Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-118080

Bows without pulling predicate animate when other bows are pulled back

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Resolution: Unresolved
    • Affects Version/s: Minecraft 1.11.2, Minecraft 1.12 Pre-Release 6
    • Fix Version/s: None
    • Confirmation Status:
      Confirmed

      Description

      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

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              Geenium Geenium
            • Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                CHK: