OSDN Git Service

a2962070a42e667d0c94dc4a7e88ec5311994d0e
[chemicraft/chemicraft.git] / common / pcc / chemicraft / core / client / ClientProxy.java
1 package pcc.chemicraft.core.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 pcc.chemicraft.ChemiCraft;
8 import pcc.chemicraft.core.container.ContainerElectrolysisTable;
9 import pcc.chemicraft.core.debug.DebugTick;
10 import pcc.chemicraft.core.gui.GuiChemicalCombinationTable;
11 import pcc.chemicraft.core.gui.GuiChemicalCraftingTable;
12 import pcc.chemicraft.core.gui.GuiElectrolysisTable;
13 import pcc.chemicraft.core.gui.GuiPyrolysisTable;
14 import pcc.chemicraft.core.gui.GuiToolAndWeaponCraftingTable;
15 import pcc.chemicraft.core.system.CommonProxy;
16 import pcc.chemicraft.core.tileentity.TileEntityChemicalCombinationTable;
17 import pcc.chemicraft.core.tileentity.TileEntityChemicalCraftingTable;
18 import pcc.chemicraft.core.tileentity.TileEntityElectrolysisTable;
19 import pcc.chemicraft.core.tileentity.TileEntityPyrolysisTable;
20 import pcc.chemicraft.core.tileentity.TileEntityToolAndWeaponCraftingTable;
21 import cpw.mods.fml.client.FMLClientHandler;
22 import cpw.mods.fml.common.registry.TickRegistry;
23 import cpw.mods.fml.relauncher.Side;
24
25 public class ClientProxy extends CommonProxy {
26
27         @Override
28         public void registerRenderInformation() {
29                 MinecraftForgeClient.preloadTexture(ChemiCraft.BLOCK_CHEMICAL_CRAFTING_TABLE_TEXTURE);
30                 MinecraftForgeClient.preloadTexture(ChemiCraft.BLOCK_ATOMS_ORE_TEXTURE);
31                 MinecraftForgeClient.preloadTexture(ChemiCraft.ITEM_ATOMS_TEXTURE);
32                 MinecraftForgeClient.preloadTexture(ChemiCraft.ITEM_COMPOUNDS_TEXTURE);
33                 MinecraftForgeClient.preloadTexture(ChemiCraft.ITEM_TEXTURE);
34                 MinecraftForgeClient.preloadTexture(ChemiCraft.GUI_PYROLYSIS_TEXTURE);
35                 MinecraftForgeClient.preloadTexture(ChemiCraft.GUI_ELECTROLYSIS_TEXTURE);
36                 MinecraftForgeClient.preloadTexture(ChemiCraft.GUI_CHEMICALCOMBINATION_TEXTURE);
37                 MinecraftForgeClient.preloadTexture(ChemiCraft.GUI_CHEMICALCRAFTING_TEXTURE);
38                 MinecraftForgeClient.preloadTexture(ChemiCraft.GUI_TOOLANDWEAPONCRAFTING_TEXTURE);
39                 MinecraftForgeClient.preloadTexture(ChemiCraft.ENTITY_PARTICLE_TEXRURE);
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 TileEntityElectrolysisTable){
52                         return new GuiElectrolysisTable(player, (TileEntityElectrolysisTable) tileEntity);
53                 }else if(tileEntity instanceof TileEntityChemicalCombinationTable){
54                         return new GuiChemicalCombinationTable(player, (TileEntityChemicalCombinationTable) tileEntity);
55                 }else if(tileEntity instanceof TileEntityToolAndWeaponCraftingTable){
56                         return new GuiToolAndWeaponCraftingTable(player, (TileEntityToolAndWeaponCraftingTable) tileEntity);
57                 }else if(tileEntity instanceof TileEntityChemicalCraftingTable){
58                         return new GuiChemicalCraftingTable(player, (TileEntityChemicalCraftingTable) tileEntity);
59                 } else if (tileEntity instanceof TileEntityElectrolysisTable) {
60                         return new ContainerElectrolysisTable(player, (TileEntityElectrolysisTable) tileEntity);
61                 }
62                 return null;
63         }
64
65
66         @Override
67         public World getClientWorld() {
68                 return FMLClientHandler.instance().getClient().theWorld;
69         }
70
71         @Override
72         public void registerTickHandler() {
73                 TickRegistry.registerTickHandler(new DebugTick(), Side.CLIENT);
74         }
75
76 }