3.0.1 - fix block id > 256 (throw error)

This commit is contained in:
Christian Weeks 2012-03-11 16:34:17 -04:00
parent 9aa53eec37
commit 085ae170ea
3 changed files with 11 additions and 4 deletions

View File

@ -13,7 +13,7 @@
</description> </description>
<property name="modname" value="mod_ironchests" /> <property name="modname" value="mod_ironchests" />
<property name="version" value="3.0" /> <property name="version" value="3.0.1" />
<property name="mcp.home" location="/home/cpw/projects/mcworkspace/forge1.3.4" /> <property name="mcp.home" location="/home/cpw/projects/mcworkspace/forge1.3.4" />
<property name="mcp.obfoutput" location="${mcp.home}/reobf" /> <property name="mcp.obfoutput" location="${mcp.home}/reobf" />
<property name="client.mcp.obfoutput" location="${mcp.obfoutput}/minecraft" /> <property name="client.mcp.obfoutput" location="${mcp.obfoutput}/minecraft" />

View File

@ -25,6 +25,9 @@ public class BlockIronChest extends BlockContainer implements ITextureProvider {
setBlockName("IronChest"); setBlockName("IronChest");
setHardness(3.0F); setHardness(3.0F);
setRequiresSelfNotify(); setRequiresSelfNotify();
if (id>=256) {
disableStats();
}
random=new Random(); random=new Random();
} }

View File

@ -23,18 +23,22 @@ public class mod_IronChest extends BaseModMp {
@Override @Override
public String getVersion() { public String getVersion() {
return "3.0"; return "3.0.1";
} }
@Override @Override
public void load() { public void load() {
MinecraftForge.versionDetect("IronChest", 1, 3, 4); MinecraftForge.versionDetect("IronChest", 1, 4, 0);
proxy = ServerClientProxy.getProxy(); proxy = ServerClientProxy.getProxy();
File cfgFile = new File(proxy.getMinecraftDir(), "config/IronChest.cfg"); File cfgFile = new File(proxy.getMinecraftDir(), "config/IronChest.cfg");
Configuration cfg = new Configuration(cfgFile); Configuration cfg = new Configuration(cfgFile);
try { try {
cfg.load(); cfg.load();
ironChestBlock = new BlockIronChest(Integer.parseInt(cfg.getOrCreateBlockIdProperty("ironChests", 181).value)); int bId=Integer.parseInt(cfg.getOrCreateBlockIdProperty("ironChests", 181).value);
if (bId>=256) {
throw new RuntimeException(String.format("IronChest detected an invalid block id %s\n",bId));
}
ironChestBlock = new BlockIronChest(bId);
ChestChangerType.buildItems(cfg, 19501); ChestChangerType.buildItems(cfg, 19501);
IronChestType.initGUIs(cfg); IronChestType.initGUIs(cfg);
} catch (Exception e) { } catch (Exception e) {