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

Vindicator not able to spawn naturally with {CanPickUpLoot:1b}

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Resolution: Works As Intended
    • Affects Version/s: Minecraft 1.11, Minecraft 1.11.2, Minecraft 1.12 Pre-Release 5, Minecraft 1.12, Minecraft 1.13.1
    • Fix Version/s: None
    • Confirmation Status:
      Confirmed
    • Category:
      (Unassigned)

      Description

      The vindicator will not spawn naturally with the tag that makes them able to pick up loot.

      What should happen:
      Depending on difficulty a percentage of all vindicators spawned naturally in the world via generation, spawn egg or commands (not including those summoned with the tag {CanPickUpLoot:1b} should have a percentage chance for it to have the tag {CanPickUpLoot:1b}. This will make the vindicators with the tag be able to pick up loot you throw at it given the priority algorithm allows it. That is for example, diamond swords are better than iron axe, meaning it should exchange the diamond sword with its current weapon (iron axe). In other words, it should act as if it was summoned with this command:

      /summon vindication_illager ~ ~ ~ {CanPickUpLoot:1b}
      

      How to recreate:
      Spawn a vindicator using a spawn egg, command or find them naturally. Try giving them a diamond sword (or another item it should prefer if it has the tag). See if it picks up the diamond sword. Repeat until satisfied.

      Please ask if you have any questions.


      Fix: (Based off of Minecraft 1.11, MCP 9.35)

      net.minecraft.entity.monster.EntityVindicator.onInitialSpawn(DifficultyInstance difficulty, @Nullable IEntityLivingData livingdata)
          public IEntityLivingData onInitialSpawn(DifficultyInstance difficulty, @Nullable IEntityLivingData livingdata)
          {
              //add these two lines
              //same way other mobs are given pick up ability
              float f = difficulty.getClampedAdditionalDifficulty();
              this.setCanPickUpLoot(this.rand.nextFloat() < 0.55F * f);
          }
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              Galia Galia
              Votes:
              22 Vote for this issue
              Watchers:
              10 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                CHK: