Skip to content

Commit

Permalink
Update WrapperPlayServerHeldItemChange to 24w44a
Browse files Browse the repository at this point in the history
  • Loading branch information
booky10 committed Oct 30, 2024
1 parent aedb43b commit b348af9
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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
Expand Down

0 comments on commit b348af9

Please sign in to comment.