<?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=Using_PacketBuffer%2F1.16</id>
	<title>Using PacketBuffer/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=Using_PacketBuffer%2F1.16"/>
	<link rel="alternate" type="text/html" href="https://forge.gemwire.uk/index.php?title=Using_PacketBuffer/1.16&amp;action=history"/>
	<updated>2026-05-22T21:56:05Z</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=Using_PacketBuffer/1.16&amp;diff=2742&amp;oldid=prev</id>
		<title>ShrimpBot: Copy Using PacketBuffer to MC1.16 archive</title>
		<link rel="alternate" type="text/html" href="https://forge.gemwire.uk/index.php?title=Using_PacketBuffer/1.16&amp;diff=2742&amp;oldid=prev"/>
		<updated>2021-07-27T03:59:31Z</updated>

		<summary type="html">&lt;p&gt;Copy &lt;a href=&quot;/wiki/Using_PacketBuffer&quot; class=&quot;mw-redirect&quot; title=&quot;Using PacketBuffer&quot;&gt;Using FriendlyByteBuf&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;&amp;lt;code&amp;gt;PacketBuffer&amp;lt;/code&amp;gt;s are essentially a byte array of zero or more bytes to sync information across a network. It works similarly to a queue: the information is written in to a specific order and read in the order it was written.&lt;br /&gt;
&lt;br /&gt;
== Using &amp;lt;code&amp;gt;PacketBuffer&amp;lt;/code&amp;gt;s ==&lt;br /&gt;
&lt;br /&gt;
In most cases, one will use a premade &amp;lt;code&amp;gt;PacketBuffer&amp;lt;/code&amp;gt; passed in from some network. Most of the time this is a heap buffer of some sort; however, understanding how it works is best left as an explanation of data structures.&lt;br /&gt;
&lt;br /&gt;
When you are &amp;lt;code&amp;gt;writing&amp;lt;/code&amp;gt; to a &amp;lt;code&amp;gt;PacketBuffer&amp;lt;/code&amp;gt;, you are calling one of the many write functions to store information as bytes (e.g. &amp;lt;code&amp;gt;writeBlockPos&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;writeVarInt&amp;lt;/code&amp;gt;). There are a couple of helpers for objects like &amp;lt;code&amp;gt;CompoundNBT&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;ItemStack&amp;lt;/code&amp;gt;s, etc. if they are needed.&lt;br /&gt;
&lt;br /&gt;
When you are &amp;lt;code&amp;gt;reading&amp;lt;/code&amp;gt; from a &amp;lt;code&amp;gt;PacketBuffer&amp;lt;/code&amp;gt;, you are calling the equivalent read function in the same order. For example, if you call &amp;lt;code&amp;gt;writeBlockPos&amp;lt;/code&amp;gt; and then &amp;lt;code&amp;gt;writeVarInt&amp;lt;/code&amp;gt;, you would call &amp;lt;code&amp;gt;readBlockPos&amp;lt;/code&amp;gt; and then &amp;lt;code&amp;gt;readVarInt&amp;lt;/code&amp;gt; in that order. Each of these method returns the value from the buffer.&lt;/div&gt;</summary>
		<author><name>ShrimpBot</name></author>
	</entry>
</feed>