mojira.dev
MC-167242

Bed stays occupied after a lightning turns the villager sleeping in it into a witch

The bug

When lightning hits a villager that is sleeping in a bed, the villager will turn into a witch, and the bed will stay occupied forever.

To reproduce

  1. Place a bed

  2. Spawn a villager next to it

  3. Set time to night

  4. Run /summon minecraft:lightning_bolt ~ ~ ~ while on the bed

  5. The villager turns into a witch and leaves the bed

  6. Right-click onto the bed
    → ❌ The message "This bed is occupied" appears

Code analysis

Code analysis and potential fix can be found in this comment.

Linked issues

Attachments

Comments 20

This occurs because witches have the capability to store a bed location in their entity data exactly like villagers. The minecraft:home (bed coordinates) from the struck villager is preserved when spawning the witch entity.

The easiest fix would be to clear the bed from the list of POIs when the lightning strike happens, and to NOT preserve the bed location when spawning the witch.

Confirmed for 20w16a, requesting ownership of ticket.

Comfirmed for 20w17a, 20w18a, 20w19a, 20w20a, 20w21a, 20w22a, 1.16 Pre-Release, 1.16 Pre-Release 2, 1.16 Pre-release 3, 1.16 Pre-Release 4, 1.16 Pre-Release 5.

Confirmed/Reproduced in 20w28a.

10 more comments

Can confirm in 23w03a

Confirmed in 23w17a.

Can confirm in 1.20.6

this was unintentionally fixed in 24w36a

Can confirm fixed in 24w36a.

WMGameLive

(Unassigned)

Confirmed

Gameplay

Low

Block states, Mob behaviour

1.14.4, 1.15 Pre-release 6, 1.15.1, 1.15.2, 20w12a, ..., 23w41a, 1.20.3 Pre-Release 4, 1.20.6, 1.21, 1.21.1

24w36a

Retrieved