[API Question] What do I make wrong with IWrenchable?

    • Official Post

    So I use the updated IWrenchable-Interface, and I was first thinking that its awesome, but then I always got this Error, when trying to remove one of my Machines with a Wrench in my Dev-Build 2.60a.


    ...
    java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
    at java.util.ArrayList.rangeCheck(Unknown Source)
    at java.util.ArrayList.set(Unknown Source)
    at ic2.common.ItemToolWrench.onItemUseFirst(ItemToolWrench.java:119)
    at ir.a(ItemInWorldManager.java:386)
    ...


    Maybe this is happened to a few others, so please tell me how I cause that Problem (already removed all old IC²-APIs from the other Mods to be sure).


    Edit:

    Code
    @Override public boolean wrenchCanSetFacing(EntityPlayer aPlayer, int aSide) {if (mMetaTileEntity != null) return mFacing != aSide && mMetaTileEntity.isFacingValid(aSide); return false;}
    @Override public short getFacing() {return (short)mFacing;}
    @Override public void setFacing(short aFacing) {if (mMetaTileEntity != null && mMetaTileEntity.isFacingValid(aFacing)) mFacing = aFacing; mNeedsUpdate = true; onMachineBlockUpdate();}
    @Override public boolean wrenchCanRemove(EntityPlayer entityPlayer) {return true;}
    @Override public float getWrenchDropRate() {if (mMetaTileEntity != null && mMetaTileEntity.isSimpleMachine()) return 1.0F; return 0.8F;}
    @Override public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {return new ItemStack(GT_Mod.instance.mBlocks[1].blockID, 1, mID);}