diff --git a/aiocraft/mc/definitions.py b/aiocraft/mc/definitions.py index c08897f..e80f46f 100644 --- a/aiocraft/mc/definitions.py +++ b/aiocraft/mc/definitions.py @@ -1,6 +1,7 @@ from math import sqrt from enum import Enum from dataclasses import dataclass +from typing import Tuple @dataclass # TODO use the one from types class BlockPos: @@ -8,6 +9,10 @@ class BlockPos: y : float z : float + @classmethod + def from_tuple(cls, t:Tuple[int, int, int]): + return cls(x=t[0], y=t[1], z=t[2]) + def distance(self, p:'BlockPos'): return sqrt( ( self.x - p.x ) ** 2 +