- Выберите загрузчик игры
- Fabric
Удивился что такое еще не слили.. ну решил сделать, код под 1.21.4, если надо, сделаете под себя
Speed:
@EventHandler
public void onTick (TickEvent e) {
if (mc.player == null || mc.world == null) return;
if (MovingUtil.hasPlayerMovement()) {
int collisions = 0;
Box expandedBox = mc.player.getBoundingBox().expand(0.5f);
for (Entity ent : mc.world.getEntities()) {
if (!(ent instanceof PlayerEntity)) continue;
if (ent != mc.player && (ent instanceof LivingEntity || ent instanceof BoatEntity)
&& expandedBox.intersects(ent.getBoundingBox())) {
collisions++;
}
}
double[] motion = MovingUtil.forward(speed.getValue() * 0.01 * collisions);
mc.player.addVelocity(motion[0], 0.0, motion[1]);
}
}
}
forward:
public static double[] forward(final double d) {
float f = mc.player.input.movementForward;
float f2 = mc.player.input.movementSideways;
float f3 = mc.player.getYaw();
if (f != 0.0f) {
if (f2 > 0.0f) {
f3 += ((f > 0.0f) ? -45 : 45);
} else if (f2 < 0.0f) {
f3 += ((f > 0.0f) ? 45 : -45);
}
f2 = 0.0f;
if (f > 0.0f) {
f = 1.0f;
} else if (f < 0.0f) {
f = -1.0f;
}
}
final double d2 = Math.sin(Math.toRadians(f3 + 90.0f));
final double d3 = Math.cos(Math.toRadians(f3 + 90.0f));
final double d4 = f * d * d3 + f2 * d * d2;
final double d5 = f * d * d2 - f2 * d * d3;
return new double[]{d4, d5};
}