Fix reflection

This commit is contained in:
Christian 2012-06-29 13:11:20 -04:00
parent fcc7f72a6b
commit 00d0701166
1 changed files with 2 additions and 1 deletions

View File

@ -10,6 +10,7 @@
******************************************************************************/ ******************************************************************************/
package cpw.mods.ironchest; package cpw.mods.ironchest;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.ReflectionHelper; import cpw.mods.fml.common.ReflectionHelper;
import net.minecraft.src.EntityPlayer; import net.minecraft.src.EntityPlayer;
import net.minecraft.src.Item; import net.minecraft.src.Item;
@ -51,7 +52,7 @@ public class ItemChestChanger extends Item implements ITextureProvider {
} }
newchest = IronChestType.makeEntity(getTargetChestOrdinal(IronChestType.WOOD.ordinal())); newchest = IronChestType.makeEntity(getTargetChestOrdinal(IronChestType.WOOD.ordinal()));
int newSize = newchest.chestContents.length; int newSize = newchest.chestContents.length;
ItemStack[] chestContents = ReflectionHelper.getPrivateValue(TileEntityChest.class, tec, "chestContents"); ItemStack[] chestContents = ReflectionHelper.getPrivateValue(TileEntityChest.class, tec, 0);
System.arraycopy(chestContents, 0, newchest.chestContents, 0, Math.min(newSize, chestContents.length)); System.arraycopy(chestContents, 0, newchest.chestContents, 0, Math.min(newSize, chestContents.length));
BlockIronChest block = mod_IronChest.ironChestBlock; BlockIronChest block = mod_IronChest.ironChestBlock;
block.dropContent(newSize, tec, world, tec.xCoord, tec.yCoord, tec.zCoord); block.dropContent(newSize, tec, world, tec.xCoord, tec.yCoord, tec.zCoord);