From d8fc742862a8d4529b8f32e314d7e36a7b9bc721 Mon Sep 17 00:00:00 2001 From: TheSnoozer Date: Sat, 5 Aug 2017 14:04:27 +0200 Subject: [PATCH] feedback: pass x, y, z as arguments since types classes are supposed to abstract away the python types and sending them over the network and calling an encode method before sending breaks that a little. --- minecraft/networking/types.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/minecraft/networking/types.py b/minecraft/networking/types.py index 6966793..c9f6843 100644 --- a/minecraft/networking/types.py +++ b/minecraft/networking/types.py @@ -245,9 +245,6 @@ class Position(Type): return {'x': x, 'y': y, 'z': z} @staticmethod - def send(value, socket): + def send(x, y, z, socket): + value = ((x & 0x3FFFFFF) << 38) | ((y & 0xFFF) << 26) | (z & 0x3FFFFFF) UnsignedLong.send(value, socket) - - @staticmethod - def encode(x, y, z): - return ((x & 0x3FFFFFF) << 38) | ((y & 0xFFF) << 26) | (z & 0x3FFFFFF)