diff --git a/src/main/java/com/github/sebseb7/autotrade/InitHandler.java b/src/main/java/com/github/sebseb7/autotrade/InitHandler.java index 7421f26..f1486e8 100644 --- a/src/main/java/com/github/sebseb7/autotrade/InitHandler.java +++ b/src/main/java/com/github/sebseb7/autotrade/InitHandler.java @@ -5,7 +5,6 @@ import com.github.sebseb7.autotrade.event.InputHandler; import com.github.sebseb7.autotrade.event.KeybindCallbacks; import com.github.sebseb7.autotrade.gui.MerchantScreenButtonInjector; import com.github.sebseb7.autotrade.render.TraderHighlightRenderer; -import com.github.sebseb7.autotrade.render.VillagerTradeOverlayRenderer; import fi.dy.masa.malilib.config.ConfigManager; import fi.dy.masa.malilib.config.options.ConfigString; import fi.dy.masa.malilib.event.InputEventHandler; @@ -31,7 +30,6 @@ public class InitHandler implements IInitializationHandler { ConfigManager.getInstance().registerConfigHandler(Reference.MOD_ID, new Configs()); TraderHighlightRenderer.register(); - VillagerTradeOverlayRenderer.register(); MerchantScreenButtonInjector.register(); InputHandler handler = new InputHandler(); 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 d064e52..222e3b8 100644 --- a/src/main/java/com/github/sebseb7/autotrade/config/Configs.java +++ b/src/main/java/com/github/sebseb7/autotrade/config/Configs.java @@ -60,8 +60,7 @@ public class Configs implements IConfigHandler { "true: Start the delay after the villager was unloaded; false: Start the delay after the trade has been initiated"); public static final ConfigInteger CONTAINER_CLOSE_DELAY = new ConfigInteger("containerCloseDelay", 0, 0, 30000000, "delay in ticks; to get signal from trapped chest"); - public static final ConfigBoolean SHOW_TRADES = new ConfigBoolean("showTrades", true, - "Display villager/wandering-trader trades above their heads (requires trading with them once to cache the offers)"); + 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)"); @@ -69,7 +68,7 @@ public class Configs implements IConfigHandler { 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); + SELECTED_ENCHANTMENTS); } public static void loadFromFile() { diff --git a/src/main/java/com/github/sebseb7/autotrade/render/VillagerTradeCache.java b/src/main/java/com/github/sebseb7/autotrade/render/VillagerTradeCache.java index d00af27..adca51c 100644 --- a/src/main/java/com/github/sebseb7/autotrade/render/VillagerTradeCache.java +++ b/src/main/java/com/github/sebseb7/autotrade/render/VillagerTradeCache.java @@ -11,8 +11,7 @@ import net.minecraft.world.item.trading.MerchantOffers; * *
* Populated by {@code AutoTradeClientTick} when the mod opens a merchant
- * screen; consumed by {@link VillagerTradeOverlayRenderer} to draw trade labels
- * above each villager's head.
+ * screen.
*/
public final class VillagerTradeCache {
private static final Map
- * Trade data comes from {@link VillagerTradeCache}, which is populated when the
- * mod opens a merchant screen. Villagers whose trades haven't been seen yet
- * show nothing.
- */
-public final class VillagerTradeOverlayRenderer {
-
- /** World-space scale of the text (vanilla name-tags use ~0.025). */
- private static final float TEXT_SCALE = 0.02F;
-
- /** Text background colour (semi-transparent dark). */
- private static final int BG_COLOR = 0x80000000;
-
- /** Normal trade text colour (white). */
- private static final int TEXT_COLOR = 0xFFFFFFFF;
-
- /** Depleted trade text colour (grey/red). */
- private static final int DEPLETED_COLOR = 0xFFFF6666;
-
- private VillagerTradeOverlayRenderer() {
- }
-
- public static void register() {
- //? if mc26 {
- LevelRenderEvents.COLLECT_SUBMITS.register(VillagerTradeOverlayRenderer::renderLevel);
- //?}
- }
-
- //? if mc26 {
- private static void renderLevel(LevelRenderContext context) {
- Minecraft mc = Minecraft.getInstance();
- if (mc.level == null || mc.player == null) {
- return;
- }
- if (!Configs.Generic.SHOW_TRADES.getBooleanValue()) {
- return;
- }
-
- Font font = mc.font;
- Vec3 camera = mc.gameRenderer.getMainCamera().position();
- float tickDelta = mc.getDeltaTracker().getGameTimeDeltaPartialTick(true);
-
- for (Entity entity : mc.level.entitiesForRendering()) {
- if (!(entity instanceof Villager) && !(entity instanceof WanderingTrader)) {
- continue;
- }
- if (entity.distanceToSqr(mc.player) > 64.0 * 64.0) {
- continue;
- }
-
- MerchantOffers offers = VillagerTradeCache.get(entity.getUUID());
- if (offers == null || offers.isEmpty()) {
- continue;
- }
-
- List