Supplementaries

Supplementaries

110M Downloads

Hex Casting mind-flayed villagers return to normal when caged and released

object-Object opened this issue ยท 5 comments

commented

Flay Mind is a spell in Hex Casting which disables a villager's AI and trading. I used Flay Mind on a villager, then put it in a cage, then released it from the cage. Before caging it, it was frozen and couldn't be interacted with (as expected). After releasing it, it was no longer flayed.

On Fabric, this is the code that flays a villager:
https://github.com/gamma-delta/HexMod/blob/c8510ed83d50ac7e05d91ba3f1924e21ec10d837/Fabric/src/main/java/at/petrak/hexcasting/fabric/xplat/FabricXplatImpl.java#L140

Mod: 2.3.15-fabric
MC: 1.19.2
Loader: Quilt

commented

Caging entities calls the entity own save method simulating what happens when they are safer to disk. It also retains their previous uuid when they are released. I don't know how that works but if they aren't attaching that state in the entity nbt itand relying instead of some external map it does seem like their issue. Nothing much I can do there

commented

Sorry for the lazy issue, my bad. Here's a bit more detail. Below is the /data get entity output for the same mind-flayed villager before and after caging/releasing it.

For convenience, the only significant differences are:

  • The tag cardinal_components: {"hexcasting:brainswept": {brainswept: 1b}} becomes cardinal_components: {"hexcasting:brainswept": {brainswept: 0b}} after the villager is caged/released. This is presumably what's actually causing it. I have no idea how Cardinal Components works, but the data is in the entity nbt afaik (as below).
  • The Offers tag is only present after the villager is caged/released, not before.
  • PersistenceRequired changes from 0b to 1b when the villager is caged/released.

Before:

{DeathTime: 0s, RestocksToday: 0, Xp: 12, LeftHanded: 0b, OnGround: 1b, AbsorptionAmount: 0.0f, FoodLevel: 0b, LastRestock: 0L, Attributes: [{Name: "porting_lib:entity_gravity", Base: 0.08d}, {Name: "stepheightentityattribute:stepheight", Base: 0.0d}, {Name: "minecraft:generic.follow_range", Modifiers: [{Amount: 0.04982944353224718d, UUID: [I; -2091009673, -1357821953, -1824815370, 1119988918], Name: "Random spawn bonus", Operation: 1}], Base: 48.0d}, {Name: "minecraft:generic.movement_speed", Base: 0.5d}], Invulnerable: 0b, Brain: {memories: {"minecraft:job_site": {value: {pos: [I; -388, 63, -429], dimension: "minecraft:overworld"}}}}, Age: 0, HandDropChances: [0.085f, 0.085f], ArmorDropChances: [0.085f, 0.085f, 0.085f, 0.085f], Rotation: [173.12488f, 0.0f], HurtByTimestamp: 2610, ForcedAge: 0, BalmData: {}, cardinal_components: {"hexcasting:brainswept": {brainswept: 1b}}, ArmorItems: [{}, {}, {}, {}], "faux-custom-entity-data:custom": {}, Air: 300s, HandItems: [{}, {}], UUID: [I; -863859042, -2087694705, -1356672757, -1044216377], Inventory: [], Gossips: [{Type: "minor_negative", Target: [I; -853062021, -1367389533, -1462062150, 1535732875], Value: 25}, {Type: "trading", Target: [I; -853062021, -1367389533, -1462062150, 1535732875], Value: 4}], VillagerData: {type: "minecraft:plains", profession: "minecraft:cartographer", level: 2}, FallDistance: 0.0f, Fire: -1s, Motion: [0.0d, -0.0784000015258789d, 0.0d], Pos: [-386.30000001192093d, 63.0d, -427.69999998807907d], Health: 19.0f, CanPickUpLoot: 1b, HurtTime: 0s, FallFlying: 0b, umbrellaTimer: 0, PersistenceRequired: 0b, LastGossipDecay: 43878L, PortalCooldown: 0}

After:

{DeathTime: 0s, RestocksToday: 0, Xp: 12, LeftHanded: 0b, OnGround: 1b, AbsorptionAmount: 0.0f, FoodLevel: 0b, LastRestock: 0L, Attributes: [{Name: "porting_lib:entity_gravity", Base: 0.08d}, {Name: "stepheightentityattribute:stepheight", Base: 0.0d}, {Name: "minecraft:generic.movement_speed", Base: 0.5d}, {Name: "minecraft:generic.follow_range", Modifiers: [{Amount: 0.04982944353224718d, UUID: [I; -2091009673, -1357821953, -1824815370, 1119988918], Name: "Random spawn bonus", Operation: 1}], Base: 48.0d}], Invulnerable: 0b, Brain: {memories: {"minecraft:job_site": {value: {pos: [I; -388, 63, -429], dimension: "minecraft:overworld"}}}}, Age: 0, HandDropChances: [0.085f, 0.085f], ArmorDropChances: [0.085f, 0.085f, 0.085f, 0.085f], Rotation: [108.09494f, -40.0f], HurtByTimestamp: 2610, ForcedAge: 0, BalmData: {}, cardinal_components: {"hexcasting:brainswept": {brainswept: 0b}}, ArmorItems: [{}, {}, {}, {}], "faux-custom-entity-data:custom": {}, Air: 300s, HandItems: [{}, {}], Offers: {Recipes: [{xp: 10, buy: {id: "minecraft:glass_pane", Count: 11b}, sell: {id: "minecraft:emerald", Count: 1b}, uses: 0, priceMultiplier: 0.05f, maxUses: 16, rewardExp: 1b, demand: 0, specialPrice: 0, buyB: {id: "minecraft:air", Count: 1b}}]}, UUID: [I; -863859042, -2087694705, -1356672757, -1044216377], Inventory: [], Gossips: [{Type: "minor_negative", Target: [I; -853062021, -1367389533, -1462062150, 1535732875], Value: 25}, {Type: "trading", Target: [I; -853062021, -1367389533, -1462062150, 1535732875], Value: 4}], VillagerData: {type: "minecraft:plains", profession: "minecraft:cartographer", level: 2}, FallDistance: 0.0f, Fire: -1s, Motion: [0.0d, -0.0784000015258789d, 0.0d], Pos: [-387.20851197752785d, 63.0d, -427.41543690998503d], Health: 19.0f, CanPickUpLoot: 1b, HurtTime: 0s, FallFlying: 0b, umbrellaTimer: 0, PersistenceRequired: 1b, LastGossipDecay: 43878L, PortalCooldown: 0}
commented

More details. Here's the NBT of the cage item itself. Seems like the Cardinal Components data isn't getting saved: cardinal_components: {}

{BlockEntityTag: {MobHolder: {Name: "Cartographer", EntityData: {DeathTime: 0, Xp: 12, RestocksToday: 0, LeftHanded: 0, OnGround: 1, AbsorptionAmount: 0.0, FoodLevel: 0, LastRestock: 0, Attributes: [{Name: "porting_lib:entity_gravity", Base: 0.08}, {Name: "minecraft:generic.movement_speed", Base: 0.5}, {Name: "minecraft:generic.follow_range", Modifiers: [{Amount: 0.04982944353224718, Operation: 1, UUID: [-2091009673, -1357821953, -1824815370, 1119988918], Name: "Random spawn bonus"}], Base: 48.0}, {Name: "stepheightentityattribute:stepheight", Base: 0.0}], Invulnerable: 0, Brain: {memories: {"minecraft:job_site": {value: {pos: [-388, 63, -429], dimension: "minecraft:overworld"}}}}, Age: 0, HandDropChances: [0.085, 0.085], ArmorDropChances: [0.085, 0.085, 0.085, 0.085], Rotation: [0.0, 0.0], HurtByTimestamp: 2610, ForcedAge: 0, BalmData: {}, cardinal_components: {}, ArmorItems: [{}, {}, {}, {}], "faux-custom-entity-data:custom": {}, HandItems: [{}, {}], Air: 300, Fire: 0, Inventory: [], Pos: [0.5, 0.0626, 0.5], Gossips: [{Type: "minor_negative", Value: 25, Target: [-853062021, -1367389533, -1462062150, 1535732875]}, {Type: "trading", Value: 4, Target: [-853062021, -1367389533, -1462062150, 1535732875]}], FallDistance: 0.0, id: "minecraft:villager", Motion: [0.0, -0.0784000015258789, 0.0], VillagerData: {type: "minecraft:plains", level: 2, profession: "minecraft:cartographer"}, Health: 19.0, CanPickUpLoot: 1, HurtTime: 0, FallFlying: 0, umbrellaTimer: 0, PersistenceRequired: 1, LastGossipDecay: 43878, PortalCooldown: 0}, UUID: [-863859042, -2087694705, -1356672757, -1044216377], Scale: 0.44871795}}}
commented

Not sure how those work. Their forge equivalent, capabilities, work fine as they always stay attached to an entity.when it's saved too. If they don't get saved along the entity when its own save method is invoked it sounds like it's their problem

commented

More details: this only happens on Quilt. On Fabric, the brainswept villager can't be caged at all. (Edit: Or in my dev environment on Fabric it can be caged just fine. I have no idea what's happening anymore.)