diff options
-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); + } + } +} |