From 317a8a79e505b5844c176e64431ba953c19df405 Mon Sep 17 00:00:00 2001 From: alemidev Date: Tue, 30 Nov 2021 13:17:48 +0100 Subject: [PATCH] renamed "Position" to "BlockPos" --- treepuncher/treepuncher.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/treepuncher/treepuncher.py b/treepuncher/treepuncher.py index bf7bf54..f30e88c 100644 --- a/treepuncher/treepuncher.py +++ b/treepuncher/treepuncher.py @@ -8,7 +8,7 @@ from apscheduler.schedulers.asyncio import AsyncIOScheduler from aiocraft.client import MinecraftClient from aiocraft.mc.packet import Packet -from aiocraft.mc.definitions import Difficulty, Dimension, Gamemode, Position +from aiocraft.mc.definitions import Difficulty, Dimension, Gamemode, BlockPos from aiocraft.mc.proto.play.clientbound import ( PacketRespawn, PacketLogin, PacketPosition, PacketUpdateHealth, PacketExperience, @@ -41,7 +41,7 @@ class Treepuncher(MinecraftClient): slot : int # TODO inventory - position : Position + position : BlockPos # TODO world # TODO player abilities @@ -69,7 +69,7 @@ class Treepuncher(MinecraftClient): self.slot = 0 - self.position = Position(0, 0, 0) + self.position = BlockPos(0, 0, 0) self._register_handlers() self.modules = [] @@ -170,7 +170,7 @@ class Treepuncher(MinecraftClient): @self.on_packet(PacketPosition) async def player_rubberband_cb(packet:PacketPosition): self._logger.info("Position synchronized") - self.position = Position(packet.x, packet.y, packet.z) + self.position = BlockPos(packet.x, packet.y, packet.z) await self.dispatcher.write( PacketTeleportConfirm( self.dispatcher.proto, @@ -187,10 +187,10 @@ class Treepuncher(MinecraftClient): ) self.run_callbacks(TreepuncherEvents.DIED) self.hp = packet.health - self.food = packet.food + self.food = packet.food + packet.foodSaturation @self.on_packet(PacketExperience) - async def player_hp_cb(packet:PacketExperience): + async def player_xp_cb(packet:PacketExperience): if packet.level != self.lvl: self._logger.info("Level up : %d", packet.level) self.xp = packet.experienceBar