feat(ClickPearl): add ClickPearl module as a demo for inventory utils

This commit is contained in:
cattyn
2025-12-25 21:13:02 +03:00
parent 8774eac6ab
commit fcf0aa95e7
2 changed files with 36 additions and 0 deletions
@@ -0,0 +1,34 @@
package me.alpha432.oyvey.features.modules.combat;
import me.alpha432.oyvey.features.modules.Module;
import me.alpha432.oyvey.features.settings.Setting;
import me.alpha432.oyvey.util.inventory.InventoryUtil;
import me.alpha432.oyvey.util.inventory.Result;
import net.minecraft.world.item.Items;
import static me.alpha432.oyvey.util.inventory.InventoryUtil.FULL_SCOPE;
import static me.alpha432.oyvey.util.inventory.InventoryUtil.HOTBAR_SCOPE;
public class ClickPearl extends Module {
private final Setting<Boolean> inventory = bool("Inventory", false);
public ClickPearl() {
super("ClickPearl", "Throws a pearl when enabled.", Category.COMBAT);
}
@Override
public void onEnable() {
disable();
if (nullCheck()) return;
int last = InventoryUtil.selected();
Result result = InventoryUtil.find(Items.ENDER_PEARL, inventory.getValue() ? FULL_SCOPE : HOTBAR_SCOPE);
if (!result.found())
return;
InventoryUtil.swap(result);
mc.gameMode.useItem(mc.player, result.hand());
InventoryUtil.swapBack(last, result);
}
}
@@ -9,6 +9,7 @@ import me.alpha432.oyvey.features.modules.Module;
import me.alpha432.oyvey.features.modules.client.ClickGui;
import me.alpha432.oyvey.features.modules.client.HudEditor;
import me.alpha432.oyvey.features.modules.client.Notifications;
import me.alpha432.oyvey.features.modules.combat.ClickPearl;
import me.alpha432.oyvey.features.modules.combat.Criticals;
import me.alpha432.oyvey.features.modules.hud.Coordinates;
import me.alpha432.oyvey.features.modules.hud.Watermark;
@@ -43,6 +44,7 @@ public class ModuleManager implements Jsonable, Util {
register(new Velocity());
register(new BlockHighlight());
register(new NoFall());
register(new ClickPearl());
}
public void register(Module module) {