diff --git a/src/openonyx/features/player/InventoryManager.java b/src/openonyx/features/player/InventoryManager.java new file mode 100644 index 0000000..1abf2d5 --- /dev/null +++ b/src/openonyx/features/player/InventoryManager.java @@ -0,0 +1,236 @@ +package openonyx.features.player; + +import meteordevelopment.orbit.EventHandler; +import net.minecraft.client.gui.inventory.GuiInventory; +import net.minecraft.item.ItemStack; +import openonyx.configuration.internal.TickEvent; +import openonyx.events.InventoryUtils; +import openonyx.features.Module; +import openonyx.features.ModuleCategory; +import openonyx.history.internal.ActionSetting; +import openonyx.history.internal.BooleanSetting; +import openonyx.history.internal.ItemListSetting; +import openonyx.history.internal.ItemMappingSetting; +import openonyx.history.internal.NumberSetting; +import openonyx.ui.InventoryLayoutScreen; + +public class InventoryManager extends Module { + private transient int m; + public BooleanSetting manageArmor; + public ItemListSetting keep; + public ItemMappingSetting slots; + public ItemListSetting drop; + private static final int i = 4; + public NumberSetting delay; + public ActionSetting editRules = new ActionSetting("Edit rules", () -> mc.displayGuiScreen(new InventoryLayoutScreen(mc.currentScreen))) + .describe("Drag items onto the slots they belong in"); + public BooleanSetting dropJunk; + + @EventHandler + private void onTick(TickEvent tickEvent) { + if (mc.thePlayer != null && mc.currentScreen instanceof GuiInventory && mc.thePlayer.openContainer == mc.thePlayer.inventoryContainer) { + if (this.m++ >= this.delay.getInt()) { + if (this.I() || this.l() || this.h()) { + this.m = 0; + } + } + } else { + this.m = 0; + } + } + + public InventoryManager() { + super("InventoryManager", "Sorts your inventory the way you laid it out", ModuleCategory.PLAYER); + this.delay = new NumberSetting("Delay", 1.0, 0.0, 10.0, 1.0).withSuffix("t").describe("Ticks between clicks"); + this.manageArmor = new BooleanSetting("Manage armor", true).describe("Wears the best piece you are carrying in each armour slot"); + this.dropJunk = new BooleanSetting("Drop junk", true).describe("Throws away anything on the Drop list that the Keep list does not rescue"); + String[] strings = new Object[18]; + boolean bl = true; + strings[0] = 0; + strings[1] = "@SWORD"; + strings[2] = 1; + strings[3] = "minecraft:golden_apple"; + strings[4] = 2; + strings[5] = "@AXE"; + strings[6] = 3; + strings[7] = "@PICKAXE"; + strings[8] = 4; + strings[9] = "@BLOCK"; + strings[10] = 5; + strings[11] = "@BLOCK"; + strings[12] = 6; + strings[13] = "@BLOCK"; + strings[14] = 7; + strings[15] = "@BLOCK"; + strings[16] = 8; + strings[17] = "@BLOCK"; + this.slots = new ItemMappingSetting("Slots", ItemMappingSetting.L(strings)); + strings = new String[0]; + bl = true; + this.keep = new ItemListSetting("Keep", strings); + strings = new String[20]; + bl = true; + strings[0] = "minecraft:snowball"; + strings[1] = "minecraft:egg"; + strings[2] = "minecraft:experience_bottle"; + strings[3] = "minecraft:flint"; + strings[4] = "minecraft:flint_and_steel"; + strings[5] = "minecraft:lava_bucket"; + strings[6] = "minecraft:string"; + strings[7] = "minecraft:chest"; + strings[8] = "minecraft:trapped_chest"; + strings[9] = "minecraft:ender_chest"; + strings[10] = "@HOE"; + strings[11] = "@BAD_POTION"; + strings[12] = "~anvil"; + strings[13] = "~tnt"; + strings[14] = "~seed"; + strings[15] = "~table"; + strings[16] = "~eye"; + strings[17] = "~mushroom"; + strings[18] = "~skull"; + strings[19] = "~pressure_plate"; + this.drop = new ItemListSetting("Drop", strings); + } + + private boolean d(ItemStack itemStack) { + return this.drop.L(itemStack) && !this.keep.L(itemStack) && this.slots.L(itemStack) < 0; + } + + @Override + protected void onDisable() { + this.m = 0; + } + + private boolean l() { + InventoryManager inventoryManager1 = this; + boolean[] bl1 = new boolean[45]; + boolean bl2 = true; + boolean[] bl = bl1; + + for (int mx = l = 0; mx < 9; mx = ++l) { + if (!inventoryManager1.slots.L(l).isEmpty()) { + int k = 36 + l; + int ix = -1; + double d = Double.NEGATIVE_INFINITY; + + int j; + for (int n = j = 9; n < 45; n = ++j) { + ItemStack itemStack; + double e; + if (!bl[j] && (itemStack = InventoryUtils.L(j)) != null && inventoryManager1.slots.L(l, itemStack) && !((e = InventoryUtils.d(itemStack)) <= d)) { + d = e; + ix = j; + } + } + + if (ix >= 0) { + bl[ix] = true; + if (ix != k) { + InventoryUtils.L(ix, l); + return true; + } + } + } + } + + return false; + } + + private boolean h() { + InventoryManager inventoryManager1 = this; + if (!inventoryManager1.dropJunk.isEnabled()) { + return false; + } + + for (int j = ix = 9; j < 45; j = ++ix) { + ItemStack itemStack; + if ((itemStack = InventoryUtils.L(ix)) != null && inventoryManager1.d(itemStack)) { + InventoryUtils.L(ix); + return true; + } + } + + return false; + } + + public boolean L(ItemStack itemStack) { + if (itemStack == null || itemStack.getItem() == null) { + return false; + } + + if (this.keep.L(itemStack)) { + return false; + } + + if (this.drop.L(itemStack)) { + return true; + } + + if (this.isEnabled() && mc.thePlayer != null) { + int ix; + if ((ix = InventoryUtils.L(itemStack)) >= 0) { + ItemStack itemStack2; + return !this.manageArmor.isEnabled() + ? false + : (itemStack2 = InventoryUtils.L(InventoryUtils.L(ix))) != null && InventoryUtils.D(itemStack) <= InventoryUtils.D(itemStack2); + } + + if (this.slots.L(itemStack) < 0) { + return false; + } + + int j; + for (int k = j = 0; k < 9; k = ++j) { + ItemStack itemStack1; + if (this.slots.L(j, itemStack) + && ( + (itemStack1 = InventoryUtils.L(36 + j)) == null || !this.slots.L(j, itemStack1) || InventoryUtils.d(itemStack) > InventoryUtils.d(itemStack1) + )) { + return false; + } + } + + return true; + } else { + return false; + } + } + + private boolean I() { + InventoryManager inventoryManager1 = this; + if (!inventoryManager1.manageArmor.isEnabled()) { + return false; + } + + int ix; + for (int n = ix = 0; n < 4; n = ++ix) { + ItemStack itemStack; + int k; + double d = (itemStack = InventoryUtils.L(k = InventoryUtils.L(ix))) == null ? Double.NEGATIVE_INFINITY : InventoryUtils.D(itemStack); + int l = -1; + + int j; + for (int mx = j = 9; mx < 45; mx = ++j) { + ItemStack itemStack1; + double e; + if (InventoryUtils.L(itemStack1 = InventoryUtils.L(j)) == ix && !inventoryManager1.d(itemStack1) && !((e = InventoryUtils.D(itemStack1)) <= d)) { + d = e; + l = j; + } + } + + if (l >= 0) { + if (itemStack == null) { + InventoryUtils.d(l); + } else { + InventoryUtils.L(k); + } + + return true; + } + } + + return false; + } +} diff --git a/src/openonyx/features/player/ItemsMode.java b/src/openonyx/features/player/ItemsMode.java new file mode 100644 index 0000000..f975769 --- /dev/null +++ b/src/openonyx/features/player/ItemsMode.java @@ -0,0 +1,35 @@ +package openonyx.features.player; + +import openonyx.history.DisplayNamed; + +public enum ItemsMode implements DisplayNamed { + OTHER("Anything else"), + DIAMOND("Diamond"), + BLOCKS("Blocks"), + IRON("Iron"), + GOLD("Gold"), + EMERALD("Emerald"); + + private final String e; + + @Override + public String getDisplayName() { + return this.e; + } + + private static ItemsMode[] L() { + ItemsMode[] itemsModes = new ItemsMode[6]; + boolean bl = true; + itemsModes[0] = IRON; + itemsModes[1] = GOLD; + itemsModes[2] = DIAMOND; + itemsModes[3] = EMERALD; + itemsModes[4] = BLOCKS; + itemsModes[5] = OTHER; + return itemsModes; + } + + ItemsMode(String string1) { + this.e = string1; + } +} diff --git a/src/openonyx/features/player/NameChanger.java b/src/openonyx/features/player/NameChanger.java new file mode 100644 index 0000000..c0f1d55 --- /dev/null +++ b/src/openonyx/features/player/NameChanger.java @@ -0,0 +1,79 @@ +package openonyx.features.player; + +import com.mojang.authlib.GameProfile; +import net.minecraft.client.network.NetworkPlayerInfo; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.scoreboard.ScorePlayerTeam; +import openonyx.core.OnyxClient; +import openonyx.features.Module; +import openonyx.features.ModuleCategory; +import openonyx.features.ModuleManager; +import openonyx.history.internal.BooleanSetting; +import openonyx.history.internal.TextSetting; + +public final class NameChanger extends Module { + public BooleanSetting chat; + public TextSetting displayName = new TextSetting("Display name", "").describe("Shown instead of your real name, locally only"); + public BooleanSetting scoreboard; + public BooleanSetting nametag; + public BooleanSetting tabList = new BooleanSetting("Tab list", true); + + public static String i() { + NameChanger nameChanger; + return (nameChanger = L()) == null ? "" : nameChanger.displayName.getValue(); + } + + private static NameChanger L() { + ModuleManager moduleManager = OnyxClient.moduleManager; + return OnyxClient.moduleManager == null ? null : moduleManager.nameChanger; + } + + private static boolean L(GameProfile gameProfile) { + return mc.thePlayer != null && gameProfile != null && gameProfile.getId() != null && gameProfile.getId().equals(mc.thePlayer.getGameProfile().getId()); + } + + public static String L(EntityPlayer entityPlayer) { + return L((EntityLivingBase)entityPlayer) ? i() : entityPlayer.getName(); + } + + private boolean h() { + return this.isEnabled() && !this.displayName.getValue().isBlank(); + } + + public static String L(String string) { + String string1 = string; + NameChanger nameChanger; + if ((nameChanger = L()) == null || !nameChanger.h() || !nameChanger.scoreboard.isEnabled()) { + return string1; + } else { + return mc.thePlayer != null && string1.equals(mc.thePlayer.getGameProfile().getName()) ? nameChanger.displayName.getValue() : string1; + } + } + + public NameChanger() { + super("NameChanger", "Overrides your own displayed name locally", ModuleCategory.PLAYER); + this.scoreboard = new BooleanSetting("Scoreboard", true); + this.chat = new BooleanSetting("Chat", true).describe("Substitute your name inside chat messages too"); + this.nametag = new BooleanSetting("Nametag", true).describe("Your own in-world nametag (third person)"); + } + + public static boolean L(EntityLivingBase entityLivingBase) { + EntityLivingBase entityLivingBase1 = entityLivingBase; + NameChanger nameChanger; + return (nameChanger = L()) != null && nameChanger.h() && nameChanger.nametag.isEnabled() && entityLivingBase1 == mc.thePlayer; + } + + public static String L(NetworkPlayerInfo networkPlayerInfo, String string) { + NetworkPlayerInfo networkPlayerInfo1 = networkPlayerInfo; + NameChanger nameChanger; + return (nameChanger = L()) != null && nameChanger.h() && nameChanger.tabList.isEnabled() && L(networkPlayerInfo1.getGameProfile()) + ? ScorePlayerTeam.formatPlayerName(networkPlayerInfo1.getPlayerTeam(), nameChanger.displayName.getValue()) + : string; + } + + public static boolean I() { + NameChanger nameChanger; + return (nameChanger = L()) != null && nameChanger.h() && nameChanger.chat.isEnabled() && mc.thePlayer != null; + } +} diff --git a/src/openonyx/features/player/SameYMode.java b/src/openonyx/features/player/SameYMode.java new file mode 100644 index 0000000..cda7f4b --- /dev/null +++ b/src/openonyx/features/player/SameYMode.java @@ -0,0 +1,33 @@ +package openonyx.features.player; + +import openonyx.history.DisplayNamed; + +public enum SameYMode implements DisplayNamed { + ON("On"), + FALLING("Falling"), + OFF("Off"), + HYPIXEL2("Hypixel2"), + HYPIXEL("Hypixel"); + + private final String i; + + @Override + public String getDisplayName() { + return this.i; + } + + private static SameYMode[] L() { + SameYMode[] sameYModes = new SameYMode[5]; + boolean bl = true; + sameYModes[0] = OFF; + sameYModes[1] = ON; + sameYModes[2] = FALLING; + sameYModes[3] = HYPIXEL; + sameYModes[4] = HYPIXEL2; + return sameYModes; + } + + SameYMode(String string1) { + this.i = string1; + } +} diff --git a/src/openonyx/features/player/Scaffold.java b/src/openonyx/features/player/Scaffold.java new file mode 100644 index 0000000..ad4b0fe --- /dev/null +++ b/src/openonyx/features/player/Scaffold.java @@ -0,0 +1,629 @@ +package openonyx.features.player; + +import java.util.ArrayList; +import java.util.Comparator; +import java.util.Iterator; +import java.util.List; +import meteordevelopment.orbit.EventHandler; +import net.minecraft.block.Block; +import net.minecraft.entity.Entity; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.Vec3; +import net.minecraft.util.EnumFacing.Axis; +import openonyx.configuration.internal.MovementInputEvent; +import openonyx.configuration.internal.PreTickEvent; +import openonyx.configuration.internal.RotationTickEvent; +import openonyx.configuration.internal.WorldChangeEvent; +import openonyx.features.Module; +import openonyx.features.ModuleCategory; +import openonyx.features.movement.SafeWalk; +import openonyx.features.player.internal.ScaffoldBlockFilter; +import openonyx.features.player.internal.ScaffoldPathfinder; +import openonyx.features.player.internal.ScaffoldRotationSettings; +import openonyx.features.player.internal.group_d.ScaffoldWatchdogMode; +import openonyx.features.player.internal.group_m.ScaffoldBreezily; +import openonyx.features.player.internal.group_m.ScaffoldExpand; +import openonyx.features.player.internal.group_m.ScaffoldGodBridge; +import openonyx.features.player.internal.group_m.ScaffoldHypixelKeepY; +import openonyx.features.player.internal.group_m.ScaffoldHypixelSprint; +import openonyx.features.player.internal.group_m.ScaffoldMode; +import openonyx.features.player.internal.group_m.ScaffoldNormal; +import openonyx.features.player.internal.group_m.internal.ScaffoldDown; +import openonyx.features.player.internal.group_m.internal.ScaffoldSneak; +import openonyx.features.player.internal.group_m.internal.ScaffoldTelly; +import openonyx.features.player.internal.internal.BridgeAction; +import openonyx.features.player.internal.internal.BridgeActionResolver; +import openonyx.features.player.internal.internal.BridgeTechnique; +import openonyx.features.player.internal.internal.ScaffoldAcceleration; +import openonyx.features.player.internal.internal.ScaffoldAutoBlock; +import openonyx.features.player.internal.internal.ScaffoldClutch; +import openonyx.features.player.internal.internal.ScaffoldPrediction; +import openonyx.features.player.internal.internal.ScaffoldSprintControl; +import openonyx.features.player.internal.internal.ScaffoldStrafe; +import openonyx.features.player.internal.internal.ScaffoldStrafeSpeed; +import openonyx.history.ModeOption; +import openonyx.history.ModeSetting; +import openonyx.history.NoneMode; +import openonyx.history.Setting; +import openonyx.history.internal.BooleanSetting; +import openonyx.history.internal.EnumSetting; +import openonyx.history.internal.NumberSetting; +import openonyx.history.internal.RangeSetting; +import openonyx.interaction.BlockUtils; +import openonyx.interaction.SwingMode; +import openonyx.interaction.internal.PlacementResult; +import openonyx.protocol.RotationHandler; +import openonyx.protocol.RotationRequest; +import openonyx.protocol.group_m.Angles; +import openonyx.utilities.BlockItemUtils; +import openonyx.utilities.BlockStackComparators; +import openonyx.utilities.ChainedComparator; +import openonyx.utilities.HotbarManager; +import openonyx.utilities.ItemPriority; +import openonyx.utilities.MovementInputState; +import openonyx.utilities.PlayerUtils; +import openonyx.utilities.internal.Line3; + +public class Scaffold extends Module { + private transient boolean u; + public static final ChainedComparator y; + private static final ChainedComparator CHAINED_COMPARATOR; + private transient boolean Y; + public ScaffoldStrafe scaffoldStrafe; + private transient int W; + public ScaffoldRotationSettings scaffoldRotationSettings; + public ScaffoldAutoBlock scaffoldAutoBlock; + public ModeSetting safeWalk; + public ScaffoldClutch scaffoldClutch; + private transient int t; + private transient int b; + public static final Scaffold INSTANCE = new Scaffold(); + public ScaffoldAcceleration scaffoldAcceleration; + public EnumSetting swing; + private transient boolean A; + public ScaffoldPrediction scaffoldPrediction; + private transient MovementInputState movementInputState; + public BooleanSetting spaceClimb; + public ModeSetting modeSetting; + public NumberSetting minDistance; + private transient boolean c; + public BooleanSetting disableOnDeath; + public ScaffoldSprintControl scaffoldSprintControl; + public BooleanSetting edgeSafety; + private transient PlacementResult placementResult; + public EnumSetting sameY; + private transient int j; + private transient Block block; + private transient int h; + public RangeSetting ticks = RangeSetting.ofInt("Delay", 0, 0, 0, 40).withSuffix(" ticks").visibleWhen(Setting.BOOLEAN_SUPPLIER); + private transient int I; + public ScaffoldStrafeSpeed scaffoldStrafeSpeed; + public ModeSetting technique; + public BooleanSetting autoF5; + private transient Line3 line3; + private static final int e = 1; + + private void e() { + Scaffold scaffold1 = this; + if (scaffold1.l()) { + if (mc.thePlayer.onGround) { + int i = new BlockPos(mc.thePlayer).getY() - 1; + scaffold1.c = !k() && !scaffold1.A && i == scaffold1.h + 1; + if (!scaffold1.c) { + scaffold1.h = i; + } + + scaffold1.Y = false; + scaffold1.A = false; + scaffold1.b++; + } + + if (mc.gameSettings.keyBindJump.isKeyDown()) { + scaffold1.I = new BlockPos(mc.thePlayer).getY(); + scaffold1.b = 2; + } + + PlacementResult placementResultx = scaffold1.placementResult; + ScaffoldMode scaffoldMode = scaffold1.L(); + Angles angles = scaffold1.L().L(); + MovingObjectPosition movingObjectPosition = scaffoldMode.L(placementResultx, angles); + int jx = scaffold1.ticks.randomInt(); + boolean bl = ScaffoldBlockFilter.d(mc.thePlayer.inventory.getCurrentItem()); + if (ScaffoldAutoBlock.INSTANCE.alwaysHoldBlock.getValue()) { + bl = scaffold1.L(bl); + } + + if (placementResultx != null && movingObjectPosition != null) { + if (placementResultx.L(movingObjectPosition) && scaffold1.L(movingObjectPosition)) { + if (!ScaffoldAutoBlock.INSTANCE.alwaysHoldBlock.getValue()) { + bl = scaffold1.L(bl); + } + + if (bl) { + boolean[] bl2 = new boolean[1]; + boolean bl3 = true; + bl2[0] = false; + boolean[] bl1 = bl2; + Vec3 vec3 = scaffold1.line3 != null ? ScaffoldPrediction.INSTANCE.L(scaffold1.line3) : null; + PlacementResult placementResult1 = placementResultx; + BlockUtils.L(movingObjectPosition, () -> { + this.L(placementResult1.placedBlock()); + this.placementResult = null; + bl1[0] = true; + return true; + }, () -> true, scaffold1.swing.getValue()); + if (bl1[0]) { + if (scaffold1.L(placementResult1.placedBlock())) { + scaffold1.Y = true; + } + + ScaffoldPrediction.INSTANCE.L(scaffold1.line3, vec3); + scaffold1.t = Math.max(0, jx - 1); + } + } + } + } + } + } + + @Override + protected void onDisable() { + this.h(); + this.k(); + } + + private List D() { + Scaffold scaffold1 = this; + ArrayList arrayList = new ArrayList(9); + if (!scaffold1.l()) { + return arrayList; + } + + for (int jx = i = 0; jx <= 8; jx = ++i) { + ItemStack itemStack; + if (ScaffoldBlockFilter.d(itemStack = mc.thePlayer.inventory.getStackInSlot(i))) { + arrayList.add(new ScaffoldData(i, itemStack)); + } + } + + return arrayList; + } + + private Integer L() { + Scaffold scaffold1 = this; + List list = scaffold1.D(); + int i = ScaffoldAutoBlock.INSTANCE.doNotUseBelowCount.getInt(); + Comparator comparator = (scaffoldData1, scaffoldData2) -> CHAINED_COMPARATOR.compare(scaffoldData1.stack(), scaffoldData2.stack()); + ScaffoldData scaffoldData; + return ( + scaffoldData = list.stream() + .filter(scaffoldData1 -> scaffoldData1.stack().stackSize > i) + .max(comparator) + .orElseGet(() -> (ScaffoldData)list.stream().max(comparator).orElse(null)) + ) + != null + ? scaffoldData.index() + : null; + } + + private static BlockPos L(BlockPos blockPos, int i) { + return new BlockPos(blockPos.getX(), i, blockPos.getZ()); + } + + @EventHandler + private void onWorldChange(WorldChangeEvent worldChangeEvent) { + this.k(); + this.u = false; + if (this.autoF5.isEnabled()) { + this.l(); + } + } + + private void L(BlockPos blockPos) { + if (!this.L(blockPos)) { + ScaffoldPathfinder.L(blockPos); + } + + ScaffoldSneak.INSTANCE.i(); + ScaffoldSprintControl.INSTANCE.i(); + ScaffoldHypixelKeepY.INSTANCE.h(); + } + + private static boolean k() { + return mc.gameSettings.keyBindJump.isKeyDown(); + } + + private void k() { + this.t = 0; + ScaffoldPathfinder.L(); + ScaffoldPrediction.INSTANCE.i(); + HotbarManager.INSTANCE.L(this); + this.block = null; + this.j = 0; + this.placementResult = null; + this.Y = false; + this.c = false; + this.A = false; + } + + private boolean F() { + if (!ScaffoldTelly.INSTANCE.isEnabled() || this.Y || this.c) { + return false; + } else { + return PlayerUtils.L(mc.thePlayer) && !mc.thePlayer.onGround ? mc.thePlayer.motionY <= 0.0 && mc.thePlayer.posY >= this.h + 2.0 : false; + } + } + + private ScaffoldMode L() { + return this.technique.getMode(); + } + + private BlockPos L() { + Scaffold scaffold1 = this; + if (!scaffold1.F()) { + return null; + } + + BlockPos blockPos; + return (blockPos = ScaffoldPathfinder.L()) != null && blockPos.getY() == scaffold1.h ? blockPos.up() : null; + } + + @EventHandler + private void onRotationTick(RotationTickEvent rotationTickEvent) { + if (this.l()) { + ItemStack itemStack; + Integer integer; + Scaffold scaffold1; + if ((integer = this.L()) == null) { + scaffold1 = this; + this.block = null; + itemStack = new ItemStack(Blocks.sandstone, 64); + } else { + itemStack = mc.thePlayer.inventory.getStackInSlot(integer); + scaffold1 = this; + this.block = BlockItemUtils.L(itemStack); + } + + Line3 line3x = scaffold1.line3; + Vec3 vec3; + if ((vec3 = ScaffoldPrediction.INSTANCE.d(line3x)) == null) { + vec3 = PlayerUtils.D((Entity)mc.thePlayer); + } + + boolean bl = ScaffoldSneak.INSTANCE.isEnabled() && ScaffoldSneak.INSTANCE.L(PlayerUtils.L(mc.thePlayer)); + ScaffoldMode scaffoldMode; + this.placementResult = (scaffoldMode = this.L()).L(vec3, bl, line3x, itemStack); + Angles angles; + if ((angles = scaffoldMode.L(this.placementResult)) != null) { + RotationRequest rotationRequest = scaffoldMode.L(angles, this.scaffoldRotationSettings, this.scaffoldRotationSettings.considerInventory.getValue()); + RotationHandler.INSTANCE + .L(this.scaffoldRotationSettings.L(ScaffoldClutch.INSTANCE.L(rotationRequest)), ItemPriority.IMPORTANT_FOR_PLAYER_LIFE, this); + } + } + } + + public int L() { + Scaffold scaffold1 = this; + if (!scaffold1.l()) { + return 0; + } + + int i = 0; + Iterator iterator; + if (ScaffoldAutoBlock.INSTANCE.isEnabled()) { + for (Iterator iterator1 = iterator = scaffold1.D().iterator(); iterator1.hasNext(); iterator1 = iterator) { + ScaffoldData scaffoldData = (ScaffoldData)iterator.next(); + i += L(scaffoldData.stack()); + } + } else { + i += L(mc.thePlayer.inventory.getCurrentItem()); + } + + return i; + } + + private Scaffold() { + super("Scaffold", "Places blocks under you", ModuleCategory.PLAYER); + this.minDistance = new NumberSetting("Min distance", 0.0, 0.0, 0.25, 0.01).visibleWhen(Setting.BOOLEAN_SUPPLIER); + this.scaffoldAutoBlock = ScaffoldAutoBlock.INSTANCE; + this.scaffoldPrediction = ScaffoldPrediction.INSTANCE; + ScaffoldNormal scaffoldNormal = ScaffoldNormal.INSTANCE; + ScaffoldMode[] scaffoldModes = new ScaffoldMode[6]; + boolean bl = true; + scaffoldModes[0] = ScaffoldNormal.INSTANCE; + scaffoldModes[1] = ScaffoldExpand.INSTANCE; + scaffoldModes[2] = ScaffoldGodBridge.INSTANCE; + scaffoldModes[3] = ScaffoldBreezily.INSTANCE; + scaffoldModes[4] = ScaffoldHypixelKeepY.INSTANCE; + scaffoldModes[5] = ScaffoldHypixelSprint.INSTANCE; + this.technique = new ModeSetting<>("Technique", scaffoldNormal, scaffoldModes); + this.sameY = new EnumSetting<>("Same Y", SameYMode.OFF); + this.spaceClimb = new BooleanSetting("Space climb", false) + .describe("Climb up normally while the jump key is held") + .visibleWhen(this.sameY, sameYMode -> sameYMode == SameYMode.ON); + this.safeWalk = L(); + this.modeSetting = SafeWalk.L("Safe walk"); + this.swing = new EnumSetting<>("Swing", SwingMode.DO_NOT_HIDE); + this.scaffoldRotationSettings = new ScaffoldRotationSettings(); + this.scaffoldSprintControl = ScaffoldSprintControl.INSTANCE; + this.scaffoldAcceleration = ScaffoldAcceleration.INSTANCE; + this.scaffoldStrafe = ScaffoldStrafe.INSTANCE; + this.scaffoldStrafeSpeed = ScaffoldStrafeSpeed.INSTANCE; + this.scaffoldClutch = ScaffoldClutch.INSTANCE; + this.edgeSafety = new BooleanSetting("Edge safety", true).describe("Waits at the edge until the aim is on the block, instead of walking off"); + this.autoF5 = new BooleanSetting("Auto F5", false) + .describe("Drops into third person behind you while scaffolding, and puts the camera back after") + .onChange(boolean1 -> { + if (this.isEnabled()) { + if (boolean1) { + this.l(); + } else { + this.h(); + } + } + }); + this.disableOnDeath = new BooleanSetting("Disable on death", true).describe("Turns Scaffold off when you die, so you do not respawn still bridging"); + this.movementInputState = MovementInputState.INSTANCE8; + } + + public MovementInputState getMovementInputState() { + return this.movementInputState; + } + + private static ModeSetting L() { + NoneMode noneMode = new NoneMode(); + ModeOption[] modeOptions = new ModeOption[2]; + boolean bl = true; + modeOptions[0] = noneMode; + modeOptions[1] = ScaffoldWatchdogMode.INSTANCE; + return new ModeSetting<>("Tower", noneMode, modeOptions).describe("Vertical bridging while you hold jump standing still"); + } + + public void F() { + if (this.isEnabled() && this.disableOnDeath.isEnabled()) { + this.setEnabled(false); + } + } + + public boolean L(MovingObjectPosition movingObjectPosition) { + if (movingObjectPosition != null && movingObjectPosition.hitVec != null) { + Vec3 vec3 = movingObjectPosition.hitVec.subtract(mc.thePlayer.getPositionEyes(1.0F)); + EnumFacing enumFacing; + if ((enumFacing = movingObjectPosition.sideHit) != null && enumFacing.getAxis() != Axis.Y) { + double d = enumFacing != EnumFacing.NORTH && enumFacing != EnumFacing.SOUTH ? vec3.xCoord : vec3.zCoord; + if (Math.abs(d) < this.minDistance.getFloat()) { + return false; + } + } + + return true; + } else { + return false; + } + } + + private boolean l() { + return mc.thePlayer != null && mc.theWorld != null && mc.playerController != null; + } + + private boolean L(BlockPos blockPos) { + return this.sameY.getValue() == SameYMode.HYPIXEL2 && blockPos.getY() == this.h + 1; + } + + private Angles L() { + Angles angles; + return (angles = RotationHandler.INSTANCE.getAngles3()) != null ? angles : PlayerUtils.L((Entity)mc.thePlayer); + } + + public boolean h() { + return !this.l() ? false : this.L(ScaffoldBlockFilter.d(mc.thePlayer.inventory.getCurrentItem())); + } + + private boolean L(boolean bl) { + if (ScaffoldAutoBlock.INSTANCE.isEnabled() && !bl) { + Integer integer; + if ((integer = this.L()) != null) { + HotbarManager.INSTANCE.L(this, integer, ScaffoldAutoBlock.INSTANCE.slotResetDelay.getInt()); + return true; + } else { + HotbarManager.INSTANCE.L(this); + return bl; + } + } else { + HotbarManager.INSTANCE.L(this); + return bl; + } + } + + @Override + protected void onEnable() { + if (this.autoF5.isEnabled()) { + this.l(); + } + + if (mc.thePlayer != null) { + this.h = new BlockPos(mc.thePlayer).getY() - 1; + this.I = new BlockPos(mc.thePlayer).getY(); + this.b = 2; + ScaffoldPathfinder.L(); + } + } + + private void l() { + if (!this.u) { + this.W = mc.gameSettings.thirdPersonView; + this.u = (boolean)(mc.gameSettings.thirdPersonView = 1); + } + } + + @EventHandler + private void onPreTick(PreTickEvent preTickEvent) { + if (!this.l()) { + this.t = 0; + } else { + if (!mc.thePlayer.onGround && k()) { + this.A = true; + } + + if (this.t > 0) { + this.t--; + } else { + this.e(); + } + } + } + + @EventHandler(priority = -50) + private void onMovementInput2(MovementInputEvent movementInputEvent) { + Scaffold scaffold1 = this; + if (scaffold1.l()) { + if (scaffold1.j > 0) { + movementInputEvent.d(true); + scaffold1.j--; + } + + if (scaffold1.edgeSafety.getValue()) { + ScaffoldMode scaffoldMode = scaffold1.L(); + Angles angles; + if ((angles = RotationHandler.INSTANCE.getAngles3()) == null) { + angles = PlayerUtils.L((Entity)mc.thePlayer); + } + + BridgeAction bridgeAction; + if ((bridgeAction = BridgeActionResolver.L( + scaffold1.placementResult, angles, scaffoldMode instanceof BridgeTechnique ? (BridgeTechnique)scaffoldMode : null + )) + .jump()) { + movementInputEvent.L(true); + } + + if (bridgeAction.stopInput()) { + movementInputEvent.L(MovementInputState.INSTANCE8); + } + + if (bridgeAction.stepBack()) { + movementInputEvent.L( + new MovementInputState(false, true, movementInputEvent.getMovementInputState().left(), movementInputEvent.getMovementInputState().right()) + ); + } + + if (bridgeAction.sneakTime() > scaffold1.j) { + movementInputEvent.d(true); + scaffold1.j = bridgeAction.sneakTime(); + } + } + } + } + + private void h() { + if (this.u) { + this.u = false; + if (mc.gameSettings.thirdPersonView == 1) { + mc.gameSettings.thirdPersonView = this.W; + } + } + } + + private BlockPos d(BlockPos blockPos) { + switch ((SameYMode)this.sameY.getValue()) { + case ON: + while (false) { + } + + return null; + case FALLING: + if (!this.spaceClimb.getValue() || !k() && !this.A) { + return L(blockPos, this.h); + } + + return null; + case OFF: + if (mc.thePlayer.motionY < 0.2) { + return L(blockPos, this.h); + } + + return null; + case HYPIXEL2: + if (mc.thePlayer.motionY == -0.15233518685055708 && this.b >= 2) { + this.b = 0; + return L(blockPos, this.I); + } + + return L(blockPos, this.I - 1); + case HYPIXEL: + if (!k() && !this.A) { + BlockPos blockPos1; + if ((blockPos1 = this.L()) != null) { + return blockPos1; + } + + return L(blockPos, this.h); + } + + return null; + default: + throw new MatchException(null, null); + } + } + + static { + Comparator[] comparators = new Comparator[7]; + boolean bl = true; + comparators[0] = BlockStackComparators.COMPARATOR4; + comparators[1] = BlockStackComparators.COMPARATOR3; + comparators[2] = BlockStackComparators.COMPARATOR5; + comparators[3] = BlockStackComparators.COMPARATOR; + comparators[4] = BlockStackComparators.L(true); + comparators[5] = BlockStackComparators.COMPARATOR2; + comparators[6] = BlockStackComparators.L(false); + CHAINED_COMPARATOR = new ChainedComparator<>(comparators); + comparators = new Comparator[7]; + bl = true; + comparators[0] = BlockStackComparators.COMPARATOR4; + comparators[1] = BlockStackComparators.COMPARATOR3; + comparators[2] = BlockStackComparators.COMPARATOR5; + comparators[3] = BlockStackComparators.COMPARATOR; + comparators[4] = BlockStackComparators.L(true); + comparators[5] = BlockStackComparators.COMPARATOR6; + comparators[6] = BlockStackComparators.L(false); + y = new ChainedComparator<>(comparators); + } + + public BlockPos L(BlockPos blockPos) { + if (ScaffoldDown.INSTANCE.isToggled() && ScaffoldDown.h()) { + return blockPos.add(0, -2, 0); + } else { + BlockPos blockPos1; + if (this.sameY.getValue() == SameYMode.HYPIXEL2 && (blockPos1 = this.d(blockPos)) != null) { + return blockPos1; + } else if (!mc.thePlayer.movementInput.jump || PlayerUtils.L(mc.thePlayer) && !mc.thePlayer.isCollidedHorizontally) { + return (blockPos1 = this.d(blockPos)) != null ? blockPos1 : blockPos.add(0, -1, 0); + } else { + return blockPos.add(0, -1, 0); + } + } + } + + @EventHandler(priority = -10) + private void onMovementInput(MovementInputEvent movementInputEvent) { + if (this.l()) { + this.line3 = null; + this.movementInputState = movementInputEvent.getMovementInputState(); + if (!movementInputEvent.getMovementInputState().equals(MovementInputState.INSTANCE8)) { + this.line3 = ScaffoldPathfinder.L(movementInputEvent.getMovementInputState()); + } + } + } + + public Line3 getLine3() { + return this.line3; + } + + private static int L(ItemStack itemStack) { + return ScaffoldBlockFilter.d(itemStack) ? itemStack.stackSize : 0; + } +}