1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
|
package jp.plusplus.fbs.block;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import jp.plusplus.fbs.FBS;
import jp.plusplus.fbs.Registry;
import jp.plusplus.fbs.particle.EntityGlowFX;
import jp.plusplus.fbs.tileentity.TileEntityExtractingFurnace;
import jp.plusplus.fbs.tileentity.TileEntityMirror;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.ITileEntityProvider;
import net.minecraft.block.material.Material;
import net.minecraft.client.particle.EffectRenderer;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.util.MathHelper;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import shift.mceconomy2.api.MCEconomyAPI;
import shift.sextiarysector.block.BlockMonitor;
import java.util.ArrayList;
import java.util.Random;
import static net.minecraftforge.common.util.ForgeDirection.UP;
/**
* Createdby pluslus_Fon 2015/06/24.
*/
public class BlockMirror extends BlockBase implements ITileEntityProvider{
public BlockMirror() {
super(Material.rock);
setBlockName("mirror");
setBlockTextureName("mirror");
setHardness(3.5F);
setStepSound(soundTypeGlass);
infoName="mirror";
infoRow=1;
}
@Override
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
return new TileEntityMirror();
}
@Override
public boolean canPlaceTorchOnTop(World par1World, int par2, int par3, int par4){
return false;
}
@Override
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) {
MCEconomyAPI.openShopGui(Registry.shopMCE2Id, par5EntityPlayer, par1World, par2, par3, par4);
return true;
}
@Override
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entity, ItemStack item) {
int l = MathHelper.floor_double((double) (entity.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
if (l == 0) {
world.setBlockMetadataWithNotify(x, y, z, 2, 2);
world.setBlock(x, y + 1, z, BlockCore.mirror);
world.setBlockMetadataWithNotify(x, y + 1, z, 2 | 8, 2);
}
if (l == 1) {
world.setBlockMetadataWithNotify(x, y, z, 5, 2);
world.setBlock(x,y+1,z, BlockCore.mirror);
world.setBlockMetadataWithNotify(x, y+1, z, 5|8, 2);
}
if (l == 2) {
world.setBlockMetadataWithNotify(x, y, z, 3, 2);
world.setBlock(x,y+1,z, BlockCore.mirror);
world.setBlockMetadataWithNotify(x, y+1, z, 3|8, 2);
}
if (l == 3) {
world.setBlockMetadataWithNotify(x, y, z, 4, 2);
world.setBlock(x,y+1,z, BlockCore.mirror);
world.setBlockMetadataWithNotify(x, y+1, z, 4|8, 2);
}
}
@Override
public void onBlockAdded(World world, int x, int y, int z) {
super.onBlockAdded(world, x,y,z);
}
public void breakBlock(World world, int x, int y, int z, Block p_149749_5_, int meta) {
world.removeTileEntity(x,y,z);
if((meta&8)!=0 && world.getBlock(x,y-1,z)==BlockCore.mirror) world.func_147480_a(x,y-1,z, true);
else if(world.getBlock(x,y+1,z)==BlockCore.mirror) world.func_147480_a(x,y+1,z, false);
}
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune){
if((metadata&8)!=0) return new ArrayList<ItemStack>();
return super.getDrops(world, x,y,z,metadata,fortune);
}
public boolean canPlaceBlockAt(World world, int x, int y, int z) {
return world.getBlock(x, y, z).isReplaceable(world, x, y, z) && world.getBlock(x, y+1, z).isReplaceable(world, x, y+1, z);
}
@Override
public int getRenderType(){
return FBS.renderMirrorId;
}
@Override
public boolean renderAsNormalBlock(){
return false;
}
@Override
public boolean isOpaqueCube() {
return false;
}
@SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(IBlockAccess p_149646_1_, int p_149646_2_, int p_149646_3_, int p_149646_4_, int p_149646_5_) {
return true;
}
}
|