diff --git a/FORK_RELEASE_26_3.md b/FORK_RELEASE_26_3.md new file mode 100644 index 0000000..3c6738f --- /dev/null +++ b/FORK_RELEASE_26_3.md @@ -0,0 +1,29 @@ +# Release instructions for the Absolute Order community fork + +**Proposed release:** `2.1.0-fork.1` for **Minecraft 26.3 / Fabric**. + +**Artifact filename:** `AbsoluteOrder-2.1.0-fork.1-fabric-mc26.3.jar`. + +**Mod ID:** `chestseparators` (unchanged from upstream). Install on both server and clients. Never put both original and forked Absolute Order JARs in a `mods` folder. + +**Source baseline:** working 26.2 fork after patches 0001–0016, preserved in `multiloader-26.2/`. First Fabric-only 26.3 port candidate in `multiloader-26.3/`. The upstream project remains credited and `LICENSE.txt` is unchanged. + +Build from `multiloader-26.3` with JDK 25: + +```bash +./gradlew :common:test :fabric:build --no-daemon +``` + +Check `fabric/build/libs/` for the **non-raw** Fabric 26.3 release JAR. Test on 26.3 client + dedicated server with a 54-slot Ender Chest mod before creating a Git tag or GitHub Release. + +Recommended release tag after verification: `v2.1.0-fork.1-mc26.3`. Release title: `Absolute Order 2.1.0-fork.1 — Fabric 26.3`. + +Recommended changelog: +- Protect player filters during automatic deposit and pull, with retained item quantities. +- Consolidate items into filtered main-inventory slots; preserve manually arranged hotbar items. +- Update manual/Shift-click routing to respect preferred filtered slots. +- Continuous retained-quantity slider with detents at stack-size marks. +- Reconcile deposit previews with simulated transfers. +- Synchronize Ender Chest filters, with size-aware compatibility for expanded inventories. + +The 26.3 port is **not compiled or gameplay-verified by the assistant**. Source changes here are only the initial migration; expect to resolve any 26.3-specific Minecraft API or mixin changes surfaced by Gradle/in-game testing. diff --git a/multiloader-26.2/FORK_NOTES.md b/multiloader-26.2/FORK_NOTES.md new file mode 100644 index 0000000..67c8715 --- /dev/null +++ b/multiloader-26.2/FORK_NOTES.md @@ -0,0 +1,107 @@ +# Absolute Order — local fork handoff (Minecraft 26.2 source) + +Baseline: user-supplied `Absolute-Order-Mod-main.zip`, module `multiloader-26.2`, upstream mod 2.0.0. The supplied archive contains NO 26.3 module. All historical Minecraft modules in the repository are untouched. The mod ID remains `chestseparators` so this fork replaces upstream, rather than running beside it. MIT license retained. + +## Changes + +1. Player inventory filters protect matching items during nearby Auto Deposit and open-container Push. With existing target `0` (displayed **Keep: All**), items in matching filtered slots never leave through these actions. A positive value retains that many of each item listed in the filter, across the group's slots (earlier slots have priority). Unfiltered stacks and unrelated items remain eligible. Client deposit/pull previews use corresponding quantity calculations. +2. The inventory-filter editor now has a compact drag/click slider with five stops, **All / 64 / 32 / 16 / 1** from left to right. **All** is distinct from **64**: All protects every matching item physically in filtered slots, whereas 64 protects at most 64 across each group/item. The `targetCount=0` legacy behavior and arbitrary saved values continue to load; moving the new slider selects one of the five stops. `SlotWhitelist.targetCount` codecs, undo/redo and clipboard copy preserve the value. Filtered Pull respects positive amounts; Shift-Pull deliberately retains upstream's override behavior, pulling all that fits. +3. Pickup slot preference is now scoped to `ItemEntity.playerTouch`; inventory actions such as closing a screen with cursor items no longer run pickup-filter routing. Existing `lockHotbarOnReorder` setting is left untouched. +4. Ender Chest filters remain saved in the client's `ender_chest.dat`, but are synchronized to the player's live server-side Ender Chest inventory on opening and editing. The server validates entries against its *actual container size* rather than assuming 27 or 54. Shift-click enforcement uses upstream's existing `IWhitelistProvider` mixins. Modded 54-slot compatibility still requires gameplay verification. +5. Refill of filtered player **main inventory** (raw slots 9..35) now merges matching unfiltered main-inventory stacks into existing home stacks, then fills empty home slots in filter item priority. It does not take from the hotbar (0..8), offhand, armor, or *any* filtered source slot; it never replaces a nonmatching item already occupying a home slot. The server runs this after a filtered-source -> unfiltered-main manual placement, after ground pickups, and before nearby Auto Deposit. The open-container Push action performs the same consolidation using normal synchronized inventory clicks before computing deposit allowances. A filtered 1 + adjacent unfiltered 64 becomes filtered 64 + unfiltered 1 before deposit; Keep: 1 still ultimately protects 1 across the group. In a chest UI, manual moves from an **unfiltered source** to an unfiltered destination do not proactively refill until Push or a subsequent ground pickup; manual moves **out of a filtered main slot** do trigger refill on the server. + +Known limitation: the **hover preview** for Push is calculated from the current inventory layout, before its first-click consolidation. If you have pre-existing stray matching stacks in the main inventory, the hover preview might momentarily differ from the final result. The actual transfer uses the consolidated inventory. Recheck the preview after one Push or an inventory-slot move and report gameplay discrepancies. + +## Build (WSL/Linux, **JDK 25**, network required for Gradle dependencies) + +```bash +cd multiloader-26.2 +chmod +x gradlew +java -version +./gradlew :common:test :fabric:build --no-daemon +``` + +The publishable Fabric artifact is expected under `fabric/build/libs/` with a name like `AbsoluteOrder-2.0.0-fork.1-fabric-mc26.2.jar`. Replace the old mod JAR; do NOT run both together. Install the fork on **both** the Fabric client and dedicated server for filter synchronization. This is *not* a Minecraft 26.3 build. + +## Current verification + +- `git diff --check`: passed locally. +- Pure Java quantity-policy checks (11 scenarios) and dedicated retention-slider stop checks: passed using available JDK 21. +- Filter-refill logic compiled against isolated Minecraft API stubs using JDK 21; 8 standalone scenarios passed (stack fill, empty home, hotbar isolation, protected sources, item/component compatibility, priority). This is **not** a real mod compile. +- Full Gradle/compile/tests: **not run successfully**. The execution environment has Java 21, not Java 25, and could not download the Gradle 9.4.0 wrapper distribution (`UnknownHostException: services.gradle.org`). +- Minecraft singleplayer/multiplayer and Ender Chest 54-slot compatibility: **not tested**. + +## Manual test matrix (back up client configs and the world first) + +1. Filter arrows in hotbar, Keep: All. Carry 64. Auto Deposit next to a filtered chest; none of those 64 may leave. +2. Change Keep to 1. Carry 64 arrows in the filtered slot; Auto Deposit must move at most 63 and leave 1. Repeat with Push from an open filtered chest, and compare preview to result. +3. Place extra arrows in an unfiltered slot; automatic deposit should move those freely, retaining the 1 arrow in the filtered slot. Test two slots in one filter group, testing total retention across the group. +4. Pull from a chest with an arrow filter, Keep: 1: it should pull only 1 when none is held and 0 afterward. Shift-Pull explicitly ignores the cap as before. Confirm the preview matches each case. +5. Manually place spruce logs in the hotbar and close/reopen inventory. No filter-driven relocation should occur. New logs picked up from the ground should still prefer dedicated empty slots. Test stacks and empty slots. +6. Ender Chest 27 slots: configure filters, close/reopen, shift-click into matching slots, verify wrong items are refused as configured. Repeat against your **actual 54-slot Ender Chest mod**, with filters above slot 27, after logout/reconnect, and after server restart. Repeat after changing filters, and try both directions. +7. Validate an unrelated chest and vanilla shift-click behavior, plus all applicable 3 filter-rule toggles. Verify the server and client are both running the fork, not a mixture of fork and upstream JARs. + +**Rollback:** keep the old mod JAR and a copy of `config/chestseparators/` on the client, plus a server world backup. Do not deploy the 26.2 artifact onto Minecraft 26.3. For a proper 26.3 port, obtain the exact corresponding upstream 26.3 source module first; do not just change `minecraft_version` in `gradle.properties`. + +## Follow-up fork revision (additional commits 0008–0009) + +- `fix(inventory): refill filtered main slots before deposits` — adds server-side movement recovery, ground-pickup consolidation, nearby Auto Deposit pre-pass, and client-synchronized open-container Push pre-pass. +- `feat(filters): replace quantity button with retention slider` — five-step click/drag quantity control (All, 64, 32, 16, 1) with safe preservation of older custom quantities and unit tests. +- These patches apply **after** the first seven fork patches. They are not a port to Minecraft 26.3. +- Multiplayer Ender Chest sync (earlier test #6), 54-slot Ender Chest compatibility, and the new manual-click integration still require in-game verification. Keep production server 26.3 untouched. + +## Corrective revision after 0010 — inventory priority, Push preview, continuous Keep slider + +1. Client inventory-filter state is now populated alongside the C2S sync so predicted inventory + clicks and the server's menu clicks use identical filter maps. The inventory menu intercepts + shift-clicks from unfiltered main slots and refills dedicated main slots first; filtered-origin + cursor placements into unfiltered main slots trigger refill even with an unfinished cursor stack. + Manually placed hotbar items are never sources for that refill. +2. Refill uses one shared copied-stack implementation on both gameplay inventories and the Push + preview. The preview simulates refill, exact per-group Keep quantities, the same four container + deposit passes, and the post-Push sort, then displays the final predicted stacks for every + changed slot. It doesn't mutate inventory while the player hovers the button. +3. Keep slider now permits integer values 1–64, with marked reference values All, 64, 32, 16, 1 + from left to right. Wheel over the slider adjusts by one for precise selection. All is still + the separate saved value 0; previously saved larger values are preserved until manually edited. +4. Headless Java checks passed for Keep slider mapping and for inventory slot refill using Minecraft + stub objects (1 + 64 -> 64 + 1, Keep 1 -> 63 + 1 movable, hotbar untouched, snapshot unchanged). + These are NOT Gradle tests or proof of a successful full mod build. Java 25 compilation and in-game + testing (including expanded Ender Chests and dedicated multiplayer synchronization) remain required. + +Suggested regression: a filtered slot with 1 Ender Chest plus an unfiltered main slot with 64 +should preview AND actually deposit 64 with Keep: 1, leaving 1 in the filtered slot. Check +manually moving half/full stacks out and a shift-click from an unfiltered main slot; verify +hotbar behavior remains intentional, and compare Push hover with the final chest/inventory. + +## Follow-up: hotbar shift-click priority and magnetic Keep slider (patches 0014–0015) + +- Explicitly **Shift-clicking FROM the hotbar** in the vanilla player inventory screen now tries matching filtered **main** inventory slots before any unrelated main slot. It finishes existing identical home stacks first, then uses empty home slots, honoring group priorities. If the home stack is 1 and the hotbar has 64 identical items, the home becomes 64 and the remaining 1 stays in the hotbar *for that click*; it will not immediately spill into an unfiltered main slot. If all matching home slots are full, vanilla shift-click behavior is unchanged. This is intentionally different from a normal manual click placing items **INTO** the hotbar, which continues to be allowed. Both logical sides execute the same quick-move path for client prediction/server authority. +- Keep quantities still support **every integer 1–64** and the separate `All` setting. While dragging, 16/32/64 engage a 2-pixel magnetic zone and hold until the mouse is more than 4 pixels away (the widget's own GUI coordinate system). Mouse wheel still changes by exactly one. The saved value format is unchanged. +- Source review and standalone Java 21 slider mapping/detent tests passed. Full Gradle compilation with JDK 25, integration gameplay, and dedicated-server filter synchronization have **not** been verified in this environment. The target remains Minecraft **26.2**. + +Quick in-game regressions: (1) home slot has 1 Ender Chest, hotbar has 64: Shift-click hotbar stack; home fills to 64 and 1 stays in hotbar; (2) home slot empty, hotbar has 64: all 64 move to home; (3) home slot already full: vanilla may shift extra items into unfiltered main slots; (4) ordinary click to put items into hotbar stays intact; (5) slider detents 16/32/64 hold briefly, while dragging still selects other values and wheel fine-adjusts; (6) verify identical results on the two sides of a dedicated-server connection. + +## Inventory reconciliation after all player-menu clicks (patch 0016) + +- Previously, the player-inventory refill hook only recognized a PICKUP that originated in a + filtered main slot, followed by a PICKUP placement into an unfiltered main slot. Shift-clicks, + swaps, quick crafting, or moving stacks that already sat in unfiltered slots could bypass it. + A later unrelated manual click sometimes repaired the scattered stacks by accident. +- The player inventory menu now runs the existing, shared refill policy after **every completed + menu click** (on both client and server). This includes all normally processed click types and + early-return paths; an immediate second click is no longer required to reconcile filtered slots. +- It deliberately runs only for `InventoryMenu`: chest/container Push's synthetic click sequence + runs on a different menu and retains its own pre-deposit consolidation. The refill still only + pulls from **unfiltered main-inventory slots 9–35**. Hotbar 0–8, equipment, offhand, and other + filtered slots are not sources; manually arranged hotbar items remain exempt. When all filtered + slots for an item reach capacity, extra stacks in unfiltered slots are expected and permissible. +- Build remains **Minecraft 26.2 / JDK 25**. In this environment the changed mixin was compiled + against isolated API stubs with JDK 21 and the patch was tested against the v4 source, but + a real Gradle build and singleplayer/multiplayer gameplay tests have NOT been performed. + +Regression focus: place 1 Ender Chest in a filtered main slot and 64 in an unfiltered main slot. +Try normal click, Shift-click, swap/number-key, right-click split, quick crafting/drag, and a +click outside the inventory. The filtered slot should promptly fill to 64 (leaving 1 outside) +whenever those actions finish. Then move a stack deliberately into the hotbar and verify it is +not automatically taken back. Test the Push preview/result and container deposit afterward. diff --git a/multiloader-26.2/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/ChestSeparatorsEditor.java b/multiloader-26.2/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/ChestSeparatorsEditor.java index f20ce9a..88cde8e 100644 --- a/multiloader-26.2/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/ChestSeparatorsEditor.java +++ b/multiloader-26.2/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/ChestSeparatorsEditor.java @@ -149,6 +149,13 @@ public void init() { ChestConfigManager.getInstance().loadWorldPalette(); loadConfigForCurrentTarget(); + // Ender Chest filters are stored on this client, but shift-click is server-side. Attach + // them to the live GUI container and send them to the server whenever it opens, including + // after relog; dynamically sized inventories need no fixed 27/54-slot assumptions. + if (session.isEnderChest) { + syncClientInventoryWhitelists(ChestConfigManager.getInstance().chestOnlyWhitelists()); + sendWhitelistToServer(); + } requestChestWhitelistsIfNeeded(); int x = accessor.getX(); @@ -718,6 +725,7 @@ public void startCreatingGroup(Slot initialSlot) { public void prepareFilterMenu() { session.currentAllowedItems.clear(); + session.targetCount = 0; // The third rule is context-dependent: "Hopper" for a chest filter, "Pick Up" for an inventory // filter (they share the ruleHopper flag). Seed its default from the matching config option so an // inventory group defaults to the Pick Up default and a chest group to the Hopper default. @@ -759,6 +767,7 @@ public void prepareFilterMenu() { session.ruleManual = entry.getValue().allowManual(); session.ruleShift = entry.getValue().allowShift(); session.ruleHopper = entry.getValue().allowHopper(); + session.targetCount = Math.max(0, entry.getValue().targetCount()); loadedRules = true; } } @@ -788,7 +797,7 @@ public void saveCurrentGroup() { session.ruleManual, session.ruleShift, session.ruleHopper, - 0); + session.targetCount); whitelists.put(slotIndex, wl); } ChestConfigManager.getInstance().setCurrentWhitelists(whitelists); @@ -818,12 +827,12 @@ public void deleteCurrentGroup() { /** * Pushes the container's own filters to the server. Self-guarding: it only sends for targets the - * server can actually enforce and persist — real block chests/shulkers, and chest/hopper minecarts - * (synced by entity UUID). Ender chests, the player inventory, and other entity containers (chest - * boats, animals) stay local-only and are skipped here. + * server can actually enforce — real block chests/shulkers, chest/hopper minecarts, and the + * player's private Ender Chest inventory. Ender filters remain client-persisted; the server + * receives only a temporary copy for shift-click enforcement. */ public void sendWhitelistToServer() { - if (session.isEnderChest || session.isPlayerInventory) return; + if (session.isPlayerInventory) return; var chestOnly = io.github.marcsanzdev.chestseparators.data.ChestConfigManager.getInstance() .chestOnlyWhitelists(); @@ -1384,6 +1393,72 @@ public void syncClientInventoryWhitelists(Map whitelists } } + /** + * Place loose main-inventory stacks into matching home slots before the open-container Push + * click sequence. Using real container clicks (rather than editing predicted client stacks) + * keeps the client and server inventories synchronized. The server's inventory-menu refill + * hook does not run in this container, so it cannot interrupt these clicks halfway through. + * Never source items from the hotbar, armor, offhand, or other filtered slots. + */ + private void consolidatePlayerBeforeDeposit( + Map filters, + net.minecraft.client.multiplayer.MultiPlayerGameMode gameMode, + net.minecraft.world.entity.player.Player player, int menuId) { + if (filters == null || filters.isEmpty()) return; + Map mainSlots = new java.util.TreeMap<>(); + for (net.minecraft.world.inventory.Slot slot : accessor.getHandler().slots) { + if (slot.container instanceof net.minecraft.world.entity.player.Inventory + && slot.getContainerSlot() >= 9 + && slot.getContainerSlot() < net.minecraft.world.entity.player.Inventory.INVENTORY_SIZE) { + mainSlots.put(slot.getContainerSlot(), slot); + } + } + // Fill partial matching stacks first; empty homes in a second pass. + for (int pass = 0; pass < 2; pass++) { + for (Map.Entry homeEntry : mainSlots.entrySet()) { + net.minecraft.world.inventory.Slot home = homeEntry.getValue(); + var filter = filters.get(homeEntry.getKey()); + if (filter == null || filter.allowedItems().isEmpty()) continue; + net.minecraft.world.item.ItemStack stack = home.getItem(); + if (pass == 0 && (stack.isEmpty() || !filter.allowedItems().contains( + net.minecraft.core.registries.BuiltInRegistries.ITEM.getKey(stack.getItem()).toString()))) { + continue; + } + if (pass == 1 && !stack.isEmpty()) continue; + + // When the home is empty, try the filter's allowed items in the configured order. + List preferred = stack.isEmpty() ? filter.allowedItems() : + List.of(net.minecraft.core.registries.BuiltInRegistries.ITEM.getKey(stack.getItem()).toString()); + for (String itemId : preferred) { + for (Map.Entry sourceEntry : mainSlots.entrySet()) { + if (filters.containsKey(sourceEntry.getKey()) || sourceEntry.getKey().equals(homeEntry.getKey())) continue; + net.minecraft.world.inventory.Slot source = sourceEntry.getValue(); + net.minecraft.world.item.ItemStack extra = source.getItem(); + if (extra.isEmpty() || !net.minecraft.core.registries.BuiltInRegistries.ITEM + .getKey(extra.getItem()).toString().equals(itemId)) continue; + net.minecraft.world.item.ItemStack current = home.getItem(); + if (!current.isEmpty() + && !net.minecraft.world.item.ItemStack.isSameItemSameComponents(current, extra)) continue; + int maximum = Math.min(extra.getMaxStackSize(), home.getMaxStackSize(extra)); + if (current.getCount() >= maximum) break; + // Pickup source, merge into home, then return any leftover to the source. + gameMode.handleContainerInput(menuId, source.index, 0, + net.minecraft.world.inventory.ContainerInput.PICKUP, player); + gameMode.handleContainerInput(menuId, home.index, 0, + net.minecraft.world.inventory.ContainerInput.PICKUP, player); + if (!accessor.getHandler().getCarried().isEmpty()) { + gameMode.handleContainerInput(menuId, source.index, 0, + net.minecraft.world.inventory.ContainerInput.PICKUP, player); + } + if (accessor.getHandler().getCarried().isEmpty() && home.hasItem() + && home.getItem().getCount() >= maximum) break; + } + if (home.hasItem()) break; + } + } + } + } + public void executeDeposit(boolean shift) { if (accessor.getHandler() == null || net.minecraft.client.Minecraft.getInstance().player == null) return; if (!accessor.getHandler().getCarried().isEmpty()) return; @@ -1394,12 +1469,22 @@ public void executeDeposit(boolean shift) { net.minecraft.client.Minecraft.getInstance().gameMode; int syncId = accessor.getHandler().containerId; net.minecraft.world.entity.player.Player player = net.minecraft.client.Minecraft.getInstance().player; + var playerFilters = io.github.marcsanzdev.chestseparators.data.ChestConfigManager.getInstance() + .getPlayerInventoryFilters(); + + // Refill dedicated main-inventory stacks BEFORE determining per-slot deposit allowances. + // The subsequent Keep limit still protects the selected number of items overall. + consolidatePlayerBeforeDeposit(playerFilters, interactionManager, player, syncId); int totalMovedCount = 0; for (net.minecraft.world.inventory.Slot playerSlot : accessor.getHandler().slots) { if (playerSlot.container instanceof net.minecraft.world.entity.player.Inventory && playerSlot.hasItem()) { - net.minecraft.world.item.ItemStack stackToMove = playerSlot.getItem().copy(); + int movable = io.github.marcsanzdev.chestseparators.util.InventoryProtection + .movableCount(player.getInventory(), playerFilters, playerSlot.getContainerSlot()); + if (movable <= 0) continue; + int reserved = playerSlot.getItem().getCount() - movable; + net.minecraft.world.item.ItemStack stackToMove = playerSlot.getItem().copyWithCount(movable); String itemId = net.minecraft.core.registries.BuiltInRegistries.ITEM .getKey(stackToMove.getItem()) .toString(); @@ -1436,6 +1521,14 @@ public void executeDeposit(boolean shift) { net.minecraft.world.inventory.ContainerInput.PICKUP, player); pickedUp = true; + // Leave the protected part in its original slot BEFORE depositing. + // Right-click on the emptied source places one item per click, allowing + // an exact retained count without adding a new server packet. + for (int keep = 0; keep < reserved; keep++) { + interactionManager.handleContainerInput( + syncId, playerSlot.index, 1, + net.minecraft.world.inventory.ContainerInput.PICKUP, player); + } } interactionManager.handleContainerInput( syncId, targetSlot.index, 0, net.minecraft.world.inventory.ContainerInput.PICKUP, player); @@ -1683,6 +1776,9 @@ private int placeIntoPlayerPreview( int canAdd = maxC - current; if (canAdd <= 0) continue; int add = Math.min(left, canAdd); + if (!shift) add = Math.min(add, + previewInboundRoom(playerSlots, invFilters, ps.getContainerSlot(), itemId)); + if (add <= 0) continue; if (proj == null) previewTargetIncoming.put(ps.index, stack.copyWithCount(add)); else proj.setCount(proj.getCount() + add); left -= add; @@ -1707,6 +1803,8 @@ private int placeIntoPlayerPreview( for (net.minecraft.world.inventory.Slot ps : emptyFiltered) { if (left <= 0) break; int add = Math.min(left, maxC); + add = Math.min(add, previewInboundRoom(playerSlots, invFilters, ps.getContainerSlot(), itemId)); + if (add <= 0) continue; previewTargetIncoming.put(ps.index, stack.copyWithCount(add)); left -= add; } @@ -1724,6 +1822,31 @@ private int placeIntoPlayerPreview( return amount - left; } + /** Client-side mirror of ModNetworking.availableInboundRoom (includes projected incoming items). */ + private int previewInboundRoom( + java.util.List playerSlots, + java.util.Map filters, + int destIndex, String itemId) { + if (filters == null) return Integer.MAX_VALUE; + var filter = filters.get(destIndex); + if (filter == null || filter.targetCount() <= 0 || filter.groupId() == null) return Integer.MAX_VALUE; + + int held = 0; + for (net.minecraft.world.inventory.Slot s : playerSlots) { + var otherFilter = filters.get(s.getContainerSlot()); + if (otherFilter == null || !filter.groupId().equals(otherFilter.groupId()) + || !otherFilter.allowedItems().contains(itemId)) continue; + var existing = s.getItem(); + if (!existing.isEmpty() && net.minecraft.core.registries.BuiltInRegistries.ITEM + .getKey(existing.getItem()).toString().equals(itemId)) held += existing.getCount(); + var pending = previewTargetIncoming.get(s.index); + if (pending != null && !pending.isEmpty() && net.minecraft.core.registries.BuiltInRegistries.ITEM + .getKey(pending.getItem()).toString().equals(itemId)) held += pending.getCount(); + } + return io.github.marcsanzdev.chestseparators.util.InventoryTransferPolicy + .inboundRoom(filter.targetCount(), held); + } + /** Mirror of PlayerInventoryFilterMixin#getEmptySlot: preferred filtered empty slot, else first unreserved. */ private net.minecraft.world.inventory.Slot findPreviewEmptySlot( java.util.List playerSlots, @@ -1784,122 +1907,157 @@ public boolean isPreviewSlot(net.minecraft.world.inventory.Slot slot) { return previewSourceRemaining.containsKey(slot.index) || previewTargetIncoming.containsKey(slot.index); } + /** + * Predicts the complete Push action, starting with the SAME main-inventory refill that Push performs. + * Every projected slot is a full final stack (including newly filled player slots), not an incoming + * delta. No real inventory or menu contents are changed when the player merely hovers the button. + */ public void updateDepositPreview(boolean shift) { previewSourceRemaining.clear(); previewTargetIncoming.clear(); - if (accessor.getHandler() == null || net.minecraft.client.Minecraft.getInstance().player == null) return; + if (!accessor.getHandler().getCarried().isEmpty()) return; // Push refuses a nonempty cursor + + var player = net.minecraft.client.Minecraft.getInstance().player; + var inventory = player.getInventory(); var whitelists = io.github.marcsanzdev.chestseparators.data.ChestConfigManager.getInstance() .getCurrentWhitelists(); + var invFilters = io.github.marcsanzdev.chestseparators.data.ChestConfigManager.getInstance() + .getPlayerInventoryFilters(); - for (net.minecraft.world.inventory.Slot playerSlot : accessor.getHandler().slots) { - if (playerSlot.container instanceof net.minecraft.world.entity.player.Inventory && playerSlot.hasItem()) { - net.minecraft.world.item.ItemStack pristineStack = playerSlot.getItem(); - String itemId = net.minecraft.core.registries.BuiltInRegistries.ITEM - .getKey(pristineStack.getItem()) - .toString(); - - int remaining = pristineStack.getCount(); - int initialCount = remaining; - - // 4-pass priority system mirrors the logic in executeDeposit. - remaining = simulateDepositPass(whitelists, pristineStack, itemId, remaining, true, false); - - if (remaining > 0) - remaining = simulateDepositPass(whitelists, pristineStack, itemId, remaining, false, false); - - if (remaining > 0 && shift) - remaining = simulateDepositPass(whitelists, pristineStack, itemId, remaining, true, true); - - if (remaining > 0 && shift) - remaining = simulateDepositPass(whitelists, pristineStack, itemId, remaining, false, true); - - if (remaining < initialCount) { - previewSourceRemaining.put(playerSlot.index, remaining); - } - } + java.util.List predicted = new java.util.ArrayList<>(); + for (int raw = 0; raw < inventory.getContainerSize(); raw++) { + predicted.add(inventory.getItem(raw).copy()); } + io.github.marcsanzdev.chestseparators.util.InventorySlotRefill.refillStacks( + predicted, invFilters, inventory::getMaxStackSize); - // Mirror the server's post-push per-group priority re-sort so the ghost preview lands items in the - // exact slots the real deposit will after it re-organizes the chest. java.util.List chestSlots = new java.util.ArrayList<>(); - for (net.minecraft.world.inventory.Slot s : accessor.getHandler().slots) { - if (!(s.container instanceof net.minecraft.world.entity.player.Inventory)) chestSlots.add(s); + java.util.Map chestState = new java.util.HashMap<>(); + for (net.minecraft.world.inventory.Slot slot : accessor.getHandler().slots) { + if (!(slot.container instanceof net.minecraft.world.entity.player.Inventory)) { + chestSlots.add(slot); + chestState.put(slot.index, slot.getItem().copy()); + } } - applyPreviewReorder(chestSlots, whitelists, net.minecraft.world.inventory.Slot::getContainerSlot); - } - private int simulateDepositPass( - Map whitelists, - net.minecraft.world.item.ItemStack stack, - String itemId, - int count, - boolean checkExisting, - boolean unfilteredOnly) { - // Empty filtered slots are visited in the filter's order, exactly as executeDeposit fills them, so - // the ghost preview lands items in the same slots the real deposit will. - List orderedSlots = new ArrayList<>(); - for (net.minecraft.world.inventory.Slot chestSlot : accessor.getHandler().slots) { - if (chestSlot.container instanceof net.minecraft.world.entity.player.Inventory) continue; - orderedSlots.add(chestSlot); - } - if (!checkExisting && !unfilteredOnly) { - orderedSlots.sort(java.util.Comparator.comparingInt( - s -> io.github.marcsanzdev.chestseparators.util.FilterPriority.slotPreference( - whitelists, s.getContainerSlot(), itemId))); + boolean depositedAnything = false; + for (net.minecraft.world.inventory.Slot slot : accessor.getHandler().slots) { + if (!(slot.container instanceof net.minecraft.world.entity.player.Inventory)) continue; + int raw = slot.getContainerSlot(); + if (raw < 0 || raw >= predicted.size()) continue; + net.minecraft.world.item.ItemStack stack = predicted.get(raw); + if (stack.isEmpty()) continue; + int movable = io.github.marcsanzdev.chestseparators.util.InventoryProtection + .movableCount(predicted, invFilters, raw); + if (movable <= 0) continue; + String itemId = net.minecraft.core.registries.BuiltInRegistries.ITEM.getKey(stack.getItem()).toString(); + int left = movable; + left = simulateDepositPass(chestSlots, chestState, whitelists, stack, itemId, left, true, false); + left = simulateDepositPass(chestSlots, chestState, whitelists, stack, itemId, left, false, false); + if (shift) { + left = simulateDepositPass(chestSlots, chestState, whitelists, stack, itemId, left, true, true); + left = simulateDepositPass(chestSlots, chestState, whitelists, stack, itemId, left, false, true); + } + int moved = movable - left; + if (moved > 0) { + depositedAnything = true; + int count = stack.getCount() - moved; + predicted.set(raw, count == 0 ? net.minecraft.world.item.ItemStack.EMPTY : stack.copyWithCount(count)); + } } - for (net.minecraft.world.inventory.Slot chestSlot : orderedSlots) { - if (count <= 0) break; + // The real Push requests post-deposit reordering only when it transferred something. + if (depositedAnything) reorderProjectedChest(chestSlots, chestState, whitelists); - boolean hasFilter = whitelists != null && whitelists.containsKey(chestSlot.getContainerSlot()); - boolean matchesFilter = hasFilter - && whitelists.get(chestSlot.getContainerSlot()).allowedItems().contains(itemId); - - if (unfilteredOnly) { - if (hasFilter) continue; + for (net.minecraft.world.inventory.Slot slot : accessor.getHandler().slots) { + net.minecraft.world.item.ItemStack finalStack; + if (slot.container instanceof net.minecraft.world.entity.player.Inventory) { + int raw = slot.getContainerSlot(); + if (raw < 0 || raw >= predicted.size()) continue; + finalStack = predicted.get(raw); } else { - if (!matchesFilter) continue; + finalStack = chestState.get(slot.index); } - - // If a slot already has a virtual preview stack, only continue if the incoming item type matches. - net.minecraft.world.item.ItemStack incoming = previewTargetIncoming.get(chestSlot.index); - if (incoming != null) { - if (!net.minecraft.world.item.ItemStack.isSameItem(stack, incoming) - || !net.minecraft.world.item.ItemStack.isSameItemSameComponents(stack, incoming)) { - continue; - } + net.minecraft.world.item.ItemStack actual = slot.getItem(); + if (actual.getCount() != finalStack.getCount() + || !net.minecraft.world.item.ItemStack.isSameItemSameComponents(actual, finalStack)) { + previewTargetIncoming.put(slot.index, finalStack.copy()); } + } + } + /** Reproduces collectTargetSlots' four passes against predicted, mutable chest contents. */ + private int simulateDepositPass( + java.util.List chestSlots, + java.util.Map state, + Map whitelists, + net.minecraft.world.item.ItemStack source, + String itemId, int remaining, boolean checkExisting, boolean unfilteredOnly) { + if (remaining <= 0) return remaining; + java.util.List candidates = new java.util.ArrayList<>(); + for (net.minecraft.world.inventory.Slot slot : chestSlots) { + var filter = whitelists == null ? null : whitelists.get(slot.getContainerSlot()); + if (unfilteredOnly ? filter != null : filter == null || !filter.allowedItems().contains(itemId)) continue; + net.minecraft.world.item.ItemStack existing = state.get(slot.index); if (checkExisting) { - if (!chestSlot.hasItem()) continue; - if (!net.minecraft.world.item.ItemStack.isSameItem(stack, chestSlot.getItem()) - || !net.minecraft.world.item.ItemStack.isSameItemSameComponents(stack, chestSlot.getItem())) - continue; - } else { - if (chestSlot.hasItem()) continue; + if (existing.isEmpty() || !net.minecraft.world.item.ItemStack.isSameItemSameComponents(existing, source) + || existing.getCount() >= source.getMaxStackSize()) continue; + } else if (!existing.isEmpty()) { + continue; } - - int currentInChest = chestSlot.hasItem() ? chestSlot.getItem().getCount() : 0; - if (incoming != null) { - currentInChest += incoming.getCount(); + candidates.add(slot); + } + if (!checkExisting && !unfilteredOnly) { + candidates.sort(java.util.Comparator.comparingInt(slot -> + io.github.marcsanzdev.chestseparators.util.FilterPriority.slotPreference( + whitelists, slot.getContainerSlot(), itemId))); + } + for (net.minecraft.world.inventory.Slot slot : candidates) { + if (remaining <= 0) break; + net.minecraft.world.item.ItemStack existing = state.get(slot.index); + int room = source.getMaxStackSize() - existing.getCount(); + if (room <= 0) continue; + int moved = Math.min(room, remaining); + if (existing.isEmpty()) state.put(slot.index, source.copyWithCount(moved)); + else existing.grow(moved); + remaining -= moved; + } + return remaining; + } + + /** Final virtual re-sort equivalent to the real container group's post-Push packing. */ + private void reorderProjectedChest( + java.util.List chestSlots, + java.util.Map state, + Map whitelists) { + if (whitelists == null || whitelists.isEmpty()) return; + java.util.Map> groups = + new java.util.LinkedHashMap<>(); + for (var slot : chestSlots) { + var wl = whitelists.get(slot.getContainerSlot()); + if (wl == null || wl.groupId() == null) continue; + groups.computeIfAbsent(wl.groupId(), ignored -> new java.util.ArrayList<>()).add(slot); + } + for (var group : groups.values()) { + if (group.size() < 2) continue; + group.sort(java.util.Comparator.comparingInt(net.minecraft.world.inventory.Slot::getContainerSlot)); + java.util.List priority = whitelists.get(group.get(0).getContainerSlot()).allowedItems(); + java.util.List stored = new java.util.ArrayList<>(); + for (var slot : group) { + var item = state.get(slot.index); + if (!item.isEmpty()) stored.add(item.copy()); } - - int spaceLeft = stack.getMaxStackSize() - currentInChest; - if (spaceLeft > 0) { - int toMove = Math.min(spaceLeft, count); - count -= toMove; - - if (incoming == null) { - incoming = stack.copy(); - incoming.setCount(toMove); - } else { - incoming.grow(toMove); - } - previewTargetIncoming.put(chestSlot.index, incoming); + stored.sort(java.util.Comparator.comparingInt(item -> { + int order = priority.indexOf(net.minecraft.core.registries.BuiltInRegistries.ITEM + .getKey(item.getItem()).toString()); + return order < 0 ? Integer.MAX_VALUE : order; + }).thenComparing(java.util.Comparator.comparingInt( + net.minecraft.world.item.ItemStack::getCount).reversed())); + for (int i = 0; i < group.size(); i++) { + state.put(group.get(i).index, i < stored.size() ? stored.get(i) : net.minecraft.world.item.ItemStack.EMPTY); } } - return count; } /** diff --git a/multiloader-26.2/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/EditorInputHandler.java b/multiloader-26.2/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/EditorInputHandler.java index cfb5df5..3793b09 100644 --- a/multiloader-26.2/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/EditorInputHandler.java +++ b/multiloader-26.2/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/EditorInputHandler.java @@ -50,6 +50,7 @@ public EditorInputHandler( // "allow" boolean: true lets the vanilla handler run, false cancels it because the editor consumed it. public boolean onMouseReleased(double mouseX, double mouseY, int button) { + if (button == 0) editor.screenEditFilter.stopRetentionDrag(); session.isDraggingMainScroll = false; session.isDraggingListScroll = false; @@ -90,6 +91,7 @@ public boolean onMouseDragged(double mouseX, double mouseY, double deltaX, doubl } if (session.currentState == EditorState.EDIT_FILTER) { + if (editor.screenEditFilter.mouseDragged(mouseX, mouseY, 0, deltaX, deltaY)) return false; layout.update(screen, accessor, editor.getSidebarYOffset()); int mainX = layout.mainX; diff --git a/multiloader-26.2/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/EditorRenderer.java b/multiloader-26.2/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/EditorRenderer.java index f6f1c80..be14f93 100644 --- a/multiloader-26.2/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/EditorRenderer.java +++ b/multiloader-26.2/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/EditorRenderer.java @@ -451,10 +451,9 @@ void renderTransferPreviewOverlay(GuiGraphicsExtractor context, int mouseX, int return; } editor.isHoveringDeposit = true; - if (editor.depositPreviewShift != shift || editor.previewSourceRemaining.isEmpty()) { - editor.depositPreviewShift = shift; - editor.updateDepositPreview(shift); - } + // Push predicts the full post-refill state, so rebuild on hover as stacks change. + editor.depositPreviewShift = shift; + editor.updateDepositPreview(shift); renderDepositPreview(context); } else if (hoverFill) { editor.isHoveringDeposit = false; diff --git a/multiloader-26.2/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/EditorSessionData.java b/multiloader-26.2/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/EditorSessionData.java index 918cc03..c411021 100644 --- a/multiloader-26.2/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/EditorSessionData.java +++ b/multiloader-26.2/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/EditorSessionData.java @@ -34,6 +34,8 @@ public class EditorSessionData { public boolean ruleManual = true; public boolean ruleShift = true; public boolean ruleHopper = true; + /** Zero retains every matching stack; positive values retain this many per item in the group. */ + public int targetCount = 0; public List allGameItems = new ArrayList<>(); public List filteredItems = new ArrayList<>(); public List visibleLeftListItems = new ArrayList<>(); @@ -202,6 +204,7 @@ public class EditorSessionData { public boolean originalRuleManual = true; public boolean originalRuleShift = true; public boolean originalRuleHopper = true; + public int originalTargetCount = 0; // Inner class to hold tab data cleanly public static class CreativeTabInfo { diff --git a/multiloader-26.2/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/screens/ScreenEditFilter.java b/multiloader-26.2/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/screens/ScreenEditFilter.java index 656b6f1..e983dd6 100644 --- a/multiloader-26.2/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/screens/ScreenEditFilter.java +++ b/multiloader-26.2/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/screens/ScreenEditFilter.java @@ -33,6 +33,7 @@ public class ScreenEditFilter extends AbstractEditorScreen { private final FilterPanelRenderer panelRenderer; private final FilterClickHandler clickHandler; + private io.github.marcsanzdev.chestseparators.client.ui.widgets.InventoryRetentionSlider quantitySlider; public ScreenEditFilter(ChestSeparatorsEditor editor) { super(editor); @@ -45,6 +46,19 @@ public boolean mouseClicked(double mouseX, double mouseY, int button) { return clickHandler.onMouseClicked(mouseX, mouseY, button); } + @Override + public boolean mouseDragged(double mouseX, double mouseY, int button, double dragX, double dragY) { + return quantitySlider != null && quantitySlider.mouseDragged(mouseX, button); + } + + public void stopRetentionDrag() { + if (quantitySlider != null) quantitySlider.stopDrag(); + } + + private boolean scrollRetentionSlider(double mouseX, double mouseY, double verticalAmount) { + return quantitySlider != null && quantitySlider.mouseScrolled(mouseX, mouseY, verticalAmount); + } + @Override public void init() { super.init(); @@ -466,6 +480,7 @@ boolean hasUnsavedChanges() { if (session.originalRuleManual != session.ruleManual) return true; if (session.originalRuleShift != session.ruleShift) return true; if (session.originalRuleHopper != session.ruleHopper) return true; + if (session.originalTargetCount != session.targetCount) return true; // Order is part of the filter now (it can be rearranged by dragging and is saved), so compare the // lists as they are: reordering alone counts as an unsaved change. @@ -474,6 +489,7 @@ boolean hasUnsavedChanges() { @Override protected void buildWidgets() { + quantitySlider = null; int btnW = layout.btnW; int bH = layout.bH; int btnX = layout.rightX; @@ -664,6 +680,22 @@ protected void buildWidgets() { widgets.add(btnHopper); } + // Compact continuous slider with marked stack sizes. All (0) stays distinct from keeping 64. + if (invFilter) { + quantitySlider = new io.github.marcsanzdev.chestseparators.client.ui.widgets.InventoryRetentionSlider( + btnX, mainY + 154, btnW, 11, + () -> session.targetCount, + value -> { + if (session.targetCount != value) { + session.targetCount = value; + editor.playClickSound(1.0f); + } + }); + widgets.add(quantitySlider); + } else { + quantitySlider = null; + } + // Group 3 (Actions) — stacked full-width in visual order: Save, Delete, Cancel. ActionIconButtonWidget btnDelete = new ActionIconButtonWidget( btnX, @@ -1014,6 +1046,7 @@ private void handlePreviewLogic(int mouseX, int mouseY) { } public boolean mouseScrolled(double mouseX, double mouseY, double horizontalAmount, double verticalAmount) { + if (scrollRetentionSlider(mouseX, mouseY, verticalAmount)) return true; float scrollSpeed = 18f; // While previewing, the scroll wheel always controls the preview panel. diff --git a/multiloader-26.2/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/screens/ScreenViewGroups.java b/multiloader-26.2/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/screens/ScreenViewGroups.java index ebcaeb3..1d35d9b 100644 --- a/multiloader-26.2/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/screens/ScreenViewGroups.java +++ b/multiloader-26.2/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/screens/ScreenViewGroups.java @@ -560,6 +560,7 @@ void transitionToEditFilter() { session.originalRuleManual = session.ruleManual; session.originalRuleShift = session.ruleShift; session.originalRuleHopper = session.ruleHopper; + session.originalTargetCount = session.targetCount; session.isUnsavedPopupOpen = false; editor.toggleState(EditorState.EDIT_FILTER); diff --git a/multiloader-26.2/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/widgets/InventoryRetentionSlider.java b/multiloader-26.2/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/widgets/InventoryRetentionSlider.java new file mode 100644 index 0000000..e0a1e41 --- /dev/null +++ b/multiloader-26.2/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/widgets/InventoryRetentionSlider.java @@ -0,0 +1,118 @@ +package io.github.marcsanzdev.chestseparators.client.ui.widgets; + +import java.util.function.IntConsumer; +import java.util.function.IntSupplier; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiGraphicsExtractor; +import net.minecraft.network.chat.Component; + +/** Compact draggable Keep slider: All, 64, 32, 16, 1 marks with exact in-between values. */ +public final class InventoryRetentionSlider extends CustomWidget { + private final IntSupplier current; + private final IntConsumer update; + private boolean dragging; + private int heldDetent = -1; + + // A short magnetic pull onto stack-size marks, followed by a slightly wider release + // threshold, makes 16/32/64 easy to hit without changing their saved numeric values. + private static final double DETENT_ENTER_PX = 2.0; + private static final double DETENT_RELEASE_PX = 4.0; + + public InventoryRetentionSlider(int x, int y, int width, int height, + IntSupplier current, IntConsumer update) { + super(x, y, width, height, null); + this.current = current; + this.update = update; + this.tooltipText = "Keep: drag for 1-64 (marks: All / 64 / 32 / 16 / 1); scroll for exact +/-1"; + } + + @Override + public boolean mouseClicked(double mouseX, double mouseY, int button) { + if (button != 0 || isDisabled || !isHovering(mouseX, mouseY)) return false; + dragging = true; + heldDetent = -1; + updateFromMouse(mouseX); + return true; + } + + public boolean mouseDragged(double mouseX, int button) { + if (!dragging || button != 0) return false; + updateFromMouse(mouseX); + return true; + } + + public boolean mouseScrolled(double mouseX, double mouseY, double delta) { + if (isDisabled || !isHovering(mouseX, mouseY) || delta == 0) return false; + update.accept(io.github.marcsanzdev.chestseparators.util.InventoryRetentionSteps.adjustByWheel( + current.getAsInt(), delta > 0 ? 1 : -1)); + return true; + } + + public void stopDrag() { + dragging = false; + heldDetent = -1; + } + + private int trackStart() { + return x + 6; + } + + private int trackEnd() { + return x + width - 6; + } + + private void updateFromMouse(double mouseX) { + int span = Math.max(1, trackEnd() - trackStart()); + double fraction = Math.max(0, Math.min(1, (mouseX - trackStart()) / span)); + // Stay on an engaged detent until the pointer moves farther away than the + // entrance radius; this avoids jitter around 16/32/64 while dragging. + if (heldDetent >= 0) { + int stillHeld = io.github.marcsanzdev.chestseparators.util.InventoryRetentionSteps + .detentNearFraction(fraction, span, DETENT_RELEASE_PX); + if (stillHeld == heldDetent) { + update.accept(heldDetent); + return; + } + heldDetent = -1; + } + heldDetent = io.github.marcsanzdev.chestseparators.util.InventoryRetentionSteps + .detentNearFraction(fraction, span, DETENT_ENTER_PX); + update.accept(heldDetent >= 0 + ? heldDetent + : io.github.marcsanzdev.chestseparators.util.InventoryRetentionSteps.valueAtFraction(fraction)); + } + + @Override + public void render(GuiGraphicsExtractor context, int mouseX, int mouseY, float delta) { + if (isDisabled) return; + int value = current.getAsInt(); + boolean hover = isHovering(mouseX, mouseY); + io.github.marcsanzdev.chestseparators.client.ui.UiTheme.button( + context, x, y, width, height, hover, false); + String label = value <= 0 ? "Keep: All" : "Keep: " + value; + context.pose().pushMatrix(); + context.pose().translate(x + 3.0f, y + 1.0f); + context.pose().scale(0.62f, 0.62f); + context.text(Minecraft.getInstance().font, label, 0, 0, + io.github.marcsanzdev.chestseparators.client.ui.UiTheme.TEXT, false); + context.pose().popMatrix(); + + // Use virtually the entire 108px widget as a track; the label sits ABOVE it. + int start = trackStart(); + int end = trackEnd(); + int lineY = y + height - 2; + context.fill(start, lineY, end + 1, lineY + 1, 0xFF626262); + int marks = io.github.marcsanzdev.chestseparators.util.InventoryRetentionSteps.count(); + for (int i = 0; i < marks; i++) { + int px = start + (end - start) * i / (marks - 1); + context.fill(px, lineY - 2, px + 1, lineY + 2, 0xFF989898); + } + int knob = start + (int) Math.round((end - start) * + io.github.marcsanzdev.chestseparators.util.InventoryRetentionSteps.fractionForValue(value)); + context.fill(knob - 2, lineY - 3, knob + 3, lineY + 3, 0xFFDEDEDE); + if (hover && tooltipText != null) { + context.setTooltipForNextFrame(Minecraft.getInstance().font, + Component.literal(tooltipText), mouseX, mouseY); + } + } +} diff --git a/multiloader-26.2/common/src/main/java/io/github/marcsanzdev/chestseparators/data/ChestConfigManager.java b/multiloader-26.2/common/src/main/java/io/github/marcsanzdev/chestseparators/data/ChestConfigManager.java index 3b3d99e..5ddc568 100644 --- a/multiloader-26.2/common/src/main/java/io/github/marcsanzdev/chestseparators/data/ChestConfigManager.java +++ b/multiloader-26.2/common/src/main/java/io/github/marcsanzdev/chestseparators/data/ChestConfigManager.java @@ -181,7 +181,8 @@ private static Map copyWhitelists(Map(orig.allowedItems()), orig.allowManual(), orig.allowShift(), - orig.allowHopper())); + orig.allowHopper(), + orig.targetCount())); } return copy; } @@ -1393,7 +1394,8 @@ public void pasteWhitelistsFromClipboard() { new ArrayList<>(clipboardItem.allowedItems()), clipboardItem.allowManual(), clipboardItem.allowShift(), - clipboardItem.allowHopper()); + clipboardItem.allowHopper(), + clipboardItem.targetCount()); currentWhitelists.put(entry.getKey(), independentCopy); } } diff --git a/multiloader-26.2/common/src/main/java/io/github/marcsanzdev/chestseparators/data/SlotWhitelist.java b/multiloader-26.2/common/src/main/java/io/github/marcsanzdev/chestseparators/data/SlotWhitelist.java index 213766b..4307305 100644 --- a/multiloader-26.2/common/src/main/java/io/github/marcsanzdev/chestseparators/data/SlotWhitelist.java +++ b/multiloader-26.2/common/src/main/java/io/github/marcsanzdev/chestseparators/data/SlotWhitelist.java @@ -13,8 +13,9 @@ // Represents the whitelist configuration for a single inventory slot. // Includes a groupId to visually and logically link multiple slots together. -// targetCount is the desired amount the player wants to keep of this filter in their inventory -// (0 = no target / unlimited); it drives the grab and deposit-junk hotkeys. +// targetCount retains a minimum number of each listed item across the filter group's inventory slots. +// 0 preserves the original behaviour: all matching items in filtered inventory slots are protected +// from mod-triggered automatic deposits. Non-inventory container filters ignore this value. public record SlotWhitelist( UUID groupId, List allowedItems, diff --git a/multiloader-26.2/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/InventoryMenuRefillMixin.java b/multiloader-26.2/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/InventoryMenuRefillMixin.java new file mode 100644 index 0000000..d257e1c --- /dev/null +++ b/multiloader-26.2/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/InventoryMenuRefillMixin.java @@ -0,0 +1,43 @@ +package io.github.marcsanzdev.chestseparators.mixin; + +import io.github.marcsanzdev.chestseparators.ChestSeparatorsState; +import io.github.marcsanzdev.chestseparators.data.SlotWhitelist; +import io.github.marcsanzdev.chestseparators.util.InventorySlotRefill; +import java.util.Map; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.inventory.ContainerInput; +import net.minecraft.world.inventory.InventoryMenu; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +/** + * Reconciles filtered MAIN inventory slots after each completed player-inventory interaction. + * + *

The old origin-tracking hook only reacted when a stack was picked up from a filtered slot + * and subsequently placed into an unfiltered MAIN slot. Shift-clicking, hotbar swaps, quick + * crafting and rearranging stacks that were already in ordinary slots could bypass that hook, + * leaving dedicated slots partially filled until an unrelated click triggered the refill. + * + *

This is deliberately limited to InventoryMenu. Open-container Push uses several synthetic + * clicks on a different menu and has its own pre-deposit refill; running after each of those + * clicks would interrupt the cursor transfer. InventorySlotRefill never sources the hotbar, + * so intentionally placed hotbar items remain untouched. + */ +@Mixin(AbstractContainerMenu.class) +public abstract class InventoryMenuRefillMixin { + @Inject(method = "clicked", at = @At("RETURN")) + private void chestseparators$reconcilePlayerInventoryAfterClick( + int slotIndex, int button, ContainerInput actionType, Player player, CallbackInfo ci) { + if (player == null || !((Object) this instanceof InventoryMenu)) return; + + Map filters = ChestSeparatorsState.INVENTORY_FILTERS.get(player.getUUID()); + if (filters == null || filters.isEmpty()) return; + + if (InventorySlotRefill.refill(player.getInventory(), filters) && !player.level().isClientSide()) { + ((AbstractContainerMenu) (Object) this).broadcastChanges(); + } + } +} diff --git a/multiloader-26.2/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/ItemEntityPickupContextMixin.java b/multiloader-26.2/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/ItemEntityPickupContextMixin.java new file mode 100644 index 0000000..1796c8d --- /dev/null +++ b/multiloader-26.2/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/ItemEntityPickupContextMixin.java @@ -0,0 +1,23 @@ +package io.github.marcsanzdev.chestseparators.mixin; + +import io.github.marcsanzdev.chestseparators.util.InventoryPickupContext; +import net.minecraft.world.entity.item.ItemEntity; +import net.minecraft.world.entity.player.Player; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +/** Ground-pickup-only scope for the inventory's automatic filter slot selection. */ +@Mixin(ItemEntity.class) +public abstract class ItemEntityPickupContextMixin { + @Inject(method = "playerTouch", at = @At("HEAD")) + private void chestseparators$beginGroundPickup(Player player, CallbackInfo ci) { + InventoryPickupContext.begin(player.getUUID()); + } + + @Inject(method = "playerTouch", at = @At("RETURN")) + private void chestseparators$finishGroundPickup(Player player, CallbackInfo ci) { + InventoryPickupContext.end(); + } +} diff --git a/multiloader-26.2/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/PlayerInventoryFilterMixin.java b/multiloader-26.2/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/PlayerInventoryFilterMixin.java index 92b4038..9b4d9df 100644 --- a/multiloader-26.2/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/PlayerInventoryFilterMixin.java +++ b/multiloader-26.2/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/PlayerInventoryFilterMixin.java @@ -3,6 +3,8 @@ import io.github.marcsanzdev.chestseparators.ChestSeparatorsState; import io.github.marcsanzdev.chestseparators.data.SlotWhitelist; import io.github.marcsanzdev.chestseparators.util.FilterPriority; +import io.github.marcsanzdev.chestseparators.util.InventoryPickupContext; +import io.github.marcsanzdev.chestseparators.util.InventorySlotRefill; import java.util.Map; import net.minecraft.core.NonNullList; import net.minecraft.core.registries.BuiltInRegistries; @@ -15,13 +17,13 @@ import org.spongepowered.asm.mixin.Unique; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; /** * Enforces the player-inventory "Pick Up" rule: a filtered inventory slot only accepts its item when - * items are auto-added (e.g. picked up from the ground). Non-matching items skip reserved slots and - * matching items prefer their reserved slot. Filters are synced from the client into + * items are picked up from the ground. Other calls to Inventory.add or returning the cursor stack + * should not reroute deliberately placed hotbar items. Non-matching items skip reserved slots and + * matching items prefer their reserved slot during pickups. Filters are synced from the client into * {@link ChestSeparatorsState#INVENTORY_FILTERS}; with none present this is a no-op. */ @Mixin(Inventory.class) @@ -40,22 +42,17 @@ public abstract class PlayerInventoryFilterMixin { @Inject(method = "add(Lnet/minecraft/world/item/ItemStack;)Z", at = @At("HEAD")) private void chestseparators$beginInsert(ItemStack stack, CallbackInfoReturnable cir) { - chestseparators$insertingStack = stack; + // Inventory.add is also used by inventory UI actions and other mods. Only ground-pickup + // insertion should prefer empty dedicated slots; deliberate hotbar moves remain vanilla. + chestseparators$insertingStack = InventoryPickupContext.isGroundPickup(player.getUUID()) ? stack : null; } @Inject(method = "add(Lnet/minecraft/world/item/ItemStack;)Z", at = @At("RETURN")) private void chestseparators$endInsert(ItemStack stack, CallbackInfoReturnable cir) { - chestseparators$insertingStack = null; - } - - // Also intercept placeItemBackInInventory: used when closing a screen with a cursor item. - @Inject(method = "placeItemBackInInventory(Lnet/minecraft/world/item/ItemStack;)V", at = @At("HEAD")) - private void chestseparators$beginOfferOrDrop(ItemStack stack, CallbackInfo ci) { - chestseparators$insertingStack = stack; - } - - @Inject(method = "placeItemBackInInventory(Lnet/minecraft/world/item/ItemStack;)V", at = @At("RETURN")) - private void chestseparators$endOfferOrDrop(ItemStack stack, CallbackInfo ci) { + if (!player.level().isClientSide() && InventoryPickupContext.isGroundPickup(player.getUUID())) { + InventorySlotRefill.refill((Inventory) (Object) this, + ChestSeparatorsState.INVENTORY_FILTERS.get(player.getUUID())); + } chestseparators$insertingStack = null; } diff --git a/multiloader-26.2/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/PlayerScreenHandlerFallbackMixin.java b/multiloader-26.2/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/PlayerScreenHandlerFallbackMixin.java index ba4e5af..6adb181 100644 --- a/multiloader-26.2/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/PlayerScreenHandlerFallbackMixin.java +++ b/multiloader-26.2/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/PlayerScreenHandlerFallbackMixin.java @@ -2,15 +2,21 @@ import io.github.marcsanzdev.chestseparators.ChestSeparatorsState; import io.github.marcsanzdev.chestseparators.data.SlotWhitelist; +import java.util.ArrayList; +import java.util.Comparator; +import java.util.List; import java.util.Map; import net.minecraft.core.component.DataComponents; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.world.entity.player.Player; +import net.minecraft.world.entity.player.Inventory; +import io.github.marcsanzdev.chestseparators.util.InventorySlotRefill; import net.minecraft.world.inventory.AbstractContainerMenu; import net.minecraft.world.inventory.InventoryMenu; import net.minecraft.world.inventory.Slot; import net.minecraft.world.item.ItemStack; import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Unique; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; @@ -26,6 +32,105 @@ @Mixin(InventoryMenu.class) public abstract class PlayerScreenHandlerFallbackMixin { + /** + * Vanilla InventoryMenu.quickMoveStack sends main-inventory items straight to the hotbar, + * never consulting dedicated MAIN filters. Give matching filtered main slots first refusal. + * Run on BOTH logical sides to keep predicted clicks aligned with the server. + */ + @Inject(method = "quickMoveStack", at = @At("HEAD"), cancellable = true) + private void chestseparators$preferFilteredMainOnShift( + Player player, int slotIndex, CallbackInfoReturnable cir) { + if (player == null) return; + AbstractContainerMenu menu = (AbstractContainerMenu) (Object) this; + if (slotIndex < 0 || slotIndex >= menu.slots.size()) return; + Slot sourceSlot = menu.slots.get(slotIndex); + if (!(sourceSlot.container instanceof Inventory)) return; + int raw = sourceSlot.getContainerSlot(); + if (raw < 0 || raw >= Inventory.INVENTORY_SIZE || !sourceSlot.hasItem()) return; + + Map filters = ChestSeparatorsState.INVENTORY_FILTERS.get(player.getUUID()); + if (filters == null || filters.isEmpty()) return; + if (raw < 9) { + // Manual placing INTO the hotbar stays vanilla. An explicit shift-click OUT of it + // should, however, offer the stack to matching MAIN filter slots before vanilla + // can merge it into an unrelated main slot. + chestseparators$shiftHotbarIntoFilteredMain(player, menu, sourceSlot, filters, cir); + return; + } + if (filters.containsKey(raw)) return; + ItemStack source = sourceSlot.getItem(); + String id = BuiltInRegistries.ITEM.getKey(source.getItem()).toString(); + boolean dedicated = filters.entrySet().stream().anyMatch(e -> + e.getKey() >= 9 && e.getKey() < Inventory.INVENTORY_SIZE + && e.getValue().allowedItems().contains(id)); + if (!dedicated) return; + + ItemStack original = source.copy(); + boolean changed = InventorySlotRefill.refill(player.getInventory(), filters); + if (!changed) return; + if (!player.level().isClientSide()) menu.broadcastChanges(); + // If all items moved into dedicated main slots, suppress vanilla's hotbar fallback. + // Otherwise vanilla can shift-move the surplus in the source slot as usual. + if (player.getInventory().getItem(raw).isEmpty()) cir.setReturnValue(original); + } + + /** + * InventoryMenu's vanilla hotbar -> main quick-move merges into the first identical main + * stack, even when a later main slot is dedicated to that item. Intercept ONLY an explicit + * shift-click from the hotbar, using vanilla's own moveItemStackTo for each destination. + * + * Filling matching home stacks first makes [1 in home + 64 in hotbar] become + * [64 in home + 1 in hotbar]. The leftover stays in the hotbar for this click, rather + * than silently going into an unrelated main slot. If no home has room, vanilla proceeds. + * This runs on BOTH logical sides for identical client prediction and server results. + */ + @Unique + private void chestseparators$shiftHotbarIntoFilteredMain( + Player player, AbstractContainerMenu menu, Slot sourceSlot, + Map filters, CallbackInfoReturnable cir) { + ItemStack stack = sourceSlot.getItem(); + String itemId = BuiltInRegistries.ITEM.getKey(stack.getItem()).toString(); + + List homeSlots = new ArrayList<>(); + for (int menuIndex = 0; menuIndex < menu.slots.size(); menuIndex++) { + Slot candidate = menu.slots.get(menuIndex); + if (!(candidate.container instanceof Inventory)) continue; + int rawTarget = candidate.getContainerSlot(); + if (rawTarget < 9 || rawTarget >= Inventory.INVENTORY_SIZE) continue; + SlotWhitelist filter = filters.get(rawTarget); + if (filter != null && filter.allowedItems().contains(itemId)) homeSlots.add(menuIndex); + } + if (homeSlots.isEmpty()) return; + // Stable filter priority and raw-slot ordering; existing matching stacks are filled first. + homeSlots.sort(Comparator.comparingInt((Integer i) -> + io.github.marcsanzdev.chestseparators.util.FilterPriority.slotPreference( + filters, menu.slots.get(i).getContainerSlot(), itemId)) + .thenComparingInt(i -> menu.slots.get(i).getContainerSlot())); + AbstractContainerMenuAccessor mover = (AbstractContainerMenuAccessor) (Object) this; + ItemStack original = stack.copy(); + boolean moved = false; + for (int pass = 0; pass < 2 && !stack.isEmpty(); pass++) { + for (int index : homeSlots) { + if (stack.isEmpty()) break; + Slot home = menu.slots.get(index); + ItemStack existing = home.getItem(); + if (pass == 0) { + if (existing.isEmpty() || !ItemStack.isSameItemSameComponents(existing, stack)) continue; + if (existing.getCount() >= Math.min(existing.getMaxStackSize(), home.getMaxStackSize(stack))) continue; + } else if (!existing.isEmpty()) { + continue; + } + moved |= mover.chestseparators$moveItemStackTo(stack, index, index + 1, false); + } + } + if (!moved) return; + if (stack.isEmpty()) sourceSlot.set(ItemStack.EMPTY); + sourceSlot.setChanged(); + if (!player.level().isClientSide()) menu.broadcastChanges(); + // A successful partial move must not fall through into vanilla's unrelated main slots. + cir.setReturnValue(original); + } + @Inject(method = "quickMoveStack", at = @At("RETURN"), cancellable = true) private void chestseparators$armorFallback(Player player, int slotIndex, CallbackInfoReturnable cir) { if (!cir.getReturnValue().isEmpty()) return; diff --git a/multiloader-26.2/common/src/main/java/io/github/marcsanzdev/chestseparators/network/ModClientNetworking.java b/multiloader-26.2/common/src/main/java/io/github/marcsanzdev/chestseparators/network/ModClientNetworking.java index 4b80b6b..2df44a7 100644 --- a/multiloader-26.2/common/src/main/java/io/github/marcsanzdev/chestseparators/network/ModClientNetworking.java +++ b/multiloader-26.2/common/src/main/java/io/github/marcsanzdev/chestseparators/network/ModClientNetworking.java @@ -24,9 +24,16 @@ public class ModClientNetworking { /** Sends the player's current inventory filters to the server (for the Pick Up rule enforcement). */ public static void sendInventoryFilters() { + var filters = new java.util.HashMap<>(ChestConfigManager.getInstance().getPlayerInventoryFilters()); + // Client inventory clicks are predicted locally before the server responds. Both sides must + // consult the SAME filters or quick-moves/refills visibly snap back on synchronization. + var localPlayer = net.minecraft.client.Minecraft.getInstance().player; + if (localPlayer != null) { + io.github.marcsanzdev.chestseparators.ChestSeparatorsState.INVENTORY_FILTERS + .put(localPlayer.getUUID(), filters); + } if (NetworkManager.canServerReceive(InventoryFiltersPayload.TYPE)) { - NetworkManager.sendToServer(new InventoryFiltersPayload( - new java.util.HashMap<>(ChestConfigManager.getInstance().getPlayerInventoryFilters()))); + NetworkManager.sendToServer(new InventoryFiltersPayload(filters)); } } diff --git a/multiloader-26.2/common/src/main/java/io/github/marcsanzdev/chestseparators/network/ModNetworking.java b/multiloader-26.2/common/src/main/java/io/github/marcsanzdev/chestseparators/network/ModNetworking.java index 8601615..0e2ecf8 100644 --- a/multiloader-26.2/common/src/main/java/io/github/marcsanzdev/chestseparators/network/ModNetworking.java +++ b/multiloader-26.2/common/src/main/java/io/github/marcsanzdev/chestseparators/network/ModNetworking.java @@ -208,8 +208,23 @@ public static void init() { BlockState state = world.getBlockState(payload.pos()); boolean isEnderChest = state.getBlock() == Blocks.ENDER_CHEST; - // Ender Chest filters are local-only (hoppers cannot access them); nothing to do here. - if (isEnderChest) return; + // An Ender Chest uses the player's own inventory (27 slots in vanilla, possibly + // larger in a compatible inventory-expansion mod). The local filter is sent at + // screen open and on edits; cache it on this player's live ender inventory so + // vanilla shift-click reaches the same IWhitelistProvider rule as ordinary chests. + // Do not persist it on the world block: each player's Ender Chest is private. + if (isEnderChest) { + Container ender = player.getEnderChestInventory(); + if (ender instanceof IWhitelistProvider provider) { + Map valid = new java.util.HashMap<>(); + payload.whitelists().forEach((slot, wl) -> { + if (slot != null && wl != null && slot >= 0 + && slot < ender.getContainerSize()) valid.put(slot, wl); + }); + provider.setWhitelists(valid); + } + return; + } Container targetInventory = getChestInventorySafe(world, payload.pos()); @@ -422,8 +437,12 @@ private static void performAutoDeposit( List candidates = collectCandidates(player, radius, throughWalls, enderWhitelists, entityWhitelists); - // 2. Deposit each stack into matching candidate slots, recording moved amounts per container. + // 2. Deposit only the movable portion of each source stack. Inventory filters are client-local + // but already synced to this server for pickup enforcement; reuse that authoritative snapshot. Inventory inventory = player.getInventory(); + Map playerFilters = ChestSeparatorsState.INVENTORY_FILTERS.get(player.getUUID()); + // Rehome loose non-hotbar stacks before deciding how many items can leave each filter. + io.github.marcsanzdev.chestseparators.util.InventorySlotRefill.refill(inventory, playerFilters); // Preserve discovery order so the animation roughly mirrors inventory layout. Map> moved = new java.util.LinkedHashMap<>(); // Containers that actually received items, so only those get their groups re-sorted afterwards. @@ -432,16 +451,20 @@ private static void performAutoDeposit( for (int i = 0; i < Inventory.INVENTORY_SIZE; i++) { ItemStack stack = inventory.getItem(i); if (stack.isEmpty()) continue; + int available = io.github.marcsanzdev.chestseparators.util.InventoryProtection + .movableCount(inventory, playerFilters, i); + if (available <= 0) continue; + ItemStack outgoing = stack.copyWithCount(available); Item item = stack.getItem(); String itemId = BuiltInRegistries.ITEM.getKey(item).toString(); for (Candidate candidate : candidates) { - if (stack.isEmpty()) break; + if (outgoing.isEmpty()) break; if (!containerListsItem(candidate.whitelists, itemId)) continue; - int before = stack.getCount(); - insertRespectingFilter(candidate.inv, candidate.whitelists, stack, itemId); - int delta = before - stack.getCount(); + int before = outgoing.getCount(); + insertRespectingFilter(candidate.inv, candidate.whitelists, outgoing, itemId); + int delta = before - outgoing.getCount(); if (delta > 0) { candidate.inv.setChanged(); touched.add(candidate); @@ -449,6 +472,8 @@ private static void performAutoDeposit( .merge(item, delta, Integer::sum); } } + int deposited = available - outgoing.getCount(); + if (deposited > 0) stack.shrink(deposited); inventory.setItem(i, stack); } @@ -589,7 +614,9 @@ private static void insertRespectingFilter( int max = Math.min(inv.getMaxStackSize(dest), dest.getMaxStackSize()); int space = max - dest.getCount(); if (space <= 0) continue; - int move = Math.min(space, stack.getCount()); + int move = Math.min(Math.min(space, stack.getCount()), + availableInboundRoom(inv, whitelists, slot, itemId)); + if (move <= 0) continue; dest.grow(move); stack.shrink(move); } @@ -608,12 +635,36 @@ private static void insertRespectingFilter( for (int slot : emptySlots) { if (stack.isEmpty()) break; int max = Math.min(inv.getMaxStackSize(stack), stack.getMaxStackSize()); - int move = Math.min(max, stack.getCount()); + int move = Math.min(Math.min(max, stack.getCount()), + availableInboundRoom(inv, whitelists, slot, itemId)); + if (move <= 0) continue; inv.setItem(slot, stack.copyWithCount(move)); stack.shrink(move); } } + /** The per-group inbound cap applies only when filling the player's inventory, not storage. */ + private static int availableInboundRoom( + Container inv, Map whitelists, int destSlot, String itemId) { + if (!(inv instanceof Inventory) || whitelists == null) return Integer.MAX_VALUE; + SlotWhitelist filter = whitelists.get(destSlot); + if (filter == null || filter.targetCount() <= 0 || filter.groupId() == null) return Integer.MAX_VALUE; + + int held = 0; + for (Map.Entry entry : whitelists.entrySet()) { + if (!filter.groupId().equals(entry.getValue().groupId()) + || !entry.getValue().allowedItems().contains(itemId)) continue; + int slot = entry.getKey(); + if (slot < 0 || slot >= inv.getContainerSize()) continue; + ItemStack existing = inv.getItem(slot); + if (!existing.isEmpty() && BuiltInRegistries.ITEM.getKey(existing.getItem()).toString().equals(itemId)) { + held += existing.getCount(); + } + } + return io.github.marcsanzdev.chestseparators.util.InventoryTransferPolicy + .inboundRoom(filter.targetCount(), held); + } + /** * Re-lays every filtered group of {@code inv} so its stacks sit in the filter's priority order, packed * from the group's first slot. Server-authoritative (direct {@link Container#setItem}) so nothing can diff --git a/multiloader-26.2/common/src/main/java/io/github/marcsanzdev/chestseparators/util/InventoryPickupContext.java b/multiloader-26.2/common/src/main/java/io/github/marcsanzdev/chestseparators/util/InventoryPickupContext.java new file mode 100644 index 0000000..2e7bf02 --- /dev/null +++ b/multiloader-26.2/common/src/main/java/io/github/marcsanzdev/chestseparators/util/InventoryPickupContext.java @@ -0,0 +1,14 @@ +package io.github.marcsanzdev.chestseparators.util; + +import java.util.UUID; + +/** Distinguishes an ItemEntity ground pickup from a deliberate inventory operation on this thread. */ +public final class InventoryPickupContext { + private static final ThreadLocal PICKING_UP = new ThreadLocal<>(); + + private InventoryPickupContext() {} + + public static void begin(UUID playerId) { PICKING_UP.set(playerId); } + public static void end() { PICKING_UP.remove(); } + public static boolean isGroundPickup(UUID playerId) { return playerId.equals(PICKING_UP.get()); } +} diff --git a/multiloader-26.2/common/src/main/java/io/github/marcsanzdev/chestseparators/util/InventoryProtection.java b/multiloader-26.2/common/src/main/java/io/github/marcsanzdev/chestseparators/util/InventoryProtection.java new file mode 100644 index 0000000..4d38ff8 --- /dev/null +++ b/multiloader-26.2/common/src/main/java/io/github/marcsanzdev/chestseparators/util/InventoryProtection.java @@ -0,0 +1,52 @@ +package io.github.marcsanzdev.chestseparators.util; + +import io.github.marcsanzdev.chestseparators.data.SlotWhitelist; +import java.util.Map; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.item.ItemStack; + +/** + * Protects item counts assigned to player-inventory filters from automated outbound transfers. + * Only matching items are protected; a wrong item in a filtered slot can still be deposited. + * A positive target is shared by all slots of one filter group, per allowed item type. + */ +public final class InventoryProtection { + private InventoryProtection() {} + + public static int movableCount(Inventory inventory, Map filters, int slot) { + return movableCount(inventory.getContainerSize(), inventory::getItem, filters, slot); + } + + /** Preview counterpart: uses the post-refill snapshot, not the current live inventory. */ + public static int movableCount(java.util.List items, Map filters, int slot) { + return movableCount(items.size(), items::get, filters, slot); + } + + private static int movableCount(int size, java.util.function.IntFunction get, + Map filters, int slot) { + if (slot < 0 || slot >= size) return 0; + ItemStack source = get.apply(slot); + if (source.isEmpty()) return 0; + if (filters == null) return source.getCount(); + SlotWhitelist filter = filters.get(slot); + if (filter == null) return source.getCount(); + + String itemId = BuiltInRegistries.ITEM.getKey(source.getItem()).toString(); + if (!filter.allowedItems().contains(itemId)) return source.getCount(); + if (filter.targetCount() <= 0) return 0; + + int earlier = 0; + for (int i = 0; i < slot; i++) { + SlotWhitelist previous = filters.get(i); + if (previous == null || !filter.groupId().equals(previous.groupId()) + || !previous.allowedItems().contains(itemId)) continue; + ItemStack existing = get.apply(i); + if (!existing.isEmpty() && BuiltInRegistries.ITEM.getKey(existing.getItem()).toString().equals(itemId)) { + earlier += existing.getCount(); + } + } + return InventoryTransferPolicy.movableCount(source.getCount(), filter.targetCount(), earlier); + } + +} diff --git a/multiloader-26.2/common/src/main/java/io/github/marcsanzdev/chestseparators/util/InventoryRetentionSteps.java b/multiloader-26.2/common/src/main/java/io/github/marcsanzdev/chestseparators/util/InventoryRetentionSteps.java new file mode 100644 index 0000000..f476f23 --- /dev/null +++ b/multiloader-26.2/common/src/main/java/io/github/marcsanzdev/chestseparators/util/InventoryRetentionSteps.java @@ -0,0 +1,63 @@ +package io.github.marcsanzdev.chestseparators.util; + +/** + * Continuous Keep slider mapping, with five visible reference marks. + * Left to right: All, 64, 32, 16, 1. All (0) remains distinct from exactly 64. + * Within the numeric portion, interpolation allows EVERY integer from 1 to 64. + */ +public final class InventoryRetentionSteps { + private static final int[] MARKERS = {0, 64, 32, 16, 1}; + + private InventoryRetentionSteps() {} + + public static int count() { + return MARKERS.length; + } + + public static int valueForStop(int index) { + return MARKERS[Math.max(0, Math.min(MARKERS.length - 1, index))]; + } + + /** Dragging exactly to the left end selects All; its neighboring region selects 64. */ + public static int valueAtFraction(double fraction) { + double f = Math.max(0.0, Math.min(1.0, fraction)); + if (f == 0.0) return 0; + if (f <= 0.25) return 64; + if (f <= 0.50) return 64 - (int) Math.round((f - 0.25) / 0.25 * 32.0); + if (f <= 0.75) return 32 - (int) Math.round((f - 0.50) / 0.25 * 16.0); + return Math.max(1, 16 - (int) Math.round((f - 0.75) / 0.25 * 15.0)); + } + + /** Inverse mapping: a saved custom quantity is drawn at its true position, not snapped to a mark. */ + public static double fractionForValue(int value) { + if (value <= 0) return 0.0; + if (value >= 64) return 0.25; + if (value >= 32) return 0.25 + (64 - value) / 32.0 * 0.25; + if (value >= 16) return 0.50 + (32 - value) / 16.0 * 0.25; + return 0.75 + (16 - value) / 15.0 * 0.25; + } + + /** + * Return the 64/32/16 stack-size detent nearest the pointer, or -1 outside the + * requested pixel radius. All and 1 remain ordinary endpoints rather than magnetic + * marks. Callers use a smaller radius to enter a detent than to leave it (hysteresis). + * Actual values between detents are still selectable with dragging or the wheel. + */ + public static int detentNearFraction(double fraction, double trackWidth, double radiusPixels) { + if (trackWidth <= 0 || radiusPixels < 0) return -1; + double pointerX = Math.max(0.0, Math.min(1.0, fraction)) * trackWidth; + for (int value : new int[] {64, 32, 16}) { + if (Math.abs(pointerX - fractionForValue(value) * trackWidth) <= radiusPixels) { + return value; + } + } + return -1; + } + + /** Scroll wheel gives exact counts even when the game uses a large GUI scale. */ + public static int adjustByWheel(int value, int steps) { + if (steps == 0) return value; + int start = value <= 0 ? 64 : Math.max(1, Math.min(64, value)); + return Math.max(1, Math.min(64, start + steps)); + } +} diff --git a/multiloader-26.2/common/src/main/java/io/github/marcsanzdev/chestseparators/util/InventorySlotRefill.java b/multiloader-26.2/common/src/main/java/io/github/marcsanzdev/chestseparators/util/InventorySlotRefill.java new file mode 100644 index 0000000..568aff6 --- /dev/null +++ b/multiloader-26.2/common/src/main/java/io/github/marcsanzdev/chestseparators/util/InventorySlotRefill.java @@ -0,0 +1,105 @@ +package io.github.marcsanzdev.chestseparators.util; + +import io.github.marcsanzdev.chestseparators.data.SlotWhitelist; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.function.ToIntFunction; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.item.ItemStack; + +/** + * Refills dedicated MAIN inventory slots from unfiltered MAIN slots, without touching hotbar, + * armor, offhand or other filtered sources. The same algorithm runs on an inventory snapshot + * for the Push preview, so it can accurately predict the action without mutating live items. + */ +public final class InventorySlotRefill { + private InventorySlotRefill() {} + + public static boolean refill(Inventory inventory, Map filters) { + if (filters == null || filters.isEmpty()) return false; + List projected = new ArrayList<>(Inventory.INVENTORY_SIZE); + for (int i = 0; i < Inventory.INVENTORY_SIZE; i++) { + projected.add(inventory.getItem(i).copy()); + } + if (!refillStacks(projected, filters, inventory::getMaxStackSize)) return false; + for (int i = 9; i < Inventory.INVENTORY_SIZE; i++) { + ItemStack before = inventory.getItem(i); + ItemStack after = projected.get(i); + if (before.getCount() != after.getCount() + || !ItemStack.isSameItemSameComponents(before, after)) { + inventory.setItem(i, after); + } + } + inventory.setChanged(); + return true; + } + + /** Mutates ONLY the supplied copied stacks. Raw player inventory indices are used throughout. */ + public static boolean refillStacks( + List stacks, + Map filters, + ToIntFunction inventoryMax) { + if (filters == null || filters.isEmpty() || stacks.size() < Inventory.INVENTORY_SIZE) return false; + boolean changed = false; + // First finish matching, partly-filled filter slots, then occupy empty filter slots. + for (int target = 9; target < Inventory.INVENTORY_SIZE; target++) { + SlotWhitelist filter = filters.get(target); + if (filter == null || filter.allowedItems().isEmpty()) continue; + ItemStack home = stacks.get(target); + if (home.isEmpty() || !filter.allowedItems().contains(itemId(home))) continue; + changed |= topUp(stacks, filters, target, home, inventoryMax); + } + for (int target = 9; target < Inventory.INVENTORY_SIZE; target++) { + SlotWhitelist filter = filters.get(target); + if (filter == null || filter.allowedItems().isEmpty() || !stacks.get(target).isEmpty()) continue; + for (String wanted : filter.allowedItems()) { + int source = findSource(stacks, filters, target, wanted, null); + if (source < 0) continue; + stacks.set(target, stacks.get(source).copy()); + stacks.set(source, ItemStack.EMPTY); + changed = true; + changed |= topUp(stacks, filters, target, stacks.get(target), inventoryMax); + break; + } + } + return changed; + } + + private static boolean topUp(List stacks, Map filters, + int target, ItemStack home, ToIntFunction inventoryMax) { + boolean changed = false; + String id = itemId(home); + int limit = Math.min(home.getMaxStackSize(), inventoryMax.applyAsInt(home)); + while (home.getCount() < limit) { + int source = findSource(stacks, filters, target, id, home); + if (source < 0) break; + ItemStack extra = stacks.get(source); + int take = Math.min(limit - home.getCount(), extra.getCount()); + if (take <= 0) break; + home.grow(take); + extra.shrink(take); + stacks.set(source, extra.isEmpty() ? ItemStack.EMPTY : extra); + stacks.set(target, home); + changed = true; + } + return changed; + } + + private static int findSource(List stacks, Map filters, + int target, String itemId, ItemStack matching) { + for (int raw = 9; raw < Inventory.INVENTORY_SIZE; raw++) { + if (raw == target || filters.containsKey(raw)) continue; + ItemStack candidate = stacks.get(raw); + if (candidate.isEmpty() || !itemId(candidate).equals(itemId)) continue; + if (matching != null && !ItemStack.isSameItemSameComponents(matching, candidate)) continue; + return raw; + } + return -1; + } + + private static String itemId(ItemStack stack) { + return BuiltInRegistries.ITEM.getKey(stack.getItem()).toString(); + } +} diff --git a/multiloader-26.2/common/src/main/java/io/github/marcsanzdev/chestseparators/util/InventoryTransferPolicy.java b/multiloader-26.2/common/src/main/java/io/github/marcsanzdev/chestseparators/util/InventoryTransferPolicy.java new file mode 100644 index 0000000..4306f8e --- /dev/null +++ b/multiloader-26.2/common/src/main/java/io/github/marcsanzdev/chestseparators/util/InventoryTransferPolicy.java @@ -0,0 +1,23 @@ +package io.github.marcsanzdev.chestseparators.util; + +/** Pure quantity arithmetic shared by client previews and server transfers. */ +public final class InventoryTransferPolicy { + private InventoryTransferPolicy() {} + + /** + * How many items may leave one matching, filtered stack. + * A target of zero is the legacy behaviour: keep all items in the filtered slot. + * Positive targets are retained across the group's earlier slots, not once per slot. + */ + public static int movableCount(int stackCount, int targetCount, int earlierMatchingCount) { + if (stackCount <= 0) return 0; + if (targetCount <= 0) return 0; + int neededHere = Math.max(0, targetCount - Math.max(0, earlierMatchingCount)); + return Math.max(0, stackCount - neededHere); + } + + /** Remaining room under a filter target; zero means there is no quantity cap on inbound pulls. */ + public static int inboundRoom(int targetCount, int currentlyHeld) { + return targetCount <= 0 ? Integer.MAX_VALUE : Math.max(0, targetCount - Math.max(0, currentlyHeld)); + } +} diff --git a/multiloader-26.2/common/src/main/resources/absoluteorder.mixins.json b/multiloader-26.2/common/src/main/resources/absoluteorder.mixins.json index 1137d25..55a6e96 100644 --- a/multiloader-26.2/common/src/main/resources/absoluteorder.mixins.json +++ b/multiloader-26.2/common/src/main/resources/absoluteorder.mixins.json @@ -13,6 +13,8 @@ "ChestBoatEntityMixin", "DoubleInventoryMixin", "HopperBlockEntityMixin", + "ItemEntityPickupContextMixin", + "InventoryMenuRefillMixin", "LootableContainerBlockEntityMixin", "PlayerInventoryFilterMixin", "PlayerScreenHandlerFallbackMixin", diff --git a/multiloader-26.2/common/src/test/java/io/github/marcsanzdev/chestseparators/util/InventoryRetentionStepsTest.java b/multiloader-26.2/common/src/test/java/io/github/marcsanzdev/chestseparators/util/InventoryRetentionStepsTest.java new file mode 100644 index 0000000..1a268b9 --- /dev/null +++ b/multiloader-26.2/common/src/test/java/io/github/marcsanzdev/chestseparators/util/InventoryRetentionStepsTest.java @@ -0,0 +1,49 @@ +package io.github.marcsanzdev.chestseparators.util; + +import static org.junit.jupiter.api.Assertions.*; +import org.junit.jupiter.api.Test; + +class InventoryRetentionStepsTest { + @Test void marksAreAll64Then32Then16Then1() { + assertEquals(5, InventoryRetentionSteps.count()); + assertEquals(0, InventoryRetentionSteps.valueForStop(0)); + assertEquals(64, InventoryRetentionSteps.valueForStop(1)); + assertEquals(32, InventoryRetentionSteps.valueForStop(2)); + assertEquals(16, InventoryRetentionSteps.valueForStop(3)); + assertEquals(1, InventoryRetentionSteps.valueForStop(4)); + } + + @Test void continuousMappingIncludesEveryInteger() { + assertEquals(0, InventoryRetentionSteps.valueAtFraction(0)); + assertEquals(64, InventoryRetentionSteps.valueAtFraction(0.25)); + assertEquals(32, InventoryRetentionSteps.valueAtFraction(0.5)); + assertEquals(16, InventoryRetentionSteps.valueAtFraction(0.75)); + assertEquals(1, InventoryRetentionSteps.valueAtFraction(1)); + for (int count = 1; count <= 64; count++) { + assertEquals(count, InventoryRetentionSteps.valueAtFraction( + InventoryRetentionSteps.fractionForValue(count)), "round trip " + count); + } + } + + @Test void magnetOnlyEngagesNearStackMarks() { + double width = 96; + for (int stop : new int[] {16, 32, 64}) { + double at = InventoryRetentionSteps.fractionForValue(stop); + assertEquals(stop, InventoryRetentionSteps.detentNearFraction(at, width, 2.0)); + assertEquals(stop, InventoryRetentionSteps.detentNearFraction(at + 1.5 / width, width, 2.0)); + assertEquals(-1, InventoryRetentionSteps.detentNearFraction(at + 2.5 / width, width, 2.0)); + assertEquals(stop, InventoryRetentionSteps.detentNearFraction(at + 3.5 / width, width, 4.0)); + assertEquals(-1, InventoryRetentionSteps.detentNearFraction(at + 4.5 / width, width, 4.0)); + } + assertEquals(-1, InventoryRetentionSteps.detentNearFraction(0, width, 2.0)); + assertEquals(-1, InventoryRetentionSteps.detentNearFraction(1, width, 2.0)); + } + + @Test void savedCustomAmountsRemainUnchangedUntilEdited() { + assertEquals(0.0, InventoryRetentionSteps.fractionForValue(0)); + assertEquals(0.25, InventoryRetentionSteps.fractionForValue(999)); + assertEquals(27, InventoryRetentionSteps.adjustByWheel(28, -1)); + assertEquals(64, InventoryRetentionSteps.adjustByWheel(0, 1)); + assertEquals(1, InventoryRetentionSteps.adjustByWheel(1, -1)); + } +} diff --git a/multiloader-26.2/common/src/test/java/io/github/marcsanzdev/chestseparators/util/InventoryTransferPolicyTest.java b/multiloader-26.2/common/src/test/java/io/github/marcsanzdev/chestseparators/util/InventoryTransferPolicyTest.java new file mode 100644 index 0000000..54d55be --- /dev/null +++ b/multiloader-26.2/common/src/test/java/io/github/marcsanzdev/chestseparators/util/InventoryTransferPolicyTest.java @@ -0,0 +1,29 @@ +package io.github.marcsanzdev.chestseparators.util; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.Test; + +class InventoryTransferPolicyTest { + @Test void legacyZeroProtectsTheEntireMatchingStack() { + assertEquals(0, InventoryTransferPolicy.movableCount(64, 0, 0)); + } + + @Test void aSingleArrowIsKeptAndSurplusIsReleased() { + assertEquals(63, InventoryTransferPolicy.movableCount(64, 1, 0)); + assertEquals(0, InventoryTransferPolicy.movableCount(1, 1, 0)); + } + + @Test void groupTargetIsSharedAcrossSeveralSlots() { + assertEquals(0, InventoryTransferPolicy.movableCount(32, 64, 0)); + assertEquals(32, InventoryTransferPolicy.movableCount(64, 64, 32)); + assertEquals(64, InventoryTransferPolicy.movableCount(64, 1, 1)); + } + + @Test void pullRespectsTargetExceptWhenUnlimited() { + assertEquals(1, InventoryTransferPolicy.inboundRoom(1, 0)); + assertEquals(0, InventoryTransferPolicy.inboundRoom(1, 1)); + assertEquals(0, InventoryTransferPolicy.inboundRoom(16, 20)); + assertEquals(12, InventoryTransferPolicy.inboundRoom(16, 4)); + assertEquals(Integer.MAX_VALUE, InventoryTransferPolicy.inboundRoom(0, 64)); + } +} diff --git a/multiloader-26.2/gradle.properties b/multiloader-26.2/gradle.properties index 1e50ac4..36c426e 100644 --- a/multiloader-26.2/gradle.properties +++ b/multiloader-26.2/gradle.properties @@ -2,7 +2,7 @@ org.gradle.jvmargs=-Xmx3G org.gradle.parallel=true # Publishable artifacts are "Absolute Order 2.0.0"; jar filenames encode loader + MC version. -mod_version = 2.0.0 +mod_version = 2.0.0-fork.1 maven_group = io.github.marcsanzdev archives_name = AbsoluteOrder enabled_platforms = fabric,neoforge diff --git a/multiloader-26.3/.gitignore b/multiloader-26.3/.gitignore new file mode 100644 index 0000000..e90d7fa --- /dev/null +++ b/multiloader-26.3/.gitignore @@ -0,0 +1,15 @@ +# Gradle +.gradle/ +build/ +**/build/ +!gradle/wrapper/gradle-wrapper.jar + +# IDE +.idea/ +*.iml +.vscode/ +eclipse/ +run/ + +# Loom +.architectury-transformer/ diff --git a/multiloader-26.3/MIGRATION.md b/multiloader-26.3/MIGRATION.md new file mode 100644 index 0000000..fd2eeaa --- /dev/null +++ b/multiloader-26.3/MIGRATION.md @@ -0,0 +1,191 @@ +# Code migration — single-loader (yarn) → `common` (Mojmap) + +Tracks moving the real mod code from the old single-loader project (`../src/main`, yarn mappings) into +the multiloader `common/` module (Mojmap). Work **one class at a time**, migrate its yarn names to +Mojmap, then `./gradlew :common:compileJava` — the compiler is the verifier for the mapping names. +Validate behaviour against `../MOD_SPEC.md`; never change behaviour during the move. + +## Order (by dependency, non-render core first) + +1. ✅ `data/SlotWhitelist` — filter record (Codec + StreamCodec). Done. +2. ✅ `access/IWhitelistProvider` — duck interface (no MC types). Done. +3. ✅ `ChestSeparatorsState` — common holder for the server-side maps `INVENTORY_FILTERS` / + `LOCKED_CHESTS` (the pure-state parts of `ChestSeparatorsMain`, split from Fabric registration). Done. +4. ✅ `util/FilterPriority` — ordering/occupancy logic; yarn→Mojmap renames applied. Compiles. Done. +5. ✅ `config/GlobalChestConfig` — Gson POJO; only change was the config dir → `Platform.getConfigFolder()`. + Loaded from common `AbsoluteOrder.init()`. Done. +6. ✅ Networking + server logic → `network/` (all 11 payloads as Mojmap `CustomPacketPayload`, plus + `ModNetworking` = Architectury registration + the whole server core ported from `ChestSeparatorsMain`: + auto-deposit, fill-from-open, whitelist persist/broadcast/expel, editor locks, reorder). Compiles. + **Still TODO on the client side:** the S2C receivers (old `ModClientNetworking`) — they touch the + editor/animator GUI classes, so they move with step 8. +7. ✅ Persistence + component registration: `ChestSeparatorsComponents` (Architectury `DeferredRegister`), + and BE/entity NBT via the snapshot's ValueInput/ValueOutput + Codec (`SlotWhitelist.MAP_CODEC`). Done. +8. ✅ ALL server-side mixins (22) migrated to `common/mixin`, in `absoluteorder.mixins.json`, wired into + fabric.mod.json + neoforge.mods.toml. Both jars build AND runtime-apply clean on NeoForge (0 failures). + Architectury transformer remaps common mixins to intermediary/SRG (no refmap needed). NO accesswidener + needed — used public accessors (`getSelectedSlot()`, `getNonEquipmentItems()`) and an `@Invoker` + (`AbstractContainerMenuAccessor`) for the one protected method (`moveItemStackTo`). + Persistence: BlockEntityComponentMixin, BlockEntityMixin, LootableContainerBlockEntityMixin, + ShulkerBoxBlockEntityMixin, BlockDropMixin, StorageMinecartEntityMixin, ChestBoatEntityMixin. + Enforcement: SlotWhitelistMixin, ScreenHandlerClickMixin, ScreenHandlerWhitelistMixin (@Redirect), + HopperBlockEntityMixin, DoubleInventoryMixin, SimpleInventoryMixin, ArmorSlotFilterMixin, + ArmorEquipFilterMixin, ScreenHandlerSwapFilterMixin, ServerPlayNetworkHandlerSwapFilterMixin, + PlayerInventoryFilterMixin, ShulkerBoxSlotMixin, ShulkerBoxBlockMixin, PlayerScreenHandlerFallbackMixin. + **Deferred to the GUI phase:** `WorldMixin` (client-only, depends on the not-yet-migrated + `ChestConfigManager`), and the two dropped S2C pushes (chest/minecart/shulker open) — re-add once the + client S2C receivers register the payload types. +9. ⬜ GUI/overlay (era E5) + `ChestConfigManager`/presets/undo + client S2C receivers (`ModClientNetworking`) + + `WorldMixin` + config screen (ModMenu/Cloth integration) + REI/EMI/JEI. + +## Architectury networking model (used by `ModNetworking`) +- **C2S**: `NetworkManager.registerReceiver(Side.C2S, TYPE, CODEC, (payload, ctx) -> ctx.queue(...))` in + **common** init (runs both physical sides; the client's integrated server needs it too). +- **S2C**: on the **dedicated server** call `NetworkManager.registerS2CPayloadType(TYPE, CODEC)` (guard with + `Platform.getEnvironment() == Env.SERVER`); on the **client** call `registerReceiver(Side.S2C, ...)` — that + one registration covers both the send-type and the receiver, so do NOT also call `registerS2CPayloadType` + on the client (double `playS2C().register` → crash). +- Send: `NetworkManager.sendToPlayer(ServerPlayer, payload)`; gate with `canPlayerReceive(player, TYPE)`. +- `ctx.getPlayer()` returns `Player` (cast to `ServerPlayer` server-side); `ctx.queue(Runnable)` = run on + main thread (replaces Fabric `context.server().execute`). +- `PlayerLookup.tracking(world, pos)` → `serverLevel.getChunkSource().chunkMap.getPlayers(new ChunkPos(pos), false)`. +- Disconnect cleanup → `dev.architectury.event.events.common.PlayerEvent.PLAYER_QUIT.register(player -> ...)`. +- **⚠ S2C send safety:** an S2C payload can only be sent once its TYPE is registered on the sending + physical side. On a client/integrated-server that means the client S2C RECEIVER must be registered + (that registration also registers the send-type). Until the client receivers are migrated, do NOT send + ANY S2C payload from the integrated server — `NetworkManager.canPlayerReceive` is unreliable on NeoForge + (returns true for a C2S-only-registered type) and `sendToPlayer` then NPEs with "codec is null". This is + why the `createMenu` whitelist-push was dropped; re-add it (or rely on WhitelistRequestPayload) only after + the client S2C receivers register `WhitelistPayload`/`EntityWhitelistPayload`/etc. + +## ⚠ This 1.21.11 mapping is NOT stable Mojmap +The mappings layer (`loom.mappings.1_21_11.layered+hash.40359`) reflects late-2025 Mojang snapshot renames. +**`ResourceLocation` was renamed to `Identifier`** → `net.minecraft.resources.Identifier` (Mojmap package, +yarn-style class name; `Identifier.fromNamespaceAndPath(ns,path)`, `Identifier.parse(str)`). Everything +else checked so far is standard Mojmap. When a name looks off, verify against the mapped merged jar with +`javap -cp ` (jar under `~/.gradle/caches/fabric-loom/minecraftMaven/.../minecraft-merged-1.21.11-*.jar`). + +## yarn → Mojmap cheat-sheet (verified via the common compiler) + +Classes: +- `net.minecraft.network.PacketByteBuf` → `net.minecraft.network.FriendlyByteBuf` +- `net.minecraft.network.RegistryByteBuf` → `net.minecraft.network.RegistryFriendlyByteBuf` +- `net.minecraft.network.packet.CustomPayload` → `net.minecraft.network.protocol.common.custom.CustomPacketPayload` (nested `Type`; override `type()` not `getId()`) +- `net.minecraft.network.codec.PacketCodec` → `net.minecraft.network.codec.StreamCodec` +- `net.minecraft.network.codec.PacketCodecs` → `net.minecraft.network.codec.ByteBufCodecs` +- `net.minecraft.util.Uuids` → `net.minecraft.core.UUIDUtil` +- `net.minecraft.util.Identifier` → `net.minecraft.resources.Identifier` (see anomaly above — NOT ResourceLocation) +- `net.minecraft.inventory.Inventory` → `net.minecraft.world.Container` +- `net.minecraft.inventory.DoubleInventory` → `net.minecraft.world.CompoundContainer` +- `net.minecraft.inventory.SimpleInventory` → `net.minecraft.world.SimpleContainer` +- `net.minecraft.entity.player.PlayerInventory` → `net.minecraft.world.entity.player.Inventory` (Mojmap's *player* inventory is literally `Inventory`; `INVENTORY_SIZE`=36, `SELECTION_SIZE`=9; `add(stack)`, public field `player`) +- `net.minecraft.item.ItemStack` → `net.minecraft.world.item.ItemStack` +- `net.minecraft.item.Item` → `net.minecraft.world.item.Item` +- `net.minecraft.registry.Registries` → `net.minecraft.core.registries.BuiltInRegistries` +- `net.minecraft.screen.slot.Slot` → `net.minecraft.world.inventory.Slot` +- `net.minecraft.screen.ScreenHandler` → `net.minecraft.world.inventory.AbstractContainerMenu` (`slots`, `broadcastChanges()`) +- `net.minecraft.util.collection.DefaultedList` → `net.minecraft.core.NonNullList` +- `net.minecraft.util.math.BlockPos` → `net.minecraft.core.BlockPos`; `Direction` → `net.minecraft.core.Direction` +- `net.minecraft.util.math.Vec3d` → `net.minecraft.world.phys.Vec3`; `Box` → `net.minecraft.world.phys.AABB` +- `net.minecraft.util.hit.BlockHitResult/HitResult` → `net.minecraft.world.phys.BlockHitResult/HitResult` +- `net.minecraft.world.RaycastContext` → `net.minecraft.world.level.ClipContext` (`ClipContext.Block.COLLIDER`, `ClipContext.Fluid.NONE`) +- `net.minecraft.world.World` → `net.minecraft.world.level.Level`; `ServerWorld` → `net.minecraft.server.level.ServerLevel` +- `net.minecraft.server.network.ServerPlayerEntity` → `net.minecraft.server.level.ServerPlayer` +- `net.minecraft.entity.ItemEntity` → `net.minecraft.world.entity.item.ItemEntity`; `Entity` → `net.minecraft.world.entity.Entity` +- `net.minecraft.world.chunk.WorldChunk` → `net.minecraft.world.level.chunk.LevelChunk`; `ChunkPos` → `net.minecraft.world.level.ChunkPos` +- `net.minecraft.block.*` → `net.minecraft.world.level.block.*` (`Blocks`, `ChestBlock`); block entity → `...block.entity.*` +- `net.minecraft.block.enums.ChestType` → `net.minecraft.world.level.block.state.properties.ChestType` + +Members: +- `PacketCodec.of(A::write, A::new)` → `StreamCodec.ofMember(A::write, A::new)` ; `PacketCodec.unit(x)` → `StreamCodec.unit(x)` ; `CustomPayload.codecOf((v,buf)->…, buf->…)` → `StreamCodec.ofMember((v,buf)->…, buf->…)` +- `ItemStack.PACKET_CODEC` → `ItemStack.STREAM_CODEC` (needs RegistryFriendlyByteBuf) ; `buf.readUuid/writeUuid` → `readUUID/writeUUID` +- `PacketCodec.tuple(...)` → `StreamCodec.composite(...)` ; `PacketCodecs.STRING.collect(toList())` → `ByteBufCodecs.STRING_UTF8.apply(ByteBufCodecs.list())` ; `PacketCodecs.BOOLEAN`→`ByteBufCodecs.BOOL` ; `PacketCodecs.VAR_INT`→`ByteBufCodecs.VAR_INT` +- `Uuids.CODEC`→`UUIDUtil.CODEC` ; `Uuids.PACKET_CODEC`→`UUIDUtil.STREAM_CODEC` +- `Container.getStack(i)`→`getItem(i)` ; `setStack(i,s)`→`setItem(i,s)` ; `removeStack(i)`→`removeItemNoUpdate(i)` ; `size()`→`getContainerSize()` ; `markDirty()`→`setChanged()` ; `getMaxCount(s)`→`getMaxStackSize(s)` ; `isValid(i,s)`→`canPlaceItem(i,s)` +- `Slot.inventory`→`container` ; `getIndex()`→`getContainerSlot()` ; `getStack()`→`getItem()` ; `getMaxItemCount(s)`→`getMaxStackSize(s)` ; `canInsert(s)`→`mayPlace(s)` +- `ItemStack.areItemsAndComponentsEqual(a,b)`→`isSameItemSameComponents(a,b)` ; `getMaxCount()`→`getMaxStackSize()` ; `decrement(n)`→`shrink(n)` ; `increment(n)`→`grow(n)` ; `copyWithCount(n)` (same) +- `Registries.ITEM.getId(item)`→`BuiltInRegistries.ITEM.getKey(item)` +- Entity/player: `getUuid()`→`getUUID()` ; `getEntityWorld()`→`level()` ; `getEyePos()`→`getEyePosition()` ; `getBlockPos()`→`blockPosition()` ; `getPos()`→`position()` ; `getEyeY()` (same) ; `getBoundingBox().expand(r)`→`.inflate(r)` ; `setVelocity(...)`→`setDeltaMovement(...)` ; `setToDefaultPickupDelay()`→`setDefaultPickUpDelay()` +- Player: `currentScreenHandler`→`containerMenu` ; `playerScreenHandler`→`inventoryMenu` ; `insertStack(s)`→`getInventory().add(s)` +- Vec3: `squaredDistanceTo(v)`→`distanceToSqr(v)` ; `Vec3d.ofCenter(pos)`→`Vec3.atCenterOf(pos)` +- World/Level: `getOtherEntities(e,box,pred)`→`getEntities(e,box,pred)` ; `getEntity(uuid)` (same, on Level) ; `raycast(ctx)`→`clip(ctx)` ; `spawnEntity(e)`→`addFreshEntity(e)` +- BlockState `state.get(prop)`→`getValue(prop)` ; `BlockPos.offset(dir)`→`relative(dir)` ; `Direction.Type.HORIZONTAL`→`Direction.Plane.HORIZONTAL` ; `rotateYClockwise()`→`getClockWise()` ; `rotateYCounterclockwise()`→`getCounterClockWise()` +- `ChestBlock.CHEST_TYPE`→`ChestBlock.TYPE` ; `ChestBlock.FACING` (same) ; `ScreenHandler.sendContentUpdates()`→`broadcastChanges()` + +## Client / render cheat-sheet (GUI phase — verified) +The source is already written for **render era E5**, so the drawing API mostly matches (it uses `pushMatrix`, +not the old `push`). Core renames: +- `net.minecraft.client.gui.DrawContext` → `net.minecraft.client.gui.GuiGraphics` (`fill(x,y,x2,y2,argb)` is the same) +- `context.getMatrices()` → `context.pose()` — returns `org.joml.Matrix3x2fStack`; `pushMatrix()/translate(x,y)/scale(x,y)/popMatrix()` are JOML, unchanged +- `net.minecraft.util.Identifier` (client refs) → `net.minecraft.resources.Identifier`; `Identifier.of(ns,path)` → `Identifier.fromNamespaceAndPath(ns,path)` +- `net.minecraft.client.MinecraftClient` → `net.minecraft.client.Minecraft` (`getInstance()`, field `level`/`player`, field `gameDirectory`, `hasSingleplayerServer()`, `getSingleplayerServer()`, `getCurrentServer()`) +- NBT file I/O: `NbtCompound`→`CompoundTag` ; `NbtList`→`ListTag` ; `NbtString.of(s)`→`StringTag.valueOf(s)` ; `NbtElement`→`Tag` ; `NbtSizeTracker`→`NbtAccounter` (`unlimitedHeap()`) ; `NbtIo` (same). CompoundTag getters return Optional: `getString/getBoolean/getInt/getCompound/getList(k).ifPresent/orElse` ; `getKeys()`→`keySet()` +- `MinecraftServer.getSavePath(WorldSavePath.X)` → `getWorldPath(LevelResource.X)` ; `getSaveProperties()`→`getWorldData()` ; `ServerData.address`→`ip` +- `@Environment(EnvType.CLIENT)` stays as the Fabric annotation in `common` (Architectury remaps it to NeoForge's `@OnlyIn`). +### E5 input model (verified via javap on the Mojmap merged jar) +The E5 yarn source uses record-based input events. Mojmap uses the SAME model with different names: +- `net.minecraft.client.gui.Click` → `net.minecraft.client.input.MouseButtonEvent` (record: `.x()` double, `.y()` double, `.button()` int) +- `net.minecraft.client.input.KeyInput` → `net.minecraft.client.input.KeyEvent` (record: `.key()`, `.scancode()`, `.modifiers()`) +- `net.minecraft.client.input.CharInput` → `net.minecraft.client.input.CharacterEvent` (record: `.codepoint()`, `.modifiers()`, `.codepointAsString()`) +- `GuiEventListener`/`Screen` sigs: `mouseClicked(MouseButtonEvent, boolean doubled)`, `mouseReleased(MouseButtonEvent)`, `mouseDragged(MouseButtonEvent, double dx, double dy)`, `mouseScrolled(double,double,double,double)` (unchanged), `keyPressed(KeyEvent)`, `charTyped(CharacterEvent)`. + +### `AbstractContainerScreen` (yarn `HandledScreen`) — E5 members (verified) +- fields: `x`→`leftPos`, `y`→`topPos`, `backgroundWidth`→`imageWidth`, `backgroundHeight`→`imageHeight`, `handler`→`menu`, `focusedSlot`→`hoveredSlot`, `titleX/Y`→`titleLabelX/Y`, `playerInventoryTitleX/Y`→`inventoryLabelX/Y` +- render methods: `drawSlot`→`renderSlot(GuiGraphics, Slot, int, int)` ; `drawSlots`→`renderSlots(GuiGraphics, int, int)` ; `renderMain`→`renderContents(GuiGraphics, int, int, float)` ; `drawMouseoverTooltip`→`renderTooltip(GuiGraphics, int, int)` ; `drawBackground`→`renderBg(GuiGraphics, float, int, int)` ; `drawForeground`→`renderLabels(GuiGraphics, int, int)` +- `HandledScreenAccessor`: keep invoker names `getHandler()/getX()/getY()`, retarget `@Accessor` to `menu`/`leftPos`/`topPos`. + +### Screen-input hook = COMMON MIXIN (no Fabric API cross-loader) +The old client used Fabric `ScreenMouseEvents.allowMouseClick/Release/Drag/Scroll`. **Cross-loader decision: inject into `AbstractContainerScreen.mouseClicked/mouseReleased/mouseDragged/mouseScrolled` in the common `GenericContainerScreenMixin`** (return-cancellable via `CallbackInfoReturnable`), dropping the Fabric event bus entirely. Identical behavior on both loaders. keyPressed/mouseScrolled were already mixin-injected. + +### Other verified client renames +- `net.minecraft.client.render.item.ItemRenderState` → `net.minecraft.client.renderer.item.ItemStackRenderState` +- `net.minecraft.client.item.ItemModelManager` → `net.minecraft.client.renderer.item.ItemModelResolver` +- `net.minecraft.client.gl.RenderPipelines` → `net.minecraft.client.renderer.RenderPipelines` +- `net.minecraft.client.render.command.OrderedRenderCommandQueue` → `net.minecraft.client.renderer.OrderedSubmitNodeCollector` +- `GuiGraphics` item/text (all present, standard): `renderItem(ItemStack,x,y[,seed])`, `renderFakeItem(ItemStack,x,y)`, `renderItemDecorations(Font, ItemStack, x, y[, String])`, `drawString(Font, str/Component, x, y, color[, shadow])`, `drawCenteredString(Font, ..., x, y, color)`, `drawWordWrap(Font, FormattedText, x, y, w, color)`. `drawStrokedRectangle(x,y,w,h,color)`→`renderOutline(x,y,w,h,color)`. +- `MinecraftClient.textRenderer` → `Minecraft.font` (field, type `net.minecraft.client.gui.Font`). Field `Minecraft.screen`, `setScreen(Screen)`. +- `Window` (from `client.getWindow()`, `com.mojang.blaze3d.platform.Window`): `getScaleFactor()`→`getGuiScale()` ; `getFramebufferWidth()`→`getWidth()` ; `getFramebufferHeight()`→`getHeight()` ; `getScaledWidth()`→`getGuiScaledWidth()` ; `getScaledHeight()`→`getGuiScaledHeight()` ; `getHandle()` unchanged +- `net.minecraft.text.Text` → `net.minecraft.network.chat.Component` (`Text.translatable`→`Component.translatable`, `Text.literal`→`Component.literal`) +- `net.minecraft.util.Formatting` → `net.minecraft.ChatFormatting` +- `net.minecraft.screen.slot.Slot` → `net.minecraft.world.inventory.Slot` (fields `x`,`y` unchanged) +- `net.minecraft.util.math.MathHelper` → `net.minecraft.util.Mth` +- `net.minecraft.item.Item`/`ItemStack` → `net.minecraft.world.item.Item`/`ItemStack` ; `net.minecraft.registry.Registries.ITEM` → `net.minecraft.core.registries.BuiltInRegistries.ITEM` (`.get(Identifier)`, `Identifier.tryParse`→`Identifier.tryParse` same) +- `net.minecraft.screen.ScreenHandler` → `net.minecraft.world.inventory.AbstractContainerMenu` ; `GenericContainerScreenHandler` → `net.minecraft.world.inventory.ChestMenu` ; `player.currentScreenHandler` → `player.containerMenu` ; `handler.getInventory()`→`ChestMenu.getContainer()` +- `net.minecraft.client.gui.widget.TextFieldWidget` → `net.minecraft.client.gui.components.EditBox` ; `net.minecraft.client.gui.screen.Screen` → `net.minecraft.client.gui.screens.Screen` +- `net.minecraft.client.option.KeyBinding` → `net.minecraft.client.KeyMapping` ; `net.minecraft.client.util.InputUtil` → `com.mojang.blaze3d.platform.InputConstants` +- `net.minecraft.sound.SoundEvents/SoundEvent` → `net.minecraft.sounds.SoundEvents/SoundEvent` ; `SoundCategory` → `net.minecraft.sounds.SoundSource` +- `net.minecraft.util.math.Vec3d`→`net.minecraft.world.phys.Vec3` ; `RotationAxis`→`com.mojang.math.Axis` ; `Direction`→`net.minecraft.core.Direction` ; `BlockPos` (`.offset`→`.relative`) +- Blocks/entities: `net.minecraft.block.*`→`net.minecraft.world.level.block.*` ; `net.minecraft.block.entity.*`→`net.minecraft.world.level.block.entity.*` ; `net.minecraft.block.enums.ChestType`→`net.minecraft.world.level.block.state.properties.ChestType` ; `ChestBlock.getDoubleBlockType`/`ChestType` connect helpers verify per use + +## GUI phase — progress & remaining (as of this session) + +**Committed & GREEN in `common`:** +- Foundation: EditorState, ModTextures, ChestConfigManager, UndoRedoHistory, UiColors, UiTheme. +- Client accessor/invoker mixins (`mixin/client/`): HandledScreenAccessor, ChestLidAccessor, EnderChestLidAccessor, ShulkerAnimationAccessor, CreativeInventoryScreenAccessor, CreativeSlotAccessor, RecipeBookScreenAccessor, RecipeBookWidgetInvoker + `access/LidAnimatorAccess`. +- Widgets: PressAnim, CustomWidget, ToolButtonWidget, ActionIconButtonWidget, WideButtonWidget. +- ModKeyBindings (Architectury `KeyMappingRegistry.register` + `KeyMapping.Category.register(Identifier)`), util/ChestPosStorage. + +**THE WHOLE 28-FILE EDITOR CLUSTER NOW COMPILES GREEN in `common`** (`./gradlew :common:compileJava` BUILD SUCCESSFUL). Migrated with `tools/client-mechanical-rename.sed` (reproducible) + hand refactors: +- `ChestSeparatorsEditor` (hub, all screens, renderers, geometry/layout/session, MagnifierRenderer) — all mechanical renames applied; hub networking → `NetworkManager.canServerReceive/sendToServer` with `Payload.TYPE`. +- `network/ModClientNetworking` — client S2C receivers via `NetworkManager.registerReceiver(Side.S2C, X.TYPE, X.CODEC, (p,ctx)->ctx.queue(...))` (Shulker UUID / lock response / auto-deposit result); `@Environment(CLIENT)`. +- `event/KeyInputHandler` — Architectury `ClientTickEvent.CLIENT_POST`; `consumeClick()`, `options.keyShift.isDown()`; `isModifierPressed()` simplified to `keyMapping.isDown()`. +- `EditorInputHandler` — Fabric `ScreenMouseEvents.allow*` REMOVED; the release/drag/scroll bodies became public `onMouseReleased/onMouseDragged/onMouseScrolled(...)` (click = existing `handleClick`) for the container-screen mixin to call. `setupInputHandlers()` deleted (+ its call site in the editor). +- `AutoDepositAnimator` — all renames done (E5 item render: `updateForTopItem`, `ItemStackRenderState.submit`, `ItemOwner` [was `HeldItemContext`; methods `level()/position()/getVisualRotationYInDegrees()`], `Axis.YP`, `Vec3.atCenterOf`, `ClientLevel.playLocalSound/addParticle`, `state.getValue(ChestBlock.TYPE/FACING)`, `getClockWise/getCounterClockWise`, `ChestLidController.shouldBeOpen`, `camera.position()`, `getMainCamera()`, `getItemModelResolver()`, `OverlayTexture.NO_OVERLAY`). The Fabric `WorldRenderEvents`/`WorldRenderContext` hook was REMOVED; the render logic is now `public static void renderFlights(PoseStack, SubmitNodeCollector)` awaiting a LevelRenderer mixin to call it (Architectury has NO world-render event — verified). + +**Still to do — remaining WIRING (the editor code + the 5 big client mixins are DONE and both jars build GREEN):** +1. ✅ DONE — Big client mixins (`mixin/client/`), registered in the `client` section of `absoluteorder.mixins.json`: + **GenericContainerScreenMixin** (over `AbstractContainerScreen`: init / renderContents [TAIL overlay + HEAD recipe-book normalize] / renderSlots / renderTooltip / renderSlotHighlightBack/Front / renderSlot / keyPressed [KeyMapping.matches] / charTyped / removed / mouseScrolled + NEW `mouseClicked/mouseReleased/mouseDragged` injects forwarding to `editor.inputHandler.*`; cursor via `requestCursor(CursorType.DEFAULT)`), **CreativeInventoryScreenMixin** (`selectTab`/`checkTabClicked`/`checkTabHovering`/keyPressed/charTyped), **InGameHudHotbarLinesMixin** (Gui `renderSlot`/`renderItemHotbar`; `getSelectedSlot()`), **StatusEffectsDisplayMixin** (→ `EffectsInInventory.render`), **ArmorEquipClientMixin** (→ `MultiPlayerGameMode.useItem`, `DataComponents.EQUIPPABLE`, `ChestSeparatorsState.INVENTORY_FILTERS`). The 8 client accessors are now registered too. +2. **`LevelRendererMixin`** — the deferred hard piece: inject into the world's after-entities render pass and call `AutoDepositAnimator.renderFlights(poseStack, submitNodeCollector)`. E5 `LevelRenderer.renderLevel` takes `Matrix4f`s (no PoseStack/collector), so the injection point/target needs research (likely a deeper entity-render method or the level pass that owns the `SubmitNodeCollector`). **Re-add the 3 dropped S2C open-pushes** (chest/shulker/minecart) in the server mixins once client S2C receivers register (see the S2C-send rule). +3. `mixin/WorldMixin` (depends on ChestConfigManager) — add to the `client` section too. +4. Client entrypoints: Fabric `ClientModInitializer` + NeoForge client init → a common `AbsoluteOrderClient.init()` (ModKeyBindings.register, ModClientNetworking.register, KeyInputHandler.register, AutoDepositAnimator.register). Config screen (ModMenu/Cloth), REI/EMI/JEI. + +Client-mixin E5 target names (verified): yarn `HandledScreen.renderMain`→`AbstractContainerScreen.renderContents`; `drawSlots`→`renderSlots`; `drawSlot`→`renderSlot`; `drawMouseoverTooltip`→`renderTooltip`; `drawSlotHighlightBack/Front`→`renderSlotHighlightBack/Front` (private); yarn `GenericContainerScreen`→`ContainerScreen`; `HorseScreen`→`HorseInventoryScreen`; `CreativeInventoryScreen`→`CreativeModeInventoryScreen` (`setSelectedTab`→`selectTab`, `isClickInTab`→`checkTabClicked`, `renderTabTooltipIfHovered`→`checkTabHovering`); `InGameHud`→`Gui` (`renderHotbarItem`→`renderSlot`, `renderHotbar`→`renderItemHotbar`); `StatusEffectsDisplay`→`EffectsInInventory`; `ClientPlayerInteractionManager`→`MultiPlayerGameMode` (`interactItem`→`useItem`); `Element`→`GuiEventListener`, `ClickableWidget`→`AbstractWidget`; `context.setCursor(Cursor.DEFAULT)`→`context.requestCursor(CursorType.DEFAULT)`; `Inventory.selectedSlot`→`getSelectedSlot()`. + +Verified E5 names for the remaining work: SoundEvents fields drop `BLOCK_`/`ENTITY_` prefix (`CHEST_OPEN`, `SHULKER_BOX_OPEN`, `ENDER_CHEST_OPEN`, `ITEM_PICKUP`); `EditBox.setBordered/setResponder/getValue/setValue`; `Slot.getContainerSlot()`; `Block.byItem`; `Minecraft.level`/`.screen`; `BuiltInRegistries.CREATIVE_MODE_TAB` (`.getKey`); `TextFieldWidget`→`EditBox`; `MutableText`→`MutableComponent`; `net.minecraft.registry.tag`→`net.minecraft.tags`. + +## Config screen + recipe-viewer compat — status + +- **Config screen (Cloth Config): DONE, both loaders.** `client/config/AbsoluteOrderConfigScreen.buildScreen(parent)` (categories client/server/hotkeys, `fillKeybindingField`, custom icon entries). Served via Fabric ModMenu (`ModMenuIntegration`) and NeoForge `IConfigScreenFactory` (`NeoForgeClientBootstrap`). Cloth Config is `modImplementation` on both platforms. +- **EMI: DONE, both loaders.** `compat/ChestSeparatorsEmiPlugin` (`@EmiEntrypoint`, auto-scanned on Fabric + NeoForge) — full-screen exclusion zone while the editor is open. EMI is compile-only. +- **REI: Fabric DONE / NeoForge DEFERRED.** `compat/ChestSeparatorsReiPlugin implements REIClientPlugin` (common) + Fabric `rei_client` entrypoint. NeoForge REI discovers plugins via its own `@REIPluginClient` annotation (a different artifact than the fabric REI api used to compile common). **Deliberately deferred**: there is NO REI build for 1.21.11 (Fabric or NeoForge) — the APIs are compile-only and REI cannot be runtime-tested on this snapshot at all. Degrades gracefully: without the NeoForge annotation, REI-on-NeoForge simply wouldn't apply the exclusion zone. **TODO when a 1.21.11 NeoForge REI exists:** add `modCompileOnly` neoforge REI api to the neoforge module + a thin `@REIPluginClient class NeoForgeReiPlugin extends ChestSeparatorsReiPlugin {}` to reuse the common exclusion-zone logic. +- **JEI: not applicable.** The original mod ships no JEI plugin (only EMI + REI); parity requires none. diff --git a/multiloader-26.3/PORT_NOTES.md b/multiloader-26.3/PORT_NOTES.md new file mode 100644 index 0000000..b9a6c0c --- /dev/null +++ b/multiloader-26.3/PORT_NOTES.md @@ -0,0 +1,44 @@ +# Absolute Order fork — Minecraft 26.3 Fabric port candidate + +This module was copied from the **user-tested Minecraft 26.2 fork** after patches 0001–0016. The 26.2 module is intentionally unchanged. The original public repository snapshot supplied by the user had no 26.3 source module. No claim is made that this has already compiled or been tested against Minecraft 26.3. + +## Scope + +- Minecraft **26.3**, Java **25**, **Fabric** client and dedicated server. +- Fork version **2.1.0-fork.1**, original mod ID **chestseparators**, archive basename **AbsoluteOrder**. +- Preserve upstream item filters, custom layouts and translation strings. Previous improvements: auto-deposit protected quantities, live Push preview, filter slot refill, hotbar shift-click prioritization, quantity slider and detents, Ender Chest filter synchronization and expanded container-size handling. +- 26.3 build requires Architectury 22 and updated Fabric API, Fabric Loader, Cloth Config, Mod Menu and REI compile APIs. +- **NeoForge 26.3 is not supported by this port candidate**. The existing 26.2 NeoForge module is unchanged. + +## How to compile in WSL Debian (requires working internet for Gradle dependencies) + +```bash +cd ~/dev/Absolute-Order-Mod/multiloader-26.3 +java -version +./gradlew :common:test :fabric:build --no-daemon +``` + +Expected Fabric release artifact: + +`fabric/build/libs/AbsoluteOrder-2.1.0-fork.1-fabric-mc26.3.jar` + +Don't use a `raw`, `sources`, or `dev` JAR for production. The mod must be present on **both client and server** for all filter synchronization behavior. Remove the upstream Absolute Order JAR first: both have the same `chestseparators` mod ID. Configure matching 26.3 dependencies. + +## Verification status + +- Source copied from v5 fork that the user reported working in 26.2 multiplayer, including 54-slot Ender Chest compatibility. +- 26.3 dependency versions confirmed from Architectury documentation and 26.3 mod releases; code/API compatibility remains **unverified**. +- This environment only has Java 21 and cannot resolve Gradle/Maven artifacts. Full Java 25 compile, tests and gameplay must run on the user's WSL machine. +- Architectury API 22 includes breaking API changes relative to 21.x; fix the first actual Java compiler error before treating the port as buildable. + +## Manual testing before deployment + +1. Launch 26.3 client and separate dedicated Fabric test server with the same compiled fork JAR and matching dependency set. +2. Confirm main-inventory filtered slots refill after all inventory click modes and do not pull deliberately placed hotbar stacks; preserve direct hotbar shift-click routing. +3. Confirm Keep: All and Keep: 1/16/32/64/intermediate quantities and slider detents. +4. Compare Auto Deposit / Push hover preview with actual transfers; verify no item duplication or loss. +5. Verify native 27-slot and 54-slot Ender Chest filter routing and slots beyond 27, both immediate and after reconnect and server restart. +6. Test with two clients, including per-player Ender Chest inventory isolation. +7. Only after passing these, tag and publish your own release and deploy it to LXC 115 with a rollback backup. + +Preserve the upstream MIT LICENSE.txt and original attribution. This is an independent community fork, not an upstream release. diff --git a/multiloader-26.3/build.gradle b/multiloader-26.3/build.gradle new file mode 100644 index 0000000..7c5bae2 --- /dev/null +++ b/multiloader-26.3/build.gradle @@ -0,0 +1,73 @@ +plugins { + // MC 26.x toolchain: MC 26.1 is the first UNOBFUSCATED Minecraft. architectury-loom 1.17 ships a + // dedicated `-no-remap` plugin for this era — the game jar already carries real names, so nothing is + // remapped and there are no Mojang mappings to declare (see the loom neoforge/261 test project). + id 'dev.architectury.loom-no-remap' version '1.17.491' apply false + id 'architectury-plugin' version '3.5.169' + id 'com.gradleup.shadow' version '8.3.6' apply false +} + +architectury { + minecraft = project.minecraft_version +} + +allprojects { + group = rootProject.maven_group + version = rootProject.mod_version +} + +subprojects { + apply plugin: 'dev.architectury.loom-no-remap' + apply plugin: 'architectury-plugin' + apply plugin: 'maven-publish' + + base { + // Publishable jars are "Absolute Order fork 2.1.0"; loader + MC version go in the remapJar classifier. + archivesName = rootProject.archives_name + } + + repositories { + // Cloth Config (config screen) and ModMenu (Fabric config host). + maven { url "https://maven.shedaniel.me/" } + maven { url "https://maven.terraformersmc.com/releases/" } + } + + dependencies { + // MC 26.x ships as an UNOBFUSCATED jar under the com.mojang coordinate, carrying real Mojang names + // (and Parchment-style parameter names) directly — Mojang no longer publishes obfuscation mappings, + // so there is no `mappings` dependency to declare (loom uses the jar's names as-is). + minecraft "com.mojang:minecraft:$rootProject.minecraft_version" + } + + java { + // Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task + // if it is present. + // If you remove this line, sources will not be generated. + withSourcesJar() + + sourceCompatibility = JavaVersion.VERSION_25 + targetCompatibility = JavaVersion.VERSION_25 + } + + tasks.withType(JavaCompile).configureEach { + it.options.release = 25 + } + + // Configure Maven publishing. + publishing { + publications { + mavenJava(MavenPublication) { + artifactId = base.archivesName.get() + from components.java + } + } + + // See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing. + repositories { + // Add repositories to publish to here. + // Notice: This block does NOT have the same function as the block in the top level. + // The repositories here will be used for publishing your artifact, not for + // retrieving dependencies. + } + } +} diff --git a/multiloader-26.3/common/build.gradle b/multiloader-26.3/common/build.gradle new file mode 100644 index 0000000..46c0a81 --- /dev/null +++ b/multiloader-26.3/common/build.gradle @@ -0,0 +1,38 @@ +architectury { + common rootProject.enabled_platforms.split(',') +} + +dependencies { + // We depend on Fabric Loader here to use the Fabric @Environment annotations, + // which get remapped to the correct annotations on each platform. + // Do NOT use other classes from Fabric Loader. + implementation "net.fabricmc:fabric-loader:$rootProject.fabric_loader_version" + + // Architectury API (common). + implementation "dev.architectury:architectury:$rootProject.architectury_api_version" + + // Cloth Config API for the config screen — compile-only here; each platform ships the real impl. + // The me.shedaniel.clothconfig2.api.* classes are platform-agnostic, so the Fabric artifact's API is + // used to compile common. Exclude the fabric loader/api so nothing Fabric-specific leaks in. + compileOnly("me.shedaniel.cloth:cloth-config-fabric:$rootProject.cloth_config_version") { + exclude group: "net.fabricmc" + exclude group: "net.fabricmc.fabric-api" + } + + // Recipe-viewer compat API — compile-only (users provide the runtime mod). REI ships a native 26.3 + // build for both loaders, so its exclusion-zone plugin lives in common and works everywhere. + // EMI is intentionally DROPPED on 26.x: there is no EMI build for 26.x, and its 1.21.1 api jar leaks + // intermediary names (class_437 = Screen) that do not resolve in the unobfuscated no-remap world. + // Re-add ChestSeparatorsEmiPlugin + this dep once EMI publishes a 26.x artifact. + compileOnly("me.shedaniel:RoughlyEnoughItems-api-fabric:$rootProject.rei_version") { + transitive = false + } +} + +// --- autotests (data-layer JUnit) --- +dependencies { + testImplementation platform("org.junit:junit-bom:5.11.4") + testImplementation "org.junit.jupiter:junit-jupiter" + testRuntimeOnly "org.junit.platform:junit-platform-launcher" +} +tasks.named("test") { useJUnitPlatform() } diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/AbsoluteOrder.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/AbsoluteOrder.java new file mode 100644 index 0000000..4326bd2 --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/AbsoluteOrder.java @@ -0,0 +1,20 @@ +package io.github.marcsanzdev.chestseparators; + +import io.github.marcsanzdev.chestseparators.config.GlobalChestConfig; +import io.github.marcsanzdev.chestseparators.network.ModNetworking; +import io.github.marcsanzdev.chestseparators.registry.ChestSeparatorsComponents; + +/** Common (loader-agnostic) entry point, run on every loader from each platform initializer. */ +public final class AbsoluteOrder { + + public static final String MOD_ID = "chestseparators"; + + private AbsoluteOrder() {} + + public static void init() { + // Common bootstrap runs on every loader (both physical sides). + GlobalChestConfig.loadConfig(); + ChestSeparatorsComponents.initialize(); + ModNetworking.init(); + } +} diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/AbsoluteOrderClient.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/AbsoluteOrderClient.java new file mode 100644 index 0000000..fcec71b --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/AbsoluteOrderClient.java @@ -0,0 +1,36 @@ +package io.github.marcsanzdev.chestseparators; + +import dev.architectury.event.events.client.ClientPlayerEvent; +import io.github.marcsanzdev.chestseparators.client.ui.AutoDepositAnimator; +import io.github.marcsanzdev.chestseparators.client.ui.ModKeyBindings; +import io.github.marcsanzdev.chestseparators.data.ChestConfigManager; +import io.github.marcsanzdev.chestseparators.event.KeyInputHandler; +import io.github.marcsanzdev.chestseparators.network.ModClientNetworking; + +/** + * Common (loader-agnostic) client bootstrap, run from each platform's client entry point. Registers the + * keybinds, the client tick/input poll, the S2C receivers and the auto-deposit render/tick hooks, then + * wires the world-join handler that primes the local config and syncs the inventory filters up to the + * server so the Pick Up rule works before the editor is ever opened. + */ +public final class AbsoluteOrderClient { + + private AbsoluteOrderClient() {} + + public static void init() { + ModKeyBindings.register(); + KeyInputHandler.register(); + ModClientNetworking.register(); + AutoDepositAnimator.register(); + + // On joining a world, load the inventory profile into the render cache and push the inventory + // filters to the server so the Pick Up rule works immediately (before the editor is opened). + ClientPlayerEvent.CLIENT_PLAYER_JOIN.register(player -> { + // Create the ready-made presets on first run (no-op afterwards), in a context where the client + // run directory is guaranteed available. + ChestConfigManager.getInstance().seedDefaultPresetsIfNeeded(); + ChestConfigManager.getInstance().loadInventoryProfile(); + ModClientNetworking.sendInventoryFilters(); + }); + } +} diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/ChestSeparatorsState.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/ChestSeparatorsState.java new file mode 100644 index 0000000..7a119b7 --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/ChestSeparatorsState.java @@ -0,0 +1,28 @@ +package io.github.marcsanzdev.chestseparators; + +import io.github.marcsanzdev.chestseparators.data.SlotWhitelist; +import java.util.Map; +import java.util.UUID; +import java.util.concurrent.ConcurrentHashMap; +import net.minecraft.core.BlockPos; + +/** + * Loader-agnostic server-side state, split out of the old Fabric {@code ChestSeparatorsMain} so the + * enforcement logic in {@code common} can reach it without depending on any loader's registration code. + * Both maps are pure runtime state (never persisted): they are rebuilt from client syncs and lock + * requests, and cleared when a player disconnects. + */ +public final class ChestSeparatorsState { + + /** Thread-safe map of chests currently locked for editing, keyed by block position. */ + public static final Map LOCKED_CHESTS = new ConcurrentHashMap<>(); + + /** + * Per-player inventory filters, synced from the client (where they live), used to enforce the + * "Pick Up" rule server-side: filtered inventory slots only accept their item on pickup. Keyed by + * player UUID, then by player-inventory slot index. + */ + public static final Map> INVENTORY_FILTERS = new ConcurrentHashMap<>(); + + private ChestSeparatorsState() {} +} diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/access/IShulkerUUIDProvider.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/access/IShulkerUUIDProvider.java new file mode 100644 index 0000000..fdd89b8 --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/access/IShulkerUUIDProvider.java @@ -0,0 +1,17 @@ +package io.github.marcsanzdev.chestseparators.access; + +import java.util.UUID; + +// Duck interface to expose the internal UUID of a Shulker Box. +// This allows other parts of the codebase to retrieve or modify the unique identifier +// without needing direct access to the modified BlockEntity class. +public interface IShulkerUUIDProvider { + + // Retrieves the UUID associated with this Shulker Box. + // If no UUID is currently assigned, it should generate and store a new one. + UUID getShulkerUUID(); + + // Restores a previously saved UUID into this Shulker Box instance. + // Used when the block is placed back into the world from an ItemStack. + void setShulkerUUID(UUID uuid); +} diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/access/IWhitelistProvider.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/access/IWhitelistProvider.java new file mode 100644 index 0000000..ee329d4 --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/access/IWhitelistProvider.java @@ -0,0 +1,15 @@ +package io.github.marcsanzdev.chestseparators.access; + +import io.github.marcsanzdev.chestseparators.data.SlotWhitelist; +import java.util.Map; + +// Duck interface applied to BlockEntities (and entity containers) to expose their internal whitelist +// data. Loader-agnostic — no Minecraft types, so it moves to common verbatim. +public interface IWhitelistProvider { + + // Retrieves the current map of slot indices to their whitelist configurations. + Map getWhitelists(); + + // Replaces the current whitelist map with a new one and marks the block entity as dirty for saving. + void setWhitelists(Map whitelists); +} diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/access/LidAnimatorAccess.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/access/LidAnimatorAccess.java new file mode 100644 index 0000000..659b505 --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/access/LidAnimatorAccess.java @@ -0,0 +1,13 @@ +package io.github.marcsanzdev.chestseparators.access; + +import net.minecraft.world.level.block.entity.ChestLidController; + +/** + * Shared duck interface exposing a container's private {@link ChestLidController}. Chests and ender chests + * each declare their OWN {@code chestLidController} field, so each container gets its own single-target + * accessor mixin, and both expose the controller through this common interface so the animator code can + * stay container-agnostic. + */ +public interface LidAnimatorAccess { + ChestLidController getLidAnimator(); +} diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/EditorState.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/EditorState.java new file mode 100644 index 0000000..8f3dc7a --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/EditorState.java @@ -0,0 +1,10 @@ +package io.github.marcsanzdev.chestseparators.client; + +// Represents the current state of the Chest Separators GUI. +public enum EditorState { + HIDDEN, // The editor is closed (normal vanilla behavior) + DRAW_LINES, // The classic mode: drawing visual separators (Pencil button) + VIEW_GROUPS, // Viewing existing whitelist groups (light/dark gray overlay) + SELECT_SLOTS, // Creating/modifying a group's slot selection (green overlay) + EDIT_FILTER // In the creative-style menu configuring allowed items +} diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ModTextures.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ModTextures.java new file mode 100644 index 0000000..2fffa54 --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ModTextures.java @@ -0,0 +1,108 @@ +package io.github.marcsanzdev.chestseparators.client; + +import net.minecraft.resources.Identifier; + +public class ModTextures { + + public static final String MOD_ID = "chestseparators"; + + // Smooth (vector-exported, 128px, linear-filtered) toolbar icons. + public static final Identifier ICON_SM_EDIT = Identifier.fromNamespaceAndPath(MOD_ID, "textures/gui/icon_sm_edit.png"); + public static final Identifier ICON_SM_FILTER = Identifier.fromNamespaceAndPath(MOD_ID, "textures/gui/icon_sm_filter.png"); + public static final Identifier ICON_SM_DEPOSIT = Identifier.fromNamespaceAndPath(MOD_ID, "textures/gui/icon_sm_deposit.png"); + public static final Identifier ICON_SM_FILL = Identifier.fromNamespaceAndPath(MOD_ID, "textures/gui/icon_sm_fill.png"); + public static final Identifier ICON_SM_SAVE = Identifier.fromNamespaceAndPath(MOD_ID, "textures/gui/icon_sm_save.png"); + public static final Identifier ICON_SM_COPY = Identifier.fromNamespaceAndPath(MOD_ID, "textures/gui/icon_sm_copy.png"); + public static final Identifier ICON_SM_INV_PRESETS = Identifier.fromNamespaceAndPath(MOD_ID, "textures/gui/icon_sm_inv_presets.png"); + public static final Identifier ICON_SM_CHEST_PRESETS = + Identifier.fromNamespaceAndPath(MOD_ID, "textures/gui/icon_sm_chest_presets.png"); + + // Smooth (vector) filter-editor icons — batch 1 of the full icon redesign. + public static final Identifier ICON_SM_IMPORT = Identifier.fromNamespaceAndPath(MOD_ID, "textures/gui/icon_sm_import.png"); + public static final Identifier ICON_SM_SEARCH = Identifier.fromNamespaceAndPath(MOD_ID, "textures/gui/icon_sm_search.png"); + public static final Identifier ICON_SM_ALLOW_ALL = Identifier.fromNamespaceAndPath(MOD_ID, "textures/gui/icon_sm_allow_all.png"); + public static final Identifier ICON_SM_CLEAR = Identifier.fromNamespaceAndPath(MOD_ID, "textures/gui/icon_sm_clear.png"); + public static final Identifier ICON_SM_MANUAL = Identifier.fromNamespaceAndPath(MOD_ID, "textures/gui/icon_sm_manual.png"); + public static final Identifier ICON_SM_SHIFT = Identifier.fromNamespaceAndPath(MOD_ID, "textures/gui/icon_sm_shift.png"); + public static final Identifier ICON_SM_HOPPER = Identifier.fromNamespaceAndPath(MOD_ID, "textures/gui/icon_sm_hopper.png"); + public static final Identifier ICON_SM_PICKUP = Identifier.fromNamespaceAndPath(MOD_ID, "textures/gui/icon_sm_pickup.png"); + public static final Identifier ICON_SM_TRASH = Identifier.fromNamespaceAndPath(MOD_ID, "textures/gui/icon_sm_trash.png"); + public static final Identifier ICON_SM_CANCEL = Identifier.fromNamespaceAndPath(MOD_ID, "textures/gui/icon_sm_cancel.png"); + public static final Identifier ICON_SM_CHECK = Identifier.fromNamespaceAndPath(MOD_ID, "textures/gui/icon_sm_check.png"); + + // Smooth (vector) edit-layout / group-view / color-picker / presets icons — batch 2. + public static final Identifier ICON_SM_PASTE = Identifier.fromNamespaceAndPath(MOD_ID, "textures/gui/icon_sm_paste.png"); + public static final Identifier ICON_SM_UNDO = Identifier.fromNamespaceAndPath(MOD_ID, "textures/gui/icon_sm_undo.png"); + public static final Identifier ICON_SM_REDO = Identifier.fromNamespaceAndPath(MOD_ID, "textures/gui/icon_sm_redo.png"); + public static final Identifier ICON_SM_AREA_SELECT = Identifier.fromNamespaceAndPath(MOD_ID, "textures/gui/icon_sm_area_select.png"); + public static final Identifier ICON_SM_TRACE_SELECT = + Identifier.fromNamespaceAndPath(MOD_ID, "textures/gui/icon_sm_trace_select.png"); + public static final Identifier ICON_SM_EYEDROPPER = Identifier.fromNamespaceAndPath(MOD_ID, "textures/gui/icon_sm_eyedropper.png"); + + // Smooth (vector) edit-layout tool + tab icons — batch 3. Bases are tinted by state; masks by paint colour. + public static final Identifier ICON_SM_PENCIL = Identifier.fromNamespaceAndPath(MOD_ID, "textures/gui/icon_sm_pencil.png"); + public static final Identifier ICON_SM_BRUSH = Identifier.fromNamespaceAndPath(MOD_ID, "textures/gui/icon_sm_brush.png"); + public static final Identifier ICON_SM_COMBO = Identifier.fromNamespaceAndPath(MOD_ID, "textures/gui/icon_sm_combo.png"); + public static final Identifier ICON_SM_ERASER_AREA = Identifier.fromNamespaceAndPath(MOD_ID, "textures/gui/icon_sm_eraser_area.png"); + public static final Identifier ICON_SM_ERASER_TRACE = + Identifier.fromNamespaceAndPath(MOD_ID, "textures/gui/icon_sm_eraser_trace.png"); + public static final Identifier ICON_SM_PALETTE = Identifier.fromNamespaceAndPath(MOD_ID, "textures/gui/icon_sm_palette.png"); + public static final Identifier ICON_SM_BROOM = Identifier.fromNamespaceAndPath(MOD_ID, "textures/gui/icon_sm_broom.png"); + public static final Identifier ICON_SM_MASK_AREA = Identifier.fromNamespaceAndPath(MOD_ID, "textures/gui/icon_sm_mask_area.png"); + public static final Identifier ICON_SM_MASK_TRACE = Identifier.fromNamespaceAndPath(MOD_ID, "textures/gui/icon_sm_mask_trace.png"); + + // Smooth (vector) misc icons — batch 4 (final): conflict warning + eyedropper cursor (reuses pipette). + public static final Identifier ICON_SM_CONFLICT = Identifier.fromNamespaceAndPath(MOD_ID, "textures/gui/icon_sm_conflict.png"); + + // Pencil tool textures. + public static final Identifier PENCIL_BASE = Identifier.fromNamespaceAndPath(MOD_ID, "textures/gui/pencil_base.png"); + public static final Identifier PENCIL_MASK_AREA = Identifier.fromNamespaceAndPath(MOD_ID, "textures/gui/pencil_mask_area.png"); + public static final Identifier PENCIL_MASK_TRACE = Identifier.fromNamespaceAndPath(MOD_ID, "textures/gui/pencil_mask_trace.png"); + + // Paintbrush tool textures. + public static final Identifier BRUSH_BASE = Identifier.fromNamespaceAndPath(MOD_ID, "textures/gui/brush_base.png"); + public static final Identifier BRUSH_MASK_AREA = Identifier.fromNamespaceAndPath(MOD_ID, "textures/gui/brush_mask_area.png"); + public static final Identifier BRUSH_MASK_TRACE = Identifier.fromNamespaceAndPath(MOD_ID, "textures/gui/brush_mask_trace.png"); + + // Tabs + public static final Identifier ICON_TAB_LINES = Identifier.fromNamespaceAndPath(MOD_ID, "textures/gui/lines.png"); + public static final Identifier ICON_TAB_BG = Identifier.fromNamespaceAndPath(MOD_ID, "textures/gui/backgrounds.png"); + public static final Identifier COMBO_MASK_AREA = Identifier.fromNamespaceAndPath(MOD_ID, "textures/gui/combo_mask_area.png"); + public static final Identifier COMBO_MASK_TRACE = Identifier.fromNamespaceAndPath(MOD_ID, "textures/gui/combo_mask_trace.png"); + + // Static Tool Icons + public static final Identifier ERASER_AREA = Identifier.fromNamespaceAndPath(MOD_ID, "textures/gui/eraser_area.png"); + public static final Identifier ERASER_TRACE = Identifier.fromNamespaceAndPath(MOD_ID, "textures/gui/eraser_trace.png"); + public static final Identifier ICON_COPY = Identifier.fromNamespaceAndPath(MOD_ID, "textures/gui/icon_copy.png"); + public static final Identifier ICON_PASTE = Identifier.fromNamespaceAndPath(MOD_ID, "textures/gui/icon_paste.png"); + public static final Identifier ICON_PALETTE = Identifier.fromNamespaceAndPath(MOD_ID, "textures/gui/icon_palette.png"); + public static final Identifier BTN_WHITELIST = Identifier.fromNamespaceAndPath(MOD_ID, "textures/gui/btn_whitelist.png"); + public static final Identifier BTN_EDIT_LINES = Identifier.fromNamespaceAndPath(MOD_ID, "textures/gui/btn_edit_lines.png"); + public static final Identifier BTN_DEPOSIT = Identifier.fromNamespaceAndPath(MOD_ID, "textures/gui/btn_deposit.png"); + public static final Identifier ICON_TRASH = Identifier.fromNamespaceAndPath(MOD_ID, "textures/gui/icon_trash.png"); + + // Filter UI icons. + public static final Identifier ICON_IMPORT = Identifier.fromNamespaceAndPath(MOD_ID, "textures/gui/icon_import.png"); + public static final Identifier ICON_BACKPACK_FULL = Identifier.fromNamespaceAndPath(MOD_ID, "textures/gui/icon_backpack_full.png"); + public static final Identifier ICON_BACKPACK_EMPTY = Identifier.fromNamespaceAndPath(MOD_ID, "textures/gui/icon_backpack_empty.png"); + public static final Identifier ICON_CURSOR = Identifier.fromNamespaceAndPath(MOD_ID, "textures/gui/icon_cursor.png"); + public static final Identifier ICON_SHIFT = Identifier.fromNamespaceAndPath(MOD_ID, "textures/gui/icon_shift.png"); + public static final Identifier ICON_HOPPER = Identifier.fromNamespaceAndPath(MOD_ID, "textures/gui/icon_hopper.png"); + public static final Identifier ICON_PICKUP = Identifier.fromNamespaceAndPath(MOD_ID, "textures/gui/icon_pickup.png"); + public static final Identifier ICON_AREA_SELECT = Identifier.fromNamespaceAndPath(MOD_ID, "textures/gui/icon_area_select.png"); + public static final Identifier ICON_TRACE_SELECT = Identifier.fromNamespaceAndPath(MOD_ID, "textures/gui/icon_trace_select.png"); + + public static final Identifier ICON_DELETE = Identifier.fromNamespaceAndPath(MOD_ID, "textures/gui/icon_delete.png"); + public static final Identifier ICON_SAVE = Identifier.fromNamespaceAndPath(MOD_ID, "textures/gui/icon_save.png"); + public static final Identifier ICON_CHECK = Identifier.fromNamespaceAndPath(MOD_ID, "textures/gui/icon_check.png"); + public static final Identifier ICON_CANCEL = Identifier.fromNamespaceAndPath(MOD_ID, "textures/gui/icon_cancel.png"); + public static final Identifier ICON_EYEDROPPER = Identifier.fromNamespaceAndPath(MOD_ID, "textures/gui/eyedropper.png"); + public static final Identifier ICON_EYEDROPPER2 = Identifier.fromNamespaceAndPath(MOD_ID, "textures/gui/eyedropper2.png"); + + public static final Identifier ICON_SEARCH = Identifier.fromNamespaceAndPath(MOD_ID, "textures/gui/icon_search.png"); + + public static final Identifier ICON_UNDO = Identifier.fromNamespaceAndPath(MOD_ID, "textures/gui/icon_ctrl_z.png"); + public static final Identifier ICON_REDO = Identifier.fromNamespaceAndPath(MOD_ID, "textures/gui/icon_ctrl_y.png"); + + public static final Identifier ICON_CONFLICT = Identifier.fromNamespaceAndPath("chestseparators", "textures/gui/icon_warning.png"); +} diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/config/AbsoluteOrderConfigScreen.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/config/AbsoluteOrderConfigScreen.java new file mode 100644 index 0000000..d5bd767 --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/config/AbsoluteOrderConfigScreen.java @@ -0,0 +1,368 @@ +package io.github.marcsanzdev.chestseparators.client.config; + +import io.github.marcsanzdev.chestseparators.client.ModTextures; +import io.github.marcsanzdev.chestseparators.client.ui.ModKeyBindings; +import io.github.marcsanzdev.chestseparators.config.GlobalChestConfig; +import java.util.ArrayList; +import java.util.List; +import java.util.function.BiConsumer; +import java.util.function.Consumer; +import me.shedaniel.clothconfig2.api.AbstractConfigListEntry; +import me.shedaniel.clothconfig2.api.ConfigBuilder; +import me.shedaniel.clothconfig2.api.ConfigCategory; +import me.shedaniel.clothconfig2.api.ConfigEntryBuilder; +import net.minecraft.ChatFormatting; +import net.minecraft.client.KeyMapping; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.screens.Screen; +import net.minecraft.network.chat.Component; +import net.minecraft.resources.Identifier; + +/** + * Builds the mod's Cloth Config screen. Loader-agnostic: the Fabric ModMenu integration and the NeoForge + * {@code IConfigScreenFactory} both delegate here so the whole config UI lives in one place. + */ +public final class AbsoluteOrderConfigScreen { + + private AbsoluteOrderConfigScreen() {} + + /** A boolean toggle carrying the mod's icon on the left. {@code key} is the short config suffix. */ + private static IconBooleanListEntry iconToggle( + String key, boolean value, boolean def, Consumer save, Identifier icon) { + return new IconBooleanListEntry( + Component.translatable("config.chestseparators." + key), + value, + def, + save, + Component.translatable("config.chestseparators." + key + ".tooltip"), + icon); + } + + public static Screen buildScreen(Screen parent) { + ConfigBuilder builder = ConfigBuilder.create() + .setParentScreen(parent) + .setTitle(Component.translatable("title.chestseparators.config")); + + // Persist the mod config, flush the key bindings the hotkeys category edited, and save vanilla options. + builder.setSavingRunnable(() -> { + GlobalChestConfig.saveConfig(); + Minecraft.getInstance().options.save(); + KeyMapping.resetMapping(); + }); + ConfigEntryBuilder entryBuilder = builder.entryBuilder(); + + // --- CATEGORY 1: CLIENT / VISUALS & DEFAULTS --- + ConfigCategory clientCategory = + builder.getOrCreateCategory(Component.translatable("config.chestseparators.category.client")); + + // ================= INTERFACE ================= + List toolbarEntries = new ArrayList<>(); + toolbarEntries.add(iconToggle( + "btn_edit_lines", + GlobalChestConfig.instance.btnEditLines, + true, + v -> GlobalChestConfig.instance.btnEditLines = v, + ModTextures.ICON_SM_COMBO)); + toolbarEntries.add(iconToggle( + "btn_filters", + GlobalChestConfig.instance.btnFilters, + true, + v -> GlobalChestConfig.instance.btnFilters = v, + ModTextures.ICON_SM_FILTER)); + toolbarEntries.add(iconToggle( + "show_deposit_button", + GlobalChestConfig.instance.showDepositButton, + true, + v -> GlobalChestConfig.instance.showDepositButton = v, + ModTextures.ICON_SM_FILL)); + toolbarEntries.add(iconToggle( + "btn_fill_from_chest", + GlobalChestConfig.instance.btnFillFromChest, + true, + v -> GlobalChestConfig.instance.btnFillFromChest = v, + ModTextures.ICON_SM_DEPOSIT)); + toolbarEntries.add(iconToggle( + "btn_chest_presets", + GlobalChestConfig.instance.btnChestPresets, + true, + v -> GlobalChestConfig.instance.btnChestPresets = v, + ModTextures.ICON_SM_CHEST_PRESETS)); + toolbarEntries.add(iconToggle( + "btn_inventory_presets", + GlobalChestConfig.instance.btnInventoryPresets, + true, + v -> GlobalChestConfig.instance.btnInventoryPresets = v, + ModTextures.ICON_SM_INV_PRESETS)); + + List interfaceEntries = new ArrayList<>(); + interfaceEntries.add(entryBuilder + .startBooleanToggle( + Component.translatable("config.chestseparators.show_left_panel"), + GlobalChestConfig.instance.showLeftPanel) + .setDefaultValue(true) + .setTooltip(Component.translatable("config.chestseparators.show_left_panel.tooltip")) + .setSaveConsumer(newValue -> GlobalChestConfig.instance.showLeftPanel = newValue) + .build()); + interfaceEntries.add(entryBuilder + .startBooleanToggle( + Component.translatable("config.chestseparators.enable_preview_animation"), + GlobalChestConfig.instance.enablePreviewAnimation) + .setDefaultValue(true) + .setTooltip(Component.translatable("config.chestseparators.enable_preview_animation.tooltip")) + .setSaveConsumer(newValue -> GlobalChestConfig.instance.enablePreviewAnimation = newValue) + .build()); + interfaceEntries.add(entryBuilder + .startBooleanToggle( + Component.translatable("config.chestseparators.show_edit_buttons"), + GlobalChestConfig.instance.showEditButtons) + .setDefaultValue(true) + .setTooltip(Component.translatable("config.chestseparators.show_edit_buttons.tooltip")) + .setSaveConsumer(newValue -> GlobalChestConfig.instance.showEditButtons = newValue) + .build()); + interfaceEntries.add(entryBuilder + .startSubCategory(Component.translatable("config.chestseparators.group.toolbar_buttons"), toolbarEntries) + .setExpanded(false) + .build()); + interfaceEntries.add(entryBuilder + .startBooleanToggle( + Component.translatable("config.chestseparators.close_on_click_outside"), + GlobalChestConfig.instance.closeOnClickOutside) + .setDefaultValue(true) + .setTooltip(Component.translatable("config.chestseparators.close_on_click_outside.tooltip")) + .setSaveConsumer(newValue -> GlobalChestConfig.instance.closeOnClickOutside = newValue) + .build()); + clientCategory.addEntry(entryBuilder + .startSubCategory(Component.translatable("config.chestseparators.group.interface"), interfaceEntries) + .setExpanded(false) + .build()); + + // ================= LAYOUT ================= + List layoutEntries = new ArrayList<>(); + layoutEntries.add(entryBuilder + .startBooleanToggle( + Component.translatable("config.chestseparators.shared_custom_colors"), + GlobalChestConfig.instance.sharedCustomColors) + .setDefaultValue(true) + .setTooltip(Component.translatable("config.chestseparators.shared_custom_colors.tooltip")) + .setSaveConsumer(newValue -> GlobalChestConfig.instance.sharedCustomColors = newValue) + .build()); + layoutEntries.add(new IconIntegerSliderEntry( + Component.translatable("config.chestseparators.line_transparency"), + 0, + 100, + GlobalChestConfig.instance.lineTransparency, + 100, + v -> GlobalChestConfig.instance.lineTransparency = v, + Component.translatable("config.chestseparators.line_transparency.tooltip"), + ModTextures.ICON_SM_PENCIL)); + layoutEntries.add(new IconIntegerSliderEntry( + Component.translatable("config.chestseparators.bg_transparency"), + 0, + 100, + GlobalChestConfig.instance.bgTransparency, + 40, + v -> GlobalChestConfig.instance.bgTransparency = v, + Component.translatable("config.chestseparators.bg_transparency.tooltip"), + ModTextures.ICON_SM_BRUSH)); + clientCategory.addEntry(entryBuilder + .startSubCategory(Component.translatable("config.chestseparators.group.layout"), layoutEntries) + .setExpanded(false) + .build()); + + // ================= FILTERS ================= + // Each default-rule toggle carries the same icon its rule button uses in the filter editor. The third + // rule is shown twice — Hopper (chest filters) and Pick Up (inventory filters) — since they default + // independently even though they share one stored flag. + List filterEntries = new ArrayList<>(); + filterEntries.add(iconToggle( + "default_rule_manual", + GlobalChestConfig.instance.defaultRuleManual, + true, + v -> GlobalChestConfig.instance.defaultRuleManual = v, + ModTextures.ICON_SM_MANUAL)); + filterEntries.add(iconToggle( + "default_rule_shift", + GlobalChestConfig.instance.defaultRuleShift, + true, + v -> GlobalChestConfig.instance.defaultRuleShift = v, + ModTextures.ICON_SM_SHIFT)); + filterEntries.add(iconToggle( + "default_rule_hopper", + GlobalChestConfig.instance.defaultRuleHopper, + true, + v -> GlobalChestConfig.instance.defaultRuleHopper = v, + ModTextures.ICON_SM_HOPPER)); + filterEntries.add(iconToggle( + "default_rule_pickup", + GlobalChestConfig.instance.defaultRulePickup, + true, + v -> GlobalChestConfig.instance.defaultRulePickup = v, + ModTextures.ICON_SM_PICKUP)); + clientCategory.addEntry(entryBuilder + .startSubCategory(Component.translatable("config.chestseparators.group.filters"), filterEntries) + .setExpanded(false) + .build()); + + // ================= MAGNIFIER ================= + List magnifierEntries = new ArrayList<>(); + magnifierEntries.add(entryBuilder + .startBooleanToggle( + Component.translatable("config.chestseparators.magnifier_enabled"), + GlobalChestConfig.instance.magnifierEnabled) + .setDefaultValue(false) + .setTooltip(Component.translatable("config.chestseparators.magnifier_enabled.tooltip")) + .setSaveConsumer(newValue -> GlobalChestConfig.instance.magnifierEnabled = newValue) + .build()); + magnifierEntries.add(entryBuilder + .startEnumSelector( + Component.translatable("config.chestseparators.magnifier_shape"), + GlobalChestConfig.MagnifierShape.class, + GlobalChestConfig.instance.magnifierShape) + .setDefaultValue(GlobalChestConfig.MagnifierShape.CIRCLE) + .setEnumNameProvider(shape -> Component.translatable("config.chestseparators.magnifier_shape." + + ((Enum) shape).name().toLowerCase())) + .setTooltip(Component.translatable("config.chestseparators.magnifier_shape.tooltip")) + .setSaveConsumer(newValue -> GlobalChestConfig.instance.magnifierShape = newValue) + .build()); + magnifierEntries.add(iconToggle( + "magnifier_tab_lines", + GlobalChestConfig.instance.magnifierTabLines, + true, + v -> GlobalChestConfig.instance.magnifierTabLines = v, + ModTextures.ICON_SM_PENCIL)); + magnifierEntries.add(iconToggle( + "magnifier_tab_backgrounds", + GlobalChestConfig.instance.magnifierTabBackgrounds, + false, + v -> GlobalChestConfig.instance.magnifierTabBackgrounds = v, + ModTextures.ICON_SM_BRUSH)); + magnifierEntries.add(iconToggle( + "magnifier_tab_combo", + GlobalChestConfig.instance.magnifierTabCombo, + false, + v -> GlobalChestConfig.instance.magnifierTabCombo = v, + ModTextures.ICON_SM_COMBO)); + clientCategory.addEntry(entryBuilder + .startSubCategory(Component.translatable("config.chestseparators.group.magnifier"), magnifierEntries) + .setExpanded(false) + .build()); + + // Auto-deposit options, collapsed into one sub-category. + List autoDepositEntries = new ArrayList<>(); + autoDepositEntries.add(entryBuilder + .startBooleanToggle( + Component.translatable("config.chestseparators.lock_hotbar_on_reorder"), + GlobalChestConfig.instance.lockHotbarOnReorder) + .setDefaultValue(true) + // Two-line tooltip: a plain first line, then a dimmed clarification underneath. + .setTooltip( + Component.translatable("config.chestseparators.lock_hotbar_on_reorder.tooltip"), + Component.translatable("config.chestseparators.lock_hotbar_on_reorder.tooltip2") + .withStyle(ChatFormatting.DARK_GRAY)) + .setSaveConsumer(newValue -> GlobalChestConfig.instance.lockHotbarOnReorder = newValue) + .build()); + autoDepositEntries.add(entryBuilder + .startBooleanToggle( + Component.translatable("config.chestseparators.auto_deposit_enabled"), + GlobalChestConfig.instance.autoDepositEnabled) + .setDefaultValue(true) + .setTooltip(Component.translatable("config.chestseparators.auto_deposit_enabled.tooltip")) + .setSaveConsumer(newValue -> GlobalChestConfig.instance.autoDepositEnabled = newValue) + .build()); + autoDepositEntries.add(entryBuilder + .startBooleanToggle( + Component.translatable("config.chestseparators.auto_deposit_double_sneak"), + GlobalChestConfig.instance.autoDepositDoubleSneak) + .setDefaultValue(true) + .setTooltip(Component.translatable("config.chestseparators.auto_deposit_double_sneak.tooltip")) + .setSaveConsumer(newValue -> GlobalChestConfig.instance.autoDepositDoubleSneak = newValue) + .build()); + autoDepositEntries.add(entryBuilder + .startIntSlider( + Component.translatable("config.chestseparators.auto_deposit_radius"), + GlobalChestConfig.instance.autoDepositRadius, + 3, + 32) + .setDefaultValue(8) + .setTooltip(Component.translatable("config.chestseparators.auto_deposit_radius.tooltip")) + .setSaveConsumer(newValue -> GlobalChestConfig.instance.autoDepositRadius = newValue) + .build()); + autoDepositEntries.add(entryBuilder + .startBooleanToggle( + Component.translatable("config.chestseparators.auto_deposit_through_walls"), + GlobalChestConfig.instance.autoDepositThroughWalls) + .setDefaultValue(false) + .setTooltip(Component.translatable("config.chestseparators.auto_deposit_through_walls.tooltip")) + .setSaveConsumer(newValue -> GlobalChestConfig.instance.autoDepositThroughWalls = newValue) + .build()); + autoDepositEntries.add(entryBuilder + .startBooleanToggle( + Component.translatable("config.chestseparators.auto_deposit_animation"), + GlobalChestConfig.instance.autoDepositAnimation) + .setDefaultValue(true) + .setTooltip(Component.translatable("config.chestseparators.auto_deposit_animation.tooltip")) + .setSaveConsumer(newValue -> GlobalChestConfig.instance.autoDepositAnimation = newValue) + .build()); + autoDepositEntries.add(entryBuilder + .startBooleanToggle( + Component.translatable("config.chestseparators.auto_deposit_trail"), + GlobalChestConfig.instance.autoDepositTrail) + .setDefaultValue(true) + .setTooltip(Component.translatable("config.chestseparators.auto_deposit_trail.tooltip")) + .setSaveConsumer(newValue -> GlobalChestConfig.instance.autoDepositTrail = newValue) + .build()); + clientCategory.addEntry(entryBuilder + .startSubCategory(Component.translatable("config.chestseparators.group.autodeposit"), autoDepositEntries) + .setExpanded(false) + .build()); + + // --- CATEGORY 2: SERVER / MECHANICS --- + // Server mechanics options are only exposed in singleplayer, where the server and client share a JVM. + if (Minecraft.getInstance().hasSingleplayerServer()) { + ConfigCategory serverCategory = + builder.getOrCreateCategory(Component.translatable("config.chestseparators.category.server")); + + serverCategory.addEntry(entryBuilder + .startBooleanToggle( + Component.translatable("config.chestseparators.expel_invalid_items"), + GlobalChestConfig.instance.expelInvalidItems) + .setDefaultValue(false) + .setTooltip(Component.translatable("config.chestseparators.expel_invalid_items.tooltip")) + .setSaveConsumer(newValue -> GlobalChestConfig.instance.expelInvalidItems = newValue) + .build()); + } + + // --- CATEGORY 3: HOTKEYS --- + ConfigCategory hotkeysCategory = + builder.getOrCreateCategory(Component.translatable("config.chestseparators.category.hotkeys")); + + // NOTE: Cloth's fillKeybindingField reaches into KeyMapping's PRIVATE 'key' field, which is only + // reachable with Cloth's own access-widener applied — and that widener is NOT applied in this Mojmap + // multiloader dev/runtime, so it throws IllegalAccessError (the config screen then fails to open). + // Build the key entry from public KeyMapping API instead (read via saveString, default via + // getDefaultKey, write via setKey) — identical behaviour, and works on Fabric AND Forge with no AW/AT. + BiConsumer addKeyEntry = (keyMapping, translationKey) -> { + com.mojang.blaze3d.platform.InputConstants.Key current = + com.mojang.blaze3d.platform.InputConstants.getKey(keyMapping.saveString()); + hotkeysCategory.addEntry(entryBuilder + .startKeyCodeField(Component.translatable(translationKey), current) + .setDefaultValue(keyMapping.getDefaultKey()) + .setKeySaveConsumer(newKey -> { + keyMapping.setKey(newKey); + KeyMapping.resetMapping(); + }) + .setTooltip(Component.translatable(translationKey + ".tooltip")) + .build()); + }; + + addKeyEntry.accept(ModKeyBindings.toggleMagnifierKey, "config.chestseparators.toggle_magnifier"); + addKeyEntry.accept(ModKeyBindings.autoDepositKey, "config.chestseparators.auto_deposit"); + addKeyEntry.accept(ModKeyBindings.openEditorKey, "config.chestseparators.toggle_preview_panel"); + addKeyEntry.accept(ModKeyBindings.toggleEditButtonsKey, "config.chestseparators.toggle_edit_buttons"); + addKeyEntry.accept(ModKeyBindings.showPanelModifierKey, "config.chestseparators.show_panel_modifier"); + addKeyEntry.accept(ModKeyBindings.pushKey, "config.chestseparators.push"); + addKeyEntry.accept(ModKeyBindings.pullKey, "config.chestseparators.pull"); + + return builder.build(); + } +} diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/config/IconBooleanListEntry.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/config/IconBooleanListEntry.java new file mode 100644 index 0000000..d1d02d5 --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/config/IconBooleanListEntry.java @@ -0,0 +1,59 @@ +package io.github.marcsanzdev.chestseparators.client.config; + +import java.util.Optional; +import java.util.function.Consumer; +import me.shedaniel.clothconfig2.gui.entries.BooleanListEntry; +import net.minecraft.client.gui.GuiGraphicsExtractor; +import net.minecraft.client.renderer.RenderPipelines; +import net.minecraft.network.chat.Component; +import net.minecraft.resources.Identifier; + +/** + * A Cloth Config boolean toggle that draws a 16×16 mod icon at the left of the row, with the label shifted + * right to make room. The right-aligned value/reset buttons keep their place because {@code x + entryWidth} + * is left unchanged. Icons are the 128px smooth line glyphs, so they sample at texture size 128. + */ +public class IconBooleanListEntry extends BooleanListEntry { + + private static final int ICON_SIZE = 16; + private static final int SHIFT = 22; + private static final int TEX = 128; + + private final Identifier icon; + + public IconBooleanListEntry( + Component fieldName, + boolean value, + boolean defaultValue, + Consumer saveConsumer, + Component tooltip, + Identifier icon) { + super( + fieldName, + value, + Component.translatable("text.cloth-config.reset_value"), + () -> defaultValue, + saveConsumer, + () -> Optional.of(new Component[] {tooltip}), + false); + this.icon = icon; + } + + @Override + public void extractRenderState( + GuiGraphicsExtractor graphics, + int index, + int y, + int x, + int entryWidth, + int entryHeight, + int mouseX, + int mouseY, + boolean isHovered, + float delta) { + super.extractRenderState(graphics, index, y, x + SHIFT, entryWidth - SHIFT, entryHeight, mouseX, mouseY, isHovered, delta); + int iconY = y + (entryHeight - ICON_SIZE) / 2; + graphics.blit( + RenderPipelines.GUI_TEXTURED, icon, x, iconY, 0.0F, 0.0F, ICON_SIZE, ICON_SIZE, TEX, TEX, TEX, TEX, -1); + } +} diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/config/IconIntegerSliderEntry.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/config/IconIntegerSliderEntry.java new file mode 100644 index 0000000..872aa3d --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/config/IconIntegerSliderEntry.java @@ -0,0 +1,60 @@ +package io.github.marcsanzdev.chestseparators.client.config; + +import java.util.Optional; +import java.util.function.Consumer; +import me.shedaniel.clothconfig2.gui.entries.IntegerSliderEntry; +import net.minecraft.client.gui.GuiGraphicsExtractor; +import net.minecraft.client.renderer.RenderPipelines; +import net.minecraft.network.chat.Component; +import net.minecraft.resources.Identifier; + +/** An integer slider that draws a 16×16 mod icon at its left, with the row shifted right to make room. */ +public class IconIntegerSliderEntry extends IntegerSliderEntry { + + private static final int ICON_SIZE = 16; + private static final int SHIFT = 22; + private static final int TEX = 128; + + private final Identifier icon; + + public IconIntegerSliderEntry( + Component fieldName, + int min, + int max, + int value, + int defaultValue, + Consumer saveConsumer, + Component tooltip, + Identifier icon) { + super( + fieldName, + min, + max, + value, + Component.translatable("text.cloth-config.reset_value"), + () -> defaultValue, + saveConsumer, + () -> Optional.of(new Component[] {tooltip}), + false); + this.icon = icon; + setTextGetter(v -> Component.literal(v + "%")); + } + + @Override + public void extractRenderState( + GuiGraphicsExtractor graphics, + int index, + int y, + int x, + int entryWidth, + int entryHeight, + int mouseX, + int mouseY, + boolean isHovered, + float delta) { + super.extractRenderState(graphics, index, y, x + SHIFT, entryWidth - SHIFT, entryHeight, mouseX, mouseY, isHovered, delta); + int iconY = y + (entryHeight - ICON_SIZE) / 2; + graphics.blit( + RenderPipelines.GUI_TEXTURED, icon, x, iconY, 0.0F, 0.0F, ICON_SIZE, ICON_SIZE, TEX, TEX, TEX, TEX, -1); + } +} diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/AutoDepositAnimator.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/AutoDepositAnimator.java new file mode 100644 index 0000000..df7c5d9 --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/AutoDepositAnimator.java @@ -0,0 +1,364 @@ +package io.github.marcsanzdev.chestseparators.client.ui; + +import io.github.marcsanzdev.chestseparators.access.LidAnimatorAccess; +import io.github.marcsanzdev.chestseparators.config.GlobalChestConfig; +import io.github.marcsanzdev.chestseparators.mixin.client.ShulkerAnimationAccessor; +import io.github.marcsanzdev.chestseparators.network.AutoDepositResultPayload; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import dev.architectury.event.events.client.ClientTickEvent; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.ChestBlock; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.EnderChestBlockEntity; +import net.minecraft.world.level.block.entity.ShulkerBoxBlockEntity; +import net.minecraft.world.level.block.state.properties.ChestType; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.item.ItemModelResolver; +import net.minecraft.client.Camera; +import net.minecraft.client.renderer.texture.OverlayTexture; +import net.minecraft.client.renderer.SubmitNodeCollector; +import net.minecraft.client.renderer.item.ItemStackRenderState; +import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.client.multiplayer.ClientLevel; +import net.minecraft.world.item.ItemDisplayContext; +import net.minecraft.world.item.ItemStack; +import net.minecraft.core.particles.ParticleTypes; +import net.minecraft.sounds.SoundSource; +import net.minecraft.sounds.SoundEvent; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.network.chat.Component; +import net.minecraft.ChatFormatting; +import net.minecraft.world.entity.ItemOwner; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import com.mojang.math.Axis; +import net.minecraft.world.phys.Vec3; +import net.minecraft.world.level.Level; + +/** + * Renders the auto-deposit feedback: each deposited item flies from the player toward its destination + * chest as a real 3D item model (the same "dropped item" look as pressing Q), rendered in the world + * via {@link #renderFlights} (called from a LevelRenderer mixin with the frame's pose stack and render + * collector). Items follow a gentle arc, spin as they travel, and optionally leave a particle trail. + * + *

The whole animation and the trail are independently toggleable in the config. + */ +public final class AutoDepositAnimator { + + private AutoDepositAnimator() {} + + /** One item in flight: a snapshot stack, fixed world endpoints, start time, and trail bookkeeping. */ + private static final class FlyingItem { + final ItemStack stack; + final Vec3 start; + final Vec3 end; + final long startTime; + long lastParticleMs; + + FlyingItem(ItemStack stack, Vec3 start, Vec3 end, long startTime) { + this.stack = stack; + this.start = start; + this.end = end; + this.startTime = startTime; + this.lastParticleMs = 0L; + } + } + + private static final List FLIGHTS = new ArrayList<>(); + + private static final long DURATION_MS = 1900L; + private static final long STAGGER_MS = 130L; + private static final double ARC_HEIGHT = 1.2; + private static final long TRAIL_INTERVAL_MS = 110L; + private static final int FULL_BRIGHT = 0xF000F0; + + // How long a destination chest stays open after its last item lands, before the lid closes. + private static final long CHEST_DWELL_MS = 250L; + + /** A chest whose lid we forced open: when to close it, and whether it should play open/close sounds. */ + private static final class ChestOpen { + long closeAt; + boolean sound; + } + + /** Chests (and double-chest neighbours) currently held open by the animation, client-side only. */ + private static final Map OPEN_CHESTS = new HashMap<>(); + + public static void register() { + // The flying-item render is driven by a LevelRenderer mixin that calls renderFlights(...) during + // the world's after-entities pass (Architectury has no world-render event, so it is a common mixin + // hook rather than a Fabric event). Only the chest-lid tick is a plain event. + ClientTickEvent.CLIENT_POST.register(client -> tickChests()); + } + + /** Queues animations for a completed auto-deposit (player -> chest). */ + public static void addFlights(List flights) { + addFlights(flights, false); + } + + /** + * Queues animations for a completed transfer. When {@code reverse} is true the items fly from each + * container toward the player (grab); otherwise from the player toward each container (deposit). + * Called on the client thread from networking. + */ + public static void addFlights(List flights, boolean reverse) { + Minecraft client = Minecraft.getInstance(); + if (client.player == null) return; + + // When a container GUI is open (the Pull button), feedback goes ABOVE the interface via the + // editor's status overlay — exactly like the Push button — instead of the action bar behind it. + boolean guiOpen = client.gui.screen() instanceof net.minecraft.client.gui.screens.inventory.AbstractContainerScreen; + io.github.marcsanzdev.chestseparators.client.ui.ChestSeparatorsEditor editor = + io.github.marcsanzdev.chestseparators.client.ui.ChestSeparatorsEditor.getInstance(); + + if (flights.isEmpty()) { + // Reverse = pull from the open chest. Be specific about WHY nothing moved: no inventory filters + // at all vs. filters exist but nothing in the chest matched. Non-reverse = radius auto-deposit. + String key; + if (reverse) { + boolean invHasFilters = !io.github.marcsanzdev.chestseparators.data.ChestConfigManager.getInstance() + .getPlayerInventoryFilters() + .isEmpty(); + key = invHasFilters + ? "message.chestseparators.pull_no_match" + : "message.chestseparators.pull_no_filters"; + } else { + key = "message.chestseparators.auto_deposit_none"; + } + Component noneMsg = Component.translatable(key).withStyle(ChatFormatting.GRAY); + if (guiOpen && editor != null) editor.showStatus(noneMsg, ChatFormatting.GRAY); + else client.player.sendOverlayMessage(noneMsg); + return; + } + + int total = 0; + for (AutoDepositResultPayload.Flight flight : flights) + total += flight.stack().getCount(); + + client.player.playSound(SoundEvents.ITEM_PICKUP, 0.5f, reverse ? 1.0f : 1.4f); + Component doneMsg = Component.translatable( + reverse + ? "message.chestseparators.auto_grab_done" + : "message.chestseparators.auto_deposit_done", + total) + .withStyle(ChatFormatting.GREEN); + + // GUI open: show it above the interface and finish instantly — no world fly-over you can't see. + if (guiOpen) { + if (editor != null) editor.showStatus(doneMsg, ChatFormatting.GREEN); + return; + } + client.player.sendOverlayMessage(doneMsg); + + // The transfer already happened server-side; the flying items are pure cosmetics. + if (!GlobalChestConfig.instance.autoDepositAnimation) return; + + // Items appear to leave/arrive at the player around body height. + Vec3 playerPos = new Vec3(client.player.getX(), client.player.getY() + 1.0, client.player.getZ()); + long now = System.currentTimeMillis(); + + // Track, per container, when its last item leaves/arrives so we know when to close the lid. + Map lastArrival = new HashMap<>(); + int index = 0; + for (AutoDepositResultPayload.Flight flight : flights) { + long startTime = now + (long) index * STAGGER_MS; + Vec3 chest = Vec3.atCenterOf(flight.target()); + Vec3 start = reverse ? chest : playerPos; + Vec3 end = reverse ? playerPos : chest; + FLIGHTS.add(new FlyingItem(flight.stack(), start, end, startTime)); + lastArrival.merge(flight.target(), startTime + DURATION_MS, Math::max); + index++; + } + + // Open every destination container so the player sees where items are headed. + ClientLevel world = client.level; + if (world != null) { + for (Map.Entry entry : lastArrival.entrySet()) { + openContainer(world, entry.getKey(), entry.getValue() + CHEST_DWELL_MS); + } + } + } + + // Plays the opening animation of whatever container sits at the position: chests and ender chests + // raise their lid, shulker boxes run their open animation. Containers without an animation (e.g. + // barrels, or a minecart whose target maps to an empty block) are skipped silently. + private static void openContainer(ClientLevel world, BlockPos pos, long closeAt) { + BlockEntity be = world.getBlockEntity(pos); + + if (be instanceof LidAnimatorAccess lid) { + boolean firstOpen = !OPEN_CHESTS.containsKey(pos); + lid.getLidAnimator().shouldBeOpen(true); + markOpen(pos, closeAt, true); + if (firstOpen) playContainerSound(world, pos, openSoundFor(be)); + + // Open the other half of a double chest in sync (silently, so the sound plays once). + BlockPos neighbor = doubleNeighbor(world, pos); + if (neighbor != null && world.getBlockEntity(neighbor) instanceof LidAnimatorAccess neighborLid) { + neighborLid.getLidAnimator().shouldBeOpen(true); + markOpen(neighbor, closeAt, false); + } + } else if (be instanceof ShulkerAnimationAccessor shulker) { + boolean firstOpen = !OPEN_CHESTS.containsKey(pos); + shulker.setAnimationStage(ShulkerBoxBlockEntity.AnimationStatus.OPENING); + markOpen(pos, closeAt, true); + if (firstOpen) playContainerSound(world, pos, SoundEvents.SHULKER_BOX_OPEN); + } + } + + private static void markOpen(BlockPos pos, long closeAt, boolean sound) { + ChestOpen state = OPEN_CHESTS.computeIfAbsent(pos, k -> new ChestOpen()); + state.closeAt = Math.max(state.closeAt, closeAt); + state.sound = state.sound || sound; + } + + private static void tickChests() { + if (OPEN_CHESTS.isEmpty()) return; + ClientLevel world = Minecraft.getInstance().level; + if (world == null) { + OPEN_CHESTS.clear(); + return; + } + long now = System.currentTimeMillis(); + Iterator> it = OPEN_CHESTS.entrySet().iterator(); + while (it.hasNext()) { + Map.Entry entry = it.next(); + if (now < entry.getValue().closeAt) continue; + closeContainer(world, entry.getKey(), entry.getValue().sound); + it.remove(); + } + } + + private static void closeContainer(ClientLevel world, BlockPos pos, boolean playSound) { + BlockEntity be = world.getBlockEntity(pos); + if (be instanceof LidAnimatorAccess lid) { + lid.getLidAnimator().shouldBeOpen(false); + if (playSound) playContainerSound(world, pos, closeSoundFor(be)); + } else if (be instanceof ShulkerAnimationAccessor shulker) { + shulker.setAnimationStage(ShulkerBoxBlockEntity.AnimationStatus.CLOSING); + if (playSound) playContainerSound(world, pos, SoundEvents.SHULKER_BOX_CLOSE); + } + } + + private static SoundEvent openSoundFor(BlockEntity be) { + return be instanceof EnderChestBlockEntity ? SoundEvents.ENDER_CHEST_OPEN : SoundEvents.CHEST_OPEN; + } + + private static SoundEvent closeSoundFor(BlockEntity be) { + return be instanceof EnderChestBlockEntity + ? SoundEvents.ENDER_CHEST_CLOSE + : SoundEvents.CHEST_CLOSE; + } + + private static BlockPos doubleNeighbor(ClientLevel world, BlockPos pos) { + BlockState state = world.getBlockState(pos); + if (!(state.getBlock() instanceof ChestBlock)) return null; + ChestType type = state.getValue(ChestBlock.TYPE); + if (type == ChestType.SINGLE) return null; + Direction facing = state.getValue(ChestBlock.FACING); + Direction neighborDir = type == ChestType.LEFT ? facing.getClockWise() : facing.getCounterClockWise(); + return pos.relative(neighborDir); + } + + private static void playContainerSound(ClientLevel world, BlockPos pos, SoundEvent sound) { + world.playLocalSound( + pos.getX() + 0.5, + pos.getY() + 0.5, + pos.getZ() + 0.5, + sound, + SoundSource.BLOCKS, + 0.5f, + world.getRandom().nextFloat() * 0.1f + 0.9f, + false); + } + + /** + * Draws every in-flight item for the current frame. Called from the world-render mixin during the + * after-entities pass, which supplies the frame's {@link PoseStack} and the render {@link + * SubmitNodeCollector} (Architectury has no world-render event, so this is a common mixin hook). + */ + public static void renderFlights(PoseStack matrices, SubmitNodeCollector queue) { + if (FLIGHTS.isEmpty()) return; + + Minecraft client = Minecraft.getInstance(); + ClientLevel world = client.level; + if (world == null || client.player == null || matrices == null || queue == null) { + FLIGHTS.clear(); + return; + } + + long now = System.currentTimeMillis(); + Camera camera = client.gameRenderer.mainCamera(); + Vec3 camPos = camera.position(); + ItemModelResolver modelManager = client.getItemModelResolver(); + boolean trail = GlobalChestConfig.instance.autoDepositTrail; + + Iterator it = FLIGHTS.iterator(); + while (it.hasNext()) { + FlyingItem flight = it.next(); + long age = now - flight.startTime; + if (age < 0) continue; // staggered start not reached yet + double t = age / (double) DURATION_MS; + if (t >= 1.0) { + it.remove(); + continue; + } + + double ease = t * t * (3.0 - 2.0 * t); // smoothstep + Vec3 pos = lerp(flight.start, flight.end, ease).add(0.0, Math.sin(Math.PI * t) * ARC_HEIGHT, 0.0); + + if (trail && now - flight.lastParticleMs >= TRAIL_INTERVAL_MS) { + world.addParticle(ParticleTypes.END_ROD, pos.x, pos.y, pos.z, 0.0, 0.0, 0.0); + flight.lastParticleMs = now; + } + + // Build the dropped-item (GROUND) model for this stack at its current position. A fresh + // state is required per item: the render command queue is deferred, so a shared/reused + // state would be mutated before it is drawn, corrupting every item but the last. + ItemStackRenderState renderState = new ItemStackRenderState(); + ItemOwner heldContext = heldContextAt(world, pos); + modelManager.updateForTopItem(renderState, flight.stack, ItemDisplayContext.GROUND, world, heldContext, 0); + if (renderState.isEmpty()) continue; + + float spin = (age * 0.18f) % 360.0f; + + // Light the flying item with the world's block/sky light at its position (like a real dropped + // item) so it blends with the ambient lighting of the moment, instead of always full-bright. + int packedLight = net.minecraft.util.LightCoordsUtil.getLightCoords( + world, net.minecraft.core.BlockPos.containing(pos)); + + matrices.pushPose(); + matrices.translate(pos.x - camPos.x, pos.y - camPos.y, pos.z - camPos.z); + matrices.rotate(Axis.YP.rotationDegrees(spin)); + matrices.scale(1.25f, 1.25f, 1.25f); + renderState.submit(matrices, queue, packedLight, OverlayTexture.NO_OVERLAY, 0); + matrices.popPose(); + } + } + + private static ItemOwner heldContextAt(Level world, Vec3 pos) { + return new ItemOwner() { + @Override + public Level level() { + return world; + } + + @Override + public Vec3 position() { + return pos; + } + + @Override + public float getVisualRotationYInDegrees() { + return 0.0f; + } + }; + } + + private static Vec3 lerp(Vec3 a, Vec3 b, double t) { + return new Vec3(a.x + (b.x - a.x) * t, a.y + (b.y - a.y) * t, a.z + (b.z - a.z) * t); + } +} diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/ChestSeparatorsEditor.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/ChestSeparatorsEditor.java new file mode 100644 index 0000000..45ca9a9 --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/ChestSeparatorsEditor.java @@ -0,0 +1,2137 @@ +package io.github.marcsanzdev.chestseparators.client.ui; + +import com.mojang.blaze3d.platform.InputConstants; +import io.github.marcsanzdev.chestseparators.access.IWhitelistProvider; +import io.github.marcsanzdev.chestseparators.client.EditorState; +import io.github.marcsanzdev.chestseparators.client.ModTextures; +import io.github.marcsanzdev.chestseparators.client.ui.screens.ScreenColorPicker; +import io.github.marcsanzdev.chestseparators.client.ui.screens.ScreenDrawLines; +import io.github.marcsanzdev.chestseparators.client.ui.screens.ScreenEditFilter; +import io.github.marcsanzdev.chestseparators.client.ui.screens.ScreenViewGroups; +import io.github.marcsanzdev.chestseparators.client.ui.widgets.ToolButtonWidget; +import io.github.marcsanzdev.chestseparators.config.GlobalChestConfig; +import io.github.marcsanzdev.chestseparators.data.ChestConfigManager; +import io.github.marcsanzdev.chestseparators.data.SlotWhitelist; +import io.github.marcsanzdev.chestseparators.mixin.client.HandledScreenAccessor; +import io.github.marcsanzdev.chestseparators.util.ChestPosStorage; +import java.util.*; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiGraphicsExtractor; +import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen; +import net.minecraft.client.gui.screens.inventory.InventoryScreen; +import net.minecraft.client.gui.screens.inventory.ShulkerBoxScreen; +import net.minecraft.client.gui.components.EditBox; +import net.minecraft.world.item.*; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.inventory.Slot; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.network.chat.Component; +import net.minecraft.ChatFormatting; +import net.minecraft.core.BlockPos; +import net.minecraft.util.Mth; + +public class ChestSeparatorsEditor { + + private static ChestSeparatorsEditor activeInstance; + + public static ChestSeparatorsEditor getInstance() { + return activeInstance; + } + + public EditorSessionData getSession() { + return this.session; + } + + public final AbstractContainerScreen screen; + public final HandledScreenAccessor accessor; + + public static EditorSessionData activeSession = new EditorSessionData(); + public final EditorSessionData session = activeSession; + public EditorGeometry geometry; + public EditorRenderer renderer; + public EditorInputHandler inputHandler; + public EditorLayout layout; + + public ScreenViewGroups screenViewGroups; + public ScreenDrawLines screenDrawLines; + public ScreenColorPicker screenColorPicker; + public ScreenEditFilter screenEditFilter; + + public ToolButtonWidget entryButton; + public ToolButtonWidget whitelistButton; + public ToolButtonWidget depositButton; + public ToolButtonWidget fillButton; + public ToolButtonWidget presetsButton; + public ToolButtonWidget chestPresetsButton; + public final io.github.marcsanzdev.chestseparators.client.ui.screens.PresetsMenu presetsMenu = + new io.github.marcsanzdev.chestseparators.client.ui.screens.PresetsMenu(this); + public EditBox searchBox; + public EditBox whitelistSearchBox; + + public boolean isHoveringDeposit = false; + public boolean isHoveringFill = false; + public boolean depositPreviewShift = false; + public boolean suspendDepositPreview = false; + public long depositClickTime = 0; + public long fillClickTime = 0; + public final Map previewSourceRemaining = new HashMap<>(); + public final Map previewTargetIncoming = new HashMap<>(); + + public static final int TOOL_ERASER_ID = -1; + + public boolean hasEditorLock = false; + + public boolean colorPickerModified = false; + public int restoreColorIndex = -1; + + // Slots changed by the most recent undo/redo, blinked briefly to show what happened. + public Map undoHighlights = new HashMap<>(); + public long undoHighlightStart = 0; + + public ChestSeparatorsEditor(AbstractContainerScreen screen) { + this.screen = screen; + this.accessor = (HandledScreenAccessor) screen; + activeInstance = this; + } + + public void init() { + + // Determine the editor target up-front so geometry/layout (which count the editable slots) are + // computed for the right slot set. The creative screen counts as a player-inventory context too + // (its inventory tab shows the real player inventory). + session.isPlayerInventory = isInventoryContextScreen(this.screen); + + this.layout = new EditorLayout(); + this.geometry = new EditorGeometry(session, accessor); + this.layout.update(screen, accessor, getSidebarYOffset()); + + this.renderer = new EditorRenderer(this, session, layout, screen, accessor); + this.inputHandler = new EditorInputHandler(this, session, geometry, layout, screen, accessor); + + this.screenViewGroups = new ScreenViewGroups(this); + this.screenViewGroups.init(); + + this.screenDrawLines = new ScreenDrawLines(this); + this.screenDrawLines.init(); + + this.screenColorPicker = new ScreenColorPicker(this); + this.screenColorPicker.init(); + + this.screenEditFilter = new ScreenEditFilter(this); + this.screenEditFilter.init(); + + session.isInventoryScreenContext = isInventoryContextScreen(this.screen); + session.isPlayerInventory = session.isInventoryScreenContext; + + // The survival inventory screen has no container context: clear any stale chest data left in + // ChestPosStorage. In a chest screen we keep the chest context so the edit target can toggle. + session.currentChestPos = session.isInventoryScreenContext ? null : ChestPosStorage.lastClickedPos; + session.currentDimension = ChestPosStorage.lastClickedDimension; + session.isEntityChest = !session.isInventoryScreenContext && ChestPosStorage.isEntityOpened; + session.isMinecartChest = session.isEntityChest && ChestPosStorage.isMinecartEntity; + session.currentEntityUUID = session.isInventoryScreenContext ? null : ChestPosStorage.lastClickedEntityUUID; + session.isEnderChest = false; + + session.isShulkerBox = !session.isInventoryScreenContext && this.screen instanceof ShulkerBoxScreen; + session.currentShulkerUUID = session.isInventoryScreenContext ? null : ChestPosStorage.lastOpenedShulkerUUID; + + // Consume the interactBlock -> screen-init handoff: the values now live in the session, so clear + // the shared storage here (on read) instead of in the screen's removed(). Clearing on removed() + // races with the NEXT container: interactBlock(B) sets the position, then the OLD screen's + // removed() would null it before B's init reads it, leaving currentChestPos == null and silently + // dropping B's saves. Clearing on read keeps leak-prevention without the race. + ChestPosStorage.lastClickedPos = null; + ChestPosStorage.lastClickedEntityUUID = null; + ChestPosStorage.lastOpenedShulkerUUID = null; + ChestPosStorage.isEntityOpened = false; + ChestPosStorage.isMinecartEntity = false; + + ChestConfigManager.getInstance().loadWorldPalette(); + loadConfigForCurrentTarget(); + // Ender Chest filters are stored on this client, but shift-click is server-side. Attach + // them to the live GUI container and send them to the server whenever it opens, including + // after relog; dynamically sized inventories need no fixed 27/54-slot assumptions. + if (session.isEnderChest) { + syncClientInventoryWhitelists(ChestConfigManager.getInstance().chestOnlyWhitelists()); + sendWhitelistToServer(); + } + requestChestWhitelistsIfNeeded(); + + int x = accessor.getX(); + int y = accessor.getY(); + int bgWidth = accessor.getBackgroundWidth(); + + this.entryButton = new io.github.marcsanzdev.chestseparators.client.ui.widgets.ToolButtonWidget( + x + bgWidth - 22, + y - 22, + io.github.marcsanzdev.chestseparators.client.ModTextures.BTN_EDIT_LINES, + Component.translatable("tooltip.chestseparators.edit_mode").getString(), + () -> { + toggleState(EditorState.DRAW_LINES); + playClickSound(1.0f); + }); + + this.whitelistButton = new io.github.marcsanzdev.chestseparators.client.ui.widgets.ToolButtonWidget( + x + bgWidth - 44, + y - 22, + io.github.marcsanzdev.chestseparators.client.ModTextures.BTN_WHITELIST, + Component.translatable("tooltip.chestseparators.whitelist_mode").getString(), + () -> { + boolean isFilterState = (session.currentState == EditorState.VIEW_GROUPS + || session.currentState == EditorState.SELECT_SLOTS + || session.currentState == EditorState.EDIT_FILTER); + + if (isFilterState) { + toggleState(EditorState.HIDDEN); + playClickSound(1.0f); + } else { + if (session.currentChestPos != null && !session.isEntityChest && !session.isShulkerBox) { + if (dev.architectury.networking.NetworkManager.canServerReceive( + io.github.marcsanzdev.chestseparators.network.EditorLockRequestPayload.TYPE)) { + dev.architectury.networking.NetworkManager.sendToServer( + new io.github.marcsanzdev.chestseparators.network.EditorLockRequestPayload( + session.currentChestPos, true)); + } else { + toggleState(EditorState.VIEW_GROUPS); + playClickSound(1.0f); + } + } else { + toggleState(EditorState.VIEW_GROUPS); + playClickSound(1.0f); + } + } + }); + + // PUSH items into the chest. Works from every editor screen (not just the closed editor). + this.depositButton = new ToolButtonWidget(0, 0, ModTextures.BTN_DEPOSIT, "", () -> { + this.depositClickTime = System.currentTimeMillis(); + + executeDeposit(isShiftDown()); + playClickSound(1.2f); + }); + + // PULL items from the chest. Shift also pulls unfiltered items into free inventory space. + this.fillButton = new ToolButtonWidget( + 0, + 0, + ModTextures.ICON_BACKPACK_FULL, + Component.translatable("tooltip.chestseparators.pull_from_chest").getString(), + () -> { + this.fillClickTime = System.currentTimeMillis(); + requestFillFromOpenChest(isShiftDown()); + }); + + // "Inventory presets" menu opener: a top icon available in any editor context. + this.presetsButton = new ToolButtonWidget( + 0, + 0, + ModTextures.ICON_SAVE, + Component.translatable("tooltip.chestseparators.desc.presets").getString(), + () -> { + presetsMenu.resetView(); + boolean openingSame = session.isPresetsMenuOpen && !session.presetsMenuChestMode; + session.presetsMenuChestMode = false; + session.isPresetsMenuOpen = !openingSame; + // Only one of layout/filters/presets may be selected at a time: opening presets + // closes any open layout or filter sub-screen. + if (session.isPresetsMenuOpen && session.currentState != EditorState.HIDDEN) { + toggleState(EditorState.HIDDEN); + } + playClickSound(1.0f); + }); + + // "Chest presets" menu opener: independent from inventory presets, only when a chest is open. + this.chestPresetsButton = new ToolButtonWidget( + 0, + 0, + ModTextures.ICON_COPY, + Component.translatable("tooltip.chestseparators.desc.chest_presets").getString(), + () -> { + presetsMenu.resetView(); + boolean openingSame = session.isPresetsMenuOpen && session.presetsMenuChestMode; + session.presetsMenuChestMode = true; + session.isPresetsMenuOpen = !openingSame; + if (session.isPresetsMenuOpen && session.currentState != EditorState.HIDDEN) { + toggleState(EditorState.HIDDEN); + } + playClickSound(1.0f); + }); + + // Smooth vector-exported icons (128px, linear-filtered via .mcmeta) for the toolbar. They are + // single-color white glyphs tinted by the button state (light-gray / accent blue). + ToolButtonWidget[] toolbarBtns = { + this.entryButton, this.whitelistButton, this.depositButton, + this.fillButton, this.presetsButton, this.chestPresetsButton + }; + net.minecraft.resources.Identifier[] toolbarIcons = { + // Edit-layout reuses the combo icon (crossed pincel + brocha) — same meaning, same glyph. + // Deposit = PUSH items into the chest = UP arrow (ICON_SM_FILL); fill = PULL items out of the + // chest into your inventory = DOWN arrow (ICON_SM_DEPOSIT). Matches the chest-above/inventory- + // below mental model. + ModTextures.ICON_SM_COMBO, ModTextures.ICON_SM_FILTER, ModTextures.ICON_SM_FILL, + ModTextures.ICON_SM_DEPOSIT, ModTextures.ICON_SM_INV_PRESETS, ModTextures.ICON_SM_CHEST_PRESETS + }; + for (int i = 0; i < toolbarBtns.length; i++) { + toolbarBtns[i].baseIcon = toolbarIcons[i]; + toolbarBtns[i].maskIcon = null; + toolbarBtns[i].texSize = 128; + toolbarBtns[i].tintByState = true; + } + + // Toolbar positioning is now handled per-frame by EditorRenderer#renderToolbar, which docks the + // visible icons into a vertical column on the right edge of the container GUI (adaptive to how + // many are enabled in the config). The buttons keep their constructor positions until first render. + + session.allGameItems.clear(); + Minecraft client = Minecraft.getInstance(); + + if (client.level != null) { + // Read the survival item set from the already-built creative search group. + // + // We must NOT call CreativeModeTabs.updateDisplayContext here. That rebuilds the GLOBAL creative + // display context, and because we do not also reload the vanilla creative SearchManager index, + // it corrupts that index so the creative-inventory search returns zero results for every query. + // The display context is shared across all screens, so calling it when opening ANY container + // (a chest, a barrel, the inventory...) would break creative search for the rest of the session. + // Reading getDisplayStacks() below does not rebuild anything; the context is already populated by + // vanilla on world join / resource reload. + CreativeModeTab searchGroup = CreativeModeTabs.searchTab(); + if (searchGroup != null) { + for (ItemStack stack : searchGroup.getDisplayItems()) { + Item item = stack.getItem(); + if (item != Items.AIR && !isNonSurvivalItem(item) && !session.allGameItems.contains(item)) { + session.allGameItems.add(item); + } + } + } + + // Fallback: if the creative display context has not been built yet (rare — e.g. first open before + // vanilla populated it), derive the set straight from the item registry so the filter editor is + // never empty. + if (session.allGameItems.isEmpty()) { + for (Item item : net.minecraft.core.registries.BuiltInRegistries.ITEM) { + if (item != Items.AIR && !isNonSurvivalItem(item)) session.allGameItems.add(item); + } + } + } + + session.filteredItems.clear(); + session.filteredItems.addAll(session.allGameItems); + + int w = 240; + int h = 200; + int guiX = (screen.width - w) / 2; + int guiY = (screen.height - h) / 2; + + session.availableTabs.clear(); + for (int i = 0; i < 16; i++) { + session.availableTabs.add(null); + } + + EditorSessionData.CreativeTabInfo chestTab = new EditorSessionData.CreativeTabInfo( + Component.translatable("itemGroup.chestseparators.chest_and_inventory"), + new ItemStack(net.minecraft.world.level.block.Blocks.CHEST), + null, + false, + true); + session.availableTabs.set(12, chestTab); + + java.util.List modTabs = new java.util.ArrayList<>(); + net.minecraft.core.registries.BuiltInRegistries.CREATIVE_MODE_TAB.forEach(group -> { + net.minecraft.resources.Identifier id = net.minecraft.core.registries.BuiltInRegistries.CREATIVE_MODE_TAB.getKey(group); + if (id == null) return; + String path = id.getPath(); + + if (path.equals("spawn_eggs") + || path.equals("inventory") + || path.equals("hotbar") + || path.equals("op_blocks")) return; + boolean isSearch = path.equals("search"); + EditorSessionData.CreativeTabInfo tab = new EditorSessionData.CreativeTabInfo( + group.getDisplayName(), group.getIconItem(), group, isSearch, false); + + if (path.equals("building_blocks")) session.availableTabs.set(0, tab); + else if (path.equals("colored_blocks")) session.availableTabs.set(1, tab); + else if (path.equals("natural_blocks")) session.availableTabs.set(2, tab); + else if (path.equals("functional_blocks")) session.availableTabs.set(3, tab); + else if (path.equals("redstone_blocks")) session.availableTabs.set(4, tab); + else if (isSearch) session.availableTabs.set(7, tab); + else if (path.equals("tools") || path.equals("tools_and_utilities")) session.availableTabs.set(8, tab); + else if (path.equals("combat")) session.availableTabs.set(9, tab); + else if (path.equals("food_and_drinks") || path.equals("food_and_drink")) + session.availableTabs.set(10, tab); + else if (path.equals("ingredients")) session.availableTabs.set(11, tab); + else { + modTabs.add(tab); + } + }); + session.availableTabs.addAll(modTabs); + + int firstValidTab = 0; + for (int i = 0; i < session.availableTabs.size(); i++) { + if (session.availableTabs.get(i) != null) { + firstValidTab = i; + break; + } + } + switchCreativeTab(firstValidTab); + + this.searchBox = new EditBox( + Minecraft.getInstance().font, + guiX + 10, + guiY + 10, + 100, + 12, + Component.translatable("gui.chestseparators.search")); + this.searchBox.setBordered(false); + this.searchBox.setMaxLength(50); + this.searchBox.setResponder(text -> { + if (!session.availableTabs.get(session.currentCreativeTabIndex).isSearchTab) return; + switchCreativeTab(session.currentCreativeTabIndex); + }); + + this.whitelistSearchBox = new EditBox( + Minecraft.getInstance().font, + guiX, + guiY, + 100, + 12, + Component.translatable("gui.chestseparators.search")); + this.whitelistSearchBox.setBordered(false); + this.whitelistSearchBox.setMaxLength(50); + this.whitelistSearchBox.setResponder(text -> { + session.listScrollY = 0f; + updateWhitelistSearchCache(); + }); + // Mouse routing is done by the common GenericContainerScreenMixin, which forwards + // clicked/released/dragged/scrolled to inputHandler; no per-screen event registration needed. + } + + public void onClose() { + releaseLock(); + ChestConfigManager.getInstance().clearCurrentConfig(); + ChestConfigManager.getInstance().getCurrentWhitelists().clear(); + + ChestPosStorage.lastOpenedShulkerUUID = null; + session.isColorPickerOpen = false; + activeSession = new EditorSessionData(); + org.lwjgl.sdl.SDLMouse.SDL_ShowCursor(); + } + + public void render(GuiGraphicsExtractor context, int mouseX, int mouseY, float delta) { + if (renderer != null) renderer.render(context, mouseX, mouseY, delta); + } + + /** + * Loads the working maps for the current screen: the container's config (chest variants) plus the + * player inventory profile mirrored at offset keys, so both are edited simultaneously. + */ + private void loadConfigForCurrentTarget() { + ChestConfigManager manager = ChestConfigManager.getInstance(); + + // 1. Container portion (clears the working maps). The inventory screen has no container. + if (session.isInventoryScreenContext) { + manager.clearCurrentConfig(); + manager.getCurrentWhitelists().clear(); + } else if (session.isShulkerBox && session.currentShulkerUUID != null) { + manager.loadShulkerConfig(session.currentShulkerUUID); + } else if (session.isEntityChest && session.currentEntityUUID != null) { + manager.loadEntityConfig(session.currentEntityUUID); + } else if (session.currentChestPos != null && Minecraft.getInstance().level != null) { + if (Minecraft.getInstance() + .level + .getBlockState(session.currentChestPos) + .getBlock() + == Blocks.ENDER_CHEST) { + session.isEnderChest = true; + manager.loadEnderConfig(); + } else { + manager.loadConfig(session.currentChestPos, session.currentDimension); + } + } + + // 2. Player inventory portion, mirrored into the working maps at offset keys. + manager.loadInventoryProfile(); + manager.mirrorInventoryIntoCurrent(); + } + + /** Fetches the chest's server-authoritative whitelists, when a real chest is open. */ + private void requestChestWhitelistsIfNeeded() { + if (!session.isInventoryScreenContext + && session.currentChestPos != null + && !session.isEntityChest + && !session.isEnderChest) { + if (dev.architectury.networking.NetworkManager.canServerReceive( + io.github.marcsanzdev.chestseparators.network.WhitelistRequestPayload.TYPE)) { + dev.architectury.networking.NetworkManager.sendToServer( + new io.github.marcsanzdev.chestseparators.network.WhitelistRequestPayload( + session.currentChestPos)); + } + } + } + + public int getSidebarYOffset() { + return geometry.getContainerSlotCount() > 27 ? 0 : -18; + } + + /** + * Items that appear in the creative menu but are not obtainable in survival, so they are kept out + * of the filter list and out of "Allow All": every spawn egg, the player head, the spawners, + * reinforced deepslate, and the infested-stone blocks. + */ + private static boolean isNonSurvivalItem(Item item) { + if (item instanceof net.minecraft.world.item.SpawnEggItem) return true; + if (item == Items.PLAYER_HEAD) return true; + net.minecraft.world.level.block.Block block = net.minecraft.world.level.block.Block.byItem(item); + return block == net.minecraft.world.level.block.Blocks.SPAWNER + || block == net.minecraft.world.level.block.Blocks.TRIAL_SPAWNER + || block == net.minecraft.world.level.block.Blocks.REINFORCED_DEEPSLATE + || block == net.minecraft.world.level.block.Blocks.INFESTED_STONE + || block == net.minecraft.world.level.block.Blocks.INFESTED_COBBLESTONE + || block == net.minecraft.world.level.block.Blocks.INFESTED_STONE_BRICKS + || block == net.minecraft.world.level.block.Blocks.INFESTED_MOSSY_STONE_BRICKS + || block == net.minecraft.world.level.block.Blocks.INFESTED_CRACKED_STONE_BRICKS + || block == net.minecraft.world.level.block.Blocks.INFESTED_CHISELED_STONE_BRICKS + || block == net.minecraft.world.level.block.Blocks.INFESTED_DEEPSLATE; + } + + public boolean isEditMode() { + return session.currentState != EditorState.HIDDEN; + } + + /** + * Whether a slot can be decorated/filtered by the editor. The player's own inventory slots are + * always editable (chest screens edit them simultaneously with the chest); container slots are + * editable only in a container screen (this also excludes the crafting slots of the inventory + * screen). Chest and inventory edits coexist via {@link #slotKey} namespacing. + */ + public static boolean isEditableSlot(Slot slot) { + if (slot.container instanceof net.minecraft.world.entity.player.Inventory) return true; + return !activeSession.isInventoryScreenContext; + } + + /** + * The real inventory index of a slot. In the creative inventory the visible slots are + * {@code CreativeSlot} wrappers whose {@code getIndex()} is the creative handler's slot ID (armor 5-8, + * hotbar 36-44, offhand 45), not the inventory index the server enforces by. Unwrapping to the + * underlying slot yields the same index the survival inventory and chests report, so editing from + * creative lands filters/layouts on the correct slot. + */ + public static int realIndex(Slot slot) { + if (slot instanceof io.github.marcsanzdev.chestseparators.mixin.client.CreativeSlotAccessor wrapper) { + Slot inner = wrapper.chestseparators$getWrappedSlot(); + if (inner != null) return inner.getContainerSlot(); + } + return slot.getContainerSlot(); + } + + /** + * The working-map key for a slot. Player-inventory slots are offset into their own namespace so + * chest and inventory data (which share raw slot indices) coexist while both are edited at once. + */ + public static int slotKey(Slot slot) { + return slot.container instanceof net.minecraft.world.entity.player.Inventory + ? realIndex(slot) + ChestConfigManager.PLAYER_KEY_OFFSET + : realIndex(slot); + } + + /** True if a slot belongs to the player inventory namespace (used for the mutual-exclusion dimming). */ + public static boolean isPlayerSlot(Slot slot) { + return slot.container instanceof net.minecraft.world.entity.player.Inventory; + } + + /** Screens the editor treats as the player-inventory context: survival inventory and creative. */ + private static boolean isInventoryContextScreen(net.minecraft.client.gui.screens.inventory.AbstractContainerScreen s) { + return s instanceof InventoryScreen + || s instanceof net.minecraft.client.gui.screens.inventory.CreativeModeInventoryScreen; + } + + // While the editor is active, the creative screen's own tab switching is blocked (the tab bar must not + // react to clicks). This flag lets the mod's OWN switch below through that block. + public static boolean allowCreativeTabSwitch = false; + + /** + * When a toolbar button is used on the creative screen while it is NOT on the inventory tab, jump to + * that tab so the player's real inventory is present to interact with. No-op otherwise. + */ + public void ensureCreativeInventoryTab() { + if (this.screen instanceof net.minecraft.client.gui.screens.inventory.CreativeModeInventoryScreen cis + && !cis.isInventoryOpen()) { + net.minecraft.world.item.CreativeModeTab inv = net.minecraft.core.registries.BuiltInRegistries.CREATIVE_MODE_TAB.stream() + .filter(g -> g.getType() == net.minecraft.world.item.CreativeModeTab.Type.INVENTORY) + .findFirst() + .orElse(null); + if (inv != null) { + allowCreativeTabSwitch = true; + try { + ((io.github.marcsanzdev.chestseparators.mixin.client.CreativeInventoryScreenAccessor) cis) + .chestseparators$setSelectedTab(inv); + } finally { + allowCreativeTabSwitch = false; + } + } + } + } + + /** Finds the slot for a working-map key (the inverse of {@link #slotKey}); null if none matches. */ + public Slot slotForKey(int key) { + for (Slot s : accessor.getHandler().slots) { + if (slotKey(s) == key) return s; + } + return null; + } + + /** + * The slots whose on-screen 16×16 box intersects the rectangle dragged from {@code start} to + * {@code current}, restricted to the namespace (chest vs. player inventory) that {@code start} belongs + * to. Uses real slot positions ({@code slot.x}/{@code slot.y}), NOT raw indices: the hotbar is drawn + * BELOW the inventory rows even though its indices (0-8) come first, so {@code index / 9} row math + * wrongly treats the hotbar as the top row and over-selects the intervening rows when a drag crosses + * between them. Visual-box intersection selects exactly the cells the cursor swept over. + */ + public java.util.List slotsInDragBox(Slot start, Slot current) { + java.util.List out = new java.util.ArrayList<>(); + if (start == null || current == null) return out; + boolean playerNs = isPlayerSlot(start); + + // Every slot the rectangle touches is selected, armor and offhand included: they are ordinary + // targets for a filter, and skipping them meant a drag reaching one simply did nothing there. + // Membership is decided purely by whether the slot's cell overlaps the swept rectangle. + int minX = Math.min(start.x, current.x); + int maxX = Math.max(start.x, current.x) + 16; + int minY = Math.min(start.y, current.y); + int maxY = Math.max(start.y, current.y) + 16; + for (Slot s : accessor.getHandler().slots) { + if (!isEditableSlot(s)) continue; + if (isPlayerSlot(s) != playerNs) continue; + if (s.x < maxX && s.x + 16 > minX && s.y < maxY && s.y + 16 > minY) out.add(s); + } + return out; + } + + /** + * Armor slots in the filter under edit that restrict which items they accept. Normal, hotbar and + * offhand slots accept anything, so they never appear here. Recomputed each time the filter editor + * opens; used to limit the item picker to equippable items for armor filters. + */ + private final java.util.List filterConstraintSlots = new java.util.ArrayList<>(); + + /** True when at least one selected slot accepts anything (so the filter has no item restriction). */ + private boolean filterHasUnrestrictedSlot = true; + + /** Detects which of the filter's selected slots are restrictive (reject a non-equippable sentinel). */ + public void recomputeFilterConstraints() { + filterConstraintSlots.clear(); + filterHasUnrestrictedSlot = false; + ItemStack sentinel = new ItemStack(Items.STONE); + // Measure each slot's VANILLA restriction (armor checks), not our own whitelist enforcement — + // otherwise, when editing an existing filter, its saved whitelist blocks the sentinel and the + // slot is wrongly flagged as restricted, hiding all game items from the picker. + io.github.marcsanzdev.chestseparators.util.ClickTracker.BYPASS_ENFORCEMENT.set(true); + try { + for (int key : session.selectedSlots) { + Slot s = slotForKey(key); + if (s == null) continue; + if (s.mayPlace(sentinel)) filterHasUnrestrictedSlot = true; + else filterConstraintSlots.add(s); + } + } finally { + io.github.marcsanzdev.chestseparators.util.ClickTracker.BYPASS_ENFORCEMENT.set(false); + } + if (filterConstraintSlots.isEmpty()) filterHasUnrestrictedSlot = true; + } + + /** + * Whether an item may be added to the filter currently being edited. Always true unless the filter + * is made up only of armor slots, in which case the item must be equippable in at least one of them + * (so selecting all four armor slots accepts any armor piece, not none). + */ + public boolean isItemAllowedForFilter(Item item) { + if (filterHasUnrestrictedSlot) return true; + ItemStack stack = new ItemStack(item); + io.github.marcsanzdev.chestseparators.util.ClickTracker.BYPASS_ENFORCEMENT.set(true); + try { + for (Slot s : filterConstraintSlots) { + if (s.mayPlace(stack)) return true; + } + } finally { + io.github.marcsanzdev.chestseparators.util.ClickTracker.BYPASS_ENFORCEMENT.set(false); + } + return false; + } + + public void releaseLock() { + if (hasEditorLock && session.currentChestPos != null) { + if (dev.architectury.networking.NetworkManager.canServerReceive( + io.github.marcsanzdev.chestseparators.network.EditorLockRequestPayload.TYPE)) { + dev.architectury.networking.NetworkManager.sendToServer( + new io.github.marcsanzdev.chestseparators.network.EditorLockRequestPayload( + session.currentChestPos, false)); + } + hasEditorLock = false; + } + } + + public void toggleState(EditorState targetState) { + EditorState previousState = session.currentState; + + if (session.currentState == targetState) { + session.currentState = EditorState.HIDDEN; + } else { + session.currentState = targetState; + } + + // Release the editor lock when transitioning away from any filter-editing state. + boolean wasFilterState = (previousState == EditorState.VIEW_GROUPS + || previousState == EditorState.SELECT_SLOTS + || previousState == EditorState.EDIT_FILTER); + boolean isFilterState = (session.currentState == EditorState.VIEW_GROUPS + || session.currentState == EditorState.SELECT_SLOTS + || session.currentState == EditorState.EDIT_FILTER); + + if (wasFilterState && !isFilterState) { + releaseLock(); + } + + if (session.currentState == EditorState.DRAW_LINES || session.currentState == EditorState.HIDDEN) { + this.session.selectedSlots.clear(); + } + + if (session.currentState == EditorState.HIDDEN) { + GlobalChestConfig.saveConfig(); + session.editingLineCustomIndex = -1; + session.editingBgCustomIndex = -1; + } + } + + public void startCreatingGroup(Slot initialSlot) { + toggleState(EditorState.SELECT_SLOTS); + session.selectedGroupId = UUID.randomUUID(); + session.selectedSlots.clear(); + + if (initialSlot != null) { + int key = slotKey(initialSlot); + session.selectedSlots.add(key); + session.lastClickedSlotIndex = key; + session.lastSlotClickTime = System.currentTimeMillis(); + session.isSelecting = true; + } + playClickSound(1.0f); + } + + public void prepareFilterMenu() { + session.currentAllowedItems.clear(); + session.targetCount = 0; + // The third rule is context-dependent: "Hopper" for a chest filter, "Pick Up" for an inventory + // filter (they share the ruleHopper flag). Seed its default from the matching config option so an + // inventory group defaults to the Pick Up default and a chest group to the Hopper default. + boolean invFilter = false; + for (int key : session.selectedSlots) { + if (io.github.marcsanzdev.chestseparators.data.ChestConfigManager.isInventoryKey(key)) { + invFilter = true; + break; + } + } + session.ruleManual = GlobalChestConfig.instance.defaultRuleManual; + session.ruleShift = GlobalChestConfig.instance.defaultRuleShift; + session.ruleHopper = invFilter + ? GlobalChestConfig.instance.defaultRulePickup + : GlobalChestConfig.instance.defaultRuleHopper; + session.gridScrollY = 0f; + session.listScrollY = 0f; + + if (session.selectedGroupId != null) { + var whitelists = io.github.marcsanzdev.chestseparators.data.ChestConfigManager.getInstance() + .getCurrentWhitelists(); + boolean isExistingGroup = false; + if (whitelists != null) { + isExistingGroup = + whitelists.values().stream().anyMatch(wl -> session.selectedGroupId.equals(wl.groupId())); + } + + if (isExistingGroup) { + session.selectedSlots.clear(); + boolean loadedRules = false; + + for (java.util.Map.Entry entry : + whitelists.entrySet()) { + if (session.selectedGroupId.equals(entry.getValue().groupId())) { + session.selectedSlots.add(entry.getKey()); + + if (!loadedRules) { + session.currentAllowedItems.addAll(entry.getValue().allowedItems()); + session.ruleManual = entry.getValue().allowManual(); + session.ruleShift = entry.getValue().allowShift(); + session.ruleHopper = entry.getValue().allowHopper(); + session.targetCount = Math.max(0, entry.getValue().targetCount()); + loadedRules = true; + } + } + } + } + } + recomputeFilterConstraints(); + resetToDefaultCreativeTab(); + updateWhitelistSearchCache(); + + // Rebuild the filter screen's widgets now that the container type is fully known. The initial + // build happens during the editor's init(), BEFORE loadConfigForCurrentTarget() determines + // isEnderChest — so without this the Ender Chest would keep its Hopper Insert button (which must be + // dropped) and the rule buttons would not be re-centred. + this.screenEditFilter.init(); + } + + public void saveCurrentGroup() { + var whitelists = ChestConfigManager.getInstance().getCurrentWhitelists(); + if (whitelists == null) whitelists = new java.util.HashMap<>(); + + for (int slotIndex : session.selectedSlots) { + io.github.marcsanzdev.chestseparators.data.SlotWhitelist wl = + new io.github.marcsanzdev.chestseparators.data.SlotWhitelist( + session.selectedGroupId, + new ArrayList<>(session.currentAllowedItems), + session.ruleManual, + session.ruleShift, + session.ruleHopper, + session.targetCount); + whitelists.put(slotIndex, wl); + } + ChestConfigManager.getInstance().setCurrentWhitelists(whitelists); + + saveSmart(); + syncClientInventoryWhitelists(whitelists); + // sendWhitelistToServer() self-guards: it forwards block chests/shulkers and chest minecarts, and + // skips ender chests, the player inventory, and other entity containers (all local-only). + sendWhitelistToServer(); + } + + public void deleteCurrentGroup() { + if (session.selectedGroupId == null) return; + var whitelists = ChestConfigManager.getInstance().getCurrentWhitelists(); + if (whitelists != null) { + whitelists + .entrySet() + .removeIf(entry -> + session.selectedGroupId.equals(entry.getValue().groupId())); + ChestConfigManager.getInstance().setCurrentWhitelists(whitelists); + + saveSmart(); + syncClientInventoryWhitelists(whitelists); + sendWhitelistToServer(); + } + } + + /** + * Pushes the container's own filters to the server. Self-guarding: it only sends for targets the + * server can actually enforce — real block chests/shulkers, chest/hopper minecarts, and the + * player's private Ender Chest inventory. Ender filters remain client-persisted; the server + * receives only a temporary copy for shift-click enforcement. + */ + public void sendWhitelistToServer() { + if (session.isPlayerInventory) return; + + var chestOnly = io.github.marcsanzdev.chestseparators.data.ChestConfigManager.getInstance() + .chestOnlyWhitelists(); + + if (session.isMinecartChest && session.currentEntityUUID != null) { + if (dev.architectury.networking.NetworkManager.canServerReceive( + io.github.marcsanzdev.chestseparators.network.EntityWhitelistPayload.TYPE)) { + dev.architectury.networking.NetworkManager.sendToServer( + new io.github.marcsanzdev.chestseparators.network.EntityWhitelistPayload( + session.currentEntityUUID, chestOnly)); + } + return; + } + + // Any other entity container (chest boat, animals) is local-only. + if (session.isEntityChest) return; + + if (dev.architectury.networking.NetworkManager.canServerReceive( + io.github.marcsanzdev.chestseparators.network.WhitelistPayload.TYPE)) { + BlockPos posToSend = session.currentChestPos != null ? session.currentChestPos : BlockPos.ZERO; + dev.architectury.networking.NetworkManager.sendToServer( + new io.github.marcsanzdev.chestseparators.network.WhitelistPayload( + posToSend, + // Only the chest's own filters; inventory filters (offset keys) are local. + chestOnly)); + } + } + + public void playClickSound(float pitch) { + playUiSound(SoundEvents.UI_BUTTON_CLICK.value(), pitch); + } + + /** Plays any UI sound event on the master track at the given pitch (non-positional, like the click). */ + public void playUiSound(net.minecraft.sounds.SoundEvent sound, float pitch) { + Minecraft.getInstance() + .getSoundManager() + .play(net.minecraft.client.resources.sounds.SimpleSoundInstance.forUI( + sound, pitch)); + } + + /** + * The single "a panel was dismissed" sound. Every screen that can be closed by clicking outside it (or on + * dead space) must play THIS, so exiting layout, filters, the item picker, presets and the palette all + * sound identical instead of each using its own pitch. + */ + public void playCloseSound() { + playClickSound(1.0f); + } + + public void saveSmart() { + ChestConfigManager manager = ChestConfigManager.getInstance(); + + // Container portion (chest screens only) — chest-only keys are saved to the container's store. + if (!session.isInventoryScreenContext) { + if (session.isShulkerBox && session.currentShulkerUUID != null) { + manager.saveShulkerConfig(session.currentShulkerUUID); + } else if (session.isEntityChest && session.currentEntityUUID != null) { + manager.saveEntityConfig(session.currentEntityUUID); + } else if (session.isEnderChest) { + manager.saveEnderConfig(); + } else if (session.currentChestPos != null) { + manager.saveConfig(session.currentChestPos, session.currentDimension); + } + } + + // Player inventory portion (always) — extracted from the offset keys and synced for Pick Up. + manager.saveInventoryFromCurrent(); + io.github.marcsanzdev.chestseparators.network.ModClientNetworking.sendInventoryFilters(); + } + + /** Asks the server to fill the inventory from the container currently open (the top fill icon). */ + /** + * Pulls items from the open container into the inventory. Normally only items the inventory filters + * want (up to each target). With {@code includeEmpty} (Shift), also pulls the rest of the container's + * items into any free inventory space — the slots that have no filter. + */ + public void requestFillFromOpenChest(boolean includeEmpty) { + playClickSound(1.0f); + net.minecraft.core.BlockPos pos = session.currentChestPos != null + ? session.currentChestPos + : (Minecraft.getInstance().player != null + ? Minecraft.getInstance().player.blockPosition() + : net.minecraft.core.BlockPos.ZERO); + if (dev.architectury.networking.NetworkManager.canServerReceive( + io.github.marcsanzdev.chestseparators.network.FillFromChestPayload.TYPE)) { + boolean lockHotbar = io.github.marcsanzdev.chestseparators.config.GlobalChestConfig.instance == null + || io.github.marcsanzdev.chestseparators.config.GlobalChestConfig.instance.lockHotbarOnReorder; + dev.architectury.networking.NetworkManager.sendToServer( + new io.github.marcsanzdev.chestseparators.network.FillFromChestPayload( + pos, includeEmpty, lockHotbar)); + } + } + + /** Loads inventory preset {@code index} (1-based) into the live editor, or reports it is empty. */ + public void loadInventoryPresetSlot(int index) { + ChestConfigManager manager = ChestConfigManager.getInstance(); + if (!manager.loadInventoryPreset(index)) { + showStatus(Component.translatable("message.chestseparators.preset_empty", index), ChatFormatting.RED); + playClickSound(0.6f); + return; + } + saveSmart(); + syncClientInventoryWhitelists(manager.getCurrentWhitelists()); + showStatus(Component.translatable("message.chestseparators.preset_loaded", index), ChatFormatting.GREEN); + playClickSound(1.1f); + } + + /** Saves the current inventory layout + filters into preset {@code index} (1-based). */ + public void saveInventoryPresetSlot(int index) { + ChestConfigManager.getInstance().saveInventoryPreset(index); + showStatus(Component.translatable("message.chestseparators.preset_saved", index), ChatFormatting.GREEN); + playClickSound(1.2f); + } + + /** The open container's slot count (27 vs 54), used to pick the matching chest-preset set. */ + public int chestPresetSize() { + return geometry.getNamespaceSlotCount(false); + } + + /** Loads chest preset {@code index} (1-based) of the open container's size, or reports it is empty. */ + public void loadChestPresetSlot(int index) { + ChestConfigManager manager = ChestConfigManager.getInstance(); + if (!manager.loadChestPreset(chestPresetSize(), index)) { + showStatus(Component.translatable("message.chestseparators.preset_empty", index), ChatFormatting.RED); + playClickSound(0.6f); + return; + } + saveSmart(); + sendWhitelistToServer(); + syncClientInventoryWhitelists(manager.getCurrentWhitelists()); + showStatus(Component.translatable("message.chestseparators.preset_loaded", index), ChatFormatting.GREEN); + playClickSound(1.1f); + } + + /** Saves the open chest's current layout + filters into its size's chest preset {@code index}. */ + public void saveChestPresetSlot(int index) { + ChestConfigManager.getInstance().saveChestPreset(chestPresetSize(), index); + showStatus(Component.translatable("message.chestseparators.preset_saved", index), ChatFormatting.GREEN); + playClickSound(1.2f); + } + + /** Deletes inventory preset {@code index} (1-based). */ + public void deleteInventoryPresetSlot(int index) { + ChestConfigManager.getInstance().deleteInventoryPreset(index); + showStatus(Component.translatable("message.chestseparators.preset_deleted", index), ChatFormatting.RED); + playClickSound(0.8f); + } + + /** Deletes chest preset {@code index} (1-based) of the open container's size. */ + public void deleteChestPresetSlot(int index) { + ChestConfigManager.getInstance().deleteChestPreset(chestPresetSize(), index); + showStatus(Component.translatable("message.chestseparators.preset_deleted", index), ChatFormatting.RED); + playClickSound(0.8f); + } + + public void triggerActionAnimation(int actionId) { + session.clickedActionId = actionId; + session.clickedActionTime = System.currentTimeMillis(); + } + + /** + * Finalizes a unified undo/redo: persists the restored state, re-syncs filters to the server and + * the local inventory (the shared history can change filters too), and shows feedback naming what + * was undone/redone. {@code labelKey} comes from {@link ChestConfigManager#undo()}/redo(); a null + * label means there was nothing to do. + */ + public void applyUndoRedo(String labelKey, boolean isRedo) { + if (labelKey == null) { + playClickSound(0.5f); + return; + } + saveSmart(); + sendWhitelistToServer(); + syncClientInventoryWhitelists(ChestConfigManager.getInstance().getCurrentWhitelists()); + + // Blink the slots that changed, colored by the kind of change. + undoHighlights = new HashMap<>(ChestConfigManager.getInstance().getLastUndoChanges()); + undoHighlightStart = System.currentTimeMillis(); + + String feedbackKey = isRedo ? "message.chestseparators.redone" : "message.chestseparators.undone"; + showStatus(Component.translatable(feedbackKey, Component.translatable(labelKey)), ChatFormatting.GRAY); + playClickSound(0.8f); + } + + public void showStatus(Component message, ChatFormatting color) { + session.statusMessage = message.copy().withStyle(color); + session.statusMessageTime = System.currentTimeMillis(); + } + + /** Shows a status message tinted with an exact ARGB/RGB color (used for color copy/paste feedback). */ + public void showStatus(Component message, int rgbColor) { + net.minecraft.network.chat.Style style = + net.minecraft.network.chat.Style.EMPTY.withColor(net.minecraft.network.chat.TextColor.fromRgb(rgbColor & 0xFFFFFF)); + session.statusMessage = message.copy().setStyle(style); + session.statusMessageTime = System.currentTimeMillis(); + } + + public boolean isHovering(int x, int y, int width, int height, double mouseX, double mouseY) { + return mouseX >= x && mouseX < x + width && mouseY >= y && mouseY < y + height; + } + + /** Whether either Shift key is held right now (polled from SDL via InputConstants at call time). */ + private static boolean isShiftDown() { + return InputConstants.isKeyDown(InputConstants.KEY_LSHIFT) + || InputConstants.isKeyDown(InputConstants.KEY_RSHIFT); + } + + public int shiftColor(int color, int amount) { + int a = (color >> 24) & 0xFF; + int r = (color >> 16) & 0xFF; + int g = (color >> 8) & 0xFF; + int b = color & 0xFF; + r = Mth.clamp(r + amount, 0, 255); + g = Mth.clamp(g + amount, 0, 255); + b = Mth.clamp(b + amount, 0, 255); + return (a << 24) | (r << 16) | (g << 8) | b; + } + + public void openColorPicker(int initialColor, int targetMode) { + session.isColorPickerOpen = true; + session.pickerTargetMode = targetMode; + this.colorPickerModified = false; + + // Default cursors to the top-left of the picker (pure red, full saturation, full brightness). + session.pickerHue = 0.0f; + session.pickerSat = 1.0f; + session.pickerVal = 1.0f; + + if (initialColor == 0) { + // Keep RGB at 0 to show the checkerboard transparency pattern for an empty slot. + session.pickerCurrentRGB = 0; + } else { + // Convert the existing color to HSB so the cursors open at the correct position. + float[] hsb = new float[3]; + int r = (initialColor >> 16) & 0xFF; + int g = (initialColor >> 8) & 0xFF; + int b = initialColor & 0xFF; + java.awt.Color.RGBtoHSB(r, g, b, hsb); + session.pickerHue = hsb[0]; + session.pickerSat = hsb[1]; + session.pickerVal = hsb[2]; + session.pickerCurrentRGB = initialColor | 0xFF000000; + } + + if (this.screenColorPicker != null) { + this.screenColorPicker.onOpen(); + } + } + + public void updateTracePath(String step) { + if (step == null || step.isEmpty()) return; + if (session.tracePath.isEmpty()) { + session.tracePath.add(step); + return; + } + if (session.tracePath.get(session.tracePath.size() - 1).equals(step)) { + return; + } + + int index = session.tracePath.indexOf(step); + if (index != -1) { + session.tracePath.subList(index + 1, session.tracePath.size()).clear(); + } else { + session.tracePath.add(step); + } + } + + public void renderNormalModeOverlay(GuiGraphicsExtractor context, int mouseX, int mouseY) { + if (this.renderer != null) this.renderer.renderNormalModeOverlay(context, mouseX, mouseY); + + // Only render the floating status message while the main editor panel is closed. + if (session.currentState == EditorState.HIDDEN && session.statusMessage != null) { + long elapsed = System.currentTimeMillis() - session.statusMessageTime; + + if (elapsed < 2000) { + int alpha = 255; + if (elapsed > 1500) { + alpha = (int) (255 * (1.0f - (elapsed - 1500) / 500.0f)); + } + + if (alpha > 10) { + net.minecraft.client.Minecraft client = net.minecraft.client.Minecraft.getInstance(); + int color = (alpha << 24) | 0xFFFFFF; + context.centeredText( + client.font, session.statusMessage, screen.width / 2, screen.height - 40, color); + } + } else { + session.statusMessage = null; + } + } + } + + public void renderSavedLinesLayer(GuiGraphicsExtractor context) { + if (this.renderer != null) this.renderer.renderSavedLinesLayer(context); + } + + public boolean keyPressed(net.minecraft.client.input.KeyEvent input) { + boolean isSearchFocused = (searchBox != null && searchBox.isFocused()); + boolean isWhitelistSearchFocused = (whitelistSearchBox != null && whitelistSearchBox.isFocused()); + + if (isSearchFocused) { + if (searchBox.keyPressed(input)) return true; + if (input.key() == InputConstants.KEY_ESCAPE) { + searchBox.setFocused(false); + return true; + } + } + if (session.isColorPickerOpen && screenColorPicker.keyPressed(input)) return true; + if (this.inputHandler != null) return this.inputHandler.keyPressed(input); + return false; + } + + public boolean charTyped(net.minecraft.client.input.CharacterEvent input) { + if (session.isColorPickerOpen && screenColorPicker.charTyped(input)) return true; + if (this.inputHandler != null) return this.inputHandler.charTyped(input); + return false; + } + + /** Runs the editor's click handling directly (used by the creative-inventory mixin to block tabs). */ + public void handleEditorClick(double mouseX, double mouseY, int button) { + if (this.inputHandler != null) this.inputHandler.handleClick(mouseX, mouseY, button); + } + + public List extractItemsFromSelection() { + Set extracted = new LinkedHashSet<>(); + if (accessor.getHandler() != null && accessor.getHandler().slots != null) { + // selectedSlots holds slot KEYS, not raw handler indices: player-inventory keys carry the + // PLAYER_KEY_OFFSET, so indexing the handler directly missed every inventory slot (the offset + // key is out of range) and the import button did nothing for inventory filters. Resolve each + // key back to its Slot, which works for both the chest (offset 0) and the inventory. + for (int key : session.selectedSlots) { + Slot slot = slotForKey(key); + if (slot == null) continue; + ItemStack stack = slot.getItem(); + if (!stack.isEmpty()) { + String id = net.minecraft.core.registries.BuiltInRegistries.ITEM + .getKey(stack.getItem()) + .toString(); + if (!session.currentAllowedItems.contains(id)) extracted.add(id); + } + } + } + return new ArrayList<>(extracted); + } + + public void buildCustomChestTab() { + session.customChestItems.clear(); + java.util.Set uniqueItems = new java.util.LinkedHashSet<>(); + + if (accessor.getHandler() != null && accessor.getHandler().slots != null) { + for (Slot slot : accessor.getHandler().slots) { + if (!(slot.container instanceof net.minecraft.world.entity.player.Inventory) && slot.hasItem()) { + uniqueItems.add(slot.getItem().getItem()); + } + } + for (Slot slot : accessor.getHandler().slots) { + if (slot.container instanceof net.minecraft.world.entity.player.Inventory && slot.hasItem()) { + uniqueItems.add(slot.getItem().getItem()); + } + } + } + session.customChestItems.addAll(uniqueItems); + } + + /** + * Resets the creative-item browser to its default tab and first page whenever a filter menu is + * opened, so the last-used tab (e.g. "Chest & Inventory") and any pending search text never carry + * over between filters. The default is the first available tab, matching the initial open. + */ + private void resetToDefaultCreativeTab() { + session.currentTabPage = 0; + for (int i = 0; i < session.availableTabs.size(); i++) { + if (session.availableTabs.get(i) != null) { + switchCreativeTab(i); + return; + } + } + } + + public void switchCreativeTab(int tabIndex) { + if (tabIndex < 0 || tabIndex >= session.availableTabs.size()) return; + session.currentCreativeTabIndex = tabIndex; + session.gridScrollY = 0f; + session.isPreviewing = false; + + EditorSessionData.CreativeTabInfo activeTab = session.availableTabs.get(tabIndex); + if (activeTab == null) return; + + if (!activeTab.isSearchTab && this.searchBox != null) this.searchBox.setValue(""); + session.filteredItems.clear(); + + Minecraft client = Minecraft.getInstance(); + net.minecraft.world.flag.FeatureFlagSet features = + client.level != null ? client.level.enabledFeatures() : null; + CreativeModeTab.ItemDisplayParameters context = features != null + ? new CreativeModeTab.ItemDisplayParameters(features, false, client.level.registryAccess()) + : null; + + if (activeTab.isCustomChestTab) { + buildCustomChestTab(); + for (Item item : session.customChestItems) { + if (isItemAllowedForFilter(item)) session.filteredItems.add(item); + } + } else if (activeTab.isSearchTab) { + boolean isSearching = + this.searchBox != null && !this.searchBox.getValue().isEmpty(); + String lowerQuery = isSearching ? this.searchBox.getValue().toLowerCase() : ""; + + for (EditorSessionData.CreativeTabInfo tab : session.availableTabs) { + if (tab == null || tab.isSearchTab || tab.isCustomChestTab || tab.group == null) continue; + java.util.Collection displayStacks = tab.group.getDisplayItems(); + + if ((displayStacks == null || displayStacks.isEmpty()) && context != null) { + tab.group.buildContents(context); + displayStacks = tab.group.getDisplayItems(); + } + + if (displayStacks != null) { + for (ItemStack stack : displayStacks) { + Item item = stack.getItem(); + if (!session.filteredItems.contains(item) + && isItemAllowedInMenu(item) + && isItemAllowedForFilter(item)) { + if (isSearching) { + boolean matches = false; + if (lowerQuery.startsWith("#")) { + String searchTag = lowerQuery.substring(1); + matches = item.builtInRegistryHolder() + .tags() + .anyMatch(t -> t.location().getPath().contains(searchTag)); + } else { + matches = item.getName(item.getDefaultInstance()) + .getString() + .toLowerCase() + .contains(lowerQuery); + } + if (matches) session.filteredItems.add(item); + } else { + session.filteredItems.add(item); + } + } + } + } + } + } else if (activeTab.group != null) { + java.util.Collection displayStacks = activeTab.group.getDisplayItems(); + if ((displayStacks == null || displayStacks.isEmpty()) && context != null) { + activeTab.group.buildContents(context); + displayStacks = activeTab.group.getDisplayItems(); + } + + if (displayStacks != null && !displayStacks.isEmpty()) { + for (ItemStack stack : displayStacks) { + Item item = stack.getItem(); + if (!session.filteredItems.contains(item) + && isItemAllowedInMenu(item) + && isItemAllowedForFilter(item)) { + session.filteredItems.add(item); + } + } + } + } + } + + public boolean isItemAllowedInMenu(Item item) { + if (item instanceof SpawnEggItem) return false; + net.minecraft.resources.Identifier id = net.minecraft.core.registries.BuiltInRegistries.ITEM.getKey(item); + if (id == null) return false; + + String path = id.getPath(); + if (path.contains("infested")) return false; + if (path.contains("command_block")) return false; + + java.util.Set blacklist = java.util.Set.of( + "air", + "bedrock", + "spawner", + "reinforced_deepslate", + "end_portal_frame", + "knowledge_book", + "trial_spawner", + "vault", + "barrier", + "light", + "debug_stick", + "structure_block", + "structure_void", + "jigsaw", + "test_block", + "test_instance_block", + "player_head", + "farmland", + "suspicious_sand", + "suspicious_gravel", + "budding_amethyst", + "dirt_path", + "chorus_plant", + "frogspawn"); + + return !blacklist.contains(path); + } + + public void updateWhitelistSearchCache() { + session.visibleLeftListItems.clear(); + String wlSearch = this.whitelistSearchBox != null + ? this.whitelistSearchBox.getValue().toLowerCase() + : ""; + + for (String id : session.currentAllowedItems) { + Item item = net.minecraft.core.registries.BuiltInRegistries.ITEM.getValue(net.minecraft.resources.Identifier.tryParse(id)); + if (item != null) { + boolean matches = false; + if (wlSearch.isEmpty()) { + matches = true; + } else if (wlSearch.startsWith("#")) { + String searchTag = wlSearch.substring(1); + matches = item.builtInRegistryHolder().tags().anyMatch(t -> t.location().getPath() + .contains(searchTag)); + } else { + matches = item.getName(item.getDefaultInstance()).getString().toLowerCase().contains(wlSearch); + } + + if (matches) session.visibleLeftListItems.add(id); + } + } + } + + public boolean mouseScrolled(double mouseX, double mouseY, double horizontalAmount, double verticalAmount) { + if (!isEditMode()) { + return screenViewGroups.mouseScrolled(mouseX, mouseY, horizontalAmount, verticalAmount); + } else { + if (session.currentState == EditorState.VIEW_GROUPS || session.currentState == EditorState.SELECT_SLOTS) { + return screenViewGroups.mouseScrolled(mouseX, mouseY, horizontalAmount, verticalAmount); + } else if (session.currentState == EditorState.EDIT_FILTER) { + return screenEditFilter.mouseScrolled(mouseX, mouseY, horizontalAmount, verticalAmount); + } + } + return false; + } + + public void syncClientInventoryWhitelists(Map whitelists) { + if (Minecraft.getInstance().player == null) return; + AbstractContainerMenu handler = Minecraft.getInstance().player.containerMenu; + if (handler == null || handler.slots.isEmpty()) return; + + // Iterate all non-player slots and push whitelists to every unique IWhitelistProvider found. + // This handles chest minecarts (entity IS the inventory), chest boats (same), and + // donkeys/llamas (cargo SimpleInventory is a separate instance from the saddle slot inventory). + java.util.Set visited = new java.util.HashSet<>(); + for (Slot slot : handler.slots) { + if (slot.container instanceof net.minecraft.world.entity.player.Inventory) continue; + if (slot.container instanceof IWhitelistProvider provider) { + if (visited.add(provider)) { + provider.setWhitelists(whitelists); + } + } + } + } + + /** + * Place loose main-inventory stacks into matching home slots before the open-container Push + * click sequence. Using real container clicks (rather than editing predicted client stacks) + * keeps the client and server inventories synchronized. The server's inventory-menu refill + * hook does not run in this container, so it cannot interrupt these clicks halfway through. + * Never source items from the hotbar, armor, offhand, or other filtered slots. + */ + private void consolidatePlayerBeforeDeposit( + Map filters, + net.minecraft.client.multiplayer.MultiPlayerGameMode gameMode, + net.minecraft.world.entity.player.Player player, int menuId) { + if (filters == null || filters.isEmpty()) return; + Map mainSlots = new java.util.TreeMap<>(); + for (net.minecraft.world.inventory.Slot slot : accessor.getHandler().slots) { + if (slot.container instanceof net.minecraft.world.entity.player.Inventory + && slot.getContainerSlot() >= 9 + && slot.getContainerSlot() < net.minecraft.world.entity.player.Inventory.INVENTORY_SIZE) { + mainSlots.put(slot.getContainerSlot(), slot); + } + } + // Fill partial matching stacks first; empty homes in a second pass. + for (int pass = 0; pass < 2; pass++) { + for (Map.Entry homeEntry : mainSlots.entrySet()) { + net.minecraft.world.inventory.Slot home = homeEntry.getValue(); + var filter = filters.get(homeEntry.getKey()); + if (filter == null || filter.allowedItems().isEmpty()) continue; + net.minecraft.world.item.ItemStack stack = home.getItem(); + if (pass == 0 && (stack.isEmpty() || !filter.allowedItems().contains( + net.minecraft.core.registries.BuiltInRegistries.ITEM.getKey(stack.getItem()).toString()))) { + continue; + } + if (pass == 1 && !stack.isEmpty()) continue; + + // When the home is empty, try the filter's allowed items in the configured order. + List preferred = stack.isEmpty() ? filter.allowedItems() : + List.of(net.minecraft.core.registries.BuiltInRegistries.ITEM.getKey(stack.getItem()).toString()); + for (String itemId : preferred) { + for (Map.Entry sourceEntry : mainSlots.entrySet()) { + if (filters.containsKey(sourceEntry.getKey()) || sourceEntry.getKey().equals(homeEntry.getKey())) continue; + net.minecraft.world.inventory.Slot source = sourceEntry.getValue(); + net.minecraft.world.item.ItemStack extra = source.getItem(); + if (extra.isEmpty() || !net.minecraft.core.registries.BuiltInRegistries.ITEM + .getKey(extra.getItem()).toString().equals(itemId)) continue; + net.minecraft.world.item.ItemStack current = home.getItem(); + if (!current.isEmpty() + && !net.minecraft.world.item.ItemStack.isSameItemSameComponents(current, extra)) continue; + int maximum = Math.min(extra.getMaxStackSize(), home.getMaxStackSize(extra)); + if (current.getCount() >= maximum) break; + // Pickup source, merge into home, then return any leftover to the source. + gameMode.handleContainerInput(menuId, source.index, 0, + net.minecraft.world.inventory.ContainerInput.PICKUP, player); + gameMode.handleContainerInput(menuId, home.index, 0, + net.minecraft.world.inventory.ContainerInput.PICKUP, player); + if (!accessor.getHandler().getCarried().isEmpty()) { + gameMode.handleContainerInput(menuId, source.index, 0, + net.minecraft.world.inventory.ContainerInput.PICKUP, player); + } + if (accessor.getHandler().getCarried().isEmpty() && home.hasItem() + && home.getItem().getCount() >= maximum) break; + } + if (home.hasItem()) break; + } + } + } + } + + public void executeDeposit(boolean shift) { + if (accessor.getHandler() == null || net.minecraft.client.Minecraft.getInstance().player == null) return; + if (!accessor.getHandler().getCarried().isEmpty()) return; + + var whitelists = io.github.marcsanzdev.chestseparators.data.ChestConfigManager.getInstance() + .getCurrentWhitelists(); + net.minecraft.client.multiplayer.MultiPlayerGameMode interactionManager = + net.minecraft.client.Minecraft.getInstance().gameMode; + int syncId = accessor.getHandler().containerId; + net.minecraft.world.entity.player.Player player = net.minecraft.client.Minecraft.getInstance().player; + var playerFilters = io.github.marcsanzdev.chestseparators.data.ChestConfigManager.getInstance() + .getPlayerInventoryFilters(); + + // Refill dedicated main-inventory stacks BEFORE determining per-slot deposit allowances. + // The subsequent Keep limit still protects the selected number of items overall. + consolidatePlayerBeforeDeposit(playerFilters, interactionManager, player, syncId); + + int totalMovedCount = 0; + + for (net.minecraft.world.inventory.Slot playerSlot : accessor.getHandler().slots) { + if (playerSlot.container instanceof net.minecraft.world.entity.player.Inventory && playerSlot.hasItem()) { + int movable = io.github.marcsanzdev.chestseparators.util.InventoryProtection + .movableCount(player.getInventory(), playerFilters, playerSlot.getContainerSlot()); + if (movable <= 0) continue; + int reserved = playerSlot.getItem().getCount() - movable; + net.minecraft.world.item.ItemStack stackToMove = playerSlot.getItem().copyWithCount(movable); + String itemId = net.minecraft.core.registries.BuiltInRegistries.ITEM + .getKey(stackToMove.getItem()) + .toString(); + int remainingOnCursor = stackToMove.getCount(); + + // Build the target slot list using the 4-pass priority system. + List prioritizedSlots = new ArrayList<>(); + + // Pass 1: Filtered slots with a matching existing stack (stacking). + collectTargetSlots(prioritizedSlots, whitelists, itemId, stackToMove, true, false); + // Pass 2: Empty filtered slots (filling). + collectTargetSlots(prioritizedSlots, whitelists, itemId, stackToMove, false, false); + + if (shift) { + // Pass 3: Unfiltered slots with a matching existing stack (stacking). + collectTargetSlots(prioritizedSlots, whitelists, itemId, stackToMove, true, true); + // Pass 4: Empty unfiltered slots (filling). + collectTargetSlots(prioritizedSlots, whitelists, itemId, stackToMove, false, true); + } + + if (!prioritizedSlots.isEmpty()) { + boolean pickedUp = false; + for (net.minecraft.world.inventory.Slot targetSlot : prioritizedSlots) { + if (remainingOnCursor <= 0) break; + + int spaceLeft = stackToMove.getMaxStackSize() + - (targetSlot.hasItem() ? targetSlot.getItem().getCount() : 0); + if (spaceLeft > 0) { + if (!pickedUp) { + interactionManager.handleContainerInput( + syncId, + playerSlot.index, + 0, + net.minecraft.world.inventory.ContainerInput.PICKUP, + player); + pickedUp = true; + // Leave the protected part in its original slot BEFORE depositing. + // Right-click on the emptied source places one item per click, allowing + // an exact retained count without adding a new server packet. + for (int keep = 0; keep < reserved; keep++) { + interactionManager.handleContainerInput( + syncId, playerSlot.index, 1, + net.minecraft.world.inventory.ContainerInput.PICKUP, player); + } + } + interactionManager.handleContainerInput( + syncId, targetSlot.index, 0, net.minecraft.world.inventory.ContainerInput.PICKUP, player); + int moved = Math.min(spaceLeft, remainingOnCursor); + remainingOnCursor -= moved; + totalMovedCount += moved; + } + } + if (pickedUp && remainingOnCursor > 0) { + interactionManager.handleContainerInput( + syncId, playerSlot.index, 0, net.minecraft.world.inventory.ContainerInput.PICKUP, player); + } + } + } + } + + if (totalMovedCount > 0) { + showStatus( + net.minecraft.network.chat.Component.translatable("message.chestseparators.deposited", totalMovedCount), + net.minecraft.ChatFormatting.GREEN); + this.suspendDepositPreview = true; + this.previewSourceRemaining.clear(); + this.previewTargetIncoming.clear(); + + // Apply the server's post-deposit re-sort to the CLIENT's predicted container right now, so the + // items show their final packed order ([64,1]) from the first frame. Without this the client + // briefly renders its raw deposit prediction ([1,64]) and then jumps when the server's re-sort + // syncs back — a visible flicker. Mirrors reorderFilteredGroups exactly. + applyClientDepositReorder(whitelists); + + // Ask the server to re-sort the container's filtered groups by priority order, so a + // just-deposited higher-priority item ends up ahead of lower-priority ones already stored + // (the deposit above only fills slots; it never relocates existing stacks). + if (dev.architectury.networking.NetworkManager.canServerReceive( + io.github.marcsanzdev.chestseparators.network.SortOpenFiltersPayload.TYPE)) { + dev.architectury.networking.NetworkManager.sendToServer( + new io.github.marcsanzdev.chestseparators.network.SortOpenFiltersPayload()); + } + } else { + // Be specific: "no filters at all" is a different situation from "filters exist but none has + // room / matches", and reads far clearer to the player. Both use the same muted grey as the + // pull/grab empty notices so every "nothing happened" message looks the same across the mod. + boolean anyContainerFilter = false; + for (net.minecraft.world.inventory.Slot s : accessor.getHandler().slots) { + if (!(s.container instanceof net.minecraft.world.entity.player.Inventory) + && whitelists != null + && whitelists.containsKey(s.getContainerSlot())) { + anyContainerFilter = true; + break; + } + } + showStatus( + net.minecraft.network.chat.Component.translatable( + anyContainerFilter + ? "message.chestseparators.push_no_slot" + : "message.chestseparators.push_no_filters"), + net.minecraft.ChatFormatting.GRAY); + } + } + + /** + * Client-side mirror of {@code ModNetworking.reorderFilteredGroups}: packs each filtered group's stacks + * by the filter's priority order (fuller stack first for a same-item tie) into its lowest slots, applied + * to the open container's predicted slots so the deposit's final layout is shown with no flicker. + */ + private void applyClientDepositReorder( + Map whitelists) { + if (whitelists == null || whitelists.isEmpty()) return; + + java.util.Map> groups = + new java.util.LinkedHashMap<>(); + for (net.minecraft.world.inventory.Slot s : accessor.getHandler().slots) { + if (s.container instanceof net.minecraft.world.entity.player.Inventory) continue; + io.github.marcsanzdev.chestseparators.data.SlotWhitelist wl = whitelists.get(s.getContainerSlot()); + if (wl == null || wl.groupId() == null) continue; + groups.computeIfAbsent(wl.groupId(), g -> new ArrayList<>()).add(s); + } + + for (List gslots : groups.values()) { + if (gslots.size() < 2) continue; + gslots.sort(java.util.Comparator.comparingInt(net.minecraft.world.inventory.Slot::getContainerSlot)); + List order = whitelists + .get(gslots.get(0).getContainerSlot()) + .allowedItems(); + + List stacks = new ArrayList<>(); + for (net.minecraft.world.inventory.Slot s : gslots) { + if (!s.getItem().isEmpty()) stacks.add(s.getItem()); + } + if (stacks.isEmpty()) continue; + stacks.sort(java.util.Comparator.comparingInt(st -> { + int r = order.indexOf(net.minecraft.core.registries.BuiltInRegistries.ITEM + .getKey(st.getItem()) + .toString()); + return r < 0 ? Integer.MAX_VALUE : r; + }) + .thenComparing(java.util.Comparator.comparingInt( + net.minecraft.world.item.ItemStack::getCount) + .reversed())); + + for (int i = 0; i < gslots.size(); i++) { + gslots.get(i) + .set(i < stacks.size() ? stacks.get(i) : net.minecraft.world.item.ItemStack.EMPTY); + } + } + } + + private void collectTargetSlots( + List list, + Map whitelists, + String itemId, + net.minecraft.world.item.ItemStack stack, + boolean checkExisting, + boolean unfilteredOnly) { + List collected = new ArrayList<>(); + for (net.minecraft.world.inventory.Slot chestSlot : accessor.getHandler().slots) { + if (chestSlot.container instanceof net.minecraft.world.entity.player.Inventory) continue; + if (list.contains(chestSlot)) continue; + + boolean hasFilter = whitelists != null && whitelists.containsKey(chestSlot.getContainerSlot()); + boolean matchesFilter = hasFilter + && whitelists.get(chestSlot.getContainerSlot()).allowedItems().contains(itemId); + + if (unfilteredOnly) { + if (hasFilter) continue; + } else { + if (!matchesFilter) continue; + } + + if (checkExisting) { + if (!chestSlot.hasItem()) continue; + if (!net.minecraft.world.item.ItemStack.isSameItem(stack, chestSlot.getItem()) + || !net.minecraft.world.item.ItemStack.isSameItemSameComponents(stack, chestSlot.getItem())) + continue; + if (chestSlot.getItem().getCount() >= chestSlot.getItem().getMaxStackSize()) continue; + } else { + if (chestSlot.hasItem()) continue; + } + collected.add(chestSlot); + } + + // Empty filtered slots are filled in the filter's own order: the item first in the list heads for + // the group's first slot, and so on. Ties (and every other pass) keep the handler's slot order. + if (!checkExisting && !unfilteredOnly) { + collected.sort(java.util.Comparator.comparingInt( + s -> io.github.marcsanzdev.chestseparators.util.FilterPriority.slotPreference( + whitelists, s.getContainerSlot(), itemId))); + } + list.addAll(collected); + } + + /** + * Client-side simulation of the Pull button for its hover preview: marks each container slot whose + * item would be pulled into the inventory (via the inventory filters' keep-limits, or — with Shift — + * any unfiltered item), storing the amount that would remain afterwards in {@link #previewSourceRemaining}. + * Mirrors {@code performFillFromOpenContainer} on the server. + */ + public void updateFillPreview(boolean shift) { + previewSourceRemaining.clear(); + previewTargetIncoming.clear(); + if (accessor.getHandler() == null || net.minecraft.client.Minecraft.getInstance().player == null) return; + + java.util.Map invFilters = + ChestConfigManager.getInstance().getPlayerInventoryFilters(); + + // Player MAIN inventory slots, in handler order, so we can simulate where each pulled item lands. + java.util.List playerSlots = new java.util.ArrayList<>(); + for (net.minecraft.world.inventory.Slot s : accessor.getHandler().slots) { + if (s.container instanceof net.minecraft.world.entity.player.Inventory) playerSlots.add(s); + } + // Match the server's fill order: Inventory#getFreeSlot scans items[0..35] (hotbar first), so sort by + // container slot or the shift-overflow ghost lands in the main inventory instead of the hotbar. + playerSlots.sort(java.util.Comparator.comparingInt(net.minecraft.world.inventory.Slot::getContainerSlot)); + + for (net.minecraft.world.inventory.Slot chestSlot : accessor.getHandler().slots) { + if (chestSlot.container instanceof net.minecraft.world.entity.player.Inventory || !chestSlot.hasItem()) + continue; + net.minecraft.world.item.ItemStack stack = chestSlot.getItem(); + String itemId = net.minecraft.core.registries.BuiltInRegistries.ITEM + .getKey(stack.getItem()) + .toString(); + + // Mirrors performFillFromOpenContainer: pull items the inventory filters list; with Shift, pull + // everything into free space. + if (!shift && !inventoryListsItemClient(invFilters, itemId)) continue; + + int placed = placeIntoPlayerPreview(playerSlots, invFilters, stack, itemId, stack.getCount(), shift); + if (placed <= 0) continue; // inventory full — nothing actually moves from this slot + previewSourceRemaining.put(chestSlot.index, stack.getCount() - placed); + } + + // Mirror the server's post-pull inventory group re-sort (honouring the hotbar lock) so the preview + // shows the same final layout the real pull will produce. + boolean lockHotbar = io.github.marcsanzdev.chestseparators.config.GlobalChestConfig.instance == null + || io.github.marcsanzdev.chestseparators.config.GlobalChestConfig.instance.lockHotbarOnReorder; + int firstSortable = lockHotbar ? 9 : 0; + java.util.List mainSlots = new java.util.ArrayList<>(); + for (net.minecraft.world.inventory.Slot s : playerSlots) { + int idx = realIndex(s); + if (idx >= firstSortable && idx < net.minecraft.world.entity.player.Inventory.INVENTORY_SIZE) { + mainSlots.add(s); + } + } + applyPreviewReorder(mainSlots, invFilters, ChestSeparatorsEditor::realIndex); + } + + /** + * Simulates PlayerInventory#insertStack (with the mod's inventory-filter routing) for the pull + * preview: tops up matching partial stacks first, then places into empty slots honouring the filters — + * an item prefers an empty slot whose active filter lists it, and never lands in a slot reserved for a + * different item — exactly as {@code PlayerInventoryFilterMixin#getEmptySlot} does at pull time. + * Accumulates the projected incoming amount per player slot in {@link #previewTargetIncoming}. + * Returns how many of {@code amount} actually fit. + */ + private int placeIntoPlayerPreview( + java.util.List playerSlots, + java.util.Map invFilters, + net.minecraft.world.item.ItemStack stack, + String itemId, + int amount, + boolean shift) { + int maxC = stack.getMaxStackSize(); + int left = amount; + + // Pass 1: top up existing matching stacks (real contents or already-projected incoming). + for (net.minecraft.world.inventory.Slot ps : playerSlots) { + if (left <= 0) break; + if (!shift) { + io.github.marcsanzdev.chestseparators.data.SlotWhitelist wl = + invFilters != null ? invFilters.get(ps.getContainerSlot()) : null; + if (wl == null || !wl.allowedItems().contains(itemId)) continue; + } + net.minecraft.world.item.ItemStack real = ps.getItem(); + net.minecraft.world.item.ItemStack proj = previewTargetIncoming.get(ps.index); + int current; + if (!real.isEmpty()) { + if (!net.minecraft.world.item.ItemStack.isSameItemSameComponents(stack, real)) continue; + current = real.getCount() + (proj != null ? proj.getCount() : 0); + } else if (proj != null) { + if (!net.minecraft.world.item.ItemStack.isSameItemSameComponents(stack, proj)) continue; + current = proj.getCount(); + } else { + continue; // empty slot handled below + } + int canAdd = maxC - current; + if (canAdd <= 0) continue; + int add = Math.min(left, canAdd); + if (!shift) add = Math.min(add, + previewInboundRoom(playerSlots, invFilters, ps.getContainerSlot(), itemId)); + if (add <= 0) continue; + if (proj == null) previewTargetIncoming.put(ps.index, stack.copyWithCount(add)); + else proj.setCount(proj.getCount() + add); + left -= add; + } + + if (!shift) { + // Pass 2 (no Shift): drop the remainder ONLY into empty filtered slots, in filter priority order — + // never overflow into unfiltered slots. Mirrors insertRespectingFilter phase 2 exactly. + java.util.List emptyFiltered = new java.util.ArrayList<>(); + for (net.minecraft.world.inventory.Slot ps : playerSlots) { + if (!ps.getItem().isEmpty() || previewTargetIncoming.containsKey(ps.index)) continue; + io.github.marcsanzdev.chestseparators.data.SlotWhitelist wl = + invFilters != null ? invFilters.get(ps.getContainerSlot()) : null; + if (wl == null || !wl.allowedItems().contains(itemId)) continue; + emptyFiltered.add(ps); + } + emptyFiltered.sort(java.util.Comparator.comparingInt( + (net.minecraft.world.inventory.Slot ps) -> + io.github.marcsanzdev.chestseparators.util.FilterPriority.slotPreference( + invFilters, ps.getContainerSlot(), itemId)) + .thenComparingInt(net.minecraft.world.inventory.Slot::getContainerSlot)); + for (net.minecraft.world.inventory.Slot ps : emptyFiltered) { + if (left <= 0) break; + int add = Math.min(left, maxC); + add = Math.min(add, previewInboundRoom(playerSlots, invFilters, ps.getContainerSlot(), itemId)); + if (add <= 0) continue; + previewTargetIncoming.put(ps.index, stack.copyWithCount(add)); + left -= add; + } + } else { + // Pass 2 (Shift): empty slots one at a time via the filter-aware getEmptySlot equivalent, which + // falls back to any unreserved empty slot (mirrors the vanilla spill of Inventory#add). + while (left > 0) { + net.minecraft.world.inventory.Slot target = findPreviewEmptySlot(playerSlots, invFilters, itemId); + if (target == null) break; + int add = Math.min(left, maxC); + previewTargetIncoming.put(target.index, stack.copyWithCount(add)); + left -= add; + } + } + return amount - left; + } + + /** Client-side mirror of ModNetworking.availableInboundRoom (includes projected incoming items). */ + private int previewInboundRoom( + java.util.List playerSlots, + java.util.Map filters, + int destIndex, String itemId) { + if (filters == null) return Integer.MAX_VALUE; + var filter = filters.get(destIndex); + if (filter == null || filter.targetCount() <= 0 || filter.groupId() == null) return Integer.MAX_VALUE; + + int held = 0; + for (net.minecraft.world.inventory.Slot s : playerSlots) { + var otherFilter = filters.get(s.getContainerSlot()); + if (otherFilter == null || !filter.groupId().equals(otherFilter.groupId()) + || !otherFilter.allowedItems().contains(itemId)) continue; + var existing = s.getItem(); + if (!existing.isEmpty() && net.minecraft.core.registries.BuiltInRegistries.ITEM + .getKey(existing.getItem()).toString().equals(itemId)) held += existing.getCount(); + var pending = previewTargetIncoming.get(s.index); + if (pending != null && !pending.isEmpty() && net.minecraft.core.registries.BuiltInRegistries.ITEM + .getKey(pending.getItem()).toString().equals(itemId)) held += pending.getCount(); + } + return io.github.marcsanzdev.chestseparators.util.InventoryTransferPolicy + .inboundRoom(filter.targetCount(), held); + } + + /** Mirror of PlayerInventoryFilterMixin#getEmptySlot: preferred filtered empty slot, else first unreserved. */ + private net.minecraft.world.inventory.Slot findPreviewEmptySlot( + java.util.List playerSlots, + java.util.Map invFilters, + String itemId) { + // Preferred: the empty slot whose active filter lists this item and whose place in the filter's + // order best fits it (item first in the list -> group's first slot, and so on; ties keep the + // lowest index). Mirrors the same slotPreference choice getEmptySlot makes at pull time. + net.minecraft.world.inventory.Slot best = null; + int bestPreference = Integer.MAX_VALUE; + for (net.minecraft.world.inventory.Slot ps : playerSlots) { + if (!ps.getItem().isEmpty() || previewTargetIncoming.containsKey(ps.index)) continue; + io.github.marcsanzdev.chestseparators.data.SlotWhitelist wl = + invFilters != null ? invFilters.get(ps.getContainerSlot()) : null; + if (wl == null || !isSlotFilterActive(wl) || !wl.allowedItems().contains(itemId)) continue; + int preference = io.github.marcsanzdev.chestseparators.util.FilterPriority.slotPreference( + invFilters, ps.getContainerSlot(), itemId); + if (preference < bestPreference) { + bestPreference = preference; + best = ps; + } + } + if (best != null) return best; + // Otherwise the first empty slot not reserved for a DIFFERENT item. + for (net.minecraft.world.inventory.Slot ps : playerSlots) { + if (!ps.getItem().isEmpty() || previewTargetIncoming.containsKey(ps.index)) continue; + io.github.marcsanzdev.chestseparators.data.SlotWhitelist wl = + invFilters != null ? invFilters.get(ps.getContainerSlot()) : null; + boolean reservedForOther = + wl != null && isSlotFilterActive(wl) && !wl.allowedItems().contains(itemId); + if (!reservedForOther) return ps; + } + return null; + } + + private static boolean isSlotFilterActive(io.github.marcsanzdev.chestseparators.data.SlotWhitelist wl) { + return wl.allowHopper() || wl.allowManual() || wl.allowShift(); + } + + /** Client mirror of the server's inventoryListsItem: does any inventory filter list this item? */ + private boolean inventoryListsItemClient( + java.util.Map invFilters, + String itemId) { + if (invFilters == null) return false; + for (io.github.marcsanzdev.chestseparators.data.SlotWhitelist wl : invFilters.values()) { + if (wl.allowedItems().contains(itemId)) return true; + } + return false; + } + + /** + * True when a push/pull preview is active and this slot is part of it — the vanilla item render is + * then suppressed for that slot so the preview draws a clean ghost with no real item (and its count) + * bleeding through underneath. + */ + public boolean isPreviewSlot(net.minecraft.world.inventory.Slot slot) { + if (!isHoveringDeposit && !isHoveringFill) return false; + return previewSourceRemaining.containsKey(slot.index) || previewTargetIncoming.containsKey(slot.index); + } + + /** + * Predicts the complete Push action, starting with the SAME main-inventory refill that Push performs. + * Every projected slot is a full final stack (including newly filled player slots), not an incoming + * delta. No real inventory or menu contents are changed when the player merely hovers the button. + */ + public void updateDepositPreview(boolean shift) { + previewSourceRemaining.clear(); + previewTargetIncoming.clear(); + if (accessor.getHandler() == null || net.minecraft.client.Minecraft.getInstance().player == null) return; + if (!accessor.getHandler().getCarried().isEmpty()) return; // Push refuses a nonempty cursor + + var player = net.minecraft.client.Minecraft.getInstance().player; + var inventory = player.getInventory(); + var whitelists = io.github.marcsanzdev.chestseparators.data.ChestConfigManager.getInstance() + .getCurrentWhitelists(); + var invFilters = io.github.marcsanzdev.chestseparators.data.ChestConfigManager.getInstance() + .getPlayerInventoryFilters(); + + java.util.List predicted = new java.util.ArrayList<>(); + for (int raw = 0; raw < inventory.getContainerSize(); raw++) { + predicted.add(inventory.getItem(raw).copy()); + } + io.github.marcsanzdev.chestseparators.util.InventorySlotRefill.refillStacks( + predicted, invFilters, inventory::getMaxStackSize); + + java.util.List chestSlots = new java.util.ArrayList<>(); + java.util.Map chestState = new java.util.HashMap<>(); + for (net.minecraft.world.inventory.Slot slot : accessor.getHandler().slots) { + if (!(slot.container instanceof net.minecraft.world.entity.player.Inventory)) { + chestSlots.add(slot); + chestState.put(slot.index, slot.getItem().copy()); + } + } + + boolean depositedAnything = false; + for (net.minecraft.world.inventory.Slot slot : accessor.getHandler().slots) { + if (!(slot.container instanceof net.minecraft.world.entity.player.Inventory)) continue; + int raw = slot.getContainerSlot(); + if (raw < 0 || raw >= predicted.size()) continue; + net.minecraft.world.item.ItemStack stack = predicted.get(raw); + if (stack.isEmpty()) continue; + int movable = io.github.marcsanzdev.chestseparators.util.InventoryProtection + .movableCount(predicted, invFilters, raw); + if (movable <= 0) continue; + String itemId = net.minecraft.core.registries.BuiltInRegistries.ITEM.getKey(stack.getItem()).toString(); + int left = movable; + left = simulateDepositPass(chestSlots, chestState, whitelists, stack, itemId, left, true, false); + left = simulateDepositPass(chestSlots, chestState, whitelists, stack, itemId, left, false, false); + if (shift) { + left = simulateDepositPass(chestSlots, chestState, whitelists, stack, itemId, left, true, true); + left = simulateDepositPass(chestSlots, chestState, whitelists, stack, itemId, left, false, true); + } + int moved = movable - left; + if (moved > 0) { + depositedAnything = true; + int count = stack.getCount() - moved; + predicted.set(raw, count == 0 ? net.minecraft.world.item.ItemStack.EMPTY : stack.copyWithCount(count)); + } + } + + // The real Push requests post-deposit reordering only when it transferred something. + if (depositedAnything) reorderProjectedChest(chestSlots, chestState, whitelists); + + for (net.minecraft.world.inventory.Slot slot : accessor.getHandler().slots) { + net.minecraft.world.item.ItemStack finalStack; + if (slot.container instanceof net.minecraft.world.entity.player.Inventory) { + int raw = slot.getContainerSlot(); + if (raw < 0 || raw >= predicted.size()) continue; + finalStack = predicted.get(raw); + } else { + finalStack = chestState.get(slot.index); + } + net.minecraft.world.item.ItemStack actual = slot.getItem(); + if (actual.getCount() != finalStack.getCount() + || !net.minecraft.world.item.ItemStack.isSameItemSameComponents(actual, finalStack)) { + previewTargetIncoming.put(slot.index, finalStack.copy()); + } + } + } + + /** Reproduces collectTargetSlots' four passes against predicted, mutable chest contents. */ + private int simulateDepositPass( + java.util.List chestSlots, + java.util.Map state, + Map whitelists, + net.minecraft.world.item.ItemStack source, + String itemId, int remaining, boolean checkExisting, boolean unfilteredOnly) { + if (remaining <= 0) return remaining; + java.util.List candidates = new java.util.ArrayList<>(); + for (net.minecraft.world.inventory.Slot slot : chestSlots) { + var filter = whitelists == null ? null : whitelists.get(slot.getContainerSlot()); + if (unfilteredOnly ? filter != null : filter == null || !filter.allowedItems().contains(itemId)) continue; + net.minecraft.world.item.ItemStack existing = state.get(slot.index); + if (checkExisting) { + if (existing.isEmpty() || !net.minecraft.world.item.ItemStack.isSameItemSameComponents(existing, source) + || existing.getCount() >= source.getMaxStackSize()) continue; + } else if (!existing.isEmpty()) { + continue; + } + candidates.add(slot); + } + if (!checkExisting && !unfilteredOnly) { + candidates.sort(java.util.Comparator.comparingInt(slot -> + io.github.marcsanzdev.chestseparators.util.FilterPriority.slotPreference( + whitelists, slot.getContainerSlot(), itemId))); + } + for (net.minecraft.world.inventory.Slot slot : candidates) { + if (remaining <= 0) break; + net.minecraft.world.item.ItemStack existing = state.get(slot.index); + int room = source.getMaxStackSize() - existing.getCount(); + if (room <= 0) continue; + int moved = Math.min(room, remaining); + if (existing.isEmpty()) state.put(slot.index, source.copyWithCount(moved)); + else existing.grow(moved); + remaining -= moved; + } + return remaining; + } + + /** Final virtual re-sort equivalent to the real container group's post-Push packing. */ + private void reorderProjectedChest( + java.util.List chestSlots, + java.util.Map state, + Map whitelists) { + if (whitelists == null || whitelists.isEmpty()) return; + java.util.Map> groups = + new java.util.LinkedHashMap<>(); + for (var slot : chestSlots) { + var wl = whitelists.get(slot.getContainerSlot()); + if (wl == null || wl.groupId() == null) continue; + groups.computeIfAbsent(wl.groupId(), ignored -> new java.util.ArrayList<>()).add(slot); + } + for (var group : groups.values()) { + if (group.size() < 2) continue; + group.sort(java.util.Comparator.comparingInt(net.minecraft.world.inventory.Slot::getContainerSlot)); + java.util.List priority = whitelists.get(group.get(0).getContainerSlot()).allowedItems(); + java.util.List stored = new java.util.ArrayList<>(); + for (var slot : group) { + var item = state.get(slot.index); + if (!item.isEmpty()) stored.add(item.copy()); + } + stored.sort(java.util.Comparator.comparingInt(item -> { + int order = priority.indexOf(net.minecraft.core.registries.BuiltInRegistries.ITEM + .getKey(item.getItem()).toString()); + return order < 0 ? Integer.MAX_VALUE : order; + }).thenComparing(java.util.Comparator.comparingInt( + net.minecraft.world.item.ItemStack::getCount).reversed())); + for (int i = 0; i < group.size(); i++) { + state.put(group.get(i).index, i < stored.size() ? stored.get(i) : net.minecraft.world.item.ItemStack.EMPTY); + } + } + } + + /** + * Rewrites {@link #previewTargetIncoming} so the preview shows the SAME final arrangement the real + * push/pull produces — including the server's per-group priority re-sort. Programming rule of this mod: + * a preview must ALWAYS render exactly what the action will do, so any change to the placement/sort + * logic must be mirrored here. Two steps: (1) turn every projected entry from an "incoming delta" into + * the slot's FINAL full stack, then (2) for each filtered group among {@code destSlots}, re-lay the + * group's final stacks in priority order packed to the first slot — mirroring + * {@code ChestSeparatorsMain#reorderFilteredGroups}. Slots that end unchanged are dropped from the map + * (so they render normally); slots emptied by the sort are stored as an empty stack. + * + * @param destSlots the slots the action re-sorts (chest slots for push; player MAIN slots, minus the + * hotbar when locked, for pull) + * @param whitelists filters keyed the way {@code indexOf} keys the slots + * @param indexOf maps a slot to its whitelist key (raw index for a chest, realIndex for the inventory) + */ + private void applyPreviewReorder( + java.util.List destSlots, + java.util.Map whitelists, + java.util.function.ToIntFunction indexOf) { + if (whitelists == null || whitelists.isEmpty() || previewTargetIncoming.isEmpty()) return; + + // Step 1: incoming delta -> final full stack, for every currently projected slot. + for (Integer slotId : new java.util.ArrayList<>(previewTargetIncoming.keySet())) { + net.minecraft.world.inventory.Slot s = accessor.getHandler().getSlot(slotId); + net.minecraft.world.item.ItemStack inc = previewTargetIncoming.get(slotId); + net.minecraft.world.item.ItemStack fin = inc.copy(); + if (!s.getItem().isEmpty() && net.minecraft.world.item.ItemStack.isSameItemSameComponents(s.getItem(), inc)) { + fin.setCount(s.getItem().getCount() + inc.getCount()); + } + previewTargetIncoming.put(slotId, fin); + } + + // Step 2: re-sort each filtered group by priority order, packed to its first slot. + java.util.Map> groups = + new java.util.LinkedHashMap<>(); + for (net.minecraft.world.inventory.Slot s : destSlots) { + io.github.marcsanzdev.chestseparators.data.SlotWhitelist wl = whitelists.get(indexOf.applyAsInt(s)); + if (wl == null || wl.groupId() == null) continue; + groups.computeIfAbsent(wl.groupId(), g -> new java.util.ArrayList<>()) + .add(s); + } + for (java.util.List gslots : groups.values()) { + if (gslots.size() < 2) continue; + gslots.sort(java.util.Comparator.comparingInt(indexOf)); + java.util.List order = + whitelists.get(indexOf.applyAsInt(gslots.get(0))).allowedItems(); + + // Final content of each group slot: the projected override if present, else its real stack. + java.util.List finals = new java.util.ArrayList<>(); + for (net.minecraft.world.inventory.Slot s : gslots) { + net.minecraft.world.item.ItemStack fin = + previewTargetIncoming.containsKey(s.index) ? previewTargetIncoming.get(s.index) : s.getItem(); + if (!fin.isEmpty()) finals.add(fin); + } + finals.sort(java.util.Comparator.comparingInt(st -> { + int r = order.indexOf(net.minecraft.core.registries.BuiltInRegistries.ITEM + .getKey(st.getItem()) + .toString()); + return r < 0 ? Integer.MAX_VALUE : r; + }) + // Match reorderFilteredGroups: same-item overflow packs the fuller stack first, so the + // preview shows exactly what the deposit + server re-sort will produce ([64,1] not [1,64]). + .thenComparing(java.util.Comparator.comparingInt( + net.minecraft.world.item.ItemStack::getCount) + .reversed())); + + for (int i = 0; i < gslots.size(); i++) { + net.minecraft.world.inventory.Slot s = gslots.get(i); + net.minecraft.world.item.ItemStack fin = + i < finals.size() ? finals.get(i) : net.minecraft.world.item.ItemStack.EMPTY; + net.minecraft.world.item.ItemStack real = s.getItem(); + boolean unchanged = net.minecraft.world.item.ItemStack.isSameItemSameComponents(fin, real) + && fin.getCount() == real.getCount(); + if (unchanged) previewTargetIncoming.remove(s.index); + else previewTargetIncoming.put(s.index, fin); + } + } + } +} diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/EditorGeometry.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/EditorGeometry.java new file mode 100644 index 0000000..97fdcf4 --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/EditorGeometry.java @@ -0,0 +1,180 @@ +package io.github.marcsanzdev.chestseparators.client.ui; + +import io.github.marcsanzdev.chestseparators.data.ChestConfigManager; +import io.github.marcsanzdev.chestseparators.mixin.client.HandledScreenAccessor; +import java.util.UUID; +import net.minecraft.world.inventory.Slot; + +public class EditorGeometry { + + private final EditorSessionData session; + private final HandledScreenAccessor accessor; + + public EditorGeometry(EditorSessionData session, HandledScreenAccessor accessor) { + this.session = session; + this.accessor = accessor; + } + + public int getContainerSlotCount() { + int count = 0; + for (Slot slot : accessor.getHandler().slots) { + if (ChestSeparatorsEditor.isEditableSlot(slot)) { + count++; + } + } + return count; + } + + /** Number of editable slots in one namespace (player inventory vs container), for grid bounds. */ + public int getNamespaceSlotCount(boolean player) { + int count = 0; + for (Slot slot : accessor.getHandler().slots) { + if (ChestSeparatorsEditor.isEditableSlot(slot) && ChestSeparatorsEditor.isPlayerSlot(slot) == player) { + count++; + } + } + return count; + } + + public UUID getGroupIdForSlot(int slotIndex) { + var whitelists = ChestConfigManager.getInstance().getCurrentWhitelists(); + if (whitelists != null && whitelists.containsKey(slotIndex)) { + return whitelists.get(slotIndex).groupId(); + } + return null; + } + + public int calculateAction(Slot slot, double mouseX, double mouseY) { + int guiX = accessor.getX(); + int guiY = accessor.getY(); + double relativeX = mouseX - (guiX + slot.x); + double relativeY = mouseY - (guiY + slot.y); + + // Shrink the dead zone (ACTION_BG) to a small 4x4 pixel square in the exact center. + if (relativeX >= 6 && relativeX <= 10 && relativeY >= 6 && relativeY <= 10) return ChestConfigManager.ACTION_BG; + + double distTop = Math.abs(relativeY); + double distBottom = Math.abs(relativeY - 16); + double distLeft = Math.abs(relativeX); + double distRight = Math.abs(relativeX - 16); + double minDist = Math.min(Math.min(distTop, distBottom), Math.min(distLeft, distRight)); + + // Increase the edge detection range to cover the rest of the slot + if (minDist <= 8.0) { + if (minDist == distTop) return ChestConfigManager.ACTION_TOP; + else if (minDist == distBottom) return ChestConfigManager.ACTION_BOTTOM; + else if (minDist == distLeft) return ChestConfigManager.ACTION_LEFT; + else if (minDist == distRight) return ChestConfigManager.ACTION_RIGHT; + } + return 0; + } + + public String calculateTraceStep(Slot hoverSlot, double mouseX, double mouseY) { + int guiX = accessor.getX(); + int guiY = accessor.getY(); + + if (session.lockedTraceAxis == 1) { + // A pull of more than 7.5 px away from the locked horizontal axis transitions to vertical rail. + if (Math.abs(mouseY - session.lockedLineCoord) > 7.5) { + session.lockedTraceAxis = 2; + double relativeX = mouseX - (guiX + hoverSlot.x); + double distLeft = Math.abs(relativeX); + double distRight = Math.abs(relativeX - 16); + session.lockedTraceAction = + (distLeft <= distRight) ? ChestConfigManager.ACTION_LEFT : ChestConfigManager.ACTION_RIGHT; + session.lockedLineCoord = (distLeft <= distRight) ? (guiX + hoverSlot.x) : (guiX + hoverSlot.x + 16); + session.lockedTraceRowCol = ChestSeparatorsEditor.realIndex(hoverSlot) % 9; + return ChestSeparatorsEditor.slotKey(hoverSlot) + "_" + session.lockedTraceAction; + } else { + // Armor/offhand are isolated non-grid cells: keep the locked action but paint it on + // the hovered cell itself instead of projecting along a meaningless grid row/col. + if (ChestConfigManager.isNonGridInventoryKey(ChestSeparatorsEditor.slotKey(hoverSlot))) + return ChestSeparatorsEditor.slotKey(hoverSlot) + "_" + session.lockedTraceAction; + int col = ChestSeparatorsEditor.realIndex(hoverSlot) % 9; + int correctSlotIndex = (session.lockedTraceRowCol * 9) + col; + return (correctSlotIndex + + (ChestSeparatorsEditor.isPlayerSlot(hoverSlot) + ? ChestConfigManager.PLAYER_KEY_OFFSET + : 0)) + + "_" + session.lockedTraceAction; + } + } else if (session.lockedTraceAxis == 2) { + // A pull of more than 7.5 px away from the locked vertical axis transitions to horizontal rail. + if (Math.abs(mouseX - session.lockedLineCoord) > 7.5) { + session.lockedTraceAxis = 1; + double relativeY = mouseY - (guiY + hoverSlot.y); + double distTop = Math.abs(relativeY); + double distBottom = Math.abs(relativeY - 16); + session.lockedTraceAction = + (distTop <= distBottom) ? ChestConfigManager.ACTION_TOP : ChestConfigManager.ACTION_BOTTOM; + session.lockedLineCoord = (distTop <= distBottom) ? (guiY + hoverSlot.y) : (guiY + hoverSlot.y + 16); + session.lockedTraceRowCol = ChestSeparatorsEditor.realIndex(hoverSlot) / 9; + return ChestSeparatorsEditor.slotKey(hoverSlot) + "_" + session.lockedTraceAction; + } else { + // Armor/offhand are isolated non-grid cells: keep the locked action but paint it on + // the hovered cell itself instead of projecting along a meaningless grid row/col. + if (ChestConfigManager.isNonGridInventoryKey(ChestSeparatorsEditor.slotKey(hoverSlot))) + return ChestSeparatorsEditor.slotKey(hoverSlot) + "_" + session.lockedTraceAction; + int row = ChestSeparatorsEditor.realIndex(hoverSlot) / 9; + int correctSlotIndex = (row * 9) + session.lockedTraceRowCol; + return (correctSlotIndex + + (ChestSeparatorsEditor.isPlayerSlot(hoverSlot) + ? ChestConfigManager.PLAYER_KEY_OFFSET + : 0)) + + "_" + session.lockedTraceAction; + } + } + + int action = calculateAction(hoverSlot, mouseX, mouseY); + return action == 0 ? "" : (ChestSeparatorsEditor.slotKey(hoverSlot) + "_" + action); + } + + public boolean isDraggingRectangle(double mouseX, double mouseY) { + int minRow = Math.min( + ChestSeparatorsEditor.realIndex(session.dragStartSlot) / 9, + ChestSeparatorsEditor.realIndex(session.dragCurrentSlot) / 9); + int maxRow = Math.max( + ChestSeparatorsEditor.realIndex(session.dragStartSlot) / 9, + ChestSeparatorsEditor.realIndex(session.dragCurrentSlot) / 9); + int minCol = Math.min( + ChestSeparatorsEditor.realIndex(session.dragStartSlot) % 9, + ChestSeparatorsEditor.realIndex(session.dragCurrentSlot) % 9); + int maxCol = Math.max( + ChestSeparatorsEditor.realIndex(session.dragStartSlot) % 9, + ChestSeparatorsEditor.realIndex(session.dragCurrentSlot) % 9); + + // Spanning multiple rows AND columns is always a 2-D rectangle. + if (minRow != maxRow && minCol != maxCol) return true; + + int guiX = accessor.getX(); + int guiY = accessor.getY(); + + if (minRow == maxRow) { + // Crossing the slot midpoint vertically while on a horizontal edge converts to a rectangle. + if (session.currentDragAction == ChestConfigManager.ACTION_TOP + && mouseY > (guiY + session.dragStartSlot.y + 8)) return true; + if (session.currentDragAction == ChestConfigManager.ACTION_BOTTOM + && mouseY < (guiY + session.dragStartSlot.y + 8)) return true; + + // Dragging a left/right edge across multiple columns also forms a rectangle. + if (minCol != maxCol + && (session.currentDragAction == ChestConfigManager.ACTION_LEFT + || session.currentDragAction == ChestConfigManager.ACTION_RIGHT)) return true; + } + + if (minCol == maxCol) { + // Crossing the slot midpoint horizontally while on a vertical edge converts to a rectangle. + if (session.currentDragAction == ChestConfigManager.ACTION_LEFT + && mouseX > (guiX + session.dragStartSlot.x + 8)) return true; + if (session.currentDragAction == ChestConfigManager.ACTION_RIGHT + && mouseX < (guiX + session.dragStartSlot.x + 8)) return true; + + // Dragging a top/bottom edge across multiple rows also forms a rectangle. + if (minRow != maxRow + && (session.currentDragAction == ChestConfigManager.ACTION_TOP + || session.currentDragAction == ChestConfigManager.ACTION_BOTTOM)) return true; + } + + return false; + } +} diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/EditorInputHandler.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/EditorInputHandler.java new file mode 100644 index 0000000..22ccdbc --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/EditorInputHandler.java @@ -0,0 +1,381 @@ +package io.github.marcsanzdev.chestseparators.client.ui; + +import com.mojang.blaze3d.platform.InputConstants; +import io.github.marcsanzdev.chestseparators.access.IWhitelistProvider; +import io.github.marcsanzdev.chestseparators.client.EditorState; +import io.github.marcsanzdev.chestseparators.config.GlobalChestConfig; +import io.github.marcsanzdev.chestseparators.data.ChestConfigManager; +import io.github.marcsanzdev.chestseparators.mixin.client.HandledScreenAccessor; +import java.util.ArrayList; +import java.util.List; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen; +import net.minecraft.client.input.CharacterEvent; +import net.minecraft.client.input.KeyEvent; +import net.minecraft.world.item.Item; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.world.inventory.ChestMenu; +import net.minecraft.network.chat.Component; +import net.minecraft.ChatFormatting; +import net.minecraft.resources.Identifier; +import net.minecraft.util.Mth; + +public class EditorInputHandler { + + private final ChestSeparatorsEditor editor; + private final EditorSessionData session; + private final EditorGeometry geometry; + private final AbstractContainerScreen screen; + private final HandledScreenAccessor accessor; + + private final EditorLayout layout; + + public EditorInputHandler( + ChestSeparatorsEditor editor, + EditorSessionData session, + EditorGeometry geometry, + EditorLayout layout, + AbstractContainerScreen screen, + HandledScreenAccessor accessor) { + this.editor = editor; + this.session = session; + this.geometry = geometry; + this.layout = layout; + this.screen = screen; + this.accessor = accessor; + } + + // Mouse click/release/drag/scroll are routed here from the common GenericContainerScreenMixin + // (which injects into AbstractContainerScreen's mouse handlers). Each returns the Fabric-style + // "allow" boolean: true lets the vanilla handler run, false cancels it because the editor consumed it. + + public boolean onMouseReleased(double mouseX, double mouseY, int button) { + if (button == 0) editor.screenEditFilter.stopRetentionDrag(); + session.isDraggingMainScroll = false; + session.isDraggingListScroll = false; + + if (session.isColorPickerOpen) { + editor.screenColorPicker.mouseReleased(mouseX, mouseY, button); + return true; + } + + if (session.reorderDragItem != null || session.pendingDragItem != null) { + editor.screenEditFilter.commitPointerRelease(mouseX, mouseY); + return true; + } + + if (button == 0 && session.isDraggingLine) { + if (session.currentState == EditorState.VIEW_GROUPS + || session.currentState == EditorState.SELECT_SLOTS) { + + editor.screenViewGroups.mouseReleased(mouseX, mouseY, button); + + } else if (session.currentState == EditorState.DRAW_LINES) { + editor.screenDrawLines.commitDrag(mouseX, mouseY); + session.isDraggingLine = false; + session.currentDragAction = 0; + session.dragStartSlot = null; + session.dragCurrentSlot = null; + session.isDragModeErasing = false; + } + } + return true; + } + + public boolean onMouseDragged(double mouseX, double mouseY, double deltaX, double deltaY) { + { + if (session.currentState == EditorState.HIDDEN) return true; + + if (editor.screenColorPicker.mouseDragged(mouseX, mouseY, 0, deltaX, deltaY)) { + return false; + } + + if (session.currentState == EditorState.EDIT_FILTER) { + if (editor.screenEditFilter.mouseDragged(mouseX, mouseY, 0, deltaX, deltaY)) return false; + layout.update(screen, accessor, editor.getSidebarYOffset()); + + int mainX = layout.mainX; + + // Reordering the filter list: just follow the cursor. The drop position and the edge + // auto-scroll are resolved per frame while rendering, so they keep working even when the + // mouse is held still against the top or bottom of the list. + if (session.reorderDragItem != null) { + session.reorderMouseX = (int) mouseX; + session.reorderMouseY = (int) mouseY; + return false; + } + + session.lastInteractedWasList = (mouseX < mainX); + + int gridViewH = layout.gridViewH; + int msbY = layout.msbY; + int msbH = layout.msbH; + + int listViewH = layout.listViewH; + int lsbY = layout.lsbY; + int lsbH = layout.lsbH; + + if (session.isDraggingMainScroll) { + int totalGridHeight = (int) Math.ceil(session.filteredItems.size() / 9.0) * 18; + float maxGridScroll = Math.max(0, totalGridHeight - gridViewH); + int thumbH = maxGridScroll > 0 + ? Math.max(10, (int) ((gridViewH / (float) Math.max(1, totalGridHeight)) * msbH)) + : msbH; + float percent = (float) (mouseY - msbY - (thumbH / 2.0f)) / (msbH - thumbH); + session.gridScrollY = Mth.clamp(percent * maxGridScroll, 0, maxGridScroll); + return false; + } + if (session.isDraggingListScroll) { + List displayedAllowedItems = new ArrayList<>(); + String wlSearch = editor.whitelistSearchBox != null + ? editor.whitelistSearchBox.getValue().toLowerCase() + : ""; + for (String id : session.currentAllowedItems) { + Item item = BuiltInRegistries.ITEM.getValue(Identifier.tryParse(id)); + if (item != null + && (wlSearch.isEmpty() + || item.getName(item.getDefaultInstance()) + .getString() + .toLowerCase() + .contains(wlSearch))) displayedAllowedItems.add(id); + } + + int totalListHeight = displayedAllowedItems.size() * 18 + + io.github.marcsanzdev.chestseparators.client.ui.EditorLayout.LIST_TRAILING_PADDING; + float maxListScroll = layout.maxListScroll(displayedAllowedItems.size()); + int thumbH = maxListScroll > 0 + ? Math.max(10, (int) ((listViewH / (float) Math.max(1, totalListHeight)) * lsbH)) + : lsbH; + float percent = (float) (mouseY - lsbY - (thumbH / 2.0f)) / (lsbH - thumbH); + session.listScrollY = Mth.clamp(percent * maxListScroll, 0, maxListScroll); + return false; + } + return false; + } + + if (session.currentState == EditorState.VIEW_GROUPS || session.currentState == EditorState.SELECT_SLOTS) { + if (editor.screenViewGroups.mouseDragged(mouseX, mouseY, 0, deltaX, deltaY)) { + return false; + } + } + + if (session.currentState == EditorState.DRAW_LINES) { + editor.screenDrawLines.mouseDragged(mouseX, mouseY, 0, deltaX, deltaY); + return false; + } + return true; + } + } + + public boolean onMouseScrolled(double mouseX, double mouseY, double horizontalAmount, double verticalAmount) { + // The presets menu (when open, over a Load preview) grabs the wheel to scroll its + // detail list, before the group view below it can react. + if (session.isPresetsMenuOpen && editor.presetsMenu.mouseScrolled(mouseX, mouseY, verticalAmount)) { + return false; + } + if (session.currentState == EditorState.VIEW_GROUPS + || session.currentState == EditorState.SELECT_SLOTS) { + if (editor.screenViewGroups.mouseScrolled(mouseX, mouseY, horizontalAmount, verticalAmount)) + return false; + } + if (session.currentState == EditorState.EDIT_FILTER) { + if (editor.screenEditFilter.mouseScrolled(mouseX, mouseY, horizontalAmount, verticalAmount)) + return false; + } + + return true; + } + + public boolean keyPressed(KeyEvent input) { + // While a preset name is being edited inline, all keys belong to that field (typing, Enter, Esc) — + // before any shortcut or the Esc-closes-menu handling below can steal them. + if (session.isPresetsMenuOpen && editor.presetsMenu.isRenaming()) { + if (editor.presetsMenu.keyPressed(input)) return true; + } + + boolean isControlDown = InputConstants.isKeyDown(InputConstants.KEY_LCONTROL) + || InputConstants.isKeyDown(InputConstants.KEY_RCONTROL); + + if (session.currentState == EditorState.EDIT_FILTER) { + if (editor.screenEditFilter.keyPressed(input)) { + return true; + } + } + + if (isControlDown && session.currentState != EditorState.HIDDEN) { + boolean isTyping = (session.currentState == EditorState.EDIT_FILTER) + && ((editor.searchBox != null && editor.searchBox.isFocused()) + || (editor.whitelistSearchBox != null && editor.whitelistSearchBox.isFocused())); + + if (!isTyping) { + // Undo (unified: separators or filters, whichever happened last). + if (input.key() == InputConstants.KEY_Z) { + editor.applyUndoRedo(ChestConfigManager.getInstance().undo(), false); + return true; + } + // Redo + else if (input.key() == InputConstants.KEY_Y) { + editor.applyUndoRedo(ChestConfigManager.getInstance().redo(), true); + return true; + } + // Copy — whole-chest layout (lines + backgrounds) in DRAW_LINES, all filters in VIEW_GROUPS. + else if (input.key() == InputConstants.KEY_C) { + if (session.currentState == EditorState.VIEW_GROUPS) { + ChestConfigManager.getInstance().copyWhitelistsToClipboard(); + editor.showStatus(Component.translatable("message.chestseparators.filters_copied"), ChatFormatting.GRAY); + editor.playClickSound(1.0f); + } else if (session.currentState == EditorState.DRAW_LINES) { + ChestConfigManager.getInstance().copyToClipboard(); + editor.showStatus(Component.translatable("message.chestseparators.layout_copied"), ChatFormatting.GRAY); + editor.playClickSound(1.0f); + } + return true; + } + // Paste + else if (input.key() == InputConstants.KEY_V) { + if (session.currentState == EditorState.VIEW_GROUPS) { + if (ChestConfigManager.getInstance().hasWhitelistClipboardData()) { + ChestConfigManager.getInstance().saveWhitelistSnapshot(); + ChestConfigManager.getInstance().pasteWhitelistsFromClipboard(); + editor.saveSmart(); + editor.sendWhitelistToServer(); + + if (Minecraft.getInstance().player != null + && Minecraft.getInstance().player.containerMenu + instanceof ChestMenu genericHandler) { + if (genericHandler.getContainer() instanceof IWhitelistProvider provider) { + provider.setWhitelists( + ChestConfigManager.getInstance().getCurrentWhitelists()); + } + } + editor.showStatus( + Component.translatable("message.chestseparators.filters_pasted"), ChatFormatting.GREEN); + editor.playClickSound(1.0f); + } else { + editor.playClickSound(0.5f); + } + } else if (session.currentState == EditorState.DRAW_LINES) { + // Paste the whole-chest layout (lines + backgrounds) regardless of the active tab. + if (ChestConfigManager.getInstance().hasClipboardData()) { + ChestConfigManager.getInstance().saveSnapshot(); + ChestConfigManager.getInstance().pasteFromClipboard(); + editor.saveSmart(); + editor.showStatus( + Component.translatable("message.chestseparators.layout_pasted"), ChatFormatting.GREEN); + editor.playClickSound(1.0f); + } else { + editor.playClickSound(0.5f); + } + } + return true; + } + } + } + + if (input.key() == InputConstants.KEY_ESCAPE && session.currentState != EditorState.HIDDEN) { + if (session.isPresetsMenuOpen) { + session.isPresetsMenuOpen = false; + editor.playClickSound(0.8f); + return true; + } + if (session.isColorPickerOpen) { + session.isColorPickerOpen = false; + } else { + editor.toggleState(EditorState.HIDDEN); + } + return true; + } + return false; + } + + public boolean charTyped(CharacterEvent input) { + if (session.isPresetsMenuOpen && editor.presetsMenu.isRenaming()) { + if (editor.presetsMenu.charTyped(input)) return true; + } + if (session.currentState == EditorState.EDIT_FILTER) { + return editor.screenEditFilter.charTyped(input); + } + return false; + } + + /** + * The editor's click handling. Invoked from the container-screen mixin's mouseClicked inject + * (returning false cancels the vanilla click). The creative-inventory mixin also calls it directly, + * because that screen processes its own tab/search clicks BEFORE the generic mixin can cancel them — + * so while editing there, the mixin routes the click here and swallows vanilla entirely. + */ + public boolean handleClick(double mouseX, double mouseY, int button) { + layout.update(screen, accessor, editor.getSidebarYOffset()); + + // While the color picker is open, all clicks outside it must be suppressed. + if (session.isColorPickerOpen) { + editor.screenColorPicker.mouseClicked(mouseX, mouseY, button); + return false; + } + + boolean isFilterMenuOpen = (session.currentState == EditorState.EDIT_FILTER); + boolean isEditorClosed = (session.currentState == EditorState.HIDDEN); + + // PUSH (deposit) and PULL (fill) act on the open container and stay clickable in the editor + // screens — edit layout, groups, presets. Hidden buttons are parked off-screen, so a disabled + // one is never hit here. They are NOT clickable while the filter item-picker is open: that panel + // covers the container, so moving items underneath it would be an invisible, unintended action. + if (!session.isPlayerInventory && !isFilterMenuOpen) { + if (editor.depositButton != null && editor.depositButton.mouseClicked(mouseX, mouseY, button)) { + return false; + } + if (editor.fillButton != null && editor.fillButton.mouseClicked(mouseX, mouseY, button)) { + return false; + } + } + + // The layout/filters/presets icons stay clickable except while the filter menu is open. Clicking + // layout or filters also closes the presets menu. + if (!isFilterMenuOpen && GlobalChestConfig.isShowEditButton()) { + if (editor.entryButton != null && editor.entryButton.mouseClicked(mouseX, mouseY, button)) { + editor.presetsMenu.cancelRename(); + session.isPresetsMenuOpen = false; + editor.ensureCreativeInventoryTab(); + return false; + } + if (editor.whitelistButton != null && editor.whitelistButton.mouseClicked(mouseX, mouseY, button)) { + editor.presetsMenu.cancelRename(); + session.isPresetsMenuOpen = false; + editor.ensureCreativeInventoryTab(); + return false; + } + if (editor.presetsButton != null && editor.presetsButton.mouseClicked(mouseX, mouseY, button)) { + editor.ensureCreativeInventoryTab(); + return false; + } + if (editor.chestPresetsButton != null + && !session.isPlayerInventory + && editor.chestPresetsButton.mouseClicked(mouseX, mouseY, button)) { + return false; + } + } + + // Otherwise the presets menu swallows clicks while open (its panel rows and close button). + if (session.isPresetsMenuOpen) { + editor.presetsMenu.onClick(mouseX, mouseY, button, screen.width, screen.height); + return false; + } + + if (!GlobalChestConfig.isShowEditButton() || isEditorClosed) { + return true; + } + + if (session.currentState == EditorState.VIEW_GROUPS || session.currentState == EditorState.SELECT_SLOTS) { + editor.screenViewGroups.mouseClicked(mouseX, mouseY, button); + return false; + } + + if (session.currentState == EditorState.EDIT_FILTER) { + editor.screenEditFilter.mouseClicked(mouseX, mouseY, button); + return false; + } + + editor.screenDrawLines.mouseClicked(mouseX, mouseY, button); + return false; + } +} diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/EditorLayout.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/EditorLayout.java new file mode 100644 index 0000000..16478e6 --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/EditorLayout.java @@ -0,0 +1,193 @@ +package io.github.marcsanzdev.chestseparators.client.ui; + +import io.github.marcsanzdev.chestseparators.mixin.client.HandledScreenAccessor; +import net.minecraft.client.gui.screens.Screen; + +public class EditorLayout { + // Base Screen Info + public int screenWidth; + public int screenHeight; + public int guiX; + public int guiY; + public int bgWidth; + public int bgHeight; + + // Approximate on-screen width of the vanilla recipe book PANEL PLUS its left category tabs, used to + // park the preview clear to the left of the whole book (tabs included) when the book and a potion-effect + // panel are both open. Generous so the preview never overlaps the book's protruding tabs. + private static final int RECIPE_BOOK_WIDTH = 200; + + // Universal Symmetrical Layout metrics + public int gap = 6; + public int mainW = 226; + public int mainH = 236; + public int listW = 120; + public int btnW = 108; + public int bH = 22; + public int swatchSize = 12; + + // Calculated X/Y positions for main panels + public int mainX; + public int mainY; + public int listX; + public int listY; + public int listH; + public int rightX; + /** True when the preview/list panel is docked to the RIGHT of the container (recipe book open). */ + public boolean listOnRight; + + // Edit Filter Grid + public int cols = 9; + public int rows = 9; + /** Row height of the LEFT allowed-items list. */ + public int itemSize = 18; + /** Cell size of the item GRID: a 16px item plus a 3px margin per side so it never touches its slot. */ + public int gridCell = 22; + + public int gridX; + public int gridViewY; + public int gridViewH; + + // Main Grid Scrollbar + public int msbX; + public int msbY; + public int msbH; + + // List Panel Scrollbar + public int listViewY; + public int listViewH; + public int lsbX; + public int lsbY; + public int lsbH; + + /** Trailing pixels added below the last list row so it can scroll fully clear of the scissor. */ + public static final int LIST_TRAILING_PADDING = 4; + + /** Size of a category tab (the 8-per-row strips above and below the item grid). */ + public int tabW = 22; + + /** + * X of category tab {@code col} (0..7). Single source of truth shared by the renderer and the click + * handler so they can never drift: the 8 tabs spread evenly across the panel, flush to both margins. + */ + public int tabX(int col) { + int margin = 4; + int stride = (this.mainW - (2 * margin) - this.tabW) / 7; + return this.mainX + margin + (col * stride); + } + + /** + * Maximum vertical scroll for the left (allowed-items) list. Single source of truth shared by the + * renderer and every scroll input (wheel, scrollbar drag, arrow keys) so the bar always reaches + * the bottom that the renderer draws. + */ + public int maxListScroll(int itemCount) { + return Math.max(0, itemCount * itemSize + LIST_TRAILING_PADDING - listViewH); + } + + // View Groups & Tools + public int sidebarWidth = 76; + public int sidebarHeight; + public int sidebarX; + public int paletteBoxY; + public int paletteY; + public int paletteCol1X; + public int paletteCol2X; + public int paletteCol3X; + + // Color Picker + public int pickerBoxSize = 100; + public int pickerHueWidth = 20; + public int popupW = 240; + public int popupH = 185; + public int popupX; + public int popupY; + + // Conflict Popup + public int conflictPopupW = 260; + public int conflictPopupH = 110; + public int conflictPopupX; + public int conflictPopupY; + + public void update(Screen screen, HandledScreenAccessor accessor, int customSidebarYOffset) { + this.screenWidth = screen.width; + this.screenHeight = screen.height; + this.guiX = accessor.getX(); + this.guiY = accessor.getY(); + this.bgWidth = accessor.getBackgroundWidth(); + this.bgHeight = accessor.getBackgroundHeight(); + + // 1. Center panels (Edit Filter / View Groups) + this.mainY = this.guiY + (this.bgHeight - this.mainH) / 2; + this.mainX = this.guiX + (this.bgWidth - this.mainW) / 2; + + // 2. Side panels. The preview/list normally docks to the LEFT of the container. When the vanilla + // recipe book is open it covers that dock, so the panel flips to the RIGHT of the container. But if + // a potion effect is ALSO shown, the effect panel pushes the whole GUI far to the right and leaves + // no room there — so in that combined case the panel goes to the FAR LEFT, to the left of the book. + // The book state is read from its own widget (not from the GUI's shift) so it is never confused with + // the effect panel's shift. + boolean bookOpen = false; + if (screen instanceof net.minecraft.client.gui.screens.inventory.AbstractRecipeBookScreen rbs) { + net.minecraft.client.gui.screens.recipebook.RecipeBookComponent book = + ((io.github.marcsanzdev.chestseparators.mixin.client.RecipeBookScreenAccessor) rbs) + .chestseparators$getRecipeBook(); + bookOpen = book != null && book.isVisible(); + } + boolean hasPotion = net.minecraft.client.Minecraft.getInstance().player != null + && !net.minecraft.client.Minecraft.getInstance() + .player + .getActiveEffects() + .isEmpty(); + + // Mirror the exact separation the left dock leaves, so the right dock is not visually tighter. + int dockGap = this.guiX - this.mainX + this.gap; + if (!bookOpen) { + this.listOnRight = false; + this.listX = this.mainX - this.listW - this.gap; + } else if (hasPotion) { + this.listOnRight = false; + this.listX = Math.max(22, this.guiX - RECIPE_BOOK_WIDTH - this.listW - this.gap); + } else { + this.listOnRight = true; + this.listX = this.guiX + this.bgWidth + dockGap; + } + this.listY = this.mainY; + this.listH = this.mainH; + this.rightX = this.mainX + this.mainW + this.gap; + + // 3. Grid area + this.gridX = this.mainX + 10; + this.gridViewY = this.mainY + 25; + this.gridViewH = this.rows * this.gridCell; + + // 4. Main Grid Scrollbar + this.msbX = this.gridX + (this.cols * this.gridCell) + 3; + this.msbY = this.gridViewY - 2; + this.msbH = this.gridViewH + 4; + + // 5. Left List area & Scrollbar + this.listViewY = this.listY + 42; + this.listViewH = this.listH - 48; + this.lsbX = this.listX + this.listW - 13; + this.lsbY = this.listViewY; + this.lsbH = this.listViewH - 1; + + // 6. Draw Lines Sidebar + this.sidebarX = this.guiX - this.sidebarWidth - 4; + this.paletteBoxY = this.guiY + customSidebarYOffset + 48; + int contentX = this.sidebarX + 7; + this.paletteY = this.paletteBoxY + 3; + this.paletteCol1X = contentX + 5; + this.paletteCol2X = contentX + 23; + this.paletteCol3X = contentX + 47; + + this.sidebarHeight = this.bgHeight - 16; + + this.popupX = ((this.screenWidth - this.popupW) / 2) + 40; + this.popupY = (this.screenHeight - this.popupH) / 2; + + this.conflictPopupX = (this.screenWidth - this.conflictPopupW) / 2; + this.conflictPopupY = (this.screenHeight - this.conflictPopupH) / 2; + } +} diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/EditorRenderer.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/EditorRenderer.java new file mode 100644 index 0000000..0b6aa3b --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/EditorRenderer.java @@ -0,0 +1,629 @@ +package io.github.marcsanzdev.chestseparators.client.ui; + +import com.mojang.blaze3d.platform.InputConstants; +import io.github.marcsanzdev.chestseparators.client.EditorState; +import io.github.marcsanzdev.chestseparators.config.GlobalChestConfig; +import io.github.marcsanzdev.chestseparators.data.ChestConfigManager; +import io.github.marcsanzdev.chestseparators.event.KeyInputHandler; +import io.github.marcsanzdev.chestseparators.mixin.client.HandledScreenAccessor; +import java.util.Map; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiGraphicsExtractor; +import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.inventory.Slot; +import net.minecraft.network.chat.Component; + +public class EditorRenderer { + + private final ChestSeparatorsEditor editor; + private final EditorSessionData session; + private final AbstractContainerScreen screen; + private final HandledScreenAccessor accessor; + + private final EditorLayout layout; + + public EditorRenderer( + ChestSeparatorsEditor editor, + EditorSessionData session, + EditorLayout layout, + AbstractContainerScreen screen, + HandledScreenAccessor accessor) { + this.editor = editor; + this.session = session; + this.layout = layout; + this.screen = screen; + this.accessor = accessor; + } + + public void render(GuiGraphicsExtractor context, int mouseX, int mouseY, float delta) { + // Fire any deferred "flash then act" button actions whose flash has finished playing. + io.github.marcsanzdev.chestseparators.client.ui.widgets.PressAnim.tick(); + layout.update(screen, accessor, editor.getSidebarYOffset()); + editor.syncClientInventoryWhitelists(ChestConfigManager.getInstance().getCurrentWhitelists()); + + boolean hideInFilter = (session.currentState == EditorState.EDIT_FILTER); + boolean hideVanilla = session.isColorPickerOpen || hideInFilter || session.hasSelectionConflict; + + // Reflect current editor state in each button's pressed/released visual. + if (editor.entryButton != null) { + editor.entryButton.isActive = (session.currentState == EditorState.DRAW_LINES); + } + if (editor.whitelistButton != null) { + editor.whitelistButton.isActive = (session.currentState == EditorState.VIEW_GROUPS + || session.currentState == EditorState.SELECT_SLOTS + || session.currentState == EditorState.EDIT_FILTER); + } + if (editor.depositButton != null) { + // Hold the pressed state for 150 ms after the click for visual feedback. + editor.depositButton.isActive = (System.currentTimeMillis() - editor.depositClickTime < 150); + } + if (editor.fillButton != null) { + // Same press-pulse for the pull button, so the 'D' hotkey feels like clicking it (matches push). + editor.fillButton.isActive = (System.currentTimeMillis() - editor.fillClickTime < 150); + } + // The presets icons are pressed only while their menu is open (radio-like with layout/filters). + if (editor.presetsButton != null) { + editor.presetsButton.isActive = session.isPresetsMenuOpen && !session.presetsMenuChestMode; + } + if (editor.chestPresetsButton != null) { + editor.chestPresetsButton.isActive = session.isPresetsMenuOpen && session.presetsMenuChestMode; + } + + // Presets menu: a light overlay that keeps the top buttons and the container slots visible (the + // hover preview paints onto the real slots), while the sub-screen panels stay hidden. + // Phase 1 (dim + preview) runs first; then the saved lines are injected on top of the dim + // (only when no Load-button preview is active); then Phase 2 draws the panel. + if (session.isPresetsMenuOpen) { + if (editor.presetsButton != null) editor.presetsButton.isActive = !session.presetsMenuChestMode; + if (editor.chestPresetsButton != null) editor.chestPresetsButton.isActive = session.presetsMenuChestMode; + editor.presetsMenu.renderBackground(context, screen.width, screen.height, mouseX, mouseY); + if (!editor.presetsMenu.isPreviewActive()) { + context.pose().pushMatrix(); + context.pose().translate((float) accessor.getX(), (float) accessor.getY()); + doRenderSavedLinesLayer(context); + context.pose().popMatrix(); + } + editor.presetsMenu.renderPanel(context, screen.width, screen.height, mouseX, mouseY); + renderToolbar(context, mouseX, mouseY, delta); + return; + } + + int bgMouseX = session.hasSelectionConflict ? -1 : mouseX; + int bgMouseY = session.hasSelectionConflict ? -1 : mouseY; + + // Background layer (rendered behind the dim overlay). + // When a sub-menu is active, pass mouse coordinates of (-1, -1) so the buttons + // remain visible but do not react to hover visually. + // Toolbar (background layer). + renderToolbar(context, hideVanilla ? -1 : bgMouseX, hideVanilla ? -1 : bgMouseY, delta); + + if (session.currentState != EditorState.HIDDEN) { + // Transfer (push/pull) preview: drawn FIRST — at the same layer the real container items sit on — + // so the dim overlay below fades the ghost together with the stationary items. This keeps it + // coherent with the rest of the darkened inventory instead of floating bright above the dim. It + // still lands below the sub-screen's filter indicators, which are drawn later. + // Suppressed while the colour picker is open so hovering the push/pull zone does nothing. + if (!session.isColorPickerOpen) { + renderTransferPreviewOverlay(context, mouseX, mouseY); + } + + if (!session.isEyedropperActive) { + context.fill(0, 0, layout.screenWidth, layout.screenHeight, 0x66000000); + } + + // Foreground layer (rendered on top of the dim overlay). + // Skipped when a sub-menu is open so clicks pass through to the screen below. + // Toolbar (foreground layer, drawn above the dim when a sub-menu is open). + if (!hideVanilla) { + renderToolbar(context, bgMouseX, bgMouseY, delta); + } + + context.pose().pushMatrix(); + context.pose().translate((float) accessor.getX(), (float) accessor.getY()); + renderSavedLinesLayer(context); + renderUndoHighlights(context); + context.pose().popMatrix(); + + switch (session.currentState) { + case DRAW_LINES -> editor.screenDrawLines.render(context, mouseX, mouseY, delta); + case VIEW_GROUPS, SELECT_SLOTS -> editor.screenViewGroups.render(context, mouseX, mouseY, delta); + case EDIT_FILTER -> editor.screenEditFilter.render(context, mouseX, mouseY, delta); + default -> {} + } + + renderStatusMessage(context); + renderMagnifierHint(context); + + if (session.isColorPickerOpen) { + editor.screenColorPicker.render(context, mouseX, mouseY, delta); + } + + renderMagnifier(context, mouseX, mouseY); + } + } + + // --- Right-side vertical toolbar dock --- + + /** + * Lays out the visible toolbar icons in a horizontal bar docked on top of the container GUI, inside a + * semi-transparent rounded panel, then renders them. Visibility depends on the per-button config flags + * and the screen context (player inventory vs container) — never on the editor state, so the bar keeps + * the same icons in the same places while a sub-screen is open. Hidden buttons are parked off-screen + * so they receive no hover or clicks. + */ + private void renderToolbar(GuiGraphicsExtractor context, int hoverX, int hoverY, float delta) { + parkToolbarButtons(); + if (!GlobalChestConfig.instance.showEditButtons) return; + + boolean inv = session.isPlayerInventory; + java.util.List vis = + new java.util.ArrayList<>(); + if (GlobalChestConfig.instance.btnEditLines && editor.entryButton != null) vis.add(editor.entryButton); + if (GlobalChestConfig.instance.btnFilters && editor.whitelistButton != null) vis.add(editor.whitelistButton); + if (GlobalChestConfig.instance.showDepositButton && !inv && editor.depositButton != null) { + vis.add(editor.depositButton); + } + if (GlobalChestConfig.instance.btnFillFromChest && !inv && editor.fillButton != null) { + vis.add(editor.fillButton); + } + // Chest presets first when a container is open — the chest is what you're looking at, so its presets + // should be the first of the two you reach; the inventory presets follow. + if (GlobalChestConfig.instance.btnChestPresets && !inv && editor.chestPresetsButton != null) { + vis.add(editor.chestPresetsButton); + } + if (GlobalChestConfig.instance.btnInventoryPresets && editor.presetsButton != null) { + vis.add(editor.presetsButton); + } + + int n = vis.size(); + if (n == 0) return; + + final int btn = 20; + final int gap = 3; + final int pad = 4; + final int gapToChest = 3; + // HORIZONTAL bar docked on TOP of the container GUI and centred on it. The editor sub-screens put + // their button columns to the left and right of the chest, so sitting above it is the one spot + // that can never collide with them. + int panelW = n * btn + (n - 1) * gap + 2 * pad; + int panelH = btn + 2 * pad; + int panelX = accessor.getX() + (accessor.getBackgroundWidth() - panelW) / 2; + // Anchored to the chest, always in the same place — by design it may end up behind a sub-screen's + // taller panels, which is accepted in exchange for the bar never moving. + int panelY = accessor.getY() - panelH - gapToChest; + // The creative screen draws its item-group tab row above the GUI top, which would overlap the bar, + // so lift the bar above those tabs. + if (screen instanceof net.minecraft.client.gui.screens.inventory.CreativeModeInventoryScreen) { + panelY -= 30; + } + + UiTheme.panel(context, panelX, panelY, panelW, panelH); + + for (int i = 0; i < n; i++) { + var b = vis.get(i); + b.x = panelX + pad + i * (btn + gap); + b.y = panelY + pad; + b.render(context, hoverX, hoverY, delta); + } + } + + /** Parks every toolbar button off-screen so hidden ones never register hover or clicks. */ + private void parkToolbarButtons() { + io.github.marcsanzdev.chestseparators.client.ui.widgets.ToolButtonWidget[] all = { + editor.entryButton, editor.whitelistButton, editor.depositButton, + editor.fillButton, editor.presetsButton, editor.chestPresetsButton + }; + for (var b : all) { + if (b != null) { + b.x = -1000; + b.y = -1000; + } + } + } + + /** Subtle, static hint under the editor telling players how to toggle the magnifier loupe. */ + private void renderMagnifierHint(GuiGraphicsExtractor context) { + if (session.currentState != EditorState.DRAW_LINES) return; + net.minecraft.network.chat.Component key = ModKeyBindings.toggleMagnifierKey.getTranslatedKeyMessage(); + // Reflect the current state: prompt to turn it ON when off, and OFF when on. + String hintKey = GlobalChestConfig.instance.magnifierEnabled + ? "message.chestseparators.magnifier_hint_off" + : "message.chestseparators.magnifier_hint"; + net.minecraft.network.chat.Component hint = net.minecraft.network.chat.Component.translatable(hintKey, key); + var tr = Minecraft.getInstance().font; + context.text(tr, hint, (screen.width - tr.width(hint)) / 2, screen.height - 12, 0x70FFFFFF, false); + } + + // White washes matching the eraser tool's drag preview, reused for the Clear-button hover preview. + private static final int ERASE_BG_WASH = 0x66FFFFFF; + private static final int ERASE_LINE_WASH = 0x88FFFFFF; + + private static final long UNDO_HIGHLIGHT_MS = 1300; + + /** + * Blinks a colored frame around each slot changed by the last undo/redo, fading out over + * {@link #UNDO_HIGHLIGHT_MS}. Color encodes the exact change: green = a filter (re)appeared, + * red = a filter was removed, amber = a filter's items changed, cyan = separators changed. + */ + private void renderUndoHighlights(GuiGraphicsExtractor context) { + if (editor.undoHighlights.isEmpty()) return; + long elapsed = System.currentTimeMillis() - editor.undoHighlightStart; + if (elapsed > UNDO_HIGHLIGHT_MS) { + editor.undoHighlights.clear(); + return; + } + float fade = 1.0f - (elapsed / (float) UNDO_HIGHLIGHT_MS); + float blink = 0.45f + 0.55f * (float) Math.abs(Math.sin(elapsed / 110.0)); + int a = (int) (255 * fade * blink); + if (a <= 0) return; + int alpha = a << 24; + + for (Slot s : accessor.getHandler().slots) { + if (!ChestSeparatorsEditor.isEditableSlot(s)) continue; + ChestConfigManager.SlotChange ch = editor.undoHighlights.get(ChestSeparatorsEditor.slotKey(s)); + if (ch == null) continue; + int color = (undoHighlightColor(ch) & 0x00FFFFFF) | alpha; + // 2px frame just outside the 16x16 slot. + context.fill(s.x - 2, s.y - 2, s.x + 18, s.y, color); + context.fill(s.x - 2, s.y + 16, s.x + 18, s.y + 18, color); + context.fill(s.x - 2, s.y, s.x, s.y + 16, color); + context.fill(s.x + 16, s.y, s.x + 18, s.y + 16, color); + } + } + + private static int undoHighlightColor(ChestConfigManager.SlotChange ch) { + return switch (ch) { + case FILTER_CREATED -> 0x55FF55; + case FILTER_REMOVED -> 0xFF5555; + case FILTER_MODIFIED -> 0xFFD24C; + case LAYOUT -> 0x55D6FF; + }; + } + + /** Called from the GenericContainerScreen mixin at drawSlots HEAD. Suppressed during presets menu + * because EditorRenderer's presets block calls doRenderSavedLinesLayer() directly instead. */ + public void renderSavedLinesLayer(GuiGraphicsExtractor context) { + if (session.isPresetsMenuOpen) return; + doRenderSavedLinesLayer(context); + } + + private void doRenderSavedLinesLayer(GuiGraphicsExtractor context) { + ChestConfigManager manager = ChestConfigManager.getInstance(); + + int bgAlpha = (GlobalChestConfig.instance.bgTransparency * 255 / 100) << 24; + int lineAlpha = (GlobalChestConfig.instance.lineTransparency * 255 / 100) << 24; + + // Clear-button hover preview: render the layers that would be erased with the same white wash + // the eraser tool uses, so the feedback is consistent across the mod. + boolean previewActive = session.currentState == EditorState.DRAW_LINES && session.clearPreviewTab != -1; + boolean clearLines = previewActive && (session.clearPreviewTab == 0 || session.clearPreviewTab == 2); + boolean clearBg = previewActive && (session.clearPreviewTab == 1 || session.clearPreviewTab == 2); + + for (Slot s : accessor.getHandler().slots) { + if (!ChestSeparatorsEditor.isEditableSlot(s)) continue; + + int key = ChestSeparatorsEditor.slotKey(s); + int bgColor = manager.getColor(key, ChestConfigManager.ACTION_BG); + if (bgColor != 0) { + int fill = clearBg ? ERASE_BG_WASH : ((bgColor & 0xFFFFFF) | bgAlpha); + context.fill(s.x, s.y, s.x + 16, s.y + 16, fill); + } + + renderEdgesInPaintOrder(context, s.x, s.y, key, lineAlpha, clearLines); + } + } + + private static int resolveEdge(int color, int lineAlpha, boolean erasePreview) { + if (color == 0) return 0; + return erasePreview ? ERASE_LINE_WASH : ((color & 0x00FFFFFF) | lineAlpha); + } + + /** + * Draws a slot's four edge lines as four bodies plus four corners. Each corner pixel is painted + * exactly once — by the edge painted later (higher sequence) — so corners respect paint order + * (newest on top) without the double-draw that brightened overlapping translucent edges. + */ + private void renderEdgesInPaintOrder( + GuiGraphicsExtractor context, int x, int y, int slotIndex, int lineAlpha, boolean erasePreview) { + ChestConfigManager m = ChestConfigManager.getInstance(); + int rTop = resolveEdge(m.getColor(slotIndex, ChestConfigManager.ACTION_TOP), lineAlpha, erasePreview); + int rBot = resolveEdge(m.getColor(slotIndex, ChestConfigManager.ACTION_BOTTOM), lineAlpha, erasePreview); + int rLeft = resolveEdge(m.getColor(slotIndex, ChestConfigManager.ACTION_LEFT), lineAlpha, erasePreview); + int rRight = resolveEdge(m.getColor(slotIndex, ChestConfigManager.ACTION_RIGHT), lineAlpha, erasePreview); + + int sTop = m.getPaintSeq(slotIndex, ChestConfigManager.ACTION_TOP); + int sBot = m.getPaintSeq(slotIndex, ChestConfigManager.ACTION_BOTTOM); + int sLeft = m.getPaintSeq(slotIndex, ChestConfigManager.ACTION_LEFT); + int sRight = m.getPaintSeq(slotIndex, ChestConfigManager.ACTION_RIGHT); + + drawEdges(context, x, y, rTop, rBot, rLeft, rRight, sTop, sBot, sLeft, sRight); + } + + /** Shared edge+corner drawing used by both the container config and the inventory render cache. */ + private void drawEdges( + GuiGraphicsExtractor context, + int x, + int y, + int rTop, + int rBot, + int rLeft, + int rRight, + int sTop, + int sBot, + int sLeft, + int sRight) { + // Bodies (no corners) — never overlap each other. + if (rTop != 0) context.fill(x, y - 1, x + 16, y, rTop); + if (rBot != 0) context.fill(x, y + 16, x + 16, y + 17, rBot); + if (rLeft != 0) context.fill(x - 1, y, x, y + 16, rLeft); + if (rRight != 0) context.fill(x + 16, y, x + 17, y + 16, rRight); + + // Corners — one fill each, by the later-painted edge. + drawCorner(context, x - 1, y - 1, rTop, sTop, rLeft, sLeft); + drawCorner(context, x + 16, y - 1, rTop, sTop, rRight, sRight); + drawCorner(context, x - 1, y + 16, rBot, sBot, rLeft, sLeft); + drawCorner(context, x + 16, y + 16, rBot, sBot, rRight, sRight); + } + + private void drawCorner(GuiGraphicsExtractor context, int cx, int cy, int colorA, int seqA, int colorB, int seqB) { + int color; + if (colorA == 0 && colorB == 0) return; + else if (colorA == 0) color = colorB; + else if (colorB == 0) color = colorA; + else color = (seqA >= seqB) ? colorA : colorB; + context.fill(cx, cy, cx + 1, cy + 1, color); + } + + private void renderStatusMessage(GuiGraphicsExtractor context) { + if (session.statusMessage != null) { + long elapsed = System.currentTimeMillis() - session.statusMessageTime; + if (elapsed < 2000) { + int alpha = 255; + if (elapsed > 1500) alpha = (int) (255 * (1.0f - (elapsed - 1500) / 500.0f)); + int color = (alpha << 24) | 0xFFFFFF; + context.centeredText( + Minecraft.getInstance().font, + session.statusMessage, + screen.width / 2, + screen.height - 40, + color); + } else { + session.statusMessage = null; + } + } + } + + public void renderNormalModeOverlay(GuiGraphicsExtractor context, int mouseX, int mouseY) { + // The presets menu owns the screen while open: never draw the always-on left filter panel or + // the deposit preview behind it. + if (session.isPresetsMenuOpen) return; + + if (!editor.isEditMode()) { + if (GlobalChestConfig.instance.showLeftPanel || KeyInputHandler.isModifierPressed()) { + editor.screenViewGroups.renderWhitelistPreviewPanel(context, mouseX, mouseY); + } + } + + // When a sub-screen is open, render() already drew the deposit preview at the right z-order + // (above the dim so it isn't faded, below the filter indicators). Draw it here — on the bright, + // undimmed chest — only when the editor is fully closed. + if (session.currentState == EditorState.HIDDEN) { + renderTransferPreviewOverlay(context, mouseX, mouseY); + } + } + + /** + * Updates + draws the push (deposit) OR pull (fill) preview depending on which toolbar button is + * hovered. Push shows outgoing player items + incoming container ghosts; pull highlights the + * container items that would be pulled to you (accent wash + count). + */ + void renderTransferPreviewOverlay(GuiGraphicsExtractor context, int mouseX, int mouseY) { + boolean shift = InputConstants.isKeyDown(InputConstants.KEY_LSHIFT) + || InputConstants.isKeyDown(InputConstants.KEY_RSHIFT); + + boolean hoverDeposit = false; + if (GlobalChestConfig.instance.showDepositButton + && !session.isPlayerInventory + && editor.depositButton != null) { + editor.depositButton.tooltipText = shift + ? Component.translatable("tooltip.chestseparators.push_to_chest.shift") + .getString() + : Component.translatable("tooltip.chestseparators.push_to_chest").getString(); + hoverDeposit = editor.isHovering(editor.depositButton.x, editor.depositButton.y, 20, 20, mouseX, mouseY); + } + boolean hoverFill = false; + if (GlobalChestConfig.instance.btnFillFromChest && !session.isPlayerInventory && editor.fillButton != null) { + hoverFill = editor.isHovering(editor.fillButton.x, editor.fillButton.y, 20, 20, mouseX, mouseY); + } + + if (hoverDeposit) { + editor.isHoveringFill = false; + // Toggling Shift is an explicit request for the other preview (filtered vs. all), + // so lift the post-deposit suspension and let it recompute below. + if (editor.suspendDepositPreview && shift != editor.depositPreviewShift) { + editor.suspendDepositPreview = false; + } + // Otherwise, do not re-show the preview right after a deposit — wait for the cursor to leave first. + if (editor.suspendDepositPreview) { + editor.isHoveringDeposit = false; + return; + } + editor.isHoveringDeposit = true; + // Push predicts the full post-refill state, so rebuild on hover as stacks change. + editor.depositPreviewShift = shift; + editor.updateDepositPreview(shift); + renderDepositPreview(context); + } else if (hoverFill) { + editor.isHoveringDeposit = false; + editor.suspendDepositPreview = false; + editor.isHoveringFill = true; + editor.updateFillPreview(shift); + renderDepositPreview(context); + } else { + editor.isHoveringDeposit = false; + editor.isHoveringFill = false; + editor.suspendDepositPreview = false; + editor.previewSourceRemaining.clear(); + editor.previewTargetIncoming.clear(); + } + } + + private void renderDepositPreview(GuiGraphicsExtractor context) { + if ((!editor.isHoveringDeposit && !editor.isHoveringFill) || editor.previewTargetIncoming.isEmpty()) return; + + int guiX = accessor.getX(); + int guiY = accessor.getY(); + + // The real item in every preview slot is already suppressed (GenericContainerScreenMixin#drawSlot), + // so we paint NO slot background. Translucency is faked WITHOUT altering the background: over the + // opaque ghost we lay a wash the exact colour of the slot's own background. On the empty pixels + // around the item that wash sits colour-over-identical-colour (invisible); over the item pixels it + // blends the model toward the background — the exact result of real per-pixel alpha (the 1.21.11 + // deferred GUI pipeline has no item-alpha API, so this is how we honour "fade the item, not the box"). + // In edit-layout the preview is drawn BEFORE the screen dim (see render()), so the global dim fades + // the ghost together with the stationary items; the wash therefore matches the plain, un-dimmed slot. + + // Source — items leaving. Show the projected leftover (nothing when the whole stack goes). + for (Map.Entry entry : editor.previewSourceRemaining.entrySet()) { + Slot slot = accessor.getHandler().getSlot(entry.getKey()); + int remaining = entry.getValue(); + if (remaining <= 0) continue; // whole stack leaves → slot shown empty + int x = guiX + slot.x; + int y = guiY + slot.y; + + ItemStack ghost = slot.getItem().copy(); + ghost.setCount(remaining); + drawGhostItem(context, ghost, x, y, previewGhostWash(ChestSeparatorsEditor.slotKey(slot))); + if (remaining > 1) { + drawProjectedCount(context, x, y, remaining, 0xDDFFFFFF); + } + } + + // Target — the slot's FINAL projected stack (already the full post-action content, including any + // group re-sort; see ChestSeparatorsEditor#applyPreviewReorder). A slot emptied by the re-sort holds + // an empty stack: the real item is already suppressed, so we simply draw nothing there. + for (Map.Entry entry : editor.previewTargetIncoming.entrySet()) { + ItemStack incoming = entry.getValue(); + if (incoming.isEmpty()) continue; + Slot slot = accessor.getHandler().getSlot(entry.getKey()); + int x = guiX + slot.x; + int y = guiY + slot.y; + + drawGhostItem(context, incoming, x, y, previewGhostWash(ChestSeparatorsEditor.slotKey(slot))); + if (incoming.getCount() > 1) { + drawProjectedCount(context, x, y, incoming.getCount(), 0xDDFFFFFF); + } + } + } + + /** + * Draws an item as a translucent ghost. {@code wash} is the slot's own background colour at the ghost's + * complementary alpha, so it fades the item to ~45% without ever changing the box behind it. + */ + private void drawGhostItem(GuiGraphicsExtractor context, ItemStack stack, int x, int y, int wash) { + context.item(stack, x, y); + drawDurabilityBar(context, stack, x, y); + context.fill(x, y, x + 16, y + 16, wash); + } + + /** Draws the item durability bar, mirroring vanilla's exact rendering logic. */ + private void drawDurabilityBar(GuiGraphicsExtractor context, ItemStack stack, int x, int y) { + if (stack.isBarVisible()) { + int step = stack.getBarWidth(); + int color = stack.getBarColor(); + int barX = x + 2; + int barY = y + 13; + context.fill(barX, barY, barX + 13, barY + 2, 0xFF000000); + context.fill(barX, barY, barX + step, barY + 1, color | 0xFF000000); + } + } + + private void drawProjectedCount(GuiGraphicsExtractor context, int x, int y, int count, int color) { + String text = String.valueOf(count); + int textW = Minecraft.getInstance().font.width(text); + context.text(Minecraft.getInstance().font, text, x + 17 - textW, y + 9, color, true); + } + + // 0x8C ≈ 55% alpha. Laying the slot's background colour over the opaque ghost at this alpha leaves the + // item at the complementary ~45% opacity — the "Medio" level the user picked. + private static final int GHOST_WASH_ALPHA = 0x8C; + + /** + * The wash colour that fades a ghost item to ~45% while leaving the slot box untouched: the slot's own + * background colour (vanilla grey plus any custom bg) at {@link #GHOST_WASH_ALPHA}. Painting this over the + * item reproduces exactly what real per-pixel alpha would show, and over the empty pixels it is + * colour-over-identical-colour, i.e. invisible. The edit-layout dim is applied globally AFTER the ghost + * (see render()), so it is intentionally NOT baked in here — that lets the dim fade the ghost like a + * stationary item. + */ + private int previewGhostWash(int slotKey) { + ChestConfigManager manager = ChestConfigManager.getInstance(); + // Vanilla container slots have a flat 0x8B8B8B interior under the 16×16 item area. + int base = 0x8B8B8B; + + int customBg = manager.getColor(slotKey, ChestConfigManager.ACTION_BG); + if (customBg != 0) { + int bgAlpha = GlobalChestConfig.instance.bgTransparency * 255 / 100; + base = compositeOver(base, customBg & 0xFFFFFF, bgAlpha); + } + return (base & 0xFFFFFF) | (GHOST_WASH_ALPHA << 24); + } + + /** Composites an RGB source at {@code srcAlpha} (0–255) over an opaque RGB destination. */ + private static int compositeOver(int dstRgb, int srcRgb, int srcAlpha) { + float a = srcAlpha / 255f; + int dr = (dstRgb >> 16) & 0xFF, dg = (dstRgb >> 8) & 0xFF, db = dstRgb & 0xFF; + int sr = (srcRgb >> 16) & 0xFF, sg = (srcRgb >> 8) & 0xFF, sb = srcRgb & 0xFF; + int rr = Math.round(sr * a + dr * (1 - a)); + int rg = Math.round(sg * a + dg * (1 - a)); + int rb = Math.round(sb * a + db * (1 - a)); + return (rr << 16) | (rg << 8) | rb; + } + + /** + * Painting loupe: only while drawing separators (not the picker) and only when the cursor is over + * the chest's slot area. The eyedropper loupe is handled separately in ScreenColorPicker so it can + * sample the whole screen. Delegates to {@link MagnifierRenderer}, which magnifies the real + * framebuffer (so item counts, previews and separators all show exactly as on screen). + */ + private void renderMagnifier(GuiGraphicsExtractor context, int mouseX, int mouseY) { + if (!GlobalChestConfig.instance.magnifierEnabled) return; + if (session.currentState != EditorState.DRAW_LINES || session.isColorPickerOpen) return; + if (!magnifierEnabledForTab(session.currentTab)) return; + if (!isCursorOverChestSlots(mouseX, mouseY)) return; + boolean circle = GlobalChestConfig.instance.magnifierShape == GlobalChestConfig.MagnifierShape.CIRCLE; + MagnifierRenderer.render(context, mouseX, mouseY, circle); + } + + private static boolean magnifierEnabledForTab(int tab) { + return switch (tab) { + case EditorSessionData.TAB_BG -> GlobalChestConfig.instance.magnifierTabBackgrounds; + case EditorSessionData.TAB_COMBO -> GlobalChestConfig.instance.magnifierTabCombo; + default -> GlobalChestConfig.instance.magnifierTabLines; + }; + } + + // Extra margin around the slot area so the loupe also shows on the outer chest borders, where the + // edge separator lines can still be painted. + private static final int SLOT_AREA_MARGIN = 2; + + /** True when the cursor is within the chest (non-player) slot area, expanded by a small margin. */ + private boolean isCursorOverChestSlots(int mouseX, int mouseY) { + int guiX = accessor.getX(); + int guiY = accessor.getY(); + int minX = Integer.MAX_VALUE, minY = Integer.MAX_VALUE, maxX = Integer.MIN_VALUE, maxY = Integer.MIN_VALUE; + for (Slot s : accessor.getHandler().slots) { + if (!ChestSeparatorsEditor.isEditableSlot(s)) continue; + minX = Math.min(minX, guiX + s.x); + minY = Math.min(minY, guiY + s.y); + maxX = Math.max(maxX, guiX + s.x + 16); + maxY = Math.max(maxY, guiY + s.y + 16); + } + if (minX == Integer.MAX_VALUE) return false; + return mouseX >= minX - SLOT_AREA_MARGIN + && mouseX < maxX + SLOT_AREA_MARGIN + && mouseY >= minY - SLOT_AREA_MARGIN + && mouseY < maxY + SLOT_AREA_MARGIN; + } +} diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/EditorSessionData.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/EditorSessionData.java new file mode 100644 index 0000000..c411021 --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/EditorSessionData.java @@ -0,0 +1,233 @@ +package io.github.marcsanzdev.chestseparators.client.ui; + +import io.github.marcsanzdev.chestseparators.client.EditorState; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.UUID; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.CreativeModeTab; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.inventory.Slot; +import net.minecraft.network.chat.Component; +import net.minecraft.core.BlockPos; + +public class EditorSessionData { + // State UI + public EditorState currentState = EditorState.HIDDEN; + + // Tab State + public static final int TAB_LINES = 0; + public static final int TAB_BG = 1; + public static final int TAB_COMBO = 2; + public int currentTab = TAB_LINES; + + // Whitelist Data + public UUID selectedGroupId = null; + public Set selectedSlots = new HashSet<>(); + + // Item Filter UI + public List currentAllowedItems = new ArrayList<>(); + public boolean ruleManual = true; + public boolean ruleShift = true; + public boolean ruleHopper = true; + /** Zero retains every matching stack; positive values retain this many per item in the group. */ + public int targetCount = 0; + public List allGameItems = new ArrayList<>(); + public List filteredItems = new ArrayList<>(); + public List visibleLeftListItems = new ArrayList<>(); + + // --- Drag-to-reorder in the filter's allowed-items list --- + /** Item id currently being dragged to a new position, or null when no drag is in progress. */ + public String reorderDragItem = null; + /** Live cursor position, so the dragged item can be drawn following the mouse. */ + public int reorderMouseX = 0; + + public int reorderMouseY = 0; + /** True when the drag started in the centre item grid rather than in the filter's list. */ + public boolean reorderFromGrid = false; + /** Where the drag started on screen, so the held row can fly out of it instead of just appearing. */ + public int reorderOriginX = 0; + + public int reorderOriginY = 0; + public long reorderStartTime = 0L; + + /** Visible index each item held just before the last drop, driving the settle animation. */ + public Map dropAnimFrom = new HashMap<>(); + + public long dropAnimStart = 0L; + + // A grid item held down but not yet moved far enough (or long enough) to count as a drag. Until it is + // promoted, releasing counts as a plain click, which adds the item at the end of the list. + public String pendingDragItem = null; + public int pendingDragX = 0; + public int pendingDragY = 0; + public long pendingDragTime = 0L; + + /** Row dropped onto the item grid, shrinking away to nothing to show it left the filter. */ + public String deleteAnimItem = null; + + public int deleteAnimX = 0; + public int deleteAnimY = 0; + public long deleteAnimStart = 0L; + + /** Row left behind after a drop, animating from the cursor into its final place. */ + public String dropGhostItem = null; + + public int dropGhostFromX = 0; + public int dropGhostFromY = 0; + public int dropGhostToX = 0; + public int dropGhostToY = 0; + public long dropGhostStart = 0L; + + public long lastSlotClickTime = 0; + public int lastClickedSlotIndex = -1; + public boolean isSelecting = true; + + // Editing + public int clickedActionId = -1; + public long clickedActionTime = 0; + + public int lineColorIndex = 0; + public int bgColorIndex = 0; + public int comboColorIndex = 0; + + public int editingLineCustomIndex = -1; + public int editingBgCustomIndex = -1; + public int editingComboCustomIndex = -1; + + // Last non-eraser color (and custom-slot index) per tab, restored when switching from the + // eraser back to a paint tool so the previous color is not lost. + public int lineColorBeforeErase = 0; + public int bgColorBeforeErase = 0; + public int comboColorBeforeErase = 0; + public int lineCustomBeforeErase = -1; + public int bgCustomBeforeErase = -1; + public int comboCustomBeforeErase = -1; + + public int lineToolMode = 0; + public int bgToolMode = 0; + public int comboToolMode = 0; + + // Which tab's Clear button is currently hovered (-1 = none); drives the fade-to-empty preview of + // the layers that would be erased. Only honored while in the DRAW_LINES state. + public int clearPreviewTab = -1; + + // Picker + public boolean isColorPickerOpen = false; + public int pickerTargetMode = 0; + public float pickerHue = 0.0f; + public float pickerSat = 1.0f; + public float pickerVal = 1.0f; + public int pickerCurrentRGB = 0xFFFF0000; + public int copiedColorRGB = 0; // -1 indicates no color is currently copied + public boolean isEyedropperActive = false; + public boolean isDraggingSatVal = false; + public boolean isDraggingHue = false; + public boolean lastClickedHue = false; + + // Dragging + public boolean isDraggingLine = false; + public int currentDragAction = 0; + public Slot dragStartSlot = null; + public Slot dragCurrentSlot = null; + public boolean isDragModeErasing = false; + public List tracePath = new ArrayList<>(); + + public int lockedTraceAxis = 0; + public int lockedTraceAction = 0; + public int lockedTraceRowCol = -1; + public double lockedLineCoord = -1; + + // Context + public BlockPos currentChestPos; + public String currentDimension; + // True when the editor is currently targeting the player's own inventory slots (decorations + + // filters) instead of a container's slots. In a chest screen this can be toggled at runtime. + public boolean isPlayerInventory = false; + // True only when the screen itself is the survival inventory screen (no container). Used to decide + // whether the chest<->inventory edit-target toggle button is available. + public boolean isInventoryScreenContext = false; + public boolean isEnderChest = false; + public boolean isEntityChest = false; + // True when the open entity container is a chest/hopper minecart specifically. Unlike other entity + // containers (chest boats, animals), hoppers CAN insert into these, so the Hopper Insert rule is + // available and its filter is synced to the server for enforcement. + public boolean isMinecartChest = false; + public UUID currentEntityUUID; + public boolean isShulkerBox = false; + public UUID currentShulkerUUID; + public Component statusMessage = null; + public long statusMessageTime = 0; + + // Whitelist Tools + public int wlToolMode = 0; // 0 = Area, 1 = Trace + public boolean hasSelectionConflict = false; + + // Phase 4: Scroll and List states + // Scroll and List states (Pixel-based) + public float listScrollY = 0f; + public float gridScrollY = 0f; + public boolean isDraggingMainScroll = false; + public boolean isDraggingListScroll = false; + public boolean lastInteractedWasList = false; + + // Phase 4.B: Import Preview and Auto-Scroll Engine + public List previewItems = new ArrayList<>(); + public boolean isPreviewing = false; + public int previewType = 0; // 0 = none, 1 = import, 2 = allow all, 3 = clear all + public float previewScrollY = 0f; + public boolean previewScrollDirectionDown = true; + public long lastPreviewTime = 0; + public long previewStartTime = 0; + public boolean userOverrodePreviewScroll = false; + + public boolean forceStopPreview = false; + + // Tab pagination and selection + public int currentCreativeTabIndex = 0; + public int currentTabPage = 0; + public List availableTabs = new ArrayList<>(); + public List customChestItems = new ArrayList<>(); + + // Unsaved Changes State + public boolean isUnsavedPopupOpen = false; + public boolean isExpelPopupOpen = false; + // The dedicated presets menu (save/load slots) overlay is open, and whether it targets the chest + // (true) or the player inventory (false). Chest and inventory presets are fully independent. + public boolean isPresetsMenuOpen = false; + public boolean presetsMenuChestMode = false; + public List originalItemsSnapshot = new ArrayList<>(); + public boolean originalRuleManual = true; + public boolean originalRuleShift = true; + public boolean originalRuleHopper = true; + public int originalTargetCount = 0; + + // Inner class to hold tab data cleanly + public static class CreativeTabInfo { + public Component name; + public ItemStack icon; + public CreativeModeTab group; + public boolean isSearchTab; + public boolean isCustomChestTab; + + public CreativeTabInfo( + Component name, ItemStack icon, CreativeModeTab group, boolean isSearchTab, boolean isCustomChestTab) { + this.name = name; + this.icon = icon; + this.group = group; + this.isSearchTab = isSearchTab; + this.isCustomChestTab = isCustomChestTab; + } + } + + // Tag Dropdown Menu State + public List activeDropdownTags = new ArrayList<>(); + public int dropdownX = 0; + public int dropdownY = 0; + + public UUID lastHoveredGroupId = null; +} diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/MagnifierRenderer.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/MagnifierRenderer.java new file mode 100644 index 0000000..3dda6d3 --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/MagnifierRenderer.java @@ -0,0 +1,159 @@ +package io.github.marcsanzdev.chestseparators.client.ui; + +import java.nio.ByteBuffer; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiGraphicsExtractor; +import org.lwjgl.opengl.GL11; +import org.lwjgl.system.MemoryUtil; + +/** + * Cursor zoom loupe. It samples a small block of the real framebuffer under the cursor and draws it + * magnified, so the loupe shows exactly what is on screen — item counts, previews, separators, + * everything. The sampled square is kept strictly smaller than the cursor ring, so the ring and the + * connector lines are never inside the captured area (and therefore never appear magnified inside the + * loupe). The loupe edge, the cursor ring and the connector lines are all drawn with per-pixel + * coverage antialiasing for clean, non-jagged shapes. + */ +public final class MagnifierRenderer { + + private MagnifierRenderer() {} + + // Captured half-size: 14 logical px → a 28px window, enough to show a whole 16px slot with margin + // even inside the circle (where only the inscribed disc is visible). Loupe radius sets on-screen + // size; both are kept small enough that reads/draws stay cheap. + private static final int BASE_SRC_HALF = 14; + private static final int BASE_LOUPE_R = 66; + private static final int BASE_GAP = 14; + private static final int BASE_RING = 4; + private static final int FRAME_COLOR = 0xFF202020; + + public static void render(GuiGraphicsExtractor context, int cursorX, int cursorY, boolean circle) { + Minecraft client = Minecraft.getInstance(); + if (client.getWindow() == null) return; + + int srcHalf = BASE_SRC_HALF; + int loupeR = BASE_LOUPE_R; + int gap = BASE_GAP; + int ring = BASE_RING; + + double scale = client.getWindow().getGuiScale(); + int fbW = client.getWindow().getWidth(); + int fbH = client.getWindow().getHeight(); + + int blockFb = Math.max(1, (int) Math.round(srcHalf * 2 * scale)); + int fbX = clamp((int) Math.round((cursorX - srcHalf) * scale), 0, fbW - blockFb); + int fbYBottom = clamp(fbH - (int) Math.round((cursorY + srcHalf) * scale), 0, fbH - blockFb); + + int[] pixels = new int[blockFb * blockFb]; + // Heap-allocated native buffer: a stack buffer (MemoryStack) overflows for large loupe sizes. + ByteBuffer buf = MemoryUtil.memAlloc(blockFb * blockFb * 4); + try { + GL11.glReadPixels(fbX, fbYBottom, blockFb, blockFb, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, buf); + for (int i = 0; i < pixels.length; i++) { + int r = buf.get(i * 4) & 0xFF; + int g = buf.get(i * 4 + 1) & 0xFF; + int b = buf.get(i * 4 + 2) & 0xFF; + pixels[i] = 0xFF000000 | (r << 16) | (g << 8) | b; + } + } finally { + MemoryUtil.memFree(buf); + } + + // Place the loupe up-right of the cursor, flipping to stay on screen. + int sw = client.getWindow().getGuiScaledWidth(); + int sh = client.getWindow().getGuiScaledHeight(); + int loupeCx = cursorX + gap + loupeR; + int loupeCy = cursorY - gap - loupeR; + if (loupeCx + loupeR + 2 > sw) loupeCx = cursorX - gap - loupeR; + if (loupeCy - loupeR - 2 < 0) loupeCy = cursorY + gap + loupeR; + loupeCy = clamp(loupeCy, loupeR + 2, sh - loupeR - 2); + + float cell = (loupeR * 2f) / blockFb; + // Content extent: a hard-clipped disc/square, with the jagged edge hidden under the thick frame. + int contentR = loupeR - ring; + long contentR2 = (long) contentR * contentR; + + for (int py = 0; py < blockFb; py++) { + for (int px = 0; px < blockFb; px++) { + int x0 = Math.round(loupeCx - loupeR + px * cell); + int x1 = Math.round(loupeCx - loupeR + (px + 1) * cell); + // py = 0 is the bottom row in GL space → bottom of the region on screen. + int y0 = Math.round(loupeCy + loupeR - (py + 1) * cell); + int y1 = Math.round(loupeCy + loupeR - py * cell); + double dx = (x0 + x1) / 2.0 - loupeCx; + double dy = (y0 + y1) / 2.0 - loupeCy; + if (circle) { + if (dx * dx + dy * dy > contentR2) continue; // hard clip → no bleed outside the disc + } else if (Math.abs(dx) > contentR || Math.abs(dy) > contentR) { + continue; + } + context.fill(x0, y0, x1, y1, pixels[py * blockFb + px]); + } + } + + // Opaque frame of thickness `ring`, hiding the content edge (consistent for circle and square). + if (circle) drawRingFrame(context, loupeCx, loupeCy, contentR, loupeR, FRAME_COLOR); + else drawSquareFrame(context, loupeCx, loupeCy, contentR, loupeR, FRAME_COLOR); + + // Reticle on the captured (center) pixel. + int half = Math.max(1, Math.round(cell / 2f)); + context.outline(loupeCx - half, loupeCy - half, half * 2, half * 2, 0xFFFFFFFF); + + // No cursor marker or connector lines: under the deferred GUI rendering they would be sampled + // back into the loupe (ghosted/smeared), so the loupe shows only real chest content. + } + + private static int clamp(int v, int lo, int hi) { + return Math.max(lo, Math.min(v, hi)); + } + + /** Antialiased 1px circle outline using per-pixel distance coverage, iterating only near the edge. */ + private static void drawCircleOutlineAA(GuiGraphicsExtractor context, int cx, int cy, int r, int color) { + int rgb = color & 0x00FFFFFF; + int baseA = (color >>> 24) & 0xFF; + for (int y = -r - 1; y <= r + 1; y++) { + double inside = (double) r * r - (double) y * y; + int edge = inside <= 0 ? 0 : (int) Math.round(Math.sqrt(inside)); + for (int side = -1; side <= 1; side += 2) { + for (int x = edge * side - 2; x <= edge * side + 2; x++) { + double cov = 1.0 - Math.abs(Math.sqrt((double) x * x + (double) y * y) - r); + if (cov <= 0) continue; + int a = (int) (baseA * Math.min(1.0, cov)); + if (a <= 0) continue; + context.fill(cx + x, cy + y, cx + x + 1, cy + y + 1, (a << 24) | rgb); + } + if (edge == 0) break; + } + } + } + + /** Opaque ring frame: filled annulus with antialiased inner and outer edges. */ + private static void drawRingFrame(GuiGraphicsExtractor context, int cx, int cy, int rInner, int rOuter, int color) { + int rgb = color & 0x00FFFFFF; + for (int y = -rOuter; y <= rOuter; y++) { + double outer = (double) rOuter * rOuter - (double) y * y; + if (outer < 0) continue; + int xo = (int) Math.floor(Math.sqrt(outer)); + double innerSq = (double) rInner * rInner - (double) y * y; + int xi = innerSq <= 0 ? -1 : (int) Math.ceil(Math.sqrt(innerSq)); + if (xi < 0 || xi > xo) { + context.fill(cx - xo, cy + y, cx + xo + 1, cy + y + 1, color); + } else { + context.fill(cx - xo, cy + y, cx - xi + 1, cy + y + 1, color); + context.fill(cx + xi, cy + y, cx + xo + 1, cy + y + 1, color); + } + } + // Antialias the inner and outer edges so the frame reads as a clean circle. + drawCircleOutlineAA(context, cx, cy, rOuter, (0xCC << 24) | rgb); + drawCircleOutlineAA(context, cx, cy, rInner, (0xCC << 24) | rgb); + } + + /** Opaque square frame: a thick border between the inner and outer half-sizes. */ + private static void drawSquareFrame(GuiGraphicsExtractor context, int cx, int cy, int rInner, int rOuter, int color) { + // top, bottom, left, right bars of thickness (rOuter - rInner) + context.fill(cx - rOuter, cy - rOuter, cx + rOuter, cy - rInner, color); + context.fill(cx - rOuter, cy + rInner, cx + rOuter, cy + rOuter, color); + context.fill(cx - rOuter, cy - rInner, cx - rInner, cy + rInner, color); + context.fill(cx + rInner, cy - rInner, cx + rOuter, cy + rInner, color); + } +} diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/ModKeyBindings.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/ModKeyBindings.java new file mode 100644 index 0000000..d15e4b8 --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/ModKeyBindings.java @@ -0,0 +1,54 @@ +package io.github.marcsanzdev.chestseparators.client.ui; + +import com.mojang.blaze3d.platform.InputConstants; +import dev.architectury.registry.client.keymappings.KeyMappingRegistry; +import net.minecraft.client.KeyMapping; +import net.minecraft.resources.Identifier; + +public class ModKeyBindings { + public static KeyMapping openEditorKey; + public static KeyMapping showPanelModifierKey; + public static KeyMapping toggleEditButtonsKey; + public static KeyMapping toggleMagnifierKey; + public static KeyMapping pushKey; + public static KeyMapping pullKey; + public static KeyMapping autoDepositKey; + + private static final KeyMapping.Category CATEGORY = + KeyMapping.Category.register(Identifier.fromNamespaceAndPath("chestseparators", "keys")); + + public static void register() { + // The 26.3 keyboard bindings use SDL scancodes from InputConstants for their reset defaults. + // Architectury's KeyMappingRegistry.register returns void, so each mapping is built first, then registered. + + openEditorKey = new KeyMapping( + "key.chestseparators.toggle_preview_panel", InputConstants.Type.KEYBOARD, InputConstants.KEY_O, CATEGORY); + KeyMappingRegistry.register(openEditorKey); + + showPanelModifierKey = new KeyMapping( + "key.chestseparators.show_panel_modifier", InputConstants.Type.KEYBOARD, InputConstants.KEY_LALT, CATEGORY); + KeyMappingRegistry.register(showPanelModifierKey); + + toggleMagnifierKey = new KeyMapping( + "key.chestseparators.toggle_magnifier", InputConstants.Type.KEYBOARD, InputConstants.KEY_M, CATEGORY); + KeyMappingRegistry.register(toggleMagnifierKey); + + toggleEditButtonsKey = new KeyMapping( + "key.chestseparators.toggle_edit_buttons", InputConstants.Type.KEYBOARD, InputConstants.KEY_H, CATEGORY); + KeyMappingRegistry.register(toggleEditButtonsKey); + + // Push inventory items INTO the open chest's filters. Hold Shift to also push into empty slots. + pushKey = new KeyMapping("key.chestseparators.push", InputConstants.Type.KEYBOARD, InputConstants.KEY_S, CATEGORY); + KeyMappingRegistry.register(pushKey); + + // Pull the open chest's items INTO the inventory's filters. Hold Shift to also pull unfiltered items. + pullKey = new KeyMapping("key.chestseparators.pull", InputConstants.Type.KEYBOARD, InputConstants.KEY_D, CATEGORY); + KeyMappingRegistry.register(pullKey); + + // Unbound by default: the primary trigger is the double-tap-sneak gesture, so this hotkey is an + // optional alternative the player may bind to avoid any conflict with other movement keys. + autoDepositKey = new KeyMapping( + "key.chestseparators.auto_deposit", InputConstants.Type.KEYBOARD, InputConstants.UNKNOWN.getValue(), CATEGORY); + KeyMappingRegistry.register(autoDepositKey); + } +} diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/UiColors.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/UiColors.java new file mode 100644 index 0000000..77d85c0 --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/UiColors.java @@ -0,0 +1,18 @@ +package io.github.marcsanzdev.chestseparators.client.ui; + +/** + * Named ARGB color constants for the editor UI. + * + *

Only the dominant, semantically stable theme colors live here. Context-specific shades + * (hover/sunken/disabled variants) remain inline at their call sites. + */ +public final class UiColors { + + private UiColors() {} + + /** Panel/surface background in dark mode. */ + public static final int SURFACE_DARK = 0xFF212121; + + /** Panel/surface background in light mode (vanilla inventory gray). */ + public static final int SURFACE_LIGHT = 0xFFC6C6C6; +} diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/UiTheme.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/UiTheme.java new file mode 100644 index 0000000..7a1eef5 --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/UiTheme.java @@ -0,0 +1,195 @@ +package io.github.marcsanzdev.chestseparators.client.ui; + +import net.minecraft.client.gui.GuiGraphicsExtractor; + +/** + * "Cristal" (glass) design tokens + reusable draw helpers for the whole editor UI: translucent dark + * panels with soft 2px corners, thin light hairline borders, and a blue accent for active/selected + * state. Centralised here so every panel and button in the mod shares one visual language. + */ +public final class UiTheme { + + private UiTheme() {} + + // Panels + public static final int PANEL_BG = 0xC8121218; // translucent dark + public static final int PANEL_BORDER = 0x22FFFFFF; // thin light hairline + public static final int PANEL_HILITE = 0x14FFFFFF; // subtle top edge highlight + + // Buttons (icon + wide) + public static final int BTN_BG = 0x12FFFFFF; // faint glass fill + public static final int BTN_BG_HOVER = 0x24FFFFFF; + public static final int BTN_BORDER = 0x2AFFFFFF; + + // Accent (blue) — active/selected. Active buttons use a near-solid blue FILL (clearly "on") rather + // than a faint tint, so they read as toggled without any muddy inset shadow. + public static final int ACCENT = 0xFF4A9EFF; + public static final int ACCENT_BG = 0xF02C6BAE; // near-solid blue fill for active buttons + public static final int ACCENT_BORDER = 0xFF5FA8FF; + + // Icons / text + public static final int ICON = 0xFFDDDDDD; + public static final int ICON_HOVER = 0xFFFFFFFF; + public static final int ICON_ACTIVE = 0xFFFFFFFF; // white on the solid blue fill + public static final int ON_ACCENT = 0xFFFFFFFF; // text/icon color on an active (blue) button + public static final int TEXT = 0xFFE6E6E6; + public static final int TEXT_MUTED = 0xFF9A9AA2; + + /** + * Fills a rounded rectangle (2px corners) with NON-OVERLAPPING rects so a translucent color keeps a + * uniform opacity everywhere (overlapping fills would double-blend the center and leave the edges + * looking lighter — the cause of the mismatched left/right vertical strips). + */ + public static void roundRect(GuiGraphicsExtractor c, int x, int y, int w, int h, int col) { + c.fill(x + 2, y, x + w - 2, y + h, col); // center band, full height + c.fill(x, y + 2, x + 2, y + h - 2, col); // left band, middle rows + c.fill(x + w - 2, y + 2, x + w, y + h - 2, col); // right band, middle rows + } + + /** Draws a thin (1px) rounded border around the rectangle. */ + public static void roundBorder(GuiGraphicsExtractor c, int x, int y, int w, int h, int col) { + c.fill(x + 2, y, x + w - 2, y + 1, col); + c.fill(x + 2, y + h - 1, x + w - 2, y + h, col); + c.fill(x, y + 2, x + 1, y + h - 2, col); + c.fill(x + w - 1, y + 2, x + w, y + h - 2, col); + c.fill(x + 1, y + 1, x + 2, y + 2, col); + c.fill(x + w - 2, y + 1, x + w - 1, y + 2, col); + c.fill(x + 1, y + h - 2, x + 2, y + h - 1, col); + c.fill(x + w - 2, y + h - 2, x + w - 1, y + h - 1, col); + } + + /** Cristal glass panel: translucent fill + thin border + top-edge highlight. */ + public static void panel(GuiGraphicsExtractor c, int x, int y, int w, int h) { + roundRect(c, x, y, w, h, PANEL_BG); + roundBorder(c, x, y, w, h, PANEL_BORDER); + c.fill(x + 3, y + 1, x + w - 3, y + 2, PANEL_HILITE); + } + + // Which edge of a tab is attached to (embedded into) the main panel. That edge gets NO border and + // square corners, so the tab reads as carved into the panel instead of a chip sitting beside it. + public static final int ATTACH_TOP = 0; + public static final int ATTACH_BOTTOM = 1; + public static final int ATTACH_LEFT = 2; + public static final int ATTACH_RIGHT = 3; + + /** + * OPAQUE tab (category tabs, editor mode tabs) embedded into a panel along its {@code attach} edge. + * The attached edge is drawn flush and border-less (no "end of tab" line, no gap); the three free + * edges keep the soft 2px rounded corners of every other button. When selected the tab shrinks 1px, + * but ONLY on the free sides — the attached edge stays anchored so no gap ever opens against the panel. + */ + public static void tab(GuiGraphicsExtractor c, int x, int y, int w, int h, boolean hover, boolean active, int attach) { + int bg = active ? 0xFF2C6BAE : (hover ? 0xFF2E2E3A : 0xFF23232C); + int border = active ? ACCENT_BORDER : 0xFF3A3A45; + if (active) { + if (attach != ATTACH_TOP) { + y += 1; + h -= 1; + } + if (attach != ATTACH_BOTTOM) { + h -= 1; + } + if (attach != ATTACH_LEFT) { + x += 1; + w -= 1; + } + if (attach != ATTACH_RIGHT) { + w -= 1; + } + } + // Corners are rounded only on the two OUTER corners (away from the attached edge); the two corners + // touching the panel stay square so the tab meets it flush. + boolean rTL = attach != ATTACH_TOP && attach != ATTACH_LEFT; + boolean rTR = attach != ATTACH_TOP && attach != ATTACH_RIGHT; + boolean rBL = attach != ATTACH_BOTTOM && attach != ATTACH_LEFT; + boolean rBR = attach != ATTACH_BOTTOM && attach != ATTACH_RIGHT; + + // --- opaque fill --- + c.fill(x + 2, y, x + w - 2, y + h, bg); // center band, full height + c.fill(x, y + 2, x + 2, y + h - 2, bg); // left band, middle rows + if (!rTL) c.fill(x, y, x + 2, y + 2, bg); // square top-left + if (!rBL) c.fill(x, y + h - 2, x + 2, y + h, bg); // square bottom-left + c.fill(x + w - 2, y + 2, x + w, y + h - 2, bg); // right band, middle rows + if (!rTR) c.fill(x + w - 2, y, x + w, y + 2, bg); // square top-right + if (!rBR) c.fill(x + w - 2, y + h - 2, x + w, y + h, bg); // square bottom-right + + // --- border on the three FREE sides only (attached side is left open so it merges into the panel) --- + if (attach != ATTACH_TOP) { + c.fill((attach == ATTACH_LEFT) ? x : x + 2, y, (attach == ATTACH_RIGHT) ? x + w : x + w - 2, y + 1, border); + } + if (attach != ATTACH_BOTTOM) { + c.fill( + (attach == ATTACH_LEFT) ? x : x + 2, + y + h - 1, + (attach == ATTACH_RIGHT) ? x + w : x + w - 2, + y + h, + border); + } + if (attach != ATTACH_LEFT) { + c.fill(x, (attach == ATTACH_TOP) ? y : y + 2, x + 1, (attach == ATTACH_BOTTOM) ? y + h : y + h - 2, border); + } + if (attach != ATTACH_RIGHT) { + c.fill( + x + w - 1, + (attach == ATTACH_TOP) ? y : y + 2, + x + w, + (attach == ATTACH_BOTTOM) ? y + h : y + h - 2, + border); + } + // rounded outer-corner pixels + if (rTL) c.fill(x + 1, y + 1, x + 2, y + 2, border); + if (rTR) c.fill(x + w - 2, y + 1, x + w - 1, y + 2, border); + if (rBL) c.fill(x + 1, y + h - 2, x + 2, y + h - 1, border); + if (rBR) c.fill(x + w - 2, y + h - 2, x + w - 1, y + h - 1, border); + } + + /** + * Cristal scrollbar: a recessed track (same inset language as the list/grid viewports) with a light + * glass thumb. The thumb is a pill — its ends are capped 1px narrower so they follow the rounded + * start/end of the track instead of butting into it with square corners. + */ + public static void scrollbar(GuiGraphicsExtractor c, int x, int y, int w, int h, int thumbY, int thumbH) { + inset(c, x, y, w, h); + int col = 0x70FFFFFF; + int tx = x + 1; + int tw = w - 2; + c.fill(tx, thumbY + 2, tx + tw, thumbY + thumbH - 2, col); // body + c.fill(tx + 1, thumbY + 1, tx + tw - 1, thumbY + 2, col); // rounded top cap + c.fill(tx + 1, thumbY + thumbH - 2, tx + tw - 1, thumbY + thumbH - 1, col); // rounded bottom cap + } + + /** Recessed inset box (search fields, list viewports): darker translucent fill + faint border. */ + public static void inset(GuiGraphicsExtractor c, int x, int y, int w, int h) { + roundRect(c, x, y, w, h, 0x50000000); + roundBorder(c, x, y, w, h, 0x16FFFFFF); + } + + /** + * Shrinks whatever is drawn next around the centre of a button, by the same proportion the button + * itself shrinks when active (1px inset per side), so the icon/label never overflows the sunken + * button and the whole thing scales as one piece. Uniform scale (the tighter axis) so icons keep + * their aspect ratio. ALWAYS pair with {@code context.pose().popMatrix()}. + */ + public static void pushActiveContent(GuiGraphicsExtractor c, int x, int y, int w, int h) { + float s = Math.min((w - 2f) / w, (h - 2f) / h); + float cx = x + w / 2f; + float cy = y + h / 2f; + c.pose().pushMatrix(); + c.pose().translate(cx, cy); + c.pose().scale(s, s); + c.pose().translate(-cx, -cy); + } + + /** Cristal glass button background for the given hover/active state. */ + public static void button(GuiGraphicsExtractor c, int x, int y, int w, int h, boolean hover, boolean active) { + if (active) { + // Pushed-in: draw the active (blue) button 1px smaller on every side, so it reads as slightly + // recessed/sunken. The 1px gap shows the panel behind — a clean "pressed" cue with no shadow. + roundRect(c, x + 1, y + 1, w - 2, h - 2, ACCENT_BG); + roundBorder(c, x + 1, y + 1, w - 2, h - 2, ACCENT_BORDER); + return; + } + roundRect(c, x, y, w, h, hover ? BTN_BG_HOVER : BTN_BG); + roundBorder(c, x, y, w, h, BTN_BORDER); + } +} diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/screens/AbstractEditorScreen.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/screens/AbstractEditorScreen.java new file mode 100644 index 0000000..55126ba --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/screens/AbstractEditorScreen.java @@ -0,0 +1,121 @@ +package io.github.marcsanzdev.chestseparators.client.ui.screens; + +import io.github.marcsanzdev.chestseparators.client.ui.ChestSeparatorsEditor; +import io.github.marcsanzdev.chestseparators.client.ui.EditorGeometry; +import io.github.marcsanzdev.chestseparators.client.ui.EditorLayout; +import io.github.marcsanzdev.chestseparators.client.ui.EditorSessionData; +import io.github.marcsanzdev.chestseparators.client.ui.widgets.CustomWidget; +import java.util.ArrayList; +import java.util.List; +import net.minecraft.client.gui.GuiGraphicsExtractor; + +public abstract class AbstractEditorScreen implements IEditorSubScreen { + + protected final ChestSeparatorsEditor editor; + protected final EditorSessionData session; + protected final EditorGeometry geometry; + protected final EditorLayout layout; + + protected final List widgets = new ArrayList<>(); + + public AbstractEditorScreen(ChestSeparatorsEditor editor) { + this.editor = editor; + this.session = editor.session; + this.geometry = editor.geometry; + this.layout = editor.layout; + } + + @Override + public void init() { + widgets.clear(); + buildWidgets(); + } + + protected abstract void buildWidgets(); + + @Override + public void render(GuiGraphicsExtractor context, int mouseX, int mouseY, float delta) { + for (CustomWidget widget : widgets) { + widget.render(context, mouseX, mouseY, delta); + } + } + + @Override + public boolean mouseClicked(double mouseX, double mouseY, int button) { + return clickWidgets(mouseX, mouseY, button); + } + + /** Dispatches a click to this screen's widgets; returns true once one consumes it. */ + boolean clickWidgets(double mouseX, double mouseY, int button) { + for (CustomWidget widget : widgets) { + if (widget.mouseClicked(mouseX, mouseY, button)) { + return true; + } + } + return false; + } + + // Default no-op implementations so sub-screens only override what they need. + @Override + public boolean mouseDragged(double mouseX, double mouseY, int button, double dragX, double dragY) { + return false; + } + + @Override + public boolean mouseScrolled(double mouseX, double mouseY, double horizontalAmount, double verticalAmount) { + return false; + } + + @Override + public boolean keyPressed(int keyCode, int scanCode, int modifiers) { + return false; + } + + @Override + public boolean charTyped(char chr, int modifiers) { + return false; + } + + protected void drawCheckerboard(GuiGraphicsExtractor context, int x, int y, int width, int height, int squareSize) { + for (int i = 0; i < width; i += squareSize) { + for (int j = 0; j < height; j += squareSize) { + int drawW = Math.min(squareSize, width - i); + int drawH = Math.min(squareSize, height - j); + int color = (((i / squareSize) + (j / squareSize)) % 2 == 0) ? 0xFF888888 : 0xFF555555; + context.fill(x + i, y + j, x + i + drawW, y + j + drawH, color); + } + } + } + + /** Draws a raised or sunken bevel border using explicit light/dark/shadow colors. */ + protected void drawBaseBevel( + GuiGraphicsExtractor context, int x, int y, int width, int height, int light, int dark, int shadow, boolean sunken) { + if (sunken) { + context.fill(x, y, x + width - 1, y + 1, dark); + context.fill(x, y, x + 1, y + height - 1, dark); + context.fill(x + width - 1, y, x + width, y + height, light); + context.fill(x, y + height - 1, x + width, y + height, light); + } else { + context.fill(x, y, x + width - 1, y + 1, light); + context.fill(x, y, x + 1, y + height - 1, light); + context.fill(x + width - 1, y, x + width, y + height, dark); + context.fill(x, y + height - 1, x + width, y + height, dark); + context.fill(x + width - 2, y + 1, x + width - 1, y + height - 1, shadow); + context.fill(x + 1, y + height - 2, x + width - 2, y + height - 1, shadow); + } + } + + /** Draws a bevel whose light/dark/shadow tones are derived from a base color. */ + protected void drawColorBevel( + GuiGraphicsExtractor context, int x, int y, int width, int height, int baseColor, boolean sunken) { + int light = editor.shiftColor(baseColor, 80) | 0xFF000000; + int dark = editor.shiftColor(baseColor, -80) | 0xFF000000; + int shadow = editor.shiftColor(baseColor, -40) | 0xFF000000; + drawBaseBevel(context, x, y, width, height, light, dark, shadow, sunken); + } + + /** Draws a bevel with the fixed vanilla-inventory tones used for standard palette swatches. */ + protected void drawStandardBevel(GuiGraphicsExtractor context, int x, int y, int width, int height, boolean sunken) { + drawBaseBevel(context, x, y, width, height, 0xFFFFFFFF, 0xFF373737, 0xFF8B8B8B, sunken); + } +} diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/screens/ColorPickerGradients.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/screens/ColorPickerGradients.java new file mode 100644 index 0000000..567cd79 --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/screens/ColorPickerGradients.java @@ -0,0 +1,56 @@ +package io.github.marcsanzdev.chestseparators.client.ui.screens; + +import java.awt.Color; +import java.nio.ByteBuffer; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiGraphicsExtractor; +import org.lwjgl.opengl.GL11; +import org.lwjgl.system.MemoryStack; + +/** + * Stateless drawing helpers for the color picker: the saturation/value gradient box, the hue + * strip, and the framebuffer pixel read used by the eyedropper tool. + */ +final class ColorPickerGradients { + + private ColorPickerGradients() {} + + /** Fills a saturation (x) by value (y) gradient for a fixed hue. */ + static void drawSaturationValueBox(GuiGraphicsExtractor context, int x, int y, int w, int h, float hue) { + int step = 2; + for (int i = 0; i < w; i += step) { + for (int j = 0; j < h; j += step) { + float sat = (float) i / w; + float val = 1.0f - ((float) j / h); + int color = Color.HSBtoRGB(hue, sat, val); + context.fill(x + i, y + j, x + i + step, y + j + step, color); + } + } + } + + /** Fills a vertical hue strip at full saturation and value. */ + static void drawHueBar(GuiGraphicsExtractor context, int x, int y, int w, int h) { + for (int i = 0; i < h; i++) { + float hue = (float) i / h; + int color = Color.HSBtoRGB(hue, 1.0f, 1.0f); + context.fill(x, y + i, x + w, y + i + 1, color); + } + } + + /** Reads the RGB color of the framebuffer pixel under the cursor (for the eyedropper). */ + static int readHoveredPixelColor(int mouseX, int mouseY) { + Minecraft client = Minecraft.getInstance(); + double scale = client.getWindow().getGuiScale(); + int fbX = (int) (mouseX * scale); + int fbY = client.getWindow().getHeight() - (int) (mouseY * scale) - 1; + + try (MemoryStack stack = MemoryStack.stackPush()) { + ByteBuffer buffer = stack.malloc(4); + GL11.glReadPixels(fbX, fbY, 1, 1, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, buffer); + int r = buffer.get(0) & 0xFF; + int g = buffer.get(1) & 0xFF; + int b = buffer.get(2) & 0xFF; + return (r << 16) | (g << 8) | b; + } + } +} diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/screens/ColorPickerInputHandler.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/screens/ColorPickerInputHandler.java new file mode 100644 index 0000000..ad27138 --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/screens/ColorPickerInputHandler.java @@ -0,0 +1,362 @@ +package io.github.marcsanzdev.chestseparators.client.ui.screens; + +import com.mojang.blaze3d.platform.InputConstants; +import io.github.marcsanzdev.chestseparators.client.ui.ChestSeparatorsEditor; +import io.github.marcsanzdev.chestseparators.client.ui.EditorLayout; +import io.github.marcsanzdev.chestseparators.client.ui.EditorSessionData; +import io.github.marcsanzdev.chestseparators.config.GlobalChestConfig; +import io.github.marcsanzdev.chestseparators.data.ChestConfigManager; +import java.awt.Color; +import net.minecraft.client.Minecraft; +import net.minecraft.util.Mth; + +/** + * Handles all mouse and keyboard input for the color-picker overlay: eyedropper, saturation/value + * box, hue bar, hex/RGB text fields, drag-select, and key navigation. Extracted from + * ScreenColorPicker. + */ +final class ColorPickerInputHandler { + + private final ScreenColorPicker screen; + private final ChestSeparatorsEditor editor; + private final EditorSessionData session; + private final EditorLayout layout; + + ColorPickerInputHandler(ScreenColorPicker screen) { + this.screen = screen; + this.editor = screen.editor; + this.session = screen.session; + this.layout = screen.layout; + } + + /** Focuses {@code field} and places the caret at the click if the click lands inside it; otherwise blurs + * it. Returns whether the click hit this field. No-op (returns false) for a null field. */ + private boolean focusFieldIfHovered( + net.minecraft.client.gui.components.EditBox field, + double mouseX, + double mouseY, + Minecraft client) { + if (field == null) return false; + if (editor.isHovering(field.getX(), field.getY(), field.getWidth(), field.getHeight(), mouseX, mouseY)) { + field.setFocused(true); + int localX = (int) (mouseX - field.getX()); + field.moveCursorTo( + client.font + .plainSubstrByWidth(field.getValue(), Math.max(0, localX)) + .length(), + false); + return true; + } + field.setFocused(false); + return false; + } + + boolean onMouseClicked(double mouseX, double mouseY, int button) { + if (!session.isColorPickerOpen) return false; + + if (session.isEyedropperActive) { + if (button == 1) { + session.isEyedropperActive = false; + org.lwjgl.sdl.SDLMouse.SDL_ShowCursor(); + editor.playClickSound(0.8f); + return true; + } + if (button == 0) { + editor.colorPickerModified = true; + session.pickerCurrentRGB = screen.hoveredPixelColor; + float[] hsb = Color.RGBtoHSB( + (screen.hoveredPixelColor >> 16) & 0xFF, + (screen.hoveredPixelColor >> 8) & 0xFF, + screen.hoveredPixelColor & 0xFF, + null); + session.pickerHue = hsb[0]; + session.pickerSat = hsb[1]; + session.pickerVal = hsb[2]; + screen.updateFieldsFromColor(); + screen.saveCurrentCustomColor(); + + session.isEyedropperActive = false; + org.lwjgl.sdl.SDLMouse.SDL_ShowCursor(); + editor.playClickSound(1.2f); + return true; + } + return false; + } + + if (button == 0) { + int pCol3X = layout.paletteCol3X; + int pY = layout.paletteY; + int sS = layout.swatchSize; + int gap = 4; + int tabMode = session.pickerTargetMode; + + for (int i = 0; i < 8; i++) { + int slotY = pY + (i * (sS + gap)); + if (editor.isHovering(pCol3X, slotY, sS, sS, mouseX, mouseY)) { + editor.playClickSound(1.0f); + if (editor.colorPickerModified) screen.saveCurrentCustomColor(); + + if (tabMode == 0) { + session.editingLineCustomIndex = i; + session.lineColorIndex = 16 + i; + } else if (tabMode == 1) { + session.editingBgCustomIndex = i; + session.bgColorIndex = 16 + i; + } else { + session.editingComboCustomIndex = i; + session.comboColorIndex = 16 + i; + } + + int newColor = ChestConfigManager.getInstance().getCustomColors(tabMode)[i]; + editor.colorPickerModified = false; + + if (newColor == 0) { + session.pickerCurrentRGB = 0; + } else { + newColor = newColor & 0xFFFFFF; + session.pickerCurrentRGB = newColor; + float[] hsb = + Color.RGBtoHSB((newColor >> 16) & 0xFF, (newColor >> 8) & 0xFF, newColor & 0xFF, null); + session.pickerHue = hsb[0]; + session.pickerSat = hsb[1]; + session.pickerVal = hsb[2]; + } + screen.updateFieldsFromColor(); + return true; + } + } + } + + boolean inPopup = mouseX >= layout.popupX + && mouseX <= layout.popupX + layout.popupW + && mouseY >= layout.popupY + && mouseY <= layout.popupY + layout.popupH; + + if (inPopup) { + if (button == 0) { + Minecraft client = Minecraft.getInstance(); + boolean clickedText = focusFieldIfHovered(screen.hexField, mouseX, mouseY, client); + clickedText |= focusFieldIfHovered(screen.rField, mouseX, mouseY, client); + clickedText |= focusFieldIfHovered(screen.gField, mouseX, mouseY, client); + clickedText |= focusFieldIfHovered(screen.bField, mouseX, mouseY, client); + + if (clickedText) { + editor.playClickSound(1.0f); + return true; + } + + int contentX = layout.popupX + 12; + int contentY = layout.popupY + 45; + + if (mouseX >= contentX && mouseX <= contentX + 100 && mouseY >= contentY && mouseY <= contentY + 100) { + session.isDraggingSatVal = true; + session.lastClickedHue = false; + updateColorFromMouse(mouseX, mouseY, true); + return true; + } else if (mouseX >= contentX + 115 + && mouseX <= contentX + 135 + && mouseY >= contentY + && mouseY <= contentY + 100) { + session.isDraggingHue = true; + session.lastClickedHue = true; + updateColorFromMouse(mouseX, mouseY, false); + return true; + } + } + return screen.clickWidgets(mouseX, mouseY, button); + } else { + if (button == 0 || button == 1) { + if (GlobalChestConfig.instance.closeOnClickOutside) { + screen.closeAndRestore(); + return true; + } + } + } + return false; + } + + boolean onMouseDragged(double mouseX, double mouseY, int button, double dragX, double dragY) { + if (!session.isColorPickerOpen || session.isEyedropperActive) return false; + + if (button == 0) { + if (session.isDraggingSatVal) { + updateColorFromMouse(mouseX, mouseY, true); + return true; + } else if (session.isDraggingHue) { + updateColorFromMouse(mouseX, mouseY, false); + return true; + } + } + return true; + } + + boolean onMouseReleased(double mouseX, double mouseY, int button) { + if (button == 0) { + session.isDraggingSatVal = false; + session.isDraggingHue = false; + } + return false; + } + + private void updateColorFromMouse(double mx, double my, boolean isSatValBox) { + editor.colorPickerModified = true; + int contentX = layout.popupX + 12; + int contentY = layout.popupY + 45; + + if (isSatValBox) { + float relX = Mth.clamp((float) (mx - contentX), 0.0f, 100.0f); + float relY = Mth.clamp((float) (my - contentY), 0.0f, 100.0f); + + session.pickerSat = relX / 100.0f; + session.pickerVal = 1.0f - (relY / 100.0f); + } else { + float relY = Mth.clamp((float) (my - contentY), 0.0f, 100.0f); + session.pickerHue = relY / 100.0f; + } + + session.pickerCurrentRGB = Color.HSBtoRGB(session.pickerHue, session.pickerSat, session.pickerVal); + screen.updateFieldsFromColor(); + + screen.saveCurrentCustomColor(); + } + + boolean onKeyPressed(net.minecraft.client.input.KeyEvent input) { + if (!session.isColorPickerOpen) return false; + + if (session.isEyedropperActive && input.key() == InputConstants.KEY_ESCAPE) { + session.isEyedropperActive = false; + org.lwjgl.sdl.SDLMouse.SDL_ShowCursor(); + return true; + } + + int key = input.key(); + boolean isAnyFieldFocused = (screen.hexField != null && screen.hexField.isFocused()) + || (screen.rField != null && screen.rField.isFocused()) + || (screen.gField != null && screen.gField.isFocused()) + || (screen.bField != null && screen.bField.isFocused()); + + if (key == InputConstants.KEY_ESCAPE) { + if (isAnyFieldFocused) { + if (screen.hexField != null) screen.hexField.setFocused(false); + if (screen.rField != null) screen.rField.setFocused(false); + if (screen.gField != null) screen.gField.setFocused(false); + if (screen.bField != null) screen.bField.setFocused(false); + } else { + screen.closeAndRestore(); + } + return true; + } + + if (key == InputConstants.KEY_TAB) { + if (screen.hexField != null && screen.hexField.isFocused()) { + screen.hexField.setFocused(false); + screen.rField.setFocused(true); + } else if (screen.rField != null && screen.rField.isFocused()) { + screen.rField.setFocused(false); + screen.gField.setFocused(true); + } else if (screen.gField != null && screen.gField.isFocused()) { + screen.gField.setFocused(false); + screen.bField.setFocused(true); + } else if (screen.bField != null && screen.bField.isFocused()) { + screen.bField.setFocused(false); + screen.hexField.setFocused(true); + } else if (screen.hexField != null) { + screen.hexField.setFocused(true); + } + return true; + } + + if (isAnyFieldFocused) { + boolean isUp = key == InputConstants.KEY_UP + || key == InputConstants.KEY_ADD + || key == InputConstants.KEY_EQUALS; + boolean isDown = key == InputConstants.KEY_DOWN + || key == InputConstants.KEY_MINUS + || key == org.lwjgl.sdl.SDLScancode.SDL_SCANCODE_KP_MINUS; + + if (isUp || isDown) { + editor.colorPickerModified = true; + int delta = isUp ? 1 : -1; + try { + if (screen.hexField.isFocused()) { + String hex = screen.hexField.getValue().trim().replace("#", ""); + int val = hex.isEmpty() ? 0 : Integer.parseInt(hex, 16); + val = Mth.clamp(val + delta, 0, 0xFFFFFF); + screen.hexField.setValue( + String.format("%02X%02X%02X", (val >> 16) & 0xFF, (val >> 8) & 0xFF, val & 0xFF)); + screen.updateColorFromFields(true); + } else if (screen.rField.isFocused()) { + int val = Integer.parseInt(screen.rField.getValue().isEmpty() ? "0" : screen.rField.getValue()); + screen.rField.setValue(String.valueOf(Mth.clamp(val + delta, 0, 255))); + screen.updateColorFromFields(false); + } else if (screen.gField.isFocused()) { + int val = Integer.parseInt(screen.gField.getValue().isEmpty() ? "0" : screen.gField.getValue()); + screen.gField.setValue(String.valueOf(Mth.clamp(val + delta, 0, 255))); + screen.updateColorFromFields(false); + } else if (screen.bField.isFocused()) { + int val = Integer.parseInt(screen.bField.getValue().isEmpty() ? "0" : screen.bField.getValue()); + screen.bField.setValue(String.valueOf(Mth.clamp(val + delta, 0, 255))); + screen.updateColorFromFields(false); + } + screen.saveCurrentCustomColor(); + } catch (NumberFormatException ignored) { + } + return true; + } + + // Forward delete/copy/paste keystrokes to the focused field. + if (screen.hexField != null && screen.hexField.isFocused()) screen.hexField.keyPressed(input); + else if (screen.rField != null && screen.rField.isFocused()) screen.rField.keyPressed(input); + else if (screen.gField != null && screen.gField.isFocused()) screen.gField.keyPressed(input); + else if (screen.bField != null && screen.bField.isFocused()) screen.bField.keyPressed(input); + + // Always consume the keystroke so Minecraft's own bindings do not fire. + return true; + } else { + float step = 0.01f; + boolean changed = false; + + if (session.lastClickedHue) { + if (key == InputConstants.KEY_UP) { + session.pickerHue = Mth.clamp(session.pickerHue - step, 0.0f, 1.0f); + changed = true; + } else if (key == InputConstants.KEY_DOWN) { + session.pickerHue = Mth.clamp(session.pickerHue + step, 0.0f, 1.0f); + changed = true; + } + } else { + if (key == InputConstants.KEY_LEFT) { + session.pickerSat = Mth.clamp(session.pickerSat - step, 0.0f, 1.0f); + changed = true; + } else if (key == InputConstants.KEY_RIGHT) { + session.pickerSat = Mth.clamp(session.pickerSat + step, 0.0f, 1.0f); + changed = true; + } else if (key == InputConstants.KEY_UP) { + session.pickerVal = Mth.clamp(session.pickerVal + step, 0.0f, 1.0f); + changed = true; + } else if (key == InputConstants.KEY_DOWN) { + session.pickerVal = Mth.clamp(session.pickerVal - step, 0.0f, 1.0f); + changed = true; + } + } + + if (changed) { + editor.colorPickerModified = true; + session.pickerCurrentRGB = Color.HSBtoRGB(session.pickerHue, session.pickerSat, session.pickerVal); + screen.updateFieldsFromColor(); + screen.saveCurrentCustomColor(); + return true; + } + } + return false; + } + + boolean onCharTyped(net.minecraft.client.input.CharacterEvent input) { + if (!session.isColorPickerOpen) return false; + if (screen.hexField != null && screen.hexField.isFocused()) return screen.hexField.charTyped(input); + if (screen.rField != null && screen.rField.isFocused()) return screen.rField.charTyped(input); + if (screen.gField != null && screen.gField.isFocused()) return screen.gField.charTyped(input); + if (screen.bField != null && screen.bField.isFocused()) return screen.bField.charTyped(input); + return false; + } +} diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/screens/DrawLinesClickHandler.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/screens/DrawLinesClickHandler.java new file mode 100644 index 0000000..f4472f3 --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/screens/DrawLinesClickHandler.java @@ -0,0 +1,277 @@ +package io.github.marcsanzdev.chestseparators.client.ui.screens; + +import io.github.marcsanzdev.chestseparators.client.EditorState; +import io.github.marcsanzdev.chestseparators.client.ui.ChestSeparatorsEditor; +import io.github.marcsanzdev.chestseparators.client.ui.EditorGeometry; +import io.github.marcsanzdev.chestseparators.client.ui.EditorLayout; +import io.github.marcsanzdev.chestseparators.client.ui.EditorSessionData; +import io.github.marcsanzdev.chestseparators.config.GlobalChestConfig; +import io.github.marcsanzdev.chestseparators.data.ChestConfigManager; +import net.minecraft.world.inventory.Slot; +import net.minecraft.network.chat.Component; + +/** + * Handles mouse-click routing for the line-drawing screen: the tab strip, the color palette + * (standard and custom swatches), slot painting/drag start, and click-outside-to-close. Extracted + * from ScreenDrawLines. + */ +final class DrawLinesClickHandler { + + private final ScreenDrawLines screen; + private final ChestSeparatorsEditor editor; + private final EditorSessionData session; + private final EditorLayout layout; + private final EditorGeometry geometry; + + DrawLinesClickHandler(ScreenDrawLines screen) { + this.screen = screen; + this.editor = screen.editor; + this.session = screen.session; + this.layout = screen.layout; + this.geometry = screen.geometry; + } + + boolean onMouseClicked(double mouseX, double mouseY, int button) { + if (screen.clickWidgets(mouseX, mouseY, button)) return true; + + if (handleTabsClick(mouseX, mouseY, button)) return true; + if (handlePaletteClick(mouseX, mouseY, button)) return true; + + if (session.isColorPickerOpen) return false; + + if (button == 0) { + Slot slot = editor.accessor.getFocusedSlot(); + if (slot != null && ChestSeparatorsEditor.isEditableSlot(slot)) { + int action = geometry.calculateAction(slot, mouseX, mouseY); + + if (session.currentTab == 1 || session.currentTab == 2) { + ChestConfigManager.getInstance().saveSnapshot(); + session.isDraggingLine = true; + session.currentDragAction = ChestConfigManager.ACTION_BG; + session.dragStartSlot = slot; + session.dragCurrentSlot = slot; + session.tracePath.clear(); + session.lockedTraceAxis = 0; + session.tracePath.add(ChestSeparatorsEditor.slotKey(slot) + "_" + ChestConfigManager.ACTION_BG); + + int tIndex = (session.currentTab == 1) ? session.bgColorIndex : session.comboColorIndex; + int colorVal = (session.currentTab == 1) + ? screen.getCurrentSelectedBgColorValue() + : screen.getCurrentSelectedComboColorValue(); + + if (tIndex == ChestSeparatorsEditor.TOOL_ERASER_ID) { + session.isDragModeErasing = true; + } else { + if (colorVal == 0) return false; + int existingColor = ChestConfigManager.getInstance() + .getColor(ChestSeparatorsEditor.slotKey(slot), ChestConfigManager.ACTION_BG); + session.isDragModeErasing = (existingColor == (colorVal | 0xFF000000)); + } + return true; + } + + if (session.currentTab == 0) { + if (action != 0 && action != ChestConfigManager.ACTION_BG) { + ChestConfigManager.getInstance().saveSnapshot(); + session.isDraggingLine = true; + session.currentDragAction = action; + session.dragStartSlot = slot; + session.dragCurrentSlot = slot; + session.tracePath.clear(); + session.tracePath.add(ChestSeparatorsEditor.slotKey(slot) + "_" + action); + session.lockedTraceAction = action; + if (action == ChestConfigManager.ACTION_TOP || action == ChestConfigManager.ACTION_BOTTOM) { + session.lockedTraceAxis = 1; + session.lockedTraceRowCol = slot.getContainerSlot() / 9; + session.lockedLineCoord = (action == ChestConfigManager.ACTION_TOP) + ? (layout.guiY + slot.y) + : (layout.guiY + slot.y + 16); + } else { + session.lockedTraceAxis = 2; + session.lockedTraceRowCol = slot.getContainerSlot() % 9; + session.lockedLineCoord = (action == ChestConfigManager.ACTION_LEFT) + ? (layout.guiX + slot.x) + : (layout.guiX + slot.x + 16); + } + + int tIndex = session.lineColorIndex; + int colorVal = screen.getCurrentSelectedLineColorValue(); + + if (tIndex == ChestSeparatorsEditor.TOOL_ERASER_ID) { + session.isDragModeErasing = true; + } else { + if (colorVal == 0) return false; + int existingColor = ChestConfigManager.getInstance() + .getColor(ChestSeparatorsEditor.slotKey(slot), action); + session.isDragModeErasing = (existingColor == (colorVal | 0xFF000000)); + } + return true; + } + } + } + } + + // --- CLICK OUTSIDE / ON DEAD SPACE TO CLOSE --- + // Close not only when clicking fully outside, but also when clicking a spot that changes nothing: + // anything that is not an editable slot (or its paintable border) and not the tool sidebar or the + // right-hand buttons. A no-op click inside the container should dismiss the panel like any other. + boolean overSlot = editor.accessor.getFocusedSlot() != null + && ChestSeparatorsEditor.isEditableSlot(editor.accessor.getFocusedSlot()); + boolean isInsideLeft = mouseX >= layout.sidebarX + && mouseX <= layout.sidebarX + layout.sidebarWidth + && mouseY >= layout.guiY + editor.getSidebarYOffset() - 4 + && mouseY <= layout.guiY + editor.getSidebarYOffset() + layout.sidebarHeight; + boolean isInsideRight = mouseX >= layout.rightX + && mouseX <= layout.rightX + layout.btnW + && mouseY >= layout.mainY + && mouseY <= layout.mainY + (layout.bH * 4) + (4 * 3); + + if (!overSlot && !isInsideLeft && !isInsideRight && !session.isEyedropperActive) { + if (GlobalChestConfig.instance.closeOnClickOutside) { + editor.toggleState(EditorState.HIDDEN); + editor.playCloseSound(); + return true; + } + } + + return false; + } + + boolean handleTabsClick(double mx, double my, int button) { + int tabX = layout.sidebarX - 16; + int startY = layout.guiY + editor.getSidebarYOffset() + 10; + + if (mx >= tabX && mx < tabX + 20) { + if (button == 0) { + for (int i = 0; i < 3; i++) { + int tabY = startY + (i * 24); + if (my >= tabY && my < tabY + 20) { + session.currentTab = i; + editor.playClickSound(1.0f); + return true; + } + } + } + } + return false; + } + + boolean handlePaletteClick(double mx, double my, int button) { + int pY = layout.paletteY; + int col1X = layout.paletteCol1X; + int col2X = layout.paletteCol2X; + int col3X = layout.paletteCol3X; + + int tabMode = session.currentTab; + + for (int i = 0; i < 16; i++) { + int x = (i / 8 == 0) ? col1X : col2X; + int y = pY + ((i % 8) * (layout.swatchSize + 4)); + if (editor.isHovering(x, y, layout.swatchSize, layout.swatchSize, mx, my)) { + if (button == 2) { + session.copiedColorRGB = ScreenDrawLines.STANDARD_PALETTE[i]; + editor.showStatus( + Component.translatable("message.chestseparators.color_copied"), session.copiedColorRGB); + editor.playClickSound(0.8f); + return true; + } else if (button == 0) { + if (tabMode == 0) { + session.lineColorIndex = i; + session.editingLineCustomIndex = -1; + } else if (tabMode == 1) { + session.bgColorIndex = i; + session.editingBgCustomIndex = -1; + } else { + session.comboColorIndex = i; + session.editingComboCustomIndex = -1; + } + editor.playClickSound(1.0f); + return true; + } + } + } + + for (int i = 0; i < 8; i++) { + int y = pY + (i * (layout.swatchSize + 4)); + if (editor.isHovering(col3X, y, layout.swatchSize, layout.swatchSize, mx, my)) { + int currentColor = ChestConfigManager.getInstance().getCustomColors(tabMode)[i]; + + if (button == 2) { + if (currentColor != 0) { + session.copiedColorRGB = currentColor; + editor.showStatus( + Component.translatable("message.chestseparators.color_copied"), session.copiedColorRGB); + editor.playClickSound(0.8f); + } + return true; + } else if (button == 0) { + if (session.copiedColorRGB != 0) { + int pastedColor = session.copiedColorRGB; + ChestConfigManager.getInstance().setCustomColor(i, session.copiedColorRGB, tabMode); + ChestConfigManager.getInstance().saveWorldPalette(); + session.copiedColorRGB = 0; + editor.showStatus(Component.translatable("message.chestseparators.color_pasted"), pastedColor); + editor.playClickSound(1.2f); + } else { + // Save the current color index so it can be restored if the picker is dismissed without saving. + editor.restoreColorIndex = (tabMode == 0) + ? session.lineColorIndex + : (tabMode == 1 ? session.bgColorIndex : session.comboColorIndex); + + if (currentColor == 0) { + // Empty slot: one click opens the color picker immediately. + if (tabMode == 0) { + session.lineColorIndex = 16 + i; + session.editingLineCustomIndex = i; + } else if (tabMode == 1) { + session.bgColorIndex = 16 + i; + session.editingBgCustomIndex = i; + } else { + session.comboColorIndex = 16 + i; + session.editingComboCustomIndex = i; + } + editor.openColorPicker(0, tabMode); + editor.playClickSound(1.0f); + } else { + // Occupied slot: single click selects for painting, double click opens the picker. + long now = System.currentTimeMillis(); + boolean isDoubleClick = (i == screen.lastCustomColorClickIndex) + && (now - screen.lastCustomColorClickTime < 300); + screen.lastCustomColorClickIndex = i; + screen.lastCustomColorClickTime = now; + + if (isDoubleClick) { + if (tabMode == 0) { + session.lineColorIndex = 16 + i; + session.editingLineCustomIndex = i; + } else if (tabMode == 1) { + session.bgColorIndex = 16 + i; + session.editingBgCustomIndex = i; + } else { + session.comboColorIndex = 16 + i; + session.editingComboCustomIndex = i; + } + editor.openColorPicker(currentColor, tabMode); + editor.playClickSound(1.0f); + } else { + if (tabMode == 0) { + session.lineColorIndex = 16 + i; + session.editingLineCustomIndex = i; + } else if (tabMode == 1) { + session.bgColorIndex = 16 + i; + session.editingBgCustomIndex = i; + } else { + session.comboColorIndex = 16 + i; + session.editingComboCustomIndex = i; + } + editor.playClickSound(1.0f); + } + } + } + return true; + } + } + } + return false; + } +} diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/screens/FilterClickHandler.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/screens/FilterClickHandler.java new file mode 100644 index 0000000..1504d37 --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/screens/FilterClickHandler.java @@ -0,0 +1,404 @@ +package io.github.marcsanzdev.chestseparators.client.ui.screens; + +import io.github.marcsanzdev.chestseparators.client.EditorState; +import io.github.marcsanzdev.chestseparators.client.ui.ChestSeparatorsEditor; +import io.github.marcsanzdev.chestseparators.client.ui.EditorLayout; +import io.github.marcsanzdev.chestseparators.client.ui.EditorSessionData; +import io.github.marcsanzdev.chestseparators.config.GlobalChestConfig; +import java.util.ArrayList; +import java.util.List; +import net.minecraft.world.item.Item; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.network.chat.Component; +import net.minecraft.ChatFormatting; +import net.minecraft.util.Mth; + +/** + * Handles mouse-click routing for the filter editor: popups, the action buttons, the search/list + * panels, tag tabs, and the item grid. Extracted verbatim from ScreenEditFilter. + */ +final class FilterClickHandler { + + private final ScreenEditFilter screen; + private final ChestSeparatorsEditor editor; + private final EditorSessionData session; + private final EditorLayout layout; + + FilterClickHandler(ScreenEditFilter screen) { + this.screen = screen; + this.editor = screen.editor; + this.session = screen.session; + this.layout = screen.layout; + } + + boolean onMouseClicked(double mouseX, double mouseY, int button) { + // Forward clicks to the active popup and block all background interaction. + if (session.isUnsavedPopupOpen) { + for (io.github.marcsanzdev.chestseparators.client.ui.widgets.CustomWidget widget : + screen.unsavedPopupWidgets) { + if (widget.mouseClicked(mouseX, mouseY, button)) return true; + } + return true; + } + + if (session.isExpelPopupOpen) { + for (io.github.marcsanzdev.chestseparators.client.ui.widgets.CustomWidget widget : + screen.expelPopupWidgets) { + if (widget.mouseClicked(mouseX, mouseY, button)) return true; + } + return true; + } + + // Track which panel received the last click to route keyboard scroll correctly. + if (mouseX >= layout.mainX + && mouseX <= layout.mainX + layout.mainW + && mouseY >= layout.mainY + && mouseY <= layout.mainY + layout.mainH) { + session.lastInteractedWasList = false; + } else if (mouseX >= layout.listX + && mouseX <= layout.listX + layout.listW + && mouseY >= layout.listY + && mouseY <= layout.listY + layout.listH) { + session.lastInteractedWasList = true; + } + + // 1. Tag Dropdown logic + if (!session.activeDropdownTags.isEmpty()) { + if (button == 0) { + int dropW = 120; + int dropH = session.activeDropdownTags.size() * 14 + 4; + if (mouseX >= session.dropdownX + && mouseX <= session.dropdownX + dropW + && mouseY >= session.dropdownY + && mouseY <= session.dropdownY + dropH) { + int clickedIndex = (int) (mouseY - session.dropdownY - 2) / 14; + if (clickedIndex >= 0 && clickedIndex < session.activeDropdownTags.size()) { + if (editor.searchBox != null) { + editor.searchBox.setValue("#" + session.activeDropdownTags.get(clickedIndex)); + editor.playClickSound(1.2f); + } + } + } + session.activeDropdownTags.clear(); + return true; + } else { + session.activeDropdownTags.clear(); + return true; + } + } + + if (button == 0 && screen.clickWidgets(mouseX, mouseY, button)) return true; + if (button != 0 && button != 2) return false; + + // Remove from List (The 'X') + if (button == 0 + && mouseX >= layout.listX + 6 + && mouseX <= layout.listX + layout.listW - 14 + && mouseY >= layout.listViewY + && mouseY <= layout.listViewY + layout.listViewH) { + int clickedIdx = (int) (mouseY - layout.listViewY + session.listScrollY) / 18; + + // We use the cache directly + List visibleAllowed = session.visibleLeftListItems; + + if (clickedIdx >= 0 && clickedIdx < visibleAllowed.size()) { + int itemY = layout.listViewY + (clickedIdx * 18) - (int) session.listScrollY; + if (editor.isHovering(layout.listX + layout.listW - 24, itemY + 2, 12, 12, mouseX, mouseY)) { + session.currentAllowedItems.remove(visibleAllowed.get(clickedIdx)); + editor.updateWhitelistSearchCache(); // Update cache after removing + editor.playClickSound(1.2f); + return true; + } + + // Anywhere else on the row picks it up to reorder the filter's list. Not while a preview + // is running: the list is then showing the preview's contents, not the filter's own. + if (button == 0 && !session.isPreviewing) { + session.reorderDragItem = visibleAllowed.get(clickedIdx); + session.reorderFromGrid = false; + session.reorderMouseX = (int) mouseX; + session.reorderMouseY = (int) mouseY; + // The held row flies out of the row it was picked from. + session.reorderOriginX = layout.listX + 6; + session.reorderOriginY = itemY - 2; + session.reorderStartTime = System.currentTimeMillis(); + return true; + } + } + } + + // Scrollbars + if (button == 0) { + if (editor.isHovering(layout.msbX, layout.msbY, 6, layout.msbH, mouseX, mouseY)) { + session.isDraggingMainScroll = true; + return true; + } + if (editor.isHovering(layout.lsbX, layout.lsbY, 6, layout.lsbH, mouseX, mouseY)) { + session.isDraggingListScroll = true; + return true; + } + } + + // Search Boxes Focus + EditorSessionData.CreativeTabInfo currentTabInfo = session.availableTabs.get(session.currentCreativeTabIndex); + if (button == 0 + && editor.whitelistSearchBox != null + && editor.isHovering(layout.listX + 6, layout.listY + 20, layout.listW - 12, 16, mouseX, mouseY)) { + editor.whitelistSearchBox.setFocused(true); + if (editor.searchBox != null) editor.searchBox.setFocused(false); + editor.playClickSound(1.0f); + return true; + } else if (button == 0 + && editor.searchBox != null + && currentTabInfo != null + && currentTabInfo.isSearchTab + && editor.searchBox.isMouseOver(mouseX, mouseY)) { + editor.searchBox.setFocused(true); + if (editor.whitelistSearchBox != null) editor.whitelistSearchBox.setFocused(false); + editor.playClickSound(1.0f); + return true; + } else if (button == 0) { + if (editor.searchBox != null) editor.searchBox.setFocused(false); + if (editor.whitelistSearchBox != null) editor.whitelistSearchBox.setFocused(false); + } + + // Tabs and Pagination + if (button == 0) { + EditorSessionData.CreativeTabInfo searchTab = null; + int searchTabIndexGlobal = -1; + List normalIndices = new ArrayList<>(); + + for (int i = 0; i < session.availableTabs.size(); i++) { + EditorSessionData.CreativeTabInfo tab = session.availableTabs.get(i); + if (tab == null) continue; + if (tab.isSearchTab) { + searchTab = tab; + searchTabIndexGlobal = i; + } else { + normalIndices.add(i); + } + } + + int totalNormalTabs = normalIndices.size(); + int remainingTabs = Math.max(0, totalNormalTabs - 10); + int normalTabsPerPage = 15; + + int maxPages = 1; + if (remainingTabs > 0) { + maxPages = 1 + (int) Math.ceil((double) remainingTabs / normalTabsPerPage); + } + + for (int slot = 0; slot < 16; slot++) { + int actualGlobalIndex = -1; + + if (slot == 7 && searchTab != null) { + actualGlobalIndex = searchTabIndexGlobal; + } else { + int normalListIndex = + FilterPanelRenderer.normalListIndexForSlot(slot, session.currentTabPage, normalTabsPerPage); + + if (normalListIndex >= 0 && normalListIndex < normalIndices.size()) { + actualGlobalIndex = normalIndices.get(normalListIndex); + } + } + + if (actualGlobalIndex == -1) continue; + + int tabX = layout.tabX(slot % 8); + int tabY = (slot < 8) ? layout.mainY - 20 : layout.mainY + layout.mainH - 2; + + if (editor.isHovering(tabX, tabY, layout.tabW, layout.tabW, mouseX, mouseY)) { + editor.switchCreativeTab(actualGlobalIndex); + editor.playClickSound(1.0f); + return true; + } + } + + // Click en el Carrusel + EditorSessionData.CreativeTabInfo activeTabInfo = + session.availableTabs.get(session.currentCreativeTabIndex); + if (activeTabInfo == null || !activeTabInfo.isSearchTab) { + if (maxPages > 1) { + int visibleDots = Math.min(maxPages, 3); + int startPage = Math.max(0, Math.min(session.currentTabPage - 1, maxPages - visibleDots)); + + int dotSpacing = 8; + int arrowWidth = 12; + int totalWidth = (arrowWidth * 2) + (visibleDots * dotSpacing); + int startX = (layout.mainX + layout.mainW - 12) - totalWidth; + int currentX = startX; + int y = layout.mainY + 10; + + if (editor.isHovering(currentX, y - 2, arrowWidth, 12, mouseX, mouseY)) { + session.currentTabPage = (session.currentTabPage - 1 + maxPages) % maxPages; + int newIndex = (session.currentTabPage == 0) ? 0 : 10 + ((session.currentTabPage - 1) * 15); + if (newIndex < normalIndices.size()) editor.switchCreativeTab(normalIndices.get(newIndex)); + editor.playClickSound(0.8f); + return true; + } + currentX += arrowWidth; + + for (int i = 0; i < visibleDots; i++) { + if (editor.isHovering(currentX, y - 2, dotSpacing, 12, mouseX, mouseY)) { + session.currentTabPage = startPage + i; + int newIndex = (session.currentTabPage == 0) ? 0 : 10 + ((session.currentTabPage - 1) * 15); + if (newIndex < normalIndices.size()) editor.switchCreativeTab(normalIndices.get(newIndex)); + editor.playClickSound(1.0f); + return true; + } + currentX += dotSpacing; + } + + if (editor.isHovering(currentX, y - 2, arrowWidth, 12, mouseX, mouseY)) { + session.currentTabPage = (session.currentTabPage + 1) % maxPages; + int newIndex = (session.currentTabPage == 0) ? 0 : 10 + ((session.currentTabPage - 1) * 15); + if (newIndex < normalIndices.size()) editor.switchCreativeTab(normalIndices.get(newIndex)); + editor.playClickSound(0.8f); + return true; + } + } + } + } + + // Grid Click + if (mouseX >= layout.gridX + && mouseX < layout.gridX + (layout.cols * layout.gridCell) + && mouseY >= layout.gridViewY + && mouseY < layout.gridViewY + layout.gridViewH) { + int c = (int) (mouseX - layout.gridX) / layout.gridCell; + int r = (int) (mouseY - layout.gridViewY + session.gridScrollY) / layout.gridCell; + int itemIndex = (r * layout.cols) + c; + if (itemIndex >= 0 && itemIndex < session.filteredItems.size()) { + Item item = session.filteredItems.get(itemIndex); + if (button == 2) { + List> candidates = new ArrayList<>(); + item.builtInRegistryHolder().tags().forEach(tagKey -> { + String t = tagKey.location().getPath(); + if (!t.startsWith("mineable/") + && !t.startsWith("needs_") + && !t.contains("tools") + && !t.startsWith("beacon_") + && !t.equals("completes_find_tree_tutorial") + && hasMoreThanOneItem(tagKey)) candidates.add(tagKey); + }); + List tags = dropEquivalentTags(candidates); + if (!tags.isEmpty()) { + if (editor.searchBox != null) editor.searchBox.setValue(""); + for (int i = 0; i < session.availableTabs.size(); i++) { + if (session.availableTabs.get(i) != null && session.availableTabs.get(i).isSearchTab) { + editor.switchCreativeTab(i); + int newIndex = session.filteredItems.indexOf(item); + if (newIndex != -1) { + // Centre the clicked item's row in the viewport. This has to use the + // grid's real metrics: the column count and cell size are laid out by + // EditorLayout and no longer match the 9x18 the old maths assumed, so + // the view landed at the wrong height. + int cols = Math.max(1, layout.cols); + int cell = layout.gridCell; + float centred = (newIndex / cols) * (float) cell - (layout.gridViewH - cell) / 2f; + float maxScroll = Math.max( + 0, + (int) Math.ceil(session.filteredItems.size() / (double) cols) * cell + - layout.gridViewH); + session.gridScrollY = Mth.clamp(centred, 0, maxScroll); + } + break; + } + } + session.activeDropdownTags = tags; + session.dropdownX = layout.mainX + layout.mainW - 132; + session.dropdownY = layout.mainY + 24; + editor.playClickSound(1.0f); + } else + editor.showStatus( + Component.translatable("message.chestseparators.no_valid_groups"), ChatFormatting.GRAY); + } else if (button == 0) { + // Only remember the press for now. A quick click still just toggles the item (see + // ScreenEditFilter#commitPointerRelease); it only becomes a drag once the button is + // held or the cursor moves, so a simple click never flashes a row on the cursor. + session.pendingDragItem = BuiltInRegistries.ITEM.getKey(item).toString(); + session.pendingDragX = (int) mouseX; + session.pendingDragY = (int) mouseY; + session.pendingDragTime = System.currentTimeMillis(); + session.reorderOriginX = layout.gridX + (c * layout.gridCell); + session.reorderOriginY = layout.gridViewY + (r * layout.gridCell) - (int) session.gridScrollY; + } + return true; + } + } + + // --- CLICK OUTSIDE TO CLOSE --- + if (button == 0 && GlobalChestConfig.instance.closeOnClickOutside) { + boolean isInsideMain = mouseX >= layout.mainX + && mouseX <= layout.mainX + layout.mainW + && mouseY >= layout.mainY + && mouseY <= layout.mainY + layout.mainH; + boolean isInsideLeft = mouseX >= layout.listX + && mouseX <= layout.listX + layout.listW + && mouseY >= layout.listY + && mouseY <= layout.listY + layout.listH; + boolean isInsideRight = mouseX >= layout.rightX + && mouseX <= layout.rightX + layout.btnW + && mouseY >= layout.mainY + && mouseY <= layout.mainY + (layout.bH * 8); + + if (!isInsideMain && !isInsideLeft && !isInsideRight && session.activeDropdownTags.isEmpty()) { + if (screen.hasUnsavedChanges()) { + session.isUnsavedPopupOpen = true; + } else { + session.selectedSlots.clear(); + editor.toggleState(EditorState.VIEW_GROUPS); + } + editor.playCloseSound(); + return true; + } + } + + return false; + } + + /** + * True when a tag covers more than one item. Single-item tags (say {@code #ore_bearing_ground/deepslate}) + * are useless as a filter shortcut: picking one gives exactly the item you already middle-clicked, so + * they only pad the list. + */ + private static boolean hasMoreThanOneItem(net.minecraft.tags.TagKey tagKey) { + int found = 0; + for (var entry : BuiltInRegistries.ITEM.getTagOrEmpty(tagKey)) { + if (++found > 1) return true; // no need to walk the whole tag + } + return false; + } + + /** + * Collapses tags that select exactly the same items down to one entry. Vanilla ships several such + * pairs — {@code #flowers/small} and {@code #small_flowers} resolve to an identical list — and showing + * both only asks the player to choose between two filters that behave the same. + * + *

The flat name wins over the {@code group/variant} form: it is what the search box will display, + * and it reads as a name rather than a path. Ties fall back to the shorter, then alphabetical, name so + * the choice is stable between openings. + */ + private static List dropEquivalentTags(List> candidates) { + java.util.Map, String> byContents = new java.util.LinkedHashMap<>(); + for (net.minecraft.tags.TagKey tagKey : candidates) { + List contents = new ArrayList<>(); + for (var entry : BuiltInRegistries.ITEM.getTagOrEmpty(tagKey)) { + contents.add(BuiltInRegistries.ITEM.getKey(entry.value()).toString()); + } + java.util.Collections.sort(contents); + + String path = tagKey.location().getPath(); + String kept = byContents.get(contents); + if (kept == null || isBetterTagName(path, kept)) byContents.put(contents, path); + } + return new ArrayList<>(byContents.values()); + } + + private static boolean isBetterTagName(String candidate, String current) { + boolean candidateFlat = !candidate.contains("/"); + boolean currentFlat = !current.contains("/"); + if (candidateFlat != currentFlat) return candidateFlat; + if (candidate.length() != current.length()) return candidate.length() < current.length(); + return candidate.compareTo(current) < 0; + } +} diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/screens/FilterPanelRenderer.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/screens/FilterPanelRenderer.java new file mode 100644 index 0000000..746b7fa --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/screens/FilterPanelRenderer.java @@ -0,0 +1,606 @@ +package io.github.marcsanzdev.chestseparators.client.ui.screens; + +import io.github.marcsanzdev.chestseparators.client.ui.ChestSeparatorsEditor; +import io.github.marcsanzdev.chestseparators.client.ui.EditorLayout; +import io.github.marcsanzdev.chestseparators.client.ui.EditorSessionData; +import io.github.marcsanzdev.chestseparators.config.GlobalChestConfig; +import java.util.ArrayList; +import java.util.List; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiGraphicsExtractor; +import net.minecraft.world.item.Item; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.network.chat.Component; +import net.minecraft.resources.Identifier; +import net.minecraft.util.Mth; + +/** + * Renders the three panels of the filter editor: the left item list, the main whitelist panel, + * and the tag dropdown. Pure rendering, extracted verbatim from ScreenEditFilter. + */ +final class FilterPanelRenderer { + + private final ScreenEditFilter screen; + private final ChestSeparatorsEditor editor; + private final EditorSessionData session; + private final EditorLayout layout; + + FilterPanelRenderer(ScreenEditFilter screen) { + this.screen = screen; + this.editor = screen.editor; + this.session = screen.session; + this.layout = screen.layout; + } + + void drawLeftPanel(GuiGraphicsExtractor context, int mouseX, int mouseY) { + int listW = layout.listW; + int listH = layout.listH; + int listX = layout.listX; + int listY = layout.listY; + boolean isDark = GlobalChestConfig.instance.darkMode; + + io.github.marcsanzdev.chestseparators.client.ui.UiTheme.panel(context, listX, listY, listW, listH); + + List activeListToRender; + float activeScrollY; + + if (session.isPreviewing) { + activeListToRender = session.previewItems; + activeScrollY = session.previewScrollY; + } else { + activeListToRender = session.visibleLeftListItems; + activeScrollY = session.listScrollY; + } + + int allowedCount = session.currentAllowedItems.size(); + int blockedCount = session.allGameItems.size() - allowedCount; + + context.pose().pushMatrix(); + float scaleC = 0.8f; + context.pose().scale(scaleC, scaleC); + + if (session.isPreviewing) { + if (session.previewType == 1) + context.text( + Minecraft.getInstance().font, + Component.translatable("gui.chestseparators.new_detected", activeListToRender.size()), + (int) ((listX + 8) / scaleC), + (int) ((listY + 9) / scaleC), + 0xFF55FF55, + false); + else if (session.previewType == 2) + context.text( + Minecraft.getInstance().font, + Component.translatable("gui.chestseparators.allowing_all", activeListToRender.size()), + (int) ((listX + 8) / scaleC), + (int) ((listY + 9) / scaleC), + 0xFF55FF55, + false); + else if (session.previewType == 3) + context.text( + Minecraft.getInstance().font, + Component.translatable("gui.chestseparators.clearing", activeListToRender.size()), + (int) ((listX + 8) / scaleC), + (int) ((listY + 9) / scaleC), + 0xFFFF5555, + false); + } else { + context.text( + Minecraft.getInstance().font, + Component.translatable("gui.chestseparators.allowed", allowedCount), + (int) ((listX + 8) / scaleC), + (int) ((listY + 5) / scaleC), + 0xFF55FF55, + false); + context.text( + Minecraft.getInstance().font, + Component.translatable("gui.chestseparators.blocked", blockedCount), + (int) ((listX + 8) / scaleC), + (int) ((listY + 13) / scaleC), + 0xFFFF5555, + false); + } + context.pose().popMatrix(); + + io.github.marcsanzdev.chestseparators.client.ui.UiTheme.inset(context, listX + 6, listY + 22, listW - 12, 16); + + if (editor.whitelistSearchBox != null) { + editor.whitelistSearchBox.setX(listX + 10); + editor.whitelistSearchBox.setY(listY + 26); + if (!session.isPreviewing) + editor.whitelistSearchBox.extractRenderState( + context, + mouseX, + mouseY, + Minecraft.getInstance().getDeltaTracker().getGameTimeDeltaPartialTick(true)); + if (editor.whitelistSearchBox.getValue().isEmpty() + && !editor.whitelistSearchBox.isFocused() + && !session.isPreviewing) { + context.text( + Minecraft.getInstance().font, + Component.translatable("gui.chestseparators.search"), + listX + 12, + listY + 26, + 0xFF666666, + false); + } + } + + int listViewY = layout.listViewY; + int listViewH = layout.listViewH; + io.github.marcsanzdev.chestseparators.client.ui.UiTheme.inset( + context, listX + 6, listViewY, listW - 12, listViewH); + + int totalListItems = activeListToRender.size(); + // Trailing padding so scrolling to the bottom fully reveals the last row. Shared formula via + // layout.maxListScroll keeps the renderer and the scroll inputs in sync. + int totalListHeight = totalListItems * 18 + EditorLayout.LIST_TRAILING_PADDING; + float maxListScroll = layout.maxListScroll(totalListItems); + + if (!session.isPreviewing) session.listScrollY = Mth.clamp(session.listScrollY, 0, maxListScroll); + + int lsbX = layout.lsbX; + int lsbY = layout.lsbY; + int lsbH = layout.lsbH; + int listThumbH = maxListScroll > 0 + ? Math.max(10, (int) ((listViewH / (float) Math.max(1, totalListHeight)) * lsbH)) + : lsbH; + int listThumbY = + maxListScroll > 0 ? lsbY + (int) ((activeScrollY / maxListScroll) * (lsbH - listThumbH)) : lsbY; + io.github.marcsanzdev.chestseparators.client.ui.UiTheme.scrollbar( + context, lsbX, lsbY, 6, lsbH, listThumbY, listThumbH); + + context.enableScissor(listX + 6, listViewY + 1, listX + listW - 14, listViewY + listViewH - 1); + int startIndex = (int) (activeScrollY / 18); + int visibleCount = (listViewH / 18) + 2; + + for (int i = 0; i < visibleCount; i++) { + int idx = startIndex + i; + if (idx >= totalListItems) break; + + String itemIdStr = activeListToRender.get(idx); + + // The row being carried leaves an empty gap behind it: it is on the cursor, not in the list, + // and the space stays open until the drop rebuilds the order. Drawing it here too would show + // the same entry twice. + if (!session.reorderFromGrid && itemIdStr.equals(session.reorderDragItem)) continue; + + Item item = BuiltInRegistries.ITEM.getValue(Identifier.tryParse(itemIdStr)); + int itemY = listViewY + (i * 18) - (int) (activeScrollY % 18) + 2; + + // Settle animation: right after a drop, every row starts from where it used to be and slides + // to its new place, so the list opens a gap for the dropped item instead of snapping. + long sinceDrop = System.currentTimeMillis() - session.dropAnimStart; + if (sinceDrop < ScreenEditFilter.DROP_MS && !session.dropAnimFrom.isEmpty()) { + Integer previousIndex = session.dropAnimFrom.get(itemIdStr); + if (previousIndex != null) { + float k = 1f - (float) sinceDrop / ScreenEditFilter.DROP_MS; + k = k * k; // ease-out: most of the travel happens immediately + itemY += Math.round((previousIndex - idx) * 18 * k); + } + } + + context.item(item.getDefaultInstance(), listX + 8, itemY); + + String name = item.getName(item.getDefaultInstance()).getString(); + context.pose().pushMatrix(); + float scale = 0.75f; + context.pose().scale(scale, scale); + int maxNameW = (int) ((listW - 55) / scale); + if (Minecraft.getInstance().font.width(name) > maxNameW) + name = Minecraft.getInstance().font.plainSubstrByWidth(name, maxNameW - 6) + "..."; + int textColor = session.isPreviewing + ? ((session.previewType == 3) ? 0x66FFFFFF : 0xAAFFFFFF) + : (isDark ? 0xFFFFFFFF : 0xFF222222); + context.text( + Minecraft.getInstance().font, + name, + (int) ((listX + 26) / scale), + (int) ((itemY + 6) / scale), + textColor, + false); + context.pose().popMatrix(); + + if (!session.isPreviewing || session.previewType == 3) { + int crossX = listX + listW - 22; + int crossY = itemY + 4; + boolean hoverCross = + !session.isPreviewing && editor.isHovering(crossX - 2, crossY - 2, 10, 10, mouseX, mouseY); + context.text( + Minecraft.getInstance().font, + "x", + crossX, + crossY, + session.isPreviewing + ? 0xFFFF5555 + : (hoverCross ? 0xFFFF5555 : (isDark ? 0xFFAAAAAA : 0xFF777777))); + } + } + context.disableScissor(); + + // Insertion caret: where the held item will land if released now. Drawn OUTSIDE the scissor and + // kept one pixel inside the viewport: the clip region starts just below the top edge, so a caret + // for the very first position fell entirely outside it and never showed up. + // Only while the cursor is actually over the list: outside it a drop changes nothing, so promising + // a landing spot there would be a lie. + if (session.reorderDragItem != null && screen.isOverList(session.reorderMouseX, session.reorderMouseY)) { + int row = screen.reorderTargetRow(session.reorderMouseY); + int caretY = listViewY + (row * 18) - (int) session.listScrollY; + caretY = Mth.clamp(caretY, listViewY + 1, listViewY + listViewH - 1); + context.fill(listX + 6, caretY - 1, listX + listW - 14, caretY + 1, 0xFF4A9EFF); + } + } + + /** Maps a 16-slot tab-grid position to an index into the normal-tabs list for {@code currentTabPage}, + * or -1 if that slot holds no normal tab. Shared verbatim by the panel renderer and click handler. */ + static int normalListIndexForSlot(int slot, int currentTabPage, int normalTabsPerPage) { + if (currentTabPage == 0) { + if (slot >= 0 && slot <= 4) return slot; + if (slot >= 8 && slot <= 12) return 5 + (slot - 8); + return -1; + } + int offsetOnPage = (slot > 7) ? slot - 1 : slot; + return 10 + ((currentTabPage - 1) * normalTabsPerPage) + offsetOnPage; + } + + void drawMainPanel(GuiGraphicsExtractor context, int mouseX, int mouseY) { + int mainX = layout.mainX; + int mainY = layout.mainY; + int mainW = layout.mainW; + int mainH = layout.mainH; + boolean isDark = GlobalChestConfig.instance.darkMode; + + // --- 1. TABS LOGIC SEPARATION --- + EditorSessionData.CreativeTabInfo searchTab = null; + int searchTabIndexGlobal = -1; + List normalTabs = new ArrayList<>(); + List normalIndices = new ArrayList<>(); + + for (int i = 0; i < session.availableTabs.size(); i++) { + EditorSessionData.CreativeTabInfo tab = session.availableTabs.get(i); + if (tab == null) continue; + if (tab.isSearchTab) { + searchTab = tab; + searchTabIndexGlobal = i; + } else { + normalTabs.add(tab); + normalIndices.add(i); + } + } + + // Pagination calculations + int totalNormalTabs = normalTabs.size(); + int remainingTabs = Math.max(0, totalNormalTabs - 10); + int normalTabsPerPage = 15; + + int maxPages = 1; + if (remainingTabs > 0) { + maxPages = 1 + (int) Math.ceil((double) remainingTabs / normalTabsPerPage); + } + + if (session.currentTabPage >= maxPages) session.currentTabPage = maxPages - 1; + + // --- MAIN PANEL FIRST so the opaque tabs drawn next sit ON TOP and don't bleed through it --- + io.github.marcsanzdev.chestseparators.client.ui.UiTheme.panel(context, mainX, mainY, mainW, mainH); + + // --- 2. DRAW TABS ON TOP OF THE PANEL --- + for (int slot = 0; slot < 16; slot++) { + EditorSessionData.CreativeTabInfo info = null; + int actualGlobalIndex = -1; + + if (slot == 7 && searchTab != null) { + info = searchTab; + actualGlobalIndex = searchTabIndexGlobal; + } else { + int normalListIndex = normalListIndexForSlot(slot, session.currentTabPage, normalTabsPerPage); + + if (normalListIndex >= 0 && normalListIndex < normalTabs.size()) { + info = normalTabs.get(normalListIndex); + actualGlobalIndex = normalIndices.get(normalListIndex); + } + } + + if (info == null) continue; + + boolean isTop = slot < 8; + int col = slot % 8; + int tabW = layout.tabW; + int tabH = layout.tabW; + int tabX = layout.tabX(col); + int tabY = isTop ? mainY - tabH + 2 : mainY + mainH - 2; + + boolean isSelected = (session.currentCreativeTabIndex == actualGlobalIndex); + boolean hover = editor.isHovering(tabX, tabY, tabW, tabH, mouseX, mouseY); + + // The tab sits flush against the panel and is embedded into it along the touching edge: top + // tabs attach on their BOTTOM, bottom tabs on their TOP. That edge has no border/gap, and a + // selected tab shrinks anchored to it so it never separates from the panel. + int drawY = isTop ? tabY : tabY + 2; + int drawH = tabH - 2; + int attach = isTop + ? io.github.marcsanzdev.chestseparators.client.ui.UiTheme.ATTACH_BOTTOM + : io.github.marcsanzdev.chestseparators.client.ui.UiTheme.ATTACH_TOP; + io.github.marcsanzdev.chestseparators.client.ui.UiTheme.tab( + context, tabX, drawY, tabW, drawH, hover, isSelected, attach); + // A selected tab draws 1px smaller; shrink its item icon by the same proportion. + if (isSelected) { + io.github.marcsanzdev.chestseparators.client.ui.UiTheme.pushActiveContent( + context, tabX, drawY, tabW, drawH); + } + context.item(info.icon, tabX + 3, tabY + (isTop ? 2 : 4)); + if (isSelected) { + context.pose().popMatrix(); + } + + if (hover) context.setTooltipForNextFrame(Minecraft.getInstance().font, info.name, mouseX, mouseY); + } + + // --- 5. TITLE & CAROUSEL OR SEARCH BOX --- + EditorSessionData.CreativeTabInfo activeTabInfo = session.availableTabs.get(session.currentCreativeTabIndex); + String tabTitle = activeTabInfo != null + ? activeTabInfo.name.getString() + : Component.translatable("gui.chestseparators.edit_filter_rules").getString(); + + if (activeTabInfo != null && activeTabInfo.isSearchTab) { + int titleWidth = Minecraft.getInstance().font.width(tabTitle); + int maxTitleWidth = 60; + float scale = 1.0f; + + if (titleWidth > maxTitleWidth) { + scale = (float) maxTitleWidth / titleWidth; + } + + context.pose().pushMatrix(); + context.pose().translate((float) (mainX + 12), (float) (mainY + 10 + (4 * (1 - scale)))); + context.pose().scale(scale, scale); + context.text( + Minecraft.getInstance().font, + tabTitle, + 0, + 0, + (isDark ? 0xFF909090 : 0xFF555555), + false); + context.pose().popMatrix(); + + int boxX = mainX + 12 + (int) (titleWidth * scale) + 12; + int boxY = mainY + 6; + int boxW = (mainX + mainW - 12) - boxX; + + io.github.marcsanzdev.chestseparators.client.ui.UiTheme.inset(context, boxX, boxY, boxW, 16); + editor.searchBox.setX(boxX + 4); + editor.searchBox.setY(boxY + 4); + editor.searchBox.setWidth(boxW - 8); + editor.searchBox.extractRenderState( + context, + mouseX, + mouseY, + Minecraft.getInstance().getDeltaTracker().getGameTimeDeltaPartialTick(true)); + + if (editor.searchBox.getValue().isEmpty() && !editor.searchBox.isFocused()) { + context.text( + Minecraft.getInstance().font, + Component.translatable("gui.chestseparators.search"), + boxX + 6, + boxY + 4, + 0xFF666666, + false); + } + } else { + int visibleDots = Math.min(maxPages, 3); + int carouselWidth = (maxPages > 1) ? ((12 * 2) + (visibleDots * 8)) : 0; + int maxTextWidth = mainW - 24 - carouselWidth - 5; + + int textWidth = Minecraft.getInstance().font.width(tabTitle); + + if (textWidth > maxTextWidth) { + float scale = (float) maxTextWidth / textWidth; + context.pose().pushMatrix(); + + context.pose().translate((float) (mainX + 12), (float) (mainY + 10 + (4 * (1 - scale)))); + context.pose().scale(scale, scale); + + context.text( + Minecraft.getInstance().font, + tabTitle, + 0, + 0, + (isDark ? 0xFF909090 : 0xFF555555), + false); + context.pose().popMatrix(); + } else { + context.text( + Minecraft.getInstance().font, + tabTitle, + mainX + 12, + mainY + 10, + (isDark ? 0xFF909090 : 0xFF555555), + false); + } + + drawPaginationCarousel( + context, mainX + mainW - 12, mainY + 10, maxPages, session.currentTabPage, mouseX, mouseY); + } + + // --- 6. DRAW ITEM GRID --- + int gridX = layout.gridX; + int gridViewY = layout.gridViewY; + int gridViewH = layout.gridViewH; + int cols = layout.cols; + int itemSize = layout.gridCell; + + io.github.marcsanzdev.chestseparators.client.ui.UiTheme.inset( + context, gridX - 2, gridViewY - 2, (cols * itemSize) + 4, gridViewH + 4); + + int totalGridItems = session.filteredItems.size(); + int totalGridHeight = (int) Math.ceil((double) totalGridItems / cols) * itemSize; + float maxGridScroll = Math.max(0, totalGridHeight - gridViewH); + session.gridScrollY = Mth.clamp(session.gridScrollY, 0, maxGridScroll); + + int msbX = layout.msbX; + int msbY = layout.msbY; + int msbH = layout.msbH; + int gridThumbH = maxGridScroll > 0 + ? Math.max(10, (int) ((gridViewH / (float) Math.max(1, totalGridHeight)) * msbH)) + : msbH; + int gridThumbY = + maxGridScroll > 0 ? msbY + (int) ((session.gridScrollY / maxGridScroll) * (msbH - gridThumbH)) : msbY; + io.github.marcsanzdev.chestseparators.client.ui.UiTheme.scrollbar( + context, msbX, msbY, 6, msbH, gridThumbY, gridThumbH); + + context.enableScissor(gridX, gridViewY, gridX + (cols * itemSize), gridViewY + gridViewH); + int startGridRow = (int) (session.gridScrollY / itemSize); + int visibleGridRows = (gridViewH / itemSize) + 2; + + for (int r = 0; r < visibleGridRows; r++) { + int absoluteRow = startGridRow + r; + int drawY = gridViewY + (r * itemSize) - (int) (session.gridScrollY % itemSize); + + for (int c = 0; c < cols; c++) { + int itemIndex = (absoluteRow * cols) + c; + if (itemIndex >= totalGridItems) break; + + int drawX = gridX + (c * itemSize); + Item item = session.filteredItems.get(itemIndex); + String itemId = BuiltInRegistries.ITEM.getKey(item).toString(); + boolean isAllowed = session.currentAllowedItems.contains(itemId); + boolean isPreviewed = session.isPreviewing && session.previewItems.contains(itemId); + + // Cristal slot: a faint glass cell. Allowed items carry the blue accent — the same "on" + // language as every active button — while the preview washes stay neutral so they still + // read as a temporary state on top of it. + int cell = itemSize - 2; // slot visual: the cell minus a 1px breathing gap + io.github.marcsanzdev.chestseparators.client.ui.UiTheme.roundRect( + context, drawX + 1, drawY + 1, cell, cell, 0x18FFFFFF); + final int allowedWash = 0x662C6BAE; + if (session.isPreviewing) { + if (session.previewType == 1) { + if (isAllowed) + io.github.marcsanzdev.chestseparators.client.ui.UiTheme.roundRect( + context, drawX + 1, drawY + 1, cell, cell, allowedWash); + if (isPreviewed) + io.github.marcsanzdev.chestseparators.client.ui.UiTheme.roundRect( + context, drawX + 1, drawY + 1, cell, cell, 0x44FFFFFF); + } else if (session.previewType == 2) { + if (isAllowed) + io.github.marcsanzdev.chestseparators.client.ui.UiTheme.roundRect( + context, drawX + 1, drawY + 1, cell, cell, allowedWash); + else + io.github.marcsanzdev.chestseparators.client.ui.UiTheme.roundRect( + context, drawX + 1, drawY + 1, cell, cell, 0x44FFFFFF); + } else if (session.previewType == 3) { + if (isAllowed) + io.github.marcsanzdev.chestseparators.client.ui.UiTheme.roundRect( + context, drawX + 1, drawY + 1, cell, cell, 0x44000000); + } + } else if (isAllowed) { + io.github.marcsanzdev.chestseparators.client.ui.UiTheme.roundRect( + context, drawX + 1, drawY + 1, cell, cell, allowedWash); + } + + // The item keeps its native 16px size (scaling it down resamples the sprite and looks + // pixelated); the cell is what grew, so it now sits centred with a margin all round. + int itemInset = (itemSize - 16) / 2; + context.item(item.getDefaultInstance(), drawX + itemInset, drawY + itemInset); + + if (session.activeDropdownTags.isEmpty() + && editor.isHovering(drawX, drawY, itemSize, itemSize, mouseX, mouseY) + && mouseY >= gridViewY + && mouseY <= gridViewY + gridViewH) { + // Exactly the cell's own geometry, so the hover ring traces the slot instead of + // floating around it with a different shape. + io.github.marcsanzdev.chestseparators.client.ui.UiTheme.roundBorder( + context, drawX + 1, drawY + 1, cell, cell, 0xFFFFFFFF); + context.setTooltipForNextFrame(Minecraft.getInstance().font, item.getName(item.getDefaultInstance()), mouseX, mouseY); + } + } + } + context.disableScissor(); + } + + void drawTagDropdown(GuiGraphicsExtractor context, int mouseX, int mouseY) { + if (!session.activeDropdownTags.isEmpty()) { + boolean isDark = GlobalChestConfig.instance.darkMode; + int dropW = 120; + int dropH = session.activeDropdownTags.size() * 14 + 4; + int dX = session.dropdownX; + int dY = session.dropdownY; + if (dX + dropW > layout.screenWidth) dX = layout.screenWidth - dropW; + if (dY + dropH > layout.screenHeight) dY = layout.screenHeight - dropH; + session.dropdownX = dX; + session.dropdownY = dY; + + io.github.marcsanzdev.chestseparators.client.ui.UiTheme.panel(context, dX, dY, dropW, dropH); + + for (int i = 0; i < session.activeDropdownTags.size(); i++) { + String tag = session.activeDropdownTags.get(i); + int itemY = dY + 2 + (i * 14); + boolean isHoveringTag = mouseX >= dX && mouseX <= dX + dropW && mouseY >= itemY && mouseY < itemY + 14; + if (isHoveringTag) + context.fill(dX + 2, itemY, dX + dropW - 2, itemY + 14, isDark ? 0x40FFFFFF : 0x40000000); + + context.pose().pushMatrix(); + float scale = 0.85f; + if (Minecraft.getInstance().font.width("#" + tag) * scale > dropW - 12) + scale = (float) (dropW - 12) + / Minecraft.getInstance().font.width("#" + tag); + context.pose().translate((float) (dX + 6), (itemY + (14 - 8 * scale) / 2)); + context.pose().scale(scale, scale); + + int textColor = + isHoveringTag ? io.github.marcsanzdev.chestseparators.client.ui.UiTheme.ACCENT : 0xFFFFFFFF; + context.text(Minecraft.getInstance().font, "#" + tag, 0, 0, textColor, false); + context.pose().popMatrix(); + } + } + } + + void drawPaginationCarousel( + GuiGraphicsExtractor context, int rightBoundX, int y, int maxPages, int currentPage, int mouseX, int mouseY) { + if (maxPages <= 1) return; + + // Sliding window: show at most 3 page dots centered on the current page. + int visibleDots = Math.min(maxPages, 3); + int startPage = Math.max(0, Math.min(currentPage - 1, maxPages - visibleDots)); + + int dotSpacing = 8; + int arrowWidth = 12; + int totalWidth = (arrowWidth * 2) + (visibleDots * dotSpacing); + int startX = rightBoundX - totalWidth; + + int currentX = startX; + + boolean hoverLeft = editor.isHovering(currentX, y - 2, arrowWidth, 12, mouseX, mouseY); + context.text( + Minecraft.getInstance().font, + "<", + currentX + 2, + y, + hoverLeft ? 0xFF55FF55 : 0xFF888888, + false); + currentX += arrowWidth; + + for (int i = 0; i < visibleDots; i++) { + int pageIndex = startPage + i; + boolean isActive = (pageIndex == currentPage); + boolean hoverDot = editor.isHovering(currentX, y - 2, dotSpacing, 12, mouseX, mouseY); + + int color = isActive ? 0xFFFFFFFF : (hoverDot ? 0xFFAAAAAA : 0xFF555555); + + if (isActive) { + context.fill(currentX + 2, y + 2, currentX + 6, y + 6, color); + } else { + context.fill(currentX + 3, y + 3, currentX + 5, y + 5, color); + } + currentX += dotSpacing; + } + + boolean hoverRight = editor.isHovering(currentX, y - 2, arrowWidth, 12, mouseX, mouseY); + context.text( + Minecraft.getInstance().font, + ">", + currentX + 2, + y, + hoverRight ? 0xFF55FF55 : 0xFF888888, + false); + } +} diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/screens/GroupBlobRenderer.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/screens/GroupBlobRenderer.java new file mode 100644 index 0000000..1f025ee --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/screens/GroupBlobRenderer.java @@ -0,0 +1,885 @@ +package io.github.marcsanzdev.chestseparators.client.ui.screens; + +import io.github.marcsanzdev.chestseparators.client.EditorState; +import io.github.marcsanzdev.chestseparators.client.ModTextures; +import io.github.marcsanzdev.chestseparators.client.ui.ChestSeparatorsEditor; +import io.github.marcsanzdev.chestseparators.client.ui.EditorLayout; +import io.github.marcsanzdev.chestseparators.client.ui.EditorSessionData; +import io.github.marcsanzdev.chestseparators.data.ChestConfigManager; +import io.github.marcsanzdev.chestseparators.data.SlotWhitelist; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.UUID; +import net.minecraft.client.gui.GuiGraphicsExtractor; +import net.minecraft.world.inventory.Slot; + +/** + * Renders the whitelist group "blobs" over the chest grid for the group-view screen, assigning a + * stable color per group. Pure rendering, extracted verbatim from ScreenViewGroups. + */ +final class GroupBlobRenderer { + + static final int[] GROUP_PALETTE = { + 0x99E53935, 0x99F57C00, 0x99FBC02D, 0x997CB342, + 0x99388E3C, 0x9900897B, 0x9900ACC1, 0x991E88E5, + 0x993949AB, 0x998E24AA, 0x99D81B60, 0x99795548, + 0x99D50000, 0x99C51162, 0x99AA00FF, 0x996200EA, + 0x99304FFE, 0x992962FF, 0x9900B8D4, 0x9900BFA5, + 0x9900C853, 0x9964DD17, 0x99AEEA00, 0x99FFD600, + 0x99FFAB00, 0x99FF6D00, 0x99DD2C00, 0x995D4037, + 0x99827717, 0x99E65100, 0x99F4511E, 0x99C0CA33 + }; + + /** Body opacity of a saved filter: translucent enough to read the item sitting in the slot. */ + private static final int SAVED_FILL_ALPHA = 0x70; + + // Blob geometry inside a 16px slot on an 18px pitch. The cell is deliberately one pixel smaller on + // each side than the slot's artwork so the rounded corners breathe instead of colliding with the slot + // border, and so two blobs in neighbouring slots never touch. + private static final int CELL_INSET = 3; // left/top edge of the cell inside the slot + private static final int CELL_FAR = 13; // right/bottom edge of the cell (CELL_INSET + 10) + private static final int NEXT_CELL = 21; // where the next slot's cell starts (18 + CELL_INSET) + // Middle of the gap on each side; the boundary at which a cell stops painting and its neighbour takes + // over, so a slot's colour never reaches into the neighbouring slot. + private static final int MID_FAR = 17; // (CELL_FAR + NEXT_CELL) / 2 + private static final int MID_NEAR = -1; // MID_FAR - 18 + + private final ChestSeparatorsEditor editor; + private final EditorSessionData session; + private final EditorLayout layout; + private final Map stableGroupColors = new HashMap<>(); + + GroupBlobRenderer(ScreenViewGroups screen) { + this.editor = screen.editor; + this.session = screen.session; + this.layout = screen.layout; + } + + void renderWhitelistGroups(GuiGraphicsExtractor context, int mouseX, int mouseY) { + int guiX = layout.guiX; + int guiY = layout.guiY; + var whitelists = ChestConfigManager.getInstance().getCurrentWhitelists(); + + Set activeGreenSlots = new HashSet<>(session.selectedSlots); + Set activeRedSlots = new HashSet<>(); + + boolean isPreviewArea = session.currentState == EditorState.VIEW_GROUPS + && session.isDraggingLine + && session.wlToolMode == 0 + && session.dragStartSlot != null + && session.dragCurrentSlot != null; + + if (isPreviewArea) { + // Ask for exactly the slots the release will act on. Deriving the rectangle from slot indices + // (index / 9) assumed the container's slots are laid out in one continuous 9-wide grid, which + // the player inventory is not — hotbar, main rows and armor break that mapping, so the preview + // highlighted rows the drag never touched even though the release then did the right thing. + for (Slot slot : editor.slotsInDragBox(session.dragStartSlot, session.dragCurrentSlot)) { + int key = ChestSeparatorsEditor.slotKey(slot); + if (session.isSelecting) { + activeGreenSlots.add(key); + } else if (activeGreenSlots.remove(key)) { + // Red marks what the release will actually drop, so slots that were never selected + // are left alone instead of flashing as if they were about to change. + activeRedSlots.add(key); + } + } + } + + // Selected slots that ALREADY belong to a filter. Their saved group paints them green itself, so + // the selection takes them over: they leave their old group's shape and join the selection blob, + // so marking a slot next to another already-marked one merges both into a single green piece. + Set conflicting = new HashSet<>(); + if (whitelists != null) { + for (int slotIdx : activeGreenSlots) { + if (whitelists.containsKey(slotIdx)) conflicting.add(slotIdx); + } + } + + for (Slot slot : editor.accessor.getHandler().slots) { + if (!ChestSeparatorsEditor.isEditableSlot(slot)) continue; + int idx = ChestSeparatorsEditor.slotKey(slot); + + boolean hasWhitelist = whitelists != null && whitelists.containsKey(idx); + boolean isActive = activeGreenSlots.contains(idx) || activeRedSlots.contains(idx); + + // Gray indicator for slots that have no filter assigned yet: same rounding language as a + // filter blob, but one pixel larger on every side. A filter cell is kept slightly inset so + // its rounding clears the slot border, while this one stands alone and reads too small at + // that size. + if (!hasWhitelist && !isActive) { + int x = guiX + slot.x; + int y = guiY + slot.y; + int inset = CELL_INSET - 1; + int size = (CELL_FAR - CELL_INSET) + 2; + fillRounded( + (x0, y0, x1, y1) -> context.fill(x0, y0, x1, y1, 0x44888888), + x + inset, + y + inset, + size, + size, + true, + true, + true, + true); + } + } + + if (whitelists != null) { + Map> groups = new HashMap<>(); + for (Map.Entry entry : whitelists.entrySet()) { + // A slot handed over to the selection leaves its old group's silhouette, so the group + // reshapes around the gap and the slot can fuse with the rest of the selection instead. + if (activeGreenSlots.contains(entry.getKey())) continue; + groups.computeIfAbsent(entry.getValue().groupId(), k -> new HashSet<>()) + .add(entry.getKey()); + } + groups.values().removeIf(Set::isEmpty); + + List orderedGroupIds = new ArrayList<>(groups.keySet()); + orderedGroupIds.sort(UUID::compareTo); + + Set usedColors = new HashSet<>(); + Map assignedColors = new HashMap<>(); + + // 1. Assign explicit user-painted colors first + for (UUID groupId : orderedGroupIds) { + int explicit = getExplicitGroupColor(groups.get(groupId)); + if (explicit != 0) { + assignedColors.put(groupId, explicit); + usedColors.add(explicit); + } + } + + // 2. Rescue stable colors from cache to prevent flickering/shifting + for (UUID groupId : orderedGroupIds) { + if (!assignedColors.containsKey(groupId) && stableGroupColors.containsKey(groupId)) { + int stableColor = stableGroupColors.get(groupId); + if (!usedColors.contains(stableColor)) { + assignedColors.put(groupId, stableColor); + usedColors.add(stableColor); + } + } + } + + // 3. Assign new sequential colors to brand new groups + int paletteIdx = 0; + for (UUID groupId : orderedGroupIds) { + if (!assignedColors.containsKey(groupId)) { + while (paletteIdx < GROUP_PALETTE.length && usedColors.contains(GROUP_PALETTE[paletteIdx])) { + paletteIdx++; + } + + int color; + if (paletteIdx < GROUP_PALETTE.length) { + color = GROUP_PALETTE[paletteIdx]; + usedColors.add(color); + paletteIdx++; + } else { + color = GROUP_PALETTE[Math.abs(groupId.hashCode()) % GROUP_PALETTE.length]; + } + + assignedColors.put(groupId, color); + stableGroupColors.put(groupId, color); // Cache it for future frames + } + } + + // Which group the cursor is over, so it can be highlighted while the rest fade back. Makes the + // extent of a single filter obvious when several groups sit next to each other. + UUID hoveredGroup = null; + for (Slot slot : editor.accessor.getHandler().slots) { + if (!ChestSeparatorsEditor.isEditableSlot(slot)) continue; + if (editor.isHovering(guiX + slot.x - 1, guiY + slot.y - 1, 18, 18, mouseX, mouseY)) { + SlotWhitelist wl = whitelists.get(ChestSeparatorsEditor.slotKey(slot)); + if (wl != null) hoveredGroup = wl.groupId(); + break; + } + } + + // Two passes on purpose: every outline underlay first, then every fill. Drawing each group + // completely in turn would let a later group's 1px outline sit on top of an earlier group's + // fill, nibbling its edge. + for (Map.Entry> groupEntry : groups.entrySet()) { + boolean isHovered = groupEntry.getKey().equals(hoveredGroup); + boolean dimmed = hoveredGroup != null && !isHovered; + int base = withAlpha(assignedColors.get(groupEntry.getKey()), SAVED_FILL_ALPHA); + int fill = dimmed ? fade(base, 0.35f) : base; + drawBlobFill(context, groupEntry.getValue(), fill, 0, null, guiX, guiY); + } + for (Map.Entry> groupEntry : groups.entrySet()) { + boolean isHovered = groupEntry.getKey().equals(hoveredGroup); + boolean dimmed = hoveredGroup != null && !isHovered; + int base = withAlpha(assignedColors.get(groupEntry.getKey()), SAVED_FILL_ALPHA); + drawBlobRim(context, groupEntry.getValue(), outlineFor(base, dimmed, isHovered), 0, null, guiX, guiY); + } + } + + // The slots being swept for a NEW filter are washed even lighter than the saved ones, so it stays + // obvious which is a committed filter and which is the selection in progress. Slots taken from an + // existing filter are included here, so they merge with any adjacent marked slot into one piece. + if (!activeGreenSlots.isEmpty()) { + final int selectionFill = 0x4433FF33; + drawBlobFill(context, activeGreenSlots, selectionFill, 0, null, guiX, guiY); + + // Slots taken from an existing filter get their outline blinking towards white, in step with + // the warning badge, so the conflict is legible even where the badge is not. + List warnSquares = new ArrayList<>(); + for (int slotIdx : conflicting) { + Slot s = editor.slotForKey(slotIdx); + if (s == null) continue; + warnSquares.add(new int[] {guiX + s.x - 1, guiY + s.y - 1, guiX + s.x + 17, guiY + s.y + 17}); + } + float warnBlink = 0.5f + 0.5f * (float) Math.sin(System.currentTimeMillis() / 200.0); + int selectionRim = outlineFor(selectionFill, false, false); + drawBlobRim( + context, + activeGreenSlots, + selectionRim, + lerpColor(selectionRim, 0xFFFFFFFF, warnBlink), + warnSquares, + guiX, + guiY); + } + if (!activeRedSlots.isEmpty()) drawBlobGroup(context, activeRedSlots, 0x44FF3333, guiX, guiY); + + // Mutual exclusion: once a side has a slot selected (or a drag is in progress), darken the + // other side's slots to show a single filter can't span the chest and the inventory. + Integer activeKey = null; + if (session.isDraggingLine && session.dragStartSlot != null) { + activeKey = ChestSeparatorsEditor.slotKey(session.dragStartSlot); + } else if (!session.selectedSlots.isEmpty()) { + activeKey = session.selectedSlots.iterator().next(); + } + if (activeKey != null) { + boolean activePlayer = ChestConfigManager.isInventoryKey(activeKey); + for (Slot slot : editor.accessor.getHandler().slots) { + if (!ChestSeparatorsEditor.isEditableSlot(slot)) continue; + if (ChestSeparatorsEditor.isPlayerSlot(slot) != activePlayer) { + context.fill( + guiX + slot.x - 1, guiY + slot.y - 1, guiX + slot.x + 17, guiY + slot.y + 17, 0xB0101010); + } + } + } + + // Conflict warning: these slots are being swept into a NEW filter but already belong to one. They + // already read as such (their piece of the old group is tinted with the selection colour), so all + // that is left is a blinking glyph — one per contiguous run rather than one per slot, centred over + // the run, so a big overlapping selection is not buried under a grid of icons. + if (!conflicting.isEmpty()) { + { + float blink = 0.35f + 0.65f * (0.5f + 0.5f * (float) Math.sin(System.currentTimeMillis() / 200.0)); + int iconAlpha = (int) (0xFF * blink) & 0xFF; + int icon = 8; // small enough to clear the selection outline on a lone 1×1 slot + + for (Set run : contiguousRuns(conflicting)) { + int count = 0; + float cx = 0f; + float cy = 0f; + for (int slotIdx : run) { + Slot slot = editor.slotForKey(slotIdx); + if (slot == null) continue; + cx += guiX + slot.x + 8f; + cy += guiY + slot.y + 8f; + count++; + } + if (count == 0) continue; + cx /= count; + cy /= count; + + // Keep the badge at the run's centroid whenever the icon there sits fully on selected + // (green) cells: that centres it truly, including on the seam BETWEEN the rows of a + // filled block — e.g. a 2×3 selection, where the middle of both rows is green so the + // glyph sits between them instead of floating on the top row. Only when the centroid + // lands in a gap — an L corner, the hollow of a U — snap it onto the selected slot + // nearest the centroid, so the glyph is always as central as possible yet never left + // half outside the green. + float half = icon / 2f; + boolean iconOnGreen = pointOnRun(run, guiX, guiY, cx - half, cy - half) + && pointOnRun(run, guiX, guiY, cx + half, cy - half) + && pointOnRun(run, guiX, guiY, cx - half, cy + half) + && pointOnRun(run, guiX, guiY, cx + half, cy + half); + if (!iconOnGreen) { + Slot nearest = null; + float bestDistance = Float.MAX_VALUE; + for (int slotIdx : run) { + Slot slot = editor.slotForKey(slotIdx); + if (slot == null) continue; + float dx = (guiX + slot.x + 8f) - cx; + float dy = (guiY + slot.y + 8f) - cy; + float distance = dx * dx + dy * dy; + if (distance < bestDistance) { + bestDistance = distance; + nearest = slot; + } + } + if (nearest != null) { + cx = guiX + nearest.x + 8f; + cy = guiY + nearest.y + 8f; + } + } + + int ix = Math.round(cx) - icon / 2; + int iy = Math.round(cy) - icon / 2; + context.blit( + net.minecraft.client.renderer.RenderPipelines.GUI_TEXTURED, + ModTextures.ICON_SM_CONFLICT, + ix, + iy, + 0.0F, + 0.0F, + icon, + icon, + 128, + 128, + 128, + 128, + (iconAlpha << 24) | 0xFFFFFF); + } + } + } + } + + /** True when the point lies within the 16×16 cell of any slot in the run (i.e. over green). */ + private boolean pointOnRun(Set run, int guiX, int guiY, float px, float py) { + for (int slotIdx : run) { + Slot slot = editor.slotForKey(slotIdx); + if (slot == null) continue; + float x0 = guiX + slot.x; + float y0 = guiY + slot.y; + if (px >= x0 && px <= x0 + 16f && py >= y0 && py <= y0 + 16f) return true; + } + return false; + } + + /** + * Splits slots into runs connected on screen, so each run can carry a single shared badge. Adjacency + * is positional for the same reason the blob's is: index neighbours are not necessarily neighbours in + * the inventory, and cells set apart (armor, offhand) must stay their own run. + */ + private List> contiguousRuns(Set slots) { + Map byPosition = new HashMap<>(); + for (int slotIdx : slots) { + Slot slot = editor.slotForKey(slotIdx); + if (slot != null) byPosition.put(posKey(slot.x, slot.y), slotIdx); + } + + List> runs = new ArrayList<>(); + Set remaining = new HashSet<>(slots); + while (!remaining.isEmpty()) { + int seed = remaining.iterator().next(); + remaining.remove(seed); + + Set run = new HashSet<>(); + java.util.ArrayDeque queue = new java.util.ArrayDeque<>(); + queue.add(seed); + while (!queue.isEmpty()) { + int current = queue.poll(); + run.add(current); + Slot slot = editor.slotForKey(current); + if (slot == null) continue; + + int[][] offsets = {{18, 0}, {-18, 0}, {0, 18}, {0, -18}}; + for (int[] offset : offsets) { + Integer neighbour = byPosition.get(posKey(slot.x + offset[0], slot.y + offset[1])); + if (neighbour != null && remaining.remove(neighbour)) queue.add(neighbour); + } + } + runs.add(run); + } + return runs; + } + + /** Same colour at a fraction of its opacity, used to push non-hovered groups into the background. */ + private static int fade(int argb, float factor) { + int alpha = (int) (((argb >>> 24) & 0xFF) * factor); + return (alpha << 24) | (argb & 0x00FFFFFF); + } + + /** Paints one rectangle of the blob. Which colour each pixel ends up with is the painter's business. */ + private interface Painter { + void rect(int x0, int y0, int x1, int y1); + } + + /** + * Paints a rectangle in {@code base}, except for the parts falling inside one of {@code tintSquares}, + * which are painted in {@code tint}. + * + *

Recolouring is done per REGION, not per slot: the blob's geometry is always identical, and a + * marked slot simply repaints whatever the group already drew inside its square. Deciding the colour + * per slot instead left seams — a slot's own square kept pixels from its neighbours (which paint into + * the gaps between slots) and its own rounding spilled outside. + * + *

The rectangle is cut along the edges of the squares that overlap it and each piece is painted + * once, so nothing is ever drawn twice — important because these colours are translucent and would + * otherwise blend into visible seams. + * + *

A fully transparent colour means "paint nothing here", which is how the outline is suppressed + * inside a marked slot: that slot shows the plain green body, with the group's own outline continuing + * around it, instead of gaining a second outline of its own hugging the green. + */ + private static void fillRegion( + GuiGraphicsExtractor c, int x0, int y0, int x1, int y1, int base, int tint, List tintSquares) { + if (x1 <= x0 || y1 <= y0) return; + if (tintSquares == null || tintSquares.isEmpty()) { + c.fill(x0, y0, x1, y1, base); + return; + } + + java.util.TreeSet xs = new java.util.TreeSet<>(List.of(x0, x1)); + java.util.TreeSet ys = new java.util.TreeSet<>(List.of(y0, y1)); + boolean anyOverlap = false; + for (int[] s : tintSquares) { + if (s[2] <= x0 || s[0] >= x1 || s[3] <= y0 || s[1] >= y1) continue; + anyOverlap = true; + if (s[0] > x0 && s[0] < x1) xs.add(s[0]); + if (s[2] > x0 && s[2] < x1) xs.add(s[2]); + if (s[1] > y0 && s[1] < y1) ys.add(s[1]); + if (s[3] > y0 && s[3] < y1) ys.add(s[3]); + } + if (!anyOverlap) { + c.fill(x0, y0, x1, y1, base); + return; + } + + List xl = new ArrayList<>(xs); + List yl = new ArrayList<>(ys); + for (int i = 0; i + 1 < xl.size(); i++) { + for (int j = 0; j + 1 < yl.size(); j++) { + int ax = xl.get(i); + int bx = xl.get(i + 1); + int ay = yl.get(j); + int by = yl.get(j + 1); + boolean inside = false; + for (int[] s : tintSquares) { + if (ax >= s[0] && bx <= s[2] && ay >= s[1] && by <= s[3]) { + inside = true; + break; + } + } + int piece = inside ? tint : base; + if ((piece >>> 24) != 0) c.fill(ax, ay, bx, by, piece); + } + } + } + + /** + * Fills a rectangle whose corners can be individually rounded. The rounding is a two-step stair + * (2px inset on the outermost row, 1px on the next) instead of a single clipped pixel, which reads + * as a noticeably softer corner at Minecraft's GUI scale. + */ + private static void fillRounded( + Painter p, int x, int y, int w, int h, boolean tl, boolean tr, boolean bl, boolean br) { + // Body: full width, minus the two rows at the top and bottom that carry the rounding. + p.rect(x, y + 2, x + w, y + h - 2); + for (int d = 0; d < 2; d++) { + int inset = 2 - d; // outermost row insets 2px, the next one 1px + p.rect(x + (tl ? inset : 0), y + d, x + w - (tr ? inset : 0), y + d + 1); + p.rect(x + (bl ? inset : 0), y + h - 1 - d, x + w - (br ? inset : 0), y + h - d); + } + } + + /** The 1px rim that traces {@link #innerFillet}'s stair on its outer side. */ + private static void innerFilletRim(Painter p, int px, int py, int sx, int sy) { + for (int d = 0; d < 2; d++) { + int len = 2 - d; + int rx0 = sx > 0 ? px + len - 1 : px - len; + int ry = sy > 0 ? py + d + 1 : py - d - 2; + p.rect(rx0, ry, rx0 + 1, ry + 1); + } + } + + /** + * Paints one group as a single blob: a 12×12 rounded cell per slot plus 6px connectors bridging + * same-group neighbours. {@code expand} grows every piece outwards by that many pixels — drawing the + * blob once expanded in the outline colour and then again at normal size in the fill colour produces a + * continuous border around the WHOLE shape, connectors included. Tracing the border edge by edge + * instead left gaps over the connectors, since those bridges have their own outer edges. + * + *

Only genuinely convex corners are rounded, so the joints where a connector meets a cell stay + * square and the blob remains one solid piece. + */ + /** Replaces the alpha of a colour, keeping its RGB. */ + private static int withAlpha(int argb, int alpha) { + return (alpha << 24) | (argb & 0x00FFFFFF); + } + + /** Neighbour flags for one cell of a group, so fill and rim always agree on the shape. */ + private static final class Edges { + boolean right, left, down, up; + // Raw diagonals (independent of the orthogonal neighbours). + boolean rawDR, rawDL, rawUR, rawUL; + /** The bottom-right gap is filled solid. */ + boolean dr; + // Concave corners this cell is responsible for drawing. A gap between four slots has one concave + // corner per "missing" slot, and each is assigned to exactly one neighbour so it is drawn once. + boolean cTL, cTR, cBL, cBRofTopLeftGap; + } + + /** Screen position of a slot, packed so neighbours can be looked up directly. */ + private static long posKey(int x, int y) { + return ((long) x << 20) ^ (y & 0xFFFFF); + } + + /** Positions occupied by a group, for adjacency tests. */ + private Set occupiedPositions(Set groupSlots) { + return occupiedPositions(groupSlots, editor::slotForKey); + } + + /** As above but resolving keys with an external mapper, so the same blob draw serves callers (like the + * preset preview) that don't have the live editor's key→slot map. */ + private static Set occupiedPositions( + Set groupSlots, java.util.function.IntFunction keyToSlot) { + Set occupied = new HashSet<>(); + for (int slotIdx : groupSlots) { + Slot slot = keyToSlot.apply(slotIdx); + if (slot != null && ChestSeparatorsEditor.isEditableSlot(slot)) { + occupied.add(posKey(slot.x, slot.y)); + } + } + return occupied; + } + + /** + * Neighbour flags derived from where the slots actually SIT (18px pitch), not from their indices. + * + *

Index arithmetic (±1, ±9) only describes adjacency on a single continuous 9-wide grid. The player + * inventory is not one: the hotbar's indices come first but it is drawn last, under the main rows, and + * armor and offhand sit apart beside the player model. That mismatch left hotbar slots refusing to + * merge with each other while inviting connectors between rows that are nowhere near one another. + * Comparing positions also survives the creative screen, whose slot indices differ from survival's. + */ + private static Edges edgesAt(Set occupied, Slot slot) { + int x = slot.x; + int y = slot.y; + + Edges e = new Edges(); + e.right = occupied.contains(posKey(x + 18, y)); + e.left = occupied.contains(posKey(x - 18, y)); + e.down = occupied.contains(posKey(x, y + 18)); + e.up = occupied.contains(posKey(x, y - 18)); + + e.rawDR = occupied.contains(posKey(x + 18, y + 18)); + e.rawDL = occupied.contains(posKey(x - 18, y + 18)); + e.rawUR = occupied.contains(posKey(x + 18, y - 18)); + e.rawUL = occupied.contains(posKey(x - 18, y - 18)); + + e.dr = e.right && e.down && e.rawDR; + + // Bottom-right gap: whichever of its four corners is concave. + e.cTL = e.right && e.down && !e.rawDR; + e.cTR = e.right && e.rawDR && !e.down; + e.cBL = e.down && e.rawDR && !e.right; + // Top-left gap: its bottom-right corner is the one this cell owns (the other three belong to the + // cells above/left, which reach them through their own bottom-right gap). + e.cBRofTopLeftGap = e.up && e.left && !e.rawUL; + return e; + } + + /** + * The blob's body: a rounded cell per slot plus the connectors that fuse neighbours. + * + *

{@code tintedSlots} keeps the group's silhouette intact while recolouring individual slots — used + * for slots that are about to be taken over by a new filter, so the shape they form with their current + * group is preserved and only that piece changes colour. + */ + private void drawBlobFill( + GuiGraphicsExtractor context, + Set groupSlots, + int color, + int tintColor, + List tintSquares, + int guiX, + int guiY) { + Painter p = (x0, y0, x1, y1) -> fillRegion(context, x0, y0, x1, y1, color, tintColor, tintSquares); + blobFillPass(p, groupSlots, guiX, guiY, editor::slotForKey, occupiedPositions(groupSlots)); + } + + /** The blob body loop, shared verbatim by the live editor and any static caller (the preset preview). */ + private static void blobFillPass( + Painter p, + Set groupSlots, + int guiX, + int guiY, + java.util.function.IntFunction keyToSlot, + Set occupied) { + final int a = CELL_INSET; + final int b = CELL_FAR; + final int n = NEXT_CELL; + final int far = MID_FAR; + final int near = MID_NEAR; + + for (int slotIdx : groupSlots) { + Slot slot = keyToSlot.apply(slotIdx); + if (slot == null || !ChestSeparatorsEditor.isEditableSlot(slot)) continue; + + int x = guiX + slot.x; + int y = guiY + slot.y; + Edges e = edgesAt(occupied, slot); + + fillRounded( + p, + x + a, + y + a, + b - a, + b - a, + !e.up && !e.left, + !e.up && !e.right, + !e.down && !e.left, + !e.down && !e.right); + + // Connectors are painted in halves, each cell covering up to the middle of the gap it shares + // with a neighbour, so no rectangle is ever painted twice. + if (e.right) p.rect(x + b, y + a, x + far, y + b); + if (e.left) p.rect(x + near, y + a, x + a, y + b); + if (e.down) p.rect(x + a, y + b, x + b, y + far); + if (e.up) p.rect(x + a, y + near, x + b, y + a); + + // Likewise each filled diagonal gap is covered a quarter at a time. + if (e.dr) p.rect(x + b, y + b, x + far, y + far); + if (e.left && e.down && e.rawDL) p.rect(x + near, y + b, x + a, y + far); + if (e.right && e.up && e.rawUR) p.rect(x + b, y + near, x + far, y + a); + if (e.left && e.up && e.rawUL) p.rect(x + near, y + near, x + a, y + a); + + // Concave corners: fill the sharp inner angle so an L-shaped group is rounded inside too. + if (e.cTL) innerFillet(p, x + b, y + b, 1, 1); + if (e.cTR) innerFillet(p, x + n, y + b, -1, 1); + if (e.cBL) innerFillet(p, x + b, y + n, 1, -1); + if (e.cBRofTopLeftGap) innerFillet(p, x + a, y + a, -1, -1); + } + } + + /** + * A concave corner's rounding: the mirror of {@link #fillRounded}'s stair, adding material into the + * notch. Grows from {@code (px, py)} towards {@code (sx, sy)}. + */ + private static void innerFillet(Painter p, int px, int py, int sx, int sy) { + for (int d = 0; d < 2; d++) { + int len = 2 - d; // 2px against the corner, then 1px + int x0 = sx > 0 ? px : px - len; + int x1 = sx > 0 ? px + len : px; + int y0 = sy > 0 ? py + d : py - d - 1; + p.rect(x0, y0, x1, y0 + 1); + } + } + + /** + * The 1px rim hugging the blob. Drawn as an outline ONLY — painting an enlarged solid copy underneath + * would have tinted the whole interior opaque, hiding the items in the slots. + * + *

Every straight edge is shortened by the 2px rounding of the corners it runs into, and each rounded + * corner is then traced by its own two-pixel stair, so the rim follows the body exactly. Connectors + * contribute their own outer edges, which is what keeps the outline unbroken across them. + */ + private void drawBlobRim( + GuiGraphicsExtractor context, + Set groupSlots, + int rimColor, + int tintRim, + List tintSquares, + int guiX, + int guiY) { + Painter p = (x0, y0, x1, y1) -> fillRegion(context, x0, y0, x1, y1, rimColor, tintRim, tintSquares); + blobRimPass(p, groupSlots, guiX, guiY, editor::slotForKey, occupiedPositions(groupSlots)); + } + + /** The blob outline loop, shared verbatim by the live editor and any static caller (the preset preview). */ + private static void blobRimPass( + Painter p, + Set groupSlots, + int guiX, + int guiY, + java.util.function.IntFunction keyToSlot, + Set occupied) { + final int a = CELL_INSET; + final int b = CELL_FAR; + final int n = NEXT_CELL; + + for (int slotIdx : groupSlots) { + Slot slot = keyToSlot.apply(slotIdx); + if (slot == null || !ChestSeparatorsEditor.isEditableSlot(slot)) continue; + + int x = guiX + slot.x; + int y = guiY + slot.y; + Edges e = edgesAt(occupied, slot); + + boolean tl = !e.up && !e.left; + boolean tr = !e.up && !e.right; + boolean bl = !e.down && !e.left; + boolean br = !e.down && !e.right; + + // Straight sides, clipped where a rounded corner takes over. + if (!e.up) p.rect(x + a + (tl ? 2 : 0), y + a - 1, x + b - (tr ? 2 : 0), y + a); + if (!e.down) p.rect(x + a + (bl ? 2 : 0), y + b, x + b - (br ? 2 : 0), y + b + 1); + if (!e.left) p.rect(x + a - 1, y + a + (tl ? 2 : 0), x + a, y + b - (bl ? 2 : 0)); + if (!e.right) p.rect(x + b, y + a + (tr ? 2 : 0), x + b + 1, y + b - (br ? 2 : 0)); + + // Two-pixel stair on each rounded corner. + if (tl) { + p.rect(x + a + 1, y + a, x + a + 2, y + a + 1); + p.rect(x + a, y + a + 1, x + a + 1, y + a + 2); + } + if (tr) { + p.rect(x + b - 2, y + a, x + b - 1, y + a + 1); + p.rect(x + b - 1, y + a + 1, x + b, y + a + 2); + } + if (bl) { + p.rect(x + a + 1, y + b - 1, x + a + 2, y + b); + p.rect(x + a, y + b - 2, x + a + 1, y + b - 1); + } + if (br) { + p.rect(x + b - 2, y + b - 1, x + b - 1, y + b); + p.rect(x + b - 1, y + b - 2, x + b, y + b - 1); + } + + // Outer edges of the connectors. Without these the rim would break every time two slots join. + // Each end is pulled back by 2px at a concave corner so the stair below takes over instead of + // the rim slicing straight across the rounding. + if (e.right && !(e.up && e.rawUR)) { // top edge of the horizontal connector + int x0 = (e.up && !e.rawUR) ? x + b + 2 : x + b; + int x1 = (e.rawUR && !e.up) ? x + n - 2 : x + n; + if (x1 > x0) p.rect(x0, y + a - 1, x1, y + a); + } + if (e.right && !e.dr) { // bottom edge of the horizontal connector + int x0 = e.cTL ? x + b + 2 : x + b; + int x1 = e.cTR ? x + n - 2 : x + n; + if (x1 > x0) p.rect(x0, y + b, x1, y + b + 1); + } + if (e.down && !(e.left && e.rawDL)) { // left edge of the vertical connector + int y0 = (e.left && !e.rawDL) ? y + b + 3 : (e.left ? y + b + 1 : y + b); + int y1 = (e.rawDL && !e.left) ? y + n - 2 : y + n; + if (y1 > y0) p.rect(x + a - 1, y0, x + a, y1); + } + if (e.down && !e.dr) { // right edge of the vertical connector + // Starts below the horizontal connector's rim when both exist, so the shared pixel is not + // painted twice (a translucent rim would darken there). + int y0 = e.cTL ? y + b + 3 : (e.right ? y + b + 1 : y + b); + int y1 = e.cBL ? y + n - 2 : y + n; + if (y1 > y0) p.rect(x + b, y0, x + b + 1, y1); + } + + // Stairs tracing the concave corners, so the inner angles are outlined like the outer ones. + if (e.cTL) innerFilletRim(p, x + b, y + b, 1, 1); + if (e.cTR) innerFilletRim(p, x + n, y + b, -1, 1); + if (e.cBL) innerFilletRim(p, x + b, y + n, 1, -1); + if (e.cBRofTopLeftGap) innerFilletRim(p, x + a, y + a, -1, -1); + } + } + + /** Blends two colours channel by channel; {@code t} of 0 gives {@code from}, 1 gives {@code to}. */ + private static int lerpColor(int from, int to, float t) { + int a = channelMix(from >>> 24, to >>> 24, t); + int r = channelMix((from >> 16) & 0xFF, (to >> 16) & 0xFF, t); + int g = channelMix((from >> 8) & 0xFF, (to >> 8) & 0xFF, t); + int b = channelMix(from & 0xFF, to & 0xFF, t); + return (a << 24) | (r << 16) | (g << 8) | b; + } + + private static int channelMix(int from, int to, float t) { + return Math.max(0, Math.min(255, Math.round(from + (to - from) * t))); + } + + /** Same colour with its RGB scaled, keeping the alpha — used for the darker rim tone. */ + private static int shade(int argb, float factor) { + int a = (argb >>> 24) & 0xFF; + int r = (int) (((argb >> 16) & 0xFF) * factor); + int g = (int) (((argb >> 8) & 0xFF) * factor); + int b = (int) ((argb & 0xFF) * factor); + return (a << 24) | (r << 16) | (g << 8) | b; + } + + /** + * Rim colour for a group. It is a deliberately darker shade of the group's own colour rather than the + * same tone at more opacity, so that outermost pixel reads as a defined edge instead of just a denser + * bit of the fill. The hovered group swaps it for white. + */ + private static int outlineFor(int fill, boolean dimmed, boolean highlighted) { + if (highlighted) return 0xFFFFFFFF; + int darker = shade(fill, 0.5f); + return (darker & 0x00FFFFFF) | (dimmed ? 0x66000000 : 0xFF000000); + } + + /** Convenience for the standalone selection blobs: body then rim, in one call. */ + private void drawBlobGroup(GuiGraphicsExtractor context, Set groupSlots, int colorARGB, int guiX, int guiY) { + drawBlobFill(context, groupSlots, colorARGB, 0, null, guiX, guiY); + drawBlobRim(context, groupSlots, outlineFor(colorARGB, false, false), 0, null, guiX, guiY); + } + + /** + * Draws one group's blob (body + rim) through the exact same passes the live editor uses, but resolving + * slot keys with an external mapper. This is the single entry point other screens (the preset Load + * preview) must use so a filter group looks pixel-identical everywhere in the mod. + */ + static void drawBlobGroupStatic( + GuiGraphicsExtractor context, + Set groupSlots, + int colorARGB, + int guiX, + int guiY, + java.util.function.IntFunction keyToSlot) { + Set occupied = occupiedPositions(groupSlots, keyToSlot); + blobFillPass( + (x0, y0, x1, y1) -> context.fill(x0, y0, x1, y1, colorARGB), + groupSlots, + guiX, + guiY, + keyToSlot, + occupied); + int rimColor = outlineFor(colorARGB, false, false); + blobRimPass( + (x0, y0, x1, y1) -> context.fill(x0, y0, x1, y1, rimColor), + groupSlots, + guiX, + guiY, + keyToSlot, + occupied); + } + + private int getExplicitGroupColor(Set groupSlots) { + ChestConfigManager manager = ChestConfigManager.getInstance(); + Set commonColors = null; + + for (int slotIdx : groupSlots) { + Set slotColors = new HashSet<>(); + + int bg = manager.getColor(slotIdx, ChestConfigManager.ACTION_BG) & 0x00FFFFFF; + if (bg != 0) slotColors.add(bg); + int top = manager.getColor(slotIdx, ChestConfigManager.ACTION_TOP) & 0x00FFFFFF; + if (top != 0) slotColors.add(top); + int bottom = manager.getColor(slotIdx, ChestConfigManager.ACTION_BOTTOM) & 0x00FFFFFF; + if (bottom != 0) slotColors.add(bottom); + int left = manager.getColor(slotIdx, ChestConfigManager.ACTION_LEFT) & 0x00FFFFFF; + if (left != 0) slotColors.add(left); + int right = manager.getColor(slotIdx, ChestConfigManager.ACTION_RIGHT) & 0x00FFFFFF; + if (right != 0) slotColors.add(right); + + // If a single slot has no colors, the group cannot have a unanimous color + if (slotColors.isEmpty()) { + return 0; + } + + if (commonColors == null) { + // Initialize with the colors of the first slot + commonColors = slotColors; + } else { + // Intersection: keep only colors present in all evaluated slots + commonColors.retainAll(slotColors); + } + + // If at any point the intersection is empty, abort + if (commonColors.isEmpty()) { + return 0; + } + } + + // If we reach here, commonColors contains at least one unanimous color + if (commonColors != null && !commonColors.isEmpty()) { + return commonColors.iterator().next() | 0x99000000; + } + + return 0; + } +} diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/screens/IEditorSubScreen.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/screens/IEditorSubScreen.java new file mode 100644 index 0000000..f157ce2 --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/screens/IEditorSubScreen.java @@ -0,0 +1,22 @@ +package io.github.marcsanzdev.chestseparators.client.ui.screens; + +import net.minecraft.client.gui.GuiGraphicsExtractor; + +public interface IEditorSubScreen { + /** Called when the screen opens or the window is resized. */ + void init(); + + /** Called each frame to draw the screen contents. */ + void render(GuiGraphicsExtractor context, int mouseX, int mouseY, float delta); + + // Mouse and keyboard event delegates. + boolean mouseClicked(double mouseX, double mouseY, int button); + + boolean mouseDragged(double mouseX, double mouseY, int button, double dragX, double dragY); + + boolean mouseScrolled(double mouseX, double mouseY, double horizontalAmount, double verticalAmount); + + boolean keyPressed(int keyCode, int scanCode, int modifiers); + + boolean charTyped(char chr, int modifiers); +} diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/screens/PresetsMenu.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/screens/PresetsMenu.java new file mode 100644 index 0000000..6248e2b --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/screens/PresetsMenu.java @@ -0,0 +1,1052 @@ +package io.github.marcsanzdev.chestseparators.client.ui.screens; + +import com.mojang.blaze3d.platform.InputConstants; +import io.github.marcsanzdev.chestseparators.client.ModTextures; +import io.github.marcsanzdev.chestseparators.client.ui.ChestSeparatorsEditor; +import io.github.marcsanzdev.chestseparators.client.ui.UiTheme; +import io.github.marcsanzdev.chestseparators.client.ui.widgets.PressAnim; +import io.github.marcsanzdev.chestseparators.client.ui.widgets.ToolButtonWidget; +import io.github.marcsanzdev.chestseparators.client.ui.widgets.WideButtonWidget; +import io.github.marcsanzdev.chestseparators.config.GlobalChestConfig; +import io.github.marcsanzdev.chestseparators.data.ChestConfigManager; +import io.github.marcsanzdev.chestseparators.data.SlotWhitelist; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.UUID; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.RenderPipelines; +import net.minecraft.client.gui.GuiGraphicsExtractor; +import net.minecraft.client.gui.components.EditBox; +import net.minecraft.client.input.CharacterEvent; +import net.minecraft.client.input.KeyEvent; +import net.minecraft.world.item.Item; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.world.inventory.Slot; +import net.minecraft.network.chat.Component; +import net.minecraft.resources.Identifier; +import net.minecraft.util.Mth; + +/** + * The dedicated presets overlay, docked on the left and styled like the mod's other windows. Each preset + * row has a saved/empty indicator plus Load / Save / Delete buttons. Hovering a saved row's Load button + * previews that preset on the real container slots (alternating layout/filters); hovering Delete previews + * the same preset tinted red to signal removal. Saving over an occupied slot opens a confirmation popup. + * Presets are paged ({@link #PER_PAGE} per page, {@link #MAX_PAGES} pages) with ‹ › arrows. Drives the + * inventory or the chest preset store per {@code session.presetsMenuChestMode}. + * + *

The render is split into two phases so EditorRenderer can inject the saved-lines layer between the + * dim overlay ({@link #renderBackground}) and the panel itself ({@link #renderPanel}). + */ +public final class PresetsMenu { + + private static final int PANEL_W = 214; + private static final int HEADER_H = 26; + private static final int ROW_H = 22; + private static final int FOOTER_H = 24; + + // Compact icon-only action buttons per row (Load / Save / Delete), each with a tooltip. + private static final int ICON = 20; + + /** 9 presets per page across 5 pages = 45 total slots. */ + private static final int PER_PAGE = 9; + + private static final int MAX_PAGES = 5; + + // Save-indicator feedback colours. + private static final int GREEN_BG = 0x4633C05A; + private static final int GREEN_BORDER = 0xFF57E06A; + private static final int GREEN_TICK = 0xFF6BF07E; + private static final int ORANGE_BG = 0xF0C2721C; + private static final int ORANGE_BORDER = 0xFFE59A3C; + + // Which row's Load/Delete button is currently being previewed, so each new hover restarts its detail + // list from the top rather than continuing where the previous preset left off. + private int lastPreviewKey = Integer.MIN_VALUE; + + /** Updated by renderBackground(); read by isPreviewActive() and EditorRenderer. */ + private int currentPreviewRow = -1; + + // --- Preset detail panel --- + // The on-slot preview shows WHERE each filter sits but not WHAT it accepts, so while a Load button is + // hovered a second panel lists every group of that preset with the items it allows. Read straight from + // the preset file, so nothing is applied to the container. + private static final int DETAIL_W = 158; + private static final int DETAIL_LINE_H = 18; + + /** Preset currently hovered over its Load button, or null. Set by renderBackground(). */ + private ChestConfigManager.PresetPreview hoveredPreview; + + // Gentle auto-scroll for detail lists taller than the panel (same language as the filter preview). + private float detailScrollY = 0f; + private boolean detailScrollDown = true; + private long detailLastTime = 0L; + // Once the player scrolls the detail list themselves, the auto-scroll stops (until a new preset is + // hovered), same as the item-import preview lets you take over the wheel. + private boolean detailUserScrolled = false; + + /** Zero-based page currently shown. */ + private int currentPage = 0; + + /** 1-based slot awaiting an overwrite confirmation, or -1 when the popup is closed. */ + private int pendingOverwriteSlot = -1; + + // --- Inline rename --- + /** 1-based slot whose name is being edited inline, or -1 when not renaming. */ + private int renamingSlot = -1; + /** The text field shown over a row's name while renaming; null when not renaming. */ + private EditBox renameField; + + private static final int NAME_MAX_LEN = 24; + + // Page-arrow hit rects (updated each render). + private int navPrevX, navNextX, navArrowY; + + // Popup buttons, non-null only while the confirmation popup is open. + private WideButtonWidget popupConfirmBtn; + private WideButtonWidget popupCancelBtn; + + private final ChestSeparatorsEditor editor; + + /** Rebuilt every render; reused by {@link #onClick} so hit-testing matches what was drawn. */ + private final List clickables = new ArrayList<>(); + + public PresetsMenu(ChestSeparatorsEditor editor) { + this.editor = editor; + } + + /** True when a Load/Delete-button hover preview is currently being painted on the real slots. */ + public boolean isPreviewActive() { + return currentPreviewRow >= 0; + } + + private boolean chestMode() { + return editor.getSession().presetsMenuChestMode; + } + + /** The open container's slot count (27 vs 54); picks which chest-preset set the menu shows. */ + private int chestSize() { + return editor.chestPresetSize(); + } + + private boolean exists(int slot) { + return chestMode() + ? ChestConfigManager.getInstance().chestPresetExists(chestSize(), slot) + : ChestConfigManager.getInstance().inventoryPresetExists(slot); + } + + /** The custom name of the current-mode preset {@code slot}, or null when empty/unnamed. */ + private String presetName(int slot) { + return chestMode() + ? ChestConfigManager.getInstance().getChestPresetName(chestSize(), slot) + : ChestConfigManager.getInstance().getInventoryPresetName(slot); + } + + /** True when the slot carries a display name (a default or a user rename); those skip "Preset N". */ + private boolean hasName(int slot) { + String n = presetName(slot); + return n != null && !n.isEmpty(); + } + + /** Resets the menu to page 1 and ends any rename — called when the presets set (mode) changes. */ + public void resetView() { + currentPage = 0; + cancelRename(); + } + + /** 1-based preset slot for visible row {@code i} on the current page. */ + private int slotOfRow(int i) { + return currentPage * PER_PAGE + i + 1; + } + + private int panelH() { + return HEADER_H + PER_PAGE * ROW_H + FOOTER_H; + } + + /** + * Docked just left of the container GUI with the mod's standard gap, like every other side panel. + */ + private int panelX() { + return Math.max(2, editor.accessor.getX() - PANEL_W - editor.layout.gap); + } + + private int panelY(int screenH) { + return Math.max(8, (screenH - panelH()) / 2); + } + + private int rowY(int screenH, int i) { + return panelY(screenH) + HEADER_H + i * ROW_H; + } + + private int deleteX() { + return panelX() + PANEL_W - 8 - ICON; + } + + private int saveX() { + return deleteX() - 4 - ICON; + } + + private int loadX() { + return saveX() - 4 - ICON; + } + + private void doSave(int slot) { + if (chestMode()) editor.saveChestPresetSlot(slot); + else editor.saveInventoryPresetSlot(slot); + } + + /** + * Phase 1: full-screen dim overlay and optional on-slot Load/Delete preview. + * Must be called before {@link #renderPanel} so EditorRenderer can paint the saved lines between. + */ + public void renderBackground(GuiGraphicsExtractor context, int screenW, int screenH, int mouseX, int mouseY) { + // Light dim so the real container slots stay clearly visible for the on-slot preview. + context.fill(0, 0, screenW, screenH, 0x55000000); + + // While the confirmation popup is up, freeze the on-slot preview. + if (pendingOverwriteSlot >= 0) { + currentPreviewRow = -1; + lastPreviewKey = Integer.MIN_VALUE; + hoveredPreview = null; + return; + } + + // Load previews onto the real slots; Delete only shows its "will be deleted" badge (its row + // feedback — the whole chip fading — is drawn in drawSaveIndicator, not on the container). + int previewRow = -1; + int deleteRow = -1; + for (int i = 0; i < PER_PAGE; i++) { + int slot = slotOfRow(i); + if (!exists(slot)) continue; + int by = rowY(screenH, i) + (ROW_H - ICON) / 2; + if (inside(mouseX, mouseY, loadX(), by, ICON, ICON)) { + previewRow = i; + break; + } + if (inside(mouseX, mouseY, deleteX(), by, ICON, ICON)) { + deleteRow = i; + break; + } + } + + // Restart the layout<->filters cycle from the layout view whenever the hovered Load changes. + long now = System.currentTimeMillis(); + if (previewRow != lastPreviewKey) { + lastPreviewKey = previewRow; + // A different preset is being inspected: start its detail list from the top and resume auto-scroll. + detailScrollY = 0f; + detailScrollDown = true; + detailLastTime = now; + detailUserScrolled = false; + } + currentPreviewRow = previewRow; + hoveredPreview = null; + + if (previewRow >= 0) { + int slot = slotOfRow(previewRow); + ChestConfigManager.PresetPreview preview = chestMode() + ? ChestConfigManager.getInstance().readChestPresetPreview(chestSize(), slot) + : ChestConfigManager.getInstance().readInventoryPresetPreview(slot); + if (preview != null) { + hoveredPreview = preview; + // Show BOTH layers at once: the layout (backgrounds + separator lines) underneath, and the + // colour filter-group blobs on top — no more alternating between the two. The right-side + // detail panel keeps listing each group's items. + renderPreviewLayout(context, preview, chestMode()); + renderFilterBlobs(context, preview, chestMode()); + } + } else if (deleteRow >= 0) { + drawDeleteBadge(context); + } + } + + /** + * Phase 2: beveled panel, rows, buttons, page navigation and (if pending) the overwrite popup. + * Call after {@link #renderBackground} (and after any lines injected by EditorRenderer). + */ + public void renderPanel(GuiGraphicsExtractor context, int screenW, int screenH, int mouseX, int mouseY) { + Minecraft client = Minecraft.getInstance(); + boolean isDark = GlobalChestConfig.instance.darkMode; + int px = panelX(); + int py = panelY(screenH); + int ph = panelH(); + + // Detail of the hovered preset first, so the presets panel always wins any overlap. + renderDetailPanel(context, screenH); + + UiTheme.panel(context, px, py, PANEL_W, ph); + + // Chest presets are split by container size, so the title carries the slot count (e.g. "… (54)") + // to make clear which set — single vs double — is currently shown. + String title = Component.translatable( + chestMode() ? "gui.chestseparators.chest_presets_title" : "gui.chestseparators.presets_title") + .getString(); + if (chestMode()) title += " (" + chestSize() + " slots)"; + context.centeredText( + client.font, Component.literal(title), px + PANEL_W / 2, py + 9, 0xFFFFE066); + + // Hover feedback (indicator, popup) is suppressed while the popup owns input. + boolean popupOpen = pendingOverwriteSlot >= 0; + int hoverX = popupOpen ? -1 : mouseX; + int hoverY = popupOpen ? -1 : mouseY; + + clickables.clear(); + // "Preset N" numbering skips the named presets: whatever their slot index, the unnamed slots read + // as Preset 1..40 (5 of the 45 are the named defaults). Count how many unnamed slots precede this + // page, then run a local counter down the rows. + int unnamedCounter = 0; + for (int s = 1; s < slotOfRow(0); s++) if (!hasName(s)) unnamedCounter++; + + for (int i = 0; i < PER_PAGE; i++) { + int slot = slotOfRow(i); + int ry = rowY(screenH, i); + boolean saved = exists(slot); + boolean named = hasName(slot); + if (!named) unnamedCounter++; + int displayNumber = unnamedCounter; // only meaningful for unnamed rows + + int by = ry + (ROW_H - ICON) / 2; + boolean hoveringSave = inside(hoverX, hoverY, saveX(), by, ICON, ICON); + boolean hoveringDelete = saved && inside(hoverX, hoverY, deleteX(), by, ICON, ICON); + + drawSaveIndicator(context, px + 8, ry + (ROW_H - 14) / 2, saved, hoveringSave, hoveringDelete); + + int nameX = px + 28; + int nameW = loadX() - 4 - nameX; + if (renamingSlot == slot && renameField != null) { + // Inline editor: an inset box holding the text field, replacing the label for this row. + UiTheme.inset(context, nameX - 2, ry + (ROW_H - 14) / 2, nameW + 2, 14); + renameField.setX(nameX + 1); + renameField.setY(ry + (ROW_H - 8) / 2); + renameField.setWidth(nameW - 2); + renameField.extractRenderState(context, hoverX, hoverY, 0); + } else { + String custom = saved ? presetName(slot) : null; + Component label = custom != null && !custom.isEmpty() + ? Component.literal(custom) + : Component.translatable("gui.chestseparators.preset_slot", displayNumber); + // Saved rows are clickable-to-rename: their name reads blue, turning white on hover so the + // affordance is clear. Empty rows keep the plain muted label (nothing to edit there). + boolean nameHover = saved && inside(hoverX, hoverY, nameX, ry, nameW, ROW_H); + int nameColor; + if (!saved) { + nameColor = isDark ? 0xFF888888 : 0xFF707070; + } else { + nameColor = nameHover ? 0xFFFFFFFF : UiTheme.ACCENT; + } + context.text(client.font, label, nameX, ry + (ROW_H - 8) / 2, nameColor, isDark); + } + + ToolButtonWidget load = new ToolButtonWidget( + loadX(), + by, + ModTextures.ICON_SM_IMPORT, + Component.translatable("button.chestseparators.preset_load").getString(), + () -> { + if (chestMode()) editor.loadChestPresetSlot(slot); + else { + editor.loadInventoryPresetSlot(slot); + editor.toggleState(io.github.marcsanzdev.chestseparators.client.EditorState.HIDDEN); + } + }); + load.texSize = 128; + load.tintByState = true; + load.isDisabled = !saved; + + ToolButtonWidget save = new ToolButtonWidget( + saveX(), + by, + ModTextures.ICON_SM_SAVE, + Component.translatable("button.chestseparators.preset_save").getString(), + () -> { + // Overwriting an occupied slot asks first; a fresh slot saves immediately. + if (exists(slot)) pendingOverwriteSlot = slot; + else doSave(slot); + }); + save.texSize = 128; + save.tintByState = true; + + ToolButtonWidget delete = new ToolButtonWidget( + deleteX(), + by, + ModTextures.ICON_SM_TRASH, + Component.translatable("button.chestseparators.delete").getString(), + () -> { + if (chestMode()) editor.deleteChestPresetSlot(slot); + else editor.deleteInventoryPresetSlot(slot); + }); + delete.texSize = 128; + delete.tintByState = true; + delete.isDisabled = !saved; + + load.render(context, hoverX, hoverY, 0); + save.render(context, hoverX, hoverY, 0); + delete.render(context, hoverX, hoverY, 0); + clickables.add(load); + clickables.add(save); + clickables.add(delete); + } + + // ---- Footer: page navigation (dots + arrows). The panel is closed via its toolbar toggle or ESC. ---- + int footerY = py + HEADER_H + PER_PAGE * ROW_H; + renderPageNav(context, px, footerY, hoverX, hoverY); + + // ---- Overwrite confirmation popup (on top of everything) ---- + if (popupOpen) { + renderOverwritePopup(context, screenW, screenH, mouseX, mouseY); + } else { + popupConfirmBtn = null; + popupCancelBtn = null; + } + } + + /** Convenience: calls both phases in order (used when no line injection is needed). */ + public void render(GuiGraphicsExtractor context, int screenW, int screenH, int mouseX, int mouseY) { + renderBackground(context, screenW, screenH, mouseX, mouseY); + renderPanel(context, screenW, screenH, mouseX, mouseY); + } + + // ---- Save indicator ---- + + /** + * The 14×14 chip at the start of each row. Empty vs saved, with a distinct Save-hover preview for each: + * a bright green tick when hovering Save on an empty slot (you will add), an orange warning chip when + * hovering Save on an occupied slot (you will overwrite). + */ + private void drawSaveIndicator( + GuiGraphicsExtractor context, int x, int y, boolean saved, boolean hoveringSave, boolean hoveringDelete) { + if (saved) { + if (hoveringDelete) { + // Delete preview: fade the WHOLE chip (blue fill, border and tick) toward transparency, + // hinting that all of it — the preset in this slot — is about to be removed. + int fade = 0x40 << 24; + UiTheme.roundRect(context, x, y, 14, 14, (UiTheme.ACCENT_BG & 0x00FFFFFF) | fade); + UiTheme.roundBorder(context, x, y, 14, 14, (UiTheme.ACCENT_BORDER & 0x00FFFFFF) | fade); + drawIcon(context, ModTextures.ICON_SM_CHECK, x + 1, y + 1, 0x40FFFFFF); + } else if (hoveringSave) { + UiTheme.roundRect(context, x, y, 14, 14, ORANGE_BG); + UiTheme.roundBorder(context, x, y, 14, 14, ORANGE_BORDER); + drawIcon(context, ModTextures.ICON_SM_CONFLICT, x + 1, y + 1, 0xFFFFFFFF); + } else { + UiTheme.roundRect(context, x, y, 14, 14, UiTheme.ACCENT_BG); + UiTheme.roundBorder(context, x, y, 14, 14, UiTheme.ACCENT_BORDER); + drawIcon(context, ModTextures.ICON_SM_CHECK, x + 1, y + 1, UiTheme.ON_ACCENT); + } + } else { + if (hoveringSave) { + UiTheme.roundRect(context, x, y, 14, 14, GREEN_BG); + UiTheme.roundBorder(context, x, y, 14, 14, GREEN_BORDER); + drawIcon(context, ModTextures.ICON_SM_CHECK, x + 1, y + 1, GREEN_TICK); + } else { + UiTheme.inset(context, x, y, 14, 14); + } + } + } + + private void drawIcon(GuiGraphicsExtractor context, net.minecraft.resources.Identifier icon, int x, int y, int color) { + context.blit(RenderPipelines.GUI_TEXTURED, icon, x, y, 0.0F, 0.0F, 12, 12, 128, 128, 128, 128, color); + } + + // ---- Page navigation ---- + + private void renderPageNav(GuiGraphicsExtractor context, int px, int footerY, int mouseX, int mouseY) { + int cx = px + PANEL_W / 2; + navArrowY = footerY + 2; + navPrevX = cx - 58; + navNextX = cx + 42; + + // Pagination wraps around, so both arrows are always active. + boolean hoverPrev = inside(mouseX, mouseY, navPrevX, navArrowY, 16, 16); + boolean hoverNext = inside(mouseX, mouseY, navNextX, navArrowY, 16, 16); + + drawArrowButton(context, navPrevX, navArrowY, true, true, hoverPrev); + drawArrowButton(context, navNextX, navArrowY, false, true, hoverNext); + + // Page-position dots: the current page lit (accent), the rest dimmed. Each is a small rounded chip + // with the mod's pixel-bevel border. + int dot = 7; + int gap = 5; + int total = MAX_PAGES * dot + (MAX_PAGES - 1) * gap; + int startX = cx - total / 2; + int dotY = navArrowY + (16 - dot) / 2; + for (int p = 0; p < MAX_PAGES; p++) { + int dx = startX + p * (dot + gap); + if (p == currentPage) { + UiTheme.roundRect(context, dx, dotY, dot, dot, UiTheme.ACCENT_BG); + UiTheme.roundBorder(context, dx, dotY, dot, dot, UiTheme.ACCENT_BORDER); + } else { + UiTheme.roundRect(context, dx, dotY, dot, dot, 0x22FFFFFF); + UiTheme.roundBorder(context, dx, dotY, dot, dot, 0x40FFFFFF); + } + } + } + + private void drawArrowButton(GuiGraphicsExtractor context, int x, int y, boolean left, boolean enabled, boolean hover) { + if (enabled) { + UiTheme.button(context, x, y, 16, 16, hover, PressAnim.active(x, y)); + } else { + UiTheme.roundRect(context, x, y, 16, 16, 0x0AFFFFFF); + UiTheme.roundBorder(context, x, y, 16, 16, 0x14FFFFFF); + } + drawArrow(context, x, y, 16, left, enabled ? UiTheme.TEXT : 0xFF6A6A72); + } + + /** A small filled triangle pointing left or right, centred in a {@code size}×{@code size} box. */ + private void drawArrow(GuiGraphicsExtractor context, int x, int y, int size, boolean left, int color) { + int midY = y + size / 2; + int half = 4; + int startX = x + size / 2 - half / 2; // leftmost column of the triangle + for (int i = 0; i <= half; i++) { + int px = startX + i; + // Left arrow: tip (short) at the left, base (tall) at the right; right arrow: mirrored. + int hh = left ? i : (half - i); + context.fill(px, midY - hh, px + 1, midY + hh + 1, color); + } + } + + // ---- Overwrite confirmation popup ---- + + private void renderOverwritePopup(GuiGraphicsExtractor context, int screenW, int screenH, int mouseX, int mouseY) { + Minecraft client = Minecraft.getInstance(); + // Darken the whole screen so the popup reads as modal. + context.fill(0, 0, screenW, screenH, 0x99000000); + + int pw = 214; + int pph = 96; + int px = (screenW - pw) / 2; + int py = (screenH - pph) / 2; + UiTheme.panel(context, px, py, pw, pph); + + drawIcon(context, ModTextures.ICON_SM_CONFLICT, px + pw / 2 - 6, py + 8, ORANGE_BORDER); + + Component title = Component.translatable("gui.chestseparators.preset_overwrite_title", pendingOverwriteSlot); + context.centeredText(client.font, title, px + pw / 2, py + 26, 0xFFFFC24A); + + Component body = Component.translatable("gui.chestseparators.preset_overwrite_body"); + for (net.minecraft.util.FormattedCharSequence line : client.font.split(body, pw - 24)) { + // Single expected line; wrapLines guards against long translations. + context.centeredText(client.font, line, px + pw / 2, py + 42, 0xFFCFCFD6); + break; + } + + int bw = 84; + int bh = 18; + int gap = 8; + int startX = px + (pw - (2 * bw + gap)) / 2; + int by = py + pph - bh - 10; + + popupConfirmBtn = new WideButtonWidget( + startX, + by, + bw, + bh, + Component.translatable("button.chestseparators.confirm").getString(), + ModTextures.ICON_SM_CHECK, + () -> { + doSave(pendingOverwriteSlot); + pendingOverwriteSlot = -1; + }); + popupConfirmBtn.texSize = 128; + popupCancelBtn = new WideButtonWidget( + startX + bw + gap, + by, + bw, + bh, + Component.translatable("button.chestseparators.cancel").getString(), + ModTextures.ICON_SM_CANCEL, + () -> pendingOverwriteSlot = -1); + popupCancelBtn.texSize = 128; + + popupConfirmBtn.render(context, mouseX, mouseY, 0); + popupCancelBtn.render(context, mouseX, mouseY, 0); + } + + /** Badge shown while hovering a Delete button, warning that the preset will be removed. */ + private void drawDeleteBadge(GuiGraphicsExtractor context) { + drawBadge(context, Component.translatable("gui.chestseparators.preview_delete"), 0xFFFF6060); + } + + /** + * A badge in the mod's Cristal style (rounded, bordered panel), centred over the chest and tucked just + * above the top toolbar so the hint sits near the buttons rather than floating at the very top. + */ + private void drawBadge(GuiGraphicsExtractor context, Component label, int textColor) { + Minecraft client = Minecraft.getInstance(); + int w = client.font.width(label) + 18; + int h = 18; + int cx = editor.accessor.getX() + editor.accessor.getBackgroundWidth() / 2; + int x = cx - w / 2; + int y = Math.max(2, editor.accessor.getY() - 51); + UiTheme.panel(context, x, y, w, h); + context.centeredText(client.font, label, x + w / 2, y + (h - 8) / 2, textColor); + } + + // ---- Preset detail panel (which items each filter of the preset accepts) ---- + + /** One line of the detail list: either a group header (colour chip + slot count) or an item. */ + private record DetailRow(boolean header, int color, int slotCount, String itemId) {} + + /** + * Docked just left of the presets panel so you get preset list → detail → container. When there is no + * room left of it (narrow window), it falls back to the free space right of the container. + */ + private int detailX() { + int left = panelX() - DETAIL_W - editor.layout.gap; + if (left >= 2) return left; + return editor.accessor.getX() + editor.accessor.getBackgroundWidth() + editor.layout.gap; + } + + /** Flattens the preset's filters into group headers followed by their allowed items. */ + private List buildDetailRows(ChestConfigManager.PresetPreview preview) { + Map filters = preview.filters(); + // Group the slots, keeping groups ordered by their first slot so the list matches the container. + Map> groups = new LinkedHashMap<>(); + List slotKeys = new ArrayList<>(filters.keySet()); + if (chestMode()) { + slotKeys.sort(null); + } else { + // Inventory presets list groups by TRUE importance: armor + offhand first, then the hotbar, + // then the main grid (top-left → bottom-right). Inventory keys are realIndex values: + // 0-8 hotbar, 9-35 main, 36-39 armor, 40 offhand. + slotKeys.sort(java.util.Comparator.comparingInt((Integer k) -> k >= 36 ? 0 : (k <= 8 ? 1 : 2)) + .thenComparingInt(k -> k)); + } + for (int key : slotKeys) { + groups.computeIfAbsent(filters.get(key).groupId(), g -> new ArrayList<>()) + .add(key); + } + + Map colors = assignPreviewGroupColors(preview); + List rows = new ArrayList<>(); + for (Map.Entry> entry : groups.entrySet()) { + SlotWhitelist wl = filters.get(entry.getValue().get(0)); + rows.add(new DetailRow( + true, + colors.getOrDefault(entry.getKey(), 0x99888888), + entry.getValue().size(), + null)); + if (wl.allowedItems().isEmpty()) { + rows.add(new DetailRow(false, 0, 0, null)); // "empty filter" line + } else { + for (String id : wl.allowedItems()) rows.add(new DetailRow(false, 0, 0, id)); + } + } + return rows; + } + + /** Draws the hovered preset's filters and their items. No-op when nothing is hovered. */ + private void renderDetailPanel(GuiGraphicsExtractor context, int screenH) { + ChestConfigManager.PresetPreview preview = hoveredPreview; + if (preview == null) return; + Map filters = preview.filters(); + if (filters == null || filters.isEmpty()) return; + + List rows = buildDetailRows(preview); + int totalItems = 0; + for (DetailRow r : rows) if (!r.header() && r.itemId() != null) totalItems++; + + Minecraft mc = Minecraft.getInstance(); + int x = detailX(); + int y = panelY(screenH); + int w = DETAIL_W; + int h = panelH(); + + UiTheme.panel(context, x, y, w, h); + + // Header: how many items this preset's filters accept in total. + context.pose().pushMatrix(); + float scale = 0.8f; + context.pose().scale(scale, scale); + context.text( + mc.font, + Component.translatable("gui.chestseparators.items_count", totalItems), + (int) ((x + 8) / scale), + (int) ((y + 8) / scale), + UiTheme.TEXT, + false); + context.pose().popMatrix(); + + int viewY = y + 22; + int viewH = h - 30; + UiTheme.inset(context, x + 6, viewY, w - 12, viewH); + + int contentH = rows.size() * DETAIL_LINE_H; + float maxScroll = Math.max(0, contentH - (viewH - 4)); + + long now = System.currentTimeMillis(); + if (detailLastTime == 0L) detailLastTime = now; + float dt = (now - detailLastTime) / 1000f; + detailLastTime = now; + if (GlobalChestConfig.instance.enablePreviewAnimation && maxScroll > 0 && !detailUserScrolled) { + float speed = 22f; + if (detailScrollDown) { + detailScrollY += speed * dt; + if (detailScrollY >= maxScroll) { + detailScrollY = maxScroll; + detailScrollDown = false; + } + } else { + detailScrollY -= speed * dt; + if (detailScrollY <= 0) { + detailScrollY = 0; + detailScrollDown = true; + } + } + } + detailScrollY = Mth.clamp(detailScrollY, 0, maxScroll); + + context.enableScissor(x + 6, viewY + 1, x + w - 6, viewY + viewH - 1); + int first = (int) (detailScrollY / DETAIL_LINE_H); + int visible = (viewH / DETAIL_LINE_H) + 2; + for (int i = 0; i < visible; i++) { + int idx = first + i; + if (idx < 0 || idx >= rows.size()) break; + DetailRow row = rows.get(idx); + int ry = viewY + 2 + (i * DETAIL_LINE_H) - (int) (detailScrollY % DETAIL_LINE_H); + + if (row.header()) { + // Colour chip matching the on-slot blob, plus how many slots the group covers. + // The group palette is translucent (for the on-slot blobs); the detail chip wants it solid. + UiTheme.roundRect(context, x + 10, ry + 4, 10, 10, row.color() | 0xFF000000); + UiTheme.roundBorder(context, x + 10, ry + 4, 10, 10, 0x66FFFFFF); + context.pose().pushMatrix(); + context.pose().scale(scale, scale); + context.text( + mc.font, + "x" + row.slotCount(), + (int) ((x + 24) / scale), + (int) ((ry + 6) / scale), + UiTheme.TEXT, + false); + context.pose().popMatrix(); + continue; + } + + if (row.itemId() == null) { + context.pose().pushMatrix(); + float s = 0.75f; + context.pose().scale(s, s); + context.text( + mc.font, + Component.translatable("gui.chestseparators.empty_whitelist"), + (int) ((x + 24) / s), + (int) ((ry + 6) / s), + UiTheme.TEXT_MUTED, + false); + context.pose().popMatrix(); + continue; + } + + Item item = BuiltInRegistries.ITEM.getValue(Identifier.tryParse(row.itemId())); + context.item(item.getDefaultInstance(), x + 22, ry); + + String name = item.getName(item.getDefaultInstance()).getString(); + context.pose().pushMatrix(); + float s = 0.75f; + context.pose().scale(s, s); + int maxNameW = (int) ((w - 52) / s); + if (mc.font.width(name) > maxNameW) { + name = mc.font.plainSubstrByWidth(name, maxNameW - 6) + "..."; + } + context.text(mc.font, name, (int) ((x + 42) / s), (int) ((ry + 5) / s), UiTheme.TEXT, false); + context.pose().popMatrix(); + } + context.disableScissor(); + + if (maxScroll > 0) { + int barX = x + w - 12; + int barH = viewH - 2; + int thumbH = Math.max(10, (int) ((viewH / (float) Math.max(1, contentH)) * barH)); + int thumbY = viewY + 1 + (int) ((detailScrollY / maxScroll) * (barH - thumbH)); + UiTheme.scrollbar(context, barX, viewY + 1, 6, barH, thumbY, thumbH); + } + } + + // ---- On-slot preview ---- + + private void renderPreviewLayout(GuiGraphicsExtractor context, ChestConfigManager.PresetPreview preview, boolean chestKind) { + int guiX = editor.accessor.getX(); + int guiY = editor.accessor.getY(); + for (Slot slot : editor.accessor.getHandler().slots) { + if (!ChestSeparatorsEditor.isEditableSlot(slot)) continue; + boolean player = ChestSeparatorsEditor.isPlayerSlot(slot); + if (chestKind == player) continue; + int idx = ChestSeparatorsEditor.realIndex(slot); + int x = guiX + slot.x; + int y = guiY + slot.y; + + int[] cc = ChestConfigManager.previewColors(preview.visual().get(idx)); + if (cc[4] != 0) context.fill(x, y, x + 16, y + 16, (cc[4] & 0x00FFFFFF) | 0x99000000); + if (cc[0] != 0) context.fill(x - 1, y - 1, x + 17, y, (cc[0] & 0x00FFFFFF) | 0xFF000000); + if (cc[1] != 0) context.fill(x - 1, y + 16, x + 17, y + 17, (cc[1] & 0x00FFFFFF) | 0xFF000000); + if (cc[2] != 0) context.fill(x - 1, y - 1, x, y + 17, (cc[2] & 0x00FFFFFF) | 0xFF000000); + if (cc[3] != 0) context.fill(x + 16, y - 1, x + 17, y + 17, (cc[3] & 0x00FFFFFF) | 0xFF000000); + } + } + + /** + * Filter view of the preview. Draws each group through the SAME blob passes the live filter editor uses + * (GroupBlobRenderer.drawBlobGroupStatic), so a filter looks pixel-identical everywhere in the mod. The + * translucent group palette lets the layout drawn underneath still show through. + */ + private void renderFilterBlobs(GuiGraphicsExtractor context, ChestConfigManager.PresetPreview preview, boolean chestKind) { + int guiX = editor.accessor.getX(); + int guiY = editor.accessor.getY(); + Map filters = preview.filters(); + Map groupColors = assignPreviewGroupColors(preview); + + // Group the filtered cells, and build a realIndex -> Slot resolver (the exact realIndex mapping the + // live editor uses) so the shared blob renderer can locate each cell on screen. + Map> groupKeys = new LinkedHashMap<>(); + Map keyToSlot = new HashMap<>(); + for (Slot slot : editor.accessor.getHandler().slots) { + if (!ChestSeparatorsEditor.isEditableSlot(slot)) continue; + if (chestKind == ChestSeparatorsEditor.isPlayerSlot(slot)) continue; + int key = ChestSeparatorsEditor.realIndex(slot); + SlotWhitelist wl = filters.get(key); + if (wl == null) continue; + keyToSlot.put(key, slot); + groupKeys.computeIfAbsent(wl.groupId(), g -> new HashSet<>()).add(key); + } + + for (Map.Entry> entry : groupKeys.entrySet()) { + int color = groupColors.getOrDefault(entry.getKey(), 0x99888888); + GroupBlobRenderer.drawBlobGroupStatic(context, entry.getValue(), color, guiX, guiY, keyToSlot::get); + } + } + + /** + * Group colours for a preset preview, mirroring the live editor exactly: a group painted with a colour + * unanimous across all its slots (in the PRESET's own layout) keeps that colour; the rest fall back to + * the shared palette, skipping colours already taken. So a preset's blobs match the layout it stored. + */ + private Map assignPreviewGroupColors(ChestConfigManager.PresetPreview preview) { + Map> groupKeys = new LinkedHashMap<>(); + for (Map.Entry e : preview.filters().entrySet()) { + groupKeys + .computeIfAbsent(e.getValue().groupId(), g -> new HashSet<>()) + .add(e.getKey()); + } + List order = new ArrayList<>(groupKeys.keySet()); + order.sort(UUID::compareTo); + + Map assigned = new HashMap<>(); + Set used = new HashSet<>(); + // 1. Explicit layout colours first (matches GroupBlobRenderer#getExplicitGroupColor). + for (UUID g : order) { + int explicit = presetExplicitGroupColor(groupKeys.get(g), preview); + if (explicit != 0) { + assigned.put(g, explicit); + used.add(explicit); + } + } + // 2. Palette for the rest, skipping colours already used. + int idx = 0; + int[] palette = GroupBlobRenderer.GROUP_PALETTE; + for (UUID g : order) { + if (assigned.containsKey(g)) continue; + while (idx < palette.length && used.contains(palette[idx])) idx++; + int color = idx < palette.length ? palette[idx++] : palette[Math.abs(g.hashCode()) % palette.length]; + used.add(color); + assigned.put(g, color); + } + return assigned; + } + + /** + * The colour a group is painted with in a preset's stored layout, if unanimous across all its slots — + * the preview equivalent of the live editor's getExplicitGroupColor, reading the preset's visual data. + * Returns 0 when the group has no single shared layout colour. + */ + private static int presetExplicitGroupColor(Set groupKeys, ChestConfigManager.PresetPreview preview) { + Set common = null; + for (int key : groupKeys) { + int[] cc = ChestConfigManager.previewColors(preview.visual().get(key)); + Set slotColors = new HashSet<>(); + for (int i = 0; i < 5 && i < cc.length; i++) { + int c = cc[i] & 0x00FFFFFF; + if (c != 0) slotColors.add(c); + } + if (slotColors.isEmpty()) return 0; // a slot with no colour means the group has no unanimous one + if (common == null) common = slotColors; + else common.retainAll(slotColors); + if (common.isEmpty()) return 0; + } + return (common != null && !common.isEmpty()) ? (common.iterator().next() | 0x99000000) : 0; + } + + private static boolean inside(double mx, double my, int x, int y, int w, int h) { + return mx >= x && mx < x + w && my >= y && my < y + h; + } + + // ---- Inline rename ---- + + /** + * Wheel over the preset menu while a Load preview is showing scrolls its detail list (the items each + * filter accepts), and hands control from the auto-scroll to the player — just like the item-import + * preview. Returns true when it consumed the scroll. + */ + public boolean mouseScrolled(double mouseX, double mouseY, double verticalAmount) { + if (hoveredPreview == null) return false; + detailScrollY = Math.max(0, detailScrollY - (float) verticalAmount * 18f); + detailUserScrolled = true; // upper bound is clamped while rendering the detail panel + return true; + } + + /** True while a preset name is being edited, so the parent screen routes typing here. */ + public boolean isRenaming() { + return renamingSlot >= 0; + } + + /** Starts editing {@code slot}'s name, seeding the field with its current name. */ + private void beginRename(int slot, double clickX) { + String current = presetName(slot); + renamingSlot = slot; + // Create the field at its real geometry FIRST: if it were built at a placeholder width, setText + // would scroll it so far that only the last letter shows (the reported bug). The row's name box + // does not depend on the screen height, so it can be sized here. + int nameX = panelX() + 28; + int fieldX = nameX + 1; + int fieldW = (loadX() - 4 - nameX) - 2; + renameField = new EditBox( + Minecraft.getInstance().font, fieldX, 0, fieldW, 12, Component.literal("")); + renameField.setBordered(false); + renameField.setMaxLength(NAME_MAX_LEN); + renameField.setValue(current == null ? "" : current); + renameField.setFocused(true); + + // Place the caret at the letter that was clicked, not blindly at the end. + String text = renameField.getValue(); + var tr = Minecraft.getInstance().font; + int rel = (int) Math.max(0, clickX - fieldX); + int caret = tr.plainSubstrByWidth(text, rel).length(); + renameField.moveCursorTo(caret, false); + editor.playClickSound(1.0f); + } + + /** Saves the edited name (empty clears back to the default label) and leaves rename mode. */ + private void commitRename() { + if (renamingSlot >= 0 && renameField != null) { + if (chestMode()) { + ChestConfigManager.getInstance().setChestPresetName(chestSize(), renamingSlot, renameField.getValue()); + } else { + ChestConfigManager.getInstance().setInventoryPresetName(renamingSlot, renameField.getValue()); + } + editor.playClickSound(1.1f); + } + renamingSlot = -1; + renameField = null; + } + + /** Ends any active rename without saving (used when the menu closes or its page/mode changes). */ + public void cancelRename() { + renamingSlot = -1; + renameField = null; + } + + /** Keyboard while renaming: Enter commits, Escape cancels, everything else edits the field. */ + public boolean keyPressed(KeyEvent input) { + if (!isRenaming() || renameField == null) return false; + int key = input.key(); + if (key == InputConstants.KEY_RETURN || key == InputConstants.KEY_NUMPADENTER) { + commitRename(); + return true; + } + if (key == InputConstants.KEY_ESCAPE) { + cancelRename(); + return true; + } + renameField.keyPressed(input); + return true; + } + + public boolean charTyped(CharacterEvent input) { + if (!isRenaming() || renameField == null) return false; + renameField.charTyped(input); + return true; + } + + /** Routes a click inside the open menu. Returns true when the click was consumed. */ + public boolean onClick(double mouseX, double mouseY, int button, int screenW, int screenH) { + if (button != 0) return true; + + // The confirmation popup captures all input until resolved. + if (pendingOverwriteSlot >= 0) { + if (popupConfirmBtn != null && popupConfirmBtn.mouseClicked(mouseX, mouseY, button)) { + editor.playClickSound(1.2f); + return true; + } + if (popupCancelBtn != null && popupCancelBtn.mouseClicked(mouseX, mouseY, button)) { + editor.playClickSound(0.9f); + return true; + } + return true; + } + + // A rename in progress: a click inside its field just moves the caret; any other click commits it + // and then continues as a normal click (so clicking a button or another name works in one go). + if (isRenaming()) { + if (renameField != null && renameField.isMouseOver(mouseX, mouseY)) { + renameField.setFocused(true); + // Reposition the caret to the clicked letter. EditBox.mouseClicked's signature + // changed in 1.21.11 and no longer moves the caret from a raw (x,y), so place it manually + // from the click X — the same computation beginRename uses when the field first opens. + var tr = Minecraft.getInstance().font; + int rel = (int) Math.max(0, mouseX - renameField.getX()); + int caret = tr.plainSubstrByWidth(renameField.getValue(), rel).length(); + renameField.moveCursorTo(caret, false); + return true; + } + commitRename(); + } + + // Page arrows — circular: wrap past either end. Changing page ends any rename (slots shift). + if (inside(mouseX, mouseY, navPrevX, navArrowY, 16, 16)) { + cancelRename(); + currentPage = (currentPage - 1 + MAX_PAGES) % MAX_PAGES; + PressAnim.press(navPrevX, navArrowY); + editor.playClickSound(1.0f); + return true; + } + if (inside(mouseX, mouseY, navNextX, navArrowY, 16, 16)) { + cancelRename(); + currentPage = (currentPage + 1) % MAX_PAGES; + PressAnim.press(navNextX, navArrowY); + editor.playClickSound(1.0f); + return true; + } + + for (ToolButtonWidget b : clickables) { + if (!b.isDisabled && b.mouseClicked(mouseX, mouseY, button)) { + editor.playClickSound(1.1f); + return true; + } + } + + // Click a saved row's name to edit it inline. + for (int i = 0; i < PER_PAGE; i++) { + int slot = slotOfRow(i); + if (!exists(slot)) continue; + int ry = rowY(screenH, i); + int nameX = panelX() + 28; + int nameW = loadX() - 4 - nameX; + if (inside(mouseX, mouseY, nameX, ry, nameW, ROW_H)) { + beginRename(slot, mouseX); + return true; + } + } + + boolean insidePanel = inside(mouseX, mouseY, panelX(), panelY(screenH), PANEL_W, panelH()); + // Click-outside-to-close: when enabled, a click beyond the panel dismisses the presets menu. + if (!insidePanel && GlobalChestConfig.instance.closeOnClickOutside) { + editor.getSession().isPresetsMenuOpen = false; + editor.playCloseSound(); + return true; + } + return insidePanel; + } +} diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/screens/ScreenColorPicker.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/screens/ScreenColorPicker.java new file mode 100644 index 0000000..02f93dc --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/screens/ScreenColorPicker.java @@ -0,0 +1,481 @@ +package io.github.marcsanzdev.chestseparators.client.ui.screens; + +import io.github.marcsanzdev.chestseparators.client.ModTextures; +import io.github.marcsanzdev.chestseparators.client.ui.ChestSeparatorsEditor; +import io.github.marcsanzdev.chestseparators.client.ui.widgets.WideButtonWidget; +import io.github.marcsanzdev.chestseparators.config.GlobalChestConfig; +import io.github.marcsanzdev.chestseparators.data.ChestConfigManager; +import java.awt.Color; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiGraphicsExtractor; +import net.minecraft.client.gui.components.EditBox; +import net.minecraft.network.chat.Component; +import net.minecraft.ChatFormatting; +import net.minecraft.util.Mth; + +public class ScreenColorPicker extends AbstractEditorScreen { + + EditBox hexField; + EditBox rField; + EditBox gField; + EditBox bField; + + private boolean isUpdatingFields = false; + int hoveredPixelColor = 0xFFFFFF; + // Consecutive frames the eyedropper has sampled a near-white pixel — used to reject the one-frame white + // flash caused by the (white) dropper icon of the previous frame landing on the sample point on fast moves. + private int whiteSampleStreak = 0; + + private final ColorPickerInputHandler inputHandler; + + public ScreenColorPicker(ChestSeparatorsEditor editor) { + super(editor); + this.inputHandler = new ColorPickerInputHandler(this); + } + + @Override + protected void buildWidgets() { + + int w = layout.popupW; + int x = layout.popupX; + int y = layout.popupY; + int btnY = y + layout.popupH - 30; + int bH = 20; + + WideButtonWidget btnEyedropper = new WideButtonWidget( + x + 10, + btnY, + 85, + bH, + Component.translatable("button.chestseparators.eyedropper").getString(), + ModTextures.ICON_SM_EYEDROPPER, + () -> { + session.isEyedropperActive = true; + org.lwjgl.sdl.SDLMouse.SDL_HideCursor(); + editor.playClickSound(1.2f); + }); + btnEyedropper.tooltipText = + Component.translatable("tooltip.chestseparators.desc.eyedropper").getString(); + btnEyedropper.texSize = 128; + widgets.add(btnEyedropper); + + WideButtonWidget btnExit = new WideButtonWidget( + x + 175, + btnY, + 55, + bH, + Component.translatable("button.chestseparators.exit").getString(), + ModTextures.ICON_SM_CANCEL, + () -> { + saveCurrentCustomColor(); + editor.playClickSound(0.8f); + clearSelection(); + session.isColorPickerOpen = false; + closeAndRestore(); + }); + btnExit.tooltipText = + Component.translatable("tooltip.chestseparators.desc.exit").getString(); + btnExit.deferAction = true; // flash before the Exit button closes the colour picker + widgets.add(btnExit); + + Minecraft client = Minecraft.getInstance(); + + int rightPanelX = layout.popupX + 155; + int textX = rightPanelX + 5; + int fieldX = textX + 12; + int fieldY = layout.popupY + 85; + + hexField = new EditBox( + client.font, fieldX, fieldY, 60, 12, Component.translatable("gui.chestseparators.hex")); + hexField.setMaxLength(6); + hexField.setBordered(false); + boolean isDark = GlobalChestConfig.instance.darkMode; + hexField.setTextColor(isDark ? 0xFFFFFFFF : 0xFF222222); + // TODO(26.1): EditBox no longer exposes setFilter — input restriction dropped for now (downstream parsing still guards). + hexField.setResponder(text -> { + String upper = text.toUpperCase(); + // Normalize to uppercase so the hex string is always canonical. + if (!text.equals(upper)) { + hexField.setValue(upper); + } else { + updateColorFromFields(true); + } + }); + + rField = new EditBox( + client.font, fieldX, fieldY + 20, 30, 12, Component.translatable("gui.chestseparators.color_r")); + rField.setMaxLength(3); + rField.setBordered(false); + rField.setTextColor(0xFFFF5555); + // TODO(26.1): EditBox no longer exposes setFilter — input restriction dropped for now (downstream parsing still guards). + rField.setResponder(text -> { + if (!text.isEmpty() && Integer.parseInt(text) > 255) { + rField.setValue("255"); + } else { + updateColorFromFields(false); + } + }); + + gField = new EditBox( + client.font, fieldX, fieldY + 36, 30, 12, Component.translatable("gui.chestseparators.color_g")); + gField.setMaxLength(3); + gField.setBordered(false); + gField.setTextColor(0xFF55FF55); + // TODO(26.1): EditBox no longer exposes setFilter — input restriction dropped for now (downstream parsing still guards). + gField.setResponder(text -> { + if (!text.isEmpty() && Integer.parseInt(text) > 255) { + gField.setValue("255"); + } else { + updateColorFromFields(false); + } + }); + + bField = new EditBox( + client.font, fieldX, fieldY + 52, 30, 12, Component.translatable("gui.chestseparators.color_b")); + bField.setMaxLength(3); + bField.setBordered(false); + bField.setTextColor(0xFF5555FF); + // TODO(26.1): EditBox no longer exposes setFilter — input restriction dropped for now (downstream parsing still guards). + bField.setResponder(text -> { + if (!text.isEmpty() && Integer.parseInt(text) > 255) { + bField.setValue("255"); + } else { + updateColorFromFields(false); + } + }); + + updateFieldsFromColor(); + } + + void saveCurrentCustomColor() { + int customIndex = (session.pickerTargetMode == 0) + ? session.editingLineCustomIndex + : ((session.pickerTargetMode == 1) ? session.editingBgCustomIndex : session.editingComboCustomIndex); + + if (customIndex != -1) { + ChestConfigManager.getInstance() + .setCustomColor(customIndex, session.pickerCurrentRGB, session.pickerTargetMode); + ChestConfigManager.getInstance().saveWorldPalette(); + } + } + + void clearSelection() { + if (session.pickerTargetMode == 0) session.editingLineCustomIndex = -1; + else if (session.pickerTargetMode == 1) session.editingBgCustomIndex = -1; + else session.editingComboCustomIndex = -1; + } + + public void onOpen() { + updateFieldsFromColor(); + } + + public void updateFieldsFromColor() { + if (hexField == null) return; + isUpdatingFields = true; + + if (session.pickerCurrentRGB == 0 && !editor.colorPickerModified) { + hexField.setValue(""); + rField.setValue(""); + gField.setValue(""); + bField.setValue(""); + boolean isDark = GlobalChestConfig.instance.darkMode; + hexField.setTextColor(isDark ? 0xFFFFFFFF : 0xFF222222); + } else { + int r = (session.pickerCurrentRGB >> 16) & 0xFF; + int g = (session.pickerCurrentRGB >> 8) & 0xFF; + int b = session.pickerCurrentRGB & 0xFF; + + hexField.setValue(String.format("%02X%02X%02X", r, g, b)); + rField.setValue(String.valueOf(r)); + gField.setValue(String.valueOf(g)); + bField.setValue(String.valueOf(b)); + + hexField.setTextColor(session.pickerCurrentRGB | 0xFF000000); + } + + isUpdatingFields = false; + } + + void updateColorFromFields(boolean fromHex) { + if (isUpdatingFields) return; + + editor.colorPickerModified = true; + + try { + int r, g, b; + if (fromHex) { + String hex = hexField.getValue().trim().replace("#", ""); + if (hex.length() == 6) { + int color = Integer.parseInt(hex, 16); + r = (color >> 16) & 0xFF; + g = (color >> 8) & 0xFF; + b = color & 0xFF; + } else return; + } else { + r = Mth.clamp(Integer.parseInt(rField.getValue().isEmpty() ? "0" : rField.getValue()), 0, 255); + g = Mth.clamp(Integer.parseInt(gField.getValue().isEmpty() ? "0" : gField.getValue()), 0, 255); + b = Mth.clamp(Integer.parseInt(bField.getValue().isEmpty() ? "0" : bField.getValue()), 0, 255); + } + + session.pickerCurrentRGB = (r << 16) | (g << 8) | b; + float[] hsb = Color.RGBtoHSB(r, g, b, null); + session.pickerHue = hsb[0]; + session.pickerSat = hsb[1]; + session.pickerVal = hsb[2]; + + isUpdatingFields = true; + if (fromHex) { + rField.setValue(String.valueOf(r)); + gField.setValue(String.valueOf(g)); + bField.setValue(String.valueOf(b)); + } else { + hexField.setValue(String.format("%02X%02X%02X", r, g, b)); + hexField.setTextColor(session.pickerCurrentRGB | 0xFF000000); + } + isUpdatingFields = false; + + saveCurrentCustomColor(); + + } catch (NumberFormatException ignored) { + } + } + + public void closeAndRestore() { + boolean hasNoColor = (session.pickerCurrentRGB == 0 && !editor.colorPickerModified); + + if (editor.colorPickerModified) { + saveCurrentCustomColor(); + } else if (hasNoColor) { + // Revert to the previous color and deselect the custom slot. + if (session.pickerTargetMode == 0) { + session.lineColorIndex = editor.restoreColorIndex; + session.editingLineCustomIndex = -1; + } else if (session.pickerTargetMode == 1) { + session.bgColorIndex = editor.restoreColorIndex; + session.editingBgCustomIndex = -1; + } else { + session.comboColorIndex = editor.restoreColorIndex; + session.editingComboCustomIndex = -1; + } + } + + editor.playCloseSound(); + session.isColorPickerOpen = false; + } + + @Override + public boolean mouseClicked(double mouseX, double mouseY, int button) { + return inputHandler.onMouseClicked(mouseX, mouseY, button); + } + + @Override + public boolean mouseDragged(double mouseX, double mouseY, int button, double dragX, double dragY) { + return inputHandler.onMouseDragged(mouseX, mouseY, button, dragX, dragY); + } + + public boolean mouseReleased(double mouseX, double mouseY, int button) { + return inputHandler.onMouseReleased(mouseX, mouseY, button); + } + + public boolean keyPressed(net.minecraft.client.input.KeyEvent input) { + return inputHandler.onKeyPressed(input); + } + + public boolean charTyped(net.minecraft.client.input.CharacterEvent input) { + return inputHandler.onCharTyped(input); + } + + @Override + public void render(GuiGraphicsExtractor context, int mouseX, int mouseY, float delta) { + if (!session.isColorPickerOpen) return; + + if (session.isEyedropperActive) { + int sampled = ColorPickerGradients.readHoveredPixelColor(mouseX, mouseY); + // Trust a near-white reading only after it has held for a second frame: a real white target + // stays put, but the previous frame's white dropper icon flashing onto the sample point during + // a fast move lasts a single frame. Every other colour updates live and instantly. + boolean nearWhite = + ((sampled >> 16) & 0xFF) >= 0xF0 && ((sampled >> 8) & 0xFF) >= 0xF0 && (sampled & 0xFF) >= 0xF0; + if (!nearWhite || whiteSampleStreak >= 1) { + hoveredPixelColor = sampled; + } + whiteSampleStreak = nearWhite ? whiteSampleStreak + 1 : 0; + // Whole-screen zoom loupe for precise color picking, drawn before the eyedropper cursor so + // the cursor stays visible and is not captured into the loupe. + if (GlobalChestConfig.instance.magnifierEnabled) { + boolean circle = GlobalChestConfig.instance.magnifierShape == GlobalChestConfig.MagnifierShape.CIRCLE; + io.github.marcsanzdev.chestseparators.client.ui.MagnifierRenderer.render( + context, mouseX, mouseY, circle); + } + renderEyedropperCursor(context, mouseX, mouseY); + return; + } + + context.fill(0, 0, layout.screenWidth, layout.screenHeight, 0x77000000); + + // Re-draw only the 8 custom swatches above the dim layer so they remain visible and clickable. + int pCol3X = layout.paletteCol3X; + int pY = layout.paletteY; + int sS = layout.swatchSize; + int gap = 4; + int tabMode = session.pickerTargetMode; + int[] worldColors = ChestConfigManager.getInstance().getCustomColors(tabMode); + + for (int i = 0; i < 8; i++) { + int slotY = pY + (i * (sS + gap)); + editor.screenDrawLines.drawSwatch( + context, pCol3X, slotY, worldColors[i], 16 + i, mouseX, mouseY, true, tabMode); + } + + int w = layout.popupW; + int h = layout.popupH; + int x = layout.popupX; + int y = layout.popupY; + boolean isDark = GlobalChestConfig.instance.darkMode; + + io.github.marcsanzdev.chestseparators.client.ui.UiTheme.panel(context, x, y, w, h); + + Minecraft client = Minecraft.getInstance(); + + Component titleText = Component.translatable("window.chestseparators.edit_color").withStyle(ChatFormatting.BOLD); + int titleWidth = client.font.width(titleText); + int rightPanelStartX = layout.popupX + 155; + int maxTitleWidth = (rightPanelStartX - 5) - (x + 12); + + float titleScale = 1.0f; + if (titleWidth > maxTitleWidth) titleScale = (float) maxTitleWidth / titleWidth; + + context.pose().pushMatrix(); + context.pose().translate((float) (x + 12), (float) (y + 12 + (9 * (1.0f - titleScale)) / 2)); + context.pose().scale(titleScale, titleScale); + context.text(client.font, titleText, 0, 0, isDark ? 0xFFE0E0E0 : 0xFF333333, false); + context.pose().popMatrix(); + + Component instructionText = Component.translatable("gui.chestseparators.color_picker.instructions") + .withStyle(ChatFormatting.GRAY); + int maxTextWidth = 135; + float scale = 1.0f; + + java.util.List wrappedLines = + client.font.split(instructionText, maxTextWidth); + + // Auto-shrink: if the text wraps beyond 2 lines, reduce scale by 5% and recalculate + // (a smaller scale means a larger logical wrap width, allowing more text per line). + while (wrappedLines.size() > 2 && scale > 0.4f) { + scale -= 0.05f; + int wrapWidth = (int) (maxTextWidth / scale); + wrappedLines = client.font.split(instructionText, wrapWidth); + } + + context.pose().pushMatrix(); + + float yOffset = (2 - wrappedLines.size()) * (client.font.lineHeight + 2) * scale / 2.0f; + context.pose().translate((float) (x + 12), (float) (y + 26) + yOffset); + context.pose().scale(scale, scale); + + int instructY = 0; + for (net.minecraft.util.FormattedCharSequence line : wrappedLines) { + context.text(client.font, line, 0, instructY, isDark ? 0xFFFFFFFF : 0xFF222222, false); + instructY += client.font.lineHeight + 2; + } + context.pose().popMatrix(); + + int contentY = layout.popupY + 45; + int contentX = layout.popupX + 12; + + ColorPickerGradients.drawSaturationValueBox( + context, contentX, contentY, layout.pickerBoxSize, layout.pickerBoxSize, session.pickerHue); + io.github.marcsanzdev.chestseparators.client.ui.UiTheme.roundBorder( + context, contentX - 1, contentY - 1, 102, 102, 0x33FFFFFF); + + int cursorX = contentX + (int) (session.pickerSat * 100); + int cursorY = contentY + (int) ((1.0f - session.pickerVal) * 100); + context.outline(cursorX - 2, cursorY - 2, 5, 5, 0xFF000000); + context.outline(cursorX - 1, cursorY - 1, 3, 3, 0xFFFFFFFF); + + int hueX = contentX + 115; + ColorPickerGradients.drawHueBar(context, hueX, contentY, layout.pickerHueWidth, layout.pickerBoxSize); + io.github.marcsanzdev.chestseparators.client.ui.UiTheme.roundBorder( + context, hueX - 1, contentY - 1, 22, 102, 0x33FFFFFF); + + int hueCursorY = contentY + (int) (session.pickerHue * 100); + context.fill(hueX - 3, hueCursorY - 1, hueX + 23, hueCursorY + 2, 0xFF000000); + context.fill(hueX - 1, hueCursorY, hueX + 21, hueCursorY + 1, 0xFFFFFFFF); + + int rightPanelX = layout.popupX + 155; + int pSize = 64; + int previewX = rightPanelX + 6; + int previewY = layout.popupY + 10; + + if (session.pickerCurrentRGB == 0 && !editor.colorPickerModified) { + drawCheckerboard(context, previewX, previewY, pSize, pSize, 8); + drawColorBevel(context, previewX, previewY, pSize, pSize, 0xFF555555, false); + } else { + context.fill(previewX, previewY, previewX + pSize, previewY + pSize, 0xFF000000 | session.pickerCurrentRGB); + drawColorBevel(context, previewX, previewY, pSize, pSize, session.pickerCurrentRGB, false); + } + + int textX = rightPanelX + 5; + int fieldY = layout.popupY + 84; + + int dynamicColor = isDark ? 0xFFFFFFFF : 0xFF222222; + if (session.pickerCurrentRGB != 0 || editor.colorPickerModified) { + dynamicColor = session.pickerCurrentRGB | 0xFF000000; + } + + context.text(client.font, "#:", textX, fieldY + 1, dynamicColor, true); + context.text(client.font, "R:", textX, fieldY + 21, 0xFFFF5555, true); + context.text(client.font, "G:", textX, fieldY + 37, 0xFF55FF55, true); + context.text(client.font, "B:", textX, fieldY + 53, 0xFF5555FF, true); + + if (hexField != null) hexField.extractRenderState(context, mouseX, mouseY, delta); + if (rField != null) rField.extractRenderState(context, mouseX, mouseY, delta); + if (gField != null) gField.extractRenderState(context, mouseX, mouseY, delta); + if (bField != null) bField.extractRenderState(context, mouseX, mouseY, delta); + + super.render(context, mouseX, mouseY, delta); + + // Custom color slot tooltips are drawn last so they layer above the picker window. + for (int i = 0; i < 8; i++) { + int slotY = pY + (i * (sS + gap)); + if (editor.isHovering(pCol3X, slotY, sS, sS, mouseX, mouseY)) { + context.setTooltipForNextFrame( + client.font, + Component.translatable("color.chestseparators.custom", (i + 1)), + mouseX, + mouseY); + } + } + } + + private void renderEyedropperCursor(GuiGraphicsExtractor context, int mx, int my) { + // The diagonal dropper's tip sits at (3.47, 12.53) within its 16px footprint; offset the sprite so + // that tip lands exactly on (mx, my) — the pixel that readHoveredPixelColor(mx, my) samples. + int iconX = mx - 3; + int iconY = my - 13; + + int previewX = mx + 18; + int previewY = my - 24; + int pw = 16; + int ph = 16; + + context.fill(previewX, previewY, previewX + pw, previewY + ph, 0xFF000000 | hoveredPixelColor); + drawColorBevel(context, previewX, previewY, pw, ph, hoveredPixelColor, false); + + com.mojang.renderpearl.api.pipeline.RenderPipeline pipeline = net.minecraft.client.renderer.RenderPipelines.GUI_TEXTURED; + context.blit( + pipeline, + io.github.marcsanzdev.chestseparators.client.ModTextures.ICON_SM_EYEDROPPER, + iconX, + iconY, + 0.0F, + 0.0F, + 16, + 16, + 128, + 128, + 128, + 128, + -1); + } +} diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/screens/ScreenDrawLines.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/screens/ScreenDrawLines.java new file mode 100644 index 0000000..2861384 --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/screens/ScreenDrawLines.java @@ -0,0 +1,580 @@ +package io.github.marcsanzdev.chestseparators.client.ui.screens; + +import io.github.marcsanzdev.chestseparators.client.ModTextures; +import io.github.marcsanzdev.chestseparators.client.ui.ChestSeparatorsEditor; +import io.github.marcsanzdev.chestseparators.client.ui.widgets.ToolButtonWidget; +import io.github.marcsanzdev.chestseparators.client.ui.widgets.WideButtonWidget; +import io.github.marcsanzdev.chestseparators.data.ChestConfigManager; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiGraphicsExtractor; +import net.minecraft.network.chat.Component; +import net.minecraft.ChatFormatting; +import net.minecraft.resources.Identifier; + +public class ScreenDrawLines extends AbstractEditorScreen { + + private ToolButtonWidget btnPencilArea; + private ToolButtonWidget btnEraserArea; + private ToolButtonWidget btnClear; + private ToolButtonWidget btnPencilTrace; + private ToolButtonWidget btnEraserTrace; + private ToolButtonWidget btnColorPicker; + + public static final int[] STANDARD_PALETTE = { + 0xFF993333, 0xFFD87F33, 0xFFE5E533, 0xFF7FCC19, + 0xFF667F33, 0xFF4C7F99, 0xFF6699D8, 0xFF334CB2, + 0xFF7F3FB2, 0xFFB24CD8, 0xFFF27FA5, 0xFF664C33, + 0xFFFFFFFF, 0xFF999999, 0xFF4C4C4C, 0xFF191919 + }; + + public static final String[] STANDARD_COLOR_KEYS = { + "red", "orange", "yellow", "lime", + "green", "cyan", "light_blue", "blue", + "purple", "magenta", "pink", "brown", + "white", "light_gray", "gray", "black" + }; + + long lastCustomColorClickTime = 0; + int lastCustomColorClickIndex = -1; + + private long btnCopyClickTime = 0; + private long btnPasteClickTime = 0; + private long btnUndoClickTime = 0; + private long btnRedoClickTime = 0; + private long btnClearClickTime = 0; + private long btnColorPickerClickTime = 0; + + private final SeparatorPreviewRenderer previewRenderer; + private final SeparatorDragCommitter dragCommitter; + private final SeparatorDragInput dragInput; + private final DrawLinesClickHandler clickHandler; + + public ScreenDrawLines(ChestSeparatorsEditor editor) { + super(editor); + this.previewRenderer = new SeparatorPreviewRenderer(this); + this.dragCommitter = new SeparatorDragCommitter(this); + this.dragInput = new SeparatorDragInput(this); + this.clickHandler = new DrawLinesClickHandler(this); + } + + /** Applies the in-progress drag to the saved configuration. Delegates to {@link SeparatorDragCommitter}. */ + public void commitDrag(double mouseX, double mouseY) { + dragCommitter.commit(mouseX, mouseY); + } + + public boolean mouseDragged(double mouseX, double mouseY, int button, double dragX, double dragY) { + return dragInput.onDrag(mouseX, mouseY); + } + + /** + * Switches the active tab to a paint tool (0 = area, 1 = trace). If the eraser was active (color + * index -1), the previously picked color is restored instead of resetting to red. + */ + private void selectPaintTool(int toolMode) { + int tabMode = session.currentTab; + if (tabMode == 0) { + session.lineToolMode = toolMode; + if (session.lineColorIndex == -1) { + session.lineColorIndex = session.lineColorBeforeErase; + session.editingLineCustomIndex = session.lineCustomBeforeErase; + } + } else if (tabMode == 1) { + session.bgToolMode = toolMode; + if (session.bgColorIndex == -1) { + session.bgColorIndex = session.bgColorBeforeErase; + session.editingBgCustomIndex = session.bgCustomBeforeErase; + } + } else { + session.comboToolMode = toolMode; + if (session.comboColorIndex == -1) { + session.comboColorIndex = session.comboColorBeforeErase; + session.editingComboCustomIndex = session.comboCustomBeforeErase; + } + } + editor.playClickSound(1.0f); + } + + /** + * Switches the active tab to an eraser tool (0 = area, 1 = trace), remembering the current color + * so {@link #selectPaintTool} can restore it when the user switches back to a paint tool. + */ + private void selectEraseTool(int toolMode) { + int tabMode = session.currentTab; + if (tabMode == 0) { + session.lineToolMode = toolMode; + if (session.lineColorIndex != -1) { + session.lineColorBeforeErase = session.lineColorIndex; + session.lineCustomBeforeErase = session.editingLineCustomIndex; + } + session.lineColorIndex = -1; + session.editingLineCustomIndex = -1; + } else if (tabMode == 1) { + session.bgToolMode = toolMode; + if (session.bgColorIndex != -1) { + session.bgColorBeforeErase = session.bgColorIndex; + session.bgCustomBeforeErase = session.editingBgCustomIndex; + } + session.bgColorIndex = -1; + session.editingBgCustomIndex = -1; + } else { + session.comboToolMode = toolMode; + if (session.comboColorIndex != -1) { + session.comboColorBeforeErase = session.comboColorIndex; + session.comboCustomBeforeErase = session.editingComboCustomIndex; + } + session.comboColorIndex = -1; + session.editingComboCustomIndex = -1; + } + editor.playClickSound(1.0f); + } + + /** Top edge of the left tools/colours sidebar. */ + private int sidebarTop() { + return layout.guiY + editor.getSidebarYOffset() - 4; + } + + /** Height of that sidebar: down to the last custom colour swatch, plus a small margin. */ + private int sidebarHeight() { + int bottomOfLastColor = layout.paletteY + (7 * (layout.swatchSize + 4)) + layout.swatchSize; + return (bottomOfLastColor - sidebarTop()) + 8; + } + + @Override + protected void buildWidgets() { + // --- 1. RIGHT ACTION PANEL (Copy, Paste, Undo, Redo) --- + int rightX = layout.rightX; + int btnW = layout.btnW; + int bH = layout.bH; + + // Centred against the left sidebar rather than pinned to the top of the container: with only four + // buttons they otherwise sat far above the panel they visually pair with. + int blockHeight = 3 * 24 + bH; // four rows on a 24px pitch + int sy = Math.max(4, sidebarTop() + (sidebarHeight() - blockHeight) / 2); + + WideButtonWidget btnCopy = new WideButtonWidget( + rightX, + sy, + btnW, + bH, + Component.translatable("button.chestseparators.copy_layout").getString(), + ModTextures.ICON_SM_COPY, + () -> { + btnCopyClickTime = System.currentTimeMillis(); + ChestConfigManager.getInstance().copyAllToClipboard(); + editor.showStatus(Component.translatable("message.chestseparators.layout_copied"), ChatFormatting.GRAY); + editor.playClickSound(1.0f); + }); + btnCopy.keepNormalTextColor = true; + btnCopy.tooltipText = + Component.translatable("tooltip.chestseparators.desc.copy_layout").getString(); + btnCopy.texSize = 128; + widgets.add(btnCopy); + + WideButtonWidget btnPaste = new WideButtonWidget( + rightX, + sy + 24, + btnW, + bH, + Component.translatable("button.chestseparators.paste_layout").getString(), + ModTextures.ICON_SM_PASTE, + () -> { + btnPasteClickTime = System.currentTimeMillis(); + if (ChestConfigManager.getInstance().hasClipboardData()) { + ChestConfigManager.getInstance().saveSnapshot(); + ChestConfigManager.getInstance().pasteFromClipboard(); + editor.saveSmart(); + editor.showStatus(Component.translatable("message.chestseparators.layout_pasted"), ChatFormatting.GREEN); + editor.playClickSound(1.0f); + } + }); + btnPaste.keepNormalTextColor = true; + btnPaste.tooltipText = + Component.translatable("tooltip.chestseparators.desc.paste_layout").getString(); + btnPaste.texSize = 128; + widgets.add(btnPaste); + + WideButtonWidget btnUndo = new WideButtonWidget( + rightX, + sy + 48, + btnW, + bH, + Component.translatable("button.chestseparators.undo_action").getString(), + ModTextures.ICON_SM_UNDO, + () -> { + btnUndoClickTime = System.currentTimeMillis(); + editor.applyUndoRedo(ChestConfigManager.getInstance().undo(), false); + }); + btnUndo.keepNormalTextColor = true; + btnUndo.tooltipText = + Component.translatable("tooltip.chestseparators.desc.undo_action").getString(); + btnUndo.texSize = 128; + widgets.add(btnUndo); + + WideButtonWidget btnRedo = new WideButtonWidget( + rightX, + sy + 72, + btnW, + bH, + Component.translatable("button.chestseparators.redo_action").getString(), + ModTextures.ICON_SM_REDO, + () -> { + btnRedoClickTime = System.currentTimeMillis(); + editor.applyUndoRedo(ChestConfigManager.getInstance().redo(), true); + }); + btnRedo.keepNormalTextColor = true; + btnRedo.tooltipText = + Component.translatable("tooltip.chestseparators.desc.redo_action").getString(); + btnRedo.texSize = 128; + widgets.add(btnRedo); + + // --- 2. LEFT SIDEBAR TOOLS --- + int sx = layout.sidebarX; + int contentX = sx + 7; + int currentY = layout.guiY + editor.getSidebarYOffset(); + int row2Y = currentY + 22; + + btnPencilArea = new ToolButtonWidget( + contentX, + currentY, + ModTextures.PENCIL_BASE, + Component.translatable("tooltip.chestseparators.draw_area").getString(), + () -> selectPaintTool(0)); + + btnEraserArea = new ToolButtonWidget( + contentX + 22, + currentY, + ModTextures.ICON_SM_ERASER_AREA, + Component.translatable("tooltip.chestseparators.erase_area").getString(), + () -> selectEraseTool(0)); + + btnClear = new ToolButtonWidget( + contentX + 44, + currentY, + ModTextures.ICON_SM_TRASH, + // Placeholder for the first frame only; updateWidgetStates() renames it per active tab. + Component.translatable("tooltip.chestseparators.clear_lines").getString(), + () -> { + btnClearClickTime = System.currentTimeMillis(); + ChestConfigManager.getInstance().saveSnapshot(); + int tabMode = session.currentTab; + if (tabMode == 0 || tabMode == 2) + ChestConfigManager.getInstance().clearAllLines(); + if (tabMode == 1 || tabMode == 2) + ChestConfigManager.getInstance().clearAllBackgrounds(); + editor.saveSmart(); + editor.showStatus(Component.translatable("message.chestseparators.cleared"), ChatFormatting.RED); + editor.playClickSound(0.8f); + }); + + btnPencilTrace = new ToolButtonWidget( + contentX, + row2Y, + ModTextures.PENCIL_BASE, + Component.translatable("tooltip.chestseparators.draw_trace").getString(), + () -> selectPaintTool(1)); + + btnEraserTrace = new ToolButtonWidget( + contentX + 22, + row2Y, + ModTextures.ICON_SM_ERASER_TRACE, + Component.translatable("tooltip.chestseparators.erase_trace").getString(), + () -> selectEraseTool(1)); + + btnColorPicker = new ToolButtonWidget( + contentX + 44, + row2Y, + ModTextures.ICON_SM_PALETTE, + Component.translatable("tooltip.chestseparators.open_palette").getString(), + () -> { + btnColorPickerClickTime = System.currentTimeMillis(); + int tabMode = session.currentTab; + if (tabMode == 0) { + if (session.editingLineCustomIndex == -1) { + session.editingLineCustomIndex = 0; + session.lineColorIndex = 16; + } + editor.openColorPicker( + ChestConfigManager.getInstance().getCustomColors(0)[session.editingLineCustomIndex], 0); + } else if (tabMode == 1) { + if (session.editingBgCustomIndex == -1) { + session.editingBgCustomIndex = 0; + session.bgColorIndex = 16; + } + editor.openColorPicker( + ChestConfigManager.getInstance().getCustomColors(1)[session.editingBgCustomIndex], 1); + } else { + if (session.editingComboCustomIndex == -1) { + session.editingComboCustomIndex = 0; + session.comboColorIndex = 16; + } + editor.openColorPicker( + ChestConfigManager.getInstance().getCustomColors(2)[session.editingComboCustomIndex], + 2); + } + editor.playClickSound(1.0f); + }); + + // Smooth (vector) tool icons: sample at 128px with linear filtering. + btnPencilArea.texSize = 128; + btnEraserArea.texSize = 128; + btnClear.texSize = 128; + btnPencilTrace.texSize = 128; + btnEraserTrace.texSize = 128; + btnColorPicker.texSize = 128; + + widgets.add(btnPencilArea); + widgets.add(btnEraserArea); + widgets.add(btnClear); + widgets.add(btnPencilTrace); + widgets.add(btnEraserTrace); + widgets.add(btnColorPicker); + } + + @Override + public void render(GuiGraphicsExtractor context, int mouseX, int mouseY, float delta) { + // Drive the fade-to-empty preview while the Clear button is hovered. + // Suppressed while the colour picker is open: the whole toolbar is inert then, so hovering the trash + // button must not paint the clear wash on the slots behind the picker. + session.clearPreviewTab = (!session.isColorPickerOpen && btnClear != null && btnClear.isHovering(mouseX, mouseY)) + ? session.currentTab : -1; + + if (session.isEyedropperActive) { + return; + } + + updateWidgetStates(); + + // 1. Draw Left Sidebar Background + io.github.marcsanzdev.chestseparators.client.ui.UiTheme.panel( + context, layout.sidebarX, sidebarTop(), layout.sidebarWidth, sidebarHeight()); + + // While the color picker is open, pass (-1, -1) as mouse coordinates so background + // buttons do not react to hover or draw tooltips behind the picker window. + int bgMouseX = session.isColorPickerOpen ? -1 : mouseX; + int bgMouseY = session.isColorPickerOpen ? -1 : mouseY; + + // 2. Draw Widgets (Tools and Action Panel) + super.render(context, bgMouseX, bgMouseY, delta); + + // 3. Draw Palette + drawPaletteArea(context, mouseX, mouseY, session.currentTab); + + // 4. Draw Tabs + drawTabs(context, mouseX, mouseY); + + // 5. Draw Grid Previews + previewRenderer.renderDragPreview(context, mouseX, mouseY); + if (!session.isDraggingLine && !session.isColorPickerOpen) { + previewRenderer.renderHoverPreview(context, mouseX, mouseY); + } + } + + private void updateWidgetStates() { + int tabMode = session.currentTab; + int tMode = (tabMode == 0) ? session.lineToolMode : (tabMode == 1 ? session.bgToolMode : session.comboToolMode); + int cIndex = (tabMode == 0) + ? session.lineColorIndex + : (tabMode == 1 ? session.bgColorIndex : session.comboColorIndex); + + int dynamicColor = 0; + if (tabMode == 0) dynamicColor = getCurrentSelectedLineColorValue(); + else if (tabMode == 1) dynamicColor = getCurrentSelectedBgColorValue(); + else if (tabMode == 2) dynamicColor = getCurrentSelectedComboColorValue(); + if (dynamicColor == 0) dynamicColor = 0xFFFFFF; + + // The trash button clears whatever the active tab edits, so its tooltip names that instead of the + // generic "layer" — it is the only cue for what a click is about to wipe. + btnClear.tooltipText = Component.translatable( + tabMode == 0 + ? "tooltip.chestseparators.clear_lines" + : tabMode == 1 + ? "tooltip.chestseparators.clear_backgrounds" + : "tooltip.chestseparators.clear_both") + .getString(); + + // Tool Active States + btnPencilArea.isActive = (tMode == 0 && cIndex != ChestSeparatorsEditor.TOOL_ERASER_ID); + btnPencilTrace.isActive = (tMode == 1 && cIndex != ChestSeparatorsEditor.TOOL_ERASER_ID); + btnEraserArea.isActive = (tMode == 0 && cIndex == ChestSeparatorsEditor.TOOL_ERASER_ID); + btnEraserTrace.isActive = (tMode == 1 && cIndex == ChestSeparatorsEditor.TOOL_ERASER_ID); + + // Tool Icons & Colors + // The two paint buttons show the AREA / TRACE mode icon (dashed square / wavy line) drawn ENTIRELY + // in the current paint colour; the tool type (pencil/brush/combo) is conveyed by the active tab. + btnPencilArea.baseIcon = ModTextures.ICON_SM_AREA_SELECT; + btnPencilArea.maskIcon = null; + btnPencilArea.baseUsesDynamicColor = true; + btnPencilArea.dynamicColor = dynamicColor; + + btnPencilTrace.baseIcon = ModTextures.ICON_SM_TRACE_SELECT; + btnPencilTrace.maskIcon = null; + btnPencilTrace.baseUsesDynamicColor = true; + btnPencilTrace.dynamicColor = dynamicColor; + btnPencilTrace.baseOffsetX = 0; + btnPencilTrace.maskOffsetX = 0; + + // Right Panel Disabled States + // Right Panel Disabled States & Animations + if (widgets.size() >= 4) { + widgets.get(0).isActive = (System.currentTimeMillis() - btnCopyClickTime < 150); + + widgets.get(1).isActive = (System.currentTimeMillis() - btnPasteClickTime < 150); + widgets.get(1).isDisabled = !ChestConfigManager.getInstance().hasClipboardData(); + + widgets.get(2).isActive = (System.currentTimeMillis() - btnUndoClickTime < 150); + widgets.get(2).isDisabled = !ChestConfigManager.getInstance().canUndo(); + + widgets.get(3).isActive = (System.currentTimeMillis() - btnRedoClickTime < 150); + widgets.get(3).isDisabled = !ChestConfigManager.getInstance().canRedo(); + } + + if (btnClear != null) { + btnClear.isActive = (System.currentTimeMillis() - btnClearClickTime < 150); + } + + if (btnColorPicker != null) { + btnColorPicker.isActive = (System.currentTimeMillis() - btnColorPickerClickTime < 150); + } + } + + @Override + public boolean mouseClicked(double mouseX, double mouseY, int button) { + return clickHandler.onMouseClicked(mouseX, mouseY, button); + } + + public void drawSwatch( + GuiGraphicsExtractor context, + int x, + int y, + int color, + int index, + int mouseX, + int mouseY, + boolean isCustom, + int tabMode) { + boolean disabled = session.isColorPickerOpen && !isCustom; + int selectedIndexToCheck = (tabMode == 0) + ? session.lineColorIndex + : (tabMode == 1 ? session.bgColorIndex : session.comboColorIndex); + boolean selected = (index == selectedIndexToCheck); + boolean hover = !disabled && editor.isHovering(x, y, layout.swatchSize, layout.swatchSize, mouseX, mouseY); + + if (color == 0) { + context.fill(x, y, x + layout.swatchSize, y + layout.swatchSize, 0xFF555555); + int half = layout.swatchSize / 2; + context.fill(x, y, x + half, y + half, 0xFF333333); + context.fill(x + half, y + half, x + layout.swatchSize, y + layout.swatchSize, 0xFF333333); + drawStandardBevel(context, x, y, layout.swatchSize, layout.swatchSize, selected); + } else { + context.fill(x, y, x + layout.swatchSize, y + layout.swatchSize, 0xFF000000 | color); + drawColorBevel(context, x, y, layout.swatchSize, layout.swatchSize, color, selected); + } + + if (hover && !selected) + context.outline( + x, y, layout.swatchSize, layout.swatchSize, isCustom ? 0x80FFFFFF : 0xFFFFFFFF); + if (disabled) context.fill(x, y, x + layout.swatchSize, y + layout.swatchSize, 0x80000000); + } + + private void drawPaletteArea(GuiGraphicsExtractor context, int mouseX, int mouseY, int tabMode) { + int pY = layout.paletteY; + int col1X = layout.paletteCol1X; + int col2X = layout.paletteCol2X; + int col3X = layout.paletteCol3X; + + for (int i = 0; i < 16; i++) { + int x = (i / 8 == 0) ? col1X : col2X; + int y = pY + ((i % 8) * (layout.swatchSize + 4)); + drawSwatch(context, x, y, STANDARD_PALETTE[i], i, mouseX, mouseY, false, tabMode); + if (!session.isColorPickerOpen + && editor.isHovering(x, y, layout.swatchSize, layout.swatchSize, mouseX, mouseY)) { + context.setTooltipForNextFrame( + Minecraft.getInstance().font, + Component.translatable("color.minecraft." + STANDARD_COLOR_KEYS[i]), + mouseX, + mouseY); + } + } + + int[] worldColors = ChestConfigManager.getInstance().getCustomColors(tabMode); + for (int i = 0; i < 8; i++) { + int y = pY + (i * (layout.swatchSize + 4)); + drawSwatch(context, col3X, y, worldColors[i], 16 + i, mouseX, mouseY, true, tabMode); + if (!session.isColorPickerOpen + && editor.isHovering(col3X, y, layout.swatchSize, layout.swatchSize, mouseX, mouseY)) { + context.setTooltipForNextFrame( + Minecraft.getInstance().font, + Component.translatable("color.chestseparators.custom", (i + 1)), + mouseX, + mouseY); + } + } + } + + private void drawTabs(GuiGraphicsExtractor context, int mouseX, int mouseY) { + int tabX = layout.sidebarX - 20; + int startY = layout.guiY + editor.getSidebarYOffset() + 10; + + for (int i = 0; i < 3; i++) { + int tabY = startY + (i * 24); + boolean isSelected = (session.currentTab == i); + boolean hover = !session.isColorPickerOpen && editor.isHovering(tabX, tabY, 20, 20, mouseX, mouseY); + // The tab reaches flush to the sidebar (right edge = sidebarX) and is embedded into it: its + // right edge has no border/gap so it merges into the panel, and a selected tab shrinks anchored + // to that right edge so it never pulls away from the sidebar. + io.github.marcsanzdev.chestseparators.client.ui.UiTheme.tab( + context, + tabX, + tabY, + 20, + 20, + hover, + isSelected, + io.github.marcsanzdev.chestseparators.client.ui.UiTheme.ATTACH_RIGHT); + + Identifier icon = (i == 0) + ? ModTextures.ICON_SM_PENCIL + : (i == 1) ? ModTextures.ICON_SM_BRUSH : ModTextures.ICON_SM_COMBO; + com.mojang.renderpearl.api.pipeline.RenderPipeline pipeline = net.minecraft.client.renderer.RenderPipelines.GUI_TEXTURED; + if (isSelected) { + io.github.marcsanzdev.chestseparators.client.ui.UiTheme.pushActiveContent(context, tabX, tabY, 20, 20); + } + context.blit(pipeline, icon, tabX + 2, tabY + 2, 0.0F, 0.0F, 16, 16, 128, 128, 128, 128, -1); + if (isSelected) { + context.pose().popMatrix(); + } + + if (hover) { + Component name = (i == 0) + ? Component.translatable("tooltip.chestseparators.tab_lines") + : (i == 1) + ? Component.translatable("tooltip.chestseparators.tab_backgrounds") + : Component.translatable("tooltip.chestseparators.tab_combo"); + context.setTooltipForNextFrame(Minecraft.getInstance().font, name, mouseX, mouseY); + } + } + } + + public int getCurrentSelectedLineColorValue() { + return resolveSelectedColor(session.lineColorIndex, 0); + } + + public int getCurrentSelectedBgColorValue() { + return resolveSelectedColor(session.bgColorIndex, 1); + } + + public int getCurrentSelectedComboColorValue() { + return resolveSelectedColor(session.comboColorIndex, 2); + } + + /** + * Resolves the ARGB value a color index points to: 0 for the eraser, a standard palette entry + * for indices 0-15, or a world custom color (for the given tab) for indices 16-23. + */ + private int resolveSelectedColor(int colorIndex, int tabMode) { + if (colorIndex == ChestSeparatorsEditor.TOOL_ERASER_ID) return 0; + if (colorIndex < 16) return STANDARD_PALETTE[colorIndex]; + if (colorIndex < 24) return ChestConfigManager.getInstance().getCustomColors(tabMode)[colorIndex - 16]; + return 0; + } +} diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/screens/ScreenEditFilter.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/screens/ScreenEditFilter.java new file mode 100644 index 0000000..9fe8e0b --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/screens/ScreenEditFilter.java @@ -0,0 +1,1162 @@ +package io.github.marcsanzdev.chestseparators.client.ui.screens; + +import com.mojang.blaze3d.platform.InputConstants; +import io.github.marcsanzdev.chestseparators.client.EditorState; +import io.github.marcsanzdev.chestseparators.client.ModTextures; +import io.github.marcsanzdev.chestseparators.client.ui.ChestSeparatorsEditor; +import io.github.marcsanzdev.chestseparators.client.ui.UiColors; +import io.github.marcsanzdev.chestseparators.client.ui.widgets.ActionIconButtonWidget; +import io.github.marcsanzdev.chestseparators.client.ui.widgets.CustomWidget; +import io.github.marcsanzdev.chestseparators.client.ui.widgets.WideButtonWidget; +import io.github.marcsanzdev.chestseparators.config.GlobalChestConfig; +import io.github.marcsanzdev.chestseparators.data.ChestConfigManager; +import java.util.ArrayList; +import java.util.List; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiGraphicsExtractor; +import net.minecraft.world.item.Item; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.network.chat.Component; +import net.minecraft.ChatFormatting; + +public class ScreenEditFilter extends AbstractEditorScreen { + + // Package-private so the extracted FilterClickHandler can route clicks to the popups. + final List unsavedPopupWidgets = new ArrayList<>(); + final List expelPopupWidgets = new ArrayList<>(); + + /** How long the held row takes to fly from where it was grabbed to the cursor. */ + static final long PICKUP_MS = 140L; + /** How long the list takes to settle after a drop, rows sliding to their new places. */ + static final long DROP_MS = 170L; + /** How long a row takes to shrink away after being dragged out of the filter onto the grid. */ + static final long DELETE_MS = 220L; + + private final FilterPanelRenderer panelRenderer; + private final FilterClickHandler clickHandler; + private io.github.marcsanzdev.chestseparators.client.ui.widgets.InventoryRetentionSlider quantitySlider; + + public ScreenEditFilter(ChestSeparatorsEditor editor) { + super(editor); + this.panelRenderer = new FilterPanelRenderer(this); + this.clickHandler = new FilterClickHandler(this); + } + + @Override + public boolean mouseClicked(double mouseX, double mouseY, int button) { + return clickHandler.onMouseClicked(mouseX, mouseY, button); + } + + @Override + public boolean mouseDragged(double mouseX, double mouseY, int button, double dragX, double dragY) { + return quantitySlider != null && quantitySlider.mouseDragged(mouseX, button); + } + + public void stopRetentionDrag() { + if (quantitySlider != null) quantitySlider.stopDrag(); + } + + private boolean scrollRetentionSlider(double mouseX, double mouseY, double verticalAmount) { + return quantitySlider != null && quantitySlider.mouseScrolled(mouseX, mouseY, verticalAmount); + } + + @Override + public void init() { + super.init(); + session.isUnsavedPopupOpen = false; + session.isExpelPopupOpen = false; + + unsavedPopupWidgets.clear(); + buildUnsavedPopupWidgets(); + + expelPopupWidgets.clear(); + buildExpelPopupWidgets(); + + // Every popup button closes the popup, so flash it before acting (else the press is never seen). + for (CustomWidget w : unsavedPopupWidgets) w.deferAction = true; + for (CustomWidget w : expelPopupWidgets) w.deferAction = true; + } + + private void buildUnsavedPopupWidgets() { + unsavedPopupWidgets.add(new ActionIconButtonWidget( + layout.conflictPopupX + 10, + layout.conflictPopupY + 45, + 240, + 16, + "1. " + + Component.translatable("button.chestseparators.save_and_exit") + .getString(), + null, + 0xFF2D852D, + () -> { + ChestConfigManager.getInstance().saveWhitelistSnapshot(); + editor.saveCurrentGroup(); + session.selectedSlots.clear(); + session.isUnsavedPopupOpen = false; + editor.toggleState(EditorState.VIEW_GROUPS); + editor.playClickSound(1.0f); + })); + + unsavedPopupWidgets.add(new ActionIconButtonWidget( + layout.conflictPopupX + 10, + layout.conflictPopupY + 63, + 240, + 16, + "2. " + + Component.translatable("button.chestseparators.discard_changes") + .getString(), + null, + 0xFF852D2D, + () -> { + session.selectedSlots.clear(); + session.isUnsavedPopupOpen = false; + editor.toggleState(EditorState.VIEW_GROUPS); + editor.playClickSound(1.0f); + })); + + unsavedPopupWidgets.add(new ActionIconButtonWidget( + layout.conflictPopupX + 10, + layout.conflictPopupY + 81, + 240, + 16, + "3. " + Component.translatable("button.chestseparators.cancel").getString(), + null, + 0xFF444444, + () -> { + session.isUnsavedPopupOpen = false; + editor.playClickSound(0.8f); + })); + } + + private void buildExpelPopupWidgets() { + expelPopupWidgets.add(new ActionIconButtonWidget( + layout.conflictPopupX + 10, + layout.conflictPopupY + 63, + 240, + 16, + "1. " + Component.translatable("button.chestseparators.accept_expel").getString(), + null, + 0xFF2D852D, + () -> { + ChestConfigManager.getInstance().saveWhitelistSnapshot(); + editor.saveCurrentGroup(); + session.selectedSlots.clear(); + session.isExpelPopupOpen = false; + editor.toggleState(EditorState.VIEW_GROUPS); + editor.playClickSound(1.0f); + })); + + expelPopupWidgets.add(new ActionIconButtonWidget( + layout.conflictPopupX + 10, + layout.conflictPopupY + 81, + 240, + 16, + "2. " + Component.translatable("button.chestseparators.cancel").getString(), + null, + 0xFF444444, + () -> { + session.isExpelPopupOpen = false; + editor.playClickSound(0.8f); + })); + } + + /** + * The item being dragged, drawn following the cursor: slightly smaller than in the list and washed + * down so it reads as "held" rather than as another entry. Items are rendered by their own pipeline + * and cannot simply be given an alpha, so the translucency is faked by laying the panel colour back + * over it — the same trick the push/pull ghost preview uses. + */ + private void drawReorderGhost(GuiGraphicsExtractor context) { + drawDeleteAnim(context); + + if (session.reorderDragItem != null) { + // Pick-up: the row travels from wherever it was grabbed to the cursor, and the bar + // (background, name, cross) fades in around the icon on the way — so a grid item visibly + // becomes an entry instead of popping into one. + float t = net.minecraft.util.Mth.clamp( + (System.currentTimeMillis() - session.reorderStartTime) / (float) PICKUP_MS, 0f, 1f); + float eased = 1f - (1f - t) * (1f - t) * (1f - t); // ease-out cubic + int rowW = layout.listW - 20; + int restX = session.reorderMouseX - (int) (rowW * 0.9f) / 2; + int restY = session.reorderMouseY - (int) (18 * 0.9f) / 2; + drawGhostRow( + context, + session.reorderDragItem, + Math.round(session.reorderOriginX + (restX - session.reorderOriginX) * eased), + Math.round(session.reorderOriginY + (restY - session.reorderOriginY) * eased), + eased, + 1f, + isRemovalDrop(session.reorderMouseX, session.reorderMouseY)); + return; + } + + if (session.dropGhostItem == null) return; + float t = (System.currentTimeMillis() - session.dropGhostStart) / (float) DROP_MS; + if (t >= 1f) { + session.dropGhostItem = null; + return; + } + // Landing: the exact reverse of the pick-up — it flies into its new row and the bar fades away. + float eased = 1f - (1f - t) * (1f - t) * (1f - t); + drawGhostRow( + context, + session.dropGhostItem, + Math.round(session.dropGhostFromX + (session.dropGhostToX - session.dropGhostFromX) * eased), + Math.round(session.dropGhostFromY + (session.dropGhostToY - session.dropGhostFromY) * eased), + 1f - eased, + 1f, + false); + } + + /** The dropped row collapsing in on itself, the visual counterpart of leaving the filter. */ + private void drawDeleteAnim(GuiGraphicsExtractor context) { + if (session.deleteAnimItem == null) return; + float t = (System.currentTimeMillis() - session.deleteAnimStart) / (float) DELETE_MS; + if (t >= 1f) { + session.deleteAnimItem = null; + return; + } + float eased = 1f - (1f - t) * (1f - t) * (1f - t); + drawGhostRow( + context, + session.deleteAnimItem, + session.deleteAnimX, + session.deleteAnimY, + 1f - eased, + 1f - eased, + true); + } + + /** + * Draws the floating row at {@code (gx, gy)}. {@code presence} fades the bar around the item icon, + * {@code shrink} scales the whole row about its own centre, and {@code danger} tints it red to say + * that letting go here drops the item out of the filter. + */ + private void drawGhostRow( + GuiGraphicsExtractor context, String itemId, int gx, int gy, float presence, float shrink, boolean danger) { + Item item = BuiltInRegistries.ITEM.getValue(net.minecraft.resources.Identifier.tryParse(itemId)); + if (item == null) return; + + Minecraft client = Minecraft.getInstance(); + int rowW = layout.listW - 20; // the row's width inside the list's inset + int rowH = 18; + shrink = net.minecraft.util.Mth.clamp(shrink, 0f, 1f); + float scale = 0.9f * shrink; + int barAlpha = (int) (0xFF * net.minecraft.util.Mth.clamp(presence, 0f, 1f)); + + // Shrinking pulls the row towards its own centre rather than towards its top-left corner, so it + // collapses in place instead of sliding up and to the left as it goes. + int drawnW = (int) (rowW * 0.9f * shrink); + int drawnH = (int) (rowH * 0.9f * shrink); + gx += ((int) (rowW * 0.9f) - drawnW) / 2; + gy += ((int) (rowH * 0.9f) - drawnH) / 2; + + context.pose().pushMatrix(); + context.pose().translate(gx, gy); + context.pose().scale(scale, scale); + + io.github.marcsanzdev.chestseparators.client.ui.UiTheme.roundRect( + context, 0, 0, rowW, rowH, ((barAlpha * 0xC8 / 0xFF) << 24) | (danger ? 0x2A1214 : 0x121218)); + io.github.marcsanzdev.chestseparators.client.ui.UiTheme.roundBorder( + context, + 0, + 0, + rowW, + rowH, + danger ? (barAlpha << 24) | 0xFF5555 : ((barAlpha * 0x55 / 0xFF) << 24) | 0xFFFFFF); + + context.item(item.getDefaultInstance(), 3, 1); + + String name = item.getName(item.getDefaultInstance()).getString(); + context.pose().pushMatrix(); + float textScale = 0.75f; + context.pose().scale(textScale, textScale); + int maxNameW = (int) ((rowW - 42) / textScale); + if (client.font.width(name) > maxNameW) { + name = client.font.plainSubstrByWidth(name, maxNameW - 6) + "..."; + } + context.text( + client.font, + name, + (int) (22 / textScale), + (int) (6 / textScale), + (barAlpha << 24) | (danger ? 0xFFAAAA : 0xFFFFFF), + false); + context.pose().popMatrix(); + + context.text( + client.font, "x", rowW - 13, 5, (barAlpha << 24) | (danger ? 0xFF5555 : 0xAAAAAA), false); + context.pose().popMatrix(); + + // Items are drawn by their own pipeline and take no alpha, so the "held" translucency is faked by + // laying the panel colour back over the finished row. Over the grid the wash turns red, which is + // the whole preview: the row you are holding reads as "about to be thrown away". + context.fill(gx, gy, gx + drawnW, gy + drawnH, danger ? 0x66B02020 : 0x55121218); + } + + /** True while the cursor is over the item grid, where letting go throws the row out of the filter. */ + boolean isOverGrid(double mouseX, double mouseY) { + return mouseX >= layout.mainX + && mouseX <= layout.mainX + layout.mainW + && mouseY >= layout.mainY + && mouseY <= layout.mainY + layout.mainH; + } + + /** + * True when releasing right now would remove the held item instead of repositioning it: only rows + * picked up from the filter's own list can be thrown away, so an item dragged in from the grid never + * turns red on its way back over it. + */ + boolean isRemovalDrop(double mouseX, double mouseY) { + return session.reorderDragItem != null && !session.reorderFromGrid && isOverGrid(mouseX, mouseY); + } + + /** Row index the cursor is currently over in the visible list, clamped to "past the last row". */ + int reorderTargetRow(double mouseY) { + int row = (int) ((mouseY - layout.listViewY + session.listScrollY) / 18); + return Math.max(0, Math.min(row, session.visibleLeftListItems.size())); + } + + /** + * Drops the dragged item at the cursor's row, shifting the rest along. The list on screen may be + * filtered by the search box, so the drop point is resolved through the item that is currently shown + * at that row and then translated back to its position in the filter's own list. + */ + /** True while the cursor is over the filter list, the only place a drop can land. */ + boolean isOverList(double mouseX, double mouseY) { + return mouseX >= layout.listX + && mouseX <= layout.listX + layout.listW + && mouseY >= layout.listViewY + && mouseY <= layout.listViewY + layout.listViewH; + } + + /** Turns a held grid press into a real drag once it is held long enough or moved far enough. */ + private void promotePendingDrag() { + if (session.pendingDragItem == null || session.reorderDragItem != null) return; + long held = System.currentTimeMillis() - session.pendingDragTime; + int dx = session.reorderMouseX - session.pendingDragX; + int dy = session.reorderMouseY - session.pendingDragY; + if (held < 160L && (dx * dx + dy * dy) < 16) return; + + session.reorderDragItem = session.pendingDragItem; + session.reorderFromGrid = true; + session.reorderStartTime = System.currentTimeMillis(); + session.pendingDragItem = null; + } + + /** Mouse button released: either finish a drag, or resolve the press as a plain click. */ + public void commitPointerRelease(double mouseX, double mouseY) { + if (session.reorderDragItem != null) { + commitReorder(mouseX, mouseY); + return; + } + String clicked = session.pendingDragItem; + session.pendingDragItem = null; + if (clicked == null) return; + + // Never promoted, so it was a click: keep the original add-to-the-end / remove toggle. + List all = session.currentAllowedItems; + if (all.contains(clicked)) { + all.remove(clicked); + editor.playClickSound(0.8f); + } else { + all.add(clicked); + editor.playClickSound(1.0f); + } + editor.updateWhitelistSearchCache(); + } + + public void commitReorder(double mouseX, double mouseY) { + String dragged = session.reorderDragItem; + int releaseX = session.reorderMouseX; + int releaseY = session.reorderMouseY; + boolean removal = isRemovalDrop(mouseX, mouseY); + session.reorderDragItem = null; + session.reorderFromGrid = false; + if (dragged == null) return; + + List all = session.currentAllowedItems; + + // Remember where every row sat, so they can slide to their new places instead of jumping. + java.util.Map before = new java.util.HashMap<>(); + for (int i = 0; i < session.visibleLeftListItems.size(); i++) { + before.put(session.visibleLeftListItems.get(i), i); + } + + // Dragging a row out of the filter and onto the grid is the same as removing it: the grid is where + // items that are not in the filter live, so dropping one back there returns it. + if (removal) { + if (!all.remove(dragged)) return; + editor.updateWhitelistSearchCache(); + session.dropAnimFrom = before; + session.dropAnimStart = System.currentTimeMillis(); + + int rowW = layout.listW - 20; + session.deleteAnimItem = dragged; + session.deleteAnimX = releaseX - (int) (rowW * 0.9f) / 2; + session.deleteAnimY = releaseY - (int) (18 * 0.9f) / 2; + session.deleteAnimStart = System.currentTimeMillis(); + // "Item removed from the filter" — the vanilla item-frame remove sound reads as taking an item out. + editor.playUiSound(net.minecraft.sounds.SoundEvents.ITEM_FRAME_REMOVE_ITEM, 1.0f); + return; + } + + // Dropping anywhere else does nothing at all — same rule the caret follows, so what you see is + // what happens. + if (!isOverList(mouseX, mouseY)) return; + + List visible = session.visibleLeftListItems; + int row = reorderTargetRow(mouseY); + + int insertBefore; + if (row >= visible.size()) { + insertBefore = all.size(); // dropped past the last row: send it to the end + } else { + String anchor = visible.get(row); + if (anchor.equals(dragged)) return; // dropped on itself: nothing to do + insertBefore = all.indexOf(anchor); + if (insertBefore < 0) return; + } + + int from = all.indexOf(dragged); + if (from >= 0) { + all.remove(from); + if (insertBefore > from) insertBefore--; // removing the item shifted everything after it + } + all.add(Math.max(0, Math.min(insertBefore, all.size())), dragged); + + editor.updateWhitelistSearchCache(); + session.dropAnimFrom = before; + session.dropAnimStart = System.currentTimeMillis(); + + // Reverse of the pick-up: the held row flies from the cursor down into the slot it just took, + // fading out as it lands, instead of vanishing the instant the button comes up. + int landed = session.visibleLeftListItems.indexOf(dragged); + if (landed >= 0) { + int rowW = layout.listW - 20; + session.dropGhostItem = dragged; + session.dropGhostFromX = releaseX - (int) (rowW * 0.9f) / 2; + session.dropGhostFromY = releaseY - (int) (18 * 0.9f) / 2; + session.dropGhostToX = layout.listX + 6; + session.dropGhostToY = layout.listViewY + (landed * 18) - (int) session.listScrollY; + session.dropGhostStart = System.currentTimeMillis(); + } + // A grid item newly dropped into the filter (from < 0) gets the item-frame "add" sound; a pure + // reorder of a row already in the filter keeps the neutral UI click. + if (from < 0) editor.playUiSound(net.minecraft.sounds.SoundEvents.ITEM_FRAME_ADD_ITEM, 1.0f); + else editor.playClickSound(1.1f); + } + + /** Scrolls the list while an item is held against its top or bottom edge. */ + private void updateReorderAutoScroll() { + if (session.reorderDragItem == null) return; + float maxScroll = layout.maxListScroll(session.visibleLeftListItems.size()); + if (maxScroll <= 0) return; + + int edge = 14; + int top = layout.listViewY; + int bottom = layout.listViewY + layout.listViewH; + float step = 2.5f; + if (session.reorderMouseY < top + edge) { + session.listScrollY = net.minecraft.util.Mth.clamp(session.listScrollY - step, 0, maxScroll); + } else if (session.reorderMouseY > bottom - edge) { + session.listScrollY = net.minecraft.util.Mth.clamp(session.listScrollY + step, 0, maxScroll); + } + } + + /** + * True when the filter under edit targets player-inventory slots — so its third rule is "Pick Up" + * rather than "Hopper Insert". Decided by the filter's own slots (their keys are offset into the + * inventory namespace), NOT by the screen it was opened from: an inventory filter edited from a chest + * must still show Pick Up. + */ + boolean isInventoryFilter() { + for (int key : session.selectedSlots) { + if (io.github.marcsanzdev.chestseparators.data.ChestConfigManager.isInventoryKey(key)) return true; + } + return false; + } + + boolean hasUnsavedChanges() { + if (session.originalRuleManual != session.ruleManual) return true; + if (session.originalRuleShift != session.ruleShift) return true; + if (session.originalRuleHopper != session.ruleHopper) return true; + if (session.originalTargetCount != session.targetCount) return true; + + // Order is part of the filter now (it can be rearranged by dragging and is saved), so compare the + // lists as they are: reordering alone counts as an unsaved change. + return !session.originalItemsSnapshot.equals(session.currentAllowedItems); + } + + @Override + protected void buildWidgets() { + quantitySlider = null; + int btnW = layout.btnW; + int bH = layout.bH; + int btnX = layout.rightX; + int mainY = layout.mainY; + + // Ender Chests have no Hopper Insert rule (hoppers cannot reach them), so that button is dropped + // entirely. With only two rule buttons left, they are re-centred in the middle section so the three + // groups stay balanced between the panel's top and bottom edges instead of leaving a gap. An + // inventory filter always keeps its third rule (Pick Up) even inside an Ender Chest screen. + boolean showThirdRule = !session.isEnderChest || isInventoryFilter(); + int ruleManualY = showThirdRule ? mainY + 83 : mainY + 95; + int ruleShiftY = showThirdRule ? mainY + 107 : mainY + 119; + + // Group 1 + WideButtonWidget btnImport = new WideButtonWidget( + btnX, + mainY, + btnW, + bH, + Component.translatable("button.chestseparators.import_extracted").getString(), + ModTextures.ICON_SM_IMPORT, + () -> { + ChestConfigManager.getInstance().saveWhitelistSnapshot(); + boolean isSearching = editor.searchBox != null + && !editor.searchBox.getValue().isEmpty(); + + if (isSearching) { + int addedCount = 0; + for (Item item : session.filteredItems) { + String id = BuiltInRegistries.ITEM.getKey(item).toString(); + if (!session.currentAllowedItems.contains(id)) { + session.currentAllowedItems.add(id); + addedCount++; + } + } + if (addedCount > 0) editor.playClickSound(1.2f); + else { + editor.showStatus( + Component.translatable("message.chestseparators.items_already_in_filter"), + ChatFormatting.RED); + editor.playClickSound(0.8f); + } + } else { + List extracted = editor.extractItemsFromSelection(); + extracted.removeIf(id -> { + Item it = BuiltInRegistries.ITEM.getValue(net.minecraft.resources.Identifier.tryParse(id)); + return it != null && !editor.isItemAllowedForFilter(it); + }); + if (!extracted.isEmpty()) { + session.currentAllowedItems.addAll(extracted); + editor.playClickSound(1.2f); + } else { + editor.showStatus( + Component.translatable("message.chestseparators.no_new_items_found"), ChatFormatting.RED); + editor.playClickSound(0.8f); + } + } + session.forceStopPreview = true; + session.isPreviewing = false; + session.previewItems.clear(); + editor.updateWhitelistSearchCache(); + }); + btnImport.tooltipText = Component.translatable("tooltip.chestseparators.desc.import_extracted") + .getString(); + btnImport.texSize = 128; + widgets.add(btnImport); + + WideButtonWidget btnAllowAll = new WideButtonWidget( + btnX, + mainY + 24, + btnW, + bH, + Component.translatable("button.chestseparators.allow_all").getString(), + ModTextures.ICON_SM_ALLOW_ALL, + () -> { + ChestConfigManager.getInstance().saveWhitelistSnapshot(); + session.currentAllowedItems.clear(); + for (Item item : session.allGameItems) + if (editor.isItemAllowedForFilter(item)) + session.currentAllowedItems.add( + BuiltInRegistries.ITEM.getKey(item).toString()); + editor.playClickSound(1.0f); + session.forceStopPreview = true; + session.isPreviewing = false; + session.previewItems.clear(); + editor.updateWhitelistSearchCache(); + }); + btnAllowAll.tooltipText = + Component.translatable("tooltip.chestseparators.desc.allow_all").getString(); + btnAllowAll.texSize = 128; + widgets.add(btnAllowAll); + + WideButtonWidget btnClearAll = new WideButtonWidget( + btnX, + mainY + 48, + btnW, + bH, + Component.translatable("button.chestseparators.clear_all").getString(), + ModTextures.ICON_SM_CLEAR, + () -> { + ChestConfigManager.getInstance().saveWhitelistSnapshot(); + session.currentAllowedItems.clear(); + editor.playClickSound(1.0f); + session.forceStopPreview = true; + session.isPreviewing = false; + session.previewItems.clear(); + editor.updateWhitelistSearchCache(); + }); + btnClearAll.tooltipText = + Component.translatable("tooltip.chestseparators.desc.clear_all").getString(); + btnClearAll.texSize = 128; + widgets.add(btnClearAll); + + // Group 2 + WideButtonWidget btnManual = new WideButtonWidget( + btnX, + ruleManualY, + btnW, + bH, + Component.translatable("button.chestseparators.manual_insert").getString(), + ModTextures.ICON_SM_MANUAL, + () -> { + session.ruleManual = !session.ruleManual; + editor.playClickSound(1.0f); + }); + btnManual.tooltipText = session.ruleManual + ? Component.translatable("tooltip.chestseparators.rule.manual_active") + .getString() + : Component.translatable("tooltip.chestseparators.rule.manual_inactive") + .getString(); + btnManual.texSize = 128; + widgets.add(btnManual); + + WideButtonWidget btnShift = new WideButtonWidget( + btnX, + ruleShiftY, + btnW, + bH, + Component.translatable("button.chestseparators.shift_insert").getString(), + ModTextures.ICON_SM_SHIFT, + () -> { + session.ruleShift = !session.ruleShift; + editor.playClickSound(1.0f); + }); + btnShift.tooltipText = session.ruleShift + ? Component.translatable("tooltip.chestseparators.rule.shift_active").getString() + : Component.translatable("tooltip.chestseparators.rule.shift_inactive") + .getString(); + btnShift.texSize = 128; + widgets.add(btnShift); + + // For an inventory filter this third rule is "Pick Up" (filter items picked up from the ground) + // instead of "Hopper Insert", which does not apply to your own inventory. It reuses the same + // ruleHopper flag for storage. Whether it is Pick Up or Hopper depends on the FILTER'S slots, not + // the screen: an inventory filter edited from a chest must still show Pick Up. Ender Chests drop + // the Hopper rule (hoppers cannot reach them), but an inventory filter always keeps Pick Up. + boolean invFilter = isInventoryFilter(); + if (showThirdRule) { + WideButtonWidget btnHopper = new WideButtonWidget( + btnX, + mainY + 131, + btnW, + bH, + Component.translatable( + invFilter + ? "button.chestseparators.pickup_insert" + : "button.chestseparators.hopper_insert") + .getString(), + invFilter ? ModTextures.ICON_SM_PICKUP : ModTextures.ICON_SM_HOPPER, + () -> { + session.ruleHopper = !session.ruleHopper; + editor.playClickSound(1.0f); + }); + if (invFilter) { + btnHopper.tooltipText = session.ruleHopper + ? Component.translatable("tooltip.chestseparators.rule.pickup_active") + .getString() + : Component.translatable("tooltip.chestseparators.rule.pickup_inactive") + .getString(); + } else if (!session.isEntityChest || session.isMinecartChest) { + btnHopper.tooltipText = session.ruleHopper + ? Component.translatable("tooltip.chestseparators.rule.hopper_active") + .getString() + : Component.translatable("tooltip.chestseparators.rule.hopper_inactive") + .getString(); + } + btnHopper.texSize = 128; + widgets.add(btnHopper); + } + + // Compact continuous slider with marked stack sizes. All (0) stays distinct from keeping 64. + if (invFilter) { + quantitySlider = new io.github.marcsanzdev.chestseparators.client.ui.widgets.InventoryRetentionSlider( + btnX, mainY + 154, btnW, 11, + () -> session.targetCount, + value -> { + if (session.targetCount != value) { + session.targetCount = value; + editor.playClickSound(1.0f); + } + }); + widgets.add(quantitySlider); + } else { + quantitySlider = null; + } + + // Group 3 (Actions) — stacked full-width in visual order: Save, Delete, Cancel. + ActionIconButtonWidget btnDelete = new ActionIconButtonWidget( + btnX, + mainY + 190, + btnW, + bH, + Component.translatable("button.chestseparators.delete").getString(), + ModTextures.ICON_SM_TRASH, + UiColors.SURFACE_DARK, + () -> { + ChestConfigManager.getInstance().saveWhitelistSnapshot(); + editor.deleteCurrentGroup(); + session.selectedSlots.clear(); + editor.toggleState(EditorState.VIEW_GROUPS); + editor.playClickSound(0.8f); + }); + btnDelete.tooltipText = + Component.translatable("tooltip.chestseparators.desc.delete_group").getString(); + btnDelete.texSize = 128; + btnDelete.deferAction = true; // flash before this button closes the filter screen + widgets.add(btnDelete); + + ActionIconButtonWidget btnSave = new ActionIconButtonWidget( + btnX, + mainY + 166, + btnW, + bH, + Component.translatable("button.chestseparators.save").getString(), + ModTextures.ICON_SM_SAVE, + UiColors.SURFACE_DARK, + () -> { + // Check whether saving will cause existing items to be expelled. + boolean willExpel = false; + + // Expulsion can only occur when all three insertion rules are blocked. + if (io.github.marcsanzdev.chestseparators.config.GlobalChestConfig.instance.expelInvalidItems + && session.ruleManual + && session.ruleShift + && session.ruleHopper) { + + for (int slotIdx : session.selectedSlots) { + if (slotIdx >= 0 + && slotIdx + < editor.accessor.getHandler().slots.size()) { + net.minecraft.world.item.ItemStack stack = editor.accessor + .getHandler() + .getSlot(slotIdx) + .getItem(); + if (!stack.isEmpty()) { + String id = net.minecraft.core.registries.BuiltInRegistries.ITEM + .getKey(stack.getItem()) + .toString(); + if (!session.currentAllowedItems.contains(id)) { + willExpel = true; + break; + } + } + } + } + } + + if (willExpel) { + session.isExpelPopupOpen = true; + editor.playClickSound(1.0f); + } else { + ChestConfigManager.getInstance().saveWhitelistSnapshot(); + editor.saveCurrentGroup(); + session.selectedSlots.clear(); + editor.toggleState(EditorState.VIEW_GROUPS); + editor.playClickSound(1.0f); + } + }); + btnSave.tooltipText = + Component.translatable("tooltip.chestseparators.desc.save").getString(); + btnSave.texSize = 128; + btnSave.deferAction = true; // flash before saving closes the filter screen (or opens the expel popup) + widgets.add(btnSave); + + ActionIconButtonWidget btnCancel = new ActionIconButtonWidget( + btnX, + mainY + 214, + btnW, + bH, + Component.translatable("button.chestseparators.cancel").getString(), + ModTextures.ICON_SM_CANCEL, + UiColors.SURFACE_DARK, + () -> { + session.selectedSlots.clear(); + editor.toggleState(EditorState.VIEW_GROUPS); + editor.playClickSound(1.0f); + }); + btnCancel.texSize = 128; + btnCancel.tooltipText = + Component.translatable("tooltip.chestseparators.desc.cancel").getString(); + btnCancel.deferAction = true; // flash before this button closes the filter screen + widgets.add(btnCancel); + } + + @Override + public void render(GuiGraphicsExtractor context, int mouseX, int mouseY, float delta) { + + context.fill(0, 0, layout.screenWidth, layout.screenHeight, 0x77000000); + + // When any popup is active — or an item is being carried on the cursor — pass (-1, -1) as mouse + // coordinates so background methods do not react to hover or draw tooltips. While dragging, a + // tooltip or a button preview firing under the held row is just noise on top of it. + boolean isAnyPopupOpen = session.isUnsavedPopupOpen || session.isExpelPopupOpen; + boolean suppressHover = isAnyPopupOpen || session.reorderDragItem != null; + int bgMouseX = suppressHover ? -1 : mouseX; + int bgMouseY = suppressHover ? -1 : mouseY; + + if (session.pendingDragItem != null) { + session.reorderMouseX = mouseX; + session.reorderMouseY = mouseY; + promotePendingDrag(); + } + + updateWidgetStates(bgMouseX, bgMouseY); + handlePreviewLogic(bgMouseX, bgMouseY); + updateReorderAutoScroll(); + + panelRenderer.drawLeftPanel(context, bgMouseX, bgMouseY); + panelRenderer.drawMainPanel(context, bgMouseX, bgMouseY); + + super.render(context, bgMouseX, bgMouseY, delta); + + // Static hint at the very bottom, matching the magnifier one in the layout editor: middle-clicking + // an item is not discoverable on its own, and it is the entry point to the whole tag mechanic. + if (!isAnyPopupOpen) { + Minecraft client = Minecraft.getInstance(); + Component hint = Component.translatable("message.chestseparators.tag_hint"); + context.text( + client.font, + hint, + (layout.screenWidth - client.font.width(hint)) / 2, + layout.screenHeight - 12, + 0x70FFFFFF, + false); + } + + drawReorderGhost(context); + + panelRenderer.drawTagDropdown(context, bgMouseX, bgMouseY); + + // Popup rendering. + if (isAnyPopupOpen) { + context.fill(0, 0, layout.screenWidth, layout.screenHeight, 0xAA000000); + + int currentPopupH = layout.conflictPopupH; + boolean isDark = GlobalChestConfig.instance.darkMode; + + io.github.marcsanzdev.chestseparators.client.ui.UiTheme.panel( + context, layout.conflictPopupX, layout.conflictPopupY, layout.conflictPopupW, currentPopupH); + + Minecraft client = Minecraft.getInstance(); + int maxContentWidth = layout.conflictPopupW - 20; // Margen interno de 10px por lado + + Component title = session.isExpelPopupOpen + ? Component.translatable("gui.chestseparators.expel_items_title") + : Component.translatable("gui.chestseparators.unsaved_changes_title"); + int titleColor = session.isExpelPopupOpen ? 0xFFFF5555 : 0xFFFFAA00; + + int titleWidth = client.font.width(title); + float titleScale = titleWidth > maxContentWidth ? (float) maxContentWidth / titleWidth : 1.0f; + + context.pose().pushMatrix(); + context.pose() + .translate( + layout.conflictPopupX + layout.conflictPopupW / 2.0f, + layout.conflictPopupY + 12 + (4 * (1 - titleScale))); + context.pose().scale(titleScale, titleScale); + context.centeredText(client.font, title, 0, 0, titleColor); + context.pose().popMatrix(); + + Component desc = session.isExpelPopupOpen + ? Component.translatable("gui.chestseparators.expel_items_desc") + : Component.translatable("gui.chestseparators.unsaved_changes_desc"); + + if (session.isExpelPopupOpen) { + int descY = layout.conflictPopupY + 26; + for (net.minecraft.util.FormattedCharSequence line : client.font.split(desc, maxContentWidth)) { + int lineWidth = client.font.width(line); + context.text( + client.font, + line, + layout.conflictPopupX + (layout.conflictPopupW - lineWidth) / 2, + descY, + (isDark ? 0xFFDDDDDD : 0xFF333333), + false); + descY += client.font.lineHeight + 1; + } + } else { + int descWidth = client.font.width(desc); + float descScale = descWidth > maxContentWidth ? (float) maxContentWidth / descWidth : 1.0f; + int scaledDescWidth = (int) (descWidth * descScale); + int descX = layout.conflictPopupX + (layout.conflictPopupW - scaledDescWidth) / 2; + + context.pose().pushMatrix(); + context.pose().translate(descX, layout.conflictPopupY + 30 + (4 * (1 - descScale))); + context.pose().scale(descScale, descScale); + context.text(client.font, desc, 0, 0, (isDark ? 0xFFDDDDDD : 0xFF333333), false); + context.pose().popMatrix(); + } + + // Renderizamos los botones correspondientes + List activeWidgets = session.isExpelPopupOpen ? expelPopupWidgets : unsavedPopupWidgets; + for (io.github.marcsanzdev.chestseparators.client.ui.widgets.CustomWidget w : activeWidgets) { + w.render(context, mouseX, mouseY, delta); + } + } + } + + private void updateWidgetStates(int mouseX, int mouseY) { + if (widgets.isEmpty()) return; + + boolean isSearching = + editor.searchBox != null && !editor.searchBox.getValue().isEmpty(); + WideButtonWidget importBtn = (WideButtonWidget) widgets.get(0); + importBtn.icon = isSearching ? ModTextures.ICON_SM_SEARCH : ModTextures.ICON_SM_IMPORT; + importBtn.tooltipText = isSearching + ? Component.translatable("tooltip.chestseparators.desc.import_search") + .getString() + : Component.translatable("tooltip.chestseparators.desc.import_extracted") + .getString(); + + String newText = isSearching + ? Component.translatable("button.chestseparators.import_search").getString() + : Component.translatable("button.chestseparators.import_extracted").getString(); + importBtn.label = newText; + + widgets.get(1).isActive = (session.currentAllowedItems.size() == session.allGameItems.size()); + widgets.get(2).isActive = session.currentAllowedItems.isEmpty(); + + widgets.get(3).isActive = session.ruleManual; + widgets.get(3).tooltipText = session.ruleManual + ? Component.translatable("tooltip.chestseparators.rule.manual_active") + .getString() + : Component.translatable("tooltip.chestseparators.rule.manual_inactive") + .getString(); + + widgets.get(4).isActive = session.ruleShift; + widgets.get(4).tooltipText = session.ruleShift + ? Component.translatable("tooltip.chestseparators.rule.shift_active").getString() + : Component.translatable("tooltip.chestseparators.rule.shift_inactive") + .getString(); + + // The third rule button (index 5) exists unless it is an Ender Chest chest-filter (there it is + // dropped and index 5 would be a different widget). An inventory filter always has it (Pick Up). + boolean invFilter = isInventoryFilter(); + if (!session.isEnderChest || invFilter) { + widgets.get(5).isActive = session.ruleHopper; + // Chest minecarts CAN be filled by hoppers and now sync their filter to the server, so the rule + // is enabled for them. Other entity containers (chest boats, animals) still cannot, so stay + // disabled. Inventory filters (Pick Up) are always enabled. + widgets.get(5).isDisabled = !invFilter && session.isEntityChest && !session.isMinecartChest; + + if (invFilter) { + widgets.get(5).tooltipText = session.ruleHopper + ? Component.translatable("tooltip.chestseparators.rule.pickup_active") + .getString() + : Component.translatable("tooltip.chestseparators.rule.pickup_inactive") + .getString(); + } else if (!session.isEntityChest || session.isMinecartChest) { + widgets.get(5).tooltipText = session.ruleHopper + ? Component.translatable("tooltip.chestseparators.rule.hopper_active") + .getString() + : Component.translatable("tooltip.chestseparators.rule.hopper_inactive") + .getString(); + } else { + widgets.get(5).tooltipText = null; + } + } + } + + private void handlePreviewLogic(int mouseX, int mouseY) { + if (widgets.isEmpty()) return; + boolean hoverImport = widgets.get(0).isHovering(mouseX, mouseY); + boolean hoverAllow = widgets.get(1).isHovering(mouseX, mouseY); + boolean hoverClear = widgets.get(2).isHovering(mouseX, mouseY); + + if (hoverImport) session.previewType = 1; + else if (hoverAllow) session.previewType = 2; + else if (hoverClear) session.previewType = 3; + else session.previewType = 0; + + if (session.previewType == 0) session.forceStopPreview = false; + + if (session.previewType != 0 && !session.forceStopPreview) { + if (!session.isPreviewing) { + List itemsToPreview = new ArrayList<>(); + boolean isSearching = + editor.searchBox != null && !editor.searchBox.getValue().isEmpty(); + + if (session.previewType == 1) { + if (isSearching) { + for (Item item : session.filteredItems) + itemsToPreview.add(BuiltInRegistries.ITEM.getKey(item).toString()); + } else { + itemsToPreview = editor.extractItemsFromSelection(); + } + } else if (session.previewType == 2) { + for (Item item : session.allGameItems) + itemsToPreview.add(BuiltInRegistries.ITEM.getKey(item).toString()); + } else if (session.previewType == 3) { + itemsToPreview.addAll(session.currentAllowedItems); + } + + if (!itemsToPreview.isEmpty() || session.previewType == 3) { + session.isPreviewing = true; + session.previewItems = itemsToPreview; + session.previewScrollY = 0f; + session.previewScrollDirectionDown = true; + session.userOverrodePreviewScroll = false; + long now = System.currentTimeMillis(); + session.lastPreviewTime = now; + session.previewStartTime = now; + } else session.forceStopPreview = true; + } else { + long now = System.currentTimeMillis(); + float dt = (now - session.lastPreviewTime) / 1000f; + session.lastPreviewTime = now; + if (!session.userOverrodePreviewScroll && (now - session.previewStartTime > 1000)) { + float maxScroll = Math.max(0, session.previewItems.size() * 18 - (layout.listH - 48)); + if (maxScroll > 0) { + float speed = (session.previewType == 2) ? 80f : 25f; + // Restarting the clock at each end re-triggers the one second wait above, so the + // list settles for a moment at the bottom and at the top instead of turning around + // the instant it arrives — otherwise the ends are the hardest part to read. + if (session.previewScrollDirectionDown) { + session.previewScrollY += speed * dt; + if (session.previewScrollY >= maxScroll) { + session.previewScrollY = maxScroll; + session.previewScrollDirectionDown = false; + session.previewStartTime = now; + } + } else { + session.previewScrollY -= speed * dt; + if (session.previewScrollY <= 0) { + session.previewScrollY = 0; + session.previewScrollDirectionDown = true; + session.previewStartTime = now; + } + } + } + } + } + } else session.isPreviewing = false; + } + + public boolean mouseScrolled(double mouseX, double mouseY, double horizontalAmount, double verticalAmount) { + if (scrollRetentionSlider(mouseX, mouseY, verticalAmount)) return true; + float scrollSpeed = 18f; + + // While previewing, the scroll wheel always controls the preview panel. + if (session.isPreviewing) { + float maxScroll = Math.max(0, session.previewItems.size() * layout.itemSize - layout.listViewH); + session.previewScrollY = net.minecraft.util.Mth.clamp( + session.previewScrollY - (float) (verticalAmount * scrollSpeed), 0, maxScroll); + session.userOverrodePreviewScroll = true; + return true; + } + + if (mouseX >= layout.mainX) { + session.lastInteractedWasList = false; + float maxGridScroll = Math.max( + 0, + (int) Math.ceil((double) session.filteredItems.size() / layout.cols) * layout.gridCell + - layout.gridViewH); + session.gridScrollY = net.minecraft.util.Mth.clamp( + session.gridScrollY - (float) (verticalAmount * scrollSpeed), 0, maxGridScroll); + } else { + session.lastInteractedWasList = true; + float maxListScroll = layout.maxListScroll(session.visibleLeftListItems.size()); + session.listScrollY = net.minecraft.util.Mth.clamp( + session.listScrollY - (float) (verticalAmount * scrollSpeed), 0, maxListScroll); + } + return true; + } + + public boolean keyPressed(net.minecraft.client.input.KeyEvent input) { + boolean isSearchFocused = (editor.searchBox != null && editor.searchBox.isFocused()); + boolean isWhitelistSearchFocused = (editor.whitelistSearchBox != null && editor.whitelistSearchBox.isFocused()); + + if (isSearchFocused) { + if (editor.searchBox.keyPressed(input)) return true; + if (input.key() != InputConstants.KEY_ESCAPE) return true; + } + if (isWhitelistSearchFocused) { + if (editor.whitelistSearchBox.keyPressed(input)) return true; + if (input.key() != InputConstants.KEY_ESCAPE) return true; + } + + // Typing anywhere in the filter editor jumps to the item search, so the inventory key ("e" by + // default) is a character being typed into the search field — not a request to close the container. + // This now applies on ANY tab, not only the search tab: switch to the search tab first, focus the + // box and consume the key; charTyped then inserts the character. + if (!isSearchFocused && !isWhitelistSearchFocused && editor.searchBox != null) { + if (input.key() != InputConstants.UNKNOWN.getValue() + && Minecraft.getInstance().options.keyInventory.matches(input)) { + if (!isOnSearchTab()) switchToSearchTab(); + editor.searchBox.setFocused(true); + if (editor.whitelistSearchBox != null) editor.whitelistSearchBox.setFocused(false); + return true; + } + } + + if (!isSearchFocused && !isWhitelistSearchFocused) { + if (input.key() == InputConstants.KEY_UP || input.key() == InputConstants.KEY_DOWN) { + float scrollAmount = 18f * 2; + int direction = (input.key() == InputConstants.KEY_UP) ? -1 : 1; + + if (session.lastInteractedWasList) { + float maxListScroll = layout.maxListScroll(session.visibleLeftListItems.size()); + session.listScrollY = net.minecraft.util.Mth.clamp( + session.listScrollY + (direction * scrollAmount), 0, maxListScroll); + } else { + float maxGridScroll = + Math.max(0, (int) Math.ceil(session.filteredItems.size() / 9.0) * 18 - (9 * 18)); + session.gridScrollY = net.minecraft.util.Mth.clamp( + session.gridScrollY + (direction * scrollAmount), 0, maxGridScroll); + } + return true; + } + } + return false; + } + + public boolean charTyped(net.minecraft.client.input.CharacterEvent input) { + if (editor.searchBox != null && editor.searchBox.isFocused()) return editor.searchBox.charTyped(input); + if (editor.whitelistSearchBox != null && editor.whitelistSearchBox.isFocused()) + return editor.whitelistSearchBox.charTyped(input); + // Typing anywhere else jumps straight to the item search: switch to the search tab if needed, focus + // the box and insert the character — no need to find and click the search tab first. + if (editor.searchBox != null) { + if (!isOnSearchTab()) switchToSearchTab(); + if (isOnSearchTab()) { + editor.searchBox.setFocused(true); + if (editor.whitelistSearchBox != null) editor.whitelistSearchBox.setFocused(false); + return editor.searchBox.charTyped(input); + } + } + return false; + } + + /** Switches the item grid to the creative search tab, if one is present. */ + private void switchToSearchTab() { + for (int i = 0; i < session.availableTabs.size(); i++) { + var tab = session.availableTabs.get(i); + if (tab != null && tab.isSearchTab) { + editor.switchCreativeTab(i); + return; + } + } + } + + private boolean isOnSearchTab() { + int idx = session.currentCreativeTabIndex; + return idx >= 0 + && idx < session.availableTabs.size() + && session.availableTabs.get(idx) != null + && session.availableTabs.get(idx).isSearchTab; + } +} diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/screens/ScreenViewGroups.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/screens/ScreenViewGroups.java new file mode 100644 index 0000000..1d35d9b --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/screens/ScreenViewGroups.java @@ -0,0 +1,568 @@ +package io.github.marcsanzdev.chestseparators.client.ui.screens; + +import io.github.marcsanzdev.chestseparators.client.EditorState; +import io.github.marcsanzdev.chestseparators.client.ModTextures; +import io.github.marcsanzdev.chestseparators.client.ui.ChestSeparatorsEditor; +import io.github.marcsanzdev.chestseparators.client.ui.widgets.ActionIconButtonWidget; +import io.github.marcsanzdev.chestseparators.client.ui.widgets.CustomWidget; +import io.github.marcsanzdev.chestseparators.client.ui.widgets.WideButtonWidget; +import io.github.marcsanzdev.chestseparators.config.GlobalChestConfig; +import io.github.marcsanzdev.chestseparators.data.ChestConfigManager; +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiGraphicsExtractor; +import net.minecraft.world.inventory.Slot; +import net.minecraft.network.chat.Component; +import net.minecraft.ChatFormatting; +import net.minecraft.util.Mth; + +public class ScreenViewGroups extends AbstractEditorScreen { + + // Package-private so the extracted ViewGroupsClickHandler can route clicks to these widgets. + final List popupWidgets = new ArrayList<>(); + final List selectSlotsWidgets = new ArrayList<>(); + + private long btnClearAllClickTime = 0; + private long btnClearSelectClickTime = 0; + private long btnCopyClickTime = 0; + private long btnPasteClickTime = 0; + private long btnUndoClickTime = 0; + private long btnRedoClickTime = 0; + + private final GroupBlobRenderer groupRenderer; + private final WhitelistPreviewPanelRenderer previewPanelRenderer; + private final ViewGroupsClickHandler clickHandler; + + public ScreenViewGroups(ChestSeparatorsEditor editor) { + super(editor); + this.groupRenderer = new GroupBlobRenderer(this); + this.previewPanelRenderer = new WhitelistPreviewPanelRenderer(this); + this.clickHandler = new ViewGroupsClickHandler(this); + } + + @Override + public boolean mouseClicked(double mouseX, double mouseY, int button) { + return clickHandler.onMouseClicked(mouseX, mouseY, button); + } + + /** Draws the always-on left whitelist preview panel. Delegates to {@link WhitelistPreviewPanelRenderer}. */ + public void renderWhitelistPreviewPanel(GuiGraphicsExtractor context, int mouseX, int mouseY) { + previewPanelRenderer.renderWhitelistPreviewPanel(context, mouseX, mouseY); + } + + @Override + public void init() { + super.init(); + popupWidgets.clear(); + buildPopupWidgets(); + selectSlotsWidgets.clear(); + buildSelectSlotsWidgets(); + + // Every conflict-popup button dismisses the popup, so flash the press before acting — otherwise + // the popup closes on the same frame and the click is never seen. + for (CustomWidget w : popupWidgets) w.deferAction = true; + } + + @Override + protected void buildWidgets() { + int sx = layout.rightX; + int sy = layout.mainY; + int btnW = layout.btnW; + int bH = layout.bH; + + // --- Block 1: Edit & Clear All --- + WideButtonWidget btnEditFilter = new WideButtonWidget( + sx, + sy, + btnW, + bH, + Component.translatable("button.chestseparators.edit_filter").getString(), + ModTextures.ICON_SM_FILTER, + () -> { + editor.playClickSound(1.0f); + if (session.selectedSlots.isEmpty()) { + editor.showStatus(Component.translatable("message.chestseparators.select_first"), ChatFormatting.RED); + return; + } + boolean conflictFound = false; + var whitelists = ChestConfigManager.getInstance().getCurrentWhitelists(); + if (whitelists != null) { + for (int slotIdx : session.selectedSlots) { + if (whitelists.containsKey(slotIdx)) { + conflictFound = true; + break; + } + } + } + if (conflictFound) session.hasSelectionConflict = true; + else { + session.selectedGroupId = UUID.randomUUID(); + transitionToEditFilter(); + } + }); + btnEditFilter.tooltipText = + Component.translatable("tooltip.chestseparators.desc.edit_filter").getString(); + btnEditFilter.texSize = 128; + widgets.add(btnEditFilter); + + WideButtonWidget btnClearAll = new WideButtonWidget( + sx, + sy + 24, + btnW, + bH, + Component.translatable("button.chestseparators.delete_all_filters").getString(), + ModTextures.ICON_SM_TRASH, + () -> { + btnClearAllClickTime = System.currentTimeMillis(); + var whitelists = ChestConfigManager.getInstance().getCurrentWhitelists(); + if (whitelists != null && !whitelists.isEmpty()) { + ChestConfigManager.getInstance().saveWhitelistSnapshot(); + whitelists.clear(); + editor.saveSmart(); + editor.sendWhitelistToServer(); + + editor.syncClientInventoryWhitelists(whitelists); + + editor.showStatus( + Component.translatable("message.chestseparators.all_filters_deleted"), ChatFormatting.RED); + editor.playClickSound(0.8f); + } + }); + btnClearAll.tooltipText = Component.translatable("tooltip.chestseparators.desc.delete_all_filters") + .getString(); + btnClearAll.keepNormalTextColor = true; + btnClearAll.texSize = 128; + widgets.add(btnClearAll); + + // --- Block 2: Selection Tools --- + WideButtonWidget btnAreaSelect = new WideButtonWidget( + sx, + sy + 53, + btnW, + bH, + Component.translatable("button.chestseparators.area_select").getString(), + ModTextures.ICON_SM_AREA_SELECT, + () -> { + session.wlToolMode = 0; + editor.playClickSound(1.2f); + }); + btnAreaSelect.tooltipText = + Component.translatable("tooltip.chestseparators.desc.area_select").getString(); + btnAreaSelect.texSize = 128; + widgets.add(btnAreaSelect); + + WideButtonWidget btnTraceSelect = new WideButtonWidget( + sx, + sy + 77, + btnW, + bH, + Component.translatable("button.chestseparators.trace_select").getString(), + ModTextures.ICON_SM_TRACE_SELECT, + () -> { + session.wlToolMode = 1; + editor.playClickSound(1.2f); + }); + btnTraceSelect.tooltipText = + Component.translatable("tooltip.chestseparators.desc.trace_select").getString(); + btnTraceSelect.texSize = 128; + widgets.add(btnTraceSelect); + + WideButtonWidget btnClearSelect = new WideButtonWidget( + sx, + sy + 101, + btnW, + bH, + Component.translatable("button.chestseparators.clear_selection").getString(), + ModTextures.ICON_SM_TRASH, + () -> { + btnClearSelectClickTime = System.currentTimeMillis(); + session.selectedSlots.clear(); + editor.playClickSound(0.8f); + }); + btnClearSelect.tooltipText = Component.translatable("tooltip.chestseparators.desc.clear_selection") + .getString(); + btnClearSelect.keepNormalTextColor = true; + btnClearSelect.texSize = 128; + widgets.add(btnClearSelect); + + // --- Block 3: Global Actions --- + WideButtonWidget btnCopy = new WideButtonWidget( + sx, + sy + 130, + btnW, + bH, + Component.translatable("button.chestseparators.copy_filters").getString(), + ModTextures.ICON_SM_COPY, + () -> { + btnCopyClickTime = System.currentTimeMillis(); + ChestConfigManager.getInstance().copyWhitelistsToClipboard(); + editor.showStatus(Component.translatable("message.chestseparators.filters_copied"), ChatFormatting.GRAY); + editor.playClickSound(1.0f); + }); + btnCopy.tooltipText = + Component.translatable("tooltip.chestseparators.desc.copy_filters").getString(); + btnCopy.keepNormalTextColor = true; + btnCopy.texSize = 128; + widgets.add(btnCopy); + + WideButtonWidget btnPaste = new WideButtonWidget( + sx, + sy + 154, + btnW, + bH, + Component.translatable("button.chestseparators.paste_filters").getString(), + ModTextures.ICON_SM_PASTE, + () -> { + btnPasteClickTime = System.currentTimeMillis(); + + if (ChestConfigManager.getInstance().hasWhitelistClipboardData()) { + ChestConfigManager.getInstance().saveWhitelistSnapshot(); + ChestConfigManager.getInstance().pasteWhitelistsFromClipboard(); + editor.saveSmart(); + editor.sendWhitelistToServer(); + + editor.syncClientInventoryWhitelists( + ChestConfigManager.getInstance().getCurrentWhitelists()); + + editor.showStatus( + Component.translatable("message.chestseparators.filters_pasted"), ChatFormatting.GREEN); + editor.playClickSound(1.0f); + } + }); + btnPaste.tooltipText = + Component.translatable("tooltip.chestseparators.desc.paste_filters").getString(); + btnPaste.keepNormalTextColor = true; + btnPaste.texSize = 128; + widgets.add(btnPaste); + + int halfW = (btnW - 4) / 2; + WideButtonWidget btnUndo = new WideButtonWidget( + sx, + sy + 178, + halfW, + bH, + Component.translatable("button.chestseparators.undo").getString(), + ModTextures.ICON_SM_UNDO, + () -> { + btnUndoClickTime = System.currentTimeMillis(); + editor.applyUndoRedo(ChestConfigManager.getInstance().undo(), false); + }); + btnUndo.tooltipText = + Component.translatable("tooltip.chestseparators.desc.undo").getString(); + btnUndo.keepNormalTextColor = true; + btnUndo.texSize = 128; + widgets.add(btnUndo); + + WideButtonWidget btnRedo = new WideButtonWidget( + sx + halfW + 4, + sy + 178, + halfW, + bH, + Component.translatable("button.chestseparators.redo").getString(), + ModTextures.ICON_SM_REDO, + () -> { + btnRedoClickTime = System.currentTimeMillis(); + editor.applyUndoRedo(ChestConfigManager.getInstance().redo(), true); + }); + btnRedo.tooltipText = + Component.translatable("tooltip.chestseparators.desc.redo").getString(); + btnRedo.keepNormalTextColor = true; + btnRedo.texSize = 128; + widgets.add(btnRedo); + } + + private void buildPopupWidgets() { + ActionIconButtonWidget btnOverwrite = new ActionIconButtonWidget( + layout.conflictPopupX + 10, + layout.conflictPopupY + 45, + 240, + 16, + "1. " + + Component.translatable("button.chestseparators.conflict.overwrite") + .getString(), + null, + 0xFF852D2D, + () -> { + ChestConfigManager.getInstance().saveWhitelistSnapshot(); + session.hasSelectionConflict = false; + session.selectedGroupId = UUID.randomUUID(); + editor.playClickSound(1.0f); + transitionToEditFilter(); + }); + btnOverwrite.tooltipText = Component.translatable("tooltip.chestseparators.desc.conflict.overwrite") + .getString(); + popupWidgets.add(btnOverwrite); + + ActionIconButtonWidget btnDeselect = new ActionIconButtonWidget( + layout.conflictPopupX + 10, + layout.conflictPopupY + 63, + 240, + 16, + "2. " + + Component.translatable("button.chestseparators.conflict.deselect") + .getString(), + null, + 0xFF2D852D, + () -> { + var whitelists = ChestConfigManager.getInstance().getCurrentWhitelists(); + if (whitelists != null) session.selectedSlots.removeIf(whitelists::containsKey); + session.hasSelectionConflict = false; + editor.playClickSound(1.0f); + if (!session.selectedSlots.isEmpty()) { + transitionToEditFilter(); + } else { + editor.showStatus(Component.translatable("message.chestseparators.empty_selection"), ChatFormatting.RED); + } + }); + btnDeselect.tooltipText = Component.translatable("tooltip.chestseparators.desc.conflict.deselect") + .getString(); + popupWidgets.add(btnDeselect); + + ActionIconButtonWidget btnCancel = new ActionIconButtonWidget( + layout.conflictPopupX + 10, + layout.conflictPopupY + 81, + 240, + 16, + "3. " + Component.translatable("button.chestseparators.cancel").getString(), + null, + 0xFF444444, + () -> { + session.hasSelectionConflict = false; + editor.playClickSound(0.8f); + }); + btnCancel.tooltipText = Component.translatable("tooltip.chestseparators.desc.conflict.cancel") + .getString(); + popupWidgets.add(btnCancel); + } + + private void buildSelectSlotsWidgets() { + int btnX = layout.guiX + layout.bgWidth + 4; + int btnY = layout.guiY; + + selectSlotsWidgets.add(new ActionIconButtonWidget( + btnX, + btnY, + 60, + 20, + Component.translatable("button.chestseparators.confirm").getString(), + null, + 0xFF2D852D, + () -> { + if (!session.selectedSlots.isEmpty()) { + transitionToEditFilter(); + } + editor.playClickSound(1.0f); + })); + + selectSlotsWidgets.add(new ActionIconButtonWidget( + btnX, + btnY + 25, + 60, + 20, + Component.translatable("button.chestseparators.cancel").getString(), + null, + 0xFF852D2D, + () -> { + editor.toggleState(EditorState.VIEW_GROUPS); + editor.playClickSound(1.0f); + })); + } + + @Override + public boolean mouseDragged(double mouseX, double mouseY, int button, double dragX, double dragY) { + if (session.hasSelectionConflict) return true; + + if (session.currentState == EditorState.VIEW_GROUPS || session.currentState == EditorState.SELECT_SLOTS) { + if (session.isDraggingLine) { + Slot slot = editor.accessor.getFocusedSlot(); + // Confine the drag to the namespace it started in (no chest<->inventory crossover). + if (slot != null + && ChestSeparatorsEditor.isEditableSlot(slot) + && (session.dragStartSlot == null + || ChestSeparatorsEditor.isPlayerSlot(slot) + == ChestSeparatorsEditor.isPlayerSlot(session.dragStartSlot))) { + session.dragCurrentSlot = slot; + + // Trace mode: immediately commit each slot as the cursor moves. + if (session.wlToolMode == 1) { + int k = ChestSeparatorsEditor.slotKey(slot); + if (session.isSelecting) session.selectedSlots.add(k); + else session.selectedSlots.remove(k); + } + } + return true; + } + } + return super.mouseDragged(mouseX, mouseY, button, dragX, dragY); + } + + public boolean mouseReleased(double mouseX, double mouseY, int button) { + if (button == 0 + && session.isDraggingLine + && (session.currentState == EditorState.VIEW_GROUPS + || session.currentState == EditorState.SELECT_SLOTS)) { + // Area mode: commit the rectangular selection on mouse release. Membership is by visual box + // (see slotsInDragBox) so crossing hotbar↔inventory selects only the cells actually swept, and + // the selection stays confined to the namespace the drag started in. + if (session.wlToolMode == 0 && session.dragStartSlot != null && session.dragCurrentSlot != null) { + for (Slot s : editor.slotsInDragBox(session.dragStartSlot, session.dragCurrentSlot)) { + int k = ChestSeparatorsEditor.slotKey(s); + if (session.isSelecting) session.selectedSlots.add(k); + else session.selectedSlots.remove(k); + } + } + session.isDraggingLine = false; + session.dragStartSlot = null; + session.dragCurrentSlot = null; + return true; + } + return false; + } + + @Override + public void render(GuiGraphicsExtractor context, int mouseX, int mouseY, float delta) { + + if (!widgets.isEmpty()) { + // Button press animations: hold the active state for 150 ms after each click. + widgets.get(1).isActive = (System.currentTimeMillis() - btnClearAllClickTime < 150); // Delete All Filters + widgets.get(4).isActive = (System.currentTimeMillis() - btnClearSelectClickTime < 150); // Clear Selection + widgets.get(5).isActive = (System.currentTimeMillis() - btnCopyClickTime < 150); // Copy + + widgets.get(6).isActive = (System.currentTimeMillis() - btnPasteClickTime < 150); // Paste + widgets.get(6).isDisabled = !ChestConfigManager.getInstance().hasWhitelistClipboardData(); + + widgets.get(7).isActive = (System.currentTimeMillis() - btnUndoClickTime < 150); // Undo + widgets.get(7).isDisabled = !ChestConfigManager.getInstance().canUndoWhitelist(); + + widgets.get(8).isActive = (System.currentTimeMillis() - btnRedoClickTime < 150); // Redo + widgets.get(8).isDisabled = !ChestConfigManager.getInstance().canRedoWhitelist(); + + // Tool toggle buttons: reflect the currently active selection mode. + widgets.get(2).isActive = (session.wlToolMode == 0); // Area Select + widgets.get(3).isActive = (session.wlToolMode == 1); // Trace Select + } + + // When a conflict popup is active, pass (-1, -1) as mouse coordinates so background + // buttons and slots do not react to hover or draw tooltips. + int bgMouseX = session.hasSelectionConflict ? -1 : mouseX; + int bgMouseY = session.hasSelectionConflict ? -1 : mouseY; + + renderWhitelistPreviewPanel(context, bgMouseX, bgMouseY); + groupRenderer.renderWhitelistGroups(context, bgMouseX, bgMouseY); + + if (session.currentState == EditorState.SELECT_SLOTS) { + renderSelectionOverlay(context); + for (CustomWidget w : selectSlotsWidgets) w.render(context, bgMouseX, bgMouseY, delta); + } + + // Main panel buttons are drawn last so their tooltips render on top of the chest. + if (session.currentState == EditorState.VIEW_GROUPS) { + super.render(context, bgMouseX, bgMouseY, delta); + } + + if (session.hasSelectionConflict) { + // Pass real mouse coordinates to the popup so its buttons remain clickable. + renderConflictPopup(context, mouseX, mouseY, delta); + } + } + + private void renderConflictPopup(GuiGraphicsExtractor context, int mouseX, int mouseY, float delta) { + context.fill(0, 0, layout.screenWidth, layout.screenHeight, 0xAA000000); + + boolean isDark = GlobalChestConfig.instance.darkMode; + // Cristal panel (rounded, glass) — matches the unsaved-changes/expel popups in the filter screen. + io.github.marcsanzdev.chestseparators.client.ui.UiTheme.panel( + context, layout.conflictPopupX, layout.conflictPopupY, layout.conflictPopupW, layout.conflictPopupH); + + Minecraft client = Minecraft.getInstance(); + int maxTextWidth = 240; // Max width matching the buttons + + // 1. Auto-scaling Title + Component title = Component.translatable("gui.chestseparators.conflict_title"); + int titleWidth = client.font.width(title); + float titleScale = titleWidth > maxTextWidth ? (float) maxTextWidth / titleWidth : 1.0f; + + context.pose().pushMatrix(); + context.pose() + .translate( + layout.conflictPopupX + layout.conflictPopupW / 2.0f, + layout.conflictPopupY + 12 + (4 * (1 - titleScale))); + context.pose().scale(titleScale, titleScale); + context.centeredText(client.font, title, 0, 0, 0xFFFF5555); + context.pose().popMatrix(); + + // 2. Auto-scaling Description + Component desc = Component.translatable("gui.chestseparators.conflict_desc"); + int descWidth = client.font.width(desc); + float descScale = descWidth > maxTextWidth ? (float) maxTextWidth / descWidth : 1.0f; + + int scaledDescWidth = (int) (descWidth * descScale); + int descX = layout.conflictPopupX + (layout.conflictPopupW - scaledDescWidth) / 2; + + context.pose().pushMatrix(); + context.pose().translate(descX, layout.conflictPopupY + 30 + (4 * (1 - descScale))); + context.pose().scale(descScale, descScale); + context.text(client.font, desc, 0, 0, isDark ? 0xFFDDDDDD : 0xFF333333, false); + context.pose().popMatrix(); + + for (CustomWidget w : popupWidgets) { + w.render(context, mouseX, mouseY, delta); + } + } + + private void renderSelectionOverlay(GuiGraphicsExtractor context) { + int guiX = layout.guiX; + int guiY = layout.guiY; + + for (Slot slot : editor.accessor.getHandler().slots) { + if (!ChestSeparatorsEditor.isEditableSlot(slot)) continue; + + // selectedSlots is keyed by slotKey (player slots carry PLAYER_KEY_OFFSET), so match on that — + // using the raw index would fail to highlight selected inventory slots. + if (session.selectedSlots.contains(ChestSeparatorsEditor.slotKey(slot))) { + context.fill(guiX + slot.x, guiY + slot.y, guiX + slot.x + 16, guiY + slot.y + 16, 0x7733FF33); + } + } + } + + // --- MIGRATED RENDERING LOGIC --- + + @Override + public boolean mouseScrolled(double mouseX, double mouseY, double horizontalAmount, double verticalAmount) { + if (session.hasSelectionConflict) return false; + + if (session.isPreviewing && session.previewItems != null) { + // Allow manual scroll when the cursor is over the preview panel or the chest grid. + boolean overPanel = mouseX >= layout.listX && mouseX <= layout.listX + layout.listW; + boolean overChest = mouseX >= layout.guiX && mouseX <= layout.guiX + layout.bgWidth; + + if (overPanel || overChest) { + float scrollSpeed = 18f; + int listViewH = layout.listH - 38; + float maxListScroll = Math.max(0, session.previewItems.size() * 18 - listViewH); + + session.listScrollY = Mth.clamp( + session.listScrollY - (float) (verticalAmount * scrollSpeed), 0, maxListScroll); + session.userOverrodePreviewScroll = true; + return true; + } + } + return false; + } + + void transitionToEditFilter() { + editor.prepareFilterMenu(); + + // Snapshot the just-loaded state so we can detect unsaved changes later. + session.originalItemsSnapshot = new ArrayList<>(session.currentAllowedItems); + session.originalRuleManual = session.ruleManual; + session.originalRuleShift = session.ruleShift; + session.originalRuleHopper = session.ruleHopper; + session.originalTargetCount = session.targetCount; + session.isUnsavedPopupOpen = false; + + editor.toggleState(EditorState.EDIT_FILTER); + } +} diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/screens/SeparatorDragCommitter.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/screens/SeparatorDragCommitter.java new file mode 100644 index 0000000..6a8ee68 --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/screens/SeparatorDragCommitter.java @@ -0,0 +1,334 @@ +package io.github.marcsanzdev.chestseparators.client.ui.screens; + +import io.github.marcsanzdev.chestseparators.client.ui.ChestSeparatorsEditor; +import io.github.marcsanzdev.chestseparators.client.ui.EditorSessionData; +import io.github.marcsanzdev.chestseparators.data.ChestConfigManager; +import net.minecraft.world.inventory.Slot; + +/** + * Applies a completed separator drag (area or trace, across the line/background/combo tabs) to + * ChestConfigManager. Extracted verbatim from ScreenDrawLines. + */ +final class SeparatorDragCommitter { + + private final ScreenDrawLines screen; + private final ChestSeparatorsEditor editor; + private final EditorSessionData session; + + SeparatorDragCommitter(ScreenDrawLines screen) { + this.screen = screen; + this.editor = screen.editor; + this.session = screen.session; + } + + void commit(double mouseX, double mouseY) { + if (session.dragStartSlot == null || session.dragCurrentSlot == null) return; + ChestConfigManager manager = ChestConfigManager.getInstance(); + boolean changeMade = false; + + // The drag is confined to the namespace of its start slot (chest vs inventory); grid-computed + // slot indices are offset into that namespace, and slot-iteration loops skip the other side. + boolean playerNs = ChestSeparatorsEditor.isPlayerSlot(session.dragStartSlot); + int off = playerNs ? ChestConfigManager.PLAYER_KEY_OFFSET : 0; + int nsCount = editor.geometry.getNamespaceSlotCount(playerNs); + + if (session.currentTab == EditorSessionData.TAB_COMBO) { + int colorToPaint = screen.getCurrentSelectedComboColorValue(); + boolean explicitEraser = (session.comboColorIndex == ChestSeparatorsEditor.TOOL_ERASER_ID); + if (colorToPaint == 0 && !explicitEraser) return; + + int allLinesAction = ChestConfigManager.ACTION_TOP + | ChestConfigManager.ACTION_BOTTOM + | ChestConfigManager.ACTION_LEFT + | ChestConfigManager.ACTION_RIGHT; + + if (session.comboToolMode == 0) { // Combo Area + // Membership + border by VISUAL box, so crossing hotbar↔inventory paints only the swept + // cells; the border is painted where the selected region has no neighbour (outer outline). + java.util.List sel = editor.slotsInDragBox(session.dragStartSlot, session.dragCurrentSlot); + java.util.Set selPos = new java.util.HashSet<>(); + for (Slot s : sel) selPos.add(SeparatorPreviewRenderer.boxKey(s.x, s.y)); + for (Slot slot : sel) { + int key = ChestSeparatorsEditor.slotKey(slot); + if (explicitEraser || session.isDragModeErasing) { + manager.removeAction(key, ChestConfigManager.ACTION_BG); + manager.removeAction(key, allLinesAction); + } else { + manager.paintAction(key, ChestConfigManager.ACTION_BG, colorToPaint); + + // Armor/offhand are isolated cells: always give them their full box; grid slots + // paint an edge only where the selection has no neighbour on that side. + boolean nonGrid = ChestConfigManager.isNonGridInventoryKey(key); + if (nonGrid || !selPos.contains(SeparatorPreviewRenderer.boxKey(slot.x, slot.y - 18))) + manager.paintAction(key, ChestConfigManager.ACTION_TOP, colorToPaint); + if (nonGrid || !selPos.contains(SeparatorPreviewRenderer.boxKey(slot.x, slot.y + 18))) + manager.paintAction(key, ChestConfigManager.ACTION_BOTTOM, colorToPaint); + if (nonGrid || !selPos.contains(SeparatorPreviewRenderer.boxKey(slot.x - 18, slot.y))) + manager.paintAction(key, ChestConfigManager.ACTION_LEFT, colorToPaint); + if (nonGrid || !selPos.contains(SeparatorPreviewRenderer.boxKey(slot.x + 18, slot.y))) + manager.paintAction(key, ChestConfigManager.ACTION_RIGHT, colorToPaint); + } + changeMade = true; + } + } else { // Combo Trace + java.util.Set traceSlots = new java.util.HashSet<>(); + for (String step : session.tracePath) { + traceSlots.add(Integer.parseInt(step.split("_")[0])); + } + + for (int slotIdx : traceSlots) { + if (explicitEraser || session.isDragModeErasing) { + manager.removeAction(slotIdx, ChestConfigManager.ACTION_BG); + manager.removeAction(slotIdx, allLinesAction); + } else { + manager.paintAction(slotIdx, ChestConfigManager.ACTION_BG, colorToPaint); + + // Armor and offhand are isolated (non-grid) cells: their keys are contiguous but + // they are not visual neighbours, so they never share/suppress an edge. A + // non-grid cell always gets its full box; grid cells ignore non-grid neighbours. + boolean nonGrid = ChestConfigManager.isNonGridInventoryKey(slotIdx); + boolean hasTop = !nonGrid + && traceSlots.contains(slotIdx - 9) + && !ChestConfigManager.isNonGridInventoryKey(slotIdx - 9); + boolean hasBottom = !nonGrid + && traceSlots.contains(slotIdx + 9) + && !ChestConfigManager.isNonGridInventoryKey(slotIdx + 9); + boolean hasLeft = !nonGrid + && (slotIdx % 9 != 0) + && traceSlots.contains(slotIdx - 1) + && !ChestConfigManager.isNonGridInventoryKey(slotIdx - 1); + boolean hasRight = !nonGrid + && (slotIdx % 9 != 8) + && traceSlots.contains(slotIdx + 1) + && !ChestConfigManager.isNonGridInventoryKey(slotIdx + 1); + + if (!hasTop) manager.paintAction(slotIdx, ChestConfigManager.ACTION_TOP, colorToPaint); + if (!hasBottom) manager.paintAction(slotIdx, ChestConfigManager.ACTION_BOTTOM, colorToPaint); + if (!hasLeft) manager.paintAction(slotIdx, ChestConfigManager.ACTION_LEFT, colorToPaint); + if (!hasRight) manager.paintAction(slotIdx, ChestConfigManager.ACTION_RIGHT, colorToPaint); + } + changeMade = true; + } + } + if (changeMade) { + editor.saveSmart(); + editor.playClickSound(1.0f); + } + return; + } + + if (session.currentDragAction == ChestConfigManager.ACTION_BG) { + int colorToPaint = screen.getCurrentSelectedBgColorValue(); + boolean explicitEraser = (session.bgColorIndex == ChestSeparatorsEditor.TOOL_ERASER_ID); + if (colorToPaint == 0 && !explicitEraser) return; + + if (session.bgToolMode == 0) { + // Membership by VISUAL box so crossing hotbar↔inventory fills only the swept cells. + boolean erase = explicitEraser || session.isDragModeErasing; + for (Slot slot : editor.slotsInDragBox(session.dragStartSlot, session.dragCurrentSlot)) { + int key = ChestSeparatorsEditor.slotKey(slot); + if (erase) manager.removeAction(key, ChestConfigManager.ACTION_BG); + else manager.paintAction(key, ChestConfigManager.ACTION_BG, colorToPaint); + changeMade = true; + } + } else { + for (String step : session.tracePath) { + int slotIdx = Integer.parseInt(step.split("_")[0]); + if (explicitEraser || session.isDragModeErasing) + manager.removeAction(slotIdx, ChestConfigManager.ACTION_BG); + else manager.paintAction(slotIdx, ChestConfigManager.ACTION_BG, colorToPaint); + changeMade = true; + } + } + } else { // PENCIL MODE + int colorToPaint = screen.getCurrentSelectedLineColorValue(); + boolean explicitEraser = (session.lineColorIndex == ChestSeparatorsEditor.TOOL_ERASER_ID); + if (colorToPaint == 0 && !explicitEraser) return; + + if (session.lineToolMode == 0) { // Pencil Area + boolean erase = explicitEraser || session.isDragModeErasing; + + int sRow = session.dragStartSlot.getContainerSlot() / 9; + int sCol = session.dragStartSlot.getContainerSlot() % 9; + int cRow = session.dragCurrentSlot.getContainerSlot() / 9; + int cCol = session.dragCurrentSlot.getContainerSlot() % 9; + + int minRow = Math.min(sRow, cRow); + int maxRow = Math.max(sRow, cRow); + int minCol = Math.min(sCol, cCol); + int maxCol = Math.max(sCol, cCol); + + // Armor/offhand are isolated (non-grid) cells outside the 9-wide grid: the grid + // rederivation below can't address them (their partial row is clamped back into the + // main inventory), which is why dragging lines over armor drew nothing on the armor + // and painted phantom lines mid-inventory. Give each covered non-grid slot its full + // box directly, exactly like the combo/trace tools do. + int allLines = ChestConfigManager.ACTION_TOP + | ChestConfigManager.ACTION_BOTTOM + | ChestConfigManager.ACTION_LEFT + | ChestConfigManager.ACTION_RIGHT; + // A single click on a non-grid cell paints only the clicked edge, exactly like the hover + // preview shows. The full box is drawn only when the gesture forms a rectangle — either a + // real multi-cell area sweep, or a corner-to-corner drag that crosses the cell's midpoint + // (isDraggingRectangle), matching how a single grid slot fills its whole box. + boolean isRect = editor.geometry.isDraggingRectangle(mouseX, mouseY); + int startKey = ChestSeparatorsEditor.slotKey(session.dragStartSlot); + for (Slot slot : editor.accessor.getHandler().slots) { + if (!ChestSeparatorsEditor.isEditableSlot(slot)) continue; + if (ChestSeparatorsEditor.isPlayerSlot(slot) != playerNs) continue; + int key = ChestSeparatorsEditor.slotKey(slot); + if (!ChestConfigManager.isNonGridInventoryKey(key)) continue; + int r = slot.getContainerSlot() / 9; + int c = slot.getContainerSlot() % 9; + if (r >= minRow && r <= maxRow && c >= minCol && c <= maxCol) { + if (!isRect && key == startKey) { + if (erase) manager.removeAction(key, session.currentDragAction); + else manager.paintAction(key, session.currentDragAction, colorToPaint); + } else if (erase) { + manager.removeAction(key, allLines); + } else { + manager.paintAction(key, ChestConfigManager.ACTION_TOP, colorToPaint); + manager.paintAction(key, ChestConfigManager.ACTION_BOTTOM, colorToPaint); + manager.paintAction(key, ChestConfigManager.ACTION_LEFT, colorToPaint); + manager.paintAction(key, ChestConfigManager.ACTION_RIGHT, colorToPaint); + } + changeMade = true; + } + } + + // Grid rederivation only covers the true 9-wide grid: the player namespace's grid is + // its first 36 slots (everything past that is the non-grid row handled above), while + // the chest namespace is fully grid. Skip entirely when the drag lies wholly in the + // non-grid row. + int gridSlotCount = playerNs ? 36 : nsCount; + int gridRows = gridSlotCount / 9; + if (minRow < gridRows) { + int yTopRaw = minRow * 2; + int yBotRaw = maxRow * 2 + 1; + if (session.currentDragAction == ChestConfigManager.ACTION_BOTTOM && cRow > sRow) + yTopRaw = sRow * 2 + 1; + else if (session.currentDragAction == ChestConfigManager.ACTION_TOP && cRow < sRow) + yBotRaw = sRow * 2; + + int xLeftRaw = minCol * 2; + int xRightRaw = maxCol * 2 + 1; + if (session.currentDragAction == ChestConfigManager.ACTION_RIGHT && cCol > sCol) + xLeftRaw = sCol * 2 + 1; + else if (session.currentDragAction == ChestConfigManager.ACTION_LEFT && cCol < sCol) + xRightRaw = sCol * 2; + + boolean isOuterIntent = + (session.currentDragAction == ChestConfigManager.ACTION_BOTTOM && cRow > sRow) + || (session.currentDragAction == ChestConfigManager.ACTION_TOP && cRow < sRow) + || (session.currentDragAction == ChestConfigManager.ACTION_RIGHT && cCol > sCol) + || (session.currentDragAction == ChestConfigManager.ACTION_LEFT && cCol < sCol); + + int yTopExp = yTopRaw; + int yBotExp = yBotRaw; + int xLeftExp = xLeftRaw; + int xRightExp = xRightRaw; + + if (isOuterIntent) { + if (yTopRaw % 2 == 0) yTopExp--; + if (yBotRaw % 2 != 0) yBotExp++; + if (xLeftRaw % 2 == 0) xLeftExp--; + if (xRightRaw % 2 != 0) xRightExp++; + } + + int maxRows = gridRows; + yTopExp = Math.max(0, Math.min(maxRows * 2 - 1, yTopExp)); + yBotExp = Math.max(0, Math.min(maxRows * 2 - 1, yBotExp)); + xLeftExp = Math.max(0, Math.min(17, xLeftExp)); + xRightExp = Math.max(0, Math.min(17, xRightExp)); + + boolean isRectangle = editor.geometry.isDraggingRectangle(mouseX, mouseY); + + if (isRectangle) { + if (erase) { + for (int r = Math.max(0, minRow - 1); r <= maxRow + 1; r++) { + for (int c = Math.max(0, minCol - 1); c <= maxCol + 1; c++) { + int slotIdx = r * 9 + c; + if (slotIdx >= gridSlotCount) continue; + int key = slotIdx + off; + + int topY = r * 2, botY = r * 2 + 1; + int leftX = c * 2, rightX = c * 2 + 1; + + boolean hInside = (leftX >= xLeftExp) && (rightX <= xRightExp); + boolean vInside = (topY >= yTopExp) && (botY <= yBotExp); + + if (hInside && topY >= yTopExp && topY <= yBotExp) + manager.removeAction(key, ChestConfigManager.ACTION_TOP); + if (hInside && botY >= yTopExp && botY <= yBotExp) + manager.removeAction(key, ChestConfigManager.ACTION_BOTTOM); + if (vInside && leftX >= xLeftExp && leftX <= xRightExp) + manager.removeAction(key, ChestConfigManager.ACTION_LEFT); + if (vInside && rightX >= xLeftExp && rightX <= xRightExp) + manager.removeAction(key, ChestConfigManager.ACTION_RIGHT); + } + } + } else { + int fillMinCol = (xLeftExp + 1) / 2; + int fillMaxCol = (xRightExp - 1) / 2; + int topAction = (yTopExp % 2 == 0) + ? ChestConfigManager.ACTION_TOP + : ChestConfigManager.ACTION_BOTTOM; + int topRow = yTopExp / 2; + int botAction = (yBotExp % 2 == 0) + ? ChestConfigManager.ACTION_TOP + : ChestConfigManager.ACTION_BOTTOM; + int botRow = yBotExp / 2; + + for (int c = fillMinCol; c <= fillMaxCol; c++) { + if (topRow * 9 + c < gridSlotCount) + manager.paintAction(topRow * 9 + c + off, topAction, colorToPaint); + if (botRow * 9 + c < gridSlotCount) + manager.paintAction(botRow * 9 + c + off, botAction, colorToPaint); + } + + int fillMinRow = (yTopExp + 1) / 2; + int fillMaxRow = (yBotExp - 1) / 2; + int leftAction = (xLeftExp % 2 == 0) + ? ChestConfigManager.ACTION_LEFT + : ChestConfigManager.ACTION_RIGHT; + int leftCol = xLeftExp / 2; + int rightAction = (xRightExp % 2 == 0) + ? ChestConfigManager.ACTION_LEFT + : ChestConfigManager.ACTION_RIGHT; + int rightCol = xRightExp / 2; + + for (int r = fillMinRow; r <= fillMaxRow; r++) { + if (r * 9 + leftCol < gridSlotCount) + manager.paintAction(r * 9 + leftCol + off, leftAction, colorToPaint); + if (r * 9 + rightCol < gridSlotCount) + manager.paintAction(r * 9 + rightCol + off, rightAction, colorToPaint); + } + } + changeMade = true; + } else { // 1D Line + for (int r = minRow; r <= Math.min(maxRow, gridRows - 1); r++) { + for (int c = minCol; c <= maxCol; c++) { + if (erase) manager.removeAction(r * 9 + c + off, session.currentDragAction); + else manager.paintAction(r * 9 + c + off, session.currentDragAction, colorToPaint); + } + } + changeMade = true; + } + } + } else { // Pencil Trace + for (String step : session.tracePath) { + String[] parts = step.split("_"); + int slotIdx = Integer.parseInt(parts[0]); + int act = Integer.parseInt(parts[1]); + if (explicitEraser || session.isDragModeErasing) manager.removeAction(slotIdx, act); + else manager.paintAction(slotIdx, act, colorToPaint); + changeMade = true; + } + } + } + if (changeMade) { + editor.saveSmart(); + editor.playClickSound(1.0f); + } + } +} diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/screens/SeparatorDragInput.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/screens/SeparatorDragInput.java new file mode 100644 index 0000000..74ce551 --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/screens/SeparatorDragInput.java @@ -0,0 +1,229 @@ +package io.github.marcsanzdev.chestseparators.client.ui.screens; + +import io.github.marcsanzdev.chestseparators.client.ui.ChestSeparatorsEditor; +import io.github.marcsanzdev.chestseparators.client.ui.EditorLayout; +import io.github.marcsanzdev.chestseparators.client.ui.EditorSessionData; +import io.github.marcsanzdev.chestseparators.data.ChestConfigManager; +import net.minecraft.world.inventory.Slot; + +/** + * Handles mouse-drag input for the separator editor: extends the trace path while painting and + * runs the pencil-trace vertex rollback/advance logic. Extracted verbatim from ScreenDrawLines. + */ +final class SeparatorDragInput { + + private final ChestSeparatorsEditor editor; + private final EditorSessionData session; + private final EditorLayout layout; + + SeparatorDragInput(ScreenDrawLines screen) { + this.editor = screen.editor; + this.session = screen.session; + this.layout = screen.layout; + } + + boolean onDrag(double mouseX, double mouseY) { + if (session.isColorPickerOpen) return false; + + if (session.isDraggingLine) { + Slot slot = editor.accessor.getFocusedSlot(); + // Confine the drag to the namespace it started in (no chest<->inventory crossover). + if (slot != null + && ChestSeparatorsEditor.isEditableSlot(slot) + && (session.dragStartSlot == null + || ChestSeparatorsEditor.isPlayerSlot(slot) + == ChestSeparatorsEditor.isPlayerSlot(session.dragStartSlot))) { + session.dragCurrentSlot = slot; + + int toolMode = (session.currentTab == 0) + ? session.lineToolMode + : (session.currentTab == 1 ? session.bgToolMode : session.comboToolMode); + + if (session.currentTab == 1 || session.currentTab == 2) { + if (toolMode == 1) { + editor.updateTracePath( + ChestSeparatorsEditor.slotKey(slot) + "_" + ChestConfigManager.ACTION_BG); + } + } else { + if (toolMode == 1) { + // Armor/offhand are isolated non-grid cells with no grid neighbours. The + // vertex-connection logic below projects segments along rows/columns via grid + // math (index%9, index/9, row*9+col), which is meaningless for them. But we + // still honour the axis lock via calculateTraceStep (patched to paint the + // locked edge on the hovered cell itself, without grid projection) so a + // vertical drag paints only the left/right edge and a horizontal one only + // top/bottom — exactly like the rest of the inventory. Skip the vertex + // undo/advance logic since there is nothing to connect to. + if (ChestConfigManager.isNonGridInventoryKey(ChestSeparatorsEditor.slotKey(slot))) { + String rawStep = editor.geometry.calculateTraceStep(slot, mouseX, mouseY); + if (rawStep != null && !rawStep.isEmpty() && !session.tracePath.contains(rawStep)) { + editor.updateTracePath(rawStep); + } + return true; + } + + int guiX = layout.guiX; + int guiY = layout.guiY; + + // 1. UNDO LOGIC (Exact rollback from connection vertex) + while (session.tracePath.size() >= 2) { + String currStep = session.tracePath.get(session.tracePath.size() - 1); + String prevStep = session.tracePath.get(session.tracePath.size() - 2); + + int currSlotIdx = Integer.parseInt(currStep.split("_")[0]); + int prevSlotIdx = Integer.parseInt(prevStep.split("_")[0]); + int currAction = Integer.parseInt(currStep.split("_")[1]); + int prevAction = Integer.parseInt(prevStep.split("_")[1]); + + Slot currSlot = editor.slotForKey(currSlotIdx); + if (currSlot == null) break; + double cRelX = mouseX - (guiX + currSlot.x); + double cRelY = mouseY - (guiY + currSlot.y); + + // Calculate vertices (P1 and P2) of the previous line + int c1 = prevSlotIdx % 9, r1 = prevSlotIdx / 9; + int v1x1 = c1, v1y1 = r1, v1x2 = c1, v1y2 = r1; + if (prevAction == ChestConfigManager.ACTION_TOP) { + v1x2 = c1 + 1; + } else if (prevAction == ChestConfigManager.ACTION_BOTTOM) { + v1y1 = r1 + 1; + v1x2 = c1 + 1; + v1y2 = r1 + 1; + } else if (prevAction == ChestConfigManager.ACTION_LEFT) { + v1y2 = r1 + 1; + } else if (prevAction == ChestConfigManager.ACTION_RIGHT) { + v1x1 = c1 + 1; + v1x2 = c1 + 1; + v1y2 = r1 + 1; + } + + // Calculate vertices of the current line + int c2 = currSlotIdx % 9, r2 = currSlotIdx / 9; + int v2x1 = c2, v2y1 = r2, v2x2 = c2, v2y2 = r2; + if (currAction == ChestConfigManager.ACTION_TOP) { + v2x2 = c2 + 1; + } else if (currAction == ChestConfigManager.ACTION_BOTTOM) { + v2y1 = r2 + 1; + v2x2 = c2 + 1; + v2y2 = r2 + 1; + } else if (currAction == ChestConfigManager.ACTION_LEFT) { + v2y2 = r2 + 1; + } else if (currAction == ChestConfigManager.ACTION_RIGHT) { + v2x1 = c2 + 1; + v2x2 = c2 + 1; + v2y2 = r2 + 1; + } + + // Which vertex of the current line connects to the previous line? + boolean sharedV1 = (v2x1 == v1x1 && v2y1 == v1y1) || (v2x1 == v1x2 && v2y1 == v1y2); + boolean sharedV2 = (v2x2 == v1x1 && v2y2 == v1y1) || (v2x2 == v1x2 && v2y2 == v1y2); + + boolean undo = false; + if (currAction == ChestConfigManager.ACTION_LEFT + || currAction == ChestConfigManager.ACTION_RIGHT) { + if (sharedV1 && cRelY < 8) undo = true; + if (sharedV2 && cRelY > 8) undo = true; + } else { + if (sharedV1 && cRelX < 8) undo = true; + if (sharedV2 && cRelX > 8) undo = true; + } + + if (undo) { + session.tracePath.remove(session.tracePath.size() - 1); + session.lockedTraceAction = prevAction; + Slot prevSlot = editor.slotForKey(prevSlotIdx); + if (prevSlot == null) break; + if (prevAction == ChestConfigManager.ACTION_TOP + || prevAction == ChestConfigManager.ACTION_BOTTOM) { + session.lockedTraceAxis = 1; + session.lockedTraceRowCol = prevSlotIdx / 9; + session.lockedLineCoord = (prevAction == ChestConfigManager.ACTION_TOP) + ? (guiY + prevSlot.y) + : (guiY + prevSlot.y + 16); + } else { + session.lockedTraceAxis = 2; + session.lockedTraceRowCol = prevSlotIdx % 9; + session.lockedLineCoord = (prevAction == ChestConfigManager.ACTION_LEFT) + ? (guiX + prevSlot.x) + : (guiX + prevSlot.x + 16); + } + } else { + break; + } + } + + // 2. PAINT LOGIC (Advance crossing the middle) + String rawStep = editor.geometry.calculateTraceStep(slot, mouseX, mouseY); + if (rawStep != null && !rawStep.isEmpty()) { + if (!session.tracePath.contains(rawStep)) { + int rawSlotIdx = Integer.parseInt(rawStep.split("_")[0]); + String lastStep = session.tracePath.get(session.tracePath.size() - 1); + int lastSlotIdx = Integer.parseInt(lastStep.split("_")[0]); + + int rawAction = Integer.parseInt(rawStep.split("_")[1]); + int lastAction = Integer.parseInt(lastStep.split("_")[1]); + + Slot rawSlot = editor.slotForKey(rawSlotIdx); + if (rawSlot == null) return true; + double rRelX = mouseX - (guiX + rawSlot.x); + double rRelY = mouseY - (guiY + rawSlot.y); + + int c1 = lastSlotIdx % 9, r1 = lastSlotIdx / 9; + int v1x1 = c1, v1y1 = r1, v1x2 = c1, v1y2 = r1; + if (lastAction == ChestConfigManager.ACTION_TOP) { + v1x2 = c1 + 1; + } else if (lastAction == ChestConfigManager.ACTION_BOTTOM) { + v1y1 = r1 + 1; + v1x2 = c1 + 1; + v1y2 = r1 + 1; + } else if (lastAction == ChestConfigManager.ACTION_LEFT) { + v1y2 = r1 + 1; + } else if (lastAction == ChestConfigManager.ACTION_RIGHT) { + v1x1 = c1 + 1; + v1x2 = c1 + 1; + v1y2 = r1 + 1; + } + + int c2 = rawSlotIdx % 9, r2 = rawSlotIdx / 9; + int v2x1 = c2, v2y1 = r2, v2x2 = c2, v2y2 = r2; + if (rawAction == ChestConfigManager.ACTION_TOP) { + v2x2 = c2 + 1; + } else if (rawAction == ChestConfigManager.ACTION_BOTTOM) { + v2y1 = r2 + 1; + v2x2 = c2 + 1; + v2y2 = r2 + 1; + } else if (rawAction == ChestConfigManager.ACTION_LEFT) { + v2y2 = r2 + 1; + } else if (rawAction == ChestConfigManager.ACTION_RIGHT) { + v2x1 = c2 + 1; + v2x2 = c2 + 1; + v2y2 = r2 + 1; + } + + boolean sharedV1 = (v2x1 == v1x1 && v2y1 == v1y1) || (v2x1 == v1x2 && v2y1 == v1y2); + boolean sharedV2 = (v2x2 == v1x1 && v2y2 == v1y1) || (v2x2 == v1x2 && v2y2 == v1y2); + + if (sharedV1 || sharedV2) { + boolean shouldAdd = false; + if (rawAction == ChestConfigManager.ACTION_LEFT + || rawAction == ChestConfigManager.ACTION_RIGHT) { + if (sharedV1 && rRelY >= 8) shouldAdd = true; + if (sharedV2 && rRelY <= 8) shouldAdd = true; + } else { + if (sharedV1 && rRelX >= 8) shouldAdd = true; + if (sharedV2 && rRelX <= 8) shouldAdd = true; + } + if (shouldAdd) editor.updateTracePath(rawStep); + } + } else { + editor.updateTracePath(rawStep); + } + } + } + } + } + return true; + } + return false; + } +} diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/screens/SeparatorPreviewRenderer.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/screens/SeparatorPreviewRenderer.java new file mode 100644 index 0000000..e0c9486 --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/screens/SeparatorPreviewRenderer.java @@ -0,0 +1,734 @@ +package io.github.marcsanzdev.chestseparators.client.ui.screens; + +import io.github.marcsanzdev.chestseparators.client.ui.ChestSeparatorsEditor; +import io.github.marcsanzdev.chestseparators.client.ui.EditorGeometry; +import io.github.marcsanzdev.chestseparators.client.ui.EditorLayout; +import io.github.marcsanzdev.chestseparators.client.ui.EditorSessionData; +import io.github.marcsanzdev.chestseparators.data.ChestConfigManager; +import net.minecraft.client.gui.GuiGraphicsExtractor; +import net.minecraft.world.inventory.Slot; + +/** + * Draws the live hover and drag previews for the separator editor. Pure rendering: it reads + * editor/session state and paints, never mutating anything. Extracted verbatim from ScreenDrawLines. + */ +final class SeparatorPreviewRenderer { + + private final ScreenDrawLines screen; + private final ChestSeparatorsEditor editor; + private final EditorSessionData session; + private final EditorLayout layout; + private final EditorGeometry geometry; + + SeparatorPreviewRenderer(ScreenDrawLines screen) { + this.screen = screen; + this.editor = screen.editor; + this.session = screen.session; + this.layout = screen.layout; + this.geometry = screen.geometry; + } + + void renderHoverPreview(GuiGraphicsExtractor context, int mouseX, int mouseY) { + Slot slot = editor.accessor.getFocusedSlot(); + if (slot != null && ChestSeparatorsEditor.isEditableSlot(slot)) { + int tabMode = session.currentTab; + int action = (tabMode == 2 || tabMode == 1) + ? ChestConfigManager.ACTION_BG + : geometry.calculateAction(slot, mouseX, mouseY); + + int colorVal = 0; + boolean explicitEraser = false; + if (tabMode == 0) { + colorVal = screen.getCurrentSelectedLineColorValue(); + explicitEraser = (session.lineColorIndex == ChestSeparatorsEditor.TOOL_ERASER_ID); + } else if (tabMode == 1) { + colorVal = screen.getCurrentSelectedBgColorValue(); + explicitEraser = (session.bgColorIndex == ChestSeparatorsEditor.TOOL_ERASER_ID); + } else if (tabMode == 2) { + colorVal = screen.getCurrentSelectedComboColorValue(); + explicitEraser = (session.comboColorIndex == ChestSeparatorsEditor.TOOL_ERASER_ID); + } + + if (colorVal == 0 && !explicitEraser) return; + + boolean willErase = explicitEraser; + if (!willErase && tabMode != 2) { + int existingColor = ChestConfigManager.getInstance().getColor(slot.getContainerSlot(), action); + if (existingColor == (colorVal | 0xFF000000)) willErase = true; + } + + int colorBg = willErase ? 0x66FFFFFF : ((colorVal & 0x00FFFFFF) | 0x66000000); + int colorLine = willErase ? 0x88FFFFFF : ((colorVal & 0x00FFFFFF) | 0x88000000); + + int x = layout.guiX + slot.x; + int y = layout.guiY + slot.y; + + if (tabMode == 1) { + if (!willErase + || ChestConfigManager.getInstance() + .getColor(ChestSeparatorsEditor.slotKey(slot), ChestConfigManager.ACTION_BG) + != 0) { + context.fill(x, y, x + 16, y + 16, colorBg); + } + } else if (tabMode == 0) { + if (action != 0 && action != ChestConfigManager.ACTION_BG) { + if ((action & ChestConfigManager.ACTION_TOP) != 0 + && (!willErase + || ChestConfigManager.getInstance() + .getColor( + ChestSeparatorsEditor.slotKey(slot), + ChestConfigManager.ACTION_TOP) + != 0)) context.fill(x - 1, y - 1, x + 17, y, colorLine); + if ((action & ChestConfigManager.ACTION_BOTTOM) != 0 + && (!willErase + || ChestConfigManager.getInstance() + .getColor( + ChestSeparatorsEditor.slotKey(slot), + ChestConfigManager.ACTION_BOTTOM) + != 0)) context.fill(x - 1, y + 16, x + 17, y + 17, colorLine); + if ((action & ChestConfigManager.ACTION_LEFT) != 0 + && (!willErase + || ChestConfigManager.getInstance() + .getColor( + ChestSeparatorsEditor.slotKey(slot), + ChestConfigManager.ACTION_LEFT) + != 0)) context.fill(x - 1, y - 1, x, y + 17, colorLine); + if ((action & ChestConfigManager.ACTION_RIGHT) != 0 + && (!willErase + || ChestConfigManager.getInstance() + .getColor( + ChestSeparatorsEditor.slotKey(slot), + ChestConfigManager.ACTION_RIGHT) + != 0)) context.fill(x + 16, y - 1, x + 17, y + 17, colorLine); + } + } else { + if (!willErase + || ChestConfigManager.getInstance() + .getColor(ChestSeparatorsEditor.slotKey(slot), ChestConfigManager.ACTION_BG) + != 0) context.fill(x, y, x + 16, y + 16, colorBg); + if (!willErase + || ChestConfigManager.getInstance() + .getColor(ChestSeparatorsEditor.slotKey(slot), ChestConfigManager.ACTION_TOP) + != 0) context.fill(x - 1, y - 1, x + 17, y, colorLine); + if (!willErase + || ChestConfigManager.getInstance() + .getColor(ChestSeparatorsEditor.slotKey(slot), ChestConfigManager.ACTION_BOTTOM) + != 0) context.fill(x - 1, y + 16, x + 17, y + 17, colorLine); + if (!willErase + || ChestConfigManager.getInstance() + .getColor(ChestSeparatorsEditor.slotKey(slot), ChestConfigManager.ACTION_LEFT) + != 0) context.fill(x - 1, y - 1, x, y + 17, colorLine); + if (!willErase + || ChestConfigManager.getInstance() + .getColor(ChestSeparatorsEditor.slotKey(slot), ChestConfigManager.ACTION_RIGHT) + != 0) context.fill(x + 16, y - 1, x + 17, y + 17, colorLine); + } + } + } + + void renderDragPreview(GuiGraphicsExtractor context, int mouseX, int mouseY) { + if (!session.isDraggingLine) return; + // Inventory drags use offset keys and include the non-grid armor/offhand cells, so they get a + // dedicated, namespace-correct preview instead of the raw-index chest path below. + if (session.dragStartSlot != null && ChestSeparatorsEditor.isPlayerSlot(session.dragStartSlot)) { + renderPlayerDragPreview(context, mouseX, mouseY); + return; + } + int guiX = layout.guiX; + int guiY = layout.guiY; + int tabMode = session.currentTab; + + int colorVal = 0; + boolean explicitEraser = false; + int tMode = 0; + if (tabMode == 0) { + colorVal = screen.getCurrentSelectedLineColorValue(); + explicitEraser = (session.lineColorIndex == ChestSeparatorsEditor.TOOL_ERASER_ID); + tMode = session.lineToolMode; + } else if (tabMode == 1) { + colorVal = screen.getCurrentSelectedBgColorValue(); + explicitEraser = (session.bgColorIndex == ChestSeparatorsEditor.TOOL_ERASER_ID); + tMode = session.bgToolMode; + } else if (tabMode == 2) { + colorVal = screen.getCurrentSelectedComboColorValue(); + explicitEraser = (session.comboColorIndex == ChestSeparatorsEditor.TOOL_ERASER_ID); + tMode = session.comboToolMode; + } + + if (colorVal == 0 && !explicitEraser) return; + + boolean erase = explicitEraser || session.isDragModeErasing; + int colorBg = erase ? 0x66FFFFFF : ((colorVal & 0x00FFFFFF) | 0x66000000); + int colorLine = erase ? 0x88FFFFFF : ((colorVal & 0x00FFFFFF) | 0x88000000); + + if (tabMode == 1) { + if (tMode == 0) { + int startRow = session.dragStartSlot.getContainerSlot() / 9; + int startCol = session.dragStartSlot.getContainerSlot() % 9; + int currRow = session.dragCurrentSlot.getContainerSlot() / 9; + int currCol = session.dragCurrentSlot.getContainerSlot() % 9; + int minRow = Math.min(startRow, currRow); + int maxRow = Math.max(startRow, currRow); + int minCol = Math.min(startCol, currCol); + int maxCol = Math.max(startCol, currCol); + for (Slot slot : editor.accessor.getHandler().slots) { + if (!ChestSeparatorsEditor.isEditableSlot(slot)) continue; + // Chest namespace only: player-inventory drags are handled by renderPlayerDragPreview. + // Without this, raw getIndex() of player slots (0-35) collides with chest indices and the + // chest preview gets mirrored onto the inventory. + if (ChestSeparatorsEditor.isPlayerSlot(slot)) continue; + int r = slot.getContainerSlot() / 9; + int c = slot.getContainerSlot() % 9; + if (r >= minRow && r <= maxRow && c >= minCol && c <= maxCol) { + if (erase + && ChestConfigManager.getInstance() + .getColor( + ChestSeparatorsEditor.slotKey(slot), + ChestConfigManager.ACTION_BG) + == 0) continue; + context.fill(guiX + slot.x, guiY + slot.y, guiX + slot.x + 16, guiY + slot.y + 16, colorBg); + } + } + } else { + for (String step : session.tracePath) { + int slotIdx = Integer.parseInt(step.split("_")[0]); + if (erase && ChestConfigManager.getInstance().getColor(slotIdx, ChestConfigManager.ACTION_BG) == 0) + continue; + Slot slot = editor.accessor.getHandler().getSlot(slotIdx); + context.fill(guiX + slot.x, guiY + slot.y, guiX + slot.x + 16, guiY + slot.y + 16, colorBg); + } + } + } else if (tabMode == 2) { + if (tMode == 0) { + int startRow = session.dragStartSlot.getContainerSlot() / 9; + int startCol = session.dragStartSlot.getContainerSlot() % 9; + int currRow = session.dragCurrentSlot.getContainerSlot() / 9; + int currCol = session.dragCurrentSlot.getContainerSlot() % 9; + int minRow = Math.min(startRow, currRow); + int maxRow = Math.max(startRow, currRow); + int minCol = Math.min(startCol, currCol); + int maxCol = Math.max(startCol, currCol); + for (Slot slot : editor.accessor.getHandler().slots) { + if (!ChestSeparatorsEditor.isEditableSlot(slot)) continue; + // Chest namespace only; player drags go through renderPlayerDragPreview. + if (ChestSeparatorsEditor.isPlayerSlot(slot)) continue; + int slotIdx = slot.getContainerSlot(); + int r = slotIdx / 9; + int c = slotIdx % 9; + if (r >= minRow && r <= maxRow && c >= minCol && c <= maxCol) { + int x = guiX + slot.x; + int y = guiY + slot.y; + if (!erase + || ChestConfigManager.getInstance().getColor(slotIdx, ChestConfigManager.ACTION_BG) + != 0) context.fill(x, y, x + 16, y + 16, colorBg); + if (r == minRow + && (!erase + || ChestConfigManager.getInstance() + .getColor(slotIdx, ChestConfigManager.ACTION_TOP) + != 0)) context.fill(x - 1, y - 1, x + 17, y, colorLine); + if (r == maxRow + && (!erase + || ChestConfigManager.getInstance() + .getColor(slotIdx, ChestConfigManager.ACTION_BOTTOM) + != 0)) context.fill(x - 1, y + 16, x + 17, y + 17, colorLine); + if (c == minCol + && (!erase + || ChestConfigManager.getInstance() + .getColor(slotIdx, ChestConfigManager.ACTION_LEFT) + != 0)) context.fill(x - 1, y - 1, x, y + 17, colorLine); + if (c == maxCol + && (!erase + || ChestConfigManager.getInstance() + .getColor(slotIdx, ChestConfigManager.ACTION_RIGHT) + != 0)) context.fill(x + 16, y - 1, x + 17, y + 17, colorLine); + } + } + } else { + java.util.Set traceSlots = new java.util.HashSet<>(); + for (String step : session.tracePath) { + traceSlots.add(Integer.parseInt(step.split("_")[0])); + } + for (int slotIdx : traceSlots) { + Slot slot = editor.accessor.getHandler().getSlot(slotIdx); + int x = guiX + slot.x; + int y = guiY + slot.y; + boolean hasTop = traceSlots.contains(slotIdx - 9); + boolean hasBottom = traceSlots.contains(slotIdx + 9); + boolean hasLeft = (slotIdx % 9 != 0) && traceSlots.contains(slotIdx - 1); + boolean hasRight = (slotIdx % 9 != 8) && traceSlots.contains(slotIdx + 1); + + if (!erase || ChestConfigManager.getInstance().getColor(slotIdx, ChestConfigManager.ACTION_BG) != 0) + context.fill(x, y, x + 16, y + 16, colorBg); + if (!hasTop + && (!erase + || ChestConfigManager.getInstance().getColor(slotIdx, ChestConfigManager.ACTION_TOP) + != 0)) context.fill(x - 1, y - 1, x + 17, y, colorLine); + if (!hasBottom + && (!erase + || ChestConfigManager.getInstance() + .getColor(slotIdx, ChestConfigManager.ACTION_BOTTOM) + != 0)) context.fill(x - 1, y + 16, x + 17, y + 17, colorLine); + if (!hasLeft + && (!erase + || ChestConfigManager.getInstance() + .getColor(slotIdx, ChestConfigManager.ACTION_LEFT) + != 0)) context.fill(x - 1, y - 1, x, y + 17, colorLine); + if (!hasRight + && (!erase + || ChestConfigManager.getInstance() + .getColor(slotIdx, ChestConfigManager.ACTION_RIGHT) + != 0)) context.fill(x + 16, y - 1, x + 17, y + 17, colorLine); + } + } + } else { + if (tMode == 0) { + int sRow = session.dragStartSlot.getContainerSlot() / 9; + int sCol = session.dragStartSlot.getContainerSlot() % 9; + int cRow = session.dragCurrentSlot.getContainerSlot() / 9; + int cCol = session.dragCurrentSlot.getContainerSlot() % 9; + int minRow = Math.min(sRow, cRow); + int maxRow = Math.max(sRow, cRow); + int minCol = Math.min(sCol, cCol); + int maxCol = Math.max(sCol, cCol); + + int yTopRaw = minRow * 2; + int yBotRaw = maxRow * 2 + 1; + if (session.currentDragAction == ChestConfigManager.ACTION_BOTTOM && cRow > sRow) + yTopRaw = sRow * 2 + 1; + else if (session.currentDragAction == ChestConfigManager.ACTION_TOP && cRow < sRow) yBotRaw = sRow * 2; + + int xLeftRaw = minCol * 2; + int xRightRaw = maxCol * 2 + 1; + if (session.currentDragAction == ChestConfigManager.ACTION_RIGHT && cCol > sCol) + xLeftRaw = sCol * 2 + 1; + else if (session.currentDragAction == ChestConfigManager.ACTION_LEFT && cCol < sCol) + xRightRaw = sCol * 2; + + boolean isOuterIntent = (session.currentDragAction == ChestConfigManager.ACTION_BOTTOM && cRow > sRow) + || (session.currentDragAction == ChestConfigManager.ACTION_TOP && cRow < sRow) + || (session.currentDragAction == ChestConfigManager.ACTION_RIGHT && cCol > sCol) + || (session.currentDragAction == ChestConfigManager.ACTION_LEFT && cCol < sCol); + + int yTopExp = yTopRaw; + int yBotExp = yBotRaw; + int xLeftExp = xLeftRaw; + int xRightExp = xRightRaw; + + if (isOuterIntent) { + if (yTopRaw % 2 == 0) yTopExp--; + if (yBotRaw % 2 != 0) yBotExp++; + if (xLeftRaw % 2 == 0) xLeftExp--; + if (xRightRaw % 2 != 0) xRightExp++; + } + + int maxRows = geometry.getContainerSlotCount() / 9; + yTopExp = Math.max(0, Math.min(maxRows * 2 - 1, yTopExp)); + yBotExp = Math.max(0, Math.min(maxRows * 2 - 1, yBotExp)); + xLeftExp = Math.max(0, xLeftExp); + xRightExp = Math.max(0, Math.min(17, xRightExp)); + + if (geometry.isDraggingRectangle(mouseX, mouseY)) { + Slot startRowSlot = editor.accessor.getHandler().getSlot((yTopExp / 2) * 9); + int topY = guiY + startRowSlot.y + (yTopExp % 2 == 0 ? -1 : 16); + Slot endRowSlot = editor.accessor.getHandler().getSlot((yBotExp / 2) * 9); + int botY = guiY + endRowSlot.y + (yBotExp % 2 == 0 ? 0 : 17); + Slot startColSlot = editor.accessor.getHandler().getSlot(xLeftExp / 2); + int leftX = guiX + startColSlot.x + (xLeftExp % 2 == 0 ? -1 : 16); + Slot endColSlot = editor.accessor.getHandler().getSlot(xRightExp / 2); + int rightX = guiX + endColSlot.x + (xRightExp % 2 == 0 ? 0 : 17); + + context.fill(leftX, topY, rightX, topY + 1, colorLine); + context.fill(leftX, botY - 1, rightX, botY, colorLine); + context.fill(leftX, topY, leftX + 1, botY, colorLine); + context.fill(rightX - 1, topY, rightX, botY, colorLine); + + if (erase) { + for (int r = Math.max(0, minRow - 1); r <= maxRow + 1; r++) { + for (int c = Math.max(0, minCol - 1); c <= maxCol + 1; c++) { + int slotIdx = r * 9 + c; + if (slotIdx >= geometry.getContainerSlotCount()) continue; + Slot s = editor.accessor.getHandler().getSlot(slotIdx); + int x = guiX + s.x; + int y = guiY + s.y; + int tY = r * 2, bY = r * 2 + 1; + int lX = c * 2, rX = c * 2 + 1; + boolean hInside = (lX >= xLeftExp) && (rX <= xRightExp); + boolean vInside = (tY >= yTopExp) && (bY <= yBotExp); + if (hInside + && tY >= yTopExp + && tY <= yBotExp + && ChestConfigManager.getInstance() + .getColor(slotIdx, ChestConfigManager.ACTION_TOP) + != 0) context.fill(x - 1, y - 1, x + 17, y, colorLine); + if (hInside + && bY >= yTopExp + && bY <= yBotExp + && ChestConfigManager.getInstance() + .getColor(slotIdx, ChestConfigManager.ACTION_BOTTOM) + != 0) context.fill(x - 1, y + 16, x + 17, y + 17, colorLine); + if (vInside + && lX >= xLeftExp + && lX <= xRightExp + && ChestConfigManager.getInstance() + .getColor(slotIdx, ChestConfigManager.ACTION_LEFT) + != 0) context.fill(x - 1, y - 1, x, y + 17, colorLine); + if (vInside + && rX >= xLeftExp + && rX <= xRightExp + && ChestConfigManager.getInstance() + .getColor(slotIdx, ChestConfigManager.ACTION_RIGHT) + != 0) context.fill(x + 16, y - 1, x + 17, y + 17, colorLine); + } + } + } + } else { + for (int r = minRow; r <= maxRow; r++) { + for (int c = minCol; c <= maxCol; c++) { + int slotIdx = r * 9 + c; + Slot s = editor.accessor.getHandler().getSlot(slotIdx); + int x = guiX + s.x; + int y = guiY + s.y; + if ((session.currentDragAction & ChestConfigManager.ACTION_TOP) != 0) + context.fill(x - 1, y - 1, x + 17, y, colorLine); + if ((session.currentDragAction & ChestConfigManager.ACTION_BOTTOM) != 0) + context.fill(x - 1, y + 16, x + 17, y + 17, colorLine); + if ((session.currentDragAction & ChestConfigManager.ACTION_LEFT) != 0) + context.fill(x - 1, y - 1, x, y + 17, colorLine); + if ((session.currentDragAction & ChestConfigManager.ACTION_RIGHT) != 0) + context.fill(x + 16, y - 1, x + 17, y + 17, colorLine); + } + } + } + } else { + for (String step : session.tracePath) { + String[] parts = step.split("_"); + int slotIdx = Integer.parseInt(parts[0]); + int act = Integer.parseInt(parts[1]); + Slot slot = editor.accessor.getHandler().getSlot(slotIdx); + int x = guiX + slot.x; + int y = guiY + slot.y; + if ((act & ChestConfigManager.ACTION_TOP) != 0 + && (!erase + || ChestConfigManager.getInstance().getColor(slotIdx, ChestConfigManager.ACTION_TOP) + != 0)) context.fill(x - 1, y - 1, x + 17, y, colorLine); + if ((act & ChestConfigManager.ACTION_BOTTOM) != 0 + && (!erase + || ChestConfigManager.getInstance() + .getColor(slotIdx, ChestConfigManager.ACTION_BOTTOM) + != 0)) context.fill(x - 1, y + 16, x + 17, y + 17, colorLine); + if ((act & ChestConfigManager.ACTION_LEFT) != 0 + && (!erase + || ChestConfigManager.getInstance() + .getColor(slotIdx, ChestConfigManager.ACTION_LEFT) + != 0)) context.fill(x - 1, y - 1, x, y + 17, colorLine); + if ((act & ChestConfigManager.ACTION_RIGHT) != 0 + && (!erase + || ChestConfigManager.getInstance() + .getColor(slotIdx, ChestConfigManager.ACTION_RIGHT) + != 0)) context.fill(x + 16, y - 1, x + 17, y + 17, colorLine); + } + } + } + } + + /** + * Live drag preview for the player inventory namespace. Uses offset keys (positioned via + * {@link ChestSeparatorsEditor#slotForKey}) and treats armor/offhand as isolated non-grid cells so + * each gets its full box. Kept separate from the chest preview, which uses raw container indices. + */ + private void renderPlayerDragPreview(GuiGraphicsExtractor context, int mouseX, int mouseY) { + int guiX = layout.guiX; + int guiY = layout.guiY; + int tabMode = session.currentTab; + + int colorVal; + boolean explicitEraser; + int tMode; + if (tabMode == 0) { + colorVal = screen.getCurrentSelectedLineColorValue(); + explicitEraser = (session.lineColorIndex == ChestSeparatorsEditor.TOOL_ERASER_ID); + tMode = session.lineToolMode; + } else if (tabMode == 1) { + colorVal = screen.getCurrentSelectedBgColorValue(); + explicitEraser = (session.bgColorIndex == ChestSeparatorsEditor.TOOL_ERASER_ID); + tMode = session.bgToolMode; + } else { + colorVal = screen.getCurrentSelectedComboColorValue(); + explicitEraser = (session.comboColorIndex == ChestSeparatorsEditor.TOOL_ERASER_ID); + tMode = session.comboToolMode; + } + if (colorVal == 0 && !explicitEraser) return; + + int colorBg = (colorVal & 0x00FFFFFF) | 0x66000000; + int colorLine = (colorVal & 0x00FFFFFF) | 0x88000000; + if (explicitEraser || session.isDragModeErasing) { + colorBg = 0x66FFFFFF; + colorLine = 0x88FFFFFF; + } + + if (tMode == 1) { // Trace + java.util.Set traceSlots = new java.util.HashSet<>(); + for (String s : session.tracePath) traceSlots.add(Integer.parseInt(s.split("_")[0])); + for (String step : session.tracePath) { + String[] p = step.split("_"); + int key = Integer.parseInt(p[0]); + int act = Integer.parseInt(p[1]); + Slot slot = editor.slotForKey(key); + if (slot == null) continue; + int x = guiX + slot.x; + int y = guiY + slot.y; + if (tabMode == 1) { + context.fill(x, y, x + 16, y + 16, colorBg); + } else if (tabMode == 2) { + context.fill(x, y, x + 16, y + 16, colorBg); + boolean nonGrid = ChestConfigManager.isNonGridInventoryKey(key); + boolean hasTop = !nonGrid + && traceSlots.contains(key - 9) + && !ChestConfigManager.isNonGridInventoryKey(key - 9); + boolean hasBottom = !nonGrid + && traceSlots.contains(key + 9) + && !ChestConfigManager.isNonGridInventoryKey(key + 9); + boolean hasLeft = !nonGrid + && (key % 9 != 0) + && traceSlots.contains(key - 1) + && !ChestConfigManager.isNonGridInventoryKey(key - 1); + boolean hasRight = !nonGrid + && (key % 9 != 8) + && traceSlots.contains(key + 1) + && !ChestConfigManager.isNonGridInventoryKey(key + 1); + if (!hasTop) context.fill(x - 1, y - 1, x + 17, y, colorLine); + if (!hasBottom) context.fill(x - 1, y + 16, x + 17, y + 17, colorLine); + if (!hasLeft) context.fill(x - 1, y - 1, x, y + 17, colorLine); + if (!hasRight) context.fill(x + 16, y - 1, x + 17, y + 17, colorLine); + } else { + if ((act & ChestConfigManager.ACTION_TOP) != 0) context.fill(x - 1, y - 1, x + 17, y, colorLine); + if ((act & ChestConfigManager.ACTION_BOTTOM) != 0) + context.fill(x - 1, y + 16, x + 17, y + 17, colorLine); + if ((act & ChestConfigManager.ACTION_LEFT) != 0) context.fill(x - 1, y - 1, x, y + 17, colorLine); + if ((act & ChestConfigManager.ACTION_RIGHT) != 0) + context.fill(x + 16, y - 1, x + 17, y + 17, colorLine); + } + } + return; + } + + // Pencil line tool keeps its intricate index-based grid geometry (mirrors the committer exactly). + if (tabMode == 0) { + int sRow = session.dragStartSlot.getContainerSlot() / 9; + int sCol = session.dragStartSlot.getContainerSlot() % 9; + int cRow = session.dragCurrentSlot.getContainerSlot() / 9; + int cCol = session.dragCurrentSlot.getContainerSlot() % 9; + int minRow = Math.min(sRow, cRow); + int maxRow = Math.max(sRow, cRow); + int minCol = Math.min(sCol, cCol); + int maxCol = Math.max(sCol, cCol); + boolean erase = explicitEraser || session.isDragModeErasing; + renderPlayerLineAreaPreview( + context, mouseX, mouseY, minRow, maxRow, minCol, maxCol, sRow, sCol, cRow, cCol, colorLine, erase); + return; + } + + // Bg/combo area: membership + border by VISUAL box (slotsInDragBox), so a drag crossing the hotbar + // and the inventory rows covers exactly the swept cells. index/9 rows get this wrong because the + // hotbar is drawn below the inventory yet its indices (0-8) come first. + java.util.List sel = editor.slotsInDragBox(session.dragStartSlot, session.dragCurrentSlot); + java.util.Set selPos = new java.util.HashSet<>(); + for (Slot s : sel) selPos.add(boxKey(s.x, s.y)); + for (Slot slot : sel) { + int x = guiX + slot.x; + int y = guiY + slot.y; + if (tabMode == 1) { + context.fill(x, y, x + 16, y + 16, colorBg); + } else { // tabMode == 2 (combo): outline the selected region (edge where no selected neighbour) + context.fill(x, y, x + 16, y + 16, colorBg); + boolean nonGrid = ChestConfigManager.isNonGridInventoryKey(ChestSeparatorsEditor.slotKey(slot)); + if (nonGrid || !selPos.contains(boxKey(slot.x, slot.y - 18))) + context.fill(x - 1, y - 1, x + 17, y, colorLine); + if (nonGrid || !selPos.contains(boxKey(slot.x, slot.y + 18))) + context.fill(x - 1, y + 16, x + 17, y + 17, colorLine); + if (nonGrid || !selPos.contains(boxKey(slot.x - 18, slot.y))) + context.fill(x - 1, y - 1, x, y + 17, colorLine); + if (nonGrid || !selPos.contains(boxKey(slot.x + 18, slot.y))) + context.fill(x + 16, y - 1, x + 17, y + 17, colorLine); + } + } + } + + /** Position key for a slot's on-screen cell, used to test same-group visual neighbours. */ + static long boxKey(int x, int y) { + return ((long) x << 20) ^ (y & 0xFFFFF); + } + + /** + * Live preview for the pencil line tool in area mode over the player inventory. Mirrors + * {@link SeparatorDragCommitter}'s pencil-area branch edge-for-edge so what the user sees before + * releasing is exactly what gets committed: non-grid armor/offhand cells get their full box, while + * the true 9-wide grid (first 36 player slots) uses the rectangle-border / 1D-line logic. + */ + private void renderPlayerLineAreaPreview( + GuiGraphicsExtractor context, + int mouseX, + int mouseY, + int minRow, + int maxRow, + int minCol, + int maxCol, + int sRow, + int sCol, + int cRow, + int cCol, + int colorLine, + boolean erase) { + ChestConfigManager m = ChestConfigManager.getInstance(); + int off = ChestConfigManager.PLAYER_KEY_OFFSET; + + // Non-grid armor/offhand cells: full box when the gesture forms a rectangle (area sweep or a + // corner-to-corner drag crossing the midpoint), but only the clicked edge on a single click — + // mirrors the committer so the preview always matches what lands. + boolean isRect = editor.geometry.isDraggingRectangle(mouseX, mouseY); + int startKey = ChestSeparatorsEditor.slotKey(session.dragStartSlot); + for (Slot slot : editor.accessor.getHandler().slots) { + if (!ChestSeparatorsEditor.isEditableSlot(slot) || !ChestSeparatorsEditor.isPlayerSlot(slot)) continue; + int key = ChestSeparatorsEditor.slotKey(slot); + if (!ChestConfigManager.isNonGridInventoryKey(key)) continue; + int r = slot.getContainerSlot() / 9; + int c = slot.getContainerSlot() % 9; + if (r < minRow || r > maxRow || c < minCol || c > maxCol) continue; + if (!isRect && key == startKey) { + int single = session.currentDragAction; + if (!erase || m.getColor(key, single) != 0) drawPreviewEdge(context, key, single, colorLine); + continue; + } + int mask = 0; + if (!erase || m.getColor(key, ChestConfigManager.ACTION_TOP) != 0) mask |= ChestConfigManager.ACTION_TOP; + if (!erase || m.getColor(key, ChestConfigManager.ACTION_BOTTOM) != 0) + mask |= ChestConfigManager.ACTION_BOTTOM; + if (!erase || m.getColor(key, ChestConfigManager.ACTION_LEFT) != 0) mask |= ChestConfigManager.ACTION_LEFT; + if (!erase || m.getColor(key, ChestConfigManager.ACTION_RIGHT) != 0) + mask |= ChestConfigManager.ACTION_RIGHT; + drawPreviewEdge(context, key, mask, colorLine); + } + + int gridSlotCount = 36; + int gridRows = gridSlotCount / 9; + if (minRow >= gridRows) return; + + int yTopRaw = minRow * 2; + int yBotRaw = maxRow * 2 + 1; + if (session.currentDragAction == ChestConfigManager.ACTION_BOTTOM && cRow > sRow) yTopRaw = sRow * 2 + 1; + else if (session.currentDragAction == ChestConfigManager.ACTION_TOP && cRow < sRow) yBotRaw = sRow * 2; + + int xLeftRaw = minCol * 2; + int xRightRaw = maxCol * 2 + 1; + if (session.currentDragAction == ChestConfigManager.ACTION_RIGHT && cCol > sCol) xLeftRaw = sCol * 2 + 1; + else if (session.currentDragAction == ChestConfigManager.ACTION_LEFT && cCol < sCol) xRightRaw = sCol * 2; + + boolean isOuterIntent = (session.currentDragAction == ChestConfigManager.ACTION_BOTTOM && cRow > sRow) + || (session.currentDragAction == ChestConfigManager.ACTION_TOP && cRow < sRow) + || (session.currentDragAction == ChestConfigManager.ACTION_RIGHT && cCol > sCol) + || (session.currentDragAction == ChestConfigManager.ACTION_LEFT && cCol < sCol); + + int yTopExp = yTopRaw; + int yBotExp = yBotRaw; + int xLeftExp = xLeftRaw; + int xRightExp = xRightRaw; + if (isOuterIntent) { + if (yTopRaw % 2 == 0) yTopExp--; + if (yBotRaw % 2 != 0) yBotExp++; + if (xLeftRaw % 2 == 0) xLeftExp--; + if (xRightRaw % 2 != 0) xRightExp++; + } + + int maxRows = gridRows; + yTopExp = Math.max(0, Math.min(maxRows * 2 - 1, yTopExp)); + yBotExp = Math.max(0, Math.min(maxRows * 2 - 1, yBotExp)); + xLeftExp = Math.max(0, Math.min(17, xLeftExp)); + xRightExp = Math.max(0, Math.min(17, xRightExp)); + + if (geometry.isDraggingRectangle(mouseX, mouseY)) { + if (erase) { + for (int r = Math.max(0, minRow - 1); r <= maxRow + 1; r++) { + for (int c = Math.max(0, minCol - 1); c <= maxCol + 1; c++) { + int slotIdx = r * 9 + c; + if (slotIdx >= gridSlotCount) continue; + int key = slotIdx + off; + int topY = r * 2, botY = r * 2 + 1; + int leftX = c * 2, rightX = c * 2 + 1; + boolean hInside = (leftX >= xLeftExp) && (rightX <= xRightExp); + boolean vInside = (topY >= yTopExp) && (botY <= yBotExp); + int mask = 0; + if (hInside + && topY >= yTopExp + && topY <= yBotExp + && m.getColor(key, ChestConfigManager.ACTION_TOP) != 0) + mask |= ChestConfigManager.ACTION_TOP; + if (hInside + && botY >= yTopExp + && botY <= yBotExp + && m.getColor(key, ChestConfigManager.ACTION_BOTTOM) != 0) + mask |= ChestConfigManager.ACTION_BOTTOM; + if (vInside + && leftX >= xLeftExp + && leftX <= xRightExp + && m.getColor(key, ChestConfigManager.ACTION_LEFT) != 0) + mask |= ChestConfigManager.ACTION_LEFT; + if (vInside + && rightX >= xLeftExp + && rightX <= xRightExp + && m.getColor(key, ChestConfigManager.ACTION_RIGHT) != 0) + mask |= ChestConfigManager.ACTION_RIGHT; + drawPreviewEdge(context, key, mask, colorLine); + } + } + } else { + int fillMinCol = (xLeftExp + 1) / 2; + int fillMaxCol = (xRightExp - 1) / 2; + int topAction = (yTopExp % 2 == 0) ? ChestConfigManager.ACTION_TOP : ChestConfigManager.ACTION_BOTTOM; + int topRow = yTopExp / 2; + int botAction = (yBotExp % 2 == 0) ? ChestConfigManager.ACTION_TOP : ChestConfigManager.ACTION_BOTTOM; + int botRow = yBotExp / 2; + for (int c = fillMinCol; c <= fillMaxCol; c++) { + if (topRow * 9 + c < gridSlotCount) + drawPreviewEdge(context, topRow * 9 + c + off, topAction, colorLine); + if (botRow * 9 + c < gridSlotCount) + drawPreviewEdge(context, botRow * 9 + c + off, botAction, colorLine); + } + + int fillMinRow = (yTopExp + 1) / 2; + int fillMaxRow = (yBotExp - 1) / 2; + int leftAction = (xLeftExp % 2 == 0) ? ChestConfigManager.ACTION_LEFT : ChestConfigManager.ACTION_RIGHT; + int leftCol = xLeftExp / 2; + int rightAction = + (xRightExp % 2 == 0) ? ChestConfigManager.ACTION_LEFT : ChestConfigManager.ACTION_RIGHT; + int rightCol = xRightExp / 2; + for (int r = fillMinRow; r <= fillMaxRow; r++) { + if (r * 9 + leftCol < gridSlotCount) + drawPreviewEdge(context, r * 9 + leftCol + off, leftAction, colorLine); + if (r * 9 + rightCol < gridSlotCount) + drawPreviewEdge(context, r * 9 + rightCol + off, rightAction, colorLine); + } + } + } else { // 1D Line + for (int r = minRow; r <= Math.min(maxRow, gridRows - 1); r++) { + for (int c = minCol; c <= maxCol; c++) { + int key = r * 9 + c + off; + if (erase && m.getColor(key, session.currentDragAction) == 0) continue; + drawPreviewEdge(context, key, session.currentDragAction, colorLine); + } + } + } + } + + /** Draws the requested edge(s) of a slot (looked up by its offset key) with the given preview color. */ + private void drawPreviewEdge(GuiGraphicsExtractor context, int key, int actionMask, int color) { + if (actionMask == 0) return; + Slot slot = editor.slotForKey(key); + if (slot == null) return; + int x = layout.guiX + slot.x; + int y = layout.guiY + slot.y; + if ((actionMask & ChestConfigManager.ACTION_TOP) != 0) context.fill(x - 1, y - 1, x + 17, y, color); + if ((actionMask & ChestConfigManager.ACTION_BOTTOM) != 0) context.fill(x - 1, y + 16, x + 17, y + 17, color); + if ((actionMask & ChestConfigManager.ACTION_LEFT) != 0) context.fill(x - 1, y - 1, x, y + 17, color); + if ((actionMask & ChestConfigManager.ACTION_RIGHT) != 0) context.fill(x + 16, y - 1, x + 17, y + 17, color); + } +} diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/screens/ViewGroupsClickHandler.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/screens/ViewGroupsClickHandler.java new file mode 100644 index 0000000..f80c0dc --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/screens/ViewGroupsClickHandler.java @@ -0,0 +1,172 @@ +package io.github.marcsanzdev.chestseparators.client.ui.screens; + +import com.mojang.blaze3d.platform.InputConstants; +import io.github.marcsanzdev.chestseparators.client.EditorState; +import io.github.marcsanzdev.chestseparators.client.ui.ChestSeparatorsEditor; +import io.github.marcsanzdev.chestseparators.client.ui.EditorGeometry; +import io.github.marcsanzdev.chestseparators.client.ui.EditorLayout; +import io.github.marcsanzdev.chestseparators.client.ui.EditorSessionData; +import io.github.marcsanzdev.chestseparators.client.ui.widgets.CustomWidget; +import io.github.marcsanzdev.chestseparators.config.GlobalChestConfig; +import io.github.marcsanzdev.chestseparators.data.ChestConfigManager; +import io.github.marcsanzdev.chestseparators.data.SlotWhitelist; +import net.minecraft.client.Minecraft; +import net.minecraft.world.inventory.Slot; + +/** + * Handles mouse-click routing for the group-view screen: the conflict popup, the right-panel action + * buttons, slot selection (area/trace), and the per-slot rule tabs. Extracted from ScreenViewGroups. + */ +final class ViewGroupsClickHandler { + + private final ScreenViewGroups screen; + private final ChestSeparatorsEditor editor; + private final EditorSessionData session; + private final EditorLayout layout; + private final EditorGeometry geometry; + + ViewGroupsClickHandler(ScreenViewGroups screen) { + this.screen = screen; + this.editor = screen.editor; + this.session = screen.session; + this.layout = screen.layout; + this.geometry = screen.geometry; + } + + boolean onMouseClicked(double mouseX, double mouseY, int button) { + // Forward clicks to the conflict resolution popup; block all background clicks. + if (session.hasSelectionConflict) { + for (CustomWidget widget : screen.popupWidgets) { + if (widget.mouseClicked(mouseX, mouseY, button)) return true; + } + return true; + } + + // Forward clicks to the confirm/cancel buttons during slot-selection mode. + if (session.currentState == EditorState.SELECT_SLOTS) { + for (CustomWidget widget : screen.selectSlotsWidgets) { + if (widget.mouseClicked(mouseX, mouseY, button)) return true; + } + } + // Right-panel buttons (only active in VIEW_GROUPS state). + else if (session.currentState == EditorState.VIEW_GROUPS) { + if (editor.whitelistSearchBox != null) { + if (editor.whitelistSearchBox.isMouseOver(mouseX, mouseY)) { + if (button == 0) editor.whitelistSearchBox.setFocused(true); + return true; + } else if (button == 0) { + editor.whitelistSearchBox.setFocused(false); + } + } + if (screen.clickWidgets(mouseX, mouseY, button)) return true; + } + + // Slot selection logic for VIEW_GROUPS and SELECT_SLOTS. + if (button == 0 + && (session.currentState == EditorState.VIEW_GROUPS + || session.currentState == EditorState.SELECT_SLOTS)) { + Slot slot = editor.accessor.getFocusedSlot(); + if (slot != null && ChestSeparatorsEditor.isEditableSlot(slot)) { + int key = ChestSeparatorsEditor.slotKey(slot); + // Mutual exclusion: ignore clicks on the dimmed (other-namespace) side once a selection + // exists — a single filter cannot span the chest and the player inventory. + if (!session.selectedSlots.isEmpty() + && ChestConfigManager.isInventoryKey( + session.selectedSlots.iterator().next()) + != ChestSeparatorsEditor.isPlayerSlot(slot)) { + return true; + } + java.util.UUID groupId = editor.geometry.getGroupIdForSlot(key); + long now = System.currentTimeMillis(); + boolean isDoubleClick = + (key == session.lastClickedSlotIndex && (now - session.lastSlotClickTime) < 300); + + boolean isShiftDown = InputConstants.isKeyDown(InputConstants.KEY_LSHIFT) + || InputConstants.isKeyDown(InputConstants.KEY_RSHIFT); + + if (session.currentState == EditorState.VIEW_GROUPS + && groupId != null + && session.selectedSlots.isEmpty() + && !isShiftDown + && !isDoubleClick) { + session.selectedGroupId = groupId; + session.selectedSlots.clear(); + var whitelists = ChestConfigManager.getInstance().getCurrentWhitelists(); + if (whitelists != null) { + for (java.util.Map.Entry entry : whitelists.entrySet()) { + if (groupId.equals(entry.getValue().groupId())) { + session.selectedSlots.add(entry.getKey()); + } + } + } + screen.transitionToEditFilter(); + editor.playClickSound(1.0f); + return true; + } else if (isDoubleClick) { + boolean player = ChestSeparatorsEditor.isPlayerSlot(slot); + int lo = player ? ChestConfigManager.PLAYER_KEY_OFFSET : 0; + int hi = lo + editor.geometry.getNamespaceSlotCount(player); + java.util.Set contiguous = + ChestConfigManager.getInstance().getContiguousSlots(key, lo, hi); + + if (session.isSelecting) session.selectedSlots.addAll(contiguous); + else session.selectedSlots.removeAll(contiguous); + + session.lastClickedSlotIndex = key; + session.lastSlotClickTime = now; + editor.playClickSound(1.2f); + return true; + } else { + if (session.selectedSlots.contains(key)) { + session.selectedSlots.remove(key); + session.isSelecting = false; + } else { + session.selectedSlots.add(key); + session.isSelecting = true; + } + + session.isDraggingLine = true; + session.dragStartSlot = slot; + session.dragCurrentSlot = slot; + + session.lastClickedSlotIndex = key; + session.lastSlotClickTime = now; + editor.playClickSound(1.2f); + return true; + } + } + } + // --- CLICK OUTSIDE / ON DEAD SPACE TO CLOSE --- + if (button == 0 && !session.hasSelectionConflict && GlobalChestConfig.instance.closeOnClickOutside) { + // Close on any click that is not over an editable slot and not on the side panels — including + // dead space inside the container, which selects nothing and so should dismiss the panel. + boolean overSlot = editor.accessor.getFocusedSlot() != null + && ChestSeparatorsEditor.isEditableSlot(editor.accessor.getFocusedSlot()); + boolean isInsideRight = mouseX >= layout.rightX + && mouseX <= layout.rightX + layout.btnW + && mouseY >= layout.mainY + && mouseY <= layout.mainY + 178 + layout.bH; + + boolean isInsideLeft = false; + if (GlobalChestConfig.instance.showLeftPanel + || io.github.marcsanzdev.chestseparators.event.KeyInputHandler.isModifierPressed()) { + isInsideLeft = mouseX >= layout.listX + && mouseX <= layout.listX + layout.listW + && mouseY >= layout.listY + && mouseY <= layout.listY + layout.listH; + } + + if (!overSlot && !isInsideRight && !isInsideLeft) { + if (session.currentState == EditorState.SELECT_SLOTS) { + editor.toggleState(EditorState.VIEW_GROUPS); + } else { + editor.toggleState(EditorState.HIDDEN); + } + editor.playCloseSound(); + return true; + } + } + + return false; + } +} diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/screens/WhitelistPreviewPanelRenderer.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/screens/WhitelistPreviewPanelRenderer.java new file mode 100644 index 0000000..2b5fd95 --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/screens/WhitelistPreviewPanelRenderer.java @@ -0,0 +1,297 @@ +package io.github.marcsanzdev.chestseparators.client.ui.screens; + +import io.github.marcsanzdev.chestseparators.client.ModTextures; +import io.github.marcsanzdev.chestseparators.client.ui.ChestSeparatorsEditor; +import io.github.marcsanzdev.chestseparators.client.ui.EditorLayout; +import io.github.marcsanzdev.chestseparators.client.ui.EditorSessionData; +import io.github.marcsanzdev.chestseparators.config.GlobalChestConfig; +import io.github.marcsanzdev.chestseparators.data.ChestConfigManager; +import io.github.marcsanzdev.chestseparators.data.SlotWhitelist; +import java.util.ArrayList; +import java.util.UUID; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiGraphicsExtractor; +import net.minecraft.world.inventory.Slot; +import net.minecraft.network.chat.Component; +import net.minecraft.util.Mth; + +/** + * Renders the always-on left-side whitelist preview panel shown in normal mode, including the + * per-rule indicator tabs. Pure rendering, extracted verbatim from ScreenViewGroups. + */ +final class WhitelistPreviewPanelRenderer { + + private final ScreenViewGroups screen; + private final ChestSeparatorsEditor editor; + private final EditorSessionData session; + private final EditorLayout layout; + + WhitelistPreviewPanelRenderer(ScreenViewGroups screen) { + this.screen = screen; + this.editor = screen.editor; + this.session = screen.session; + this.layout = screen.layout; + } + + void renderWhitelistPreviewPanel(GuiGraphicsExtractor context, int mouseX, int mouseY) { + int listW = layout.listW; + int listH = layout.listH; + int listX = layout.listX; + int listY = layout.listY; + + int guiX = layout.guiX; + int guiY = layout.guiY; + + boolean isDark = GlobalChestConfig.instance.darkMode; + + io.github.marcsanzdev.chestseparators.client.ui.UiTheme.panel(context, listX, listY, listW, listH); + + Slot hoveredSlot = null; + for (Slot slot : editor.accessor.getHandler().slots) { + if (ChestSeparatorsEditor.isEditableSlot(slot) + && editor.isHovering(guiX + slot.x - 1, guiY + slot.y - 1, 18, 18, mouseX, mouseY)) { + hoveredSlot = slot; + break; + } + } + + if (hoveredSlot != null) { + var whitelists = ChestConfigManager.getInstance().getCurrentWhitelists(); + int hoveredKey = ChestSeparatorsEditor.slotKey(hoveredSlot); + if (whitelists != null && whitelists.containsKey(hoveredKey)) { + SlotWhitelist wl = whitelists.get(hoveredKey); + UUID currentGroupId = wl.groupId(); + + if (!session.isPreviewing || !currentGroupId.equals(session.lastHoveredGroupId)) { + session.previewItems = new ArrayList<>(wl.allowedItems()); + session.listScrollY = 0f; + session.isPreviewing = true; + session.lastHoveredGroupId = currentGroupId; + + long now = System.currentTimeMillis(); + session.previewStartTime = now; + session.lastPreviewTime = now; + session.previewScrollDirectionDown = true; + session.userOverrodePreviewScroll = false; + } + } else { + session.isPreviewing = false; + session.previewItems.clear(); + session.lastHoveredGroupId = null; + } + } else { + if (!editor.isHovering(listX, listY, listW, listH, mouseX, mouseY)) { + session.isPreviewing = false; + session.previewItems.clear(); + session.lastHoveredGroupId = null; + } + } + + Component title = session.isPreviewing + ? Component.translatable("gui.chestseparators.group_filter") + : Component.translatable("gui.chestseparators.no_filter"); + int colorTitle = session.isPreviewing ? 0xFF55FF55 : 0xFFAAAAAA; + int itemCount = session.isPreviewing ? session.previewItems.size() : 0; + + context.pose().pushMatrix(); + float scaleC = 0.8f; + context.pose().scale(scaleC, scaleC); + context.text( + Minecraft.getInstance().font, + title, + (int) ((listX + 8) / scaleC), + (int) ((listY + 8) / scaleC), + colorTitle, + false); + context.text( + Minecraft.getInstance().font, + Component.translatable("gui.chestseparators.items_count", itemCount), + (int) ((listX + 8) / scaleC), + (int) ((listY + 18) / scaleC), + 0xFFFFFFFF, + false); + context.pose().popMatrix(); + + int listViewY = listY + 32; + int listViewH = listH - 38; + io.github.marcsanzdev.chestseparators.client.ui.UiTheme.inset( + context, listX + 6, listViewY, listW - 12, listViewH); + + if (!session.isPreviewing) { + Component hoverText = Component.translatable("gui.chestseparators.hover_group"); + int textX = listX + 12; + int textY = listViewY + 10; + int maxTextW = listW - 24; + + for (net.minecraft.util.FormattedCharSequence line : + Minecraft.getInstance().font.split(hoverText, maxTextW)) { + context.text(Minecraft.getInstance().font, line, textX, textY, 0xFF666666, false); + textY += Minecraft.getInstance().font.lineHeight + 2; + } + return; + } + + int totalListItems = session.previewItems.size(); + int totalListHeight = totalListItems * 18; + float maxListScroll = Math.max(0, totalListHeight - listViewH); + + long now = System.currentTimeMillis(); + float dt = (now - session.lastPreviewTime) / 1000f; + session.lastPreviewTime = now; + + if (!session.userOverrodePreviewScroll && maxListScroll > 0 && (now - session.previewStartTime > 1000)) { + if (GlobalChestConfig.instance.enablePreviewAnimation) { + float speed = 25f; + if (session.previewScrollDirectionDown) { + session.listScrollY += speed * dt; + if (session.listScrollY >= maxListScroll) { + session.listScrollY = maxListScroll; + session.previewScrollDirectionDown = false; + session.previewStartTime = now; + } + } else { + session.listScrollY -= speed * dt; + if (session.listScrollY <= 0) { + session.listScrollY = 0; + session.previewScrollDirectionDown = true; + session.previewStartTime = now; + } + } + } + } + + session.listScrollY = Mth.clamp(session.listScrollY, 0, maxListScroll); + + context.enableScissor(listX + 6, listViewY + 1, listX + listW - 14, listViewY + listViewH - 1); + int startIndex = (int) (session.listScrollY / 18); + int visibleCount = (listViewH / 18) + 2; + + if (session.previewItems.isEmpty()) { + Component emptyText = Component.translatable("gui.chestseparators.empty_whitelist"); + int textX = listX + 12; + int textY = listViewY + 10; + int maxTextW = listW - 24; + + for (net.minecraft.util.FormattedCharSequence line : + Minecraft.getInstance().font.split(emptyText, maxTextW)) { + context.text(Minecraft.getInstance().font, line, textX, textY, 0xFF888888, false); + textY += Minecraft.getInstance().font.lineHeight + 2; + } + } + + for (int i = 0; i < visibleCount; i++) { + int idx = startIndex + i; + if (idx >= totalListItems) break; + + String itemIdStr = session.previewItems.get(idx); + net.minecraft.world.item.Item item = + net.minecraft.core.registries.BuiltInRegistries.ITEM.getValue(net.minecraft.resources.Identifier.tryParse(itemIdStr)); + + int itemY = listViewY + (i * 18) - (int) (session.listScrollY % 18) + 2; + context.item(item.getDefaultInstance(), listX + 8, itemY); + + String name = item.getName(item.getDefaultInstance()).getString(); + context.pose().pushMatrix(); + float scale = 0.75f; + context.pose().scale(scale, scale); + int maxNameW = (int) ((listW - 35) / scale); + if (Minecraft.getInstance().font.width(name) > maxNameW) { + name = Minecraft.getInstance().font.plainSubstrByWidth(name, maxNameW - 6) + "..."; + } + int textColor = isDark ? 0xFFDDDDDD : 0xFF222222; + context.text( + Minecraft.getInstance().font, + name, + (int) ((listX + 26) / scale), + (int) ((itemY + 6) / scale), + textColor, + false); + context.pose().popMatrix(); + } + context.disableScissor(); + + // Draw the rule indicator tabs to the left of the preview panel. + if (session.isPreviewing && session.lastHoveredGroupId != null) { + SlotWhitelist activeWl = null; + var whitelists = ChestConfigManager.getInstance().getCurrentWhitelists(); + if (whitelists != null) { + for (SlotWhitelist wl : whitelists.values()) { + if (wl.groupId().equals(session.lastHoveredGroupId)) { + activeWl = wl; + break; + } + } + } + + if (activeWl != null) { + // Tabs sit on the OUTER side of the panel: to its left on the normal left dock, to its right + // when the panel is flipped right (recipe book open), so they never point back into the GUI. + int tabX = layout.listOnRight ? (listX + listW) : (listX - 20); + int startY = listY + 12; + + drawRuleTab(context, tabX, startY, ModTextures.ICON_SM_MANUAL, activeWl.allowManual()); + drawRuleTab(context, tabX, startY + 24, ModTextures.ICON_SM_SHIFT, activeWl.allowShift()); + // The Hopper rule can never be toggled on an Ender Chest (hoppers cannot reach it), so its + // indicator tab would always be meaningless — omit it entirely there. + if (!session.isEnderChest) { + drawRuleTab( + context, + tabX, + startY + 48, + session.isPlayerInventory ? ModTextures.ICON_SM_PICKUP : ModTextures.ICON_SM_HOPPER, + activeWl.allowHopper()); + } + } + } + + int lsbX = listX + listW - 13; + int lsbH = listViewH - 1; + int listThumbH = maxListScroll > 0 + ? Math.max(10, (int) ((listViewH / (float) Math.max(1, totalListHeight)) * lsbH)) + : lsbH; + int listThumbY = maxListScroll > 0 + ? listViewY + (int) ((session.listScrollY / maxListScroll) * (lsbH - listThumbH)) + : listViewY; + io.github.marcsanzdev.chestseparators.client.ui.UiTheme.scrollbar( + context, lsbX, listViewY, 6, lsbH, listThumbY, listThumbH); + + for (int i = 0; i < visibleCount; i++) { + int idx = startIndex + i; + if (idx >= totalListItems) break; + net.minecraft.world.item.Item item = net.minecraft.core.registries.BuiltInRegistries.ITEM.getValue( + net.minecraft.resources.Identifier.tryParse(session.previewItems.get(idx))); + int itemY = listViewY + (i * 18) - (int) (session.listScrollY % 18) + 2; + + if (editor.isHovering(listX + 8, itemY, 16, 16, mouseX, mouseY) + && mouseY >= listViewY + && mouseY <= listViewY + listViewH) { + context.outline(listX + 7, itemY - 1, 18, 18, 0xFFFFFFFF); + context.setTooltipForNextFrame(Minecraft.getInstance().font, item.getName(item.getDefaultInstance()), mouseX, mouseY); + } + } + } + + private void drawRuleTab(GuiGraphicsExtractor context, int x, int y, net.minecraft.resources.Identifier icon, boolean isActive) { + int w = 20; + int h = 20; + // Cristal tab embedded flush into the preview panel: it attaches on the edge that faces the panel — + // its right edge on the normal left dock, its left edge when the panel is flipped to the right. + int attach = layout.listOnRight + ? io.github.marcsanzdev.chestseparators.client.ui.UiTheme.ATTACH_LEFT + : io.github.marcsanzdev.chestseparators.client.ui.UiTheme.ATTACH_RIGHT; + io.github.marcsanzdev.chestseparators.client.ui.UiTheme.tab(context, x, y, w, h, false, isActive, attach); + + int color = isActive + ? io.github.marcsanzdev.chestseparators.client.ui.UiTheme.ICON_ACTIVE + : io.github.marcsanzdev.chestseparators.client.ui.UiTheme.TEXT_MUTED; + com.mojang.renderpearl.api.pipeline.RenderPipeline pipeline = net.minecraft.client.renderer.RenderPipelines.GUI_TEXTURED; + // An active tab draws 1px smaller; shrink its icon by the same proportion. + if (isActive) { + io.github.marcsanzdev.chestseparators.client.ui.UiTheme.pushActiveContent(context, x, y, w, h); + } + context.blit(pipeline, icon, x + 2, y + 2, 0.0F, 0.0F, 16, 16, 128, 128, 128, 128, color); + if (isActive) { + context.pose().popMatrix(); + } + } +} diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/widgets/ActionIconButtonWidget.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/widgets/ActionIconButtonWidget.java new file mode 100644 index 0000000..1d7a2c9 --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/widgets/ActionIconButtonWidget.java @@ -0,0 +1,95 @@ +package io.github.marcsanzdev.chestseparators.client.ui.widgets; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiGraphicsExtractor; +import net.minecraft.network.chat.Component; +import net.minecraft.resources.Identifier; + +public class ActionIconButtonWidget extends CustomWidget { + + public String label; + public Identifier icon; + public int baseColor; + /** Source texture size to sample. 32 = legacy pixel icons; 128 = smooth vector icons (with blur mcmeta). */ + public int texSize = 32; + + public ActionIconButtonWidget( + int x, int y, int width, int height, String label, Identifier icon, int baseColor, Runnable onClickAction) { + super(x, y, width, height, onClickAction); + this.label = label; + this.icon = icon; + this.baseColor = baseColor; + } + + @Override + public void render(GuiGraphicsExtractor context, int mouseX, int mouseY, float delta) { + if (this.isDisabled) return; + + boolean hover = isHovering(mouseX, mouseY); + boolean active = this.isActive || PressAnim.active(x, y); + io.github.marcsanzdev.chestseparators.client.ui.UiTheme.button(context, x, y, width, height, hover, active); + + // The active/pressed button draws 1px smaller; shrink its icon+label by the same proportion. + if (active) { + io.github.marcsanzdev.chestseparators.client.ui.UiTheme.pushActiveContent(context, x, y, width, height); + } + + float scale = 0.85f; + int textWidth = Minecraft.getInstance().font.width(label); + int iconSpace = (icon != null ? 20 : 0); + int availableTextWidth = width - 8 - iconSpace; + + String displayText = label; + + if (textWidth * scale > availableTextWidth) { + scale = (float) availableTextWidth / textWidth; + if (scale < 0.60f) { + scale = 0.60f; + int maxTextWidth = (int) (availableTextWidth / scale); + displayText = Minecraft.getInstance().font.plainSubstrByWidth(label, maxTextWidth - 8) + "..."; + } + } + + int scaledTextWidth = (int) (Minecraft.getInstance().font.width(displayText) * scale); + int contentWidth = iconSpace + scaledTextWidth; + int startX = x + (width - contentWidth) / 2; + + if (icon != null) { + com.mojang.renderpearl.api.pipeline.RenderPipeline pipeline = net.minecraft.client.renderer.RenderPipelines.GUI_TEXTURED; + context.blit( + pipeline, + icon, + startX, + y + (height - 16) / 2, + 0.0F, + 0.0F, + 16, + 16, + texSize, + texSize, + texSize, + texSize, + -1); + startX += 20; + } + + int textColor = active + ? io.github.marcsanzdev.chestseparators.client.ui.UiTheme.ON_ACCENT + : io.github.marcsanzdev.chestseparators.client.ui.UiTheme.TEXT; + + context.pose().pushMatrix(); + context.pose().translate((float) startX, (float) (y + (height - 9 * scale) / 2)); + context.pose().scale(scale, scale); + context.text(Minecraft.getInstance().font, displayText, 0, 0, textColor, true); + context.pose().popMatrix(); + + if (active) { + context.pose().popMatrix(); + } + + if (hover && this.tooltipText != null && !this.isDisabled) { + context.setTooltipForNextFrame( + Minecraft.getInstance().font, Component.literal(this.tooltipText), mouseX, mouseY); + } + } +} diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/widgets/CustomWidget.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/widgets/CustomWidget.java new file mode 100644 index 0000000..a3f1f71 --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/widgets/CustomWidget.java @@ -0,0 +1,52 @@ +package io.github.marcsanzdev.chestseparators.client.ui.widgets; + +import net.minecraft.client.gui.GuiGraphicsExtractor; + +public abstract class CustomWidget { + public int x; + public int y; + public int width; + public int height; + + public boolean isActive = false; + public boolean isDisabled = false; + public String tooltipText = null; + /** When true, the click plays the press flash first and runs the action a moment later (see PressAnim). + * Use for buttons whose action closes their own screen, so the flash is actually seen. */ + public boolean deferAction = false; + + protected Runnable onClickAction; + + public CustomWidget(int x, int y, int width, int height, Runnable onClickAction) { + this.x = x; + this.y = y; + this.width = width; + this.height = height; + this.onClickAction = onClickAction; + } + + // Every specific widget must implement its own drawing logic + public abstract void render(GuiGraphicsExtractor context, int mouseX, int mouseY, float delta); + + public boolean isHovering(double mouseX, double mouseY) { + return mouseX >= x && mouseX < x + width && mouseY >= y && mouseY < y + height; + } + + public boolean mouseClicked(double mouseX, double mouseY, int button) { + if (button == 0 && !isDisabled && isHovering(mouseX, mouseY)) { + // Flash the button "pressed" (accent + shrunk) briefly, so stateless actions (Save, Load, + // Copy, Undo…) visibly react instead of staying static. Close-screen buttons defer the action + // until the flash has played, so it is still visible. + if (deferAction) { + PressAnim.pressAndDefer(x, y, onClickAction); + } else { + PressAnim.press(x, y); + if (onClickAction != null) { + onClickAction.run(); + } + } + return true; // Click consumed + } + return false; + } +} diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/widgets/InventoryRetentionSlider.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/widgets/InventoryRetentionSlider.java new file mode 100644 index 0000000..e0a1e41 --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/widgets/InventoryRetentionSlider.java @@ -0,0 +1,118 @@ +package io.github.marcsanzdev.chestseparators.client.ui.widgets; + +import java.util.function.IntConsumer; +import java.util.function.IntSupplier; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiGraphicsExtractor; +import net.minecraft.network.chat.Component; + +/** Compact draggable Keep slider: All, 64, 32, 16, 1 marks with exact in-between values. */ +public final class InventoryRetentionSlider extends CustomWidget { + private final IntSupplier current; + private final IntConsumer update; + private boolean dragging; + private int heldDetent = -1; + + // A short magnetic pull onto stack-size marks, followed by a slightly wider release + // threshold, makes 16/32/64 easy to hit without changing their saved numeric values. + private static final double DETENT_ENTER_PX = 2.0; + private static final double DETENT_RELEASE_PX = 4.0; + + public InventoryRetentionSlider(int x, int y, int width, int height, + IntSupplier current, IntConsumer update) { + super(x, y, width, height, null); + this.current = current; + this.update = update; + this.tooltipText = "Keep: drag for 1-64 (marks: All / 64 / 32 / 16 / 1); scroll for exact +/-1"; + } + + @Override + public boolean mouseClicked(double mouseX, double mouseY, int button) { + if (button != 0 || isDisabled || !isHovering(mouseX, mouseY)) return false; + dragging = true; + heldDetent = -1; + updateFromMouse(mouseX); + return true; + } + + public boolean mouseDragged(double mouseX, int button) { + if (!dragging || button != 0) return false; + updateFromMouse(mouseX); + return true; + } + + public boolean mouseScrolled(double mouseX, double mouseY, double delta) { + if (isDisabled || !isHovering(mouseX, mouseY) || delta == 0) return false; + update.accept(io.github.marcsanzdev.chestseparators.util.InventoryRetentionSteps.adjustByWheel( + current.getAsInt(), delta > 0 ? 1 : -1)); + return true; + } + + public void stopDrag() { + dragging = false; + heldDetent = -1; + } + + private int trackStart() { + return x + 6; + } + + private int trackEnd() { + return x + width - 6; + } + + private void updateFromMouse(double mouseX) { + int span = Math.max(1, trackEnd() - trackStart()); + double fraction = Math.max(0, Math.min(1, (mouseX - trackStart()) / span)); + // Stay on an engaged detent until the pointer moves farther away than the + // entrance radius; this avoids jitter around 16/32/64 while dragging. + if (heldDetent >= 0) { + int stillHeld = io.github.marcsanzdev.chestseparators.util.InventoryRetentionSteps + .detentNearFraction(fraction, span, DETENT_RELEASE_PX); + if (stillHeld == heldDetent) { + update.accept(heldDetent); + return; + } + heldDetent = -1; + } + heldDetent = io.github.marcsanzdev.chestseparators.util.InventoryRetentionSteps + .detentNearFraction(fraction, span, DETENT_ENTER_PX); + update.accept(heldDetent >= 0 + ? heldDetent + : io.github.marcsanzdev.chestseparators.util.InventoryRetentionSteps.valueAtFraction(fraction)); + } + + @Override + public void render(GuiGraphicsExtractor context, int mouseX, int mouseY, float delta) { + if (isDisabled) return; + int value = current.getAsInt(); + boolean hover = isHovering(mouseX, mouseY); + io.github.marcsanzdev.chestseparators.client.ui.UiTheme.button( + context, x, y, width, height, hover, false); + String label = value <= 0 ? "Keep: All" : "Keep: " + value; + context.pose().pushMatrix(); + context.pose().translate(x + 3.0f, y + 1.0f); + context.pose().scale(0.62f, 0.62f); + context.text(Minecraft.getInstance().font, label, 0, 0, + io.github.marcsanzdev.chestseparators.client.ui.UiTheme.TEXT, false); + context.pose().popMatrix(); + + // Use virtually the entire 108px widget as a track; the label sits ABOVE it. + int start = trackStart(); + int end = trackEnd(); + int lineY = y + height - 2; + context.fill(start, lineY, end + 1, lineY + 1, 0xFF626262); + int marks = io.github.marcsanzdev.chestseparators.util.InventoryRetentionSteps.count(); + for (int i = 0; i < marks; i++) { + int px = start + (end - start) * i / (marks - 1); + context.fill(px, lineY - 2, px + 1, lineY + 2, 0xFF989898); + } + int knob = start + (int) Math.round((end - start) * + io.github.marcsanzdev.chestseparators.util.InventoryRetentionSteps.fractionForValue(value)); + context.fill(knob - 2, lineY - 3, knob + 3, lineY + 3, 0xFFDEDEDE); + if (hover && tooltipText != null) { + context.setTooltipForNextFrame(Minecraft.getInstance().font, + Component.literal(tooltipText), mouseX, mouseY); + } + } +} diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/widgets/PressAnim.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/widgets/PressAnim.java new file mode 100644 index 0000000..83857d1 --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/widgets/PressAnim.java @@ -0,0 +1,80 @@ +package io.github.marcsanzdev.chestseparators.client.ui.widgets; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +/** + * A tiny, shared "button was just pressed" registry keyed by on-screen position. + * + *

Many action buttons (preset Save/Load/Delete, Copy/Paste/Undo/Redo, …) are re-created every frame, so + * per-instance press state does not survive. Keying by the button's (x, y) — which stays constant across + * those re-creations while a button keeps its place — lets a stateless button flash "pressed" (accent + + * shrunk) for a moment after a click, then return to normal. Two distinct buttons never occupy the same + * (x, y) in the same frame, so collisions are momentary at worst. + * + *

For buttons whose action would close their own screen (so the flash would never be seen), {@link + * #pressAndDefer} plays the flash first and runs the action a moment later; {@link #tick()} — pumped once + * per frame by the editor — fires those deferred actions when their flash has elapsed. + */ +public final class PressAnim { + + private static final long DURATION_MS = 140L; + private static final long DEFER_MS = 110L; + private static final Map PRESSES = new HashMap<>(); + + private static final class Deferred { + final long dueAt; + final Runnable action; + + Deferred(long dueAt, Runnable action) { + this.dueAt = dueAt; + this.action = action; + } + } + + private static final List PENDING = new ArrayList<>(); + + private PressAnim() {} + + private static long key(int x, int y) { + return ((long) x << 20) ^ (y & 0xFFFFF); + } + + /** Marks the button at (x, y) as just pressed, starting its flash. */ + public static void press(int x, int y) { + PRESSES.put(key(x, y), System.currentTimeMillis()); + } + + /** True while the button at (x, y) is still within its post-click flash window. */ + public static boolean active(int x, int y) { + Long t = PRESSES.get(key(x, y)); + if (t == null) return false; + if (System.currentTimeMillis() - t > DURATION_MS) { + PRESSES.remove(key(x, y)); + return false; + } + return true; + } + + /** Flash the button at (x, y), then run {@code action} once the flash has played (see {@link #tick()}). */ + public static void pressAndDefer(int x, int y, Runnable action) { + press(x, y); + if (action != null) PENDING.add(new Deferred(System.currentTimeMillis() + DEFER_MS, action)); + } + + /** Runs any deferred actions whose flash has elapsed. Pump once per frame from the editor render. */ + public static void tick() { + if (PENDING.isEmpty()) return; + long now = System.currentTimeMillis(); + for (Iterator it = PENDING.iterator(); it.hasNext(); ) { + Deferred d = it.next(); + if (now >= d.dueAt) { + it.remove(); + d.action.run(); + } + } + } +} diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/widgets/ToolButtonWidget.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/widgets/ToolButtonWidget.java new file mode 100644 index 0000000..52b13fe --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/widgets/ToolButtonWidget.java @@ -0,0 +1,115 @@ +package io.github.marcsanzdev.chestseparators.client.ui.widgets; + +import io.github.marcsanzdev.chestseparators.client.ui.UiTheme; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiGraphicsExtractor; +import net.minecraft.network.chat.Component; +import net.minecraft.resources.Identifier; + +public class ToolButtonWidget extends CustomWidget { + + // Source texture size in px: 32 for the legacy pixel-art icons, larger (e.g. 128) for the smooth + // vector-exported icons. Used as the u/v region and texture dimensions when sampling. + public int texSize = 32; + // When true the base icon is a single-color (white) glyph that is tinted by the button state + // (light-gray normally, brighter on hover, accent blue when active). Used by the smooth line icons. + public boolean tintByState = false; + /** When true the BASE icon is drawn in {@link #dynamicColor} (the current paint colour) instead of + * white/state — used by the area/trace paint buttons so the whole mode icon shows the paint colour. */ + public boolean baseUsesDynamicColor = false; + + private boolean hovered = false; + + public Identifier baseIcon; + public Identifier maskIcon; + public int dynamicColor = 0xFFFFFF; + + public int baseOffsetX = 0; + public int maskOffsetX = 0; + + public ToolButtonWidget(int x, int y, Identifier baseIcon, String tooltip, Runnable onClickAction) { + super(x, y, 20, 20, onClickAction); + this.baseIcon = baseIcon; + this.tooltipText = tooltip; + } + + @Override + public void render(GuiGraphicsExtractor context, int mouseX, int mouseY, float delta) { + this.hovered = isHovering(mouseX, mouseY); + boolean active = this.isActive || PressAnim.active(x, y); + + // A button that disables itself right after acting (e.g. preset Delete → slot now empty) still + // plays its press flash, so the click is visible; otherwise draw the normal disabled look. + if (this.isDisabled && !PressAnim.active(x, y)) { + UiTheme.roundRect(context, x, y, width, height, 0x0AFFFFFF); + UiTheme.roundBorder(context, x, y, width, height, 0x14FFFFFF); + drawIcon(context, this.baseIcon, this.maskIcon, 0xFFFFFF); + UiTheme.roundRect(context, x, y, width, height, 0x66121218); + return; + } + + UiTheme.button(context, x, y, width, height, this.hovered, active); + if (active) { + // The active button draws 1px smaller; shrink its icon by the same proportion. + UiTheme.pushActiveContent(context, x, y, width, height); + drawIcon(context, this.baseIcon, this.maskIcon, this.dynamicColor); + context.pose().popMatrix(); + } else { + drawIcon(context, this.baseIcon, this.maskIcon, this.dynamicColor); + } + + if (this.hovered && this.tooltipText != null) { + java.util.List tooltipLines = new java.util.ArrayList<>(); + for (String line : this.tooltipText.split("\n")) { + tooltipLines.add(Component.literal(line)); + } + context.setComponentTooltipForNextFrame(Minecraft.getInstance().font, tooltipLines, mouseX, mouseY); + } + } + + private void drawIcon(GuiGraphicsExtractor context, Identifier base, Identifier mask, int color) { + if (base == null) return; + com.mojang.renderpearl.api.pipeline.RenderPipeline pipeline = net.minecraft.client.renderer.RenderPipelines.GUI_TEXTURED; + + int baseColor = -1; + if (this.tintByState) { + boolean active = this.isActive || PressAnim.active(x, y); + baseColor = active ? UiTheme.ICON_ACTIVE : (this.hovered ? UiTheme.ICON_HOVER : UiTheme.ICON); + } + if (this.baseUsesDynamicColor) { + baseColor = this.dynamicColor | 0xFF000000; + } + context.blit( + pipeline, + base, + x + 2 + baseOffsetX, + y + 2, + 0.0F, + 0.0F, + 16, + 16, + texSize, + texSize, + texSize, + texSize, + baseColor); + + if (mask != null) { + int colorARGB = color | 0xFF000000; + context.blit( + pipeline, + mask, + x + 2 + maskOffsetX, + y + 2, + 0.0F, + 0.0F, + 16, + 16, + texSize, + texSize, + texSize, + texSize, + colorARGB); + } + } +} diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/widgets/WideButtonWidget.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/widgets/WideButtonWidget.java new file mode 100644 index 0000000..3e0eaa4 --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/client/ui/widgets/WideButtonWidget.java @@ -0,0 +1,134 @@ +package io.github.marcsanzdev.chestseparators.client.ui.widgets; + +import io.github.marcsanzdev.chestseparators.config.GlobalChestConfig; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiGraphicsExtractor; +import net.minecraft.network.chat.Component; +import net.minecraft.resources.Identifier; + +public class WideButtonWidget extends CustomWidget { + + public String label; + public Identifier icon; + public Identifier disabledIconFallback; + public boolean keepNormalTextColor = false; + /** Source texture size to sample. 32 = legacy pixel icons; 128 = smooth vector icons (with blur mcmeta). */ + public int texSize = 32; + + public WideButtonWidget( + int x, int y, int width, int height, String label, Identifier icon, Runnable onClickAction) { + super(x, y, width, height, onClickAction); + this.label = label; + this.icon = icon; + this.disabledIconFallback = icon; + } + + @Override + public void render(GuiGraphicsExtractor context, int mouseX, int mouseY, float delta) { + if (this.isDisabled) { + renderDisabled(context); + return; + } + + boolean hover = isHovering(mouseX, mouseY); + boolean sunken = this.isActive || PressAnim.active(x, y); + boolean isDark = GlobalChestConfig.instance.darkMode; + + io.github.marcsanzdev.chestseparators.client.ui.UiTheme.button(context, x, y, width, height, hover, sunken); + + // The sunken (active) button draws 1px smaller; shrink its icon+label by the same proportion. + if (sunken) { + io.github.marcsanzdev.chestseparators.client.ui.UiTheme.pushActiveContent(context, x, y, width, height); + } + + int iconColor; + if (sunken && !this.keepNormalTextColor) { + iconColor = io.github.marcsanzdev.chestseparators.client.ui.UiTheme.ON_ACCENT; + } else { + iconColor = io.github.marcsanzdev.chestseparators.client.ui.UiTheme.TEXT; + } + + if (this.icon != null) { + com.mojang.renderpearl.api.pipeline.RenderPipeline pipeline = net.minecraft.client.renderer.RenderPipelines.GUI_TEXTURED; + context.blit( + pipeline, this.icon, x + 2, y + 2, 0.0F, 0.0F, 16, 16, texSize, texSize, texSize, texSize, -1); + } + + float scale = 0.85f; + int textWidth = Minecraft.getInstance().font.width(label); + int availableWidth = width - 26; + String displayText = label; + + if (textWidth * scale > availableWidth) { + scale = (float) availableWidth / textWidth; + if (scale < 0.60f) { + scale = 0.60f; + int maxTextWidth = (int) (availableWidth / scale); + displayText = Minecraft.getInstance().font.plainSubstrByWidth(label, maxTextWidth - 6) + "..."; + } + } + + context.pose().pushMatrix(); + context.pose().translate((float) (x + 22), (float) (y + (height - 9 * scale) / 2)); + context.pose().scale(scale, scale); + // Shadow only when in dark mode + context.text(Minecraft.getInstance().font, displayText, 0, 0, iconColor, isDark); + context.pose().popMatrix(); + + if (sunken) { + context.pose().popMatrix(); + } + + if (hover && this.tooltipText != null && !this.isDisabled) { + context.setTooltipForNextFrame( + Minecraft.getInstance().font, Component.literal(this.tooltipText), mouseX, mouseY); + } + } + + private void renderDisabled(GuiGraphicsExtractor context) { + boolean isDark = GlobalChestConfig.instance.darkMode; + io.github.marcsanzdev.chestseparators.client.ui.UiTheme.roundRect(context, x, y, width, height, 0x0AFFFFFF); + io.github.marcsanzdev.chestseparators.client.ui.UiTheme.roundBorder(context, x, y, width, height, 0x14FFFFFF); + + Identifier iconToDraw = this.disabledIconFallback != null ? this.disabledIconFallback : this.icon; + int disabledColor = 0xFF6A6A72; + + if (iconToDraw != null) { + com.mojang.renderpearl.api.pipeline.RenderPipeline pipeline = net.minecraft.client.renderer.RenderPipelines.GUI_TEXTURED; + context.blit( + pipeline, + iconToDraw, + x + 2, + y + 2, + 0.0F, + 0.0F, + 16, + 16, + texSize, + texSize, + texSize, + texSize, + disabledColor); + } + + float scale = 0.85f; + int textWidth = Minecraft.getInstance().font.width(label); + int availableWidth = width - 26; + String displayText = label; + + if (textWidth * scale > availableWidth) { + scale = (float) availableWidth / textWidth; + if (scale < 0.60f) { + scale = 0.60f; + int maxTextWidth = (int) (availableWidth / scale); + displayText = Minecraft.getInstance().font.plainSubstrByWidth(label, maxTextWidth - 6) + "..."; + } + } + + context.pose().pushMatrix(); + context.pose().translate((float) (x + 22), (float) (y + (height - 9 * scale) / 2)); + context.pose().scale(scale, scale); + context.text(Minecraft.getInstance().font, displayText, 0, 0, disabledColor, isDark); + context.pose().popMatrix(); + } +} diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/compat/ChestSeparatorsReiPlugin.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/compat/ChestSeparatorsReiPlugin.java new file mode 100644 index 0000000..9740a37 --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/compat/ChestSeparatorsReiPlugin.java @@ -0,0 +1,28 @@ +package io.github.marcsanzdev.chestseparators.compat; + +import io.github.marcsanzdev.chestseparators.client.EditorState; +import io.github.marcsanzdev.chestseparators.client.ui.ChestSeparatorsEditor; +import java.util.Collections; +import me.shedaniel.math.Rectangle; +import me.shedaniel.rei.api.client.plugins.REIClientPlugin; +import me.shedaniel.rei.api.client.registry.screen.ExclusionZones; +import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen; + +public class ChestSeparatorsReiPlugin implements REIClientPlugin { + + @Override + public void registerExclusionZones(ExclusionZones zones) { + zones.register(AbstractContainerScreen.class, screen -> { + ChestSeparatorsEditor editor = ChestSeparatorsEditor.getInstance(); + + // While the editor is active, claim the entire screen to prevent REI from rendering over it. + if (editor != null + && editor.getSession() != null + && editor.getSession().currentState != EditorState.HIDDEN) { + return Collections.singletonList(new Rectangle(0, 0, 10000, 10000)); + } + + return Collections.emptyList(); + }); + } +} diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/config/GlobalChestConfig.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/config/GlobalChestConfig.java new file mode 100644 index 0000000..28af267 --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/config/GlobalChestConfig.java @@ -0,0 +1,126 @@ +package io.github.marcsanzdev.chestseparators.config; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import dev.architectury.platform.Platform; +import java.io.*; +import java.nio.charset.StandardCharsets; + +public class GlobalChestConfig { + + private static final Gson GSON = new GsonBuilder().setPrettyPrinting().create(); + + // Resolved lazily rather than in a static initializer so that merely reading config values does + // not touch the loader config directory (which is unavailable in unit tests). Architectury's + // Platform.getConfigFolder() gives the same path on every loader. + private static File configFile() { + return new File(Platform.getConfigFolder().toFile(), "chestseparators_config.json"); + } + + public static ConfigData instance = new ConfigData(); + + /** Shape of the painting/eyedropper magnifier loupe. */ + public enum MagnifierShape { + CIRCLE, + SQUARE + } + + public static class ConfigData { + // --- CLIENT / VISUALS --- + public boolean darkMode = true; + public boolean showLeftPanel = true; + public boolean enablePreviewAnimation = true; + // --- EDITOR TOOLBAR (right-side vertical dock) --- + // showEditButtons is the MASTER toggle for the whole toolbar. Each icon below can be turned on + // or off individually from the mod settings (ModMenu); there is no keybind for this. + public boolean showEditButtons = true; + public boolean showDepositButton = true; + public boolean btnEditLines = true; + public boolean btnFilters = true; + public boolean btnFillFromChest = true; + public boolean btnInventoryPresets = true; + public boolean btnChestPresets = true; + public boolean closeOnClickOutside = true; + // When true, the custom-color column (third palette column) is shared across the Lines, + // Backgrounds and Combo tabs. When false, each tab keeps its own custom colors. + public boolean sharedCustomColors = true; + // Zoom loupe shown while painting separators or using the eyedropper. Off by default; players + // are hinted that they can enable it (key L or config) if precise editing is tricky. + public boolean magnifierEnabled = false; + public MagnifierShape magnifierShape = MagnifierShape.CIRCLE; + // Which painting tabs show the loupe (the eyedropper always shows it when enabled). Lines on by + // default; backgrounds/combo off by default but left for the user to opt into. + public boolean magnifierTabLines = true; + public boolean magnifierTabBackgrounds = false; + public boolean magnifierTabCombo = false; + public int bgTransparency = 40; + public int lineTransparency = 100; + + // When a push/pull auto-organizes the player inventory's filtered groups by priority, keep the + // hotbar (slots 0-8) untouched so an item you might be holding never gets moved out from under you. + // Turn it off to let the hotbar auto-sort too, accepting that risk. + public boolean lockHotbarOnReorder = true; + + // --- AUTO-DEPOSIT TO NEARBY CHESTS --- + // Master switch for the radius auto-deposit feature: stand in your storage area, trigger it, + // and every inventory item is sorted into nearby chests whose filters list it. + public boolean autoDepositEnabled = true; + // Enable the double-tap-sneak gesture as a trigger (in addition to the optional hotkey). + public boolean autoDepositDoubleSneak = true; + // Search radius in blocks around the player for filtered containers. + public int autoDepositRadius = 8; + // When false (default) a chest is skipped if a solid block obstructs the straight line between + // the player and the chest. When true, items can be deposited through walls. + public boolean autoDepositThroughWalls = false; + // Show the 3D items flying from the player to each chest. When off, the deposit still happens + // (with sound + message) but no items are animated. + public boolean autoDepositAnimation = true; + // Leave a particle trail behind each flying item. Only applies when the animation is on. + public boolean autoDepositTrail = true; + + // --- PLAYER INVENTORY DECORATIONS / FILTERS --- + // The active inventory layout (separators, backgrounds and filters) is always stored per-world + // (and, being client-side, per account), so it never bleeds across worlds/servers. Inventory + // presets, by contrast, are global reusable templates. See ChestConfigManager#getInventoryFile + // and #getInventoryPresetFile. + + // How many inventory preset slots are available (bound to number keys 1-9 in the editor). + public int inventoryPresetCount = 9; + + // --- SERVER / MECHANICS --- + public boolean defaultRuleManual = true; + public boolean defaultRuleShift = true; + public boolean defaultRuleHopper = true; + // The third insertion rule is context-dependent: "Hopper" on a chest filter, "Pick Up" on an + // inventory filter (both share SlotWhitelist#allowHopper). This holds the default for the Pick Up + // side so inventory groups can default independently from chest groups. + public boolean defaultRulePickup = true; + public boolean expelInvalidItems = false; + } + + public static boolean isShowEditButton() { + return instance.showEditButtons; + } + + public static void loadConfig() { + File configFile = configFile(); + if (configFile.exists()) { + try (Reader reader = new InputStreamReader(new FileInputStream(configFile), StandardCharsets.UTF_8)) { + instance = GSON.fromJson(reader, ConfigData.class); + } catch (Exception e) { + e.printStackTrace(); + instance = new ConfigData(); + } + } else { + saveConfig(); + } + } + + public static void saveConfig() { + try (Writer writer = new OutputStreamWriter(new FileOutputStream(configFile()), StandardCharsets.UTF_8)) { + GSON.toJson(instance, writer); + } catch (Exception e) { + e.printStackTrace(); + } + } +} diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/data/ChestConfigManager.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/data/ChestConfigManager.java new file mode 100644 index 0000000..5ddc568 --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/data/ChestConfigManager.java @@ -0,0 +1,1403 @@ +package io.github.marcsanzdev.chestseparators.data; + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; +import java.util.UUID; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.ChestBlock; +import net.minecraft.world.level.block.state.properties.ChestType; +import net.minecraft.client.Minecraft; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.nbt.NbtIo; +import net.minecraft.nbt.NbtAccounter; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class ChestConfigManager { + + private static final Logger LOGGER = LoggerFactory.getLogger("chestseparators"); + + private static final String MOD_ID = "chestseparators"; + private static final String FOLDER_NAME = "separators"; + private static final String ENDER_FILE_NAME = "ender_chest.dat"; + private static final String PALETTE_FILE_NAME = "world_palette.dat"; + private static final String INVENTORY_FILE_NAME = "player_inventory.dat"; + + /** + * Current on-disk format version. Increment when making breaking changes to the NBT schema. + * Version 1 = v1.3.x (4-element visual arrays, no version field). + * Version 2 = 5-element visual arrays with an explicit "Version" field. + * Version 3 = 9-element visual arrays adding per-edge paint-order sequence (indices 5-8). + * Older saves are migrated transparently on read in {@link #readRawData}. + */ + private static final int DATA_VERSION = 3; + + public static final int ACTION_TOP = 1; + public static final int ACTION_BOTTOM = 2; + public static final int ACTION_LEFT = 4; + public static final int ACTION_RIGHT = 8; + public static final int ACTION_BG = 16; + + private static final int IDX_TOP = 0; + private static final int IDX_BOTTOM = 1; + private static final int IDX_LEFT = 2; + private static final int IDX_RIGHT = 3; + private static final int IDX_BG = 4; + + // Paint-order sequence for each of the four edges, so corners are drawn newest-on-top: the edge + // painted later wins where two lines overlap. Indices 5-8 parallel IDX_TOP..IDX_RIGHT. + private static final int IDX_SEQ_TOP = 5; + private static final int IDX_SEQ_BOTTOM = 6; + private static final int IDX_SEQ_LEFT = 7; + private static final int IDX_SEQ_RIGHT = 8; + private static final int SLOT_ARRAY_LEN = 9; + + /** Monotonic counter assigning a paint order to each edge as it is painted. */ + private int paintSequence = 0; + + private final Map currentChestConfig = new HashMap<>(); + private Map clipboardConfig = null; + private Map linesClipboard = null; + private Map bgClipboard = null; + private int[] worldCustomLineColors = new int[8]; + private int[] worldCustomBgColors = new int[8]; + private int[] worldCustomComboColors = new int[8]; + + // The player inventory's own decorations and filters, kept in memory so they can be rendered on the + // player-inventory slots in any screen. Keyed by PlayerInventory slot index (not screen-handler + // slot index), so the same layout shows consistently in the inventory screen and inside chests. + private Map playerInventoryVisual = new HashMap<>(); + private Map playerInventoryFilters = new HashMap<>(); + + private Map whitelistClipboard = null; + + private static final ChestConfigManager INSTANCE = new ChestConfigManager(); + + public static ChestConfigManager getInstance() { + return INSTANCE; + } + + public void clearCurrentConfig() { + currentChestConfig.clear(); + paintSequence = 0; + clearHistory(); + } + + // --- UNIFIED UNDO / REDO SYSTEM --- + // + // A single stack records every change to a chest — painted separators AND item filters — so + // Ctrl+Z always undoes the most recent action regardless of which sub-screen is open. Each entry + // snapshots both the visual layout and the whitelists, plus a label key identifying what changed + // (used to give the user feedback such as "Undone: filter"). + + private static final int MAX_UNDO_STEPS = 50; + + /** Translation key describing a separator/painting change. */ + public static final String ACTION_LAYOUT = "message.chestseparators.action.layout"; + /** Translation key describing a filter/whitelist change. */ + public static final String ACTION_FILTER = "message.chestseparators.action.filter"; + + /** An immutable snapshot of the whole chest state, tagged with what changed to reach it. */ + private record ChestState(Map visual, Map whitelists, String labelKey) {} + + /** Per-slot classification of an undo/redo change, used to drive the on-slot blink feedback. */ + public enum SlotChange { + LAYOUT, + FILTER_CREATED, + FILTER_REMOVED, + FILTER_MODIFIED + } + + private final java.util.Deque undoStack = new java.util.ArrayDeque<>(); + private final java.util.Deque redoStack = new java.util.ArrayDeque<>(); + + /** Slots that changed in the most recent undo/redo, with what kind of change the user just saw. */ + private Map lastUndoChanges = new HashMap<>(); + + public Map getLastUndoChanges() { + return lastUndoChanges; + } + + /** Classifies, per slot, the difference between the current state and the state being restored. */ + private Map computeChanges( + Map oldVis, + Map oldWl, + Map newVis, + Map newWl) { + Map changes = new HashMap<>(); + Set slots = new HashSet<>(); + slots.addAll(oldVis.keySet()); + slots.addAll(newVis.keySet()); + slots.addAll(oldWl.keySet()); + slots.addAll(newWl.keySet()); + for (int slot : slots) { + SlotWhitelist owl = oldWl.get(slot); + SlotWhitelist nwl = newWl.get(slot); + if (!java.util.Objects.equals(owl, nwl)) { + if (owl == null) changes.put(slot, SlotChange.FILTER_CREATED); + else if (nwl == null) changes.put(slot, SlotChange.FILTER_REMOVED); + else changes.put(slot, SlotChange.FILTER_MODIFIED); + } else if (!sameColors(oldVis.get(slot), newVis.get(slot))) { + changes.put(slot, SlotChange.LAYOUT); + } + } + return changes; + } + + /** Compares only the five color channels (0-4), ignoring the paint-order sequence (5-8). */ + private static boolean sameColors(int[] a, int[] b) { + for (int i = 0; i <= IDX_BG; i++) { + int av = (a != null && i < a.length) ? a[i] : 0; + int bv = (b != null && i < b.length) ? b[i] : 0; + if (av != bv) return false; + } + return true; + } + + private static Map copyVisualConfig(Map source) { + Map copy = new HashMap<>(); + for (Map.Entry entry : source.entrySet()) { + copy.put(entry.getKey(), entry.getValue().clone()); + } + return copy; + } + + private static Map copyWhitelists(Map source) { + Map copy = new HashMap<>(); + for (Map.Entry entry : source.entrySet()) { + SlotWhitelist orig = entry.getValue(); + copy.put( + entry.getKey(), + new SlotWhitelist( + orig.groupId(), + new ArrayList<>(orig.allowedItems()), + orig.allowManual(), + orig.allowShift(), + orig.allowHopper(), + orig.targetCount())); + } + return copy; + } + + private ChestState snapshotCurrent(String labelKey) { + return new ChestState(copyVisualConfig(currentChestConfig), copyWhitelists(currentWhitelists), labelKey); + } + + /** Records the current state on the undo stack before a change of the given kind is applied. */ + private void pushHistory(String labelKey) { + undoStack.push(snapshotCurrent(labelKey)); + while (undoStack.size() > MAX_UNDO_STEPS) undoStack.removeLast(); + redoStack.clear(); + } + + public void saveSnapshot() { + pushHistory(ACTION_LAYOUT); + } + + public void saveWhitelistSnapshot() { + pushHistory(ACTION_FILTER); + } + + public boolean canUndo() { + return !undoStack.isEmpty(); + } + + public boolean canRedo() { + return !redoStack.isEmpty(); + } + + /** + * Undoes the most recent change. Returns the label key of the undone action (for user feedback), + * or {@code null} if there was nothing to undo. + */ + public String undo() { + if (undoStack.isEmpty()) return null; + ChestState previous = undoStack.pop(); + redoStack.push(snapshotCurrent(previous.labelKey())); + lastUndoChanges = + computeChanges(currentChestConfig, currentWhitelists, previous.visual(), previous.whitelists()); + applyVisualConfig(previous.visual()); + applyWhitelists(previous.whitelists()); + return previous.labelKey(); + } + + /** + * Redoes the most recently undone change. Returns the label key of the redone action, or + * {@code null} if there was nothing to redo. + */ + public String redo() { + if (redoStack.isEmpty()) return null; + ChestState next = redoStack.pop(); + undoStack.push(snapshotCurrent(next.labelKey())); + lastUndoChanges = computeChanges(currentChestConfig, currentWhitelists, next.visual(), next.whitelists()); + applyVisualConfig(next.visual()); + applyWhitelists(next.whitelists()); + return next.labelKey(); + } + + // Filter-screen aliases kept for the View Groups buttons; the history is unified, so these simply + // delegate to the shared undo/redo. + public boolean canUndoWhitelist() { + return canUndo(); + } + + public boolean canRedoWhitelist() { + return canRedo(); + } + + public String undoWhitelist() { + return undo(); + } + + public String redoWhitelist() { + return redo(); + } + + private void applyVisualConfig(Map snapshot) { + currentChestConfig.clear(); + currentChestConfig.putAll(copyVisualConfig(snapshot)); + } + + private void applyWhitelists(Map snapshot) { + currentWhitelists.clear(); + currentWhitelists.putAll(copyWhitelists(snapshot)); + } + + public void clearHistory() { + undoStack.clear(); + redoStack.clear(); + } + + // --- PATH MANAGEMENT (NIO) --- + + private String getWorldFolderName() { + Minecraft client = Minecraft.getInstance(); + String name = "unknown_world"; + + if (client.hasSingleplayerServer() && client.getSingleplayerServer() != null) { + // WorldSavePath.ROOT resolves to "/." so calling getFileName() on it yields ".", NOT + // the world folder — which made EVERY singleplayer world collapse to the same key ("sp__") and + // therefore share its separators AND inventory profile. Normalize away the trailing "." so we + // recover the real, per-world save folder name. + Path saveRoot = client.getSingleplayerServer() + .getWorldPath(net.minecraft.world.level.storage.LevelResource.ROOT) + .toAbsolutePath() + .normalize(); + Path saveFolder = saveRoot.getFileName(); + String folderName = saveFolder != null ? saveFolder.toString() : ""; + if (folderName.isEmpty()) { + // Extremely defensive fallback (e.g. root path); the level name is still per-world enough. + folderName = client.getSingleplayerServer().getWorldData().getLevelName(); + } + name = "sp_" + folderName; + } else if (client.getCurrentServer() != null) { + name = "mp_" + client.getCurrentServer().ip; + } + + return name.replaceAll("[^a-zA-Z0-9_\\-]", "_"); + } + + private Path getWorldConfigDir() { + Path runDir = Minecraft.getInstance().gameDirectory.toPath(); + Path baseModDir = runDir.resolve("config/" + MOD_ID); + Path worldDir = baseModDir.resolve(getWorldFolderName()); + + try { + if (!Files.exists(worldDir)) { + Files.createDirectories(worldDir); + } + } catch (IOException e) { + LOGGER.error("chestseparators: I/O error", e); + } + return worldDir; + } + + private Path getSeparatorsDir() { + Path sepDir = getWorldConfigDir().resolve(FOLDER_NAME); + try { + if (!Files.exists(sepDir)) { + Files.createDirectories(sepDir); + } + } catch (IOException e) { + LOGGER.error("chestseparators: I/O error", e); + } + return sepDir; + } + + private Path getFileForPos(BlockPos pos, String dimensionId) { + if (pos == null) return null; + Path dir = getSeparatorsDir(); + String safeDim = dimensionId.replace(":", "_"); + String fileName = String.format("%s_%d_%d_%d.dat", safeDim, pos.getX(), pos.getY(), pos.getZ()); + return dir.resolve(fileName); + } + + private Path getEnderChestFile() { + return getWorldConfigDir().resolve(ENDER_FILE_NAME); + } + + private Path getFileForEntity(UUID uuid) { + if (uuid == null) return null; + Path dir = getSeparatorsDir(); + return dir.resolve("entity_" + uuid.toString() + ".dat"); + } + + private Path getFileForShulker(UUID uuid) { + if (uuid == null) return null; + Path dir = getSeparatorsDir(); + return dir.resolve("shulker_" + uuid.toString() + ".dat"); + } + + // --- CHEST LOGIC --- + + private int[] getSlotColors(int slotIndex) { + int[] colors = currentChestConfig.get(slotIndex); + if (colors == null) { + colors = new int[SLOT_ARRAY_LEN]; + currentChestConfig.put(slotIndex, colors); + } else if (colors.length < SLOT_ARRAY_LEN) { + // Grow legacy arrays (4 or 5 elements) so paint-order indices are available. + colors = java.util.Arrays.copyOf(colors, SLOT_ARRAY_LEN); + currentChestConfig.put(slotIndex, colors); + } + return colors; + } + + // Shared edge/bg colour lookup: null array (absent slot) reads as 0, matching both callers' guards. + private static int colorForFlag(int[] colors, int actionFlag) { + if (colors == null) return 0; + if (actionFlag == ACTION_TOP) return colors[IDX_TOP]; + if (actionFlag == ACTION_BOTTOM) return colors[IDX_BOTTOM]; + if (actionFlag == ACTION_LEFT) return colors[IDX_LEFT]; + if (actionFlag == ACTION_RIGHT) return colors[IDX_RIGHT]; + if (actionFlag == ACTION_BG) return colors[IDX_BG]; + return 0; + } + + public int getColor(int slotIndex, int actionFlag) { + return colorForFlag(currentChestConfig.get(slotIndex), actionFlag); + } + + /** Like {@link #getColor}, but reads the player inventory render cache (for the all-screens overlay). */ + public int getInventoryColor(int slotIndex, int actionFlag) { + return colorForFlag(playerInventoryVisual.get(slotIndex), actionFlag); + } + + // Shared paint-order lookup: null array reads as 0, legacy arrays without a seq slot read as 0. + private static int seqForFlag(int[] colors, int actionFlag) { + if (colors == null) return 0; + int idx; + if (actionFlag == ACTION_TOP) idx = IDX_SEQ_TOP; + else if (actionFlag == ACTION_BOTTOM) idx = IDX_SEQ_BOTTOM; + else if (actionFlag == ACTION_LEFT) idx = IDX_SEQ_LEFT; + else if (actionFlag == ACTION_RIGHT) idx = IDX_SEQ_RIGHT; + else return 0; + return idx < colors.length ? colors[idx] : 0; + } + + /** Like {@link #getPaintSeq}, but reads the player inventory render cache. */ + public int getInventoryPaintSeq(int slotIndex, int actionFlag) { + return seqForFlag(playerInventoryVisual.get(slotIndex), actionFlag); + } + + /** + * Returns the paint-order sequence of an edge (higher = painted later, drawn on top). Returns 0 + * for backgrounds, unpainted edges, or legacy arrays without sequence data. + */ + public int getPaintSeq(int slotIndex, int actionFlag) { + return seqForFlag(currentChestConfig.get(slotIndex), actionFlag); + } + + public void paintAction(int slotIndex, int actionFlags, int argbColor) { + int[] colors = getSlotColors(slotIndex); + if ((actionFlags & ACTION_TOP) != 0) { + colors[IDX_TOP] = argbColor; + colors[IDX_SEQ_TOP] = ++paintSequence; + } + if ((actionFlags & ACTION_BOTTOM) != 0) { + colors[IDX_BOTTOM] = argbColor; + colors[IDX_SEQ_BOTTOM] = ++paintSequence; + } + if ((actionFlags & ACTION_LEFT) != 0) { + colors[IDX_LEFT] = argbColor; + colors[IDX_SEQ_LEFT] = ++paintSequence; + } + if ((actionFlags & ACTION_RIGHT) != 0) { + colors[IDX_RIGHT] = argbColor; + colors[IDX_SEQ_RIGHT] = ++paintSequence; + } + if ((actionFlags & ACTION_BG) != 0) colors[IDX_BG] = argbColor; + } + + /** Raises the paint counter above any sequence currently stored, e.g. after pasting another + * chest's layout, so subsequently painted edges still win in corners. */ + private void bumpPaintSequenceToMax() { + for (int[] colors : currentChestConfig.values()) { + for (int si = IDX_SEQ_TOP; si < SLOT_ARRAY_LEN && si <= IDX_SEQ_RIGHT; si++) { + if (si < colors.length && colors[si] > paintSequence) paintSequence = colors[si]; + } + } + } + + /** Raises paintSequence above any stored sequence in the given colour arrays (loaded profiles/presets). */ + private void bumpPaintSequence(java.util.Collection arrays) { + for (int[] colors : arrays) { + for (int si = IDX_SEQ_TOP; si <= IDX_SEQ_RIGHT && si < colors.length; si++) { + if (colors[si] > paintSequence) paintSequence = colors[si]; + } + } + } + + public void removeAction(int slotIndex, int actionFlags) { + if (!currentChestConfig.containsKey(slotIndex)) return; + int[] colors = currentChestConfig.get(slotIndex); + if ((actionFlags & ACTION_TOP) != 0) colors[IDX_TOP] = 0; + if ((actionFlags & ACTION_BOTTOM) != 0) colors[IDX_BOTTOM] = 0; + if ((actionFlags & ACTION_LEFT) != 0) colors[IDX_LEFT] = 0; + if ((actionFlags & ACTION_RIGHT) != 0) colors[IDX_RIGHT] = 0; + if ((actionFlags & ACTION_BG) != 0) colors[IDX_BG] = 0; + + if (isBlank(colors)) { + currentChestConfig.remove(slotIndex); + } + } + + /** True when a slot's first five channels (4 edges + bg) are all clear, i.e. the slot is empty. */ + private static boolean isBlank(int[] c) { + return c[0] == 0 && c[1] == 0 && c[2] == 0 && c[3] == 0 && c[4] == 0; + } + + public void clearAllBackgrounds() { + for (Map.Entry entry : currentChestConfig.entrySet()) entry.getValue()[IDX_BG] = 0; + currentChestConfig.entrySet().removeIf(entry -> isBlank(entry.getValue())); + } + + public void clearAllLines() { + for (Map.Entry entry : currentChestConfig.entrySet()) { + entry.getValue()[IDX_TOP] = 0; + entry.getValue()[IDX_BOTTOM] = 0; + entry.getValue()[IDX_LEFT] = 0; + entry.getValue()[IDX_RIGHT] = 0; + } + currentChestConfig.entrySet().removeIf(entry -> isBlank(entry.getValue())); + } + + public void copyToClipboard() { + this.clipboardConfig = copyVisualConfig(this.currentChestConfig); + } + + public void pasteFromClipboard() { + if (this.clipboardConfig != null && !this.clipboardConfig.isEmpty()) { + applyVisualConfig(this.clipboardConfig); + bumpPaintSequenceToMax(); + } + } + + public boolean hasClipboardData() { + return this.clipboardConfig != null && !this.clipboardConfig.isEmpty(); + } + + public void copyLinesToClipboard() { + this.linesClipboard = new HashMap<>(); + for (Map.Entry entry : this.currentChestConfig.entrySet()) { + int[] c = entry.getValue(); + if (c[0] != 0 || c[1] != 0 || c[2] != 0 || c[3] != 0) { + this.linesClipboard.put(entry.getKey(), new int[] {c[0], c[1], c[2], c[3], 0}); + } + } + } + + public void pasteLinesFromClipboard() { + if (this.linesClipboard != null && !this.linesClipboard.isEmpty()) { + for (Map.Entry entry : this.linesClipboard.entrySet()) { + int[] current = getSlotColors(entry.getKey()); + int[] clip = entry.getValue(); + current[0] = clip[0]; + current[1] = clip[1]; + current[2] = clip[2]; + current[3] = clip[3]; + } + } + } + + public boolean hasLinesClipboardData() { + return this.linesClipboard != null && !this.linesClipboard.isEmpty(); + } + + public void copyBackgroundsToClipboard() { + this.bgClipboard = new HashMap<>(); + for (Map.Entry entry : this.currentChestConfig.entrySet()) { + if (entry.getValue()[4] != 0) { + this.bgClipboard.put(entry.getKey(), new int[] {0, 0, 0, 0, entry.getValue()[4]}); + } + } + } + + public void pasteBackgroundsFromClipboard() { + if (this.bgClipboard != null && !this.bgClipboard.isEmpty()) { + for (Map.Entry entry : this.bgClipboard.entrySet()) { + getSlotColors(entry.getKey())[4] = entry.getValue()[4]; + } + } + } + + public boolean hasBackgroundsClipboardData() { + return this.bgClipboard != null && !this.bgClipboard.isEmpty(); + } + + public void copyAllToClipboard() { + copyToClipboard(); + copyLinesToClipboard(); + copyBackgroundsToClipboard(); + } + + // --- PUBLIC IO OPERATIONS --- + + public void clearChest(BlockPos pos, String dimensionId) { + Path path = getFileForPos(pos, dimensionId); + if (path != null) { + try { + Files.deleteIfExists(path); + } catch (IOException e) { + LOGGER.error("chestseparators: I/O error", e); + } + } + } + + public void loadConfig(BlockPos pos, String dimensionId) { + clearCurrentConfig(); + // Whitelist state is authoritative on the server; do not clear it here. + + Minecraft client = Minecraft.getInstance(); + if (client.level == null) return; + + BlockState state = client.level.getBlockState(pos); + if (state.getBlock() instanceof ChestBlock) { + ChestType type = state.getValue(ChestBlock.TYPE); + if (type != ChestType.SINGLE) { + Direction facing = state.getValue(ChestBlock.FACING); + Direction neighborDir = + type == ChestType.LEFT ? facing.getClockWise() : facing.getCounterClockWise(); + BlockPos neighborPos = pos.relative(neighborDir); + + // Key the layout by ChestType, the same way the container (and thus filters, via DoubleInventoryMixin) + // is combined: vanilla puts the RIGHT chest first (GUI slots 0-26), LEFT second (27-53). Keying by + // min/max BlockPos instead disagreed with that order, so breaking + replacing one half (which can flip + // the block's LEFT/RIGHT role while its position stays) moved the layout to the wrong half while the + // filters stayed. Same key keeps layout and filters on the same half. + BlockPos primaryPos = type == ChestType.RIGHT ? pos : neighborPos; + BlockPos secondaryPos = type == ChestType.RIGHT ? neighborPos : pos; + + RawData firstData = readRawData(getFileForPos(primaryPos, dimensionId)); + currentChestConfig.putAll(firstData.visual); + + RawData secondData = readRawData(getFileForPos(secondaryPos, dimensionId)); + for (Map.Entry entry : secondData.visual.entrySet()) { + currentChestConfig.put(entry.getKey() + 27, entry.getValue()); + } + return; + } + } + RawData rawData = readRawData(getFileForPos(pos, dimensionId)); + currentChestConfig.putAll(rawData.visual); + } + + /** + * Reads the locally-stored Ender Chest whitelist without disturbing the currently-open container's + * state. Used to forward the filter to the server for radius auto-deposit (Ender filters are + * client-side only). Returns an empty map if none is configured. + */ + public Map readEnderWhitelists() { + return new HashMap<>(readRawData(getEnderChestFile()).filters); + } + + /** + * Reads the locally-stored whitelist of a mobile container entity (chest minecart / boat) by its + * UUID, without disturbing the open container's state. Entity filters are client-side only and are + * forwarded to the server for radius auto-deposit. Returns an empty map if none is configured. + */ + public Map readEntityWhitelists(UUID uuid) { + return new HashMap<>(readRawData(getFileForEntity(uuid)).filters); + } + + public void loadEnderConfig() { + clearCurrentConfig(); + // Ender Chest whitelists are local-only; always load them from the local .dat file. + currentWhitelists.clear(); + RawData data = readRawData(getEnderChestFile()); + currentChestConfig.putAll(data.visual); + currentWhitelists.putAll(data.filters); + } + + public void loadEntityConfig(UUID uuid) { + clearCurrentConfig(); + currentWhitelists.clear(); + RawData data = readRawData(getFileForEntity(uuid)); + currentChestConfig.putAll(data.visual); + currentWhitelists.putAll(data.filters); + } + + public void loadShulkerConfig(UUID uuid) { + clearCurrentConfig(); + // Preserve the server-authoritative whitelist; only update visual config from local storage. + RawData data = readRawData(getFileForShulker(uuid)); + currentChestConfig.putAll(data.visual); + } + + public void saveConfig(BlockPos pos, String dimensionId) { + Minecraft client = Minecraft.getInstance(); + if (client.level == null) return; + + // Only the chest's own slots; mirrored inventory entries (offset keys) are saved separately. + Map chestVis = chestOnlyVisual(); + Map chestFil = chestOnlyWhitelists(); + + BlockState state = client.level.getBlockState(pos); + if (state.getBlock() instanceof ChestBlock) { + ChestType type = state.getValue(ChestBlock.TYPE); + if (type != ChestType.SINGLE) { + Direction facing = state.getValue(ChestBlock.FACING); + Direction neighborDir = + type == ChestType.LEFT ? facing.getClockWise() : facing.getCounterClockWise(); + BlockPos neighborPos = pos.relative(neighborDir); + + // Key the layout by ChestType, the same way the container (and thus filters, via DoubleInventoryMixin) + // is combined: vanilla puts the RIGHT chest first (GUI slots 0-26), LEFT second (27-53). Keying by + // min/max BlockPos instead disagreed with that order, so breaking + replacing one half (which can flip + // the block's LEFT/RIGHT role while its position stays) moved the layout to the wrong half while the + // filters stayed. Same key keeps layout and filters on the same half. + BlockPos primaryPos = type == ChestType.RIGHT ? pos : neighborPos; + BlockPos secondaryPos = type == ChestType.RIGHT ? neighborPos : pos; + + Map firstVis = new HashMap<>(); + Map secondVis = new HashMap<>(); + Map firstFil = new HashMap<>(); + Map secondFil = new HashMap<>(); + + for (Map.Entry entry : chestVis.entrySet()) { + if (entry.getKey() < 27) firstVis.put(entry.getKey(), entry.getValue()); + else secondVis.put(entry.getKey() - 27, entry.getValue()); + } + for (Map.Entry entry : chestFil.entrySet()) { + if (entry.getKey() < 27) firstFil.put(entry.getKey(), entry.getValue()); + else secondFil.put(entry.getKey() - 27, entry.getValue()); + } + + writeRawData(firstVis, firstFil, getFileForPos(primaryPos, dimensionId)); + writeRawData(secondVis, secondFil, getFileForPos(secondaryPos, dimensionId)); + return; + } + } + writeRawData(chestVis, chestFil, getFileForPos(pos, dimensionId)); + } + + public void saveEnderConfig() { + writeRawData(chestOnlyVisual(), chestOnlyWhitelists(), getEnderChestFile()); + } + + public void saveEntityConfig(UUID uuid) { + writeRawData(chestOnlyVisual(), chestOnlyWhitelists(), getFileForEntity(uuid)); + } + + public void saveShulkerConfig(UUID uuid) { + writeRawData(chestOnlyVisual(), chestOnlyWhitelists(), getFileForShulker(uuid)); + } + + private static class RawData { + Map visual = new HashMap<>(); + Map filters = new HashMap<>(); + // Only presets carry a display name; world configs leave this null. + String name = null; + } + + private RawData readRawData(Path path) { + RawData data = new RawData(); + if (path == null || !Files.exists(path)) return data; + try { + CompoundTag root = NbtIo.readCompressed(path, NbtAccounter.unlimitedHeap()); + + root.getString("Name").ifPresent(n -> data.name = n); + + if (root.contains("Separators")) { + root.getCompound("Separators").ifPresent(separatorsTag -> { + for (String key : separatorsTag.keySet()) { + try { + int slot = Integer.parseInt(key); + separatorsTag.getIntArray(key).ifPresent(arr -> { + // Normalize every legacy length to the current 9-element layout: + // [TOP,BOTTOM,LEFT,RIGHT,BG, seqTOP,seqBOTTOM,seqLEFT,seqRIGHT]. + int[] full; + if (arr.length == 4) { + full = new int[] {arr[0], arr[1], arr[2], arr[3], 0, 0, 0, 0, 0}; + } else if (arr.length >= 5) { + full = java.util.Arrays.copyOf(arr, SLOT_ARRAY_LEN); + } else { + return; // malformed + } + data.visual.put(slot, full); + // Keep the paint counter ahead of any loaded sequence so new paints + // stay on top in corners. + for (int si = IDX_SEQ_TOP; si <= IDX_SEQ_RIGHT; si++) { + if (full[si] > paintSequence) paintSequence = full[si]; + } + }); + } catch (NumberFormatException ignored) { + } + } + }); + } + + if (root.contains("Whitelists")) { + root.getCompound("Whitelists").ifPresent(wlRoot -> { + for (String key : wlRoot.keySet()) { + try { + int slot = Integer.parseInt(key); + wlRoot.getCompound(key).ifPresent(wlTag -> { + + // Safely extract UUID from an Optional String + UUID groupId = wlTag.getString("GroupId") + .map(str -> { + try { + return UUID.fromString(str); + } catch (Exception e) { + return UUID.randomUUID(); + } + }) + .orElseGet(UUID::randomUUID); + + java.util.List items = new ArrayList<>(); + + // getString(i) returns Optional in these mappings; use ifPresent to extract safely. + wlTag.getList("AllowedItems").ifPresent(list -> { + for (int i = 0; i < list.size(); i++) { + list.getString(i).ifPresent(items::add); + } + }); + + // Safely extract booleans using orElse() fallback + boolean manual = wlTag.getBoolean("AllowManual").orElse(true); + boolean shift = wlTag.getBoolean("AllowShift").orElse(true); + boolean hopper = wlTag.getBoolean("AllowHopper").orElse(true); + // Optional so files written before target counts still load (defaulting to 0). + int target = wlTag.getInt("TargetCount").orElse(0); + + data.filters.put( + slot, new SlotWhitelist(groupId, items, manual, shift, hopper, target)); + }); + } catch (Exception ignored) { + } + } + }); + } + } catch (IOException e) { + LOGGER.error("chestseparators: I/O error", e); + } + return data; + } + + private void writeRawData(Map visualConfig, Map filters, Path path) { + writeRawData(visualConfig, filters, null, path); + } + + private void writeRawData( + Map visualConfig, Map filters, String name, Path path) { + if (path == null) return; + if (visualConfig.isEmpty() && (filters == null || filters.isEmpty())) { + try { + Files.deleteIfExists(path); + } catch (IOException ignored) { + } + return; + } + + CompoundTag root = new CompoundTag(); + root.putInt("Version", DATA_VERSION); + if (name != null && !name.isEmpty()) root.putString("Name", name); + + if (!visualConfig.isEmpty()) { + CompoundTag separatorsTag = new CompoundTag(); + for (Map.Entry entry : visualConfig.entrySet()) { + separatorsTag.putIntArray(String.valueOf(entry.getKey()), entry.getValue()); + } + root.put("Separators", separatorsTag); + } + + if (filters != null && !filters.isEmpty()) { + CompoundTag wlRoot = new CompoundTag(); + for (Map.Entry entry : filters.entrySet()) { + CompoundTag wlTag = new CompoundTag(); + SlotWhitelist wl = entry.getValue(); + + // Save UUID as String to avoid missing method errors + wlTag.putString("GroupId", wl.groupId().toString()); + + net.minecraft.nbt.ListTag itemsList = new net.minecraft.nbt.ListTag(); + for (String item : wl.allowedItems()) { + itemsList.add(net.minecraft.nbt.StringTag.valueOf(item)); + } + wlTag.put("AllowedItems", itemsList); + wlTag.putBoolean("AllowManual", wl.allowManual()); + wlTag.putBoolean("AllowShift", wl.allowShift()); + wlTag.putBoolean("AllowHopper", wl.allowHopper()); + wlTag.putInt("TargetCount", wl.targetCount()); + + wlRoot.put(String.valueOf(entry.getKey()), wlTag); + } + root.put("Whitelists", wlRoot); + } + + try { + NbtIo.writeCompressed(root, path); + } catch (IOException e) { + LOGGER.error("chestseparators: I/O error", e); + } + } + + // --- WHITELIST DATA --- + private Map currentWhitelists = new HashMap<>(); + + public Map getCurrentWhitelists() { + return currentWhitelists; + } + + public void setCurrentWhitelists( + Map whitelists) { + this.currentWhitelists = new HashMap<>(whitelists); + } + + // --- FLOOD FILL ALGORITHM (VISUAL SELECTION) --- + + /** + * Flood-fills the contiguous region of slots reachable from {@code startSlot} without crossing a + * separator, confined to the key window {@code [lo, hi)} (one namespace: the container starts at 0, + * the player inventory at {@link #PLAYER_KEY_OFFSET}). {@code lo} must be a multiple of 9. + */ + public Set getContiguousSlots(int startSlot, int lo, int hi) { + Set result = new HashSet<>(); + if (startSlot < lo || startSlot >= hi) return result; + + int rowCount = (hi - lo + 8) / 9; + java.util.Queue queue = new java.util.LinkedList<>(); + queue.add(startSlot); + result.add(startSlot); + + while (!queue.isEmpty()) { + int current = queue.poll(); + int rel = current - lo; + int row = rel / 9; + int col = rel % 9; + + int up = current - 9; + if (row > 0 && up >= lo && !result.contains(up)) { + if (getColor(current, ACTION_TOP) == 0 && getColor(up, ACTION_BOTTOM) == 0) { + result.add(up); + queue.add(up); + } + } + + int down = current + 9; + if (row < rowCount - 1 && down < hi && !result.contains(down)) { + if (getColor(current, ACTION_BOTTOM) == 0 && getColor(down, ACTION_TOP) == 0) { + result.add(down); + queue.add(down); + } + } + + int left = current - 1; + if (col > 0 && left >= lo && !result.contains(left)) { + if (getColor(current, ACTION_LEFT) == 0 && getColor(left, ACTION_RIGHT) == 0) { + result.add(left); + queue.add(left); + } + } + + int right = current + 1; + if (col < 8 && right < hi && !result.contains(right)) { + if (getColor(current, ACTION_RIGHT) == 0 && getColor(right, ACTION_LEFT) == 0) { + result.add(right); + queue.add(right); + } + } + } + return result; + } + + public int[] getCustomColors(int tabMode) { + // In shared mode all tabs read from the single Lines palette. + if (io.github.marcsanzdev.chestseparators.config.GlobalChestConfig.instance.sharedCustomColors) + return worldCustomLineColors; + if (tabMode == 1) return worldCustomBgColors; + if (tabMode == 2) return worldCustomComboColors; + return worldCustomLineColors; + } + + public void setCustomColor(int index, int color, int tabMode) { + if (index >= 0 && index < 8) { + // In shared mode all tabs write to the single Lines palette. + if (io.github.marcsanzdev.chestseparators.config.GlobalChestConfig.instance.sharedCustomColors) + worldCustomLineColors[index] = color; + else if (tabMode == 1) worldCustomBgColors[index] = color; + else if (tabMode == 2) worldCustomComboColors[index] = color; + else worldCustomLineColors[index] = color; + } + } + + public void loadWorldPalette() { + worldCustomLineColors = new int[8]; + worldCustomBgColors = new int[8]; + worldCustomComboColors = new int[8]; + Path path = getWorldConfigDir().resolve(PALETTE_FILE_NAME); + + if (!Files.exists(path)) return; + + try { + CompoundTag root = NbtIo.readCompressed(path, NbtAccounter.unlimitedHeap()); + + if (root.contains("PaletteLines")) { + root.getIntArray("PaletteLines") + .ifPresent(loaded -> + System.arraycopy(loaded, 0, worldCustomLineColors, 0, Math.min(loaded.length, 8))); + } + if (root.contains("PaletteBg")) { + root.getIntArray("PaletteBg") + .ifPresent(loaded -> + System.arraycopy(loaded, 0, worldCustomBgColors, 0, Math.min(loaded.length, 8))); + } + if (root.contains("PaletteCombo")) { + root.getIntArray("PaletteCombo") + .ifPresent(loaded -> + System.arraycopy(loaded, 0, worldCustomComboColors, 0, Math.min(loaded.length, 8))); + } + } catch (IOException e) { + LOGGER.error("chestseparators: I/O error", e); + } + } + + public void saveWorldPalette() { + Path path = getWorldConfigDir().resolve(PALETTE_FILE_NAME); + CompoundTag root = new CompoundTag(); + root.putIntArray("PaletteLines", worldCustomLineColors); + root.putIntArray("PaletteBg", worldCustomBgColors); + root.putIntArray("PaletteCombo", worldCustomComboColors); + try { + NbtIo.writeCompressed(root, path); + } catch (IOException e) { + LOGGER.error("chestseparators: I/O error", e); + } + } + + // --- PLAYER INVENTORY PROFILE (global by default, per-world when configured) --- + + /** Cross-world config dir ({@code config/chestseparators}), used for the global inventory profile. */ + private Path getGlobalConfigDir() { + Path dir = Minecraft.getInstance().gameDirectory.toPath().resolve("config/" + MOD_ID); + try { + if (!Files.exists(dir)) { + Files.createDirectories(dir); + } + } catch (IOException e) { + LOGGER.error("chestseparators: I/O error", e); + } + return dir; + } + + private Path getInventoryFile() { + // The active inventory decorators + filters are ALWAYS per-world (and, being client-side, per + // account): they must not bleed across worlds/servers. Reusable inventory PRESETS stay global + // (see getInventoryPresetFile) so they can be applied to any world as templates. + return getWorldConfigDir().resolve(INVENTORY_FILE_NAME); + } + + public Map getPlayerInventoryVisual() { + return playerInventoryVisual; + } + + public Map getPlayerInventoryFilters() { + return playerInventoryFilters; + } + + // --- PRESET NAMES --- + // Preset display names are stored inside each preset file (the "Name" tag) but cached here, keyed by + // file path, so the menu does not decompress a file per row every frame. A cached empty string means + // "saved but unnamed"; a missing key means "not read yet". Mutations refresh the entry. + private final Map presetNameCache = new HashMap<>(); + + /** Reads just the "Name" tag of a preset file, or null when absent/unreadable. */ + private String readPresetName(Path path) { + if (path == null || !Files.exists(path)) return null; + try { + CompoundTag root = NbtIo.readCompressed(path, NbtAccounter.unlimitedHeap()); + return root.getString("Name").orElse(null); + } catch (IOException e) { + return null; + } + } + + /** Custom display name of the preset in this file, or null when empty/unnamed. Cached by path. */ + private String getPresetNameForFile(Path path) { + String key = path.toString(); + String cached = presetNameCache.get(key); + if (cached != null) return cached.isEmpty() ? null : cached; + String name = readPresetName(path); + presetNameCache.put(key, name == null ? "" : name); + return name; + } + + /** Renames a preset in place (rewrites its file keeping the layout and filters). No-op if empty. */ + private void setPresetNameForFile(Path path, String name) { + if (!Files.exists(path)) return; + RawData data = readRawData(path); + String trimmed = name == null ? "" : name.trim(); + writeRawData(data.visual, data.filters, trimmed, path); + presetNameCache.put(path.toString(), trimmed); + } + + private void invalidatePresetNameForFile(Path path) { + presetNameCache.remove(path.toString()); + } + + // Typed convenience wrappers. Chest presets are split by the open container's size (27 vs 54), so a + // single chest and a double chest each have their own independent set — the menu shows only the set + // that matches whatever is open. + public String getInventoryPresetName(int index) { + return getPresetNameForFile(getInventoryPresetFile(index)); + } + + public void setInventoryPresetName(int index, String name) { + setPresetNameForFile(getInventoryPresetFile(index), name); + } + + public String getChestPresetName(int size, int index) { + return getPresetNameForFile(getChestPresetFile(size, index)); + } + + public void setChestPresetName(int size, int index, String name) { + setPresetNameForFile(getChestPresetFile(size, index), name); + } + + // Written once the pre-made presets have been created, so they are never regenerated — a deleted or + // overwritten default stays gone. Bump the suffix to ship a new default set to existing players. + private static final String DEFAULTS_MARKER = ".defaults_seeded_v2"; + + // The ready-made presets shipped as resources under /chestseparators_presets. Copied verbatim into + // the config on first run, so what the player gets is byte-for-byte what was authored in-game. + private static final String[] BUNDLED_PRESETS = { + "chest_preset_27_1.json", + "chest_preset_27_2.json", + "chest_preset_27_3.json", + "chest_preset_27_4.json", + "chest_preset_27_5.json", + "chest_preset_54_1.json", + "chest_preset_54_2.json", + "chest_preset_54_3.json", + "chest_preset_54_4.json", + "chest_preset_54_5.json", + "inventory_preset_1.json", + "inventory_preset_2.json", + "inventory_preset_3.json", + "inventory_preset_4.json", + "inventory_preset_5.json", + }; + + /** + * Copies the bundled ready-made presets into the config the first time the mod runs. Guarded by a + * marker file so it happens exactly once; an existing slot is never overwritten, so a player who + * already saved into that slot keeps their own preset. The files are already valid preset NBT, so + * they are copied as raw bytes — no re-serialization. + */ + public void seedDefaultPresetsIfNeeded() { + Path marker = getGlobalConfigDir().resolve(DEFAULTS_MARKER); + if (Files.exists(marker)) return; + + // Guard: if the bundled presets are not on the classpath (a broken/dev build with the resources + // missing), do NOT write the marker — otherwise the "seeded once" flag would be set with nothing + // copied, permanently suppressing the defaults even after the resources are added back. + if (ChestConfigManager.class.getResource("/chestseparators_presets/" + BUNDLED_PRESETS[0]) == null) { + return; + } + + for (String name : BUNDLED_PRESETS) { + Path target = getGlobalConfigDir().resolve(name); + if (Files.exists(target)) continue; + try (java.io.InputStream in = + ChestConfigManager.class.getResourceAsStream("/chestseparators_presets/" + name)) { + if (in == null) continue; + Files.write(target, in.readAllBytes()); + invalidatePresetNameForFile(target); + } catch (IOException e) { + LOGGER.error("chestseparators: failed to seed preset " + name, e); + } + } + try { + Files.createFile(marker); + } catch (IOException ignored) { + } + } + + /** + * Offset added to a player-inventory slot index to namespace it inside the editor's working maps, + * so chest slots (raw indices) and inventory slots (offset indices) — which would otherwise share + * the same index — coexist while editing both at once. Must exceed any container's slot count and + * be a multiple of 9 so the 9-wide grid math stays aligned within the inventory namespace. + */ + public static final int PLAYER_KEY_OFFSET = 117; + + public static boolean isInventoryKey(int key) { + return key >= PLAYER_KEY_OFFSET; + } + + /** + * True for player-inventory keys that fall outside the 9-wide grid: armor and offhand (their + * PlayerInventory index is >= MAIN_SIZE = 36). They are isolated cells with no grid neighbours, so + * blob connectors and contiguous flood-fill must not bridge them. + */ + public static boolean isNonGridInventoryKey(int key) { + return key >= PLAYER_KEY_OFFSET + 36; + } + + /** Loads the persistent inventory profile (separators/backgrounds + filters) from disk. */ + public void loadInventoryProfile() { + RawData data = readRawData(getInventoryFile()); + playerInventoryVisual = data.visual; + playerInventoryFilters = data.filters; + bumpPaintSequence(playerInventoryVisual.values()); + } + + /** + * Mirrors the inventory profile into the editor's working maps at offset keys, so the editor edits + * the chest (raw keys) and the inventory (offset keys) simultaneously through the same operations. + */ + public void mirrorInventoryIntoCurrent() { + for (Map.Entry e : playerInventoryVisual.entrySet()) { + currentChestConfig.put(e.getKey() + PLAYER_KEY_OFFSET, e.getValue().clone()); + } + for (Map.Entry e : playerInventoryFilters.entrySet()) { + currentWhitelists.put(e.getKey() + PLAYER_KEY_OFFSET, e.getValue()); + } + } + + /** Inventory-slot visuals from the working map, re-keyed back to profile (non-offset) keys, cloned. */ + private Map extractInventoryVisual() { + Map vis = new HashMap<>(); + for (Map.Entry e : currentChestConfig.entrySet()) { + if (isInventoryKey(e.getKey())) + vis.put(e.getKey() - PLAYER_KEY_OFFSET, e.getValue().clone()); + } + return vis; + } + + /** Inventory-slot filters from the working map, re-keyed back to profile (non-offset) keys. */ + private Map extractInventoryFilters() { + Map fil = new HashMap<>(); + for (Map.Entry e : currentWhitelists.entrySet()) { + if (isInventoryKey(e.getKey())) fil.put(e.getKey() - PLAYER_KEY_OFFSET, e.getValue()); + } + return fil; + } + + /** Extracts the inventory portion (offset keys) from the working maps back into the profile and saves it. */ + public void saveInventoryFromCurrent() { + Map vis = extractInventoryVisual(); + Map fil = extractInventoryFilters(); + playerInventoryVisual = vis; + playerInventoryFilters = fil; + writeRawData(vis, fil, getInventoryFile()); + } + + private static final String INVENTORY_PRESET_PREFIX = "inventory_preset_"; + + /** + * File backing inventory preset slot {@code index}. Presets are intentionally GLOBAL (shared across + * all worlds/servers): they are reusable templates the player applies to any world. The active + * inventory layout, by contrast, is per-world (see getInventoryFile). + */ + private Path getInventoryPresetFile(int index) { + return getGlobalConfigDir().resolve(INVENTORY_PRESET_PREFIX + index + ".json"); + } + + /** Whether inventory preset slot {@code index} has been saved. */ + public boolean inventoryPresetExists(int index) { + return Files.exists(getInventoryPresetFile(index)); + } + + /** Deletes inventory preset slot {@code index} from disk. No-op if it does not exist. */ + public void deleteInventoryPreset(int index) { + try { + Files.deleteIfExists(getInventoryPresetFile(index)); + } catch (IOException e) { + LOGGER.error("chestseparators: I/O error", e); + } + invalidatePresetNameForFile(getInventoryPresetFile(index)); + } + + /** Saves the inventory portion currently in the working maps into preset slot {@code index}. */ + public void saveInventoryPreset(int index) { + Map vis = extractInventoryVisual(); + Map fil = extractInventoryFilters(); + // Overwriting a slot keeps its existing name (see saveChestPreset). + Path path = getInventoryPresetFile(index); + String name = getPresetNameForFile(path); + writeRawData(vis, fil, name, path); + invalidatePresetNameForFile(path); + } + + /** + * Loads inventory preset slot {@code index} as the active inventory profile and mirrors it into the + * working maps (so an open editor reflects it immediately). Returns false if the slot is empty. + */ + public boolean loadInventoryPreset(int index) { + Path f = getInventoryPresetFile(index); + if (!Files.exists(f)) return false; + RawData data = readRawData(f); + playerInventoryVisual = data.visual; + playerInventoryFilters = data.filters; + bumpPaintSequence(playerInventoryVisual.values()); + currentChestConfig.keySet().removeIf(ChestConfigManager::isInventoryKey); + currentWhitelists.keySet().removeIf(ChestConfigManager::isInventoryKey); + mirrorInventoryIntoCurrent(); + writeRawData(playerInventoryVisual, playerInventoryFilters, getInventoryFile()); + return true; + } + + private static final String CHEST_PRESET_PREFIX = "chest_preset_"; + + /** + * File backing chest preset slot {@code index} for a container of {@code size} slots (27 vs 54). + * Presets are split by container size so a single chest and a double chest keep independent sets, + * shown only when a container of that size is open. Global reusable template across worlds. + */ + private Path getChestPresetFile(int size, int index) { + return getGlobalConfigDir().resolve(CHEST_PRESET_PREFIX + size + "_" + index + ".json"); + } + + /** Whether chest preset slot {@code index} of the {@code size}-slot set has been saved. */ + public boolean chestPresetExists(int size, int index) { + return Files.exists(getChestPresetFile(size, index)); + } + + /** Deletes chest preset slot {@code index} of the {@code size}-slot set from disk. */ + public void deleteChestPreset(int size, int index) { + Path path = getChestPresetFile(size, index); + try { + Files.deleteIfExists(path); + } catch (IOException e) { + LOGGER.error("chestseparators: I/O error", e); + } + invalidatePresetNameForFile(path); + } + + /** Saves the open chest's current layout + filters into slot {@code index} of the {@code size}-slot set. */ + public void saveChestPreset(int size, int index) { + Path path = getChestPresetFile(size, index); + // Overwriting a slot keeps whatever name it already had, so a re-save does not wipe a rename. + String name = getPresetNameForFile(path); + writeRawData(chestOnlyVisual(), chestOnlyWhitelists(), name, path); + invalidatePresetNameForFile(path); + } + + /** + * Loads chest preset slot {@code index} of the {@code size}-slot set onto the open chest, replacing + * only the chest-only keys in the working maps and leaving the mirrored inventory keys untouched. + */ + public boolean loadChestPreset(int size, int index) { + Path f = getChestPresetFile(size, index); + if (!Files.exists(f)) return false; + RawData data = readRawData(f); + currentChestConfig.keySet().removeIf(k -> !isInventoryKey(k)); + currentWhitelists.keySet().removeIf(k -> !isInventoryKey(k)); + currentChestConfig.putAll(data.visual); + currentWhitelists.putAll(data.filters); + bumpPaintSequence(data.visual.values()); + return true; + } + + /** Read-only snapshot of a preset's stored data, for rendering a preview without applying it. */ + public record PresetPreview(Map visual, Map filters) {} + + /** The five paint colors of a slot's stored array as {top, bottom, left, right, background}. */ + public static int[] previewColors(int[] arr) { + int[] c = new int[5]; + for (int i = 0; i <= IDX_BG; i++) { + c[i] = (arr != null && i < arr.length) ? arr[i] : 0; + } + return c; + } + + /** Reads an inventory preset's contents for preview (keys are raw PlayerInventory indices). */ + public PresetPreview readInventoryPresetPreview(int index) { + Path f = getInventoryPresetFile(index); + if (!Files.exists(f)) return null; + RawData data = readRawData(f); + return new PresetPreview(data.visual, data.filters); + } + + /** Reads a chest preset's contents for preview (keys are raw container slot indices). */ + public PresetPreview readChestPresetPreview(int size, int index) { + Path f = getChestPresetFile(size, index); + if (!Files.exists(f)) return null; + RawData data = readRawData(f); + return new PresetPreview(data.visual, data.filters); + } + + /** Chest-only view of the working visual config (excludes mirrored inventory entries at offset keys). */ + private Map chestOnlyVisual() { + Map out = new HashMap<>(); + for (Map.Entry e : currentChestConfig.entrySet()) { + if (!isInventoryKey(e.getKey())) out.put(e.getKey(), e.getValue()); + } + return out; + } + + /** Chest-only view of the working whitelists (excludes mirrored inventory entries at offset keys). */ + public Map chestOnlyWhitelists() { + Map out = new HashMap<>(); + for (Map.Entry e : currentWhitelists.entrySet()) { + if (!isInventoryKey(e.getKey())) out.put(e.getKey(), e.getValue()); + } + return out; + } + + public void copyWhitelistsToClipboard() { + if (currentWhitelists != null) { + whitelistClipboard = new HashMap<>(); + for (Map.Entry entry : currentWhitelists.entrySet()) { + whitelistClipboard.put(entry.getKey(), entry.getValue()); + } + } + } + + public boolean hasWhitelistClipboardData() { + return whitelistClipboard != null && !whitelistClipboard.isEmpty(); + } + + public void pasteWhitelistsFromClipboard() { + if (hasWhitelistClipboardData()) { + if (currentWhitelists == null) currentWhitelists = new HashMap<>(); + + Map uuidMapping = new HashMap<>(); + + for (Map.Entry entry : whitelistClipboard.entrySet()) { + SlotWhitelist clipboardItem = entry.getValue(); + + UUID newGroupId = uuidMapping.computeIfAbsent(clipboardItem.groupId(), k -> UUID.randomUUID()); + + SlotWhitelist independentCopy = new SlotWhitelist( + newGroupId, + new ArrayList<>(clipboardItem.allowedItems()), + clipboardItem.allowManual(), + clipboardItem.allowShift(), + clipboardItem.allowHopper(), + clipboardItem.targetCount()); + currentWhitelists.put(entry.getKey(), independentCopy); + } + } + } +} diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/data/SlotWhitelist.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/data/SlotWhitelist.java new file mode 100644 index 0000000..4307305 --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/data/SlotWhitelist.java @@ -0,0 +1,80 @@ +package io.github.marcsanzdev.chestseparators.data; + +import com.mojang.serialization.Codec; +import com.mojang.serialization.codecs.RecordCodecBuilder; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; +import net.minecraft.core.UUIDUtil; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.codec.ByteBufCodecs; +import net.minecraft.network.codec.StreamCodec; + +// Represents the whitelist configuration for a single inventory slot. +// Includes a groupId to visually and logically link multiple slots together. +// targetCount retains a minimum number of each listed item across the filter group's inventory slots. +// 0 preserves the original behaviour: all matching items in filtered inventory slots are protected +// from mod-triggered automatic deposits. Non-inventory container filters ignore this value. +public record SlotWhitelist( + UUID groupId, + List allowedItems, + boolean allowManual, + boolean allowShift, + boolean allowHopper, + int targetCount) { + + /** Backwards-compatible constructor for the pre-targetCount call sites (defaults to no target). */ + public SlotWhitelist( + UUID groupId, List allowedItems, boolean allowManual, boolean allowShift, boolean allowHopper) { + this(groupId, allowedItems, allowManual, allowShift, allowHopper, 0); + } + + // Codec used for saving this data into the world's NBT files (.mca) and Item Data Components. + // target_count is optional so worlds saved before this field still load (defaulting to 0). + public static final Codec CODEC = RecordCodecBuilder.create(instance -> instance.group( + UUIDUtil.CODEC.fieldOf("group_id").forGetter(SlotWhitelist::groupId), + Codec.STRING.listOf().fieldOf("allowed_items").forGetter(SlotWhitelist::allowedItems), + Codec.BOOL.fieldOf("allow_manual").forGetter(SlotWhitelist::allowManual), + Codec.BOOL.fieldOf("allow_shift").forGetter(SlotWhitelist::allowShift), + Codec.BOOL.fieldOf("allow_hopper").forGetter(SlotWhitelist::allowHopper), + Codec.INT.optionalFieldOf("target_count", 0).forGetter(SlotWhitelist::targetCount)) + .apply(instance, SlotWhitelist::new)); + + // Stream codec for transmitting this data over the network between client and server. + public static final StreamCodec PACKET_CODEC = StreamCodec.composite( + UUIDUtil.STREAM_CODEC, + SlotWhitelist::groupId, + ByteBufCodecs.STRING_UTF8.apply(ByteBufCodecs.list()), + SlotWhitelist::allowedItems, + ByteBufCodecs.BOOL, + SlotWhitelist::allowManual, + ByteBufCodecs.BOOL, + SlotWhitelist::allowShift, + ByteBufCodecs.BOOL, + SlotWhitelist::allowHopper, + ByteBufCodecs.VAR_INT, + SlotWhitelist::targetCount, + SlotWhitelist::new); + + // Codec for a whole slot->filter map. The map is keyed by int slot index, but NBT/JSON map keys must + // be strings, so this stores string keys and converts back on load. Reused by the data component and + // by the block-entity NBT persistence so both share one on-disk shape. + public static final Codec> MAP_CODEC = Codec.unboundedMap(Codec.STRING, CODEC) + .xmap( + stringMap -> { + Map intMap = new HashMap<>(); + stringMap.forEach((k, v) -> { + try { + intMap.put(Integer.parseInt(k), v); + } catch (NumberFormatException ignored) { + } + }); + return intMap; + }, + intMap -> { + Map stringMap = new HashMap<>(); + intMap.forEach((k, v) -> stringMap.put(String.valueOf(k), v)); + return stringMap; + }); +} diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/data/UndoRedoHistory.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/data/UndoRedoHistory.java new file mode 100644 index 0000000..a49bff1 --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/data/UndoRedoHistory.java @@ -0,0 +1,69 @@ +package io.github.marcsanzdev.chestseparators.data; + +import java.util.LinkedList; +import java.util.function.UnaryOperator; + +/** + * Generic bounded undo/redo history. + * + *

Stores deep copies of state snapshots (produced by the supplied copy function) so the + * live state and the recorded history never alias. The same mechanism backs both the visual + * separator configuration and the slot whitelists. + * + * @param the snapshot state type + */ +public final class UndoRedoHistory { + + private final LinkedList undoStack = new LinkedList<>(); + private final LinkedList redoStack = new LinkedList<>(); + private final UnaryOperator copy; + private final int maxSteps; + + public UndoRedoHistory(UnaryOperator copy, int maxSteps) { + this.copy = copy; + this.maxSteps = maxSteps; + } + + /** Records the current state as a restore point and discards any redo history. */ + public void push(T current) { + undoStack.addLast(copy.apply(current)); + if (undoStack.size() > maxSteps) { + undoStack.removeFirst(); + } + redoStack.clear(); + } + + public boolean canUndo() { + return !undoStack.isEmpty(); + } + + public boolean canRedo() { + return !redoStack.isEmpty(); + } + + /** + * Steps one entry back: captures {@code current} onto the redo stack and returns the previous + * snapshot for the caller to apply, or {@code null} when there is nothing to undo. + */ + public T undo(T current) { + if (!canUndo()) { + return null; + } + redoStack.addLast(copy.apply(current)); + return undoStack.removeLast(); + } + + /** Steps one entry forward, mirroring {@link #undo}; returns {@code null} when nothing to redo. */ + public T redo(T current) { + if (!canRedo()) { + return null; + } + undoStack.addLast(copy.apply(current)); + return redoStack.removeLast(); + } + + public void clear() { + undoStack.clear(); + redoStack.clear(); + } +} diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/event/KeyInputHandler.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/event/KeyInputHandler.java new file mode 100644 index 0000000..58877e0 --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/event/KeyInputHandler.java @@ -0,0 +1,157 @@ +package io.github.marcsanzdev.chestseparators.event; + +import com.mojang.blaze3d.platform.InputConstants; +import dev.architectury.event.events.client.ClientTickEvent; +import dev.architectury.networking.NetworkManager; +import io.github.marcsanzdev.chestseparators.access.IWhitelistProvider; +import io.github.marcsanzdev.chestseparators.client.ui.ModKeyBindings; +import io.github.marcsanzdev.chestseparators.config.GlobalChestConfig; +import io.github.marcsanzdev.chestseparators.data.ChestConfigManager; +import io.github.marcsanzdev.chestseparators.data.SlotWhitelist; +import io.github.marcsanzdev.chestseparators.network.AutoDepositRequestPayload; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; +import net.minecraft.ChatFormatting; +import net.minecraft.client.Minecraft; +import net.minecraft.network.chat.Component; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.phys.AABB; + +public class KeyInputHandler { + + // Double-tap-sneak gesture state for the radius auto-deposit trigger. + private static boolean wasSneakDown = false; + private static long lastSneakTapTime = 0L; + private static final long DOUBLE_TAP_WINDOW_MS = 350L; + + public static void register() { + ClientTickEvent.CLIENT_POST.register(client -> { + if (client.player == null) return; + + // These fire only with no screen open (chest closed). The same toggles are wired into the + // chest screen via GenericContainerScreenMixin so they also work with the chest open. + if (client.gui.screen() != null) { + return; + } + + if (client.player == null) return; + while (ModKeyBindings.openEditorKey.consumeClick()) actionBar(client, togglePreviewPanel()); + while (ModKeyBindings.toggleMagnifierKey.consumeClick()) actionBar(client, toggleMagnifier()); + while (ModKeyBindings.toggleEditButtonsKey.consumeClick()) actionBar(client, toggleEditButtons()); + + handleAutoDepositTriggers(client); + }); + } + + // Fires the radius auto-deposit from either the dedicated (optional) hotkey or a quick + // double-tap of the sneak key. The server performs the move and replies with the animation data. + private static void handleAutoDepositTriggers(Minecraft client) { + boolean sneakDown = client.options.keyShift.isDown(); + + if (!GlobalChestConfig.instance.autoDepositEnabled) { + wasSneakDown = sneakDown; + return; + } + + while (ModKeyBindings.autoDepositKey.consumeClick()) + triggerAutoDeposit(client, AutoDepositRequestPayload.ACTION_DEPOSIT_ALL); + + if (GlobalChestConfig.instance.autoDepositDoubleSneak && sneakDown && !wasSneakDown) { + long now = System.currentTimeMillis(); + if (now - lastSneakTapTime <= DOUBLE_TAP_WINDOW_MS) { + triggerAutoDeposit(client, AutoDepositRequestPayload.ACTION_DEPOSIT_ALL); + lastSneakTapTime = 0L; + } else { + lastSneakTapTime = now; + } + } + wasSneakDown = sneakDown; + } + + private static void triggerAutoDeposit(Minecraft client, int action) { + if (client.player == null || !NetworkManager.canServerReceive(AutoDepositRequestPayload.TYPE)) return; + + int radius = GlobalChestConfig.instance.autoDepositRadius; + + // Entity (chest minecart / boat) filters are client-side only, so gather the ones near the + // player and forward them keyed by UUID; the server can't read these on its own. + Map> entityWhitelists = new HashMap<>(); + if (client.level != null) { + AABB box = client.player.getBoundingBox().inflate(radius); + for (Entity entity : + client.level.getEntities(client.player, box, e -> e instanceof IWhitelistProvider)) { + Map wl = + ChestConfigManager.getInstance().readEntityWhitelists(entity.getUUID()); + if (!wl.isEmpty()) entityWhitelists.put(entity.getUUID(), wl); + } + } + + NetworkManager.sendToServer(new AutoDepositRequestPayload( + radius, + GlobalChestConfig.instance.autoDepositThroughWalls, + action, + ChestConfigManager.getInstance().readEnderWhitelists(), + entityWhitelists)); + } + + // Each toggle flips its config flag and returns the feedback text, leaving the caller to display + // it: the action bar when no screen is open, or the editor's status overlay when a chest is open + // (the action bar would otherwise be hidden behind the chest GUI). + + public static Component toggleMagnifier() { + GlobalChestConfig.instance.magnifierEnabled = !GlobalChestConfig.instance.magnifierEnabled; + GlobalChestConfig.saveConfig(); + return label( + GlobalChestConfig.instance.magnifierEnabled, + "message.chestseparators.magnifier_on", + "message.chestseparators.magnifier_off"); + } + + public static Component toggleEditButtons() { + GlobalChestConfig.instance.showEditButtons = !GlobalChestConfig.instance.showEditButtons; + GlobalChestConfig.saveConfig(); + return label( + GlobalChestConfig.instance.showEditButtons, + "message.chestseparators.edit_buttons_visible", + "message.chestseparators.edit_buttons_hidden"); + } + + public static Component togglePreviewPanel() { + GlobalChestConfig.instance.showLeftPanel = !GlobalChestConfig.instance.showLeftPanel; + GlobalChestConfig.saveConfig(); + return label( + GlobalChestConfig.instance.showLeftPanel, + "message.chestseparators.preview_panel_visible", + "message.chestseparators.preview_panel_hidden"); + } + + public static Component toggleDepositButton() { + GlobalChestConfig.instance.showDepositButton = !GlobalChestConfig.instance.showDepositButton; + GlobalChestConfig.saveConfig(); + return label( + GlobalChestConfig.instance.showDepositButton, + "message.chestseparators.deposit_button_visible", + "message.chestseparators.deposit_button_hidden"); + } + + private static Component label(boolean on, String onKey, String offKey) { + return Component.translatable(on ? onKey : offKey); + } + + private static void actionBar(Minecraft client, Component message) { + if (client.player != null) client.player.sendOverlayMessage(message.copy().withStyle(ChatFormatting.GRAY)); + } + + public static boolean isModifierPressed() { + // Whether the "show panel" modifier key (default Left Alt) is currently held. Reading the mapping's + // live pressed state keeps this loader-agnostic (no Fabric KeyBindingHelper / raw SDL call needed). + // Over an open container vanilla stops updating KeyMapping down-state, so isDown() reads + // false there; poll the bound key raw (as the Shift checks do), falling back to isDown(). + InputConstants.Key bound = InputConstants.getKey(ModKeyBindings.showPanelModifierKey.saveString()); + if (bound.getType() == InputConstants.Type.KEYBOARD && bound.getValue() != InputConstants.UNKNOWN.getValue()) { + if (InputConstants.isKeyDown(bound.getValue())) return true; + } + return ModKeyBindings.showPanelModifierKey.isDown(); + } +} diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/AbstractContainerMenuAccessor.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/AbstractContainerMenuAccessor.java new file mode 100644 index 0000000..9331fb8 --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/AbstractContainerMenuAccessor.java @@ -0,0 +1,14 @@ +package io.github.marcsanzdev.chestseparators.mixin; + +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.item.ItemStack; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.gen.Invoker; + +/** Exposes the protected {@code moveItemStackTo} so the armor shift-click fallback can reuse it. */ +@Mixin(AbstractContainerMenu.class) +public interface AbstractContainerMenuAccessor { + + @Invoker("moveItemStackTo") + boolean chestseparators$moveItemStackTo(ItemStack stack, int startIndex, int endIndex, boolean fromLast); +} diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/ArmorEquipFilterMixin.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/ArmorEquipFilterMixin.java new file mode 100644 index 0000000..47db8cc --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/ArmorEquipFilterMixin.java @@ -0,0 +1,59 @@ +package io.github.marcsanzdev.chestseparators.mixin; + +import io.github.marcsanzdev.chestseparators.ChestSeparatorsState; +import io.github.marcsanzdev.chestseparators.data.SlotWhitelist; +import java.util.Map; +import net.minecraft.core.component.DataComponents; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.network.protocol.game.ServerboundUseItemPacket; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.server.network.ServerGamePacketListenerImpl; +import net.minecraft.world.item.ItemStack; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +/** + * Blocks right-click armor equip when the target armor slot has an active Shift filter that does not + * include the item. Vanilla's equip path bypasses {@code mayPlace} entirely, so intercepting at the + * network-handler level is the only reliable block point. + */ +@Mixin(ServerGamePacketListenerImpl.class) +public abstract class ArmorEquipFilterMixin { + + @Shadow + public ServerPlayer player; + + @Inject(method = "handleUseItem", at = @At("HEAD"), cancellable = true) + private void enforceFilterOnArmorEquip(ServerboundUseItemPacket packet, CallbackInfo ci) { + ItemStack stack = player.getItemInHand(packet.hand()); + if (stack.isEmpty()) return; + + var equippable = stack.get(DataComponents.EQUIPPABLE); + if (equippable == null) return; + + int rawIndex = + switch (equippable.slot()) { + case FEET -> 36; + case LEGS -> 37; + case CHEST -> 38; + case HEAD -> 39; + default -> -1; + }; + if (rawIndex == -1) return; + + Map filters = ChestSeparatorsState.INVENTORY_FILTERS.get(player.getUUID()); + if (filters == null) return; + + SlotWhitelist wl = filters.get(rawIndex); + if (wl == null || !wl.allowShift()) return; + + String itemId = BuiltInRegistries.ITEM.getKey(stack.getItem()).toString(); + if (!wl.allowedItems().contains(itemId)) { + ci.cancel(); + player.containerMenu.sendAllDataToRemote(); + } + } +} diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/ArmorSlotFilterMixin.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/ArmorSlotFilterMixin.java new file mode 100644 index 0000000..859a58d --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/ArmorSlotFilterMixin.java @@ -0,0 +1,49 @@ +package io.github.marcsanzdev.chestseparators.mixin; + +import io.github.marcsanzdev.chestseparators.ChestSeparatorsState; +import io.github.marcsanzdev.chestseparators.data.SlotWhitelist; +import io.github.marcsanzdev.chestseparators.util.ClickTracker; +import java.util.Map; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.inventory.Slot; +import net.minecraft.world.item.ItemStack; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +/** + * Extends inventory-filter enforcement to {@code ArmorSlot}, which overrides {@code mayPlace} without + * delegating to its superclass, so {@link SlotWhitelistMixin} on {@code Slot} cannot intercept armor-slot + * clicks. Applies the same Manual/Shift rule logic. ArmorSlot's members are inherited from {@link Slot} + * and are reached by casting through {@code Slot} (safe — ArmorSlot extends Slot). + */ +@Mixin(targets = "net.minecraft.world.inventory.ArmorSlot") +public abstract class ArmorSlotFilterMixin { + + @Inject(method = "mayPlace", at = @At("HEAD"), cancellable = true) + public void onMayPlace(ItemStack stack, CallbackInfoReturnable cir) { + if (ClickTracker.BYPASS_ENFORCEMENT.get()) return; + + Slot self = (Slot) (Object) this; + if (!(self.container instanceof Inventory pinv)) return; + + Map whitelists = ChestSeparatorsState.INVENTORY_FILTERS.get(pinv.player.getUUID()); + if (whitelists == null) return; + + int slotIndex = self.getContainerSlot(); + SlotWhitelist wl = whitelists.get(slotIndex); + if (wl == null) return; + + String itemId = BuiltInRegistries.ITEM.getKey(stack.getItem()).toString(); + boolean isAllowedItem = wl.allowedItems().contains(itemId); + boolean isShift = ClickTracker.IS_SHIFT_CLICK.get(); + + if (isShift) { + if (wl.allowShift() && !isAllowedItem) cir.setReturnValue(false); + } else { + if (wl.allowManual() && !isAllowedItem) cir.setReturnValue(false); + } + } +} diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/BlockDropMixin.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/BlockDropMixin.java new file mode 100644 index 0000000..2166af9 --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/BlockDropMixin.java @@ -0,0 +1,85 @@ +package io.github.marcsanzdev.chestseparators.mixin; + +import io.github.marcsanzdev.chestseparators.access.IShulkerUUIDProvider; +import io.github.marcsanzdev.chestseparators.access.IWhitelistProvider; +import io.github.marcsanzdev.chestseparators.data.SlotWhitelist; +import io.github.marcsanzdev.chestseparators.registry.ChestSeparatorsComponents; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; +import net.minecraft.core.BlockPos; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.item.BlockItem; +import net.minecraft.world.item.ItemInstance; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.entity.BarrelBlockEntity; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.ChestBlockEntity; +import net.minecraft.world.level.block.state.BlockState; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +/** Copies mod data (Shulker UUID, non-standard-container whitelist) onto the block's dropped ItemStack. */ +@Mixin(Block.class) +public abstract class BlockDropMixin { + + @Inject( + method = + "getDrops(Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/server/level/ServerLevel;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/entity/BlockEntity;)Ljava/util/List;", + at = @At("RETURN")) + private static void onGetDrops( + BlockState state, + ServerLevel world, + BlockPos pos, + BlockEntity blockEntity, + CallbackInfoReturnable> cir) { + injectDataToDrops(blockEntity, cir.getReturnValue()); + } + + @Inject( + method = + "getDrops(Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/server/level/ServerLevel;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/entity/BlockEntity;Lnet/minecraft/world/entity/Entity;Lnet/minecraft/world/item/ItemInstance;)Ljava/util/List;", + at = @At("RETURN")) + private static void onGetDropsWithEntity( + BlockState state, + ServerLevel world, + BlockPos pos, + BlockEntity blockEntity, + Entity entity, + ItemInstance tool, + CallbackInfoReturnable> cir) { + injectDataToDrops(blockEntity, cir.getReturnValue()); + } + + private static void injectDataToDrops(BlockEntity blockEntity, List drops) { + if (blockEntity == null || drops == null || drops.isEmpty()) return; + + for (ItemStack drop : drops) { + // Only enrich the drop that is actually the block itself. + if (drop.getItem() instanceof BlockItem) { + if (blockEntity instanceof IShulkerUUIDProvider provider) { + UUID uuid = provider.getShulkerUUID(); + if (uuid != null) drop.set(ChestSeparatorsComponents.SHULKER_UUID.get(), uuid.toString()); + } + + if (blockEntity instanceof IWhitelistProvider provider) { + // Standard Chests/Barrels keep their filters in world NBT only, not on the dropped item. + boolean isStandardChest = + blockEntity instanceof ChestBlockEntity || blockEntity instanceof BarrelBlockEntity; + + if (!isStandardChest) { + Map whitelists = provider.getWhitelists(); + if (whitelists != null && !whitelists.isEmpty()) { + drop.set(ChestSeparatorsComponents.SLOT_WHITELISTS.get(), new HashMap<>(whitelists)); + } + } + } + } + } + } +} diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/BlockEntityComponentMixin.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/BlockEntityComponentMixin.java new file mode 100644 index 0000000..fe1baee --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/BlockEntityComponentMixin.java @@ -0,0 +1,67 @@ +package io.github.marcsanzdev.chestseparators.mixin; + +import io.github.marcsanzdev.chestseparators.access.IShulkerUUIDProvider; +import io.github.marcsanzdev.chestseparators.access.IWhitelistProvider; +import io.github.marcsanzdev.chestseparators.data.SlotWhitelist; +import io.github.marcsanzdev.chestseparators.registry.ChestSeparatorsComponents; +import java.util.Map; +import java.util.UUID; +import net.minecraft.core.component.DataComponentGetter; +import net.minecraft.core.component.DataComponentMap; +import net.minecraft.world.level.block.entity.BlockEntity; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +/** + * Transfers mod data between placed BlockEntities and dropped ItemStacks via Minecraft's Data Component + * system, so a container's whitelist (and a Shulker's UUID) survives being broken and re-placed. + * + *

    + *
  • {@code collectImplicitComponents} — copies whitelist/UUID data into the dropped ItemStack's components.
  • + *
  • {@code applyImplicitComponents} — restores that data back into the BlockEntity when placed.
  • + *
+ * + * NBT world-save persistence is handled separately by {@link LootableContainerBlockEntityMixin}. + */ +@Mixin(BlockEntity.class) +public abstract class BlockEntityComponentMixin { + + @Inject(method = "collectImplicitComponents", at = @At("TAIL")) + protected void onCollectImplicitComponents(DataComponentMap.Builder builder, CallbackInfo ci) { + if ((Object) this instanceof IShulkerUUIDProvider shulkerProvider) { + UUID uuid = shulkerProvider.getShulkerUUID(); + if (uuid != null) { + builder.set(ChestSeparatorsComponents.SHULKER_UUID.get(), uuid.toString()); + } + } + + if ((Object) this instanceof IWhitelistProvider whitelistProvider) { + Map map = whitelistProvider.getWhitelists(); + if (map != null && !map.isEmpty()) { + builder.set(ChestSeparatorsComponents.SLOT_WHITELISTS.get(), map); + } + } + } + + @Inject(method = "applyImplicitComponents", at = @At("TAIL")) + protected void onApplyImplicitComponents(DataComponentGetter components, CallbackInfo ci) { + if ((Object) this instanceof IShulkerUUIDProvider shulkerProvider) { + String uuidStr = components.get(ChestSeparatorsComponents.SHULKER_UUID.get()); + if (uuidStr != null && !uuidStr.isEmpty()) { + try { + shulkerProvider.setShulkerUUID(UUID.fromString(uuidStr)); + } catch (IllegalArgumentException ignored) { + } + } + } + + if ((Object) this instanceof IWhitelistProvider whitelistProvider) { + Map map = components.get(ChestSeparatorsComponents.SLOT_WHITELISTS.get()); + if (map != null && !map.isEmpty()) { + whitelistProvider.setWhitelists(map); + } + } + } +} diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/BlockEntityMixin.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/BlockEntityMixin.java new file mode 100644 index 0000000..c4dec4a --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/BlockEntityMixin.java @@ -0,0 +1,22 @@ +package io.github.marcsanzdev.chestseparators.mixin; + +import io.github.marcsanzdev.chestseparators.access.IWhitelistProvider; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.storage.ValueOutput; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +// BlockEntityComponentMixin already handles the component copy. This mixin only strips the mod's NBT key +// from the tag written when an item is created from a block, which has no component equivalent. +@Mixin(BlockEntity.class) +public abstract class BlockEntityMixin { + + @Inject(method = "removeComponentsFromTag", at = @At("TAIL")) + private void onRemoveComponentsFromTag(ValueOutput view, CallbackInfo ci) { + if ((Object) this instanceof IWhitelistProvider) { + view.discard("ChestSeparatorsWhitelists"); + } + } +} diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/ChestBoatEntityMixin.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/ChestBoatEntityMixin.java new file mode 100644 index 0000000..e029273 --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/ChestBoatEntityMixin.java @@ -0,0 +1,28 @@ +package io.github.marcsanzdev.chestseparators.mixin; + +import io.github.marcsanzdev.chestseparators.access.IWhitelistProvider; +import io.github.marcsanzdev.chestseparators.data.SlotWhitelist; +import java.util.HashMap; +import java.util.Map; +import net.minecraft.world.entity.vehicle.boat.ChestBoat; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Unique; + +// Adds IWhitelistProvider to chest boats. Hoppers cannot insert into them, so the filter is client-local +// only (no server persistence) — same model as the client-side entity config file. +@Mixin(ChestBoat.class) +public abstract class ChestBoatEntityMixin implements IWhitelistProvider { + + @Unique + private Map chestSeparatorsWhitelists = new HashMap<>(); + + @Override + public Map getWhitelists() { + return this.chestSeparatorsWhitelists; + } + + @Override + public void setWhitelists(Map whitelists) { + this.chestSeparatorsWhitelists = new HashMap<>(whitelists); + } +} diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/DoubleInventoryMixin.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/DoubleInventoryMixin.java new file mode 100644 index 0000000..5b576ad --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/DoubleInventoryMixin.java @@ -0,0 +1,64 @@ +package io.github.marcsanzdev.chestseparators.mixin; + +import io.github.marcsanzdev.chestseparators.access.IWhitelistProvider; +import io.github.marcsanzdev.chestseparators.data.SlotWhitelist; +import java.util.HashMap; +import java.util.Map; +import net.minecraft.world.CompoundContainer; +import net.minecraft.world.Container; +import org.spongepowered.asm.mixin.Final; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; + +/** + * Exposes a unified whitelist across both halves of a double chest ({@link CompoundContainer}), mapping + * the 54-slot GUI view onto the two physical 27-slot block inventories. + */ +@Mixin(CompoundContainer.class) +public abstract class DoubleInventoryMixin implements IWhitelistProvider { + + @Shadow + @Final + private Container container1; + + @Shadow + @Final + private Container container2; + + @Override + public Map getWhitelists() { + Map combined = new HashMap<>(); + + // 1. Fetch data from the primary half (slots 0-26). + if (this.container1 instanceof IWhitelistProvider p1 && p1.getWhitelists() != null) { + combined.putAll(p1.getWhitelists()); + } + + // 2. Fetch data from the secondary half and shift the visual index up by 27 (slots 27-53). + if (this.container2 instanceof IWhitelistProvider p2 && p2.getWhitelists() != null) { + for (Map.Entry entry : p2.getWhitelists().entrySet()) { + combined.put(entry.getKey() + 27, entry.getValue()); + } + } + return combined; + } + + @Override + public void setWhitelists(Map whitelists) { + Map firstMap = new HashMap<>(); + Map secondMap = new HashMap<>(); + + // Split the unified 54-slot GUI map into two distinct 27-slot physical block maps. + for (Map.Entry entry : whitelists.entrySet()) { + int slot = entry.getKey(); + if (slot < 27) { + firstMap.put(slot, entry.getValue()); + } else { + secondMap.put(slot - 27, entry.getValue()); + } + } + + if (this.container1 instanceof IWhitelistProvider p1) p1.setWhitelists(firstMap); + if (this.container2 instanceof IWhitelistProvider p2) p2.setWhitelists(secondMap); + } +} diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/HopperBlockEntityMixin.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/HopperBlockEntityMixin.java new file mode 100644 index 0000000..7936abe --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/HopperBlockEntityMixin.java @@ -0,0 +1,51 @@ +package io.github.marcsanzdev.chestseparators.mixin; + +import io.github.marcsanzdev.chestseparators.access.IWhitelistProvider; +import io.github.marcsanzdev.chestseparators.data.SlotWhitelist; +import io.github.marcsanzdev.chestseparators.util.FilterPriority; +import java.util.Map; +import net.minecraft.core.Direction; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.world.Container; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.block.entity.HopperBlockEntity; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +/** + * Enforces the Hopper insertion rule on all containers that implement {@link IWhitelistProvider}. When + * the Hopper rule is enabled for a slot, only whitelisted items may be deposited by automation; when + * disabled, the slot accepts any item as if unfiltered. + */ +@Mixin(HopperBlockEntity.class) +public abstract class HopperBlockEntityMixin { + + @Inject(method = "canPlaceItemInContainer", at = @At("HEAD"), cancellable = true) + private static void onCanInsert( + Container inventory, ItemStack stack, int slot, Direction side, CallbackInfoReturnable cir) { + if (inventory instanceof IWhitelistProvider provider) { + Map whitelists = provider.getWhitelists(); + + if (whitelists != null && whitelists.containsKey(slot)) { + SlotWhitelist wl = whitelists.get(slot); + + // Hopper rule ON: enforce the whitelist. Rule OFF: let vanilla decide. + if (wl.allowHopper()) { + String itemId = BuiltInRegistries.ITEM.getKey(stack.getItem()).toString(); + if (!wl.allowedItems().contains(itemId)) { + cir.setReturnValue(false); + return; + } + } + } + } + + // Same ordering rule as the shift-click quick-move: an item that has a dedicated filter slot + // fills that slot first, so ordinary slots decline it while the dedicated one still has room. + if (FilterPriority.shouldDefer(inventory, slot, stack)) { + cir.setReturnValue(false); + } + } +} diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/InventoryMenuRefillMixin.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/InventoryMenuRefillMixin.java new file mode 100644 index 0000000..d257e1c --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/InventoryMenuRefillMixin.java @@ -0,0 +1,43 @@ +package io.github.marcsanzdev.chestseparators.mixin; + +import io.github.marcsanzdev.chestseparators.ChestSeparatorsState; +import io.github.marcsanzdev.chestseparators.data.SlotWhitelist; +import io.github.marcsanzdev.chestseparators.util.InventorySlotRefill; +import java.util.Map; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.inventory.ContainerInput; +import net.minecraft.world.inventory.InventoryMenu; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +/** + * Reconciles filtered MAIN inventory slots after each completed player-inventory interaction. + * + *

The old origin-tracking hook only reacted when a stack was picked up from a filtered slot + * and subsequently placed into an unfiltered MAIN slot. Shift-clicking, hotbar swaps, quick + * crafting and rearranging stacks that were already in ordinary slots could bypass that hook, + * leaving dedicated slots partially filled until an unrelated click triggered the refill. + * + *

This is deliberately limited to InventoryMenu. Open-container Push uses several synthetic + * clicks on a different menu and has its own pre-deposit refill; running after each of those + * clicks would interrupt the cursor transfer. InventorySlotRefill never sources the hotbar, + * so intentionally placed hotbar items remain untouched. + */ +@Mixin(AbstractContainerMenu.class) +public abstract class InventoryMenuRefillMixin { + @Inject(method = "clicked", at = @At("RETURN")) + private void chestseparators$reconcilePlayerInventoryAfterClick( + int slotIndex, int button, ContainerInput actionType, Player player, CallbackInfo ci) { + if (player == null || !((Object) this instanceof InventoryMenu)) return; + + Map filters = ChestSeparatorsState.INVENTORY_FILTERS.get(player.getUUID()); + if (filters == null || filters.isEmpty()) return; + + if (InventorySlotRefill.refill(player.getInventory(), filters) && !player.level().isClientSide()) { + ((AbstractContainerMenu) (Object) this).broadcastChanges(); + } + } +} diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/ItemEntityPickupContextMixin.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/ItemEntityPickupContextMixin.java new file mode 100644 index 0000000..1796c8d --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/ItemEntityPickupContextMixin.java @@ -0,0 +1,23 @@ +package io.github.marcsanzdev.chestseparators.mixin; + +import io.github.marcsanzdev.chestseparators.util.InventoryPickupContext; +import net.minecraft.world.entity.item.ItemEntity; +import net.minecraft.world.entity.player.Player; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +/** Ground-pickup-only scope for the inventory's automatic filter slot selection. */ +@Mixin(ItemEntity.class) +public abstract class ItemEntityPickupContextMixin { + @Inject(method = "playerTouch", at = @At("HEAD")) + private void chestseparators$beginGroundPickup(Player player, CallbackInfo ci) { + InventoryPickupContext.begin(player.getUUID()); + } + + @Inject(method = "playerTouch", at = @At("RETURN")) + private void chestseparators$finishGroundPickup(Player player, CallbackInfo ci) { + InventoryPickupContext.end(); + } +} diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/LootableContainerBlockEntityMixin.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/LootableContainerBlockEntityMixin.java new file mode 100644 index 0000000..0acaa89 --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/LootableContainerBlockEntityMixin.java @@ -0,0 +1,91 @@ +package io.github.marcsanzdev.chestseparators.mixin; + +import dev.architectury.networking.NetworkManager; +import io.github.marcsanzdev.chestseparators.access.IWhitelistProvider; +import io.github.marcsanzdev.chestseparators.data.SlotWhitelist; +import io.github.marcsanzdev.chestseparators.network.WhitelistS2CPayload; +import java.util.HashMap; +import java.util.Map; +import net.minecraft.core.BlockPos; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.world.level.block.entity.RandomizableContainerBlockEntity; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.storage.ValueInput; +import net.minecraft.world.level.storage.ValueOutput; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Unique; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +/** + * Implements {@link IWhitelistProvider} on all standard lootable containers (Chests, Barrels, Shulker + * Boxes — every subclass of {@code RandomizableContainerBlockEntity}) and owns the canonical NBT + * persistence for whitelist data under the "ChestSeparatorsWhitelists" key. + * + *

On open it pushes the saved whitelist to the opener (S2C) so the editor shows the server-authoritative + * state immediately, without a {@code WhitelistRequestPayload} round-trip. The S2C payload type is a + * dedicated one ({@link WhitelistS2CPayload}) registered by the client receiver at client init — NeoForge + * forbids a single payload id for both directions, so the C2S save and this S2C push use different ids. + */ +@Mixin(RandomizableContainerBlockEntity.class) +public abstract class LootableContainerBlockEntityMixin extends BlockEntity implements IWhitelistProvider { + + @Unique + private Map chestSeparatorsWhitelists = new HashMap<>(); + + public LootableContainerBlockEntityMixin(BlockEntityType type, BlockPos pos, BlockState state) { + super(type, pos, state); + } + + @Override + public Map getWhitelists() { + return this.chestSeparatorsWhitelists; + } + + @Override + public void setWhitelists(Map whitelists) { + this.chestSeparatorsWhitelists = new HashMap<>(whitelists); + this.setChanged(); + } + + /** + * Pushes the saved whitelist to the opening player whenever the container GUI is created, so the client + * shows the server-authoritative filters immediately (and co-viewers in multiplayer stay in sync). + */ + @Inject(method = "createMenu", at = @At("RETURN")) + private void chestseparators$onOpenMenu( + int syncId, Inventory playerInventory, Player player, CallbackInfoReturnable cir) { + if (cir.getReturnValue() != null + && this.getLevel() != null + && !this.getLevel().isClientSide() + && player instanceof ServerPlayer serverPlayer + && NetworkManager.canPlayerReceive(serverPlayer, WhitelistS2CPayload.TYPE)) { + NetworkManager.sendToPlayer( + serverPlayer, new WhitelistS2CPayload(this.getBlockPos(), this.chestSeparatorsWhitelists)); + } + } + + // --- NBT world-save persistence (Codec-based; one shared on-disk shape with the data component) --- + + @Override + protected void saveAdditional(ValueOutput out) { + super.saveAdditional(out); + if (!this.chestSeparatorsWhitelists.isEmpty()) { + out.store("ChestSeparatorsWhitelists", SlotWhitelist.MAP_CODEC, this.chestSeparatorsWhitelists); + } + } + + @Override + protected void loadAdditional(ValueInput in) { + super.loadAdditional(in); + this.chestSeparatorsWhitelists.clear(); + in.read("ChestSeparatorsWhitelists", SlotWhitelist.MAP_CODEC) + .ifPresent(this.chestSeparatorsWhitelists::putAll); + } +} diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/PlayerInventoryFilterMixin.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/PlayerInventoryFilterMixin.java new file mode 100644 index 0000000..9b4d9df --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/PlayerInventoryFilterMixin.java @@ -0,0 +1,105 @@ +package io.github.marcsanzdev.chestseparators.mixin; + +import io.github.marcsanzdev.chestseparators.ChestSeparatorsState; +import io.github.marcsanzdev.chestseparators.data.SlotWhitelist; +import io.github.marcsanzdev.chestseparators.util.FilterPriority; +import io.github.marcsanzdev.chestseparators.util.InventoryPickupContext; +import io.github.marcsanzdev.chestseparators.util.InventorySlotRefill; +import java.util.Map; +import net.minecraft.core.NonNullList; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import org.spongepowered.asm.mixin.Final; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.Unique; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +/** + * Enforces the player-inventory "Pick Up" rule: a filtered inventory slot only accepts its item when + * items are picked up from the ground. Other calls to Inventory.add or returning the cursor stack + * should not reroute deliberately placed hotbar items. Non-matching items skip reserved slots and + * matching items prefer their reserved slot during pickups. Filters are synced from the client into + * {@link ChestSeparatorsState#INVENTORY_FILTERS}; with none present this is a no-op. + */ +@Mixin(Inventory.class) +public abstract class PlayerInventoryFilterMixin { + + @Shadow + @Final + public Player player; + + @Shadow + public abstract NonNullList getNonEquipmentItems(); + + // The stack currently being auto-inserted, so the empty-slot search can reserve filtered slots. + @Unique + private static ItemStack chestseparators$insertingStack = null; + + @Inject(method = "add(Lnet/minecraft/world/item/ItemStack;)Z", at = @At("HEAD")) + private void chestseparators$beginInsert(ItemStack stack, CallbackInfoReturnable cir) { + // Inventory.add is also used by inventory UI actions and other mods. Only ground-pickup + // insertion should prefer empty dedicated slots; deliberate hotbar moves remain vanilla. + chestseparators$insertingStack = InventoryPickupContext.isGroundPickup(player.getUUID()) ? stack : null; + } + + @Inject(method = "add(Lnet/minecraft/world/item/ItemStack;)Z", at = @At("RETURN")) + private void chestseparators$endInsert(ItemStack stack, CallbackInfoReturnable cir) { + if (!player.level().isClientSide() && InventoryPickupContext.isGroundPickup(player.getUUID())) { + InventorySlotRefill.refill((Inventory) (Object) this, + ChestSeparatorsState.INVENTORY_FILTERS.get(player.getUUID())); + } + chestseparators$insertingStack = null; + } + + @Inject(method = "getFreeSlot", at = @At("HEAD"), cancellable = true) + private void chestseparators$reserveFilteredSlots(CallbackInfoReturnable cir) { + ItemStack stack = chestseparators$insertingStack; + if (stack == null || stack.isEmpty()) return; + + Map filters = ChestSeparatorsState.INVENTORY_FILTERS.get(player.getUUID()); + if (filters == null || filters.isEmpty()) return; + + String itemId = BuiltInRegistries.ITEM.getKey(stack.getItem()).toString(); + NonNullList main = getNonEquipmentItems(); + + // Prefer an empty slot whose filter matches this item, ranked by the filter's own order (same + // priority the shift/hopper/deposit paths use); ties keep the lowest index. + int bestSlot = -1; + int bestPreference = Integer.MAX_VALUE; + for (int i = 0; i < main.size(); i++) { + if (!main.get(i).isEmpty()) continue; + SlotWhitelist wl = filters.get(i); + if (wl == null || !isSlotActive(wl) || !wl.allowedItems().contains(itemId)) continue; + int preference = FilterPriority.slotPreference(filters, i, itemId); + if (preference < bestPreference) { + bestPreference = preference; + bestSlot = i; + } + } + if (bestSlot >= 0) { + cir.setReturnValue(bestSlot); + return; + } + // Otherwise the first empty slot not reserved by a non-matching filter. + for (int i = 0; i < main.size(); i++) { + if (!main.get(i).isEmpty()) continue; + SlotWhitelist wl = filters.get(i); + boolean reservedForOther = wl != null && isSlotActive(wl) && !wl.allowedItems().contains(itemId); + if (!reservedForOther) { + cir.setReturnValue(i); + return; + } + } + cir.setReturnValue(-1); + } + + @Unique + private static boolean isSlotActive(SlotWhitelist wl) { + return wl.allowHopper() || wl.allowManual() || wl.allowShift(); + } +} diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/PlayerScreenHandlerFallbackMixin.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/PlayerScreenHandlerFallbackMixin.java new file mode 100644 index 0000000..6adb181 --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/PlayerScreenHandlerFallbackMixin.java @@ -0,0 +1,181 @@ +package io.github.marcsanzdev.chestseparators.mixin; + +import io.github.marcsanzdev.chestseparators.ChestSeparatorsState; +import io.github.marcsanzdev.chestseparators.data.SlotWhitelist; +import java.util.ArrayList; +import java.util.Comparator; +import java.util.List; +import java.util.Map; +import net.minecraft.core.component.DataComponents; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.entity.player.Inventory; +import io.github.marcsanzdev.chestseparators.util.InventorySlotRefill; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.inventory.InventoryMenu; +import net.minecraft.world.inventory.Slot; +import net.minecraft.world.item.ItemStack; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Unique; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +/** + * When shift-clicking armor whose target armor slot is blocked by a Shift filter, vanilla's + * {@code quickMoveStack} returns without a fallback — the item stays put. This adds a fallback that + * inserts the armor into the main inventory or hotbar instead (like shift-clicking any non-armor item). + * + *

InventoryMenu slot layout: 0=craft output, 1-4=craft grid, 5-8=armor, 9-35=main, 36-44=hotbar, + * 45=offhand. {@code moveItemStackTo} is reached via {@link AbstractContainerMenuAccessor}. + */ +@Mixin(InventoryMenu.class) +public abstract class PlayerScreenHandlerFallbackMixin { + + /** + * Vanilla InventoryMenu.quickMoveStack sends main-inventory items straight to the hotbar, + * never consulting dedicated MAIN filters. Give matching filtered main slots first refusal. + * Run on BOTH logical sides to keep predicted clicks aligned with the server. + */ + @Inject(method = "quickMoveStack", at = @At("HEAD"), cancellable = true) + private void chestseparators$preferFilteredMainOnShift( + Player player, int slotIndex, CallbackInfoReturnable cir) { + if (player == null) return; + AbstractContainerMenu menu = (AbstractContainerMenu) (Object) this; + if (slotIndex < 0 || slotIndex >= menu.slots.size()) return; + Slot sourceSlot = menu.slots.get(slotIndex); + if (!(sourceSlot.container instanceof Inventory)) return; + int raw = sourceSlot.getContainerSlot(); + if (raw < 0 || raw >= Inventory.INVENTORY_SIZE || !sourceSlot.hasItem()) return; + + Map filters = ChestSeparatorsState.INVENTORY_FILTERS.get(player.getUUID()); + if (filters == null || filters.isEmpty()) return; + if (raw < 9) { + // Manual placing INTO the hotbar stays vanilla. An explicit shift-click OUT of it + // should, however, offer the stack to matching MAIN filter slots before vanilla + // can merge it into an unrelated main slot. + chestseparators$shiftHotbarIntoFilteredMain(player, menu, sourceSlot, filters, cir); + return; + } + if (filters.containsKey(raw)) return; + ItemStack source = sourceSlot.getItem(); + String id = BuiltInRegistries.ITEM.getKey(source.getItem()).toString(); + boolean dedicated = filters.entrySet().stream().anyMatch(e -> + e.getKey() >= 9 && e.getKey() < Inventory.INVENTORY_SIZE + && e.getValue().allowedItems().contains(id)); + if (!dedicated) return; + + ItemStack original = source.copy(); + boolean changed = InventorySlotRefill.refill(player.getInventory(), filters); + if (!changed) return; + if (!player.level().isClientSide()) menu.broadcastChanges(); + // If all items moved into dedicated main slots, suppress vanilla's hotbar fallback. + // Otherwise vanilla can shift-move the surplus in the source slot as usual. + if (player.getInventory().getItem(raw).isEmpty()) cir.setReturnValue(original); + } + + /** + * InventoryMenu's vanilla hotbar -> main quick-move merges into the first identical main + * stack, even when a later main slot is dedicated to that item. Intercept ONLY an explicit + * shift-click from the hotbar, using vanilla's own moveItemStackTo for each destination. + * + * Filling matching home stacks first makes [1 in home + 64 in hotbar] become + * [64 in home + 1 in hotbar]. The leftover stays in the hotbar for this click, rather + * than silently going into an unrelated main slot. If no home has room, vanilla proceeds. + * This runs on BOTH logical sides for identical client prediction and server results. + */ + @Unique + private void chestseparators$shiftHotbarIntoFilteredMain( + Player player, AbstractContainerMenu menu, Slot sourceSlot, + Map filters, CallbackInfoReturnable cir) { + ItemStack stack = sourceSlot.getItem(); + String itemId = BuiltInRegistries.ITEM.getKey(stack.getItem()).toString(); + + List homeSlots = new ArrayList<>(); + for (int menuIndex = 0; menuIndex < menu.slots.size(); menuIndex++) { + Slot candidate = menu.slots.get(menuIndex); + if (!(candidate.container instanceof Inventory)) continue; + int rawTarget = candidate.getContainerSlot(); + if (rawTarget < 9 || rawTarget >= Inventory.INVENTORY_SIZE) continue; + SlotWhitelist filter = filters.get(rawTarget); + if (filter != null && filter.allowedItems().contains(itemId)) homeSlots.add(menuIndex); + } + if (homeSlots.isEmpty()) return; + // Stable filter priority and raw-slot ordering; existing matching stacks are filled first. + homeSlots.sort(Comparator.comparingInt((Integer i) -> + io.github.marcsanzdev.chestseparators.util.FilterPriority.slotPreference( + filters, menu.slots.get(i).getContainerSlot(), itemId)) + .thenComparingInt(i -> menu.slots.get(i).getContainerSlot())); + AbstractContainerMenuAccessor mover = (AbstractContainerMenuAccessor) (Object) this; + ItemStack original = stack.copy(); + boolean moved = false; + for (int pass = 0; pass < 2 && !stack.isEmpty(); pass++) { + for (int index : homeSlots) { + if (stack.isEmpty()) break; + Slot home = menu.slots.get(index); + ItemStack existing = home.getItem(); + if (pass == 0) { + if (existing.isEmpty() || !ItemStack.isSameItemSameComponents(existing, stack)) continue; + if (existing.getCount() >= Math.min(existing.getMaxStackSize(), home.getMaxStackSize(stack))) continue; + } else if (!existing.isEmpty()) { + continue; + } + moved |= mover.chestseparators$moveItemStackTo(stack, index, index + 1, false); + } + } + if (!moved) return; + if (stack.isEmpty()) sourceSlot.set(ItemStack.EMPTY); + sourceSlot.setChanged(); + if (!player.level().isClientSide()) menu.broadcastChanges(); + // A successful partial move must not fall through into vanilla's unrelated main slots. + cir.setReturnValue(original); + } + + @Inject(method = "quickMoveStack", at = @At("RETURN"), cancellable = true) + private void chestseparators$armorFallback(Player player, int slotIndex, CallbackInfoReturnable cir) { + if (!cir.getReturnValue().isEmpty()) return; + + AbstractContainerMenu self = (AbstractContainerMenu) (Object) this; + if (slotIndex < 0 || slotIndex >= self.slots.size()) return; + Slot slot = self.slots.get(slotIndex); + ItemStack slotStack = slot.getItem(); + if (slotStack.isEmpty()) return; + + var equippable = slotStack.get(DataComponents.EQUIPPABLE); + if (equippable == null) return; + + int rawIndex = + switch (equippable.slot()) { + case FEET -> 36; + case LEGS -> 37; + case CHEST -> 38; + case HEAD -> 39; + default -> -1; + }; + if (rawIndex == -1) return; + + Map filters = ChestSeparatorsState.INVENTORY_FILTERS.get(player.getUUID()); + if (filters == null) return; + SlotWhitelist wl = filters.get(rawIndex); + if (wl == null || !wl.allowShift()) return; + String itemId = BuiltInRegistries.ITEM.getKey(slotStack.getItem()).toString(); + if (wl.allowedItems().contains(itemId)) return; + + ItemStack copy = slotStack.copy(); + boolean fromHotbar = slotIndex >= 36 && slotIndex < 45; + AbstractContainerMenuAccessor acc = (AbstractContainerMenuAccessor) (Object) this; + if (fromHotbar) { + acc.chestseparators$moveItemStackTo(slotStack, 9, 36, false); + } else { + if (!acc.chestseparators$moveItemStackTo(slotStack, 36, 45, false)) { + acc.chestseparators$moveItemStackTo(slotStack, 9, 36, false); + } + } + + if (slotStack.getCount() != copy.getCount()) { + if (slotStack.isEmpty()) slot.set(ItemStack.EMPTY); + slot.setChanged(); + cir.setReturnValue(copy); + } + } +} diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/ScreenHandlerClickMixin.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/ScreenHandlerClickMixin.java new file mode 100644 index 0000000..b9389c0 --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/ScreenHandlerClickMixin.java @@ -0,0 +1,33 @@ +package io.github.marcsanzdev.chestseparators.mixin; + +import io.github.marcsanzdev.chestseparators.util.ClickTracker; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.item.ItemStack; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +/** + * Sets the {@link ClickTracker#IS_SHIFT_CLICK} thread-local for the duration of {@code moveItemStackTo}, + * the internal method vanilla calls during shift-click quick-move, so {@link SlotWhitelistMixin} can tell + * shift-clicks from direct cursor insertions (both arrive at {@code Slot#mayPlace}). Also publishes the + * destination range so the filter-priority rule only defers to slots this insertion can reach. + */ +@Mixin(AbstractContainerMenu.class) +public abstract class ScreenHandlerClickMixin { + + @Inject(method = "moveItemStackTo(Lnet/minecraft/world/item/ItemStack;IIZ)Z", at = @At("HEAD")) + protected void onInsertItemBegin( + ItemStack stack, int startIndex, int endIndex, boolean fromLast, CallbackInfoReturnable cir) { + ClickTracker.IS_SHIFT_CLICK.set(true); + ClickTracker.INSERT_RANGE.set(new int[] {startIndex, endIndex}); + } + + @Inject(method = "moveItemStackTo(Lnet/minecraft/world/item/ItemStack;IIZ)Z", at = @At("RETURN")) + protected void onInsertItemEnd( + ItemStack stack, int startIndex, int endIndex, boolean fromLast, CallbackInfoReturnable cir) { + ClickTracker.IS_SHIFT_CLICK.set(false); + ClickTracker.INSERT_RANGE.remove(); + } +} diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/ScreenHandlerSwapFilterMixin.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/ScreenHandlerSwapFilterMixin.java new file mode 100644 index 0000000..529d37e --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/ScreenHandlerSwapFilterMixin.java @@ -0,0 +1,137 @@ +package io.github.marcsanzdev.chestseparators.mixin; + +import io.github.marcsanzdev.chestseparators.ChestSeparatorsState; +import io.github.marcsanzdev.chestseparators.data.SlotWhitelist; +import io.github.marcsanzdev.chestseparators.util.FilterPriority; +import java.util.Map; +import net.minecraft.core.NonNullList; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.inventory.ContainerInput; +import net.minecraft.world.inventory.Slot; +import net.minecraft.world.item.ItemStack; +import org.spongepowered.asm.mixin.Final; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.Unique; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +/** + * Enforces inventory filters on {@code SWAP} clicks (the number/F keys), which bypass {@code mayPlace} + * by swapping items directly. A disallowed destination still blocks the swap. When the ONLY + * obstacle is an item displaced from the hotbar into a filtered MAIN inventory slot, relocate that + * displaced stack to a suitable empty MAIN slot before completing the number-key action. + * The swap target is identified by {@code button}: 0-8 = hotbar raw indices, 40 = offhand. + */ +@Mixin(AbstractContainerMenu.class) +public abstract class ScreenHandlerSwapFilterMixin { + + @Shadow + @Final + public NonNullList slots; + + @Inject(method = "clicked", at = @At("HEAD"), cancellable = true) + private void enforceFilterOnSwap( + int slotIndex, int button, ContainerInput actionType, Player player, CallbackInfo ci) { + if (actionType != ContainerInput.SWAP) return; + if (slotIndex < 0 || slotIndex >= slots.size()) return; + + Map filters = ChestSeparatorsState.INVENTORY_FILTERS.get(player.getUUID()); + if (filters == null || filters.isEmpty()) return; + + Slot sourceSlot = slots.get(slotIndex); + ItemStack sourceItem = sourceSlot.getItem(); // moves INTO the swap-target slot + + // button 0-8 = hotbar raw index; button 40 = offhand raw index. + int targetRawIndex = (button >= 0 && button <= 8) ? button : 40; + ItemStack targetItem = player.getInventory().getItem(targetRawIndex); // moves INTO sourceSlot + + // Can sourceItem enter the swap-target slot? + SlotWhitelist wlTarget = filters.get(targetRawIndex); + if (wlTarget != null && wlTarget.allowShift() && !sourceItem.isEmpty()) { + String id = BuiltInRegistries.ITEM.getKey(sourceItem.getItem()).toString(); + if (!wlTarget.allowedItems().contains(id)) { + ci.cancel(); + return; + } + } + + // Can targetItem enter the source slot (only relevant when it is a player-inventory slot)? + if (sourceSlot.container instanceof Inventory) { + SlotWhitelist wlSource = filters.get(sourceSlot.getContainerSlot()); + if (wlSource != null && wlSource.allowShift() && !targetItem.isEmpty()) { + String id = BuiltInRegistries.ITEM.getKey(targetItem.getItem()).toString(); + if (!wlSource.allowedItems().contains(id)) { + // Only number-key swaps from a filtered MAIN slot get this fallback. + // Offhand/armor/hotbar swaps and swaps without free space keep their old behavior. + if (button >= 0 && button <= 8 && sourceSlot.getContainerSlot() >= 9 + && sourceSlot.getContainerSlot() < Inventory.INVENTORY_SIZE + && !sourceItem.isEmpty() + && chestseparators$relocateDisplacedHotbarStack( + player, sourceSlot, button, sourceItem, targetItem, filters)) { + ci.cancel(); // Our relocation and hotbar move already completed the click. + return; + } + ci.cancel(); + } + } + } + } + + /** + * A normal SWAP would put {@code displaced} into {@code sourceSlot}, violating its filter. + * Instead, move the *entire* displaced stack into an empty, eligible MAIN inventory slot and + * move the selected item into the hotbar. Called on BOTH sides to match client prediction. + * Never consume the item from the cursor or displace items from a third occupied slot. + */ + @Unique + private boolean chestseparators$relocateDisplacedHotbarStack( + Player player, Slot sourceSlot, int hotbarRawIndex, + ItemStack selected, ItemStack displaced, Map filters) { + AbstractContainerMenu menu = (AbstractContainerMenu) (Object) this; + if (!menu.getCarried().isEmpty() || !sourceSlot.mayPickup(player)) return false; + + // Prefer an empty slot that is dedicated to the displaced item. If none exists, + // use an unfiltered empty MAIN slot. Never pollute a slot reserved for another item. + String displacedId = BuiltInRegistries.ITEM.getKey(displaced.getItem()).toString(); + int sourceRawIndex = sourceSlot.getContainerSlot(); + Slot destination = null; + int bestPreference = Integer.MAX_VALUE; + for (Slot candidate : this.slots) { + if (!(candidate.container instanceof Inventory)) continue; + int raw = candidate.getContainerSlot(); + if (raw < 9 || raw >= Inventory.INVENTORY_SIZE || raw == sourceRawIndex + || !candidate.getItem().isEmpty() || !candidate.isActive() + || !candidate.mayPlace(displaced) + || candidate.getMaxStackSize(displaced) < displaced.getCount()) continue; + + SlotWhitelist candidateFilter = filters.get(raw); + if (candidateFilter == null) { + if (destination == null) destination = candidate; + continue; + } + if (!candidateFilter.allowedItems().contains(displacedId)) continue; + int preference = FilterPriority.slotPreference(filters, raw, displacedId); + if (bestPreference == Integer.MAX_VALUE || preference < bestPreference) { + bestPreference = preference; + destination = candidate; + } + } + if (destination == null) return false; + + // All validation precedes mutation: without a valid empty slot the original protected + // swap is simply cancelled and nothing moves. Keep this symmetric on client and server. + sourceSlot.set(ItemStack.EMPTY); + player.getInventory().setItem(hotbarRawIndex, selected.copy()); + destination.set(displaced.copy()); + sourceSlot.setChanged(); + destination.setChanged(); + player.getInventory().setChanged(); + if (!player.level().isClientSide()) menu.broadcastChanges(); + return true; + } +} diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/ScreenHandlerWhitelistMixin.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/ScreenHandlerWhitelistMixin.java new file mode 100644 index 0000000..53b6550 --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/ScreenHandlerWhitelistMixin.java @@ -0,0 +1,70 @@ +package io.github.marcsanzdev.chestseparators.mixin; + +import io.github.marcsanzdev.chestseparators.access.IWhitelistProvider; +import io.github.marcsanzdev.chestseparators.data.SlotWhitelist; +import io.github.marcsanzdev.chestseparators.util.ClickTracker; +import io.github.marcsanzdev.chestseparators.util.FilterPriority; +import java.util.Map; +import net.minecraft.core.NonNullList; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.inventory.Slot; +import net.minecraft.world.item.ItemStack; +import org.spongepowered.asm.mixin.Final; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Redirect; + +/** + * Intercepts the {@code Slot.mayPlace} check inside the {@code AbstractContainerMenu.moveItemStackTo} + * loop (the shift-click quick-move flow). This redirect enforces the Shift rule on each target slot + * independently, complementing {@link SlotWhitelistMixin}, and applies the filter-priority ordering. + */ +@Mixin(AbstractContainerMenu.class) +public abstract class ScreenHandlerWhitelistMixin { + + @Shadow + @Final + public NonNullList slots; + + @Redirect( + method = "moveItemStackTo", + at = + @At( + value = "INVOKE", + target = "Lnet/minecraft/world/inventory/Slot;mayPlace(Lnet/minecraft/world/item/ItemStack;)Z")) + private boolean enforceWhitelistOnShiftClick(Slot slot, ItemStack stack) { + // Respect vanilla constraints first (also triggers SlotWhitelistMixin). + if (!slot.mayPlace(stack)) { + return false; + } + + if (slot.container instanceof IWhitelistProvider provider) { + Map whitelists = provider.getWhitelists(); + int slotIndex = slot.getContainerSlot(); + + if (whitelists != null && whitelists.containsKey(slotIndex)) { + SlotWhitelist whitelist = whitelists.get(slotIndex); + + // Shift rule ON: enforce the item filter. Shift rule OFF: treat as vanilla. + if (whitelist.allowShift()) { + String incomingItemId = + BuiltInRegistries.ITEM.getKey(stack.getItem()).toString(); + if (!whitelist.allowedItems().contains(incomingItemId)) { + return false; + } + } + } + } + + // Ordering rule: while a slot dedicated to this item still has room, ordinary slots decline it + // so vanilla keeps scanning and drops the item into its dedicated slot. + int[] range = ClickTracker.INSERT_RANGE.get(); + if (range != null && FilterPriority.shouldDefer(this.slots, range[0], range[1], slot, stack)) { + return false; + } + + return true; + } +} diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/ServerPlayNetworkHandlerSwapFilterMixin.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/ServerPlayNetworkHandlerSwapFilterMixin.java new file mode 100644 index 0000000..57f4ff9 --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/ServerPlayNetworkHandlerSwapFilterMixin.java @@ -0,0 +1,63 @@ +package io.github.marcsanzdev.chestseparators.mixin; + +import io.github.marcsanzdev.chestseparators.ChestSeparatorsState; +import io.github.marcsanzdev.chestseparators.data.SlotWhitelist; +import java.util.Map; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.network.protocol.game.ServerboundPlayerActionPacket; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.server.network.ServerGamePacketListenerImpl; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.item.ItemStack; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +/** + * Enforces inventory filters on the F-key offhand swap when no screen is open. There the client sends a + * {@code ServerboundPlayerActionPacket} with {@code SWAP_ITEM_WITH_OFFHAND} rather than a slot click, so + * {@link ScreenHandlerSwapFilterMixin} does not intercept it. Both the offhand and the selected hotbar + * slot are checked against any active Shift-rule filter and the swap is cancelled if either side blocks. + */ +@Mixin(ServerGamePacketListenerImpl.class) +public abstract class ServerPlayNetworkHandlerSwapFilterMixin { + + @Shadow + public ServerPlayer player; + + @Inject(method = "handlePlayerAction", at = @At("HEAD"), cancellable = true) + private void enforceFilterOnOffhandSwap(ServerboundPlayerActionPacket packet, CallbackInfo ci) { + if (packet.getAction() != ServerboundPlayerActionPacket.Action.SWAP_ITEM_WITH_OFFHAND) return; + + Map filters = ChestSeparatorsState.INVENTORY_FILTERS.get(player.getUUID()); + if (filters == null || filters.isEmpty()) return; + + Inventory inv = player.getInventory(); + int hotbarIndex = inv.getSelectedSlot(); + ItemStack mainHandItem = inv.getItem(hotbarIndex); // moves INTO the offhand slot + ItemStack offhandItem = inv.getItem(40); // moves INTO the selected hotbar slot + + // Offhand filter (raw index 40): does the main-hand item pass the Shift rule? + SlotWhitelist offhandFilter = filters.get(40); + if (offhandFilter != null && offhandFilter.allowShift() && !mainHandItem.isEmpty()) { + String id = BuiltInRegistries.ITEM.getKey(mainHandItem.getItem()).toString(); + if (!offhandFilter.allowedItems().contains(id)) { + ci.cancel(); + player.containerMenu.sendAllDataToRemote(); + return; + } + } + + // Selected hotbar slot filter: does the offhand item pass the Shift rule? + SlotWhitelist hotbarFilter = filters.get(hotbarIndex); + if (hotbarFilter != null && hotbarFilter.allowShift() && !offhandItem.isEmpty()) { + String id = BuiltInRegistries.ITEM.getKey(offhandItem.getItem()).toString(); + if (!hotbarFilter.allowedItems().contains(id)) { + ci.cancel(); + player.containerMenu.sendAllDataToRemote(); + } + } + } +} diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/ShulkerBoxBlockEntityMixin.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/ShulkerBoxBlockEntityMixin.java new file mode 100644 index 0000000..23638bd --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/ShulkerBoxBlockEntityMixin.java @@ -0,0 +1,86 @@ +package io.github.marcsanzdev.chestseparators.mixin; + +import dev.architectury.networking.NetworkManager; +import io.github.marcsanzdev.chestseparators.access.IShulkerUUIDProvider; +import io.github.marcsanzdev.chestseparators.network.ShulkerUUIDPayload; +import java.util.UUID; +import net.minecraft.core.BlockPos; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.entity.ContainerUser; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.world.level.block.entity.ShulkerBoxBlockEntity; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.storage.ValueInput; +import net.minecraft.world.level.storage.ValueOutput; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Unique; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +/** + * Injects a persistent mod UUID into each Shulker Box block entity: generated lazily on the server and + * persisted to world NBT. On open it transmits that UUID to the opener ({@link ShulkerUUIDPayload} S2C) + * so the client can key the shulker's local filter config; a capability check keeps vanilla-only clients + * from receiving an unknown packet. + */ +@Mixin(ShulkerBoxBlockEntity.class) +public abstract class ShulkerBoxBlockEntityMixin extends BlockEntity implements IShulkerUUIDProvider { + + @Unique + private UUID chestSeparatorsUUID; + + public ShulkerBoxBlockEntityMixin(BlockEntityType type, BlockPos pos, BlockState state) { + super(type, pos, state); + } + + @Override + public UUID getShulkerUUID() { + if (this.chestSeparatorsUUID == null) { + // On the client, never generate a UUID — wait for the authoritative S2C payload. + if (this.level != null && this.level.isClientSide()) { + return null; + } + this.chestSeparatorsUUID = UUID.randomUUID(); + this.setChanged(); + } + return this.chestSeparatorsUUID; + } + + @Override + public void setShulkerUUID(UUID uuid) { + this.chestSeparatorsUUID = uuid; + this.setChanged(); + } + + /** Transmits the Shulker UUID to the opening player so the editor can load its UUID-keyed local config. */ + @Inject(method = "startOpen", at = @At("HEAD")) + private void chestseparators$onShulkerOpened(ContainerUser user, CallbackInfo ci) { + if (this.getLevel() != null + && !this.getLevel().isClientSide() + && user instanceof ServerPlayer serverPlayer + && NetworkManager.canPlayerReceive(serverPlayer, ShulkerUUIDPayload.TYPE)) { + NetworkManager.sendToPlayer(serverPlayer, new ShulkerUUIDPayload(this.getShulkerUUID())); + } + } + + @Inject(method = "loadAdditional", at = @At("TAIL")) + protected void onLoadAdditional(ValueInput view, CallbackInfo ci) { + view.getString("ChestSeparatorsUUID").ifPresent(uuidString -> { + if (!uuidString.isEmpty()) { + try { + this.chestSeparatorsUUID = UUID.fromString(uuidString); + } catch (IllegalArgumentException ignored) { + } + } + }); + } + + @Inject(method = "saveAdditional", at = @At("TAIL")) + protected void onSaveAdditional(ValueOutput view, CallbackInfo ci) { + if (this.chestSeparatorsUUID != null) { + view.putString("ChestSeparatorsUUID", this.chestSeparatorsUUID.toString()); + } + } +} diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/ShulkerBoxBlockMixin.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/ShulkerBoxBlockMixin.java new file mode 100644 index 0000000..eef0ee4 --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/ShulkerBoxBlockMixin.java @@ -0,0 +1,59 @@ +package io.github.marcsanzdev.chestseparators.mixin; + +import io.github.marcsanzdev.chestseparators.access.IShulkerUUIDProvider; +import io.github.marcsanzdev.chestseparators.access.IWhitelistProvider; +import net.minecraft.core.BlockPos; +import net.minecraft.world.entity.item.ItemEntity; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.ShulkerBoxBlock; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.ShulkerBoxBlockEntity; +import net.minecraft.world.level.block.state.BlockState; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +/** + * Forces an empty Shulker Box to drop as an item in Creative mode when it carries mod data. Vanilla skips + * the item drop for empty Shulker Boxes in Creative; without this the separator UUID / slot filters would + * be lost on break. Spawns the item with all data components already embedded via {@code collectComponents()}. + */ +@Mixin(ShulkerBoxBlock.class) +public class ShulkerBoxBlockMixin { + + @Inject(method = "playerWillDestroy", at = @At("HEAD")) + private void forceDropEmptyCustomShulker( + Level world, BlockPos pos, BlockState state, Player player, CallbackInfoReturnable cir) { + // Survival always drops the item; only Creative needs special handling. + if (!world.isClientSide() && player.isCreative()) { + BlockEntity be = world.getBlockEntity(pos); + + if (be instanceof ShulkerBoxBlockEntity shulker && shulker.isEmpty()) { + boolean hasCustomData = false; + + if (shulker instanceof IShulkerUUIDProvider provider && provider.getShulkerUUID() != null) { + hasCustomData = true; + } + + if (shulker instanceof IWhitelistProvider provider + && provider.getWhitelists() != null + && !provider.getWhitelists().isEmpty()) { + hasCustomData = true; + } + + if (hasCustomData) { + ItemStack itemStack = new ItemStack(((ShulkerBoxBlock) (Object) this).asItem()); + itemStack.applyComponents(shulker.collectComponents()); + + ItemEntity itemEntity = + new ItemEntity(world, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, itemStack); + itemEntity.setDefaultPickUpDelay(); + world.addFreshEntity(itemEntity); + } + } + } + } +} diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/ShulkerBoxSlotMixin.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/ShulkerBoxSlotMixin.java new file mode 100644 index 0000000..6af81f8 --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/ShulkerBoxSlotMixin.java @@ -0,0 +1,44 @@ +package io.github.marcsanzdev.chestseparators.mixin; + +import io.github.marcsanzdev.chestseparators.access.IWhitelistProvider; +import io.github.marcsanzdev.chestseparators.data.SlotWhitelist; +import io.github.marcsanzdev.chestseparators.util.ClickTracker; +import java.util.Map; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.world.inventory.ShulkerBoxSlot; +import net.minecraft.world.inventory.Slot; +import net.minecraft.world.item.ItemStack; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +/** + * Mirrors {@link SlotWhitelistMixin} for {@link ShulkerBoxSlot}, which overrides {@code mayPlace} without + * calling {@code super}, so the base-slot mixin never fires for Shulker Box slots. + */ +@Mixin(ShulkerBoxSlot.class) +public abstract class ShulkerBoxSlotMixin { + + @Inject(method = "mayPlace", at = @At("HEAD"), cancellable = true) + public void onMayPlaceShulker(ItemStack stack, CallbackInfoReturnable cir) { + Slot thisSlot = (Slot) (Object) this; + + if (thisSlot.container instanceof IWhitelistProvider provider) { + Map whitelists = provider.getWhitelists(); + + if (whitelists != null && whitelists.containsKey(thisSlot.getContainerSlot())) { + SlotWhitelist wl = whitelists.get(thisSlot.getContainerSlot()); + String itemId = BuiltInRegistries.ITEM.getKey(stack.getItem()).toString(); + boolean isAllowedItem = wl.allowedItems().contains(itemId); + boolean isShift = ClickTracker.IS_SHIFT_CLICK.get(); + + if (isShift) { + if (wl.allowShift() && !isAllowedItem) cir.setReturnValue(false); + } else { + if (wl.allowManual() && !isAllowedItem) cir.setReturnValue(false); + } + } + } + } +} diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/SimpleInventoryMixin.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/SimpleInventoryMixin.java new file mode 100644 index 0000000..a620af9 --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/SimpleInventoryMixin.java @@ -0,0 +1,28 @@ +package io.github.marcsanzdev.chestseparators.mixin; + +import io.github.marcsanzdev.chestseparators.access.IWhitelistProvider; +import io.github.marcsanzdev.chestseparators.data.SlotWhitelist; +import java.util.Map; +import net.minecraft.world.SimpleContainer; +import org.spongepowered.asm.mixin.Mixin; + +/** + * Adds {@link IWhitelistProvider} to {@link SimpleContainer}, used both as the client-side dummy + * inventory backing open container GUIs and as the cargo inventory of pack animals (donkeys, mules, + * llamas). No persistence is performed here; data comes from the server payload or the entity's local + * UUID-keyed config file. + */ +@Mixin(SimpleContainer.class) +public abstract class SimpleInventoryMixin implements IWhitelistProvider { + private Map whitelists = null; + + @Override + public Map getWhitelists() { + return this.whitelists; + } + + @Override + public void setWhitelists(Map whitelists) { + this.whitelists = whitelists; + } +} diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/SlotWhitelistMixin.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/SlotWhitelistMixin.java new file mode 100644 index 0000000..808aacd --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/SlotWhitelistMixin.java @@ -0,0 +1,70 @@ +package io.github.marcsanzdev.chestseparators.mixin; + +import io.github.marcsanzdev.chestseparators.ChestSeparatorsState; +import io.github.marcsanzdev.chestseparators.access.IWhitelistProvider; +import io.github.marcsanzdev.chestseparators.data.SlotWhitelist; +import io.github.marcsanzdev.chestseparators.util.ClickTracker; +import java.util.Map; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.world.Container; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.inventory.Slot; +import org.spongepowered.asm.mixin.Final; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +/** + * Intercepts {@link Slot#mayPlace} to enforce whitelist rules for direct (cursor) and shift-click + * insertions. Uses {@link ClickTracker#IS_SHIFT_CLICK} to distinguish the two, since both flow through + * {@code mayPlace}. If the rule toggle is OFF the slot behaves as vanilla; if ON and the item is not + * whitelisted, insertion is blocked. + */ +@Mixin(Slot.class) +public abstract class SlotWhitelistMixin { + + @Shadow + @Final + public Container container; + + @Shadow + public abstract int getContainerSlot(); + + @Inject(method = "mayPlace", at = @At("HEAD"), cancellable = true) + public void onMayPlace(ItemStack stack, CallbackInfoReturnable cir) { + // The editor probes mayPlace to detect vanilla slot restrictions; don't let our own filter + // enforcement pollute that probe (it would hide every unfiltered item when editing a filter). + if (ClickTracker.BYPASS_ENFORCEMENT.get()) return; + + Map whitelists = null; + + if (this.container instanceof IWhitelistProvider provider) { + // Block containers and entities carry their whitelist on the inventory itself. + whitelists = provider.getWhitelists(); + } else if (this.container instanceof Inventory pinv) { + // The player's own inventory filters live server-side, keyed by raw inventory index + // (which matches Slot#getContainerSlot). Enforced here for manual and shift-click placement. + whitelists = ChestSeparatorsState.INVENTORY_FILTERS.get(pinv.player.getUUID()); + } + + if (whitelists != null && whitelists.containsKey(this.getContainerSlot())) { + SlotWhitelist wl = whitelists.get(this.getContainerSlot()); + String itemId = BuiltInRegistries.ITEM.getKey(stack.getItem()).toString(); + boolean isAllowedItem = wl.allowedItems().contains(itemId); + boolean isShift = ClickTracker.IS_SHIFT_CLICK.get(); + + if (isShift) { + if (wl.allowShift() && !isAllowedItem) { + cir.setReturnValue(false); + } + } else { + if (wl.allowManual() && !isAllowedItem) { + cir.setReturnValue(false); + } + } + } + } +} diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/StorageMinecartEntityMixin.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/StorageMinecartEntityMixin.java new file mode 100644 index 0000000..d436acf --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/StorageMinecartEntityMixin.java @@ -0,0 +1,81 @@ +package io.github.marcsanzdev.chestseparators.mixin; + +import dev.architectury.networking.NetworkManager; +import io.github.marcsanzdev.chestseparators.access.IWhitelistProvider; +import io.github.marcsanzdev.chestseparators.data.SlotWhitelist; +import io.github.marcsanzdev.chestseparators.network.EntityWhitelistS2CPayload; +import java.util.HashMap; +import java.util.Map; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.entity.vehicle.minecart.AbstractMinecartContainer; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.level.storage.ValueInput; +import net.minecraft.world.level.storage.ValueOutput; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Unique; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +/** + * Adds {@link IWhitelistProvider} to chest/hopper minecarts. Unlike other entity containers, hoppers CAN + * insert into these, so the filter is synced to the server by entity UUID (see {@code EntityWhitelistPayload}) + * and persisted here in the entity's own NBT, making the Hopper Insert rule enforce on minecarts (via + * {@code HopperBlockEntityMixin}) and survive reload. On open it pushes the stored filter to the opener + * ({@link EntityWhitelistS2CPayload} S2C) so the editor shows the server-authoritative state. + */ +@Mixin(AbstractMinecartContainer.class) +public abstract class StorageMinecartEntityMixin implements IWhitelistProvider { + + @Unique + private Map chestSeparatorsWhitelists = new HashMap<>(); + + @Override + public Map getWhitelists() { + return this.chestSeparatorsWhitelists; + } + + @Override + public void setWhitelists(Map whitelists) { + this.chestSeparatorsWhitelists = new HashMap<>(whitelists); + } + + /** + * Pushes the stored filter to the opening player so the editor displays the server-authoritative state, + * mirroring the block-chest handler in LootableContainerBlockEntityMixin. + */ + @Inject( + method = + "createMenu(ILnet/minecraft/world/entity/player/Inventory;Lnet/minecraft/world/entity/player/Player;)Lnet/minecraft/world/inventory/AbstractContainerMenu;", + at = @At("RETURN")) + private void chestseparators$onOpenMenu( + int syncId, Inventory playerInventory, Player player, CallbackInfoReturnable cir) { + Entity self = (Entity) (Object) this; + if (cir.getReturnValue() != null + && self.level() != null + && !self.level().isClientSide() + && player instanceof ServerPlayer serverPlayer + && NetworkManager.canPlayerReceive(serverPlayer, EntityWhitelistS2CPayload.TYPE)) { + NetworkManager.sendToPlayer( + serverPlayer, new EntityWhitelistS2CPayload(self.getUUID(), this.chestSeparatorsWhitelists)); + } + } + + @Inject(method = "addAdditionalSaveData", at = @At("TAIL")) + private void chestseparators$writeWhitelists(ValueOutput view, CallbackInfo ci) { + if (!this.chestSeparatorsWhitelists.isEmpty()) { + view.store("ChestSeparatorsWhitelists", SlotWhitelist.MAP_CODEC, this.chestSeparatorsWhitelists); + } + } + + @Inject(method = "readAdditionalSaveData", at = @At("TAIL")) + private void chestseparators$readWhitelists(ValueInput view, CallbackInfo ci) { + this.chestSeparatorsWhitelists.clear(); + view.read("ChestSeparatorsWhitelists", SlotWhitelist.MAP_CODEC) + .ifPresent(this.chestSeparatorsWhitelists::putAll); + } +} diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/WorldMixin.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/WorldMixin.java new file mode 100644 index 0000000..d2d47a5 --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/WorldMixin.java @@ -0,0 +1,58 @@ +package io.github.marcsanzdev.chestseparators.mixin; + +import net.minecraft.core.BlockPos; +import net.minecraft.resources.ResourceKey; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.BarrelBlock; +import net.minecraft.world.level.block.ChestBlock; +import net.minecraft.world.level.block.state.BlockState; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +/** + * Listens for block replacements and removes the corresponding local config file + * when a position-keyed container (chest, trapped chest, or barrel) is destroyed on the client side. + * + *

Registered in the mixin config's {@code client} section so it only ever applies on the physical + * client — the dedicated-server JVM never loads {@code ChestConfigManager} (a client-only class, kept off + * the server by that client-section registration + the client entrypoint). The {@code isClientSide()} guard + * then restricts it to the logical client side of the world (the integrated server shares the client JVM). + */ +@Mixin(Level.class) +public abstract class WorldMixin { + + @Shadow + public abstract boolean isClientSide(); + + @Shadow + public abstract BlockState getBlockState(BlockPos pos); + + @Shadow + public abstract ResourceKey dimension(); + + @Inject( + method = "setBlock(Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;II)Z", + at = @At("HEAD")) + private void onSetBlockState( + BlockPos pos, BlockState newState, int flags, int maxUpdateDepth, CallbackInfoReturnable cir) { + // Only act on the logical client side of the world. + if (this.isClientSide()) { + BlockState oldState = this.getBlockState(pos); + + // Position-keyed containers whose separator config is stored by BlockPos: + // chests (incl. trapped) and barrels. Shulker boxes (UUID-keyed) and ender chests + // (global) use their own persistence models and must NOT be cleaned up here. + boolean wasPosKeyedContainer = + oldState.getBlock() instanceof ChestBlock || oldState.getBlock() instanceof BarrelBlock; + + if (wasPosKeyedContainer && oldState.getBlock() != newState.getBlock()) { + String dim = this.dimension().identifier().toString(); + io.github.marcsanzdev.chestseparators.data.ChestConfigManager.getInstance() + .clearChest(pos, dim); + } + } + } +} diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/client/ArmorEquipClientMixin.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/client/ArmorEquipClientMixin.java new file mode 100644 index 0000000..2805da2 --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/client/ArmorEquipClientMixin.java @@ -0,0 +1,55 @@ +package io.github.marcsanzdev.chestseparators.mixin.client; + +import io.github.marcsanzdev.chestseparators.ChestSeparatorsState; +import io.github.marcsanzdev.chestseparators.data.SlotWhitelist; +import java.util.Map; +import net.minecraft.client.multiplayer.MultiPlayerGameMode; +import net.minecraft.core.component.DataComponents; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +/** + * Prevents the client-side equip prediction (animation flicker) when right-clicking armor + * whose target slot has a Shift filter that blocks the item. Without this, the server cancels + * the equip one tick later, causing a visible flash of the armor being worn momentarily. + */ +@Mixin(MultiPlayerGameMode.class) +public abstract class ArmorEquipClientMixin { + + @Inject(method = "useItem", at = @At("HEAD"), cancellable = true) + private void blockArmorEquipIfFiltered(Player player, InteractionHand hand, CallbackInfoReturnable cir) { + ItemStack stack = player.getItemInHand(hand); + if (stack.isEmpty()) return; + + var equippable = stack.get(DataComponents.EQUIPPABLE); + if (equippable == null) return; + + int rawIndex = + switch (equippable.slot()) { + case FEET -> 36; + case LEGS -> 37; + case CHEST -> 38; + case HEAD -> 39; + default -> -1; + }; + if (rawIndex == -1) return; + + Map filters = ChestSeparatorsState.INVENTORY_FILTERS.get(player.getUUID()); + if (filters == null) return; + + SlotWhitelist wl = filters.get(rawIndex); + if (wl == null || !wl.allowShift()) return; + + String itemId = BuiltInRegistries.ITEM.getKey(stack.getItem()).toString(); + if (!wl.allowedItems().contains(itemId)) { + cir.setReturnValue(InteractionResult.FAIL); + } + } +} diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/client/ChestInteractionMixin.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/client/ChestInteractionMixin.java new file mode 100644 index 0000000..47caa85 --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/client/ChestInteractionMixin.java @@ -0,0 +1,95 @@ +package io.github.marcsanzdev.chestseparators.mixin.client; + +import io.github.marcsanzdev.chestseparators.util.ChestPosStorage; +import net.minecraft.client.Minecraft; +import net.minecraft.client.multiplayer.MultiPlayerGameMode; +import net.minecraft.client.player.LocalPlayer; +import net.minecraft.core.BlockPos; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.entity.vehicle.minecart.AbstractMinecartContainer; +import net.minecraft.world.entity.vehicle.ContainerEntity; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.world.phys.EntityHitResult; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +/** + * Intercepts the player's block and entity interactions to capture the context needed + * for the mod's editor UI before the container screen is opened. + * + *

Minecraft's architecture separates the interaction event from the screen initializer, + * so {@link ChestPosStorage} acts as a transient bridge between the two call sites. + */ +@Mixin(MultiPlayerGameMode.class) +public class ChestInteractionMixin { + + /** + * Captures the clicked block position and, if present, the Shulker UUID from its block entity. + * This runs before the server processes the interaction, so the data is ready by the time + * the resulting container screen is initialized on the client. + */ + @Inject(method = "useItemOn", at = @At("HEAD")) + private void captureChestPos( + LocalPlayer player, + InteractionHand hand, + BlockHitResult hitResult, + CallbackInfoReturnable cir) { + if (hand == InteractionHand.MAIN_HAND) { + BlockPos clickedPos = hitResult.getBlockPos(); + + ChestPosStorage.lastClickedPos = clickedPos; + ChestPosStorage.isEntityOpened = false; + ChestPosStorage.lastOpenedShulkerUUID = null; + + if (Minecraft.getInstance().level != null) { + ChestPosStorage.lastClickedDimension = Minecraft.getInstance() + .level + .dimension() + .identifier() + .toString(); + + net.minecraft.world.level.block.entity.BlockEntity be = + Minecraft.getInstance().level.getBlockEntity(clickedPos); + if (be instanceof io.github.marcsanzdev.chestseparators.access.IShulkerUUIDProvider provider) { + ChestPosStorage.lastOpenedShulkerUUID = provider.getShulkerUUID(); + } + } + } + } + + /** + * Captures the UUID of entity-based inventories (Chest Minecarts, Chest Boats, + * Donkeys, Llamas, etc.) so the editor can use UUID-keyed storage instead of BlockPos. + */ + @Inject(method = "interact", at = @At("HEAD")) + private void captureEntity( + Player player, + Entity entity, + EntityHitResult hitResult, + InteractionHand hand, + CallbackInfoReturnable cir) { + if (hand == InteractionHand.MAIN_HAND) { + if (entity instanceof ContainerEntity + || entity.getClass().getName().contains("Chest")) { + ChestPosStorage.lastClickedEntityUUID = entity.getUUID(); + ChestPosStorage.isEntityOpened = true; + // Chest/hopper minecarts accept hopper input, so the Hopper rule is available for them. + ChestPosStorage.isMinecartEntity = entity instanceof AbstractMinecartContainer; + ChestPosStorage.lastOpenedShulkerUUID = null; + + if (Minecraft.getInstance().level != null) { + ChestPosStorage.lastClickedDimension = Minecraft.getInstance() + .level + .dimension() + .identifier() + .toString(); + } + } + } + } +} diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/client/ChestLidAccessor.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/client/ChestLidAccessor.java new file mode 100644 index 0000000..d37fa37 --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/client/ChestLidAccessor.java @@ -0,0 +1,18 @@ +package io.github.marcsanzdev.chestseparators.mixin.client; + +import io.github.marcsanzdev.chestseparators.access.LidAnimatorAccess; +import net.minecraft.world.level.block.entity.ChestBlockEntity; +import net.minecraft.world.level.block.entity.ChestLidController; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.gen.Accessor; + +// Exposes the chest's private lid controller so the auto-deposit feedback can briefly play the vanilla +// opening animation (client-side, cosmetic). Single-target on purpose to keep the ender-chest counterpart +// independent. See EnderChestLidAccessor and LidAnimatorAccess. +@Mixin(ChestBlockEntity.class) +public interface ChestLidAccessor extends LidAnimatorAccess { + + @Override + @Accessor("chestLidController") + ChestLidController getLidAnimator(); +} diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/client/CreativeInventoryScreenAccessor.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/client/CreativeInventoryScreenAccessor.java new file mode 100644 index 0000000..9a60556 --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/client/CreativeInventoryScreenAccessor.java @@ -0,0 +1,15 @@ +package io.github.marcsanzdev.chestseparators.mixin.client; + +import net.minecraft.client.gui.screens.inventory.CreativeModeInventoryScreen; +import net.minecraft.world.item.CreativeModeTab; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.gen.Invoker; + +/** Exposes the private {@code selectTab} so the editor can jump the creative screen to its + * inventory tab when a toolbar button is used (the player inventory is only present on that tab). */ +@Mixin(CreativeModeInventoryScreen.class) +public interface CreativeInventoryScreenAccessor { + + @Invoker("selectTab") + void chestseparators$setSelectedTab(CreativeModeTab group); +} diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/client/CreativeInventoryScreenMixin.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/client/CreativeInventoryScreenMixin.java new file mode 100644 index 0000000..819c561 --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/client/CreativeInventoryScreenMixin.java @@ -0,0 +1,76 @@ +package io.github.marcsanzdev.chestseparators.mixin.client; + +import io.github.marcsanzdev.chestseparators.client.ui.ChestSeparatorsEditor; +import net.minecraft.client.gui.GuiGraphicsExtractor; +import net.minecraft.client.gui.screens.inventory.CreativeModeInventoryScreen; +import net.minecraft.client.input.CharacterEvent; +import net.minecraft.client.input.KeyEvent; +import net.minecraft.world.item.CreativeModeTab; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +/** + * While the mod's editor is active over the creative inventory, the vanilla creative tab bar must not + * react — clicking a tab would switch it out from under the editor. Rather than fight the several mouse + * events the tab bar can respond to, this blocks the single choke point {@code selectTab} (except + * the mod's own jump-to-inventory-tab, flagged via {@link ChestSeparatorsEditor#allowCreativeTabSwitch}). + * The tab tooltips are suppressed the same way. + */ +@Mixin(CreativeModeInventoryScreen.class) +public abstract class CreativeInventoryScreenMixin { + + private static boolean chestseparators$blocking() { + ChestSeparatorsEditor editor = ChestSeparatorsEditor.getInstance(); + return editor != null && (editor.isEditMode() || editor.getSession().isPresetsMenuOpen); + } + + @Inject(method = "selectTab", at = @At("HEAD"), cancellable = true) + private void chestseparators$blockTabSwitchWhileEditing(CreativeModeTab group, CallbackInfo ci) { + if (!ChestSeparatorsEditor.allowCreativeTabSwitch && chestseparators$blocking()) { + ci.cancel(); + } + } + + // A tab reads as "hovered" (it lifts) when the cursor is over it, which makes it look clickable even + // though the switch is blocked. Reporting no tab as clicked while editing keeps the tab bar flat and + // inert, so nothing about it invites a click. + @Inject(method = "checkTabClicked", at = @At("HEAD"), cancellable = true) + private void chestseparators$noTabHoverWhileEditing( + CreativeModeTab group, double mouseX, double mouseY, CallbackInfoReturnable cir) { + if (chestseparators$blocking()) { + cir.setReturnValue(false); + } + } + + @Inject(method = "checkTabHovering", at = @At("HEAD"), cancellable = true) + private void chestseparators$blockTabTooltipsWhileEditing( + GuiGraphicsExtractor context, CreativeModeTab group, int mouseX, int mouseY, CallbackInfoReturnable cir) { + if (chestseparators$blocking()) { + cir.setReturnValue(false); + } + } + + // CreativeModeInventoryScreen overrides keyPressed/charTyped for its own search box, so the + // AbstractContainerScreen mixin that forwards typing to the editor never runs here. Without this, + // editing a filter's search or renaming a preset from the creative inventory swallowed every keystroke. + // Route input to the editor first; it only consumes keys it actually needs (rename field, filter + // search, shortcuts), so normal creative typing (the item search) still falls through untouched. + @Inject(method = "keyPressed", at = @At("HEAD"), cancellable = true) + private void chestseparators$forwardKeyToEditor(KeyEvent input, CallbackInfoReturnable cir) { + ChestSeparatorsEditor editor = ChestSeparatorsEditor.getInstance(); + if (editor != null && editor.keyPressed(input)) { + cir.setReturnValue(true); + } + } + + @Inject(method = "charTyped", at = @At("HEAD"), cancellable = true) + private void chestseparators$forwardCharToEditor(CharacterEvent input, CallbackInfoReturnable cir) { + ChestSeparatorsEditor editor = ChestSeparatorsEditor.getInstance(); + if (editor != null && editor.charTyped(input)) { + cir.setReturnValue(true); + } + } +} diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/client/CreativeSlotAccessor.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/client/CreativeSlotAccessor.java new file mode 100644 index 0000000..6c60fe2 --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/client/CreativeSlotAccessor.java @@ -0,0 +1,22 @@ +package io.github.marcsanzdev.chestseparators.mixin.client; + +import net.minecraft.world.inventory.Slot; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.gen.Accessor; + +/** + * Exposes the wrapped slot inside {@code CreativeModeInventoryScreen$SlotWrapper}. + * + *

On the creative inventory tab every player slot is a {@code SlotWrapper} that wraps the real + * {@code InventoryMenu} slot. Its own {@code getContainerSlot()} returns the wrapper's position in the + * creative handler (armor 5-8, hotbar 36-44, offhand 45) — the handler slot IDs, NOT the inventory + * indices the server enforces filters by (hotbar 0-8, armor 36-39, offhand 40). Reading the wrapped + * slot's {@code getContainerSlot()} instead yields the canonical index, exactly what the survival inventory + * and chests report, so a filter/layout made in creative lands on the right slot everywhere. + */ +@Mixin(targets = "net.minecraft.client.gui.screens.inventory.CreativeModeInventoryScreen$SlotWrapper") +public interface CreativeSlotAccessor { + + @Accessor("target") + Slot chestseparators$getWrappedSlot(); +} diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/client/EnderChestLidAccessor.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/client/EnderChestLidAccessor.java new file mode 100644 index 0000000..1f0bc65 --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/client/EnderChestLidAccessor.java @@ -0,0 +1,17 @@ +package io.github.marcsanzdev.chestseparators.mixin.client; + +import io.github.marcsanzdev.chestseparators.access.LidAnimatorAccess; +import net.minecraft.world.level.block.entity.ChestLidController; +import net.minecraft.world.level.block.entity.EnderChestBlockEntity; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.gen.Accessor; + +// Ender-chest counterpart of ChestLidAccessor. Kept as its own single-target accessor so each container +// exposes its own chestLidController through the shared LidAnimatorAccess interface. +@Mixin(EnderChestBlockEntity.class) +public interface EnderChestLidAccessor extends LidAnimatorAccess { + + @Override + @Accessor("chestLidController") + ChestLidController getLidAnimator(); +} diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/client/GenericContainerScreenMixin.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/client/GenericContainerScreenMixin.java new file mode 100644 index 0000000..6978df5 --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/client/GenericContainerScreenMixin.java @@ -0,0 +1,349 @@ +package io.github.marcsanzdev.chestseparators.mixin.client; + +import com.mojang.blaze3d.platform.InputConstants; +import com.mojang.blaze3d.platform.cursor.CursorType; +import io.github.marcsanzdev.chestseparators.client.ui.ChestSeparatorsEditor; +import io.github.marcsanzdev.chestseparators.client.ui.ModKeyBindings; +import io.github.marcsanzdev.chestseparators.config.GlobalChestConfig; +import net.minecraft.client.gui.GuiGraphicsExtractor; +import net.minecraft.client.gui.screens.Screen; +import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen; +import net.minecraft.client.gui.screens.inventory.ContainerScreen; +import net.minecraft.client.gui.screens.inventory.HorseInventoryScreen; +import net.minecraft.client.gui.screens.inventory.InventoryScreen; +import net.minecraft.client.gui.screens.inventory.ShulkerBoxScreen; +import net.minecraft.client.input.CharacterEvent; +import net.minecraft.client.input.KeyEvent; +import net.minecraft.client.input.MouseButtonEvent; +import net.minecraft.network.chat.Component; +import net.minecraft.world.inventory.AbstractContainerMenu; +import org.lwjgl.sdl.SDLMouse; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Unique; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +// Injects custom rendering and input handling logic into the base AbstractContainerScreen class. +// This allows the mod to overlay the editor UI onto existing vanilla container screens. +@Mixin(AbstractContainerScreen.class) +public abstract class GenericContainerScreenMixin extends Screen { + + @Unique + private ChestSeparatorsEditor editor; + + protected GenericContainerScreenMixin(Component title) { + super(title); + } + + // Intercepts the initialization phase of the screen to instantiate our custom editor. + @Inject(method = "init", at = @At("TAIL")) + protected void init(CallbackInfo ci) { + // Validates that the current screen is a supported container type. + // ContainerScreen handles standard Chests, Barrels, Chest Minecarts, and Chest Boats. + // ShulkerBoxScreen is explicitly allowed for Shulker Box support. + // HorseInventoryScreen is allowed for donkeys, mules, llamas, and alpacas (entities with cargo slots). + boolean isValidScreen = (Object) this instanceof ContainerScreen + || (Object) this instanceof ShulkerBoxScreen + || (Object) this instanceof InventoryScreen + || (Object) this instanceof net.minecraft.client.gui.screens.inventory.CreativeModeInventoryScreen + || isHorseScreenWithCargo(); + + if (!isValidScreen) return; + + this.editor = new ChestSeparatorsEditor((AbstractContainerScreen) (Object) this); + this.editor.init(); + } + + // Returns true only for horse-type screens that have cargo slots (donkeys, mules, llamas, alpacas). + // Regular horses only have saddle + armor slots (≤ 2 non-player slots), so they are excluded. + @Unique + private boolean isHorseScreenWithCargo() { + if (!((Object) this instanceof HorseInventoryScreen)) return false; + AbstractContainerMenu handler = ((HandledScreenAccessor) this).getHandler(); + // 36 = player inventory slots. More than 2 container slots means there is cargo. + return handler.slots.size() - 36 > 2; + } + + // Injects the editor's custom rendering logic or normal mode overlays to be drawn on top of the + // vanilla GUI. Hooked at renderContents (not render) because InventoryScreen -> recipe-book screens call + // renderContents directly and never AbstractContainerScreen#render; renderContents is the common path for + // both chests and the inventory, and runs inside the render flow so deferred tooltips still flush. + @Inject(method = "extractContents", at = @At("TAIL")) + public void renderEditorOverlay(GuiGraphicsExtractor context, int mouseX, int mouseY, float delta, CallbackInfo ci) { + if (this.editor != null) { + this.editor.render(context, mouseX, mouseY, delta); + this.editor.renderNormalModeOverlay(context, mouseX, mouseY); + + // Creative's renderLabels sets a pointer cursor over its tabs/scrollbar, making them look + // clickable even while the editor has them blocked. This overlay renders last, so forcing the + // default cursor here wins the frame and keeps the tab bar looking inert while editing. + if (this.editor.isEditMode() || this.editor.getSession().isPresetsMenuOpen) { + context.requestCursor(CursorType.DEFAULT); + } + } + } + + // While a mod sub-screen (layout / filters / presets) is open on a recipe-book screen, keep the book + // closed AND recenter the container. Opening the book shifts the whole GUI sideways; if we only closed + // the book the container would stay shifted and everything the mod draws (panels, slot decorations) + // would sit out of place. Doing it at renderContents HEAD — before the GUI is drawn — makes the container + // render centered this very frame, as if the book had never been open. + // Remembers that we force-closed a recipe book the player had open, so it can be restored when the mod + // sub-screen is dismissed and the normal inventory returns. + @Unique + private boolean chestseparators$bookWasOpen = false; + + // The horizontal shift we applied to recenter the container while editing. Kept so it can be undone + // exactly on exit, returning the container (and its GUI-anchored widgets) to the book-open position. + @Unique + private int chestseparators$appliedShift = 0; + + @Inject(method = "extractContents", at = @At("HEAD")) + public void normalizeRecipeBookWhileEditing( + GuiGraphicsExtractor context, int mouseX, int mouseY, float delta, CallbackInfo ci) { + if (this.editor == null) return; + if (!((Object) this + instanceof net.minecraft.client.gui.screens.inventory.AbstractRecipeBookScreen rbs)) return; + + net.minecraft.client.gui.screens.recipebook.RecipeBookComponent book = + ((RecipeBookScreenAccessor) rbs).chestseparators$getRecipeBook(); + if (book == null) return; + + boolean editing = this.editor.isEditMode() || this.editor.getSession().isPresetsMenuOpen; + if (!editing) { + // Back in the normal inventory: reopen the book the player had left open, and UNDO our recentering + // shift so the container, its widgets and the effect panel all slide back to the book-open layout. + if (chestseparators$bookWasOpen && !book.isVisible()) { + ((RecipeBookWidgetInvoker) book).chestseparators$setOpen(true); + } + if (chestseparators$appliedShift != 0) { + chestseparators$shiftGui((HandledScreenAccessor) this, -chestseparators$appliedShift); + chestseparators$appliedShift = 0; + } + chestseparators$bookWasOpen = false; + return; + } + + // A mod sub-screen is open: force the book closed (remembering it was open) so it stops covering the + // editor, then recenter the container as if the book were closed. + if (book.isVisible()) { + chestseparators$bookWasOpen = true; + ((RecipeBookWidgetInvoker) book).chestseparators$setOpen(false); + } + + HandledScreenAccessor acc = (HandledScreenAccessor) this; + int centeredX = (this.width - acc.getBackgroundWidth()) / 2; + int dx = centeredX - acc.getX(); + if (dx != 0) { + chestseparators$shiftGui(acc, dx); + chestseparators$appliedShift += dx; + } + } + + // Slides the container's x and every GUI-anchored vanilla widget (the recipe book toggle button) by dx. + // Those widgets are positioned once at init and do not follow a live x change on their own, so shifting + // them by the same delta keeps the whole GUI moving as one piece. + @Unique + private void chestseparators$shiftGui(HandledScreenAccessor acc, int dx) { + acc.setX(acc.getX() + dx); + for (net.minecraft.client.gui.components.events.GuiEventListener el : this.children()) { + if (el instanceof net.minecraft.client.gui.components.AbstractWidget widget) { + widget.setX(widget.getX() + dx); + } + } + } + + // Renders the previously saved separator lines underneath the item slots, plus the player's own + // inventory decorations on the player slots (visible in every screen, including chests). + @Inject(method = "extractSlots", at = @At("HEAD")) + public void renderSavedLinesLayer(GuiGraphicsExtractor context, int mouseX, int mouseY, CallbackInfo ci) { + if (this.editor != null) { + this.editor.renderSavedLinesLayer(context); + } + } + + // Suppresses vanilla item tooltips while the editor mode is active + // to prevent visual clutter while drawing lines. + @Inject(method = "extractTooltip", at = @At("HEAD"), cancellable = true) + private void onDrawMouseoverTooltip(GuiGraphicsExtractor context, int x, int y, CallbackInfo ci) { + if (this.editor != null && (this.editor.isEditMode() || this.editor.getSession().isPresetsMenuOpen)) { + ci.cancel(); + } + } + + // Suppresses the vanilla background slot highlight when editing. + @Inject(method = "extractSlotHighlightBack", at = @At("HEAD"), cancellable = true) + private void onDrawSlotHighlightBack(GuiGraphicsExtractor context, CallbackInfo ci) { + if (this.editor != null && (this.editor.isEditMode() || this.editor.getSession().isPresetsMenuOpen)) { + ci.cancel(); + } + } + + // Suppresses the vanilla foreground slot highlight when editing. + @Inject(method = "extractSlotHighlightFront", at = @At("HEAD"), cancellable = true) + private void onDrawSlotHighlightFront(GuiGraphicsExtractor context, CallbackInfo ci) { + if (this.editor != null && (this.editor.isEditMode() || this.editor.getSession().isPresetsMenuOpen)) { + ci.cancel(); + } + } + + // Skips the vanilla item render for slots taking part in the push/pull preview, so the editor can + // draw a clean ghost with no real item (or its count) showing through underneath. + @Inject(method = "extractSlot", at = @At("HEAD"), cancellable = true) + private void onDrawSlot( + GuiGraphicsExtractor context, net.minecraft.world.inventory.Slot slot, int mouseX, int mouseY, CallbackInfo ci) { + if (this.editor != null && this.editor.isPreviewSlot(slot)) { + ci.cancel(); + } + } + + // ---- Mouse routing (replaces the old Fabric ScreenMouseEvents registration) ---- + // The editor's internal handlers still use the pre-26.3/GLFW convention: + // left = 0, right = 1, middle = 2. Minecraft 26.3 sends SDL buttons: + // left = 1, middle = 2, right = 3. Convert at the boundary so all widgets, + // painting tools, and mouse-release/drag behavior share the same semantics. + // Unknown buttons stay unknown rather than accidentally invoking left-click actions. + @Unique + private static int chestseparators$legacyMouseButton(int sdlButton) { + return switch (sdlButton) { + case SDLMouse.SDL_BUTTON_LEFT -> 0; + case SDLMouse.SDL_BUTTON_RIGHT -> 1; + case SDLMouse.SDL_BUTTON_MIDDLE -> 2; + default -> -1; + }; + } + + // Each editor handler returns the Fabric-style "allow" boolean: false means the editor consumed the + // event, so we cancel the vanilla handler by returning true (handled). + + @Inject(method = "mouseClicked", at = @At("HEAD"), cancellable = true) + private void onMouseClicked(MouseButtonEvent event, boolean doubleClick, CallbackInfoReturnable cir) { + if (this.editor != null && !this.editor.inputHandler.handleClick(event.x(), event.y(), chestseparators$legacyMouseButton(event.button()))) { + cir.setReturnValue(true); + } + } + + @Inject(method = "mouseReleased", at = @At("HEAD"), cancellable = true) + private void onMouseReleased(MouseButtonEvent event, CallbackInfoReturnable cir) { + if (this.editor != null + && !this.editor.inputHandler.onMouseReleased(event.x(), event.y(), chestseparators$legacyMouseButton(event.button()))) { + cir.setReturnValue(true); + } + } + + @Inject(method = "mouseDragged", at = @At("HEAD"), cancellable = true) + private void onMouseDragged( + MouseButtonEvent event, double deltaX, double deltaY, CallbackInfoReturnable cir) { + if (this.editor != null + && !this.editor.inputHandler.onMouseDragged(event.x(), event.y(), deltaX, deltaY)) { + cir.setReturnValue(true); + } + } + + // Forwards keyboard input to the editor seamlessly and intercepts Deposit Hotkeys. + @Inject(method = "keyPressed", at = @At("HEAD"), cancellable = true) + private void onKeyPressed(KeyEvent input, CallbackInfoReturnable cir) { + if (this.editor != null) { + + if (this.editor.keyPressed(input)) { + cir.setReturnValue(true); + return; + } + + // The magnifier toggle works in any editor state, since it is used while painting. Feedback + // goes through the editor's status overlay so it shows above the chest GUI. + if (ModKeyBindings.toggleMagnifierKey.matches(input)) { + this.editor.showStatus( + io.github.marcsanzdev.chestseparators.event.KeyInputHandler.toggleMagnifier(), + net.minecraft.ChatFormatting.GRAY); + this.editor.playClickSound(1.0f); + cir.setReturnValue(true); + return; + } + + // The same UI toggles available with the chest closed (deposit button, edit buttons, + // preview panel) also work with the chest open, applied instantly. Only when no editor + // sub-menu is active, so they don't clash with typing in search boxes. + if (!this.editor.isEditMode()) { + if (ModKeyBindings.openEditorKey.matches(input)) { + this.editor.showStatus( + io.github.marcsanzdev.chestseparators.event.KeyInputHandler.togglePreviewPanel(), + net.minecraft.ChatFormatting.GRAY); + this.editor.playClickSound(1.0f); + cir.setReturnValue(true); + return; + } + if (ModKeyBindings.toggleEditButtonsKey.matches(input)) { + this.editor.showStatus( + io.github.marcsanzdev.chestseparators.event.KeyInputHandler.toggleEditButtons(), + net.minecraft.ChatFormatting.GRAY); + this.editor.playClickSound(1.0f); + cir.setReturnValue(true); + return; + } + } + + // Push/Pull hotkeys act on the open container and only fire when no editor sub-menu is active. + // Holding Shift runs the "+ empty slots" variant of each — push also into empty slots, pull also + // unfiltered items — matching the Shift behaviour of the deposit and fill buttons. + if (!this.editor.isEditMode() && GlobalChestConfig.instance.showDepositButton) { + boolean shift = InputConstants.isKeyDown(InputConstants.KEY_LSHIFT) + || InputConstants.isKeyDown(InputConstants.KEY_RSHIFT); + + if (ModKeyBindings.pushKey.matches(input)) { + this.editor.depositClickTime = System.currentTimeMillis(); + this.editor.executeDeposit(shift); + this.editor.playClickSound(1.2f); + cir.setReturnValue(true); + return; + } + if (ModKeyBindings.pullKey.matches(input)) { + this.editor.fillClickTime = System.currentTimeMillis(); + // requestFillFromOpenChest already plays the click sound; don't play a second one. + this.editor.requestFillFromOpenChest(shift); + cir.setReturnValue(true); + return; + } + } + } + } + + // Forwards text input (typing) to the editor's search box (Using Override because + // AbstractContainerScreen doesn't have it). + @Override + public boolean charTyped(CharacterEvent input) { + if (this.editor != null && this.editor.charTyped(input)) { + return true; + } + return super.charTyped(input); + } + + // Ensures cleanup operations and server unlocks run when the GUI is destroyed for ANY reason + // (Manual close, block broken by another player, server kick, etc). + @Inject(method = "removed", at = @At("HEAD")) + public void onRemoved(CallbackInfo ci) { + if (this.editor != null) { + this.editor.onClose(); + } + + // NOTE: the ChestPosStorage handoff is now cleared on read in ChestSeparatorsEditor#init + // (consume-on-read), NOT here. Clearing it on removed() raced with the next container being + // opened: interactBlock(B) set the position, then this removed() nulled it before B's init read + // it, so the second chest opened in a session saved to nowhere. See the editor init for details. + } + + @Inject(method = "mouseScrolled", at = @At("HEAD"), cancellable = true) + private void onMouseScrolled( + double mouseX, + double mouseY, + double horizontalAmount, + double verticalAmount, + CallbackInfoReturnable cir) { + if (this.editor != null + && !this.editor.inputHandler.onMouseScrolled(mouseX, mouseY, horizontalAmount, verticalAmount)) { + cir.setReturnValue(true); + } + } +} diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/client/HandledScreenAccessor.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/client/HandledScreenAccessor.java new file mode 100644 index 0000000..97705c0 --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/client/HandledScreenAccessor.java @@ -0,0 +1,50 @@ +package io.github.marcsanzdev.chestseparators.mixin.client; + +import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.inventory.Slot; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.gen.Accessor; + +// Mixin Interface implementing the Accessor Pattern. +// Bypasses Java access modifiers (protected/private) to expose internal layout coordinates +// and state data from the generic AbstractContainerScreen class. +// This creates a compile-time safe bridge for the rendering logic to align custom UI elements +// with the vanilla container GUI. +@Mixin(AbstractContainerScreen.class) +public interface HandledScreenAccessor { + + // Exposes the absolute X coordinate of the GUI root on the screen. + // Required for calculating relative offsets for custom buttons and overlays. + @Accessor("leftPos") + int getX(); + + // Recenters the GUI root. Used to undo the recipe book's horizontal shift while a mod sub-screen is + // open, so the container returns to its normal position as if the book were closed. + @Accessor("leftPos") + void setX(int x); + + // Exposes the absolute Y coordinate of the GUI root. + @Accessor("topPos") + int getY(); + + // Exposes the dynamic width of the container background texture. + // Used to anchor UI elements relative to the right edge of the container. + @Accessor("imageWidth") + int getBackgroundWidth(); + + // Exposes the dynamic height of the container background texture. + @Accessor("imageHeight") + int getBackgroundHeight(); + + // Retrieves the slot currently hovered by the mouse cursor. + // Critical for the editor's hit-detection logic (determining where to draw lines). + @Accessor("hoveredSlot") + Slot getFocusedSlot(); + + // Exposes the underlying AbstractContainerMenu (Container). + // Essential for iterating through the complete list of slots to render + // persisted separator lines during the draw cycle. + @Accessor("menu") + AbstractContainerMenu getHandler(); +} diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/client/InGameHudHotbarLinesMixin.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/client/InGameHudHotbarLinesMixin.java new file mode 100644 index 0000000..58ef82a --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/client/InGameHudHotbarLinesMixin.java @@ -0,0 +1,134 @@ +package io.github.marcsanzdev.chestseparators.mixin.client; + +import io.github.marcsanzdev.chestseparators.config.GlobalChestConfig; +import io.github.marcsanzdev.chestseparators.data.ChestConfigManager; +import net.minecraft.client.DeltaTracker; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.Hud; +import net.minecraft.client.gui.GuiGraphicsExtractor; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +/** + * Draws separator backgrounds and 2px border lines on the HUD hotbar slots. + * + *

MC 1.21.6+ uses a deferred GUI renderer (Matrix3x2fStack, no z) whose item + * vs colored-quad layering is not a clean global submission order: drawing all + * backgrounds up-front (before the item loop) leaves some slots' fills on top of + * their item and others underneath. To get uniform "background under item" + * behaviour, each slot's background is drawn at the HEAD of {@code renderSlot} + * — immediately before that very slot's item is rendered — so the bg→item order is + * local and adjacent for every slot. + * + *

Lines inject at RETURN, on top of everything. The vanilla selection highlight + * is a 24×23 frame extending 4px around the 16×16 item area; a 16×16 background + * fills only its transparent center, so the selected slot's background draws + * normally, while the selected slot's own border lines (and the selection-facing + * edges of its neighbours) are suppressed to keep the highlight frame pristine. + */ +@Mixin(Hud.class) +public class InGameHudHotbarLinesMixin { + + @Inject(method = "extractSlot", at = @At("HEAD")) + private void chestseparators$renderSlotBackground( + GuiGraphicsExtractor context, + int x, + int y, + DeltaTracker counter, + Player player, + ItemStack stack, + int seq, + CallbackInfo ci) { + ChestConfigManager m = ChestConfigManager.getInstance(); + if (m.getPlayerInventoryVisual().isEmpty()) return; + + // The x passed in is the slot's item-area left edge (baseX + slot*20). + // Derive the hotbar slot; bail on the offhand call (not an aligned slot). + int rel = x - hotbarBase()[0]; + if (rel < 0 || rel % 20 != 0) return; + int slot = rel / 20; + if (slot < 0 || slot > 8) return; + + int bgColor = m.getInventoryColor(slot, ChestConfigManager.ACTION_BG); + if (bgColor == 0) return; + + int bgAlpha = (GlobalChestConfig.instance.bgTransparency * 255 / 100) << 24; + context.fill(x, y, x + 16, y + 16, (bgColor & 0xFFFFFF) | bgAlpha); + } + + @Inject(method = "extractItemHotbar", at = @At("RETURN")) + private void chestseparators$renderHotbarLines(GuiGraphicsExtractor context, DeltaTracker counter, CallbackInfo ci) { + ChestConfigManager m = ChestConfigManager.getInstance(); + if (m.getPlayerInventoryVisual().isEmpty()) return; + + Minecraft client = Minecraft.getInstance(); + if (client.player == null) return; + int selected = client.player.getInventory().getSelectedSlot(); + + int[] pos = hotbarBase(); + int baseX = pos[0], baseY = pos[1]; + int lineAlpha = (GlobalChestConfig.instance.lineTransparency * 255 / 100) << 24; + + for (int i = 0; i < 9; i++) { + if (i == selected) continue; // selection highlight owns this slot's border + + int x = baseX + i * 20; + int y = baseY; + + // Suppress the edge (and its corners) facing the selected slot: the 24×23 + // highlight frame extends 4px into the neighbour, where the 2px line would land. + boolean skipRight = (i == selected - 1); + boolean skipLeft = (i == selected + 1); + + int rTop = applyAlpha(m.getInventoryColor(i, ChestConfigManager.ACTION_TOP), lineAlpha); + int rBot = applyAlpha(m.getInventoryColor(i, ChestConfigManager.ACTION_BOTTOM), lineAlpha); + int rLeft = skipLeft ? 0 : applyAlpha(m.getInventoryColor(i, ChestConfigManager.ACTION_LEFT), lineAlpha); + int rRight = skipRight ? 0 : applyAlpha(m.getInventoryColor(i, ChestConfigManager.ACTION_RIGHT), lineAlpha); + + if (rTop == 0 && rBot == 0 && rLeft == 0 && rRight == 0) continue; + + int sTop = m.getInventoryPaintSeq(i, ChestConfigManager.ACTION_TOP); + int sBot = m.getInventoryPaintSeq(i, ChestConfigManager.ACTION_BOTTOM); + int sLeft = m.getInventoryPaintSeq(i, ChestConfigManager.ACTION_LEFT); + int sRight = m.getInventoryPaintSeq(i, ChestConfigManager.ACTION_RIGHT); + + // 2px lines fully cover the grey slot dividers of the hotbar texture. + if (rTop != 0) context.fill(x, y - 2, x + 16, y, rTop); + if (rBot != 0) context.fill(x, y + 16, x + 16, y + 18, rBot); + if (rLeft != 0) context.fill(x - 2, y, x, y + 16, rLeft); + if (rRight != 0) context.fill(x + 16, y, x + 18, y + 16, rRight); + + // Corners on the selection-facing side are guarded by boolean (not just a zero + // color) because drawCorner falls back to the other edge's color when one is 0. + if (!skipLeft) drawCorner(context, x - 2, y - 2, rTop, sTop, rLeft, sLeft); + if (!skipRight) drawCorner(context, x + 16, y - 2, rTop, sTop, rRight, sRight); + if (!skipLeft) drawCorner(context, x - 2, y + 16, rBot, sBot, rLeft, sLeft); + if (!skipRight) drawCorner(context, x + 16, y + 16, rBot, sBot, rRight, sRight); + } + } + + private static int[] hotbarBase() { + Minecraft client = Minecraft.getInstance(); + int w = client.getWindow().getGuiScaledWidth(); + int h = client.getWindow().getGuiScaledHeight(); + return new int[] {(w - 182) / 2 + 3, h - 19}; + } + + private static int applyAlpha(int color, int lineAlpha) { + return color == 0 ? 0 : (color & 0x00FFFFFF) | lineAlpha; + } + + /** Paints a 2×2 corner using the edge with the higher paint sequence. */ + private static void drawCorner(GuiGraphicsExtractor context, int cx, int cy, int colorA, int seqA, int colorB, int seqB) { + if (colorA == 0 && colorB == 0) return; + int color; + if (colorA == 0) color = colorB; + else if (colorB == 0) color = colorA; + else color = (seqA >= seqB) ? colorA : colorB; + context.fill(cx, cy, cx + 2, cy + 2, color); + } +} diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/client/LevelRendererMixin.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/client/LevelRendererMixin.java new file mode 100644 index 0000000..95d593c --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/client/LevelRendererMixin.java @@ -0,0 +1,28 @@ +package io.github.marcsanzdev.chestseparators.mixin.client; + +import com.mojang.blaze3d.vertex.PoseStack; +import io.github.marcsanzdev.chestseparators.client.ui.AutoDepositAnimator; +import net.minecraft.client.renderer.LevelRenderer; +import net.minecraft.client.renderer.SubmitNodeCollector; +import net.minecraft.client.renderer.state.level.LevelRenderState; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +/** + * Cross-loader replacement for Fabric's {@code WorldRenderEvents.AFTER_ENTITIES}: Architectury has no + * world-render event, so the auto-deposit fly-over is driven from here. {@code submitEntities} is the E5 + * pass that renders every entity with the frame's camera-relative {@link PoseStack} and the render + * {@link SubmitNodeCollector} — exactly what {@link AutoDepositAnimator#renderFlights} needs — so injecting + * at its TAIL draws the flying items right after the world's entities, in the same space. + */ +@Mixin(LevelRenderer.class) +public class LevelRendererMixin { + + @Inject(method = "submitEntities", at = @At("TAIL")) + private void chestseparators$renderAutoDepositFlights( + PoseStack poseStack, LevelRenderState renderState, SubmitNodeCollector collector, CallbackInfo ci) { + AutoDepositAnimator.renderFlights(poseStack, collector); + } +} diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/client/RecipeBookScreenAccessor.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/client/RecipeBookScreenAccessor.java new file mode 100644 index 0000000..c4623e0 --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/client/RecipeBookScreenAccessor.java @@ -0,0 +1,16 @@ +package io.github.marcsanzdev.chestseparators.mixin.client; + +import net.minecraft.client.gui.screens.inventory.AbstractRecipeBookScreen; +import net.minecraft.client.gui.screens.recipebook.RecipeBookComponent; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.gen.Accessor; + +// Exposes the vanilla recipe book component of recipe-book-bearing screens (the survival inventory, crafting +// table, etc.) so the editor can force it closed while a mod sub-screen is open: an open book covers the +// editor's panels and shoves the whole GUI aside, which is only in the way there. +@Mixin(AbstractRecipeBookScreen.class) +public interface RecipeBookScreenAccessor { + + @Accessor("recipeBookComponent") + RecipeBookComponent chestseparators$getRecipeBook(); +} diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/client/RecipeBookWidgetInvoker.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/client/RecipeBookWidgetInvoker.java new file mode 100644 index 0000000..639da6a --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/client/RecipeBookWidgetInvoker.java @@ -0,0 +1,14 @@ +package io.github.marcsanzdev.chestseparators.mixin.client; + +import net.minecraft.client.gui.screens.recipebook.RecipeBookComponent; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.gen.Invoker; + +// RecipeBookComponent#setVisible is protected; this invoker lets the editor close the book (setVisible(false)) +// while a mod sub-screen is open. See GenericContainerScreenMixin and RecipeBookScreenAccessor. +@Mixin(RecipeBookComponent.class) +public interface RecipeBookWidgetInvoker { + + @Invoker("setVisible") + void chestseparators$setOpen(boolean open); +} diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/client/ShulkerAnimationAccessor.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/client/ShulkerAnimationAccessor.java new file mode 100644 index 0000000..ed15ac1 --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/client/ShulkerAnimationAccessor.java @@ -0,0 +1,15 @@ +package io.github.marcsanzdev.chestseparators.mixin.client; + +import net.minecraft.world.level.block.entity.ShulkerBoxBlockEntity; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.gen.Accessor; + +// Exposes the private animation status of a shulker box so the auto-deposit feedback can drive its +// lid-opening animation (client-side, cosmetic): the block entity's ticker advances the progress +// once the status is set to OPENING/CLOSING. +@Mixin(ShulkerBoxBlockEntity.class) +public interface ShulkerAnimationAccessor { + + @Accessor("animationStatus") + void setAnimationStage(ShulkerBoxBlockEntity.AnimationStatus stage); +} diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/client/StatusEffectsDisplayMixin.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/client/StatusEffectsDisplayMixin.java new file mode 100644 index 0000000..3f0f06f --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/mixin/client/StatusEffectsDisplayMixin.java @@ -0,0 +1,24 @@ +package io.github.marcsanzdev.chestseparators.mixin.client; + +import io.github.marcsanzdev.chestseparators.client.ui.ChestSeparatorsEditor; +import net.minecraft.client.gui.GuiGraphicsExtractor; +import net.minecraft.client.gui.screens.inventory.EffectsInInventory; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +// While a mod sub-screen (layout / filters / presets) is open, the vanilla potion-effect panel drawn beside +// the inventory sits behind the editor's own panels and menus, making them unreadable. Suppress the effect +// panel entirely while editing; it comes back the moment the editor closes. +@Mixin(EffectsInInventory.class) +public class StatusEffectsDisplayMixin { + + @Inject(method = "extractRenderState", at = @At("HEAD"), cancellable = true) + private void chestseparators$hideWhileEditing(GuiGraphicsExtractor context, int mouseX, int mouseY, CallbackInfo ci) { + ChestSeparatorsEditor editor = ChestSeparatorsEditor.getInstance(); + if (editor != null && (editor.isEditMode() || editor.getSession().isPresetsMenuOpen)) { + ci.cancel(); + } + } +} diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/network/AutoDepositRequestPayload.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/network/AutoDepositRequestPayload.java new file mode 100644 index 0000000..06b4db8 --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/network/AutoDepositRequestPayload.java @@ -0,0 +1,86 @@ +package io.github.marcsanzdev.chestseparators.network; + +import io.github.marcsanzdev.chestseparators.data.SlotWhitelist; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; +import net.minecraft.network.RegistryFriendlyByteBuf; +import net.minecraft.network.codec.StreamCodec; +import net.minecraft.network.protocol.common.custom.CustomPacketPayload; +import net.minecraft.resources.Identifier; + +/** + * Client-to-Server request to auto-deposit the player's inventory into nearby filtered containers. + * The client forwards its own config (radius, through-walls) so the behaviour matches the player's + * settings; the server clamps the radius to a safe maximum before acting. + * + *

Ender Chest and entity (chest minecart / chest boat) filters are stored client-side only, so + * they travel with the request: the ender filter as a single map, and entity filters keyed by entity + * UUID. The server uses them to deposit into those containers when they are in range. + */ +public record AutoDepositRequestPayload( + int radius, + boolean throughWalls, + int action, + Map enderWhitelists, + Map> entityWhitelists) + implements CustomPacketPayload { + + /** Deposit every matching item (double-sneak / dedicated hotkey). */ + public static final int ACTION_DEPOSIT_ALL = 0; + + public static final CustomPacketPayload.Type TYPE = new CustomPacketPayload.Type<>( + Identifier.fromNamespaceAndPath("chestseparators", "auto_deposit_request")); + + public static final StreamCodec CODEC = + StreamCodec.ofMember(AutoDepositRequestPayload::write, AutoDepositRequestPayload::new); + + private AutoDepositRequestPayload(RegistryFriendlyByteBuf buf) { + this(buf.readVarInt(), buf.readBoolean(), buf.readVarInt(), readWlMap(buf), readEntityMap(buf)); + } + + private void write(RegistryFriendlyByteBuf buf) { + buf.writeVarInt(this.radius); + buf.writeBoolean(this.throughWalls); + buf.writeVarInt(this.action); + writeWlMap(buf, this.enderWhitelists); + buf.writeVarInt(this.entityWhitelists.size()); + for (Map.Entry> entry : this.entityWhitelists.entrySet()) { + buf.writeUUID(entry.getKey()); + writeWlMap(buf, entry.getValue()); + } + } + + private static void writeWlMap(RegistryFriendlyByteBuf buf, Map map) { + buf.writeVarInt(map.size()); + for (Map.Entry entry : map.entrySet()) { + buf.writeVarInt(entry.getKey()); + SlotWhitelist.PACKET_CODEC.encode(buf, entry.getValue()); + } + } + + private static Map readWlMap(RegistryFriendlyByteBuf buf) { + int size = buf.readVarInt(); + Map map = new HashMap<>(); + for (int i = 0; i < size; i++) { + int key = buf.readVarInt(); + map.put(key, SlotWhitelist.PACKET_CODEC.decode(buf)); + } + return map; + } + + private static Map> readEntityMap(RegistryFriendlyByteBuf buf) { + int size = buf.readVarInt(); + Map> map = new HashMap<>(); + for (int i = 0; i < size; i++) { + UUID uuid = buf.readUUID(); + map.put(uuid, readWlMap(buf)); + } + return map; + } + + @Override + public CustomPacketPayload.Type type() { + return TYPE; + } +} diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/network/AutoDepositResultPayload.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/network/AutoDepositResultPayload.java new file mode 100644 index 0000000..7f965ec --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/network/AutoDepositResultPayload.java @@ -0,0 +1,61 @@ +package io.github.marcsanzdev.chestseparators.network; + +import java.util.ArrayList; +import java.util.List; +import net.minecraft.core.BlockPos; +import net.minecraft.network.RegistryFriendlyByteBuf; +import net.minecraft.network.codec.StreamCodec; +import net.minecraft.network.protocol.common.custom.CustomPacketPayload; +import net.minecraft.resources.Identifier; +import net.minecraft.world.item.ItemStack; + +/** + * Server-to-Client report of a completed auto-deposit. Lists one {@link Flight} per (item type, + * destination container) pair so the client can animate the deposited items flying from the player + * toward each chest. Carries an {@link ItemStack} so it must travel over a {@link RegistryFriendlyByteBuf}. + */ +public record AutoDepositResultPayload(List flights, boolean reverse) implements CustomPacketPayload { + + /** One animated transfer: a representative stack (with the moved count) and its destination. */ + public record Flight(ItemStack stack, BlockPos target) {} + + /** Deposit flights (player -> chest). The grab path uses the two-arg form with reverse=true. */ + public AutoDepositResultPayload(List flights) { + this(flights, false); + } + + public static final CustomPacketPayload.Type TYPE = new CustomPacketPayload.Type<>( + Identifier.fromNamespaceAndPath("chestseparators", "auto_deposit_result")); + + public static final StreamCodec CODEC = + StreamCodec.ofMember(AutoDepositResultPayload::write, AutoDepositResultPayload::new); + + private AutoDepositResultPayload(RegistryFriendlyByteBuf buf) { + this(readFlights(buf), buf.readBoolean()); + } + + private void write(RegistryFriendlyByteBuf buf) { + buf.writeVarInt(this.flights.size()); + for (Flight flight : this.flights) { + ItemStack.STREAM_CODEC.encode(buf, flight.stack()); + buf.writeBlockPos(flight.target()); + } + buf.writeBoolean(this.reverse); + } + + private static List readFlights(RegistryFriendlyByteBuf buf) { + int size = buf.readVarInt(); + List list = new ArrayList<>(size); + for (int i = 0; i < size; i++) { + ItemStack stack = ItemStack.STREAM_CODEC.decode(buf); + BlockPos target = buf.readBlockPos(); + list.add(new Flight(stack, target)); + } + return list; + } + + @Override + public CustomPacketPayload.Type type() { + return TYPE; + } +} diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/network/EditorLockRequestPayload.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/network/EditorLockRequestPayload.java new file mode 100644 index 0000000..a760428 --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/network/EditorLockRequestPayload.java @@ -0,0 +1,32 @@ +package io.github.marcsanzdev.chestseparators.network; + +import net.minecraft.core.BlockPos; +import net.minecraft.network.RegistryFriendlyByteBuf; +import net.minecraft.network.codec.StreamCodec; +import net.minecraft.network.protocol.common.custom.CustomPacketPayload; +import net.minecraft.resources.Identifier; + +// Sent by the client to request a lock on a chest before opening the editor, +// or to release the lock when closing the editor. +public record EditorLockRequestPayload(BlockPos pos, boolean isLocking) implements CustomPacketPayload { + + public static final CustomPacketPayload.Type TYPE = new CustomPacketPayload.Type<>( + Identifier.fromNamespaceAndPath("chestseparators", "editor_lock_request")); + + public static final StreamCodec CODEC = + StreamCodec.ofMember(EditorLockRequestPayload::write, EditorLockRequestPayload::new); + + private EditorLockRequestPayload(RegistryFriendlyByteBuf buf) { + this(buf.readBlockPos(), buf.readBoolean()); + } + + private void write(RegistryFriendlyByteBuf buf) { + buf.writeBlockPos(this.pos); + buf.writeBoolean(this.isLocking); + } + + @Override + public CustomPacketPayload.Type type() { + return TYPE; + } +} diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/network/EditorLockResponsePayload.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/network/EditorLockResponsePayload.java new file mode 100644 index 0000000..fad708f --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/network/EditorLockResponsePayload.java @@ -0,0 +1,31 @@ +package io.github.marcsanzdev.chestseparators.network; + +import net.minecraft.core.BlockPos; +import net.minecraft.network.RegistryFriendlyByteBuf; +import net.minecraft.network.codec.StreamCodec; +import net.minecraft.network.protocol.common.custom.CustomPacketPayload; +import net.minecraft.resources.Identifier; + +// Sent by the server to inform the client if the lock was granted or denied. +public record EditorLockResponsePayload(BlockPos pos, boolean granted) implements CustomPacketPayload { + + public static final CustomPacketPayload.Type TYPE = new CustomPacketPayload.Type<>( + Identifier.fromNamespaceAndPath("chestseparators", "editor_lock_response")); + + public static final StreamCodec CODEC = + StreamCodec.ofMember(EditorLockResponsePayload::write, EditorLockResponsePayload::new); + + private EditorLockResponsePayload(RegistryFriendlyByteBuf buf) { + this(buf.readBlockPos(), buf.readBoolean()); + } + + private void write(RegistryFriendlyByteBuf buf) { + buf.writeBlockPos(this.pos); + buf.writeBoolean(this.granted); + } + + @Override + public CustomPacketPayload.Type type() { + return TYPE; + } +} diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/network/EntityWhitelistPayload.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/network/EntityWhitelistPayload.java new file mode 100644 index 0000000..734783f --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/network/EntityWhitelistPayload.java @@ -0,0 +1,55 @@ +package io.github.marcsanzdev.chestseparators.network; + +import io.github.marcsanzdev.chestseparators.data.SlotWhitelist; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; +import net.minecraft.network.RegistryFriendlyByteBuf; +import net.minecraft.network.codec.StreamCodec; +import net.minecraft.network.protocol.common.custom.CustomPacketPayload; +import net.minecraft.resources.Identifier; + +// Payload for synchronizing whitelist data of ENTITY containers (chest/hopper minecarts) between the +// Server and the Client, keyed by the entity's UUID instead of a BlockPos. +// +// Used bidirectionally: C2S when the client saves a minecart filter (so the server can enforce the Hopper +// rule and persist it in the entity's NBT), and S2C when the container GUI opens (so the client shows the +// server-authoritative filter). +public record EntityWhitelistPayload(UUID entityUuid, Map whitelists) + implements CustomPacketPayload { + + public static final CustomPacketPayload.Type TYPE = new CustomPacketPayload.Type<>( + Identifier.fromNamespaceAndPath("chestseparators", "entity_whitelist_sync")); + + public static final StreamCodec CODEC = + StreamCodec.ofMember(EntityWhitelistPayload::write, EntityWhitelistPayload::new); + + private EntityWhitelistPayload(RegistryFriendlyByteBuf buf) { + this(buf.readUUID(), readMap(buf)); + } + + private void write(RegistryFriendlyByteBuf buf) { + buf.writeUUID(this.entityUuid); + buf.writeInt(this.whitelists.size()); + for (Map.Entry entry : this.whitelists.entrySet()) { + buf.writeInt(entry.getKey()); + SlotWhitelist.PACKET_CODEC.encode(buf, entry.getValue()); + } + } + + private static Map readMap(RegistryFriendlyByteBuf buf) { + int size = buf.readInt(); + Map map = new HashMap<>(); + for (int i = 0; i < size; i++) { + int key = buf.readInt(); + SlotWhitelist value = SlotWhitelist.PACKET_CODEC.decode(buf); + map.put(key, value); + } + return map; + } + + @Override + public CustomPacketPayload.Type type() { + return TYPE; + } +} diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/network/EntityWhitelistS2CPayload.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/network/EntityWhitelistS2CPayload.java new file mode 100644 index 0000000..e1b2a94 --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/network/EntityWhitelistS2CPayload.java @@ -0,0 +1,52 @@ +package io.github.marcsanzdev.chestseparators.network; + +import io.github.marcsanzdev.chestseparators.data.SlotWhitelist; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; +import net.minecraft.network.RegistryFriendlyByteBuf; +import net.minecraft.network.codec.StreamCodec; +import net.minecraft.network.protocol.common.custom.CustomPacketPayload; +import net.minecraft.resources.Identifier; + +// Server -> Client sync of an ENTITY container's whitelist (chest/hopper minecart), keyed by entity UUID. +// A separate payload ID from the C2S {@link EntityWhitelistPayload} because NeoForge (via Architectury) +// forbids registering one payload id for both directions. +public record EntityWhitelistS2CPayload(UUID entityUuid, Map whitelists) + implements CustomPacketPayload { + + public static final CustomPacketPayload.Type TYPE = new CustomPacketPayload.Type<>( + Identifier.fromNamespaceAndPath("chestseparators", "entity_whitelist_sync_s2c")); + + public static final StreamCodec CODEC = + StreamCodec.ofMember(EntityWhitelistS2CPayload::write, EntityWhitelistS2CPayload::new); + + private EntityWhitelistS2CPayload(RegistryFriendlyByteBuf buf) { + this(buf.readUUID(), readMap(buf)); + } + + private void write(RegistryFriendlyByteBuf buf) { + buf.writeUUID(this.entityUuid); + buf.writeInt(this.whitelists.size()); + for (Map.Entry entry : this.whitelists.entrySet()) { + buf.writeInt(entry.getKey()); + SlotWhitelist.PACKET_CODEC.encode(buf, entry.getValue()); + } + } + + private static Map readMap(RegistryFriendlyByteBuf buf) { + int size = buf.readInt(); + Map map = new HashMap<>(); + for (int i = 0; i < size; i++) { + int key = buf.readInt(); + SlotWhitelist value = SlotWhitelist.PACKET_CODEC.decode(buf); + map.put(key, value); + } + return map; + } + + @Override + public CustomPacketPayload.Type type() { + return TYPE; + } +} diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/network/FillFromChestPayload.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/network/FillFromChestPayload.java new file mode 100644 index 0000000..a053a31 --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/network/FillFromChestPayload.java @@ -0,0 +1,40 @@ +package io.github.marcsanzdev.chestseparators.network; + +import net.minecraft.core.BlockPos; +import net.minecraft.network.RegistryFriendlyByteBuf; +import net.minecraft.network.codec.StreamCodec; +import net.minecraft.network.protocol.common.custom.CustomPacketPayload; +import net.minecraft.resources.Identifier; + +/** + * Client-to-Server request to fill the player's inventory from the currently open container (the + * "fill inventory" button in the chest editor). The server reads the open menu's container and pulls + * items the player's inventory filters want. The block position is used only as the origin of the + * cosmetic fly-back animation. + */ +public record FillFromChestPayload(BlockPos animPos, boolean includeEmpty, boolean lockHotbar) + implements CustomPacketPayload { + + public static final CustomPacketPayload.Type TYPE = new CustomPacketPayload.Type<>( + Identifier.fromNamespaceAndPath("chestseparators", "fill_from_chest")); + + public static final StreamCodec CODEC = + StreamCodec.ofMember(FillFromChestPayload::write, FillFromChestPayload::new); + + private FillFromChestPayload(RegistryFriendlyByteBuf buf) { + this(buf.readBlockPos(), buf.readBoolean(), buf.readBoolean()); + } + + private void write(RegistryFriendlyByteBuf buf) { + buf.writeBlockPos(this.animPos); + buf.writeBoolean(this.includeEmpty); + // Client-side setting (GlobalChestConfig is client-only), forwarded so the server-side re-sort can + // honour it without referencing the client config class. + buf.writeBoolean(this.lockHotbar); + } + + @Override + public CustomPacketPayload.Type type() { + return TYPE; + } +} diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/network/InventoryFiltersPayload.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/network/InventoryFiltersPayload.java new file mode 100644 index 0000000..6f57830 --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/network/InventoryFiltersPayload.java @@ -0,0 +1,50 @@ +package io.github.marcsanzdev.chestseparators.network; + +import io.github.marcsanzdev.chestseparators.data.SlotWhitelist; +import java.util.HashMap; +import java.util.Map; +import net.minecraft.network.RegistryFriendlyByteBuf; +import net.minecraft.network.codec.StreamCodec; +import net.minecraft.network.protocol.common.custom.CustomPacketPayload; +import net.minecraft.resources.Identifier; + +/** + * Client-to-Server sync of the player's inventory filters (client-side only otherwise). The server + * caches them per player so it can enforce the "Pick Up" rule: filtered inventory slots only accept + * their item when items are picked up from the ground. Keyed by player-inventory slot index. + */ +public record InventoryFiltersPayload(Map filters) implements CustomPacketPayload { + + public static final CustomPacketPayload.Type TYPE = new CustomPacketPayload.Type<>( + Identifier.fromNamespaceAndPath("chestseparators", "inventory_filters")); + + public static final StreamCodec CODEC = + StreamCodec.ofMember(InventoryFiltersPayload::write, InventoryFiltersPayload::new); + + private InventoryFiltersPayload(RegistryFriendlyByteBuf buf) { + this(readMap(buf)); + } + + private void write(RegistryFriendlyByteBuf buf) { + buf.writeVarInt(this.filters.size()); + for (Map.Entry entry : this.filters.entrySet()) { + buf.writeVarInt(entry.getKey()); + SlotWhitelist.PACKET_CODEC.encode(buf, entry.getValue()); + } + } + + private static Map readMap(RegistryFriendlyByteBuf buf) { + int size = buf.readVarInt(); + Map map = new HashMap<>(); + for (int i = 0; i < size; i++) { + int key = buf.readVarInt(); + map.put(key, SlotWhitelist.PACKET_CODEC.decode(buf)); + } + return map; + } + + @Override + public CustomPacketPayload.Type type() { + return TYPE; + } +} diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/network/ModClientNetworking.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/network/ModClientNetworking.java new file mode 100644 index 0000000..2df44a7 --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/network/ModClientNetworking.java @@ -0,0 +1,174 @@ +package io.github.marcsanzdev.chestseparators.network; + +import dev.architectury.networking.NetworkManager; +import io.github.marcsanzdev.chestseparators.access.IWhitelistProvider; +import io.github.marcsanzdev.chestseparators.client.EditorState; +import io.github.marcsanzdev.chestseparators.client.ui.AutoDepositAnimator; +import io.github.marcsanzdev.chestseparators.client.ui.ChestSeparatorsEditor; +import io.github.marcsanzdev.chestseparators.data.ChestConfigManager; +import io.github.marcsanzdev.chestseparators.util.ChestPosStorage; +import net.minecraft.ChatFormatting; +import net.minecraft.network.chat.Component; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.ChestMenu; +import net.minecraft.world.inventory.PlayerEnderChestContainer; +import net.minecraft.world.inventory.Slot; +import net.minecraft.world.level.block.entity.BlockEntity; + +/** + * Registers all client-side S2C packet handlers for the mod. Each handler runs on the main client thread + * via {@code context.queue(...)}. The matching S2C payload types are registered on the dedicated server in + * {@link ModNetworking#init()} (so {@code canPlayerReceive} is accurate before any send). + */ +public class ModClientNetworking { + + /** Sends the player's current inventory filters to the server (for the Pick Up rule enforcement). */ + public static void sendInventoryFilters() { + var filters = new java.util.HashMap<>(ChestConfigManager.getInstance().getPlayerInventoryFilters()); + // Client inventory clicks are predicted locally before the server responds. Both sides must + // consult the SAME filters or quick-moves/refills visibly snap back on synchronization. + var localPlayer = net.minecraft.client.Minecraft.getInstance().player; + if (localPlayer != null) { + io.github.marcsanzdev.chestseparators.ChestSeparatorsState.INVENTORY_FILTERS + .put(localPlayer.getUUID(), filters); + } + if (NetworkManager.canServerReceive(InventoryFiltersPayload.TYPE)) { + NetworkManager.sendToServer(new InventoryFiltersPayload(filters)); + } + } + + public static void register() { + + // Receives the Shulker Box UUID from the server when a Shulker is opened. + // Stored immediately so it is available when the screen initializes. + NetworkManager.registerReceiver( + NetworkManager.Side.S2C, ShulkerUUIDPayload.TYPE, ShulkerUUIDPayload.CODEC, (payload, context) -> { + context.queue(() -> { + ChestPosStorage.lastOpenedShulkerUUID = payload.shulkerUUID(); + + // Hot-update the editor if the screen is already open (rare but possible). + ChestSeparatorsEditor editor = ChestSeparatorsEditor.getInstance(); + if (editor != null && editor.session.isShulkerBox) { + editor.session.currentShulkerUUID = payload.shulkerUUID(); + ChestConfigManager.getInstance().loadShulkerConfig(payload.shulkerUUID()); + } + }); + }); + + // Receives the server's response to an editor lock request. + // On success, transitions the editor to VIEW_GROUPS mode. + // On failure, shows an error status message and plays a rejection sound. + NetworkManager.registerReceiver( + NetworkManager.Side.S2C, + EditorLockResponsePayload.TYPE, + EditorLockResponsePayload.CODEC, + (payload, context) -> { + context.queue(() -> { + ChestSeparatorsEditor editor = ChestSeparatorsEditor.getInstance(); + if (editor != null + && editor.session.currentChestPos != null + && editor.session.currentChestPos.equals(payload.pos())) { + if (payload.granted()) { + editor.hasEditorLock = true; + editor.toggleState(EditorState.VIEW_GROUPS); + editor.playClickSound(1.0f); + } else { + editor.showStatus( + Component.translatable("message.chestseparators.locked"), ChatFormatting.RED); + editor.playClickSound(0.5f); + } + } + }); + }); + + // Receives the result of a radius transfer and animates the items flying (to chests for a + // deposit, or back to the player for a grab when reverse is set). + NetworkManager.registerReceiver( + NetworkManager.Side.S2C, + AutoDepositResultPayload.TYPE, + AutoDepositResultPayload.CODEC, + (payload, context) -> context.queue( + () -> AutoDepositAnimator.addFlights(payload.flights(), payload.reverse()))); + + // Server-authoritative whitelist for a BLOCK container (chest/barrel/…): applied to the client's + // physical block entity AND the open dummy GUI inventory to kill the one-tick filter flicker. + NetworkManager.registerReceiver( + NetworkManager.Side.S2C, WhitelistS2CPayload.TYPE, WhitelistS2CPayload.CODEC, (payload, context) -> { + context.queue(() -> { + Player player = context.getPlayer(); + if (player == null || player.level() == null) return; + + // Detect Ender Chest by inspecting the open menu's inventory slots, not the block + // position — the payload's pos points to the block the server used, which may differ + // from the Ender Chest position in edge cases. + boolean isEnderChest = false; + if (player.containerMenu != null) { + for (Slot slot : player.containerMenu.slots) { + if (slot.container instanceof PlayerEnderChestContainer) { + isEnderChest = true; + break; + } + } + } + if (isEnderChest) return; + + // 1. Store data for UI rendering. setCurrentWhitelists replaces the whole working map + // with only the container's filters; re-mirror the player-inventory filters so the + // preview panel can still show an inventory group's filter while a chest is open. + ChestConfigManager.getInstance().setCurrentWhitelists(payload.whitelists()); + ChestSeparatorsEditor editorForMirror = ChestSeparatorsEditor.getInstance(); + if (editorForMirror != null && !editorForMirror.session.isInventoryScreenContext) { + ChestConfigManager.getInstance().mirrorInventoryIntoCurrent(); + } + + // 2. Inject into the client-side physical block entity. + BlockEntity be = player.level().getBlockEntity(payload.pos()); + if (be instanceof IWhitelistProvider provider) { + provider.setWhitelists(payload.whitelists()); + } + + // 3. THE FLICKER KILLER: inject into the client's dummy GUI inventory. + if (player.containerMenu instanceof ChestMenu genericHandler + && genericHandler.getContainer() instanceof IWhitelistProvider provider) { + provider.setWhitelists(payload.whitelists()); + } + }); + }); + + // Server-authoritative whitelist for ENTITY containers (chest minecarts), pushed when the GUI opens + // and after a save. Mirrors the block-chest handler above but keyed by entity UUID. + NetworkManager.registerReceiver( + NetworkManager.Side.S2C, + EntityWhitelistS2CPayload.TYPE, + EntityWhitelistS2CPayload.CODEC, + (payload, context) -> { + context.queue(() -> { + Player player = context.getPlayer(); + if (player == null) return; + + // An empty payload means the server entity has no stored filter yet — the migration + // case for minecarts filtered before this version (their filter lives only in the + // local .dat, never synced): ignore it so the local filter is preserved and displayed, + // and it will sync up to the server on the next save. + if (payload.whitelists().isEmpty()) return; + + // Inject into the client's open container inventory (the minecart) to keep client-side + // prediction consistent and avoid a flicker. + if (player.containerMenu instanceof ChestMenu genericHandler + && genericHandler.getContainer() instanceof IWhitelistProvider provider) { + provider.setWhitelists(payload.whitelists()); + } + + // If the editor is open on exactly this minecart, make its displayed filters match the + // server, then re-mirror the player inventory (offset keys) so they are not dropped. + ChestSeparatorsEditor editor = ChestSeparatorsEditor.getInstance(); + if (editor != null + && editor.session.isMinecartChest + && payload.entityUuid().equals(editor.session.currentEntityUUID)) { + ChestConfigManager.getInstance().setCurrentWhitelists(payload.whitelists()); + ChestConfigManager.getInstance().mirrorInventoryIntoCurrent(); + } + }); + }); + } +} diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/network/ModNetworking.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/network/ModNetworking.java new file mode 100644 index 0000000..0e2ecf8 --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/network/ModNetworking.java @@ -0,0 +1,798 @@ +package io.github.marcsanzdev.chestseparators.network; + +import dev.architectury.event.events.common.PlayerEvent; +import dev.architectury.networking.NetworkManager; +import dev.architectury.platform.Platform; +import dev.architectury.utils.Env; +import io.github.marcsanzdev.chestseparators.ChestSeparatorsState; +import io.github.marcsanzdev.chestseparators.access.IWhitelistProvider; +import io.github.marcsanzdev.chestseparators.config.GlobalChestConfig; +import io.github.marcsanzdev.chestseparators.data.SlotWhitelist; +import io.github.marcsanzdev.chestseparators.util.FilterPriority; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Random; +import java.util.UUID; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.CompoundContainer; +import net.minecraft.world.Container; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.item.ItemEntity; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.ChunkPos; +import net.minecraft.world.level.ClipContext; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.ChestBlock; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.EnderChestBlockEntity; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.properties.ChestType; +import net.minecraft.world.level.chunk.LevelChunk; +import net.minecraft.world.phys.AABB; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.world.phys.HitResult; +import net.minecraft.world.phys.Vec3; + +/** + * Loader-agnostic server-side networking, ported from the old Fabric {@code ChestSeparatorsMain}. All + * packet channels are registered through Architectury's {@link NetworkManager}; the enforcement/auto + * logic (auto-deposit, fill, whitelist persistence, editor locks) is the same as the single-loader mod. + */ +public final class ModNetworking { + + private ModNetworking() {} + + private static final Random EXPEL_RANDOM = new Random(); + + /** Hard cap on the auto-deposit radius, regardless of what the client requests. */ + private static final int MAX_AUTO_DEPOSIT_RADIUS = 32; + + /** + * Registers every C2S receiver (runs on both physical sides so the client's integrated server also + * handles them) plus the S2C payload types on the dedicated server. Client-side S2C receivers are + * registered separately in the client module. + */ + public static void init() { + // Release all locks held by a player who disconnects abruptly, and drop their cached filters. + PlayerEvent.PLAYER_QUIT.register(player -> { + ChestSeparatorsState.LOCKED_CHESTS.values().removeIf(uuid -> uuid.equals(player.getUUID())); + ChestSeparatorsState.INVENTORY_FILTERS.remove(player.getUUID()); + }); + + // Fills the player's inventory from the container they currently have open. + NetworkManager.registerReceiver( + NetworkManager.Side.C2S, FillFromChestPayload.TYPE, FillFromChestPayload.CODEC, (payload, context) -> { + context.queue(() -> { + if (context.getPlayer() instanceof ServerPlayer player) { + performFillFromOpenContainer( + player, payload.animPos(), payload.includeEmpty(), payload.lockHotbar()); + } + }); + }); + + // After a "push into the open chest" deposit, re-sort that container's filtered groups by priority + // order (the deposit itself is done client-side via slot clicks; this makes higher-priority arrivals + // move ahead of lower-priority items already stored). + NetworkManager.registerReceiver( + NetworkManager.Side.C2S, + SortOpenFiltersPayload.TYPE, + SortOpenFiltersPayload.CODEC, + (payload, context) -> { + context.queue(() -> { + if (!(context.getPlayer() instanceof ServerPlayer p) || p.containerMenu == null) return; + for (net.minecraft.world.inventory.Slot s : p.containerMenu.slots) { + if (s.container instanceof Inventory) continue; + if (s.container instanceof IWhitelistProvider provider) { + reorderFilteredGroups(s.container, provider.getWhitelists()); + } + break; // the container is a single inventory shared by all its slots + } + p.containerMenu.broadcastChanges(); + }); + }); + + // Caches the player's inventory filters (synced from the client) for the Pick Up rule. + NetworkManager.registerReceiver( + NetworkManager.Side.C2S, + InventoryFiltersPayload.TYPE, + InventoryFiltersPayload.CODEC, + (payload, context) -> { + context.queue(() -> { + if (context.getPlayer() instanceof ServerPlayer player) { + ChestSeparatorsState.INVENTORY_FILTERS.put(player.getUUID(), payload.filters()); + } + }); + }); + + // Persists incoming whitelist updates for ENTITY containers (chest/hopper minecarts). Applying it + // to the live server-side entity is what makes the Hopper Insert rule actually enforce on minecarts, + // and the entity's own NBT persistence keeps it across reload. + NetworkManager.registerReceiver( + NetworkManager.Side.C2S, + EntityWhitelistPayload.TYPE, + EntityWhitelistPayload.CODEC, + (payload, context) -> { + context.queue(() -> { + if (!(context.getPlayer() instanceof ServerPlayer player)) return; + Level world = player.level(); + if (!(world instanceof ServerLevel serverWorld)) return; + Entity entity = serverWorld.getEntity(payload.entityUuid()); + if (entity instanceof IWhitelistProvider provider) { + provider.setWhitelists(payload.whitelists()); + } + }); + }); + + // Handles editor lock requests, with support for double chests (two associated positions). + NetworkManager.registerReceiver( + NetworkManager.Side.C2S, + EditorLockRequestPayload.TYPE, + EditorLockRequestPayload.CODEC, + (payload, context) -> { + context.queue(() -> { + if (!(context.getPlayer() instanceof ServerPlayer player)) return; + UUID playerUuid = player.getUUID(); + BlockPos targetPos = payload.pos(); + Level world = player.level(); + + // Resolve all block positions occupied by this container (1 for single, 2 for double). + List associatedPositions = getAssociatedPositions(world, targetPos); + + if (payload.isLocking()) { + boolean canLock = true; + + // Deny the lock if any part of the container is held by a different player. + for (BlockPos p : associatedPositions) { + if (ChestSeparatorsState.LOCKED_CHESTS.containsKey(p) + && !ChestSeparatorsState.LOCKED_CHESTS.get(p).equals(playerUuid)) { + canLock = false; + break; + } + } + + if (canLock) { + // Acquire all positions atomically so no partial lock can slip through. + for (BlockPos p : associatedPositions) { + ChestSeparatorsState.LOCKED_CHESTS.put(p, playerUuid); + } + } + if (NetworkManager.canPlayerReceive(player, EditorLockResponsePayload.TYPE)) { + NetworkManager.sendToPlayer(player, new EditorLockResponsePayload(targetPos, canLock)); + } + } else { + // Release all associated positions when the player exits the editor. + for (BlockPos p : associatedPositions) { + if (ChestSeparatorsState.LOCKED_CHESTS.containsKey(p) + && ChestSeparatorsState.LOCKED_CHESTS.get(p).equals(playerUuid)) { + ChestSeparatorsState.LOCKED_CHESTS.remove(p); + } + } + } + }); + }); + + // Handles whitelist fetch requests sent by the client when a container is first opened. + NetworkManager.registerReceiver( + NetworkManager.Side.C2S, + WhitelistRequestPayload.TYPE, + WhitelistRequestPayload.CODEC, + (payload, context) -> { + context.queue(() -> { + if (!(context.getPlayer() instanceof ServerPlayer player)) return; + Level world = player.level(); + Container targetInventory = getChestInventorySafe(world, payload.pos()); + + if (targetInventory instanceof IWhitelistProvider provider) { + if (NetworkManager.canPlayerReceive(player, WhitelistS2CPayload.TYPE)) { + NetworkManager.sendToPlayer( + player, new WhitelistS2CPayload(payload.pos(), provider.getWhitelists())); + } + } + }); + }); + + // Persists incoming whitelist updates from the client and broadcasts them to co-viewers. + NetworkManager.registerReceiver( + NetworkManager.Side.C2S, WhitelistPayload.TYPE, WhitelistPayload.CODEC, (payload, context) -> { + context.queue(() -> { + if (!(context.getPlayer() instanceof ServerPlayer player)) return; + Level world = player.level(); + BlockState state = world.getBlockState(payload.pos()); + boolean isEnderChest = state.getBlock() == Blocks.ENDER_CHEST; + + // An Ender Chest uses the player's own inventory (27 slots in vanilla, possibly + // larger in a compatible inventory-expansion mod). The local filter is sent at + // screen open and on edits; cache it on this player's live ender inventory so + // vanilla shift-click reaches the same IWhitelistProvider rule as ordinary chests. + // Do not persist it on the world block: each player's Ender Chest is private. + if (isEnderChest) { + Container ender = player.getEnderChestInventory(); + if (ender instanceof IWhitelistProvider provider) { + Map valid = new java.util.HashMap<>(); + payload.whitelists().forEach((slot, wl) -> { + if (slot != null && wl != null && slot >= 0 + && slot < ender.getContainerSize()) valid.put(slot, wl); + }); + provider.setWhitelists(valid); + } + return; + } + + Container targetInventory = getChestInventorySafe(world, payload.pos()); + + if (targetInventory instanceof IWhitelistProvider provider) { + provider.setWhitelists(payload.whitelists()); + targetInventory.setChanged(); + + // Broadcast the updated whitelist to all other players viewing this container. + if (world instanceof ServerLevel serverWorld) { + for (ServerPlayer trackingPlayer : serverWorld + .getChunkSource() + .chunkMap + .getPlayers(new ChunkPos(payload.pos().getX() >> 4, payload.pos().getZ() >> 4), false)) { + if (trackingPlayer != player + && NetworkManager.canPlayerReceive( + trackingPlayer, WhitelistS2CPayload.TYPE)) { + NetworkManager.sendToPlayer( + trackingPlayer, + new WhitelistS2CPayload(payload.pos(), payload.whitelists())); + } + } + } + + // Eject items that violate the new whitelist when all three rules are enabled. + if (GlobalChestConfig.instance.expelInvalidItems) { + for (int i = 0; i < targetInventory.getContainerSize(); i++) { + ItemStack stack = targetInventory.getItem(i); + if (!stack.isEmpty() && payload.whitelists().containsKey(i)) { + SlotWhitelist wl = payload.whitelists().get(i); + + if (wl.allowManual() && wl.allowShift() && wl.allowHopper()) { + String itemId = BuiltInRegistries.ITEM + .getKey(stack.getItem()) + .toString(); + + if (!wl.allowedItems().contains(itemId)) { + ItemStack extracted = targetInventory.removeItemNoUpdate(i); + + double dropX = payload.pos().getX() + 0.5D; + double dropY = payload.pos().getY() + 0.5D; + double dropZ = payload.pos().getZ() + 0.5D; + + ItemEntity itemEntity = + new ItemEntity(world, dropX, dropY, dropZ, extracted); + + double dirX = player.getX() - dropX; + double dirY = player.getEyeY() - dropY; + double dirZ = player.getZ() - dropZ; + + double distance = + Math.sqrt(dirX * dirX + dirY * dirY + dirZ * dirZ); + dirX /= distance; + dirY /= distance; + dirZ /= distance; + + double force = 0.3D; + itemEntity.setDeltaMovement( + dirX * force + EXPEL_RANDOM.nextGaussian() * 0.05D, + dirY * force + EXPEL_RANDOM.nextGaussian() * 0.05D + 0.1D, + dirZ * force + EXPEL_RANDOM.nextGaussian() * 0.05D); + + itemEntity.setDefaultPickUpDelay(); + world.addFreshEntity(itemEntity); + } + } + } + } + } + } + }); + }); + + // Handles the radius auto-deposit trigger: sort the player's inventory into nearby filtered + // containers and report back what moved so the client can animate it. + NetworkManager.registerReceiver( + NetworkManager.Side.C2S, + AutoDepositRequestPayload.TYPE, + AutoDepositRequestPayload.CODEC, + (payload, context) -> { + context.queue(() -> { + if (!(context.getPlayer() instanceof ServerPlayer p)) return; + performAutoDeposit( + p, + payload.radius(), + payload.throughWalls(), + payload.enderWhitelists(), + payload.entityWhitelists()); + }); + }); + + // S2C send types must be registered on the dedicated server so it can send them. On the physical + // client the same types are registered by the client-side receiver registration. + if (Platform.getEnvironment() == Env.SERVER) { + NetworkManager.registerS2CPayloadType(ShulkerUUIDPayload.TYPE, ShulkerUUIDPayload.CODEC); + NetworkManager.registerS2CPayloadType(EditorLockResponsePayload.TYPE, EditorLockResponsePayload.CODEC); + NetworkManager.registerS2CPayloadType(AutoDepositResultPayload.TYPE, AutoDepositResultPayload.CODEC); + NetworkManager.registerS2CPayloadType(WhitelistS2CPayload.TYPE, WhitelistS2CPayload.CODEC); + NetworkManager.registerS2CPayloadType(EntityWhitelistS2CPayload.TYPE, EntityWhitelistS2CPayload.CODEC); + } + } + + // ------------------------------------------------------------------------------------------------ + // Server-side logic (ported verbatim from ChestSeparatorsMain, yarn -> Mojmap). + // ------------------------------------------------------------------------------------------------ + + /** A filtered container eligible to receive items during an auto-deposit. */ + private record Candidate(BlockPos pos, Container inv, Map whitelists, double distSq) {} + + /** + * Gathers every filtered container in range (block entities, chest minecarts/boats, and the + * player's ender inventory at the nearest reachable ender chest), sorted nearest first. Containers + * blocked from every lateral side are skipped unless {@code throughWalls} is set. + */ + private static List collectCandidates( + ServerPlayer player, + int radius, + boolean throughWalls, + Map enderWhitelists, + Map> entityWhitelists) { + Level world = player.level(); + List candidates = new ArrayList<>(); + if (!(world instanceof ServerLevel)) return candidates; + + radius = Math.max(1, Math.min(radius, MAX_AUTO_DEPOSIT_RADIUS)); + Vec3 eye = player.getEyePosition(); + BlockPos origin = player.blockPosition(); + long radiusSq = (long) radius * radius; + + int chunkRadius = (radius >> 4) + 1; + int centerChunkX = origin.getX() >> 4; + int centerChunkZ = origin.getZ() >> 4; + + // Nearest reachable ender chest block, used as the target for the player's ender inventory + // (ender filters are client-side, so they arrive in the request payload). + BlockPos nearestEnder = null; + double nearestEnderDistSq = Double.MAX_VALUE; + + for (int dx = -chunkRadius; dx <= chunkRadius; dx++) { + for (int dz = -chunkRadius; dz <= chunkRadius; dz++) { + LevelChunk chunk = world.getChunk(centerChunkX + dx, centerChunkZ + dz); + for (Map.Entry entry : + chunk.getBlockEntities().entrySet()) { + BlockPos pos = entry.getKey(); + BlockEntity be = entry.getValue(); + + double cdx = pos.getX() + 0.5D - eye.x; + double cdy = pos.getY() + 0.5D - eye.y; + double cdz = pos.getZ() + 0.5D - eye.z; + double distSq = cdx * cdx + cdy * cdy + cdz * cdz; + if (distSq > radiusSq) continue; + + if (be instanceof EnderChestBlockEntity) { + if (distSq < nearestEnderDistSq + && (throughWalls || !isBlockObstructed(world, eye, pos, player))) { + nearestEnder = pos; + nearestEnderDistSq = distSq; + } + continue; + } + + if (!(be instanceof Container inv) || !(be instanceof IWhitelistProvider provider)) continue; + Map whitelists = provider.getWhitelists(); + if (whitelists == null || whitelists.isEmpty()) continue; + + if (!throughWalls && isBlockObstructed(world, eye, pos, player)) continue; + + candidates.add(new Candidate(pos, inv, whitelists, distSq)); + } + } + } + + // Mobile filtered containers: chest minecarts and chest boats are entities, not block entities, + // and their filters live client-side only, so they arrive in entityWhitelists keyed by UUID. + AABB box = player.getBoundingBox().inflate(radius); + for (Entity entity : world.getEntities(player, box, e -> e instanceof Container)) { + Map whitelists = entityWhitelists.get(entity.getUUID()); + if (whitelists == null || whitelists.isEmpty()) continue; + + Vec3 center = entity.getBoundingBox().getCenter(); + double distSq = center.distanceToSqr(eye); + if (distSq > radiusSq) continue; + if (!throughWalls && blockedToPoint(world, eye, center, player, null)) continue; + + candidates.add(new Candidate(entity.blockPosition(), (Container) entity, whitelists, distSq)); + } + + // Ender chest: the player's ender inventory, animated at the nearest reachable ender chest + // block, using the client-supplied ender filter. + if (nearestEnder != null && enderWhitelists != null && !enderWhitelists.isEmpty()) { + candidates.add( + new Candidate(nearestEnder, player.getEnderChestInventory(), enderWhitelists, nearestEnderDistSq)); + } + + candidates.sort(java.util.Comparator.comparingDouble(c -> c.distSq)); + return candidates; + } + + /** + * Sorts every stack in the player's main inventory into nearby containers whose filters list the + * item, nearest containers first. Sends an {@link AutoDepositResultPayload} describing every transfer. + */ + private static void performAutoDeposit( + ServerPlayer player, + int radius, + boolean throughWalls, + Map enderWhitelists, + Map> entityWhitelists) { + Level world = player.level(); + if (!(world instanceof ServerLevel)) return; + + List candidates = collectCandidates(player, radius, throughWalls, enderWhitelists, entityWhitelists); + + // 2. Deposit only the movable portion of each source stack. Inventory filters are client-local + // but already synced to this server for pickup enforcement; reuse that authoritative snapshot. + Inventory inventory = player.getInventory(); + Map playerFilters = ChestSeparatorsState.INVENTORY_FILTERS.get(player.getUUID()); + // Rehome loose non-hotbar stacks before deciding how many items can leave each filter. + io.github.marcsanzdev.chestseparators.util.InventorySlotRefill.refill(inventory, playerFilters); + // Preserve discovery order so the animation roughly mirrors inventory layout. + Map> moved = new java.util.LinkedHashMap<>(); + // Containers that actually received items, so only those get their groups re-sorted afterwards. + java.util.Set touched = java.util.Collections.newSetFromMap(new java.util.IdentityHashMap<>()); + + for (int i = 0; i < Inventory.INVENTORY_SIZE; i++) { + ItemStack stack = inventory.getItem(i); + if (stack.isEmpty()) continue; + int available = io.github.marcsanzdev.chestseparators.util.InventoryProtection + .movableCount(inventory, playerFilters, i); + if (available <= 0) continue; + ItemStack outgoing = stack.copyWithCount(available); + Item item = stack.getItem(); + String itemId = BuiltInRegistries.ITEM.getKey(item).toString(); + + for (Candidate candidate : candidates) { + if (outgoing.isEmpty()) break; + if (!containerListsItem(candidate.whitelists, itemId)) continue; + + int before = outgoing.getCount(); + insertRespectingFilter(candidate.inv, candidate.whitelists, outgoing, itemId); + int delta = before - outgoing.getCount(); + if (delta > 0) { + candidate.inv.setChanged(); + touched.add(candidate); + moved.computeIfAbsent(candidate.pos, k -> new java.util.LinkedHashMap<>()) + .merge(item, delta, Integer::sum); + } + } + int deposited = available - outgoing.getCount(); + if (deposited > 0) stack.shrink(deposited); + inventory.setItem(i, stack); + } + + // Auto-organize each container that received items: sort every filtered group by priority order. + for (Candidate candidate : touched) { + reorderFilteredGroups(candidate.inv, candidate.whitelists); + } + + inventory.setChanged(); + player.inventoryMenu.broadcastChanges(); + + // 3. Build the animation report. + if (NetworkManager.canPlayerReceive(player, AutoDepositResultPayload.TYPE)) { + NetworkManager.sendToPlayer(player, new AutoDepositResultPayload(buildFlights(moved))); + } + } + + /** + * Fills the player's inventory from the container they currently have open (the editor's "fill + * inventory" button): pulls every item any inventory filter lists, or — with Shift ({@code includeEmpty}) + * — everything into whatever free space is left. {@code animPos} is only the origin of the animation. + */ + private static void performFillFromOpenContainer( + ServerPlayer player, BlockPos animPos, boolean includeEmpty, boolean lockHotbar) { + if (!(player.level() instanceof ServerLevel)) return; + + // The open container's inventory: the first menu slot not backed by the player. + Container container = null; + for (net.minecraft.world.inventory.Slot s : player.containerMenu.slots) { + if (!(s.container instanceof Inventory)) { + container = s.container; + break; + } + } + if (container == null) return; + + Map invFilters = ChestSeparatorsState.INVENTORY_FILTERS.get(player.getUUID()); + Inventory inventory = player.getInventory(); + Map movedItems = new java.util.LinkedHashMap<>(); + + int size = container.getContainerSize(); + for (int slot = 0; slot < size; slot++) { + ItemStack stack = container.getItem(slot); + if (stack.isEmpty()) continue; + Item item = stack.getItem(); + String itemId = BuiltInRegistries.ITEM.getKey(item).toString(); + + // Pull items the inventory filters list; with Shift, pull everything (into free space). + if (!includeEmpty && !inventoryListsItem(invFilters, itemId)) continue; + + int take = stack.getCount(); + ItemStack portion = stack.copyWithCount(take); + if (includeEmpty) { + // Shift: pull everything into whatever free space is left (vanilla spill). + inventory.add(portion); + } else { + // No Shift: only top up / fill the slots whose filter lists this item — never overflow into + // unfiltered slots. Any surplus the filtered slots can't hold stays in the container. + insertRespectingFilter(inventory, invFilters, portion, itemId); + } + int delta = take - portion.getCount(); + if (delta > 0) { + stack.shrink(delta); + container.setItem(slot, stack); + movedItems.merge(item, delta, Integer::sum); + } + } + + // Auto-organize the inventory's filtered groups after a pull, so items land in priority order. + // Restricted to the MAIN inventory (0..INVENTORY_SIZE): armor and offhand slots are type-specific. + if (!movedItems.isEmpty() && invFilters != null) { + // Hotbar is slots 0-8; keep it out of the sort when the option is on so a held item never moves. + int firstSortable = lockHotbar ? 9 : 0; + Map mainFilters = new java.util.HashMap<>(); + for (Map.Entry e : invFilters.entrySet()) { + if (e.getKey() >= firstSortable && e.getKey() < Inventory.INVENTORY_SIZE) { + mainFilters.put(e.getKey(), e.getValue()); + } + } + reorderFilteredGroups(inventory, mainFilters); + } + + container.setChanged(); + inventory.setChanged(); + player.containerMenu.broadcastChanges(); + + Map> moved = new java.util.LinkedHashMap<>(); + if (!movedItems.isEmpty() && animPos != null) moved.put(animPos, movedItems); + if (NetworkManager.canPlayerReceive(player, AutoDepositResultPayload.TYPE)) { + NetworkManager.sendToPlayer(player, new AutoDepositResultPayload(buildFlights(moved), true)); + } + } + + /** Builds one animation flight per (item, container) pair from a moved-amount report. */ + private static List buildFlights(Map> moved) { + List flights = new ArrayList<>(); + for (Map.Entry> chestEntry : moved.entrySet()) { + for (Map.Entry itemEntry : chestEntry.getValue().entrySet()) { + ItemStack representative = new ItemStack(itemEntry.getKey(), itemEntry.getValue()); + flights.add(new AutoDepositResultPayload.Flight(representative, chestEntry.getKey())); + } + } + return flights; + } + + /** True when any of the player's inventory filters lists the item (so a Fill should pull it in). */ + private static boolean inventoryListsItem(Map invFilters, String itemId) { + if (invFilters == null) return false; + for (SlotWhitelist wl : invFilters.values()) { + if (wl.allowedItems().contains(itemId)) return true; + } + return false; + } + + /** True if any slot whitelist of the container lists the given item id. */ + private static boolean containerListsItem(Map whitelists, String itemId) { + for (SlotWhitelist wl : whitelists.values()) { + if (wl.allowedItems().contains(itemId)) return true; + } + return false; + } + + /** + * Inserts as much of {@code stack} as possible into the container, but only into slots whose + * filter explicitly lists the item: first merging onto matching stacks, then filling empty + * filtered slots. Mutates {@code stack}'s count in place. + */ + private static void insertRespectingFilter( + Container inv, Map whitelists, ItemStack stack, String itemId) { + int size = inv.getContainerSize(); + + // Phase 1: top up existing identical stacks in filtered slots. + for (int slot = 0; slot < size && !stack.isEmpty(); slot++) { + SlotWhitelist wl = whitelists.get(slot); + if (wl == null || !wl.allowedItems().contains(itemId)) continue; + ItemStack dest = inv.getItem(slot); + if (dest.isEmpty() || !ItemStack.isSameItemSameComponents(dest, stack)) continue; + int max = Math.min(inv.getMaxStackSize(dest), dest.getMaxStackSize()); + int space = max - dest.getCount(); + if (space <= 0) continue; + int move = Math.min(Math.min(space, stack.getCount()), + availableInboundRoom(inv, whitelists, slot, itemId)); + if (move <= 0) continue; + dest.grow(move); + stack.shrink(move); + } + + // Phase 2: drop the remainder into empty filtered slots, in the filter's priority order. + List emptySlots = new java.util.ArrayList<>(); + for (int slot = 0; slot < size; slot++) { + SlotWhitelist wl = whitelists.get(slot); + if (wl == null || !wl.allowedItems().contains(itemId)) continue; + if (!inv.getItem(slot).isEmpty() || !inv.canPlaceItem(slot, stack)) continue; + emptySlots.add(slot); + } + emptySlots.sort(java.util.Comparator.comparingInt( + (Integer slot) -> FilterPriority.slotPreference(whitelists, slot, itemId)) + .thenComparingInt(slot -> slot)); + for (int slot : emptySlots) { + if (stack.isEmpty()) break; + int max = Math.min(inv.getMaxStackSize(stack), stack.getMaxStackSize()); + int move = Math.min(Math.min(max, stack.getCount()), + availableInboundRoom(inv, whitelists, slot, itemId)); + if (move <= 0) continue; + inv.setItem(slot, stack.copyWithCount(move)); + stack.shrink(move); + } + } + + /** The per-group inbound cap applies only when filling the player's inventory, not storage. */ + private static int availableInboundRoom( + Container inv, Map whitelists, int destSlot, String itemId) { + if (!(inv instanceof Inventory) || whitelists == null) return Integer.MAX_VALUE; + SlotWhitelist filter = whitelists.get(destSlot); + if (filter == null || filter.targetCount() <= 0 || filter.groupId() == null) return Integer.MAX_VALUE; + + int held = 0; + for (Map.Entry entry : whitelists.entrySet()) { + if (!filter.groupId().equals(entry.getValue().groupId()) + || !entry.getValue().allowedItems().contains(itemId)) continue; + int slot = entry.getKey(); + if (slot < 0 || slot >= inv.getContainerSize()) continue; + ItemStack existing = inv.getItem(slot); + if (!existing.isEmpty() && BuiltInRegistries.ITEM.getKey(existing.getItem()).toString().equals(itemId)) { + held += existing.getCount(); + } + } + return io.github.marcsanzdev.chestseparators.util.InventoryTransferPolicy + .inboundRoom(filter.targetCount(), held); + } + + /** + * Re-lays every filtered group of {@code inv} so its stacks sit in the filter's priority order, packed + * from the group's first slot. Server-authoritative (direct {@link Container#setItem}) so nothing can + * desync or leave ghosts. Items the filter does not list keep their relative place at the end. + */ + private static void reorderFilteredGroups(Container inv, Map whitelists) { + if (inv == null || whitelists == null || whitelists.isEmpty()) return; + + // Collect each group's slot indices in ascending (normal Minecraft) slot order. + Map> groups = new java.util.LinkedHashMap<>(); + java.util.List keys = new ArrayList<>(whitelists.keySet()); + java.util.Collections.sort(keys); + for (int slot : keys) { + if (slot < 0 || slot >= inv.getContainerSize()) continue; + SlotWhitelist wl = whitelists.get(slot); + if (wl == null || wl.groupId() == null) continue; + groups.computeIfAbsent(wl.groupId(), g -> new ArrayList<>()).add(slot); + } + + for (java.util.List slots : groups.values()) { + if (slots.size() < 2) continue; + java.util.List order = whitelists.get(slots.get(0)).allowedItems(); + + // Snapshot the group's non-empty stacks (references), then sort by the filter's priority order. + java.util.List stacks = new ArrayList<>(); + for (int slot : slots) { + ItemStack st = inv.getItem(slot); + if (!st.isEmpty()) stacks.add(st); + } + if (stacks.isEmpty()) continue; + stacks.sort(java.util.Comparator.comparingInt(st -> { + int rank = order.indexOf( + BuiltInRegistries.ITEM.getKey(st.getItem()).toString()); + return rank < 0 ? Integer.MAX_VALUE : rank; + }) + // Tie-break equal-ranked stacks (the same item overflowing several of the group's slots) + // by count, fuller first — so a 65-item deposit ends as [64, 1] and not [1, 64]. + .thenComparing(java.util.Comparator.comparingInt(ItemStack::getCount).reversed())); + + // Re-lay packed from the first slot; any trailing slots become empty. + for (int i = 0; i < slots.size(); i++) { + inv.setItem(slots.get(i), i < stacks.size() ? stacks.get(i) : ItemStack.EMPTY); + } + } + inv.setChanged(); + } + + /** + * True if no unobstructed path exists from the player's eye to a free lateral side of the + * container. Access must come through one of the four horizontal sides (not the top or bottom). + */ + private static boolean isBlockObstructed(Level world, Vec3 eye, BlockPos chestPos, Entity player) { + List parts = getAssociatedPositions(world, chestPos); + for (BlockPos part : parts) { + for (Direction dir : Direction.Plane.HORIZONTAL) { + BlockPos neighbor = part.relative(dir); + if (parts.contains(neighbor)) continue; + // A clear line to this open side cell (ending in air) means the chest is reachable. + if (!blockedToPoint(world, eye, Vec3.atCenterOf(neighbor), player, null)) return false; + } + } + return true; + } + + /** + * True if a solid block lies between {@code eye} and {@code target}. Block positions in + * {@code allowed} (e.g. the target container's own blocks) are not treated as obstructions; pass + * {@code null} when the target is an empty point such as an entity's center. + */ + private static boolean blockedToPoint( + Level world, Vec3 eye, Vec3 target, Entity player, java.util.Collection allowed) { + BlockHitResult hit = world.clip( + new ClipContext(eye, target, ClipContext.Block.COLLIDER, ClipContext.Fluid.NONE, player)); + if (hit.getType() == HitResult.Type.MISS) return false; + return allowed == null || !allowed.contains(hit.getBlockPos()); + } + + /** + * Returns the direction toward the other half of a double chest, or null when the block is not + * part of a double chest (single chest, shulker box, barrel, or any non-chest container). + */ + private static Direction getDoubleChestNeighborDirection(BlockState state) { + if (!(state.getBlock() instanceof ChestBlock)) { + return null; + } + ChestType type = state.getValue(ChestBlock.TYPE); + if (type == ChestType.SINGLE) { + return null; + } + Direction facing = state.getValue(ChestBlock.FACING); + return type == ChestType.LEFT ? facing.getClockWise() : facing.getCounterClockWise(); + } + + /** + * Returns the effective inventory for the given position, merging both halves for double chests. + */ + private static Container getChestInventorySafe(Level world, BlockPos pos) { + BlockState state = world.getBlockState(pos); + BlockEntity be = world.getBlockEntity(pos); + + Direction neighborDir = getDoubleChestNeighborDirection(state); + if (neighborDir != null) { + ChestType type = state.getValue(ChestBlock.TYPE); + BlockEntity neighborBe = world.getBlockEntity(pos.relative(neighborDir)); + + if (be instanceof Container && neighborBe instanceof Container) { + if (type == ChestType.RIGHT) { + return new CompoundContainer((Container) be, (Container) neighborBe); + } else { + return new CompoundContainer((Container) neighborBe, (Container) be); + } + } + } + // Single chest, Shulker Box, or Barrel — return directly. + return be instanceof Container inv ? inv : null; + } + + /** + * Resolves all block positions occupied by a container (2 for double chests, 1 for all others). + */ + private static List getAssociatedPositions(Level world, BlockPos pos) { + List list = new ArrayList<>(); + list.add(pos); + + Direction neighborDir = getDoubleChestNeighborDirection(world.getBlockState(pos)); + if (neighborDir != null) { + list.add(pos.relative(neighborDir)); + } + return list; + } +} diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/network/ShulkerUUIDPayload.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/network/ShulkerUUIDPayload.java new file mode 100644 index 0000000..de7f78e --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/network/ShulkerUUIDPayload.java @@ -0,0 +1,26 @@ +package io.github.marcsanzdev.chestseparators.network; + +import java.util.UUID; +import net.minecraft.network.RegistryFriendlyByteBuf; +import net.minecraft.network.codec.StreamCodec; +import net.minecraft.network.protocol.common.custom.CustomPacketPayload; +import net.minecraft.resources.Identifier; + +// Defines the network packet responsible for transmitting the Shulker Box UUID +// from the server to the client. +public record ShulkerUUIDPayload(UUID shulkerUUID) implements CustomPacketPayload { + + public static final CustomPacketPayload.Type TYPE = new CustomPacketPayload.Type<>( + Identifier.fromNamespaceAndPath("chestseparators", "shulker_uuid")); + + // Custom codec utilizing lambda expressions to ensure absolute compatibility + // without relying on potentially unstable vanilla UUID codec mappings. + public static final StreamCodec CODEC = StreamCodec.ofMember( + (ShulkerUUIDPayload payload, RegistryFriendlyByteBuf buf) -> buf.writeUUID(payload.shulkerUUID()), + (RegistryFriendlyByteBuf buf) -> new ShulkerUUIDPayload(buf.readUUID())); + + @Override + public CustomPacketPayload.Type type() { + return TYPE; + } +} diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/network/SortOpenFiltersPayload.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/network/SortOpenFiltersPayload.java new file mode 100644 index 0000000..6ca8b6a --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/network/SortOpenFiltersPayload.java @@ -0,0 +1,25 @@ +package io.github.marcsanzdev.chestseparators.network; + +import net.minecraft.network.RegistryFriendlyByteBuf; +import net.minecraft.network.codec.StreamCodec; +import net.minecraft.network.protocol.common.custom.CustomPacketPayload; +import net.minecraft.resources.Identifier; + +/** + * Client-to-Server request sent right after a "push into the open chest" deposit, asking the server to + * re-sort the open container's filtered groups by their priority order. Carries no data: it always + * targets whatever container the sending player currently has open. + */ +public record SortOpenFiltersPayload() implements CustomPacketPayload { + + public static final CustomPacketPayload.Type TYPE = new CustomPacketPayload.Type<>( + Identifier.fromNamespaceAndPath("chestseparators", "sort_open_filters")); + + public static final StreamCodec CODEC = + StreamCodec.unit(new SortOpenFiltersPayload()); + + @Override + public CustomPacketPayload.Type type() { + return TYPE; + } +} diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/network/WhitelistPayload.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/network/WhitelistPayload.java new file mode 100644 index 0000000..182aa8e --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/network/WhitelistPayload.java @@ -0,0 +1,50 @@ +package io.github.marcsanzdev.chestseparators.network; + +import io.github.marcsanzdev.chestseparators.data.SlotWhitelist; +import java.util.HashMap; +import java.util.Map; +import net.minecraft.core.BlockPos; +import net.minecraft.network.RegistryFriendlyByteBuf; +import net.minecraft.network.codec.StreamCodec; +import net.minecraft.network.protocol.common.custom.CustomPacketPayload; +import net.minecraft.resources.Identifier; + +// Payload for synchronizing whitelist data between the Server and the Client. +// Used bidirectionally (C2S for saving, S2C for loading the GUI). +public record WhitelistPayload(BlockPos pos, Map whitelists) implements CustomPacketPayload { + + public static final CustomPacketPayload.Type TYPE = new CustomPacketPayload.Type<>( + Identifier.fromNamespaceAndPath("chestseparators", "whitelist_sync")); + + public static final StreamCodec CODEC = + StreamCodec.ofMember(WhitelistPayload::write, WhitelistPayload::new); + + private WhitelistPayload(RegistryFriendlyByteBuf buf) { + this(buf.readBlockPos(), readMap(buf)); + } + + private void write(RegistryFriendlyByteBuf buf) { + buf.writeBlockPos(this.pos); + buf.writeInt(this.whitelists.size()); + for (Map.Entry entry : this.whitelists.entrySet()) { + buf.writeInt(entry.getKey()); + SlotWhitelist.PACKET_CODEC.encode(buf, entry.getValue()); + } + } + + private static Map readMap(RegistryFriendlyByteBuf buf) { + int size = buf.readInt(); + Map map = new HashMap<>(); + for (int i = 0; i < size; i++) { + int key = buf.readInt(); + SlotWhitelist value = SlotWhitelist.PACKET_CODEC.decode(buf); + map.put(key, value); + } + return map; + } + + @Override + public CustomPacketPayload.Type type() { + return TYPE; + } +} diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/network/WhitelistRequestPayload.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/network/WhitelistRequestPayload.java new file mode 100644 index 0000000..06af1be --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/network/WhitelistRequestPayload.java @@ -0,0 +1,30 @@ +package io.github.marcsanzdev.chestseparators.network; + +import net.minecraft.core.BlockPos; +import net.minecraft.network.RegistryFriendlyByteBuf; +import net.minecraft.network.codec.StreamCodec; +import net.minecraft.network.protocol.common.custom.CustomPacketPayload; +import net.minecraft.resources.Identifier; + +// Client-to-Server request packet to fetch whitelist data for a specific chest. +public record WhitelistRequestPayload(BlockPos pos) implements CustomPacketPayload { + + public static final CustomPacketPayload.Type TYPE = new CustomPacketPayload.Type<>( + Identifier.fromNamespaceAndPath("chestseparators", "whitelist_request")); + + public static final StreamCodec CODEC = + StreamCodec.ofMember(WhitelistRequestPayload::write, WhitelistRequestPayload::new); + + private WhitelistRequestPayload(RegistryFriendlyByteBuf buf) { + this(buf.readBlockPos()); + } + + private void write(RegistryFriendlyByteBuf buf) { + buf.writeBlockPos(this.pos); + } + + @Override + public CustomPacketPayload.Type type() { + return TYPE; + } +} diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/network/WhitelistS2CPayload.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/network/WhitelistS2CPayload.java new file mode 100644 index 0000000..a85380f --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/network/WhitelistS2CPayload.java @@ -0,0 +1,52 @@ +package io.github.marcsanzdev.chestseparators.network; + +import io.github.marcsanzdev.chestseparators.data.SlotWhitelist; +import java.util.HashMap; +import java.util.Map; +import net.minecraft.core.BlockPos; +import net.minecraft.network.RegistryFriendlyByteBuf; +import net.minecraft.network.codec.StreamCodec; +import net.minecraft.network.protocol.common.custom.CustomPacketPayload; +import net.minecraft.resources.Identifier; + +// Server -> Client broadcast of a block container's whitelist (open push / re-sync to other viewers). +// A separate payload ID from the C2S {@link WhitelistPayload} because NeoForge (via Architectury) forbids +// registering one payload id for both directions; Fabric tolerated it but NeoForge does not. +public record WhitelistS2CPayload(BlockPos pos, Map whitelists) + implements CustomPacketPayload { + + public static final CustomPacketPayload.Type TYPE = new CustomPacketPayload.Type<>( + Identifier.fromNamespaceAndPath("chestseparators", "whitelist_sync_s2c")); + + public static final StreamCodec CODEC = + StreamCodec.ofMember(WhitelistS2CPayload::write, WhitelistS2CPayload::new); + + private WhitelistS2CPayload(RegistryFriendlyByteBuf buf) { + this(buf.readBlockPos(), readMap(buf)); + } + + private void write(RegistryFriendlyByteBuf buf) { + buf.writeBlockPos(this.pos); + buf.writeInt(this.whitelists.size()); + for (Map.Entry entry : this.whitelists.entrySet()) { + buf.writeInt(entry.getKey()); + SlotWhitelist.PACKET_CODEC.encode(buf, entry.getValue()); + } + } + + private static Map readMap(RegistryFriendlyByteBuf buf) { + int size = buf.readInt(); + Map map = new HashMap<>(); + for (int i = 0; i < size; i++) { + int key = buf.readInt(); + SlotWhitelist value = SlotWhitelist.PACKET_CODEC.decode(buf); + map.put(key, value); + } + return map; + } + + @Override + public CustomPacketPayload.Type type() { + return TYPE; + } +} diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/registry/ChestSeparatorsComponents.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/registry/ChestSeparatorsComponents.java new file mode 100644 index 0000000..8a66584 --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/registry/ChestSeparatorsComponents.java @@ -0,0 +1,39 @@ +package io.github.marcsanzdev.chestseparators.registry; + +import com.mojang.serialization.Codec; +import dev.architectury.registry.registries.DeferredRegister; +import dev.architectury.registry.registries.RegistrySupplier; +import io.github.marcsanzdev.chestseparators.AbsoluteOrder; +import io.github.marcsanzdev.chestseparators.data.SlotWhitelist; +import java.util.Map; +import net.minecraft.core.component.DataComponentType; +import net.minecraft.core.registries.Registries; + +/** + * Custom Data Components, registered through Architectury's {@link DeferredRegister} so the same code + * works on every loader. Registering the whitelist map as a persistent component is what makes the game + * preserve a container's filters when it is broken and re-placed (the component rides on the ItemStack). + */ +public final class ChestSeparatorsComponents { + + private ChestSeparatorsComponents() {} + + public static final DeferredRegister> COMPONENTS = + DeferredRegister.create(AbsoluteOrder.MOD_ID, Registries.DATA_COMPONENT_TYPE); + + public static final RegistrySupplier> SHULKER_UUID = COMPONENTS.register( + "shulker_uuid", + () -> DataComponentType.builder().persistent(Codec.STRING).build()); + + // Component mapping slot indices to their whitelist configurations. Persisted natively so the game + // preserves the filters when containers are broken or moved. + public static final RegistrySupplier>> SLOT_WHITELISTS = + COMPONENTS.register("slot_whitelists", () -> DataComponentType.>builder() + .persistent(SlotWhitelist.MAP_CODEC) + .build()); + + /** Flushes the deferred registrations. Called once from the common bootstrap. */ + public static void initialize() { + COMPONENTS.register(); + } +} diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/util/ChestPosStorage.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/util/ChestPosStorage.java new file mode 100644 index 0000000..ee62b7f --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/util/ChestPosStorage.java @@ -0,0 +1,39 @@ +package io.github.marcsanzdev.chestseparators.util; + +import java.util.UUID; +import net.minecraft.core.BlockPos; + +// Functions as a transient state container for context propagation across disjoint system boundaries. +// Specifically designed to bridge the gap between the initial player interaction event (ClientPlayerInteractionManager) +// and the subsequent GUI initialization (HandledScreen), where direct parameter passing is restricted by the vanilla +// architecture. +public class ChestPosStorage { + + // Buffer for the coordinate vectors of static block-entities (Chests, Barrels, Shulker Boxes). + // Note: Shulker Boxes will ignore this value and use the UUID system instead. + public static BlockPos lastClickedPos; + + // Stores the registry key of the dimension where the interaction occurred. + // Necessary to distinguish between identical coordinates in different worlds (Overworld vs Nether). + public static String lastClickedDimension; + + // --- ENTITY CONTEXT EXTENSIONS --- + + // Unique identifier for mobile inventory holders (e.g., Donkeys, Llamas, Chest Minecarts). + // Required because entities lack fixed BlockPos coordinates for persistent data keying. + public static UUID lastClickedEntityUUID; + + // Mode discriminator flag indicating whether the current UI context belongs to a dynamic entity + // or a static block. Used by the ConfigManager to select the appropriate loading strategy. + public static boolean isEntityOpened = false; + + // True when the opened entity is a chest/hopper minecart. Hoppers can insert into these, so the mod + // enables the Hopper Insert rule for them and syncs their filter to the server for enforcement. + public static boolean isMinecartEntity = false; + + // --- NETWORK EXTENSIONS --- + + // Transient storage for the incoming Shulker Box UUID received via the S2C network packet. + // Populated precisely when the server confirms the container has been opened. + public static UUID lastOpenedShulkerUUID = null; +} diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/util/ClickTracker.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/util/ClickTracker.java new file mode 100644 index 0000000..dc80bf6 --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/util/ClickTracker.java @@ -0,0 +1,16 @@ +package io.github.marcsanzdev.chestseparators.util; + +// Tracks the current slot interaction type using ThreadLocal to prevent +// Client and Server threads from overwriting each other's state in singleplayer. +public class ClickTracker { + public static final ThreadLocal IS_SHIFT_CLICK = ThreadLocal.withInitial(() -> false); + + // When set, the mayPlace mixins skip the mod's whitelist enforcement so the editor can probe a + // slot's *vanilla* restriction (real armor checks) without the saved filter blocking the sentinel. + public static final ThreadLocal BYPASS_ENFORCEMENT = ThreadLocal.withInitial(() -> false); + + // The [start, end) slot range of the shift-click insertion currently running, or null outside one. + // The filter-priority rule needs it so it only ever defers to a dedicated slot that the current + // insertion can actually reach (deferring to a slot outside the range would strand the item). + public static final ThreadLocal INSERT_RANGE = new ThreadLocal<>(); +} diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/util/FilterPriority.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/util/FilterPriority.java new file mode 100644 index 0000000..e2bd40c --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/util/FilterPriority.java @@ -0,0 +1,211 @@ +package io.github.marcsanzdev.chestseparators.util; + +import io.github.marcsanzdev.chestseparators.ChestSeparatorsState; +import io.github.marcsanzdev.chestseparators.access.IWhitelistProvider; +import io.github.marcsanzdev.chestseparators.data.SlotWhitelist; +import java.util.Map; +import net.minecraft.core.NonNullList; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.world.Container; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.inventory.Slot; +import net.minecraft.world.item.ItemStack; + +/** + * Slot-ordering rule shared by every automatic insertion path (shift-click quick-move and hopper + * transfers): an item that has a dedicated filter slot goes into that slot first, and when a group owns + * several slots the filter's item order decides which one — the list the player arranges by dragging is + * a priority order, not just a display order. + * + *

The rule is expressed as a refusal: a slot with no matching filter declines the item + * while some dedicated slot can still take it. Vanilla then keeps scanning and lands the item in the + * dedicated slot on its own. Doing it this way — instead of moving stacks around ourselves — matters: + * vanilla performs the actual transfer, so the client's predicted result and the server's authoritative + * result are produced by the very same code and agree. Manually relocating stacks desynced them and + * left ghost items behind. + * + *

The refusal is always conditional on a dedicated slot having room, so once those are full the + * item falls back to normal slots and can never get stuck. + */ +public final class FilterPriority { + + private FilterPriority() {} + + /** Every filter of this inventory, keyed by slot index, or null when it carries none. */ + private static Map whitelistsOf(Container inventory) { + if (inventory instanceof IWhitelistProvider provider) { + return provider.getWhitelists(); + } + if (inventory instanceof Inventory playerInventory) { + return ChestSeparatorsState.INVENTORY_FILTERS.get(playerInventory.player.getUUID()); + } + return null; + } + + /** The filter attached to a slot of this inventory, or null when it has none. */ + private static SlotWhitelist whitelistFor(Container inventory, int slotIndex) { + Map whitelists = whitelistsOf(inventory); + return whitelists == null ? null : whitelists.get(slotIndex); + } + + /** True when this slot's filter explicitly lists the item — i.e. the slot is dedicated to it. */ + private static boolean isDedicatedTo(Container inventory, int slotIndex, String itemId) { + SlotWhitelist whitelist = whitelistFor(inventory, slotIndex); + return whitelist != null && whitelist.allowedItems().contains(itemId); + } + + /** How many slots of the same group come before this one, i.e. its rank inside the group. */ + private static int positionInGroup(Map whitelists, int slotIndex, SlotWhitelist whitelist) { + if (whitelists == null || whitelist.groupId() == null) return 0; + int position = 0; + for (Map.Entry entry : whitelists.entrySet()) { + if (entry.getKey() < slotIndex + && whitelist.groupId().equals(entry.getValue().groupId())) position++; + } + return position; + } + + /** + * How well a dedicated slot suits this item, lower being better, or {@link Integer#MAX_VALUE} when the + * slot's filter does not list the item at all. The filter's item list is an ordered priority — the + * player arranges it by dragging — so the first item of the list wants the group's first slot, the + * second item the second slot, and so on. A slot is scored by how far its position in the group is from + * the item's position in the list; ties keep the earlier slot. + * + *

Groups smaller than their item list simply run out of exact matches and fall back to the nearest + * slot, which is the same order read from a shorter row. Shared by every placement path so the shift, + * hopper, grab and deposit routes all lay items out in the same order. + */ + public static int slotPreference(Map whitelists, int slotIndex, String itemId) { + if (whitelists == null) return Integer.MAX_VALUE; + SlotWhitelist whitelist = whitelists.get(slotIndex); + if (whitelist == null) return Integer.MAX_VALUE; + int itemRank = whitelist.allowedItems().indexOf(itemId); + if (itemRank < 0) return Integer.MAX_VALUE; + return Math.abs(positionInGroup(whitelists, slotIndex, whitelist) - itemRank); + } + + private static int preference(Container inventory, int slotIndex, String itemId) { + return slotPreference(whitelistsOf(inventory), slotIndex, itemId); + } + + /** + * Occupancy-aware home score for the shift-click path — lower is better, {@link Integer#MAX_VALUE} when + * the slot's filter does not list the item. Unlike {@link #slotPreference}, which permanently reserves + * the group's first slots for higher-priority items even when they are absent, this ranks a slot by + * where the item should sit given what the group ACTUALLY holds right now: an item sits just after every + * higher-priority item currently present, so when none are present it packs to the group's first slot in + * normal slot order. (Fixes emeralds landing in the second slot of a [diamond, emerald] filter while no + * diamonds are stored.) + */ + private static int occupancyPreference(Slot slot, String itemId) { + Container inv = slot.container; + Map whitelists = whitelistsOf(inv); + if (whitelists == null) return Integer.MAX_VALUE; + SlotWhitelist whitelist = whitelists.get(slot.getContainerSlot()); + if (whitelist == null) return Integer.MAX_VALUE; + int itemRank = whitelist.allowedItems().indexOf(itemId); + if (itemRank < 0) return Integer.MAX_VALUE; + + int position = 0; // how many group slots come before this one (its index inside the group) + int higherPresent = 0; // group slots currently holding a strictly higher-priority item + for (Map.Entry entry : whitelists.entrySet()) { + SlotWhitelist other = entry.getValue(); + if (whitelist.groupId() == null || !whitelist.groupId().equals(other.groupId())) continue; + int idx = entry.getKey(); + if (idx < slot.getContainerSlot()) position++; + if (idx == slot.getContainerSlot()) continue; + if (idx < 0 || idx >= inv.getContainerSize()) continue; + ItemStack existing = inv.getItem(idx); + if (existing.isEmpty()) continue; + int occRank = other.allowedItems() + .indexOf(BuiltInRegistries.ITEM.getKey(existing.getItem()).toString()); + if (occRank >= 0 && occRank < itemRank) higherPresent++; + } + return Math.abs(position - higherPresent); + } + + /** + * True when the slot at {@code (otherInv, otherIndex)} is a strictly better home for the item than + * {@code (candidateInv, candidateIndex)}. Strictness matters: it makes "better than" a total order, so + * two slots can never both defer to each other and leave the item homeless. + */ + private static boolean isBetterFor( + Container otherInv, + int otherIndex, + Container candidateInv, + int candidateIndex, + String itemId, + boolean otherComesFirst) { + int otherPreference = preference(otherInv, otherIndex, itemId); + int candidatePreference = preference(candidateInv, candidateIndex, itemId); + if (otherPreference != candidatePreference) return otherPreference < candidatePreference; + return otherComesFirst; + } + + /** True when a slot holding {@code existing} could still accept part of {@code incoming}. */ + private static boolean hasRoom(ItemStack existing, ItemStack incoming, int maxCount) { + if (existing.isEmpty()) return true; + return ItemStack.isSameItemSameComponents(existing, incoming) && existing.getCount() < maxCount; + } + + /** + * Shift-click path. True when {@code candidate} should decline {@code stack} because another slot + * inside the target range [{@code start}, {@code end}) is a better home for it — dedicated where the + * candidate is not, or ranked ahead of it by the filter's order — and still has room. + */ + public static boolean shouldDefer(NonNullList slots, int start, int end, Slot candidate, ItemStack stack) { + if (stack.isEmpty()) return false; + String itemId = BuiltInRegistries.ITEM.getKey(stack.getItem()).toString(); + + boolean candidateIsDedicated = isDedicatedTo(candidate.container, candidate.getContainerSlot(), itemId); + int candidatePreference = candidateIsDedicated ? occupancyPreference(candidate, itemId) : Integer.MAX_VALUE; + int candidatePosition = candidateIsDedicated ? slots.indexOf(candidate) : -1; + int from = Math.max(0, start); + int to = Math.min(end, slots.size()); + for (int i = from; i < to; i++) { + Slot other = slots.get(i); + if (other == candidate) continue; + if (!isDedicatedTo(other.container, other.getContainerSlot(), itemId)) continue; + // A dedicated candidate only steps aside for a slot the filter's order ranks above it given the + // group's current contents (occupancy-aware, so absent higher-priority items never reserve a + // slot); an undedicated candidate steps aside for any dedicated slot at all. The strict + // preference-then-index comparison keeps this a total order, so two slots can't both defer. + if (candidateIsDedicated) { + int otherPreference = occupancyPreference(other, itemId); + boolean otherIsBetter = otherPreference < candidatePreference + || (otherPreference == candidatePreference && i < candidatePosition); + if (!otherIsBetter) continue; + } + if (hasRoom(other.getItem(), stack, other.getMaxStackSize(stack)) && other.mayPlace(stack)) { + return true; + } + } + return false; + } + + /** + * Hopper path. True when slot {@code candidateSlot} of {@code inventory} should decline + * {@code stack} because another slot of the same inventory is a better home for it and still has room. + */ + public static boolean shouldDefer(Container inventory, int candidateSlot, ItemStack stack) { + if (stack.isEmpty()) return false; + String itemId = BuiltInRegistries.ITEM.getKey(stack.getItem()).toString(); + + boolean candidateIsDedicated = isDedicatedTo(inventory, candidateSlot, itemId); + + int maxCount = Math.min(inventory.getMaxStackSize(stack), stack.getMaxStackSize()); + for (int i = 0; i < inventory.getContainerSize(); i++) { + if (i == candidateSlot) continue; + if (!isDedicatedTo(inventory, i, itemId)) continue; + // Same rule as the shift-click path: a dedicated slot yields only to one the filter's order + // ranks above it. + if (candidateIsDedicated && !isBetterFor(inventory, i, inventory, candidateSlot, itemId, i < candidateSlot)) + continue; + if (hasRoom(inventory.getItem(i), stack, maxCount) && inventory.canPlaceItem(i, stack)) { + return true; + } + } + return false; + } +} diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/util/InventoryPickupContext.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/util/InventoryPickupContext.java new file mode 100644 index 0000000..2e7bf02 --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/util/InventoryPickupContext.java @@ -0,0 +1,14 @@ +package io.github.marcsanzdev.chestseparators.util; + +import java.util.UUID; + +/** Distinguishes an ItemEntity ground pickup from a deliberate inventory operation on this thread. */ +public final class InventoryPickupContext { + private static final ThreadLocal PICKING_UP = new ThreadLocal<>(); + + private InventoryPickupContext() {} + + public static void begin(UUID playerId) { PICKING_UP.set(playerId); } + public static void end() { PICKING_UP.remove(); } + public static boolean isGroundPickup(UUID playerId) { return playerId.equals(PICKING_UP.get()); } +} diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/util/InventoryProtection.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/util/InventoryProtection.java new file mode 100644 index 0000000..4d38ff8 --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/util/InventoryProtection.java @@ -0,0 +1,52 @@ +package io.github.marcsanzdev.chestseparators.util; + +import io.github.marcsanzdev.chestseparators.data.SlotWhitelist; +import java.util.Map; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.item.ItemStack; + +/** + * Protects item counts assigned to player-inventory filters from automated outbound transfers. + * Only matching items are protected; a wrong item in a filtered slot can still be deposited. + * A positive target is shared by all slots of one filter group, per allowed item type. + */ +public final class InventoryProtection { + private InventoryProtection() {} + + public static int movableCount(Inventory inventory, Map filters, int slot) { + return movableCount(inventory.getContainerSize(), inventory::getItem, filters, slot); + } + + /** Preview counterpart: uses the post-refill snapshot, not the current live inventory. */ + public static int movableCount(java.util.List items, Map filters, int slot) { + return movableCount(items.size(), items::get, filters, slot); + } + + private static int movableCount(int size, java.util.function.IntFunction get, + Map filters, int slot) { + if (slot < 0 || slot >= size) return 0; + ItemStack source = get.apply(slot); + if (source.isEmpty()) return 0; + if (filters == null) return source.getCount(); + SlotWhitelist filter = filters.get(slot); + if (filter == null) return source.getCount(); + + String itemId = BuiltInRegistries.ITEM.getKey(source.getItem()).toString(); + if (!filter.allowedItems().contains(itemId)) return source.getCount(); + if (filter.targetCount() <= 0) return 0; + + int earlier = 0; + for (int i = 0; i < slot; i++) { + SlotWhitelist previous = filters.get(i); + if (previous == null || !filter.groupId().equals(previous.groupId()) + || !previous.allowedItems().contains(itemId)) continue; + ItemStack existing = get.apply(i); + if (!existing.isEmpty() && BuiltInRegistries.ITEM.getKey(existing.getItem()).toString().equals(itemId)) { + earlier += existing.getCount(); + } + } + return InventoryTransferPolicy.movableCount(source.getCount(), filter.targetCount(), earlier); + } + +} diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/util/InventoryRetentionSteps.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/util/InventoryRetentionSteps.java new file mode 100644 index 0000000..f476f23 --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/util/InventoryRetentionSteps.java @@ -0,0 +1,63 @@ +package io.github.marcsanzdev.chestseparators.util; + +/** + * Continuous Keep slider mapping, with five visible reference marks. + * Left to right: All, 64, 32, 16, 1. All (0) remains distinct from exactly 64. + * Within the numeric portion, interpolation allows EVERY integer from 1 to 64. + */ +public final class InventoryRetentionSteps { + private static final int[] MARKERS = {0, 64, 32, 16, 1}; + + private InventoryRetentionSteps() {} + + public static int count() { + return MARKERS.length; + } + + public static int valueForStop(int index) { + return MARKERS[Math.max(0, Math.min(MARKERS.length - 1, index))]; + } + + /** Dragging exactly to the left end selects All; its neighboring region selects 64. */ + public static int valueAtFraction(double fraction) { + double f = Math.max(0.0, Math.min(1.0, fraction)); + if (f == 0.0) return 0; + if (f <= 0.25) return 64; + if (f <= 0.50) return 64 - (int) Math.round((f - 0.25) / 0.25 * 32.0); + if (f <= 0.75) return 32 - (int) Math.round((f - 0.50) / 0.25 * 16.0); + return Math.max(1, 16 - (int) Math.round((f - 0.75) / 0.25 * 15.0)); + } + + /** Inverse mapping: a saved custom quantity is drawn at its true position, not snapped to a mark. */ + public static double fractionForValue(int value) { + if (value <= 0) return 0.0; + if (value >= 64) return 0.25; + if (value >= 32) return 0.25 + (64 - value) / 32.0 * 0.25; + if (value >= 16) return 0.50 + (32 - value) / 16.0 * 0.25; + return 0.75 + (16 - value) / 15.0 * 0.25; + } + + /** + * Return the 64/32/16 stack-size detent nearest the pointer, or -1 outside the + * requested pixel radius. All and 1 remain ordinary endpoints rather than magnetic + * marks. Callers use a smaller radius to enter a detent than to leave it (hysteresis). + * Actual values between detents are still selectable with dragging or the wheel. + */ + public static int detentNearFraction(double fraction, double trackWidth, double radiusPixels) { + if (trackWidth <= 0 || radiusPixels < 0) return -1; + double pointerX = Math.max(0.0, Math.min(1.0, fraction)) * trackWidth; + for (int value : new int[] {64, 32, 16}) { + if (Math.abs(pointerX - fractionForValue(value) * trackWidth) <= radiusPixels) { + return value; + } + } + return -1; + } + + /** Scroll wheel gives exact counts even when the game uses a large GUI scale. */ + public static int adjustByWheel(int value, int steps) { + if (steps == 0) return value; + int start = value <= 0 ? 64 : Math.max(1, Math.min(64, value)); + return Math.max(1, Math.min(64, start + steps)); + } +} diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/util/InventorySlotRefill.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/util/InventorySlotRefill.java new file mode 100644 index 0000000..568aff6 --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/util/InventorySlotRefill.java @@ -0,0 +1,105 @@ +package io.github.marcsanzdev.chestseparators.util; + +import io.github.marcsanzdev.chestseparators.data.SlotWhitelist; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.function.ToIntFunction; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.item.ItemStack; + +/** + * Refills dedicated MAIN inventory slots from unfiltered MAIN slots, without touching hotbar, + * armor, offhand or other filtered sources. The same algorithm runs on an inventory snapshot + * for the Push preview, so it can accurately predict the action without mutating live items. + */ +public final class InventorySlotRefill { + private InventorySlotRefill() {} + + public static boolean refill(Inventory inventory, Map filters) { + if (filters == null || filters.isEmpty()) return false; + List projected = new ArrayList<>(Inventory.INVENTORY_SIZE); + for (int i = 0; i < Inventory.INVENTORY_SIZE; i++) { + projected.add(inventory.getItem(i).copy()); + } + if (!refillStacks(projected, filters, inventory::getMaxStackSize)) return false; + for (int i = 9; i < Inventory.INVENTORY_SIZE; i++) { + ItemStack before = inventory.getItem(i); + ItemStack after = projected.get(i); + if (before.getCount() != after.getCount() + || !ItemStack.isSameItemSameComponents(before, after)) { + inventory.setItem(i, after); + } + } + inventory.setChanged(); + return true; + } + + /** Mutates ONLY the supplied copied stacks. Raw player inventory indices are used throughout. */ + public static boolean refillStacks( + List stacks, + Map filters, + ToIntFunction inventoryMax) { + if (filters == null || filters.isEmpty() || stacks.size() < Inventory.INVENTORY_SIZE) return false; + boolean changed = false; + // First finish matching, partly-filled filter slots, then occupy empty filter slots. + for (int target = 9; target < Inventory.INVENTORY_SIZE; target++) { + SlotWhitelist filter = filters.get(target); + if (filter == null || filter.allowedItems().isEmpty()) continue; + ItemStack home = stacks.get(target); + if (home.isEmpty() || !filter.allowedItems().contains(itemId(home))) continue; + changed |= topUp(stacks, filters, target, home, inventoryMax); + } + for (int target = 9; target < Inventory.INVENTORY_SIZE; target++) { + SlotWhitelist filter = filters.get(target); + if (filter == null || filter.allowedItems().isEmpty() || !stacks.get(target).isEmpty()) continue; + for (String wanted : filter.allowedItems()) { + int source = findSource(stacks, filters, target, wanted, null); + if (source < 0) continue; + stacks.set(target, stacks.get(source).copy()); + stacks.set(source, ItemStack.EMPTY); + changed = true; + changed |= topUp(stacks, filters, target, stacks.get(target), inventoryMax); + break; + } + } + return changed; + } + + private static boolean topUp(List stacks, Map filters, + int target, ItemStack home, ToIntFunction inventoryMax) { + boolean changed = false; + String id = itemId(home); + int limit = Math.min(home.getMaxStackSize(), inventoryMax.applyAsInt(home)); + while (home.getCount() < limit) { + int source = findSource(stacks, filters, target, id, home); + if (source < 0) break; + ItemStack extra = stacks.get(source); + int take = Math.min(limit - home.getCount(), extra.getCount()); + if (take <= 0) break; + home.grow(take); + extra.shrink(take); + stacks.set(source, extra.isEmpty() ? ItemStack.EMPTY : extra); + stacks.set(target, home); + changed = true; + } + return changed; + } + + private static int findSource(List stacks, Map filters, + int target, String itemId, ItemStack matching) { + for (int raw = 9; raw < Inventory.INVENTORY_SIZE; raw++) { + if (raw == target || filters.containsKey(raw)) continue; + ItemStack candidate = stacks.get(raw); + if (candidate.isEmpty() || !itemId(candidate).equals(itemId)) continue; + if (matching != null && !ItemStack.isSameItemSameComponents(matching, candidate)) continue; + return raw; + } + return -1; + } + + private static String itemId(ItemStack stack) { + return BuiltInRegistries.ITEM.getKey(stack.getItem()).toString(); + } +} diff --git a/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/util/InventoryTransferPolicy.java b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/util/InventoryTransferPolicy.java new file mode 100644 index 0000000..4306f8e --- /dev/null +++ b/multiloader-26.3/common/src/main/java/io/github/marcsanzdev/chestseparators/util/InventoryTransferPolicy.java @@ -0,0 +1,23 @@ +package io.github.marcsanzdev.chestseparators.util; + +/** Pure quantity arithmetic shared by client previews and server transfers. */ +public final class InventoryTransferPolicy { + private InventoryTransferPolicy() {} + + /** + * How many items may leave one matching, filtered stack. + * A target of zero is the legacy behaviour: keep all items in the filtered slot. + * Positive targets are retained across the group's earlier slots, not once per slot. + */ + public static int movableCount(int stackCount, int targetCount, int earlierMatchingCount) { + if (stackCount <= 0) return 0; + if (targetCount <= 0) return 0; + int neededHere = Math.max(0, targetCount - Math.max(0, earlierMatchingCount)); + return Math.max(0, stackCount - neededHere); + } + + /** Remaining room under a filter target; zero means there is no quantity cap on inbound pulls. */ + public static int inboundRoom(int targetCount, int currentlyHeld) { + return targetCount <= 0 ? Integer.MAX_VALUE : Math.max(0, targetCount - Math.max(0, currentlyHeld)); + } +} diff --git a/multiloader-26.3/common/src/main/resources/absoluteorder.accesswidener b/multiloader-26.3/common/src/main/resources/absoluteorder.accesswidener new file mode 100644 index 0000000..9ab2173 --- /dev/null +++ b/multiloader-26.3/common/src/main/resources/absoluteorder.accesswidener @@ -0,0 +1 @@ +accessWidener v2 named diff --git a/multiloader-26.3/common/src/main/resources/absoluteorder.mixins.json b/multiloader-26.3/common/src/main/resources/absoluteorder.mixins.json new file mode 100644 index 0000000..55a6e96 --- /dev/null +++ b/multiloader-26.3/common/src/main/resources/absoluteorder.mixins.json @@ -0,0 +1,53 @@ +{ + "required": true, + "minVersion": "0.8", + "package": "io.github.marcsanzdev.chestseparators.mixin", + "compatibilityLevel": "JAVA_25", + "mixins": [ + "AbstractContainerMenuAccessor", + "ArmorEquipFilterMixin", + "ArmorSlotFilterMixin", + "BlockDropMixin", + "BlockEntityComponentMixin", + "BlockEntityMixin", + "ChestBoatEntityMixin", + "DoubleInventoryMixin", + "HopperBlockEntityMixin", + "ItemEntityPickupContextMixin", + "InventoryMenuRefillMixin", + "LootableContainerBlockEntityMixin", + "PlayerInventoryFilterMixin", + "PlayerScreenHandlerFallbackMixin", + "ScreenHandlerClickMixin", + "ScreenHandlerSwapFilterMixin", + "ScreenHandlerWhitelistMixin", + "ServerPlayNetworkHandlerSwapFilterMixin", + "ShulkerBoxBlockEntityMixin", + "ShulkerBoxBlockMixin", + "ShulkerBoxSlotMixin", + "SimpleInventoryMixin", + "SlotWhitelistMixin", + "StorageMinecartEntityMixin" + ], + "client": [ + "client.ArmorEquipClientMixin", + "client.ChestInteractionMixin", + "client.ChestLidAccessor", + "client.CreativeInventoryScreenAccessor", + "client.CreativeInventoryScreenMixin", + "client.CreativeSlotAccessor", + "client.EnderChestLidAccessor", + "client.GenericContainerScreenMixin", + "client.HandledScreenAccessor", + "client.InGameHudHotbarLinesMixin", + "client.LevelRendererMixin", + "client.RecipeBookScreenAccessor", + "client.RecipeBookWidgetInvoker", + "client.ShulkerAnimationAccessor", + "client.StatusEffectsDisplayMixin", + "WorldMixin" + ], + "injectors": { + "defaultRequire": 1 + } +} diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/lang/ar_sa.json b/multiloader-26.3/common/src/main/resources/assets/chestseparators/lang/ar_sa.json new file mode 100644 index 0000000..e4f5171 --- /dev/null +++ b/multiloader-26.3/common/src/main/resources/assets/chestseparators/lang/ar_sa.json @@ -0,0 +1,257 @@ +{ + "tooltip.chestseparators.edit_mode": "تعديل التخطيط", + "tooltip.chestseparators.whitelist_mode": "إدارة الفلاتر", + "itemGroup.chestseparators.chest_and_inventory": "الصندوق ومخزون الأدوات", + "gui.chestseparators.search": "بحث", + "button.chestseparators.copy_layout": "نسخ التخطيط", + "message.chestseparators.layout_copied": "تم نسخ التخطيط!", + "tooltip.chestseparators.desc.copy_layout": "ينسخ التخطيط الحالي إلى الحافظة", + "button.chestseparators.paste_layout": "لصق التخطيط", + "message.chestseparators.layout_pasted": "تم لصق التخطيط!", + "tooltip.chestseparators.desc.paste_layout": "يلصق التخطيط المنسوخ من الحافظة", + "button.chestseparators.undo_action": "تراجع", + "tooltip.chestseparators.desc.undo_action": "يتراجع عن آخر إجراء رسم", + "button.chestseparators.redo_action": "إعادة", + "tooltip.chestseparators.desc.redo_action": "يستعيد الإجراء الذي تم التراجع عنه مسبقًا", + "tooltip.chestseparators.draw_area": "رسم منطقة", + "tooltip.chestseparators.erase_area": "مسح منطقة", + "tooltip.chestseparators.clear_lines": "مسح الخطوط", + "tooltip.chestseparators.clear_backgrounds": "مسح الخلفيات", + "tooltip.chestseparators.clear_both": "مسح كليهما", + "message.chestseparators.cleared": "تم المسح", + "tooltip.chestseparators.draw_trace": "رسم مسار", + "tooltip.chestseparators.erase_trace": "مسح مسار", + "tooltip.chestseparators.open_palette": "فتح اللوحة", + "message.chestseparators.color_copied": "تم نسخ اللون!", + "message.chestseparators.color_pasted": "تم لصق اللون!", + "tooltip.chestseparators.tab_lines": "خطوط", + "tooltip.chestseparators.tab_backgrounds": "خلفيات", + "tooltip.chestseparators.tab_combo": "الوضع المدمج", + "button.chestseparators.edit_filter": "تعديل الفلتر", + "tooltip.chestseparators.desc.edit_filter": "إنشاء أو تعديل فلتر للفتحات المحددة", + "button.chestseparators.delete_all_filters": "حذف جميع الفلاتر", + "tooltip.chestseparators.desc.delete_all_filters": "يحذف كل فلتر في هذا الصندوق", + "message.chestseparators.all_filters_deleted": "تم حذف جميع الفلاتر!", + "message.chestseparators.select_first": "حدد فتحة واحدة على الأقل أولاً.", + "button.chestseparators.area_select": "تحديد منطقة", + "tooltip.chestseparators.desc.area_select": "تحديد الفتحات عن طريق سحب منطقة مستطيلة", + "button.chestseparators.trace_select": "تحديد مسار", + "tooltip.chestseparators.desc.trace_select": "تحديد الفتحات بالرسم عليها", + "button.chestseparators.clear_selection": "مسح التحديد", + "tooltip.chestseparators.desc.clear_selection": "مسح جميع الفتحات المحددة حاليًا", + "button.chestseparators.copy_filters": "نسخ الفلاتر", + "message.chestseparators.filters_copied": "تم نسخ الفلاتر!", + "tooltip.chestseparators.desc.copy_filters": "ينسخ جميع الفلاتر من هذا الصندوق إلى الحافظة", + "button.chestseparators.paste_filters": "لصق الفلاتر", + "message.chestseparators.filters_pasted": "تم لصق الفلاتر!", + "message.chestseparators.undone": "تم التراجع: %s", + "message.chestseparators.redone": "تمت الإعادة: %s", + "message.chestseparators.action.layout": "التخطيط", + "message.chestseparators.action.filter": "الفلتر", + "tooltip.chestseparators.desc.paste_filters": "يلصق الفلاتر من الحافظة في هذا الصندوق", + "button.chestseparators.undo": "تراجع", + "tooltip.chestseparators.desc.undo": "يتراجع عن آخر إجراء للفلتر", + "button.chestseparators.redo": "إعادة", + "button.chestseparators.fill_inventory": "ملء المخزون", + "button.chestseparators.preset_load": "تحميل", + "button.chestseparators.preset_save": "حفظ", + "tooltip.chestseparators.desc.redo": "يستعيد الإجراء الذي تم التراجع عنه مسبقًا", + "tooltip.chestseparators.desc.fill_inventory": "اسحب العناصر المفلترة هنا (حتى الهدف)", + "tooltip.chestseparators.push_to_chest": "أرسل العناصر إلى الصندوق\n§8اضغط [Shift] لتشمل الخانات الفارغة", + "tooltip.chestseparators.push_to_chest.shift": "إلى الصندوق + الخانات الفارغة", + "tooltip.chestseparators.pull_from_chest": "اسحب العناصر من الصندوق\n§8[Shift] لسحب غير المفلترة أيضًا", + "tooltip.chestseparators.desc.presets": "إعدادات المخزون: حفظ وتحميل التخطيطات والمرشحات", + "tooltip.chestseparators.desc.chest_presets": "إعدادات الصندوق: حفظ وتحميل تخطيطات ومرشحات الصندوق", + "button.chestseparators.conflict.overwrite": "استبدال الفلاتر الحالية", + "tooltip.chestseparators.desc.conflict.overwrite": "يحذف الفلاتر الحالية في التحديد وينشئ فلاتر جديدة", + "button.chestseparators.conflict.deselect": "إلغاء تحديد التعارضات والمتابعة", + "message.chestseparators.empty_selection": "التحديد فارغ.", + "tooltip.chestseparators.desc.conflict.deselect": "يحافظ على الفلاتر الحالية سليمة ويطبقها فقط على الفتحات الفارغة", + "button.chestseparators.cancel": "إلغاء", + "tooltip.chestseparators.desc.conflict.cancel": "إلغاء إنشاء الفلتر", + "button.chestseparators.confirm": "تأكيد", + "gui.chestseparators.conflict_title": "تعارض في التحديد!", + "gui.chestseparators.presets_title": "إعدادات المخزون", + "gui.chestseparators.chest_presets_title": "إعدادات الصندوق", + "gui.chestseparators.preview_layout": "التخطيط", + "gui.chestseparators.preview_filters": "المرشحات", + "gui.chestseparators.preset_slot": "الإعداد %s", + "gui.chestseparators.preset.building": "بناء", + "gui.chestseparators.preset.mining": "تعدين", + "gui.chestseparators.preset.food": "طعام وزراعة", + "gui.chestseparators.preset.redstone": "ريدستون", + "gui.chestseparators.preset.combat": "قتال", + "gui.chestseparators.preset.inv_miner": "عامل منجم", + "gui.chestseparators.preset.inv_builder": "بنّاء", + "gui.chestseparators.preset.inv_explorer": "مستكشف", + "gui.chestseparators.preset.inv_farmer": "مزارع", + "gui.chestseparators.preset.inv_nether_end": "نيذر والنهاية", + "gui.chestseparators.conflict_desc": "بعض الفتحات المحددة تحتوي بالفعل على فلتر.", + "gui.chestseparators.group_filter": "فلتر المجموعة", + "gui.chestseparators.no_filter": "بدون فلتر", + "gui.chestseparators.items_count": "العناصر: %s", + "gui.chestseparators.hover_group": "مرر الماوس فوق مجموعة...", + "gui.chestseparators.empty_whitelist": "القائمة البيضاء فارغة.", + "button.chestseparators.save_and_exit": "حفظ وخروج", + "button.chestseparators.discard_changes": "تجاهل التغييرات", + "button.chestseparators.import_extracted": "استيراد المستخرج", + "message.chestseparators.items_already_in_filter": "العناصر موجودة بالفعل في الفلتر.", + "message.chestseparators.no_new_items_found": "لم يتم العثور على عناصر جديدة.", + "tooltip.chestseparators.desc.import_extracted": "يضيف العناصر الموجودة في الخانات المحددة إلى المرشح.", + "tooltip.chestseparators.desc.import_search": "استيراد البحث", + "button.chestseparators.allow_all": "السماح للكل", + "tooltip.chestseparators.desc.allow_all": "يضيف جميع عناصر اللعبة إلى القائمة البيضاء", + "button.chestseparators.clear_all": "مسح الكل", + "tooltip.chestseparators.desc.clear_all": "يمسح القائمة البيضاء الحالية", + "button.chestseparators.manual_insert": "إدراج يدوي", + "tooltip.chestseparators.rule.manual_active": "نشط: يفلتر النقرات اليدوية", + "tooltip.chestseparators.rule.manual_inactive": "غير نشط: النقرات اليدوية تتجاهل الفلتر", + "button.chestseparators.shift_insert": "إدراج بـ Shift", + "tooltip.chestseparators.rule.shift_active": "نشط: يفلتر نقرات Shift", + "tooltip.chestseparators.rule.shift_inactive": "غير نشط: نقرات Shift تتجاهل الفلتر", + "button.chestseparators.hopper_insert": "إدراج بالقمع", + "tooltip.chestseparators.rule.hopper_active": "نشط: يفلتر نقل الأقماع", + "tooltip.chestseparators.rule.hopper_inactive": "غير نشط: الأقماع تتجاهل الفلتر", + "button.chestseparators.delete": "حذف", + "tooltip.chestseparators.desc.delete_group": "يحذف مجموعة الفلاتر هذه", + "button.chestseparators.save": "حفظ", + "tooltip.chestseparators.desc.save": "يحفظ التغييرات", + "tooltip.chestseparators.desc.cancel": "يتجاهل التغييرات", + "gui.chestseparators.unsaved_changes_title": "تغييرات غير محفوظة", + "gui.chestseparators.unsaved_changes_desc": "لديك تغييرات غير محفوظة في هذا الفلتر.", + "gui.chestseparators.new_detected": "اكتشاف جديد: %s", + "gui.chestseparators.allowing_all": "السماح للكل: %s", + "gui.chestseparators.clearing": "جاري المسح: %s", + "gui.chestseparators.allowed": "مسموح: %s", + "gui.chestseparators.blocked": "محظور: %s", + "gui.chestseparators.edit_filter_rules": "تعديل قواعد الفلتر", + "message.chestseparators.no_valid_groups": "لا توجد مجموعات صالحة.", + "color.chestseparators.custom": "لون مخصص %s", + "button.chestseparators.eyedropper": "قطارة", + "tooltip.chestseparators.desc.eyedropper": "اختر لونًا مباشرة من الشاشة", + "button.chestseparators.exit": "خروج", + "tooltip.chestseparators.desc.exit": "حفظ التغييرات وإغلاق منتقي الألوان", + "gui.chestseparators.hex": "Hex", + "gui.chestseparators.color_r": "R", + "gui.chestseparators.color_g": "G", + "gui.chestseparators.color_b": "B", + "gui.chestseparators.color_picker.instructions": "انقر بزر الماوس الأوسط للنسخ. انقر بزر الماوس الأيسر للصق.", + "window.chestseparators.edit_color": "تعديل اللون المخصص", + "message.chestseparators.edit_buttons_visible": "أزرار التعديل: مرئية", + "message.chestseparators.edit_buttons_hidden": "أزرار التعديل: مخفية", + "message.chestseparators.preview_panel_visible": "لوحة المعاينة: مرئية", + "message.chestseparators.preview_panel_hidden": "لوحة المعاينة: مخفية", + "config.chestseparators.category.client": "العميل / المرئيات", + "config.chestseparators.show_left_panel": "إظهار اللوحة اليسرى", + "config.chestseparators.show_left_panel.tooltip": "يعرض لوحة معاينة القائمة البيضاء. استمر في الضغط للتجاوز.", + "config.chestseparators.enable_preview_animation": "تفعيل رسوم المعاينة المتحركة", + "config.chestseparators.enable_preview_animation.tooltip": "يقوم بتمرير قائمة العناصر تلقائيًا في لوحة المعاينة.", + "config.chestseparators.show_edit_buttons": "إظهار أزرار المحرر", + "config.chestseparators.show_edit_buttons.tooltip": "يعرض أزرار الأدوات داخل واجهة الصندوق.", + "config.chestseparators.bg_transparency": "شفافية الخلفية", + "config.chestseparators.bg_transparency.tooltip": "مستوى التعتيم لألوان خلفية الفتحة (0 = غير مرئي، 100 = صلب).", + "config.chestseparators.line_transparency": "شفافية الخطوط", + "config.chestseparators.line_transparency.tooltip": "مستوى التعتيم لخطوط الفصل (0 = غير مرئي، 100 = صلب).", + "config.chestseparators.default_rule_manual": "القاعدة الافتراضية: يدوي", + "config.chestseparators.default_rule_manual.tooltip": "المجموعات الجديدة ستسمح بالنقرات اليدوية بشكل افتراضي.", + "config.chestseparators.default_rule_shift": "القاعدة الافتراضية: Shift", + "config.chestseparators.default_rule_shift.tooltip": "المجموعات الجديدة ستسمح بنقرات Shift بشكل افتراضي.", + "config.chestseparators.default_rule_hopper": "القاعدة الافتراضية: القمع", + "config.chestseparators.default_rule_hopper.tooltip": "المجموعات الجديدة ستسمح بإدخال القمع بشكل افتراضي.", + "config.chestseparators.default_rule_pickup": "القاعدة الافتراضية: الالتقاط", + "config.chestseparators.default_rule_pickup.tooltip": "المجموعات الجديدة في الحقيبة ستصفّي العناصر المُلتقطة من الأرض بشكل افتراضي.", + "config.chestseparators.category.server": "الخادم / الميكانيكا", + "config.chestseparators.expel_invalid_items": "طرد العناصر غير الصالحة", + "config.chestseparators.expel_invalid_items.tooltip": "سيتم دفع العناصر غير الصالحة إلى مخزون اللاعب أو إسقاطها.", + "config.chestseparators.category.hotkeys": "مفاتيح الاختصار", + "config.chestseparators.toggle_preview_panel": "تبديل لوحة المعاينة", + "config.chestseparators.toggle_preview_panel.tooltip": "إظهار/إخفاء لوحة المعاينة اليسرى بسرعة.", + "config.chestseparators.show_panel_modifier": "مفتاح تعديل إظهار اللوحة", + "config.chestseparators.show_panel_modifier.tooltip": "استمر في الضغط لفرض إظهار اللوحة اليسرى إذا كانت معطلة.", + "button.chestseparators.import_search": "استيراد البحث", + "message.chestseparators.locked": "هناك شخص آخر يقوم بتعديل هذا الصندوق بالفعل!", + "gui.chestseparators.expel_items_title": "طرد العناصر غير الصالحة؟", + "gui.chestseparators.expel_items_desc": "بعض العناصر الموجودة حاليًا في هذه الخانات لا تتطابق مع القواعد الجديدة. سيتم طردها من الصندوق.", + "button.chestseparators.accept_expel": "قبول وطرد", + "config.chestseparators.dark_mode": "الوضع الداكن", + "config.chestseparators.dark_mode.tooltip": "التبديل بين سمات واجهة المستخدم الفاتحة والداكنة.", + "title.chestseparators.config": "إعدادات Absolute Order", + "category.chestseparators.keys": "Absolute Order", + "key.category.chestseparators.keys": "Absolute Order", + "config.chestseparators.show_deposit_button": "إظهار زر الإيداع", + "message.chestseparators.deposit_button_visible": "زر الإيداع: مرئي", + "message.chestseparators.deposit_button_hidden": "زر الإيداع: مخفي", + "key.chestseparators.toggle_magnifier": "تبديل العدسة المكبرة", + "key.chestseparators.toggle_edit_buttons": "تبديل شريط الأدوات", + "config.chestseparators.toggle_edit_buttons": "تبديل شريط الأدوات", + "config.chestseparators.toggle_edit_buttons.tooltip": "إظهار أو إخفاء شريط الأدوات العلوي بالكامل دفعة واحدة.", + "config.chestseparators.toggle_magnifier": "تبديل العدسة المكبرة", + "config.chestseparators.magnifier_enabled": "إظهار العدسة المكبرة", + "config.chestseparators.magnifier_enabled.tooltip": "تعرض عدسة تكبير عند المؤشر أثناء رسم الفواصل أو استخدام القطارة.", + "config.chestseparators.magnifier_shape": "شكل العدسة المكبرة", + "config.chestseparators.magnifier_shape.tooltip": "ما إذا كانت العدسة المكبرة دائرية أو مربعة.", + "config.chestseparators.magnifier_shape.circle": "دائرة", + "config.chestseparators.magnifier_shape.square": "مربع", + "config.chestseparators.magnifier_tab_lines": "العدسة المكبرة: خطوط", + "config.chestseparators.magnifier_tab_backgrounds": "العدسة المكبرة: خلفيات", + "config.chestseparators.magnifier_tab_combo": "العدسة المكبرة: الوضع المدمج", + "message.chestseparators.magnifier_on": "العدسة المكبرة: تشغيل", + "message.chestseparators.magnifier_off": "العدسة المكبرة: إيقاف", + "message.chestseparators.magnifier_hint": "نصيحة: اضغط %s لعدسة تكبير", + "message.chestseparators.tag_hint": "نصيحة: انقر بالزر الأوسط على عنصر لعرض وسومه", + "message.chestseparators.magnifier_hint_off": "نصيحة: اضغط %s لإخفاء عدسة التكبير", + "config.chestseparators.show_deposit_button.tooltip": "يظهر أو يخفي زر الإيداع السريع في واجهة الصندوق.", + "tooltip.chestseparators.deposit_items": "إيداع في الفلاتر\n§8[Shift + Click] إيداع في الفلاتر والفتحات الفارغة", + "message.chestseparators.deposited": "تم إيداع %s عناصر.", + "message.chestseparators.deposit_failed": "لم يتم العثور على فتحات صالحة لإيداع العناصر.", + "config.chestseparators.close_on_click_outside": "إغلاق عند النقر في الخارج", + "config.chestseparators.close_on_click_outside.tooltip": "يغلق القائمة عند النقر خارج الواجهة.", + "config.chestseparators.shared_custom_colors": "ألوان مخصصة مشتركة", + "config.chestseparators.shared_custom_colors.tooltip": "عند التفعيل، تتم مشاركة عمود الألوان المخصصة بين علامات تبويب الخطوط والخلفيات والمدمج. عند التعطيل، لكل علامة تبويب ألوانها الخاصة.", + "modmenu.descriptionTranslation.chestseparators": "حقق تفريغًا سريعًا للمخزون مع الإيداع التلقائي المخصص. اللعبة أخيرًا تعرف بالضبط ما تريده وأين تريده.", + "config.chestseparators.auto_deposit_enabled": "الإيداع التلقائي في الصناديق القريبة", + "config.chestseparators.auto_deposit_enabled.tooltip": "رتّب كامل حقيبتك في الصناديق المُصفّاة القريبة بحركة واحدة.", + "config.chestseparators.auto_deposit_double_sneak": "المُشغّل: التسلل المزدوج", + "config.chestseparators.auto_deposit_double_sneak.tooltip": "اضغط مفتاح التسلل مرتين بسرعة للإيداع التلقائي.", + "config.chestseparators.auto_deposit_radius": "نطاق الإيداع التلقائي", + "config.chestseparators.auto_deposit_radius.tooltip": "المسافة حولك (بالكتل) التي يتم البحث فيها عن الصناديق.", + "config.chestseparators.auto_deposit_through_walls": "الإيداع عبر الجدران", + "config.chestseparators.auto_deposit_through_walls.tooltip": "يسمح بالإيداع في الصناديق المحجوبة بكتل صلبة. عند الإيقاف يجب أن يكون المسار خاليًا.", + "config.chestseparators.auto_deposit": "الإيداع التلقائي", + "key.chestseparators.auto_deposit": "الإيداع التلقائي في الصناديق القريبة", + "message.chestseparators.auto_deposit_done": "تم إيداع %s عنصرًا تلقائيًا.", + "message.chestseparators.auto_deposit_none": "لا توجد صناديق مُصفّاة قريبة في المتناول.", + "message.chestseparators.auto_grab_done": "تم جلب %s عنصرًا.", + "message.chestseparators.auto_grab_none": "لا شيء لجلبه في الجوار.", + "message.chestseparators.preset_loaded": "تم تحميل الإعداد %s.", + "message.chestseparators.preset_saved": "تم حفظ الإعداد %s.", + "message.chestseparators.preset_empty": "الإعداد %s فارغ.", + "config.chestseparators.auto_deposit_animation": "حركة الإيداع", + "config.chestseparators.auto_deposit_animation.tooltip": "تُظهر العناصر ثلاثية الأبعاد وهي تطير إلى كل صندوق. عند الإيقاف تُودع العناصر فورًا دون حركة.", + "config.chestseparators.auto_deposit_trail": "تأثير الأثر", + "config.chestseparators.auto_deposit_trail.tooltip": "يترك أثرًا من الجسيمات خلف كل عنصر طائر. ينطبق فقط عند تشغيل الحركة.", + "button.chestseparators.pickup_insert": "الالتقاط", + "tooltip.chestseparators.rule.pickup_active": "مفعّل: يصفّي العناصر المُلتقطة من الأرض", + "tooltip.chestseparators.rule.pickup_inactive": "معطّل: العناصر المُلتقطة تتجاهل المرشّح", + "tooltip.chestseparators.edit_inventory_toggle": "تحرير الحقيبة / الصندوق", + "message.chestseparators.editing_inventory": "التحرير: الحقيبة", + "message.chestseparators.editing_chest": "التحرير: الصندوق", + "message.chestseparators.preset_deleted": "تم حذف الإعداد %s.", + "gui.chestseparators.preset_overwrite_title": "الكتابة فوق الإعداد %s؟", + "gui.chestseparators.preset_overwrite_body": "سيُفقد الإعداد المحفوظ.", + "gui.chestseparators.preset_page": "الصفحة %s/%s", + "gui.chestseparators.preview_delete": "سيتم حذفه", + "key.chestseparators.push": "إرسال إلى مرشحات الصندوق", + "config.chestseparators.push": "إرسال إلى مرشحات الصندوق", + "config.chestseparators.push.tooltip": "يرسل العناصر المطابقة إلى مرشحات الصندوق المفتوح.\n§8اضغط [Shift] لملء الخانات الفارغة أيضًا", + "key.chestseparators.pull": "جلب إلى مرشحات الحقيبة", + "config.chestseparators.pull": "جلب إلى مرشحات الحقيبة", + "config.chestseparators.pull.tooltip": "يجلب عناصر الصندوق إلى مرشحات حقيبتك.\n§8اضغط [Shift] لجلب العناصر غير المرشحة أيضًا", + "config.chestseparators.lock_hotbar_on_reorder": "قفل شريط الأدوات عند الفرز", + "config.chestseparators.lock_hotbar_on_reorder.tooltip": "عند قيام الإرسال أو الجلب بفرز حقيبتك، يبقى شريط الأدوات دون تغيير.", + "config.chestseparators.lock_hotbar_on_reorder.tooltip2": "يحمي عنصرًا تمسكه. إيقاف: يُفرز شريط الأدوات أيضًا.", + "message.chestseparators.push_no_filters": "لا توجد مرشحات في هذا الصندوق بعد.", + "message.chestseparators.push_no_slot": "لا توجد خانة مرشح فارغة.", + "message.chestseparators.pull_no_filters": "لا توجد مرشحات في حقيبتك بعد.", + "message.chestseparators.pull_no_match": "لا شيء هنا يطابق مرشحاتك." +} diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/lang/ca_es.json b/multiloader-26.3/common/src/main/resources/assets/chestseparators/lang/ca_es.json new file mode 100644 index 0000000..e57c6ab --- /dev/null +++ b/multiloader-26.3/common/src/main/resources/assets/chestseparators/lang/ca_es.json @@ -0,0 +1,257 @@ +{ + "tooltip.chestseparators.edit_mode": "Editar disposició", + "tooltip.chestseparators.whitelist_mode": "Gestionar filtres", + "itemGroup.chestseparators.chest_and_inventory": "Cofre i inventari", + "gui.chestseparators.search": "Cercar", + "button.chestseparators.copy_layout": "Copiar disposició", + "message.chestseparators.layout_copied": "Disposició copiada!", + "tooltip.chestseparators.desc.copy_layout": "Copia la disposició actual al porta-retalls", + "button.chestseparators.paste_layout": "Enganxar disposició", + "message.chestseparators.layout_pasted": "Disposició enganxada!", + "tooltip.chestseparators.desc.paste_layout": "Enganxa la disposició copiada des del porta-retalls", + "button.chestseparators.undo_action": "Desfer acció", + "tooltip.chestseparators.desc.undo_action": "Reverteix l'última acció dibuixada", + "button.chestseparators.redo_action": "Refer acció", + "tooltip.chestseparators.desc.redo_action": "Restaura l'acció prèviament desfeta", + "tooltip.chestseparators.draw_area": "Dibuixar àrea", + "tooltip.chestseparators.erase_area": "Esborrar àrea", + "tooltip.chestseparators.clear_lines": "Netejar línies", + "tooltip.chestseparators.clear_backgrounds": "Netejar fons", + "tooltip.chestseparators.clear_both": "Netejar ambdós", + "message.chestseparators.cleared": "Netejat", + "tooltip.chestseparators.draw_trace": "Dibuixar traç", + "tooltip.chestseparators.erase_trace": "Esborrar traç", + "tooltip.chestseparators.open_palette": "Obrir paleta", + "message.chestseparators.color_copied": "Color copiat!", + "message.chestseparators.color_pasted": "Color enganxat!", + "tooltip.chestseparators.tab_lines": "Línies", + "tooltip.chestseparators.tab_backgrounds": "Fons", + "tooltip.chestseparators.tab_combo": "Mode combinat", + "button.chestseparators.edit_filter": "Editar filtre", + "tooltip.chestseparators.desc.edit_filter": "Crea o edita un filtre per a les ranures seleccionades", + "button.chestseparators.delete_all_filters": "Eliminar tots els filtres", + "tooltip.chestseparators.desc.delete_all_filters": "Elimina tots els filtres d'aquest cofre", + "message.chestseparators.all_filters_deleted": "Tots els filtres eliminats!", + "message.chestseparators.select_first": "Selecciona almenys una ranura primer.", + "button.chestseparators.area_select": "Selecció per àrea", + "tooltip.chestseparators.desc.area_select": "Selecciona ranures arrossegant una àrea rectangular", + "button.chestseparators.trace_select": "Selecció per traç", + "tooltip.chestseparators.desc.trace_select": "Selecciona ranures pintant sobre elles", + "button.chestseparators.clear_selection": "Netejar selecció", + "tooltip.chestseparators.desc.clear_selection": "Neteja totes les ranures seleccionades actualment", + "button.chestseparators.copy_filters": "Copiar filtres", + "message.chestseparators.filters_copied": "Filtres copiats!", + "tooltip.chestseparators.desc.copy_filters": "Copia tots els filtres d'aquest cofre al porta-retalls", + "button.chestseparators.paste_filters": "Enganxar filtres", + "message.chestseparators.filters_pasted": "Filtres enganxats!", + "message.chestseparators.undone": "Desfet: %s", + "message.chestseparators.redone": "Refet: %s", + "message.chestseparators.action.layout": "Disposició", + "message.chestseparators.action.filter": "Filtre", + "tooltip.chestseparators.desc.paste_filters": "Enganxa els filtres des del porta-retalls a aquest cofre", + "button.chestseparators.undo": "Desfer", + "tooltip.chestseparators.desc.undo": "Desfà l'última acció del filtre", + "button.chestseparators.redo": "Refer", + "button.chestseparators.fill_inventory": "Omplir inventari", + "button.chestseparators.preset_load": "Carregar", + "button.chestseparators.preset_save": "Desar", + "tooltip.chestseparators.desc.redo": "Refà l'acció prèviament desfeta", + "tooltip.chestseparators.desc.fill_inventory": "Porta els ítems filtrats aquí (fins a l’objectiu)", + "tooltip.chestseparators.push_to_chest": "Envia ítems al cofre\n§8Mantén [Maj] per incloure espais buits", + "tooltip.chestseparators.push_to_chest.shift": "Envia al cofre + espais buits", + "tooltip.chestseparators.pull_from_chest": "Porta ítems del cofre\n§8[Maj] també porta els no filtrats", + "tooltip.chestseparators.desc.presets": "Presets d'inventari: desa i carrega dissenys i filtres", + "tooltip.chestseparators.desc.chest_presets": "Presets de cofre: desa i carrega dissenys i filtres del cofre", + "button.chestseparators.conflict.overwrite": "Sobreescriure filtres existents", + "tooltip.chestseparators.desc.conflict.overwrite": "Elimina els filtres existents a la selecció i en crea un de nou", + "button.chestseparators.conflict.deselect": "Deseleccionar conflictes i continuar", + "message.chestseparators.empty_selection": "Selecció buida.", + "tooltip.chestseparators.desc.conflict.deselect": "Manté els filtres existents intactes i només s'aplica a les ranures buides", + "button.chestseparators.cancel": "Cancel·lar", + "tooltip.chestseparators.desc.conflict.cancel": "Avorta la creació del filtre", + "button.chestseparators.confirm": "Confirmar", + "gui.chestseparators.conflict_title": "Conflicte de selecció!", + "gui.chestseparators.presets_title": "Presets d'inventari", + "gui.chestseparators.chest_presets_title": "Presets de cofre", + "gui.chestseparators.preview_layout": "Disseny", + "gui.chestseparators.preview_filters": "Filtres", + "gui.chestseparators.preset_slot": "Preset %s", + "gui.chestseparators.preset.building": "Construcció", + "gui.chestseparators.preset.mining": "Mineria", + "gui.chestseparators.preset.food": "Menjar i granja", + "gui.chestseparators.preset.redstone": "Redstone", + "gui.chestseparators.preset.combat": "Combat", + "gui.chestseparators.preset.inv_miner": "Miner", + "gui.chestseparators.preset.inv_builder": "Constructor", + "gui.chestseparators.preset.inv_explorer": "Explorador", + "gui.chestseparators.preset.inv_farmer": "Granger", + "gui.chestseparators.preset.inv_nether_end": "Nether i End", + "gui.chestseparators.conflict_desc": "Algunes ranures seleccionades ja tenen un filtre.", + "gui.chestseparators.group_filter": "Filtre de grup", + "gui.chestseparators.no_filter": "Sense filtre", + "gui.chestseparators.items_count": "Objectes: %s", + "gui.chestseparators.hover_group": "Passa el ratolí sobre un grup...", + "gui.chestseparators.empty_whitelist": "Llista blanca buida.", + "button.chestseparators.save_and_exit": "Desar i sortir", + "button.chestseparators.discard_changes": "Descartar canvis", + "button.chestseparators.import_extracted": "Importar extrets", + "message.chestseparators.items_already_in_filter": "Els objectes ja són al filtre.", + "message.chestseparators.no_new_items_found": "No s'han trobat objectes nous.", + "tooltip.chestseparators.desc.import_extracted": "Afegeix al filtre els objectes que hi ha a les caselles seleccionades.", + "tooltip.chestseparators.desc.import_search": "Importar cerca", + "button.chestseparators.allow_all": "Permetre-ho tot", + "tooltip.chestseparators.desc.allow_all": "Afegeix tots els objectes del joc a la llista blanca", + "button.chestseparators.clear_all": "Netejar-ho tot", + "tooltip.chestseparators.desc.clear_all": "Neteja la llista blanca actual", + "button.chestseparators.manual_insert": "Inserció manual", + "tooltip.chestseparators.rule.manual_active": "Actiu: Filtra els clics manuals", + "tooltip.chestseparators.rule.manual_inactive": "Inactiu: Els clics manuals ignoren el filtre", + "button.chestseparators.shift_insert": "Inserció amb Maj", + "tooltip.chestseparators.rule.shift_active": "Actiu: Filtra els clics amb Maj", + "tooltip.chestseparators.rule.shift_inactive": "Inactiu: Els clics amb Maj ignoren el filtre", + "button.chestseparators.hopper_insert": "Inserció per tremuja", + "tooltip.chestseparators.rule.hopper_active": "Actiu: Filtra les transferències de la tremuja", + "tooltip.chestseparators.rule.hopper_inactive": "Inactiu: Les tremuges ignoren el filtre", + "button.chestseparators.delete": "Eliminar", + "tooltip.chestseparators.desc.delete_group": "Elimina aquest grup de filtres", + "button.chestseparators.save": "Desar", + "tooltip.chestseparators.desc.save": "Desa els canvis", + "tooltip.chestseparators.desc.cancel": "Descarta els canvis", + "gui.chestseparators.unsaved_changes_title": "Canvis sense desar", + "gui.chestseparators.unsaved_changes_desc": "Tens canvis sense desar en aquest filtre.", + "gui.chestseparators.new_detected": "Nous detectats: %s", + "gui.chestseparators.allowing_all": "Permetent tots: %s", + "gui.chestseparators.clearing": "Netejant: %s", + "gui.chestseparators.allowed": "Permesos: %s", + "gui.chestseparators.blocked": "Bloquejats: %s", + "gui.chestseparators.edit_filter_rules": "Editar regles del filtre", + "message.chestseparators.no_valid_groups": "Sense grups vàlids.", + "button.chestseparators.eyedropper": "Comptagotes", + "tooltip.chestseparators.desc.eyedropper": "Tria un color directament de la pantalla", + "button.chestseparators.exit": "Sortir", + "tooltip.chestseparators.desc.exit": "Desa els canvis i tanca el selector de color", + "gui.chestseparators.hex": "Hex", + "gui.chestseparators.color_r": "R", + "gui.chestseparators.color_g": "G", + "gui.chestseparators.color_b": "B", + "gui.chestseparators.color_picker.instructions": "Clic central en un color per copiar. Clic esquerre en una ranura per enganxar.", + "window.chestseparators.edit_color": "Editar color personalitzat", + "message.chestseparators.edit_buttons_visible": "Botons d'edició: Visibles", + "message.chestseparators.edit_buttons_hidden": "Botons d'edició: Ocults", + "message.chestseparators.preview_panel_visible": "Panell de previsualització: Visible", + "message.chestseparators.preview_panel_hidden": "Panell de previsualització: Ocult", + "modmenu.descriptionTranslation.chestseparators": "Aconsegueix buidar l'inventari ràpidament amb el dipòsit automàtic personalitzat. El joc per fi sap exactament què vols i on ho vols.", + "config.chestseparators.category.client": "Client / Visuals", + "config.chestseparators.show_left_panel": "Mostrar panell esquerre", + "config.chestseparators.show_left_panel.tooltip": "Mostra el panell de previsualització de la llista blanca. Mantén premuda la tecla modificadora per forçar-ho.", + "config.chestseparators.enable_preview_animation": "Activar animació de previsualització", + "config.chestseparators.enable_preview_animation.tooltip": "Desplaça automàticament la llista d'objectes al panell de previsualització.", + "config.chestseparators.show_edit_buttons": "Mostrar botons d'edició", + "config.chestseparators.show_edit_buttons.tooltip": "Mostra els botons d'eines dins de la interfície del cofre.", + "config.chestseparators.bg_transparency": "Transparència del fons", + "config.chestseparators.bg_transparency.tooltip": "Nivell d'opacitat per als colors de fons de les ranures (0 = Invisible, 100 = Sòlid).", + "config.chestseparators.line_transparency": "Transparència de les línies", + "config.chestseparators.line_transparency.tooltip": "Nivell d'opacitat per a les línies separadores (0 = Invisible, 100 = Sòlid).", + "config.chestseparators.default_rule_manual": "Regla per defecte: Manual", + "config.chestseparators.default_rule_manual.tooltip": "Els grups creats recentment permetran clics manuals per defecte.", + "config.chestseparators.default_rule_shift": "Regla per defecte: Maj", + "config.chestseparators.default_rule_shift.tooltip": "Els grups creats recentment permetran clics amb Maj per defecte.", + "config.chestseparators.default_rule_hopper": "Regla per defecte: Tremuja", + "config.chestseparators.default_rule_hopper.tooltip": "Els grups creats recentment permetran la inserció per tremuja per defecte.", + "config.chestseparators.default_rule_pickup": "Regla per defecte: Recollir", + "config.chestseparators.default_rule_pickup.tooltip": "Els grups d'inventari nous filtraran els ítems recollits de terra per defecte.", + "config.chestseparators.category.server": "Servidor / Mecàniques", + "config.chestseparators.expel_invalid_items": "Expulsar objectes no vàlids", + "config.chestseparators.expel_invalid_items.tooltip": "En aplicar un filtre nou, els objectes no vàlids s'enviaran a l'inventari del jugador o cauran a terra.", + "config.chestseparators.category.hotkeys": "Dreceres", + "config.chestseparators.toggle_preview_panel": "Alternar panell de previsualització", + "config.chestseparators.toggle_preview_panel.tooltip": "Mostra/amaga ràpidament el panell de previsualització esquerre.", + "config.chestseparators.show_panel_modifier": "Modificador del panell", + "config.chestseparators.show_panel_modifier.tooltip": "Mantén premuda aquesta tecla per forçar que el panell esquerre es mostri si està desactivat.", + "color.chestseparators.custom": "Color personalitzat %s", + "button.chestseparators.import_search": "Importar Cerca", + "message.chestseparators.locked": "Algú ja està editant aquest cofre!", + "gui.chestseparators.expel_items_title": "Expulsar ítems no vàlids?", + "gui.chestseparators.expel_items_desc": "Alguns ítems actualment en aquests espais no coincideixen amb les noves regles. Seran expulsats del cofre.", + "button.chestseparators.accept_expel": "Acceptar i Expulsar", + "config.chestseparators.dark_mode": "Mode Fosc", + "config.chestseparators.dark_mode.tooltip": "Alterna entre els temes clar i fosc de la interfície.", + "config.chestseparators.show_deposit_button": "Mostrar Botó de Dipositar", + "message.chestseparators.deposit_button_visible": "Botó de Dipositar: Visible", + "message.chestseparators.deposit_button_hidden": "Botó de Dipositar: Ocult", + "key.chestseparators.toggle_magnifier": "Alternar lupa", + "key.chestseparators.toggle_edit_buttons": "Alterna la barra de botons", + "config.chestseparators.toggle_edit_buttons": "Alterna la barra de botons", + "config.chestseparators.toggle_edit_buttons.tooltip": "Mostra o amaga tota la barra de botons superior alhora.", + "config.chestseparators.toggle_magnifier": "Alternar lupa", + "config.chestseparators.magnifier_enabled": "Mostrar lupa", + "config.chestseparators.magnifier_enabled.tooltip": "Mostra una lupa de zoom al cursor en pintar separadors o usar el comptagotes.", + "config.chestseparators.magnifier_shape": "Forma de la lupa", + "config.chestseparators.magnifier_shape.tooltip": "Si la lupa és rodona o quadrada.", + "config.chestseparators.magnifier_shape.circle": "Cercle", + "config.chestseparators.magnifier_shape.square": "Quadrat", + "config.chestseparators.magnifier_tab_lines": "Lupa: Línies", + "config.chestseparators.magnifier_tab_backgrounds": "Lupa: Fons", + "config.chestseparators.magnifier_tab_combo": "Lupa: Mode combinat", + "message.chestseparators.magnifier_on": "Lupa: Activada", + "message.chestseparators.magnifier_off": "Lupa: Desactivada", + "message.chestseparators.magnifier_hint": "Consell: prem %s per a una lupa de zoom", + "message.chestseparators.tag_hint": "Consell: clic central en un ítem per veure les seves etiquetes", + "message.chestseparators.magnifier_hint_off": "Consell: prem %s per treure la lupa de zoom", + "config.chestseparators.show_deposit_button.tooltip": "Mostra o amaga el botó de dipòsit ràpid a la interfície del cofre.", + "tooltip.chestseparators.deposit_items": "Dipositar en Filtres\n§8[Shift + Click] Dipositar en Filtres i Forats Buits", + "message.chestseparators.deposited": "S'han dipositat %s ítems.", + "message.chestseparators.deposit_failed": "No s'han trobat forats vàlids per dipositar.", + "config.chestseparators.close_on_click_outside": "Tancar en fer clic a fora", + "config.chestseparators.close_on_click_outside.tooltip": "Tanca el menú en fer clic fora de la interfície.", + "config.chestseparators.shared_custom_colors": "Colors Personalitzats Compartits", + "config.chestseparators.shared_custom_colors.tooltip": "Si s'activa, la columna de colors personalitzats és comuna a les pestanyes Línies, Fons i Combo. Si es desactiva, cada pestanya té els seus.", + "title.chestseparators.config": "إعدادات Absolute Order", + "category.chestseparators.keys": "Absolute Order", + "key.category.chestseparators.keys": "Absolute Order", + "config.chestseparators.auto_deposit_enabled": "Auto-dipòsit a cofres propers", + "config.chestseparators.auto_deposit_enabled.tooltip": "Ordena tot el teu inventari als cofres filtrats propers amb un sol gest.", + "config.chestseparators.auto_deposit_double_sneak": "Activador: ajupir-se dos cops", + "config.chestseparators.auto_deposit_double_sneak.tooltip": "Prem dues vegades seguides la tecla d'ajupir-se per auto-dipositar.", + "config.chestseparators.auto_deposit_radius": "Radi d'auto-dipòsit", + "config.chestseparators.auto_deposit_radius.tooltip": "Distància al teu voltant (en blocs) on es busquen cofres.", + "config.chestseparators.auto_deposit_through_walls": "Dipositar a través de parets", + "config.chestseparators.auto_deposit_through_walls.tooltip": "Permet dipositar en cofres bloquejats per blocs sòlids. Si està desactivat, el camí ha d'estar lliure.", + "config.chestseparators.auto_deposit": "Auto-dipòsit", + "key.chestseparators.auto_deposit": "Auto-dipòsit a cofres propers", + "message.chestseparators.auto_deposit_done": "Auto-dipositats %s objectes.", + "message.chestseparators.auto_deposit_none": "No hi ha cofres filtrats propers a l'abast.", + "message.chestseparators.auto_grab_done": "Recollits %s objectes.", + "message.chestseparators.auto_grab_none": "Res a recollir a prop.", + "message.chestseparators.preset_loaded": "Preset %s carregat.", + "message.chestseparators.preset_saved": "Preset %s desat.", + "message.chestseparators.preset_empty": "El preset %s està buit.", + "config.chestseparators.auto_deposit_animation": "Animació de dipòsit", + "config.chestseparators.auto_deposit_animation.tooltip": "Mostra els objectes 3D volant cap a cada cofre. Si està desactivat, els objectes es dipositen a l'instant sense animació.", + "config.chestseparators.auto_deposit_trail": "Efecte d'estela", + "config.chestseparators.auto_deposit_trail.tooltip": "Deixa una estela de partícules darrere de cada objecte que vola. Només s'aplica si l'animació està activada.", + "button.chestseparators.pickup_insert": "Recollir", + "tooltip.chestseparators.rule.pickup_active": "Actiu: Filtra els ítems recollits de terra", + "tooltip.chestseparators.rule.pickup_inactive": "Inactiu: Els ítems recollits ignoren el filtre", + "tooltip.chestseparators.edit_inventory_toggle": "Edita inventari / cofre", + "message.chestseparators.editing_inventory": "Editant: inventari", + "message.chestseparators.editing_chest": "Editant: cofre", + "message.chestseparators.preset_deleted": "Preset %s eliminat.", + "gui.chestseparators.preset_overwrite_title": "Sobreescriure el preset %s?", + "gui.chestseparators.preset_overwrite_body": "Es perdrà el preset desat.", + "gui.chestseparators.preset_page": "Pàgina %s/%s", + "gui.chestseparators.preview_delete": "S'eliminarà", + "key.chestseparators.push": "Envia als Filtres del Cofre", + "config.chestseparators.push": "Envia als Filtres del Cofre", + "config.chestseparators.push.tooltip": "Envia els objectes coincidents als filtres del cofre obert.\n§8Mantén [Shift] per omplir també els espais buits", + "key.chestseparators.pull": "Porta als Filtres de l'Inventari", + "config.chestseparators.pull": "Porta als Filtres de l'Inventari", + "config.chestseparators.pull.tooltip": "Porta els objectes del cofre als filtres del teu inventari.\n§8Mantén [Shift] per portar també objectes sense filtre", + "config.chestseparators.lock_hotbar_on_reorder": "Bloqueja la barra ràpida en autoordenar", + "config.chestseparators.lock_hotbar_on_reorder.tooltip": "Quan un push o pull reordena el teu inventari, la barra ràpida es deixa intacta.", + "config.chestseparators.lock_hotbar_on_reorder.tooltip2": "Protegeix un objecte que puguis tenir a la mà. Desactivat: la barra ràpida també s'ordena.", + "message.chestseparators.push_no_filters": "Aquest cofre encara no té filtres.", + "message.chestseparators.push_no_slot": "No hi ha lloc lliure als filtres.", + "message.chestseparators.pull_no_filters": "El teu inventari encara no té filtres.", + "message.chestseparators.pull_no_match": "Res d'aquí coincideix amb els teus filtres." +} diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/lang/de_de.json b/multiloader-26.3/common/src/main/resources/assets/chestseparators/lang/de_de.json new file mode 100644 index 0000000..6c7945f --- /dev/null +++ b/multiloader-26.3/common/src/main/resources/assets/chestseparators/lang/de_de.json @@ -0,0 +1,257 @@ +{ + "tooltip.chestseparators.edit_mode": "Layout bearbeiten", + "tooltip.chestseparators.whitelist_mode": "Filter verwalten", + "itemGroup.chestseparators.chest_and_inventory": "Truhe & Inventar", + "gui.chestseparators.search": "Suchen", + "button.chestseparators.copy_layout": "Layout kopieren", + "message.chestseparators.layout_copied": "Layout kopiert!", + "tooltip.chestseparators.desc.copy_layout": "Kopiert das aktuelle Layout in die Zwischenablage", + "button.chestseparators.paste_layout": "Layout einfügen", + "message.chestseparators.layout_pasted": "Layout eingefügt!", + "tooltip.chestseparators.desc.paste_layout": "Fügt das kopierte Layout aus der Zwischenablage ein", + "button.chestseparators.undo_action": "Rückgängig", + "tooltip.chestseparators.desc.undo_action": "Macht die letzte gezeichnete Aktion rückgängig", + "button.chestseparators.redo_action": "Wiederholen", + "tooltip.chestseparators.desc.redo_action": "Stellt die zuletzt rückgängig gemachte Aktion wieder her", + "tooltip.chestseparators.draw_area": "Bereich zeichnen", + "tooltip.chestseparators.erase_area": "Bereich radieren", + "tooltip.chestseparators.clear_lines": "Linien leeren", + "tooltip.chestseparators.clear_backgrounds": "Hintergründe leeren", + "tooltip.chestseparators.clear_both": "Beides leeren", + "message.chestseparators.cleared": "Geleert", + "tooltip.chestseparators.draw_trace": "Linie zeichnen", + "tooltip.chestseparators.erase_trace": "Linie radieren", + "tooltip.chestseparators.open_palette": "Palette öffnen", + "message.chestseparators.color_copied": "Farbe kopiert!", + "message.chestseparators.color_pasted": "Farbe eingefügt!", + "tooltip.chestseparators.tab_lines": "Linien", + "tooltip.chestseparators.tab_backgrounds": "Hintergründe", + "tooltip.chestseparators.tab_combo": "Kombi-Modus", + "button.chestseparators.edit_filter": "Filter bearbeiten", + "tooltip.chestseparators.desc.edit_filter": "Erstellt oder bearbeitet einen Filter für die ausgewählten Slots", + "button.chestseparators.delete_all_filters": "Alle Filter löschen", + "tooltip.chestseparators.desc.delete_all_filters": "Löscht alle Filter in dieser Truhe", + "message.chestseparators.all_filters_deleted": "Alle Filter gelöscht!", + "message.chestseparators.select_first": "Wähle zuerst mindestens einen Slot aus.", + "button.chestseparators.area_select": "Bereich auswählen", + "tooltip.chestseparators.desc.area_select": "Slots durch Ziehen eines rechteckigen Bereichs auswählen", + "button.chestseparators.trace_select": "Linie auswählen", + "tooltip.chestseparators.desc.trace_select": "Slots durch Darübermalen auswählen", + "button.chestseparators.clear_selection": "Auswahl aufheben", + "tooltip.chestseparators.desc.clear_selection": "Hebt die aktuelle Auswahl aller Slots auf", + "button.chestseparators.copy_filters": "Filter kopieren", + "message.chestseparators.filters_copied": "Filter kopiert!", + "tooltip.chestseparators.desc.copy_filters": "Kopiert alle Filter dieser Truhe in die Zwischenablage", + "button.chestseparators.paste_filters": "Filter einfügen", + "message.chestseparators.filters_pasted": "Filter eingefügt!", + "message.chestseparators.undone": "Rückgängig: %s", + "message.chestseparators.redone": "Wiederhergestellt: %s", + "message.chestseparators.action.layout": "Layout", + "message.chestseparators.action.filter": "Filter", + "tooltip.chestseparators.desc.paste_filters": "Fügt Filter aus der Zwischenablage in diese Truhe ein", + "button.chestseparators.undo": "Rückgängig", + "tooltip.chestseparators.desc.undo": "Macht die letzte Filter-Aktion rückgängig", + "button.chestseparators.redo": "Wiederholen", + "button.chestseparators.fill_inventory": "Inventar füllen", + "button.chestseparators.preset_load": "Laden", + "button.chestseparators.preset_save": "Speichern", + "tooltip.chestseparators.desc.redo": "Stellt die zuletzt rückgängig gemachte Aktion wieder her", + "tooltip.chestseparators.desc.fill_inventory": "Gefilterte Items hierher holen (bis zum Ziel)", + "tooltip.chestseparators.push_to_chest": "Items in Kiste legen\n§8[Umschalt] halten für leere Slots", + "tooltip.chestseparators.push_to_chest.shift": "Items in Kiste legen + leere Slots", + "tooltip.chestseparators.pull_from_chest": "Items aus Kiste holen\n§8[Umschalt] holt auch ungefilterte Items", + "tooltip.chestseparators.desc.presets": "Inventar-Presets: Layouts und Filter speichern und laden", + "tooltip.chestseparators.desc.chest_presets": "Truhen-Presets: Truhen-Layouts und Filter speichern und laden", + "button.chestseparators.conflict.overwrite": "Vorhandene Filter überschreiben", + "tooltip.chestseparators.desc.conflict.overwrite": "Löscht vorhandene Filter in der Auswahl und erstellt einen neuen", + "button.chestseparators.conflict.deselect": "Konflikte abwählen & fortfahren", + "message.chestseparators.empty_selection": "Leere Auswahl.", + "tooltip.chestseparators.desc.conflict.deselect": "Behält vorhandene Filter intakt und wendet sie nur auf leere Slots an", + "button.chestseparators.cancel": "Abbrechen", + "tooltip.chestseparators.desc.conflict.cancel": "Filtererstellung abbrechen", + "button.chestseparators.confirm": "Bestätigen", + "gui.chestseparators.conflict_title": "Auswahlkonflikt!", + "gui.chestseparators.presets_title": "Inventar-Presets", + "gui.chestseparators.chest_presets_title": "Truhen-Presets", + "gui.chestseparators.preview_layout": "Layout", + "gui.chestseparators.preview_filters": "Filter", + "gui.chestseparators.preset_slot": "Preset %s", + "gui.chestseparators.preset.building": "Bauen", + "gui.chestseparators.preset.mining": "Bergbau", + "gui.chestseparators.preset.food": "Essen & Farm", + "gui.chestseparators.preset.redstone": "Redstone", + "gui.chestseparators.preset.combat": "Kampf", + "gui.chestseparators.preset.inv_miner": "Bergmann", + "gui.chestseparators.preset.inv_builder": "Baumeister", + "gui.chestseparators.preset.inv_explorer": "Entdecker", + "gui.chestseparators.preset.inv_farmer": "Bauer", + "gui.chestseparators.preset.inv_nether_end": "Nether & End", + "gui.chestseparators.conflict_desc": "Einige ausgewählte Slots haben bereits einen Filter.", + "gui.chestseparators.group_filter": "Gruppenfilter", + "gui.chestseparators.no_filter": "Kein Filter", + "gui.chestseparators.items_count": "Gegenstände: %s", + "gui.chestseparators.hover_group": "Fahre über eine Gruppe...", + "gui.chestseparators.empty_whitelist": "Leere Whitelist.", + "button.chestseparators.save_and_exit": "Speichern und Beenden", + "button.chestseparators.discard_changes": "Änderungen verwerfen", + "button.chestseparators.import_extracted": "Extrahierte importieren", + "message.chestseparators.items_already_in_filter": "Gegenstände bereits im Filter.", + "message.chestseparators.no_new_items_found": "Keine neuen Gegenstände gefunden.", + "tooltip.chestseparators.desc.import_extracted": "Fügt die Gegenstände aus den ausgewählten Slots zum Filter hinzu.", + "tooltip.chestseparators.desc.import_search": "Suche importieren", + "button.chestseparators.allow_all": "Alle zulassen", + "tooltip.chestseparators.desc.allow_all": "Setzt alle Spiel-Gegenstände auf die Whitelist", + "button.chestseparators.clear_all": "Alle löschen", + "tooltip.chestseparators.desc.clear_all": "Löscht die aktuelle Whitelist", + "button.chestseparators.manual_insert": "Manuell einfügen", + "tooltip.chestseparators.rule.manual_active": "Aktiv: Filtert manuelle Klicks", + "tooltip.chestseparators.rule.manual_inactive": "Inaktiv: Manuelle Klicks ignorieren Filter", + "button.chestseparators.shift_insert": "Shift-Einfügen", + "tooltip.chestseparators.rule.shift_active": "Aktiv: Filtert Shift-Klicks", + "tooltip.chestseparators.rule.shift_inactive": "Inaktiv: Shift-Klicks ignorieren Filter", + "button.chestseparators.hopper_insert": "Trichter-Einfügen", + "tooltip.chestseparators.rule.hopper_active": "Aktiv: Filtert Trichter-Transfers", + "tooltip.chestseparators.rule.hopper_inactive": "Inaktiv: Trichter ignorieren Filter", + "button.chestseparators.delete": "Löschen", + "tooltip.chestseparators.desc.delete_group": "Löscht diese Filtergruppe", + "button.chestseparators.save": "Speichern", + "tooltip.chestseparators.desc.save": "Speichert Änderungen", + "tooltip.chestseparators.desc.cancel": "Verwirft Änderungen", + "gui.chestseparators.unsaved_changes_title": "Ungespeicherte Änderungen", + "gui.chestseparators.unsaved_changes_desc": "Du hast ungespeicherte Änderungen in diesem Filter.", + "gui.chestseparators.new_detected": "Neu erkannt: %s", + "gui.chestseparators.allowing_all": "Alle zulassen: %s", + "gui.chestseparators.clearing": "Leeren: %s", + "gui.chestseparators.allowed": "Zugelassen: %s", + "gui.chestseparators.blocked": "Blockiert: %s", + "gui.chestseparators.edit_filter_rules": "Filterregeln bearbeiten", + "message.chestseparators.no_valid_groups": "Keine gültigen Gruppen.", + "button.chestseparators.eyedropper": "Pipette", + "tooltip.chestseparators.desc.eyedropper": "Farbe direkt vom Bildschirm aufnehmen", + "button.chestseparators.exit": "Beenden", + "tooltip.chestseparators.desc.exit": "Änderungen speichern und schließen", + "gui.chestseparators.hex": "Hex", + "gui.chestseparators.color_r": "R", + "gui.chestseparators.color_g": "G", + "gui.chestseparators.color_b": "B", + "gui.chestseparators.color_picker.instructions": "Mittelklick zum Kopieren. Linksklick auf einen Slot zum Einfügen.", + "window.chestseparators.edit_color": "Benutzerdefinierte Farbe bearbeiten", + "message.chestseparators.edit_buttons_visible": "Bearbeiten-Tasten: Sichtbar", + "message.chestseparators.edit_buttons_hidden": "Bearbeiten-Tasten: Versteckt", + "message.chestseparators.preview_panel_visible": "Vorschaufenster: Sichtbar", + "message.chestseparators.preview_panel_hidden": "Vorschaufenster: Versteckt", + "modmenu.descriptionTranslation.chestseparators": "Erreiche eine schnelle Inventar-Leerung mit benutzerdefiniertem Auto-Deposit. Das Spiel weiß endlich genau, was du wirklich willst und wo du es willst.", + "config.chestseparators.category.client": "Client / Optik", + "config.chestseparators.show_left_panel": "Linkes Panel anzeigen", + "config.chestseparators.show_left_panel.tooltip": "Zeigt das Whitelist-Vorschaufenster an. Modifikatortaste gedrückt halten zum Erzwingen.", + "config.chestseparators.enable_preview_animation": "Vorschau-Animation aktivieren", + "config.chestseparators.enable_preview_animation.tooltip": "Scrollt automatisch durch die Gegenstandsliste im Vorschaufenster.", + "config.chestseparators.show_edit_buttons": "Editor-Tasten anzeigen", + "config.chestseparators.show_edit_buttons.tooltip": "Zeigt die Werkzeugtasten in der Truhe an.", + "config.chestseparators.bg_transparency": "Hintergrundtransparenz", + "config.chestseparators.bg_transparency.tooltip": "Deckkraft der Slot-Hintergrundfarben (0 = Unsichtbar, 100 = Solide).", + "config.chestseparators.line_transparency": "Linientransparenz", + "config.chestseparators.line_transparency.tooltip": "Deckkraft der Trennlinien (0 = Unsichtbar, 100 = Solide).", + "config.chestseparators.default_rule_manual": "Standardregel: Manuell", + "config.chestseparators.default_rule_manual.tooltip": "Neue Gruppen erlauben standardmäßig manuelle Klicks.", + "config.chestseparators.default_rule_shift": "Standardregel: Shift", + "config.chestseparators.default_rule_shift.tooltip": "Neue Gruppen erlauben standardmäßig Shift-Klicks.", + "config.chestseparators.default_rule_hopper": "Standardregel: Trichter", + "config.chestseparators.default_rule_hopper.tooltip": "Neue Gruppen erlauben standardmäßig Trichter-Einfügen.", + "config.chestseparators.default_rule_pickup": "Standardregel: Aufheben", + "config.chestseparators.default_rule_pickup.tooltip": "Neue Inventargruppen filtern standardmäßig aufgehobene Gegenstände.", + "config.chestseparators.category.server": "Server / Mechanik", + "config.chestseparators.expel_invalid_items": "Ungültige Gegenstände auswerfen", + "config.chestseparators.expel_invalid_items.tooltip": "Beim Anwenden eines Filters werden ungültige Gegenstände ins Inventar verschoben oder fallengelassen.", + "config.chestseparators.category.hotkeys": "Tastenbelegung", + "config.chestseparators.toggle_preview_panel": "Vorschaufenster umschalten", + "config.chestseparators.toggle_preview_panel.tooltip": "Linkes Vorschaufenster schnell ein-/ausblenden.", + "config.chestseparators.show_panel_modifier": "Panel-Modifikator", + "config.chestseparators.show_panel_modifier.tooltip": "Taste gedrückt halten, um das linke Panel zu erzwingen.", + "color.chestseparators.custom": "Benutzerdefinierte Farbe %s", + "button.chestseparators.import_search": "Suche importieren", + "message.chestseparators.locked": "Jemand anderes bearbeitet diese Truhe bereits!", + "gui.chestseparators.expel_items_title": "Ungültige Gegenstände auswerfen?", + "gui.chestseparators.expel_items_desc": "Einige Gegenstände in diesen Plätzen entsprechen nicht den neuen Regeln. Sie werden aus der Truhe ausgeworfen.", + "button.chestseparators.accept_expel": "Akzeptieren & Auswerfen", + "config.chestseparators.dark_mode": "Dunkelmodus", + "config.chestseparators.dark_mode.tooltip": "Wechselt zwischen dunklem und hellem UI-Design.", + "config.chestseparators.show_deposit_button": "Ablage-Schaltfläche anzeigen", + "message.chestseparators.deposit_button_visible": "Ablage-Schaltfläche: Sichtbar", + "message.chestseparators.deposit_button_hidden": "Ablage-Schaltfläche: Versteckt", + "key.chestseparators.toggle_magnifier": "Lupe umschalten", + "key.chestseparators.toggle_edit_buttons": "Werkzeugleiste umschalten", + "config.chestseparators.toggle_edit_buttons": "Werkzeugleiste umschalten", + "config.chestseparators.toggle_edit_buttons.tooltip": "Blendet die gesamte obere Werkzeugleiste auf einmal ein/aus.", + "config.chestseparators.toggle_magnifier": "Lupe umschalten", + "config.chestseparators.magnifier_enabled": "Lupe anzeigen", + "config.chestseparators.magnifier_enabled.tooltip": "Zeigt eine Zoom-Lupe am Cursor beim Malen von Trennern oder mit der Pipette.", + "config.chestseparators.magnifier_shape": "Lupenform", + "config.chestseparators.magnifier_shape.tooltip": "Ob die Lupe rund oder eckig ist.", + "config.chestseparators.magnifier_shape.circle": "Kreis", + "config.chestseparators.magnifier_shape.square": "Quadrat", + "config.chestseparators.magnifier_tab_lines": "Lupe: Linien", + "config.chestseparators.magnifier_tab_backgrounds": "Lupe: Hintergründe", + "config.chestseparators.magnifier_tab_combo": "Lupe: Kombi-Modus", + "message.chestseparators.magnifier_on": "Lupe: An", + "message.chestseparators.magnifier_off": "Lupe: Aus", + "message.chestseparators.magnifier_hint": "Tipp: Drücke %s für eine Zoom-Lupe", + "message.chestseparators.tag_hint": "Tipp: Mittelklick auf ein Item zeigt seine Tags", + "message.chestseparators.magnifier_hint_off": "Tipp: Drücke %s, um die Zoom-Lupe auszublenden", + "config.chestseparators.show_deposit_button.tooltip": "Zeigt oder verbirgt die Schnelleinlagerungs-Schaltfläche in der Truhenoberfläche.", + "tooltip.chestseparators.deposit_items": "In Filter einlagern\n§8[Shift + Klick] In Filter & Leere Slots einlagern", + "message.chestseparators.deposited": "%s Items eingelagert.", + "message.chestseparators.deposit_failed": "Keine gültigen Slots zum Einlagern gefunden.", + "config.chestseparators.close_on_click_outside": "Beim Klicken außerhalb schließen", + "config.chestseparators.close_on_click_outside.tooltip": "Schließt das Menü, wenn außerhalb der Benutzeroberfläche geklickt wird.", + "config.chestseparators.shared_custom_colors": "Gemeinsame Benutzerfarben", + "config.chestseparators.shared_custom_colors.tooltip": "Wenn aktiviert, wird die Benutzerfarben-Spalte von den Tabs Linien, Hintergründe und Kombi gemeinsam genutzt. Wenn deaktiviert, hat jeder Tab eigene.", + "title.chestseparators.config": "Absolute Order Konfiguration", + "category.chestseparators.keys": "Absolute Order", + "key.category.chestseparators.keys": "Absolute Order", + "config.chestseparators.auto_deposit_enabled": "Auto-Einlagern in nahe Truhen", + "config.chestseparators.auto_deposit_enabled.tooltip": "Sortiere dein ganzes Inventar mit einem Auslöser in nahe gefilterte Truhen.", + "config.chestseparators.auto_deposit_double_sneak": "Auslöser: Doppeltes Schleichen", + "config.chestseparators.auto_deposit_double_sneak.tooltip": "Tippe die Schleichen-Taste schnell zweimal, um automatisch einzulagern.", + "config.chestseparators.auto_deposit_radius": "Auto-Einlager-Radius", + "config.chestseparators.auto_deposit_radius.tooltip": "Wie weit um dich herum (in Blöcken) nach Truhen gesucht wird.", + "config.chestseparators.auto_deposit_through_walls": "Durch Wände einlagern", + "config.chestseparators.auto_deposit_through_walls.tooltip": "Erlaubt das Einlagern in Truhen, die durch feste Blöcke verdeckt sind. Wenn aus, muss der Weg frei sein.", + "config.chestseparators.auto_deposit": "Auto-Einlagern", + "key.chestseparators.auto_deposit": "Auto-Einlagern in nahe Truhen", + "message.chestseparators.auto_deposit_done": "%s Gegenstände automatisch eingelagert.", + "message.chestseparators.auto_deposit_none": "Keine gefilterten Truhen in Reichweite.", + "message.chestseparators.auto_grab_done": "%s Gegenstände geholt.", + "message.chestseparators.auto_grab_none": "Nichts in der Nähe zum Holen.", + "message.chestseparators.preset_loaded": "Preset %s geladen.", + "message.chestseparators.preset_saved": "Preset %s gespeichert.", + "message.chestseparators.preset_empty": "Preset %s ist leer.", + "config.chestseparators.auto_deposit_animation": "Einlager-Animation", + "config.chestseparators.auto_deposit_animation.tooltip": "Zeigt die 3D-Gegenstände, die zu jeder Truhe fliegen. Wenn aus, werden Gegenstände sofort ohne Animation eingelagert.", + "config.chestseparators.auto_deposit_trail": "Spur-Effekt", + "config.chestseparators.auto_deposit_trail.tooltip": "Hinterlässt eine Partikelspur hinter jedem fliegenden Gegenstand. Gilt nur, wenn die Animation an ist.", + "button.chestseparators.pickup_insert": "Aufheben", + "tooltip.chestseparators.rule.pickup_active": "Aktiv: Filtert aufgehobene Gegenstände", + "tooltip.chestseparators.rule.pickup_inactive": "Inaktiv: Aufgehobene Gegenstände ignorieren den Filter", + "tooltip.chestseparators.edit_inventory_toggle": "Inventar / Truhe bearbeiten", + "message.chestseparators.editing_inventory": "Bearbeiten: Inventar", + "message.chestseparators.editing_chest": "Bearbeiten: Truhe", + "message.chestseparators.preset_deleted": "Preset %s gelöscht.", + "gui.chestseparators.preset_overwrite_title": "Preset %s überschreiben?", + "gui.chestseparators.preset_overwrite_body": "Das gespeicherte Preset geht verloren.", + "gui.chestseparators.preset_page": "Seite %s/%s", + "gui.chestseparators.preview_delete": "Wird gelöscht", + "key.chestseparators.push": "In Truhenfilter einlagern", + "config.chestseparators.push": "In Truhenfilter einlagern", + "config.chestseparators.push.tooltip": "Legt passende Gegenstände in die Filter der offenen Truhe.\n§8[Umschalt] halten, um auch leere Slots zu füllen", + "key.chestseparators.pull": "In Inventarfilter holen", + "config.chestseparators.pull": "In Inventarfilter holen", + "config.chestseparators.pull.tooltip": "Holt die Gegenstände der Truhe in deine Inventarfilter.\n§8[Umschalt] halten, um auch ungefilterte Gegenstände zu holen", + "config.chestseparators.lock_hotbar_on_reorder": "Hotbar beim Sortieren sperren", + "config.chestseparators.lock_hotbar_on_reorder.tooltip": "Wenn ein Einlagern oder Herausholen dein Inventar sortiert, bleibt die Hotbar unberührt.", + "config.chestseparators.lock_hotbar_on_reorder.tooltip2": "Schützt ein gehaltenes Objekt. Aus: Die Hotbar wird mitsortiert.", + "message.chestseparators.push_no_filters": "Diese Truhe hat noch keine Filter.", + "message.chestseparators.push_no_slot": "Kein freier Filter-Slot dafür.", + "message.chestseparators.pull_no_filters": "Dein Inventar hat noch keine Filter.", + "message.chestseparators.pull_no_match": "Nichts hier passt zu deinen Filtern." +} diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/lang/en_us.json b/multiloader-26.3/common/src/main/resources/assets/chestseparators/lang/en_us.json new file mode 100644 index 0000000..d976231 --- /dev/null +++ b/multiloader-26.3/common/src/main/resources/assets/chestseparators/lang/en_us.json @@ -0,0 +1,281 @@ +{ + "tooltip.chestseparators.edit_mode": "Edit Layout", + "tooltip.chestseparators.whitelist_mode": "Manage Filters", + "itemGroup.chestseparators.chest_and_inventory": "Chest & Inventory", + "gui.chestseparators.search": "Search", + "button.chestseparators.copy_layout": "Copy Layout", + "message.chestseparators.layout_copied": "Layout Copied!", + "tooltip.chestseparators.desc.copy_layout": "Copies the current layout to clipboard", + "button.chestseparators.paste_layout": "Paste Layout", + "message.chestseparators.layout_pasted": "Layout Pasted!", + "tooltip.chestseparators.desc.paste_layout": "Pastes the copied layout from clipboard", + "button.chestseparators.undo_action": "Undo Action", + "tooltip.chestseparators.desc.undo_action": "Reverts the last drawn action", + "button.chestseparators.redo_action": "Redo Action", + "tooltip.chestseparators.desc.redo_action": "Restores the previously undone action", + "tooltip.chestseparators.draw_area": "Draw Area", + "tooltip.chestseparators.erase_area": "Erase Area", + "tooltip.chestseparators.clear_lines": "Clear Lines", + "tooltip.chestseparators.clear_backgrounds": "Clear Backgrounds", + "tooltip.chestseparators.clear_both": "Clear Both", + "message.chestseparators.cleared": "Cleared", + "tooltip.chestseparators.draw_trace": "Draw Trace", + "tooltip.chestseparators.erase_trace": "Erase Trace", + "tooltip.chestseparators.open_palette": "Open Palette", + "message.chestseparators.color_copied": "Color Copied!", + "message.chestseparators.color_pasted": "Color Pasted!", + "tooltip.chestseparators.tab_lines": "Lines", + "tooltip.chestseparators.tab_backgrounds": "Backgrounds", + "tooltip.chestseparators.tab_combo": "Combo Mode", + "button.chestseparators.edit_filter": "Edit Filter", + "tooltip.chestseparators.desc.edit_filter": "Create or edit a filter for the selected slots", + "button.chestseparators.delete_all_filters": "Delete All Filters", + "tooltip.chestseparators.desc.delete_all_filters": "Deletes every filter in this chest", + "message.chestseparators.all_filters_deleted": "All Filters Deleted!", + "message.chestseparators.select_first": "Select at least one slot first.", + "button.chestseparators.area_select": "Area Select", + "tooltip.chestseparators.desc.area_select": "Select slots by dragging a rectangular area", + "button.chestseparators.trace_select": "Trace Select", + "tooltip.chestseparators.desc.trace_select": "Select slots by painting over them", + "button.chestseparators.clear_selection": "Clear Selection", + "tooltip.chestseparators.desc.clear_selection": "Clear all currently selected slots", + "button.chestseparators.copy_filters": "Copy Filters", + "message.chestseparators.filters_copied": "Filters Copied!", + "tooltip.chestseparators.desc.copy_filters": "Copy all filters from this chest to clipboard", + "button.chestseparators.paste_filters": "Paste Filters", + "message.chestseparators.filters_pasted": "Filters Pasted!", + "message.chestseparators.undone": "Undone: %s", + "message.chestseparators.redone": "Redone: %s", + "message.chestseparators.action.layout": "Layout", + "message.chestseparators.action.filter": "Filter", + "tooltip.chestseparators.desc.paste_filters": "Paste filters from clipboard to this chest", + "button.chestseparators.undo": "Undo", + "tooltip.chestseparators.desc.undo": "Undo the last filter action", + "button.chestseparators.redo": "Redo", + "button.chestseparators.fill_inventory": "Fill Inventory", + "button.chestseparators.preset_load": "Load", + "button.chestseparators.preset_save": "Save", + "tooltip.chestseparators.desc.redo": "Redo the previously undone action", + "tooltip.chestseparators.desc.fill_inventory": "Pull filtered items here (up to target)", + "tooltip.chestseparators.push_to_chest": "Push items to chest\n§8Hold [Shift] to include empty slots", + "tooltip.chestseparators.push_to_chest.shift": "Push items to chest + empty slots", + "tooltip.chestseparators.pull_from_chest": "Pull items from chest\n§8Hold [Shift] to also pull unfiltered items", + "tooltip.chestseparators.desc.presets": "Inventory presets: save & load layouts and filters", + "tooltip.chestseparators.desc.chest_presets": "Chest presets: save & load chest layouts and filters", + "button.chestseparators.conflict.overwrite": "Overwrite existing filters", + "tooltip.chestseparators.desc.conflict.overwrite": "Deletes existing filters in the selection and creates a new one", + "button.chestseparators.conflict.deselect": "Deselect conflicts & continue", + "message.chestseparators.empty_selection": "Empty selection.", + "tooltip.chestseparators.desc.conflict.deselect": "Keeps existing filters intact and only applies to empty slots", + "button.chestseparators.cancel": "Cancel", + "tooltip.chestseparators.desc.conflict.cancel": "Abort filter creation", + "button.chestseparators.confirm": "Confirm", + "gui.chestseparators.conflict_title": "Selection Conflict!", + "gui.chestseparators.presets_title": "Inventory Presets", + "gui.chestseparators.chest_presets_title": "Chest Presets", + "gui.chestseparators.preview_layout": "Layout", + "gui.chestseparators.preview_filters": "Filters", + "gui.chestseparators.preset_slot": "Preset %s", + "gui.chestseparators.preset.building": "Building", + "gui.chestseparators.preset.mining": "Mining", + "gui.chestseparators.preset.food": "Food & Farming", + "gui.chestseparators.preset.redstone": "Redstone", + "gui.chestseparators.preset.combat": "Combat", + "gui.chestseparators.preset.inv_miner": "Miner", + "gui.chestseparators.preset.inv_builder": "Builder", + "gui.chestseparators.preset.inv_explorer": "Explorer", + "gui.chestseparators.preset.inv_farmer": "Farmer", + "gui.chestseparators.preset.inv_nether_end": "Nether & End", + "gui.chestseparators.conflict_desc": "Some selected slots already have a filter.", + "gui.chestseparators.group_filter": "Group Filter", + "gui.chestseparators.no_filter": "No Filter", + "gui.chestseparators.items_count": "Items: %s", + "gui.chestseparators.hover_group": "Hover a group...", + "gui.chestseparators.empty_whitelist": "Empty whitelist.", + "button.chestseparators.save_and_exit": "Save and Exit", + "button.chestseparators.discard_changes": "Discard Changes", + "button.chestseparators.import_extracted": "Import Extracted", + "message.chestseparators.items_already_in_filter": "Items already in filter.", + "message.chestseparators.no_new_items_found": "No new items found.", + "tooltip.chestseparators.desc.import_extracted": "Adds the items found in the selected slots to the filter.", + "tooltip.chestseparators.desc.import_search": "Import Search", + "button.chestseparators.allow_all": "Allow All", + "tooltip.chestseparators.desc.allow_all": "Whitelists all game items", + "button.chestseparators.clear_all": "Clear All", + "tooltip.chestseparators.desc.clear_all": "Clears the current whitelist", + "button.chestseparators.manual_insert": "Manual Insert", + "tooltip.chestseparators.rule.manual_active": "Active: Filters manual clicks", + "tooltip.chestseparators.rule.manual_inactive": "Inactive: Manual clicks ignore filter", + "button.chestseparators.shift_insert": "Shift Insert", + "tooltip.chestseparators.rule.shift_active": "Active: Filters shift-clicks", + "tooltip.chestseparators.rule.shift_inactive": "Inactive: Shift-clicks ignore filter", + "button.chestseparators.hopper_insert": "Hopper Insert", + "tooltip.chestseparators.rule.hopper_active": "Active: Filters hopper transfers", + "tooltip.chestseparators.rule.hopper_inactive": "Inactive: Hoppers ignore filter", + "button.chestseparators.delete": "Delete", + "tooltip.chestseparators.desc.delete_group": "Deletes this filter group", + "button.chestseparators.save": "Save", + "tooltip.chestseparators.desc.save": "Saves changes", + "tooltip.chestseparators.desc.cancel": "Discards changes", + "gui.chestseparators.unsaved_changes_title": "Unsaved Changes", + "gui.chestseparators.unsaved_changes_desc": "You have unsaved changes in this filter.", + "gui.chestseparators.new_detected": "New detected: %s", + "gui.chestseparators.allowing_all": "Allowing All: %s", + "gui.chestseparators.clearing": "Clearing: %s", + "gui.chestseparators.allowed": "Allowed: %s", + "gui.chestseparators.blocked": "Blocked: %s", + "gui.chestseparators.edit_filter_rules": "Edit Filter Rules", + "message.chestseparators.no_valid_groups": "No valid groups.", + "button.chestseparators.eyedropper": "Eyedropper", + "tooltip.chestseparators.desc.eyedropper": "Pick a color directly from the screen", + "button.chestseparators.exit": "Exit", + "tooltip.chestseparators.desc.exit": "Save changes and close the color picker", + "gui.chestseparators.hex": "Hex", + "gui.chestseparators.color_r": "R", + "gui.chestseparators.color_g": "G", + "gui.chestseparators.color_b": "B", + "gui.chestseparators.color_picker.instructions": "Middle-click a color to copy. Left-click a custom slot to paste.", + "window.chestseparators.edit_color": "Edit Custom Color", + "message.chestseparators.edit_buttons_visible": "Edit Buttons: Visible", + "message.chestseparators.edit_buttons_hidden": "Edit Buttons: Hidden", + "message.chestseparators.preview_panel_visible": "Preview Panel: Visible", + "message.chestseparators.preview_panel_hidden": "Preview Panel: Hidden", + "config.chestseparators.category.client": "Client / Visuals", + "config.chestseparators.show_left_panel": "Show Left Panel", + "config.chestseparators.show_left_panel.tooltip": "Shows the whitelist preview panel in standard chest UI. Hold modifier key to override.", + "config.chestseparators.enable_preview_animation": "Enable Preview Animation", + "config.chestseparators.enable_preview_animation.tooltip": "Automatically scrolls the item list in the preview panel.", + "config.chestseparators.show_edit_buttons": "Show toolbar (master)", + "config.chestseparators.show_edit_buttons.tooltip": "Master switch for the right-side toolbar. Turn off to hide every icon at once.", + "config.chestseparators.bg_transparency": "Background Transparency", + "config.chestseparators.bg_transparency.tooltip": "Opacity level for the slot background colors (0 = Invisible, 100 = Solid).", + "config.chestseparators.line_transparency": "Line Transparency", + "config.chestseparators.line_transparency.tooltip": "Opacity level for the separator lines (0 = Invisible, 100 = Solid).", + "config.chestseparators.default_rule_manual": "Default Rule: Manual", + "config.chestseparators.default_rule_manual.tooltip": "Newly created groups will allow manual clicks by default.", + "config.chestseparators.default_rule_shift": "Default Rule: Shift", + "config.chestseparators.default_rule_shift.tooltip": "Newly created groups will allow shift-clicks by default.", + "config.chestseparators.default_rule_hopper": "Default Rule: Hopper", + "config.chestseparators.default_rule_hopper.tooltip": "Newly created groups will allow hopper insertion by default.", + "config.chestseparators.default_rule_pickup": "Default Rule: Pick Up", + "config.chestseparators.default_rule_pickup.tooltip": "Newly created inventory groups will filter picked-up items by default.", + "config.chestseparators.category.server": "Server / Mechanics", + "config.chestseparators.expel_invalid_items": "Expel Invalid Items", + "config.chestseparators.expel_invalid_items.tooltip": "When applying a new filter, existing invalid items will be pushed to the player's inventory or dropped.", + "config.chestseparators.category.hotkeys": "Hotkeys", + "config.chestseparators.toggle_preview_panel": "Toggle Preview Panel", + "config.chestseparators.toggle_preview_panel.tooltip": "Quickly show/hide the left preview panel.", + "config.chestseparators.show_panel_modifier": "Show Panel Modifier", + "config.chestseparators.show_panel_modifier.tooltip": "Hold this key to force the left panel to show if disabled.", + "color.chestseparators.custom": "Custom Color %s", + "button.chestseparators.import_search": "Import Search", + "message.chestseparators.locked": "Someone is already editing this chest!", + "gui.chestseparators.expel_items_title": "Expel Invalid Items?", + "gui.chestseparators.expel_items_desc": "Some items currently in these slots do not match the new rules. They will be ejected from the chest.", + "button.chestseparators.accept_expel": "Accept & Expel", + "config.chestseparators.dark_mode": "Dark Mode", + "config.chestseparators.dark_mode.tooltip": "Toggle between dark and light UI themes.", + "key.chestseparators.toggle_preview_panel": "Toggle Preview Panel", + "key.chestseparators.show_panel_modifier": "Show Panel Modifier", + "config.chestseparators.show_deposit_button": "Deposit (inventory → chest)", + "config.chestseparators.group.interface": "Interface", + "config.chestseparators.group.layout": "Layout", + "config.chestseparators.group.filters": "Filters", + "config.chestseparators.group.toolbar_buttons": "Toolbar buttons", + "config.chestseparators.group.magnifier": "Magnifier", + "config.chestseparators.group.autodeposit": "Auto-deposit", + "config.chestseparators.btn_edit_lines": "Edit lines", + "config.chestseparators.btn_edit_lines.tooltip": "Show the edit-lines icon in the toolbar.", + "config.chestseparators.btn_filters": "Filters", + "config.chestseparators.btn_filters.tooltip": "Show the filters icon in the toolbar.", + "config.chestseparators.btn_fill_from_chest": "Deposit (chest → inventory)", + "config.chestseparators.btn_fill_from_chest.tooltip": "Show the deposit (chest → inventory) icon in the toolbar.", + "config.chestseparators.btn_inventory_presets": "Inventory presets", + "config.chestseparators.btn_inventory_presets.tooltip": "Show the inventory presets icon in the toolbar.", + "config.chestseparators.btn_chest_presets": "Chest presets", + "config.chestseparators.btn_chest_presets.tooltip": "Show the chest presets icon in the toolbar.", + "message.chestseparators.deposit_button_visible": "Deposit Button: Visible", + "message.chestseparators.deposit_button_hidden": "Deposit Button: Hidden", + "key.chestseparators.toggle_magnifier": "Toggle Magnifier", + "key.chestseparators.toggle_edit_buttons": "Toggle Toolbar", + "config.chestseparators.toggle_edit_buttons": "Toggle Toolbar", + "config.chestseparators.toggle_edit_buttons.tooltip": "Show or hide the entire top toolbar at once.", + "config.chestseparators.toggle_magnifier": "Toggle Magnifier", + "config.chestseparators.magnifier_enabled": "Show Magnifier", + "config.chestseparators.magnifier_enabled.tooltip": "Shows a zoom loupe at the cursor while painting separators or using the eyedropper.", + "config.chestseparators.magnifier_shape": "Magnifier Shape", + "config.chestseparators.magnifier_shape.tooltip": "Whether the magnifier loupe is round or square.", + "config.chestseparators.magnifier_shape.circle": "Circle", + "config.chestseparators.magnifier_shape.square": "Square", + "config.chestseparators.magnifier_tab_lines": "Magnifier: Lines", + "config.chestseparators.magnifier_tab_backgrounds": "Magnifier: Backgrounds", + "config.chestseparators.magnifier_tab_combo": "Magnifier: Combo Mode", + "message.chestseparators.magnifier_on": "Magnifier: On", + "message.chestseparators.magnifier_off": "Magnifier: Off", + "message.chestseparators.magnifier_hint": "Tip: press %s for a zoom loupe", + "message.chestseparators.tag_hint": "Tip: middle-click an item to browse its tags", + "message.chestseparators.magnifier_hint_off": "Tip: press %s to hide the zoom loupe", + "config.chestseparators.show_deposit_button.tooltip": "Show the deposit (inventory → chest) icon in the toolbar.", + "tooltip.chestseparators.deposit_items": "Deposit to Filters\n§8Hold [Shift] for more options", + "tooltip.chestseparators.deposit_items.shift": "Deposit to Filters & Empty Slots", + "message.chestseparators.deposited": "Deposited %s items.", + "message.chestseparators.deposit_failed": "No valid slots found to deposit items.", + "config.chestseparators.close_on_click_outside": "Close on Click Outside", + "config.chestseparators.close_on_click_outside.tooltip": "Closes the menu when clicking outside the interface.", + "config.chestseparators.shared_custom_colors": "Shared Custom Colors", + "config.chestseparators.shared_custom_colors.tooltip": "When enabled, the custom color column is shared across the Lines, Backgrounds and Combo tabs. When disabled, each tab keeps its own.", + "title.chestseparators.config": "Absolute Order Configuration", + "category.chestseparators.keys": "Absolute Order", + "key.category.chestseparators.keys": "Absolute Order", + "modmenu.descriptionTranslation.chestseparators": "Achieve fast inventory clearing with custom auto-deposit. The game finally knows exactly what you really want and where you want it.", + "config.chestseparators.auto_deposit_enabled": "Auto-Deposit to Nearby Chests", + "config.chestseparators.auto_deposit_enabled.tooltip": "Sort your whole inventory into nearby filtered chests with a single trigger.", + "config.chestseparators.auto_deposit_double_sneak": "Trigger: Double-Sneak", + "config.chestseparators.auto_deposit_double_sneak.tooltip": "Quickly tap the sneak key twice to auto-deposit.", + "config.chestseparators.auto_deposit_radius": "Auto-Deposit Radius", + "config.chestseparators.auto_deposit_radius.tooltip": "How far around you (in blocks) chests are searched.", + "config.chestseparators.auto_deposit_through_walls": "Deposit Through Walls", + "config.chestseparators.auto_deposit_through_walls.tooltip": "Allow depositing into chests blocked by solid blocks. When off, the path must be clear.", + "config.chestseparators.auto_deposit": "Auto-Deposit", + "key.chestseparators.auto_deposit": "Auto-Deposit to Nearby Chests", + "message.chestseparators.auto_deposit_done": "Auto-deposited %s items.", + "message.chestseparators.auto_deposit_none": "No nearby filtered chests in reach.", + "message.chestseparators.auto_grab_done": "Grabbed %s items.", + "message.chestseparators.auto_grab_none": "Nothing nearby to grab.", + "message.chestseparators.preset_loaded": "Preset %s loaded.", + "message.chestseparators.preset_saved": "Preset %s saved.", + "message.chestseparators.preset_empty": "Preset %s is empty.", + "config.chestseparators.auto_deposit_animation": "Deposit Animation", + "config.chestseparators.auto_deposit_animation.tooltip": "Show the 3D items flying to each chest. When off, items are deposited instantly with no animation.", + "config.chestseparators.auto_deposit_trail": "Deposit Trail Effect", + "config.chestseparators.auto_deposit_trail.tooltip": "Leave a particle trail behind each flying item. Only applies when the animation is on.", + "button.chestseparators.pickup_insert": "Pick Up", + "tooltip.chestseparators.rule.pickup_active": "Active: Filters picked-up items", + "tooltip.chestseparators.rule.pickup_inactive": "Inactive: Picked-up items ignore filter", + "tooltip.chestseparators.edit_inventory_toggle": "Edit Inventory / Chest", + "message.chestseparators.editing_inventory": "Editing: Inventory", + "message.chestseparators.editing_chest": "Editing: Chest", + "message.chestseparators.preset_deleted": "Preset %s deleted.", + "gui.chestseparators.preset_overwrite_title": "Overwrite Preset %s?", + "gui.chestseparators.preset_overwrite_body": "The saved preset will be lost.", + "gui.chestseparators.preset_page": "Page %s/%s", + "gui.chestseparators.preview_delete": "Will be deleted", + "config.chestseparators.magnifier_tab_lines.tooltip": "Show the separator lines in the magnifier loupe.", + "config.chestseparators.magnifier_tab_backgrounds.tooltip": "Show the slot background colours in the magnifier loupe.", + "config.chestseparators.magnifier_tab_combo.tooltip": "Show combo-mode painting (lines + backgrounds) in the magnifier loupe.", + "config.chestseparators.toggle_magnifier.tooltip": "Toggle the zoom magnifier while painting or picking colours.", + "config.chestseparators.auto_deposit.tooltip": "Key to deposit your inventory into nearby chests with matching filters.", + "key.chestseparators.push": "Push to Chest Filters", + "config.chestseparators.push": "Push to Chest Filters", + "config.chestseparators.push.tooltip": "Push matching items into the open chest's filters.\n§8Hold [Shift] to also fill empty slots", + "key.chestseparators.pull": "Pull to Inventory Filters", + "config.chestseparators.pull": "Pull to Inventory Filters", + "config.chestseparators.pull.tooltip": "Pull the chest's items into your inventory filters.\n§8Hold [Shift] to also pull unfiltered items", + "config.chestseparators.lock_hotbar_on_reorder": "Lock Hotbar on Auto-Sort", + "config.chestseparators.lock_hotbar_on_reorder.tooltip": "When a push or pull re-sorts your inventory, the hotbar is left untouched.", + "config.chestseparators.lock_hotbar_on_reorder.tooltip2": "Protects an item you might be holding. Off: the hotbar sorts too.", + "message.chestseparators.push_no_filters": "This chest has no filters yet.", + "message.chestseparators.push_no_slot": "No free filter slot for these items.", + "message.chestseparators.pull_no_filters": "Your inventory has no filters yet.", + "message.chestseparators.pull_no_match": "Nothing here matches your filters." +} diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/lang/es_es.json b/multiloader-26.3/common/src/main/resources/assets/chestseparators/lang/es_es.json new file mode 100644 index 0000000..c8c6ee4 --- /dev/null +++ b/multiloader-26.3/common/src/main/resources/assets/chestseparators/lang/es_es.json @@ -0,0 +1,278 @@ +{ + "tooltip.chestseparators.edit_mode": "Editar Diseño", + "tooltip.chestseparators.whitelist_mode": "Gestionar Filtros", + "itemGroup.chestseparators.chest_and_inventory": "Cofre e Inventario", + "gui.chestseparators.search": "Buscar", + "button.chestseparators.copy_layout": "Copiar diseño", + "message.chestseparators.layout_copied": "¡Diseño copiado!", + "tooltip.chestseparators.desc.copy_layout": "Copia el diseño actual al portapapeles", + "button.chestseparators.paste_layout": "Pegar diseño", + "message.chestseparators.layout_pasted": "¡Diseño pegado!", + "tooltip.chestseparators.desc.paste_layout": "Pega el diseño desde el portapapeles", + "button.chestseparators.undo_action": "Deshacer", + "tooltip.chestseparators.desc.undo_action": "Revierte la última acción dibujada", + "button.chestseparators.redo_action": "Rehacer", + "tooltip.chestseparators.desc.redo_action": "Restaura la última acción deshecha", + "tooltip.chestseparators.draw_area": "Dibujar área", + "tooltip.chestseparators.erase_area": "Borrar área", + "tooltip.chestseparators.clear_lines": "Limpiar líneas", + "tooltip.chestseparators.clear_backgrounds": "Limpiar fondos", + "tooltip.chestseparators.clear_both": "Limpiar ambos", + "message.chestseparators.cleared": "Capa limpia", + "tooltip.chestseparators.draw_trace": "Dibujar trazo", + "tooltip.chestseparators.erase_trace": "Borrar trazo", + "tooltip.chestseparators.open_palette": "Abrir paleta", + "message.chestseparators.color_copied": "¡Color copiado!", + "message.chestseparators.color_pasted": "¡Color pegado!", + "tooltip.chestseparators.tab_lines": "Líneas", + "tooltip.chestseparators.tab_backgrounds": "Fondos", + "tooltip.chestseparators.tab_combo": "Modo Combinado", + "button.chestseparators.edit_filter": "Editar filtro", + "tooltip.chestseparators.desc.edit_filter": "Crea o edita un filtro para las ranuras seleccionadas", + "button.chestseparators.delete_all_filters": "Eliminar todos los filtros", + "tooltip.chestseparators.desc.delete_all_filters": "Elimina todos los filtros de este cofre", + "message.chestseparators.all_filters_deleted": "¡Todos los filtros eliminados!", + "message.chestseparators.select_first": "Selecciona al menos una ranura primero.", + "button.chestseparators.area_select": "Selección por área", + "tooltip.chestseparators.desc.area_select": "Selecciona ranuras arrastrando un área rectangular", + "button.chestseparators.trace_select": "Selección por trazo", + "tooltip.chestseparators.desc.trace_select": "Selecciona ranuras pintando sobre ellas", + "button.chestseparators.clear_selection": "Borrar selección", + "tooltip.chestseparators.desc.clear_selection": "Borra todas las ranuras seleccionadas actualmente", + "button.chestseparators.copy_filters": "Copiar filtros", + "message.chestseparators.filters_copied": "¡Filtros copiados!", + "tooltip.chestseparators.desc.copy_filters": "Copia todos los filtros de este cofre al portapapeles", + "button.chestseparators.paste_filters": "Pegar filtros", + "message.chestseparators.filters_pasted": "¡Filtros pegados!", + "message.chestseparators.undone": "Deshecho: %s", + "message.chestseparators.redone": "Rehecho: %s", + "message.chestseparators.action.layout": "Diseño", + "message.chestseparators.action.filter": "Filtro", + "tooltip.chestseparators.desc.paste_filters": "Pega los filtros del portapapeles en este cofre", + "button.chestseparators.undo": "Deshacer", + "tooltip.chestseparators.desc.undo": "Deshace la última acción de filtrado", + "button.chestseparators.redo": "Rehacer", + "button.chestseparators.fill_inventory": "Rellenar inventario", + "button.chestseparators.preset_load": "Cargar", + "button.chestseparators.preset_save": "Guardar", + "tooltip.chestseparators.desc.redo": "Rehace la acción previamente deshecha", + "tooltip.chestseparators.desc.fill_inventory": "Trae los items filtrados (hasta el objetivo)", + "tooltip.chestseparators.push_to_chest": "Envía items al cofre\n§8[Shift] para incluir huecos vacíos", + "tooltip.chestseparators.push_to_chest.shift": "Envía items al cofre + huecos vacíos", + "tooltip.chestseparators.pull_from_chest": "Trae items del cofre\n§8[Shift] para traer también los no filtrados", + "tooltip.chestseparators.desc.presets": "Presets de inventario: guarda y carga layouts y filtros", + "tooltip.chestseparators.desc.chest_presets": "Presets de cofre: guarda y carga diseños y filtros del cofre", + "button.chestseparators.conflict.overwrite": "Sobrescribir filtros existentes", + "tooltip.chestseparators.desc.conflict.overwrite": "Elimina los filtros existentes en la selección y crea uno nuevo", + "button.chestseparators.conflict.deselect": "Deseleccionar conflictos y continuar", + "message.chestseparators.empty_selection": "Selección vacía.", + "tooltip.chestseparators.desc.conflict.deselect": "Mantiene intactos los filtros existentes y solo se aplica a ranuras vacías", + "button.chestseparators.cancel": "Cancelar", + "tooltip.chestseparators.desc.conflict.cancel": "Cancela la creación del filtro", + "button.chestseparators.confirm": "Confirmar", + "gui.chestseparators.conflict_title": "¡Conflicto de selección!", + "gui.chestseparators.presets_title": "Presets de inventario", + "gui.chestseparators.chest_presets_title": "Presets de cofre", + "gui.chestseparators.preview_layout": "Diseño", + "gui.chestseparators.preview_filters": "Filtros", + "gui.chestseparators.preset_slot": "Preset %s", + "gui.chestseparators.preset.building": "Construcción", + "gui.chestseparators.preset.mining": "Minería", + "gui.chestseparators.preset.food": "Comida y granja", + "gui.chestseparators.preset.redstone": "Redstone", + "gui.chestseparators.preset.combat": "Combate", + "gui.chestseparators.preset.inv_miner": "Minero", + "gui.chestseparators.preset.inv_builder": "Constructor", + "gui.chestseparators.preset.inv_explorer": "Explorador", + "gui.chestseparators.preset.inv_farmer": "Granjero", + "gui.chestseparators.preset.inv_nether_end": "Nether y End", + "gui.chestseparators.conflict_desc": "Algunas ranuras seleccionadas ya tienen un filtro.", + "gui.chestseparators.group_filter": "Filtro de grupo", + "gui.chestseparators.no_filter": "Sin filtro", + "gui.chestseparators.items_count": "Objetos: %s", + "gui.chestseparators.hover_group": "Pasa el ratón sobre un grupo...", + "gui.chestseparators.empty_whitelist": "Lista blanca vacía.", + "button.chestseparators.save_and_exit": "Guardar y salir", + "button.chestseparators.discard_changes": "Descartar cambios", + "button.chestseparators.import_extracted": "Importar extraídos", + "message.chestseparators.items_already_in_filter": "Los objetos ya están en el filtro.", + "message.chestseparators.no_new_items_found": "No se encontraron objetos nuevos.", + "tooltip.chestseparators.desc.import_extracted": "Añade al filtro los objetos que hay en los slots seleccionados.", + "tooltip.chestseparators.desc.import_search": "Importar búsqueda", + "button.chestseparators.allow_all": "Permitir todos", + "tooltip.chestseparators.desc.allow_all": "Añade todos los objetos a la lista blanca", + "button.chestseparators.clear_all": "Limpiar todo", + "tooltip.chestseparators.desc.clear_all": "Limpia la lista blanca actual", + "button.chestseparators.manual_insert": "Inserción manual", + "tooltip.chestseparators.rule.manual_active": "Activo: Filtra clics manuales", + "tooltip.chestseparators.rule.manual_inactive": "Inactivo: Clics manuales ignoran el filtro", + "button.chestseparators.shift_insert": "Inserción con Shift", + "tooltip.chestseparators.rule.shift_active": "Activo: Filtra clics con Shift", + "tooltip.chestseparators.rule.shift_inactive": "Inactivo: Clics con Shift ignoran el filtro", + "button.chestseparators.hopper_insert": "Inserción por tolva", + "tooltip.chestseparators.rule.hopper_active": "Activo: Filtra transferencias por tolva", + "tooltip.chestseparators.rule.hopper_inactive": "Inactivo: Las tolvas ignoran el filtro", + "button.chestseparators.delete": "Eliminar", + "tooltip.chestseparators.desc.delete_group": "Elimina este grupo de filtros", + "button.chestseparators.save": "Guardar", + "tooltip.chestseparators.desc.save": "Guarda los cambios", + "tooltip.chestseparators.desc.cancel": "Descarta los cambios", + "gui.chestseparators.unsaved_changes_title": "Cambios sin guardar", + "gui.chestseparators.unsaved_changes_desc": "Tienes cambios sin guardar en este filtro.", + "gui.chestseparators.new_detected": "Nuevos detectados: %s", + "gui.chestseparators.allowing_all": "Permitiendo todos: %s", + "gui.chestseparators.clearing": "Limpiando: %s", + "gui.chestseparators.allowed": "Permitidos: %s", + "gui.chestseparators.blocked": "Bloqueados: %s", + "gui.chestseparators.edit_filter_rules": "Editar reglas del filtro", + "message.chestseparators.no_valid_groups": "No hay grupos válidos.", + "button.chestseparators.eyedropper": "Cuentagotas", + "tooltip.chestseparators.desc.eyedropper": "Elige un color directamente de la pantalla", + "button.chestseparators.exit": "Salir", + "tooltip.chestseparators.desc.exit": "Guarda los cambios y cierra el selector de color", + "gui.chestseparators.hex": "Hex", + "gui.chestseparators.color_r": "R", + "gui.chestseparators.color_g": "G", + "gui.chestseparators.color_b": "B", + "gui.chestseparators.color_picker.instructions": "Clic central en un color para copiar. Clic izquierdo en un hueco personalizado para pegar.", + "window.chestseparators.edit_color": "Editar color personalizado", + "message.chestseparators.edit_buttons_visible": "Botones de edición: Visibles", + "message.chestseparators.edit_buttons_hidden": "Botones de edición: Ocultos", + "message.chestseparators.preview_panel_visible": "Panel de previsualización: Visible", + "message.chestseparators.preview_panel_hidden": "Panel de previsualización: Oculto", + "modmenu.descriptionTranslation.chestseparators": "Logra un vaciado rápido del inventario con el depósito automático personalizado. El juego por fin sabe exactamente lo que quieres y dónde lo quieres.", + "config.chestseparators.category.client": "Cliente / Visuales", + "config.chestseparators.show_left_panel": "Mostrar panel izquierdo", + "config.chestseparators.show_left_panel.tooltip": "Muestra el panel de vista previa de la lista blanca. Mantén pulsada la tecla modificadora para anular.", + "config.chestseparators.enable_preview_animation": "Activar animación de vista previa", + "config.chestseparators.enable_preview_animation.tooltip": "Desplaza automáticamente la lista de objetos en el panel de vista previa.", + "config.chestseparators.show_edit_buttons": "Mostrar barra (principal)", + "config.chestseparators.show_edit_buttons.tooltip": "Interruptor principal de la barra derecha. Desactívalo para ocultar todos los iconos de golpe.", + "config.chestseparators.bg_transparency": "Transparencia del fondo", + "config.chestseparators.bg_transparency.tooltip": "Nivel de opacidad para el fondo de las ranuras (0 = Invisible, 100 = Sólido).", + "config.chestseparators.line_transparency": "Transparencia de líneas", + "config.chestseparators.line_transparency.tooltip": "Nivel de opacidad para las líneas separadoras (0 = Invisible, 100 = Sólido).", + "config.chestseparators.default_rule_manual": "Regla por defecto: Manual", + "config.chestseparators.default_rule_manual.tooltip": "Los grupos nuevos permitirán clics manuales por defecto.", + "config.chestseparators.default_rule_shift": "Regla por defecto: Shift", + "config.chestseparators.default_rule_shift.tooltip": "Los grupos nuevos permitirán clics con Shift por defecto.", + "config.chestseparators.default_rule_hopper": "Regla por defecto: Tolva", + "config.chestseparators.default_rule_hopper.tooltip": "Los grupos nuevos permitirán la inserción por tolva por defecto.", + "config.chestseparators.default_rule_pickup": "Regla por defecto: Recoger", + "config.chestseparators.default_rule_pickup.tooltip": "Los grupos de inventario nuevos filtrarán los objetos recogidos del suelo por defecto.", + "config.chestseparators.category.server": "Servidor / Mecánicas", + "config.chestseparators.expel_invalid_items": "Expulsar objetos no válidos", + "config.chestseparators.expel_invalid_items.tooltip": "Al aplicar un nuevo filtro, los objetos no válidos se moverán al inventario o se soltarán.", + "config.chestseparators.category.hotkeys": "Atajos de teclado", + "config.chestseparators.toggle_preview_panel": "Alternar panel de vista previa", + "config.chestseparators.toggle_preview_panel.tooltip": "Muestra/oculta rápidamente el panel izquierdo de vista previa.", + "config.chestseparators.show_panel_modifier": "Modificador del panel", + "config.chestseparators.show_panel_modifier.tooltip": "Mantén esta tecla para forzar que el panel izquierdo se muestre si está desactivado.", + "color.chestseparators.custom": "Color personalizado %s", + "button.chestseparators.import_search": "Importar Búsqueda", + "message.chestseparators.locked": "¡Alguien ya está editando este cofre!", + "gui.chestseparators.expel_items_title": "¿Expulsar objetos no válidos?", + "gui.chestseparators.expel_items_desc": "Algunos objetos que están en estos espacios no cumplen las nuevas reglas. Serán expulsados del cofre.", + "button.chestseparators.accept_expel": "Aceptar y Expulsar", + "config.chestseparators.dark_mode": "Modo Oscuro", + "config.chestseparators.dark_mode.tooltip": "Alterna entre los temas claro y oscuro de la interfaz.", + "config.chestseparators.show_deposit_button": "Depositar (inventario → cofre)", + "config.chestseparators.group.interface": "Interfaz", + "config.chestseparators.group.layout": "Diseño", + "config.chestseparators.group.filters": "Filtros", + "config.chestseparators.group.toolbar_buttons": "Botones de la barra", + "config.chestseparators.group.magnifier": "Lupa", + "config.chestseparators.group.autodeposit": "Autodepósito", + "config.chestseparators.btn_edit_lines": "Editar líneas", + "config.chestseparators.btn_edit_lines.tooltip": "Muestra el icono de editar líneas en la barra.", + "config.chestseparators.btn_filters": "Filtros", + "config.chestseparators.btn_filters.tooltip": "Muestra el icono de filtros en la barra.", + "config.chestseparators.btn_fill_from_chest": "Depositar (cofre → inventario)", + "config.chestseparators.btn_fill_from_chest.tooltip": "Muestra el icono de depositar (cofre → inventario) en la barra.", + "config.chestseparators.btn_inventory_presets": "Presets de inventario", + "config.chestseparators.btn_inventory_presets.tooltip": "Muestra el icono de presets de inventario en la barra.", + "config.chestseparators.btn_chest_presets": "Presets de cofre", + "config.chestseparators.btn_chest_presets.tooltip": "Muestra el icono de presets de cofre en la barra.", + "message.chestseparators.deposit_button_visible": "Botón de Depositar: Visible", + "message.chestseparators.deposit_button_hidden": "Botón de Depositar: Oculto", + "key.chestseparators.toggle_magnifier": "Alternar lupa", + "key.chestseparators.toggle_edit_buttons": "Alternar barra de botones", + "config.chestseparators.toggle_edit_buttons": "Alternar barra de botones", + "config.chestseparators.toggle_edit_buttons.tooltip": "Muestra u oculta toda la barra de botones superior de una vez.", + "config.chestseparators.toggle_magnifier": "Alternar lupa", + "config.chestseparators.magnifier_enabled": "Mostrar lupa", + "config.chestseparators.magnifier_enabled.tooltip": "Muestra una lupa de zoom en el cursor al pintar separadores o usar el cuentagotas.", + "config.chestseparators.magnifier_shape": "Forma de la lupa", + "config.chestseparators.magnifier_shape.tooltip": "Si la lupa es redonda o cuadrada.", + "config.chestseparators.magnifier_shape.circle": "Círculo", + "config.chestseparators.magnifier_shape.square": "Cuadrado", + "config.chestseparators.magnifier_tab_lines": "Lupa: Líneas", + "config.chestseparators.magnifier_tab_backgrounds": "Lupa: Fondos", + "config.chestseparators.magnifier_tab_combo": "Lupa: Modo Combinado", + "message.chestseparators.magnifier_on": "Lupa: Activada", + "message.chestseparators.magnifier_off": "Lupa: Desactivada", + "message.chestseparators.magnifier_hint": "Consejo: pulsa %s para una lupa de zoom", + "message.chestseparators.tag_hint": "Consejo: clic central en un ítem para ver sus etiquetas", + "message.chestseparators.magnifier_hint_off": "Consejo: pulsa %s para quitar la lupa de zoom", + "config.chestseparators.show_deposit_button.tooltip": "Muestra el icono de depositar (inventario → cofre) en la barra.", + "tooltip.chestseparators.deposit_items": "Depositar en Filtros\n§8[Shift + Click] Depositar en Filtros y Huecos Vacíos", + "message.chestseparators.deposited": "Se han depositado %s ítems.", + "message.chestseparators.deposit_failed": "No se han encontrado huecos válidos para depositar.", + "config.chestseparators.close_on_click_outside": "Cerrar al hacer clic fuera", + "config.chestseparators.close_on_click_outside.tooltip": "Cierra el menú al hacer clic fuera de la interfaz.", + "config.chestseparators.shared_custom_colors": "Colores Personalizados Compartidos", + "config.chestseparators.shared_custom_colors.tooltip": "Si está activado, la columna de colores personalizados es común a las pestañas Líneas, Fondos y Combo. Si está desactivado, cada pestaña tiene los suyos.", + "title.chestseparators.config": "Configuración de Absolute Order", + "category.chestseparators.keys": "Absolute Order", + "key.category.chestseparators.keys": "Absolute Order", + "config.chestseparators.auto_deposit_enabled": "Auto-depósito en cofres cercanos", + "config.chestseparators.auto_deposit_enabled.tooltip": "Ordena todo tu inventario en los cofres filtrados cercanos con un solo gesto.", + "config.chestseparators.auto_deposit_double_sneak": "Disparador: doble agacharse", + "config.chestseparators.auto_deposit_double_sneak.tooltip": "Pulsa dos veces seguidas la tecla de agacharse para auto-depositar.", + "config.chestseparators.auto_deposit_radius": "Radio de auto-depósito", + "config.chestseparators.auto_deposit_radius.tooltip": "Distancia a tu alrededor (en bloques) en la que se buscan cofres.", + "config.chestseparators.auto_deposit_through_walls": "Depositar a través de paredes", + "config.chestseparators.auto_deposit_through_walls.tooltip": "Permite depositar en cofres bloqueados por bloques sólidos. Si está desactivado, el camino debe estar libre.", + "config.chestseparators.auto_deposit": "Auto-depósito", + "key.chestseparators.auto_deposit": "Auto-depósito en cofres cercanos", + "message.chestseparators.auto_deposit_done": "Auto-depositados %s objetos.", + "message.chestseparators.auto_deposit_none": "No hay cofres filtrados cercanos al alcance.", + "message.chestseparators.auto_grab_done": "Recogidos %s objetos.", + "message.chestseparators.auto_grab_none": "Nada que recoger cerca.", + "message.chestseparators.preset_loaded": "Preset %s cargado.", + "message.chestseparators.preset_saved": "Preset %s guardado.", + "message.chestseparators.preset_empty": "El preset %s está vacío.", + "config.chestseparators.auto_deposit_animation": "Animación de depósito", + "config.chestseparators.auto_deposit_animation.tooltip": "Muestra los objetos 3D volando hacia cada cofre. Si está desactivado, los objetos se depositan al instante sin animación.", + "config.chestseparators.auto_deposit_trail": "Efecto de estela", + "config.chestseparators.auto_deposit_trail.tooltip": "Deja una estela de partículas tras cada objeto que vuela. Solo se aplica si la animación está activada.", + "button.chestseparators.pickup_insert": "Recoger", + "tooltip.chestseparators.rule.pickup_active": "Activo: Filtra items recogidos del suelo", + "tooltip.chestseparators.rule.pickup_inactive": "Inactivo: Los items recogidos ignoran el filtro", + "tooltip.chestseparators.edit_inventory_toggle": "Editar inventario / cofre", + "message.chestseparators.editing_inventory": "Editando: inventario", + "message.chestseparators.editing_chest": "Editando: cofre", + "message.chestseparators.preset_deleted": "Preset %s eliminado.", + "gui.chestseparators.preset_overwrite_title": "¿Sobrescribir el preset %s?", + "gui.chestseparators.preset_overwrite_body": "Se perderá el preset guardado.", + "gui.chestseparators.preset_page": "Página %s/%s", + "gui.chestseparators.preview_delete": "Se eliminará", + "config.chestseparators.magnifier_tab_lines.tooltip": "Muestra las líneas separadoras en la lupa.", + "config.chestseparators.magnifier_tab_backgrounds.tooltip": "Muestra los colores de fondo de los huecos en la lupa.", + "config.chestseparators.magnifier_tab_combo.tooltip": "Muestra el pintado en modo combinado (líneas + fondos) en la lupa.", + "config.chestseparators.toggle_magnifier.tooltip": "Activa/desactiva la lupa de zoom al pintar o elegir colores.", + "config.chestseparators.auto_deposit.tooltip": "Tecla para depositar tu inventario en cofres cercanos con filtros coincidentes.", + "key.chestseparators.push": "Enviar a Filtros del Cofre", + "config.chestseparators.push": "Enviar a Filtros del Cofre", + "config.chestseparators.push.tooltip": "Envía los objetos que coincidan a los filtros del cofre abierto.\n§8Mantén [Shift] para llenar también los huecos vacíos", + "key.chestseparators.pull": "Traer a Filtros del Inventario", + "config.chestseparators.pull": "Traer a Filtros del Inventario", + "config.chestseparators.pull.tooltip": "Trae los objetos del cofre a los filtros de tu inventario.\n§8Mantén [Shift] para traer también objetos sin filtro", + "config.chestseparators.lock_hotbar_on_reorder": "Bloquear hotbar al autoordenar", + "config.chestseparators.lock_hotbar_on_reorder.tooltip": "Cuando un push o pull reordena tu inventario, la hotbar se deja intacta.", + "config.chestseparators.lock_hotbar_on_reorder.tooltip2": "Protege un objeto que puedas tener en la mano. Desactivado: la hotbar también se ordena.", + "message.chestseparators.push_no_filters": "Este cofre aún no tiene filtros.", + "message.chestseparators.push_no_slot": "No hay hueco libre en los filtros.", + "message.chestseparators.pull_no_filters": "Tu inventario aún no tiene filtros.", + "message.chestseparators.pull_no_match": "Nada aquí coincide con tus filtros." +} diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/lang/eu_es.json b/multiloader-26.3/common/src/main/resources/assets/chestseparators/lang/eu_es.json new file mode 100644 index 0000000..f5a5b3f --- /dev/null +++ b/multiloader-26.3/common/src/main/resources/assets/chestseparators/lang/eu_es.json @@ -0,0 +1,257 @@ +{ + "tooltip.chestseparators.edit_mode": "Editatu diseinua", + "tooltip.chestseparators.whitelist_mode": "Kudeatu iragazkiak", + "itemGroup.chestseparators.chest_and_inventory": "Kutxa eta inbentarioa", + "gui.chestseparators.search": "Bilatu", + "button.chestseparators.copy_layout": "Kopiatu diseinua", + "message.chestseparators.layout_copied": "Diseinua kopiatu da!", + "tooltip.chestseparators.desc.copy_layout": "Uneko diseinua arbelean kopiatzen du", + "button.chestseparators.paste_layout": "Itsatsi diseinua", + "message.chestseparators.layout_pasted": "Diseinua itsatsi da!", + "tooltip.chestseparators.desc.paste_layout": "Arbeletik kopiatutako diseinua itsasten du", + "button.chestseparators.undo_action": "Desegin ekintza", + "tooltip.chestseparators.desc.undo_action": "Marraztutako azken ekintza desegiten du", + "button.chestseparators.redo_action": "Berregin ekintza", + "tooltip.chestseparators.desc.redo_action": "Aurrez desegindako ekintza leheneratzen du", + "tooltip.chestseparators.draw_area": "Marraztu eremua", + "tooltip.chestseparators.erase_area": "Ezabatu eremua", + "tooltip.chestseparators.clear_lines": "Garbitu lerroak", + "tooltip.chestseparators.clear_backgrounds": "Garbitu hondoak", + "tooltip.chestseparators.clear_both": "Garbitu biak", + "message.chestseparators.cleared": "Garbitu da", + "tooltip.chestseparators.draw_trace": "Marraztu trazoa", + "tooltip.chestseparators.erase_trace": "Ezabatu trazoa", + "tooltip.chestseparators.open_palette": "Ireki paleta", + "message.chestseparators.color_copied": "Kolorea kopiatu da!", + "message.chestseparators.color_pasted": "Kolorea itsatsi da!", + "tooltip.chestseparators.tab_lines": "Lerroak", + "tooltip.chestseparators.tab_backgrounds": "Hondoak", + "tooltip.chestseparators.tab_combo": "Modu konbinatua", + "button.chestseparators.edit_filter": "Editatu iragazkia", + "tooltip.chestseparators.desc.edit_filter": "Sortu edo editatu hautatutako zirrikituetarako iragazkia", + "button.chestseparators.delete_all_filters": "Ezabatu iragazki guztiak", + "tooltip.chestseparators.desc.delete_all_filters": "Kutxa honetako iragazki guztiak ezabatzen ditu", + "message.chestseparators.all_filters_deleted": "Iragazki guztiak ezabatu dira!", + "message.chestseparators.select_first": "Hautatu gutxienez zirrikitu bat lehenik.", + "button.chestseparators.area_select": "Eremu bidezko hautapena", + "tooltip.chestseparators.desc.area_select": "Hautatu zirrikituak eremu laukizuzena arrastatuz", + "button.chestseparators.trace_select": "Trazo bidezko hautapena", + "tooltip.chestseparators.desc.trace_select": "Hautatu zirrikituak haien gainean margotuz", + "button.chestseparators.clear_selection": "Garbitu hautapena", + "tooltip.chestseparators.desc.clear_selection": "Garbitu uneko hautatutako zirrikitu guztiak", + "button.chestseparators.copy_filters": "Kopiatu iragazkiak", + "message.chestseparators.filters_copied": "Iragazkiak kopiatu dira!", + "tooltip.chestseparators.desc.copy_filters": "Kutxa honetako iragazki guztiak arbelean kopiatzen ditu", + "button.chestseparators.paste_filters": "Itsatsi iragazkiak", + "message.chestseparators.filters_pasted": "Iragazkiak itsatsi dira!", + "message.chestseparators.undone": "Desegina: %s", + "message.chestseparators.redone": "Berreginda: %s", + "message.chestseparators.action.layout": "Diseinua", + "message.chestseparators.action.filter": "Iragazkia", + "tooltip.chestseparators.desc.paste_filters": "Arbeleko iragazkiak kutxa honetan itsasten ditu", + "button.chestseparators.undo": "Desegin", + "tooltip.chestseparators.desc.undo": "Azken iragazki ekintza desegiten du", + "button.chestseparators.redo": "Berregin", + "button.chestseparators.fill_inventory": "Bete inventarioa", + "button.chestseparators.preset_load": "Kargatu", + "button.chestseparators.preset_save": "Gorde", + "tooltip.chestseparators.desc.redo": "Aurrez desegindako ekintza leheneratzen du", + "tooltip.chestseparators.desc.fill_inventory": "Ekarri iragazitako itemak hona (helburura arte)", + "tooltip.chestseparators.push_to_chest": "Bidali itemak kutxara\n§8Eutsi [Shift] leku hutsak sartzeko", + "tooltip.chestseparators.push_to_chest.shift": "Kutxara + leku hutsak", + "tooltip.chestseparators.pull_from_chest": "Ekarri itemak kutxatik\n§8[Shift] iragazi gabekoak ere ekartzeko", + "tooltip.chestseparators.desc.presets": "Inventarioko aurrezarpenak: diseinuak eta iragazkiak gorde eta kargatu", + "tooltip.chestseparators.desc.chest_presets": "Kutxa aurrezarpenak: kutxaren diseinuak eta iragazkiak gorde eta kargatu", + "button.chestseparators.conflict.overwrite": "Gainidatzi lehendik dauden iragazkiak", + "tooltip.chestseparators.desc.conflict.overwrite": "Hautapeneko iragazkiak ezabatzen ditu eta berri bat sortzen du", + "button.chestseparators.conflict.deselect": "Kendu gatazkak eta jarraitu", + "message.chestseparators.empty_selection": "Hautapen hutsa.", + "tooltip.chestseparators.desc.conflict.deselect": "Lehendik dauden iragazkiak mantentzen ditu eta zirrikitu hutsetan soilik aplikatzen da", + "button.chestseparators.cancel": "Utzi", + "tooltip.chestseparators.desc.conflict.cancel": "Bertan behera utzi iragazkia sortzea", + "button.chestseparators.confirm": "Berretsi", + "gui.chestseparators.conflict_title": "Hautapen gatazka!", + "gui.chestseparators.presets_title": "Inventarioko aurrezarpenak", + "gui.chestseparators.chest_presets_title": "Kutxa aurrezarpenak", + "gui.chestseparators.preview_layout": "Diseinua", + "gui.chestseparators.preview_filters": "Iragazkiak", + "gui.chestseparators.preset_slot": "%s aurrezarpena", + "gui.chestseparators.preset.building": "Eraikuntza", + "gui.chestseparators.preset.mining": "Meatzaritza", + "gui.chestseparators.preset.food": "Janaria eta baserria", + "gui.chestseparators.preset.redstone": "Redstone", + "gui.chestseparators.preset.combat": "Borroka", + "gui.chestseparators.preset.inv_miner": "Meatzaria", + "gui.chestseparators.preset.inv_builder": "Eraikitzailea", + "gui.chestseparators.preset.inv_explorer": "Esploratzailea", + "gui.chestseparators.preset.inv_farmer": "Nekazaria", + "gui.chestseparators.preset.inv_nether_end": "Nether eta End", + "gui.chestseparators.conflict_desc": "Hautatutako zirrikitu batzuek badute iragazki bat jada.", + "gui.chestseparators.group_filter": "Talde iragazkia", + "gui.chestseparators.no_filter": "Iragazkirik ez", + "gui.chestseparators.items_count": "Elementuak: %s", + "gui.chestseparators.hover_group": "Pasatu sagua talde baten gainetik...", + "gui.chestseparators.empty_whitelist": "Zerrenda zuri hutsa.", + "button.chestseparators.save_and_exit": "Gorde eta irten", + "button.chestseparators.discard_changes": "Baztertu aldaketak", + "button.chestseparators.import_extracted": "Inportatu erauzitakoak", + "message.chestseparators.items_already_in_filter": "Elementuak iragazkian daude jada.", + "message.chestseparators.no_new_items_found": "Ez da elementu berririk aurkitu.", + "tooltip.chestseparators.desc.import_extracted": "Hautatutako zuloetan dauden objektuak iragazkira gehitzen ditu.", + "tooltip.chestseparators.desc.import_search": "Inportatu bilaketa", + "button.chestseparators.allow_all": "Baimendu guztiak", + "tooltip.chestseparators.desc.allow_all": "Jokoko elementu guztiak zerrenda zurian gehitzen ditu", + "button.chestseparators.clear_all": "Garbitu guztia", + "tooltip.chestseparators.desc.clear_all": "Uneko zerrenda zuria garbitzen du", + "button.chestseparators.manual_insert": "Eskuzko txertaketa", + "tooltip.chestseparators.rule.manual_active": "Aktibatuta: Eskuzko klikak iragazten ditu", + "tooltip.chestseparators.rule.manual_inactive": "Desaktibatuta: Eskuzko klikek iragazkia baztertzen dute", + "button.chestseparators.shift_insert": "Shift txertaketa", + "tooltip.chestseparators.rule.shift_active": "Aktibatuta: Shift bidezko klikak iragazten ditu", + "tooltip.chestseparators.rule.shift_inactive": "Desaktibatuta: Shift klikek iragazkia baztertzen dute", + "button.chestseparators.hopper_insert": "Inbutu txertaketa", + "tooltip.chestseparators.rule.hopper_active": "Aktibatuta: Inbutu transferentziak iragazten ditu", + "tooltip.chestseparators.rule.hopper_inactive": "Desaktibatuta: Inbutuek iragazkia baztertzen dute", + "button.chestseparators.delete": "Ezabatu", + "tooltip.chestseparators.desc.delete_group": "Iragazki talde hau ezabatzen du", + "button.chestseparators.save": "Gorde", + "tooltip.chestseparators.desc.save": "Aldaketak gordetzen ditu", + "tooltip.chestseparators.desc.cancel": "Aldaketak baztertzen ditu", + "gui.chestseparators.unsaved_changes_title": "Gorde gabeko aldaketak", + "gui.chestseparators.unsaved_changes_desc": "Gorde gabeko aldaketak dituzu iragazki honetan.", + "gui.chestseparators.new_detected": "Berriak detektatuta: %s", + "gui.chestseparators.allowing_all": "Guztiak baimentzen: %s", + "gui.chestseparators.clearing": "Garbitzen: %s", + "gui.chestseparators.allowed": "Baimenduta: %s", + "gui.chestseparators.blocked": "Blokeatuta: %s", + "gui.chestseparators.edit_filter_rules": "Editatu iragazkiaren arauak", + "message.chestseparators.no_valid_groups": "Ez dago baliozko talderik.", + "button.chestseparators.eyedropper": "Tantakakoa", + "tooltip.chestseparators.desc.eyedropper": "Aukeratu kolore bat zuzenean pantailatik", + "button.chestseparators.exit": "Irten", + "tooltip.chestseparators.desc.exit": "Gorde aldaketak eta itxi kolore-hautatzailea", + "gui.chestseparators.hex": "Hex", + "gui.chestseparators.color_r": "R", + "gui.chestseparators.color_g": "G", + "gui.chestseparators.color_b": "B", + "gui.chestseparators.color_picker.instructions": "Egin klik erdiko botoiarekin kopiatzeko. Egin klik ezkerreko botoiarekin itsasteko.", + "color.chestseparators.custom": "Kolore pertsonalizatua %s", + "window.chestseparators.edit_color": "Editatu kolore pertsonalizatua", + "message.chestseparators.edit_buttons_visible": "Edizio botoiak: Ikusgai", + "message.chestseparators.edit_buttons_hidden": "Edizio botoiak: Ezkutatuta", + "message.chestseparators.preview_panel_visible": "Aurrebista panela: Ikusgai", + "message.chestseparators.preview_panel_hidden": "Aurrebista panela: Ezkutatuta", + "modmenu.descriptionTranslation.chestseparators": "Lortu inbentarioa azkar hustea gordetze automatiko pertsonalizatuarekin. Jolasak azkenean badaki zehazki zer nahi duzun eta non nahi duzun.", + "config.chestseparators.category.client": "Bezeroa / Ikusizkoak", + "config.chestseparators.show_left_panel": "Erakutsi ezkerreko panela", + "config.chestseparators.show_left_panel.tooltip": "Zerrenda zuriaren aurrebista panela erakusten du. Eduki sakatuta modifikatzaile tekla behartzeko.", + "config.chestseparators.enable_preview_animation": "Gaitu aurrebistaren animazioa", + "config.chestseparators.enable_preview_animation.tooltip": "Automatikoki mugitzen du aurrebista paneleko elementuen zerrenda.", + "config.chestseparators.show_edit_buttons": "Erakutsi edizio botoiak", + "config.chestseparators.show_edit_buttons.tooltip": "Tresnen botoiak erakusten ditu kutxaren interfazean.", + "config.chestseparators.bg_transparency": "Hondoaren gardentasuna", + "config.chestseparators.bg_transparency.tooltip": "Zirrikituen hondoko koloreen opakutasun maila (0 = Ikusezina, 100 = Solidoa).", + "config.chestseparators.line_transparency": "Lerroen gardentasuna", + "config.chestseparators.line_transparency.tooltip": "Banantze-lerroen opakutasun maila (0 = Ikusezina, 100 = Solidoa).", + "config.chestseparators.default_rule_manual": "Araua lehenespenez: Eskuz", + "config.chestseparators.default_rule_manual.tooltip": "Sortu berri diren taldeek eskuzko klikak baimenduko dituzte lehenespenez.", + "config.chestseparators.default_rule_shift": "Araua lehenespenez: Shift", + "config.chestseparators.default_rule_shift.tooltip": "Sortu berri diren taldeek Shift klikak baimenduko dituzte lehenespenez.", + "config.chestseparators.default_rule_hopper": "Araua lehenespenez: Inbutua", + "config.chestseparators.default_rule_hopper.tooltip": "Sortu berri diren taldeek inbutu bidezko txertaketa baimenduko dute lehenespenez.", + "config.chestseparators.default_rule_pickup": "Araua lehenespenez: Jaso", + "config.chestseparators.default_rule_pickup.tooltip": "Sortu berri diren inbentario-taldeek lurretik jasotako objektuak iragaziko dituzte lehenespenez.", + "config.chestseparators.category.server": "Zerbitzaria / Mekanikak", + "config.chestseparators.expel_invalid_items": "Egotzi baliogabeko elementuak", + "config.chestseparators.expel_invalid_items.tooltip": "Iragazki berri bat aplikatzean, baliogabeko elementuak inbentariora joango dira edo lurrera eroriko dira.", + "config.chestseparators.category.hotkeys": "Laster-teklak", + "config.chestseparators.toggle_preview_panel": "Txandakatu aurrebista panela", + "config.chestseparators.toggle_preview_panel.tooltip": "Azkar erakutsi/ezkutatu ezkerreko aurrebista panela.", + "config.chestseparators.show_panel_modifier": "Panelaren modifikatzailea", + "config.chestseparators.show_panel_modifier.tooltip": "Eduki sakatuta tekla hau ezkerreko panela erakustera behartzeko desaktibatuta badago.", + "button.chestseparators.import_search": "Bilaketa Inportatu", + "message.chestseparators.locked": "Norbaitek kutxa hau editatzen ari da jada!", + "gui.chestseparators.expel_items_title": "Elementu baliogabeak egotzi?", + "gui.chestseparators.expel_items_desc": "Une honetan zirrikitu hauetan dauden zenbait elementu ez datoz bat arau berriekin. Kutxatik egotziko dira.", + "button.chestseparators.accept_expel": "Onartu eta Egotzi", + "config.chestseparators.dark_mode": "Modu Iluna", + "config.chestseparators.dark_mode.tooltip": "Interfazearen gai argiaren eta ilunaren artean txandakatu.", + "config.chestseparators.show_deposit_button": "Erakutsi Gordailu Botoia", + "message.chestseparators.deposit_button_visible": "Gordailu botoia: Ikusgai", + "message.chestseparators.deposit_button_hidden": "Gordailu botoia: Ezkutatuta", + "key.chestseparators.toggle_magnifier": "Txandakatu lupa", + "key.chestseparators.toggle_edit_buttons": "Tresna-barra txandakatu", + "config.chestseparators.toggle_edit_buttons": "Tresna-barra txandakatu", + "config.chestseparators.toggle_edit_buttons.tooltip": "Erakutsi edo ezkutatu goiko tresna-barra osoa aldi berean.", + "config.chestseparators.toggle_magnifier": "Txandakatu lupa", + "config.chestseparators.magnifier_enabled": "Erakutsi lupa", + "config.chestseparators.magnifier_enabled.tooltip": "Lupa bat erakusten du kurtsorean banatzaileak margotzean edo tanta-kontagailua erabiltzean.", + "config.chestseparators.magnifier_shape": "Luparen forma", + "config.chestseparators.magnifier_shape.tooltip": "Lupa biribila edo karratua den.", + "config.chestseparators.magnifier_shape.circle": "Zirkulua", + "config.chestseparators.magnifier_shape.square": "Karratua", + "config.chestseparators.magnifier_tab_lines": "Lupa: Lerroak", + "config.chestseparators.magnifier_tab_backgrounds": "Lupa: Hondoak", + "config.chestseparators.magnifier_tab_combo": "Lupa: Modu konbinatua", + "message.chestseparators.magnifier_on": "Lupa: Aktibatuta", + "message.chestseparators.magnifier_off": "Lupa: Desaktibatuta", + "message.chestseparators.magnifier_hint": "Aholkua: sakatu %s zoom-lupa baterako", + "message.chestseparators.tag_hint": "Aholkua: erdiko klika item batean bere etiketak ikusteko", + "message.chestseparators.magnifier_hint_off": "Aholkua: sakatu %s zoom-lupa kentzeko", + "config.chestseparators.show_deposit_button.tooltip": "Kutxaren interfazean gordailu azkarreko botoia erakusten edo ezkutatzen du.", + "tooltip.chestseparators.deposit_items": "Gordailatu Iragazkietan\n§8[Shift + Klik] Gordailatu Iragazkietan eta Zirrikitu Hutsetan", + "message.chestseparators.deposited": "%s item gordailatu dira.", + "message.chestseparators.deposit_failed": "Ez da baliozko zirrikitorik aurkitu itemak gordailatzeko.", + "config.chestseparators.close_on_click_outside": "Itxi kanpoan klik egitean", + "config.chestseparators.close_on_click_outside.tooltip": "Menua ixten du interfazearen kanpoan klik egitean.", + "config.chestseparators.shared_custom_colors": "Kolore Pertsonalizatu Partekatuak", + "config.chestseparators.shared_custom_colors.tooltip": "Gaituta dagoenean, kolore pertsonalizatuen zutabea Lerroak, Atzealdeak eta Konbinazioa fitxen artean partekatzen da. Desgaituta, fitxa bakoitzak bereak ditu.", + "title.chestseparators.config": "Absolute Order-en Konfigurazioa", + "category.chestseparators.keys": "Absolute Order", + "key.category.chestseparators.keys": "Absolute Order", + "config.chestseparators.auto_deposit_enabled": "Auto-gordailua hurbileko kutxetan", + "config.chestseparators.auto_deposit_enabled.tooltip": "Antolatu zure inbentario osoa hurbileko iragazitako kutxetan keinu bakar batekin.", + "config.chestseparators.auto_deposit_double_sneak": "Abiarazlea: makurtu bikoitza", + "config.chestseparators.auto_deposit_double_sneak.tooltip": "Sakatu bizkor bi aldiz makurtzeko tekla auto-gordailatzeko.", + "config.chestseparators.auto_deposit_radius": "Auto-gordailuaren erradioa", + "config.chestseparators.auto_deposit_radius.tooltip": "Zure inguruan (blokeetan) kutxak bilatzen diren distantzia.", + "config.chestseparators.auto_deposit_through_walls": "Gordailatu hormen zehar", + "config.chestseparators.auto_deposit_through_walls.tooltip": "Baimendu bloke solidoek blokeatutako kutxetan gordailatzea. Itzalita dagoenean, bidea libre egon behar da.", + "config.chestseparators.auto_deposit": "Auto-gordailua", + "key.chestseparators.auto_deposit": "Auto-gordailua hurbileko kutxetan", + "message.chestseparators.auto_deposit_done": "%s objektu auto-gordailatu dira.", + "message.chestseparators.auto_deposit_none": "Ez dago hurbileko iragazitako kutxarik eskura.", + "message.chestseparators.auto_grab_done": "%s objektu hartuta.", + "message.chestseparators.auto_grab_none": "Inguruan ez dago zer hartu.", + "message.chestseparators.preset_loaded": "%s aurrezarpena kargatua.", + "message.chestseparators.preset_saved": "%s aurrezarpena gordeta.", + "message.chestseparators.preset_empty": "%s aurrezarpena hutsik dago.", + "config.chestseparators.auto_deposit_animation": "Gordailu-animazioa", + "config.chestseparators.auto_deposit_animation.tooltip": "Erakutsi 3D objektuak kutxa bakoitzera hegan. Itzalita badago, objektuak berehala gordailatzen dira animaziorik gabe.", + "config.chestseparators.auto_deposit_trail": "Arrasto-efektua", + "config.chestseparators.auto_deposit_trail.tooltip": "Utzi partikula-arrasto bat hegan doan objektu bakoitzaren atzean. Animazioa piztuta dagoenean soilik aplikatzen da.", + "button.chestseparators.pickup_insert": "Jaso", + "tooltip.chestseparators.rule.pickup_active": "Aktibo: Lurretik jasotako objektuak iragazten ditu", + "tooltip.chestseparators.rule.pickup_inactive": "Inaktibo: Jasotako objektuek iragazkia alde batera uzten dute", + "tooltip.chestseparators.edit_inventory_toggle": "Editatu inbentarioa / kutxa", + "message.chestseparators.editing_inventory": "Editatzen: inbentarioa", + "message.chestseparators.editing_chest": "Editatzen: kutxa", + "message.chestseparators.preset_deleted": "%s aurrezarpena ezabatuta.", + "gui.chestseparators.preset_overwrite_title": "%s aurrezarpena gainidatzi?", + "gui.chestseparators.preset_overwrite_body": "Gordetako aurrezarpena galduko da.", + "gui.chestseparators.preset_page": "%s/%s orria", + "gui.chestseparators.preview_delete": "Ezabatuko da", + "key.chestseparators.push": "Bidali Kutxaren Iragazkietara", + "config.chestseparators.push": "Bidali Kutxaren Iragazkietara", + "config.chestseparators.push.tooltip": "Bidali bat datozen objektuak irekitako kutxaren iragazkietara.\n§8Eutsi [Shift] hutsuneak ere betetzeko", + "key.chestseparators.pull": "Ekarri Inbentarioaren Iragazkietara", + "config.chestseparators.pull": "Ekarri Inbentarioaren Iragazkietara", + "config.chestseparators.pull.tooltip": "Ekarri kutxaren objektuak zure inbentarioaren iragazkietara.\n§8Eutsi [Shift] iragazkirik gabeko objektuak ere ekartzeko", + "config.chestseparators.lock_hotbar_on_reorder": "Blokeatu tresna-barra auto-ordenatzean", + "config.chestseparators.lock_hotbar_on_reorder.tooltip": "Push edo pull batek zure inbentarioa berrantolatzean, tresna-barra ukitu gabe geratzen da.", + "config.chestseparators.lock_hotbar_on_reorder.tooltip2": "Eskuan izan dezakezun objektua babesten du. Desaktibatuta: tresna-barra ere ordenatzen da.", + "message.chestseparators.push_no_filters": "Kutxa honek ez du iragazkirik oraindik.", + "message.chestseparators.push_no_slot": "Ez dago leku librerik iragazkietan.", + "message.chestseparators.pull_no_filters": "Zure inbentarioak ez du iragazkirik oraindik.", + "message.chestseparators.pull_no_match": "Hemen ezerk ez dator bat zure iragazkiekin." +} diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/lang/fr_fr.json b/multiloader-26.3/common/src/main/resources/assets/chestseparators/lang/fr_fr.json new file mode 100644 index 0000000..394d580 --- /dev/null +++ b/multiloader-26.3/common/src/main/resources/assets/chestseparators/lang/fr_fr.json @@ -0,0 +1,257 @@ +{ + "tooltip.chestseparators.edit_mode": "Modifier la disposition", + "tooltip.chestseparators.whitelist_mode": "Gérer les filtres", + "itemGroup.chestseparators.chest_and_inventory": "Coffre et inventaire", + "gui.chestseparators.search": "Rechercher", + "button.chestseparators.copy_layout": "Copier la disposition", + "message.chestseparators.layout_copied": "Disposition copiée !", + "tooltip.chestseparators.desc.copy_layout": "Copie la disposition actuelle dans le presse-papiers", + "button.chestseparators.paste_layout": "Coller la disposition", + "message.chestseparators.layout_pasted": "Disposition collée !", + "tooltip.chestseparators.desc.paste_layout": "Colle la disposition du presse-papiers", + "button.chestseparators.undo_action": "Annuler", + "tooltip.chestseparators.desc.undo_action": "Annule la dernière action dessinée", + "button.chestseparators.redo_action": "Rétablir", + "tooltip.chestseparators.desc.redo_action": "Rétablit l'action précédemment annulée", + "tooltip.chestseparators.draw_area": "Dessiner une zone", + "tooltip.chestseparators.erase_area": "Effacer une zone", + "tooltip.chestseparators.clear_lines": "Effacer les lignes", + "tooltip.chestseparators.clear_backgrounds": "Effacer les arrière-plans", + "tooltip.chestseparators.clear_both": "Tout effacer", + "message.chestseparators.cleared": "Calque effacé", + "tooltip.chestseparators.draw_trace": "Dessiner un tracé", + "tooltip.chestseparators.erase_trace": "Effacer un tracé", + "tooltip.chestseparators.open_palette": "Ouvrir la palette", + "message.chestseparators.color_copied": "Couleur copiée !", + "message.chestseparators.color_pasted": "Couleur collée !", + "tooltip.chestseparators.tab_lines": "Lignes", + "tooltip.chestseparators.tab_backgrounds": "Arrière-plans", + "tooltip.chestseparators.tab_combo": "Mode Combiné", + "button.chestseparators.edit_filter": "Modifier le filtre", + "tooltip.chestseparators.desc.edit_filter": "Créer ou modifier un filtre pour les emplacements sélectionnés", + "button.chestseparators.delete_all_filters": "Supprimer tous les filtres", + "tooltip.chestseparators.desc.delete_all_filters": "Supprime tous les filtres de ce coffre", + "message.chestseparators.all_filters_deleted": "Tous les filtres supprimés !", + "message.chestseparators.select_first": "Sélectionnez d'abord au moins un emplacement.", + "button.chestseparators.area_select": "Sélection de zone", + "tooltip.chestseparators.desc.area_select": "Sélectionnez des emplacements en faisant glisser une zone rectangulaire", + "button.chestseparators.trace_select": "Sélection de tracé", + "tooltip.chestseparators.desc.trace_select": "Sélectionnez des emplacements en peignant dessus", + "button.chestseparators.clear_selection": "Effacer la sélection", + "tooltip.chestseparators.desc.clear_selection": "Efface tous les emplacements actuellement sélectionnés", + "button.chestseparators.copy_filters": "Copier les filtres", + "message.chestseparators.filters_copied": "Filtres copiés !", + "tooltip.chestseparators.desc.copy_filters": "Copie tous les filtres de ce coffre dans le presse-papiers", + "button.chestseparators.paste_filters": "Coller les filtres", + "message.chestseparators.filters_pasted": "Filtres collés !", + "message.chestseparators.undone": "Annulé : %s", + "message.chestseparators.redone": "Rétabli : %s", + "message.chestseparators.action.layout": "Disposition", + "message.chestseparators.action.filter": "Filtre", + "tooltip.chestseparators.desc.paste_filters": "Colle les filtres du presse-papiers dans ce coffre", + "button.chestseparators.undo": "Annuler", + "tooltip.chestseparators.desc.undo": "Annule la dernière action de filtre", + "button.chestseparators.redo": "Rétablir", + "button.chestseparators.fill_inventory": "Remplir l'inventaire", + "button.chestseparators.preset_load": "Charger", + "button.chestseparators.preset_save": "Enregistrer", + "tooltip.chestseparators.desc.redo": "Rétablit l'action précédemment annulée", + "tooltip.chestseparators.desc.fill_inventory": "Récupérer les objets filtrés ici (jusqu’à la cible)", + "tooltip.chestseparators.push_to_chest": "Envoyer les objets au coffre\n§8Maintenir [Maj] pour inclure les cases vides", + "tooltip.chestseparators.push_to_chest.shift": "Envoyer au coffre + cases vides", + "tooltip.chestseparators.pull_from_chest": "Récupérer les objets du coffre\n§8[Maj] récupère aussi les non filtrés", + "tooltip.chestseparators.desc.presets": "Préréglages d'inventaire : enregistrer et charger dispositions et filtres", + "tooltip.chestseparators.desc.chest_presets": "Préréglages de coffre : enregistrer et charger dispositions et filtres du coffre", + "button.chestseparators.conflict.overwrite": "Écraser les filtres existants", + "tooltip.chestseparators.desc.conflict.overwrite": "Supprime les filtres existants dans la sélection et en crée un nouveau", + "button.chestseparators.conflict.deselect": "Désélectionner les conflits et continuer", + "message.chestseparators.empty_selection": "Sélection vide.", + "tooltip.chestseparators.desc.conflict.deselect": "Garde les filtres existants intacts et ne s'applique qu'aux emplacements vides", + "button.chestseparators.cancel": "Annuler", + "tooltip.chestseparators.desc.conflict.cancel": "Annuler la création du filtre", + "button.chestseparators.confirm": "Confirmer", + "gui.chestseparators.conflict_title": "Conflit de sélection !", + "gui.chestseparators.presets_title": "Préréglages d'inventaire", + "gui.chestseparators.chest_presets_title": "Préréglages de coffre", + "gui.chestseparators.preview_layout": "Disposition", + "gui.chestseparators.preview_filters": "Filtres", + "gui.chestseparators.preset_slot": "Préréglage %s", + "gui.chestseparators.preset.building": "Construction", + "gui.chestseparators.preset.mining": "Minage", + "gui.chestseparators.preset.food": "Nourriture & ferme", + "gui.chestseparators.preset.redstone": "Redstone", + "gui.chestseparators.preset.combat": "Combat", + "gui.chestseparators.preset.inv_miner": "Mineur", + "gui.chestseparators.preset.inv_builder": "Bâtisseur", + "gui.chestseparators.preset.inv_explorer": "Explorateur", + "gui.chestseparators.preset.inv_farmer": "Fermier", + "gui.chestseparators.preset.inv_nether_end": "Nether & End", + "gui.chestseparators.conflict_desc": "Certains emplacements sélectionnés ont déjà un filtre.", + "gui.chestseparators.group_filter": "Filtre de groupe", + "gui.chestseparators.no_filter": "Aucun filtre", + "gui.chestseparators.items_count": "Objets : %s", + "gui.chestseparators.hover_group": "Survolez un groupe...", + "gui.chestseparators.empty_whitelist": "Liste blanche vide.", + "button.chestseparators.save_and_exit": "Enregistrer et quitter", + "button.chestseparators.discard_changes": "Ignorer les modifications", + "button.chestseparators.import_extracted": "Importer extraits", + "message.chestseparators.items_already_in_filter": "Objets déjà dans le filtre.", + "message.chestseparators.no_new_items_found": "Aucun nouvel objet trouvé.", + "tooltip.chestseparators.desc.import_extracted": "Ajoute au filtre les objets présents dans les emplacements sélectionnés.", + "tooltip.chestseparators.desc.import_search": "Importer recherche", + "button.chestseparators.allow_all": "Tout autoriser", + "tooltip.chestseparators.desc.allow_all": "Autorise tous les objets du jeu", + "button.chestseparators.clear_all": "Tout effacer", + "tooltip.chestseparators.desc.clear_all": "Efface la liste blanche actuelle", + "button.chestseparators.manual_insert": "Insertion manuelle", + "tooltip.chestseparators.rule.manual_active": "Actif : Filtre les clics manuels", + "tooltip.chestseparators.rule.manual_inactive": "Inactif : Les clics manuels ignorent le filtre", + "button.chestseparators.shift_insert": "Insertion Maj", + "tooltip.chestseparators.rule.shift_active": "Actif : Filtre les clics avec Maj", + "tooltip.chestseparators.rule.shift_inactive": "Inactif : Les clics avec Maj ignorent le filtre", + "button.chestseparators.hopper_insert": "Insertion par entonnoir", + "tooltip.chestseparators.rule.hopper_active": "Actif : Filtre les transferts par entonnoir", + "tooltip.chestseparators.rule.hopper_inactive": "Inactif : Les entonnoirs ignorent le filtre", + "button.chestseparators.delete": "Supprimer", + "tooltip.chestseparators.desc.delete_group": "Supprime ce groupe de filtres", + "button.chestseparators.save": "Enregistrer", + "tooltip.chestseparators.desc.save": "Enregistre les modifications", + "tooltip.chestseparators.desc.cancel": "Ignore les modifications", + "gui.chestseparators.unsaved_changes_title": "Modifications non enregistrées", + "gui.chestseparators.unsaved_changes_desc": "Vous avez des modifications non enregistrées dans ce filtre.", + "gui.chestseparators.new_detected": "Nouveaux détectés : %s", + "gui.chestseparators.allowing_all": "Tout autoriser : %s", + "gui.chestseparators.clearing": "Effacement : %s", + "gui.chestseparators.allowed": "Autorisés : %s", + "gui.chestseparators.blocked": "Bloqués : %s", + "gui.chestseparators.edit_filter_rules": "Modifier les règles du filtre", + "message.chestseparators.no_valid_groups": "Aucun groupe valide.", + "button.chestseparators.eyedropper": "Pipette", + "tooltip.chestseparators.desc.eyedropper": "Prélever une couleur à l'écran", + "button.chestseparators.exit": "Quitter", + "tooltip.chestseparators.desc.exit": "Enregistrer et fermer le sélecteur de couleurs", + "gui.chestseparators.hex": "Hex", + "gui.chestseparators.color_r": "R", + "gui.chestseparators.color_g": "V", + "gui.chestseparators.color_b": "B", + "gui.chestseparators.color_picker.instructions": "Clic molette pour copier. Clic gauche pour coller.", + "window.chestseparators.edit_color": "Modifier la couleur", + "message.chestseparators.edit_buttons_visible": "Boutons d'édition : Visibles", + "message.chestseparators.edit_buttons_hidden": "Boutons d'édition : Masqués", + "message.chestseparators.preview_panel_visible": "Panneau d'aperçu : Visible", + "message.chestseparators.preview_panel_hidden": "Panneau d'aperçu : Masqué", + "modmenu.descriptionTranslation.chestseparators": "Videz rapidement votre inventaire grâce au dépôt automatique personnalisé. Le jeu sait enfin exactement ce que vous voulez et où vous le voulez.", + "config.chestseparators.category.client": "Client / Visuels", + "config.chestseparators.show_left_panel": "Afficher le panneau gauche", + "config.chestseparators.show_left_panel.tooltip": "Affiche le panneau d'aperçu. Maintenez la touche modificateur pour forcer l'affichage.", + "config.chestseparators.enable_preview_animation": "Activer l'animation d'aperçu", + "config.chestseparators.enable_preview_animation.tooltip": "Fait défiler automatiquement la liste des objets dans le panneau.", + "config.chestseparators.show_edit_buttons": "Afficher les boutons d'édition", + "config.chestseparators.show_edit_buttons.tooltip": "Affiche les boutons d'outils dans le coffre.", + "config.chestseparators.bg_transparency": "Transparence du fond", + "config.chestseparators.bg_transparency.tooltip": "Opacité du fond des emplacements (0 = Invisible, 100 = Opaque).", + "config.chestseparators.line_transparency": "Transparence des lignes", + "config.chestseparators.line_transparency.tooltip": "Opacité des lignes de séparation (0 = Invisible, 100 = Opaque).", + "config.chestseparators.default_rule_manual": "Règle par défaut : Manuel", + "config.chestseparators.default_rule_manual.tooltip": "Les nouveaux groupes autorisent les clics manuels par défaut.", + "config.chestseparators.default_rule_shift": "Règle par défaut : Maj", + "config.chestseparators.default_rule_shift.tooltip": "Les nouveaux groupes autorisent les clics avec Maj par défaut.", + "config.chestseparators.default_rule_hopper": "Règle par défaut : Entonnoir", + "config.chestseparators.default_rule_hopper.tooltip": "Les nouveaux groupes autorisent l'insertion par entonnoir par défaut.", + "config.chestseparators.default_rule_pickup": "Règle par défaut : Ramasser", + "config.chestseparators.default_rule_pickup.tooltip": "Les nouveaux groupes d'inventaire filtrent les objets ramassés par défaut.", + "config.chestseparators.category.server": "Serveur / Mécaniques", + "config.chestseparators.expel_invalid_items": "Expulser les objets non valides", + "config.chestseparators.expel_invalid_items.tooltip": "Les objets non valides seront expulsés vers l'inventaire ou jetés.", + "config.chestseparators.category.hotkeys": "Raccourcis", + "config.chestseparators.toggle_preview_panel": "Basculer le panneau d'aperçu", + "config.chestseparators.toggle_preview_panel.tooltip": "Afficher/masquer rapidement le panneau gauche.", + "config.chestseparators.show_panel_modifier": "Modificateur de panneau", + "config.chestseparators.show_panel_modifier.tooltip": "Maintenez pour forcer l'affichage du panneau gauche.", + "color.chestseparators.custom": "Couleur personnalisée %s", + "button.chestseparators.import_search": "Importer la recherche", + "message.chestseparators.locked": "Quelqu'un est déjà en train de modifier ce coffre !", + "gui.chestseparators.expel_items_title": "Expulser les objets non valides ?", + "gui.chestseparators.expel_items_desc": "Certains objets actuellement dans ces emplacements ne correspondent pas aux nouvelles règles. Ils seront éjectés du coffre.", + "button.chestseparators.accept_expel": "Accepter et Expulser", + "config.chestseparators.dark_mode": "Mode Sombre", + "config.chestseparators.dark_mode.tooltip": "Bascule entre les thèmes d'interface clair et sombre.", + "config.chestseparators.show_deposit_button": "Afficher le bouton de dépôt", + "message.chestseparators.deposit_button_visible": "Bouton de dépôt : Visible", + "message.chestseparators.deposit_button_hidden": "Bouton de dépôt : Masqué", + "key.chestseparators.toggle_magnifier": "Activer la loupe", + "key.chestseparators.toggle_edit_buttons": "Basculer la barre d'outils", + "config.chestseparators.toggle_edit_buttons": "Basculer la barre d'outils", + "config.chestseparators.toggle_edit_buttons.tooltip": "Affiche ou masque toute la barre d'outils supérieure d'un coup.", + "config.chestseparators.toggle_magnifier": "Activer la loupe", + "config.chestseparators.magnifier_enabled": "Afficher la loupe", + "config.chestseparators.magnifier_enabled.tooltip": "Affiche une loupe au curseur lors du dessin des séparateurs ou de la pipette.", + "config.chestseparators.magnifier_shape": "Forme de la loupe", + "config.chestseparators.magnifier_shape.tooltip": "Si la loupe est ronde ou carrée.", + "config.chestseparators.magnifier_shape.circle": "Cercle", + "config.chestseparators.magnifier_shape.square": "Carré", + "config.chestseparators.magnifier_tab_lines": "Loupe: Lignes", + "config.chestseparators.magnifier_tab_backgrounds": "Loupe: Arrière-plans", + "config.chestseparators.magnifier_tab_combo": "Loupe: Mode Combiné", + "message.chestseparators.magnifier_on": "Loupe : Activée", + "message.chestseparators.magnifier_off": "Loupe : Désactivée", + "message.chestseparators.magnifier_hint": "Astuce : appuyez sur %s pour une loupe", + "message.chestseparators.tag_hint": "Astuce : clic milieu sur un objet pour voir ses tags", + "message.chestseparators.magnifier_hint_off": "Astuce : appuyez sur %s pour retirer la loupe", + "config.chestseparators.show_deposit_button.tooltip": "Affiche ou masque le bouton de dépôt rapide dans l'interface du coffre.", + "tooltip.chestseparators.deposit_items": "Déposer dans les filtres\n§8[Shift + Clic] Déposer dans les filtres & emplacements vides", + "message.chestseparators.deposited": "%s objets déposés.", + "message.chestseparators.deposit_failed": "Aucun emplacement valide trouvé pour déposer.", + "config.chestseparators.close_on_click_outside": "Fermer en cliquant à l'extérieur", + "config.chestseparators.close_on_click_outside.tooltip": "Ferme le menu lorsque vous cliquez en dehors de l'interface.", + "config.chestseparators.shared_custom_colors": "Couleurs personnalisées partagées", + "config.chestseparators.shared_custom_colors.tooltip": "Si activé, la colonne de couleurs personnalisées est partagée entre les onglets Lignes, Fonds et Combo. Si désactivé, chaque onglet a les siennes.", + "title.chestseparators.config": "Configuration d'Absolute Order", + "category.chestseparators.keys": "Absolute Order", + "key.category.chestseparators.keys": "Absolute Order", + "config.chestseparators.auto_deposit_enabled": "Dépôt auto dans les coffres proches", + "config.chestseparators.auto_deposit_enabled.tooltip": "Range tout ton inventaire dans les coffres filtrés proches d'un seul geste.", + "config.chestseparators.auto_deposit_double_sneak": "Déclencheur : double accroupissement", + "config.chestseparators.auto_deposit_double_sneak.tooltip": "Appuie deux fois rapidement sur la touche d'accroupissement pour déposer automatiquement.", + "config.chestseparators.auto_deposit_radius": "Rayon de dépôt auto", + "config.chestseparators.auto_deposit_radius.tooltip": "Distance autour de toi (en blocs) où les coffres sont recherchés.", + "config.chestseparators.auto_deposit_through_walls": "Déposer à travers les murs", + "config.chestseparators.auto_deposit_through_walls.tooltip": "Autorise le dépôt dans les coffres bloqués par des blocs solides. Désactivé, le chemin doit être dégagé.", + "config.chestseparators.auto_deposit": "Dépôt auto", + "key.chestseparators.auto_deposit": "Dépôt auto dans les coffres proches", + "message.chestseparators.auto_deposit_done": "%s objets déposés automatiquement.", + "message.chestseparators.auto_deposit_none": "Aucun coffre filtré proche à portée.", + "message.chestseparators.auto_grab_done": "%s objets récupérés.", + "message.chestseparators.auto_grab_none": "Rien à récupérer à proximité.", + "message.chestseparators.preset_loaded": "Préréglage %s chargé.", + "message.chestseparators.preset_saved": "Préréglage %s enregistré.", + "message.chestseparators.preset_empty": "Le préréglage %s est vide.", + "config.chestseparators.auto_deposit_animation": "Animation de dépôt", + "config.chestseparators.auto_deposit_animation.tooltip": "Affiche les objets 3D volant vers chaque coffre. Désactivé, les objets sont déposés instantanément sans animation.", + "config.chestseparators.auto_deposit_trail": "Effet de traînée", + "config.chestseparators.auto_deposit_trail.tooltip": "Laisse une traînée de particules derrière chaque objet volant. Ne s'applique que si l'animation est activée.", + "button.chestseparators.pickup_insert": "Ramasser", + "tooltip.chestseparators.rule.pickup_active": "Actif : filtre les objets ramassés", + "tooltip.chestseparators.rule.pickup_inactive": "Inactif : les objets ramassés ignorent le filtre", + "tooltip.chestseparators.edit_inventory_toggle": "Éditer inventaire / coffre", + "message.chestseparators.editing_inventory": "Édition : inventaire", + "message.chestseparators.editing_chest": "Édition : coffre", + "message.chestseparators.preset_deleted": "Préréglage %s supprimé.", + "gui.chestseparators.preset_overwrite_title": "Écraser le préréglage %s ?", + "gui.chestseparators.preset_overwrite_body": "Le préréglage enregistré sera perdu.", + "gui.chestseparators.preset_page": "Page %s/%s", + "gui.chestseparators.preview_delete": "Sera supprimé", + "key.chestseparators.push": "Envoyer vers les filtres du coffre", + "config.chestseparators.push": "Envoyer vers les filtres du coffre", + "config.chestseparators.push.tooltip": "Envoie les objets correspondants dans les filtres du coffre ouvert.\n§8Maintenez [Maj] pour aussi remplir les emplacements vides", + "key.chestseparators.pull": "Récupérer vers les filtres de l'inventaire", + "config.chestseparators.pull": "Récupérer vers les filtres de l'inventaire", + "config.chestseparators.pull.tooltip": "Récupère les objets du coffre dans les filtres de votre inventaire.\n§8Maintenez [Maj] pour aussi récupérer les objets sans filtre", + "config.chestseparators.lock_hotbar_on_reorder": "Verrouiller la barre d'accès lors du tri", + "config.chestseparators.lock_hotbar_on_reorder.tooltip": "Quand un envoi ou une récupération trie votre inventaire, la barre d'accès reste intacte.", + "config.chestseparators.lock_hotbar_on_reorder.tooltip2": "Protège un objet que vous tenez. Désactivé : la barre d'accès est triée aussi.", + "message.chestseparators.push_no_filters": "Ce coffre n'a pas encore de filtres.", + "message.chestseparators.push_no_slot": "Aucun emplacement de filtre libre.", + "message.chestseparators.pull_no_filters": "Ton inventaire n'a pas encore de filtres.", + "message.chestseparators.pull_no_match": "Rien ici ne correspond à tes filtres." +} diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/lang/gl_es.json b/multiloader-26.3/common/src/main/resources/assets/chestseparators/lang/gl_es.json new file mode 100644 index 0000000..6a970d9 --- /dev/null +++ b/multiloader-26.3/common/src/main/resources/assets/chestseparators/lang/gl_es.json @@ -0,0 +1,257 @@ +{ + "tooltip.chestseparators.edit_mode": "Editar deseño", + "tooltip.chestseparators.whitelist_mode": "Xestionar filtros", + "itemGroup.chestseparators.chest_and_inventory": "Cofre e inventario", + "gui.chestseparators.search": "Buscar", + "button.chestseparators.copy_layout": "Copiar deseño", + "message.chestseparators.layout_copied": "Deseño copiado!", + "tooltip.chestseparators.desc.copy_layout": "Copia o deseño actual ao portapapeis", + "button.chestseparators.paste_layout": "Pegar deseño", + "message.chestseparators.layout_pasted": "Deseño pegado!", + "tooltip.chestseparators.desc.paste_layout": "Pega o deseño copiado dende o portapapeis", + "button.chestseparators.undo_action": "Desfacer acción", + "tooltip.chestseparators.desc.undo_action": "Reverte a última acción debuxada", + "button.chestseparators.redo_action": "Refacer acción", + "tooltip.chestseparators.desc.redo_action": "Restaura a acción previamente desfeita", + "tooltip.chestseparators.draw_area": "Debuxar área", + "tooltip.chestseparators.erase_area": "Borrar área", + "tooltip.chestseparators.clear_lines": "Limpar liñas", + "tooltip.chestseparators.clear_backgrounds": "Limpar fondos", + "tooltip.chestseparators.clear_both": "Limpar ambos", + "message.chestseparators.cleared": "Limpado", + "tooltip.chestseparators.draw_trace": "Debuxar trazo", + "tooltip.chestseparators.erase_trace": "Borrar trazo", + "tooltip.chestseparators.open_palette": "Abrir paleta", + "message.chestseparators.color_copied": "Cor copiada!", + "message.chestseparators.color_pasted": "Cor pegada!", + "tooltip.chestseparators.tab_lines": "Liñas", + "tooltip.chestseparators.tab_backgrounds": "Fondos", + "tooltip.chestseparators.tab_combo": "Modo combinado", + "button.chestseparators.edit_filter": "Editar filtro", + "tooltip.chestseparators.desc.edit_filter": "Crea ou edita un filtro para os ocos seleccionados", + "button.chestseparators.delete_all_filters": "Eliminar todos os filtros", + "tooltip.chestseparators.desc.delete_all_filters": "Elimina todos os filtros deste cofre", + "message.chestseparators.all_filters_deleted": "Todos os filtros eliminados!", + "message.chestseparators.select_first": "Selecciona polo menos un oco primeiro.", + "button.chestseparators.area_select": "Selección por área", + "tooltip.chestseparators.desc.area_select": "Selecciona ocos arrastrando unha área rectangular", + "button.chestseparators.trace_select": "Selección por trazo", + "tooltip.chestseparators.desc.trace_select": "Selecciona ocos pintando sobre eles", + "button.chestseparators.clear_selection": "Limpar selección", + "tooltip.chestseparators.desc.clear_selection": "Limpa todos os ocos seleccionados actualmente", + "button.chestseparators.copy_filters": "Copiar filtros", + "message.chestseparators.filters_copied": "Filtros copiados!", + "tooltip.chestseparators.desc.copy_filters": "Copia todos os filtros deste cofre ao portapapeis", + "button.chestseparators.paste_filters": "Pegar filtros", + "message.chestseparators.filters_pasted": "Filtros pegados!", + "message.chestseparators.undone": "Desfeito: %s", + "message.chestseparators.redone": "Refeito: %s", + "message.chestseparators.action.layout": "Deseño", + "message.chestseparators.action.filter": "Filtro", + "tooltip.chestseparators.desc.paste_filters": "Pega os filtros do portapapeis neste cofre", + "button.chestseparators.undo": "Desfacer", + "tooltip.chestseparators.desc.undo": "Desfai a última acción de filtrado", + "button.chestseparators.redo": "Refacer", + "button.chestseparators.fill_inventory": "Encher inventario", + "button.chestseparators.preset_load": "Cargar", + "button.chestseparators.preset_save": "Gardar", + "tooltip.chestseparators.desc.redo": "Refai a acción previamente desfeita", + "tooltip.chestseparators.desc.fill_inventory": "Trae os ítems filtrados aquí (ata o obxectivo)", + "tooltip.chestseparators.push_to_chest": "Envía ítems ao cofre\n§8Mantén [Maiús] para incluír ocos baleiros", + "tooltip.chestseparators.push_to_chest.shift": "Envía ao cofre + ocos baleiros", + "tooltip.chestseparators.pull_from_chest": "Trae ítems do cofre\n§8[Maiús] tamén trae os non filtrados", + "tooltip.chestseparators.desc.presets": "Presets de inventario: garda e carga deseños e filtros", + "tooltip.chestseparators.desc.chest_presets": "Presets de cofre: garda e carga deseños e filtros do cofre", + "button.chestseparators.conflict.overwrite": "Sobrescribir filtros existentes", + "tooltip.chestseparators.desc.conflict.overwrite": "Elimina os filtros existentes na selección e crea un novo", + "button.chestseparators.conflict.deselect": "Deseleccionar conflitos e continuar", + "message.chestseparators.empty_selection": "Selección baleira.", + "tooltip.chestseparators.desc.conflict.deselect": "Mantén os filtros existentes intactos e aplícase só aos ocos baleiros", + "button.chestseparators.cancel": "Cancelar", + "tooltip.chestseparators.desc.conflict.cancel": "Cancela a creación do filtro", + "button.chestseparators.confirm": "Confirmar", + "gui.chestseparators.conflict_title": "Conflito de selección!", + "gui.chestseparators.presets_title": "Presets de inventario", + "gui.chestseparators.chest_presets_title": "Presets de cofre", + "gui.chestseparators.preview_layout": "Deseño", + "gui.chestseparators.preview_filters": "Filtros", + "gui.chestseparators.preset_slot": "Preset %s", + "gui.chestseparators.preset.building": "Construción", + "gui.chestseparators.preset.mining": "Minería", + "gui.chestseparators.preset.food": "Comida e granxa", + "gui.chestseparators.preset.redstone": "Redstone", + "gui.chestseparators.preset.combat": "Combate", + "gui.chestseparators.preset.inv_miner": "Mineiro", + "gui.chestseparators.preset.inv_builder": "Construtor", + "gui.chestseparators.preset.inv_explorer": "Explorador", + "gui.chestseparators.preset.inv_farmer": "Granxeiro", + "gui.chestseparators.preset.inv_nether_end": "Nether e End", + "gui.chestseparators.conflict_desc": "Algúns ocos seleccionados xa teñen un filtro.", + "gui.chestseparators.group_filter": "Filtro de grupo", + "gui.chestseparators.no_filter": "Sen filtro", + "gui.chestseparators.items_count": "Elementos: %s", + "gui.chestseparators.hover_group": "Pasa o rato sobre un grupo...", + "gui.chestseparators.empty_whitelist": "Lista branca baleira.", + "button.chestseparators.save_and_exit": "Gardar e saír", + "button.chestseparators.discard_changes": "Descartar cambios", + "button.chestseparators.import_extracted": "Importar extraídos", + "message.chestseparators.items_already_in_filter": "Os elementos xa están no filtro.", + "message.chestseparators.no_new_items_found": "Non se atoparon elementos novos.", + "tooltip.chestseparators.desc.import_extracted": "Engade ao filtro os obxectos que hai nas rañuras seleccionadas.", + "tooltip.chestseparators.desc.import_search": "Importar busca", + "button.chestseparators.allow_all": "Permitir todo", + "tooltip.chestseparators.desc.allow_all": "Engade todos os elementos do xogo á lista branca", + "button.chestseparators.clear_all": "Limpar todo", + "tooltip.chestseparators.desc.clear_all": "Limpa a lista branca actual", + "button.chestseparators.manual_insert": "Inserción manual", + "tooltip.chestseparators.rule.manual_active": "Activo: Filtra clics manuais", + "tooltip.chestseparators.rule.manual_inactive": "Inactivo: Os clics manuais ignoran o filtro", + "button.chestseparators.shift_insert": "Inserción con Shift", + "tooltip.chestseparators.rule.shift_active": "Activo: Filtra clics con Shift", + "tooltip.chestseparators.rule.shift_inactive": "Inactivo: Os clics con Shift ignoran o filtro", + "button.chestseparators.hopper_insert": "Inserción por funil", + "tooltip.chestseparators.rule.hopper_active": "Activo: Filtra transferencias de funís", + "tooltip.chestseparators.rule.hopper_inactive": "Inactivo: Os funís ignoran o filtro", + "button.chestseparators.delete": "Eliminar", + "tooltip.chestseparators.desc.delete_group": "Elimina este grupo de filtros", + "button.chestseparators.save": "Gardar", + "tooltip.chestseparators.desc.save": "Garda os cambios", + "tooltip.chestseparators.desc.cancel": "Descarta os cambios", + "gui.chestseparators.unsaved_changes_title": "Cambios sen gardar", + "gui.chestseparators.unsaved_changes_desc": "Tes cambios sen gardar neste filtro.", + "gui.chestseparators.new_detected": "Novos detectados: %s", + "gui.chestseparators.allowing_all": "Permitindo todos: %s", + "gui.chestseparators.clearing": "Limpando: %s", + "gui.chestseparators.allowed": "Permitidos: %s", + "gui.chestseparators.blocked": "Bloqueados: %s", + "gui.chestseparators.edit_filter_rules": "Editar regras do filtro", + "message.chestseparators.no_valid_groups": "Non hai grupos válidos.", + "button.chestseparators.eyedropper": "Contagotas", + "tooltip.chestseparators.desc.eyedropper": "Escolle unha cor directamente da pantalla", + "button.chestseparators.exit": "Saír", + "tooltip.chestseparators.desc.exit": "Garda os cambios e pecha o selector de cores", + "gui.chestseparators.hex": "Hex", + "gui.chestseparators.color_r": "R", + "gui.chestseparators.color_g": "G", + "gui.chestseparators.color_b": "B", + "gui.chestseparators.color_picker.instructions": "Clic central nunha cor para copiar. Clic esquerdo nun oco para pegar.", + "window.chestseparators.edit_color": "Editar cor personalizada", + "message.chestseparators.edit_buttons_visible": "Botóns de edición: Visibles", + "message.chestseparators.edit_buttons_hidden": "Botóns de edición: Ocultos", + "message.chestseparators.preview_panel_visible": "Panel de previsualización: Visible", + "message.chestseparators.preview_panel_hidden": "Panel de previsualización: Oculto", + "modmenu.descriptionTranslation.chestseparators": "Aconsegue un baleirado rápido do inventario co depósito automático personalizado. O xogo por fin sabe exactamente o que queres e onde o queres.", + "config.chestseparators.category.client": "Cliente / Visuais", + "config.chestseparators.show_left_panel": "Mostrar panel esquerdo", + "config.chestseparators.show_left_panel.tooltip": "Mostra o panel de previsualización da lista branca. Mantén premida a tecla modificadora para forzar.", + "config.chestseparators.enable_preview_animation": "Activar animación de previsualización", + "config.chestseparators.enable_preview_animation.tooltip": "Despraza automaticamente a lista de elementos no panel de previsualización.", + "config.chestseparators.show_edit_buttons": "Mostrar botóns de edición", + "config.chestseparators.show_edit_buttons.tooltip": "Mostra os botóns de ferramentas dentro do cofre.", + "config.chestseparators.bg_transparency": "Transparencia do fondo", + "config.chestseparators.bg_transparency.tooltip": "Nivel de opacidade para as cores de fondo dos ocos (0 = Invisible, 100 = Sólido).", + "config.chestseparators.line_transparency": "Transparencia de liñas", + "config.chestseparators.line_transparency.tooltip": "Nivel de opacidade para as liñas separadoras (0 = Invisible, 100 = Sólido).", + "config.chestseparators.default_rule_manual": "Regra por defecto: Manual", + "config.chestseparators.default_rule_manual.tooltip": "Os grupos creados recentemente permitirán clics manuais por defecto.", + "config.chestseparators.default_rule_shift": "Regra por defecto: Shift", + "config.chestseparators.default_rule_shift.tooltip": "Os grupos creados recentemente permitirán clics con Shift por defecto.", + "config.chestseparators.default_rule_hopper": "Regra por defecto: Funil", + "config.chestseparators.default_rule_hopper.tooltip": "Os grupos creados recentemente permitirán a inserción por funil por defecto.", + "config.chestseparators.default_rule_pickup": "Regra por defecto: Recoller", + "config.chestseparators.default_rule_pickup.tooltip": "Os grupos de inventario novos filtrarán os obxectos recollidos do chan por defecto.", + "config.chestseparators.category.server": "Servidor / Mecánicas", + "config.chestseparators.expel_invalid_items": "Expulsar elementos non válidos", + "config.chestseparators.expel_invalid_items.tooltip": "Ao aplicar un novo filtro, os elementos non válidos moveranse ao inventario ou caerán ao chan.", + "config.chestseparators.category.hotkeys": "Atallos de teclado", + "config.chestseparators.toggle_preview_panel": "Alternar panel de previsualización", + "config.chestseparators.toggle_preview_panel.tooltip": "Mostra/oculta rapidamente o panel de previsualización esquerdo.", + "config.chestseparators.show_panel_modifier": "Modificador do panel", + "config.chestseparators.show_panel_modifier.tooltip": "Mantén premida esta tecla para forzar que o panel esquerdo se mostre se está desactivado.", + "color.chestseparators.custom": "Cor personalizada %s", + "button.chestseparators.import_search": "Importar Busca", + "message.chestseparators.locked": "Alguén xa está a editar este cofre!", + "gui.chestseparators.expel_items_title": "Expulsar obxectos non válidos?", + "gui.chestseparators.expel_items_desc": "Algúns obxectos que están nestes espazos non cumpren as novas regras. Serán expulsados do cofre.", + "button.chestseparators.accept_expel": "Aceptar e Expulsar", + "config.chestseparators.dark_mode": "Modo Escuro", + "config.chestseparators.dark_mode.tooltip": "Alterna entre os temas claro e escuro da interface.", + "config.chestseparators.show_deposit_button": "Mostrar Botón de Depositar", + "message.chestseparators.deposit_button_visible": "Botón de depósito: Visible", + "message.chestseparators.deposit_button_hidden": "Botón de depósito: Oculto", + "key.chestseparators.toggle_magnifier": "Alternar lupa", + "key.chestseparators.toggle_edit_buttons": "Alternar barra de botóns", + "config.chestseparators.toggle_edit_buttons": "Alternar barra de botóns", + "config.chestseparators.toggle_edit_buttons.tooltip": "Mostra ou oculta toda a barra de botóns superior dunha vez.", + "config.chestseparators.toggle_magnifier": "Alternar lupa", + "config.chestseparators.magnifier_enabled": "Mostrar lupa", + "config.chestseparators.magnifier_enabled.tooltip": "Mostra unha lupa de zoom no cursor ao pintar separadores ou usar o contagotas.", + "config.chestseparators.magnifier_shape": "Forma da lupa", + "config.chestseparators.magnifier_shape.tooltip": "Se a lupa é redonda ou cadrada.", + "config.chestseparators.magnifier_shape.circle": "Círculo", + "config.chestseparators.magnifier_shape.square": "Cadrado", + "config.chestseparators.magnifier_tab_lines": "Lupa: Liñas", + "config.chestseparators.magnifier_tab_backgrounds": "Lupa: Fondos", + "config.chestseparators.magnifier_tab_combo": "Lupa: Modo combinado", + "message.chestseparators.magnifier_on": "Lupa: Activada", + "message.chestseparators.magnifier_off": "Lupa: Desactivada", + "message.chestseparators.magnifier_hint": "Consello: preme %s para unha lupa de zoom", + "message.chestseparators.tag_hint": "Consello: clic central nun ítem para ver as súas etiquetas", + "message.chestseparators.magnifier_hint_off": "Consello: preme %s para quitar a lupa de zoom", + "config.chestseparators.show_deposit_button.tooltip": "Mostra ou oculta o botón de depósito rápido na interface do cofre.", + "tooltip.chestseparators.deposit_items": "Depositar nos Filtros\n§8[Shift + Click] Depositar nos Filtros e Ocos Baleiros", + "message.chestseparators.deposited": "Depositáronse %s ítems.", + "message.chestseparators.deposit_failed": "Non se atoparon ocos válidos para depositar.", + "config.chestseparators.close_on_click_outside": "Pechar ao facer clic fóra", + "config.chestseparators.close_on_click_outside.tooltip": "Pecha o menú ao facer clic fóra da interface.", + "config.chestseparators.shared_custom_colors": "Cores Personalizadas Compartidas", + "config.chestseparators.shared_custom_colors.tooltip": "Se está activado, a columna de cores personalizadas é común ás pestanas Liñas, Fondos e Combo. Se está desactivado, cada pestana ten as súas.", + "title.chestseparators.config": "Configuración de Absolute Order", + "category.chestseparators.keys": "Absolute Order", + "key.category.chestseparators.keys": "Absolute Order", + "config.chestseparators.auto_deposit_enabled": "Auto-depósito en cofres próximos", + "config.chestseparators.auto_deposit_enabled.tooltip": "Ordena todo o teu inventario nos cofres filtrados próximos cun só xesto.", + "config.chestseparators.auto_deposit_double_sneak": "Disparador: dobre agocharse", + "config.chestseparators.auto_deposit_double_sneak.tooltip": "Preme dúas veces seguidas a tecla de agocharse para auto-depositar.", + "config.chestseparators.auto_deposit_radius": "Raio de auto-depósito", + "config.chestseparators.auto_deposit_radius.tooltip": "Distancia ao teu redor (en bloques) na que se buscan cofres.", + "config.chestseparators.auto_deposit_through_walls": "Depositar a través de paredes", + "config.chestseparators.auto_deposit_through_walls.tooltip": "Permite depositar en cofres bloqueados por bloques sólidos. Se está desactivado, o camiño debe estar libre.", + "config.chestseparators.auto_deposit": "Auto-depósito", + "key.chestseparators.auto_deposit": "Auto-depósito en cofres próximos", + "message.chestseparators.auto_deposit_done": "Auto-depositados %s obxectos.", + "message.chestseparators.auto_deposit_none": "Non hai cofres filtrados próximos ao alcance.", + "message.chestseparators.auto_grab_done": "Recollidos %s obxectos.", + "message.chestseparators.auto_grab_none": "Nada que recoller preto.", + "message.chestseparators.preset_loaded": "Preset %s cargado.", + "message.chestseparators.preset_saved": "Preset %s gardado.", + "message.chestseparators.preset_empty": "O preset %s está baleiro.", + "config.chestseparators.auto_deposit_animation": "Animación de depósito", + "config.chestseparators.auto_deposit_animation.tooltip": "Mostra os obxectos 3D voando cara a cada cofre. Se está desactivado, os obxectos depositanse ao instante sen animación.", + "config.chestseparators.auto_deposit_trail": "Efecto de estela", + "config.chestseparators.auto_deposit_trail.tooltip": "Deixa unha estela de partículas tras cada obxecto que voa. Só se aplica se a animación está activada.", + "button.chestseparators.pickup_insert": "Recoller", + "tooltip.chestseparators.rule.pickup_active": "Activo: Filtra os obxectos recollidos do chan", + "tooltip.chestseparators.rule.pickup_inactive": "Inactivo: Os obxectos recollidos ignoran o filtro", + "tooltip.chestseparators.edit_inventory_toggle": "Editar inventario / cofre", + "message.chestseparators.editing_inventory": "Editando: inventario", + "message.chestseparators.editing_chest": "Editando: cofre", + "message.chestseparators.preset_deleted": "Preset %s eliminado.", + "gui.chestseparators.preset_overwrite_title": "Sobrescribir o preset %s?", + "gui.chestseparators.preset_overwrite_body": "Perderase o preset gardado.", + "gui.chestseparators.preset_page": "Páxina %s/%s", + "gui.chestseparators.preview_delete": "Eliminarase", + "key.chestseparators.push": "Enviar aos Filtros do Cofre", + "config.chestseparators.push": "Enviar aos Filtros do Cofre", + "config.chestseparators.push.tooltip": "Envía os obxectos que coincidan aos filtros do cofre aberto.\n§8Mantén [Shift] para encher tamén os ocos baleiros", + "key.chestseparators.pull": "Traer aos Filtros do Inventario", + "config.chestseparators.pull": "Traer aos Filtros do Inventario", + "config.chestseparators.pull.tooltip": "Trae os obxectos do cofre aos filtros do teu inventario.\n§8Mantén [Shift] para traer tamén obxectos sen filtro", + "config.chestseparators.lock_hotbar_on_reorder": "Bloquear a barra rápida ao autoordenar", + "config.chestseparators.lock_hotbar_on_reorder.tooltip": "Cando un push ou pull reordena o teu inventario, a barra rápida déixase intacta.", + "config.chestseparators.lock_hotbar_on_reorder.tooltip2": "Protexe un obxecto que poidas ter na man. Desactivado: a barra rápida tamén se ordena.", + "message.chestseparators.push_no_filters": "Este cofre aínda non ten filtros.", + "message.chestseparators.push_no_slot": "Non hai oco libre nos filtros.", + "message.chestseparators.pull_no_filters": "O teu inventario aínda non ten filtros.", + "message.chestseparators.pull_no_match": "Nada de aquí coincide cos teus filtros." +} diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/lang/hi_in.json b/multiloader-26.3/common/src/main/resources/assets/chestseparators/lang/hi_in.json new file mode 100644 index 0000000..0b20f1f --- /dev/null +++ b/multiloader-26.3/common/src/main/resources/assets/chestseparators/lang/hi_in.json @@ -0,0 +1,257 @@ +{ + "tooltip.chestseparators.edit_mode": "लेआउट संपादित करें", + "tooltip.chestseparators.whitelist_mode": "फ़िल्टर प्रबंधित करें", + "itemGroup.chestseparators.chest_and_inventory": "चेस्ट और इन्वेंट्री", + "gui.chestseparators.search": "खोजें", + "button.chestseparators.copy_layout": "लेआउट कॉपी करें", + "message.chestseparators.layout_copied": "लेआउट कॉपी किया गया!", + "tooltip.chestseparators.desc.copy_layout": "वर्तमान लेआउट को क्लिपबोर्ड पर कॉपी करता है", + "button.chestseparators.paste_layout": "लेआउट पेस्ट करें", + "message.chestseparators.layout_pasted": "लेआउट पेस्ट किया गया!", + "tooltip.chestseparators.desc.paste_layout": "क्लिपबोर्ड से कॉपी किए गए लेआउट को पेस्ट करता है", + "button.chestseparators.undo_action": "पूर्ववत करें", + "tooltip.chestseparators.desc.undo_action": "अंतिम खींचे गए कार्य को पूर्ववत करता है", + "button.chestseparators.redo_action": "फिर से करें", + "tooltip.chestseparators.desc.redo_action": "पहले पूर्ववत किए गए कार्य को पुनर्स्थापित करता है", + "tooltip.chestseparators.draw_area": "क्षेत्र बनाएं", + "tooltip.chestseparators.erase_area": "क्षेत्र मिटाएं", + "tooltip.chestseparators.clear_lines": "रेखाएं साफ़ करें", + "tooltip.chestseparators.clear_backgrounds": "पृष्ठभूमि साफ़ करें", + "tooltip.chestseparators.clear_both": "दोनों साफ़ करें", + "message.chestseparators.cleared": "साफ़ किया गया", + "tooltip.chestseparators.draw_trace": "पथ बनाएं", + "tooltip.chestseparators.erase_trace": "पथ मिटाएं", + "tooltip.chestseparators.open_palette": "पैलेट खोलें", + "message.chestseparators.color_copied": "रंग कॉपी किया गया!", + "message.chestseparators.color_pasted": "रंग पेस्ट किया गया!", + "tooltip.chestseparators.tab_lines": "रेखाएं", + "tooltip.chestseparators.tab_backgrounds": "पृष्ठभूमि", + "tooltip.chestseparators.tab_combo": "कॉम्बो मोड", + "button.chestseparators.edit_filter": "फ़िल्टर संपादित करें", + "tooltip.chestseparators.desc.edit_filter": "चयनित स्लॉट के लिए फ़िल्टर बनाएं या संपादित करें", + "button.chestseparators.delete_all_filters": "सभी फ़िल्टर हटाएं", + "tooltip.chestseparators.desc.delete_all_filters": "इस चेस्ट में हर फ़िल्टर को हटा देता है", + "message.chestseparators.all_filters_deleted": "सभी फ़िल्टर हटा दिए गए!", + "message.chestseparators.select_first": "पहले कम से कम एक स्लॉट चुनें।", + "button.chestseparators.area_select": "क्षेत्र चुनें", + "tooltip.chestseparators.desc.area_select": "एक आयताकार क्षेत्र खींचकर स्लॉट चुनें", + "button.chestseparators.trace_select": "पथ चुनें", + "tooltip.chestseparators.desc.trace_select": "स्लॉट के ऊपर पेंट करके उन्हें चुनें", + "button.chestseparators.clear_selection": "चयन साफ़ करें", + "tooltip.chestseparators.desc.clear_selection": "वर्तमान में चयनित सभी स्लॉट साफ़ करें", + "button.chestseparators.copy_filters": "फ़िल्टर कॉपी करें", + "message.chestseparators.filters_copied": "फ़िल्टर कॉपी किए गए!", + "tooltip.chestseparators.desc.copy_filters": "इस चेस्ट से सभी फ़िल्टर क्लिपबोर्ड पर कॉपी करें", + "button.chestseparators.paste_filters": "फ़िल्टर पेस्ट करें", + "message.chestseparators.filters_pasted": "फ़िल्टर पेस्ट किए गए!", + "message.chestseparators.undone": "पूर्ववत: %s", + "message.chestseparators.redone": "फिर से: %s", + "message.chestseparators.action.layout": "लेआउट", + "message.chestseparators.action.filter": "फ़िल्टर", + "tooltip.chestseparators.desc.paste_filters": "क्लिपबोर्ड से फ़िल्टर को इस चेस्ट में पेस्ट करें", + "button.chestseparators.undo": "पूर्ववत करें", + "tooltip.chestseparators.desc.undo": "अंतिम फ़िल्टर क्रिया को पूर्ववत करता है", + "button.chestseparators.redo": "फिर से करें", + "button.chestseparators.fill_inventory": "इन्वेंटरी भरें", + "button.chestseparators.preset_load": "लोड", + "button.chestseparators.preset_save": "सहेजें", + "tooltip.chestseparators.desc.redo": "पहले पूर्ववत किए गए कार्य को पुनर्स्थापित करता है", + "tooltip.chestseparators.desc.fill_inventory": "फ़िल्टर की गई वस्तुएँ यहाँ लाएँ (लक्ष्य तक)", + "tooltip.chestseparators.push_to_chest": "आइटम संदूक में भेजें\n§8खाली स्लॉट के लिए [Shift] दबाए रखें", + "tooltip.chestseparators.push_to_chest.shift": "संदूक में + खाली स्लॉट", + "tooltip.chestseparators.pull_from_chest": "संदूक से आइटम लाएँ\n§8[Shift] बिना फ़िल्टर वाले भी लाएँ", + "tooltip.chestseparators.desc.presets": "इन्वेंटरी प्रीसेट: लेआउट और फ़िल्टर सहेजें और लोड करें", + "tooltip.chestseparators.desc.chest_presets": "संदूक प्रीसेट: संदूक के लेआउट और फ़िल्टर सहेजें और लोड करें", + "button.chestseparators.conflict.overwrite": "मौजूदा फ़िल्टर अधिलेखित करें", + "tooltip.chestseparators.desc.conflict.overwrite": "चयन में मौजूदा फ़िल्टर हटाता है और एक नया बनाता है", + "button.chestseparators.conflict.deselect": "विरोधों को अचयनित करें और जारी रखें", + "message.chestseparators.empty_selection": "खाली चयन।", + "tooltip.chestseparators.desc.conflict.deselect": "मौजूदा फ़िल्टर बरकरार रखता है और केवल खाली स्लॉट पर लागू होता है", + "button.chestseparators.cancel": "रद्द करें", + "tooltip.chestseparators.desc.conflict.cancel": "फ़िल्टर निर्माण निरस्त करें", + "button.chestseparators.confirm": "पुष्टि करें", + "gui.chestseparators.conflict_title": "चयन विरोध!", + "gui.chestseparators.presets_title": "इन्वेंटरी प्रीसेट", + "gui.chestseparators.chest_presets_title": "संदूक प्रीसेट", + "gui.chestseparators.preview_layout": "लेआउट", + "gui.chestseparators.preview_filters": "फ़िल्टर", + "gui.chestseparators.preset_slot": "प्रीसेट %s", + "gui.chestseparators.preset.building": "निर्माण", + "gui.chestseparators.preset.mining": "खनन", + "gui.chestseparators.preset.food": "भोजन और खेती", + "gui.chestseparators.preset.redstone": "रेडस्टोन", + "gui.chestseparators.preset.combat": "युद्ध", + "gui.chestseparators.preset.inv_miner": "खनिक", + "gui.chestseparators.preset.inv_builder": "निर्माता", + "gui.chestseparators.preset.inv_explorer": "खोजकर्ता", + "gui.chestseparators.preset.inv_farmer": "किसान", + "gui.chestseparators.preset.inv_nether_end": "नेदर और एंड", + "gui.chestseparators.conflict_desc": "कुछ चयनित स्लॉट में पहले से ही एक फ़िल्टर है।", + "gui.chestseparators.group_filter": "समूह फ़िल्टर", + "gui.chestseparators.no_filter": "कोई फ़िल्टर नहीं", + "gui.chestseparators.items_count": "वस्तुएं: %s", + "gui.chestseparators.hover_group": "समूह पर होवर करें...", + "gui.chestseparators.empty_whitelist": "खाली श्वेतसूची।", + "button.chestseparators.save_and_exit": "सहेजें और बाहर निकलें", + "button.chestseparators.discard_changes": "बदलाव त्यागें", + "button.chestseparators.import_extracted": "निकाले गए आयात करें", + "message.chestseparators.items_already_in_filter": "आइटम पहले से ही फ़िल्टर में हैं।", + "message.chestseparators.no_new_items_found": "कोई नया आइटम नहीं मिला।", + "tooltip.chestseparators.desc.import_extracted": "चयनित स्लॉट में मौजूद आइटम को फ़िल्टर में जोड़ता है।", + "tooltip.chestseparators.desc.import_search": "खोज आयात करें", + "button.chestseparators.allow_all": "सभी को अनुमति दें", + "tooltip.chestseparators.desc.allow_all": "सभी गेम आइटम को श्वेतसूची में डालता है", + "button.chestseparators.clear_all": "सभी साफ़ करें", + "tooltip.chestseparators.desc.clear_all": "वर्तमान श्वेतसूची साफ़ करता है", + "button.chestseparators.manual_insert": "मैन्युअल प्रविष्टि", + "tooltip.chestseparators.rule.manual_active": "सक्रिय: मैन्युअल क्लिक फ़िल्टर करता है", + "tooltip.chestseparators.rule.manual_inactive": "निष्क्रिय: मैन्युअल क्लिक फ़िल्टर को अनदेखा करते हैं", + "button.chestseparators.shift_insert": "शिफ्ट प्रविष्टि", + "tooltip.chestseparators.rule.shift_active": "सक्रिय: शिफ्ट-क्लिक फ़िल्टर करता है", + "tooltip.chestseparators.rule.shift_inactive": "निष्क्रिय: शिफ्ट-क्लिक फ़िल्टर को अनदेखा करते हैं", + "button.chestseparators.hopper_insert": "हॉपर प्रविष्टि", + "tooltip.chestseparators.rule.hopper_active": "सक्रिय: हॉपर स्थानांतरण फ़िल्टर करता है", + "tooltip.chestseparators.rule.hopper_inactive": "निष्क्रिय: हॉपर फ़िल्टर को अनदेखा करते हैं", + "button.chestseparators.delete": "हटाएं", + "tooltip.chestseparators.desc.delete_group": "इस फ़िल्टर समूह को हटाता है", + "button.chestseparators.save": "सहेजें", + "tooltip.chestseparators.desc.save": "बदलाव सहेजता है", + "tooltip.chestseparators.desc.cancel": "बदलाव त्यागता है", + "gui.chestseparators.unsaved_changes_title": "सहेजे न गए बदलाव", + "gui.chestseparators.unsaved_changes_desc": "आपके पास इस फ़िल्टर में सहेजे न गए बदलाव हैं।", + "gui.chestseparators.new_detected": "नया पाया गया: %s", + "gui.chestseparators.allowing_all": "सभी को अनुमति दे रहा है: %s", + "gui.chestseparators.clearing": "साफ़ कर रहा है: %s", + "gui.chestseparators.allowed": "अनुमति प्राप्त: %s", + "gui.chestseparators.blocked": "अवरुद्ध: %s", + "gui.chestseparators.edit_filter_rules": "फ़िल्टर नियम संपादित करें", + "message.chestseparators.no_valid_groups": "कोई मान्य समूह नहीं।", + "color.chestseparators.custom": "कस्टम रंग %s", + "button.chestseparators.eyedropper": "आईड्रॉपर", + "tooltip.chestseparators.desc.eyedropper": "सीधे स्क्रीन से रंग चुनें", + "button.chestseparators.exit": "बाहर निकलें", + "tooltip.chestseparators.desc.exit": "बदलाव सहेजें और रंग पिकर बंद करें", + "gui.chestseparators.hex": "Hex", + "gui.chestseparators.color_r": "R", + "gui.chestseparators.color_g": "G", + "gui.chestseparators.color_b": "B", + "gui.chestseparators.color_picker.instructions": "कॉपी करने के लिए मध्य-क्लिक करें। पेस्ट करने के लिए बायां-क्लिक करें।", + "window.chestseparators.edit_color": "कस्टम रंग संपादित करें", + "message.chestseparators.edit_buttons_visible": "संपादन बटन: दृश्यमान", + "message.chestseparators.edit_buttons_hidden": "संपादन बटन: छिपा हुआ", + "message.chestseparators.preview_panel_visible": "पूर्वावलोकन पैनल: दृश्यमान", + "message.chestseparators.preview_panel_hidden": "पूर्वावलोकन पैनल: छिपा हुआ", + "modmenu.descriptionTranslation.chestseparators": "कस्टम ऑटो-डिपॉजिट के साथ अपनी इन्वेंट्री को तेज़ी से खाली करें। गेम को आखिरकार पता चल गया है कि आप वास्तव में क्या चाहते हैं और कहाँ चाहते हैं।", + "config.chestseparators.category.client": "क्लाइंट / दृश्य", + "config.chestseparators.show_left_panel": "बायां पैनल दिखाएं", + "config.chestseparators.show_left_panel.tooltip": "श्वेतसूची पूर्वावलोकन पैनल दिखाता है। ओवरराइड करने के लिए संशोधक कुंजी दबाए रखें।", + "config.chestseparators.enable_preview_animation": "पूर्वावलोकन एनीमेशन सक्षम करें", + "config.chestseparators.enable_preview_animation.tooltip": "पूर्वावलोकन पैनल में आइटम सूची को स्वचालित रूप से स्क्रॉल करता है।", + "config.chestseparators.show_edit_buttons": "संपादक बटन दिखाएं", + "config.chestseparators.show_edit_buttons.tooltip": "चेस्ट के अंदर उपकरण बटन प्रदर्शित करता है।", + "config.chestseparators.bg_transparency": "पृष्ठभूमि पारदर्शिता", + "config.chestseparators.bg_transparency.tooltip": "स्लॉट पृष्ठभूमि रंगों के लिए अपारदर्शिता स्तर (0 = अदृश्य, 100 = ठोस)।", + "config.chestseparators.line_transparency": "रेखा पारदर्शिता", + "config.chestseparators.line_transparency.tooltip": "विभाजक रेखाओं के लिए अपारदर्शिता स्तर (0 = अदृश्य, 100 = ठोस)।", + "config.chestseparators.default_rule_manual": "डिफ़ॉल्ट नियम: मैनुअल", + "config.chestseparators.default_rule_manual.tooltip": "नए बनाए गए समूह डिफ़ॉल्ट रूप से मैन्युअल क्लिक की अनुमति देंगे।", + "config.chestseparators.default_rule_shift": "डिफ़ॉल्ट नियम: Shift", + "config.chestseparators.default_rule_shift.tooltip": "नए बनाए गए समूह डिफ़ॉल्ट रूप से शिफ्ट-क्लिक की अनुमति देंगे।", + "config.chestseparators.default_rule_hopper": "डिफ़ॉल्ट नियम: हॉपर", + "config.chestseparators.default_rule_hopper.tooltip": "नए बनाए गए समूह डिफ़ॉल्ट रूप से हॉपर प्रविष्टि की अनुमति देंगे।", + "config.chestseparators.default_rule_pickup": "डिफ़ॉल्ट नियम: उठाना", + "config.chestseparators.default_rule_pickup.tooltip": "नए बनाए गए इन्वेंटरी समूह डिफ़ॉल्ट रूप से ज़मीन से उठाए गए आइटम फ़िल्टर करेंगे।", + "config.chestseparators.category.server": "सर्वर / यांत्रिकी", + "config.chestseparators.expel_invalid_items": "अमान्य आइटम निकालें", + "config.chestseparators.expel_invalid_items.tooltip": "नया फ़िल्टर लागू करते समय, अमान्य आइटम इन्वेंट्री में धकेल दिए जाएंगे।", + "config.chestseparators.category.hotkeys": "हॉटकी", + "config.chestseparators.toggle_preview_panel": "पूर्वावलोकन पैनल टॉगल करें", + "config.chestseparators.toggle_preview_panel.tooltip": "बाएँ पूर्वावलोकन पैनल को जल्दी से दिखाएं/छिपाएं।", + "config.chestseparators.show_panel_modifier": "पैनल संशोधक दिखाएं", + "config.chestseparators.show_panel_modifier.tooltip": "अक्षम होने पर बाएँ पैनल को दिखाने के लिए बाध्य करने के लिए इस कुंजी को दबाए रखें।", + "button.chestseparators.import_search": "खोज आयात करें", + "message.chestseparators.locked": "कोई अन्य पहले से ही इस संदूक को संपादित कर रहा है!", + "gui.chestseparators.expel_items_title": "अमान्य आइटम निकालें?", + "gui.chestseparators.expel_items_desc": "वर्तमान में इन स्लॉट में मौजूद कुछ आइटम नए नियमों से मेल नहीं खाते हैं। उन्हें संदूक से बाहर निकाल दिया जाएगा।", + "button.chestseparators.accept_expel": "स्वीकार करें और निकालें", + "config.chestseparators.dark_mode": "डार्क मोड", + "config.chestseparators.dark_mode.tooltip": "डार्क और लाइट यूआई थीम के बीच टॉगल करें।", + "config.chestseparators.show_deposit_button": "जमा बटन दिखाएं", + "message.chestseparators.deposit_button_visible": "जमा बटन: दृश्यमान", + "message.chestseparators.deposit_button_hidden": "जमा बटन: छिपा हुआ", + "key.chestseparators.toggle_magnifier": "आवर्धक टॉगल करें", + "key.chestseparators.toggle_edit_buttons": "टूलबार टॉगल करें", + "config.chestseparators.toggle_edit_buttons": "टूलबार टॉगल करें", + "config.chestseparators.toggle_edit_buttons.tooltip": "पूरे शीर्ष टूलबार को एक साथ दिखाएँ या छिपाएँ।", + "config.chestseparators.toggle_magnifier": "आवर्धक टॉगल करें", + "config.chestseparators.magnifier_enabled": "आवर्धक दिखाएं", + "config.chestseparators.magnifier_enabled.tooltip": "विभाजक बनाते समय या आईड्रॉपर का उपयोग करते समय कर्सर पर ज़ूम लेंस दिखाता है।", + "config.chestseparators.magnifier_shape": "आवर्धक आकार", + "config.chestseparators.magnifier_shape.tooltip": "आवर्धक गोल है या चौकोर।", + "config.chestseparators.magnifier_shape.circle": "वृत्त", + "config.chestseparators.magnifier_shape.square": "वर्ग", + "config.chestseparators.magnifier_tab_lines": "आवर्धक: रेखाएं", + "config.chestseparators.magnifier_tab_backgrounds": "आवर्धक: पृष्ठभूमि", + "config.chestseparators.magnifier_tab_combo": "आवर्धक: कॉम्बो मोड", + "message.chestseparators.magnifier_on": "आवर्धक: चालू", + "message.chestseparators.magnifier_off": "आवर्धक: बंद", + "message.chestseparators.magnifier_hint": "सुझाव: ज़ूम लेंस के लिए %s दबाएं", + "message.chestseparators.tag_hint": "सुझाव: टैग देखने के लिए आइटम पर मध्य-क्लिक करें", + "message.chestseparators.magnifier_hint_off": "सुझाव: ज़ूम लूप हटाने के लिए %s दबाएँ", + "config.chestseparators.show_deposit_button.tooltip": "चेस्ट इंटरफ़ेस में त्वरित जमा बटन दिखाता या छुपाता है।", + "tooltip.chestseparators.deposit_items": "फ़िल्टर में जमा करें\n§8[Shift + Click] फ़िल्टर और खाली स्लॉट में जमा करें", + "message.chestseparators.deposited": "%s आइटम जमा किए गए।", + "message.chestseparators.deposit_failed": "आइटम जमा करने के लिए कोई मान्य स्लॉट नहीं मिला।", + "config.chestseparators.close_on_click_outside": "बाहर क्लिक करने पर बंद करें", + "config.chestseparators.close_on_click_outside.tooltip": "इंटरफ़ेस के बाहर क्लिक करने पर मेनू बंद हो जाता है।", + "config.chestseparators.shared_custom_colors": "साझा कस्टम रंग", + "config.chestseparators.shared_custom_colors.tooltip": "सक्षम होने पर, कस्टम रंग कॉलम लाइन, बैकग्राउंड और कॉम्बो टैब में साझा होता है। अक्षम होने पर, प्रत्येक टैब के अपने रंग होते हैं।", + "title.chestseparators.config": "Absolute Order कॉन्फ़िगरेशन", + "category.chestseparators.keys": "Absolute Order", + "key.category.chestseparators.keys": "Absolute Order", + "config.chestseparators.auto_deposit_enabled": "पास के संदूकों में स्वतः जमा", + "config.chestseparators.auto_deposit_enabled.tooltip": "एक ही क्रिया से अपनी पूरी इन्वेंटरी पास के फ़िल्टर किए गए संदूकों में व्यवस्थित करें।", + "config.chestseparators.auto_deposit_double_sneak": "ट्रिगर: दोहरा झुकाव", + "config.chestseparators.auto_deposit_double_sneak.tooltip": "स्वतः जमा करने के लिए झुकने की कुंजी जल्दी से दो बार दबाएँ।", + "config.chestseparators.auto_deposit_radius": "स्वतः जमा त्रिज्या", + "config.chestseparators.auto_deposit_radius.tooltip": "आपके चारों ओर (ब्लॉक में) कितनी दूर तक संदूक खोजे जाते हैं।", + "config.chestseparators.auto_deposit_through_walls": "दीवारों के पार जमा करें", + "config.chestseparators.auto_deposit_through_walls.tooltip": "ठोस ब्लॉकों से अवरुद्ध संदूकों में जमा करने की अनुमति देता है। बंद होने पर रास्ता साफ़ होना चाहिए।", + "config.chestseparators.auto_deposit": "स्वतः जमा", + "key.chestseparators.auto_deposit": "पास के संदूकों में स्वतः जमा", + "message.chestseparators.auto_deposit_done": "%s वस्तुएँ स्वतः जमा कीं।", + "message.chestseparators.auto_deposit_none": "पहुँच में पास कोई फ़िल्टर किया संदूक नहीं।", + "message.chestseparators.auto_grab_done": "%s वस्तुएँ ली गईं।", + "message.chestseparators.auto_grab_none": "पास लेने को कुछ नहीं।", + "message.chestseparators.preset_loaded": "प्रीसेट %s लोड हुआ।", + "message.chestseparators.preset_saved": "प्रीसेट %s सहेजा गया।", + "message.chestseparators.preset_empty": "प्रीसेट %s खाली है।", + "config.chestseparators.auto_deposit_animation": "जमा एनिमेशन", + "config.chestseparators.auto_deposit_animation.tooltip": "प्रत्येक संदूक की ओर उड़ते 3D आइटम दिखाता है। बंद होने पर आइटम बिना एनिमेशन के तुरंत जमा होते हैं।", + "config.chestseparators.auto_deposit_trail": "लकीर प्रभाव", + "config.chestseparators.auto_deposit_trail.tooltip": "प्रत्येक उड़ते आइटम के पीछे कणों की लकीर छोड़ता है। केवल तभी लागू होता है जब एनिमेशन चालू हो।", + "button.chestseparators.pickup_insert": "उठाना", + "tooltip.chestseparators.rule.pickup_active": "सक्रिय: ज़मीन से उठाए गए आइटम फ़िल्टर करता है", + "tooltip.chestseparators.rule.pickup_inactive": "निष्क्रिय: उठाए गए आइटम फ़िल्टर को अनदेखा करते हैं", + "tooltip.chestseparators.edit_inventory_toggle": "इन्वेंटरी / संदूक संपादित करें", + "message.chestseparators.editing_inventory": "संपादन: इन्वेंटरी", + "message.chestseparators.editing_chest": "संपादन: संदूक", + "message.chestseparators.preset_deleted": "प्रीसेट %s हटाया गया।", + "gui.chestseparators.preset_overwrite_title": "प्रीसेट %s अधिलेखित करें?", + "gui.chestseparators.preset_overwrite_body": "सहेजा गया प्रीसेट खो जाएगा।", + "gui.chestseparators.preset_page": "पृष्ठ %s/%s", + "gui.chestseparators.preview_delete": "हटाया जाएगा", + "key.chestseparators.push": "संदूक फ़िल्टर में भेजें", + "config.chestseparators.push": "संदूक फ़िल्टर में भेजें", + "config.chestseparators.push.tooltip": "मिलती-जुलती वस्तुओं को खुले संदूक के फ़िल्टर में भेजें।\n§8खाली स्लॉट भी भरने के लिए [Shift] दबाए रखें", + "key.chestseparators.pull": "इन्वेंटरी फ़िल्टर में लाएँ", + "config.chestseparators.pull": "इन्वेंटरी फ़िल्टर में लाएँ", + "config.chestseparators.pull.tooltip": "संदूक की वस्तुओं को अपनी इन्वेंटरी फ़िल्टर में लाएँ।\n§8बिना फ़िल्टर वाली वस्तुएँ भी लाने के लिए [Shift] दबाए रखें", + "config.chestseparators.lock_hotbar_on_reorder": "ऑटो-सॉर्ट पर हॉटबार लॉक करें", + "config.chestseparators.lock_hotbar_on_reorder.tooltip": "जब कोई पुश या पुल आपकी इन्वेंटरी क्रमबद्ध करता है, तो हॉटबार अछूता रहता है।", + "config.chestseparators.lock_hotbar_on_reorder.tooltip2": "आपके हाथ की वस्तु की रक्षा करता है। बंद: हॉटबार भी क्रमबद्ध होता है।", + "message.chestseparators.push_no_filters": "इस संदूक में अभी कोई फ़िल्टर नहीं है।", + "message.chestseparators.push_no_slot": "कोई खाली फ़िल्टर स्लॉट नहीं है।", + "message.chestseparators.pull_no_filters": "आपकी इन्वेंटरी में अभी कोई फ़िल्टर नहीं है।", + "message.chestseparators.pull_no_match": "यहाँ कुछ भी आपके फ़िल्टर से मेल नहीं खाता।" +} diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/lang/id_id.json b/multiloader-26.3/common/src/main/resources/assets/chestseparators/lang/id_id.json new file mode 100644 index 0000000..4bb9f20 --- /dev/null +++ b/multiloader-26.3/common/src/main/resources/assets/chestseparators/lang/id_id.json @@ -0,0 +1,257 @@ +{ + "tooltip.chestseparators.edit_mode": "Edit Tata Letak", + "tooltip.chestseparators.whitelist_mode": "Kelola Filter", + "itemGroup.chestseparators.chest_and_inventory": "Peti dan Inventaris", + "gui.chestseparators.search": "Cari", + "button.chestseparators.copy_layout": "Salin Tata Letak", + "message.chestseparators.layout_copied": "Tata Letak Disalin!", + "tooltip.chestseparators.desc.copy_layout": "Menyalin tata letak saat ini ke papan klip", + "button.chestseparators.paste_layout": "Tempel Tata Letak", + "message.chestseparators.layout_pasted": "Tata Letak Ditempel!", + "tooltip.chestseparators.desc.paste_layout": "Menempelkan tata letak yang disalin dari papan klip", + "button.chestseparators.undo_action": "Urungkan", + "tooltip.chestseparators.desc.undo_action": "Membatalkan tindakan gambar terakhir", + "button.chestseparators.redo_action": "Ulangi", + "tooltip.chestseparators.desc.redo_action": "Mengembalikan tindakan yang sebelumnya diurungkan", + "tooltip.chestseparators.draw_area": "Gambar Area", + "tooltip.chestseparators.erase_area": "Hapus Area", + "tooltip.chestseparators.clear_lines": "Bersihkan Garis", + "tooltip.chestseparators.clear_backgrounds": "Bersihkan Latar Belakang", + "tooltip.chestseparators.clear_both": "Bersihkan Keduanya", + "message.chestseparators.cleared": "Dihapus", + "tooltip.chestseparators.draw_trace": "Gambar Jejak", + "tooltip.chestseparators.erase_trace": "Hapus Jejak", + "tooltip.chestseparators.open_palette": "Buka Palet", + "message.chestseparators.color_copied": "Warna Disalin!", + "message.chestseparators.color_pasted": "Warna Ditempel!", + "tooltip.chestseparators.tab_lines": "Garis", + "tooltip.chestseparators.tab_backgrounds": "Latar Belakang", + "tooltip.chestseparators.tab_combo": "Mode Kombo", + "button.chestseparators.edit_filter": "Edit Filter", + "tooltip.chestseparators.desc.edit_filter": "Buat atau edit filter untuk slot yang dipilih", + "button.chestseparators.delete_all_filters": "Hapus Semua Filter", + "tooltip.chestseparators.desc.delete_all_filters": "Menghapus setiap filter di peti ini", + "message.chestseparators.all_filters_deleted": "Semua Filter Dihapus!", + "message.chestseparators.select_first": "Pilih setidaknya satu slot terlebih dahulu.", + "button.chestseparators.area_select": "Pilih Area", + "tooltip.chestseparators.desc.area_select": "Pilih slot dengan menyeret area persegi panjang", + "button.chestseparators.trace_select": "Pilih Jejak", + "tooltip.chestseparators.desc.trace_select": "Pilih slot dengan melukis di atasnya", + "button.chestseparators.clear_selection": "Bersihkan Pilihan", + "tooltip.chestseparators.desc.clear_selection": "Bersihkan semua slot yang saat ini dipilih", + "button.chestseparators.copy_filters": "Salin Filter", + "message.chestseparators.filters_copied": "Filter Disalin!", + "tooltip.chestseparators.desc.copy_filters": "Salin semua filter dari peti ini ke papan klip", + "button.chestseparators.paste_filters": "Tempel Filter", + "message.chestseparators.filters_pasted": "Filter Ditempel!", + "message.chestseparators.undone": "Dibatalkan: %s", + "message.chestseparators.redone": "Diulang: %s", + "message.chestseparators.action.layout": "Tata Letak", + "message.chestseparators.action.filter": "Filter", + "tooltip.chestseparators.desc.paste_filters": "Tempel filter dari papan klip ke peti ini", + "button.chestseparators.undo": "Urungkan", + "tooltip.chestseparators.desc.undo": "Membatalkan tindakan filter terakhir", + "button.chestseparators.redo": "Ulangi", + "button.chestseparators.fill_inventory": "Isi inventaris", + "button.chestseparators.preset_load": "Muat", + "button.chestseparators.preset_save": "Simpan", + "tooltip.chestseparators.desc.redo": "Mengembalikan tindakan yang sebelumnya diurungkan", + "tooltip.chestseparators.desc.fill_inventory": "Tarik item terfilter ke sini (hingga target)", + "tooltip.chestseparators.push_to_chest": "Kirim item ke peti\n§8Tahan [Shift] untuk slot kosong", + "tooltip.chestseparators.push_to_chest.shift": "Ke peti + slot kosong", + "tooltip.chestseparators.pull_from_chest": "Tarik item dari peti\n§8[Shift] juga menarik item tak terfilter", + "tooltip.chestseparators.desc.presets": "Preset inventaris: simpan dan muat tata letak dan filter", + "tooltip.chestseparators.desc.chest_presets": "Preset peti: simpan dan muat tata letak dan filter peti", + "button.chestseparators.conflict.overwrite": "Timpa filter yang ada", + "tooltip.chestseparators.desc.conflict.overwrite": "Menghapus filter yang ada di pilihan dan membuat yang baru", + "button.chestseparators.conflict.deselect": "Hapus pilihan konflik & lanjutkan", + "message.chestseparators.empty_selection": "Pilihan kosong.", + "tooltip.chestseparators.desc.conflict.deselect": "Menjaga filter yang ada tetap utuh dan hanya berlaku untuk slot kosong", + "button.chestseparators.cancel": "Batal", + "tooltip.chestseparators.desc.conflict.cancel": "Batalkan pembuatan filter", + "button.chestseparators.confirm": "Konfirmasi", + "gui.chestseparators.conflict_title": "Konflik Pilihan!", + "gui.chestseparators.presets_title": "Preset inventaris", + "gui.chestseparators.chest_presets_title": "Preset peti", + "gui.chestseparators.preview_layout": "Tata letak", + "gui.chestseparators.preview_filters": "Filter", + "gui.chestseparators.preset_slot": "Preset %s", + "gui.chestseparators.preset.building": "Bangunan", + "gui.chestseparators.preset.mining": "Pertambangan", + "gui.chestseparators.preset.food": "Makanan & pertanian", + "gui.chestseparators.preset.redstone": "Redstone", + "gui.chestseparators.preset.combat": "Tempur", + "gui.chestseparators.preset.inv_miner": "Penambang", + "gui.chestseparators.preset.inv_builder": "Pembangun", + "gui.chestseparators.preset.inv_explorer": "Penjelajah", + "gui.chestseparators.preset.inv_farmer": "Petani", + "gui.chestseparators.preset.inv_nether_end": "Nether & End", + "gui.chestseparators.conflict_desc": "Beberapa slot yang dipilih sudah memiliki filter.", + "gui.chestseparators.group_filter": "Filter Grup", + "gui.chestseparators.no_filter": "Tanpa Filter", + "gui.chestseparators.items_count": "Barang: %s", + "gui.chestseparators.hover_group": "Arahkan ke grup...", + "gui.chestseparators.empty_whitelist": "Daftar putih kosong.", + "button.chestseparators.save_and_exit": "Simpan dan Keluar", + "button.chestseparators.discard_changes": "Buang Perubahan", + "button.chestseparators.import_extracted": "Impor yang Diekstrak", + "message.chestseparators.items_already_in_filter": "Barang sudah ada di filter.", + "message.chestseparators.no_new_items_found": "Tidak ada barang baru yang ditemukan.", + "tooltip.chestseparators.desc.import_extracted": "Menambahkan item pada slot terpilih ke filter.", + "tooltip.chestseparators.desc.import_search": "Impor Pencarian", + "button.chestseparators.allow_all": "Izinkan Semua", + "tooltip.chestseparators.desc.allow_all": "Memasukkan semua barang game ke daftar putih", + "button.chestseparators.clear_all": "Bersihkan Semua", + "tooltip.chestseparators.desc.clear_all": "Membersihkan daftar putih saat ini", + "button.chestseparators.manual_insert": "Masukkan Manual", + "tooltip.chestseparators.rule.manual_active": "Aktif: Menyaring klik manual", + "tooltip.chestseparators.rule.manual_inactive": "Tidak Aktif: Klik manual mengabaikan filter", + "button.chestseparators.shift_insert": "Masukkan Shift", + "tooltip.chestseparators.rule.shift_active": "Aktif: Menyaring klik Shift", + "tooltip.chestseparators.rule.shift_inactive": "Tidak Aktif: Klik Shift mengabaikan filter", + "button.chestseparators.hopper_insert": "Masukkan Corong", + "tooltip.chestseparators.rule.hopper_active": "Aktif: Menyaring transfer corong", + "tooltip.chestseparators.rule.hopper_inactive": "Tidak Aktif: Corong mengabaikan filter", + "button.chestseparators.delete": "Hapus", + "tooltip.chestseparators.desc.delete_group": "Menghapus grup filter ini", + "button.chestseparators.save": "Simpan", + "tooltip.chestseparators.desc.save": "Menyimpan perubahan", + "tooltip.chestseparators.desc.cancel": "Membuang perubahan", + "gui.chestseparators.unsaved_changes_title": "Perubahan Belum Disimpan", + "gui.chestseparators.unsaved_changes_desc": "Anda memiliki perubahan yang belum disimpan pada filter ini.", + "gui.chestseparators.new_detected": "Baru terdeteksi: %s", + "gui.chestseparators.allowing_all": "Mengizinkan Semua: %s", + "gui.chestseparators.clearing": "Membersihkan: %s", + "gui.chestseparators.allowed": "Diizinkan: %s", + "gui.chestseparators.blocked": "Dibloki: %s", + "gui.chestseparators.edit_filter_rules": "Edit Aturan Filter", + "message.chestseparators.no_valid_groups": "Tidak ada grup yang valid.", + "color.chestseparators.custom": "Warna Kustom %s", + "button.chestseparators.eyedropper": "Pipet Warna", + "tooltip.chestseparators.desc.eyedropper": "Pilih warna langsung dari layar", + "button.chestseparators.exit": "Keluar", + "tooltip.chestseparators.desc.exit": "Simpan perubahan dan tutup pemilih warna", + "gui.chestseparators.hex": "Hex", + "gui.chestseparators.color_r": "R", + "gui.chestseparators.color_g": "G", + "gui.chestseparators.color_b": "B", + "gui.chestseparators.color_picker.instructions": "Klik tengah untuk menyalin. Klik kiri slot khusus untuk menempel.", + "window.chestseparators.edit_color": "Edit Warna Kustom", + "message.chestseparators.edit_buttons_visible": "Tombol Edit: Terlihat", + "message.chestseparators.edit_buttons_hidden": "Tombol Edit: Tersembunyi", + "message.chestseparators.preview_panel_visible": "Panel Pratinjau: Terlihat", + "message.chestseparators.preview_panel_hidden": "Panel Pratinjau: Tersembunyi", + "modmenu.descriptionTranslation.chestseparators": "Kosongkan inventaris dengan cepat menggunakan setoran otomatis kustom. Game ini akhirnya tahu persis apa yang Anda inginkan dan di mana Anda menginginkannya.", + "config.chestseparators.category.client": "Klien / Visual", + "config.chestseparators.show_left_panel": "Tampilkan Panel Kiri", + "config.chestseparators.show_left_panel.tooltip": "Menampilkan panel pratinjau daftar putih. Tahan tombol pengubah untuk memaksa tampil.", + "config.chestseparators.enable_preview_animation": "Aktifkan Animasi Pratinjau", + "config.chestseparators.enable_preview_animation.tooltip": "Menggulir daftar barang secara otomatis di panel pratinjau.", + "config.chestseparators.show_edit_buttons": "Tampilkan Tombol Editor", + "config.chestseparators.show_edit_buttons.tooltip": "Menampilkan tombol alat di dalam GUI peti.", + "config.chestseparators.bg_transparency": "Transparansi Latar Belakang", + "config.chestseparators.bg_transparency.tooltip": "Tingkat opasitas untuk warna latar belakang slot (0 = Tak Terlihat, 100 = Padat).", + "config.chestseparators.line_transparency": "Transparansi Garis", + "config.chestseparators.line_transparency.tooltip": "Tingkat opasitas untuk garis pemisah (0 = Tak Terlihat, 100 = Padat).", + "config.chestseparators.default_rule_manual": "Aturan Default: Manual", + "config.chestseparators.default_rule_manual.tooltip": "Grup baru akan mengizinkan klik manual secara default.", + "config.chestseparators.default_rule_shift": "Aturan Default: Shift", + "config.chestseparators.default_rule_shift.tooltip": "Grup baru akan mengizinkan klik Shift secara default.", + "config.chestseparators.default_rule_hopper": "Aturan Default: Corong", + "config.chestseparators.default_rule_hopper.tooltip": "Grup baru akan mengizinkan penyisipan corong secara default.", + "config.chestseparators.default_rule_pickup": "Aturan Default: Ambil", + "config.chestseparators.default_rule_pickup.tooltip": "Grup inventaris baru akan memfilter item yang dipungut dari tanah secara default.", + "config.chestseparators.category.server": "Server / Mekanisme", + "config.chestseparators.expel_invalid_items": "Keluarkan Barang Tidak Valid", + "config.chestseparators.expel_invalid_items.tooltip": "Barang tidak valid yang ada akan didorong ke inventaris pemain atau dijatuhkan.", + "config.chestseparators.category.hotkeys": "Tombol Pintas", + "config.chestseparators.toggle_preview_panel": "Alihkan Panel Pratinjau", + "config.chestseparators.toggle_preview_panel.tooltip": "Menampilkan/menyembunyikan panel pratinjau kiri dengan cepat.", + "config.chestseparators.show_panel_modifier": "Pengubah Tampilan Panel", + "config.chestseparators.show_panel_modifier.tooltip": "Tahan tombol ini untuk memaksa panel kiri tampil jika dinonaktifkan.", + "button.chestseparators.import_search": "Impor Pencarian", + "message.chestseparators.locked": "Orang lain sudah mengedit peti ini!", + "gui.chestseparators.expel_items_title": "Keluarkan Item Tidak Valid?", + "gui.chestseparators.expel_items_desc": "Beberapa item saat ini di slot ini tidak cocok dengan aturan baru. Mereka akan dikeluarkan dari peti.", + "button.chestseparators.accept_expel": "Terima & Keluarkan", + "config.chestseparators.dark_mode": "Mode Gelap", + "config.chestseparators.dark_mode.tooltip": "Beralih antara tema UI gelap dan terang.", + "config.chestseparators.show_deposit_button": "Tampilkan Tombol Simpan", + "message.chestseparators.deposit_button_visible": "Tombol Simpan: Terlihat", + "message.chestseparators.deposit_button_hidden": "Tombol Simpan: Tersembunyi", + "key.chestseparators.toggle_magnifier": "Alihkan Kaca Pembesar", + "key.chestseparators.toggle_edit_buttons": "Alihkan bilah alat", + "config.chestseparators.toggle_edit_buttons": "Alihkan bilah alat", + "config.chestseparators.toggle_edit_buttons.tooltip": "Menampilkan atau menyembunyikan seluruh bilah alat atas sekaligus.", + "config.chestseparators.toggle_magnifier": "Alihkan Kaca Pembesar", + "config.chestseparators.magnifier_enabled": "Tampilkan Kaca Pembesar", + "config.chestseparators.magnifier_enabled.tooltip": "Menampilkan kaca pembesar di kursor saat melukis pemisah atau memakai pipet.", + "config.chestseparators.magnifier_shape": "Bentuk Kaca Pembesar", + "config.chestseparators.magnifier_shape.tooltip": "Apakah kaca pembesar bulat atau kotak.", + "config.chestseparators.magnifier_shape.circle": "Lingkaran", + "config.chestseparators.magnifier_shape.square": "Kotak", + "config.chestseparators.magnifier_tab_lines": "Kaca Pembesar: Garis", + "config.chestseparators.magnifier_tab_backgrounds": "Kaca Pembesar: Latar Belakang", + "config.chestseparators.magnifier_tab_combo": "Kaca Pembesar: Mode Kombo", + "message.chestseparators.magnifier_on": "Kaca Pembesar: Aktif", + "message.chestseparators.magnifier_off": "Kaca Pembesar: Mati", + "message.chestseparators.magnifier_hint": "Tips: tekan %s untuk kaca pembesar", + "message.chestseparators.tag_hint": "Tips: klik tengah item untuk melihat tag-nya", + "message.chestseparators.magnifier_hint_off": "Tips: tekan %s untuk menyembunyikan lup zoom", + "config.chestseparators.show_deposit_button.tooltip": "Menampilkan atau menyembunyikan tombol simpan cepat di antarmuka peti.", + "tooltip.chestseparators.deposit_items": "Simpan ke Filter\n§8[Shift + Klik] Simpan ke Filter & Slot Kosong", + "message.chestseparators.deposited": "Menyimpan %s item.", + "message.chestseparators.deposit_failed": "Tidak ada slot yang valid ditemukan untuk menyimpan item.", + "config.chestseparators.close_on_click_outside": "Tutup saat Klik di Luar", + "config.chestseparators.close_on_click_outside.tooltip": "Menutup menu saat mengklik di luar antarmuka.", + "config.chestseparators.shared_custom_colors": "Warna Kustom Bersama", + "config.chestseparators.shared_custom_colors.tooltip": "Jika aktif, kolom warna kustom digunakan bersama di tab Garis, Latar, dan Combo. Jika nonaktif, tiap tab punya sendiri.", + "title.chestseparators.config": "Konfigurasi Absolute Order", + "category.chestseparators.keys": "Absolute Order", + "key.category.chestseparators.keys": "Absolute Order", + "config.chestseparators.auto_deposit_enabled": "Setor otomatis ke peti terdekat", + "config.chestseparators.auto_deposit_enabled.tooltip": "Urutkan seluruh inventarismu ke peti berfilter terdekat dengan satu pemicu.", + "config.chestseparators.auto_deposit_double_sneak": "Pemicu: menunduk ganda", + "config.chestseparators.auto_deposit_double_sneak.tooltip": "Tekan tombol menunduk dua kali dengan cepat untuk menyetor otomatis.", + "config.chestseparators.auto_deposit_radius": "Radius setor otomatis", + "config.chestseparators.auto_deposit_radius.tooltip": "Seberapa jauh di sekitarmu (dalam blok) peti dicari.", + "config.chestseparators.auto_deposit_through_walls": "Setor menembus dinding", + "config.chestseparators.auto_deposit_through_walls.tooltip": "Izinkan menyetor ke peti yang terhalang blok padat. Bila mati, jalur harus bebas.", + "config.chestseparators.auto_deposit": "Setor otomatis", + "key.chestseparators.auto_deposit": "Setor otomatis ke peti terdekat", + "message.chestseparators.auto_deposit_done": "%s item disetor otomatis.", + "message.chestseparators.auto_deposit_none": "Tidak ada peti berfilter terdekat dalam jangkauan.", + "message.chestseparators.auto_grab_done": "Mengambil %s item.", + "message.chestseparators.auto_grab_none": "Tidak ada yang bisa diambil.", + "message.chestseparators.preset_loaded": "Preset %s dimuat.", + "message.chestseparators.preset_saved": "Preset %s disimpan.", + "message.chestseparators.preset_empty": "Preset %s kosong.", + "config.chestseparators.auto_deposit_animation": "Animasi setor", + "config.chestseparators.auto_deposit_animation.tooltip": "Menampilkan item 3D yang terbang ke setiap peti. Bila mati, item disetor seketika tanpa animasi.", + "config.chestseparators.auto_deposit_trail": "Efek jejak", + "config.chestseparators.auto_deposit_trail.tooltip": "Meninggalkan jejak partikel di belakang setiap item yang terbang. Hanya berlaku saat animasi menyala.", + "button.chestseparators.pickup_insert": "Ambil", + "tooltip.chestseparators.rule.pickup_active": "Aktif: memfilter item yang dipungut dari tanah", + "tooltip.chestseparators.rule.pickup_inactive": "Nonaktif: item yang dipungut mengabaikan filter", + "tooltip.chestseparators.edit_inventory_toggle": "Edit inventaris / peti", + "message.chestseparators.editing_inventory": "Mengedit: inventaris", + "message.chestseparators.editing_chest": "Mengedit: peti", + "message.chestseparators.preset_deleted": "Preset %s dihapus.", + "gui.chestseparators.preset_overwrite_title": "Timpa Preset %s?", + "gui.chestseparators.preset_overwrite_body": "Preset yang tersimpan akan hilang.", + "gui.chestseparators.preset_page": "Halaman %s/%s", + "gui.chestseparators.preview_delete": "Akan dihapus", + "key.chestseparators.push": "Kirim ke Filter Peti", + "config.chestseparators.push": "Kirim ke Filter Peti", + "config.chestseparators.push.tooltip": "Kirim item yang cocok ke filter peti yang terbuka.\n§8Tahan [Shift] untuk mengisi slot kosong juga", + "key.chestseparators.pull": "Ambil ke Filter Inventaris", + "config.chestseparators.pull": "Ambil ke Filter Inventaris", + "config.chestseparators.pull.tooltip": "Ambil item peti ke filter inventarismu.\n§8Tahan [Shift] untuk mengambil item tanpa filter juga", + "config.chestseparators.lock_hotbar_on_reorder": "Kunci hotbar saat menyortir", + "config.chestseparators.lock_hotbar_on_reorder.tooltip": "Saat push atau pull menyortir inventarismu, hotbar dibiarkan.", + "config.chestseparators.lock_hotbar_on_reorder.tooltip2": "Melindungi item yang kamu pegang. Mati: hotbar ikut disortir.", + "message.chestseparators.push_no_filters": "Peti ini belum punya filter.", + "message.chestseparators.push_no_slot": "Tak ada slot filter kosong.", + "message.chestseparators.pull_no_filters": "Inventarismu belum punya filter.", + "message.chestseparators.pull_no_match": "Tak ada yang cocok dengan filtermu." +} diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/lang/it_it.json b/multiloader-26.3/common/src/main/resources/assets/chestseparators/lang/it_it.json new file mode 100644 index 0000000..5b842aa --- /dev/null +++ b/multiloader-26.3/common/src/main/resources/assets/chestseparators/lang/it_it.json @@ -0,0 +1,257 @@ +{ + "tooltip.chestseparators.edit_mode": "Modifica Disposizione", + "tooltip.chestseparators.whitelist_mode": "Gestisci Filtri", + "itemGroup.chestseparators.chest_and_inventory": "Baule e Inventario", + "gui.chestseparators.search": "Cerca", + "button.chestseparators.copy_layout": "Copia Disposizione", + "message.chestseparators.layout_copied": "Disposizione Copiata!", + "tooltip.chestseparators.desc.copy_layout": "Copia la disposizione attuale negli appunti", + "button.chestseparators.paste_layout": "Incolla Disposizione", + "message.chestseparators.layout_pasted": "Disposizione Incollata!", + "tooltip.chestseparators.desc.paste_layout": "Incolla la disposizione copiata dagli appunti", + "button.chestseparators.undo_action": "Annulla Azione", + "tooltip.chestseparators.desc.undo_action": "Annulla l'ultima azione disegnata", + "button.chestseparators.redo_action": "Ripeti Azione", + "tooltip.chestseparators.desc.redo_action": "Ripristina l'azione precedentemente annullata", + "tooltip.chestseparators.draw_area": "Disegna Area", + "tooltip.chestseparators.erase_area": "Cancella Area", + "tooltip.chestseparators.clear_lines": "Svuota Linee", + "tooltip.chestseparators.clear_backgrounds": "Svuota Sfondi", + "tooltip.chestseparators.clear_both": "Svuota Entrambi", + "message.chestseparators.cleared": "Svuotato", + "tooltip.chestseparators.draw_trace": "Disegna Tracciato", + "tooltip.chestseparators.erase_trace": "Cancella Tracciato", + "tooltip.chestseparators.open_palette": "Apri Tavolozza", + "message.chestseparators.color_copied": "Colore Copiato!", + "message.chestseparators.color_pasted": "Colore Incollato!", + "tooltip.chestseparators.tab_lines": "Linee", + "tooltip.chestseparators.tab_backgrounds": "Sfondi", + "tooltip.chestseparators.tab_combo": "Modalità Combinata", + "button.chestseparators.edit_filter": "Modifica Filtro", + "tooltip.chestseparators.desc.edit_filter": "Crea o modifica un filtro per gli slot selezionati", + "button.chestseparators.delete_all_filters": "Elimina Tutti i Filtri", + "tooltip.chestseparators.desc.delete_all_filters": "Elimina ogni filtro in questo baule", + "message.chestseparators.all_filters_deleted": "Tutti i Filtri Eliminati!", + "message.chestseparators.select_first": "Seleziona prima almeno uno slot.", + "button.chestseparators.area_select": "Selezione Area", + "tooltip.chestseparators.desc.area_select": "Seleziona slot trascinando un'area rettangolare", + "button.chestseparators.trace_select": "Selezione Tracciato", + "tooltip.chestseparators.desc.trace_select": "Seleziona slot dipingendoci sopra", + "button.chestseparators.clear_selection": "Cancella Selezione", + "tooltip.chestseparators.desc.clear_selection": "Cancella tutti gli slot attualmente selezionati", + "button.chestseparators.copy_filters": "Copia Filtri", + "message.chestseparators.filters_copied": "Filtri Copiati!", + "tooltip.chestseparators.desc.copy_filters": "Copia tutti i filtri da questo baule agli appunti", + "button.chestseparators.paste_filters": "Incolla Filtri", + "message.chestseparators.filters_pasted": "Filtri Incollati!", + "message.chestseparators.undone": "Annullato: %s", + "message.chestseparators.redone": "Ripristinato: %s", + "message.chestseparators.action.layout": "Disposizione", + "message.chestseparators.action.filter": "Filtro", + "tooltip.chestseparators.desc.paste_filters": "Incolla filtri dagli appunti in questo baule", + "button.chestseparators.undo": "Annulla", + "tooltip.chestseparators.desc.undo": "Annulla l'ultima azione filtro", + "button.chestseparators.redo": "Ripeti", + "button.chestseparators.fill_inventory": "Riempi inventario", + "button.chestseparators.preset_load": "Carica", + "button.chestseparators.preset_save": "Salva", + "tooltip.chestseparators.desc.redo": "Ripristina l'azione precedentemente annullata", + "tooltip.chestseparators.desc.fill_inventory": "Preleva gli oggetti filtrati qui (fino all’obiettivo)", + "tooltip.chestseparators.push_to_chest": "Metti gli oggetti nel baule\n§8Tieni [Shift] per gli slot vuoti", + "tooltip.chestseparators.push_to_chest.shift": "Nel baule + slot vuoti", + "tooltip.chestseparators.pull_from_chest": "Preleva gli oggetti dal baule\n§8[Shift] preleva anche i non filtrati", + "tooltip.chestseparators.desc.presets": "Preset inventario: salva e carica layout e filtri", + "tooltip.chestseparators.desc.chest_presets": "Preset cassa: salva e carica layout e filtri della cassa", + "button.chestseparators.conflict.overwrite": "Sovrascrivi i filtri esistenti", + "tooltip.chestseparators.desc.conflict.overwrite": "Elimina i filtri esistenti nella selezione e ne crea uno nuovo", + "button.chestseparators.conflict.deselect": "Deseleziona conflitti e continua", + "message.chestseparators.empty_selection": "Selezione vuota.", + "tooltip.chestseparators.desc.conflict.deselect": "Mantiene intatti i filtri esistenti e si applica solo agli slot vuoti", + "button.chestseparators.cancel": "Annulla", + "tooltip.chestseparators.desc.conflict.cancel": "Interrompi la creazione del filtro", + "button.chestseparators.confirm": "Conferma", + "gui.chestseparators.conflict_title": "Conflitto di Selezione!", + "gui.chestseparators.presets_title": "Preset inventario", + "gui.chestseparators.chest_presets_title": "Preset cassa", + "gui.chestseparators.preview_layout": "Layout", + "gui.chestseparators.preview_filters": "Filtri", + "gui.chestseparators.preset_slot": "Preset %s", + "gui.chestseparators.preset.building": "Costruzione", + "gui.chestseparators.preset.mining": "Estrazione", + "gui.chestseparators.preset.food": "Cibo e fattoria", + "gui.chestseparators.preset.redstone": "Redstone", + "gui.chestseparators.preset.combat": "Combattimento", + "gui.chestseparators.preset.inv_miner": "Minatore", + "gui.chestseparators.preset.inv_builder": "Costruttore", + "gui.chestseparators.preset.inv_explorer": "Esploratore", + "gui.chestseparators.preset.inv_farmer": "Contadino", + "gui.chestseparators.preset.inv_nether_end": "Nether e End", + "gui.chestseparators.conflict_desc": "Alcuni slot selezionati hanno già un filtro.", + "gui.chestseparators.group_filter": "Filtro Gruppo", + "gui.chestseparators.no_filter": "Nessun Filtro", + "gui.chestseparators.items_count": "Oggetti: %s", + "gui.chestseparators.hover_group": "Passa il mouse su un gruppo...", + "gui.chestseparators.empty_whitelist": "Whitelist vuota.", + "button.chestseparators.save_and_exit": "Salva ed Esci", + "button.chestseparators.discard_changes": "Scarta Modifiche", + "button.chestseparators.import_extracted": "Importa Estratti", + "message.chestseparators.items_already_in_filter": "Oggetti già nel filtro.", + "message.chestseparators.no_new_items_found": "Nessun nuovo oggetto trovato.", + "tooltip.chestseparators.desc.import_extracted": "Aggiunge al filtro gli oggetti presenti negli slot selezionati.", + "tooltip.chestseparators.desc.import_search": "Importa Ricerca", + "button.chestseparators.allow_all": "Consenti Tutti", + "tooltip.chestseparators.desc.allow_all": "Inserisce tutti gli oggetti nella whitelist", + "button.chestseparators.clear_all": "Svuota Tutto", + "tooltip.chestseparators.desc.clear_all": "Svuota la whitelist attuale", + "button.chestseparators.manual_insert": "Inserimento Manuale", + "tooltip.chestseparators.rule.manual_active": "Attivo: Filtra clic manuali", + "tooltip.chestseparators.rule.manual_inactive": "Inattivo: I clic manuali ignorano il filtro", + "button.chestseparators.shift_insert": "Inserimento Maiusc", + "tooltip.chestseparators.rule.shift_active": "Attivo: Filtra clic con Maiusc", + "tooltip.chestseparators.rule.shift_inactive": "Inattivo: I clic con Maiusc ignorano il filtro", + "button.chestseparators.hopper_insert": "Inserimento Tramoggia", + "tooltip.chestseparators.rule.hopper_active": "Attivo: Filtra trasferimenti tramoggia", + "tooltip.chestseparators.rule.hopper_inactive": "Inattivo: Le tramogge ignorano il filtro", + "button.chestseparators.delete": "Elimina", + "tooltip.chestseparators.desc.delete_group": "Elimina questo gruppo di filtri", + "button.chestseparators.save": "Salva", + "tooltip.chestseparators.desc.save": "Salva le modifiche", + "tooltip.chestseparators.desc.cancel": "Scarta le modifiche", + "gui.chestseparators.unsaved_changes_title": "Modifiche Non Salvate", + "gui.chestseparators.unsaved_changes_desc": "Hai modifiche non salvate in questo filtro.", + "gui.chestseparators.new_detected": "Nuovi rilevati: %s", + "gui.chestseparators.allowing_all": "Consentendo tutti: %s", + "gui.chestseparators.clearing": "Svuotamento: %s", + "gui.chestseparators.allowed": "Consentiti: %s", + "gui.chestseparators.blocked": "Bloccati: %s", + "gui.chestseparators.edit_filter_rules": "Modifica Regole Filtro", + "message.chestseparators.no_valid_groups": "Nessun gruppo valido.", + "button.chestseparators.eyedropper": "Contagocce", + "tooltip.chestseparators.desc.eyedropper": "Scegli un colore direttamente dallo schermo", + "button.chestseparators.exit": "Esci", + "tooltip.chestseparators.desc.exit": "Salva le modifiche e chiudi il selettore di colori", + "gui.chestseparators.hex": "Hex", + "gui.chestseparators.color_r": "R", + "gui.chestseparators.color_g": "G", + "gui.chestseparators.color_b": "B", + "gui.chestseparators.color_picker.instructions": "Clic centrale per copiare. Clic sinistro su uno slot per incollare.", + "window.chestseparators.edit_color": "Modifica Colore Personalizzato", + "message.chestseparators.edit_buttons_visible": "Pulsanti Modifica: Visibili", + "message.chestseparators.edit_buttons_hidden": "Pulsanti Modifica: Nascosti", + "message.chestseparators.preview_panel_visible": "Pannello Anteprima: Visibile", + "message.chestseparators.preview_panel_hidden": "Pannello Anteprima: Nascosto", + "modmenu.descriptionTranslation.chestseparators": "Svuota rapidamente l'inventario con il deposito automatico personalizzato. Il gioco finalmente sa esattamente cosa vuoi e dove lo vuoi.", + "config.chestseparators.category.client": "Client / Grafica", + "config.chestseparators.show_left_panel": "Mostra Pannello Sinistro", + "config.chestseparators.show_left_panel.tooltip": "Mostra l'anteprima della whitelist. Tieni premuto il tasto modificatore per forzarlo.", + "config.chestseparators.enable_preview_animation": "Abilita Animazione Anteprima", + "config.chestseparators.enable_preview_animation.tooltip": "Scorre automaticamente la lista degli oggetti nel pannello di anteprima.", + "config.chestseparators.show_edit_buttons": "Mostra Pulsanti Editor", + "config.chestseparators.show_edit_buttons.tooltip": "Mostra i pulsanti degli strumenti all'interno del baule.", + "config.chestseparators.bg_transparency": "Trasparenza Sfondo", + "config.chestseparators.bg_transparency.tooltip": "Livello di opacità per lo sfondo degli slot (0 = Invisibile, 100 = Solido).", + "config.chestseparators.line_transparency": "Trasparenza Linee", + "config.chestseparators.line_transparency.tooltip": "Livello di opacità per le linee di separazione (0 = Invisibile, 100 = Solido).", + "config.chestseparators.default_rule_manual": "Regola Predefinita: Manuale", + "config.chestseparators.default_rule_manual.tooltip": "I nuovi gruppi consentiranno i clic manuali per impostazione predefinita.", + "config.chestseparators.default_rule_shift": "Regola Predefinita: Maiusc", + "config.chestseparators.default_rule_shift.tooltip": "I nuovi gruppi consentiranno i clic con Maiusc per impostazione predefinita.", + "config.chestseparators.default_rule_hopper": "Regola Predefinita: Tramoggia", + "config.chestseparators.default_rule_hopper.tooltip": "I nuovi gruppi consentiranno l'inserimento tramite tramoggia per impostazione predefinita.", + "config.chestseparators.default_rule_pickup": "Regola Predefinita: Raccogli", + "config.chestseparators.default_rule_pickup.tooltip": "I nuovi gruppi dell'inventario filtreranno gli oggetti raccolti da terra per impostazione predefinita.", + "config.chestseparators.category.server": "Server / Meccaniche", + "config.chestseparators.expel_invalid_items": "Espelli Oggetti Non Validi", + "config.chestseparators.expel_invalid_items.tooltip": "Quando applichi un nuovo filtro, gli oggetti non validi verranno spostati nell'inventario o gettati.", + "config.chestseparators.category.hotkeys": "Scorciatoie", + "config.chestseparators.toggle_preview_panel": "Attiva/Disattiva Pannello Anteprima", + "config.chestseparators.toggle_preview_panel.tooltip": "Mostra/nasconde rapidamente il pannello sinistro.", + "config.chestseparators.show_panel_modifier": "Modificatore Pannello", + "config.chestseparators.show_panel_modifier.tooltip": "Tieni premuto per forzare la visualizzazione del pannello sinistro.", + "color.chestseparators.custom": "Colore Personalizzato %s", + "button.chestseparators.import_search": "Importa Ricerca", + "message.chestseparators.locked": "Qualcun altro sta già modificando questo baule!", + "gui.chestseparators.expel_items_title": "Espellere gli oggetti non validi?", + "gui.chestseparators.expel_items_desc": "Alcuni oggetti attualmente in questi slot non corrispondono alle nuove regole. Saranno espulsi dal baule.", + "button.chestseparators.accept_expel": "Accetta ed Espelli", + "config.chestseparators.dark_mode": "Modalità Scura", + "config.chestseparators.dark_mode.tooltip": "Passa tra i temi chiaro e scuro dell'interfaccia.", + "config.chestseparators.show_deposit_button": "Mostra Pulsante Deposito", + "message.chestseparators.deposit_button_visible": "Pulsante Deposito: Visibile", + "message.chestseparators.deposit_button_hidden": "Pulsante Deposito: Nascosto", + "key.chestseparators.toggle_magnifier": "Attiva/disattiva lente", + "key.chestseparators.toggle_edit_buttons": "Attiva/disattiva barra strumenti", + "config.chestseparators.toggle_edit_buttons": "Attiva/disattiva barra strumenti", + "config.chestseparators.toggle_edit_buttons.tooltip": "Mostra o nasconde l'intera barra strumenti superiore in una volta.", + "config.chestseparators.toggle_magnifier": "Attiva/disattiva lente", + "config.chestseparators.magnifier_enabled": "Mostra lente", + "config.chestseparators.magnifier_enabled.tooltip": "Mostra una lente d'ingrandimento sul cursore mentre dipingi i separatori o usi il contagocce.", + "config.chestseparators.magnifier_shape": "Forma della lente", + "config.chestseparators.magnifier_shape.tooltip": "Se la lente è rotonda o quadrata.", + "config.chestseparators.magnifier_shape.circle": "Cerchio", + "config.chestseparators.magnifier_shape.square": "Quadrato", + "config.chestseparators.magnifier_tab_lines": "Lente: Linee", + "config.chestseparators.magnifier_tab_backgrounds": "Lente: Sfondi", + "config.chestseparators.magnifier_tab_combo": "Lente: Modalità Combinata", + "message.chestseparators.magnifier_on": "Lente: Attiva", + "message.chestseparators.magnifier_off": "Lente: Disattivata", + "message.chestseparators.magnifier_hint": "Consiglio: premi %s per una lente d'ingrandimento", + "message.chestseparators.tag_hint": "Consiglio: clic centrale su un oggetto per vedere i suoi tag", + "message.chestseparators.magnifier_hint_off": "Consiglio: premi %s per rimuovere la lente", + "config.chestseparators.show_deposit_button.tooltip": "Mostra o nasconde il pulsante di deposito rapido nell'interfaccia della cassa.", + "tooltip.chestseparators.deposit_items": "Deposita nei Filtri\n§8[Shift + Clic] Deposita nei Filtri e Slot Vuoti", + "message.chestseparators.deposited": "Depositati %s oggetti.", + "message.chestseparators.deposit_failed": "Nessuno slot valido trovato per depositare oggetti.", + "config.chestseparators.close_on_click_outside": "Chiudi al clic esterno", + "config.chestseparators.close_on_click_outside.tooltip": "Chiude il menu quando si fa clic all'esterno dell'interfaccia.", + "config.chestseparators.shared_custom_colors": "Colori Personalizzati Condivisi", + "config.chestseparators.shared_custom_colors.tooltip": "Se attivo, la colonna dei colori personalizzati è condivisa tra le schede Linee, Sfondi e Combo. Se disattivo, ogni scheda ha i propri.", + "title.chestseparators.config": "Configurazione di Absolute Order", + "category.chestseparators.keys": "Absolute Order", + "key.category.chestseparators.keys": "Absolute Order", + "config.chestseparators.auto_deposit_enabled": "Deposito automatico nei bauli vicini", + "config.chestseparators.auto_deposit_enabled.tooltip": "Ordina tutto l'inventario nei bauli filtrati vicini con un solo comando.", + "config.chestseparators.auto_deposit_double_sneak": "Attivazione: doppio accovacciamento", + "config.chestseparators.auto_deposit_double_sneak.tooltip": "Premi due volte rapidamente il tasto accovacciati per depositare automaticamente.", + "config.chestseparators.auto_deposit_radius": "Raggio del deposito automatico", + "config.chestseparators.auto_deposit_radius.tooltip": "Distanza attorno a te (in blocchi) entro cui cercare i bauli.", + "config.chestseparators.auto_deposit_through_walls": "Deposita attraverso i muri", + "config.chestseparators.auto_deposit_through_walls.tooltip": "Consente di depositare nei bauli bloccati da blocchi solidi. Se disattivato, il percorso deve essere libero.", + "config.chestseparators.auto_deposit": "Deposito automatico", + "key.chestseparators.auto_deposit": "Deposito automatico nei bauli vicini", + "message.chestseparators.auto_deposit_done": "Depositati automaticamente %s oggetti.", + "message.chestseparators.auto_deposit_none": "Nessun baule filtrato vicino a portata.", + "message.chestseparators.auto_grab_done": "Raccolti %s oggetti.", + "message.chestseparators.auto_grab_none": "Niente da raccogliere vicino.", + "message.chestseparators.preset_loaded": "Preset %s caricato.", + "message.chestseparators.preset_saved": "Preset %s salvato.", + "message.chestseparators.preset_empty": "Il preset %s è vuoto.", + "config.chestseparators.auto_deposit_animation": "Animazione di deposito", + "config.chestseparators.auto_deposit_animation.tooltip": "Mostra gli oggetti 3D che volano verso ogni baule. Se disattivata, gli oggetti vengono depositati all'istante senza animazione.", + "config.chestseparators.auto_deposit_trail": "Effetto scia", + "config.chestseparators.auto_deposit_trail.tooltip": "Lascia una scia di particelle dietro ogni oggetto in volo. Si applica solo se l'animazione è attiva.", + "button.chestseparators.pickup_insert": "Raccogli", + "tooltip.chestseparators.rule.pickup_active": "Attivo: filtra gli oggetti raccolti da terra", + "tooltip.chestseparators.rule.pickup_inactive": "Inattivo: gli oggetti raccolti ignorano il filtro", + "tooltip.chestseparators.edit_inventory_toggle": "Modifica inventario / baule", + "message.chestseparators.editing_inventory": "Modifica: inventario", + "message.chestseparators.editing_chest": "Modifica: baule", + "message.chestseparators.preset_deleted": "Preset %s eliminato.", + "gui.chestseparators.preset_overwrite_title": "Sovrascrivere il preset %s?", + "gui.chestseparators.preset_overwrite_body": "Il preset salvato andrà perso.", + "gui.chestseparators.preset_page": "Pagina %s/%s", + "gui.chestseparators.preview_delete": "Sarà eliminato", + "key.chestseparators.push": "Invia ai filtri del baule", + "config.chestseparators.push": "Invia ai filtri del baule", + "config.chestseparators.push.tooltip": "Invia gli oggetti corrispondenti ai filtri del baule aperto.\n§8Tieni premuto [Shift] per riempire anche gli slot vuoti", + "key.chestseparators.pull": "Preleva ai filtri dell'inventario", + "config.chestseparators.pull": "Preleva ai filtri dell'inventario", + "config.chestseparators.pull.tooltip": "Preleva gli oggetti del baule nei filtri del tuo inventario.\n§8Tieni premuto [Shift] per prelevare anche oggetti non filtrati", + "config.chestseparators.lock_hotbar_on_reorder": "Blocca la barra rapida durante l'ordinamento", + "config.chestseparators.lock_hotbar_on_reorder.tooltip": "Quando un push o pull riordina il tuo inventario, la barra rapida resta intatta.", + "config.chestseparators.lock_hotbar_on_reorder.tooltip2": "Protegge un oggetto che tieni in mano. Off: anche la barra rapida viene ordinata.", + "message.chestseparators.push_no_filters": "Questo baule non ha ancora filtri.", + "message.chestseparators.push_no_slot": "Nessuno slot filtro libero.", + "message.chestseparators.pull_no_filters": "Il tuo inventario non ha ancora filtri.", + "message.chestseparators.pull_no_match": "Niente qui corrisponde ai tuoi filtri." +} diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/lang/ja_jp.json b/multiloader-26.3/common/src/main/resources/assets/chestseparators/lang/ja_jp.json new file mode 100644 index 0000000..76c0de6 --- /dev/null +++ b/multiloader-26.3/common/src/main/resources/assets/chestseparators/lang/ja_jp.json @@ -0,0 +1,257 @@ +{ + "tooltip.chestseparators.edit_mode": "レイアウトを編集", + "tooltip.chestseparators.whitelist_mode": "フィルターを管理", + "itemGroup.chestseparators.chest_and_inventory": "チェストとインベントリ", + "gui.chestseparators.search": "検索", + "button.chestseparators.copy_layout": "レイアウトをコピー", + "message.chestseparators.layout_copied": "レイアウトをコピーしました!", + "tooltip.chestseparators.desc.copy_layout": "現在のレイアウトをクリップボードにコピーします", + "button.chestseparators.paste_layout": "レイアウトを貼り付け", + "message.chestseparators.layout_pasted": "レイアウトを貼り付けました!", + "tooltip.chestseparators.desc.paste_layout": "クリップボードからコピーしたレイアウトを貼り付けます", + "button.chestseparators.undo_action": "元に戻す", + "tooltip.chestseparators.desc.undo_action": "最後に描画したアクションを元に戻します", + "button.chestseparators.redo_action": "やり直す", + "tooltip.chestseparators.desc.redo_action": "元に戻したアクションをやり直します", + "tooltip.chestseparators.draw_area": "エリアを描画", + "tooltip.chestseparators.erase_area": "エリアを消去", + "tooltip.chestseparators.clear_lines": "ラインをクリア", + "tooltip.chestseparators.clear_backgrounds": "背景をクリア", + "tooltip.chestseparators.clear_both": "両方をクリア", + "message.chestseparators.cleared": "クリアしました", + "tooltip.chestseparators.draw_trace": "なぞって描画", + "tooltip.chestseparators.erase_trace": "なぞって消去", + "tooltip.chestseparators.open_palette": "パレットを開く", + "message.chestseparators.color_copied": "色をコピーしました!", + "message.chestseparators.color_pasted": "色を貼り付けました!", + "tooltip.chestseparators.tab_lines": "ライン", + "tooltip.chestseparators.tab_backgrounds": "背景", + "tooltip.chestseparators.tab_combo": "コンボモード", + "button.chestseparators.edit_filter": "フィルターを編集", + "tooltip.chestseparators.desc.edit_filter": "選択したスロットのフィルターを作成または編集します", + "button.chestseparators.delete_all_filters": "すべてのフィルターを削除", + "tooltip.chestseparators.desc.delete_all_filters": "このチェスト内のすべてのフィルターを削除します", + "message.chestseparators.all_filters_deleted": "すべてのフィルターを削除しました!", + "message.chestseparators.select_first": "最初に少なくとも1つのスロットを選択してください。", + "button.chestseparators.area_select": "エリア選択", + "tooltip.chestseparators.desc.area_select": "長方形の領域をドラッグしてスロットを選択します", + "button.chestseparators.trace_select": "トレース選択", + "tooltip.chestseparators.desc.trace_select": "なぞってスロットを選択します", + "button.chestseparators.clear_selection": "選択をクリア", + "tooltip.chestseparators.desc.clear_selection": "現在選択されているすべてのスロットをクリアします", + "button.chestseparators.copy_filters": "フィルターをコピー", + "message.chestseparators.filters_copied": "フィルターをコピーしました!", + "tooltip.chestseparators.desc.copy_filters": "このチェストからすべてのフィルターをクリップボードにコピーします", + "button.chestseparators.paste_filters": "フィルターを貼り付け", + "message.chestseparators.filters_pasted": "フィルターを貼り付けました!", + "message.chestseparators.undone": "元に戻す: %s", + "message.chestseparators.redone": "やり直し: %s", + "message.chestseparators.action.layout": "レイアウト", + "message.chestseparators.action.filter": "フィルター", + "tooltip.chestseparators.desc.paste_filters": "クリップボードからこのチェストにフィルターを貼り付けます", + "button.chestseparators.undo": "元に戻す", + "tooltip.chestseparators.desc.undo": "最後のフィルター操作を元に戻します", + "button.chestseparators.redo": "やり直す", + "button.chestseparators.fill_inventory": "インベントリを補充", + "button.chestseparators.preset_load": "読込", + "button.chestseparators.preset_save": "保存", + "tooltip.chestseparators.desc.redo": "前に取り消した操作をやり直します", + "tooltip.chestseparators.desc.fill_inventory": "フィルターされたアイテムをここに引き出す(目標まで)", + "tooltip.chestseparators.push_to_chest": "アイテムをチェストへ送る\n§8[Shift]で空きスロットも対象", + "tooltip.chestseparators.push_to_chest.shift": "チェストへ + 空きスロット", + "tooltip.chestseparators.pull_from_chest": "チェストからアイテムを取り出す\n§8[Shift]で未フィルターも取り出す", + "tooltip.chestseparators.desc.presets": "インベントリプリセット: レイアウトとフィルターを保存・読込", + "tooltip.chestseparators.desc.chest_presets": "チェストプリセット: チェストのレイアウトとフィルターを保存・読込", + "button.chestseparators.conflict.overwrite": "既存のフィルターを上書きする", + "tooltip.chestseparators.desc.conflict.overwrite": "選択範囲内の既存のフィルターを削除し、新しいフィルターを作成します", + "button.chestseparators.conflict.deselect": "競合の選択を解除して続行", + "message.chestseparators.empty_selection": "選択が空です。", + "tooltip.chestseparators.desc.conflict.deselect": "既存のフィルターはそのままにして、空のスロットにのみ適用します", + "button.chestseparators.cancel": "キャンセル", + "tooltip.chestseparators.desc.conflict.cancel": "フィルターの作成を中止します", + "button.chestseparators.confirm": "確認", + "gui.chestseparators.conflict_title": "選択の競合!", + "gui.chestseparators.presets_title": "インベントリプリセット", + "gui.chestseparators.chest_presets_title": "チェストプリセット", + "gui.chestseparators.preview_layout": "レイアウト", + "gui.chestseparators.preview_filters": "フィルター", + "gui.chestseparators.preset_slot": "プリセット %s", + "gui.chestseparators.preset.building": "建築", + "gui.chestseparators.preset.mining": "採掘", + "gui.chestseparators.preset.food": "食料と農業", + "gui.chestseparators.preset.redstone": "レッドストーン", + "gui.chestseparators.preset.combat": "戦闘", + "gui.chestseparators.preset.inv_miner": "採掘者", + "gui.chestseparators.preset.inv_builder": "建築家", + "gui.chestseparators.preset.inv_explorer": "探検家", + "gui.chestseparators.preset.inv_farmer": "農家", + "gui.chestseparators.preset.inv_nether_end": "ネザーとエンド", + "gui.chestseparators.conflict_desc": "選択したスロットの一部にはすでにフィルターがあります。", + "gui.chestseparators.group_filter": "グループフィルター", + "gui.chestseparators.no_filter": "フィルターなし", + "gui.chestseparators.items_count": "アイテム: %s", + "gui.chestseparators.hover_group": "グループにカーソルを合わせる...", + "gui.chestseparators.empty_whitelist": "ホワイトリストが空です。", + "button.chestseparators.save_and_exit": "保存して終了", + "button.chestseparators.discard_changes": "変更を破棄", + "button.chestseparators.import_extracted": "抽出アイテムをインポート", + "message.chestseparators.items_already_in_filter": "アイテムはすでにフィルターにあります。", + "message.chestseparators.no_new_items_found": "新しいアイテムは見つかりませんでした。", + "tooltip.chestseparators.desc.import_extracted": "選択したスロットにあるアイテムをフィルターに追加します。", + "tooltip.chestseparators.desc.import_search": "検索をインポート", + "button.chestseparators.allow_all": "すべて許可", + "tooltip.chestseparators.desc.allow_all": "すべてのアイテムをホワイトリストに登録します", + "button.chestseparators.clear_all": "すべてクリア", + "tooltip.chestseparators.desc.clear_all": "現在のホワイトリストをクリアします", + "button.chestseparators.manual_insert": "手動挿入", + "tooltip.chestseparators.rule.manual_active": "有効: 手動クリックをフィルタリング", + "tooltip.chestseparators.rule.manual_inactive": "無効: 手動クリックはフィルターを無視", + "button.chestseparators.shift_insert": "Shift挿入", + "tooltip.chestseparators.rule.shift_active": "有効: Shiftクリックをフィルタリング", + "tooltip.chestseparators.rule.shift_inactive": "無効: Shiftクリックはフィルターを無視", + "button.chestseparators.hopper_insert": "ホッパー挿入", + "tooltip.chestseparators.rule.hopper_active": "有効: ホッパーの移動をフィルタリング", + "tooltip.chestseparators.rule.hopper_inactive": "無効: ホッパーはフィルターを無視", + "button.chestseparators.delete": "削除", + "tooltip.chestseparators.desc.delete_group": "このフィルターグループを削除します", + "button.chestseparators.save": "保存", + "tooltip.chestseparators.desc.save": "変更を保存します", + "tooltip.chestseparators.desc.cancel": "変更を破棄します", + "gui.chestseparators.unsaved_changes_title": "未保存の変更", + "gui.chestseparators.unsaved_changes_desc": "このフィルターには未保存の変更があります。", + "gui.chestseparators.new_detected": "新規検出: %s", + "gui.chestseparators.allowing_all": "すべて許可: %s", + "gui.chestseparators.clearing": "クリア: %s", + "gui.chestseparators.allowed": "許可: %s", + "gui.chestseparators.blocked": "ブロック: %s", + "gui.chestseparators.edit_filter_rules": "フィルタールールの編集", + "message.chestseparators.no_valid_groups": "有効なグループがありません。", + "button.chestseparators.eyedropper": "スポイト", + "tooltip.chestseparators.desc.eyedropper": "画面から直接色を取得します", + "button.chestseparators.exit": "終了", + "tooltip.chestseparators.desc.exit": "変更を保存してカラーピッカーを閉じます", + "gui.chestseparators.hex": "Hex", + "gui.chestseparators.color_r": "R", + "gui.chestseparators.color_g": "G", + "gui.chestseparators.color_b": "B", + "gui.chestseparators.color_picker.instructions": "中クリックでコピー。スロットを左クリックで貼り付け。", + "window.chestseparators.edit_color": "カスタムカラーを編集", + "message.chestseparators.edit_buttons_visible": "編集ボタン: 表示", + "message.chestseparators.edit_buttons_hidden": "編集ボタン: 非表示", + "message.chestseparators.preview_panel_visible": "プレビューパネル: 表示", + "message.chestseparators.preview_panel_hidden": "プレビューパネル: 非表示", + "modmenu.descriptionTranslation.chestseparators": "カスタム自動預け入れでインベントリを素早く整理。ゲームがようやく、あなたが本当に欲しいものと、それをどこに置きたいかを正確に理解します。", + "config.chestseparators.category.client": "クライアント / 表示", + "config.chestseparators.show_left_panel": "左パネルを表示", + "config.chestseparators.show_left_panel.tooltip": "ホワイトリストのプレビューパネルを表示します。修飾キーを長押しで強制表示します。", + "config.chestseparators.enable_preview_animation": "プレビューアニメーションを有効化", + "config.chestseparators.enable_preview_animation.tooltip": "プレビューパネルのアイテムリストを自動的にスクロールします。", + "config.chestseparators.show_edit_buttons": "エディターボタンを表示", + "config.chestseparators.show_edit_buttons.tooltip": "チェスト内にツールボタンを表示します。", + "config.chestseparators.bg_transparency": "背景の透明度", + "config.chestseparators.bg_transparency.tooltip": "スロットの背景色の不透明度(0 = 透明、100 = 不透明)。", + "config.chestseparators.line_transparency": "ラインの透明度", + "config.chestseparators.line_transparency.tooltip": "区切り線の不透明度(0 = 透明、100 = 不透明)。", + "config.chestseparators.default_rule_manual": "デフォルトルール: 手動", + "config.chestseparators.default_rule_manual.tooltip": "新しいグループはデフォルトで手動クリックを許可します。", + "config.chestseparators.default_rule_shift": "デフォルトルール: Shift", + "config.chestseparators.default_rule_shift.tooltip": "新しいグループはデフォルトでShiftクリックを許可します。", + "config.chestseparators.default_rule_hopper": "デフォルトルール: ホッパー", + "config.chestseparators.default_rule_hopper.tooltip": "新しいグループはデフォルトでホッパーの搬入を許可します。", + "config.chestseparators.default_rule_pickup": "デフォルトルール: 拾う", + "config.chestseparators.default_rule_pickup.tooltip": "新しいインベントリグループはデフォルトで拾ったアイテムをフィルタリングします。", + "config.chestseparators.category.server": "サーバー / システム", + "config.chestseparators.expel_invalid_items": "無効なアイテムを排出", + "config.chestseparators.expel_invalid_items.tooltip": "新しいフィルターを適用した時、無効なアイテムはインベントリに移動されるかドロップされます。", + "config.chestseparators.category.hotkeys": "ホットキー", + "config.chestseparators.toggle_preview_panel": "プレビューパネルの切り替え", + "config.chestseparators.toggle_preview_panel.tooltip": "左側のプレビューパネルの表示/非表示をすばやく切り替えます。", + "config.chestseparators.show_panel_modifier": "パネル表示修飾キー", + "config.chestseparators.show_panel_modifier.tooltip": "無効になっている場合、このキーを長押しすると左パネルが強制的に表示されます。", + "color.chestseparators.custom": "カスタムカラー %s", + "button.chestseparators.import_search": "検索をインポート", + "message.chestseparators.locked": "他の誰かがすでにこのチェストを編集しています!", + "gui.chestseparators.expel_items_title": "無効なアイテムを排出しますか?", + "gui.chestseparators.expel_items_desc": "現在これらのスロットにある一部のアイテムは、新しいルールと一致しません。チェストから排出されます。", + "button.chestseparators.accept_expel": "承認して排出", + "config.chestseparators.dark_mode": "ダークモード", + "config.chestseparators.dark_mode.tooltip": "UIのテーマをダークとライトで切り替えます。", + "config.chestseparators.show_deposit_button": "預けるボタンを表示", + "message.chestseparators.deposit_button_visible": "預けるボタン: 表示", + "message.chestseparators.deposit_button_hidden": "預けるボタン: 非表示", + "key.chestseparators.toggle_magnifier": "拡大鏡の切り替え", + "key.chestseparators.toggle_edit_buttons": "ツールバーの切り替え", + "config.chestseparators.toggle_edit_buttons": "ツールバーの切り替え", + "config.chestseparators.toggle_edit_buttons.tooltip": "上部ツールバー全体を一度に表示/非表示にします。", + "config.chestseparators.toggle_magnifier": "拡大鏡の切り替え", + "config.chestseparators.magnifier_enabled": "拡大鏡を表示", + "config.chestseparators.magnifier_enabled.tooltip": "仕切りの描画やスポイト使用時にカーソルへ拡大鏡を表示します。", + "config.chestseparators.magnifier_shape": "拡大鏡の形", + "config.chestseparators.magnifier_shape.tooltip": "拡大鏡を円形にするか四角形にするか。", + "config.chestseparators.magnifier_shape.circle": "円", + "config.chestseparators.magnifier_shape.square": "四角", + "config.chestseparators.magnifier_tab_lines": "拡大鏡: ライン", + "config.chestseparators.magnifier_tab_backgrounds": "拡大鏡: 背景", + "config.chestseparators.magnifier_tab_combo": "拡大鏡: コンボモード", + "message.chestseparators.magnifier_on": "拡大鏡: オン", + "message.chestseparators.magnifier_off": "拡大鏡: オフ", + "message.chestseparators.magnifier_hint": "ヒント: %s で拡大鏡を表示", + "message.chestseparators.tag_hint": "ヒント: アイテムを中クリックするとタグを表示", + "message.chestseparators.magnifier_hint_off": "ヒント: %s で拡大ルーペを消す", + "config.chestseparators.show_deposit_button.tooltip": "チェスト画面のクイック預けるボタンを表示または非表示にします。", + "tooltip.chestseparators.deposit_items": "フィルターに預ける\n§8[Shift + クリック] フィルターと空きスロットに預ける", + "message.chestseparators.deposited": "%s 個のアイテムを預けました。", + "message.chestseparators.deposit_failed": "アイテムを預ける有効なスロットが見つかりません。", + "config.chestseparators.close_on_click_outside": "画面外クリックで閉じる", + "config.chestseparators.close_on_click_outside.tooltip": "インターフェースの外側をクリックするとメニューを閉じます。", + "config.chestseparators.shared_custom_colors": "カスタムカラーを共有", + "config.chestseparators.shared_custom_colors.tooltip": "有効にすると、カスタムカラー列がライン、背景、コンボのタブ間で共有されます。無効にすると、各タブが独自の色を持ちます。", + "title.chestseparators.config": "Absolute Order の設定", + "category.chestseparators.keys": "Absolute Order", + "key.category.chestseparators.keys": "Absolute Order", + "config.chestseparators.auto_deposit_enabled": "近くのチェストへ自動収納", + "config.chestseparators.auto_deposit_enabled.tooltip": "一回の操作でインベントリ全体を近くのフィルター付きチェストに整理します。", + "config.chestseparators.auto_deposit_double_sneak": "トリガー:二回スニーク", + "config.chestseparators.auto_deposit_double_sneak.tooltip": "スニークキーを素早く二回押すと自動収納します。", + "config.chestseparators.auto_deposit_radius": "自動収納の範囲", + "config.chestseparators.auto_deposit_radius.tooltip": "周囲(ブロック単位)でチェストを探す距離。", + "config.chestseparators.auto_deposit_through_walls": "壁越しに収納", + "config.chestseparators.auto_deposit_through_walls.tooltip": "固いブロックで遮られたチェストへの収納を許可します。オフの場合は経路が通っている必要があります。", + "config.chestseparators.auto_deposit": "自動収納(キー)", + "key.chestseparators.auto_deposit": "近くのチェストへ自動収納", + "message.chestseparators.auto_deposit_done": "%s 個のアイテムを自動収納しました。", + "message.chestseparators.auto_deposit_none": "範囲内に近くのフィルター付きチェストがありません。", + "message.chestseparators.auto_grab_done": "%s 個回収しました。", + "message.chestseparators.auto_grab_none": "近くに回収する物がありません。", + "message.chestseparators.preset_loaded": "プリセット %s を読み込みました。", + "message.chestseparators.preset_saved": "プリセット %s を保存しました。", + "message.chestseparators.preset_empty": "プリセット %s は空です。", + "config.chestseparators.auto_deposit_animation": "収納アニメーション", + "config.chestseparators.auto_deposit_animation.tooltip": "各チェストへ飛んでいく3Dアイテムを表示します。オフの場合、アイテムはアニメーションなしで即座に収納されます。", + "config.chestseparators.auto_deposit_trail": "軌跡エフェクト", + "config.chestseparators.auto_deposit_trail.tooltip": "飛んでいく各アイテムの後ろにパーティクルの軌跡を残します。アニメーションがオンのときのみ有効です。", + "button.chestseparators.pickup_insert": "拾う", + "tooltip.chestseparators.rule.pickup_active": "有効:拾ったアイテムをフィルタリング", + "tooltip.chestseparators.rule.pickup_inactive": "無効:拾ったアイテムはフィルターを無視", + "tooltip.chestseparators.edit_inventory_toggle": "インベントリ/チェストを編集", + "message.chestseparators.editing_inventory": "編集中:インベントリ", + "message.chestseparators.editing_chest": "編集中:チェスト", + "message.chestseparators.preset_deleted": "プリセット %s を削除しました。", + "gui.chestseparators.preset_overwrite_title": "プリセット %s を上書きしますか?", + "gui.chestseparators.preset_overwrite_body": "保存されたプリセットは失われます。", + "gui.chestseparators.preset_page": "ページ %s/%s", + "gui.chestseparators.preview_delete": "削除されます", + "key.chestseparators.push": "チェストのフィルターへ送る", + "config.chestseparators.push": "チェストのフィルターへ送る", + "config.chestseparators.push.tooltip": "一致するアイテムを開いているチェストのフィルターへ送ります。\n§8[Shift]を押しながらで空きスロットにも入れます", + "key.chestseparators.pull": "インベントリのフィルターへ取り込む", + "config.chestseparators.pull": "インベントリのフィルターへ取り込む", + "config.chestseparators.pull.tooltip": "チェストのアイテムをインベントリのフィルターへ取り込みます。\n§8[Shift]を押しながらでフィルター外のアイテムも取り込みます", + "config.chestseparators.lock_hotbar_on_reorder": "並べ替え時にホットバーを固定", + "config.chestseparators.lock_hotbar_on_reorder.tooltip": "プッシュやプルがインベントリを並べ替えても、ホットバーはそのままです。", + "config.chestseparators.lock_hotbar_on_reorder.tooltip2": "手に持っているアイテムを保護します。オフ:ホットバーも並べ替えます。", + "message.chestseparators.push_no_filters": "このチェストにはまだフィルターがありません。", + "message.chestseparators.push_no_slot": "空きのフィルタースロットがありません。", + "message.chestseparators.pull_no_filters": "インベントリにまだフィルターがありません。", + "message.chestseparators.pull_no_match": "フィルターに合うものがここにありません。" +} diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/lang/ko_kr.json b/multiloader-26.3/common/src/main/resources/assets/chestseparators/lang/ko_kr.json new file mode 100644 index 0000000..2ac670a --- /dev/null +++ b/multiloader-26.3/common/src/main/resources/assets/chestseparators/lang/ko_kr.json @@ -0,0 +1,257 @@ +{ + "tooltip.chestseparators.edit_mode": "레이아웃 편집", + "tooltip.chestseparators.whitelist_mode": "필터 관리", + "itemGroup.chestseparators.chest_and_inventory": "상자 및 보관함", + "gui.chestseparators.search": "검색", + "button.chestseparators.copy_layout": "레이아웃 복사", + "message.chestseparators.layout_copied": "레이아웃이 복사되었습니다!", + "tooltip.chestseparators.desc.copy_layout": "현재 레이아웃을 클립보드에 복사합니다", + "button.chestseparators.paste_layout": "레이아웃 붙여넣기", + "message.chestseparators.layout_pasted": "레이아웃이 붙여넣어졌습니다!", + "tooltip.chestseparators.desc.paste_layout": "클립보드에서 복사한 레이아웃을 붙여넣습니다", + "button.chestseparators.undo_action": "실행 취소", + "tooltip.chestseparators.desc.undo_action": "마지막으로 그린 작업을 되돌립니다", + "button.chestseparators.redo_action": "다시 실행", + "tooltip.chestseparators.desc.redo_action": "이전에 취소한 작업을 복구합니다", + "tooltip.chestseparators.draw_area": "영역 그리기", + "tooltip.chestseparators.erase_area": "영역 지우기", + "tooltip.chestseparators.clear_lines": "선 지우기", + "tooltip.chestseparators.clear_backgrounds": "배경 지우기", + "tooltip.chestseparators.clear_both": "둘 다 지우기", + "message.chestseparators.cleared": "지워짐", + "tooltip.chestseparators.draw_trace": "경로 그리기", + "tooltip.chestseparators.erase_trace": "경로 지우기", + "tooltip.chestseparators.open_palette": "팔레트 열기", + "message.chestseparators.color_copied": "색상이 복사되었습니다!", + "message.chestseparators.color_pasted": "색상이 붙여넣어졌습니다!", + "tooltip.chestseparators.tab_lines": "선", + "tooltip.chestseparators.tab_backgrounds": "배경", + "tooltip.chestseparators.tab_combo": "콤보 모드", + "button.chestseparators.edit_filter": "필터 편집", + "tooltip.chestseparators.desc.edit_filter": "선택한 슬롯의 필터를 생성하거나 편집합니다", + "button.chestseparators.delete_all_filters": "모든 필터 삭제", + "tooltip.chestseparators.desc.delete_all_filters": "이 상자의 모든 필터를 삭제합니다", + "message.chestseparators.all_filters_deleted": "모든 필터가 삭제되었습니다!", + "message.chestseparators.select_first": "먼저 하나 이상의 슬롯을 선택하세요.", + "button.chestseparators.area_select": "영역 선택", + "tooltip.chestseparators.desc.area_select": "직사각형 영역을 드래그하여 슬롯을 선택합니다", + "button.chestseparators.trace_select": "경로 선택", + "tooltip.chestseparators.desc.trace_select": "칠하여 슬롯을 선택합니다", + "button.chestseparators.clear_selection": "선택 지우기", + "tooltip.chestseparators.desc.clear_selection": "현재 선택된 모든 슬롯을 지웁니다", + "button.chestseparators.copy_filters": "필터 복사", + "message.chestseparators.filters_copied": "필터가 복사되었습니다!", + "tooltip.chestseparators.desc.copy_filters": "이 상자의 모든 필터를 클립보드에 복사합니다", + "button.chestseparators.paste_filters": "필터 붙여넣기", + "message.chestseparators.filters_pasted": "필터가 붙여넣어졌습니다!", + "message.chestseparators.undone": "실행 취소: %s", + "message.chestseparators.redone": "다시 실행: %s", + "message.chestseparators.action.layout": "레이아웃", + "message.chestseparators.action.filter": "필터", + "tooltip.chestseparators.desc.paste_filters": "클립보드의 필터를 이 상자에 붙여넣습니다", + "button.chestseparators.undo": "실행 취소", + "tooltip.chestseparators.desc.undo": "마지막 필터 작업을 되돌립니다", + "button.chestseparators.redo": "다시 실행", + "button.chestseparators.fill_inventory": "인벤토리 채우기", + "button.chestseparators.preset_load": "불러오기", + "button.chestseparators.preset_save": "저장", + "tooltip.chestseparators.desc.redo": "이전에 취소한 작업을 복구합니다", + "tooltip.chestseparators.desc.fill_inventory": "필터된 아이템을 여기로 가져오기 (목표까지)", + "tooltip.chestseparators.push_to_chest": "아이템을 상자로 보내기\n§8[Shift]로 빈 칸도 포함", + "tooltip.chestseparators.push_to_chest.shift": "상자로 + 빈 칸", + "tooltip.chestseparators.pull_from_chest": "상자에서 아이템 가져오기\n§8[Shift]로 미필터 항목도 가져오기", + "tooltip.chestseparators.desc.presets": "인벤토리 프리셋: 레이아웃과 필터 저장 및 불러오기", + "tooltip.chestseparators.desc.chest_presets": "상자 프리셋: 상자 레이아웃과 필터 저장 및 불러오기", + "button.chestseparators.conflict.overwrite": "기존 필터 덮어쓰기", + "tooltip.chestseparators.desc.conflict.overwrite": "선택 영역의 기존 필터를 삭제하고 새 필터를 만듭니다", + "button.chestseparators.conflict.deselect": "충돌 선택 해제 및 계속", + "message.chestseparators.empty_selection": "선택 영역이 비어 있습니다.", + "tooltip.chestseparators.desc.conflict.deselect": "기존 필터를 그대로 유지하고 빈 슬롯에만 적용합니다", + "button.chestseparators.cancel": "취소", + "tooltip.chestseparators.desc.conflict.cancel": "필터 생성 중단", + "button.chestseparators.confirm": "확인", + "gui.chestseparators.conflict_title": "선택 충돌!", + "gui.chestseparators.presets_title": "인벤토리 프리셋", + "gui.chestseparators.chest_presets_title": "상자 프리셋", + "gui.chestseparators.preview_layout": "레이아웃", + "gui.chestseparators.preview_filters": "필터", + "gui.chestseparators.preset_slot": "프리셋 %s", + "gui.chestseparators.preset.building": "건축", + "gui.chestseparators.preset.mining": "채굴", + "gui.chestseparators.preset.food": "음식과 농사", + "gui.chestseparators.preset.redstone": "레드스톤", + "gui.chestseparators.preset.combat": "전투", + "gui.chestseparators.preset.inv_miner": "광부", + "gui.chestseparators.preset.inv_builder": "건축가", + "gui.chestseparators.preset.inv_explorer": "탐험가", + "gui.chestseparators.preset.inv_farmer": "농부", + "gui.chestseparators.preset.inv_nether_end": "네더와 엔드", + "gui.chestseparators.conflict_desc": "선택한 일부 슬롯에 이미 필터가 있습니다.", + "gui.chestseparators.group_filter": "그룹 필터", + "gui.chestseparators.no_filter": "필터 없음", + "gui.chestseparators.items_count": "아이템: %s", + "gui.chestseparators.hover_group": "그룹에 마우스를 올리세요...", + "gui.chestseparators.empty_whitelist": "화이트리스트가 비어 있습니다.", + "button.chestseparators.save_and_exit": "저장 후 나가기", + "button.chestseparators.discard_changes": "변경 사항 무시", + "button.chestseparators.import_extracted": "추출된 아이템 가져오기", + "message.chestseparators.items_already_in_filter": "아이템이 이미 필터에 있습니다.", + "message.chestseparators.no_new_items_found": "새로운 아이템을 찾을 수 없습니다.", + "tooltip.chestseparators.desc.import_extracted": "선택한 슬롯에 있는 아이템을 필터에 추가합니다.", + "tooltip.chestseparators.desc.import_search": "검색 가져오기", + "button.chestseparators.allow_all": "모두 허용", + "tooltip.chestseparators.desc.allow_all": "모든 게임 아이템을 화이트리스트에 추가합니다", + "button.chestseparators.clear_all": "모두 지우기", + "tooltip.chestseparators.desc.clear_all": "현재 화이트리스트를 지웁니다", + "button.chestseparators.manual_insert": "수동 삽입", + "tooltip.chestseparators.rule.manual_active": "활성: 수동 클릭 필터링", + "tooltip.chestseparators.rule.manual_inactive": "비활성: 수동 클릭시 필터 무시", + "button.chestseparators.shift_insert": "Shift 삽입", + "tooltip.chestseparators.rule.shift_active": "활성: Shift 클릭 필터링", + "tooltip.chestseparators.rule.shift_inactive": "비활성: Shift 클릭시 필터 무시", + "button.chestseparators.hopper_insert": "깔때기 삽입", + "tooltip.chestseparators.rule.hopper_active": "활성: 깔때기 이동 필터링", + "tooltip.chestseparators.rule.hopper_inactive": "비활성: 깔때기는 필터를 무시", + "button.chestseparators.delete": "삭제", + "tooltip.chestseparators.desc.delete_group": "이 필터 그룹을 삭제합니다", + "button.chestseparators.save": "저장", + "tooltip.chestseparators.desc.save": "변경 사항을 저장합니다", + "tooltip.chestseparators.desc.cancel": "변경 사항을 무시합니다", + "gui.chestseparators.unsaved_changes_title": "저장되지 않은 변경 사항", + "gui.chestseparators.unsaved_changes_desc": "이 필터에 저장되지 않은 변경 사항이 있습니다.", + "gui.chestseparators.new_detected": "새로 감지됨: %s", + "gui.chestseparators.allowing_all": "모두 허용 중: %s", + "gui.chestseparators.clearing": "지우는 중: %s", + "gui.chestseparators.allowed": "허용됨: %s", + "gui.chestseparators.blocked": "차단됨: %s", + "gui.chestseparators.edit_filter_rules": "필터 규칙 편집", + "message.chestseparators.no_valid_groups": "유효한 그룹이 없습니다.", + "color.chestseparators.custom": "사용자 지정 색상 %s", + "button.chestseparators.eyedropper": "스포이트", + "tooltip.chestseparators.desc.eyedropper": "화면에서 직접 색상 선택", + "button.chestseparators.exit": "종료", + "tooltip.chestseparators.desc.exit": "변경 사항을 저장하고 색상 선택기를 닫습니다", + "gui.chestseparators.hex": "Hex", + "gui.chestseparators.color_r": "R", + "gui.chestseparators.color_g": "G", + "gui.chestseparators.color_b": "B", + "gui.chestseparators.color_picker.instructions": "마우스 휠 클릭으로 복사. 사용자 지정 슬롯을 좌클릭하여 붙여넣기.", + "window.chestseparators.edit_color": "사용자 지정 색상 편집", + "message.chestseparators.edit_buttons_visible": "편집 버튼: 표시", + "message.chestseparators.edit_buttons_hidden": "편집 버튼: 숨김", + "message.chestseparators.preview_panel_visible": "미리보기 패널: 표시", + "message.chestseparators.preview_panel_hidden": "미리보기 패널: 숨김", + "modmenu.descriptionTranslation.chestseparators": "사용자 지정 자동 보관으로 인벤토리를 빠르게 비우세요. 게임이 마침내 당신이 진정으로 원하는 것과 원하는 위치를 정확히 알아냅니다.", + "config.chestseparators.category.client": "클라이언트 / 시각 요소", + "config.chestseparators.show_left_panel": "왼쪽 패널 표시", + "config.chestseparators.show_left_panel.tooltip": "기본 상자 UI에 화이트리스트 미리보기 패널을 표시합니다. 수정자 키를 길게 눌러 무시할 수 있습니다.", + "config.chestseparators.enable_preview_animation": "미리보기 애니메이션 활성화", + "config.chestseparators.enable_preview_animation.tooltip": "미리보기 패널에서 아이템 목록을 자동으로 스크롤합니다.", + "config.chestseparators.show_edit_buttons": "에디터 버튼 표시", + "config.chestseparators.show_edit_buttons.tooltip": "상자 GUI 내부에 도구 버튼을 표시합니다.", + "config.chestseparators.bg_transparency": "배경 투명도", + "config.chestseparators.bg_transparency.tooltip": "슬롯 배경색의 불투명도 수준 (0 = 투명, 100 = 불투명).", + "config.chestseparators.line_transparency": "선 투명도", + "config.chestseparators.line_transparency.tooltip": "구분선의 불투명도 수준 (0 = 투명, 100 = 불투명).", + "config.chestseparators.default_rule_manual": "기본 규칙: 수동", + "config.chestseparators.default_rule_manual.tooltip": "새로 생성된 그룹은 기본적으로 수동 클릭을 허용합니다.", + "config.chestseparators.default_rule_shift": "기본 규칙: Shift", + "config.chestseparators.default_rule_shift.tooltip": "새로 생성된 그룹은 기본적으로 Shift 클릭을 허용합니다.", + "config.chestseparators.default_rule_hopper": "기본 규칙: 깔때기", + "config.chestseparators.default_rule_hopper.tooltip": "새로 생성된 그룹은 기본적으로 깔때기 삽입을 허용합니다.", + "config.chestseparators.default_rule_pickup": "기본 규칙: 줍기", + "config.chestseparators.default_rule_pickup.tooltip": "새로 생성된 인벤토리 그룹은 기본적으로 주운 아이템을 필터링합니다.", + "config.chestseparators.category.server": "서버 / 메커니즘", + "config.chestseparators.expel_invalid_items": "유효하지 않은 아이템 배출", + "config.chestseparators.expel_invalid_items.tooltip": "새 필터를 적용할 때 기존의 유효하지 않은 아이템은 플레이어의 인벤토리로 밀려나거나 버려집니다.", + "config.chestseparators.category.hotkeys": "단축키", + "config.chestseparators.toggle_preview_panel": "미리보기 패널 전환", + "config.chestseparators.toggle_preview_panel.tooltip": "왼쪽 미리보기 패널을 빠르게 표시하거나 숨깁니다.", + "config.chestseparators.show_panel_modifier": "패널 표시 수정자", + "config.chestseparators.show_panel_modifier.tooltip": "비활성화된 경우 이 키를 길게 눌러 왼쪽 패널을 강제로 표시합니다.", + "button.chestseparators.import_search": "검색 가져오기", + "message.chestseparators.locked": "다른 사람이 이미 이 상자를 편집하고 있습니다!", + "gui.chestseparators.expel_items_title": "잘못된 아이템을 배출하시겠습니까?", + "gui.chestseparators.expel_items_desc": "현재 이 슬롯에 있는 일부 아이템이 새 규칙과 일치하지 않습니다. 상자에서 배출됩니다.", + "button.chestseparators.accept_expel": "수락 및 배출", + "config.chestseparators.dark_mode": "다크 모드", + "config.chestseparators.dark_mode.tooltip": "어두운 UI 테마와 밝은 UI 테마를 전환합니다.", + "config.chestseparators.show_deposit_button": "보관 버튼 표시", + "message.chestseparators.deposit_button_visible": "보관 버튼: 표시", + "message.chestseparators.deposit_button_hidden": "보관 버튼: 숨김", + "key.chestseparators.toggle_magnifier": "돋보기 전환", + "key.chestseparators.toggle_edit_buttons": "도구 모음 전환", + "config.chestseparators.toggle_edit_buttons": "도구 모음 전환", + "config.chestseparators.toggle_edit_buttons.tooltip": "상단 도구 모음 전체를 한 번에 표시하거나 숨깁니다.", + "config.chestseparators.toggle_magnifier": "돋보기 전환", + "config.chestseparators.magnifier_enabled": "돋보기 표시", + "config.chestseparators.magnifier_enabled.tooltip": "구분선을 그리거나 스포이트를 사용할 때 커서에 확대경을 표시합니다.", + "config.chestseparators.magnifier_shape": "돋보기 모양", + "config.chestseparators.magnifier_shape.tooltip": "돋보기를 원형 또는 사각형으로.", + "config.chestseparators.magnifier_shape.circle": "원", + "config.chestseparators.magnifier_shape.square": "사각형", + "config.chestseparators.magnifier_tab_lines": "돋보기: 선", + "config.chestseparators.magnifier_tab_backgrounds": "돋보기: 배경", + "config.chestseparators.magnifier_tab_combo": "돋보기: 콤보 모드", + "message.chestseparators.magnifier_on": "돋보기: 켜짐", + "message.chestseparators.magnifier_off": "돋보기: 꺼짐", + "message.chestseparators.magnifier_hint": "팁: %s 키로 확대경 표시", + "message.chestseparators.tag_hint": "팁: 아이템을 가운데 클릭하면 태그를 볼 수 있습니다", + "message.chestseparators.magnifier_hint_off": "팁: %s 키로 확대 루페 끄기", + "config.chestseparators.show_deposit_button.tooltip": "상자 인터페이스에서 빠른 보관 버튼을 표시하거나 숨깁니다.", + "tooltip.chestseparators.deposit_items": "필터에 보관\n§8[Shift + 클릭] 필터 및 빈 슬롯에 보관", + "message.chestseparators.deposited": "%s개의 아이템을 보관했습니다.", + "message.chestseparators.deposit_failed": "아이템을 보관할 유효한 슬롯을 찾을 수 없습니다.", + "config.chestseparators.close_on_click_outside": "외부 클릭 시 닫기", + "config.chestseparators.close_on_click_outside.tooltip": "인터페이스 외부를 클릭하면 메뉴가 닫힙니다.", + "config.chestseparators.shared_custom_colors": "사용자 지정 색상 공유", + "config.chestseparators.shared_custom_colors.tooltip": "활성화하면 사용자 지정 색상 열이 선, 배경, 콤보 탭에서 공유됩니다. 비활성화하면 각 탭이 자체 색상을 가집니다.", + "title.chestseparators.config": "Absolute Order 설정", + "category.chestseparators.keys": "Absolute Order", + "key.category.chestseparators.keys": "Absolute Order", + "config.chestseparators.auto_deposit_enabled": "근처 상자에 자동 보관", + "config.chestseparators.auto_deposit_enabled.tooltip": "한 번의 동작으로 인벤토리 전체를 근처 필터 상자에 정리합니다.", + "config.chestseparators.auto_deposit_double_sneak": "트리거: 이중 웅크리기", + "config.chestseparators.auto_deposit_double_sneak.tooltip": "웅크리기 키를 빠르게 두 번 눌러 자동 보관합니다.", + "config.chestseparators.auto_deposit_radius": "자동 보관 범위", + "config.chestseparators.auto_deposit_radius.tooltip": "주변(블록 단위)에서 상자를 검색하는 거리.", + "config.chestseparators.auto_deposit_through_walls": "벽 너머로 보관", + "config.chestseparators.auto_deposit_through_walls.tooltip": "단단한 블록으로 막힌 상자에도 보관을 허용합니다. 꺼져 있으면 경로가 뚫려 있어야 합니다.", + "config.chestseparators.auto_deposit": "자동 보관", + "key.chestseparators.auto_deposit": "근처 상자에 자동 보관", + "message.chestseparators.auto_deposit_done": "%s개 아이템을 자동 보관했습니다.", + "message.chestseparators.auto_deposit_none": "범위 내에 가까운 필터 상자가 없습니다.", + "message.chestseparators.auto_grab_done": "%s개 회수했습니다.", + "message.chestseparators.auto_grab_none": "근처에 회수할 것이 없습니다.", + "message.chestseparators.preset_loaded": "프리셋 %s 불러옴.", + "message.chestseparators.preset_saved": "프리셋 %s 저장됨.", + "message.chestseparators.preset_empty": "프리셋 %s 비어 있음.", + "config.chestseparators.auto_deposit_animation": "보관 애니메이션", + "config.chestseparators.auto_deposit_animation.tooltip": "각 상자로 날아가는 3D 아이템을 표시합니다. 꺼져 있으면 아이템이 애니메이션 없이 즉시 보관됩니다.", + "config.chestseparators.auto_deposit_trail": "잔상 효과", + "config.chestseparators.auto_deposit_trail.tooltip": "날아가는 각 아이템 뒤에 파티클 잔상을 남깁니다. 애니메이션이 켜져 있을 때만 적용됩니다.", + "button.chestseparators.pickup_insert": "줍기", + "tooltip.chestseparators.rule.pickup_active": "활성: 주운 아이템을 필터링", + "tooltip.chestseparators.rule.pickup_inactive": "비활성: 주운 아이템이 필터를 무시", + "tooltip.chestseparators.edit_inventory_toggle": "인벤토리 / 상자 편집", + "message.chestseparators.editing_inventory": "편집 중: 인벤토리", + "message.chestseparators.editing_chest": "편집 중: 상자", + "message.chestseparators.preset_deleted": "프리셋 %s 삭제됨.", + "gui.chestseparators.preset_overwrite_title": "프리셋 %s을(를) 덮어쓸까요?", + "gui.chestseparators.preset_overwrite_body": "저장된 프리셋이 사라집니다.", + "gui.chestseparators.preset_page": "페이지 %s/%s", + "gui.chestseparators.preview_delete": "삭제됩니다", + "key.chestseparators.push": "상자 필터로 보내기", + "config.chestseparators.push": "상자 필터로 보내기", + "config.chestseparators.push.tooltip": "일치하는 아이템을 열린 상자의 필터로 보냅니다.\n§8[Shift]를 누르면 빈 칸도 채웁니다", + "key.chestseparators.pull": "인벤토리 필터로 가져오기", + "config.chestseparators.pull": "인벤토리 필터로 가져오기", + "config.chestseparators.pull.tooltip": "상자의 아이템을 인벤토리 필터로 가져옵니다.\n§8[Shift]를 누르면 필터 없는 아이템도 가져옵니다", + "config.chestseparators.lock_hotbar_on_reorder": "정렬 시 단축바 잠금", + "config.chestseparators.lock_hotbar_on_reorder.tooltip": "푸시나 풀이 인벤토리를 정렬할 때 단축바는 건드리지 않습니다.", + "config.chestseparators.lock_hotbar_on_reorder.tooltip2": "들고 있는 아이템을 보호합니다. 끔: 단축바도 정렬됩니다.", + "message.chestseparators.push_no_filters": "이 상자에는 아직 필터가 없습니다.", + "message.chestseparators.push_no_slot": "빈 필터 칸이 없습니다.", + "message.chestseparators.pull_no_filters": "인벤토리에 아직 필터가 없습니다.", + "message.chestseparators.pull_no_match": "여기에 필터와 맞는 것이 없습니다." +} diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/lang/nl_nl.json b/multiloader-26.3/common/src/main/resources/assets/chestseparators/lang/nl_nl.json new file mode 100644 index 0000000..a559fa2 --- /dev/null +++ b/multiloader-26.3/common/src/main/resources/assets/chestseparators/lang/nl_nl.json @@ -0,0 +1,257 @@ +{ + "tooltip.chestseparators.edit_mode": "Lay-out bewerken", + "tooltip.chestseparators.whitelist_mode": "Filters beheren", + "itemGroup.chestseparators.chest_and_inventory": "Kist en inventaris", + "gui.chestseparators.search": "Zoeken", + "button.chestseparators.copy_layout": "Lay-out kopiëren", + "message.chestseparators.layout_copied": "Lay-out gekopieerd!", + "tooltip.chestseparators.desc.copy_layout": "Kopieert de huidige lay-out naar het klembord", + "button.chestseparators.paste_layout": "Lay-out plakken", + "message.chestseparators.layout_pasted": "Lay-out geplakt!", + "tooltip.chestseparators.desc.paste_layout": "Plakt de gekopieerde lay-out vanaf het klembord", + "button.chestseparators.undo_action": "Ongedaan maken", + "tooltip.chestseparators.desc.undo_action": "Maakt de laatst getekende actie ongedaan", + "button.chestseparators.redo_action": "Opnieuw doen", + "tooltip.chestseparators.desc.redo_action": "Herstelt de eerder ongedaan gemaakte actie", + "tooltip.chestseparators.draw_area": "Gebied tekenen", + "tooltip.chestseparators.erase_area": "Gebied wissen", + "tooltip.chestseparators.clear_lines": "Lijnen wissen", + "tooltip.chestseparators.clear_backgrounds": "Achtergronden wissen", + "tooltip.chestseparators.clear_both": "Beide wissen", + "message.chestseparators.cleared": "Gewist", + "tooltip.chestseparators.draw_trace": "Lijn tekenen", + "tooltip.chestseparators.erase_trace": "Lijn wissen", + "tooltip.chestseparators.open_palette": "Palet openen", + "message.chestseparators.color_copied": "Kleur gekopieerd!", + "message.chestseparators.color_pasted": "Kleur geplakt!", + "tooltip.chestseparators.tab_lines": "Lijnen", + "tooltip.chestseparators.tab_backgrounds": "Achtergronden", + "tooltip.chestseparators.tab_combo": "Combomodus", + "button.chestseparators.edit_filter": "Filter bewerken", + "tooltip.chestseparators.desc.edit_filter": "Maak of bewerk een filter voor de geselecteerde vakjes", + "button.chestseparators.delete_all_filters": "Alle filters verwijderen", + "tooltip.chestseparators.desc.delete_all_filters": "Verwijdert elk filter in deze kist", + "message.chestseparators.all_filters_deleted": "Alle filters verwijderd!", + "message.chestseparators.select_first": "Selecteer eerst ten minste één vakje.", + "button.chestseparators.area_select": "Gebiedsselectie", + "tooltip.chestseparators.desc.area_select": "Selecteer vakjes door een rechthoekig gebied te slepen", + "button.chestseparators.trace_select": "Lijnselectie", + "tooltip.chestseparators.desc.trace_select": "Selecteer vakjes door eroverheen te schilderen", + "button.chestseparators.clear_selection": "Selectie wissen", + "tooltip.chestseparators.desc.clear_selection": "Wis alle momenteel geselecteerde vakjes", + "button.chestseparators.copy_filters": "Filters kopiëren", + "message.chestseparators.filters_copied": "Filters gekopieerd!", + "tooltip.chestseparators.desc.copy_filters": "Kopieert alle filters van deze kist naar het klembord", + "button.chestseparators.paste_filters": "Filters plakken", + "message.chestseparators.filters_pasted": "Filters geplakt!", + "message.chestseparators.undone": "Ongedaan: %s", + "message.chestseparators.redone": "Opnieuw: %s", + "message.chestseparators.action.layout": "Lay-out", + "message.chestseparators.action.filter": "Filter", + "tooltip.chestseparators.desc.paste_filters": "Plakt filters van het klembord in deze kist", + "button.chestseparators.undo": "Ongedaan maken", + "tooltip.chestseparators.desc.undo": "Maakt de laatste filteractie ongedaan", + "button.chestseparators.redo": "Opnieuw doen", + "button.chestseparators.fill_inventory": "Inventaris vullen", + "button.chestseparators.preset_load": "Laden", + "button.chestseparators.preset_save": "Opslaan", + "tooltip.chestseparators.desc.redo": "Herstelt de eerder ongedaan gemaakte actie", + "tooltip.chestseparators.desc.fill_inventory": "Haal gefilterde items hierheen (tot doel)", + "tooltip.chestseparators.push_to_chest": "Items naar kist sturen\n§8Houd [Shift] voor lege vakken", + "tooltip.chestseparators.push_to_chest.shift": "Naar kist + lege vakken", + "tooltip.chestseparators.pull_from_chest": "Items uit kist halen\n§8[Shift] haalt ook ongefilterde items", + "tooltip.chestseparators.desc.presets": "Inventaris-presets: lay-outs en filters opslaan en laden", + "tooltip.chestseparators.desc.chest_presets": "Kist-presets: kist-lay-outs en filters opslaan en laden", + "button.chestseparators.conflict.overwrite": "Bestaande filters overschrijven", + "tooltip.chestseparators.desc.conflict.overwrite": "Verwijdert bestaande filters in de selectie en maakt een nieuwe aan", + "button.chestseparators.conflict.deselect": "Conflicten deselecteren & doorgaan", + "message.chestseparators.empty_selection": "Lege selectie.", + "tooltip.chestseparators.desc.conflict.deselect": "Behoudt bestaande filters en past deze alleen toe op lege vakjes", + "button.chestseparators.cancel": "Annuleren", + "tooltip.chestseparators.desc.conflict.cancel": "Filtraanmaak afbreken", + "button.chestseparators.confirm": "Bevestigen", + "gui.chestseparators.conflict_title": "Selectieconflict!", + "gui.chestseparators.presets_title": "Inventaris-presets", + "gui.chestseparators.chest_presets_title": "Kist-presets", + "gui.chestseparators.preview_layout": "Lay-out", + "gui.chestseparators.preview_filters": "Filters", + "gui.chestseparators.preset_slot": "Voorinstelling %s", + "gui.chestseparators.preset.building": "Bouwen", + "gui.chestseparators.preset.mining": "Mijnbouw", + "gui.chestseparators.preset.food": "Eten & boerderij", + "gui.chestseparators.preset.redstone": "Redstone", + "gui.chestseparators.preset.combat": "Gevecht", + "gui.chestseparators.preset.inv_miner": "Mijnwerker", + "gui.chestseparators.preset.inv_builder": "Bouwer", + "gui.chestseparators.preset.inv_explorer": "Ontdekker", + "gui.chestseparators.preset.inv_farmer": "Boer", + "gui.chestseparators.preset.inv_nether_end": "Nether & End", + "gui.chestseparators.conflict_desc": "Sommige geselecteerde vakjes hebben al een filter.", + "gui.chestseparators.group_filter": "Groepsfilter", + "gui.chestseparators.no_filter": "Geen filter", + "gui.chestseparators.items_count": "Items: %s", + "gui.chestseparators.hover_group": "Zweef over een groep...", + "gui.chestseparators.empty_whitelist": "Lege witte lijst.", + "button.chestseparators.save_and_exit": "Opslaan en afsluiten", + "button.chestseparators.discard_changes": "Wijzigingen negeren", + "button.chestseparators.import_extracted": "Geëxtraheerde importeren", + "message.chestseparators.items_already_in_filter": "Items staan al in het filter.", + "message.chestseparators.no_new_items_found": "Geen nieuwe items gevonden.", + "tooltip.chestseparators.desc.import_extracted": "Voegt de items in de geselecteerde vakjes toe aan het filter.", + "tooltip.chestseparators.desc.import_search": "Zoekopdracht importeren", + "button.chestseparators.allow_all": "Alles toestaan", + "tooltip.chestseparators.desc.allow_all": "Zet alle game-items op de witte lijst", + "button.chestseparators.clear_all": "Alles wissen", + "tooltip.chestseparators.desc.clear_all": "Wist de huidige witte lijst", + "button.chestseparators.manual_insert": "Handmatig invoegen", + "tooltip.chestseparators.rule.manual_active": "Actief: Filtert handmatige klikken", + "tooltip.chestseparators.rule.manual_inactive": "Inactief: Handmatige klikken negeren filter", + "button.chestseparators.shift_insert": "Shift invoegen", + "tooltip.chestseparators.rule.shift_active": "Actief: Filtert Shift-klikken", + "tooltip.chestseparators.rule.shift_inactive": "Inactief: Shift-klikken negeren filter", + "button.chestseparators.hopper_insert": "Trechter invoegen", + "tooltip.chestseparators.rule.hopper_active": "Actief: Filtert trechteroverdrachten", + "tooltip.chestseparators.rule.hopper_inactive": "Inactief: Trechters negeren filter", + "button.chestseparators.delete": "Verwijderen", + "tooltip.chestseparators.desc.delete_group": "Verwijdert deze filtergroep", + "button.chestseparators.save": "Opslaan", + "tooltip.chestseparators.desc.save": "Slaat wijzigingen op", + "tooltip.chestseparators.desc.cancel": "Negeert wijzigingen", + "gui.chestseparators.unsaved_changes_title": "Niet-opgeslagen wijzigingen", + "gui.chestseparators.unsaved_changes_desc": "Je hebt niet-opgeslagen wijzigingen in dit filter.", + "gui.chestseparators.new_detected": "Nieuw gedetecteerd: %s", + "gui.chestseparators.allowing_all": "Alles toestaan: %s", + "gui.chestseparators.clearing": "Wissen: %s", + "gui.chestseparators.allowed": "Toegestaan: %s", + "gui.chestseparators.blocked": "Geblokkeerd: %s", + "gui.chestseparators.edit_filter_rules": "Filterregels bewerken", + "message.chestseparators.no_valid_groups": "Geen geldige groepen.", + "color.chestseparators.custom": "Aangepaste kleur %s", + "button.chestseparators.eyedropper": "Pipet", + "tooltip.chestseparators.desc.eyedropper": "Kies rechtstreeks een kleur van het scherm", + "button.chestseparators.exit": "Afsluiten", + "tooltip.chestseparators.desc.exit": "Wijzigingen opslaan en de kleurkiezer sluiten", + "gui.chestseparators.hex": "Hex", + "gui.chestseparators.color_r": "R", + "gui.chestseparators.color_g": "G", + "gui.chestseparators.color_b": "B", + "gui.chestseparators.color_picker.instructions": "Klik met de middelste muisknop om te kopiëren. Klik met de linkermuisknop om te plakken.", + "window.chestseparators.edit_color": "Aangepaste kleur bewerken", + "message.chestseparators.edit_buttons_visible": "Bewerkknoppen: Zichtbaar", + "message.chestseparators.edit_buttons_hidden": "Bewerkknoppen: Verborgen", + "message.chestseparators.preview_panel_visible": "Voorbeeldpaneel: Zichtbaar", + "message.chestseparators.preview_panel_hidden": "Voorbeeldpaneel: Verborgen", + "modmenu.descriptionTranslation.chestseparators": "Maak je inventaris snel leeg met aangepaste auto-deposit. Het spel weet eindelijk precies wat je echt wilt en waar je het wilt hebben.", + "config.chestseparators.category.client": "Client / Uiterlijk", + "config.chestseparators.show_left_panel": "Linkerpaneel tonen", + "config.chestseparators.show_left_panel.tooltip": "Toont het witte lijst voorbeeldpaneel. Houd de wijzigingstoets ingedrukt om te forceren.", + "config.chestseparators.enable_preview_animation": "Voorbeeldanimatie inschakelen", + "config.chestseparators.enable_preview_animation.tooltip": "Scrolt automatisch de itemlijst in het voorbeeldpaneel.", + "config.chestseparators.show_edit_buttons": "Editorknoppen tonen", + "config.chestseparators.show_edit_buttons.tooltip": "Toont de gereedschapsknoppen in de kist.", + "config.chestseparators.bg_transparency": "Achtergrondtransparantie", + "config.chestseparators.bg_transparency.tooltip": "Dekkingsgraad voor achtergrondkleuren (0 = Onzichtbaar, 100 = Ondoorzichtig).", + "config.chestseparators.line_transparency": "Lijntransparantie", + "config.chestseparators.line_transparency.tooltip": "Dekkingsgraad voor scheidingslijnen (0 = Onzichtbaar, 100 = Ondoorzichtig).", + "config.chestseparators.default_rule_manual": "Standaardregel: Handmatig", + "config.chestseparators.default_rule_manual.tooltip": "Nieuwe groepen staan standaard handmatige klikken toe.", + "config.chestseparators.default_rule_shift": "Standaardregel: Shift", + "config.chestseparators.default_rule_shift.tooltip": "Nieuwe groepen staan standaard Shift-klikken toe.", + "config.chestseparators.default_rule_hopper": "Standaardregel: Trechter", + "config.chestseparators.default_rule_hopper.tooltip": "Nieuwe groepen staan standaard trechterinvoer toe.", + "config.chestseparators.default_rule_pickup": "Standaardregel: Oprapen", + "config.chestseparators.default_rule_pickup.tooltip": "Nieuwe inventarisgroepen filteren standaard opgeraapte voorwerpen.", + "config.chestseparators.category.server": "Server / Mechanica", + "config.chestseparators.expel_invalid_items": "Ongeldige items verdrijven", + "config.chestseparators.expel_invalid_items.tooltip": "Ongeldige items worden naar de inventaris verplaatst of laten vallen.", + "config.chestseparators.category.hotkeys": "Sneltoetsen", + "config.chestseparators.toggle_preview_panel": "Voorbeeldpaneel in-/uitschakelen", + "config.chestseparators.toggle_preview_panel.tooltip": "Snel tonen/verbergen van het linker voorbeeldpaneel.", + "config.chestseparators.show_panel_modifier": "Paneelweergave modificator", + "config.chestseparators.show_panel_modifier.tooltip": "Houd deze toets ingedrukt om het linkerpaneel te forceren.", + "button.chestseparators.import_search": "Zoekopdracht importeren", + "message.chestseparators.locked": "Iemand anders is deze kist al aan het bewerken!", + "gui.chestseparators.expel_items_title": "Ongeldige items uitwerpen?", + "gui.chestseparators.expel_items_desc": "Sommige items in deze sleuven komen niet overeen met de nieuwe regels. Ze worden uit de kist geworpen.", + "button.chestseparators.accept_expel": "Accepteren & Uitwerpen", + "config.chestseparators.dark_mode": "Donkere Modus", + "config.chestseparators.dark_mode.tooltip": "Schakelt tussen donkere en lichte UI-thema's.", + "config.chestseparators.show_deposit_button": "Stortknop Tonen", + "message.chestseparators.deposit_button_visible": "Stortknop: Zichtbaar", + "message.chestseparators.deposit_button_hidden": "Stortknop: Verborgen", + "key.chestseparators.toggle_magnifier": "Vergrootglas wisselen", + "key.chestseparators.toggle_edit_buttons": "Werkbalk in-/uitschakelen", + "config.chestseparators.toggle_edit_buttons": "Werkbalk in-/uitschakelen", + "config.chestseparators.toggle_edit_buttons.tooltip": "Toont of verbergt de hele bovenste werkbalk in één keer.", + "config.chestseparators.toggle_magnifier": "Vergrootglas wisselen", + "config.chestseparators.magnifier_enabled": "Vergrootglas tonen", + "config.chestseparators.magnifier_enabled.tooltip": "Toont een zoomloep bij de cursor tijdens het tekenen van scheidingen of met de pipet.", + "config.chestseparators.magnifier_shape": "Vorm vergrootglas", + "config.chestseparators.magnifier_shape.tooltip": "Of het vergrootglas rond of vierkant is.", + "config.chestseparators.magnifier_shape.circle": "Cirkel", + "config.chestseparators.magnifier_shape.square": "Vierkant", + "config.chestseparators.magnifier_tab_lines": "Vergrootglas: Lijnen", + "config.chestseparators.magnifier_tab_backgrounds": "Vergrootglas: Achtergronden", + "config.chestseparators.magnifier_tab_combo": "Vergrootglas: Combomodus", + "message.chestseparators.magnifier_on": "Vergrootglas: Aan", + "message.chestseparators.magnifier_off": "Vergrootglas: Uit", + "message.chestseparators.magnifier_hint": "Tip: druk op %s voor een vergrootglas", + "message.chestseparators.tag_hint": "Tip: middelklik op een item om zijn tags te zien", + "message.chestseparators.magnifier_hint_off": "Tip: druk %s om het vergrootglas te verbergen", + "config.chestseparators.show_deposit_button.tooltip": "Toont of verbergt de knop voor snel storten in de kistinterface.", + "tooltip.chestseparators.deposit_items": "Storten in Filters\n§8[Shift + Klik] Storten in Filters & Lege Slots", + "message.chestseparators.deposited": "%s items gestort.", + "message.chestseparators.deposit_failed": "Geen geldige slots gevonden om te storten.", + "config.chestseparators.close_on_click_outside": "Sluiten bij klikken buiten menu", + "config.chestseparators.close_on_click_outside.tooltip": "Sluit het menu wanneer buiten de interface wordt geklikt.", + "config.chestseparators.shared_custom_colors": "Gedeelde Aangepaste Kleuren", + "config.chestseparators.shared_custom_colors.tooltip": "Indien ingeschakeld wordt de aangepaste kleurenkolom gedeeld tussen de tabbladen Lijnen, Achtergronden en Combo. Indien uitgeschakeld heeft elk tabblad eigen kleuren.", + "title.chestseparators.config": "Absolute Order Configuratie", + "category.chestseparators.keys": "Absolute Order", + "key.category.chestseparators.keys": "Absolute Order", + "config.chestseparators.auto_deposit_enabled": "Auto-opslaan in nabije kisten", + "config.chestseparators.auto_deposit_enabled.tooltip": "Sorteer je hele inventaris met één actie in nabije gefilterde kisten.", + "config.chestseparators.auto_deposit_double_sneak": "Trigger: dubbel sluipen", + "config.chestseparators.auto_deposit_double_sneak.tooltip": "Tik twee keer snel op de sluiptoets om automatisch op te slaan.", + "config.chestseparators.auto_deposit_radius": "Auto-opslag straal", + "config.chestseparators.auto_deposit_radius.tooltip": "Hoe ver om je heen (in blokken) naar kisten wordt gezocht.", + "config.chestseparators.auto_deposit_through_walls": "Opslaan door muren", + "config.chestseparators.auto_deposit_through_walls.tooltip": "Sta opslaan toe in kisten die door vaste blokken worden geblokkeerd. Indien uit, moet het pad vrij zijn.", + "config.chestseparators.auto_deposit": "Auto-opslaan", + "key.chestseparators.auto_deposit": "Auto-opslaan in nabije kisten", + "message.chestseparators.auto_deposit_done": "%s voorwerpen automatisch opgeslagen.", + "message.chestseparators.auto_deposit_none": "Geen nabije gefilterde kisten binnen bereik.", + "message.chestseparators.auto_grab_done": "%s items gepakt.", + "message.chestseparators.auto_grab_none": "Niets in de buurt om te pakken.", + "message.chestseparators.preset_loaded": "Voorinstelling %s geladen.", + "message.chestseparators.preset_saved": "Voorinstelling %s opgeslagen.", + "message.chestseparators.preset_empty": "Voorinstelling %s is leeg.", + "config.chestseparators.auto_deposit_animation": "Opslag-animatie", + "config.chestseparators.auto_deposit_animation.tooltip": "Toont de 3D-voorwerpen die naar elke kist vliegen. Indien uit, worden voorwerpen direct zonder animatie opgeslagen.", + "config.chestseparators.auto_deposit_trail": "Spoor-effect", + "config.chestseparators.auto_deposit_trail.tooltip": "Laat een deeltjesspoor achter elk vliegend voorwerp achter. Geldt alleen als de animatie aan staat.", + "button.chestseparators.pickup_insert": "Oprapen", + "tooltip.chestseparators.rule.pickup_active": "Actief: filtert opgeraapte voorwerpen", + "tooltip.chestseparators.rule.pickup_inactive": "Inactief: opgeraapte voorwerpen negeren het filter", + "tooltip.chestseparators.edit_inventory_toggle": "Inventaris / kist bewerken", + "message.chestseparators.editing_inventory": "Bewerken: inventaris", + "message.chestseparators.editing_chest": "Bewerken: kist", + "message.chestseparators.preset_deleted": "Voorinstelling %s verwijderd.", + "gui.chestseparators.preset_overwrite_title": "Voorinstelling %s overschrijven?", + "gui.chestseparators.preset_overwrite_body": "De opgeslagen voorinstelling gaat verloren.", + "gui.chestseparators.preset_page": "Pagina %s/%s", + "gui.chestseparators.preview_delete": "Wordt verwijderd", + "key.chestseparators.push": "Naar kistfilters sturen", + "config.chestseparators.push": "Naar kistfilters sturen", + "config.chestseparators.push.tooltip": "Stuurt passende items naar de filters van de open kist.\n§8Houd [Shift] ingedrukt om ook lege vakjes te vullen", + "key.chestseparators.pull": "Naar inventarisfilters halen", + "config.chestseparators.pull": "Naar inventarisfilters halen", + "config.chestseparators.pull.tooltip": "Haalt de items van de kist naar je inventarisfilters.\n§8Houd [Shift] ingedrukt om ook ongefilterde items te halen", + "config.chestseparators.lock_hotbar_on_reorder": "Hotbar vergrendelen bij sorteren", + "config.chestseparators.lock_hotbar_on_reorder.tooltip": "Wanneer een push of pull je inventaris sorteert, blijft de hotbar ongemoeid.", + "config.chestseparators.lock_hotbar_on_reorder.tooltip2": "Beschermt een item dat je vasthoudt. Uit: de hotbar wordt ook gesorteerd.", + "message.chestseparators.push_no_filters": "Deze kist heeft nog geen filters.", + "message.chestseparators.push_no_slot": "Geen vrij filtervak hiervoor.", + "message.chestseparators.pull_no_filters": "Je inventaris heeft nog geen filters.", + "message.chestseparators.pull_no_match": "Niets hier past bij je filters." +} diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/lang/pl_pl.json b/multiloader-26.3/common/src/main/resources/assets/chestseparators/lang/pl_pl.json new file mode 100644 index 0000000..e703f87 --- /dev/null +++ b/multiloader-26.3/common/src/main/resources/assets/chestseparators/lang/pl_pl.json @@ -0,0 +1,257 @@ +{ + "tooltip.chestseparators.edit_mode": "Edytuj układ", + "tooltip.chestseparators.whitelist_mode": "Zarządzaj filtrami", + "itemGroup.chestseparators.chest_and_inventory": "Skrzynia i ekwipunek", + "gui.chestseparators.search": "Szukaj", + "button.chestseparators.copy_layout": "Kopiuj układ", + "message.chestseparators.layout_copied": "Skopiowano układ!", + "tooltip.chestseparators.desc.copy_layout": "Kopiuje obecny układ do schowka", + "button.chestseparators.paste_layout": "Wklej układ", + "message.chestseparators.layout_pasted": "Wklejono układ!", + "tooltip.chestseparators.desc.paste_layout": "Wkleja skopiowany układ ze schowka", + "button.chestseparators.undo_action": "Cofnij", + "tooltip.chestseparators.desc.undo_action": "Cofa ostatnio narysowaną akcję", + "button.chestseparators.redo_action": "Ponów", + "tooltip.chestseparators.desc.redo_action": "Przywraca wcześniej cofniętą akcję", + "tooltip.chestseparators.draw_area": "Rysuj obszar", + "tooltip.chestseparators.erase_area": "Wymaż obszar", + "tooltip.chestseparators.clear_lines": "Wyczyść linie", + "tooltip.chestseparators.clear_backgrounds": "Wyczyść tła", + "tooltip.chestseparators.clear_both": "Wyczyść oba", + "message.chestseparators.cleared": "Wyczyszczono", + "tooltip.chestseparators.draw_trace": "Rysuj ślad", + "tooltip.chestseparators.erase_trace": "Wymaż ślad", + "tooltip.chestseparators.open_palette": "Otwórz paletę", + "message.chestseparators.color_copied": "Skopiowano kolor!", + "message.chestseparators.color_pasted": "Wklejono kolor!", + "tooltip.chestseparators.tab_lines": "Linie", + "tooltip.chestseparators.tab_backgrounds": "Tła", + "tooltip.chestseparators.tab_combo": "Tryb łączony", + "button.chestseparators.edit_filter": "Edytuj filtr", + "tooltip.chestseparators.desc.edit_filter": "Utwórz lub edytuj filtr dla wybranych miejsc", + "button.chestseparators.delete_all_filters": "Usuń wszystkie filtry", + "tooltip.chestseparators.desc.delete_all_filters": "Usuwa każdy filtr w tej skrzyni", + "message.chestseparators.all_filters_deleted": "Wszystkie filtry usunięte!", + "message.chestseparators.select_first": "Wybierz najpierw przynajmniej jedno miejsce.", + "button.chestseparators.area_select": "Wybór obszaru", + "tooltip.chestseparators.desc.area_select": "Wybierz miejsca, przeciągając prostokątny obszar", + "button.chestseparators.trace_select": "Wybór śladu", + "tooltip.chestseparators.desc.trace_select": "Wybierz miejsca, malując po nich", + "button.chestseparators.clear_selection": "Wyczyść zaznaczenie", + "tooltip.chestseparators.desc.clear_selection": "Wyczyść wszystkie aktualnie wybrane miejsca", + "button.chestseparators.copy_filters": "Kopiuj filtry", + "message.chestseparators.filters_copied": "Filtry skopiowane!", + "tooltip.chestseparators.desc.copy_filters": "Kopiuje wszystkie filtry z tej skrzyni do schowka", + "button.chestseparators.paste_filters": "Wklej filtry", + "message.chestseparators.filters_pasted": "Filtry wklejone!", + "message.chestseparators.undone": "Cofnięto: %s", + "message.chestseparators.redone": "Ponowiono: %s", + "message.chestseparators.action.layout": "Układ", + "message.chestseparators.action.filter": "Filtr", + "tooltip.chestseparators.desc.paste_filters": "Wkleja filtry ze schowka do tej skrzyni", + "button.chestseparators.undo": "Cofnij", + "tooltip.chestseparators.desc.undo": "Cofa ostatnią akcję filtra", + "button.chestseparators.redo": "Ponów", + "button.chestseparators.fill_inventory": "Napełnij ekwipunek", + "button.chestseparators.preset_load": "Wczytaj", + "button.chestseparators.preset_save": "Zapisz", + "tooltip.chestseparators.desc.redo": "Przywraca wcześniej cofniętą akcję", + "tooltip.chestseparators.desc.fill_inventory": "Pobierz przefiltrowane przedmioty tutaj (do celu)", + "tooltip.chestseparators.push_to_chest": "Wyślij przedmioty do skrzyni\n§8Przytrzymaj [Shift], aby dodać puste sloty", + "tooltip.chestseparators.push_to_chest.shift": "Do skrzyni + puste sloty", + "tooltip.chestseparators.pull_from_chest": "Pobierz przedmioty ze skrzyni\n§8[Shift] pobiera też nieprzefiltrowane", + "tooltip.chestseparators.desc.presets": "Zestawy ekwipunku: zapis i wczytywanie układów i filtrów", + "tooltip.chestseparators.desc.chest_presets": "Zestawy skrzyni: zapis i wczytywanie układów i filtrów skrzyni", + "button.chestseparators.conflict.overwrite": "Nadpisz istniejące filtry", + "tooltip.chestseparators.desc.conflict.overwrite": "Usuwa istniejące filtry w zaznaczeniu i tworzy nowy", + "button.chestseparators.conflict.deselect": "Odznacz konflikty i kontynuuj", + "message.chestseparators.empty_selection": "Puste zaznaczenie.", + "tooltip.chestseparators.desc.conflict.deselect": "Pozostawia istniejące filtry nienaruszone i stosuje się tylko do pustych miejsc", + "button.chestseparators.cancel": "Anuluj", + "tooltip.chestseparators.desc.conflict.cancel": "Przerwij tworzenie filtra", + "button.chestseparators.confirm": "Potwierdź", + "gui.chestseparators.conflict_title": "Konflikt zaznaczenia!", + "gui.chestseparators.presets_title": "Zestawy ekwipunku", + "gui.chestseparators.chest_presets_title": "Zestawy skrzyni", + "gui.chestseparators.preview_layout": "Układ", + "gui.chestseparators.preview_filters": "Filtry", + "gui.chestseparators.preset_slot": "Zestaw %s", + "gui.chestseparators.preset.building": "Budowanie", + "gui.chestseparators.preset.mining": "Górnictwo", + "gui.chestseparators.preset.food": "Jedzenie i farma", + "gui.chestseparators.preset.redstone": "Redstone", + "gui.chestseparators.preset.combat": "Walka", + "gui.chestseparators.preset.inv_miner": "Górnik", + "gui.chestseparators.preset.inv_builder": "Budowniczy", + "gui.chestseparators.preset.inv_explorer": "Odkrywca", + "gui.chestseparators.preset.inv_farmer": "Rolnik", + "gui.chestseparators.preset.inv_nether_end": "Nether i End", + "gui.chestseparators.conflict_desc": "Niektóre wybrane miejsca mają już filtr.", + "gui.chestseparators.group_filter": "Filtr grupy", + "gui.chestseparators.no_filter": "Brak filtra", + "gui.chestseparators.items_count": "Przedmioty: %s", + "gui.chestseparators.hover_group": "Najedź na grupę...", + "gui.chestseparators.empty_whitelist": "Pusta biała lista.", + "button.chestseparators.save_and_exit": "Zapisz i wyjdź", + "button.chestseparators.discard_changes": "Odrzuć zmiany", + "button.chestseparators.import_extracted": "Importuj wyodrębnione", + "message.chestseparators.items_already_in_filter": "Przedmioty są już w filtrze.", + "message.chestseparators.no_new_items_found": "Nie znaleziono nowych przedmiotów.", + "tooltip.chestseparators.desc.import_extracted": "Dodaje do filtra przedmioty znajdujące się w zaznaczonych slotach.", + "tooltip.chestseparators.desc.import_search": "Importuj wyszukiwanie", + "button.chestseparators.allow_all": "Zezwól na wszystkie", + "tooltip.chestseparators.desc.allow_all": "Dodaje wszystkie przedmioty do białej listy", + "button.chestseparators.clear_all": "Wyczyść wszystko", + "tooltip.chestseparators.desc.clear_all": "Czysci obecną białą listę", + "button.chestseparators.manual_insert": "Wkładanie ręczne", + "tooltip.chestseparators.rule.manual_active": "Aktywne: Filtruje ręczne kliknięcia", + "tooltip.chestseparators.rule.manual_inactive": "Nieaktywne: Ręczne kliknięcia ignorują filtr", + "button.chestseparators.shift_insert": "Wkładanie z Shift", + "tooltip.chestseparators.rule.shift_active": "Aktywne: Filtruje kliknięcia z Shift", + "tooltip.chestseparators.rule.shift_inactive": "Nieaktywne: Kliknięcia z Shift ignorują filtr", + "button.chestseparators.hopper_insert": "Wkładanie lejem", + "tooltip.chestseparators.rule.hopper_active": "Aktywne: Filtruje transfery z leja", + "tooltip.chestseparators.rule.hopper_inactive": "Nieaktywne: Leje ignorują filtr", + "button.chestseparators.delete": "Usuń", + "tooltip.chestseparators.desc.delete_group": "Usuwa tę grupę filtrów", + "button.chestseparators.save": "Zapisz", + "tooltip.chestseparators.desc.save": "Zapisuje zmiany", + "tooltip.chestseparators.desc.cancel": "Odrzuca zmiany", + "gui.chestseparators.unsaved_changes_title": "Niezapisane zmiany", + "gui.chestseparators.unsaved_changes_desc": "Masz niezapisane zmiany w tym filtrze.", + "gui.chestseparators.new_detected": "Wykryto nowe: %s", + "gui.chestseparators.allowing_all": "Zezwalanie wszystkim: %s", + "gui.chestseparators.clearing": "Czyszczenie: %s", + "gui.chestseparators.allowed": "Dozwolone: %s", + "gui.chestseparators.blocked": "Zablokowane: %s", + "gui.chestseparators.edit_filter_rules": "Edytuj zasady filtra", + "message.chestseparators.no_valid_groups": "Brak prawidłowych grup.", + "button.chestseparators.eyedropper": "Kroplomierz", + "tooltip.chestseparators.desc.eyedropper": "Wybierz kolor bezpośrednio z ekranu", + "button.chestseparators.exit": "Wyjście", + "tooltip.chestseparators.desc.exit": "Zapisz zmiany i zamknij próbnik kolorów", + "gui.chestseparators.hex": "Hex", + "gui.chestseparators.color_r": "R", + "gui.chestseparators.color_g": "G", + "gui.chestseparators.color_b": "B", + "gui.chestseparators.color_picker.instructions": "Środkowy przycisk myszy, aby skopiować. Lewy przycisk na slocie, aby wkleić.", + "window.chestseparators.edit_color": "Edytuj kolor niestandardowy", + "message.chestseparators.edit_buttons_visible": "Przyciski edycji: Widoczne", + "message.chestseparators.edit_buttons_hidden": "Przyciski edycji: Ukryte", + "message.chestseparators.preview_panel_visible": "Panel podglądu: Widoczny", + "message.chestseparators.preview_panel_hidden": "Panel podglądu: Ukryty", + "modmenu.descriptionTranslation.chestseparators": "Osiągnij szybkie opróżnianie ekwipunku dzięki niestandardowemu automatycznemu deponowaniu. Gra wreszcie wie dokładnie, czego naprawdę chcesz i gdzie to chcesz.", + "config.chestseparators.category.client": "Klient / Wygląd", + "config.chestseparators.show_left_panel": "Pokaż lewy panel", + "config.chestseparators.show_left_panel.tooltip": "Pokazuje panel podglądu białej listy. Przytrzymaj klawisz modyfikujący, aby wymusić.", + "config.chestseparators.enable_preview_animation": "Włącz animację podglądu", + "config.chestseparators.enable_preview_animation.tooltip": "Automatycznie przewija listę przedmiotów w panelu podglądu.", + "config.chestseparators.show_edit_buttons": "Pokaż przyciski edytora", + "config.chestseparators.show_edit_buttons.tooltip": "Wyświetla przyciski narzędzi wewnątrz skrzyni.", + "config.chestseparators.bg_transparency": "Przezroczystość tła", + "config.chestseparators.bg_transparency.tooltip": "Poziom nieprzezroczystości tła slotów (0 = Niewidoczne, 100 = Pełne).", + "config.chestseparators.line_transparency": "Przezroczystość linii", + "config.chestseparators.line_transparency.tooltip": "Poziom nieprzezroczystości linii oddzielających (0 = Niewidoczne, 100 = Pełne).", + "config.chestseparators.default_rule_manual": "Domyślna zasada: Ręcznie", + "config.chestseparators.default_rule_manual.tooltip": "Nowe grupy będą domyślnie zezwalać na ręczne kliknięcia.", + "config.chestseparators.default_rule_shift": "Domyślna zasada: Shift", + "config.chestseparators.default_rule_shift.tooltip": "Nowe grupy będą domyślnie zezwalać na kliknięcia z Shiftem.", + "config.chestseparators.default_rule_hopper": "Domyślna zasada: Lej", + "config.chestseparators.default_rule_hopper.tooltip": "Nowe grupy będą domyślnie zezwalać na wkładanie lejem.", + "config.chestseparators.default_rule_pickup": "Domyślna zasada: Podnoszenie", + "config.chestseparators.default_rule_pickup.tooltip": "Nowe grupy ekwipunku będą domyślnie filtrować podniesione przedmioty.", + "config.chestseparators.category.server": "Serwer / Mechanika", + "config.chestseparators.expel_invalid_items": "Wyrzuć nieprawidłowe przedmioty", + "config.chestseparators.expel_invalid_items.tooltip": "Podczas nakładania nowego filtra nieprawidłowe przedmioty zostaną przeniesione do ekwipunku lub wyrzucone.", + "config.chestseparators.category.hotkeys": "Skróty klawiszowe", + "config.chestseparators.toggle_preview_panel": "Przełącz panel podglądu", + "config.chestseparators.toggle_preview_panel.tooltip": "Szybko pokaż/ukryj lewy panel podglądu.", + "config.chestseparators.show_panel_modifier": "Modyfikator panelu", + "config.chestseparators.show_panel_modifier.tooltip": "Przytrzymaj ten klawisz, aby wymusić pokazanie lewego panelu.", + "color.chestseparators.custom": "Kolor niestandardowy %s", + "button.chestseparators.import_search": "Importuj wyszukiwanie", + "message.chestseparators.locked": "Ktoś inny już edytuje tę skrzynię!", + "gui.chestseparators.expel_items_title": "Wyrzucić nieprawidłowe przedmioty?", + "gui.chestseparators.expel_items_desc": "Niektóre przedmioty znajdujące się obecnie w tych miejscach nie pasują do nowych zasad. Zostaną one wyrzucone ze skrzyni.", + "button.chestseparators.accept_expel": "Akceptuj i Wyrzuć", + "config.chestseparators.dark_mode": "Tryb Ciemny", + "config.chestseparators.dark_mode.tooltip": "Przełącza między ciemnym a jasnym motywem interfejsu.", + "config.chestseparators.show_deposit_button": "Pokaż Przycisk Depozytu", + "message.chestseparators.deposit_button_visible": "Przycisk depozytu: Widoczny", + "message.chestseparators.deposit_button_hidden": "Przycisk depozytu: Ukryty", + "key.chestseparators.toggle_magnifier": "Przełącz lupę", + "key.chestseparators.toggle_edit_buttons": "Przełącz pasek narzędzi", + "config.chestseparators.toggle_edit_buttons": "Przełącz pasek narzędzi", + "config.chestseparators.toggle_edit_buttons.tooltip": "Pokazuje lub ukrywa cały górny pasek narzędzi naraz.", + "config.chestseparators.toggle_magnifier": "Przełącz lupę", + "config.chestseparators.magnifier_enabled": "Pokaż lupę", + "config.chestseparators.magnifier_enabled.tooltip": "Pokazuje lupę przy kursorze podczas malowania separatorów lub używania zakraplacza.", + "config.chestseparators.magnifier_shape": "Kształt lupy", + "config.chestseparators.magnifier_shape.tooltip": "Czy lupa jest okrągła czy kwadratowa.", + "config.chestseparators.magnifier_shape.circle": "Koło", + "config.chestseparators.magnifier_shape.square": "Kwadrat", + "config.chestseparators.magnifier_tab_lines": "Lupa: Linie", + "config.chestseparators.magnifier_tab_backgrounds": "Lupa: Tła", + "config.chestseparators.magnifier_tab_combo": "Lupa: Tryb łączony", + "message.chestseparators.magnifier_on": "Lupa: Wł.", + "message.chestseparators.magnifier_off": "Lupa: Wył.", + "message.chestseparators.magnifier_hint": "Wskazówka: naciśnij %s, aby użyć lupy", + "message.chestseparators.tag_hint": "Wskazówka: kliknij środkowym na przedmiot, by zobaczyć jego tagi", + "message.chestseparators.magnifier_hint_off": "Wskazówka: naciśnij %s, aby ukryć lupę", + "config.chestseparators.show_deposit_button.tooltip": "Pokazuje lub ukrywa przycisk szybkiego depozytu w interfejsie skrzyni.", + "tooltip.chestseparators.deposit_items": "Zdeponuj w Filtrach\n§8[Shift + Kliknięcie] Zdeponuj w Filtrach i Pustych Miejscach", + "message.chestseparators.deposited": "Zdeponowano %s przedmiotów.", + "message.chestseparators.deposit_failed": "Nie znaleziono odpowiednich miejsc do depozytu.", + "config.chestseparators.close_on_click_outside": "Zamknij po kliknięciu na zewnątrz", + "config.chestseparators.close_on_click_outside.tooltip": "Zamyka menu po kliknięciu poza interfejsem.", + "config.chestseparators.shared_custom_colors": "Wspólne Kolory Niestandardowe", + "config.chestseparators.shared_custom_colors.tooltip": "Po włączeniu kolumna kolorów niestandardowych jest wspólna dla kart Linie, Tła i Combo. Po wyłączeniu każda karta ma własne.", + "title.chestseparators.config": "Konfiguracja Absolute Order", + "category.chestseparators.keys": "Absolute Order", + "key.category.chestseparators.keys": "Absolute Order", + "config.chestseparators.auto_deposit_enabled": "Auto-deponowanie do pobliskich skrzyń", + "config.chestseparators.auto_deposit_enabled.tooltip": "Posortuj cały ekwipunek do pobliskich filtrowanych skrzyń jednym ruchem.", + "config.chestseparators.auto_deposit_double_sneak": "Wyzwalacz: podwójne skradanie", + "config.chestseparators.auto_deposit_double_sneak.tooltip": "Naciśnij szybko dwa razy klawisz skradania, aby auto-deponować.", + "config.chestseparators.auto_deposit_radius": "Promień auto-deponowania", + "config.chestseparators.auto_deposit_radius.tooltip": "Jak daleko wokół ciebie (w blokach) szukane są skrzynie.", + "config.chestseparators.auto_deposit_through_walls": "Deponowanie przez ściany", + "config.chestseparators.auto_deposit_through_walls.tooltip": "Pozwala deponować do skrzyń zasłoniętych litymi blokami. Gdy wyłączone, droga musi być wolna.", + "config.chestseparators.auto_deposit": "Auto-deponowanie", + "key.chestseparators.auto_deposit": "Auto-deponowanie do pobliskich skrzyń", + "message.chestseparators.auto_deposit_done": "Auto-zdeponowano %s przedmiotów.", + "message.chestseparators.auto_deposit_none": "Brak pobliskich filtrowanych skrzyń w zasięgu.", + "message.chestseparators.auto_grab_done": "Zebrano %s przedmiotów.", + "message.chestseparators.auto_grab_none": "Brak rzeczy do zebrania w pobliżu.", + "message.chestseparators.preset_loaded": "Wczytano zestaw %s.", + "message.chestseparators.preset_saved": "Zapisano zestaw %s.", + "message.chestseparators.preset_empty": "Zestaw %s jest pusty.", + "config.chestseparators.auto_deposit_animation": "Animacja deponowania", + "config.chestseparators.auto_deposit_animation.tooltip": "Pokazuje przedmioty 3D lecące do każdej skrzyni. Gdy wyłączone, przedmioty są deponowane natychmiast bez animacji.", + "config.chestseparators.auto_deposit_trail": "Efekt smugi", + "config.chestseparators.auto_deposit_trail.tooltip": "Pozostawia smugę cząsteczek za każdym lecącym przedmiotem. Działa tylko, gdy animacja jest włączona.", + "button.chestseparators.pickup_insert": "Podnoszenie", + "tooltip.chestseparators.rule.pickup_active": "Aktywne: filtruje podniesione przedmioty", + "tooltip.chestseparators.rule.pickup_inactive": "Nieaktywne: podniesione przedmioty ignorują filtr", + "tooltip.chestseparators.edit_inventory_toggle": "Edytuj ekwipunek / skrzynię", + "message.chestseparators.editing_inventory": "Edycja: ekwipunek", + "message.chestseparators.editing_chest": "Edycja: skrzynia", + "message.chestseparators.preset_deleted": "Usunięto zestaw %s.", + "gui.chestseparators.preset_overwrite_title": "Nadpisać zestaw %s?", + "gui.chestseparators.preset_overwrite_body": "Zapisany zestaw zostanie utracony.", + "gui.chestseparators.preset_page": "Strona %s/%s", + "gui.chestseparators.preview_delete": "Zostanie usunięty", + "key.chestseparators.push": "Wyślij do filtrów skrzyni", + "config.chestseparators.push": "Wyślij do filtrów skrzyni", + "config.chestseparators.push.tooltip": "Wysyła pasujące przedmioty do filtrów otwartej skrzyni.\n§8Przytrzymaj [Shift], aby wypełnić też puste sloty", + "key.chestseparators.pull": "Pobierz do filtrów ekwipunku", + "config.chestseparators.pull": "Pobierz do filtrów ekwipunku", + "config.chestseparators.pull.tooltip": "Pobiera przedmioty ze skrzyni do filtrów twojego ekwipunku.\n§8Przytrzymaj [Shift], aby pobrać też przedmioty bez filtra", + "config.chestseparators.lock_hotbar_on_reorder": "Zablokuj pasek szybkiego dostępu przy sortowaniu", + "config.chestseparators.lock_hotbar_on_reorder.tooltip": "Gdy push lub pull sortuje ekwipunek, pasek szybkiego dostępu pozostaje nietknięty.", + "config.chestseparators.lock_hotbar_on_reorder.tooltip2": "Chroni trzymany przedmiot. Wył.: pasek też jest sortowany.", + "message.chestseparators.push_no_filters": "Ta skrzynia nie ma jeszcze filtrów.", + "message.chestseparators.push_no_slot": "Brak wolnego miejsca w filtrach.", + "message.chestseparators.pull_no_filters": "Twój ekwipunek nie ma jeszcze filtrów.", + "message.chestseparators.pull_no_match": "Nic tu nie pasuje do twoich filtrów." +} diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/lang/pt_br.json b/multiloader-26.3/common/src/main/resources/assets/chestseparators/lang/pt_br.json new file mode 100644 index 0000000..cfd9af1 --- /dev/null +++ b/multiloader-26.3/common/src/main/resources/assets/chestseparators/lang/pt_br.json @@ -0,0 +1,257 @@ +{ + "tooltip.chestseparators.edit_mode": "Editar Layout", + "tooltip.chestseparators.whitelist_mode": "Gerenciar Filtros", + "itemGroup.chestseparators.chest_and_inventory": "Baú e Inventário", + "gui.chestseparators.search": "Buscar", + "button.chestseparators.copy_layout": "Copiar Layout", + "message.chestseparators.layout_copied": "Layout Copiado!", + "tooltip.chestseparators.desc.copy_layout": "Copia o layout atual para a área de transferência", + "button.chestseparators.paste_layout": "Colar Layout", + "message.chestseparators.layout_pasted": "Layout Colado!", + "tooltip.chestseparators.desc.paste_layout": "Cola o layout copiado da área de transferência", + "button.chestseparators.undo_action": "Desfazer", + "tooltip.chestseparators.desc.undo_action": "Reverte a última ação desenhada", + "button.chestseparators.redo_action": "Refazer", + "tooltip.chestseparators.desc.redo_action": "Restaura a ação desfeita anteriormente", + "tooltip.chestseparators.draw_area": "Desenhar Área", + "tooltip.chestseparators.erase_area": "Apagar Área", + "tooltip.chestseparators.clear_lines": "Limpar Linhas", + "tooltip.chestseparators.clear_backgrounds": "Limpar Fundos", + "tooltip.chestseparators.clear_both": "Limpar Ambos", + "message.chestseparators.cleared": "Camada Limpa", + "tooltip.chestseparators.draw_trace": "Desenhar Rastro", + "tooltip.chestseparators.erase_trace": "Apagar Rastro", + "tooltip.chestseparators.open_palette": "Abrir Paleta", + "message.chestseparators.color_copied": "Cor Copiada!", + "message.chestseparators.color_pasted": "Cor Colada!", + "tooltip.chestseparators.tab_lines": "Linhas", + "tooltip.chestseparators.tab_backgrounds": "Fundos", + "tooltip.chestseparators.tab_combo": "Modo Combinado", + "button.chestseparators.edit_filter": "Editar Filtro", + "tooltip.chestseparators.desc.edit_filter": "Cria ou edita um filtro para os espaços selecionados", + "button.chestseparators.delete_all_filters": "Excluir Todos os Filtros", + "tooltip.chestseparators.desc.delete_all_filters": "Exclui todos os filtros neste baú", + "message.chestseparators.all_filters_deleted": "Todos os Filtros Excluídos!", + "message.chestseparators.select_first": "Selecione pelo menos um espaço primeiro.", + "button.chestseparators.area_select": "Seleção por Área", + "tooltip.chestseparators.desc.area_select": "Selecione espaços arrastando uma área retangular", + "button.chestseparators.trace_select": "Seleção por Traço", + "tooltip.chestseparators.desc.trace_select": "Selecione espaços pintando sobre eles", + "button.chestseparators.clear_selection": "Limpar Seleção", + "tooltip.chestseparators.desc.clear_selection": "Limpa todos os espaços selecionados atualmente", + "button.chestseparators.copy_filters": "Copiar Filtros", + "message.chestseparators.filters_copied": "Filtros Copiados!", + "tooltip.chestseparators.desc.copy_filters": "Copia todos os filtros deste baú para a área de transferência", + "button.chestseparators.paste_filters": "Colar Filtros", + "message.chestseparators.filters_pasted": "Filtros Colados!", + "message.chestseparators.undone": "Desfeito: %s", + "message.chestseparators.redone": "Refeito: %s", + "message.chestseparators.action.layout": "Layout", + "message.chestseparators.action.filter": "Filtro", + "tooltip.chestseparators.desc.paste_filters": "Cola os filtros da área de transferência neste baú", + "button.chestseparators.undo": "Desfazer", + "tooltip.chestseparators.desc.undo": "Desfaz a última ação de filtro", + "button.chestseparators.redo": "Refazer", + "button.chestseparators.fill_inventory": "Encher inventário", + "button.chestseparators.preset_load": "Carregar", + "button.chestseparators.preset_save": "Salvar", + "tooltip.chestseparators.desc.redo": "Refaz a ação desfeita anteriormente", + "tooltip.chestseparators.desc.fill_inventory": "Puxa os itens filtrados aqui (até o alvo)", + "tooltip.chestseparators.push_to_chest": "Envia itens ao baú\n§8Segure [Shift] para incluir espaços vazios", + "tooltip.chestseparators.push_to_chest.shift": "Envia ao baú + espaços vazios", + "tooltip.chestseparators.pull_from_chest": "Puxa itens do baú\n§8[Shift] também puxa itens não filtrados", + "tooltip.chestseparators.desc.presets": "Predefinições de inventário: salvar e carregar layouts e filtros", + "tooltip.chestseparators.desc.chest_presets": "Predefinições de baú: salvar e carregar layouts e filtros do baú", + "button.chestseparators.conflict.overwrite": "Substituir filtros existentes", + "tooltip.chestseparators.desc.conflict.overwrite": "Exclui filtros existentes na seleção e cria um novo", + "button.chestseparators.conflict.deselect": "Deselecionar conflitos e continuar", + "message.chestseparators.empty_selection": "Seleção vazia.", + "tooltip.chestseparators.desc.conflict.deselect": "Mantém os filtros existentes intactos e aplica apenas aos espaços vazios", + "button.chestseparators.cancel": "Cancelar", + "tooltip.chestseparators.desc.conflict.cancel": "Cancela a criação do filtro", + "button.chestseparators.confirm": "Confirmar", + "gui.chestseparators.conflict_title": "Conflito de Seleção!", + "gui.chestseparators.presets_title": "Predefinições de inventário", + "gui.chestseparators.chest_presets_title": "Predefinições de baú", + "gui.chestseparators.preview_layout": "Layout", + "gui.chestseparators.preview_filters": "Filtros", + "gui.chestseparators.preset_slot": "Predefinição %s", + "gui.chestseparators.preset.building": "Construção", + "gui.chestseparators.preset.mining": "Mineração", + "gui.chestseparators.preset.food": "Comida e fazenda", + "gui.chestseparators.preset.redstone": "Redstone", + "gui.chestseparators.preset.combat": "Combate", + "gui.chestseparators.preset.inv_miner": "Minerador", + "gui.chestseparators.preset.inv_builder": "Construtor", + "gui.chestseparators.preset.inv_explorer": "Explorador", + "gui.chestseparators.preset.inv_farmer": "Fazendeiro", + "gui.chestseparators.preset.inv_nether_end": "Nether e End", + "gui.chestseparators.conflict_desc": "Alguns espaços selecionados já possuem um filtro.", + "gui.chestseparators.group_filter": "Filtro de Grupo", + "gui.chestseparators.no_filter": "Sem Filtro", + "gui.chestseparators.items_count": "Itens: %s", + "gui.chestseparators.hover_group": "Passe o mouse sobre um grupo...", + "gui.chestseparators.empty_whitelist": "Lista branca vazia.", + "button.chestseparators.save_and_exit": "Salvar e Sair", + "button.chestseparators.discard_changes": "Descartar Alterações", + "button.chestseparators.import_extracted": "Importar Extraídos", + "message.chestseparators.items_already_in_filter": "Itens já estão no filtro.", + "message.chestseparators.no_new_items_found": "Nenhum item novo encontrado.", + "tooltip.chestseparators.desc.import_extracted": "Adiciona ao filtro os itens presentes nos slots selecionados.", + "tooltip.chestseparators.desc.import_search": "Importar Pesquisa", + "button.chestseparators.allow_all": "Permitir Todos", + "tooltip.chestseparators.desc.allow_all": "Coloca todos os itens do jogo na lista branca", + "button.chestseparators.clear_all": "Limpar Tudo", + "tooltip.chestseparators.desc.clear_all": "Limpa a lista branca atual", + "button.chestseparators.manual_insert": "Inserção Manual", + "tooltip.chestseparators.rule.manual_active": "Ativo: Filtra cliques manuais", + "tooltip.chestseparators.rule.manual_inactive": "Inativo: Cliques manuais ignoram o filtro", + "button.chestseparators.shift_insert": "Inserção com Shift", + "tooltip.chestseparators.rule.shift_active": "Ativo: Filtra cliques com Shift", + "tooltip.chestseparators.rule.shift_inactive": "Inativo: Cliques com Shift ignoram o filtro", + "button.chestseparators.hopper_insert": "Inserção por Funil", + "tooltip.chestseparators.rule.hopper_active": "Ativo: Filtra transferências de funil", + "tooltip.chestseparators.rule.hopper_inactive": "Inativo: Funis ignoram o filtro", + "button.chestseparators.delete": "Excluir", + "tooltip.chestseparators.desc.delete_group": "Exclui este grupo de filtros", + "button.chestseparators.save": "Salvar", + "tooltip.chestseparators.desc.save": "Salva as alterações", + "tooltip.chestseparators.desc.cancel": "Descarta as alterações", + "gui.chestseparators.unsaved_changes_title": "Alterações Não Salvas", + "gui.chestseparators.unsaved_changes_desc": "Você tem alterações não salvas neste filtro.", + "gui.chestseparators.new_detected": "Novos detectados: %s", + "gui.chestseparators.allowing_all": "Permitindo Todos: %s", + "gui.chestseparators.clearing": "Limpando: %s", + "gui.chestseparators.allowed": "Permitidos: %s", + "gui.chestseparators.blocked": "Bloqueados: %s", + "gui.chestseparators.edit_filter_rules": "Editar Regras do Filtro", + "message.chestseparators.no_valid_groups": "Nenhum grupo válido.", + "button.chestseparators.eyedropper": "Conta-gotas", + "tooltip.chestseparators.desc.eyedropper": "Escolha uma cor diretamente da tela", + "button.chestseparators.exit": "Sair", + "tooltip.chestseparators.desc.exit": "Salva as alterações e fecha o seletor de cores", + "gui.chestseparators.hex": "Hex", + "gui.chestseparators.color_r": "R", + "gui.chestseparators.color_g": "G", + "gui.chestseparators.color_b": "B", + "gui.chestseparators.color_picker.instructions": "Clique com o botão do meio para copiar. Clique esquerdo em um slot para colar.", + "window.chestseparators.edit_color": "Editar Cor Personalizada", + "message.chestseparators.edit_buttons_visible": "Botões de Edição: Visíveis", + "message.chestseparators.edit_buttons_hidden": "Botões de Edição: Ocultos", + "message.chestseparators.preview_panel_visible": "Painel de Visualização: Visível", + "message.chestseparators.preview_panel_hidden": "Painel de Visualização: Oculto", + "modmenu.descriptionTranslation.chestseparators": "Limpe o inventário rapidamente com o depósito automático personalizado. O jogo finalmente sabe exatamente o que você quer e onde você quer.", + "config.chestseparators.category.client": "Cliente / Visuais", + "config.chestseparators.show_left_panel": "Mostrar Painel Esquerdo", + "config.chestseparators.show_left_panel.tooltip": "Mostra o painel de visualização da lista branca. Segure a tecla modificadora para forçar.", + "config.chestseparators.enable_preview_animation": "Ativar Animação de Visualização", + "config.chestseparators.enable_preview_animation.tooltip": "Rola automaticamente a lista de itens no painel de visualização.", + "config.chestseparators.show_edit_buttons": "Mostrar Botões de Edição", + "config.chestseparators.show_edit_buttons.tooltip": "Exibe os botões de ferramentas dentro do baú.", + "config.chestseparators.bg_transparency": "Transparência do Fundo", + "config.chestseparators.bg_transparency.tooltip": "Nível de opacidade para o fundo dos slots (0 = Invisível, 100 = Sólido).", + "config.chestseparators.line_transparency": "Transparência das Linhas", + "config.chestseparators.line_transparency.tooltip": "Nível de opacidade para as linhas (0 = Invisível, 100 = Sólido).", + "config.chestseparators.default_rule_manual": "Regra Padrão: Manual", + "config.chestseparators.default_rule_manual.tooltip": "Grupos novos permitirão cliques manuais por padrão.", + "config.chestseparators.default_rule_shift": "Regra Padrão: Shift", + "config.chestseparators.default_rule_shift.tooltip": "Grupos novos permitirão cliques com Shift por padrão.", + "config.chestseparators.default_rule_hopper": "Regra Padrão: Funil", + "config.chestseparators.default_rule_hopper.tooltip": "Grupos novos permitirão a inserção por funil por padrão.", + "config.chestseparators.default_rule_pickup": "Regra Padrão: Pegar", + "config.chestseparators.default_rule_pickup.tooltip": "Grupos de inventário novos filtrarão itens pegos do chão por padrão.", + "config.chestseparators.category.server": "Servidor / Mecânicas", + "config.chestseparators.expel_invalid_items": "Expulsar Itens Inválidos", + "config.chestseparators.expel_invalid_items.tooltip": "Ao aplicar um novo filtro, itens inválidos serão movidos para o inventário ou soltos.", + "config.chestseparators.category.hotkeys": "Teclas de Atalho", + "config.chestseparators.toggle_preview_panel": "Alternar Painel de Visualização", + "config.chestseparators.toggle_preview_panel.tooltip": "Mostra/oculta rapidamente o painel esquerdo de visualização.", + "config.chestseparators.show_panel_modifier": "Modificador do Painel", + "config.chestseparators.show_panel_modifier.tooltip": "Segure esta tecla para forçar a exibição do painel esquerdo.", + "color.chestseparators.custom": "Cor Personalizada %s", + "button.chestseparators.import_search": "Importar Pesquisa", + "message.chestseparators.locked": "Outra pessoa já está editando este baú!", + "gui.chestseparators.expel_items_title": "Expulsar itens inválidos?", + "gui.chestseparators.expel_items_desc": "Alguns itens atualmente nestes espaços não correspondem às novas regras. Eles serão ejetados do baú.", + "button.chestseparators.accept_expel": "Aceitar e Expulsar", + "config.chestseparators.dark_mode": "Modo Escuro", + "config.chestseparators.dark_mode.tooltip": "Alterna entre temas claros e escuros na interface.", + "config.chestseparators.show_deposit_button": "Mostrar Botão de Depositar", + "message.chestseparators.deposit_button_visible": "Botão de Depositar: Visível", + "message.chestseparators.deposit_button_hidden": "Botão de Depositar: Oculto", + "key.chestseparators.toggle_magnifier": "Alternar lupa", + "key.chestseparators.toggle_edit_buttons": "Alternar barra de ferramentas", + "config.chestseparators.toggle_edit_buttons": "Alternar barra de ferramentas", + "config.chestseparators.toggle_edit_buttons.tooltip": "Mostra ou oculta toda a barra de ferramentas superior de uma vez.", + "config.chestseparators.toggle_magnifier": "Alternar lupa", + "config.chestseparators.magnifier_enabled": "Mostrar lupa", + "config.chestseparators.magnifier_enabled.tooltip": "Mostra uma lupa de zoom no cursor ao pintar separadores ou usar o conta-gotas.", + "config.chestseparators.magnifier_shape": "Forma da lupa", + "config.chestseparators.magnifier_shape.tooltip": "Se a lupa é redonda ou quadrada.", + "config.chestseparators.magnifier_shape.circle": "Círculo", + "config.chestseparators.magnifier_shape.square": "Quadrado", + "config.chestseparators.magnifier_tab_lines": "Lupa: Linhas", + "config.chestseparators.magnifier_tab_backgrounds": "Lupa: Fundos", + "config.chestseparators.magnifier_tab_combo": "Lupa: Modo Combinado", + "message.chestseparators.magnifier_on": "Lupa: Ligada", + "message.chestseparators.magnifier_off": "Lupa: Desligada", + "message.chestseparators.magnifier_hint": "Dica: pressione %s para uma lupa de zoom", + "message.chestseparators.tag_hint": "Dica: clique do meio em um item para ver suas tags", + "message.chestseparators.magnifier_hint_off": "Dica: aperte %s para remover a lupa de zoom", + "config.chestseparators.show_deposit_button.tooltip": "Mostra ou oculta o botão de depósito rápido na interface do baú.", + "tooltip.chestseparators.deposit_items": "Depositar nos Filtros\n§8[Shift + Clique] Depositar nos Filtros e Slots Vazios", + "message.chestseparators.deposited": "Foram depositados %s itens.", + "message.chestseparators.deposit_failed": "Nenhum slot válido encontrado para depositar itens.", + "config.chestseparators.close_on_click_outside": "Fechar ao clicar fora", + "config.chestseparators.close_on_click_outside.tooltip": "Fecha o menu ao clicar fora da interface.", + "config.chestseparators.shared_custom_colors": "Cores Personalizadas Compartilhadas", + "config.chestseparators.shared_custom_colors.tooltip": "Quando ativado, a coluna de cores personalizadas é compartilhada entre as abas Linhas, Fundos e Combo. Quando desativado, cada aba tem as suas.", + "title.chestseparators.config": "Configuração do Absolute Order", + "category.chestseparators.keys": "Absolute Order", + "key.category.chestseparators.keys": "Absolute Order", + "config.chestseparators.auto_deposit_enabled": "Depósito automático em baús próximos", + "config.chestseparators.auto_deposit_enabled.tooltip": "Organize todo o seu inventário nos baús filtrados próximos com um único gesto.", + "config.chestseparators.auto_deposit_double_sneak": "Gatilho: agachar duas vezes", + "config.chestseparators.auto_deposit_double_sneak.tooltip": "Toque duas vezes rapidamente a tecla de agachar para depositar automaticamente.", + "config.chestseparators.auto_deposit_radius": "Raio do depósito automático", + "config.chestseparators.auto_deposit_radius.tooltip": "Distância ao seu redor (em blocos) em que os baús são procurados.", + "config.chestseparators.auto_deposit_through_walls": "Depositar através de paredes", + "config.chestseparators.auto_deposit_through_walls.tooltip": "Permite depositar em baús bloqueados por blocos sólidos. Quando desligado, o caminho deve estar livre.", + "config.chestseparators.auto_deposit": "Depósito automático", + "key.chestseparators.auto_deposit": "Depósito automático em baús próximos", + "message.chestseparators.auto_deposit_done": "%s itens depositados automaticamente.", + "message.chestseparators.auto_deposit_none": "Nenhum baú filtrado próximo ao alcance.", + "message.chestseparators.auto_grab_done": "Pegos %s itens.", + "message.chestseparators.auto_grab_none": "Nada para pegar por perto.", + "message.chestseparators.preset_loaded": "Predefinição %s carregada.", + "message.chestseparators.preset_saved": "Predefinição %s salva.", + "message.chestseparators.preset_empty": "A predefinição %s está vazia.", + "config.chestseparators.auto_deposit_animation": "Animação de depósito", + "config.chestseparators.auto_deposit_animation.tooltip": "Mostra os itens 3D voando para cada baú. Quando desligado, os itens são depositados instantaneamente sem animação.", + "config.chestseparators.auto_deposit_trail": "Efeito de rastro", + "config.chestseparators.auto_deposit_trail.tooltip": "Deixa um rastro de partículas atrás de cada item que voa. Só se aplica quando a animação está ligada.", + "button.chestseparators.pickup_insert": "Pegar", + "tooltip.chestseparators.rule.pickup_active": "Ativo: filtra itens pegos do chão", + "tooltip.chestseparators.rule.pickup_inactive": "Inativo: itens pegos ignoram o filtro", + "tooltip.chestseparators.edit_inventory_toggle": "Editar inventário / baú", + "message.chestseparators.editing_inventory": "Editando: inventário", + "message.chestseparators.editing_chest": "Editando: baú", + "message.chestseparators.preset_deleted": "Predefinição %s excluída.", + "gui.chestseparators.preset_overwrite_title": "Sobrescrever a predefinição %s?", + "gui.chestseparators.preset_overwrite_body": "A predefinição salva será perdida.", + "gui.chestseparators.preset_page": "Página %s/%s", + "gui.chestseparators.preview_delete": "Será excluída", + "key.chestseparators.push": "Enviar aos Filtros do Baú", + "config.chestseparators.push": "Enviar aos Filtros do Baú", + "config.chestseparators.push.tooltip": "Envia os itens correspondentes aos filtros do baú aberto.\n§8Segure [Shift] para preencher também os espaços vazios", + "key.chestseparators.pull": "Trazer aos Filtros do Inventário", + "config.chestseparators.pull": "Trazer aos Filtros do Inventário", + "config.chestseparators.pull.tooltip": "Traz os itens do baú para os filtros do seu inventário.\n§8Segure [Shift] para trazer também itens sem filtro", + "config.chestseparators.lock_hotbar_on_reorder": "Travar a hotbar ao auto-ordenar", + "config.chestseparators.lock_hotbar_on_reorder.tooltip": "Quando um push ou pull reordena seu inventário, a hotbar fica intacta.", + "config.chestseparators.lock_hotbar_on_reorder.tooltip2": "Protege um item que você esteja segurando. Off: a hotbar também é ordenada.", + "message.chestseparators.push_no_filters": "Este baú ainda não tem filtros.", + "message.chestseparators.push_no_slot": "Sem espaço livre nos filtros.", + "message.chestseparators.pull_no_filters": "Seu inventário ainda não tem filtros.", + "message.chestseparators.pull_no_match": "Nada aqui combina com seus filtros." +} diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/lang/ru_ru.json b/multiloader-26.3/common/src/main/resources/assets/chestseparators/lang/ru_ru.json new file mode 100644 index 0000000..b6be1e8 --- /dev/null +++ b/multiloader-26.3/common/src/main/resources/assets/chestseparators/lang/ru_ru.json @@ -0,0 +1,257 @@ +{ + "tooltip.chestseparators.edit_mode": "Изменить макет", + "tooltip.chestseparators.whitelist_mode": "Управление фильтрами", + "itemGroup.chestseparators.chest_and_inventory": "Сундук и инвентарь", + "gui.chestseparators.search": "Поиск", + "button.chestseparators.copy_layout": "Копировать макет", + "message.chestseparators.layout_copied": "Макет скопирован!", + "tooltip.chestseparators.desc.copy_layout": "Копирует текущий макет в буфер обмена", + "button.chestseparators.paste_layout": "Вставить макет", + "message.chestseparators.layout_pasted": "Макет вставлен!", + "tooltip.chestseparators.desc.paste_layout": "Вставляет скопированный макет из буфера обмена", + "button.chestseparators.undo_action": "Отменить действие", + "tooltip.chestseparators.desc.undo_action": "Отменяет последнее нарисованное действие", + "button.chestseparators.redo_action": "Повторить действие", + "tooltip.chestseparators.desc.redo_action": "Восстанавливает ранее отмененное действие", + "tooltip.chestseparators.draw_area": "Нарисовать область", + "tooltip.chestseparators.erase_area": "Стереть область", + "tooltip.chestseparators.clear_lines": "Очистить линии", + "tooltip.chestseparators.clear_backgrounds": "Очистить фоны", + "tooltip.chestseparators.clear_both": "Очистить оба", + "message.chestseparators.cleared": "Очищено", + "tooltip.chestseparators.draw_trace": "Нарисовать линию", + "tooltip.chestseparators.erase_trace": "Стереть линию", + "tooltip.chestseparators.open_palette": "Открыть палитру", + "message.chestseparators.color_copied": "Цвет скопирован!", + "message.chestseparators.color_pasted": "Цвет вставлен!", + "tooltip.chestseparators.tab_lines": "Линии", + "tooltip.chestseparators.tab_backgrounds": "Фоны", + "tooltip.chestseparators.tab_combo": "Комбинированный режим", + "button.chestseparators.edit_filter": "Изменить фильтр", + "tooltip.chestseparators.desc.edit_filter": "Создать или изменить фильтр для выбранных слотов", + "button.chestseparators.delete_all_filters": "Удалить все фильтры", + "tooltip.chestseparators.desc.delete_all_filters": "Удаляет каждый фильтр в этом сундуке", + "message.chestseparators.all_filters_deleted": "Все фильтры удалены!", + "message.chestseparators.select_first": "Сначала выберите хотя бы один слот.", + "button.chestseparators.area_select": "Выделение области", + "tooltip.chestseparators.desc.area_select": "Выделяет слоты перетаскиванием прямоугольной области", + "button.chestseparators.trace_select": "Выделение линией", + "tooltip.chestseparators.desc.trace_select": "Выделяет слоты закрашиванием", + "button.chestseparators.clear_selection": "Очистить выделение", + "tooltip.chestseparators.desc.clear_selection": "Очистить все текущие выбранные слоты", + "button.chestseparators.copy_filters": "Копировать фильтры", + "message.chestseparators.filters_copied": "Фильтры скопированы!", + "tooltip.chestseparators.desc.copy_filters": "Копирует все фильтры из этого сундука в буфер обмена", + "button.chestseparators.paste_filters": "Вставить фильтры", + "message.chestseparators.filters_pasted": "Фильтры вставлены!", + "message.chestseparators.undone": "Отменено: %s", + "message.chestseparators.redone": "Повторено: %s", + "message.chestseparators.action.layout": "Макет", + "message.chestseparators.action.filter": "Фильтр", + "tooltip.chestseparators.desc.paste_filters": "Вставляет фильтры из буфера обмена в этот сундук", + "button.chestseparators.undo": "Отменить", + "tooltip.chestseparators.desc.undo": "Отменяет последнее действие с фильтром", + "button.chestseparators.redo": "Повторить", + "button.chestseparators.fill_inventory": "Заполнить инвентарь", + "button.chestseparators.preset_load": "Загрузить", + "button.chestseparators.preset_save": "Сохранить", + "tooltip.chestseparators.desc.redo": "Восстанавливает ранее отмененное действие", + "tooltip.chestseparators.desc.fill_inventory": "Перенести отфильтрованные предметы сюда (до цели)", + "tooltip.chestseparators.push_to_chest": "Отправить предметы в сундук\n§8Удерживайте [Shift] для пустых слотов", + "tooltip.chestseparators.push_to_chest.shift": "В сундук + пустые слоты", + "tooltip.chestseparators.pull_from_chest": "Забрать предметы из сундука\n§8[Shift] также заберёт нефильтрованные", + "tooltip.chestseparators.desc.presets": "Пресеты инвентаря: сохранение и загрузка раскладок и фильтров", + "tooltip.chestseparators.desc.chest_presets": "Пресеты сундука: сохранение и загрузка раскладок и фильтров сундука", + "button.chestseparators.conflict.overwrite": "Перезаписать существующие фильтры", + "tooltip.chestseparators.desc.conflict.overwrite": "Удаляет существующие фильтры в выделении и создает новый", + "button.chestseparators.conflict.deselect": "Снять выделение с конфликтов и продолжить", + "message.chestseparators.empty_selection": "Пустое выделение.", + "tooltip.chestseparators.desc.conflict.deselect": "Оставляет существующие фильтры нетронутыми и применяется только к пустым слотам", + "button.chestseparators.cancel": "Отмена", + "tooltip.chestseparators.desc.conflict.cancel": "Прервать создание фильтра", + "button.chestseparators.confirm": "Подтвердить", + "gui.chestseparators.conflict_title": "Конфликт выделения!", + "gui.chestseparators.presets_title": "Пресеты инвентаря", + "gui.chestseparators.chest_presets_title": "Пресеты сундука", + "gui.chestseparators.preview_layout": "Раскладка", + "gui.chestseparators.preview_filters": "Фильтры", + "gui.chestseparators.preset_slot": "Пресет %s", + "gui.chestseparators.preset.building": "Строительство", + "gui.chestseparators.preset.mining": "Добыча", + "gui.chestseparators.preset.food": "Еда и ферма", + "gui.chestseparators.preset.redstone": "Редстоун", + "gui.chestseparators.preset.combat": "Бой", + "gui.chestseparators.preset.inv_miner": "Шахтёр", + "gui.chestseparators.preset.inv_builder": "Строитель", + "gui.chestseparators.preset.inv_explorer": "Исследователь", + "gui.chestseparators.preset.inv_farmer": "Фермер", + "gui.chestseparators.preset.inv_nether_end": "Незер и Энд", + "gui.chestseparators.conflict_desc": "Некоторые выбранные слоты уже имеют фильтр.", + "gui.chestseparators.group_filter": "Фильтр группы", + "gui.chestseparators.no_filter": "Без фильтра", + "gui.chestseparators.items_count": "Предметы: %s", + "gui.chestseparators.hover_group": "Наведите курсор на группу...", + "gui.chestseparators.empty_whitelist": "Белый список пуст.", + "button.chestseparators.save_and_exit": "Сохранить и выйти", + "button.chestseparators.discard_changes": "Отменить изменения", + "button.chestseparators.import_extracted": "Импорт извлеченных", + "message.chestseparators.items_already_in_filter": "Предметы уже в фильтре.", + "message.chestseparators.no_new_items_found": "Новые предметы не найдены.", + "tooltip.chestseparators.desc.import_extracted": "Добавляет в фильтр предметы из выбранных ячеек.", + "tooltip.chestseparators.desc.import_search": "Импорт поиска", + "button.chestseparators.allow_all": "Разрешить все", + "tooltip.chestseparators.desc.allow_all": "Добавляет все предметы в белый список", + "button.chestseparators.clear_all": "Очистить все", + "tooltip.chestseparators.desc.clear_all": "Очищает текущий белый список", + "button.chestseparators.manual_insert": "Ручная вставка", + "tooltip.chestseparators.rule.manual_active": "Активно: Фильтрует ручные клики", + "tooltip.chestseparators.rule.manual_inactive": "Неактивно: Ручные клики игнорируют фильтр", + "button.chestseparators.shift_insert": "Вставка через Shift", + "tooltip.chestseparators.rule.shift_active": "Активно: Фильтрует клики с Shift", + "tooltip.chestseparators.rule.shift_inactive": "Неактивно: Клики с Shift игнорируют фильтр", + "button.chestseparators.hopper_insert": "Вставка воронкой", + "tooltip.chestseparators.rule.hopper_active": "Активно: Фильтрует перемещения воронкой", + "tooltip.chestseparators.rule.hopper_inactive": "Неактивно: Воронки игнорируют фильтр", + "button.chestseparators.delete": "Удалить", + "tooltip.chestseparators.desc.delete_group": "Удаляет эту группу фильтров", + "button.chestseparators.save": "Сохранить", + "tooltip.chestseparators.desc.save": "Сохраняет изменения", + "tooltip.chestseparators.desc.cancel": "Отменяет изменения", + "gui.chestseparators.unsaved_changes_title": "Несохраненные изменения", + "gui.chestseparators.unsaved_changes_desc": "В этом фильтре есть несохраненные изменения.", + "gui.chestseparators.new_detected": "Обнаружено новых: %s", + "gui.chestseparators.allowing_all": "Разрешено всем: %s", + "gui.chestseparators.clearing": "Очистка: %s", + "gui.chestseparators.allowed": "Разрешено: %s", + "gui.chestseparators.blocked": "Заблокировано: %s", + "gui.chestseparators.edit_filter_rules": "Изменить правила фильтра", + "message.chestseparators.no_valid_groups": "Нет допустимых групп.", + "button.chestseparators.eyedropper": "Пипетка", + "tooltip.chestseparators.desc.eyedropper": "Взять цвет прямо с экрана", + "button.chestseparators.exit": "Выход", + "tooltip.chestseparators.desc.exit": "Сохранить изменения и закрыть палитру", + "gui.chestseparators.hex": "Hex", + "gui.chestseparators.color_r": "R", + "gui.chestseparators.color_g": "G", + "gui.chestseparators.color_b": "B", + "gui.chestseparators.color_picker.instructions": "Нажмите колесико, чтобы скопировать. ЛКМ по слоту, чтобы вставить.", + "window.chestseparators.edit_color": "Изменить цвет", + "message.chestseparators.edit_buttons_visible": "Кнопки редактора: Видимы", + "message.chestseparators.edit_buttons_hidden": "Кнопки редактора: Скрыты", + "message.chestseparators.preview_panel_visible": "Панель предпросмотра: Видима", + "message.chestseparators.preview_panel_hidden": "Панель предпросмотра: Скрыта", + "modmenu.descriptionTranslation.chestseparators": "Быстро очищайте инвентарь с помощью настраиваемого автодепозита. Игра наконец-то знает, чего вы действительно хотите и где.", + "config.chestseparators.category.client": "Клиент / Визуал", + "config.chestseparators.show_left_panel": "Показывать левую панель", + "config.chestseparators.show_left_panel.tooltip": "Показывает панель предпросмотра белого списка. Зажмите клавишу-модификатор, чтобы принудительно открыть.", + "config.chestseparators.enable_preview_animation": "Анимация предпросмотра", + "config.chestseparators.enable_preview_animation.tooltip": "Автоматически прокручивает список предметов в панели предпросмотра.", + "config.chestseparators.show_edit_buttons": "Кнопки редактора", + "config.chestseparators.show_edit_buttons.tooltip": "Отображает кнопки инструментов внутри сундука.", + "config.chestseparators.bg_transparency": "Прозрачность фона", + "config.chestseparators.bg_transparency.tooltip": "Уровень непрозрачности фона слотов (0 = Невидимый, 100 = Сплошной).", + "config.chestseparators.line_transparency": "Прозрачность линий", + "config.chestseparators.line_transparency.tooltip": "Уровень непрозрачности разделительных линий (0 = Невидимые, 100 = Сплошные).", + "config.chestseparators.default_rule_manual": "Правило по ум.: Вручную", + "config.chestseparators.default_rule_manual.tooltip": "Новые группы будут разрешать ручные клики по умолчанию.", + "config.chestseparators.default_rule_shift": "Правило по ум.: Shift", + "config.chestseparators.default_rule_shift.tooltip": "Новые группы будут разрешать клики с Shift по умолчанию.", + "config.chestseparators.default_rule_hopper": "Правило по ум.: Воронка", + "config.chestseparators.default_rule_hopper.tooltip": "Новые группы будут разрешать воронки по умолчанию.", + "config.chestseparators.default_rule_pickup": "Правило по ум.: Подбор", + "config.chestseparators.default_rule_pickup.tooltip": "Новые группы инвентаря будут фильтровать подобранные предметы по умолчанию.", + "config.chestseparators.category.server": "Сервер / Механики", + "config.chestseparators.expel_invalid_items": "Выбрасывать неверные предметы", + "config.chestseparators.expel_invalid_items.tooltip": "При применении фильтра неверные предметы переместятся в инвентарь или выпадут.", + "config.chestseparators.category.hotkeys": "Горячие клавиши", + "config.chestseparators.toggle_preview_panel": "Левая панель (вкл/выкл)", + "config.chestseparators.toggle_preview_panel.tooltip": "Быстро показать/скрыть панель предпросмотра.", + "config.chestseparators.show_panel_modifier": "Модификатор панели", + "config.chestseparators.show_panel_modifier.tooltip": "Зажмите эту клавишу, чтобы принудительно открыть левую панель.", + "color.chestseparators.custom": "Пользовательский цвет %s", + "button.chestseparators.import_search": "Импортировать поиск", + "message.chestseparators.locked": "Кто-то другой уже редактирует этот сундук!", + "gui.chestseparators.expel_items_title": "Выбросить недопустимые предметы?", + "gui.chestseparators.expel_items_desc": "Некоторые предметы в этих слотах не соответствуют новым правилам. Они будут выброшены из сундука.", + "button.chestseparators.accept_expel": "Принять и Выбросить", + "config.chestseparators.dark_mode": "Тёмный режим", + "config.chestseparators.dark_mode.tooltip": "Переключение между тёмной и светлой темами интерфейса.", + "config.chestseparators.show_deposit_button": "Показывать кнопку склада", + "message.chestseparators.deposit_button_visible": "Кнопка склада: Видима", + "message.chestseparators.deposit_button_hidden": "Кнопка склада: Скрыта", + "key.chestseparators.toggle_magnifier": "Переключить лупу", + "key.chestseparators.toggle_edit_buttons": "Переключить панель кнопок", + "config.chestseparators.toggle_edit_buttons": "Переключить панель кнопок", + "config.chestseparators.toggle_edit_buttons.tooltip": "Показать или скрыть всю верхнюю панель кнопок сразу.", + "config.chestseparators.toggle_magnifier": "Переключить лупу", + "config.chestseparators.magnifier_enabled": "Показывать лупу", + "config.chestseparators.magnifier_enabled.tooltip": "Показывает лупу у курсора при рисовании разделителей или использовании пипетки.", + "config.chestseparators.magnifier_shape": "Форма лупы", + "config.chestseparators.magnifier_shape.tooltip": "Круглая лупа или квадратная.", + "config.chestseparators.magnifier_shape.circle": "Круг", + "config.chestseparators.magnifier_shape.square": "Квадрат", + "config.chestseparators.magnifier_tab_lines": "Лупа: Линии", + "config.chestseparators.magnifier_tab_backgrounds": "Лупа: Фоны", + "config.chestseparators.magnifier_tab_combo": "Лупа: Комбинированный режим", + "message.chestseparators.magnifier_on": "Лупа: Вкл", + "message.chestseparators.magnifier_off": "Лупа: Выкл", + "message.chestseparators.magnifier_hint": "Совет: нажмите %s для лупы", + "message.chestseparators.tag_hint": "Совет: щёлкните колёсиком по предмету, чтобы увидеть его теги", + "message.chestseparators.magnifier_hint_off": "Совет: нажмите %s, чтобы убрать лупу", + "config.chestseparators.show_deposit_button.tooltip": "Показывает или скрывает кнопку быстрого складирования в интерфейсе сундука.", + "tooltip.chestseparators.deposit_items": "Сложить в фильтры\n§8[Shift + Клик] Сложить в фильтры и пустые слоты", + "message.chestseparators.deposited": "Сложено %s предметов.", + "message.chestseparators.deposit_failed": "Не найдено подходящих слотов для складирования.", + "config.chestseparators.close_on_click_outside": "Закрывать по клику вне окна", + "config.chestseparators.close_on_click_outside.tooltip": "Закрывает меню при клике за пределами интерфейса.", + "config.chestseparators.shared_custom_colors": "Общие пользовательские цвета", + "config.chestseparators.shared_custom_colors.tooltip": "Если включено, столбец пользовательских цветов общий для вкладок «Линии», «Фоны» и «Комбо». Если выключено, у каждой вкладки свои.", + "title.chestseparators.config": "Настройки Absolute Order", + "category.chestseparators.keys": "Absolute Order", + "key.category.chestseparators.keys": "Absolute Order", + "config.chestseparators.auto_deposit_enabled": "Авто-складирование в ближайшие сундуки", + "config.chestseparators.auto_deposit_enabled.tooltip": "Разложите весь инвентарь по ближайшим сундукам с фильтрами одним действием.", + "config.chestseparators.auto_deposit_double_sneak": "Триггер: двойное приседание", + "config.chestseparators.auto_deposit_double_sneak.tooltip": "Быстро нажмите клавишу приседания дважды для авто-складирования.", + "config.chestseparators.auto_deposit_radius": "Радиус авто-складирования", + "config.chestseparators.auto_deposit_radius.tooltip": "Как далеко вокруг вас (в блоках) ищутся сундуки.", + "config.chestseparators.auto_deposit_through_walls": "Складировать сквозь стены", + "config.chestseparators.auto_deposit_through_walls.tooltip": "Разрешает складирование в сундуки за сплошными блоками. Когда выключено, путь должен быть свободен.", + "config.chestseparators.auto_deposit": "Авто-складирование", + "key.chestseparators.auto_deposit": "Авто-складирование в ближайшие сундуки", + "message.chestseparators.auto_deposit_done": "Авто-сложено предметов: %s.", + "message.chestseparators.auto_deposit_none": "Поблизости нет сундуков с фильтрами в пределах досягаемости.", + "message.chestseparators.auto_grab_done": "Забрано предметов: %s.", + "message.chestseparators.auto_grab_none": "Рядом нечего забирать.", + "message.chestseparators.preset_loaded": "Пресет %s загружен.", + "message.chestseparators.preset_saved": "Пресет %s сохранён.", + "message.chestseparators.preset_empty": "Пресет %s пуст.", + "config.chestseparators.auto_deposit_animation": "Анимация складирования", + "config.chestseparators.auto_deposit_animation.tooltip": "Показывает 3D-предметы, летящие к каждому сундуку. Когда выключено, предметы складываются мгновенно без анимации.", + "config.chestseparators.auto_deposit_trail": "Эффект следа", + "config.chestseparators.auto_deposit_trail.tooltip": "Оставляет след из частиц за каждым летящим предметом. Действует только при включённой анимации.", + "button.chestseparators.pickup_insert": "Подбор", + "tooltip.chestseparators.rule.pickup_active": "Активно: фильтрует подобранные предметы", + "tooltip.chestseparators.rule.pickup_inactive": "Неактивно: подобранные предметы игнорируют фильтр", + "tooltip.chestseparators.edit_inventory_toggle": "Редактировать инвентарь / сундук", + "message.chestseparators.editing_inventory": "Редактирование: инвентарь", + "message.chestseparators.editing_chest": "Редактирование: сундук", + "message.chestseparators.preset_deleted": "Пресет %s удалён.", + "gui.chestseparators.preset_overwrite_title": "Перезаписать пресет %s?", + "gui.chestseparators.preset_overwrite_body": "Сохранённый пресет будет потерян.", + "gui.chestseparators.preset_page": "Страница %s/%s", + "gui.chestseparators.preview_delete": "Будет удалён", + "key.chestseparators.push": "Отправить в фильтры сундука", + "config.chestseparators.push": "Отправить в фильтры сундука", + "config.chestseparators.push.tooltip": "Отправляет подходящие предметы в фильтры открытого сундука.\n§8Удерживайте [Shift], чтобы заполнить и пустые ячейки", + "key.chestseparators.pull": "Забрать в фильтры инвентаря", + "config.chestseparators.pull": "Забрать в фильтры инвентаря", + "config.chestseparators.pull.tooltip": "Забирает предметы сундука в фильтры вашего инвентаря.\n§8Удерживайте [Shift], чтобы забрать и нефильтрованные предметы", + "config.chestseparators.lock_hotbar_on_reorder": "Блокировать хотбар при сортировке", + "config.chestseparators.lock_hotbar_on_reorder.tooltip": "Когда push или pull сортирует инвентарь, хотбар остаётся нетронутым.", + "config.chestseparators.lock_hotbar_on_reorder.tooltip2": "Защищает предмет в руке. Выкл.: хотбар тоже сортируется.", + "message.chestseparators.push_no_filters": "У этого сундука ещё нет фильтров.", + "message.chestseparators.push_no_slot": "Нет свободного слота фильтра.", + "message.chestseparators.pull_no_filters": "В инвентаре ещё нет фильтров.", + "message.chestseparators.pull_no_match": "Здесь ничего не подходит под фильтры." +} diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/lang/sv_se.json b/multiloader-26.3/common/src/main/resources/assets/chestseparators/lang/sv_se.json new file mode 100644 index 0000000..4b8c875 --- /dev/null +++ b/multiloader-26.3/common/src/main/resources/assets/chestseparators/lang/sv_se.json @@ -0,0 +1,257 @@ +{ + "tooltip.chestseparators.edit_mode": "Redigera layout", + "tooltip.chestseparators.whitelist_mode": "Hantera filter", + "itemGroup.chestseparators.chest_and_inventory": "Kista & inventarie", + "gui.chestseparators.search": "Sök", + "button.chestseparators.copy_layout": "Kopiera layout", + "message.chestseparators.layout_copied": "Layout kopierad!", + "tooltip.chestseparators.desc.copy_layout": "Kopierar den aktuella layouten till urklipp", + "button.chestseparators.paste_layout": "Klistra in layout", + "message.chestseparators.layout_pasted": "Layout inklistrad!", + "tooltip.chestseparators.desc.paste_layout": "Klistrar in den kopierade layouten från urklipp", + "button.chestseparators.undo_action": "Ångra åtgärd", + "tooltip.chestseparators.desc.undo_action": "Ångrar den senast ritade åtgärden", + "button.chestseparators.redo_action": "Gör om åtgärd", + "tooltip.chestseparators.desc.redo_action": "Återställer den tidigare ångrade åtgärden", + "tooltip.chestseparators.draw_area": "Rita område", + "tooltip.chestseparators.erase_area": "Sudda område", + "tooltip.chestseparators.clear_lines": "Rensa linjer", + "tooltip.chestseparators.clear_backgrounds": "Rensa bakgrunder", + "tooltip.chestseparators.clear_both": "Rensa båda", + "message.chestseparators.cleared": "Rensat", + "tooltip.chestseparators.draw_trace": "Rita linje", + "tooltip.chestseparators.erase_trace": "Sudda linje", + "tooltip.chestseparators.open_palette": "Öppna palett", + "message.chestseparators.color_copied": "Färg kopierad!", + "message.chestseparators.color_pasted": "Färg inklistrad!", + "tooltip.chestseparators.tab_lines": "Linjer", + "tooltip.chestseparators.tab_backgrounds": "Bakgrunder", + "tooltip.chestseparators.tab_combo": "Kombinerat läge", + "button.chestseparators.edit_filter": "Redigera filter", + "tooltip.chestseparators.desc.edit_filter": "Skapa eller redigera ett filter för de valda platserna", + "button.chestseparators.delete_all_filters": "Ta bort alla filter", + "tooltip.chestseparators.desc.delete_all_filters": "Tar bort alla filter i denna kista", + "message.chestseparators.all_filters_deleted": "Alla filter borttagna!", + "message.chestseparators.select_first": "Välj minst en plats först.", + "button.chestseparators.area_select": "Områdesval", + "tooltip.chestseparators.desc.area_select": "Välj platser genom att dra ett rektangulärt område", + "button.chestseparators.trace_select": "Linjeval", + "tooltip.chestseparators.desc.trace_select": "Välj platser genom att måla över dem", + "button.chestseparators.clear_selection": "Rensa markering", + "tooltip.chestseparators.desc.clear_selection": "Rensa alla nuvarande markerade platser", + "button.chestseparators.copy_filters": "Kopiera filter", + "message.chestseparators.filters_copied": "Filter kopierade!", + "tooltip.chestseparators.desc.copy_filters": "Kopiera alla filter från denna kista till urklipp", + "button.chestseparators.paste_filters": "Klistra in filter", + "message.chestseparators.filters_pasted": "Filter inklistrade!", + "message.chestseparators.undone": "Ångrade: %s", + "message.chestseparators.redone": "Gjorde om: %s", + "message.chestseparators.action.layout": "Layout", + "message.chestseparators.action.filter": "Filter", + "tooltip.chestseparators.desc.paste_filters": "Klistra in filter från urklipp till denna kista", + "button.chestseparators.undo": "Ångra", + "tooltip.chestseparators.desc.undo": "Ångrar den senaste filteråtgärden", + "button.chestseparators.redo": "Gör om", + "button.chestseparators.fill_inventory": "Fyll inventarie", + "button.chestseparators.preset_load": "Ladda", + "button.chestseparators.preset_save": "Spara", + "tooltip.chestseparators.desc.redo": "Återställer den tidigare ångrade åtgärden", + "tooltip.chestseparators.desc.fill_inventory": "Hämta filtrerade föremål hit (upp till mål)", + "tooltip.chestseparators.push_to_chest": "Skicka föremål till kista\n§8Håll [Shift] för tomma platser", + "tooltip.chestseparators.push_to_chest.shift": "Till kista + tomma platser", + "tooltip.chestseparators.pull_from_chest": "Hämta föremål från kista\n§8[Shift] hämtar även ofiltrerade", + "tooltip.chestseparators.desc.presets": "Inventarie-förinställningar: spara och ladda layouter och filter", + "tooltip.chestseparators.desc.chest_presets": "Kist-förinställningar: spara och ladda kistlayouter och filter", + "button.chestseparators.conflict.overwrite": "Skriv över befintliga filter", + "tooltip.chestseparators.desc.conflict.overwrite": "Tar bort befintliga filter i markeringen och skapar ett nytt", + "button.chestseparators.conflict.deselect": "Avmarkera konflikter och fortsätt", + "message.chestseparators.empty_selection": "Tom markering.", + "tooltip.chestseparators.desc.conflict.deselect": "Behåller befintliga filter och tillämpar endast på tomma platser", + "button.chestseparators.cancel": "Avbryt", + "tooltip.chestseparators.desc.conflict.cancel": "Avbryt filter skapande", + "button.chestseparators.confirm": "Bekräfta", + "gui.chestseparators.conflict_title": "Markeringskonflikt!", + "gui.chestseparators.presets_title": "Inventarie-förinställningar", + "gui.chestseparators.chest_presets_title": "Kist-förinställningar", + "gui.chestseparators.preview_layout": "Layout", + "gui.chestseparators.preview_filters": "Filter", + "gui.chestseparators.preset_slot": "Förinst. %s", + "gui.chestseparators.preset.building": "Bygge", + "gui.chestseparators.preset.mining": "Gruvdrift", + "gui.chestseparators.preset.food": "Mat & gård", + "gui.chestseparators.preset.redstone": "Redstone", + "gui.chestseparators.preset.combat": "Strid", + "gui.chestseparators.preset.inv_miner": "Gruvarbetare", + "gui.chestseparators.preset.inv_builder": "Byggare", + "gui.chestseparators.preset.inv_explorer": "Utforskare", + "gui.chestseparators.preset.inv_farmer": "Bonde", + "gui.chestseparators.preset.inv_nether_end": "Nether & End", + "gui.chestseparators.conflict_desc": "Vissa valda platser har redan ett filter.", + "gui.chestseparators.group_filter": "Gruppfilter", + "gui.chestseparators.no_filter": "Inget filter", + "gui.chestseparators.items_count": "Föremål: %s", + "gui.chestseparators.hover_group": "För musen över en grupp...", + "gui.chestseparators.empty_whitelist": "Tom vitlista.", + "button.chestseparators.save_and_exit": "Spara och avsluta", + "button.chestseparators.discard_changes": "Släng ändringar", + "button.chestseparators.import_extracted": "Importera extraherade", + "message.chestseparators.items_already_in_filter": "Föremålen är redan i filtret.", + "message.chestseparators.no_new_items_found": "Inga nya föremål hittades.", + "tooltip.chestseparators.desc.import_extracted": "Lägger till föremålen i de valda platserna i filtret.", + "tooltip.chestseparators.desc.import_search": "Importera sökning", + "button.chestseparators.allow_all": "Tillåt alla", + "tooltip.chestseparators.desc.allow_all": "Vitlistar alla spelföremål", + "button.chestseparators.clear_all": "Rensa alla", + "tooltip.chestseparators.desc.clear_all": "Rensar den nuvarande vitlistan", + "button.chestseparators.manual_insert": "Manuell insättning", + "tooltip.chestseparators.rule.manual_active": "Aktiv: Filtrerar manuella klick", + "tooltip.chestseparators.rule.manual_inactive": "Inaktiv: Manuella klick ignorerar filtret", + "button.chestseparators.shift_insert": "Shift-insättning", + "tooltip.chestseparators.rule.shift_active": "Aktiv: Filtrerar Shift-klick", + "tooltip.chestseparators.rule.shift_inactive": "Inaktiv: Shift-klick ignorerar filtret", + "button.chestseparators.hopper_insert": "Trattinsättning", + "tooltip.chestseparators.rule.hopper_active": "Aktiv: Filtrerar trattöverföringar", + "tooltip.chestseparators.rule.hopper_inactive": "Inaktiv: Trattar ignorerar filtret", + "button.chestseparators.delete": "Ta bort", + "tooltip.chestseparators.desc.delete_group": "Tar bort denna filtergrupp", + "button.chestseparators.save": "Spara", + "tooltip.chestseparators.desc.save": "Sparar ändringar", + "tooltip.chestseparators.desc.cancel": "Slänger ändringar", + "gui.chestseparators.unsaved_changes_title": "Osparade ändringar", + "gui.chestseparators.unsaved_changes_desc": "Du har osparade ändringar i detta filter.", + "gui.chestseparators.new_detected": "Nyupptäckt: %s", + "gui.chestseparators.allowing_all": "Tillåter alla: %s", + "gui.chestseparators.clearing": "Rensar: %s", + "gui.chestseparators.allowed": "Tillåtet: %s", + "gui.chestseparators.blocked": "Blockerat: %s", + "gui.chestseparators.edit_filter_rules": "Redigera filterregler", + "message.chestseparators.no_valid_groups": "Inga giltiga grupper.", + "button.chestseparators.eyedropper": "Pipett", + "tooltip.chestseparators.desc.eyedropper": "Välj en färg direkt från skärmen", + "button.chestseparators.exit": "Avsluta", + "tooltip.chestseparators.desc.exit": "Spara ändringar och stäng färgväljaren", + "gui.chestseparators.hex": "Hex", + "gui.chestseparators.color_r": "R", + "gui.chestseparators.color_g": "G", + "gui.chestseparators.color_b": "B", + "gui.chestseparators.color_picker.instructions": "Mittenklicka för att kopiera. Vänsterklicka på en plats för att klistra in.", + "window.chestseparators.edit_color": "Redigera anpassad färg", + "message.chestseparators.edit_buttons_visible": "Redigeringsknappar: Synliga", + "message.chestseparators.edit_buttons_hidden": "Redigeringsknappar: Dolda", + "message.chestseparators.preview_panel_visible": "Förhandsgranskningspanel: Synlig", + "message.chestseparators.preview_panel_hidden": "Förhandsgranskningspanel: Dold", + "modmenu.descriptionTranslation.chestseparators": "Töm lagret snabbt med anpassad automatisk insättning. Spelet vet äntligen exakt vad du verkligen vill ha och var du vill ha det.", + "config.chestseparators.category.client": "Klient / Visuellt", + "config.chestseparators.show_left_panel": "Visa vänster panel", + "config.chestseparators.show_left_panel.tooltip": "Visar vitlistans förhandsgranskningspanel. Håll modifieringstangenten för att tvinga.", + "config.chestseparators.enable_preview_animation": "Aktivera förhandsgranskningsanimation", + "config.chestseparators.enable_preview_animation.tooltip": "Skrollar automatiskt föremålslistan i förhandsgranskningspanelen.", + "config.chestseparators.show_edit_buttons": "Visa redigeringsknappar", + "config.chestseparators.show_edit_buttons.tooltip": "Visar verktygsknapparna inuti kistan.", + "config.chestseparators.bg_transparency": "Bakgrundens transparens", + "config.chestseparators.bg_transparency.tooltip": "Opacitetsnivå för bakgrundsfärger (0 = Osynlig, 100 = Solid).", + "config.chestseparators.line_transparency": "Linjernas transparens", + "config.chestseparators.line_transparency.tooltip": "Opacitetsnivå för separeringslinjerna (0 = Osynlig, 100 = Solid).", + "config.chestseparators.default_rule_manual": "Standardregel: Manuell", + "config.chestseparators.default_rule_manual.tooltip": "Nyskapade grupper tillåter manuella klick som standard.", + "config.chestseparators.default_rule_shift": "Standardregel: Shift", + "config.chestseparators.default_rule_shift.tooltip": "Nyskapade grupper tillåter Shift-klick som standard.", + "config.chestseparators.default_rule_hopper": "Standardregel: Tratt", + "config.chestseparators.default_rule_hopper.tooltip": "Nyskapade grupper tillåter trattinsättning som standard.", + "config.chestseparators.default_rule_pickup": "Standardregel: Plocka upp", + "config.chestseparators.default_rule_pickup.tooltip": "Nyskapade inventariegrupper filtrerar upplockade föremål som standard.", + "config.chestseparators.category.server": "Server / Mekanik", + "config.chestseparators.expel_invalid_items": "Kasta ut ogiltiga föremål", + "config.chestseparators.expel_invalid_items.tooltip": "När ett nytt filter appliceras skjuts befintliga ogiltiga föremål till spelarens inventarie eller tappas.", + "config.chestseparators.category.hotkeys": "Snabbtangenter", + "config.chestseparators.toggle_preview_panel": "Växla förhandsgranskningspanel", + "config.chestseparators.toggle_preview_panel.tooltip": "Visa/dölj snabbt den vänstra förhandsgranskningspanelen.", + "config.chestseparators.show_panel_modifier": "Modifierare för panel", + "config.chestseparators.show_panel_modifier.tooltip": "Håll denna tangent för att tvinga vänster panel att visas om den är inaktiverad.", + "color.chestseparators.custom": "Anpassad färg %s", + "button.chestseparators.import_search": "Importera sökning", + "message.chestseparators.locked": "Någon annan redigerar redan denna kista!", + "gui.chestseparators.expel_items_title": "Mata ut ogiltiga föremål?", + "gui.chestseparators.expel_items_desc": "Vissa föremål i dessa fack stämmer inte överens med de nya reglerna. De kommer att matas ut från kistan.", + "button.chestseparators.accept_expel": "Acceptera & Mata ut", + "config.chestseparators.dark_mode": "Mörkt Läge", + "config.chestseparators.dark_mode.tooltip": "Växla mellan mörkt och ljust gränssnittstema.", + "config.chestseparators.show_deposit_button": "Visa Insättningsknapp", + "message.chestseparators.deposit_button_visible": "Insättningsknapp: Synlig", + "message.chestseparators.deposit_button_hidden": "Insättningsknapp: Dold", + "key.chestseparators.toggle_magnifier": "Växla förstoringsglas", + "key.chestseparators.toggle_edit_buttons": "Växla verktygsfält", + "config.chestseparators.toggle_edit_buttons": "Växla verktygsfält", + "config.chestseparators.toggle_edit_buttons.tooltip": "Visar eller döljer hela det övre verktygsfältet på en gång.", + "config.chestseparators.toggle_magnifier": "Växla förstoringsglas", + "config.chestseparators.magnifier_enabled": "Visa förstoringsglas", + "config.chestseparators.magnifier_enabled.tooltip": "Visar ett förstoringsglas vid markören när du målar avdelare eller använder pipetten.", + "config.chestseparators.magnifier_shape": "Förstoringsglasets form", + "config.chestseparators.magnifier_shape.tooltip": "Om förstoringsglaset är runt eller fyrkantigt.", + "config.chestseparators.magnifier_shape.circle": "Cirkel", + "config.chestseparators.magnifier_shape.square": "Fyrkant", + "config.chestseparators.magnifier_tab_lines": "Förstoringsglas: Linjer", + "config.chestseparators.magnifier_tab_backgrounds": "Förstoringsglas: Bakgrunder", + "config.chestseparators.magnifier_tab_combo": "Förstoringsglas: Kombinerat läge", + "message.chestseparators.magnifier_on": "Förstoringsglas: På", + "message.chestseparators.magnifier_off": "Förstoringsglas: Av", + "message.chestseparators.magnifier_hint": "Tips: tryck %s för ett förstoringsglas", + "message.chestseparators.tag_hint": "Tips: mittklicka på ett föremål för att se dess taggar", + "message.chestseparators.magnifier_hint_off": "Tips: tryck %s för att dölja luppen", + "config.chestseparators.show_deposit_button.tooltip": "Visar eller döljer snabbinsättningsknappen i kistans gränssnitt.", + "tooltip.chestseparators.deposit_items": "Sätt in i Filter\n§8[Shift + Klick] Sätt in i Filter & Tomma Fack", + "message.chestseparators.deposited": "Satte in %s föremål.", + "message.chestseparators.deposit_failed": "Inga giltiga fack hittades för insättning.", + "config.chestseparators.close_on_click_outside": "Stäng vid klick utanför", + "config.chestseparators.close_on_click_outside.tooltip": "Stänger menyn när du klickar utanför gränssnittet.", + "config.chestseparators.shared_custom_colors": "Delade Anpassade Färger", + "config.chestseparators.shared_custom_colors.tooltip": "När aktiverat delas kolumnen med anpassade färger mellan flikarna Linjer, Bakgrunder och Kombo. När inaktiverat har varje flik egna.", + "title.chestseparators.config": "Absolute Order-konfiguration", + "category.chestseparators.keys": "Absolute Order", + "key.category.chestseparators.keys": "Absolute Order", + "config.chestseparators.auto_deposit_enabled": "Auto-insättning i närliggande kistor", + "config.chestseparators.auto_deposit_enabled.tooltip": "Sortera hela ditt inventarium till närliggande filtrerade kistor med en enda utlösare.", + "config.chestseparators.auto_deposit_double_sneak": "Utlösare: dubbelsmyg", + "config.chestseparators.auto_deposit_double_sneak.tooltip": "Tryck snabbt två gånger på smygtangenten för att auto-sätta in.", + "config.chestseparators.auto_deposit_radius": "Auto-insättningsradie", + "config.chestseparators.auto_deposit_radius.tooltip": "Hur långt runt dig (i block) kistor söks.", + "config.chestseparators.auto_deposit_through_walls": "Sätt in genom väggar", + "config.chestseparators.auto_deposit_through_walls.tooltip": "Tillåter insättning i kistor som blockeras av fasta block. När av måste vägen vara fri.", + "config.chestseparators.auto_deposit": "Auto-insättning", + "key.chestseparators.auto_deposit": "Auto-insättning i närliggande kistor", + "message.chestseparators.auto_deposit_done": "Auto-insatte %s föremål.", + "message.chestseparators.auto_deposit_none": "Inga närliggande filtrerade kistor inom räckhåll.", + "message.chestseparators.auto_grab_done": "Hämtade %s föremål.", + "message.chestseparators.auto_grab_none": "Inget att hämta i närheten.", + "message.chestseparators.preset_loaded": "Förinställning %s laddad.", + "message.chestseparators.preset_saved": "Förinställning %s sparad.", + "message.chestseparators.preset_empty": "Förinställning %s är tom.", + "config.chestseparators.auto_deposit_animation": "Insättningsanimation", + "config.chestseparators.auto_deposit_animation.tooltip": "Visar 3D-föremålen som flyger till varje kista. När av sätts föremål in direkt utan animation.", + "config.chestseparators.auto_deposit_trail": "Svanseffekt", + "config.chestseparators.auto_deposit_trail.tooltip": "Lämnar ett partikelspår efter varje flygande föremål. Gäller endast när animationen är på.", + "button.chestseparators.pickup_insert": "Plocka upp", + "tooltip.chestseparators.rule.pickup_active": "Aktiv: filtrerar upplockade föremål", + "tooltip.chestseparators.rule.pickup_inactive": "Inaktiv: upplockade föremål ignorerar filtret", + "tooltip.chestseparators.edit_inventory_toggle": "Redigera inventarium / kista", + "message.chestseparators.editing_inventory": "Redigerar: inventarium", + "message.chestseparators.editing_chest": "Redigerar: kista", + "message.chestseparators.preset_deleted": "Förinställning %s borttagen.", + "gui.chestseparators.preset_overwrite_title": "Skriva över förinställning %s?", + "gui.chestseparators.preset_overwrite_body": "Den sparade förinställningen går förlorad.", + "gui.chestseparators.preset_page": "Sida %s/%s", + "gui.chestseparators.preview_delete": "Tas bort", + "key.chestseparators.push": "Skicka till kistfilter", + "config.chestseparators.push": "Skicka till kistfilter", + "config.chestseparators.push.tooltip": "Skickar matchande föremål till den öppna kistans filter.\n§8Håll [Shift] för att även fylla tomma platser", + "key.chestseparators.pull": "Hämta till inventariefilter", + "config.chestseparators.pull": "Hämta till inventariefilter", + "config.chestseparators.pull.tooltip": "Hämtar kistans föremål till dina inventariefilter.\n§8Håll [Shift] för att även hämta ofiltrerade föremål", + "config.chestseparators.lock_hotbar_on_reorder": "Lås snabbfältet vid sortering", + "config.chestseparators.lock_hotbar_on_reorder.tooltip": "När en push eller pull sorterar ditt inventarium lämnas snabbfältet orört.", + "config.chestseparators.lock_hotbar_on_reorder.tooltip2": "Skyddar ett föremål du håller. Av: snabbfältet sorteras också.", + "message.chestseparators.push_no_filters": "Denna kista har inga filter än.", + "message.chestseparators.push_no_slot": "Ingen ledig filterplats.", + "message.chestseparators.pull_no_filters": "Ditt inventarium har inga filter än.", + "message.chestseparators.pull_no_match": "Inget här matchar dina filter." +} diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/lang/tr_tr.json b/multiloader-26.3/common/src/main/resources/assets/chestseparators/lang/tr_tr.json new file mode 100644 index 0000000..a4367fa --- /dev/null +++ b/multiloader-26.3/common/src/main/resources/assets/chestseparators/lang/tr_tr.json @@ -0,0 +1,257 @@ +{ + "tooltip.chestseparators.edit_mode": "Düzeni Düzenle", + "tooltip.chestseparators.whitelist_mode": "Filtreleri Yönet", + "itemGroup.chestseparators.chest_and_inventory": "Sandık ve Envanter", + "gui.chestseparators.search": "Ara", + "button.chestseparators.copy_layout": "Düzeni Kopyala", + "message.chestseparators.layout_copied": "Düzen Kopyalandı!", + "tooltip.chestseparators.desc.copy_layout": "Geçerli düzeni panoya kopyalar", + "button.chestseparators.paste_layout": "Düzeni Yapıştır", + "message.chestseparators.layout_pasted": "Düzen Yapıştırıldı!", + "tooltip.chestseparators.desc.paste_layout": "Kopyalanan düzeni panodan yapıştırır", + "button.chestseparators.undo_action": "Geri Al", + "tooltip.chestseparators.desc.undo_action": "Çizilen son işlemi geri alır", + "button.chestseparators.redo_action": "Yinele", + "tooltip.chestseparators.desc.redo_action": "Daha önce geri alınan işlemi geri yükler", + "tooltip.chestseparators.draw_area": "Alan Çiz", + "tooltip.chestseparators.erase_area": "Alanı Sil", + "tooltip.chestseparators.clear_lines": "Çizgileri Temizle", + "tooltip.chestseparators.clear_backgrounds": "Arka Planları Temizle", + "tooltip.chestseparators.clear_both": "İkisini de Temizle", + "message.chestseparators.cleared": "Temizlendi", + "tooltip.chestseparators.draw_trace": "İz Çiz", + "tooltip.chestseparators.erase_trace": "İzi Sil", + "tooltip.chestseparators.open_palette": "Paleti Aç", + "message.chestseparators.color_copied": "Renk Kopyalandı!", + "message.chestseparators.color_pasted": "Renk Yapıştırıldı!", + "tooltip.chestseparators.tab_lines": "Çizgiler", + "tooltip.chestseparators.tab_backgrounds": "Arka Planlar", + "tooltip.chestseparators.tab_combo": "Kombo Modu", + "button.chestseparators.edit_filter": "Filtreyi Düzenle", + "tooltip.chestseparators.desc.edit_filter": "Seçili slotlar için bir filtre oluştur veya düzenle", + "button.chestseparators.delete_all_filters": "Tüm Filtreleri Sil", + "tooltip.chestseparators.desc.delete_all_filters": "Bu sandıktaki her filtreyi siler", + "message.chestseparators.all_filters_deleted": "Tüm Filtreler Silindi!", + "message.chestseparators.select_first": "Önce en az bir slot seçin.", + "button.chestseparators.area_select": "Alan Seçimi", + "tooltip.chestseparators.desc.area_select": "Dikdörtgen bir alan sürükleyerek slotları seçin", + "button.chestseparators.trace_select": "İz Seçimi", + "tooltip.chestseparators.desc.trace_select": "Üzerlerini boyayarak slotları seçin", + "button.chestseparators.clear_selection": "Seçimi Temizle", + "tooltip.chestseparators.desc.clear_selection": "Geçerli seçili tüm slotları temizle", + "button.chestseparators.copy_filters": "Filtreleri Kopyala", + "message.chestseparators.filters_copied": "Filtreler Kopyalandı!", + "tooltip.chestseparators.desc.copy_filters": "Bu sandıktaki tüm filtreleri panoya kopyalar", + "button.chestseparators.paste_filters": "Filtreleri Yapıştır", + "message.chestseparators.filters_pasted": "Filtreler Yapıştırıldı!", + "message.chestseparators.undone": "Geri alındı: %s", + "message.chestseparators.redone": "Yinelendi: %s", + "message.chestseparators.action.layout": "Düzen", + "message.chestseparators.action.filter": "Filtre", + "tooltip.chestseparators.desc.paste_filters": "Panodaki filtreleri bu sandığa yapıştırır", + "button.chestseparators.undo": "Geri Al", + "tooltip.chestseparators.desc.undo": "Son filtre işlemini geri alır", + "button.chestseparators.redo": "Yinele", + "button.chestseparators.fill_inventory": "Envanteri doldur", + "button.chestseparators.preset_load": "Yükle", + "button.chestseparators.preset_save": "Kaydet", + "tooltip.chestseparators.desc.redo": "Daha önce geri alınan işlemi geri yükler", + "tooltip.chestseparators.desc.fill_inventory": "Filtrelenen eşyaları buraya çek (hedefe kadar)", + "tooltip.chestseparators.push_to_chest": "Eşyaları sandığa gönder\n§8Boş yuvalar için [Shift] tuşunu basılı tut", + "tooltip.chestseparators.push_to_chest.shift": "Sandığa + boş yuvalar", + "tooltip.chestseparators.pull_from_chest": "Eşyaları sandıktan çek\n§8[Shift] filtresizleri de çeker", + "tooltip.chestseparators.desc.presets": "Envanter hazır ayarları: düzenleri ve filtreleri kaydet ve yükle", + "tooltip.chestseparators.desc.chest_presets": "Sandık hazır ayarları: sandık düzenlerini ve filtrelerini kaydet ve yükle", + "button.chestseparators.conflict.overwrite": "Mevcut filtrelerin üzerine yaz", + "tooltip.chestseparators.desc.conflict.overwrite": "Seçimdeki mevcut filtreleri siler ve yenisini oluşturur", + "button.chestseparators.conflict.deselect": "Çakışmaları kaldır ve devam et", + "message.chestseparators.empty_selection": "Boş seçim.", + "tooltip.chestseparators.desc.conflict.deselect": "Mevcut filtreleri olduğu gibi tutar ve yalnızca boş slotlara uygular", + "button.chestseparators.cancel": "İptal", + "tooltip.chestseparators.desc.conflict.cancel": "Filtre oluşturmayı iptal et", + "button.chestseparators.confirm": "Onayla", + "gui.chestseparators.conflict_title": "Seçim Çakışması!", + "gui.chestseparators.presets_title": "Envanter hazır ayarları", + "gui.chestseparators.chest_presets_title": "Sandık hazır ayarları", + "gui.chestseparators.preview_layout": "Düzen", + "gui.chestseparators.preview_filters": "Filtreler", + "gui.chestseparators.preset_slot": "%s ayarı", + "gui.chestseparators.preset.building": "İnşaat", + "gui.chestseparators.preset.mining": "Madencilik", + "gui.chestseparators.preset.food": "Yiyecek ve çiftlik", + "gui.chestseparators.preset.redstone": "Redstone", + "gui.chestseparators.preset.combat": "Savaş", + "gui.chestseparators.preset.inv_miner": "Madenci", + "gui.chestseparators.preset.inv_builder": "İnşaatçı", + "gui.chestseparators.preset.inv_explorer": "Kaşif", + "gui.chestseparators.preset.inv_farmer": "Çiftçi", + "gui.chestseparators.preset.inv_nether_end": "Nether ve End", + "gui.chestseparators.conflict_desc": "Seçili bazı slotlarda zaten bir filtre var.", + "gui.chestseparators.group_filter": "Grup Filtresi", + "gui.chestseparators.no_filter": "Filtre Yok", + "gui.chestseparators.items_count": "Öğeler: %s", + "gui.chestseparators.hover_group": "Bir grubun üzerine gelin...", + "gui.chestseparators.empty_whitelist": "Beyaz liste boş.", + "button.chestseparators.save_and_exit": "Kaydet ve Çık", + "button.chestseparators.discard_changes": "Değişiklikleri Sil", + "button.chestseparators.import_extracted": "Çıkarılanları İçe Aktar", + "message.chestseparators.items_already_in_filter": "Öğeler zaten filtrede.", + "message.chestseparators.no_new_items_found": "Yeni öğe bulunamadı.", + "tooltip.chestseparators.desc.import_extracted": "Seçili yuvalardaki eşyaları filtreye ekler.", + "tooltip.chestseparators.desc.import_search": "Aramayı İçe Aktar", + "button.chestseparators.allow_all": "Tümüne İzin Ver", + "tooltip.chestseparators.desc.allow_all": "Tüm oyun öğelerini beyaz listeye ekler", + "button.chestseparators.clear_all": "Tümünü Temizle", + "tooltip.chestseparators.desc.clear_all": "Mevcut beyaz listeyi temizler", + "button.chestseparators.manual_insert": "Manuel Ekleme", + "tooltip.chestseparators.rule.manual_active": "Aktif: Manuel tıklamaları filtreler", + "tooltip.chestseparators.rule.manual_inactive": "Pasif: Manuel tıklamalar filtreyi yoksayar", + "button.chestseparators.shift_insert": "Shift ile Ekleme", + "tooltip.chestseparators.rule.shift_active": "Aktif: Shift tıklamalarını filtreler", + "tooltip.chestseparators.rule.shift_inactive": "Pasif: Shift tıklamaları filtreyi yoksayar", + "button.chestseparators.hopper_insert": "Huni ile Ekleme", + "tooltip.chestseparators.rule.hopper_active": "Aktif: Huni aktarımlarını filtreler", + "tooltip.chestseparators.rule.hopper_inactive": "Pasif: Huniler filtreyi yoksayar", + "button.chestseparators.delete": "Sil", + "tooltip.chestseparators.desc.delete_group": "Bu filtre grubunu siler", + "button.chestseparators.save": "Kaydet", + "tooltip.chestseparators.desc.save": "Değişiklikleri kaydeder", + "tooltip.chestseparators.desc.cancel": "Değişiklikleri iptal eder", + "gui.chestseparators.unsaved_changes_title": "Kaydedilmemiş Değişiklikler", + "gui.chestseparators.unsaved_changes_desc": "Bu filtrede kaydedilmemiş değişiklikleriniz var.", + "gui.chestseparators.new_detected": "Yeni tespit edilen: %s", + "gui.chestseparators.allowing_all": "Tümüne izin veriliyor: %s", + "gui.chestseparators.clearing": "Temizleniyor: %s", + "gui.chestseparators.allowed": "İzin Verilen: %s", + "gui.chestseparators.blocked": "Engellenen: %s", + "gui.chestseparators.edit_filter_rules": "Filtre Kurallarını Düzenle", + "message.chestseparators.no_valid_groups": "Geçerli grup yok.", + "color.chestseparators.custom": "Özel Renk %s", + "modmenu.descriptionTranslation.chestseparators": "Özel otomatik yerleştirme ile envanterinizi hızlıca boşaltın. Oyun sonunda gerçekten ne istediğinizi ve nerede istediğinizi tam olarak biliyor.", + "button.chestseparators.eyedropper": "Damlalık", + "tooltip.chestseparators.desc.eyedropper": "Doğrudan ekrandan bir renk seçin", + "button.chestseparators.exit": "Çıkış", + "tooltip.chestseparators.desc.exit": "Değişiklikleri kaydedin ve renk seçiciyi kapatın", + "gui.chestseparators.hex": "Hex", + "gui.chestseparators.color_r": "R", + "gui.chestseparators.color_g": "G", + "gui.chestseparators.color_b": "B", + "gui.chestseparators.color_picker.instructions": "Kopyalamak için orta tıklayın. Yapıştırmak için özel bir slota sol tıklayın.", + "window.chestseparators.edit_color": "Özel Rengi Düzenle", + "message.chestseparators.edit_buttons_visible": "Düzenleme Düğmeleri: Görünür", + "message.chestseparators.edit_buttons_hidden": "Düzenleme Düğmeleri: Gizli", + "message.chestseparators.preview_panel_visible": "Önizleme Paneli: Görünür", + "message.chestseparators.preview_panel_hidden": "Önizleme Paneli: Gizli", + "config.chestseparators.category.client": "İstemci / Görseller", + "config.chestseparators.show_left_panel": "Sol Paneli Göster", + "config.chestseparators.show_left_panel.tooltip": "Beyaz liste önizleme panelini gösterir. Geçersiz kılmak için değiştirici tuşa basılı tutun.", + "config.chestseparators.enable_preview_animation": "Önizleme Animasyonunu Etkinleştir", + "config.chestseparators.enable_preview_animation.tooltip": "Önizleme panelindeki öğe listesini otomatik olarak kaydırır.", + "config.chestseparators.show_edit_buttons": "Düzenleyici Düğmelerini Göster", + "config.chestseparators.show_edit_buttons.tooltip": "Sandık arayüzündeki araç düğmelerini görüntüler.", + "config.chestseparators.bg_transparency": "Arka Plan Şeffaflığı", + "config.chestseparators.bg_transparency.tooltip": "Slot arka plan renklerinin opaklık seviyesi (0 = Görünmez, 100 = Katı).", + "config.chestseparators.line_transparency": "Çizgi Şeffaflığı", + "config.chestseparators.line_transparency.tooltip": "Ayırıcı çizgilerin opaklık seviyesi (0 = Görünmez, 100 = Katı).", + "config.chestseparators.default_rule_manual": "Varsayılan Kural: Manuel", + "config.chestseparators.default_rule_manual.tooltip": "Yeni oluşturulan gruplar varsayılan olarak manuel tıklamalara izin verir.", + "config.chestseparators.default_rule_shift": "Varsayılan Kural: Shift", + "config.chestseparators.default_rule_shift.tooltip": "Yeni oluşturulan gruplar varsayılan olarak Shift tıklamalarına izin verir.", + "config.chestseparators.default_rule_hopper": "Varsayılan Kural: Huni", + "config.chestseparators.default_rule_hopper.tooltip": "Yeni oluşturulan gruplar varsayılan olarak huni eklemesine izin verir.", + "config.chestseparators.default_rule_pickup": "Varsayılan Kural: Yerden Al", + "config.chestseparators.default_rule_pickup.tooltip": "Yeni oluşturulan envanter grupları varsayılan olarak yerden alınan eşyaları filtreler.", + "config.chestseparators.category.server": "Sunucu / Mekanikler", + "config.chestseparators.expel_invalid_items": "Geçersiz Öğeleri Dışarı At", + "config.chestseparators.expel_invalid_items.tooltip": "Yeni filtre uygulandığında geçersiz öğeler oyuncunun envanterine itilir.", + "config.chestseparators.category.hotkeys": "Kısayol Tuşları", + "config.chestseparators.toggle_preview_panel": "Önizleme Panelini Değiştir", + "config.chestseparators.toggle_preview_panel.tooltip": "Sol önizleme panelini hızlıca gösterir/gizler.", + "config.chestseparators.show_panel_modifier": "Panel Gösterici Tuş", + "config.chestseparators.show_panel_modifier.tooltip": "Devre dışıysa sol paneli göstermeye zorlamak için bu tuşa basılı tutun.", + "button.chestseparators.import_search": "Aramayı İçe Aktar", + "message.chestseparators.locked": "Başka biri zaten bu sandığı düzenliyor!", + "gui.chestseparators.expel_items_title": "Geçersiz Eşyaları Çıkar?", + "gui.chestseparators.expel_items_desc": "Şu anda bu yuvalarda bulunan bazı eşyalar yeni kurallarla eşleşmiyor. Sandıktan çıkarılacaklar.", + "button.chestseparators.accept_expel": "Kabul Et ve Çıkar", + "config.chestseparators.dark_mode": "Karanlık Mod", + "config.chestseparators.dark_mode.tooltip": "Aydınlık ve karanlık arayüz temaları arasında geçiş yapar.", + "config.chestseparators.show_deposit_button": "Para Yatırma Düğmesini Göster", + "message.chestseparators.deposit_button_visible": "Para Yatırma Düğmesi: Görünür", + "message.chestseparators.deposit_button_hidden": "Para Yatırma Düğmesi: Gizli", + "key.chestseparators.toggle_magnifier": "Büyüteci Aç/Kapat", + "key.chestseparators.toggle_edit_buttons": "Araç çubuğunu aç/kapat", + "config.chestseparators.toggle_edit_buttons": "Araç çubuğunu aç/kapat", + "config.chestseparators.toggle_edit_buttons.tooltip": "Üst araç çubuğunun tamamını tek seferde gösterir/gizler.", + "config.chestseparators.toggle_magnifier": "Büyüteci Aç/Kapat", + "config.chestseparators.magnifier_enabled": "Büyüteci Göster", + "config.chestseparators.magnifier_enabled.tooltip": "Ayırıcıları boyarken veya damlalığı kullanırken imleçte yakınlaştırma büyüteci gösterir.", + "config.chestseparators.magnifier_shape": "Büyüteç Şekli", + "config.chestseparators.magnifier_shape.tooltip": "Büyütecin yuvarlak mı yoksa kare mi olduğu.", + "config.chestseparators.magnifier_shape.circle": "Daire", + "config.chestseparators.magnifier_shape.square": "Kare", + "config.chestseparators.magnifier_tab_lines": "Büyüteç: Çizgiler", + "config.chestseparators.magnifier_tab_backgrounds": "Büyüteç: Arka Planlar", + "config.chestseparators.magnifier_tab_combo": "Büyüteç: Kombo Modu", + "message.chestseparators.magnifier_on": "Büyüteç: Açık", + "message.chestseparators.magnifier_off": "Büyüteç: Kapalı", + "message.chestseparators.magnifier_hint": "İpucu: yakınlaştırma büyüteci için %s tuşuna basın", + "message.chestseparators.tag_hint": "İpucu: etiketlerini görmek için bir eşyaya orta tıklayın", + "message.chestseparators.magnifier_hint_off": "İpucu: büyüteci kapatmak için %s tuşuna bas", + "config.chestseparators.show_deposit_button.tooltip": "Sandık arayüzündeki hızlı para yatırma düğmesini gösterir veya gizler.", + "tooltip.chestseparators.deposit_items": "Filtrelere Yatır\n§8[Shift + Tıklama] Filtrelere ve Boş Yuvalara Yatır", + "message.chestseparators.deposited": "%s eşya yatırıldı.", + "message.chestseparators.deposit_failed": "Eşya yatırmak için geçerli yuva bulunamadı.", + "config.chestseparators.close_on_click_outside": "Dışarı tıklandığında kapat", + "config.chestseparators.close_on_click_outside.tooltip": "Arayüzün dışına tıklandığında menüyü kapatır.", + "config.chestseparators.shared_custom_colors": "Paylaşılan Özel Renkler", + "config.chestseparators.shared_custom_colors.tooltip": "Etkinleştirildiğinde, özel renk sütunu Çizgiler, Arka Planlar ve Combo sekmeleri arasında paylaşılır. Devre dışıyken her sekmenin kendi renkleri olur.", + "title.chestseparators.config": "Absolute Order Yapılandırması", + "category.chestseparators.keys": "Absolute Order", + "key.category.chestseparators.keys": "Absolute Order", + "config.chestseparators.auto_deposit_enabled": "Yakındaki sandıklara otomatik yatırma", + "config.chestseparators.auto_deposit_enabled.tooltip": "Tüm envanterini tek bir hareketle yakındaki filtreli sandıklara yerleştir.", + "config.chestseparators.auto_deposit_double_sneak": "Tetikleyici: çift eğilme", + "config.chestseparators.auto_deposit_double_sneak.tooltip": "Otomatik yatırmak için eğilme tuşuna hızlıca iki kez bas.", + "config.chestseparators.auto_deposit_radius": "Otomatik yatırma yarıçapı", + "config.chestseparators.auto_deposit_radius.tooltip": "Etrafında (blok cinsinden) sandıkların aranacağı mesafe.", + "config.chestseparators.auto_deposit_through_walls": "Duvarların arkasına yatır", + "config.chestseparators.auto_deposit_through_walls.tooltip": "Katı bloklarla engellenen sandıklara yatırmaya izin verir. Kapalıyken yol açık olmalı.", + "config.chestseparators.auto_deposit": "Otomatik yatırma", + "key.chestseparators.auto_deposit": "Yakındaki sandıklara otomatik yatırma", + "message.chestseparators.auto_deposit_done": "%s eşya otomatik yatırıldı.", + "message.chestseparators.auto_deposit_none": "Menzilde yakın filtreli sandık yok.", + "message.chestseparators.auto_grab_done": "%s eşya alındı.", + "message.chestseparators.auto_grab_none": "Yakında alınacak bir şey yok.", + "message.chestseparators.preset_loaded": "%s hazır ayarı yüklendi.", + "message.chestseparators.preset_saved": "%s hazır ayarı kaydedildi.", + "message.chestseparators.preset_empty": "%s hazır ayarı boş.", + "config.chestseparators.auto_deposit_animation": "Yatırma animasyonu", + "config.chestseparators.auto_deposit_animation.tooltip": "Her sandığa uçan 3D eşyaları gösterir. Kapalıyken eşyalar animasyonsuz anında yatırılır.", + "config.chestseparators.auto_deposit_trail": "İz efekti", + "config.chestseparators.auto_deposit_trail.tooltip": "Uçan her eşyanın arkasında parçacık izi bırakır. Yalnızca animasyon açıkken geçerlidir.", + "button.chestseparators.pickup_insert": "Yerden Al", + "tooltip.chestseparators.rule.pickup_active": "Etkin: Yerden alınan eşyaları filtreler", + "tooltip.chestseparators.rule.pickup_inactive": "Etkin değil: Yerden alınan eşyalar filtreyi yok sayar", + "tooltip.chestseparators.edit_inventory_toggle": "Envanteri / sandığı düzenle", + "message.chestseparators.editing_inventory": "Düzenleniyor: envanter", + "message.chestseparators.editing_chest": "Düzenleniyor: sandık", + "message.chestseparators.preset_deleted": "%s ayarı silindi.", + "gui.chestseparators.preset_overwrite_title": "%s ayarının üzerine yazılsın mı?", + "gui.chestseparators.preset_overwrite_body": "Kayıtlı ayar kaybolacak.", + "gui.chestseparators.preset_page": "Sayfa %s/%s", + "gui.chestseparators.preview_delete": "Silinecek", + "key.chestseparators.push": "Sandık Filtrelerine Gönder", + "config.chestseparators.push": "Sandık Filtrelerine Gönder", + "config.chestseparators.push.tooltip": "Eşleşen eşyaları açık sandığın filtrelerine gönderir.\n§8Boş yuvaları da doldurmak için [Shift] tuşunu basılı tut", + "key.chestseparators.pull": "Envanter Filtrelerine Getir", + "config.chestseparators.pull": "Envanter Filtrelerine Getir", + "config.chestseparators.pull.tooltip": "Sandığın eşyalarını envanter filtrelerine getirir.\n§8Filtresiz eşyaları da getirmek için [Shift] tuşunu basılı tut", + "config.chestseparators.lock_hotbar_on_reorder": "Sıralarken hotbar'ı kilitle", + "config.chestseparators.lock_hotbar_on_reorder.tooltip": "Bir push veya pull envanterini sıraladığında hotbar'a dokunulmaz.", + "config.chestseparators.lock_hotbar_on_reorder.tooltip2": "Elindeki eşyayı korur. Kapalı: hotbar da sıralanır.", + "message.chestseparators.push_no_filters": "Bu sandıkta henüz filtre yok.", + "message.chestseparators.push_no_slot": "Boş filtre yuvası yok.", + "message.chestseparators.pull_no_filters": "Envanterinde henüz filtre yok.", + "message.chestseparators.pull_no_match": "Buradaki hiçbir şey filtrelerine uymuyor." +} diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/lang/zh_cn.json b/multiloader-26.3/common/src/main/resources/assets/chestseparators/lang/zh_cn.json new file mode 100644 index 0000000..6e128bc --- /dev/null +++ b/multiloader-26.3/common/src/main/resources/assets/chestseparators/lang/zh_cn.json @@ -0,0 +1,257 @@ +{ + "tooltip.chestseparators.edit_mode": "编辑布局", + "tooltip.chestseparators.whitelist_mode": "管理过滤器", + "itemGroup.chestseparators.chest_and_inventory": "箱子与物品栏", + "gui.chestseparators.search": "搜索", + "button.chestseparators.copy_layout": "复制布局", + "message.chestseparators.layout_copied": "布局已复制!", + "tooltip.chestseparators.desc.copy_layout": "将当前布局复制到剪贴板", + "button.chestseparators.paste_layout": "粘贴布局", + "message.chestseparators.layout_pasted": "布局已粘贴!", + "tooltip.chestseparators.desc.paste_layout": "粘贴剪贴板中的布局", + "button.chestseparators.undo_action": "撤销操作", + "tooltip.chestseparators.desc.undo_action": "撤销上一次的绘制操作", + "button.chestseparators.redo_action": "重做操作", + "tooltip.chestseparators.desc.redo_action": "恢复上一次撤销的操作", + "tooltip.chestseparators.draw_area": "绘制区域", + "tooltip.chestseparators.erase_area": "擦除区域", + "tooltip.chestseparators.clear_lines": "清空线条", + "tooltip.chestseparators.clear_backgrounds": "清空背景", + "tooltip.chestseparators.clear_both": "清空两者", + "message.chestseparators.cleared": "已清空", + "tooltip.chestseparators.draw_trace": "绘制路径", + "tooltip.chestseparators.erase_trace": "擦除路径", + "tooltip.chestseparators.open_palette": "打开调色板", + "message.chestseparators.color_copied": "颜色已复制!", + "message.chestseparators.color_pasted": "颜色已粘贴!", + "tooltip.chestseparators.tab_lines": "线条", + "tooltip.chestseparators.tab_backgrounds": "背景", + "tooltip.chestseparators.tab_combo": "组合模式", + "button.chestseparators.edit_filter": "编辑过滤器", + "tooltip.chestseparators.desc.edit_filter": "为选中的槽位创建或编辑过滤器", + "button.chestseparators.delete_all_filters": "删除所有过滤器", + "tooltip.chestseparators.desc.delete_all_filters": "删除此箱子中的所有过滤器", + "message.chestseparators.all_filters_deleted": "所有过滤器已删除!", + "message.chestseparators.select_first": "请先至少选择一个槽位。", + "button.chestseparators.area_select": "区域选择", + "tooltip.chestseparators.desc.area_select": "通过拖动矩形区域选择槽位", + "button.chestseparators.trace_select": "轨迹选择", + "tooltip.chestseparators.desc.trace_select": "通过涂抹选择槽位", + "button.chestseparators.clear_selection": "清除选择", + "tooltip.chestseparators.desc.clear_selection": "清除当前所有选中的槽位", + "button.chestseparators.copy_filters": "复制过滤器", + "message.chestseparators.filters_copied": "过滤器已复制!", + "tooltip.chestseparators.desc.copy_filters": "将此箱子中的所有过滤器复制到剪贴板", + "button.chestseparators.paste_filters": "粘贴过滤器", + "message.chestseparators.filters_pasted": "过滤器已粘贴!", + "message.chestseparators.undone": "已撤销:%s", + "message.chestseparators.redone": "已重做:%s", + "message.chestseparators.action.layout": "布局", + "message.chestseparators.action.filter": "过滤器", + "tooltip.chestseparators.desc.paste_filters": "将剪贴板中的过滤器粘贴到此箱子", + "button.chestseparators.undo": "撤销", + "tooltip.chestseparators.desc.undo": "撤销上一次的过滤器操作", + "button.chestseparators.redo": "重做", + "button.chestseparators.fill_inventory": "填充背包", + "button.chestseparators.preset_load": "加载", + "button.chestseparators.preset_save": "保存", + "tooltip.chestseparators.desc.redo": "恢复上一次撤销的操作", + "tooltip.chestseparators.desc.fill_inventory": "将筛选的物品取到这里(至目标数量)", + "tooltip.chestseparators.push_to_chest": "将物品放入箱子\n§8按住 [Shift] 包含空槽位", + "tooltip.chestseparators.push_to_chest.shift": "放入箱子 + 空槽位", + "tooltip.chestseparators.pull_from_chest": "从箱子取出物品\n§8[Shift] 也取出未筛选的物品", + "tooltip.chestseparators.desc.presets": "背包预设:保存和加载布局与过滤器", + "tooltip.chestseparators.desc.chest_presets": "箱子预设:保存和加载箱子的布局与过滤器", + "button.chestseparators.conflict.overwrite": "覆盖现有过滤器", + "tooltip.chestseparators.desc.conflict.overwrite": "删除选择范围内的现有过滤器并创建一个新过滤器", + "button.chestseparators.conflict.deselect": "取消选择冲突项并继续", + "message.chestseparators.empty_selection": "未选择任何槽位。", + "tooltip.chestseparators.desc.conflict.deselect": "保持现有过滤器不变,仅应用于空槽位", + "button.chestseparators.cancel": "取消", + "tooltip.chestseparators.desc.conflict.cancel": "中止过滤器创建", + "button.chestseparators.confirm": "确认", + "gui.chestseparators.conflict_title": "选择冲突!", + "gui.chestseparators.presets_title": "背包预设", + "gui.chestseparators.chest_presets_title": "箱子预设", + "gui.chestseparators.preview_layout": "布局", + "gui.chestseparators.preview_filters": "过滤器", + "gui.chestseparators.preset_slot": "预设 %s", + "gui.chestseparators.preset.building": "建筑", + "gui.chestseparators.preset.mining": "采矿", + "gui.chestseparators.preset.food": "食物与农场", + "gui.chestseparators.preset.redstone": "红石", + "gui.chestseparators.preset.combat": "战斗", + "gui.chestseparators.preset.inv_miner": "矿工", + "gui.chestseparators.preset.inv_builder": "建造者", + "gui.chestseparators.preset.inv_explorer": "探险家", + "gui.chestseparators.preset.inv_farmer": "农夫", + "gui.chestseparators.preset.inv_nether_end": "下界与末地", + "gui.chestseparators.conflict_desc": "部分选中的槽位已有过滤器。", + "gui.chestseparators.group_filter": "组过滤器", + "gui.chestseparators.no_filter": "无过滤器", + "gui.chestseparators.items_count": "物品:%s", + "gui.chestseparators.hover_group": "悬停在一个组上...", + "gui.chestseparators.empty_whitelist": "白名单为空。", + "button.chestseparators.save_and_exit": "保存并退出", + "button.chestseparators.discard_changes": "放弃更改", + "button.chestseparators.import_extracted": "导入提取的物品", + "message.chestseparators.items_already_in_filter": "物品已在过滤器中。", + "message.chestseparators.no_new_items_found": "未找到新物品。", + "tooltip.chestseparators.desc.import_extracted": "将选定槽位中的物品添加到筛选器。", + "tooltip.chestseparators.desc.import_search": "导入搜索", + "button.chestseparators.allow_all": "允许所有", + "tooltip.chestseparators.desc.allow_all": "将所有游戏物品加入白名单", + "button.chestseparators.clear_all": "清空所有", + "tooltip.chestseparators.desc.clear_all": "清空当前白名单", + "button.chestseparators.manual_insert": "手动放入", + "tooltip.chestseparators.rule.manual_active": "已启用:过滤手动点击", + "tooltip.chestseparators.rule.manual_inactive": "已停用:手动点击无视过滤器", + "button.chestseparators.shift_insert": "Shift放入", + "tooltip.chestseparators.rule.shift_active": "已启用:过滤Shift点击", + "tooltip.chestseparators.rule.shift_inactive": "已停用:Shift点击无视过滤器", + "button.chestseparators.hopper_insert": "漏斗放入", + "tooltip.chestseparators.rule.hopper_active": "已启用:过滤漏斗传输", + "tooltip.chestseparators.rule.hopper_inactive": "已停用:漏斗无视过滤器", + "button.chestseparators.delete": "删除", + "tooltip.chestseparators.desc.delete_group": "删除此过滤器组", + "button.chestseparators.save": "保存", + "tooltip.chestseparators.desc.save": "保存更改", + "tooltip.chestseparators.desc.cancel": "放弃更改", + "gui.chestseparators.unsaved_changes_title": "未保存的更改", + "gui.chestseparators.unsaved_changes_desc": "您在此过滤器中有未保存的更改。", + "gui.chestseparators.new_detected": "新检测到:%s", + "gui.chestseparators.allowing_all": "允许所有:%s", + "gui.chestseparators.clearing": "清空:%s", + "gui.chestseparators.allowed": "允许:%s", + "gui.chestseparators.blocked": "阻止:%s", + "gui.chestseparators.edit_filter_rules": "编辑过滤器规则", + "message.chestseparators.no_valid_groups": "无有效组。", + "button.chestseparators.eyedropper": "吸管", + "tooltip.chestseparators.desc.eyedropper": "直接从屏幕选取颜色", + "button.chestseparators.exit": "退出", + "tooltip.chestseparators.desc.exit": "保存更改并关闭拾色器", + "gui.chestseparators.hex": "Hex", + "gui.chestseparators.color_r": "R", + "modmenu.descriptionTranslation.chestseparators": "通过自定义自动存放实现快速清理物品栏。游戏终于确切知道你真正想要什么以及你想放在哪里。", + "gui.chestseparators.color_g": "G", + "gui.chestseparators.color_b": "B", + "gui.chestseparators.color_picker.instructions": "鼠标中键复制,左键点击自定义槽位以粘贴。", + "window.chestseparators.edit_color": "编辑自定义颜色", + "message.chestseparators.edit_buttons_visible": "编辑按钮:显示", + "message.chestseparators.edit_buttons_hidden": "编辑按钮:隐藏", + "message.chestseparators.preview_panel_visible": "预览面板:显示", + "message.chestseparators.preview_panel_hidden": "预览面板:隐藏", + "config.chestseparators.category.client": "客户端 / 视觉", + "config.chestseparators.show_left_panel": "显示左侧面板", + "config.chestseparators.show_left_panel.tooltip": "在箱子界面显示白名单预览面板。按住修饰键可强制显示。", + "config.chestseparators.enable_preview_animation": "启用预览动画", + "config.chestseparators.enable_preview_animation.tooltip": "在预览面板中自动滚动物品列表。", + "config.chestseparators.show_edit_buttons": "显示编辑器按钮", + "config.chestseparators.show_edit_buttons.tooltip": "在箱子内显示工具按钮。", + "config.chestseparators.bg_transparency": "背景透明度", + "config.chestseparators.bg_transparency.tooltip": "槽位背景颜色的不透明度(0 = 完全透明,100 = 完全不透明)。", + "config.chestseparators.line_transparency": "线条透明度", + "config.chestseparators.line_transparency.tooltip": "分割线的不透明度(0 = 完全透明,100 = 完全不透明)。", + "config.chestseparators.default_rule_manual": "默认规则:手动", + "config.chestseparators.default_rule_manual.tooltip": "新创建的组默认允许手动点击放入。", + "config.chestseparators.default_rule_shift": "默认规则:Shift", + "config.chestseparators.default_rule_shift.tooltip": "新创建的组默认允许Shift点击放入。", + "config.chestseparators.default_rule_hopper": "默认规则:漏斗", + "config.chestseparators.default_rule_hopper.tooltip": "新创建的组默认允许漏斗传输放入。", + "config.chestseparators.default_rule_pickup": "默认规则:拾取", + "config.chestseparators.default_rule_pickup.tooltip": "新创建的物品栏分组默认会过滤拾取的物品。", + "config.chestseparators.category.server": "服务器 / 机制", + "config.chestseparators.expel_invalid_items": "排出无效物品", + "config.chestseparators.expel_invalid_items.tooltip": "应用新过滤器时,现有的无效物品将被推入玩家背包或掉落。", + "config.chestseparators.category.hotkeys": "快捷键", + "config.chestseparators.toggle_preview_panel": "切换预览面板", + "config.chestseparators.toggle_preview_panel.tooltip": "快速显示/隐藏左侧预览面板。", + "config.chestseparators.show_panel_modifier": "面板显示修饰键", + "config.chestseparators.show_panel_modifier.tooltip": "按住此键可强制显示被隐藏的左侧面板。", + "color.chestseparators.custom": "自定义颜色 %s", + "button.chestseparators.import_search": "导入搜索", + "message.chestseparators.locked": "已经有其他人在编辑此箱子了!", + "gui.chestseparators.expel_items_title": "排出无效物品?", + "gui.chestseparators.expel_items_desc": "当前这些槽位中的某些物品不符合新规则。它们将被从箱子中弹出。", + "button.chestseparators.accept_expel": "接受并排出", + "config.chestseparators.dark_mode": "深色模式", + "config.chestseparators.dark_mode.tooltip": "在深色和浅色界面主题之间切换。", + "config.chestseparators.show_deposit_button": "显示存入按钮", + "message.chestseparators.deposit_button_visible": "存入按钮:显示", + "message.chestseparators.deposit_button_hidden": "存入按钮:隐藏", + "key.chestseparators.toggle_magnifier": "切换放大镜", + "key.chestseparators.toggle_edit_buttons": "切换工具栏", + "config.chestseparators.toggle_edit_buttons": "切换工具栏", + "config.chestseparators.toggle_edit_buttons.tooltip": "一次性显示或隐藏整个顶部工具栏。", + "config.chestseparators.toggle_magnifier": "切换放大镜", + "config.chestseparators.magnifier_enabled": "显示放大镜", + "config.chestseparators.magnifier_enabled.tooltip": "在绘制分隔线或使用吸管时在光标处显示缩放放大镜。", + "config.chestseparators.magnifier_shape": "放大镜形状", + "config.chestseparators.magnifier_shape.tooltip": "放大镜为圆形还是方形。", + "config.chestseparators.magnifier_shape.circle": "圆形", + "config.chestseparators.magnifier_shape.square": "方形", + "config.chestseparators.magnifier_tab_lines": "放大镜: 线条", + "config.chestseparators.magnifier_tab_backgrounds": "放大镜: 背景", + "config.chestseparators.magnifier_tab_combo": "放大镜: 组合模式", + "message.chestseparators.magnifier_on": "放大镜:开", + "message.chestseparators.magnifier_off": "放大镜:关", + "message.chestseparators.magnifier_hint": "提示:按 %s 显示放大镜", + "message.chestseparators.tag_hint": "提示:中键点击物品可查看其标签", + "message.chestseparators.magnifier_hint_off": "提示:按 %s 关闭放大镜", + "config.chestseparators.show_deposit_button.tooltip": "在箱子界面显示或隐藏快速存入按钮。", + "tooltip.chestseparators.deposit_items": "存入过滤器\n§8[Shift + 左键] 存入过滤器与空槽", + "message.chestseparators.deposited": "已存入 %s 个物品。", + "message.chestseparators.deposit_failed": "未找到有效的槽位来存入物品。", + "config.chestseparators.close_on_click_outside": "点击外部关闭", + "config.chestseparators.close_on_click_outside.tooltip": "点击界面外部时关闭菜单。", + "config.chestseparators.shared_custom_colors": "共享自定义颜色", + "config.chestseparators.shared_custom_colors.tooltip": "启用后,自定义颜色列在线条、背景和组合标签页之间共享。禁用后,每个标签页各自独立。", + "title.chestseparators.config": "Absolute Order 配置", + "category.chestseparators.keys": "Absolute Order", + "key.category.chestseparators.keys": "Absolute Order", + "config.chestseparators.auto_deposit_enabled": "自动存入附近箱子", + "config.chestseparators.auto_deposit_enabled.tooltip": "一个动作即可将整个物品栏整理到附近的过滤箱子中。", + "config.chestseparators.auto_deposit_double_sneak": "触发:双击潜行", + "config.chestseparators.auto_deposit_double_sneak.tooltip": "快速按两次潜行键即可自动存入。", + "config.chestseparators.auto_deposit_radius": "自动存入半径", + "config.chestseparators.auto_deposit_radius.tooltip": "在你周围(以方块计)搜索箱子的距离。", + "config.chestseparators.auto_deposit_through_walls": "穿墙存入", + "config.chestseparators.auto_deposit_through_walls.tooltip": "允许存入被实心方块阻挡的箱子。关闭时路径必须畅通。", + "config.chestseparators.auto_deposit": "自动存入(快捷键)", + "key.chestseparators.auto_deposit": "自动存入附近箱子", + "message.chestseparators.auto_deposit_done": "已自动存入 %s 个物品。", + "message.chestseparators.auto_deposit_none": "范围内没有附近的过滤箱子。", + "message.chestseparators.auto_grab_done": "已取回 %s 个物品。", + "message.chestseparators.auto_grab_none": "附近没有可取回的物品。", + "message.chestseparators.preset_loaded": "已加载预设 %s。", + "message.chestseparators.preset_saved": "已保存预设 %s。", + "message.chestseparators.preset_empty": "预设 %s 为空。", + "config.chestseparators.auto_deposit_animation": "存入动画", + "config.chestseparators.auto_deposit_animation.tooltip": "显示飞向每个箱子的 3D 物品。关闭时,物品将无动画即时存入。", + "config.chestseparators.auto_deposit_trail": "拖尾效果", + "config.chestseparators.auto_deposit_trail.tooltip": "在每个飞行物品后方留下粒子拖尾。仅在动画开启时生效。", + "button.chestseparators.pickup_insert": "拾取", + "tooltip.chestseparators.rule.pickup_active": "启用:过滤拾取的物品", + "tooltip.chestseparators.rule.pickup_inactive": "禁用:拾取的物品忽略过滤", + "tooltip.chestseparators.edit_inventory_toggle": "编辑物品栏 / 箱子", + "message.chestseparators.editing_inventory": "正在编辑:物品栏", + "message.chestseparators.editing_chest": "正在编辑:箱子", + "message.chestseparators.preset_deleted": "已删除预设 %s。", + "gui.chestseparators.preset_overwrite_title": "覆盖预设 %s?", + "gui.chestseparators.preset_overwrite_body": "已保存的预设将丢失。", + "gui.chestseparators.preset_page": "第 %s/%s 页", + "gui.chestseparators.preview_delete": "将被删除", + "key.chestseparators.push": "存入箱子筛选槽", + "config.chestseparators.push": "存入箱子筛选槽", + "config.chestseparators.push.tooltip": "将匹配的物品存入打开的箱子的筛选槽。\n§8按住 [Shift] 也填入空槽", + "key.chestseparators.pull": "取入背包筛选槽", + "config.chestseparators.pull": "取入背包筛选槽", + "config.chestseparators.pull.tooltip": "将箱子的物品取入你的背包筛选槽。\n§8按住 [Shift] 也取出未筛选的物品", + "config.chestseparators.lock_hotbar_on_reorder": "整理时锁定快捷栏", + "config.chestseparators.lock_hotbar_on_reorder.tooltip": "推入或拉取整理背包时,保持快捷栏不动。", + "config.chestseparators.lock_hotbar_on_reorder.tooltip2": "保护你手持的物品。关闭:快捷栏也会一起整理。", + "message.chestseparators.push_no_filters": "这个箱子还没有筛选。", + "message.chestseparators.push_no_slot": "没有空闲的筛选槽。", + "message.chestseparators.pull_no_filters": "你的背包还没有筛选。", + "message.chestseparators.pull_no_match": "这里没有符合筛选的物品。" +} diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/backgrounds.png b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/backgrounds.png new file mode 100644 index 0000000..c0a636e Binary files /dev/null and b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/backgrounds.png differ diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/brush_base.png b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/brush_base.png new file mode 100644 index 0000000..29c4e70 Binary files /dev/null and b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/brush_base.png differ diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/brush_mask_area.png b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/brush_mask_area.png new file mode 100644 index 0000000..8e95523 Binary files /dev/null and b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/brush_mask_area.png differ diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/brush_mask_trace.png b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/brush_mask_trace.png new file mode 100644 index 0000000..64d5314 Binary files /dev/null and b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/brush_mask_trace.png differ diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/btn_deposit.png b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/btn_deposit.png new file mode 100644 index 0000000..6760b9c Binary files /dev/null and b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/btn_deposit.png differ diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/btn_edit_lines.png b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/btn_edit_lines.png new file mode 100644 index 0000000..af7c6a3 Binary files /dev/null and b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/btn_edit_lines.png differ diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/btn_whitelist.png b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/btn_whitelist.png new file mode 100644 index 0000000..a7613a8 Binary files /dev/null and b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/btn_whitelist.png differ diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/combo_mask_area.png b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/combo_mask_area.png new file mode 100644 index 0000000..e7a6143 Binary files /dev/null and b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/combo_mask_area.png differ diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/combo_mask_trace.png b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/combo_mask_trace.png new file mode 100644 index 0000000..3a280ef Binary files /dev/null and b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/combo_mask_trace.png differ diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/eraser_area.png b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/eraser_area.png new file mode 100644 index 0000000..df55f01 Binary files /dev/null and b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/eraser_area.png differ diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/eraser_trace.png b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/eraser_trace.png new file mode 100644 index 0000000..8cc5c42 Binary files /dev/null and b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/eraser_trace.png differ diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/eyedropper.png b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/eyedropper.png new file mode 100644 index 0000000..bcc19d6 Binary files /dev/null and b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/eyedropper.png differ diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/eyedropper2.png b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/eyedropper2.png new file mode 100644 index 0000000..136fee2 Binary files /dev/null and b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/eyedropper2.png differ diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_area_select.png b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_area_select.png new file mode 100644 index 0000000..1997848 Binary files /dev/null and b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_area_select.png differ diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_backpack_empty.png b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_backpack_empty.png new file mode 100644 index 0000000..5947001 Binary files /dev/null and b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_backpack_empty.png differ diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_backpack_full.png b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_backpack_full.png new file mode 100644 index 0000000..501167d Binary files /dev/null and b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_backpack_full.png differ diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_cancel.png b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_cancel.png new file mode 100644 index 0000000..c919498 Binary files /dev/null and b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_cancel.png differ diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_check.png b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_check.png new file mode 100644 index 0000000..b9e5ded Binary files /dev/null and b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_check.png differ diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_copy.png b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_copy.png new file mode 100644 index 0000000..c5a9d11 Binary files /dev/null and b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_copy.png differ diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_ctrl_y.png b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_ctrl_y.png new file mode 100644 index 0000000..9f18eba Binary files /dev/null and b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_ctrl_y.png differ diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_ctrl_z.png b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_ctrl_z.png new file mode 100644 index 0000000..84f5e84 Binary files /dev/null and b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_ctrl_z.png differ diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_cursor.png b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_cursor.png new file mode 100644 index 0000000..aaa2907 Binary files /dev/null and b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_cursor.png differ diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_delete.png b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_delete.png new file mode 100644 index 0000000..46a8ac9 Binary files /dev/null and b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_delete.png differ diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_hopper.png b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_hopper.png new file mode 100644 index 0000000..5494db7 Binary files /dev/null and b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_hopper.png differ diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_import.png b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_import.png new file mode 100644 index 0000000..18079a4 Binary files /dev/null and b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_import.png differ diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_palette.png b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_palette.png new file mode 100644 index 0000000..5ac1385 Binary files /dev/null and b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_palette.png differ diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_paste.png b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_paste.png new file mode 100644 index 0000000..6c6a556 Binary files /dev/null and b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_paste.png differ diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_pickup.png b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_pickup.png new file mode 100644 index 0000000..517d295 Binary files /dev/null and b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_pickup.png differ diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_save.png b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_save.png new file mode 100644 index 0000000..40b15ea Binary files /dev/null and b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_save.png differ diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_search.png b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_search.png new file mode 100644 index 0000000..9bc33a4 Binary files /dev/null and b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_search.png differ diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_shift.png b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_shift.png new file mode 100644 index 0000000..a8fc4f3 Binary files /dev/null and b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_shift.png differ diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_allow_all.png b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_allow_all.png new file mode 100644 index 0000000..634b80f Binary files /dev/null and b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_allow_all.png differ diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_allow_all.png.mcmeta b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_allow_all.png.mcmeta new file mode 100644 index 0000000..f2fc985 --- /dev/null +++ b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_allow_all.png.mcmeta @@ -0,0 +1,6 @@ +{ + "texture": { + "blur": true, + "clamp": true + } +} \ No newline at end of file diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_area_select.png b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_area_select.png new file mode 100644 index 0000000..d3897d6 Binary files /dev/null and b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_area_select.png differ diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_area_select.png.mcmeta b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_area_select.png.mcmeta new file mode 100644 index 0000000..f2fc985 --- /dev/null +++ b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_area_select.png.mcmeta @@ -0,0 +1,6 @@ +{ + "texture": { + "blur": true, + "clamp": true + } +} \ No newline at end of file diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_broom.png b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_broom.png new file mode 100644 index 0000000..9e82ea6 Binary files /dev/null and b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_broom.png differ diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_broom.png.mcmeta b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_broom.png.mcmeta new file mode 100644 index 0000000..f2fc985 --- /dev/null +++ b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_broom.png.mcmeta @@ -0,0 +1,6 @@ +{ + "texture": { + "blur": true, + "clamp": true + } +} \ No newline at end of file diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_brush.png b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_brush.png new file mode 100644 index 0000000..c5518f9 Binary files /dev/null and b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_brush.png differ diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_brush.png.mcmeta b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_brush.png.mcmeta new file mode 100644 index 0000000..f2fc985 --- /dev/null +++ b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_brush.png.mcmeta @@ -0,0 +1,6 @@ +{ + "texture": { + "blur": true, + "clamp": true + } +} \ No newline at end of file diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_cancel.png b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_cancel.png new file mode 100644 index 0000000..515d863 Binary files /dev/null and b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_cancel.png differ diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_cancel.png.mcmeta b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_cancel.png.mcmeta new file mode 100644 index 0000000..f2fc985 --- /dev/null +++ b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_cancel.png.mcmeta @@ -0,0 +1,6 @@ +{ + "texture": { + "blur": true, + "clamp": true + } +} \ No newline at end of file diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_check.png b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_check.png new file mode 100644 index 0000000..d7cbcdc Binary files /dev/null and b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_check.png differ diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_check.png.mcmeta b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_check.png.mcmeta new file mode 100644 index 0000000..f2fc985 --- /dev/null +++ b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_check.png.mcmeta @@ -0,0 +1,6 @@ +{ + "texture": { + "blur": true, + "clamp": true + } +} \ No newline at end of file diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_chest_presets.png b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_chest_presets.png new file mode 100644 index 0000000..d8c1f9f Binary files /dev/null and b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_chest_presets.png differ diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_chest_presets.png.mcmeta b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_chest_presets.png.mcmeta new file mode 100644 index 0000000..f2fc985 --- /dev/null +++ b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_chest_presets.png.mcmeta @@ -0,0 +1,6 @@ +{ + "texture": { + "blur": true, + "clamp": true + } +} \ No newline at end of file diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_clear.png b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_clear.png new file mode 100644 index 0000000..d849212 Binary files /dev/null and b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_clear.png differ diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_clear.png.mcmeta b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_clear.png.mcmeta new file mode 100644 index 0000000..f2fc985 --- /dev/null +++ b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_clear.png.mcmeta @@ -0,0 +1,6 @@ +{ + "texture": { + "blur": true, + "clamp": true + } +} \ No newline at end of file diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_combo.png b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_combo.png new file mode 100644 index 0000000..70b7ea2 Binary files /dev/null and b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_combo.png differ diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_combo.png.mcmeta b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_combo.png.mcmeta new file mode 100644 index 0000000..f2fc985 --- /dev/null +++ b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_combo.png.mcmeta @@ -0,0 +1,6 @@ +{ + "texture": { + "blur": true, + "clamp": true + } +} \ No newline at end of file diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_conflict.png b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_conflict.png new file mode 100644 index 0000000..9100b31 Binary files /dev/null and b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_conflict.png differ diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_conflict.png.mcmeta b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_conflict.png.mcmeta new file mode 100644 index 0000000..f2fc985 --- /dev/null +++ b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_conflict.png.mcmeta @@ -0,0 +1,6 @@ +{ + "texture": { + "blur": true, + "clamp": true + } +} \ No newline at end of file diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_copy.png b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_copy.png new file mode 100644 index 0000000..a83ce6d Binary files /dev/null and b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_copy.png differ diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_copy.png.mcmeta b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_copy.png.mcmeta new file mode 100644 index 0000000..f2fc985 --- /dev/null +++ b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_copy.png.mcmeta @@ -0,0 +1,6 @@ +{ + "texture": { + "blur": true, + "clamp": true + } +} \ No newline at end of file diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_deposit.png b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_deposit.png new file mode 100644 index 0000000..d976418 Binary files /dev/null and b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_deposit.png differ diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_deposit.png.mcmeta b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_deposit.png.mcmeta new file mode 100644 index 0000000..f2fc985 --- /dev/null +++ b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_deposit.png.mcmeta @@ -0,0 +1,6 @@ +{ + "texture": { + "blur": true, + "clamp": true + } +} \ No newline at end of file diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_edit.png b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_edit.png new file mode 100644 index 0000000..c4da147 Binary files /dev/null and b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_edit.png differ diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_edit.png.mcmeta b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_edit.png.mcmeta new file mode 100644 index 0000000..f2fc985 --- /dev/null +++ b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_edit.png.mcmeta @@ -0,0 +1,6 @@ +{ + "texture": { + "blur": true, + "clamp": true + } +} \ No newline at end of file diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_eraser_area.png b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_eraser_area.png new file mode 100644 index 0000000..0e3bdbf Binary files /dev/null and b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_eraser_area.png differ diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_eraser_area.png.mcmeta b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_eraser_area.png.mcmeta new file mode 100644 index 0000000..f2fc985 --- /dev/null +++ b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_eraser_area.png.mcmeta @@ -0,0 +1,6 @@ +{ + "texture": { + "blur": true, + "clamp": true + } +} \ No newline at end of file diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_eraser_trace.png b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_eraser_trace.png new file mode 100644 index 0000000..df65d5a Binary files /dev/null and b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_eraser_trace.png differ diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_eraser_trace.png.mcmeta b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_eraser_trace.png.mcmeta new file mode 100644 index 0000000..f2fc985 --- /dev/null +++ b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_eraser_trace.png.mcmeta @@ -0,0 +1,6 @@ +{ + "texture": { + "blur": true, + "clamp": true + } +} \ No newline at end of file diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_eyedropper.png b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_eyedropper.png new file mode 100644 index 0000000..2817e03 Binary files /dev/null and b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_eyedropper.png differ diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_eyedropper.png.mcmeta b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_eyedropper.png.mcmeta new file mode 100644 index 0000000..f2fc985 --- /dev/null +++ b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_eyedropper.png.mcmeta @@ -0,0 +1,6 @@ +{ + "texture": { + "blur": true, + "clamp": true + } +} \ No newline at end of file diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_fill.png b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_fill.png new file mode 100644 index 0000000..fd81eef Binary files /dev/null and b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_fill.png differ diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_fill.png.mcmeta b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_fill.png.mcmeta new file mode 100644 index 0000000..f2fc985 --- /dev/null +++ b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_fill.png.mcmeta @@ -0,0 +1,6 @@ +{ + "texture": { + "blur": true, + "clamp": true + } +} \ No newline at end of file diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_filter.png b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_filter.png new file mode 100644 index 0000000..123a5c5 Binary files /dev/null and b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_filter.png differ diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_filter.png.mcmeta b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_filter.png.mcmeta new file mode 100644 index 0000000..f2fc985 --- /dev/null +++ b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_filter.png.mcmeta @@ -0,0 +1,6 @@ +{ + "texture": { + "blur": true, + "clamp": true + } +} \ No newline at end of file diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_hopper.png b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_hopper.png new file mode 100644 index 0000000..529e128 Binary files /dev/null and b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_hopper.png differ diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_hopper.png.mcmeta b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_hopper.png.mcmeta new file mode 100644 index 0000000..f2fc985 --- /dev/null +++ b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_hopper.png.mcmeta @@ -0,0 +1,6 @@ +{ + "texture": { + "blur": true, + "clamp": true + } +} \ No newline at end of file diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_import.png b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_import.png new file mode 100644 index 0000000..0eae146 Binary files /dev/null and b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_import.png differ diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_import.png.mcmeta b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_import.png.mcmeta new file mode 100644 index 0000000..f2fc985 --- /dev/null +++ b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_import.png.mcmeta @@ -0,0 +1,6 @@ +{ + "texture": { + "blur": true, + "clamp": true + } +} \ No newline at end of file diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_inv_presets.png b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_inv_presets.png new file mode 100644 index 0000000..e4b429c Binary files /dev/null and b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_inv_presets.png differ diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_inv_presets.png.mcmeta b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_inv_presets.png.mcmeta new file mode 100644 index 0000000..f2fc985 --- /dev/null +++ b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_inv_presets.png.mcmeta @@ -0,0 +1,6 @@ +{ + "texture": { + "blur": true, + "clamp": true + } +} \ No newline at end of file diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_manual.png b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_manual.png new file mode 100644 index 0000000..e203f48 Binary files /dev/null and b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_manual.png differ diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_manual.png.mcmeta b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_manual.png.mcmeta new file mode 100644 index 0000000..f2fc985 --- /dev/null +++ b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_manual.png.mcmeta @@ -0,0 +1,6 @@ +{ + "texture": { + "blur": true, + "clamp": true + } +} \ No newline at end of file diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_mask_area.png b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_mask_area.png new file mode 100644 index 0000000..92377a6 Binary files /dev/null and b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_mask_area.png differ diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_mask_area.png.mcmeta b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_mask_area.png.mcmeta new file mode 100644 index 0000000..f2fc985 --- /dev/null +++ b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_mask_area.png.mcmeta @@ -0,0 +1,6 @@ +{ + "texture": { + "blur": true, + "clamp": true + } +} \ No newline at end of file diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_mask_trace.png b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_mask_trace.png new file mode 100644 index 0000000..933e32d Binary files /dev/null and b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_mask_trace.png differ diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_mask_trace.png.mcmeta b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_mask_trace.png.mcmeta new file mode 100644 index 0000000..f2fc985 --- /dev/null +++ b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_mask_trace.png.mcmeta @@ -0,0 +1,6 @@ +{ + "texture": { + "blur": true, + "clamp": true + } +} \ No newline at end of file diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_palette.png b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_palette.png new file mode 100644 index 0000000..8dd93ba Binary files /dev/null and b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_palette.png differ diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_palette.png.mcmeta b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_palette.png.mcmeta new file mode 100644 index 0000000..f2fc985 --- /dev/null +++ b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_palette.png.mcmeta @@ -0,0 +1,6 @@ +{ + "texture": { + "blur": true, + "clamp": true + } +} \ No newline at end of file diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_paste.png b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_paste.png new file mode 100644 index 0000000..a018554 Binary files /dev/null and b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_paste.png differ diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_paste.png.mcmeta b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_paste.png.mcmeta new file mode 100644 index 0000000..f2fc985 --- /dev/null +++ b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_paste.png.mcmeta @@ -0,0 +1,6 @@ +{ + "texture": { + "blur": true, + "clamp": true + } +} \ No newline at end of file diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_pencil.png b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_pencil.png new file mode 100644 index 0000000..425e9e7 Binary files /dev/null and b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_pencil.png differ diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_pencil.png.mcmeta b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_pencil.png.mcmeta new file mode 100644 index 0000000..f2fc985 --- /dev/null +++ b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_pencil.png.mcmeta @@ -0,0 +1,6 @@ +{ + "texture": { + "blur": true, + "clamp": true + } +} \ No newline at end of file diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_pickup.png b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_pickup.png new file mode 100644 index 0000000..b50c0d7 Binary files /dev/null and b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_pickup.png differ diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_pickup.png.mcmeta b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_pickup.png.mcmeta new file mode 100644 index 0000000..f2fc985 --- /dev/null +++ b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_pickup.png.mcmeta @@ -0,0 +1,6 @@ +{ + "texture": { + "blur": true, + "clamp": true + } +} \ No newline at end of file diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_redo.png b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_redo.png new file mode 100644 index 0000000..64f6efc Binary files /dev/null and b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_redo.png differ diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_redo.png.mcmeta b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_redo.png.mcmeta new file mode 100644 index 0000000..f2fc985 --- /dev/null +++ b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_redo.png.mcmeta @@ -0,0 +1,6 @@ +{ + "texture": { + "blur": true, + "clamp": true + } +} \ No newline at end of file diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_save.png b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_save.png new file mode 100644 index 0000000..09d6576 Binary files /dev/null and b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_save.png differ diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_save.png.mcmeta b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_save.png.mcmeta new file mode 100644 index 0000000..f2fc985 --- /dev/null +++ b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_save.png.mcmeta @@ -0,0 +1,6 @@ +{ + "texture": { + "blur": true, + "clamp": true + } +} \ No newline at end of file diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_search.png b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_search.png new file mode 100644 index 0000000..b419386 Binary files /dev/null and b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_search.png differ diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_search.png.mcmeta b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_search.png.mcmeta new file mode 100644 index 0000000..f2fc985 --- /dev/null +++ b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_search.png.mcmeta @@ -0,0 +1,6 @@ +{ + "texture": { + "blur": true, + "clamp": true + } +} \ No newline at end of file diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_shift.png b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_shift.png new file mode 100644 index 0000000..048643c Binary files /dev/null and b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_shift.png differ diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_shift.png.mcmeta b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_shift.png.mcmeta new file mode 100644 index 0000000..f2fc985 --- /dev/null +++ b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_shift.png.mcmeta @@ -0,0 +1,6 @@ +{ + "texture": { + "blur": true, + "clamp": true + } +} \ No newline at end of file diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_trace_select.png b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_trace_select.png new file mode 100644 index 0000000..8b606fa Binary files /dev/null and b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_trace_select.png differ diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_trace_select.png.mcmeta b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_trace_select.png.mcmeta new file mode 100644 index 0000000..f2fc985 --- /dev/null +++ b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_trace_select.png.mcmeta @@ -0,0 +1,6 @@ +{ + "texture": { + "blur": true, + "clamp": true + } +} \ No newline at end of file diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_trash.png b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_trash.png new file mode 100644 index 0000000..4e62aa8 Binary files /dev/null and b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_trash.png differ diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_trash.png.mcmeta b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_trash.png.mcmeta new file mode 100644 index 0000000..f2fc985 --- /dev/null +++ b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_trash.png.mcmeta @@ -0,0 +1,6 @@ +{ + "texture": { + "blur": true, + "clamp": true + } +} \ No newline at end of file diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_undo.png b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_undo.png new file mode 100644 index 0000000..d2cea51 Binary files /dev/null and b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_undo.png differ diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_undo.png.mcmeta b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_undo.png.mcmeta new file mode 100644 index 0000000..f2fc985 --- /dev/null +++ b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_sm_undo.png.mcmeta @@ -0,0 +1,6 @@ +{ + "texture": { + "blur": true, + "clamp": true + } +} \ No newline at end of file diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_trace_select.png b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_trace_select.png new file mode 100644 index 0000000..cfdd305 Binary files /dev/null and b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_trace_select.png differ diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_trash.png b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_trash.png new file mode 100644 index 0000000..05306d5 Binary files /dev/null and b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_trash.png differ diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_warning.png b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_warning.png new file mode 100644 index 0000000..5d52eaf Binary files /dev/null and b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/icon_warning.png differ diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/lines.png b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/lines.png new file mode 100644 index 0000000..587b4ca Binary files /dev/null and b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/lines.png differ diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/pencil_base.png b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/pencil_base.png new file mode 100644 index 0000000..2931ebf Binary files /dev/null and b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/pencil_base.png differ diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/pencil_mask_area.png b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/pencil_mask_area.png new file mode 100644 index 0000000..7a46f72 Binary files /dev/null and b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/pencil_mask_area.png differ diff --git a/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/pencil_mask_trace.png b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/pencil_mask_trace.png new file mode 100644 index 0000000..4ec99ae Binary files /dev/null and b/multiloader-26.3/common/src/main/resources/assets/chestseparators/textures/gui/pencil_mask_trace.png differ diff --git a/multiloader-26.3/common/src/main/resources/chestseparators_presets/chest_preset_27_1.json b/multiloader-26.3/common/src/main/resources/chestseparators_presets/chest_preset_27_1.json new file mode 100644 index 0000000..3652cfd Binary files /dev/null and b/multiloader-26.3/common/src/main/resources/chestseparators_presets/chest_preset_27_1.json differ diff --git a/multiloader-26.3/common/src/main/resources/chestseparators_presets/chest_preset_27_2.json b/multiloader-26.3/common/src/main/resources/chestseparators_presets/chest_preset_27_2.json new file mode 100644 index 0000000..f0aa873 Binary files /dev/null and b/multiloader-26.3/common/src/main/resources/chestseparators_presets/chest_preset_27_2.json differ diff --git a/multiloader-26.3/common/src/main/resources/chestseparators_presets/chest_preset_27_3.json b/multiloader-26.3/common/src/main/resources/chestseparators_presets/chest_preset_27_3.json new file mode 100644 index 0000000..a41e66e Binary files /dev/null and b/multiloader-26.3/common/src/main/resources/chestseparators_presets/chest_preset_27_3.json differ diff --git a/multiloader-26.3/common/src/main/resources/chestseparators_presets/chest_preset_27_4.json b/multiloader-26.3/common/src/main/resources/chestseparators_presets/chest_preset_27_4.json new file mode 100644 index 0000000..cd417c9 Binary files /dev/null and b/multiloader-26.3/common/src/main/resources/chestseparators_presets/chest_preset_27_4.json differ diff --git a/multiloader-26.3/common/src/main/resources/chestseparators_presets/chest_preset_27_5.json b/multiloader-26.3/common/src/main/resources/chestseparators_presets/chest_preset_27_5.json new file mode 100644 index 0000000..52e0357 Binary files /dev/null and b/multiloader-26.3/common/src/main/resources/chestseparators_presets/chest_preset_27_5.json differ diff --git a/multiloader-26.3/common/src/main/resources/chestseparators_presets/chest_preset_54_1.json b/multiloader-26.3/common/src/main/resources/chestseparators_presets/chest_preset_54_1.json new file mode 100644 index 0000000..7687977 Binary files /dev/null and b/multiloader-26.3/common/src/main/resources/chestseparators_presets/chest_preset_54_1.json differ diff --git a/multiloader-26.3/common/src/main/resources/chestseparators_presets/chest_preset_54_2.json b/multiloader-26.3/common/src/main/resources/chestseparators_presets/chest_preset_54_2.json new file mode 100644 index 0000000..065955f Binary files /dev/null and b/multiloader-26.3/common/src/main/resources/chestseparators_presets/chest_preset_54_2.json differ diff --git a/multiloader-26.3/common/src/main/resources/chestseparators_presets/chest_preset_54_3.json b/multiloader-26.3/common/src/main/resources/chestseparators_presets/chest_preset_54_3.json new file mode 100644 index 0000000..8168418 Binary files /dev/null and b/multiloader-26.3/common/src/main/resources/chestseparators_presets/chest_preset_54_3.json differ diff --git a/multiloader-26.3/common/src/main/resources/chestseparators_presets/chest_preset_54_4.json b/multiloader-26.3/common/src/main/resources/chestseparators_presets/chest_preset_54_4.json new file mode 100644 index 0000000..be7e9f5 Binary files /dev/null and b/multiloader-26.3/common/src/main/resources/chestseparators_presets/chest_preset_54_4.json differ diff --git a/multiloader-26.3/common/src/main/resources/chestseparators_presets/chest_preset_54_5.json b/multiloader-26.3/common/src/main/resources/chestseparators_presets/chest_preset_54_5.json new file mode 100644 index 0000000..448b6ad Binary files /dev/null and b/multiloader-26.3/common/src/main/resources/chestseparators_presets/chest_preset_54_5.json differ diff --git a/multiloader-26.3/common/src/main/resources/chestseparators_presets/inventory_preset_1.json b/multiloader-26.3/common/src/main/resources/chestseparators_presets/inventory_preset_1.json new file mode 100644 index 0000000..30e00fa Binary files /dev/null and b/multiloader-26.3/common/src/main/resources/chestseparators_presets/inventory_preset_1.json differ diff --git a/multiloader-26.3/common/src/main/resources/chestseparators_presets/inventory_preset_2.json b/multiloader-26.3/common/src/main/resources/chestseparators_presets/inventory_preset_2.json new file mode 100644 index 0000000..5550d89 Binary files /dev/null and b/multiloader-26.3/common/src/main/resources/chestseparators_presets/inventory_preset_2.json differ diff --git a/multiloader-26.3/common/src/main/resources/chestseparators_presets/inventory_preset_3.json b/multiloader-26.3/common/src/main/resources/chestseparators_presets/inventory_preset_3.json new file mode 100644 index 0000000..a1095bd Binary files /dev/null and b/multiloader-26.3/common/src/main/resources/chestseparators_presets/inventory_preset_3.json differ diff --git a/multiloader-26.3/common/src/main/resources/chestseparators_presets/inventory_preset_4.json b/multiloader-26.3/common/src/main/resources/chestseparators_presets/inventory_preset_4.json new file mode 100644 index 0000000..8664c32 Binary files /dev/null and b/multiloader-26.3/common/src/main/resources/chestseparators_presets/inventory_preset_4.json differ diff --git a/multiloader-26.3/common/src/main/resources/chestseparators_presets/inventory_preset_5.json b/multiloader-26.3/common/src/main/resources/chestseparators_presets/inventory_preset_5.json new file mode 100644 index 0000000..f568606 Binary files /dev/null and b/multiloader-26.3/common/src/main/resources/chestseparators_presets/inventory_preset_5.json differ diff --git a/multiloader-26.3/common/src/test/java/io/github/marcsanzdev/chestseparators/HarnessSmokeTest.java b/multiloader-26.3/common/src/test/java/io/github/marcsanzdev/chestseparators/HarnessSmokeTest.java new file mode 100644 index 0000000..3feefa5 --- /dev/null +++ b/multiloader-26.3/common/src/test/java/io/github/marcsanzdev/chestseparators/HarnessSmokeTest.java @@ -0,0 +1,17 @@ +package io.github.marcsanzdev.chestseparators; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +import org.junit.jupiter.api.Test; + +/** + * Scaffolding test that proves the JUnit 5 harness is wired up correctly. + * Real coverage of the data and utility layers is added in a later phase. + */ +class HarnessSmokeTest { + + @Test + void junitHarnessIsAvailable() { + assertEquals(4, 2 + 2); + } +} diff --git a/multiloader-26.3/common/src/test/java/io/github/marcsanzdev/chestseparators/data/ChestConfigManagerTest.java b/multiloader-26.3/common/src/test/java/io/github/marcsanzdev/chestseparators/data/ChestConfigManagerTest.java new file mode 100644 index 0000000..2fe0516 --- /dev/null +++ b/multiloader-26.3/common/src/test/java/io/github/marcsanzdev/chestseparators/data/ChestConfigManagerTest.java @@ -0,0 +1,120 @@ +package io.github.marcsanzdev.chestseparators.data; + +import static io.github.marcsanzdev.chestseparators.data.ChestConfigManager.ACTION_BG; +import static io.github.marcsanzdev.chestseparators.data.ChestConfigManager.ACTION_BOTTOM; +import static io.github.marcsanzdev.chestseparators.data.ChestConfigManager.ACTION_LEFT; +import static io.github.marcsanzdev.chestseparators.data.ChestConfigManager.ACTION_RIGHT; +import static io.github.marcsanzdev.chestseparators.data.ChestConfigManager.ACTION_TOP; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +/** + * Exercises the in-memory separator logic of ChestConfigManager — painting, erasing, the + * snapshot-backed undo/redo wired to {@link UndoRedoHistory}, and the layout clipboard. + * + *

Only methods that operate on the in-memory config are touched; file I/O and the + * client-only world/palette helpers are out of scope here. + */ +class ChestConfigManagerTest { + + private static final int RED = 0xFFAA0000; + private static final int BLUE = 0xFF0000AA; + + private final ChestConfigManager manager = ChestConfigManager.getInstance(); + + @BeforeEach + void reset() { + manager.clearCurrentConfig(); + } + + @Test + void paintSetsOnlyTheTargetedChannels() { + manager.paintAction(0, ACTION_TOP | ACTION_LEFT, RED); + + assertEquals(RED, manager.getColor(0, ACTION_TOP)); + assertEquals(RED, manager.getColor(0, ACTION_LEFT)); + assertEquals(0, manager.getColor(0, ACTION_BOTTOM)); + assertEquals(0, manager.getColor(0, ACTION_RIGHT)); + assertEquals(0, manager.getColor(0, ACTION_BG)); + } + + @Test + void removeClearsChannelAndDropsEmptySlots() { + manager.paintAction(3, ACTION_TOP, RED); + manager.removeAction(3, ACTION_TOP); + + assertEquals(0, manager.getColor(3, ACTION_TOP)); + // With every channel back to zero, the slot entry is discarded entirely. + assertEquals(0, manager.getColor(3, ACTION_BG)); + } + + @Test + void clearAllLinesKeepsBackgrounds() { + manager.paintAction(5, ACTION_TOP, RED); + manager.paintAction(5, ACTION_BG, BLUE); + + manager.clearAllLines(); + + assertEquals(0, manager.getColor(5, ACTION_TOP)); + assertEquals(BLUE, manager.getColor(5, ACTION_BG)); + } + + @Test + void clearAllBackgroundsKeepsLines() { + manager.paintAction(5, ACTION_TOP, RED); + manager.paintAction(5, ACTION_BG, BLUE); + + manager.clearAllBackgrounds(); + + assertEquals(RED, manager.getColor(5, ACTION_TOP)); + assertEquals(0, manager.getColor(5, ACTION_BG)); + } + + @Test + void undoRestoresThePreSnapshotStateAndRedoReapplies() { + manager.saveSnapshot(); // restore point: empty + manager.paintAction(1, ACTION_TOP, RED); + assertEquals(RED, manager.getColor(1, ACTION_TOP)); + + assertTrue(manager.canUndo()); + manager.undo(); + assertEquals(0, manager.getColor(1, ACTION_TOP)); + + assertTrue(manager.canRedo()); + manager.redo(); + assertEquals(RED, manager.getColor(1, ACTION_TOP)); + } + + @Test + void clipboardCopyAndPasteRoundTripsTheLayout() { + manager.paintAction(2, ACTION_TOP | ACTION_BG, RED); + manager.copyToClipboard(); + assertTrue(manager.hasClipboardData()); + + manager.clearCurrentConfig(); + assertEquals(0, manager.getColor(2, ACTION_TOP)); + + manager.pasteFromClipboard(); + assertEquals(RED, manager.getColor(2, ACTION_TOP)); + assertEquals(RED, manager.getColor(2, ACTION_BG)); + } + + @Test + void linesClipboardCopiesOnlyEdgeChannels() { + manager.paintAction(4, ACTION_TOP, RED); + manager.paintAction(4, ACTION_BG, BLUE); + manager.copyLinesToClipboard(); + + manager.clearCurrentConfig(); + manager.pasteLinesFromClipboard(); + + assertEquals(RED, manager.getColor(4, ACTION_TOP)); + // The background channel is not part of the lines clipboard. + assertEquals(0, manager.getColor(4, ACTION_BG)); + assertFalse(manager.hasBackgroundsClipboardData()); + } +} diff --git a/multiloader-26.3/common/src/test/java/io/github/marcsanzdev/chestseparators/data/ClipboardTest.java b/multiloader-26.3/common/src/test/java/io/github/marcsanzdev/chestseparators/data/ClipboardTest.java new file mode 100644 index 0000000..3818625 --- /dev/null +++ b/multiloader-26.3/common/src/test/java/io/github/marcsanzdev/chestseparators/data/ClipboardTest.java @@ -0,0 +1,92 @@ +package io.github.marcsanzdev.chestseparators.data; + +import static io.github.marcsanzdev.chestseparators.data.ChestConfigManager.ACTION_BG; +import static io.github.marcsanzdev.chestseparators.data.ChestConfigManager.ACTION_TOP; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +/** + * Tests the background-only and copyAll clipboard paths in {@link ChestConfigManager}. The + * lines-only clipboard is already covered by {@link ChestConfigManagerTest}. + */ +class ClipboardTest { + + private static final int RED = 0xFFAA0000; + private static final int BLUE = 0xFF0000AA; + + private final ChestConfigManager manager = ChestConfigManager.getInstance(); + + @BeforeEach + void reset() { + manager.clearCurrentConfig(); + } + + @Test + void backgroundsClipboardCopiesOnlyBgChannel() { + manager.paintAction(3, ACTION_TOP, RED); + manager.paintAction(3, ACTION_BG, BLUE); + manager.copyBackgroundsToClipboard(); + assertTrue(manager.hasBackgroundsClipboardData()); + + manager.clearCurrentConfig(); + manager.pasteBackgroundsFromClipboard(); + + // Background must be present + assertEquals(BLUE, manager.getColor(3, ACTION_BG)); + // The line channel must not have been copied to the backgrounds clipboard + assertEquals(0, manager.getColor(3, ACTION_TOP)); + } + + @Test + void copyAllPopulatesAllThreeClipboards() { + manager.paintAction(0, ACTION_TOP, RED); + manager.paintAction(0, ACTION_BG, BLUE); + manager.copyAllToClipboard(); + + assertTrue(manager.hasClipboardData()); + assertTrue(manager.hasLinesClipboardData()); + assertTrue(manager.hasBackgroundsClipboardData()); + } + + @Test + void pasteDoesNotAffectUnrelatedSlots() { + manager.paintAction(7, ACTION_BG, RED); + manager.copyToClipboard(); + + manager.clearCurrentConfig(); + manager.paintAction(2, ACTION_TOP, BLUE); + manager.pasteFromClipboard(); + + // Slot 7 restored from clipboard + assertEquals(RED, manager.getColor(7, ACTION_BG)); + // Paste replaces the whole config, so slot 2 overwritten + assertEquals(0, manager.getColor(2, ACTION_TOP)); + } + + @Test + void clearHistoryResetsUndoRedoAvailability() { + manager.saveSnapshot(); + manager.paintAction(1, ACTION_TOP, RED); + assertTrue(manager.canUndo()); + + manager.clearHistory(); + + assertFalse(manager.canUndo()); + assertFalse(manager.canRedo()); + } + + @Test + void customColors_setAndGetRoundTrip() { + manager.setCustomColor(0, 0xFF112233, 0); // tab=0 (lines) + manager.setCustomColor(3, 0xFF445566, 1); // tab=1 (backgrounds) + manager.setCustomColor(7, 0xFF778899, 2); // tab=2 (combo) + + assertEquals(0xFF112233, manager.getCustomColors(0)[0]); + assertEquals(0xFF445566, manager.getCustomColors(1)[3]); + assertEquals(0xFF778899, manager.getCustomColors(2)[7]); + } +} diff --git a/multiloader-26.3/common/src/test/java/io/github/marcsanzdev/chestseparators/data/ContiguousSlotsTest.java b/multiloader-26.3/common/src/test/java/io/github/marcsanzdev/chestseparators/data/ContiguousSlotsTest.java new file mode 100644 index 0000000..edae3eb --- /dev/null +++ b/multiloader-26.3/common/src/test/java/io/github/marcsanzdev/chestseparators/data/ContiguousSlotsTest.java @@ -0,0 +1,95 @@ +package io.github.marcsanzdev.chestseparators.data; + +import static io.github.marcsanzdev.chestseparators.data.ChestConfigManager.ACTION_BOTTOM; +import static io.github.marcsanzdev.chestseparators.data.ChestConfigManager.ACTION_LEFT; +import static io.github.marcsanzdev.chestseparators.data.ChestConfigManager.ACTION_RIGHT; +import static io.github.marcsanzdev.chestseparators.data.ChestConfigManager.ACTION_TOP; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import java.util.Set; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +/** + * Tests {@link ChestConfigManager#getContiguousSlots} — the BFS that finds all slots reachable + * from a starting slot without crossing a painted separator line. + * + *

Uses a 27-slot (3×9) single chest layout for all cases. + */ +class ContiguousSlotsTest { + + private static final int MAX_SLOTS = 27; + private static final int RED = 0xFFAA0000; + + private final ChestConfigManager manager = ChestConfigManager.getInstance(); + + @BeforeEach + void reset() { + manager.clearCurrentConfig(); + } + + @Test + void withNoSeparators_allSlotsAreContiguous() { + Set result = manager.getContiguousSlots(0, 0, MAX_SLOTS); + assertEquals(MAX_SLOTS, result.size()); + } + + @Test + void topLineOnSlot9_splitsTopAndBottomRows() { + // Draw a TOP separator on every slot of the second row (slots 9–17). + // This creates a horizontal wall between row 0 and row 1. + for (int col = 0; col < 9; col++) { + manager.paintAction(9 + col, ACTION_TOP, RED); + } + + Set topRegion = manager.getContiguousSlots(0, 0, MAX_SLOTS); + Set bottomRegion = manager.getContiguousSlots(9, 0, MAX_SLOTS); + + // Top region (row 0, slots 0–8) must not reach row 1+ + assertEquals(9, topRegion.size()); + for (int i = 0; i < 9; i++) assertTrue(topRegion.contains(i)); + + // Bottom region (rows 1–2, slots 9–26) must not reach row 0 + assertEquals(18, bottomRegion.size()); + assertFalse(bottomRegion.contains(0)); + } + + @Test + void rightLineOnSlot4_splitsColumnRegions() { + // A RIGHT separator on slot 4 (middle of row 0) and its mirror LEFT on slot 5 + // together form a vertical wall between columns 4 and 5 in row 0. + // Only apply within row 0 to isolate the effect. + manager.paintAction(4, ACTION_RIGHT, RED); + manager.paintAction(5, ACTION_LEFT, RED); + + Set leftRegion = manager.getContiguousSlots(0, 0, MAX_SLOTS); + // The wall only covers row 0; rows 1–2 reconnect the two sides via the cells below. + // So starting from slot 0 we expect to reach ALL slots (the region wraps around rows 1–2). + // This verifies the BFS does NOT stop at the wall when there is a path around it. + assertTrue(leftRegion.contains(8)); + } + + @Test + void fullyEnclosedRegion_returnsOnlyItsSlots() { + // Enclose slot 13 (centre of a 3×9 chest: row 1, col 4) on all four sides. + manager.paintAction(13, ACTION_TOP, RED); + manager.paintAction(13, ACTION_BOTTOM, RED); + manager.paintAction(13, ACTION_LEFT, RED); + manager.paintAction(13, ACTION_RIGHT, RED); + + Set isolated = manager.getContiguousSlots(13, 0, MAX_SLOTS); + assertEquals(1, isolated.size()); + assertTrue(isolated.contains(13)); + } + + @Test + void outOfBoundsStart_returnsEmptySet() { + Set result = manager.getContiguousSlots(-1, 0, MAX_SLOTS); + assertTrue(result.isEmpty()); + + result = manager.getContiguousSlots(MAX_SLOTS, 0, MAX_SLOTS); + assertTrue(result.isEmpty()); + } +} diff --git a/multiloader-26.3/common/src/test/java/io/github/marcsanzdev/chestseparators/data/UndoRedoHistoryTest.java b/multiloader-26.3/common/src/test/java/io/github/marcsanzdev/chestseparators/data/UndoRedoHistoryTest.java new file mode 100644 index 0000000..018e929 --- /dev/null +++ b/multiloader-26.3/common/src/test/java/io/github/marcsanzdev/chestseparators/data/UndoRedoHistoryTest.java @@ -0,0 +1,90 @@ +package io.github.marcsanzdev.chestseparators.data; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import java.util.ArrayList; +import java.util.List; +import org.junit.jupiter.api.Test; + +/** Verifies the generic undo/redo history that backs both the separator config and the whitelists. */ +class UndoRedoHistoryTest { + + private static UndoRedoHistory> newHistory(int maxSteps) { + return new UndoRedoHistory<>(ArrayList::new, maxSteps); + } + + @Test + void emptyHistoryHasNothingToUndoOrRedo() { + UndoRedoHistory> history = newHistory(10); + assertFalse(history.canUndo()); + assertFalse(history.canRedo()); + assertNull(history.undo(new ArrayList<>())); + assertNull(history.redo(new ArrayList<>())); + } + + @Test + void undoReturnsThePreviousSnapshotAndEnablesRedo() { + UndoRedoHistory> history = newHistory(10); + + List state = new ArrayList<>(List.of(1)); + history.push(state); // restore point: [1] + state.add(2); // live state is now [1, 2] + + List undone = history.undo(state); + assertEquals(List.of(1), undone); + assertTrue(history.canRedo()); + assertFalse(history.canUndo()); + + List redone = history.redo(undone); + assertEquals(List.of(1, 2), redone); + } + + @Test + void pushDiscardsRedoHistory() { + UndoRedoHistory> history = newHistory(10); + history.push(new ArrayList<>(List.of(1))); + history.undo(new ArrayList<>(List.of(1, 2))); + assertTrue(history.canRedo()); + + history.push(new ArrayList<>(List.of(9))); + assertFalse(history.canRedo()); + } + + @Test + void snapshotsAreDeepCopiesIndependentOfLaterMutation() { + UndoRedoHistory> history = newHistory(10); + List state = new ArrayList<>(List.of(1)); + + history.push(state); + state.add(99); // must not leak into the stored snapshot + + assertEquals(List.of(1), history.undo(state)); + } + + @Test + void undoStackIsBoundedByMaxSteps() { + UndoRedoHistory> history = newHistory(2); + history.push(new ArrayList<>(List.of(1))); + history.push(new ArrayList<>(List.of(2))); + history.push(new ArrayList<>(List.of(3))); + + // Only the two most recent restore points survive. + assertEquals(List.of(3), history.undo(new ArrayList<>(List.of(4)))); + assertEquals(List.of(2), history.undo(new ArrayList<>(List.of(3)))); + assertFalse(history.canUndo()); + } + + @Test + void clearEmptiesBothStacks() { + UndoRedoHistory> history = newHistory(10); + history.push(new ArrayList<>(List.of(1))); + history.undo(new ArrayList<>(List.of(1, 2))); + + history.clear(); + assertFalse(history.canUndo()); + assertFalse(history.canRedo()); + } +} diff --git a/multiloader-26.3/common/src/test/java/io/github/marcsanzdev/chestseparators/data/WhitelistHistoryTest.java b/multiloader-26.3/common/src/test/java/io/github/marcsanzdev/chestseparators/data/WhitelistHistoryTest.java new file mode 100644 index 0000000..022bab1 --- /dev/null +++ b/multiloader-26.3/common/src/test/java/io/github/marcsanzdev/chestseparators/data/WhitelistHistoryTest.java @@ -0,0 +1,98 @@ +package io.github.marcsanzdev.chestseparators.data; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import java.util.List; +import java.util.Map; +import java.util.UUID; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +/** + * Tests the whitelist undo/redo stack and the whitelist clipboard in + * {@link ChestConfigManager}, exercising the {@link UndoRedoHistory} wiring for filter data. + */ +class WhitelistHistoryTest { + + private final ChestConfigManager manager = ChestConfigManager.getInstance(); + + private static SlotWhitelist wl(String... items) { + return new SlotWhitelist(UUID.randomUUID(), List.of(items), true, true, true); + } + + @BeforeEach + void reset() { + manager.clearCurrentConfig(); + manager.clearHistory(); + manager.setCurrentWhitelists(Map.of()); + } + + @Test + void undoRestoresEmptyWhitelist() { + manager.saveWhitelistSnapshot(); + manager.setCurrentWhitelists(Map.of(0, wl("minecraft:apple"))); + + assertTrue(manager.canUndoWhitelist()); + manager.undoWhitelist(); + + Map restored = manager.getCurrentWhitelists(); + assertTrue(restored == null || restored.isEmpty()); + } + + @Test + void redoReappliesWhitelistAfterUndo() { + manager.saveWhitelistSnapshot(); + SlotWhitelist apple = wl("minecraft:apple"); + manager.setCurrentWhitelists(Map.of(0, apple)); + + manager.undoWhitelist(); + assertTrue(manager.canRedoWhitelist()); + manager.redoWhitelist(); + + Map current = manager.getCurrentWhitelists(); + assertNotNull(current); + assertEquals(1, current.size()); + assertEquals(List.of("minecraft:apple"), current.get(0).allowedItems()); + } + + @Test + void multipleSnapshotsUndoInOrder() { + // snapshot A: empty + manager.saveWhitelistSnapshot(); + manager.setCurrentWhitelists(Map.of(1, wl("minecraft:stone"))); + + // snapshot B: one entry + manager.saveWhitelistSnapshot(); + manager.setCurrentWhitelists(Map.of(1, wl("minecraft:stone"), 2, wl("minecraft:dirt"))); + + // undo to B + manager.undoWhitelist(); + assertEquals(1, manager.getCurrentWhitelists().size()); + + // undo to A + manager.undoWhitelist(); + assertTrue(manager.getCurrentWhitelists() == null + || manager.getCurrentWhitelists().isEmpty()); + + assertFalse(manager.canUndoWhitelist()); + } + + @Test + void whitelistClipboardCopyAndPaste() { + manager.setCurrentWhitelists(Map.of(5, wl("minecraft:oak_log"))); + manager.copyWhitelistsToClipboard(); + assertTrue(manager.hasWhitelistClipboardData()); + + // Clear and paste + manager.setCurrentWhitelists(Map.of()); + manager.pasteWhitelistsFromClipboard(); + + Map result = manager.getCurrentWhitelists(); + assertNotNull(result); + assertEquals(1, result.size()); + assertEquals(List.of("minecraft:oak_log"), result.get(5).allowedItems()); + } +} diff --git a/multiloader-26.3/common/src/test/java/io/github/marcsanzdev/chestseparators/util/InventoryRetentionStepsTest.java b/multiloader-26.3/common/src/test/java/io/github/marcsanzdev/chestseparators/util/InventoryRetentionStepsTest.java new file mode 100644 index 0000000..1a268b9 --- /dev/null +++ b/multiloader-26.3/common/src/test/java/io/github/marcsanzdev/chestseparators/util/InventoryRetentionStepsTest.java @@ -0,0 +1,49 @@ +package io.github.marcsanzdev.chestseparators.util; + +import static org.junit.jupiter.api.Assertions.*; +import org.junit.jupiter.api.Test; + +class InventoryRetentionStepsTest { + @Test void marksAreAll64Then32Then16Then1() { + assertEquals(5, InventoryRetentionSteps.count()); + assertEquals(0, InventoryRetentionSteps.valueForStop(0)); + assertEquals(64, InventoryRetentionSteps.valueForStop(1)); + assertEquals(32, InventoryRetentionSteps.valueForStop(2)); + assertEquals(16, InventoryRetentionSteps.valueForStop(3)); + assertEquals(1, InventoryRetentionSteps.valueForStop(4)); + } + + @Test void continuousMappingIncludesEveryInteger() { + assertEquals(0, InventoryRetentionSteps.valueAtFraction(0)); + assertEquals(64, InventoryRetentionSteps.valueAtFraction(0.25)); + assertEquals(32, InventoryRetentionSteps.valueAtFraction(0.5)); + assertEquals(16, InventoryRetentionSteps.valueAtFraction(0.75)); + assertEquals(1, InventoryRetentionSteps.valueAtFraction(1)); + for (int count = 1; count <= 64; count++) { + assertEquals(count, InventoryRetentionSteps.valueAtFraction( + InventoryRetentionSteps.fractionForValue(count)), "round trip " + count); + } + } + + @Test void magnetOnlyEngagesNearStackMarks() { + double width = 96; + for (int stop : new int[] {16, 32, 64}) { + double at = InventoryRetentionSteps.fractionForValue(stop); + assertEquals(stop, InventoryRetentionSteps.detentNearFraction(at, width, 2.0)); + assertEquals(stop, InventoryRetentionSteps.detentNearFraction(at + 1.5 / width, width, 2.0)); + assertEquals(-1, InventoryRetentionSteps.detentNearFraction(at + 2.5 / width, width, 2.0)); + assertEquals(stop, InventoryRetentionSteps.detentNearFraction(at + 3.5 / width, width, 4.0)); + assertEquals(-1, InventoryRetentionSteps.detentNearFraction(at + 4.5 / width, width, 4.0)); + } + assertEquals(-1, InventoryRetentionSteps.detentNearFraction(0, width, 2.0)); + assertEquals(-1, InventoryRetentionSteps.detentNearFraction(1, width, 2.0)); + } + + @Test void savedCustomAmountsRemainUnchangedUntilEdited() { + assertEquals(0.0, InventoryRetentionSteps.fractionForValue(0)); + assertEquals(0.25, InventoryRetentionSteps.fractionForValue(999)); + assertEquals(27, InventoryRetentionSteps.adjustByWheel(28, -1)); + assertEquals(64, InventoryRetentionSteps.adjustByWheel(0, 1)); + assertEquals(1, InventoryRetentionSteps.adjustByWheel(1, -1)); + } +} diff --git a/multiloader-26.3/common/src/test/java/io/github/marcsanzdev/chestseparators/util/InventoryTransferPolicyTest.java b/multiloader-26.3/common/src/test/java/io/github/marcsanzdev/chestseparators/util/InventoryTransferPolicyTest.java new file mode 100644 index 0000000..54d55be --- /dev/null +++ b/multiloader-26.3/common/src/test/java/io/github/marcsanzdev/chestseparators/util/InventoryTransferPolicyTest.java @@ -0,0 +1,29 @@ +package io.github.marcsanzdev.chestseparators.util; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.Test; + +class InventoryTransferPolicyTest { + @Test void legacyZeroProtectsTheEntireMatchingStack() { + assertEquals(0, InventoryTransferPolicy.movableCount(64, 0, 0)); + } + + @Test void aSingleArrowIsKeptAndSurplusIsReleased() { + assertEquals(63, InventoryTransferPolicy.movableCount(64, 1, 0)); + assertEquals(0, InventoryTransferPolicy.movableCount(1, 1, 0)); + } + + @Test void groupTargetIsSharedAcrossSeveralSlots() { + assertEquals(0, InventoryTransferPolicy.movableCount(32, 64, 0)); + assertEquals(32, InventoryTransferPolicy.movableCount(64, 64, 32)); + assertEquals(64, InventoryTransferPolicy.movableCount(64, 1, 1)); + } + + @Test void pullRespectsTargetExceptWhenUnlimited() { + assertEquals(1, InventoryTransferPolicy.inboundRoom(1, 0)); + assertEquals(0, InventoryTransferPolicy.inboundRoom(1, 1)); + assertEquals(0, InventoryTransferPolicy.inboundRoom(16, 20)); + assertEquals(12, InventoryTransferPolicy.inboundRoom(16, 4)); + assertEquals(Integer.MAX_VALUE, InventoryTransferPolicy.inboundRoom(0, 64)); + } +} diff --git a/multiloader-26.3/fabric/build.gradle b/multiloader-26.3/fabric/build.gradle new file mode 100644 index 0000000..0aca806 --- /dev/null +++ b/multiloader-26.3/fabric/build.gradle @@ -0,0 +1,78 @@ +plugins { + id 'com.gradleup.shadow' +} + +architectury { + platformSetupLoomIde() + fabric() +} + +configurations { + common { + canBeResolved = true + canBeConsumed = false + } + compileClasspath.extendsFrom common + runtimeClasspath.extendsFrom common + developmentFabric.extendsFrom common + + // Files in this configuration will be bundled into your mod using the Shadow plugin. + // Don't use the `shadow` configuration from the plugin itself as it's meant for excluding files. + shadowBundle { + canBeResolved = true + canBeConsumed = false + } +} + +repositories { + maven { url "https://maven.terraformersmc.com/releases/" } // Mod Menu + maven { url "https://maven.shedaniel.me/" } // Cloth Config +} + +dependencies { + implementation "net.fabricmc:fabric-loader:$rootProject.fabric_loader_version" + + // Fabric API. This is technically optional, but you probably want it anyway. + implementation "net.fabricmc.fabric-api:fabric-api:$rootProject.fabric_api_version" + + // Architectury API (Fabric). + implementation "dev.architectury:architectury-fabric:$rootProject.architectury_api_version" + + // Cloth Config (Fabric) — the real config-screen impl; a required dependency of the config screen. + implementation("me.shedaniel.cloth:cloth-config-fabric:$rootProject.cloth_config_version") { + exclude group: "net.fabricmc.fabric-api" + } + // ModMenu hosts the config button. Compile the ModMenuApi entrypoint against it; it stays optional at + // runtime (declared "suggests" in fabric.mod.json), and is loaded in dev so the config screen is testable. + compileOnly("com.terraformersmc:modmenu:$rootProject.modmenu_version") { exclude group: "net.fabricmc" } + localRuntime("com.terraformersmc:modmenu:$rootProject.modmenu_version") { exclude group: "net.fabricmc" } + + common(project(path: ':common')) { transitive = false } + shadowBundle project(path: ':common', configuration: 'transformProductionFabric') +} + +processResources { + inputs.property 'version', project.version + + filesMatching('fabric.mod.json') { + expand version: inputs.properties.version + } +} + +// No-remap era (MC 26.x, unobfuscated): there is no remapJar. Loom processes the base `jar` (classifier +// 'raw'); shadowJar then unpacks it and bundles the transformed common classes into the publishable jar +// AbsoluteOrder-2.1.0-fork.1-fabric-mc.jar. +jar { + archiveClassifier = "raw" +} + +shadowJar { + dependsOn jar + mainSpec.sourcePaths.clear() + from zipTree(jar.archiveFile) + configurations = [project.configurations.shadowBundle] + archiveClassifier = "fabric-mc${rootProject.minecraft_version}" +} + +// The publishable jar is the shadowJar (bundles common); make `build`/`assemble` produce it. +tasks.named('assemble') { dependsOn tasks.named('shadowJar') } diff --git a/multiloader-26.3/fabric/src/main/java/io/github/marcsanzdev/chestseparators/fabric/AbsoluteOrderClientFabric.java b/multiloader-26.3/fabric/src/main/java/io/github/marcsanzdev/chestseparators/fabric/AbsoluteOrderClientFabric.java new file mode 100644 index 0000000..762bed0 --- /dev/null +++ b/multiloader-26.3/fabric/src/main/java/io/github/marcsanzdev/chestseparators/fabric/AbsoluteOrderClientFabric.java @@ -0,0 +1,13 @@ +package io.github.marcsanzdev.chestseparators.fabric; + +import io.github.marcsanzdev.chestseparators.AbsoluteOrderClient; +import net.fabricmc.api.ClientModInitializer; + +/** Fabric client entry point — delegates to the common client bootstrap. */ +public final class AbsoluteOrderClientFabric implements ClientModInitializer { + + @Override + public void onInitializeClient() { + AbsoluteOrderClient.init(); + } +} diff --git a/multiloader-26.3/fabric/src/main/java/io/github/marcsanzdev/chestseparators/fabric/AbsoluteOrderFabric.java b/multiloader-26.3/fabric/src/main/java/io/github/marcsanzdev/chestseparators/fabric/AbsoluteOrderFabric.java new file mode 100644 index 0000000..9f32324 --- /dev/null +++ b/multiloader-26.3/fabric/src/main/java/io/github/marcsanzdev/chestseparators/fabric/AbsoluteOrderFabric.java @@ -0,0 +1,13 @@ +package io.github.marcsanzdev.chestseparators.fabric; + +import io.github.marcsanzdev.chestseparators.AbsoluteOrder; +import net.fabricmc.api.ModInitializer; + +/** Fabric loader entry point — delegates to the common bootstrap. */ +public final class AbsoluteOrderFabric implements ModInitializer { + + @Override + public void onInitialize() { + AbsoluteOrder.init(); + } +} diff --git a/multiloader-26.3/fabric/src/main/java/io/github/marcsanzdev/chestseparators/fabric/ModMenuIntegration.java b/multiloader-26.3/fabric/src/main/java/io/github/marcsanzdev/chestseparators/fabric/ModMenuIntegration.java new file mode 100644 index 0000000..af51b5d --- /dev/null +++ b/multiloader-26.3/fabric/src/main/java/io/github/marcsanzdev/chestseparators/fabric/ModMenuIntegration.java @@ -0,0 +1,14 @@ +package io.github.marcsanzdev.chestseparators.fabric; + +import com.terraformersmc.modmenu.api.ConfigScreenFactory; +import com.terraformersmc.modmenu.api.ModMenuApi; +import io.github.marcsanzdev.chestseparators.client.config.AbsoluteOrderConfigScreen; + +/** Fabric ModMenu integration — hosts the common Cloth Config screen. */ +public class ModMenuIntegration implements ModMenuApi { + + @Override + public ConfigScreenFactory getModConfigScreenFactory() { + return AbsoluteOrderConfigScreen::buildScreen; + } +} diff --git a/multiloader-26.3/fabric/src/main/resources/assets/chestseparators/icon.png b/multiloader-26.3/fabric/src/main/resources/assets/chestseparators/icon.png new file mode 100644 index 0000000..4598381 Binary files /dev/null and b/multiloader-26.3/fabric/src/main/resources/assets/chestseparators/icon.png differ diff --git a/multiloader-26.3/fabric/src/main/resources/fabric.mod.json b/multiloader-26.3/fabric/src/main/resources/fabric.mod.json new file mode 100644 index 0000000..5b60a3a --- /dev/null +++ b/multiloader-26.3/fabric/src/main/resources/fabric.mod.json @@ -0,0 +1,38 @@ +{ + "schemaVersion": 1, + "id": "chestseparators", + "version": "${version}", + "name": "Absolute Order", + "description": "Custom chest auto-sorter with visual separators and per-slot filters.", + "authors": ["marcsanz-dev"], + "icon": "assets/chestseparators/icon.png", + "environment": "*", + "entrypoints": { + "main": [ + "io.github.marcsanzdev.chestseparators.fabric.AbsoluteOrderFabric" + ], + "client": [ + "io.github.marcsanzdev.chestseparators.fabric.AbsoluteOrderClientFabric" + ], + "modmenu": [ + "io.github.marcsanzdev.chestseparators.fabric.ModMenuIntegration" + ], + "rei_client": [ + "io.github.marcsanzdev.chestseparators.compat.ChestSeparatorsReiPlugin" + ] + }, + "mixins": [ + "absoluteorder.mixins.json" + ], + "depends": { + "fabricloader": ">=0.19.5", + "minecraft": ">=26.3 <26.4", + "java": ">=25", + "fabric-api": "*", + "architectury": "*", + "cloth-config": "*" + }, + "suggests": { + "modmenu": "*" + } +} diff --git a/multiloader-26.3/gradle.properties b/multiloader-26.3/gradle.properties new file mode 100644 index 0000000..785ff5d --- /dev/null +++ b/multiloader-26.3/gradle.properties @@ -0,0 +1,25 @@ +org.gradle.jvmargs=-Xmx3G +org.gradle.parallel=true + +# Absolute Order fork release: retain the upstream mod ID (chestseparators) for saved data compatibility. +# The suffix identifies this as a community-maintained fork, not the upstream 2.0.0 artifact. +mod_version = 2.1.0-fork.1 +maven_group = io.github.marcsanzdev +archives_name = AbsoluteOrder +enabled_platforms = fabric + +# Minecraft 26.3, Java 25, Architectury Loom no-remap. +minecraft_version = 26.3 + +# Fabric 26.3 dependency baseline. Keep this port Fabric-only until any other loader is tested. +architectury_api_version = 22.0.6 +fabric_loader_version = 0.19.5 +fabric_api_version = 0.165.2+26.3 + +# Fabric client dependencies (Cloth Config required, Mod Menu optional). +cloth_config_version = 26.3.159 +modmenu_version = 21.0.1 + +# Optional recipe-viewer API used for GUI exclusion zones (compileOnly). +# EMI support is absent in the base 26.x source and is not added by this port. +rei_version = 26.3.824 diff --git a/multiloader-26.3/gradle/wrapper/gradle-wrapper.jar b/multiloader-26.3/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..e644113 Binary files /dev/null and b/multiloader-26.3/gradle/wrapper/gradle-wrapper.jar differ diff --git a/multiloader-26.3/gradle/wrapper/gradle-wrapper.properties b/multiloader-26.3/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..dbc3ce4 --- /dev/null +++ b/multiloader-26.3/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,7 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.0-bin.zip +networkTimeout=10000 +validateDistributionUrl=true +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/multiloader-26.3/gradlew b/multiloader-26.3/gradlew new file mode 100755 index 0000000..b740cf1 --- /dev/null +++ b/multiloader-26.3/gradlew @@ -0,0 +1,249 @@ +#!/bin/sh + +# +# Copyright © 2015-2021 the original authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac +done + +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { + echo "$*" +} >&2 + +die () { + echo + echo "$*" + echo + exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD=$JAVA_HOME/jre/sh/java + else + JAVACMD=$JAVA_HOME/bin/java + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD=java + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/multiloader-26.3/gradlew.bat b/multiloader-26.3/gradlew.bat new file mode 100644 index 0000000..25da30d --- /dev/null +++ b/multiloader-26.3/gradlew.bat @@ -0,0 +1,92 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/multiloader-26.3/settings.gradle b/multiloader-26.3/settings.gradle new file mode 100644 index 0000000..acff8ee --- /dev/null +++ b/multiloader-26.3/settings.gradle @@ -0,0 +1,13 @@ +pluginManagement { + repositories { + maven { url = 'https://maven.fabricmc.net/' } + maven { url = 'https://maven.architectury.dev/' } + maven { url = 'https://files.minecraftforge.net/maven/' } + gradlePluginPortal() + } +} + +rootProject.name = 'absolute-order' + +include 'common' +include 'fabric' diff --git a/multiloader-26.3/tools/client-mechanical-rename.sed b/multiloader-26.3/tools/client-mechanical-rename.sed new file mode 100644 index 0000000..478a65d --- /dev/null +++ b/multiloader-26.3/tools/client-mechanical-rename.sed @@ -0,0 +1,118 @@ +# Mechanical yarn(1.21.11 snapshot) -> Mojmap rename script for the client/editor cluster. +# Reproducible: apply to the OLD src client/ui files copied into common. Fabric-API refactors +# (networking, keybind poll, screen-mouse events, world-render) are done BY HAND afterwards. +# Usage: sed -i -f multiloader/tools/client-mechanical-rename.sed + +# ---- package-qualified imports (specific first) ---- +s#net\.minecraft\.client\.gui\.DrawContext#net.minecraft.client.gui.GuiGraphics#g +s#net\.minecraft\.client\.gui\.screen\.ingame\.HandledScreen#net.minecraft.client.gui.screens.inventory.AbstractContainerScreen#g +s#net\.minecraft\.client\.gui\.screen\.ingame\.ShulkerBoxScreen#net.minecraft.client.gui.screens.inventory.ShulkerBoxScreen#g +s#net\.minecraft\.client\.gui\.screen\.ingame\.InventoryScreen#net.minecraft.client.gui.screens.inventory.InventoryScreen#g +s#net\.minecraft\.client\.gui\.screen\.ingame\.CreativeInventoryScreen#net.minecraft.client.gui.screens.inventory.CreativeModeInventoryScreen#g +s#net\.minecraft\.client\.gui\.screen\.Screen#net.minecraft.client.gui.screens.Screen#g +s#net\.minecraft\.client\.gui\.widget\.TextFieldWidget#net.minecraft.client.gui.components.EditBox#g +s#net\.minecraft\.client\.gui\.Click#net.minecraft.client.input.MouseButtonEvent#g +s#net\.minecraft\.client\.input\.KeyInput#net.minecraft.client.input.KeyEvent#g +s#net\.minecraft\.client\.input\.CharInput#net.minecraft.client.input.CharacterEvent#g +s#net\.minecraft\.client\.MinecraftClient#net.minecraft.client.Minecraft#g +s#net\.minecraft\.client\.gl\.RenderPipelines#net.minecraft.client.renderer.RenderPipelines#g +s#net\.minecraft\.client\.render\.item\.ItemRenderState#net.minecraft.client.renderer.item.ItemStackRenderState#g +s#net\.minecraft\.client\.item\.ItemModelManager#net.minecraft.client.renderer.item.ItemModelResolver#g +s#net\.minecraft\.client\.render\.command\.OrderedRenderCommandQueue#net.minecraft.client.renderer.OrderedSubmitNodeCollector#g +s#net\.minecraft\.client\.render\.OverlayTexture#net.minecraft.client.renderer.texture.OverlayTexture#g +s#net\.minecraft\.client\.render\.Camera#net.minecraft.client.Camera#g +s#net\.minecraft\.client\.util\.math\.MatrixStack#com.mojang.blaze3d.vertex.PoseStack#g +s#net\.minecraft\.client\.util\.InputUtil#com.mojang.blaze3d.platform.InputConstants#g +s#net\.minecraft\.client\.option\.KeyBinding#net.minecraft.client.KeyMapping#g +s#net\.minecraft\.client\.world\.ClientWorld#net.minecraft.client.multiplayer.ClientLevel#g +s#net\.minecraft\.screen\.slot\.Slot#net.minecraft.world.inventory.Slot#g +s#net\.minecraft\.screen\.GenericContainerScreenHandler#net.minecraft.world.inventory.ChestMenu#g +s#net\.minecraft\.screen\.ScreenHandler#net.minecraft.world.inventory.AbstractContainerMenu#g +s#net\.minecraft\.text\.Text#net.minecraft.network.chat.Component#g +s#net\.minecraft\.util\.Formatting#net.minecraft.ChatFormatting#g +s#net\.minecraft\.util\.Identifier#net.minecraft.resources.Identifier#g +s#net\.minecraft\.util\.math\.MathHelper#net.minecraft.util.Mth#g +s#net\.minecraft\.util\.math\.BlockPos#net.minecraft.core.BlockPos#g +s#net\.minecraft\.util\.math\.Vec3d#net.minecraft.world.phys.Vec3#g +s#net\.minecraft\.util\.math\.Direction#net.minecraft.core.Direction#g +s#net\.minecraft\.util\.math\.RotationAxis#com.mojang.math.Axis#g +s#net\.minecraft\.util\.HeldItemContext#net.minecraft.world.item.HeldItemContext#g +s#net\.minecraft\.registry\.Registries#net.minecraft.core.registries.BuiltInRegistries#g +s#net\.minecraft\.item\.ItemDisplayContext#net.minecraft.world.item.ItemDisplayContext#g +s#net\.minecraft\.item\.ItemGroup#net.minecraft.world.item.CreativeModeTab#g +s#net\.minecraft\.item\.ItemStack#net.minecraft.world.item.ItemStack#g +s#net\.minecraft\.item\.Item#net.minecraft.world.item.Item#g +s#net\.minecraft\.particle\.ParticleTypes#net.minecraft.core.particles.ParticleTypes#g +s#net\.minecraft\.sound\.SoundEvents#net.minecraft.sounds.SoundEvents#g +s#net\.minecraft\.sound\.SoundEvent#net.minecraft.sounds.SoundEvent#g +s#net\.minecraft\.sound\.SoundCategory#net.minecraft.sounds.SoundSource#g +s#net\.minecraft\.block\.entity\.#net.minecraft.world.level.block.entity.#g +s#net\.minecraft\.block\.enums\.ChestType#net.minecraft.world.level.block.state.properties.ChestType#g +s#net\.minecraft\.block\.BlockState#net.minecraft.world.level.block.state.BlockState#g +s#net\.minecraft\.block\.#net.minecraft.world.level.block.#g +s#net\.minecraft\.world\.World#net.minecraft.world.level.Level#g +# ---- bare type identifiers (word-boundary) ---- +s#\bDrawContext\b#GuiGraphics#g +s#\bMinecraftClient\b#Minecraft#g +s#\bMathHelper\b#Mth#g +s#\bFormatting\b#ChatFormatting#g +s#\bHandledScreen\b#AbstractContainerScreen#g +s#\bScreenHandler\b#AbstractContainerMenu#g +s#\bGenericContainerScreenHandler\b#ChestMenu#g +s#\bMatrixStack\b#PoseStack#g +s#\bClientWorld\b#ClientLevel#g +s#\bRotationAxis\b#Axis#g +s#\bVec3d\b#Vec3#g +s#\bItemGroup\b#CreativeModeTab#g +s#\bCreativeInventoryScreen\b#CreativeModeInventoryScreen#g +s#\bKeyInput\b#KeyEvent#g +s#\bCharInput\b#CharacterEvent#g +# ---- Text -> Component (type + factories) ---- +s#\bText\.translatable#Component.translatable#g +s#\bText\.literal#Component.literal#g +s#\bText\.empty#Component.empty#g +s#\bText\.of\b#Component.literal#g +s#\bList#List#g +s###g +s#\bText\[\]#Component[]#g +s#\bText #Component #g +s#(\bText)#(Component)#g +# ---- render/text method renames ---- +s#\.getMatrices()#.pose()#g +s#\.drawTexture(#.blit(#g +s#\.drawText(#.drawString(#g +s#\.drawStrokedRectangle(#.renderOutline(#g +s#\.textRenderer\b#.font#g +s#\.currentScreenHandler\b#.containerMenu#g + +s#net\.minecraft\.registry\.tag\.#net.minecraft.tags.#g +s#net\.minecraft\.text\.MutableText#net.minecraft.network.chat.MutableComponent#g +s#\bTextFieldWidget\b#EditBox#g +s#\bItemRenderState\b#ItemStackRenderState#g +s#\bItemModelManager\b#ItemModelResolver#g +s#\bOrderedRenderCommandQueue\b#OrderedSubmitNodeCollector#g +s#\bMutableText\b#MutableComponent#g +s#\bSoundCategory\b#SoundSource#g +s#\bAnimationStage\b#AnimationStatus#g +s#\.currentScreen\b#.screen#g +s#\.sendMessage(#.displayClientMessage(#g +s#\.formatted(#.withStyle(#g +s#SoundEvents\.ENTITY_ITEM_PICKUP#SoundEvents.ITEM_PICKUP#g +s#SoundEvents\.BLOCK_SHULKER_BOX_OPEN#SoundEvents.SHULKER_BOX_OPEN#g +s#SoundEvents\.BLOCK_SHULKER_BOX_CLOSE#SoundEvents.SHULKER_BOX_CLOSE#g +s#SoundEvents\.BLOCK_ENDER_CHEST_OPEN#SoundEvents.ENDER_CHEST_OPEN#g +s#SoundEvents\.BLOCK_ENDER_CHEST_CLOSE#SoundEvents.ENDER_CHEST_CLOSE#g +s#SoundEvents\.BLOCK_CHEST_OPEN#SoundEvents.CHEST_OPEN#g +s#SoundEvents\.BLOCK_CHEST_CLOSE#SoundEvents.CHEST_CLOSE#g + +# ---- hub/EditBox/registry general rules ---- +s#import net\.minecraft\.item\.\*;#import net.minecraft.world.item.*;#g +s#BuiltInRegistries\.ITEM_GROUP#BuiltInRegistries.CREATIVE_MODE_TAB#g +s#CREATIVE_MODE_TAB\.getId(#CREATIVE_MODE_TAB.getKey(#g +s#\.setDrawsBackground(#.setBordered(#g +s#\.setChangedListener(#.setResponder(#g +s#\.getIndex()#.getContainerSlot()#g +s#Block\.getBlockFromItem(#Block.byItem(#g +s#client\.world\b#client.level#g +s#getInstance()\.world\b#getInstance().level#g +s#\.getText()#.getValue()#g