Implement 26.3 bed sleeping
This commit is contained in:
@@ -3,11 +3,41 @@ import re
|
||||
import time
|
||||
from contextlib import nullcontext
|
||||
|
||||
from minecraft.networking.packets import Packet
|
||||
from minecraft.networking.types import Float, Long, VarInt, VarLong
|
||||
from minecraft.networking.modern import (
|
||||
ChatCommand, ClientboundPlayerChatPacket, ServerboundChatPacket, SystemChat,
|
||||
)
|
||||
|
||||
|
||||
class UpdateTimePacket(Packet):
|
||||
"""26.3 update-time packet with registry-indexed world clocks."""
|
||||
# The 26.1 Prismarine schema defines this payload; protocol 777's 26.3
|
||||
# clientbound table places it at 0x73 (0x71 is a different short packet).
|
||||
id = 0x73
|
||||
packet_name = 'update time'
|
||||
|
||||
def read(self, file_object):
|
||||
self.age = Long.read(file_object)
|
||||
self.clock_updates = []
|
||||
for _ in range(VarInt.read(file_object)):
|
||||
self.clock_updates.append({
|
||||
'clock_id': VarInt.read(file_object),
|
||||
'total_ticks': VarLong.read(file_object),
|
||||
'partial_tick': Float.read(file_object),
|
||||
'rate': Float.read(file_object),
|
||||
})
|
||||
|
||||
|
||||
class PlayerCommandPacket(Packet):
|
||||
"""Client player-command packet; action 0 stops sleeping (protocol 777)."""
|
||||
id = 0x2A
|
||||
packet_name = 'player command'
|
||||
definition = [
|
||||
{'entity_id': VarInt}, {'action_id': VarInt}, {'jump_boost': VarInt},
|
||||
]
|
||||
|
||||
|
||||
def parse_incoming_private_message(message):
|
||||
"""Return (sender_name, body) for common Minecraft incoming-DM forms."""
|
||||
patterns = (
|
||||
|
||||
Reference in New Issue
Block a user