From 69985e50f9ded41b27f9b073c340dd40191777e1 Mon Sep 17 00:00:00 2001 From: Sollace Date: Sat, 20 Jan 2024 15:42:26 +0000 Subject: [PATCH] Fixed placed spells breaking when reloading a world --- .../ability/magic/spell/PlaceableSpell.java | 4 ++++ .../advancements/unicopia/earth/dead_ringer.json | 12 ++++++------ .../unicopia/earth/sticks_and_stones.json | 14 +++++++------- 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/PlaceableSpell.java b/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/PlaceableSpell.java index e3736e59..082460cf 100644 --- a/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/PlaceableSpell.java +++ b/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/PlaceableSpell.java @@ -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) { diff --git a/src/main/resources/data/unicopia/advancements/unicopia/earth/dead_ringer.json b/src/main/resources/data/unicopia/advancements/unicopia/earth/dead_ringer.json index 881e8c8d..b9859933 100644 --- a/src/main/resources/data/unicopia/advancements/unicopia/earth/dead_ringer.json +++ b/src/main/resources/data/unicopia/advancements/unicopia/earth/dead_ringer.json @@ -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" ] ] } diff --git a/src/main/resources/data/unicopia/advancements/unicopia/earth/sticks_and_stones.json b/src/main/resources/data/unicopia/advancements/unicopia/earth/sticks_and_stones.json index 591e4616..083c3c04 100644 --- a/src/main/resources/data/unicopia/advancements/unicopia/earth/sticks_and_stones.json +++ b/src/main/resources/data/unicopia/advancements/unicopia/earth/sticks_and_stones.json @@ -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" ] ] -} +} \ No newline at end of file