mojira.dev
MC-118080

Bows without pulling predicate animate when other bows are pulled back

The bug

When specifying different models for different damage values of bows if you have a bow model which doesn't use the pulling predicate but uses pull, this bow will have its pulling animation play, when in your inventory, when other bows are pulled.

When using the resourcepack provided:

/give @p minecraft:bow
/give @p minecraft:bow 1 1 {Unbreakable:1b}

When pulling back the normal bow the second bow will play it's animation, replaced with cycling through different swords in the resourcepack for testing purposes.

Code analysis

Based on 1.11.2 decompiled using MCP 9.35 rc1

The property override (net.minecraft.item.ItemBow.ItemBow().new IItemPropertyGetter() {...}.()) only tests if the active item is a bow instead of testing if the active item is the bow which is supposed to be rendered.

this.addPropertyOverride(new ResourceLocation("pull"), new IItemPropertyGetter()
{
    public float apply(ItemStack stack, @Nullable World worldIn, @Nullable EntityLivingBase entityIn)
    {
        // Comment: Replaced this
        // return entityIn == null ? 0.0F : (entityIn.getActiveItemStack().getItem() != Items.BOW ? 0.0F : (float)(stack.getMaxItemUseDuration() - entityIn.getItemInUseCount()) / 20.0F);
        return entityIn == null ? 0.0F : (entityIn.getActiveItemStack() == stack ? (float)(stack.getMaxItemUseDuration() - entityIn.getItemInUseCount()) / 20.0F : 0.0F);
    }
});

Attachments

Comments 0

No comments.

Geenium

(Unassigned)

Confirmed

(Unassigned)

bow, overriding, resource-pack

Minecraft 1.11.2, Minecraft 1.12 Pre-Release 6, 20w07a

20w13a

Retrieved