Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-11-03 14:50:30 +01:00
Merge pull request #26 from Mystalion/fix-paintings
Fix support for paintings, also add a read and write position method.
Dieser Commit ist enthalten in:
Commit
0209c51d10
@ -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