diff --git a/IronChests2/.gitignore b/IronChests2/.gitignore index 2dbd679..57a8e50 100644 --- a/IronChests2/.gitignore +++ b/IronChests2/.gitignore @@ -5,4 +5,5 @@ bin/ /build.properties /build /ironchestversion.properties +/version.properties /tmpbukkit diff --git a/IronChests2/.project b/IronChests2/.project index d59bcf7..594c34b 100644 --- a/IronChests2/.project +++ b/IronChests2/.project @@ -15,15 +15,15 @@ org.eclipse.jdt.core.javanature - - common/ironchestversion.properties - 1 - PROJECT_LOC/ironchestversion.properties - common/mcmod.info 1 - PROJECT_LOC/mcmod.info + /home/cpw/projects/gitstores/ironchests/IronChests2/mcmod.info + + + common/version.properties + 1 + /home/cpw/projects/gitstores/ironchests/IronChests2/version.properties diff --git a/IronChests2/build.xml b/IronChests2/build.xml index 6eeb372..d417bd3 100644 --- a/IronChests2/build.xml +++ b/IronChests2/build.xml @@ -21,9 +21,6 @@ - - - @@ -31,8 +28,9 @@ - - + + + @@ -52,11 +50,6 @@ - - - - - @@ -66,7 +59,6 @@ - @@ -76,17 +68,17 @@ - - - - - - + + + + + + + - @@ -125,6 +117,7 @@ + @@ -136,7 +129,7 @@ - + @@ -176,28 +169,7 @@ - - - - - - - - - - - - - - - - - - - - - - + diff --git a/IronChests2/client/cpw/mods/ironchest/client/TileEntityIronChestRenderer.java b/IronChests2/client/cpw/mods/ironchest/client/TileEntityIronChestRenderer.java index d4cd0e7..199df1c 100644 --- a/IronChests2/client/cpw/mods/ironchest/client/TileEntityIronChestRenderer.java +++ b/IronChests2/client/cpw/mods/ironchest/client/TileEntityIronChestRenderer.java @@ -55,17 +55,8 @@ public class TileEntityIronChestRenderer extends TileEntitySpecialRenderer { private RenderBlocks renderBlocks; - private static float[][] shifts = { - { 0.3F, 0.45F, 0.3F }, - { 0.7F, 0.45F, 0.3F }, - { 0.3F, 0.45F, 0.7F }, - { 0.7F, 0.45F, 0.7F }, - { 0.3F, 0.1F, 0.3F }, - { 0.7F, 0.1F, 0.3F }, - { 0.3F, 0.1F, 0.7F }, - { 0.7F, 0.1F, 0.7F }, - { 0.5F, 0.32F, 0.5F }, - }; + private static float[][] shifts = { { 0.3F, 0.45F, 0.3F }, { 0.7F, 0.45F, 0.3F }, { 0.3F, 0.45F, 0.7F }, { 0.7F, 0.45F, 0.7F }, { 0.3F, 0.1F, 0.3F }, + { 0.7F, 0.1F, 0.3F }, { 0.3F, 0.1F, 0.7F }, { 0.7F, 0.1F, 0.7F }, { 0.5F, 0.32F, 0.5F }, }; public TileEntityIronChestRenderer() { model = new ModelChest(); @@ -73,15 +64,11 @@ public class TileEntityIronChestRenderer extends TileEntitySpecialRenderer { renderBlocks = new RenderBlocks(); } - private void overrideTexture(Object obj) - { - if (obj instanceof Item) - { - GL11.glBindTexture(GL11.GL_TEXTURE_2D, FMLClientHandler.instance().getClient().renderEngine.getTexture(((Item)obj).getTextureFile())); - } - else if (obj instanceof Block) - { - GL11.glBindTexture(GL11.GL_TEXTURE_2D, FMLClientHandler.instance().getClient().renderEngine.getTexture(((Block)obj).getTextureFile())); + private void overrideTexture(Object obj) { + if (obj instanceof Item) { + GL11.glBindTexture(GL11.GL_TEXTURE_2D, FMLClientHandler.instance().getClient().renderEngine.getTexture(((Item) obj).getTextureFile())); + } else if (obj instanceof Block) { + GL11.glBindTexture(GL11.GL_TEXTURE_2D, FMLClientHandler.instance().getClient().renderEngine.getTexture(((Block) obj).getTextureFile())); } } @@ -91,10 +78,10 @@ public class TileEntityIronChestRenderer extends TileEntitySpecialRenderer { } int facing = 3; IronChestType type = tile.getType(); - if (tile != null && tile.func_70314_l() != null) { + if (tile != null && tile.getWorldObj() != null) { facing = tile.getFacing(); type = tile.getType(); - int typ = tile.func_70314_l().getBlockMetadata(tile.xCoord, tile.yCoord, tile.zCoord); + int typ = tile.getWorldObj().getBlockMetadata(tile.xCoord, tile.yCoord, tile.zCoord); type = IronChestType.values()[typ]; } bindTextureByName(type.getModelTexture()); @@ -160,7 +147,7 @@ public class TileEntityIronChestRenderer extends TileEntitySpecialRenderer { shiftZ = shifts[shift][2]; shift++; float localScale = blockScale; - if (item.itemID < Block.blocksList.length && Block.blocksList[item.itemID] != null) { + if (item.itemID < Block.blocksList.length && Block.blocksList[item.itemID] != null && Block.blocksList[item.itemID].blockID != 0) { int j = Block.blocksList[item.itemID].getRenderType(); if (j == 1 || j == 19 || j == 12 || j == 2) { localScale = 2 * blockScale; @@ -180,24 +167,28 @@ public class TileEntityIronChestRenderer extends TileEntitySpecialRenderer { } MappableItemStackWrapper mis = new MappableItemStackWrapper(item); if (!IronChest.CACHE_RENDER || !renderList.containsKey(mis)) { // Added support for using only old system. - if (IronChest.CACHE_RENDER) { - int render = glGenLists(1); - renderList.put(mis, render); - glNewList(render, GL_COMPILE_AND_EXECUTE); - } - IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(item, IItemRenderer.ItemRenderType.ENTITY); + IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(item, IItemRenderer.ItemRenderType.ENTITY); if (customRenderer != null) { customitem.item = item; bindTextureByName("/terrain.png"); overrideTexture(item.getItem()); customRenderer.renderItem(IItemRenderer.ItemRenderType.ENTITY, item, renderBlocks, customitem); - } else if (item.itemID < Block.blocksList.length && Block.blocksList[item.itemID] != null && RenderBlocks.renderItemIn3d(Block.blocksList[item.itemID].getRenderType())) { + } else if (item.itemID < Block.blocksList.length && Block.blocksList[item.itemID] != null && Block.blocksList[item.itemID].blockID != 0 && RenderBlocks.renderItemIn3d(Block.blocksList[item.itemID].getRenderType())) { bindTextureByName("/terrain.png"); overrideTexture(Block.blocksList[item.itemID]); renderBlocks.renderBlockAsItem(Block.blocksList[item.itemID], item.getItemDamage(), 1.0F); } else { + int render = 0; + if (IronChest.CACHE_RENDER) { + render = glGenLists(1); + if (render != 0) + { + renderList.put(mis, render); + glNewList(render, GL_COMPILE_AND_EXECUTE); + } + } int i = item.getIconIndex(); - if (item.itemID >= Block.blocksList.length || Block.blocksList[item.itemID] == null) { + if (item.itemID >= Block.blocksList.length || Block.blocksList[item.itemID] == null || Block.blocksList[item.itemID].blockID == 0) { bindTextureByName("/gui/items.png"); overrideTexture(Item.itemsList[item.itemID]); } else { @@ -227,9 +218,9 @@ public class TileEntityIronChestRenderer extends TileEntitySpecialRenderer { tessellator.addVertexWithUV(f13 - f14, 1.0F - f15, 0.0D, f8, f10); tessellator.addVertexWithUV(0.0F - f14, 1.0F - f15, 0.0D, f5, f10); tessellator.draw(); - } - if (IronChest.CACHE_RENDER) { - glEndList(); + if (IronChest.CACHE_RENDER && render != 0) { + glEndList(); + } } } else { Integer integer = renderList.get(mis); diff --git a/IronChests2/common/cpw/mods/ironchest/BlockIronChest.java b/IronChests2/common/cpw/mods/ironchest/BlockIronChest.java index a3cdf1d..88b82e5 100644 --- a/IronChests2/common/cpw/mods/ironchest/BlockIronChest.java +++ b/IronChests2/common/cpw/mods/ironchest/BlockIronChest.java @@ -10,7 +10,6 @@ ******************************************************************************/ package cpw.mods.ironchest; -import java.util.ArrayList; import java.util.List; import java.util.Random; @@ -41,12 +40,9 @@ public class BlockIronChest extends BlockContainer { setBlockName("IronChest"); setHardness(3.0F); setRequiresSelfNotify(); - if (id >= 256) { - disableStats(); - } setBlockBounds(0.0625F, 0F, 0.0625F, 0.9375F, 0.875F, 0.9375F); random = new Random(); - setCreativeTab(CreativeTabs.tabDeco); + setCreativeTab(CreativeTabs.tabDecorations); } @Override diff --git a/IronChests2/common/cpw/mods/ironchest/IronChest.java b/IronChests2/common/cpw/mods/ironchest/IronChest.java index d7d2176..7b0439d 100644 --- a/IronChests2/common/cpw/mods/ironchest/IronChest.java +++ b/IronChests2/common/cpw/mods/ironchest/IronChest.java @@ -10,7 +10,6 @@ ******************************************************************************/ package cpw.mods.ironchest; -import java.lang.reflect.Method; import java.util.logging.Level; import net.minecraftforge.common.Configuration; @@ -30,14 +29,14 @@ 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", version = "4.0") -@NetworkMod(channels = { "IronChest" }, clientSideRequired = true, serverSideRequired = false, packetHandler = PacketHandler.class) +@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) public class IronChest { public static BlockIronChest ironChestBlock; @SidedProxy(clientSide = "cpw.mods.ironchest.client.ClientProxy", serverSide = "cpw.mods.ironchest.CommonProxy") public static CommonProxy proxy; - @Instance + @Instance("IronChest") public static IronChest instance; public static boolean CACHE_RENDER = true; public static boolean OCELOTS_SITONCHESTS = true; @@ -45,6 +44,7 @@ public class IronChest { @PreInit public void preInit(FMLPreInitializationEvent event) { + Version.init(event.getVersionProperties()); event.getModMetadata().version = Version.fullVersionString(); Configuration cfg = new Configuration(event.getSuggestedConfigurationFile()); try { @@ -84,26 +84,5 @@ public class IronChest { @PostInit public void modsLoaded(FMLPostInitializationEvent evt) { - try { - Class equivexmaps = Class.forName("ee.EEMaps"); - Method addEMC = equivexmaps.getMethod("addEMC", int.class, int.class, int.class); - Method addMeta = equivexmaps.getMethod("addMeta", int.class, int.class); - int[] chestEMCValues = new int[] { 8 * 8 + 256 * 8, /* iron chest */ - 8 * 8 + 256 * 8 + 2048 * 8, /* gold chest */ - 2 * 8192 + 8 * 8 + 256 * 8 + 2048 * 8 + 6, /* diamond chest */ - 85 * 8 + 8 * 8, /* copper chest */ - 85 * 8 + 8 * 8 + 512 * 8, /* silver chest */ - 2 * 8192 + 8 * 8 + 256 * 8 + 2048 * 8 + 6 + 8 /* crystal chest */ - }; - for (IronChestType icType : IronChestType.values()) { - if (icType.ordinal() >= chestEMCValues.length) - break; - addEMC.invoke(null, ironChestBlock.blockID, icType.ordinal(), chestEMCValues[icType.ordinal()]); - } - addMeta.invoke(null, ironChestBlock.blockID, IronChestType.values().length - 1); - FMLLog.fine("mod_IronChest registered chests with Equivalent Exchange"); - } catch (Exception ex) { - FMLLog.fine("mod_IronChest unable to load Equivalent Exchange integration"); - } } } diff --git a/IronChests2/common/cpw/mods/ironchest/ItemChestChanger.java b/IronChests2/common/cpw/mods/ironchest/ItemChestChanger.java index d490a72..e22679f 100644 --- a/IronChests2/common/cpw/mods/ironchest/ItemChestChanger.java +++ b/IronChests2/common/cpw/mods/ironchest/ItemChestChanger.java @@ -29,7 +29,7 @@ public class ItemChestChanger extends Item { this.type=type; setIconIndex(type.ordinal()); setItemName(type.itemName); - setTabToDisplayOn(CreativeTabs.tabMisc); + setCreativeTab(CreativeTabs.tabMisc); } @Override diff --git a/IronChests2/common/cpw/mods/ironchest/OcelotsSitOnChestsHandler.java b/IronChests2/common/cpw/mods/ironchest/OcelotsSitOnChestsHandler.java index 462b2b8..70ae41a 100644 --- a/IronChests2/common/cpw/mods/ironchest/OcelotsSitOnChestsHandler.java +++ b/IronChests2/common/cpw/mods/ironchest/OcelotsSitOnChestsHandler.java @@ -15,7 +15,7 @@ public class OcelotsSitOnChestsHandler { { EntityOcelot ocelot = (EntityOcelot) evt.entityLiving; @SuppressWarnings("unchecked") - List tasks = ocelot.tasks.field_75782_a; + List tasks = ocelot.tasks.taskEntries; for (int i=0; i