OSDN Git Service

128a4fdf1ca31d97e23bb54cabef7978d695ee1f
[chemicraft/chemicraft.git] / common / pcc / chemicraft / client / ClientProxy.java
1 package pcc.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 pcc.chemicraft.ChemiCraft;
8 import pcc.chemicraft.debug.DebugTick;
9 import pcc.chemicraft.entity.EntityAtomsGrenade;
10 import pcc.chemicraft.gui.GuiChemicalCombinationTable;
11 import pcc.chemicraft.gui.GuiChemicalCraftingTable;
12 import pcc.chemicraft.gui.GuiElectrolysisTable;
13 import pcc.chemicraft.gui.GuiPyrolysisTable;
14 import pcc.chemicraft.gui.GuiToolAndWeaponCraftingTable;
15 import pcc.chemicraft.render.RenderAtomsGrenade;
16 import pcc.chemicraft.system.CommonProxy;
17 import pcc.chemicraft.tileentity.TileEntityChemicalCombinationTable;
18 import pcc.chemicraft.tileentity.TileEntityChemicalCraftingTable;
19 import pcc.chemicraft.tileentity.TileEntityElectrolysisTable;
20 import pcc.chemicraft.tileentity.TileEntityPyrolysisTable;
21 import pcc.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.BLOCKCHEMICALCRAFTINGTABLETEXTURE);
32                 MinecraftForgeClient.preloadTexture(ChemiCraft.instance.ITEMATOMSTEXTURE);
33                 MinecraftForgeClient.preloadTexture(ChemiCraft.instance.ITEMCOMPOUNDSTEXTURE);
34                 MinecraftForgeClient.preloadTexture(ChemiCraft.instance.ITEMTEXTURE);
35                 MinecraftForgeClient.preloadTexture(ChemiCraft.instance.GUIPYROLYSISTEXTURE);
36                 MinecraftForgeClient.preloadTexture(ChemiCraft.instance.GUIELECTROLYSISTEXTURE);
37                 MinecraftForgeClient.preloadTexture(ChemiCraft.instance.GUICHEMICALCOMBINATIONTEXTURE);
38                 MinecraftForgeClient.preloadTexture(ChemiCraft.instance.GUICHEMICALCRAFTINGTEXTURE);
39                 MinecraftForgeClient.preloadTexture(ChemiCraft.instance.GUITOOLANDWEAPONCRAFTINGTEXTURE);
40                 RenderingRegistry.registerEntityRenderingHandler(EntityAtomsGrenade.class, new RenderAtomsGrenade(0.5F));
41         }
42
43
44         @Override
45         public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
46                 if (!world.blockExists(x, y, z))
47                         return null;
48
49                 TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
50                 if (tileEntity instanceof TileEntityPyrolysisTable) {
51                         return new GuiPyrolysisTable(player, (TileEntityPyrolysisTable) tileEntity);
52                 }else if(tileEntity instanceof TileEntityElectrolysisTable){
53                         return new GuiElectrolysisTable(player, (TileEntityElectrolysisTable) tileEntity);
54                 }else if(tileEntity instanceof TileEntityChemicalCombinationTable){
55                         return new GuiChemicalCombinationTable(player, (TileEntityChemicalCombinationTable) tileEntity);
56                 }else if(tileEntity instanceof TileEntityToolAndWeaponCraftingTable){
57                         return new GuiToolAndWeaponCraftingTable(player, (TileEntityToolAndWeaponCraftingTable) tileEntity);
58                 }else if(tileEntity instanceof TileEntityChemicalCraftingTable){
59                         return new GuiChemicalCraftingTable(player, (TileEntityChemicalCraftingTable) tileEntity);
60                 }
61                 return null;
62         }
63
64
65         @Override
66         public World getClientWorld() {
67                 return FMLClientHandler.instance().getClient().theWorld;
68         }
69
70         @Override
71         public void registerTickHandler() {
72                 TickRegistry.registerTickHandler(new DebugTick(), Side.CLIENT);
73         }
74
75 }