Added support for snapshot 20w13a
This commit is contained in:
1 parent
76f7b4bdc9
commit
428a599f40
2 files changed
+15
-2
No files matched your search
@@ -232,6 +232,7 @@ SUPPORTED_MINECRAFT_VERSIONS = {
|
|||||||
'20w10a': 705,
|
'20w10a': 705,
|
||||||
'20w11a': 706,
|
'20w11a': 706,
|
||||||
'20w12a': 707,
|
'20w12a': 707,
|
||||||
|
'20w13a': 708,
|
||||||
}
|
}
|
||||||
|
|
||||||
# Those Minecraft versions supported by pyCraft which are "release" versions,
|
# Those Minecraft versions supported by pyCraft which are "release" versions,
|
||||||
|
|||||||
@@ -253,6 +253,14 @@ class VarIntPrefixedByteArray(Type):
|
|||||||
socket.send(struct.pack(str(len(value)) + "s", value))
|
socket.send(struct.pack(str(len(value)) + "s", value))
|
||||||
|
|
||||||
|
|
||||||
|
# https://stackoverflow.com/questions/1604464/twos-complement-in-python
|
||||||
|
def twos_comp(val, bits):
|
||||||
|
"""compute the 2's complement of int value val"""
|
||||||
|
if (val & (1 << (bits - 1))) != 0: # if sign bit is set
|
||||||
|
val = val - (1 << bits) # compute negative value
|
||||||
|
return val # return positive value as is
|
||||||
|
|
||||||
|
|
||||||
class UUIDIntegerArray(Type):
|
class UUIDIntegerArray(Type):
|
||||||
""" Minecraft sends an array of 4 integers to represent the most
|
""" Minecraft sends an array of 4 integers to represent the most
|
||||||
significant and least significant bits (as longs) of a UUID
|
significant and least significant bits (as longs) of a UUID
|
||||||
@@ -271,8 +279,12 @@ class UUIDIntegerArray(Type):
|
|||||||
def send(value, socket):
|
def send(value, socket):
|
||||||
player_uuid = uuid.UUID(value)
|
player_uuid = uuid.UUID(value)
|
||||||
msb, lsb = struct.unpack(">qq", player_uuid.bytes)
|
msb, lsb = struct.unpack(">qq", player_uuid.bytes)
|
||||||
socket.send(struct.pack("4i", msb & 0xffffffff, msb >> 32,
|
socket.send(struct.pack(">4i", msb >> 32,
|
||||||
lsb & 0xffffffff, lsb >> 32))
|
twos_comp(msb & 0xffffffff, 32),
|
||||||
|
lsb >> 32,
|
||||||
|
twos_comp(lsb & 0xffffffff, 32)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class TrailingByteArray(Type):
|
class TrailingByteArray(Type):
|
||||||
|
|||||||
Reference in new issue
Block a user