SpoutDev/Spout — Issue #1007: ItemTool.class.getDeclaredField("b").get(spade) does not always return a valid value
Author: hitechwizard
Created: 2011-11-24 07:44:52+00:00
State: open

Stacktrace is located at: http://pastebin.com/94GugeF4

Quick summary: line 35 in CustomItemSpade.java
if (Item.byId[i] instanceof ItemSpade) {
ItemSpade spade = (ItemSpade)Item.byId[i];
EnumToolMaterial etm = null;
try {
Field tool = ItemTool.class.getDeclaredField("b");
tool.setAccessible(true);
--->	etm = (EnumToolMaterial) tool.get(spade);
}
catch (Exception e) {
e.printStackTrace();
}
Item.byId[i] = null;
---->	Item.byId[i] = new CustomItemSpade(spade.id-256, etm);
}

when tool.get(spade) returns a float (for whatever reason) it throws the exception and etm remains null.

Suggest: move lines 40&41 into the try block so that Spout will just leave that item alone and continue to enable itself properly.