Some tweaks to the code layout. The common proxy should *not* have client gui code references.
This commit is contained in:
parent
f91a505a56
commit
aa0e926532
|
@ -11,12 +11,15 @@
|
|||
package cpw.mods.ironchest.client;
|
||||
|
||||
import net.minecraft.src.ChestItemRenderHelper;
|
||||
import net.minecraft.src.EntityPlayer;
|
||||
import net.minecraft.src.TileEntity;
|
||||
import net.minecraft.src.World;
|
||||
import net.minecraftforge.client.MinecraftForgeClient;
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
import cpw.mods.fml.client.registry.ClientRegistry;
|
||||
import cpw.mods.ironchest.CommonProxy;
|
||||
import cpw.mods.ironchest.IronChestType;
|
||||
import cpw.mods.ironchest.TileEntityIronChest;
|
||||
|
||||
public class ClientProxy extends CommonProxy {
|
||||
@Override
|
||||
|
@ -35,4 +38,15 @@ public class ClientProxy extends CommonProxy {
|
|||
public World getClientWorld() {
|
||||
return FMLClientHandler.instance().getClient().theWorld;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
TileEntity te = world.getBlockTileEntity(x, y, z);
|
||||
if (te != null && te instanceof TileEntityIronChest) {
|
||||
return GUIChest.GUI.buildGUI(IronChestType.values()[ID], player.inventory, (TileEntityIronChest) te);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ public enum ChestChangerType {
|
|||
}
|
||||
|
||||
public ItemChestChanger buildItem(Configuration cfg, int id) {
|
||||
int itemId = cfg.getOrCreateIntProperty(itemName, Configuration.CATEGORY_ITEM, id).getInt(id);
|
||||
int itemId = cfg.get(Configuration.CATEGORY_ITEM, itemName, id).getInt(id);
|
||||
item = new ItemChestChanger(itemId, this);
|
||||
return item;
|
||||
}
|
||||
|
|
|
@ -10,11 +10,10 @@
|
|||
******************************************************************************/
|
||||
package cpw.mods.ironchest;
|
||||
|
||||
import cpw.mods.fml.common.network.IGuiHandler;
|
||||
import net.minecraft.src.EntityPlayer;
|
||||
import net.minecraft.src.TileEntity;
|
||||
import net.minecraft.src.World;
|
||||
import cpw.mods.fml.common.network.IGuiHandler;
|
||||
import cpw.mods.ironchest.client.GUIChest;
|
||||
|
||||
|
||||
public class CommonProxy implements IGuiHandler {
|
||||
|
@ -30,12 +29,7 @@ public class CommonProxy implements IGuiHandler {
|
|||
|
||||
@Override
|
||||
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
TileEntity te = world.getBlockTileEntity(x, y, z);
|
||||
if (te != null && te instanceof TileEntityIronChest) {
|
||||
return GUIChest.GUI.buildGUI(IronChestType.values()[ID], player.inventory, (TileEntityIronChest) te);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -29,10 +29,9 @@ import cpw.mods.fml.common.network.NetworkRegistry;
|
|||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.common.registry.LanguageRegistry;
|
||||
|
||||
@Mod(modid = "IronChest", name = "Iron Chests", dependencies="required-after:FML@[3.1.15,)")
|
||||
@NetworkMod(channels = { "IronChest" }, versionBounds = "[4.0,)", clientSideRequired = true, serverSideRequired = false, packetHandler = PacketHandler.class)
|
||||
@Mod(modid = "IronChest", name = "Iron Chests", dependencies="required-after:FML@[4.0,)")
|
||||
@NetworkMod(channels = { "IronChest" }, versionBounds = "[4.1,)", clientSideRequired = true, serverSideRequired = false, packetHandler = PacketHandler.class)
|
||||
public class IronChest {
|
||||
|
||||
public static BlockIronChest ironChestBlock;
|
||||
@SidedProxy(clientSide = "cpw.mods.ironchest.client.ClientProxy", serverSide = "cpw.mods.ironchest.CommonProxy")
|
||||
public static CommonProxy proxy;
|
||||
|
@ -49,10 +48,10 @@ public class IronChest {
|
|||
Configuration cfg = new Configuration(event.getSuggestedConfigurationFile());
|
||||
try {
|
||||
cfg.load();
|
||||
blockId = cfg.getOrCreateBlockIdProperty("ironChests", 181).getInt(181);
|
||||
blockId = cfg.get(Configuration.CATEGORY_BLOCK, "ironChests", 181).getInt(181);
|
||||
ChestChangerType.buildItems(cfg, 29501);
|
||||
CACHE_RENDER = cfg.getOrCreateBooleanProperty("cacheRenderingInformation", Configuration.CATEGORY_GENERAL, true).getBoolean(true);
|
||||
OCELOTS_SITONCHESTS = cfg.getOrCreateBooleanProperty("ocelotsSitOnChests", Configuration.CATEGORY_GENERAL, true).getBoolean(true);
|
||||
CACHE_RENDER = cfg.get(Configuration.CATEGORY_GENERAL, "cacheRenderingInformation", true).getBoolean(true);
|
||||
OCELOTS_SITONCHESTS = cfg.get(Configuration.CATEGORY_GENERAL, "ocelotsSitOnChests", true).getBoolean(true);
|
||||
} catch (Exception e) {
|
||||
FMLLog.log(Level.SEVERE, e, "IronChest has a problem loading it's configuration");
|
||||
} finally {
|
||||
|
|
Loading…
Reference in New Issue