OSDN Git Service

ChemiCraft.java修正
[chemicraft/chemicraft.git] / common / chemicraft / client / ClientProxy.java
1 package chemicraft.client;
2
3 import net.minecraft.entity.player.EntityPlayer;
4 import net.minecraft.tileentity.TileEntity;
5 import net.minecraft.world.World;
6 import net.minecraftforge.client.MinecraftForgeClient;
7 import chemicraft.ChemiCraft;
8 import chemicraft.debug.DebugTick;
9 import chemicraft.entity.EntityAtomsGrenade;
10 import chemicraft.gui.GuiChemicalCombinationTable;
11 import chemicraft.gui.GuiChemicalCraftingTable;
12 import chemicraft.gui.GuiElectrolysisTable;
13 import chemicraft.gui.GuiPyrolysisTable;
14 import chemicraft.gui.GuiToolAndWeaponCraftingTable;
15 import chemicraft.render.RenderAtomsGrenade;
16 import chemicraft.system.CommonProxy;
17 import chemicraft.tileentity.TileEntityChemicalCombinationTable;
18 import chemicraft.tileentity.TileEntityChemicalCraftingTable;
19 import chemicraft.tileentity.TileEntityElectrolysisTable;
20 import chemicraft.tileentity.TileEntityPyrolysisTable;
21 import chemicraft.tileentity.TileEntityToolAndWeaponCraftingTable;
22 import cpw.mods.fml.client.FMLClientHandler;
23 import cpw.mods.fml.client.registry.RenderingRegistry;
24 import cpw.mods.fml.common.registry.TickRegistry;
25 import cpw.mods.fml.relauncher.Side;
26
27 public class ClientProxy extends CommonProxy {
28
29         @Override
30         public void registerRenderInformation() {
31                 MinecraftForgeClient.preloadTexture(ChemiCraft.instance.BLOCK_CHEMICALCRAFTING_TABLE_TEXTURE);
32                 MinecraftForgeClient.preloadTexture(ChemiCraft.instance.ITEM_ATOMS_TEXTURE);
33                 MinecraftForgeClient.preloadTexture(ChemiCraft.instance.ITEM_COMPOUNDS_TEXTURE);
34                 MinecraftForgeClient.preloadTexture(ChemiCraft.instance.ITEM_TEXTURE);
35                 MinecraftForgeClient.preloadTexture(ChemiCraft.instance.GUI_CHEMICALCOMBINATION_TEXTURE);
36                 MinecraftForgeClient.preloadTexture(ChemiCraft.instance.GUI_PYROLYSIS_TEXTURE);
37                 MinecraftForgeClient.preloadTexture(ChemiCraft.instance.GUI_CHEMICALCRAFTING_TEXTURE);
38                 MinecraftForgeClient.preloadTexture(ChemiCraft.instance.GUI_TOOLANDWEAPONCRAFTING_TEXTURE);
39                 RenderingRegistry.registerEntityRenderingHandler(EntityAtomsGrenade.class, new RenderAtomsGrenade(0.5F));
40         }
41
42
43         @Override
44         public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
45                 if (!world.blockExists(x, y, z))
46                         return null;
47
48                 TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
49                 if (tileEntity instanceof TileEntityPyrolysisTable) {
50                         return new GuiPyrolysisTable(player, (TileEntityPyrolysisTable) tileEntity);
51                 }else if(tileEntity instanceof TileEntityChemicalCombinationTable){
52                         return new GuiChemicalCombinationTable(player, (TileEntityChemicalCombinationTable) tileEntity);
53                 }else if(tileEntity instanceof TileEntityToolAndWeaponCraftingTable){
54                         return new GuiToolAndWeaponCraftingTable(player, (TileEntityToolAndWeaponCraftingTable) tileEntity);
55                 }else if(tileEntity instanceof TileEntityChemicalCraftingTable){
56                         return new GuiChemicalCraftingTable(player, (TileEntityChemicalCraftingTable) tileEntity);
57                 } else if (tileEntity instanceof TileEntityElectrolysisTable) {
58                         return new GuiElectrolysisTable(player, (TileEntityElectrolysisTable) tileEntity);
59                 }
60                 return null;
61         }
62
63
64         @Override
65         public World getClientWorld() {
66                 return FMLClientHandler.instance().getClient().theWorld;
67         }
68
69         @Override
70         public void registerTickHandler() {
71                 TickRegistry.registerTickHandler(new DebugTick(), Side.CLIENT);
72         }
73
74 }