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,5 +1,6 @@
from minecraft.networking.types import (
Vector, Float, Byte, Integer, PrefixedArray, multi_attribute_alias, Type,
VarInt,
)
from minecraft.networking.packets import Packet
@@ -34,15 +35,22 @@ class ExplosionPacket(Packet):
for coord in record:
Byte.send(coord, socket)
definition = [
{'x': Float},
{'y': Float},
{'z': Float},
{'radius': Float},
{'records': PrefixedArray(Integer, Record)},
{'player_motion_x': Float},
{'player_motion_y': Float},
{'player_motion_z': Float}]
@staticmethod
def get_definition(context):
return [
{'x': Float},
{'y': Float},
{'z': Float},
{'radius': Float},
{'records': PrefixedArray(VarInt, ExplosionPacket.Record)}
if context.protocol_later_eq(755) else
{'records': PrefixedArray(Integer, ExplosionPacket.Record)},
{'player_motion_x': Float},
{'player_motion_y': Float},
{'player_motion_z': Float},
]
# Access the 'x', 'y', 'z' fields as a Vector tuple.
position = multi_attribute_alias(Vector, 'x', 'y', 'z')