@@ -82,9 +82,11 @@ protected byte[] getData() throws IOException {
8282 buffer .writeInt (syncType .ordinal ());
8383 buffer .writeInt (enumSyncAction .ordinal ());
8484 buffer .writeInt (operationID );
85+ buffer .writeInt (revision );
86+
87+ // UPDATE/REMOVE UNIQUE FIELDS
8588 buffer .writeBoolean (hasKey );
8689 if (hasKey ) ByteBufUtils .writeString (buffer , operationKey );
87- buffer .writeInt (revision );
8890 buffer .writeBoolean (hasNbt );
8991 if (hasNbt ) ByteBufUtils .writeBigNBT (buffer , syncData );
9092
@@ -135,9 +137,16 @@ protected void handleCompleteData(ByteBuf data, EntityPlayer player) throws IOEx
135137 int syncTypeOrdinal = data .readInt ();
136138 int syncActionOrdinal = data .readInt ();
137139 operationID = data .readInt ();
138- if (data .readBoolean ()) operationKey = ByteBufUtils .readString (data );
139140 revision = data .readInt ();
140- if (data .readBoolean ()) syncData = ByteBufUtils .readBigNBT (data );
141+
142+ EnumSyncAction action = EnumSyncAction .values ()[syncActionOrdinal ];
143+
144+ // These fields only exist for UPDATE/REMOVE
145+ if (action != EnumSyncAction .RELOAD ) {
146+ if (data .readBoolean ()) operationKey = ByteBufUtils .readString (data );
147+ if (data .readBoolean ()) syncData = ByteBufUtils .readBigNBT (data );
148+ } else
149+ syncData = ByteBufUtils .readBigNBT (data );
141150
142151
143152 syncType = SyncType .byOrdinal (syncTypeOrdinal );
@@ -146,7 +155,6 @@ protected void handleCompleteData(ByteBuf data, EntityPlayer player) throws IOEx
146155 return ;
147156 }
148157
149- EnumSyncAction action = EnumSyncAction .values ()[syncActionOrdinal ];
150158 handleSync (syncType , action , operationID , operationKey , revision , syncData );
151159 }
152160
0 commit comments