//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//
package wtf.expensive.modules.impl.movement;
import net.minecraft.inventory.container.ClickType;
import net.minecraft.item.Items;
import net.minecraft.network.play.client.CEntityActionPacket;
import net.minecraft.network.play.client.CEntityActionPacket.Action;
import net.minecraft.network.play.server.SEntityMetadataPacket;
import net.minecraft.util.Hand;
import wtf.expensive.events.Event;
import wtf.expensive.events.impl.packet.EventPacket;
import wtf.expensive.events.impl.player.EventMotion;
import wtf.expensive.events.impl.player.EventUpdate;
import wtf.expensive.modules.Function;
import wtf.expensive.modules.FunctionAnnotation;
import wtf.expensive.modules.Type;
import wtf.expensive.modules.settings.Setting;
import wtf.expensive.modules.settings.imp.SliderSetting;
import wtf.expensive.util.misc.TimerUtil;
import wtf.expensive.util.movement.MoveUtil;
import wtf.expensive.util.world.InventoryUtil;
@FunctionAnnotation(
name = "CatFly",
type = Type.Movement
)
public class CatFly extends Function {
private final TimerUtil timerUtil = new TimerUtil();
private final SliderSetting Y = new SliderSetting("Скорость в высоту", 0.3F, 0.15F, 0.55F, 1.0E-4F);
public CatFly() {
this.addSettings(new Setting[]{this.Y});
}
protected void onEnable() {
super.onEnable();
}
public void onEvent(Event event) {
if (!(event instanceof EventUpdate) || InventoryUtil.getItemSlot(Items.FIREWORK_ROCKET) != -1 && !mc.player.collidedHorizontally && InventoryUtil.doesHotbarHaveItem(Items.ELYTRA)) {
if (event instanceof EventMotion) {
EventMotion eventMotion = (EventMotion)event;
float rotation = -30.0F;
eventMotion.setPitch(rotation);
mc.player.rotationPitchHead = rotation;
}
if (event instanceof EventUpdate) {
if (mc.player.getActiveHand() == Hand.MAIN_HAND) {
mc.playerController.onStoppedUsingItem(mc.player);
}
if (mc.player.rotationPitchHead != -30.0F) {
return;
}
if (mc.player.isOnGround()) {
mc.player.motion.y = 0.42;
}
mc.gameSettings.keyBindRight.setPressed(false);
mc.gameSettings.keyBindLeft.setPressed(false);
mc.gameSettings.keyBindBack.setPressed(false);
for(int i = 0; i < 9; ++i) {
if (mc.player.inventory.getStackInSlot(i).getItem() == Items.ELYTRA && !mc.player.isOnGround() && !mc.player.isInWater() && !mc.player.isInLava() && this.timerUtil.hasTimeElapsed(300L)) {
mc.playerController.windowClick(0, 6, i, ClickType.SWAP, mc.player);
mc.player.connection.sendPacket(new CEntityActionPacket(mc.player, Action.START_FALL_FLYING));
mc.player.motion.y = (double)this.Y.getValue().floatValue();
MoveUtil.setMotion(1.4);
mc.playerController.windowClick(0, 6, i, ClickType.SWAP, mc.player);
if (this.timerUtil.hasTimeElapsed(300L)) {
InventoryUtil.inventorySwapClick(Items.FIREWORK_ROCKET);
this.timerUtil.reset();
}
}
}
}
if (event instanceof EventPacket) {
EventPacket e = (EventPacket)event;
if (e.getPacket() instanceof SEntityMetadataPacket && ((SEntityMetadataPacket)e.getPacket()).getEntityId() == mc.player.getEntityId()) {
e.setCancel(true);
}
}
}
}
public void onDisable() {
super.onDisable();
}
}