Evade ranged weapons and rush target

This commit is contained in:
Tanner committed 2026-11-17 23:45:21 +00:00
1 parent dbd2831dda
commit 0722924263
10 files changed
+474 -14

No files matched your search

+29
View File
@@ -1,6 +1,9 @@
from math import floor
from minecraft.networking.packets import Packet, PacketBuffer
from minecraft.networking.modern import (
UnsupportedItemComponents, read_item_stack,
)
from minecraft.networking.types import (
VarInt, Integer, UnsignedByte, Position, Vector, MutableRecord,
attribute_alias, multi_attribute_alias, Long, Boolean, VarLong,
@@ -24,6 +27,32 @@ class SetHealthPacket(Packet):
]
class SetEquipmentPacket(Packet):
"""Decode protocol-777 entity equipment updates."""
id = 0x68
packet_name = 'set equipment'
def read(self, file_object):
self.entity_id = VarInt.read(file_object)
self.equipment = {}
self.incomplete = False
for _ in range(16):
packed_slot = UnsignedByte.read(file_object)
slot = packed_slot & 0x7F
has_more = bool(packed_slot & 0x80)
try:
self.equipment[slot] = read_item_stack(
file_object, self.context)
except UnsupportedItemComponents as exc:
self.equipment[slot] = exc.stack
self.incomplete = True
file_object.read()
return
if not has_more:
return
raise ValueError('set equipment contains too many slots')
class ChunkDataPacket(Packet):
id = 0x20
packet_name = 'chunk data'