OSDN Git Service

d001c822dcf62c8767fceaf704ce2c3c9d475fef
[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.gui.GuiPyrolysisTable;
10 import chemicraft.tileentity.TileEntityPyrolysisTable;
11 import cpw.mods.fml.client.FMLClientHandler;
12 import cpw.mods.fml.client.registry.RenderingRegistry;
13 import cpw.mods.fml.common.registry.TickRegistry;
14 import cpw.mods.fml.relauncher.Side;
15
16 public class ClientProxy extends CommonProxy {
17
18         @Override
19         public void registerRenderInformation() {
20                 MinecraftForgeClient.preloadTexture(ChemiCraft.instance.blockChemicalCraftingTableTexture);
21                 MinecraftForgeClient.preloadTexture(ChemiCraft.instance.itemAtomsTexture);
22                 MinecraftForgeClient.preloadTexture(ChemiCraft.instance.itemCompoundsTexture);
23                 MinecraftForgeClient.preloadTexture(ChemiCraft.instance.itemTexture);
24                 MinecraftForgeClient.preloadTexture(ChemiCraft.instance.guiChemicalCombinationTexture);
25                 MinecraftForgeClient.preloadTexture(ChemiCraft.instance.guiPyrolysisTexture);
26                 MinecraftForgeClient.preloadTexture(ChemiCraft.instance.guiChemicalCraftingTexture);
27                 MinecraftForgeClient.preloadTexture(ChemiCraft.instance.guiToolAndWeaponCraftingTexture);
28                 RenderingRegistry.registerEntityRenderingHandler(EntityAtomsGrenade.class, new RenderAtomsGrenade(0.5F));
29         }
30
31
32         @Override
33         public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
34                 if (!world.blockExists(x, y, z))
35                         return null;
36
37                 TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
38                 if (tileEntity instanceof TileEntityPyrolysisTable) {
39                         return new GuiPyrolysisTable(player, (TileEntityPyrolysisTable) tileEntity);
40                 }else if(tileEntity instanceof TileEntityChemicalCombinationTable){
41                         return new GuiChemicalCombinationTable(player, (TileEntityChemicalCombinationTable) tileEntity);
42                 }else if(tileEntity instanceof TileEntityToolAndWeaponCraftingTable){
43                         return new GuiToolAndWeaponCraftingTable(player, (TileEntityToolAndWeaponCraftingTable) tileEntity);
44                 }else if(tileEntity instanceof TileEntityChemicalCraftingTable){
45                         return new GuiChemicalCraftingTable(player, (TileEntityChemicalCraftingTable) tileEntity);
46                 }
47                 return null;
48         }
49
50
51         @Override
52         public World getClientWorld() {
53                 return FMLClientHandler.instance().getClient().theWorld;
54         }
55
56         @Override
57         public void registerTickHandler() {
58                 TickRegistry.registerTickHandler(new DebugTick(), Side.CLIENT);
59         }
60
61 }