mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-13 00:47:50 +00:00
Fixed massive SyncPacket failure
This commit is contained in:
1 parent
332f1bfd57
commit
0a4bc4126f
1 file changed
+12
-4
@@ -82,9 +82,11 @@ public final class SyncPacket extends LargeAbstractPacket {
|
||||
buffer.writeInt(syncType.ordinal());
|
||||
buffer.writeInt(enumSyncAction.ordinal());
|
||||
buffer.writeInt(operationID);
|
||||
buffer.writeInt(revision);
|
||||
|
||||
// UPDATE/REMOVE UNIQUE FIELDS
|
||||
buffer.writeBoolean(hasKey);
|
||||
if (hasKey) ByteBufUtils.writeString(buffer, operationKey);
|
||||
buffer.writeInt(revision);
|
||||
buffer.writeBoolean(hasNbt);
|
||||
if (hasNbt) ByteBufUtils.writeBigNBT(buffer, syncData);
|
||||
|
||||
@@ -135,9 +137,16 @@ public final class SyncPacket extends LargeAbstractPacket {
|
||||
int syncTypeOrdinal = data.readInt();
|
||||
int syncActionOrdinal = data.readInt();
|
||||
operationID = data.readInt();
|
||||
if (data.readBoolean()) operationKey = ByteBufUtils.readString(data);
|
||||
revision = data.readInt();
|
||||
if (data.readBoolean()) syncData = ByteBufUtils.readBigNBT(data);
|
||||
|
||||
EnumSyncAction action = EnumSyncAction.values()[syncActionOrdinal];
|
||||
|
||||
// These fields only exist for UPDATE/REMOVE
|
||||
if (action != EnumSyncAction.RELOAD) {
|
||||
if (data.readBoolean()) operationKey = ByteBufUtils.readString(data);
|
||||
if (data.readBoolean()) syncData = ByteBufUtils.readBigNBT(data);
|
||||
} else
|
||||
syncData = ByteBufUtils.readBigNBT(data);
|
||||
|
||||
|
||||
syncType = SyncType.byOrdinal(syncTypeOrdinal);
|
||||
@@ -146,7 +155,6 @@ public final class SyncPacket extends LargeAbstractPacket {
|
||||
return;
|
||||
}
|
||||
|
||||
EnumSyncAction action = EnumSyncAction.values()[syncActionOrdinal];
|
||||
handleSync(syncType, action, operationID, operationKey, revision, syncData);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user