<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://forge.gemwire.uk/index.php?action=history&amp;feed=atom&amp;title=DynamicOps%2F1.16</id>
	<title>DynamicOps/1.16 - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://forge.gemwire.uk/index.php?action=history&amp;feed=atom&amp;title=DynamicOps%2F1.16"/>
	<link rel="alternate" type="text/html" href="https://forge.gemwire.uk/index.php?title=DynamicOps/1.16&amp;action=history"/>
	<updated>2026-05-23T00:32:02Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.35.0</generator>
	<entry>
		<id>https://forge.gemwire.uk/index.php?title=DynamicOps/1.16&amp;diff=2763&amp;oldid=prev</id>
		<title>ShrimpBot: Copy DynamicOps to MC1.16 archive</title>
		<link rel="alternate" type="text/html" href="https://forge.gemwire.uk/index.php?title=DynamicOps/1.16&amp;diff=2763&amp;oldid=prev"/>
		<updated>2021-07-27T04:14:07Z</updated>

		<summary type="html">&lt;p&gt;Copy &lt;a href=&quot;/wiki/DynamicOps&quot; title=&quot;DynamicOps&quot;&gt;DynamicOps&lt;/a&gt; to MC1.16 archive&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left diff-editfont-monospace&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en-GB&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 04:14, 27 July 2021&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot; &gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The &amp;lt;code&amp;gt;DynamicOps&amp;lt;/code&amp;gt; class is part of mojang's DataFixerUpper serialization library; DynamicOps are used alongside [[codecs/1.16]] to convert java objects to a serialized format and back. While Codecs describe how a java object is to be serialized, DynamicOps describe the format the object is to be serialized to.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The &amp;lt;code&amp;gt;DynamicOps&amp;lt;/code&amp;gt; class is part of mojang's DataFixerUpper serialization library; DynamicOps are used alongside [[codecs/1.16&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;|codecs&lt;/ins&gt;]] to convert java objects to a serialized format and back. While Codecs describe how a java object is to be serialized, DynamicOps describe the format the object is to be serialized to.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The DataFixerUpper library includes several DynamicOps for serializing to json; vanilla minecraft also includes a DynamicOps for serializing to minecraft's [[&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Using_NBT|&lt;/del&gt;NBT/1.16]] format.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The DataFixerUpper library includes several DynamicOps for serializing to json; vanilla minecraft also includes a DynamicOps for serializing to minecraft's [[&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Using &lt;/ins&gt;NBT/1.16&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;|NBT&lt;/ins&gt;]] format.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;= Builtin DynamicOps =&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;= Builtin DynamicOps =&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l21&quot; &gt;Line 21:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 21:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Serializing and Deserializing ==&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Serializing and Deserializing ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;By combining a &amp;lt;code&amp;gt;Codec&amp;lt;SomeJavaType&amp;gt;&amp;lt;/code&amp;gt; with a &amp;lt;code&amp;gt;DynamicOps&amp;lt;SomeSerializedFormat&amp;gt;&amp;lt;/code&amp;gt;, the proper java object can be converted to the serialized form and back. See [[codecs/1.16]] for details on this subject.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;By combining a &amp;lt;code&amp;gt;Codec&amp;lt;SomeJavaType&amp;gt;&amp;lt;/code&amp;gt; with a &amp;lt;code&amp;gt;DynamicOps&amp;lt;SomeSerializedFormat&amp;gt;&amp;lt;/code&amp;gt;, the proper java object can be converted to the serialized form and back. See [[codecs/1.16&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;|codecs&lt;/ins&gt;]] for details on this subject.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Format Conversion ==&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Format Conversion ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>ShrimpBot</name></author>
	</entry>
	<entry>
		<id>https://forge.gemwire.uk/index.php?title=DynamicOps/1.16&amp;diff=2698&amp;oldid=prev</id>
		<title>ShrimpBot: Copy DynamicOps to MC1.16 archive</title>
		<link rel="alternate" type="text/html" href="https://forge.gemwire.uk/index.php?title=DynamicOps/1.16&amp;diff=2698&amp;oldid=prev"/>
		<updated>2021-07-27T03:58:22Z</updated>

		<summary type="html">&lt;p&gt;Copy &lt;a href=&quot;/wiki/DynamicOps&quot; title=&quot;DynamicOps&quot;&gt;DynamicOps&lt;/a&gt; to MC1.16 archive&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;The &amp;lt;code&amp;gt;DynamicOps&amp;lt;/code&amp;gt; class is part of mojang's DataFixerUpper serialization library; DynamicOps are used alongside [[codecs/1.16]] to convert java objects to a serialized format and back. While Codecs describe how a java object is to be serialized, DynamicOps describe the format the object is to be serialized to.&lt;br /&gt;
&lt;br /&gt;
The DataFixerUpper library includes several DynamicOps for serializing to json; vanilla minecraft also includes a DynamicOps for serializing to minecraft's [[Using_NBT|NBT/1.16]] format.&lt;br /&gt;
&lt;br /&gt;
= Builtin DynamicOps =&lt;br /&gt;
&lt;br /&gt;
== JsonOps ==&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;JsonOps&amp;lt;/code&amp;gt; DynamicOps are used to serialize and deserialize json data. These are instances of &amp;lt;code&amp;gt;DynamicOps&amp;lt;JsonElement&amp;gt;&amp;lt;/code&amp;gt;, meaning that they are used to convert java objects to and from &amp;lt;code&amp;gt;JsonElement&amp;lt;/code&amp;gt; instances. These can used in conjunction with codecs to serialize/deserialize objects from assets and datapacks.&lt;br /&gt;
&lt;br /&gt;
There are two public instances of JsonOps: &amp;lt;code&amp;gt;JsonOps.INSTANCE&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;JsonOps.COMPRESSED&amp;lt;/code&amp;gt;. Compressed data is represented as a single string to read/write. However, this is never used within vanilla itself.&lt;br /&gt;
&lt;br /&gt;
== NBTDynamicOps ==&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;NBTDynamicOps.INSTANCE&amp;lt;/code&amp;gt; is an instance of &amp;lt;code&amp;gt;DynamicOps&amp;lt;INBT&amp;gt;&amp;lt;/code&amp;gt;, meaning it is used to convert java objects to and from &amp;lt;code&amp;gt;INBT&amp;lt;/code&amp;gt; instances. This can be used for serializing data into packets to send across networks, as well as serializing persistant data for entities and similar objects.&lt;br /&gt;
&lt;br /&gt;
There is only one public instance of NBTDynamicOps: &amp;lt;code&amp;gt;NBTDynamicOps.INSTANCE&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
= Using DynamicOps =&lt;br /&gt;
&lt;br /&gt;
== Serializing and Deserializing ==&lt;br /&gt;
&lt;br /&gt;
By combining a &amp;lt;code&amp;gt;Codec&amp;lt;SomeJavaType&amp;gt;&amp;lt;/code&amp;gt; with a &amp;lt;code&amp;gt;DynamicOps&amp;lt;SomeSerializedFormat&amp;gt;&amp;lt;/code&amp;gt;, the proper java object can be converted to the serialized form and back. See [[codecs/1.16]] for details on this subject.&lt;br /&gt;
&lt;br /&gt;
== Format Conversion ==&lt;br /&gt;
&lt;br /&gt;
By using the &amp;lt;code&amp;gt;DynamicOps#convertTo&amp;lt;/code&amp;gt; instance method with a second DynamicOps instance, data can be converted between two different serialized formats, such as JsonElement to INBT and back.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=java&amp;gt;&lt;br /&gt;
// converting INBT to JsonElement&lt;br /&gt;
JsonElement someJsonElement = NBTDynamicOps.INSTANCE.convertTo(JsonOps.INSTANCE, someNBT);&lt;br /&gt;
&lt;br /&gt;
// converting JsonElement to INBT&lt;br /&gt;
INBT someNBT = JsonOps.INSTANCE.convertTo(NBTDynamicOps.INSTANCE, someJsonElement);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Depending on the implementation of the DynamicOps used, this may throw an exception or return an empty object if the two formats are incompatible.&lt;br /&gt;
&lt;br /&gt;
In particular, it is '''not''' safe to convert lists of numbers to NBT in this manner, due to the NBT format's strong typing and the way the NBTDynamicOps attempts to create lists of numbers.&lt;br /&gt;
&lt;br /&gt;
= External Links =&lt;br /&gt;
* [https://kvverti.github.io/Documented-DataFixerUpper/snapshot/com/mojang/serialization/DynamicOps.html DynamicOps unofficial javadocs]&lt;/div&gt;</summary>
		<author><name>ShrimpBot</name></author>
	</entry>
</feed>