OSDN Git Service

6d9c1df38ce43a9d9c2da4996a0b8af5a3c934e0
[chemicraft/chemicraft.git] / src / chemicraft / client / ClientProxy.java
1 package chemicraft.client;
2
3 import net.minecraft.src.EntityPlayer;
4 import net.minecraft.src.TileEntity;
5 import net.minecraft.src.World;
6 import net.minecraftforge.client.MinecraftForgeClient;
7 import chemicraft.ChemiCraft;
8 import chemicraft.entity.EntityAtomGrenade;
9 import chemicraft.gui.GuiChemicalCombinationTable;
10 import chemicraft.gui.GuiChemicalCraftingTable;
11 import chemicraft.gui.GuiDecompositionTable;
12 import chemicraft.gui.GuiToolAndWeaponCraftingTable;
13 import chemicraft.render.RenderAtomsGrenade;
14 import chemicraft.system.CommonProxy;
15 import chemicraft.tileentity.TileEntityChemicalCombinationTable;
16 import chemicraft.tileentity.TileEntityChemicalCraftingTable;
17 import chemicraft.tileentity.TileEntityDecompositionTable;
18 import chemicraft.tileentity.TileEntityToolAndWeaponCraftingTable;
19 import cpw.mods.fml.client.FMLClientHandler;
20 import cpw.mods.fml.client.registry.RenderingRegistry;
21
22 public class ClientProxy extends CommonProxy {
23
24         @Override
25         public void registerRenderInformation() {
26                 MinecraftForgeClient.preloadTexture(ChemiCraft.instance.blockChemicalCraftingTableTexture);
27                 MinecraftForgeClient.preloadTexture(ChemiCraft.instance.itemAtomsTexture);
28                 MinecraftForgeClient.preloadTexture(ChemiCraft.instance.itemCompoundsTexture);
29                 MinecraftForgeClient.preloadTexture(ChemiCraft.instance.itemTexture);
30                 MinecraftForgeClient.preloadTexture(ChemiCraft.instance.guiChemicalCombinationTexture);
31                 MinecraftForgeClient.preloadTexture(ChemiCraft.instance.guiDecompositionTexture);
32                 MinecraftForgeClient.preloadTexture(ChemiCraft.instance.guiChemicalCraftingTexture);
33                 MinecraftForgeClient.preloadTexture(ChemiCraft.instance.guiToolAndWeaponCraftingTexture);
34                 RenderingRegistry.registerEntityRenderingHandler(EntityAtomGrenade.class, new RenderAtomsGrenade(0.5F));
35         }
36
37
38         @Override
39         public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
40                 if (!world.blockExists(x, y, z))
41                         return null;
42
43                 TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
44                 if (tileEntity instanceof TileEntityDecompositionTable) {
45                         return new GuiDecompositionTable(player, (TileEntityDecompositionTable) tileEntity);
46                 }else if(tileEntity instanceof TileEntityChemicalCombinationTable){
47                         return new GuiChemicalCombinationTable(player, (TileEntityChemicalCombinationTable) tileEntity);
48                 }else if(tileEntity instanceof TileEntityToolAndWeaponCraftingTable){
49                         return new GuiToolAndWeaponCraftingTable(player, (TileEntityToolAndWeaponCraftingTable) tileEntity);
50                 }else if(tileEntity instanceof TileEntityChemicalCraftingTable){
51                         return new GuiChemicalCraftingTable(player, (TileEntityChemicalCraftingTable) tileEntity);
52                 }
53                 return null;
54         }
55
56
57         @Override
58         public World getClientWorld() {
59                 return FMLClientHandler.instance().getClient().theWorld;
60         }
61
62 }