OSDN Git Service

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