Начинающий
- Статус
- Оффлайн
- Регистрация
- 23 Июн 2025
- Сообщения
- 43
- Реакции
- 0
- Выберите загрузчик игры
- Vanilla
JavaScript:
package im.expensive.functions.impl.movement;//
import com.google.common.eventbus.Subscribe;
import im.expensive.events.EventChangeWorld;
import im.expensive.events.EventLivingUpdate;
import im.expensive.events.EventMotion;
import im.expensive.events.EventPacket;
import im.expensive.functions.api.Category;
import im.expensive.functions.api.Function;
import im.expensive.functions.api.FunctionRegister;
import net.minecraft.network.IPacket;
import net.minecraft.network.play.client.CPlayerPacket;
import net.minecraft.network.play.server.SJoinGamePacket;
import net.minecraft.util.MovementInput;
import net.minecraft.util.MovementInputFromOptions;
@FunctionRegister(name = "AirStuck", type = Category.Movement)
public class AirStuck extends Function {
private boolean oldIsFlying;
float yaw;
float pitch;
float yawoff;
@Subscribe
public void onMotion(EventMotion e) {
if (mc.player != null && mc.player.ticksExisted % 10 == 0) {
mc.player.connection.sendPacket(new CPlayerPacket(mc.player.isOnGround()));
}
if (mc.player != null) {
e.cancel();
}
if (mc.player.isSprinting()) {
mc.player.setSprinting(false);
}
mc.player.rotationYawHead = this.yaw;
mc.player.renderYawOffset = this.yawoff;
mc.player.rotationPitchHead = this.pitch;
}
@Subscribe
public void onLivingUpdate(EventLivingUpdate e) {
if (mc.player != null) {
mc.player.noClip = true;
mc.player.setOnGround(false);
mc.player.setMotion((double)0.0F, (double)0.0F, (double)0.0F);
mc.player.abilities.isFlying = true;
}
}
@Subscribe
public void onPacket(EventChangeWorld event) {
this.setState(false, false);
}
@Subscribe
public void onPacket(EventPacket event) {
if (mc.player != null) {
IPacket var3 = event.getPacket();
if (var3 instanceof CPlayerPacket) {
CPlayerPacket packet = (CPlayerPacket)var3;
if (packet.moving) {
packet.x = mc.player.getPosX();
packet.y = mc.player.getPosY();
packet.z = mc.player.getPosZ();
}
packet.onGround = mc.player.isOnGround();
if (packet.rotating) {
packet.yaw = mc.player.rotationYaw;
packet.pitch = mc.player.rotationPitch;
}
}
if (event.getPacket() instanceof SJoinGamePacket) {
this.toggle();
}
}
}
public void onEnable() {
super.onEnable();
if (mc.player != null) {
this.oldIsFlying = mc.player.abilities.isFlying;
mc.player.movementInput = new MovementInput();
mc.player.moveForward = 0.0F;
mc.player.moveStrafing = 0.0F;
this.yaw = mc.player.rotationYaw;
this.pitch = mc.player.rotationPitch;
this.yawoff = mc.player.renderYawOffset;
}
}
public void onDisable() {
super.onDisable();
if (mc.player != null) {
mc.player.movementInput = new MovementInputFromOptions(mc.gameSettings);
mc.player.abilities.isFlying = this.oldIsFlying;
}
}
}

