From 4ba6a40df62729004323737e91635665221a2070 Mon Sep 17 00:00:00 2001 From: Zachy24 Date: Mon, 13 Aug 2018 00:41:21 +0100 Subject: [PATCH] Add aliases for Enums in Packet Definitions --- .../packets/clientbound/play/__init__.py | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/minecraft/networking/packets/clientbound/play/__init__.py b/minecraft/networking/packets/clientbound/play/__init__.py index f074e24..5269217 100644 --- a/minecraft/networking/packets/clientbound/play/__init__.py +++ b/minecraft/networking/packets/clientbound/play/__init__.py @@ -77,6 +77,15 @@ class JoinGamePacket(Packet): {'reduced_debug_info': Boolean} ]) + # JoinGamePacket.Difficulty is an alias for Difficulty + Difficulty = Difficulty + + # JoinGamePacket.Gamemode is an alias for Gamemode + Gamemode = Gamemode + + # JoinGamePacket.Dimension is an alias for Dimension + Dimension = Dimension + class ServerDifficultyPacket(Packet): @staticmethod @@ -88,9 +97,12 @@ class ServerDifficultyPacket(Packet): packet_name = 'server difficulty' get_definition = staticmethod(lambda context: [ - {'difficulty': UnsignedByte} + {'difficulty_enum': UnsignedByte} ]) + # ServerDifficultyPacket.Difficulty is an alias for Difficulty + Difficulty = Difficulty + class ChatMessagePacket(Packet): @staticmethod @@ -221,6 +233,15 @@ class RespawnPacket(Packet): {'level_type': String} ]) + # RespawnPacket.Difficulty is an alias for Difficulty. + Difficulty = Difficulty + + # RespawnPacket.Dimension is an alias for Dimension. + Dimension = Dimension + + # RespawnPacket.Gamemode is an alias for Gamemode. + Gamemode = Gamemode + class PluginMessagePacket(AbstractPluginMessagePacket): @staticmethod