package im.radiant.functions.impl.movement;
import com.google.common.eventbus.Subscribe;
import im.radiant.events.EventUpdate;
import im.radiant.functions.api.Category;
import im.radiant.functions.api.Function;
import im.radiant.functions.api.FunctionRegister;
import im.radiant.functions.settings.impl.SliderSetting;
import net.minecraft.util.math.vector.Vector3d;
@FunctionRegister(name = "WaterSpeed", type = Category.Movement)
public class WaterSpeed extends Function {
final SliderSetting speed = new SliderSetting("Скорость",0.05f,0.01f,0.1f,0.01f);
public WaterSpeed() {
addSettings(speed);
}
@Subscribe
public void onUpdate(EventUpdate eblanObhod) {
Vector3d move = mc.player.getMotion();
float speedCustom = 1 + speed.get();
if (mc.player.isSwimming()) {
mc.player.setSprinting(true);
mc.player.setVelocity(move.x * speedCustom,move.y,move.z * speedCustom);
mc.player.setPosition(mc.player.getPosX(),mc.player.getPosY(),mc.player.getPosZ());
}
}
}