OSDN Git Service

(・∀・)
[chemicraft/chemicraft.git] / common / pcc / chemicraft / core / block / BlockChemicalCombinationTable.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.tileentity.TileEntityChemicalCombinationTable;
12
13 public class BlockChemicalCombinationTable extends BlockContainer {
14
15         public Icon topIcon;
16         public Icon bottomIcon;
17         public Icon globalIcon;
18
19         public BlockChemicalCombinationTable(int par1, Material par2Material) {
20                 super(par1, par2Material);
21                 this.setCreativeTab(ChemiCraftCore.creativeTabChemiCraft);
22         }
23
24         @Override
25         public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) {
26                 par5EntityPlayer.openGui(ChemiCraftCore.instance, ChemiCraftCore.instance.guiChemicalCombinationTableID, par1World, par2, par3, par4);
27                 return true;
28         }
29
30
31
32         @Override
33         public void registerIcons(IconRegister par1IconRegister) {
34         }
35
36
37
38         public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, int par5) {
39                 if (!par1World.isRemote) {
40                         boolean var7 = par1World.isBlockIndirectlyGettingPowered(par2, par3, par4);
41                         if(var7) {
42                                 TileEntityChemicalCombinationTable tileentity;
43                                 try {
44                                         tileentity = (TileEntityChemicalCombinationTable) par1World.getBlockTileEntity(par2, par3, par4);
45                                 } catch(ClassCastException e) {
46                                         return;
47                                 }
48                                 tileentity.setProvidePower(true);
49                         }
50                 }
51         }
52
53
54
55         @Override
56         public Icon getBlockTextureFromSideAndMetadata(int par1, int par2) {
57                 if(par1 == 0){
58                         return this.topIcon;
59                 }else if(par1 == 1){
60                         return this.bottomIcon;
61                 }else{
62                         return this.globalIcon;
63                 }
64         }
65
66         @Override
67         public TileEntity createNewTileEntity(World var1) {
68                 return new TileEntityChemicalCombinationTable();
69         }
70
71 }