Add support for Minecraft 1.18 and 1.18.1.

This commit is contained in:
joodicator committed 2021-12-16 19:39:13 +01:00
1 parent 1ae9a2b48a
commit bf49006553
17 files changed
+322 -75

No files matched your search

@@ -1,3 +1,4 @@
from minecraft import PRE
from minecraft.networking.packets import Packet
from minecraft.networking.types import (
VarInt, Byte, Boolean, UnsignedByte, VarIntPrefixedByteArray, String,
@@ -72,9 +73,9 @@ class MapPacket(Packet):
self.map_id = VarInt.read(file_object)
self.scale = Byte.read(file_object)
if self.context.protocol_later_eq(107):
if self.context.protocol_in_range(107, PRE | 6):
self.is_tracking_position = Boolean.read(file_object)
else:
elif self.context.protocol_earlier(107):
self.is_tracking_position = True
if self.context.protocol_later_eq(452):
@@ -82,6 +83,9 @@ class MapPacket(Packet):
else:
self.is_locked = False
if self.context.protocol_later_eq(PRE | 6):
self.is_tracking_position = Boolean.read(file_object)
icon_count = VarInt.read(file_object)
self.icons = []
for i in range(icon_count):
@@ -101,10 +105,7 @@ class MapPacket(Packet):
icon = MapPacket.MapIcon(type, direction, (x, z), display_name)
self.icons.append(icon)
try:
self.width = UnsignedByte.read(file_object)
except:
self.width = None
self.width = UnsignedByte.read(file_object)
if self.width:
self.height = UnsignedByte.read(file_object)
x = Byte.read(file_object)