diff --git a/src/api/java/mekanism/api/SerializerHelper.java b/src/api/java/mekanism/api/SerializerHelper.java index 86b366ba59d..105584aa74f 100644 --- a/src/api/java/mekanism/api/SerializerHelper.java +++ b/src/api/java/mekanism/api/SerializerHelper.java @@ -8,8 +8,6 @@ import com.mojang.brigadier.exceptions.CommandSyntaxException; import com.mojang.serialization.Codec; import com.mojang.serialization.DataResult; -import com.mojang.serialization.DynamicOps; -import com.mojang.serialization.codecs.PrimitiveCodec; import com.mojang.serialization.codecs.RecordCodecBuilder; import java.util.Optional; import java.util.function.Function; @@ -91,18 +89,6 @@ private SerializerHelper() { case SLURRY -> SlurryStack.CODEC; }); - public static final Codec FLOATING_LONG_CODEC = new PrimitiveCodec() { - @Override - public DataResult read(DynamicOps ops, T input) { - return ops.getNumberValue(input).map(number -> FloatingLong.fromNumber(number, true)); - } - - @Override - public T write(DynamicOps ops, FloatingLong value) { - return ops.createNumeric(value); - } - }; - /** * Deserializes a FloatingLong that is stored in a specific key in a Json Object. * diff --git a/src/api/java/mekanism/api/math/FloatingLong.java b/src/api/java/mekanism/api/math/FloatingLong.java index 8d3f8f4e1c3..fda9aa1c094 100644 --- a/src/api/java/mekanism/api/math/FloatingLong.java +++ b/src/api/java/mekanism/api/math/FloatingLong.java @@ -1,5 +1,9 @@ package mekanism.api.math; +import com.mojang.serialization.Codec; +import com.mojang.serialization.DataResult; +import com.mojang.serialization.DynamicOps; +import com.mojang.serialization.codecs.PrimitiveCodec; import java.math.BigDecimal; import java.math.BigInteger; import java.math.RoundingMode; @@ -16,6 +20,17 @@ @NothingNullByDefault public class FloatingLong extends Number implements Comparable { + public static final Codec FLOATING_LONG_CODEC = new PrimitiveCodec() { + @Override + public DataResult read(DynamicOps ops, T input) { + return ops.getNumberValue(input).map(number -> fromNumber(number, true)); + } + + @Override + public T write(DynamicOps ops, FloatingLong value) { + return ops.createNumeric(value); + } + }; private static final DecimalFormat df = new DecimalFormat("0.0000", DecimalFormatSymbols.getInstance(Locale.ENGLISH)); //TODO: Eventually we should define a way of doing a set of operations all at once, and outputting a new value