track player abilities
This commit is contained in:
parent
b8477c3d22
commit
3548603578
1 changed files with 14 additions and 2 deletions
|
@ -1,10 +1,11 @@
|
||||||
import asyncio
|
import asyncio
|
||||||
import datetime
|
import datetime
|
||||||
import functools
|
|
||||||
|
|
||||||
#from aiocraft.client import MinecraftClient
|
#from aiocraft.client import MinecraftClient
|
||||||
from aiocraft.mc.definitions import Gamemode, Dimension, Difficulty
|
from aiocraft.mc.definitions import Gamemode, Dimension, Difficulty
|
||||||
from aiocraft.mc.proto import PacketRespawn, PacketLogin, PacketUpdateHealth, PacketExperience, PacketSettings, PacketClientCommand
|
from aiocraft.mc.proto import (
|
||||||
|
PacketRespawn, PacketLogin, PacketUpdateHealth, PacketExperience, PacketSettings, PacketClientCommand, PacketAbilities
|
||||||
|
)
|
||||||
|
|
||||||
from ..events import JoinGameEvent, DeathEvent, ConnectedEvent, DisconnectedEvent
|
from ..events import JoinGameEvent, DeathEvent, ConnectedEvent, DisconnectedEvent
|
||||||
from ..scaffold import Scaffold
|
from ..scaffold import Scaffold
|
||||||
|
@ -27,6 +28,11 @@ class GameState(Scaffold):
|
||||||
difficulty : Difficulty
|
difficulty : Difficulty
|
||||||
join_time : datetime.datetime
|
join_time : datetime.datetime
|
||||||
|
|
||||||
|
# Abilities
|
||||||
|
flags : int
|
||||||
|
flyingSpeed : float
|
||||||
|
walkingSpeed : float
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
|
|
||||||
|
@ -114,3 +120,9 @@ class GameState(Scaffold):
|
||||||
self.lvl = packet.level
|
self.lvl = packet.level
|
||||||
self.total_xp = packet.totalExperience
|
self.total_xp = packet.totalExperience
|
||||||
|
|
||||||
|
@self.on_packet(PacketAbilities)
|
||||||
|
async def player_abilities_cb(packet:PacketAbilities):
|
||||||
|
self.flags = packet.flags
|
||||||
|
self.flyingSpeed = packet.flyingSpeed
|
||||||
|
self.walkingSpeed = packet.walkingSpeed
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue