From b348af95811458c3e7bd18db376f1d9a79f47e12 Mon Sep 17 00:00:00 2001 From: booky10 Date: Wed, 30 Oct 2024 15:23:16 +0100 Subject: [PATCH] Update WrapperPlayServerHeldItemChange to 24w44a --- .../play/server/WrapperPlayServerHeldItemChange.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/api/src/main/java/com/github/retrooper/packetevents/wrapper/play/server/WrapperPlayServerHeldItemChange.java b/api/src/main/java/com/github/retrooper/packetevents/wrapper/play/server/WrapperPlayServerHeldItemChange.java index 6d9914892c..0da8492cb8 100644 --- a/api/src/main/java/com/github/retrooper/packetevents/wrapper/play/server/WrapperPlayServerHeldItemChange.java +++ b/api/src/main/java/com/github/retrooper/packetevents/wrapper/play/server/WrapperPlayServerHeldItemChange.java @@ -19,6 +19,7 @@ package com.github.retrooper.packetevents.wrapper.play.server; import com.github.retrooper.packetevents.event.PacketSendEvent; +import com.github.retrooper.packetevents.manager.server.ServerVersion; import com.github.retrooper.packetevents.protocol.packettype.PacketType; import com.github.retrooper.packetevents.wrapper.PacketWrapper; @@ -36,12 +37,17 @@ public WrapperPlayServerHeldItemChange(int slot) { @Override public void read() { - this.slot = readByte(); + this.slot = this.serverVersion.isNewerThanOrEquals(ServerVersion.V_1_21_4) + ? this.readVarInt() : this.readByte(); } @Override public void write() { - writeByte(slot); + if (this.serverVersion.isNewerThanOrEquals(ServerVersion.V_1_21_4)) { + this.writeVarInt(this.slot); + } else { + this.writeByte(this.slot); + } } @Override