<?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=Networking_with_Entities</id>
	<title>Networking with Entities - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://forge.gemwire.uk/index.php?action=history&amp;feed=atom&amp;title=Networking_with_Entities"/>
	<link rel="alternate" type="text/html" href="https://forge.gemwire.uk/index.php?title=Networking_with_Entities&amp;action=history"/>
	<updated>2026-05-01T17:59:37Z</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=Networking_with_Entities&amp;diff=3124&amp;oldid=prev</id>
		<title>Ferri Arnus: /* IEntityAdditionalSpawnData */</title>
		<link rel="alternate" type="text/html" href="https://forge.gemwire.uk/index.php?title=Networking_with_Entities&amp;diff=3124&amp;oldid=prev"/>
		<updated>2022-02-21T21:49:38Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;IEntityAdditionalSpawnData&lt;/span&gt;&lt;/span&gt;&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 21:49, 21 February 2022&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-l9&quot; &gt;Line 9:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 9:&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;You can add extra data to the spawn packet Forge sends by implementing the following interface.&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;You can add extra data to the spawn packet Forge sends by implementing the following interface.&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;=== IEntityAdditionalSpawnData ===&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;===IEntityAdditionalSpawnData===&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;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; &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;If your entity has data that is needed on the client, but doesn't change over time, then it can be added to the entity spawn packet using this interface. &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;writeSpawnData()&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;readSpawnData()&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; control how the data should be en/decoded to/from the network buffer&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;. Also override &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;getAddEntityPacket()&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; to return &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;NetworkHooks.getEntitySpawningPacket(...)&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; for the data to be send&lt;/ins&gt;.&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;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;If your entity has data that is needed on the client, but doesn't change over time, then it can be added to the entity spawn packet using this interface. &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;writeSpawnData()&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;readSpawnData()&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; control how the data should be en/decoded to/from the network buffer.&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&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;/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;== Dynamic Data ==&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;== Dynamic Data ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Ferri Arnus</name></author>
	</entry>
	<entry>
		<id>https://forge.gemwire.uk/index.php?title=Networking_with_Entities&amp;diff=2871&amp;oldid=prev</id>
		<title>ChampionAsh5357: Update to 1.17</title>
		<link rel="alternate" type="text/html" href="https://forge.gemwire.uk/index.php?title=Networking_with_Entities&amp;diff=2871&amp;oldid=prev"/>
		<updated>2021-08-02T19:25:39Z</updated>

		<summary type="html">&lt;p&gt;Update to 1.17&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 19:25, 2 August 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-l19&quot; &gt;Line 19:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 19:&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;This is the main vanilla system for synchronizing entity data from the server to the client. As such, a number of vanilla examples are available to refer to.&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;This is the main vanilla system for synchronizing entity data from the server to the client. As such, a number of vanilla examples are available to refer 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;Firstly you need a &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;DataParameter&lt;/del&gt;&amp;lt;T&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; for the data you wish to keep synchronized. This should be stored as a static final field in your entity class, obtained by calling &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;EntityDataManager&lt;/del&gt;.&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;createKey&lt;/del&gt;()&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; and passing the entity class and a serializer for that type of data. The available serializer implementations can be found as static constants within the &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;DataSerializers&lt;/del&gt;&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; class.&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;Firstly you need a &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;EntityDataAccessor&lt;/ins&gt;&amp;lt;T&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; for the data you wish to keep synchronized. This should be stored as a static final field in your entity class, obtained by calling &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;SynchedEntityData&lt;/ins&gt;.&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;defineId&lt;/ins&gt;()&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; and passing the entity class and a serializer for that type of data. The available serializer implementations can be found as static constants within the &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;EntityDataSerializers&lt;/ins&gt;&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; class.&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;{{Colored box|title=Alert|content=You should '''only''' create data parameters for your own entities, ''within that entity's class''. Adding parameters to entities you do not control can cause the IDs used to send that data over the network to become desynchronized, causing difficult to debug crashes.}}&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;{{Colored box|title=Alert|content=You should '''only''' create data parameters for your own entities, ''within that entity's class''. Adding parameters to entities you do not control can cause the IDs used to send that data over the network to become desynchronized, causing difficult to debug crashes.}}&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;/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;Then, override &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;registerData&lt;/del&gt;()&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; and call &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;this.&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;dataManager&lt;/del&gt;.&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;register&lt;/del&gt;()&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; for each of your data parameters, passing the parameter and an initial value to use. Remember to always call &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;super.&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;registerData&lt;/del&gt;()&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; first!&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;Then, override &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Entity#defineSynchedData&lt;/ins&gt;()&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; and call &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;this.&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;entityData&lt;/ins&gt;.&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;define&lt;/ins&gt;(&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;...&lt;/ins&gt;)&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; for each of your data parameters, passing the parameter and an initial value to use. Remember to always call &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;super.&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;defineSynchedData&lt;/ins&gt;()&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; first!&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;You can then get and set these values via your entity's &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;dataManager&lt;/del&gt;&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; instance. Changes made will be synchronized to the client automatically.&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;You can then get and set these values via your entity's &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;entityData&lt;/ins&gt;&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; instance. Changes made will be synchronized to the client automatically.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>ChampionAsh5357</name></author>
	</entry>
	<entry>
		<id>https://forge.gemwire.uk/index.php?title=Networking_with_Entities&amp;diff=2155&amp;oldid=prev</id>
		<title>Unbekannt: Inital Import dokuwiki</title>
		<link rel="alternate" type="text/html" href="https://forge.gemwire.uk/index.php?title=Networking_with_Entities&amp;diff=2155&amp;oldid=prev"/>
		<updated>2020-10-24T20:48:11Z</updated>

		<summary type="html">&lt;p&gt;Inital Import dokuwiki&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;In addition to regular network messages, there are various other systems provided to handle synchronizing entity data.&lt;br /&gt;
&lt;br /&gt;
== Spawn Data ==&lt;br /&gt;
&lt;br /&gt;
In general, the spawning of modded entities is handled seperately, by Forge.&lt;br /&gt;
&lt;br /&gt;
{{Colored box|title=Info|content=This means that simply extending a vanilla entity class may not inherit all its behaviour here. You may need to implement certain vanilla behaviours yourself.}}&lt;br /&gt;
&lt;br /&gt;
You can add extra data to the spawn packet Forge sends by implementing the following interface.&lt;br /&gt;
&lt;br /&gt;
=== IEntityAdditionalSpawnData ===&lt;br /&gt;
&lt;br /&gt;
If your entity has data that is needed on the client, but doesn't change over time, then it can be added to the entity spawn packet using this interface. &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;writeSpawnData()&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;readSpawnData()&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; control how the data should be en/decoded to/from the network buffer.&lt;br /&gt;
&lt;br /&gt;
== Dynamic Data ==&lt;br /&gt;
&lt;br /&gt;
=== Data Parameters ===&lt;br /&gt;
&lt;br /&gt;
This is the main vanilla system for synchronizing entity data from the server to the client. As such, a number of vanilla examples are available to refer to.&lt;br /&gt;
&lt;br /&gt;
Firstly you need a &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;DataParameter&amp;lt;T&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; for the data you wish to keep synchronized. This should be stored as a static final field in your entity class, obtained by calling &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;EntityDataManager.createKey()&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; and passing the entity class and a serializer for that type of data. The available serializer implementations can be found as static constants within the &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;DataSerializers&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; class.&lt;br /&gt;
&lt;br /&gt;
{{Colored box|title=Alert|content=You should '''only''' create data parameters for your own entities, ''within that entity's class''. Adding parameters to entities you do not control can cause the IDs used to send that data over the network to become desynchronized, causing difficult to debug crashes.}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then, override &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;registerData()&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; and call &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;this.dataManager.register()&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; for each of your data parameters, passing the parameter and an initial value to use. Remember to always call &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;super.registerData()&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; first!&lt;br /&gt;
&lt;br /&gt;
You can then get and set these values via your entity's &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;dataManager&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; instance. Changes made will be synchronized to the client automatically.&lt;/div&gt;</summary>
		<author><name>Unbekannt</name></author>
	</entry>
</feed>