OSDN Git Service

f0b41f4908f3c6e7b3d21f21c35612b4abaa767d
[chemicraft/chemicraft.git] / common / pcc / chemicraft / block / BlockElectrolysisTable.java
1 package pcc.chemicraft.block;
2
3 import net.minecraft.block.BlockContainer;
4 import net.minecraft.block.material.Material;
5 import net.minecraft.entity.player.EntityPlayer;
6 import net.minecraft.tileentity.TileEntity;
7 import net.minecraft.world.World;
8 import pcc.chemicraft.ChemiCraft;
9 import pcc.chemicraft.debug.DebugTick;
10 import pcc.chemicraft.tileentity.TileEntityElectrolysisTable;
11
12 public class BlockElectrolysisTable extends BlockContainer
13 {
14
15         public BlockElectrolysisTable(int par1, int par2, Material par3Material)
16         {
17                 super(par1, par2, par3Material);
18                 this.setCreativeTab(ChemiCraft.creativeTab);
19         }
20
21         @Override
22         public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9)
23         {
24                 par5EntityPlayer.openGui(ChemiCraft.instance, ChemiCraft.instance.guiElectrolysisTableID, par1World, par2, par3, par4);
25                 return true;
26         }
27
28         @Override
29         public String getTextureFile()
30         {
31                 return ChemiCraft.instance.BLOCKCHEMICALCRAFTINGTABLETEXTURE;
32         }
33
34         @Override
35         public void breakBlock(World par1World, int par2, int par3, int par4, int par5, int par6)
36         {
37                 TileEntity tileentity = par1World.getBlockTileEntity(par2, par3, par4);
38                 if (tileentity != null) {
39                         DebugTick.removeDebugData("ElectrolysisTable" + "(x:" + tileentity.xCoord + " y:" + tileentity.yCoord + " z:" + tileentity.zCoord + ")");
40                 }
41                 super.breakBlock(par1World, par2, par3, par4, par5, par6);
42         }
43
44         @Override
45         public int getBlockTextureFromSide(int par1)
46         {
47                 if (par1 == 0) {
48                         return 17;
49                 } else if (par1 == 1) {
50                         return this.blockIndexInTexture;
51                 } else {
52                         return 16;
53                 }
54         }
55
56         @Override
57         public TileEntity createNewTileEntity(World var1)
58         {
59                 return new TileEntityElectrolysisTable();
60         }
61
62 }