Update for recent Forge/FML. Fix up a graphical bug. Require shiny new FML and Forge.

This commit is contained in:
Christian 2012-09-18 01:09:32 -04:00
parent 73422fcd5e
commit 0011616b6f
12 changed files with 78 additions and 164 deletions

View File

@ -5,4 +5,5 @@ bin/
/build.properties
/build
/ironchestversion.properties
/version.properties
/tmpbukkit

View File

@ -15,15 +15,15 @@
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
<linkedResources>
<link>
<name>common/ironchestversion.properties</name>
<type>1</type>
<locationURI>PROJECT_LOC/ironchestversion.properties</locationURI>
</link>
<link>
<name>common/mcmod.info</name>
<type>1</type>
<locationURI>PROJECT_LOC/mcmod.info</locationURI>
<location>/home/cpw/projects/gitstores/ironchests/IronChests2/mcmod.info</location>
</link>
<link>
<name>common/version.properties</name>
<type>1</type>
<location>/home/cpw/projects/gitstores/ironchests/IronChests2/version.properties</location>
</link>
</linkedResources>
</projectDescription>

View File

@ -21,9 +21,6 @@
<condition property="is.server">
<equals arg1="@{side}" arg2="server" />
</condition>
<condition property="is.bukkit">
<equals arg1="@{side}" arg2="bukkit" />
</condition>
</sequential>
</macrodef>
<target name="writeversion" depends="buildenvsetup">
@ -31,8 +28,9 @@
<arg value="${basedir}/getversion.py" />
<arg value="${mcp.home}" />
</exec>
<propertyfile file="ironchestversion.properties">
<entry key="ironchest.build.build.number" type="int" value="${version.build}"/>
<propertyfile file="version.properties">
<entry key="IronChest.build.number" type="int" value="${version.build}"/>
<entry key="IronChest.version" type="string" value="${version}"/>
</propertyfile>
</target>
@ -52,11 +50,6 @@
<condition property="python.exe" value="${mcp.home}/runtime/bin/python/python_mcp" else="python">
<os family="Windows" />
</condition>
<condition property="bukkitporting.dir" value="${env.WORKSPACE}/bukkitportingtools" else="${dev.home}/bukkitportingtools">
<isset property="env.WORKSPACE" />
</condition>
<property name="bukkit.tmpdir" location="${basedir}/tmpbukkit" />
<property name="bukkit.mcp.srcdir" location="${bukkit.tmpdir}/src" />
<property name="mcp.obfoutput" location="${mcp.home}/reobf" />
<property name="client.mcp.obfoutput" location="${mcp.obfoutput}/minecraft" />
<property name="server.mcp.obfoutput" location="${mcp.obfoutput}/minecraft_server" />
@ -66,7 +59,6 @@
<property name="common.src.dir" location="${basedir}/common" />
<property name="client.src.dir" location="${basedir}/client" />
<property name="server.src.dir" location="${basedir}/server" />
<property name="bukkit.src.dir" location="${server.src.dir}" />
<property name="deploy.dir" location="${user.home}/.minecraft/mods" />
<property name="resource.dir" location="${basedir}/resources" />
<condition property="version.build" value="${env.BUILD_NUMBER}" else="1">
@ -76,17 +68,17 @@
<target name="init" depends="buildenvsetup">
<antcall target="writeversion" />
<property file="ironchestversion.properties" />
<property name="build.number" value="${ironchest.build.major.number}.${ironchest.build.minor.number}.${ironchest.build.revision.number}" />
<property name="version.minecraft" value="${ironchest.build.mcversion}" />
<property name="version.major" value="${ironchest.build.major.number}" />
<property name="version.minor" value="${ironchest.build.minor.number}" />
<property name="version.rev" value="${ironchest.build.revision.number}" />
<property file="version.properties" />
<property name="build.number" value="${IronChest.build.major.number}.${IronChest.build.minor.number}.${IronChest.build.revision.number}" />
<property name="version.minecraft" value="${IronChest.build.mcversion}" />
<property name="version.major" value="${IronChest.build.major.number}" />
<property name="version.minor" value="${IronChest.build.minor.number}" />
<property name="version.rev" value="${IronChest.build.revision.number}" />
<property name="version" value="${version.major}.${version.minor}.${version.rev}.${version.build}" />
<antcall target="writeversion" />
</target>
<target name="clean">
<delete dir="${bukkit.tmpdir}"/>
<antcall target="clean-source">
<param name="side" value="client" />
</antcall>
@ -125,6 +117,7 @@
</target>
<target name="build-client" depends="init,clean,merge-client,buildandreobfmcp">
<antcall target="writeversion" />
<antcall target="extract-built-jar">
<param name="side" value="client" />
</antcall>
@ -136,7 +129,7 @@
<mkdir dir="${basedir}/target" />
<jar destfile="${basedir}/target/${jarname}.zip">
<fileset dir="${output}" includes="**/*.class" />
<zipfileset dir="${basedir}" includes="ironchestversion.properties"/>
<zipfileset dir="${basedir}" includes="version.properties"/>
<mappedresources>
<concat>
<fileset dir="${basedir}" includes="mcmod.info" />
@ -176,28 +169,7 @@
</delete>
</target>
<target name="merge-bukkit" depends="init">
<mkdir dir="${bukkit.tmpdir}"/>
<mkdir dir="${bukkit.mcp.srcdir}"/>
<antcall target="merge-source">
<param name="side" value="bukkit" />
</antcall>
</target>
<target name="build-bukkit" depends="init,merge-bukkit">
<property name="jarname" value="${basedir}/target/${modname}-bukkit-${version}.jar" />
<path id="bukkit.compile.ref"/>
<mkdir dir="${basedir}/target" />
<ant dir="${bukkitporting.dir}" target="convert-mcp-to-bukkit">
<reference refid="bukkit.compile.ref" />
<property name="modname" value="ironchest"/>
<property name="bukkit.output.jar" value="${jarname}"/>
<property name="bukkit.mcp.srcdir" value="${bukkit.mcp.srcdir}"/>
</ant>
<delete dir="${bukkit.tmpdir}"/>
</target>
<target name="deploy" depends="init,build-client">
<target name="deploy" depends="init,build-client">
<property name="jarname" value="${modname}-client-${version}" />
<move file="${deploy.dir}/${jarname}.zip" tofile="${deploy.dir}/${jarname}.zip.${timestamp}" failonerror="false" verbose="true" />
<copy file="${basedir}/${jarname}.zip" todir="${deploy.dir}" verbose="true" />

View File

@ -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);

View File

@ -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

View File

@ -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");
}
}
}

View File

@ -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

View File

@ -15,7 +15,7 @@ public class OcelotsSitOnChestsHandler {
{
EntityOcelot ocelot = (EntityOcelot) evt.entityLiving;
@SuppressWarnings("unchecked")
List<EntityAITaskEntry> tasks = ocelot.tasks.field_75782_a;
List<EntityAITaskEntry> tasks = ocelot.tasks.taskEntries;
for (int i=0; i<tasks.size(); i++)
{

View File

@ -334,7 +334,7 @@ public class TileEntityIronChest extends TileEntity implements IInventory {
}
@Override
public Packet getAuxillaryInfoPacket() {
public Packet getDescriptionPacket() {
return PacketHandler.getPacket(this);
}

View File

@ -6,12 +6,7 @@
******************************************************************************/
package cpw.mods.ironchest;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
import java.util.logging.Level;
import cpw.mods.fml.common.FMLCommonHandler;
public class Version {
private static String major;
@ -19,37 +14,18 @@ public class Version {
private static String rev;
private static String build;
private static String mcversion;
private static boolean loaded;
private static void init() {
InputStream stream = Version.class.getClassLoader().getResourceAsStream("ironchestversion.properties");
Properties properties = new Properties();
if (stream != null) {
try {
properties.load(stream);
major = properties.getProperty("ironchest.build.major.number");
minor = properties.getProperty("ironchest.build.minor.number");
rev = properties.getProperty("ironchest.build.revision.number");
build = properties.getProperty("ironchest.build.build.number");
mcversion = properties.getProperty("ironchest.build.mcversion");
} catch (IOException ex) {
FMLCommonHandler.instance().getFMLLogger().log(Level.SEVERE, "Could not get IronChest version information - corrupted installation detected!", ex);
throw new RuntimeException(ex);
}
static void init(Properties properties) {
if (properties != null) {
major = properties.getProperty("IronChest.build.major.number");
minor = properties.getProperty("IronChest.build.minor.number");
rev = properties.getProperty("IronChest.build.revision.number");
build = properties.getProperty("IronChest.build.number");
mcversion = properties.getProperty("IronChest.build.mcversion");
}
loaded = true;
}
public static final String version() {
if (!loaded) {
init();
}
return major+"."+minor;
}
public static String fullVersionString() {
if (!loaded) {
init();
}
return String.format("%s.%s.%s build %s for %s", major,minor,rev, build, mcversion);
return String.format("%s.%s.%s build %s", major,minor,rev, build);
}
}

View File

@ -18,22 +18,22 @@ def cmdsplit(args):
if os.sep == '\\':
args = args.replace('\\', '\\\\')
return shlex.split(args)
def cleanDirs(path):
if not os.path.isdir(path):
return
files = os.listdir(path)
if len(files):
for f in files:
fullpath = os.path.join(path, f)
if os.path.isdir(fullpath):
cleanDirs(fullpath)
files = os.listdir(path)
if len(files) == 0:
os.rmdir(path)
def main():
print("Obtaining version information from git")
cmd = "git describe --long --match='[^(jenkins)]*'"
@ -45,18 +45,17 @@ def main():
vers="v1.0-0-deadbeef"
(major,minor,rev,githash)=re.match("v(\d+).(\d+)-(\d+)-(.*)",vers).groups()
(mcpversion,mcclientversion,mcserverversion) = re.match("[.\w]+ \(data: ([.\w]+), client: ([.\w.]+), server: ([.\w.]+)\)",Commands.fullversion()).groups()
with open("ironchestversion.properties","w") as f:
f.write("%s=%s\n" %("ironchest.build.major.number",major))
f.write("%s=%s\n" %("ironchest.build.minor.number",minor))
f.write("%s=%s\n" %("ironchest.build.revision.number",rev))
f.write("%s=%s\n" %("ironchest.build.githash",githash))
f.write("%s=%s\n" %("ironchest.build.mcpversion",mcpversion))
f.write("%s=%s\n" %("ironchest.build.mcclientversion",mcclientversion))
f.write("%s=%s\n" %("ironchest.build.mcserverversion",mcserverversion))
(mcpversion,mcversion,mcserverversion) = re.match("[.\w]+ \(data: ([.\w]+), client: ([.\w.]+), server: ([.\w.]+)\)",Commands.fullversion()).groups()
with open("version.properties","w") as f:
f.write("%s=%s\n" %("IronChest.build.major.number",major))
f.write("%s=%s\n" %("IronChest.build.minor.number",minor))
f.write("%s=%s\n" %("IronChest.build.revision.number",rev))
f.write("%s=%s\n" %("IronChest.build.githash",githash))
f.write("%s=%s\n" %("IronChest.build.mcpversion",mcpversion))
f.write("%s=%s\n" %("IronChest.build.mcversion",mcversion))
print("Version information: IronChest %s.%s.%s using MCP %s for %s" % (major, minor, rev, mcpversion, mcversion))
print("Version information: IronChest %s.%s.%s using MCP %s for c:%s, s:%s" % (major, minor, rev, mcpversion, mcclientversion, mcserverversion))
if __name__ == '__main__':
main()

View File

@ -5,7 +5,7 @@
"description": "New chests with larger sizes, with in-place upgrade items.
The feature chest is the crystal chest, which is transparent - some inventory contents are visible without opening the chest",
"version": "@VERSION@",
"mcversion": "1.2.5",
"mcversion": "1.3.2",
"url": "http://www.minecraftforum.net/topic/981855-",
"updateUrl": "",
"authors": [