Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public Flight() {
- super("Flight", 33, Category.MOVEMENT, "Allows you to fly like a bird");
- this.damaged = false;
- this.hasReached = false;
- this.boosted = false;
- this.level = 0;
- this.timer = new TimerUtils();
- }
- @Override
- public void setup() {
- final ArrayList<String> options = new ArrayList<String>();
- options.add("Hypixel");
- options.add("HypixelDamage");
- options.add("Vanilla");
- Emilio.instance.sm.rSetting(new Setting("Mode", this, "HypixelFast", options));
- Emilio.instance.sm.rSetting(new Setting("HypixelSpeed", this, 0.95, 0.0, 1.0, false));
- Emilio.instance.sm.rSetting(new Setting("Timer", this, 1.0, 1.0, 8.0, false));
- Emilio.instance.sm.rSetting(new Setting("FastTime", this, 100.0, 0.0, 1000.0, true));
- Emilio.instance.sm.rSetting(new Setting("Damage", this, true));
- }
- @Override
- public void onEnable() {
- super.onEnable();
- this.timer.reset();
- this.mode = Emilio.instance.sm.getSettingByName(this, "Mode").getValString();
- if (Flight.mc.thePlayer == null) {
- return;
- }
- if (Emilio.instance.sm.getSettingByName(this, "Damage").getValBoolean()) {
- this.damagePlayer();
- }
- Flight.mc.timer.timerSpeed = 1.0f;
- if (this.mode.equalsIgnoreCase("Hypixel")) {
- this.canboost = true;
- double motionY = 0.40123128;
- this.timervalue = 1.0f;
- if (Flight.mc.thePlayer.onGround) {
- if ((Flight.mc.thePlayer.moveForward != 0.0f || Flight.mc.thePlayer.moveStrafing != 0.0f) && Flight.mc.thePlayer.isCollidedVertically) {
- if (Flight.mc.thePlayer.isPotionActive(Potion.jump)) {
- motionY += (Flight.mc.thePlayer.getActivePotionEffect(Potion.jump).getAmplifier() + 1) * 0.1f;
- }
- Flight.mc.thePlayer.motionY = motionY;
- }
- this.level = 1;
- this.moveSpeed = 0.1;
- this.hypixelboost = true;
- this.lastDist = 0.0;
- }
- this.timer.reset();
- }
- }
- @Override
- public void onDisable() {
- super.onDisable();
- this.damaged = false;
- Flight.mc.timer.timerSpeed = 1.0f;
- Flight.mc.thePlayer.motionX = 0.0;
- Flight.mc.thePlayer.motionZ = 0.0;
- Flight.mc.thePlayer.motionY = 0.0;
- Flight.mc.gameSettings.keyBindJump.pressed = false;
- this.prevBoost = System.currentTimeMillis();
- this.boosted = false;
- this.timer.reset();
- }
- @EventTarget
- public void onUpdate(final EventPlayerUpdate e) {
- this.mode = Emilio.instance.sm.getSettingByName(this, "Mode").getValString();
- final double speed = 5.5;
- this.setDisplayName(String.valueOf(this.getName()) + EnumChatFormatting.GRAY + " " + this.mode);
- if (this.mode.toLowerCase().contains("Hypixel")) {
- Flight.mc.thePlayer.motionY = 0.0;
- }
- if (e.isPre()) {
- if (this.mode.equalsIgnoreCase("HypixelDamage")) {
- ++this.counter;
- if (this.counter == 1) {
- Flight.mc.thePlayer.setPosition(Flight.mc.thePlayer.posX, Flight.mc.thePlayer.posY + 8.0E-6, Flight.mc.thePlayer.posZ);
- }
- else if (this.counter == 2) {
- Flight.mc.thePlayer.setPosition(Flight.mc.thePlayer.posX, Flight.mc.thePlayer.posY - 8.0E-6, Flight.mc.thePlayer.posZ);
- this.counter = 0;
- }
- if (this.damaged) {
- Flight.mc.timer.timerSpeed = 34.0f;
- }
- else {
- Flight.mc.timer.timerSpeed = 1.0f;
- }
- }
- else if (this.mode.equalsIgnoreCase("Hypixel")) {
- if (!this.boosted) {
- Flight.mc.timer.timerSpeed = Emilio.instance.sm.getSettingByName(this, "Timer").getValFloat();
- this.boosted = true;
- }
- else if (this.timer.hasReached(Emilio.instance.sm.getSettingByName(this, "FastTime").getValInt())) {
- Flight.mc.timer.timerSpeed = 1.0f;
- MoveUtils.setMotion(null, 0.0);
- }
- final double xDist = Flight.mc.thePlayer.posX - Flight.mc.thePlayer.prevPosX;
- final double zDist = Flight.mc.thePlayer.posZ - Flight.mc.thePlayer.prevPosZ;
- this.lastDist = Math.sqrt(xDist * xDist + zDist * zDist);
- if (this.canboost && this.hypixelboost) {
- this.timervalue += (float)(this.decreasing2 ? -0.01 : 0.05);
- if (this.timervalue >= 1.4) {
- this.decreasing2 = true;
- }
- if (this.timervalue <= 0.9) {
- this.decreasing2 = false;
- }
- if (this.timer.hasReached(2000.0)) {
- this.canboost = false;
- }
- }
- if (Flight.mc.gameSettings.keyBindJump.isKeyDown()) {
- Flight.mc.thePlayer.setPositionAndUpdate(Flight.mc.thePlayer.posX, Flight.mc.thePlayer.posY + 0.4, Flight.mc.thePlayer.posZ);
- Flight.mc.thePlayer.motionY = 0.8;
- final EntityPlayerSP thePlayer3;
- final EntityPlayerSP thePlayer = thePlayer3 = Flight.mc.thePlayer;
- thePlayer3.motionX *= 0.1;
- final EntityPlayerSP thePlayer4;
- final EntityPlayerSP thePlayer2 = thePlayer4 = Flight.mc.thePlayer;
- thePlayer4.motionZ *= 0.1;
- }
- if (Flight.mc.thePlayer.ticksExisted % 2 == 0) {
- Flight.mc.thePlayer.setPosition(Flight.mc.thePlayer.posX, Flight.mc.thePlayer.posY + MathUtils.getRandomInRange(1.2354235325235235E-14, 1.2354235325235233E-13), Flight.mc.thePlayer.posZ);
- }
- Flight.mc.thePlayer.motionY = 0.0;
- }
- }
- }
- @EventTarget
- public void onMove(final EventMotion e) {
- final float yaw = Flight.mc.thePlayer.rotationYaw;
- double strafe = Flight.mc.thePlayer.movementInput.moveStrafe;
- double forward = Flight.mc.thePlayer.movementInput.moveForward;
- final double mx = -Math.sin(Math.toRadians(yaw));
- final double mz = Math.cos(Math.toRadians(yaw));
- if (this.mode.equalsIgnoreCase("Vanilla")) {
- if (Flight.mc.gameSettings.keyBindForward.isKeyDown() || Flight.mc.gameSettings.keyBindBack.isKeyDown() || Flight.mc.gameSettings.keyBindRight.isKeyDown() || Flight.mc.gameSettings.keyBindLeft.isKeyDown()) {
- MoveUtils.setMotion(e, 2.0);
- }
- Flight.mc.thePlayer.capabilities.isFlying = false;
- Flight.mc.thePlayer.motionY = 0.085;
- Flight.mc.thePlayer.jumpMovementFactor = 2.0f;
- if (Flight.mc.gameSettings.keyBindJump.isKeyDown()) {
- final EntityPlayerSP thePlayer3;
- final EntityPlayerSP thePlayer = thePlayer3 = Flight.mc.thePlayer;
- ++thePlayer3.motionY;
- }
- if (Flight.mc.gameSettings.keyBindSneak.isKeyDown()) {
- final EntityPlayerSP thePlayer4;
- final EntityPlayerSP thePlayer2 = thePlayer4 = Flight.mc.thePlayer;
- --thePlayer4.motionY;
- }
- }
- else if (this.mode.equalsIgnoreCase("Hypixel")) {
- if (forward == 0.0 && strafe == 0.0) {
- e.setX(0.0);
- e.setZ(0.0);
- }
- if (forward != 0.0 && strafe != 0.0) {
- forward *= Math.sin(0.7853981633974483);
- strafe *= Math.cos(0.7853981633974483);
- }
- if (this.level != 1 || (Flight.mc.thePlayer.moveForward == 0.0f && Flight.mc.thePlayer.moveStrafing == 0.0f)) {
- if (this.level == 2) {
- this.level = 3;
- this.moveSpeed *= 2.1499999;
- }
- else if (this.level == 3) {
- this.level = 4;
- double difference;
- if (MoveUtils.getSpeedEffect() > 0) {
- difference = 1.5 - Emilio.instance.sm.getSettingByName(this, "HypixelSpeed").getValDouble() * (this.lastDist - MathUtils.getBaseMovementSpeed());
- }
- else {
- difference = 1.0 - Emilio.instance.sm.getSettingByName(this, "HypixelSpeed").getValDouble() * (this.lastDist - MathUtils.getBaseMovementSpeed());
- }
- this.moveSpeed = this.lastDist - difference;
- }
- else {
- if (Flight.mc.theWorld.getCollidingBoundingBoxes(Flight.mc.thePlayer, Flight.mc.thePlayer.getEntityBoundingBox().offset(0.0, Flight.mc.thePlayer.motionY, 0.0)).size() > 0 || Flight.mc.thePlayer.isCollidedVertically) {
- this.level = 1;
- }
- this.moveSpeed = this.lastDist - this.lastDist / (159.99999 - Emilio.instance.sm.getSettingByName(this, "HypixelSpeed").getValDouble() * 20.0);
- }
- }
- else {
- this.level = 2;
- final double boost = Flight.mc.thePlayer.isPotionActive(Potion.moveSpeed) ? 1.706 : 2.034;
- this.moveSpeed = boost * MathUtils.getBaseMovementSpeed() - 0.01;
- }
- this.moveSpeed = Math.max(this.moveSpeed, MathUtils.getBaseMovementSpeed());
- e.setX(forward * this.moveSpeed * mx + strafe * this.moveSpeed * mz);
- e.setZ(forward * this.moveSpeed * mz - strafe * this.moveSpeed * mx);
- if (forward == 0.0 && strafe == 0.0) {
- e.setX(0.0);
- e.setZ(0.0);
- }
- if (this.timer.hasReached(1700.0) && this.hypixelboost) {
- this.hypixelboost = false;
- }
- }
- }
- @EventTarget
- public void onSend(final EventSendPacket ep) {
- }
- @EventTarget
- public void onRecieve(final EventRecievePacket e) {
- if (e.getPacket() instanceof S00PacketKeepAlive && this.mode.equalsIgnoreCase("Vanilla")) {
- e.setCancelled(true);
- }
- }
- public void damagePlayer() {
- for (int i = 0; i <= (Flight.mc.thePlayer.isPotionActive(Potion.jump) ? 140 : 70); ++i) {
- Flight.mc.thePlayer.sendQueue.getNetworkManager().sendPacket(new C03PacketPlayer.C06PacketPlayerPosLook(Flight.mc.thePlayer.posX, Flight.mc.thePlayer.posY + 0.05, Flight.mc.thePlayer.posZ, Flight.mc.thePlayer.rotationYaw, Flight.mc.thePlayer.rotationPitch, false));
- Flight.mc.thePlayer.sendQueue.getNetworkManager().sendPacket(new C03PacketPlayer.C06PacketPlayerPosLook(Flight.mc.thePlayer.posX, Flight.mc.thePlayer.posY, Flight.mc.thePlayer.posZ, Flight.mc.thePlayer.rotationYaw, Flight.mc.thePlayer.rotationPitch, false));
- Flight.mc.thePlayer.sendQueue.getNetworkManager().sendPacket(new C03PacketPlayer.C06PacketPlayerPosLook(Flight.mc.thePlayer.posX, Flight.mc.thePlayer.posY + 1.0E-5, Flight.mc.thePlayer.posZ, Flight.mc.thePlayer.rotationYaw, Flight.mc.thePlayer.rotationPitch, false));
- }
- Flight.mc.thePlayer.sendQueue.getNetworkManager().sendPacket(new C03PacketPlayer.C06PacketPlayerPosLook(Flight.mc.thePlayer.posX, Flight.mc.thePlayer.posY, Flight.mc.thePlayer.posZ, Flight.mc.thePlayer.rotationYaw, Flight.mc.thePlayer.rotationPitch, true));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement