Keep the only change made by Blabliblubpaul that made sense
Line 5:
Line 5:
== Serialization and Deserialization ==
== Serialization and Deserialization ==
−
The primary use for Codecs is to serialize java objects to some serialized type, such as a JsonElement or a Tag, and to deserialize an serialized object back to its proper java type. This is accomplished with <code>Codec#encodeStart</code> and <code>Codec#parse</code>, respectively. Given a Codec<SomeJavaType> and a DynamicOps<SomeSerializedType>, we can convert instances of SomeJavaType to instances of SomeSerializedType and back.
+
The primary use for Codecs is to serialize java objects to some serialized type, such as a JsonElement or a Tag, and to deserialize a serialized object back to its proper java type. This is accomplished with <code>Codec#encodeStart</code> and <code>Codec#parse</code>, respectively. Given a Codec<SomeJavaType> and a DynamicOps<SomeSerializedType>, we can convert instances of SomeJavaType to instances of SomeSerializedType and back.
Each of these methods take a [[DynamicOps]] instance and an instance of the object we are serializing or deserializing, and returns a DataResult:
Each of these methods take a [[DynamicOps]] instance and an instance of the object we are serializing or deserializing, and returns a DataResult:
Line 18:
Line 18:
// deserialize some Tag instance back to a proper java object
// deserialize some Tag instance back to a proper java object
−
DataResult<SomeJavaType> result = someCodec.parse(NBTOps.INSTANCE, someTag );
+
DataResult<SomeJavaType> result = someCodec.parse(NBTOps.INSTANCE, someTag);