fix tox -e flake
This commit is contained in:
1 parent
cc466bb0ea
commit
fdb5a0bb72
3 files changed
+105
-36
No files matched your search
@@ -3,7 +3,7 @@ from zlib import compress
|
|||||||
|
|
||||||
from .types import (
|
from .types import (
|
||||||
VarInt, Integer, Float, Double, UnsignedShort, Long, Byte, UnsignedByte,
|
VarInt, Integer, Float, Double, UnsignedShort, Long, Byte, UnsignedByte,
|
||||||
String, VarIntPrefixedByteArray, Boolean, UUID, Short, UnsignedLong, Position
|
String, VarIntPrefixedByteArray, Boolean, UUID, Short, Position
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@@ -726,6 +726,7 @@ class MapPacket(Packet):
|
|||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.__repr__()
|
return self.__repr__()
|
||||||
|
|
||||||
|
|
||||||
class ClientSpawnPlayer(Packet):
|
class ClientSpawnPlayer(Packet):
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_id(context):
|
def get_id(context):
|
||||||
@@ -744,6 +745,7 @@ class ClientSpawnPlayer(Packet):
|
|||||||
{'current_item': Short} if context.protocol_version <= 49 else {}
|
{'current_item': Short} if context.protocol_version <= 49 else {}
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
class ClientEntityVelocity(Packet):
|
class ClientEntityVelocity(Packet):
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_id(context):
|
def get_id(context):
|
||||||
@@ -761,6 +763,7 @@ class ClientEntityVelocity(Packet):
|
|||||||
{'velocity_z': Short}
|
{'velocity_z': Short}
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
class ClientUpdateHealth(Packet):
|
class ClientUpdateHealth(Packet):
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_id(context):
|
def get_id(context):
|
||||||
@@ -777,6 +780,7 @@ class ClientUpdateHealth(Packet):
|
|||||||
{'food_saturation': Float}
|
{'food_saturation': Float}
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
class ClientCombatEvent(Packet):
|
class ClientCombatEvent(Packet):
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_id(context):
|
def get_id(context):
|
||||||
@@ -835,6 +839,7 @@ class ClientCombatEvent(Packet):
|
|||||||
def write(self, socket, compression_threshold=None):
|
def write(self, socket, compression_threshold=None):
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
|
|
||||||
class ClientExplosion(Packet):
|
class ClientExplosion(Packet):
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_id(context):
|
def get_id(context):
|
||||||
@@ -861,7 +866,6 @@ class ClientExplosion(Packet):
|
|||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.__repr__()
|
return self.__repr__()
|
||||||
|
|
||||||
|
|
||||||
class Explosion(object):
|
class Explosion(object):
|
||||||
__slots__ = ('x', 'y', 'z', 'radius', 'records',
|
__slots__ = ('x', 'y', 'z', 'radius', 'records',
|
||||||
'player_motion_x', 'player_motion_y', 'player_motion_z')
|
'player_motion_x', 'player_motion_y', 'player_motion_z')
|
||||||
@@ -946,33 +950,86 @@ class ClientSpawnObject(Packet):
|
|||||||
% type_id)
|
% type_id)
|
||||||
return subcls
|
return subcls
|
||||||
|
|
||||||
class Type_Boat(Type): pass
|
class Type_Boat(Type):
|
||||||
class Type_Item_Stack(Type): pass
|
pass
|
||||||
class Type_Area_Effect_Cloud(Type): pass
|
|
||||||
class Type_Minecart(Type): pass
|
class Type_Item_Stack(Type):
|
||||||
class Type_Activated_TNT(Type): pass
|
pass
|
||||||
class Type_EnderCrystal(Type): pass
|
|
||||||
class Type_Arrow(Type): pass
|
class Type_Area_Effect_Cloud(Type):
|
||||||
class Type_Snowball(Type): pass
|
pass
|
||||||
class Type_Egg(Type): pass
|
|
||||||
class Type_FireBall(Type): pass
|
class Type_Minecart(Type):
|
||||||
class Type_FireCharge(Type): pass
|
pass
|
||||||
class Type_Enderpearl(Type): pass
|
|
||||||
class Type_Wither_Skull(Type): pass
|
class Type_Activated_TNT(Type):
|
||||||
class Type_Shulker_Bullet(Type): pass
|
pass
|
||||||
class Type_Llama_spit(Type): pass
|
|
||||||
class Type_Falling_Objects(Type): pass
|
class Type_EnderCrystal(Type):
|
||||||
class Type_Item_frames(Type): pass
|
pass
|
||||||
class Type_Eye_of_Ender(Type): pass
|
|
||||||
class Type_Potion(Type): pass
|
class Type_Arrow(Type):
|
||||||
class Type_Exp_Bottle(Type): pass
|
pass
|
||||||
class Type_Firework_Rocket(Type): pass
|
|
||||||
class Type_Leash_Knot(Type): pass
|
class Type_Snowball(Type):
|
||||||
class Type_ArmorStand(Type): pass
|
pass
|
||||||
class Type_Evocation_Fangs(Type): pass
|
|
||||||
class Type_Fishing_Hook(Type): pass
|
class Type_Egg(Type):
|
||||||
class Type_Spectral_Arrow(Type): pass
|
pass
|
||||||
class Type_Dragon_Fireball(Type): pass
|
|
||||||
|
class Type_FireBall(Type):
|
||||||
|
pass
|
||||||
|
|
||||||
|
class Type_FireCharge(Type):
|
||||||
|
pass
|
||||||
|
|
||||||
|
class Type_Enderpearl(Type):
|
||||||
|
pass
|
||||||
|
|
||||||
|
class Type_Wither_Skull(Type):
|
||||||
|
pass
|
||||||
|
|
||||||
|
class Type_Shulker_Bullet(Type):
|
||||||
|
pass
|
||||||
|
|
||||||
|
class Type_Llama_spit(Type):
|
||||||
|
pass
|
||||||
|
|
||||||
|
class Type_Falling_Objects(Type):
|
||||||
|
pass
|
||||||
|
|
||||||
|
class Type_Item_frames(Type):
|
||||||
|
pass
|
||||||
|
|
||||||
|
class Type_Eye_of_Ender(Type):
|
||||||
|
pass
|
||||||
|
|
||||||
|
class Type_Potion(Type):
|
||||||
|
pass
|
||||||
|
|
||||||
|
class Type_Exp_Bottle(Type):
|
||||||
|
pass
|
||||||
|
|
||||||
|
class Type_Firework_Rocket(Type):
|
||||||
|
pass
|
||||||
|
|
||||||
|
class Type_Leash_Knot(Type):
|
||||||
|
pass
|
||||||
|
|
||||||
|
class Type_ArmorStand(Type):
|
||||||
|
pass
|
||||||
|
|
||||||
|
class Type_Evocation_Fangs(Type):
|
||||||
|
pass
|
||||||
|
|
||||||
|
class Type_Fishing_Hook(Type):
|
||||||
|
pass
|
||||||
|
|
||||||
|
class Type_Spectral_Arrow(Type):
|
||||||
|
pass
|
||||||
|
|
||||||
|
class Type_Dragon_Fireball(Type):
|
||||||
|
pass
|
||||||
|
|
||||||
def read(self, file_object):
|
def read(self, file_object):
|
||||||
self.entity_id = VarInt.read(file_object)
|
self.entity_id = VarInt.read(file_object)
|
||||||
@@ -1007,6 +1064,7 @@ class ClientSpawnObject(Packet):
|
|||||||
def write(self, socket, compression_threshold=None):
|
def write(self, socket, compression_threshold=None):
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
|
|
||||||
class ClientBlockChange(Packet):
|
class ClientBlockChange(Packet):
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_id(context):
|
def get_id(context):
|
||||||
@@ -1027,6 +1085,7 @@ class ClientBlockChange(Packet):
|
|||||||
def write(self, socket, compression_threshold=None):
|
def write(self, socket, compression_threshold=None):
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
|
|
||||||
class ClientMultiBlockChange(Packet):
|
class ClientMultiBlockChange(Packet):
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_id(context):
|
def get_id(context):
|
||||||
@@ -1063,12 +1122,15 @@ class ClientMultiBlockChange(Packet):
|
|||||||
rec_horizontal_position = UnsignedByte.read(file_object)
|
rec_horizontal_position = UnsignedByte.read(file_object)
|
||||||
rec_y_coordinate = UnsignedByte.read(file_object)
|
rec_y_coordinate = UnsignedByte.read(file_object)
|
||||||
rec_blockData = VarInt.read(file_object)
|
rec_blockData = VarInt.read(file_object)
|
||||||
record = ClientMultiBlockChange.Record(rec_horizontal_position,rec_y_coordinate,rec_blockData)
|
record = ClientMultiBlockChange.Record(
|
||||||
|
rec_horizontal_position,
|
||||||
|
rec_y_coordinate, rec_blockData)
|
||||||
self.records.append(record)
|
self.records.append(record)
|
||||||
|
|
||||||
def write(self, socket, compression_threshold=None):
|
def write(self, socket, compression_threshold=None):
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
|
|
||||||
def state_playing_clientbound(context):
|
def state_playing_clientbound(context):
|
||||||
packets = {
|
packets = {
|
||||||
KeepAlivePacketClientbound,
|
KeepAlivePacketClientbound,
|
||||||
@@ -1093,6 +1155,7 @@ def state_playing_clientbound(context):
|
|||||||
}
|
}
|
||||||
return packets
|
return packets
|
||||||
|
|
||||||
|
|
||||||
class ChatPacket(Packet):
|
class ChatPacket(Packet):
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_id(context):
|
def get_id(context):
|
||||||
@@ -1157,6 +1220,7 @@ class AnimationPacketServerbound(Packet):
|
|||||||
HAND_MAIN = 0
|
HAND_MAIN = 0
|
||||||
HAND_OFF = 1
|
HAND_OFF = 1
|
||||||
|
|
||||||
|
|
||||||
class ServerClientStatus(Packet):
|
class ServerClientStatus(Packet):
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_id(context):
|
def get_id(context):
|
||||||
@@ -1173,6 +1237,7 @@ class ServerClientStatus(Packet):
|
|||||||
RESPAWN = 0
|
RESPAWN = 0
|
||||||
REQUEST_STATS = 1
|
REQUEST_STATS = 1
|
||||||
|
|
||||||
|
|
||||||
def state_playing_serverbound(context):
|
def state_playing_serverbound(context):
|
||||||
packets = {
|
packets = {
|
||||||
KeepAlivePacketServerbound,
|
KeepAlivePacketServerbound,
|
||||||
|
|||||||
@@ -147,6 +147,7 @@ class Long(Type):
|
|||||||
def send(value, socket):
|
def send(value, socket):
|
||||||
socket.send(struct.pack('>q', value))
|
socket.send(struct.pack('>q', value))
|
||||||
|
|
||||||
|
|
||||||
class UnsignedLong(Type):
|
class UnsignedLong(Type):
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def read(file_object):
|
def read(file_object):
|
||||||
@@ -156,6 +157,7 @@ class UnsignedLong(Type):
|
|||||||
def send(value, socket):
|
def send(value, socket):
|
||||||
socket.send(struct.pack('>Q', value))
|
socket.send(struct.pack('>Q', value))
|
||||||
|
|
||||||
|
|
||||||
class Float(Type):
|
class Float(Type):
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def read(file_object):
|
def read(file_object):
|
||||||
@@ -222,13 +224,14 @@ class UUID(Type):
|
|||||||
def send(value, socket):
|
def send(value, socket):
|
||||||
socket.send(uuid.UUID(value).bytes)
|
socket.send(uuid.UUID(value).bytes)
|
||||||
|
|
||||||
|
|
||||||
class Position(Type):
|
class Position(Type):
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def read(file_object):
|
def read(file_object):
|
||||||
location = UnsignedLong.read(file_object) # 64-bit value
|
location = UnsignedLong.read(file_object)
|
||||||
x = int(location >> 38) # 26 MSBs
|
x = int(location >> 38)
|
||||||
y = int((location >> 26) & 0xFFF) # 12 bits between them
|
y = int((location >> 26) & 0xFFF)
|
||||||
z = int(location & 0x3FFFFFF) # 26 LSBs
|
z = int(location & 0x3FFFFFF)
|
||||||
|
|
||||||
if x >= pow(2, 25):
|
if x >= pow(2, 25):
|
||||||
x -= pow(2, 26)
|
x -= pow(2, 26)
|
||||||
@@ -243,7 +246,6 @@ class Position(Type):
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def send(value, socket):
|
def send(value, socket):
|
||||||
# Position is a single encoded long value; use encode method to encode position properly
|
|
||||||
UnsignedLong.send(value, socket)
|
UnsignedLong.send(value, socket)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
|||||||
@@ -7,7 +7,9 @@ from optparse import OptionParser
|
|||||||
from minecraft import authentication
|
from minecraft import authentication
|
||||||
from minecraft.exceptions import YggdrasilError
|
from minecraft.exceptions import YggdrasilError
|
||||||
from minecraft.networking.connection import Connection
|
from minecraft.networking.connection import Connection
|
||||||
from minecraft.networking.packets import ChatMessagePacket, ChatPacket, ServerClientStatus
|
from minecraft.networking.packets import (
|
||||||
|
ChatMessagePacket, ChatPacket, ServerClientStatus
|
||||||
|
)
|
||||||
from minecraft.compat import input
|
from minecraft.compat import input
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user