From 900b300f66a9e39182cb6b64eda65eee6e5250ee Mon Sep 17 00:00:00 2001 From: alemidev Date: Tue, 30 Nov 2021 13:17:20 +0100 Subject: [PATCH] renamed 'Position' to 'BlockPos' --- aiocraft/mc/definitions.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/aiocraft/mc/definitions.py b/aiocraft/mc/definitions.py index 674a2c9..c08897f 100644 --- a/aiocraft/mc/definitions.py +++ b/aiocraft/mc/definitions.py @@ -1,12 +1,20 @@ +from math import sqrt from enum import Enum from dataclasses import dataclass @dataclass # TODO use the one from types -class Position: +class BlockPos: x : float y : float z : float + def distance(self, p:'BlockPos'): + return sqrt( + ( self.x - p.x ) ** 2 + + ( self.y - p.y ) ** 2 + + ( self.z - p.z ) ** 2 + ) + class Dimension(Enum): NETHER = -1 OVERWORLD = 0