Closed HaktyGaona closed 1 week ago
This is normal behavior. When storing an entity in a structure it will store the entity's current health via nbt, whether it's full health or not that number will remain unchanged even if their base registry attributes are changed. This would result in the entity having 20/200 health if you were to change the health attribute later on. To remedy this you can either in an EntityEvents.spawned check if their health is the same as their max health and heal them or update the structure nbts to spawn in entities that have the updated max health.
这是正常行为。当将实体存储在结构中时,它将通过 nbt 存储实体的当前运行状况,无论它是否为完整运行状况,即使其基本注册表属性发生更改,该数字也将保持不变。如果您稍后要更改 health 属性,这将导致实体具有 20/200 的生命值。要解决此问题,您可以在 EntityEvents.spawned 中检查它们的生命值是否与最大生命值相同并治愈它们,或者更新结构 nbts 以在具有更新的最大生命值的实体中生成。
Okay, I'll give it a try. Thank you for your reply.
Report an issue or feature request
Mod Version: entityjs-0.3.6-1.20.1
Minecraft Version: Minecraft1.20.1
Minecraft Modloader: Forge 47.3.11
Describe the Bug/Feature Request: I tried to modify entity properties using example code, such as changing the iron golem to 200 health points, but in reality, I was unable to successfully modify it. The villagers and pillager did not have full health points even after increasing the maximum health points. It seems to only occur in entities generated through structure. I used Nbtedit to check the entities generated through the structures and confirmed the occurrence of the event.
Sometimes some mods intentionally modify the properties of entities generated through structures. It would be better if there was a way to avoid this.
Screenshots or Logs: Used the same example code as Wiki. Environment: