Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-11-03 14:50:30 +01:00
Fix support for paintings, also add a read and write position method.
Dieser Commit ist enthalten in:
Ursprung
8ceee31299
Commit
3425ed94e0
@ -363,4 +363,17 @@ public class PacketUtil {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static long[] readBlockPosition(ByteBuf buf) {
|
||||||
|
long val = buf.readLong();
|
||||||
|
long x = (val >> 38); // signed
|
||||||
|
long y = (val >> 26) & 0xfff; // unsigned
|
||||||
|
// this shifting madness is used to preserve sign
|
||||||
|
long z = (val << 38) >> 38; // signed
|
||||||
|
return new long[]{x, y, z};
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void writeBlockPosition(ByteBuf buf, long x, long y, long z) {
|
||||||
|
buf.writeLong(((x & 0x3ffffff) << 38) | ((y & 0xfff) << 26) | (z & 0x3ffffff));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -267,6 +267,23 @@ public class OutgoingTransformer {
|
|||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (packet == PacketType.PLAY_SPAWN_PAINTING) {
|
||||||
|
int id = PacketUtil.readVarInt(input);
|
||||||
|
PacketUtil.writeVarInt(id, output);
|
||||||
|
|
||||||
|
PacketUtil.writeUUID(getUUID(id), output);
|
||||||
|
|
||||||
|
String title = PacketUtil.readString(input);
|
||||||
|
PacketUtil.writeString(title, output);
|
||||||
|
|
||||||
|
long[] position = PacketUtil.readBlockPosition(input);
|
||||||
|
PacketUtil.writeBlockPosition(output, position[0], position[1], position[2]);
|
||||||
|
|
||||||
|
byte direction = input.readByte();
|
||||||
|
output.writeByte(direction);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (packet == PacketType.PLAY_OPEN_WINDOW) {
|
if (packet == PacketType.PLAY_OPEN_WINDOW) {
|
||||||
int windowId = input.readUnsignedByte();
|
int windowId = input.readUnsignedByte();
|
||||||
String type = readString(input);
|
String type = readString(input);
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren