implement ByteBufInPacket.readUnsignedByte

This commit is contained in:
yuzumika
2024-01-04 10:55:07 -08:00
parent cb0320a471
commit 5a4200cc8e
3 changed files with 4 additions and 6 deletions

View File

@@ -22,6 +22,8 @@ public class ByteBufInPacket implements InPacket {
public byte readByte() {
return byteBuf.readByte();
}
@Override
public short readUnsignedByte() { return byteBuf.readUnsignedByte(); }
@Override
public short readShort() {

View File

@@ -4,6 +4,7 @@ import java.awt.*;
public interface InPacket extends Packet {
byte readByte();
short readUnsignedByte();
short readShort();
int readInt();
long readLong();

View File

@@ -59,12 +59,7 @@ public final class NPCMoreTalkHandler extends AbstractPacketHandler {
if (p.available() >= 4) {
selection = p.readInt();
} else if (p.available() > 0) {
selection = p.readByte();
// If there are more than 127 choices, don't underflow to -128.
// This is useful if you want to have more than 127 hairs/faces at a stylist NPC.
if (selection < 0) {
selection += 256;
}
selection = p.readUnsignedByte();
}
if (c.getQM() != null) {
if (c.getQM().isStart()) {