feat: added clone method to BlockPos

This commit is contained in:
əlemi 2023-03-16 14:11:52 +01:00
parent 7327d4764d
commit eb934a5a06
2 changed files with 4 additions and 0 deletions

View file

@ -71,6 +71,7 @@ class MinecraftClient:
return self.dispatcher.connected return self.dispatcher.connected
async def write(self, packet:Packet, wait:bool=False): async def write(self, packet:Packet, wait:bool=False):
# TODO get rid of this, too many ways to do one thing...
await self.dispatcher.write(packet, wait) await self.dispatcher.write(packet, wait)
async def authenticate(self): async def authenticate(self):

View file

@ -97,6 +97,9 @@ class BlockPos:
and (self.y - other.y) < threshold \ and (self.y - other.y) < threshold \
and (self.z - other.z) < threshold and (self.z - other.z) < threshold
def clone(self) -> 'BlockPos':
return BlockPos(self.x, self.y, self.z)
def __repr__(self) -> str: def __repr__(self) -> str:
return f"{self.__class__.__name__}(x={self.x},y={self.y},z={self.z})" return f"{self.__class__.__name__}(x={self.x},y={self.y},z={self.z})"