-
-
Notifications
You must be signed in to change notification settings - Fork 214
Open
Description
I want to make the bot move.
bot.getClientSession().send(new ServerboundMovePlayerPosRotPacket(true, false, 0, 0, 0, 0f, 0f));
`
private final MinecraftProtocol minecraftProtocol;
private final SessionService sessionService;
private final ClientSession clientSession;
private int id;
private boolean lastSprinting;
private boolean lastOnGround;
private boolean lastHorizontalCollision;
private float yRotLast;
private float xRotLast;
private int positionReminder = 0;
private double lastX, lastY, lastZ;
public Bot(MinecraftProtocol minecraftProtocol, SessionService sessionService, ClientSession clientSession) {
this.minecraftProtocol = minecraftProtocol;
this.sessionService = sessionService;
this.clientSession = clientSession;
clientSession.addListener(new SessionAdapter() {
@Override
public void packetSent(Session session, Packet packet) {
onPacketReceive(packet);
}
@Override
public void packetReceived(Session session, Packet packet) {
onPacketReceive(packet);
}
});
}
public void connect() {
this.clientSession.connect();
}
public void disconnect(String reason) {
this.clientSession.disconnect(reason);
}
public void onSend(Packet packet) {
}
public void onPacketReceive(Packet packet) {
if (packet instanceof ClientboundLoginPacket loginPacket) this.id = loginPacket.getEntityId();
}
public void sendPacket(Packet packet) {clientSession.send(packet);}
public void sendMessage(String message) {sendPacket(new ServerboundChatPacket(message, 0, 0, null, 0, new BitSet()));}
public void sendCommand(String command) {sendPacket(new ServerboundChatCommandPacket(command));}
public String getName() {
return this.minecraftProtocol.getProfile().getName();
}
public MinecraftProtocol getMinecraftProtocol() {return minecraftProtocol;}
public SessionService getSessionService() {return sessionService;}
public ClientSession getClientSession() {return clientSession;}
public int getId() {return id;}`
Metadata
Metadata
Assignees
Labels
No labels