Feedback: Replace FeetEyes convention with OriginPoint for forward compat
This commit is contained in:
1 parent
0b127da0ca
commit
e8a0e34aef
2 files changed
+10
-10
No files matched your search
@@ -1,5 +1,5 @@
|
|||||||
from minecraft.networking.types import (
|
from minecraft.networking.types import (
|
||||||
VarInt, Double, Boolean, FeetEyes
|
VarInt, Double, Boolean, OriginPoint
|
||||||
)
|
)
|
||||||
|
|
||||||
from minecraft.networking.packets import Packet
|
from minecraft.networking.packets import Packet
|
||||||
@@ -17,7 +17,7 @@ class FacePlayerPacket(Packet):
|
|||||||
|
|
||||||
def read(self, file_object):
|
def read(self, file_object):
|
||||||
if self.context.protocol_version >= 353:
|
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.x = Double.read(file_object)
|
||||||
self.y = Double.read(file_object)
|
self.y = Double.read(file_object)
|
||||||
self.z = 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,
|
# If the entity given by entity ID cannot be found,
|
||||||
# this packet should be treated as if is_entity was false.
|
# this packet should be treated as if is_entity was false.
|
||||||
self.entity_id = VarInt.read(file_object)
|
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
|
else: # Protocol version 352
|
||||||
is_entity = Boolean.read(file_object)
|
is_entity = Boolean.read(file_object)
|
||||||
@@ -38,13 +38,13 @@ class FacePlayerPacket(Packet):
|
|||||||
|
|
||||||
def write_fields(self, packet_buffer):
|
def write_fields(self, packet_buffer):
|
||||||
if self.context.protocol_version >= 353:
|
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.x, packet_buffer)
|
||||||
Double.send(self.y, packet_buffer)
|
Double.send(self.y, packet_buffer)
|
||||||
Double.send(self.z, packet_buffer)
|
Double.send(self.z, packet_buffer)
|
||||||
if self.entity_id:
|
if self.entity_id:
|
||||||
VarInt.send(self.entity_id, packet_buffer)
|
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
|
else: # Protocol version 352
|
||||||
if self.entity_id:
|
if self.entity_id:
|
||||||
@@ -56,5 +56,5 @@ class FacePlayerPacket(Packet):
|
|||||||
Double.send(self.y, packet_buffer)
|
Double.send(self.y, packet_buffer)
|
||||||
Double.send(self.z, packet_buffer)
|
Double.send(self.z, packet_buffer)
|
||||||
|
|
||||||
# FacePlayerPacket.FeetEyes is an alias for FeetEyes
|
# FacePlayerPacket.OriginPoint is an alias for OriginPoint
|
||||||
FeetEyes = FeetEyes
|
OriginPoint = OriginPoint
|
||||||
@@ -12,7 +12,7 @@ from .utility import Vector
|
|||||||
|
|
||||||
__all__ = (
|
__all__ = (
|
||||||
'Enum', 'BitFieldEnum', 'AbsoluteHand', 'RelativeHand', 'BlockFace',
|
'Enum', 'BitFieldEnum', 'AbsoluteHand', 'RelativeHand', 'BlockFace',
|
||||||
'Difficulty', 'Dimension', 'GameMode', 'FeetEyes'
|
'Difficulty', 'Dimension', 'GameMode', 'OriginPoint'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@@ -108,8 +108,8 @@ class GameMode(Enum):
|
|||||||
SPECTATOR = 3
|
SPECTATOR = 3
|
||||||
|
|
||||||
|
|
||||||
# Designation of an entity's head or eyes.
|
# Currently designates an entity's feet or eyes.
|
||||||
# Used in the Face Player Packet
|
# Used in the Face Player Packet
|
||||||
class FeetEyes(Enum):
|
class OriginPoint(Enum):
|
||||||
FEET = 0
|
FEET = 0
|
||||||
EYES = 1
|
EYES = 1
|
||||||
Reference in new issue
Block a user