Начинающий
- Статус
- Оффлайн
- Регистрация
- 15 Июн 2025
- Сообщения
- 14
- Реакции
- 1
- Выберите загрузчик игры
- Vanilla
утилка для нормальных ротаций, а точнее сброса. (точнее для сброса она писалась)
как юзать:
и ресет в киллауре заменить на это:
сама утилка:
слил потому, что скоро сервера будут переходить на 1.21+ и экспа станет неактуальной.
как юзать:
Java:
private void updateRotation() {
Vector3d vec = getVector(target);
vec = vec.subtract(mc.player.getEyePosition(1.0f));
(ротации и прочее)
float pitch = clamp(rotateVector.y + deltaPitchStep, -90, 90);
yaw += ThreadLocalRandom.current().nextFloat(20);
pitch += ThreadLocalRandom.current().nextFloat(10);
rotateVector = new Vector2f(yaw, pitch);
}
}
}
rotationUtil.updateRotation(rotateVector.x, rotateVector.y); // <<<<
}
и ресет в киллауре заменить на это:
Java:
private void reset() {
rotationUtil.resetRotation(type.is("Grim"));
}
сама утилка:
Java:
package im.expensive.utils.player;
import com.google.common.eventbus.Subscribe;
import im.expensive.Expensive;
import im.expensive.managers.events.EventMotion;
import im.expensive.managers.events.EventUpdate;
import im.expensive.utils.client.IMinecraft;
import im.expensive.utils.math.SensUtils;
import lombok.Getter;
import net.minecraft.stats.Stat;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.vector.Vector2f;
import static net.minecraft.util.math.MathHelper.clamp;
public class RotationUtil implements IMinecraft {
@Getter
private static Vector2f rotateVector = new Vector2f(0, 0);
@Getter
private static State state = State.NONE;
public RotationUtil() {
Expensive.getInstance().getEventBus().register(this);
}
public static void updateRotation(float yaw, float pitch) {
state = State.ACTIVE;
rotateVector.x = yaw;
rotateVector.y = pitch;
mc.player.rotationYawOffset = yaw;
}
public static void resetRotation(boolean moment) {
if (moment) {
rotateVector.x = mc.player.rotationYaw;
rotateVector.y = mc.player.rotationPitch;
mc.player.rotationYawOffset = Integer.MIN_VALUE;
state = State.NONE;
return;
}
if (state != State.NONE) {
state = State.BACK;
}
}
@Subscribe
public void onUpdate(EventUpdate e) {
float yawDelta = MathHelper.wrapDegrees(mc.player.rotationYaw - rotateVector.x);
float pitchDelta = MathHelper.wrapDegrees(mc.player.rotationPitch - rotateVector.y);
if (state == State.BACK) {
float clampedYaw = Math.min(Math.abs(yawDelta), 40);
float clampedPitch = Math.min(Math.abs(pitchDelta), 20);
float deltaYawStep = Math.signum(yawDelta) * Math.round(clampedYaw / SensUtils.getGCDValue()) * SensUtils.getGCDValue();
float deltaPitchStep = Math.signum(pitchDelta) * Math.round(clampedPitch / SensUtils.getGCDValue()) * SensUtils.getGCDValue();
float yaw = rotateVector.x + deltaYawStep;
float pitch = clamp(rotateVector.y + deltaPitchStep, -90, 90);
rotateVector = new Vector2f(yaw, pitch);
mc.player.rotationYawOffset = yaw;
}
}
@Subscribe
public void onMotion(EventMotion e) {
float yawDelta = MathHelper.wrapDegrees(mc.player.rotationYaw - rotateVector.x);
float pitchDelta = MathHelper.wrapDegrees(mc.player.rotationPitch - rotateVector.y);
if (Math.abs(yawDelta) < 5f && Math.abs(pitchDelta) < 5f) {
rotateVector.x = mc.player.rotationYaw;
rotateVector.y = mc.player.rotationPitch;
mc.player.rotationYawOffset = Integer.MIN_VALUE;
state = State.NONE;
return;
}
if (state == State.NONE) {
rotateVector.x = mc.player.rotationYaw;
rotateVector.y = mc.player.rotationPitch;
return;
}
float yaw = rotateVector.x;
float pitch = MathHelper.clamp(rotateVector.y, -90, 90);
e.setYaw(yaw);
e.setPitch(pitch);
mc.player.rotationPitchHead = pitch;
mc.player.rotationYawHead = yaw;
float yawOffsetDelta = MathHelper.wrapDegrees(yaw - mc.player.prevRenderYawOffset);
mc.player.renderYawOffset = yaw - clamp(yawOffsetDelta, -75, 75);
mc.player.renderYawOffset += yawOffsetDelta * 0.3f;
}
public enum State {
ACTIVE,
BACK,
NONE
}
}
слил потому, что скоро сервера будут переходить на 1.21+ и экспа станет неактуальной.