Подведи собственные итоги года совместно с YOUGAME и забери ценные призы! Перейти

Вопрос /vse

  • Автор темы Автор темы ez2ex
  • Дата начала Дата начала
почему не работает silent ротация?

Код:
Expand Collapse Copy
    @Subscribe
    public void onMotion(EventMotion e) {
        PlayerEntity player = mc.player;
        if (player != null &&  mc.player.isSwimming() && !player.isSneaking() && (player.moveForward != 0.0f || player.moveStrafing != 0.0f) && isAtSurface(player)) {
            float realPitch = player.rotationPitch;
                e.setPitch(0F);

            }
        }

ПОЛНЫЙ КОД:

Код:
Expand Collapse Copy
package by.algorithm.alpha.api.modules.impl.movement;

import by.algorithm.alpha.api.modules.api.Module;
import by.algorithm.alpha.api.modules.api.ModuleAnnot;
import by.algorithm.alpha.api.modules.api.ModuleCategory;
import by.algorithm.alpha.api.modules.settings.Setting;
import by.algorithm.alpha.api.modules.settings.impl.ModeSetting;
import by.algorithm.alpha.system.events.EventMotion; // <--- УБЕДИСЬ, ЧТО ИМПОРТ ПРАВИЛЬНЫЙ
import by.algorithm.alpha.system.events.EventUpdate;
import com.google.common.eventbus.Subscribe;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.vector.Vector3d;

@ModuleAnnot(
        name = "WaterSpeed",
        type = ModuleCategory.Movement
)
public class WaterSpeed extends Module {
    ModeSetting type = new ModeSetting("Обход", "Обычный", new String[]{"Funtime", "StormHVH", "Обычный"});

    public WaterSpeed() {
        this.addSettings(this.type);
    }

    protected float[] rotations(PlayerEntity player) {
        return new float[0];
    }
    @Subscribe
    public void onUpdate(EventUpdate e) {
        PlayerEntity player = mc.player;
        if (player == null || !player.isInWater() || (player.moveForward == 0.0f && player.moveStrafing == 0.0f)) {
            return;
        }
        if (!isAtSurface(player)) {
            player.setMotion(player.getMotion().x, 0.12D, player.getMotion().z);
            return;
        }

        // Если на поверхности и не ныряем - ускоряемся
        if (!player.isSneaking()) {
            String selectedType = this.type.get();
            if (selectedType.equals("Обычный")) this.WATER_DEF();
            else if (selectedType.equals("Funtime")) this.WATER_FT();
            else if (selectedType.equals("StormHVH")) this.WATER_STORM();
        }
    }
    @Subscribe
    public void onMotion(EventMotion e) {
        PlayerEntity player = mc.player;
        if (player != null &&  mc.player.isSwimming() && !player.isSneaking() && (player.moveForward != 0.0f || player.moveStrafing != 0.0f) && isAtSurface(player)) {
            float realPitch = player.rotationPitch;
                e.setPitch(0F);

            }
        }

    // --- Вспомогательные методы ---
    private void WATER_DEF() { if (mc.player != null) mc.player.setMotion(mc.player.getMotion().x * 1.1, mc.player.getMotion().y, mc.player.getMotion().z * 1.1); }
    private void WATER_FT() { if (mc.player != null && mc.player.isSwimming()) mc.player.moveRelative(0.0462f, new Vector3d(mc.player.moveStrafing, 0.0f, mc.player.moveForward)); }
    private void WATER_STORM() { if (mc.player != null) mc.player.setMotion(mc.player.getMotion().x * 1.077, mc.player.getMotion().y, mc.player.getMotion().z * 1.077); }
    private boolean isAtSurface(PlayerEntity player) { return !mc.world.getBlockState(new BlockPos(player.getPosX(), player.getPosY() + player.getEyeHeight() + 0.1, player.getPosZ())).getMaterial().isLiquid(); }
}
Там где e.setPitch(0) допиши
mc.player.rotationPitchHead = 0
 
Назад
Сверху Снизу