From 4afd6046057688a8a460bf2d0d5720d5c4d98b56 Mon Sep 17 00:00:00 2001 From: seb Date: Sat, 16 May 2026 05:26:10 +0200 Subject: [PATCH] remove glass block selection logic and related configuration options --- .../sebseb7/autotrade/config/Configs.java | 9 ++-- .../autotrade/event/AutoTradeClientTick.java | 1 - .../event/AutoTradeConfigSelectors.java | 52 ------------------- 3 files changed, 3 insertions(+), 59 deletions(-) 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 f59d8a4..d064e52 100644 --- a/src/main/java/com/github/sebseb7/autotrade/config/Configs.java +++ b/src/main/java/com/github/sebseb7/autotrade/config/Configs.java @@ -27,10 +27,7 @@ public class Configs implements IConfigHandler { "Do auto trading with villagers in range"); public static final ConfigBoolean ITEM_FRAME = new ConfigBoolean("selectUsingItemFrame", true, "Select buy/sell items with item frames (max. distance 3) with items nametagged \"buy\" or \"sell\""); - public static final ConfigBoolean GLASS_BLOCK = new ConfigBoolean("selectUsingGlassBlock", false, - "Select input and output containers by placing red (input) and blue (output) stained glass blocks blocks above them (or below if negative)"); - public static final ConfigInteger SELECTOR_OFFSET = new ConfigInteger("selectionBlockOffset", 3, -10, 10, - "x Blocks below a red stained glass block will be input container, x Blocks below a blue stained glass block will be output container (or above, if x is negative)"); + public static final ConfigBoolean ENABLE_SELL = new ConfigBoolean("enableSell", false, "Enable selling (if disabled emeralds are taken from the input container)"); public static final ConfigString SELL_ITEM = new ConfigString("sellItem", "minecraft:gold_ingot", @@ -68,8 +65,8 @@ public class Configs implements IConfigHandler { public static final ConfigString SELECTED_ENCHANTMENTS = new ConfigString("selectedEnchantments", "", "Comma-separated list of selected enchantment IDs (set via the \"Select Enchantments\" button on a librarian's trade screen)"); - public static final ImmutableList OPTIONS = ImmutableList.of(ENABLED, ITEM_FRAME, GLASS_BLOCK, - SELECTOR_OFFSET, ENABLE_SELL, SELL_ITEM, SELL_LIMIT, ENABLE_BUY, BUY_ITEM, BUY_LIMIT, MAX_INPUT_ITEMS, + public static final ImmutableList OPTIONS = ImmutableList.of(ENABLED, ITEM_FRAME, + ENABLE_SELL, SELL_ITEM, SELL_LIMIT, ENABLE_BUY, BUY_ITEM, BUY_LIMIT, MAX_INPUT_ITEMS, INPUT_CONTAINER_X, INPUT_CONTAINER_Y, INPUT_CONTAINER_Z, OUTPUT_CONTAINER_X, OUTPUT_CONTAINER_Y, OUTPUT_CONTAINER_Z, VOID_TRADING_DELAY, VOID_TRADING_DELAY_AFTER_TELEPORT, CONTAINER_CLOSE_DELAY, SHOW_TRADES, SELECTED_ENCHANTMENTS); diff --git a/src/main/java/com/github/sebseb7/autotrade/event/AutoTradeClientTick.java b/src/main/java/com/github/sebseb7/autotrade/event/AutoTradeClientTick.java index 793d5cb..ebb6baa 100644 --- a/src/main/java/com/github/sebseb7/autotrade/event/AutoTradeClientTick.java +++ b/src/main/java/com/github/sebseb7/autotrade/event/AutoTradeClientTick.java @@ -43,7 +43,6 @@ final class AutoTradeClientTick { return; } - AutoTradeConfigSelectors.tickGlassBlockSelection(mc); AutoTradeConfigSelectors.tickItemFrameSelection(mc); merchantScreenTick.tickDeferredResultQuickMove(mc); diff --git a/src/main/java/com/github/sebseb7/autotrade/event/AutoTradeConfigSelectors.java b/src/main/java/com/github/sebseb7/autotrade/event/AutoTradeConfigSelectors.java index a983817..be3db20 100644 --- a/src/main/java/com/github/sebseb7/autotrade/event/AutoTradeConfigSelectors.java +++ b/src/main/java/com/github/sebseb7/autotrade/event/AutoTradeConfigSelectors.java @@ -4,7 +4,6 @@ import com.github.sebseb7.autotrade.config.Configs; import fi.dy.masa.malilib.gui.Message.MessageType; import fi.dy.masa.malilib.util.InfoUtils; import net.minecraft.client.Minecraft; -import net.minecraft.core.BlockPos; import net.minecraft.world.entity.Entity; import net.minecraft.world.phys.Vec3; @@ -12,57 +11,6 @@ final class AutoTradeConfigSelectors { private AutoTradeConfigSelectors() {} - static void tickGlassBlockSelection(Minecraft mc) { - if (!Configs.Generic.GLASS_BLOCK.getBooleanValue()) return; - int playerX = (int) mc.player.getX(); - int playerZ = (int) mc.player.getZ(); - int playerY = (int) mc.player.getY(); - int selectorOffset = Configs.Generic.SELECTOR_OFFSET.getIntegerValue(); - int absSelectorOffset = Math.abs(selectorOffset); - var redGlass = net.minecraft.world.level.block.Blocks.RED_STAINED_GLASS; - var blueGlass = net.minecraft.world.level.block.Blocks.BLUE_STAINED_GLASS; - - for (int x = playerX - (absSelectorOffset + 3); x < playerX + (absSelectorOffset + 3); x++) { - for (int z = playerZ - (absSelectorOffset + 3); z < playerZ + (absSelectorOffset + 3); z++) { - for (int y = playerY - (absSelectorOffset + 3); y < playerY + (absSelectorOffset + 3); y++) { - BlockPos pos = new BlockPos(x, y, z); - if (mc.level.getBlockState(pos).getBlock() == redGlass) { - updateInputContainerPos(x, y, z, selectorOffset); - break; - } - if (mc.level.getBlockState(pos).getBlock() == blueGlass) { - updateOutputContainerPos(x, y, z, selectorOffset); - break; - } - } - } - } - } - - private static void updateInputContainerPos(int x, int y, int z, int selectorOffset) { - if (x != Configs.Generic.INPUT_CONTAINER_X.getIntegerValue() - || (y - selectorOffset) != Configs.Generic.INPUT_CONTAINER_Y.getIntegerValue() - || z != Configs.Generic.INPUT_CONTAINER_Z.getIntegerValue()) { - Configs.Generic.INPUT_CONTAINER_X.setIntegerValue(x); - Configs.Generic.INPUT_CONTAINER_Y.setIntegerValue(y - selectorOffset); - Configs.Generic.INPUT_CONTAINER_Z.setIntegerValue(z); - InfoUtils.showGuiOrInGameMessage(MessageType.INFO, - "autotrade.message.input_container_set", x, y - selectorOffset, z); - } - } - - private static void updateOutputContainerPos(int x, int y, int z, int selectorOffset) { - if (x != Configs.Generic.OUTPUT_CONTAINER_X.getIntegerValue() - || (y - selectorOffset) != Configs.Generic.OUTPUT_CONTAINER_Y.getIntegerValue() - || z != Configs.Generic.OUTPUT_CONTAINER_Z.getIntegerValue()) { - Configs.Generic.OUTPUT_CONTAINER_X.setIntegerValue(x); - Configs.Generic.OUTPUT_CONTAINER_Y.setIntegerValue(y - selectorOffset); - Configs.Generic.OUTPUT_CONTAINER_Z.setIntegerValue(z); - InfoUtils.showGuiOrInGameMessage(MessageType.INFO, - "autotrade.message.output_container_set", x, y - selectorOffset, z); - } - } - static void tickItemFrameSelection(Minecraft mc) { if (!Configs.Generic.ITEM_FRAME.getBooleanValue()) return; Vec3 pm = new Vec3(mc.player.getX(), mc.player.getY(), mc.player.getZ());