Load PersistenceRequired as vanilla does: copper golems save 0 again
Mob.readAdditionalSaveData assigns persistenceRequired from the tag, overriding the constructor's setPersistenceRequired (copper golems, elder guardians). Horizon ORed it in, so a copper golem vanilla saved with 0 came back with 1. The monument's elder guardian, which Horizon builds from NBT where vanilla calls the constructor, now carries the flag in its spawn NBT. Fixes #289 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -597,7 +597,9 @@ pub fn mob_from_nbt(tag: &Tag, types: &HashMap<String, Arc<MobType>>, id: u32) -
|
||||
m.extra.main_hand = None;
|
||||
}
|
||||
m.death_time = number(tag.get("DeathTime")).unwrap_or(0) as i32;
|
||||
m.persistent |= flag(tag, "PersistenceRequired");
|
||||
// Mob.readAdditionalSaveData overrides what the constructor set (copper
|
||||
// golems and elder guardians start persistent).
|
||||
m.persistent = flag(tag, "PersistenceRequired");
|
||||
m.extra.pick_up_loot = flag(tag, "CanPickUpLoot");
|
||||
m.custom_name = custom_name(tag);
|
||||
if m.kind.category == "creature" {
|
||||
|
||||
@@ -350,7 +350,8 @@ impl W<'_, '_> {
|
||||
"minecraft:elder_guardian",
|
||||
pos,
|
||||
true,
|
||||
false,
|
||||
// The ElderGuardian constructor's setPersistenceRequired.
|
||||
true,
|
||||
))?;
|
||||
}
|
||||
Ok(())
|
||||
|
||||
Reference in New Issue
Block a user