Merge aeef856a98
into bcd156e83b
This commit is contained in:
commit
2707475c00
|
@ -2,6 +2,7 @@ from minecraft.networking.packets import (
|
|||
Packet, AbstractKeepAlivePacket, AbstractPluginMessagePacket
|
||||
)
|
||||
|
||||
|
||||
from minecraft.networking.types import (
|
||||
Double, Float, Boolean, VarInt, String, Byte, Position, Enum,
|
||||
RelativeHand, BlockFace, Vector, Direction, PositionAndLook,
|
||||
|
@ -9,19 +10,22 @@ from minecraft.networking.types import (
|
|||
)
|
||||
|
||||
from .client_settings_packet import ClientSettingsPacket
|
||||
|
||||
from .vehicle_move_packet import VehicleMovePacket
|
||||
from .player_position_packet import PlayerPositionPacket
|
||||
|
||||
# Formerly known as state_playing_serverbound.
|
||||
def get_packets(context):
|
||||
packets = {
|
||||
KeepAlivePacket,
|
||||
ChatPacket,
|
||||
PlayerPositionPacket,
|
||||
PositionAndLookPacket,
|
||||
AnimationPacket,
|
||||
ClientStatusPacket,
|
||||
ClientSettingsPacket,
|
||||
PluginMessagePacket,
|
||||
PlayerBlockPlacementPacket,
|
||||
VehicleMovePacket
|
||||
}
|
||||
if context.protocol_later_eq(69):
|
||||
packets |= {
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
from minecraft.networking.packets import Packet
|
||||
from minecraft.networking.types import (
|
||||
Double, Float, Boolean, Vector, multi_attribute_alias
|
||||
)
|
||||
|
||||
class PlayerPositionPacket(Packet):
|
||||
@staticmethod
|
||||
def get_id(context):
|
||||
return 0x11 if context.protocol_version >= 471 else \
|
||||
0x12 if context.protocol_version >= 464 else \
|
||||
0x10 if context.protocol_version >= 389 else \
|
||||
0x0E if context.protocol_version >= 386 else \
|
||||
0x0D if context.protocol_version >= 345 else \
|
||||
0x0C if context.protocol_version >= 343 else \
|
||||
0x0D if context.protocol_version >= 336 else \
|
||||
0x0E if context.protocol_version >= 332 else \
|
||||
0x0D if context.protocol_version >= 318 else \
|
||||
0x0C if context.protocol_version >= 94 else \
|
||||
0x0B if context.protocol_version >= 70 else \
|
||||
0x04
|
||||
|
||||
packet_name = "player position"
|
||||
definition = [
|
||||
{'x': Double},
|
||||
{'feet_y': Double},
|
||||
{'z': Double},
|
||||
{'on_ground': Boolean}
|
||||
]
|
||||
|
||||
# The code under this line was copied from the packets/clientbound/play/player_position_and_look_packet.py
|
||||
|
||||
# Access the 'x', 'y', 'z' fields as a Vector tuple.
|
||||
position = multi_attribute_alias(Vector, 'x', 'feet_y', 'z')
|
|
@ -0,0 +1,39 @@
|
|||
from minecraft.networking.packets import Packet
|
||||
from minecraft.networking.types import (
|
||||
Double, Float, Vector, multi_attribute_alias, Direction, PositionAndLook
|
||||
)
|
||||
|
||||
class VehicleMovePacket(Packet):
|
||||
@staticmethod
|
||||
def get_id(context):
|
||||
return 0x15 if context.protocol_version >= 464 else \
|
||||
0x13 if context.protocol_version >= 389 else \
|
||||
0x11 if context.protocol_version >= 386 else \
|
||||
0x10 if context.protocol_version >= 345 else \
|
||||
0x0F if context.protocol_version >= 343 else \
|
||||
0x10 if context.protocol_version >= 336 else \
|
||||
0x11 if context.protocol_version >= 318 else \
|
||||
0x10
|
||||
|
||||
packet_name = "vehicle move"
|
||||
definition = [
|
||||
{'x': Double},
|
||||
{'y': Double},
|
||||
{'z': Double},
|
||||
{'yaw': Float},
|
||||
{'pitch': Float}
|
||||
]
|
||||
|
||||
# The code under this line was copied from the packets/clientbound/play/player_position_and_look_packet.py
|
||||
|
||||
# Access the 'x', 'y', 'z' fields as a Vector tuple.
|
||||
position = multi_attribute_alias(Vector, 'x', 'y', 'z')
|
||||
|
||||
# Access the 'yaw', 'pitch' fields as a Direction tuple.
|
||||
look = multi_attribute_alias(Direction, 'yaw', 'pitch')
|
||||
|
||||
# Access the 'x', 'y', 'z', 'yaw', 'pitch' fields as a PositionAndLook.
|
||||
# NOTE: modifying the object retrieved from this property will not change
|
||||
# the packet; it can only be changed by attribute or property assignment.
|
||||
position_and_look = multi_attribute_alias(
|
||||
PositionAndLook, 'x', 'y', 'z', 'yaw', 'pitch')
|
Loading…
Reference in New Issue