Use built in BlockChangePacket and MultiBlockChangePacket
This commit is contained in:
27
bot.py
27
bot.py
@@ -20,7 +20,7 @@ from minecraft.networking.connection import Connection
|
||||
from minecraft.networking.packets import Packet, clientbound, serverbound
|
||||
|
||||
from protocol.managers import DataManager, ChunksManager, ChatManager, ChunkNotLoadedException
|
||||
from protocol.packets import BlockChangePacket
|
||||
from protocol.packets import TimeUpdatePacket, SetSlotPacket
|
||||
|
||||
from bunch import Bunch
|
||||
from panda3d.core import LPoint3f, LVector3f
|
||||
@@ -185,18 +185,27 @@ def bot(global_state):
|
||||
|
||||
g.chunks.register(g.connection)
|
||||
|
||||
h1 = packet_wrapper(packet_handlers.handle_join_game)
|
||||
g.connection.register_packet_listener(h1, clientbound.play.JoinGamePacket)
|
||||
def x(p):
|
||||
print(p)
|
||||
|
||||
h2 = packet_wrapper(packet_handlers.handle_position_and_look)
|
||||
g.connection.register_packet_listener(h2, clientbound.play.PlayerPositionAndLookPacket)
|
||||
h = packet_wrapper(packet_handlers.handle_block_change)
|
||||
g.connection.register_packet_listener(h, clientbound.play.BlockChangePacket)
|
||||
|
||||
h3 = packet_wrapper(packet_handlers.handle_block_change)
|
||||
g.connection.register_packet_listener(h3, BlockChangePacket)
|
||||
h = packet_wrapper(packet_handlers.handle_join_game)
|
||||
g.connection.register_packet_listener(h, clientbound.play.JoinGamePacket)
|
||||
|
||||
h = packet_wrapper(packet_handlers.handle_position_and_look)
|
||||
g.connection.register_packet_listener(h, clientbound.play.PlayerPositionAndLookPacket)
|
||||
|
||||
g.chat = ChatManager(g)
|
||||
h4 = packet_wrapper(packet_handlers.handle_chat)
|
||||
g.chat.set_handler(h4)
|
||||
h = packet_wrapper(packet_handlers.handle_chat)
|
||||
g.chat.set_handler(h)
|
||||
|
||||
h = packet_wrapper(packet_handlers.handle_time_update)
|
||||
g.connection.register_packet_listener(h, TimeUpdatePacket)
|
||||
|
||||
h = packet_wrapper(packet_handlers.handle_set_slot)
|
||||
g.connection.register_packet_listener(h, SetSlotPacket)
|
||||
|
||||
try:
|
||||
while not g.pos:
|
||||
|
Reference in New Issue
Block a user