Fixed placed spells breaking when reloading a world

This commit is contained in:
Sollace 2024-01-20 15:42:26 +00:00
parent ab3ac8cb0d
commit 69985e50f9
No known key found for this signature in database
GPG key ID: E52FACE7B5C773DB
3 changed files with 17 additions and 13 deletions

View file

@ -219,6 +219,9 @@ public class PlaceableSpell extends AbstractDelegatingSpell implements OrientedS
position.ifPresent(pos -> {
compound.put("position", NbtSerialisable.writeVector(pos));
});
if (placedSpellId != null) {
compound.putUuid("placedSpellId", placedSpellId);
}
if (dimension != null) {
compound.putString("dimension", dimension.getValue().toString());
}
@ -232,6 +235,7 @@ public class PlaceableSpell extends AbstractDelegatingSpell implements OrientedS
pitch = compound.getFloat("pitch");
yaw = compound.getFloat("yaw");
position = compound.contains("position") ? Optional.of(NbtSerialisable.readVector(compound.getList("position", NbtElement.FLOAT_TYPE))) : Optional.empty();
placedSpellId = compound.containsUuid("placedSpellId") ? compound.getUuid("placedSpellId") : null;
if (compound.contains("dimension", NbtElement.STRING_TYPE)) {
Identifier id = Identifier.tryParse(compound.getString("dimension"));
if (id != null) {

View file

@ -2,13 +2,13 @@
"parent": "unicopia:unicopia/earth/born_on_a_rock_farm",
"display": {
"icon": {
"item": "unicopia:rock"
"item": "unicopia:iron_horseshoe"
},
"title": {
"translate": "advancements.unicopia.sticks_and_stones.title"
"translate": "advancements.unicopia.dead_ringer.title"
},
"description": {
"translate": "advancements.unicopia.sticks_and_stones.description"
"translate": "advancements.unicopia.dead_ringer.description"
},
"frame": "task",
"show_toast": true,
@ -16,13 +16,13 @@
"hidden": true
},
"criteria": {
"killed_entity_with_rock": {
"killed_entity_with_horseshoe": {
"trigger": "minecraft:player_killed_entity",
"conditions": {
"killing_blow": {
"tags": [
{
"id": "unicopia:from_rocks",
"id": "unicopia:from_horseshoes",
"expected": true
}
]
@ -31,6 +31,6 @@
}
},
"requirements": [
[ "killed_entity_with_rock" ]
[ "killed_entity_with_horseshoe" ]
]
}

View file

@ -2,13 +2,13 @@
"parent": "unicopia:unicopia/earth/born_on_a_rock_farm",
"display": {
"icon": {
"item": "unicopia:horseshoe"
"item": "unicopia:rock"
},
"title": {
"translate": "advancements.unicopia.dead_ringer.title"
"translate": "advancements.unicopia.sticks_and_stones.title"
},
"description": {
"translate": "advancements.unicopia.dead_ringer.description"
"translate": "advancements.unicopia.sticks_and_stones.description"
},
"frame": "task",
"show_toast": true,
@ -16,13 +16,13 @@
"hidden": true
},
"criteria": {
"killed_entity_with_horseshoe": {
"killed_entity_with_rock": {
"trigger": "minecraft:player_killed_entity",
"conditions": {
"killing_blow": {
"tags": [
{
"id": "unicopia:from_horseshoes",
"id": "unicopia:from_rocks",
"expected": true
}
]
@ -31,6 +31,6 @@
}
},
"requirements": [
[ "killed_entity_with_horseshoe" ]
[ "killed_entity_with_rock" ]
]
}
}