OSDN Git Service

1d19a1010590d47a2e10b60b68fc0cd0bbb4d5b9
[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.entity.player.EntityPlayer;
6 import net.minecraft.tileentity.TileEntity;
7 import net.minecraft.world.World;
8 import pcc.chemicraft.ChemiCraft;
9 import pcc.chemicraft.core.ChemiCraftCore;
10 import pcc.chemicraft.core.tileentity.TileEntityChemicalCombinationTable;
11
12 public class BlockChemicalCombinationTable extends BlockContainer {
13
14         public BlockChemicalCombinationTable(int par1, int par2, Material par3Material) {
15                 super(par1, par2, par3Material);
16                 this.setCreativeTab(ChemiCraftCore.creativeTabChemiCraft);
17         }
18
19         @Override
20         public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) {
21                 par5EntityPlayer.openGui(ChemiCraftCore.instance, ChemiCraftCore.instance.guiChemicalCombinationTableID, par1World, par2, par3, par4);
22                 return true;
23         }
24
25
26
27         @Override
28         public String getTextureFile() {
29                 return ChemiCraft.BLOCK_CHEMICAL_CRAFTING_TABLE_TEXTURE;
30         }
31
32
33
34         public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, int par5) {
35                 if (!par1World.isRemote) {
36                         boolean var7 = par1World.isBlockIndirectlyGettingPowered(par2, par3, par4);
37                         if(var7) {
38                                 TileEntityChemicalCombinationTable tileentity;
39                                 try {
40                                         tileentity = (TileEntityChemicalCombinationTable) par1World.getBlockTileEntity(par2, par3, par4);
41                                 } catch(ClassCastException e) {
42                                         return;
43                                 }
44                                 tileentity.setProvidePower(true);
45                         }
46                 }
47         }
48
49
50
51         @Override
52         public int getBlockTextureFromSide(int par1) {
53                 if(par1 == 0){
54                         return 17;
55                 }else if(par1 == 1){
56                         return this.blockIndexInTexture;
57                 }else{
58                         return 16;
59                 }
60         }
61
62         @Override
63         public TileEntity createNewTileEntity(World var1) {
64                 return new TileEntityChemicalCombinationTable();
65         }
66
67 }