ClientTickEvents.END_CLIENT_TICK.register(client -> {
if (client.player == null || client.world == null) return;
if (MobilityHandler.isMoving()) {
int collisions = 0;
Box expandedBox = client.player.getBoundingBox().expand(radius.getValue().doubleValue());
for (Entity ent : client.world.getEntities()) {
if (onlyPlayers.getValue() && !(ent instanceof PlayerEntity)) continue;
if (ent != client.player && (ent instanceof LivingEntity || ent instanceof BoatEntity)
&& expandedBox.intersects(ent.getBoundingBox())) {
collisions++;
}
}
double[] motion = MobilityHandler.forward(speed.getValue().intValue() * 0.01 * collisions);
client.player.addVelocity(motion[0], 0.0, motion[1]);
}
делал я тк чето ошибок было с MinecraftClient.get
чатгпт пофиксил