From dc7a5debaada72beeab0c6884101f2ca50253a91 Mon Sep 17 00:00:00 2001 From: Sollace Date: Fri, 5 Apr 2024 22:38:37 +0100 Subject: [PATCH] Fix spell ingredient serializing --- .../java/com/minelittlepony/unicopia/util/CodecUtils.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/minelittlepony/unicopia/util/CodecUtils.java b/src/main/java/com/minelittlepony/unicopia/util/CodecUtils.java index 91cbef5c..67d5f491 100644 --- a/src/main/java/com/minelittlepony/unicopia/util/CodecUtils.java +++ b/src/main/java/com/minelittlepony/unicopia/util/CodecUtils.java @@ -55,9 +55,9 @@ public interface CodecUtils { @Override public DataResult encode(Pair, Optional> input, DynamicOps ops, T prefix) { return baseCodec.encode(input.getFirst().get(), ops, prefix) - .flatMap(leftResult -> input.getSecond() - .map(r -> fieldCodec.encode(r, ops, ops.mapBuilder()).build(prefix)) - .orElse(DataResult.success(leftResult))); + .flatMap(l -> input.getSecond() + .map(r -> fieldCodec.encode(r, ops, ops.mapBuilder()).build(prefix).flatMap(rr -> ops.getMap(rr).flatMap(rrr -> ops.mergeToMap(l, rrr)))) + .orElse(DataResult.success(l))); } }, new Decoder, Optional>>() { @Override