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