matshou / FierySouls

Revealing the true essence of fire elements in Minecraft.
Apache License 2.0
0 stars 0 forks source link

Torches can't break blocks #5

Closed matshou closed 8 years ago

matshou commented 8 years ago

Periodic item NBT updates reset the block breaking progress. This could be because the item is somehow marked as new, much like when it was called to produce a bobbing animation every update.

matshou commented 8 years ago

I believe I've located the cause of the problem:

private boolean func_178893_a(BlockPos p_178893_1_)
{
    ItemStack itemstack = this.mc.thePlayer.getHeldItem();
    boolean flag = this.currentItemHittingBlock == null && itemstack == null;

    if (this.currentItemHittingBlock != null && itemstack != null)
    {
        flag = itemstack.getItem() == this.currentItemHittingBlock.getItem() && ItemStack.areItemStackTagsEqual(itemstack, this.currentItemHittingBlock) && (itemstack.isItemStackDamageable() || itemstack.getMetadata() == this.currentItemHittingBlock.getMetadata());
    }

    return p_178893_1_.equals(this.field_178895_c) && flag;
}

Located in net.minecraft.client.multiplayer.PlayerControllerMP.

Here the ItemStack.areItemStackTagsEqual() method will return false on the first item NBT update. Another problem is that the mentioned method is final and doesn't permit an override while the currentItemHittingBlock variable is private and has no public access method.