mojira.dev
MC-211074

Tall flowers placed by endermen break immediately

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);

Linked issues

Comments 1

Same as MC-183054
Mwahaha the evil agenda will be fulfilled!!

Command Master

(Unassigned)

Unconfirmed

(Unassigned)

1.16.4, 20w51a

Retrieved