Add support for Minecraft 18w43a to 1.14 (protocols 441 to 477)
This commit introduces two backward-incompatible changes which may break existing code: (1) `networking.packets.clientbound.play.SpawnObjectPacket.EntityType' is no longer accessible as an attribute of the the `SpawnObjectPacket' class: the values now depend on a `ConnectionContext`, and must be accessed through an instance, or using `SpawnObjectPacket.field_enum'. See the text of the `AttributeError` raised from the descriptor for `SpawnObjectPacket.EntityType` for the full details. (2) For some subclasses of `networking.types.Type', it is necessary to call the methods `read_with_context' and `send_with_context' instead of `read' and `send', supplying a `ConnectionContext' for those data types - currently only `Position` - whose layout depends on it.
This commit is contained in:
1 parent
9b43d6f004
commit
612fa8e324
20 files changed
+463
-219
No files matched your search
@@ -28,7 +28,7 @@ class MapPacket(Packet):
|
||||
|
||||
class Map(MutableRecord):
|
||||
__slots__ = ('id', 'scale', 'icons', 'pixels', 'width', 'height',
|
||||
'is_tracking_position')
|
||||
'is_tracking_position', 'is_locked')
|
||||
|
||||
def __init__(self, id=None, scale=None, width=128, height=128):
|
||||
self.id = id
|
||||
@@ -38,6 +38,7 @@ class MapPacket(Packet):
|
||||
self.height = height
|
||||
self.pixels = bytearray(0 for i in range(width*height))
|
||||
self.is_tracking_position = True
|
||||
self.is_locked = False
|
||||
|
||||
class MapSet(object):
|
||||
__slots__ = 'maps_by_id'
|
||||
@@ -58,6 +59,11 @@ class MapPacket(Packet):
|
||||
else:
|
||||
self.is_tracking_position = True
|
||||
|
||||
if self.context.protocol_version >= 452:
|
||||
self.is_locked = Boolean.read(file_object)
|
||||
else:
|
||||
self.is_locked = False
|
||||
|
||||
icon_count = VarInt.read(file_object)
|
||||
self.icons = []
|
||||
for i in range(icon_count):
|
||||
@@ -99,6 +105,7 @@ class MapPacket(Packet):
|
||||
z = self.offset[1] + i // self.width
|
||||
map.pixels[x + map.width * z] = self.pixels[i]
|
||||
map.is_tracking_position = self.is_tracking_position
|
||||
map.is_locked = self.is_locked
|
||||
|
||||
def apply_to_map_set(self, map_set):
|
||||
map = map_set.maps_by_id.get(self.map_id)
|
||||
|
||||
Reference in new issue
Block a user