Upload files to "src/openonyx/features/player"

This commit is contained in:
winterflyt committed 2026-11-30 05:53:03 +02:00
1 parent 10117bd22b
commit 16dbd196c1
5 files changed
+507

No files matched your search

@@ -0,0 +1,133 @@
package openonyx.features.player;
import java.util.Locale;
import meteordevelopment.orbit.EventHandler;
import net.minecraft.block.BlockChest;
import net.minecraft.client.gui.inventory.GuiChest;
import net.minecraft.client.resources.I18n;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.ContainerChest;
import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.IChatComponent;
import openonyx.configuration.internal.TickEvent;
import openonyx.core.OnyxClient;
import openonyx.features.Module;
import openonyx.features.ModuleCategory;
import openonyx.history.internal.BooleanSetting;
import openonyx.history.internal.NumberSetting;
public class ChestStealer extends Module {
public BooleanSetting antiGUI;
private static final int d = 5;
public NumberSetting delay = new NumberSetting("Delay", 1.0, 0.0, 10.0, 1.0).withSuffix("t").describe("Ticks between clicks");
public BooleanSetting close;
private transient int H;
public BooleanSetting filter = new BooleanSetting("Filter", true).describe("Leaves behind anything InventoryManager calls junk");
@Override
protected void onDisable() {
this.H = 0;
}
private static String i() {
String string = "container.chest";
Object[] objects = new Object[0];
boolean bl = true;
String string1 = I18n.format("container.chest", objects);
return (string.equals(string1) ? "chest" : string1).toLowerCase(Locale.ROOT);
}
private boolean d(ContainerChest containerChest) {
return !this.antiGUI.isEnabled() ? true : L(containerChest) && this.I();
}
@EventHandler
private void onTick(TickEvent tickEvent) {
ContainerChest containerChest;
if ((containerChest = this.L()) != null && this.d(containerChest)) {
int i;
if ((i = this.L(containerChest)) < 0) {
this.H = 0;
if (this.close.isEnabled()) {
mc.thePlayer.closeScreen();
}
} else if (this.H++ >= this.delay.getInt()) {
mc.playerController.windowClick(containerChest.windowId, i, 0, 1, mc.thePlayer);
this.H = 0;
}
} else {
this.H = 0;
}
}
public ChestStealer() {
super("ChestStealer", "Takes the useful items out of a chest", ModuleCategory.PLAYER);
this.close = new BooleanSetting("Close", true).describe("Closes the chest once there is nothing left worth taking");
this.antiGUI = new BooleanSetting("Anti GUI", true)
.describe("Only steal from a real chest. A shop, kit or menu is a chest window like any other, and clicking through one buys it out.");
}
private ContainerChest L() {
if (mc.thePlayer != null && mc.currentScreen instanceof GuiChest) {
Container container = mc.thePlayer.openContainer;
return mc.thePlayer.openContainer instanceof ContainerChest ? (ContainerChest)container : null;
} else {
return null;
}
}
private int L(ContainerChest containerChest) {
ChestStealer chestStealer1 = this;
int i = containerChest.getLowerChestInventory().getSizeInventory();
for (int k = j = 0; k < i; k = ++j) {
ItemStack itemStack;
if ((itemStack = containerChest.getSlot(j).getStack()) != null && itemStack.getItem() != null && !chestStealer1.L(itemStack)) {
return j;
}
}
return -1;
}
private static boolean L(ContainerChest containerChest) {
ContainerChest containerChest1 = containerChest;
IChatComponent iChatComponent;
if ((iChatComponent = containerChest1.getLowerChestInventory().getDisplayName()) == null) {
return false;
}
String string;
return (string = EnumChatFormatting.getTextWithoutFormattingCodes(iChatComponent.getUnformattedText())) == null
? false
: string.toLowerCase(Locale.ROOT).contains(i());
}
private boolean L(ItemStack itemStack) {
return this.filter.isEnabled() && OnyxClient.moduleManager.inventoryManager.L(itemStack);
}
private boolean I() {
if (mc.theWorld == null) {
return false;
}
BlockPos blockPos = new BlockPos(mc.thePlayer);
int j;
for (int n = j = -5; n <= 5; n = ++j) {
int i;
for (int l = k = -5; l <= 5; l = ++k) {
for (int m = i = -5; m <= 5; m = ++i) {
if (mc.theWorld.getBlockState(blockPos.add(j, k, i)).getBlock() instanceof BlockChest) {
return true;
}
}
}
}
return false;
}
}
+227
View File
@@ -0,0 +1,227 @@
package openonyx.features.player;
import meteordevelopment.orbit.EventHandler;
import net.minecraft.block.Block;
import net.minecraft.block.BlockChest;
import net.minecraft.block.BlockEnderChest;
import net.minecraft.client.gui.inventory.GuiChest;
import net.minecraft.init.Items;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.ContainerChest;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
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.MovingObjectPosition.MovingObjectType;
import openonyx.configuration.internal.RunTickEvent;
import openonyx.configuration.internal.WorldChangeEvent;
import openonyx.events.HypixelUtils;
import openonyx.features.Module;
import openonyx.features.ModuleCategory;
import openonyx.history.internal.BooleanSetting;
import openonyx.history.internal.EnumSetting;
import openonyx.history.internal.MultiSelectSetting;
import openonyx.history.internal.RangeSetting;
import openonyx.utilities.Timer;
public class Deposit extends Module {
private static final int D = 27;
private transient int c;
public BooleanSetting hypixelOnly;
private transient EnumFacing enumFacing;
private final transient Timer timer;
private static final int M = 40;
private transient DepositMode2 depositMode2;
private static final int j = 1;
private transient BlockPos blockPos;
private static final int h = 9;
public MultiSelectSetting<ItemsMode> items;
public static final Deposit INSTANCE = new Deposit();
private transient int d;
private transient long i;
public RangeSetting ms;
public EnumSetting<DepositMode> mode = new EnumSetting<>("Mode", DepositMode.HELD)
.describe("What a scroll at a chest sends over - just what you are holding, or a sweep of the hotbar");
private transient Vec3 vec3;
@EventHandler
private void onRunTick(RunTickEvent runTickEvent) {
if (mc.thePlayer != null && mc.theWorld != null) {
switch (this.depositMode2) {
case DEPOSITING:
while (false) {
}
this.F();
return;
case OPENING:
this.l();
return;
}
} else {
this.h();
}
}
@Override
protected void onDisable() {
this.h();
}
private void F() {
if (this.L() != null) {
this.d = this.mode.is(DepositMode.HELD) ? mc.thePlayer.inventory.currentItem : 0;
this.i = 0L;
this.timer.reset();
this.depositMode2 = DepositMode2.DEPOSITING;
} else {
if (++this.c >= 40) {
this.h();
}
}
}
private void l() {
Deposit deposit1 = this;
ContainerChest containerChest;
if ((containerChest = deposit1.L()) == null) {
deposit1.h();
} else if (deposit1.timer.hasElapsed(deposit1.i)) {
int ix;
if ((ix = deposit1.L()) < 0) {
mc.thePlayer.closeScreen();
deposit1.h();
} else {
mc.playerController.windowClick(containerChest.windowId, deposit1.L(containerChest, ix), 0, 1, mc.thePlayer);
deposit1.d = deposit1.mode.is(DepositMode.HELD) ? 9 : ix + 1;
deposit1.i = (long)deposit1.ms.random();
deposit1.timer.reset();
}
}
}
private boolean L(BlockPos blockPos) {
Block block;
return (block = mc.theWorld.getBlockState(blockPosx).getBlock()) instanceof BlockChest || block instanceof BlockEnderChest;
}
private boolean L(ItemStack itemStack) {
Item item;
if ((item = itemStack.getItem()) == Items.iron_ingot) {
return this.items.contains(ItemsMode.IRON);
} else if (item == Items.gold_ingot) {
return this.items.contains(ItemsMode.GOLD);
} else if (item == Items.diamond) {
return this.items.contains(ItemsMode.DIAMOND);
} else if (item == Items.emerald) {
return this.items.contains(ItemsMode.EMERALD);
} else {
return item instanceof ItemBlock ? this.items.contains(ItemsMode.BLOCKS) : this.items.contains(ItemsMode.OTHER);
}
}
private ContainerChest L() {
if (!(mc.currentScreen instanceof GuiChest)) {
return null;
}
Container container = mc.thePlayer.openContainer;
return mc.thePlayer.openContainer instanceof ContainerChest ? (ContainerChest)container : null;
}
private void h() {
this.depositMode2 = DepositMode2.IDLE;
this.blockPos = null;
this.enumFacing = null;
this.vec3 = null;
this.c = 0;
this.d = 0;
this.i = 0L;
}
private int L() {
Deposit deposit1 = this;
for (int jx = ix = deposit1.d; jx < 9; jx = ++ix) {
ItemStack itemStack = mc.thePlayer.inventory.getStackInSlot(ix);
if (deposit1.mode.is(DepositMode.HELD)) {
if (itemStack == null) {
return -1;
}
return ix;
}
if (itemStack != null && deposit1.L(itemStack)) {
return ix;
}
}
return -1;
}
private int L(ContainerChest containerChest, int i) {
return containerChest.getLowerChestInventory().getSizeInventory() / 9 * 9 + 27 + ix;
}
private Deposit() {
super("Deposit", "Scroll at a chest to put your items in it", ModuleCategory.PLAYER);
ItemsMode[] itemsModes = new ItemsMode[4];
boolean bl = true;
itemsModes[0] = ItemsMode.IRON;
itemsModes[1] = ItemsMode.GOLD;
itemsModes[2] = ItemsMode.DIAMOND;
itemsModes[3] = ItemsMode.EMERALD;
this.items = new MultiSelectSetting<>("Items", ItemsMode.class, itemsModes)
.allowEmpty(false)
.describe("Which of the hotbar a sweep picks up - the rest stays on you")
.visibleWhen(this.mode, depositMode -> depositMode == DepositMode.HOTBAR);
this.hypixelOnly = new BooleanSetting("Hypixel only", true).describe("Leaves the scroll wheel alone on every other server");
this.ms = RangeSetting.ofInt("Delay", 50, 100, 0, 500).withSuffix(" ms").describe("Spacing between the individual shift clicks");
this.depositMode2 = DepositMode2.IDLE;
this.timer = new Timer();
}
public boolean L(int i) {
if (ix == 0 || !this.isEnabled() || this.depositMode2 != DepositMode2.IDLE) {
return false;
}
if (mc.thePlayer == null || mc.theWorld == null || mc.currentScreen != null) {
return false;
}
if (this.hypixelOnly.isEnabled() && !HypixelUtils.d()) {
return false;
}
MovingObjectPosition movingObjectPosition = mc.objectMouseOver;
if (mc.objectMouseOver == null || movingObjectPosition.typeOfHit != MovingObjectType.BLOCK) {
return false;
}
if (!this.L(movingObjectPosition.getBlockPos())) {
return false;
}
if (this.mode.is(DepositMode.HELD) && mc.thePlayer.getHeldItem() == null) {
return false;
}
this.blockPos = movingObjectPosition.getBlockPos();
this.enumFacing = movingObjectPosition.sideHit;
this.vec3 = movingObjectPosition.hitVec;
this.c = 0;
this.depositMode2 = DepositMode2.OPENING;
mc.playerController.onPlayerRightClick(mc.thePlayer, mc.theWorld, mc.thePlayer.getHeldItem(), this.blockPos, this.enumFacing, this.vec3);
return true;
}
@EventHandler
private void onWorldChange(WorldChangeEvent worldChangeEvent) {
this.h();
}
}
@@ -0,0 +1,27 @@
package openonyx.features.player;
import openonyx.history.DisplayNamed;
public enum DepositMode implements DisplayNamed {
HELD("Held item"),
HOTBAR("Hotbar");
private final String i;
DepositMode(String string1) {
this.i = string1;
}
@Override
public String getDisplayName() {
return this.i;
}
private static DepositMode[] L() {
DepositMode[] depositModes = new DepositMode[2];
boolean bl = true;
depositModes[0] = HELD;
depositModes[1] = HOTBAR;
return depositModes;
}
}
@@ -0,0 +1,16 @@
package openonyx.features.player;
enum DepositMode2 {
IDLE,
DEPOSITING,
OPENING;
private static DepositMode2[] L() {
DepositMode2[] depositMode2s = new DepositMode2[3];
boolean bl = true;
depositMode2s[0] = IDLE;
depositMode2s[1] = OPENING;
depositMode2s[2] = DEPOSITING;
return depositMode2s;
}
}
+104
View File
@@ -0,0 +1,104 @@
package openonyx.features.player;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.MovingObjectPosition.MovingObjectType;
import openonyx.core.OnyxClient;
import openonyx.features.Module;
import openonyx.features.ModuleCategory;
import openonyx.history.internal.BooleanSetting;
import openonyx.history.internal.RangeSetting;
import openonyx.utilities.Timer;
public class FastPlace extends Module {
private transient long I;
public RangeSetting cps;
public BooleanSetting interact;
private final transient Timer timer;
public BooleanSetting place = new BooleanSetting("Place", true).describe("Removes the delay when the right click puts a block down");
public BooleanSetting jump;
@Override
public String getSuffix() {
return this.cps.format();
}
private boolean L(MovingObjectPosition movingObjectPosition, ItemStack itemStack) {
FastPlace fastPlace1 = this;
boolean bl = movingObjectPosition != null
&& movingObjectPosition.typeOfHit == MovingObjectType.BLOCK
&& itemStack != null
&& itemStack.getItem() instanceof ItemBlock;
return bl ? fastPlace1.place.isEnabled() : fastPlace1.interact.isEnabled();
}
private static FastPlace L() {
return OnyxClient.moduleManager == null ? null : OnyxClient.moduleManager.fastPlace;
}
public FastPlace() {
super("FastPlace", "Places, interacts and jumps without vanilla's cooldowns", ModuleCategory.PLAYER);
this.interact = new BooleanSetting("Interact", true)
.describe("Removes the delay on everything else the right click does - using items, and clicking entities");
this.jump = new BooleanSetting("Jump", false).describe("Removes the 10 tick cooldown after a jump, so you leave the ground again the tick you land");
this.cps = RangeSetting.ofInt("CPS", 12, 20, 1, 20)
.withSuffix(" cps")
.describe("The rate the held right click repeats at - re-rolled inside this range every action")
.visibleWhen(() -> {
FastPlace fastPlace;
return (fastPlace = L()) != null && (fastPlace.place.isEnabled() || fastPlace.interact.isEnabled());
});
this.timer = new Timer();
}
public static int L(MovingObjectPosition movingObjectPosition, ItemStack itemStack) {
MovingObjectPosition movingObjectPosition1 = movingObjectPosition;
FastPlace fastPlace;
if ((fastPlace = L()) != null && fastPlace.isEnabled()) {
fastPlace.timer.reset();
return fastPlace.L(movingObjectPosition1, itemStack) ? 0 : 4;
} else {
return 4;
}
}
@Override
protected void onEnable() {
this.I = this.L();
this.timer.reset();
}
private long L() {
return (long)(1000.0 / this.cps.random());
}
public static boolean I() {
FastPlace fastPlace;
if ((fastPlace = L()) == null || !fastPlace.isEnabled()) {
return true;
}
if (!fastPlace.place.isEnabled() && !fastPlace.interact.isEnabled()) {
return true;
}
if (!fastPlace.timer.hasElapsed(fastPlace.I)) {
return false;
}
fastPlace.I = fastPlace.L();
return true;
}
public static int L(EntityLivingBase entityLivingBase) {
EntityLivingBase entityLivingBase1 = entityLivingBase;
FastPlace fastPlace;
if ((fastPlace = L()) == null || !fastPlace.isEnabled() || !fastPlace.jump.isEnabled()) {
return 10;
} else {
return entityLivingBase1 == mc.thePlayer ? 0 : 10;
}
}
}