Difference between revisions of "DynamicOps"

From Forge Community Wiki
(Inital Import dokuwiki)
 
m (Corret Link)
Line 1: Line 1:
<code>DynamicOps</code> is a helper interface that's used to convert files into data types and vice versa. Their usages will probably never be explored by most modders. They are overshadowed by [[latest:advanced:handle:codecs|codecs]].
+
<code>DynamicOps</code> is a helper interface that's used to convert files into data types and vice versa. Their usages will probably never be explored by most modders. They are overshadowed by [[codecs]].
  
 
== <code>NBTDynamicOps</code> ==
 
== <code>NBTDynamicOps</code> ==

Revision as of 09:07, 19 December 2020

DynamicOps is a helper interface that's used to convert files into data types and vice versa. Their usages will probably never be explored by most modders. They are overshadowed by codecs.

NBTDynamicOps

NBTDynamicOps is a handler that converts an NBT file to an INBT tag. They are also used to parse information from codecs to send them across networks.

There is only one public instance of NBTDynamicOps: INSTANCE.

JsonOps

JsonOps are similar in which they convert a JSON file into a JsonElement. These are usually used in conjunction with codecs as well to serialize/deserialize instances.

There are two public instances of JsonOps: INSTANCE and COMPRESSED. Compressed data is represented as a single string to read/write. However, this is never used within vanilla itself.