The bug
If a villager with no experience and {PersistenceRequired: 1b} is struck by lightning and converted into a witch, the witch that replaces the villager will have {PersistenceRequired: 0b}.
Code analysis (Yarn mappings)
LOGGER.info("Villager {} was struck by lightning {}.", this, lightning);
WitchEntity witchEntity = (WitchEntity)EntityType.WITCH.create(this.world);
witchEntity.refreshPositionAndAngles(this.getX(), this.getY(), this.getZ(), this.yaw, this.pitch);
witchEntity.initialize(this.world, this.world.getLocalDifficulty(witchEntity.getBlockPos()), SpawnReason.CONVERSION, (EntityData)null, (CompoundTag)null);
witchEntity.setAiDisabled(this.isAiDisabled());
if (this.hasCustomName()) {
witchEntity.setCustomName(this.getCustomName());
witchEntity.setCustomNameVisible(this.isCustomNameVisible());
}
// Unlike other conversion code, this does not check whether this.isPersistent() as well
if (this.getExperience() > 0) {
witchEntity.setPersistent();
}
this.world.spawnEntity(witchEntity);
this.remove();Attachments
Comments 0
No comments.