Difference between revisions of "Template:PacketList"

From wiki.vg
Jump to navigation Jump to search
m (Use {{Added}} and {{Removed}})
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<!-- style="background-color: #f4cccc; text-decoration: line-through;" -->
+
<includeonly> |- {{#ifeq: {{{pre|}}} | removed | {{Removed}} | {{#ifeq: {{{rel|}}} | added | {{Added}} | }} }}
<!-- style="background-color: #d9ead3;" -->
+
  | {{{1}}} || {{{2}}} || {{#ifeq: {{{rel|}}} | added || [[Protocol#{{{rel|{{{2}}}}}}|Current]] }} || {{#ifeq: {{{pre|}}} | removed || {{#ifeq: {{{pre|}}} | unchanged | (unchanged) | [[Pre-release_protocol#{{{pre|{{{2}}}}}}|Pre]] }} }}</includeonly><noinclude>{{PacketList/doc}}</noinclude>
|- {{#if: {{{removed|}}} | style="background-color: #f4cccc; text-decoration: line-through;" | {{#if: {{{added|}}} | style="background-color: #d9ead3;" | }} }}
 
  | {{{1}}} || {{{2}}} || [[Protocol#{{{2}}}|Current]] || [[Pre-release_protocol#{{{2}}}|Pre]]
 

Latest revision as of 21:12, 26 June 2018

This template is used to simplify creation the table of contents / packet changes on Pre-release protocol.

Usage

This template is always used within a table, to add an entry to the table. A simple usage would be like this:

{| class="wikitable"
 ! ID
 ! Packet name
 !colspan="2"| Documentation
 |-
 !colspan="4"| Handshaking serverbound
 {{PacketList|0x00|Handshake}}
 |}

which produces

ID Packet name Documentation
Handshaking serverbound
0x00 Handshake Current Pre

The headers in the in the table of contents must always be provided; {{PacketList}} is used to add a row to the table but does not generate the rest of the table. For the remainder of this page the table start will be omitted to keep example code short, but it is still needed.

Basic usage

The simplest usage is merely writing {{PacketList|<packet ID>|<packet name>}}. This will automatically produce a link to the current and pre-release documentation for the given packet.

{{PacketList|0x19|Named Sound Effect}}
{{PacketList|0x46|Sound Effect}}
ID Packet name Documentation
Play clientbound
0x19 Named Sound Effect Current Pre
0x46 Sound Effect Current Pre

Removed packets

For representing packets that have been removed in a pre-release, add a pre=removed parameter. This will mark that packet as removed and remove the link to the current version. Note that you will need to manually indicate changes to the following packet IDs, if they changed.

{{PacketList|0x46|Update Sign (clientbound)|pre=removed}}
ID Packet name Documentation
Play clientbound
0x46 Update Sign (clientbound) Current

Packets that changed IDs and data

To indicate a packet ID that changed, use the {{Change|<old id>|<new id>}} template to create a diff on the packet ID. Packets should be ordered by the order of the new packet ID, not the old one.

{{PacketList|{{Change|0x1B|0x19}}|Foo}}
{{PacketList|{{Change|0x19|0x1A}}|Bar}}
{{PacketList|{{Change|0x1A|0x1B}}|Baz}}
ID Packet name Documentation
Example serverbound
0x1B 0x19 Foo Current Pre
0x19 0x1A Bar Current Pre
0x1A 0x1B Baz Current Pre

Packets that only changed IDs

If a packet changed its ID but did not change its content, {{Change}} should be used but pre=unchanged should also be added. This makes it clear that the packet did not get modified in the version, only renumbered.

{{PacketList|{{Change|0x1B|0x19}}|Foo|pre=unchanged}}
{{PacketList|{{Change|0x19|0x1A}}|Bar|pre=unchanged}}
{{PacketList|{{Change|0x1A|0x1B}}|Baz|pre=unchanged}}
ID Packet name Documentation
Example serverbound
0x1B 0x19 Foo Current (unchanged)
0x19 0x1A Bar Current (unchanged)
0x1A 0x1B Baz Current (unchanged)

New packets

If a packet was added, add the parameter rel=added.

{{PacketList|0xFF|New packet|rel=added}}
ID Packet name Documentation
Example serverbound
0xFF New packet Pre