diff --git a/gradle.properties b/gradle.properties index 2db0522..4ad5bb2 100644 --- a/gradle.properties +++ b/gradle.properties @@ -7,7 +7,7 @@ mod_name = AutoTrade author = sebseb7 mod_file_name = autotrade-fabric -mod_version = 0.0.2 +mod_version = 0.0.3 malilib_version = 0.16.0 diff --git a/src/main/java/com/github/sebseb7/autotrade/config/Configs.java b/src/main/java/com/github/sebseb7/autotrade/config/Configs.java index dbb0845..618f500 100644 --- a/src/main/java/com/github/sebseb7/autotrade/config/Configs.java +++ b/src/main/java/com/github/sebseb7/autotrade/config/Configs.java @@ -42,10 +42,12 @@ public class Configs implements IConfigHandler { "Output container Y (not used when buy disabled)"); public static final ConfigInteger OUTPUT_CONTAINER_Z = new ConfigInteger("outputContainerZ", 0, -30000000, 30000000, "Output container Z (not used when buy disabled)"); + public static final ConfigInteger VOID_TRADING_DELAY = new ConfigInteger("voidTradingDelay", 0, 0, 30000000, + "delay in ticks for void trading"); public static final ImmutableList OPTIONS = ImmutableList.of(ENABLED, ENABLE_SELL, SELL_ITEM, ENABLE_BUY, BUY_ITEM, MAX_INPUT_ITEMS, INPUT_CONTAINER_X, INPUT_CONTAINER_Y, INPUT_CONTAINER_Z, - OUTPUT_CONTAINER_X, OUTPUT_CONTAINER_Y, OUTPUT_CONTAINER_Z); + OUTPUT_CONTAINER_X, OUTPUT_CONTAINER_Y, OUTPUT_CONTAINER_Z, VOID_TRADING_DELAY); } public static void loadFromFile() { diff --git a/src/main/java/com/github/sebseb7/autotrade/event/KeybindCallbacks.java b/src/main/java/com/github/sebseb7/autotrade/event/KeybindCallbacks.java index a67db32..7a1f69e 100644 --- a/src/main/java/com/github/sebseb7/autotrade/event/KeybindCallbacks.java +++ b/src/main/java/com/github/sebseb7/autotrade/event/KeybindCallbacks.java @@ -51,6 +51,7 @@ public class KeybindCallbacks implements IHotkeyCallback, IClientTickHandler { private boolean outputInRange = false; private boolean outputOpened = false; private int tickCount = 0; + private int voidDelay = 0; public static KeybindCallbacks getInstance() { return INSTANCE; @@ -192,6 +193,12 @@ public class KeybindCallbacks implements IHotkeyCallback, IClientTickHandler { @Override public void onClientTick(MinecraftClient mc) { + + if (voidDelay > 0) { + voidDelay--; + return; + } + if (this.functionalityEnabled() == false || mc.player == null) { return; } @@ -282,6 +289,7 @@ public class KeybindCallbacks implements IHotkeyCallback, IClientTickHandler { found = true; newVillagersInRange.add(entity); mc.interactionManager.interactEntity(mc.player, entity, Hand.MAIN_HAND); + voidDelay = Configs.Generic.VOID_TRADING_DELAY.getIntegerValue(); state = false; break; }