OSDN Git Service

鉱石の生成頻度をEnumでも指定できるように変更
[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.container.ContainerElectrolysisTable;
9 import pcc.chemicraft.debug.DebugTick;
10 import pcc.chemicraft.entity.EntityAtomsGrenade;
11 import pcc.chemicraft.gui.GuiChemicalCombinationTable;
12 import pcc.chemicraft.gui.GuiChemicalCraftingTable;
13 import pcc.chemicraft.gui.GuiElectrolysisTable;
14 import pcc.chemicraft.gui.GuiPyrolysisTable;
15 import pcc.chemicraft.gui.GuiToolAndWeaponCraftingTable;
16 import pcc.chemicraft.render.RenderAtomsGrenade;
17 import pcc.chemicraft.system.CommonProxy;
18 import pcc.chemicraft.tileentity.TileEntityChemicalCombinationTable;
19 import pcc.chemicraft.tileentity.TileEntityChemicalCraftingTable;
20 import pcc.chemicraft.tileentity.TileEntityElectrolysisTable;
21 import pcc.chemicraft.tileentity.TileEntityPyrolysisTable;
22 import pcc.chemicraft.tileentity.TileEntityToolAndWeaponCraftingTable;
23 import cpw.mods.fml.client.FMLClientHandler;
24 import cpw.mods.fml.client.registry.RenderingRegistry;
25 import cpw.mods.fml.common.registry.TickRegistry;
26 import cpw.mods.fml.relauncher.Side;
27
28 public class ClientProxy extends CommonProxy {
29
30         @Override
31         public void registerRenderInformation() {
32                 MinecraftForgeClient.preloadTexture(ChemiCraft.instance.BLOCK_CHEMICAL_CRAFTING_TABLE_TEXTURE);
33                 MinecraftForgeClient.preloadTexture(ChemiCraft.instance.BLOCK_ATOMS_ORE_TEXTURE);
34                 MinecraftForgeClient.preloadTexture(ChemiCraft.instance.ITEM_ATOMS_TEXTURE);
35                 MinecraftForgeClient.preloadTexture(ChemiCraft.instance.ITEM_COMPOUNDS_TEXTURE);
36                 MinecraftForgeClient.preloadTexture(ChemiCraft.instance.ITEM_TEXTURE);
37                 MinecraftForgeClient.preloadTexture(ChemiCraft.instance.GUI_PYROLYSIS_TEXTURE);
38                 MinecraftForgeClient.preloadTexture(ChemiCraft.instance.GUI_ELECTROLYSIS_TEXTURE);
39                 MinecraftForgeClient.preloadTexture(ChemiCraft.instance.GUI_CHEMICALCOMBINATION_TEXTURE);
40                 MinecraftForgeClient.preloadTexture(ChemiCraft.instance.GUI_CHEMICALCRAFTING_TEXTURE);
41                 MinecraftForgeClient.preloadTexture(ChemiCraft.instance.GUI_TOOLANDWEAPONCRAFTING_TEXTURE);
42                 RenderingRegistry.registerEntityRenderingHandler(EntityAtomsGrenade.class, new RenderAtomsGrenade(0.5F));
43         }
44
45
46         @Override
47         public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
48                 if (!world.blockExists(x, y, z))
49                         return null;
50
51                 TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
52                 if (tileEntity instanceof TileEntityPyrolysisTable) {
53                         return new GuiPyrolysisTable(player, (TileEntityPyrolysisTable) tileEntity);
54                 }else if(tileEntity instanceof TileEntityElectrolysisTable){
55                         return new GuiElectrolysisTable(player, (TileEntityElectrolysisTable) tileEntity);
56                 }else if(tileEntity instanceof TileEntityChemicalCombinationTable){
57                         return new GuiChemicalCombinationTable(player, (TileEntityChemicalCombinationTable) tileEntity);
58                 }else if(tileEntity instanceof TileEntityToolAndWeaponCraftingTable){
59                         return new GuiToolAndWeaponCraftingTable(player, (TileEntityToolAndWeaponCraftingTable) tileEntity);
60                 }else if(tileEntity instanceof TileEntityChemicalCraftingTable){
61                         return new GuiChemicalCraftingTable(player, (TileEntityChemicalCraftingTable) tileEntity);
62                 } else if (tileEntity instanceof TileEntityElectrolysisTable) {
63                         return new ContainerElectrolysisTable(player, (TileEntityElectrolysisTable) tileEntity);
64                 }
65                 return null;
66         }
67
68
69         @Override
70         public World getClientWorld() {
71                 return FMLClientHandler.instance().getClient().theWorld;
72         }
73
74         @Override
75         public void registerTickHandler() {
76                 TickRegistry.registerTickHandler(new DebugTick(), Side.CLIENT);
77         }
78
79 }