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

Tall flowers placed by endermen break immediately

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • None
    • 1.16.4, 20w51a
    • None
    • Unconfirmed
    • (Unassigned)

      If an enderman is given any tall flowers with commands, the flower will break immediately when placed.

       

      What I expected to happen was...:
      The tall flower being places as a player would place it, placing two blocks.

      What actually happened was...:
      No flower was placed.

      Reproduction steps:

      1. Summon an enderman with
        summon enderman ~ ~ ~ {carriedBlockState:{Name:"minecraft:sunflower"}}
      1.  Spectate it
      2. Wait until it places the sunflower
      3. See that while the sunflower is removed from his hands, it doesn't get placed anywhere in the world

       

      Code analysis

      EnderMan.EndermanLeaveBlockGoal.tick runs

      level.setBlock(blockPos, blockState3, 3);
      this.enderman.setCarriedBlock(null);
      

      without running Block.setPlacedBy, which causes the block to not update correctly.

      It can be fixed by adding

      this.enderman.getCarriedBlock().getBlock().setPlacedBy(level, blockPos, this.enderman.getCarriedBlock(), this.enderman, this.enderman.getCarriedBlock().getBlock().asItem());
      

      before doing

      this.enderman.setCarriedBlock(null);
      

            Unassigned Unassigned
            COmmandMaster Command Master
            Votes:
            3 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: