diff options
author | alemi <me@alemi.dev> | 2023-11-13 04:41:06 +0100 |
---|---|---|
committer | alemi <me@alemi.dev> | 2023-11-13 04:41:06 +0100 |
commit | 34b96b67d31d032a72a72eb37e3b79809ef9fbbd (patch) | |
tree | ff16ce093cb38f1bd4cd267a11ed444ec6021866 /src/main | |
parent | 939a0f7a40f9c9c4864e7b39a039fbf56c7333ac (diff) |
feat: added crude fastcraft
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/ftbsc/bscv/modules/self/FastCraft.java | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/src/main/java/ftbsc/bscv/modules/self/FastCraft.java b/src/main/java/ftbsc/bscv/modules/self/FastCraft.java new file mode 100644 index 0000000..d4aaa77 --- /dev/null +++ b/src/main/java/ftbsc/bscv/modules/self/FastCraft.java @@ -0,0 +1,39 @@ +package ftbsc.bscv.modules.self; + +import com.google.auto.service.AutoService; +import ftbsc.bscv.api.ILoadable; +import ftbsc.bscv.modules.AbstractModule; +import ftbsc.bscv.tools.Inventory; +import ftbsc.bscv.tools.Setting; +import net.minecraft.client.gui.screen.inventory.InventoryScreen; +import net.minecraft.inventory.container.ClickType; +import net.minecraftforge.common.ForgeConfigSpec; +import net.minecraftforge.event.TickEvent.ClientTickEvent; +import net.minecraftforge.eventbus.api.SubscribeEvent; + +@AutoService(ILoadable.class) +public class FastCraft extends AbstractModule { + + public final ForgeConfigSpec.ConfigValue<Boolean> drop; + + public FastCraft() { + super(); + + this.drop = Setting.Bool.builder() + .fallback(false) + .name("drop") + .comment("throw cradted items away instead of moving them back in inventory") + .build(this); + } + + @SubscribeEvent + public void onTick(ClientTickEvent event) { + if (MC.screen == null) return; + if (!(MC.screen instanceof InventoryScreen)) return; + InventoryScreen inventory = (InventoryScreen) MC.screen; + if (inventory.getMenu().slots.get(0).hasItem()) { + // TODO can we throw them all? like this it throws one by one + Inventory.clickSlot(0, this.drop.get() ? ClickType.THROW : ClickType.QUICK_MOVE); + } + } +} |