From e8a0e34aefeffaec19bd5b7fcf8728eecabfd46f Mon Sep 17 00:00:00 2001 From: Zachy Date: Fri, 17 May 2019 21:38:57 +0100 Subject: [PATCH] Feedback: Replace FeetEyes convention with OriginPoint for forward compat --- .../packets/clientbound/play/face_player_packet.py | 14 +++++++------- minecraft/networking/types/enum.py | 6 +++--- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/minecraft/networking/packets/clientbound/play/face_player_packet.py b/minecraft/networking/packets/clientbound/play/face_player_packet.py index 83e3f20..a9a9abf 100644 --- a/minecraft/networking/packets/clientbound/play/face_player_packet.py +++ b/minecraft/networking/packets/clientbound/play/face_player_packet.py @@ -1,5 +1,5 @@ from minecraft.networking.types import ( - VarInt, Double, Boolean, FeetEyes + VarInt, Double, Boolean, OriginPoint ) from minecraft.networking.packets import Packet @@ -17,7 +17,7 @@ class FacePlayerPacket(Packet): def read(self, file_object): if self.context.protocol_version >= 353: - self.feet_or_eyes = VarInt.read(file_object) + self.origin = VarInt.read(file_object) self.x = Double.read(file_object) self.y = Double.read(file_object) self.z = Double.read(file_object) @@ -26,7 +26,7 @@ class FacePlayerPacket(Packet): # If the entity given by entity ID cannot be found, # this packet should be treated as if is_entity was false. self.entity_id = VarInt.read(file_object) - self.entity_feet_or_eyes = VarInt.read(file_object) + self.entity_origin = VarInt.read(file_object) else: # Protocol version 352 is_entity = Boolean.read(file_object) @@ -38,13 +38,13 @@ class FacePlayerPacket(Packet): def write_fields(self, packet_buffer): if self.context.protocol_version >= 353: - VarInt.send(self.feet_or_eyes, packet_buffer) + VarInt.send(self.origin, packet_buffer) Double.send(self.x, packet_buffer) Double.send(self.y, packet_buffer) Double.send(self.z, packet_buffer) if self.entity_id: VarInt.send(self.entity_id, packet_buffer) - VarInt.send(self.entity_feet_or_eyes, packet_buffer) + VarInt.send(self.entity_origin, packet_buffer) else: # Protocol version 352 if self.entity_id: @@ -56,5 +56,5 @@ class FacePlayerPacket(Packet): Double.send(self.y, packet_buffer) Double.send(self.z, packet_buffer) - # FacePlayerPacket.FeetEyes is an alias for FeetEyes - FeetEyes = FeetEyes + # FacePlayerPacket.OriginPoint is an alias for OriginPoint + OriginPoint = OriginPoint diff --git a/minecraft/networking/types/enum.py b/minecraft/networking/types/enum.py index c50b5ff..61aa238 100644 --- a/minecraft/networking/types/enum.py +++ b/minecraft/networking/types/enum.py @@ -12,7 +12,7 @@ from .utility import Vector __all__ = ( 'Enum', 'BitFieldEnum', 'AbsoluteHand', 'RelativeHand', 'BlockFace', - 'Difficulty', 'Dimension', 'GameMode', 'FeetEyes' + 'Difficulty', 'Dimension', 'GameMode', 'OriginPoint' ) @@ -108,8 +108,8 @@ class GameMode(Enum): SPECTATOR = 3 -# Designation of an entity's head or eyes. +# Currently designates an entity's feet or eyes. # Used in the Face Player Packet -class FeetEyes(Enum): +class OriginPoint(Enum): FEET = 0 EYES = 1