minecraft-bot/monkey_patch.py

29 lines
1.1 KiB
Python
Raw Normal View History

import minecraft.networking.packets
2020-09-09 02:13:15 +00:00
from protocol import packets
def get_packets(old_get_packets):
def wrapper(func, context):
print('Monkey-patch worked.')
2020-09-09 02:13:15 +00:00
mc_packets = func(context)
# add any custom CLIENTBOUND packets here
2020-09-09 02:13:15 +00:00
mc_packets.add(packets.ChunkDataPacket)
mc_packets.add(packets.AcknowledgePlayerDiggingPacket)
mc_packets.add(packets.BlockBreakAnimationPacket)
mc_packets.add(packets.SetSlotPacket)
mc_packets.add(packets.OpenWindowPacket)
2020-09-21 05:41:55 +00:00
mc_packets.add(packets.ClientWindowConfirmationPacket)
2020-09-23 06:00:28 +00:00
mc_packets.add(packets.EntityMetadataPacket)
2020-09-23 21:36:18 +00:00
mc_packets.add(packets.SpawnLivingEntityPacket)
mc_packets.add(packets.EntityPositionRotationPacket)
mc_packets.add(packets.DestroyEntitiesPacket)
2020-12-14 04:27:06 +00:00
mc_packets.add(packets.EntityTeleport)
mc_packets.add(packets.TradeListPacket)
mc_packets.add(packets.DisconnectPacket)
2020-09-09 02:13:15 +00:00
return mc_packets
return lambda x: wrapper(old_get_packets, x)
minecraft.networking.packets.clientbound.play.get_packets = get_packets(minecraft.networking.packets.clientbound.play.get_packets)