Fix: networking.types.Position.send() doesn't accept a Position.
This commit is contained in:
commit
c90afe4424
2 files changed
+4
-3
No files matched your search
@@ -29,8 +29,7 @@ class BlockChangePacket(Packet):
|
|||||||
|
|
||||||
def write(self, socket, compression_threshold=None):
|
def write(self, socket, compression_threshold=None):
|
||||||
packet_buffer = PacketBuffer()
|
packet_buffer = PacketBuffer()
|
||||||
(x, y, z) = self.location
|
Position.send(self.location, packet_buffer)
|
||||||
Position.send(x, y, z, packet_buffer)
|
|
||||||
blockData = ((self.blockId << 4) | (self.blockMeta & 0xF))
|
blockData = ((self.blockId << 4) | (self.blockMeta & 0xF))
|
||||||
VarInt.send(blockData)
|
VarInt.send(blockData)
|
||||||
self._write_buffer(socket, packet_buffer, compression_threshold)
|
self._write_buffer(socket, packet_buffer, compression_threshold)
|
||||||
|
|||||||
@@ -263,7 +263,9 @@ class Position(Type, namedtuple('Position', ('x', 'y', 'z'))):
|
|||||||
return Position(x=x, y=y, z=z)
|
return Position(x=x, y=y, z=z)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def send(x, y, z, socket):
|
def send(position, socket):
|
||||||
|
# 'position' can be either a tuple or Position object.
|
||||||
|
x, y, z = position
|
||||||
value = ((x & 0x3FFFFFF) << 38) | ((y & 0xFFF) << 26) | (z & 0x3FFFFFF)
|
value = ((x & 0x3FFFFFF) << 38) | ((y & 0xFFF) << 26) | (z & 0x3FFFFFF)
|
||||||
UnsignedLong.send(value, socket)
|
UnsignedLong.send(value, socket)
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user