From 855c984b3700507a225ff20d5551b064b92ec435 Mon Sep 17 00:00:00 2001 From: Siphalor Date: Tue, 23 May 2023 00:13:23 +0200 Subject: [PATCH 01/21] Add 1.19.4 branch to Giup --- .giup | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.giup b/.giup index c29e9fac..bf611d4f 100644 --- a/.giup +++ b/.giup @@ -2,7 +2,7 @@ "merge-paths": [ "1.16", "1.16->1.15->1.14", - "1.16->1.17->1.18.2->1.19->1.19.3->unstable" + "1.16->1.17->1.18.2->1.19->1.19.3->1.19.4->unstable" ], "commands": [ { From 829960c5a86ccd3a432d69d727b29afeca8edb3c Mon Sep 17 00:00:00 2001 From: Siphalor Date: Fri, 9 Jun 2023 23:15:20 +0200 Subject: [PATCH 02/21] Add an action for fixing language file names --- .github/workflows/push-main.yaml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 .github/workflows/push-main.yaml diff --git a/.github/workflows/push-main.yaml b/.github/workflows/push-main.yaml new file mode 100644 index 00000000..76f0d36d --- /dev/null +++ b/.github/workflows/push-main.yaml @@ -0,0 +1,28 @@ +on: + push: + branches: + - "1.16" + + +jobs: + auto-fix: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Fix language file names + run: | + for lang in src/main/resources/assets/*/lang/*.json + do + rename=$(echo "$lang" | sed -e 's/\b\w\+\.json$/\L\0/' -e 's/\b\([a-z]\+\)\.json$/\/\1_\1.json/') + mv "$lang" "$rename" + done + echo done + + - name: Commit + uses: EndBug/add-and-commit@v9 + with: + add: 'src/main/resources/assets' + default_author: github_actions + message: Fix language file names From 593ea3db5137cf5a74013d87880aa116f2ddce77 Mon Sep 17 00:00:00 2001 From: Weblate Date: Fri, 9 Jun 2023 21:15:43 +0000 Subject: [PATCH 03/21] Translated using Weblate (German (de_DE)) Currently translated at 100.0% (97 of 97 strings) Co-authored-by: Weblate Co-authored-by: theflusspferd Translate-URL: https://weblate.siphalor.de/projects/mouse-wheelie/lang/de_DE/ Translation: Mouse Wheelie/Mouse Wheelie --- .../assets/mousewheelie/lang/de_de.json | 54 +++++++++++-------- 1 file changed, 31 insertions(+), 23 deletions(-) diff --git a/src/main/resources/assets/mousewheelie/lang/de_de.json b/src/main/resources/assets/mousewheelie/lang/de_de.json index 628995dd..5b11fa3b 100644 --- a/src/main/resources/assets/mousewheelie/lang/de_de.json +++ b/src/main/resources/assets/mousewheelie/lang/de_de.json @@ -17,26 +17,26 @@ "tweed4_tailor_screen.screen.mousewheelie": "Mouse Wheelie Einstellungen", "tweed4_tailor_screen.screen.mousewheelie.general": "Allgemein", "tweed4_tailor_screen.screen.mousewheelie.general.hotbar-scoping": "Hotbar-Abgrenzung", - "tweed4_tailor_screen.screen.mousewheelie.general.hotbar-scoping.description": "Die Hotbar als eigenen Bereich behandeln:\n HARD: immer\n SOFT: nicht, wenn das gesamte Inventar gescrollt wird\n OFF: keine Abgrenzung", + "tweed4_tailor_screen.screen.mousewheelie.general.hotbar-scoping.description": "Die Hotbar als eigenen Bereich behandeln(z.B. beim Scrollen oder Sortieren des Inventars).\n HARD: Die Hotbar wird immer als eigener Bereich behandelt.\n SOFT: Die Hotbar wird immer als eigener Bereich behandelt, außer wenn das gesamte Inventar gescrollt wird.\n NONE: Die Hotbar wird als Teil des Inventars behandelt.", "tweed4_tailor_screen.screen.mousewheelie.general.enable-quick-craft": "Schnelles Herstellen", - "tweed4_tailor_screen.screen.mousewheelie.general.enable-quick-craft.description": "Beim Rechtsklicken von Einträgen im Rezeptbuch diese Herstellen und in die Hand nehmen.\nShift drücken, um ganze Stacks zu produzieren.", + "tweed4_tailor_screen.screen.mousewheelie.general.enable-quick-craft.description": "Aktiviert sofortiges Herstellen bei Rechtsklick auf einen Eintrag im Rezeptbuch und sofortiges Handeln bei Rechtsklick auf ein Angebot. Mit Shift werden ganze Stapel produziert.", "tweed4_tailor_screen.screen.mousewheelie.scrolling": "Scrollen", "tweed4_tailor_screen.screen.mousewheelie.scrolling.enable": "Scrollen zum Bewegen von Gegenständen", "tweed4_tailor_screen.screen.mousewheelie.scrolling.invert": "Scroll-Richtung umkehren", - "tweed4_tailor_screen.screen.mousewheelie.scrolling.invert.description": "Betrifft nur das Scrollen von Gegenständen", + "tweed4_tailor_screen.screen.mousewheelie.scrolling.invert.description": "Kehre die Scrollrichtung beim Scrollen von Gegenständen um.", "tweed4_tailor_screen.screen.mousewheelie.scrolling.directional-scrolling": "Richtungsgesteuertes Scrollen", "tweed4_tailor_screen.screen.mousewheelie.scrolling.directional-scrolling.description": "Gegenstände in die Richtung bewegen, in die gescrollt wird.\nAlternativ werden Stacks je nach Scroll-Richtung vergrößert bzw. verkleinert.", "tweed4_tailor_screen.screen.mousewheelie.scrolling.scroll-creative-menu-items": "Gegenstände aus dem Kreativ-Inventar scrollen", "tweed4_tailor_screen.screen.mousewheelie.scrolling.scroll-creative-menu-items.description": "Definiert, ob Gegenstände aus dem Kreativ-Inventar gescrollt werden oder ob das Kreativ-Inventar selbst bewegt werden soll (Vanilla).", "tweed4_tailor_screen.screen.mousewheelie.scrolling.scroll-creative-menu-tabs": "Tabs vom Kreativ-Inventar scrollen", - "tweed4_tailor_screen.screen.mousewheelie.scrolling.scroll-creative-menu-tabs.description": "Definiert, ob die Tabs im Kreativ-Inventar durchgescrollt werden wenn über ihnen gescrollt wird.\nAlternativ wird das Kreativ-Inventar gescrollt (Vanilla).", + "tweed4_tailor_screen.screen.mousewheelie.scrolling.scroll-creative-menu-tabs.description": "Definiert, ob die Tabs im Kreativ-Inventar beim darüberscrollen gewechselt werden können, sonst wird im Inventar gescrollt (Vanilla).", "tweed4_tailor_screen.screen.mousewheelie.sort": "Sortierung", "tweed4_tailor_screen.screen.mousewheelie.sort.primary-sort": "Mittlere Maustaste", - "tweed4_tailor_screen.screen.mousewheelie.sort.primary-sort.description": "Setzt den Sortiermodus auf der Erstbelegung.\nDie Taste für das Sortieren kann in den Minecraft-Tastatur-Einstellungen angepasst werden", + "tweed4_tailor_screen.screen.mousewheelie.sort.primary-sort.description": "Setzt den Sortiermodus auf der Erstbelegung.", "tweed4_tailor_screen.screen.mousewheelie.sort.shift-sort": "Umschalt & mittlere Maustaste", - "tweed4_tailor_screen.screen.mousewheelie.sort.shift-sort.description": "Setzt den Sortiermodus auf der Zweitbelegung (mit Umschalt)", + "tweed4_tailor_screen.screen.mousewheelie.sort.shift-sort.description": "Definiert den Sortiermodus auf der Zweitbelegung (mit Umschalt).", "tweed4_tailor_screen.screen.mousewheelie.sort.control-sort": "Steuerung & mittlere Maustaste", - "tweed4_tailor_screen.screen.mousewheelie.sort.control-sort.description": "Setzt den Sortiermodus auf der Drittbelegung (mit Steuerung)", + "tweed4_tailor_screen.screen.mousewheelie.sort.control-sort.description": "Definiert den Sortiermodus auf der Drittbelegung (mit Steuerung).", "tweed4_tailor_screen.screen.mousewheelie.refill": "Auffüllen", "tweed4_tailor_screen.screen.mousewheelie.refill.off-hand": "Zweithand auffüllen", "tweed4_tailor_screen.screen.mousewheelie.refill.off-hand.description": "Gegenstände in der Zweithand nachfüllen.", @@ -47,26 +47,26 @@ "tweed4_tailor_screen.screen.mousewheelie.refill.use": "Benutzte Gegenstände nachladen", "tweed4_tailor_screen.screen.mousewheelie.refill.use.description": "Abgenutzte Gegenstände und Blöcke nachfüllen.", "tweed4_tailor_screen.screen.mousewheelie.refill.other": "Sonstiges Nachladen", - "tweed4_tailor_screen.screen.mousewheelie.refill.other.description": "Andere Nachladeereignisse", + "tweed4_tailor_screen.screen.mousewheelie.refill.other.description": "Andere Auffüllereignisse.", "tweed4_tailor_screen.screen.mousewheelie.refill.rules": "Auffüll-Regeln", - "tweed4_tailor_screen.screen.mousewheelie.refill.rules.description": "Regeln zum Finden von ähnlichen Gegenständen zum Nachfüllen anpassen", + "tweed4_tailor_screen.screen.mousewheelie.refill.rules.description": "Regeln zum Finden von ähnlichen Gegenständen zum Nachfüllen anpassen.", "tweed4_tailor_screen.screen.mousewheelie.refill.rules.any-block": "Mit beliebigen Blöcken auffüllen", - "tweed4_tailor_screen.screen.mousewheelie.refill.rules.any-block.description": "Füllt mit beliebigen Blöcken auf", + "tweed4_tailor_screen.screen.mousewheelie.refill.rules.any-block.description": "Füllt mit beliebigen Blöcken auf.", "tweed4_tailor_screen.screen.mousewheelie.refill.rules.itemgroup": "Nach Gegenstandsgruppen auffüllen", - "tweed4_tailor_screen.screen.mousewheelie.refill.rules.itemgroup.description": "Es werden die Gegenstandsgruppen des Kreativinventars verwendet", + "tweed4_tailor_screen.screen.mousewheelie.refill.rules.itemgroup.description": "Es werden die Gegenstandsgruppen des Kreativinventars verwendet.", "tweed4_tailor_screen.screen.mousewheelie.refill.rules.item-hierarchy": "Gegenstände nach Funktionalität auffüllen", "tweed4_tailor_screen.screen.mousewheelie.refill.rules.block-hierarchy": "Blöcke nach Funktionalität auffüllen", "tweed4_tailor_screen.screen.mousewheelie.refill.rules.food": "Essen auffüllen", - "tweed4_tailor_screen.screen.mousewheelie.refill.rules.food.description": "Mit beliebigen Essen auffüllen", + "tweed4_tailor_screen.screen.mousewheelie.refill.rules.food.description": "Mit beliebigen Essen auffüllen.", "tweed4_tailor_screen.screen.mousewheelie.refill.rules.equal-items": "Mit gleicher Gegenstandsart auffüllen", - "tweed4_tailor_screen.screen.mousewheelie.refill.rules.equal-items.description": "Mit gleichen Gegenständen auffüllen.\nNBT-Daten wie die Beschädigung von Gegenständen wird nicht beachtet-", + "tweed4_tailor_screen.screen.mousewheelie.refill.rules.equal-items.description": "Versuche, gleiche Gegenstände zu finden (NBT-Daten wie die Beschädigung von Gegenständen werden nicht beachtet).", "tweed4_tailor_screen.screen.mousewheelie.refill.rules.equal-stacks": "Mit identischen Gegenständen auffüllen", "tweed4_tailor_screen.screen.mousewheelie.refill.rules.equal-stacks.description": "Verzauberungen, Beschädigung, Name und ähnliches wird beachtet.", "tweed4_tailor_screen.screen.mousewheelie.tool-picking": "Werkzeug finden", - "tweed4_tailor_screen.screen.mousewheelie.tool-picking.hold-tool": "Optimales Werkzeug bei Werkzeug wählen", - "tweed4_tailor_screen.screen.mousewheelie.tool-picking.hold-tool.description": "Beim Drücken der mittleren Maustaste das optimale Werkzeug für den anvisierten Block wählen.\nDer Spieler muss dabei bereits ein Werkzeug in der Htool-pickingand halten.", - "tweed4_tailor_screen.screen.mousewheelie.tool-picking.hold-block": "Optimales Werkzeug bei Block wählen", - "tweed4_tailor_screen.screen.mousewheelie.tool-picking.hold-block.description": "Beim Drücken der mittleren Maustaste das optimale Werkzeug für den anvisierten Block wählen.\nDie Interaktion erfolgt wenn der Spieler den anvisierten Block als Gegenstand in der Hand hält.", + "tweed4_tailor_screen.screen.mousewheelie.tool-picking.hold-tool": "Optimales Werkzeug bei Mittelklick wählen", + "tweed4_tailor_screen.screen.mousewheelie.tool-picking.hold-tool.description": "Beim Halten eines Werkzeuges wird dieses durch einen Mittelklick zum optimalen Werkzeug für den anvisierten Block gewechselt.", + "tweed4_tailor_screen.screen.mousewheelie.tool-picking.hold-block": "Optimales Werkzeug per Mittelklick auswählen, wenn der anvisierte Block in der Hand gehalten wird", + "tweed4_tailor_screen.screen.mousewheelie.tool-picking.hold-block.description": "Beim Drücken der mittleren Maustaste das optimale Werkzeug für den anvisierten Block wählen, wenn der Spieler den anvisierten Block als Gegenstand in der Hand hält.", "tweed4_tailor_screen.screen.mousewheelie.tool-picking.pick-from-inventory": "Aus dem Inventar wählen", "tweed4_tailor_screen.screen.mousewheelie.tool-picking.pick-from-inventory.description": "Bei der Suche nach passenden Werkzeugen das gesamte Inventar verwenden,\nstatt nur der Hotbar.", "tweed4_tailor_screen.screen.mousewheelie.general.interaction-rate": "Interaktionsrate", @@ -80,12 +80,20 @@ "tweed4_tailor_screen.screen.mousewheelie.general.better-fast-dragging": "Besseres schnelles Maus-Ziehen", "tweed4_tailor_screen.screen.mousewheelie.general.item-kinds-nbt-match-mode.description": "Ob, Gegenstandstypen die Einteilung nach NBT-Daten vornehmen.\nDies hat beispielsweise Einfluss auf Scrollen oder das Fallenlassen von Gegenständen aus dem Inventar.\nNONE deaktiviert die NBT-Prüfung, ALL prüft auf den exakt gleichen Gegenstand und SOME erlaubt Abweichungen im Gegenstandsschaden und in Verzauberungen.", "tweed4_tailor_screen.screen.mousewheelie.general.better-fast-dragging.description": "Dies hilft, wenn du häufig die Maus schneller bewegst als das Spiel dies registrieren kann.\nDiese Option kann allerdings die Leistung beeinflussen.", - "tweed4_tailor_screen.screen.mousewheelie.sort.description": "Ändert die Sortiermodi. Existierende Modi sind ALPHABET (alphabetisch), RAW_ID (wie Kreativinventar) und QUANTITY (nach Menge der Stapel)", - "tweed4_tailor_screen.screen.mousewheelie.refill.description": "Stelle hier das Nachfüllen von Gegenständen ein.", + "tweed4_tailor_screen.screen.mousewheelie.sort.description": "Ändert die Sortiermodi. Existierende Modi sind ALPHABET (alphabetisch), RAW_ID (wie Kreativinventar) und QUANTITY (nach Größe und Menge der Stapel).\nAb Version 1.19 gibt es außerdem CREATIVE_SEARCH (wie die Suche im Kreativinventar).", + "tweed4_tailor_screen.screen.mousewheelie.refill.description": "Itemauffüllung holt automatisch mehr Gegenstände der gleichen Art aus dem Inventar, wenn der gerade benutzte Stapel leer wird.\nDas ist zum Beispiel nützlich beim Bauen mit sehr vielen Blöcken der gleichen Sorte, so dass du nicht ständig das Inventar öffnen musst.", "tweed4_tailor_screen.screen.mousewheelie.refill.restore-selected-slot.description": "Stellt sicher, dass Gegenstände in den zuvor gewählten Hotbar-Slot nachgefüllt werden.\nDies kann etwas länger dauern. Bei langsameren Verbindungen sollte dies eventuell deaktiviert werden.", - "tweed4_tailor_screen.screen.mousewheelie.refill.rules.item-hierarchy.description": "Versuche ähnliche Gegenstände durch die Klassenhierarchie zu finden", - "tweed4_tailor_screen.screen.mousewheelie.refill.rules.block-hierarchy.description": "Versuche ähnliche Blöcke durch die Blockklassenhierarchie zu finden", - "tweed4_tailor_screen.screen.mousewheelie.tool-picking.description": "Stelle ein, wie das korrekte Werkzeug für den aktuell betrachteten Block ausgewählt wird.", + "tweed4_tailor_screen.screen.mousewheelie.refill.rules.item-hierarchy.description": "Versuche ähnliche Gegenstände durch die Gegenstandstyphierarchie zu finden.\nDas bedeutet normalerweise eine ähnliche Funktion.", + "tweed4_tailor_screen.screen.mousewheelie.refill.rules.block-hierarchy.description": "Versuche ähnliche Blöcke durch die Blocktyphierarchie zu finden.\nDas bedeutet normalerweise eine ähnliche Funktion.", + "tweed4_tailor_screen.screen.mousewheelie.tool-picking.description": "Stelle ein, wann und wie das korrekte Werkzeug für den aktuell betrachteten Block ausgewählt wird.\nNormalerweise passiert das beim Mittelklick, dies könnte in den Vanilla-Einstellungen geändert sein.", "tweed4_tailor_screen.screen.mousewheelie.general.interaction-rate.description": "Setzt das Intervall in Millisekunden, in dem Interaktionen an den Server übermittelt werden.\nNiedrige Zahlen beschleunigen bspw. das Sortieren aber können vom Server abgelehnt werden.", - "tweed4_tailor_screen.screen.mousewheelie.refill.restore-selected-slot": "Zuletzt gewählten Slot wiederauswählen" + "tweed4_tailor_screen.screen.mousewheelie.refill.restore-selected-slot": "Zuletzt gewählten Slot wiederauswählen", + "mousewheelie.sortmode.creative": "Kreativmodus-Suchen", + "tweed4_tailor_screen.screen.mousewheelie.sort.optimize-creative-search-sort": "Optimiertes Kreativmodus-Suchen", + "tweed4_tailor_screen.screen.mousewheelie.sort.optimize-creative-search-sort.description": "Ob die Sortierung der Kreativmodus-Suche hinsichtlich Performance optimiert werden soll.\nDies benötigt mehr Speicher in Austausch gegen weniger benötigter Prozessorleistung, nur deaktivieren, wenn du Speicherprobleme hast.", + "tweed4_tailor_screen.screen.mousewheelie.general.enable-bundle-dragging.description": "Aktiviere Klicken und Ziehen des Bündels im Inventar, um Gegenstände einfach hinzuzufügen oder herauszunehmen.", + "tweed4_tailor_screen.screen.mousewheelie.scrolling.description": "Gegenstände können durch Scrollen über einem Gegenstandsstapel leicht in das Inventar oder heraus bewegt werden.\nIn Kombination mit Modifikationen wie der Umschalt- oder Steuerungstaste (in den Tastenbelegungseinstellungen anpassbar) können ganze Stapel gescrollt werden, alle Gegenstände einer Sorte oder alle Gegenstände eines Inventars.", + "tweed4_tailor_screen.screen.mousewheelie.general.enable-bundle-dragging": "Bündelverschiebung aktivieren", + "tweed4_tailor_screen.screen.mousewheelie.refill.enable.description": "Aktiviert automatische Gegenstandsauffüllung.\nDeaktiviere dies, um automatisches Auffüllen zu deaktivieren.", + "tweed4_tailor_screen.screen.mousewheelie.refill.enable": "Aktiviere automatische Gegenstandsauffüllung" } From 37a93a625e3b49dcc49dafe0d5b797f62b796275 Mon Sep 17 00:00:00 2001 From: Weblate Date: Fri, 9 Jun 2023 21:15:43 +0000 Subject: [PATCH 04/21] Translated using Weblate (English) Currently translated at 100.0% (97 of 97 strings) Co-authored-by: Weblate Co-authored-by: Weblate Admin Translate-URL: https://weblate.siphalor.de/projects/mouse-wheelie/lang/en/ Translation: Mouse Wheelie/Mouse Wheelie --- .../assets/mousewheelie/lang/en_us.json | 194 +++++++++--------- 1 file changed, 97 insertions(+), 97 deletions(-) diff --git a/src/main/resources/assets/mousewheelie/lang/en_us.json b/src/main/resources/assets/mousewheelie/lang/en_us.json index 179bd023..c409fec2 100644 --- a/src/main/resources/assets/mousewheelie/lang/en_us.json +++ b/src/main/resources/assets/mousewheelie/lang/en_us.json @@ -1,99 +1,99 @@ { - "key.categories.mousewheelie": "Mouse Wheelie", - "key.mousewheelie.open_config_screen": "Open Config Screen", - "key.mousewheelie.whole_stack_modifier": "Whole Stack Modifier", - "key.mousewheelie.all_of_kind_modifier": "All of Kind Modifier", - "key.mousewheelie.drop_modifier": "Drop Modifier", - "key.mousewheelie.sort_inventory": "Sort Inventory", - "key.mousewheelie.scroll_up": "Scroll Items Up", - "key.mousewheelie.scroll_down": "Scroll Items Down", - "key.mousewheelie.pick_tool": "Pick the correct tool", - "mousewheelie.gui.config-screen-unavailable": "Opening the config screen with the keybinding is currently unavailable.", - "mousewheelie.gui.config-screen-unavailable.note": "Please use Mod Menu to edit the config or use an external application to edit the config directly.", - "mousewheelie.sortmode.alphabet": "By Alphabet", - "mousewheelie.sortmode.creative": "Creative Search", - "mousewheelie.sortmode.quantity": "By Quantity", - "mousewheelie.sortmode.raw_id": "By Raw Id", - "mousewheelie.sortmode.none": "Don't Sort", - "tweed4_tailor_screen.screen.mousewheelie": "Mouse Wheelie Config", - "tweed4_tailor_screen.screen.mousewheelie.general": "General", - "tweed4_tailor_screen.screen.mousewheelie.general.interaction-rate": "Interaction rate", - "tweed4_tailor_screen.screen.mousewheelie.general.interaction-rate.description": "Sets the interval in milliseconds in which interactions are sent to the server.\nLower numbers increase the speed but might be rejected by servers.", - "tweed4_tailor_screen.screen.mousewheelie.general.integrated-interaction-rate": "Singleplayer Interaction rate", - "tweed4_tailor_screen.screen.mousewheelie.general.integrated-interaction-rate.description": "Sets the interval in milliseconds for singleplayer and local multiplayer.", - "tweed4_tailor_screen.screen.mousewheelie.general.enable-quick-armor-swapping": "Quick Armor Swapping", - "tweed4_tailor_screen.screen.mousewheelie.general.enable-quick-armor-swapping.description": "Enables quick swapping of armor pieces and elytra pieces by clicking them while in hand.", - "tweed4_tailor_screen.screen.mousewheelie.general.enable-drop-modifier": "Drop with Alt+Click", - "tweed4_tailor_screen.screen.mousewheelie.general.enable-drop-modifier.description": "Enables dropping items when holding the drop modifier (alt by default) and clicking on them.\nThe modifier can be changed in the vanilla controls menu.", - "tweed4_tailor_screen.screen.mousewheelie.general.enable-quick-craft": "Enable quick crafting", - "tweed4_tailor_screen.screen.mousewheelie.general.enable-quick-craft.description": "Enables right-clicking in recipe books/villager trading to swiftly craft/trade.", - "tweed4_tailor_screen.screen.mousewheelie.general.item-kinds-nbt-match-mode": "Match item kinds by NBT", - "tweed4_tailor_screen.screen.mousewheelie.general.item-kinds-nbt-match-mode.description": "Whether item types should check nbt data.\nThis is for example used by scrolling and drop-clicking.\nNONE disables this, ALL checks for exactly the same nbt and SOME allows for differences in damage and enchantments.", - "tweed4_tailor_screen.screen.mousewheelie.general.hotbar-scoping": "Treat hotbar separately", - "tweed4_tailor_screen.screen.mousewheelie.general.hotbar-scoping.description": "Lets you define how the hotbar will be treated when e.g. scrolling or sorting items in the inventory.\n HARD: The hotbar will always be treated separately.\n SOFT: The hotbar will be treated as part of the inventory. This does not apply when sending the whole inventory (ctrl+shift).\n NONE: The hotbar will be treated as part of the inventory. This also applies when sending the whole inventory (ctrl+shift).", - "tweed4_tailor_screen.screen.mousewheelie.general.better-fast-dragging": "Better fast dragging", - "tweed4_tailor_screen.screen.mousewheelie.general.better-fast-dragging.description": "This helps when you regularly move your mouse faster than the game can pick up.\nThis will impact performance though.", - "tweed4_tailor_screen.screen.mousewheelie.general.enable-bundle-dragging": "Enable Bundle dragging", - "tweed4_tailor_screen.screen.mousewheelie.general.enable-bundle-dragging.description": "Enable clicking and dragging the bundle in the inventory to easily put in or out multiple stacks.", - "tweed4_tailor_screen.screen.mousewheelie.scrolling": "Scrolling", - "tweed4_tailor_screen.screen.mousewheelie.scrolling.description": "With this feature, scrolling while hovering over a stack lets you easily move single items in or out of your inventory.\nIn combination with modifiers such as Shift and Control (changeable in the Controls settings) you can scroll whole stacks, all of a kind of item or even all items in an inventory.", - "tweed4_tailor_screen.screen.mousewheelie.scrolling.enable": "Enable item scrolling", - "tweed4_tailor_screen.screen.mousewheelie.scrolling.invert": "Invert scroll direction", - "tweed4_tailor_screen.screen.mousewheelie.scrolling.invert.description": "Invert the scroll direction when scrolling items.", - "tweed4_tailor_screen.screen.mousewheelie.scrolling.directional-scrolling": "Directional Scrolling", - "tweed4_tailor_screen.screen.mousewheelie.scrolling.directional-scrolling.description": "If enabled items will be moved according to whether your scrolling up or down.\nIf disabled you will scroll to change the amount of items present (up will increase - down will decrease).", - "tweed4_tailor_screen.screen.mousewheelie.scrolling.scroll-creative-menu-items": "Scroll creative menu items", - "tweed4_tailor_screen.screen.mousewheelie.scrolling.scroll-creative-menu-items.description": "Sets whether to by default scroll items out of the creative menu.", - "tweed4_tailor_screen.screen.mousewheelie.scrolling.scroll-creative-menu-tabs": "Scroll creative menu tabs", - "tweed4_tailor_screen.screen.mousewheelie.scrolling.scroll-creative-menu-tabs.description": "Sets whether creative mode tabs can be switched by scrolling over them.", - "tweed4_tailor_screen.screen.mousewheelie.sort": "Sorting", - "tweed4_tailor_screen.screen.mousewheelie.sort.description": "Change sort modes. Existing sort modes are ALPHABET, RAW_ID and QUANTITY.\nFor Minecraft 1.19 and up there's also CREATIVE_SEARCH.", - "tweed4_tailor_screen.screen.mousewheelie.sort.primary-sort": "Middle mouse click", - "tweed4_tailor_screen.screen.mousewheelie.sort.primary-sort.description": "Sets the sort mode for normal sorting.", - "tweed4_tailor_screen.screen.mousewheelie.sort.shift-sort": "Shift + middle mouse click", - "tweed4_tailor_screen.screen.mousewheelie.sort.shift-sort.description": "Sets the sort mode for sorting whilst pressing shift.", - "tweed4_tailor_screen.screen.mousewheelie.sort.control-sort": "Control + middle mouse click", - "tweed4_tailor_screen.screen.mousewheelie.sort.control-sort.description": "Sets the sort mode for sorting whilst pressing control.", - "tweed4_tailor_screen.screen.mousewheelie.sort.optimize-creative-search-sort": "Optimized creative sorting", - "tweed4_tailor_screen.screen.mousewheelie.sort.optimize-creative-search-sort.description": "Whether the creative search sorting should be optimized for performance.\nThis will make use of more memory in exchange for processor time, only disable this if you run into memory issues.", - "tweed4_tailor_screen.screen.mousewheelie.refill": "Refill", - "tweed4_tailor_screen.screen.mousewheelie.refill.description": "Item refilling is a feature that automatically loads more items from your inventory when your current stack runs out.\nThis is for example useful when building with a lot of the same block so you don't have to constantly open the inventory.", - "tweed4_tailor_screen.screen.mousewheelie.refill.enable": "Enable item refilling", - "tweed4_tailor_screen.screen.mousewheelie.refill.enable.description": "Enables item refilling.\nTurn this off to disable refilling entirely.", - "tweed4_tailor_screen.screen.mousewheelie.refill.off-hand": "Refill the off hand", - "tweed4_tailor_screen.screen.mousewheelie.refill.off-hand.description": "Refills stacks in the off hand.", - "tweed4_tailor_screen.screen.mousewheelie.refill.restore-selected-slot": "Restore selected slot", - "tweed4_tailor_screen.screen.mousewheelie.refill.restore-selected-slot.description": "Restore the refilled item to the originally selected slot.\nThis will take a tad more time. You might want to turn this off on slow connections.", - "tweed4_tailor_screen.screen.mousewheelie.refill.eat": "Refill when eating food", - "tweed4_tailor_screen.screen.mousewheelie.refill.eat.description": "Refill when the last food item in the hand has been item.", - "tweed4_tailor_screen.screen.mousewheelie.refill.drop": "Refill when dropping items", - "tweed4_tailor_screen.screen.mousewheelie.refill.drop.description": "Refill when dropping stacks from the hotbar.", - "tweed4_tailor_screen.screen.mousewheelie.refill.use": "Refill when using items", - "tweed4_tailor_screen.screen.mousewheelie.refill.use.description": "Refill when using up items, like tools or weapons.", - "tweed4_tailor_screen.screen.mousewheelie.refill.other": "Refill on other occasions", - "tweed4_tailor_screen.screen.mousewheelie.refill.other.description": "Refill on other occasions.", - "tweed4_tailor_screen.screen.mousewheelie.refill.rules": "Refill rules", - "tweed4_tailor_screen.screen.mousewheelie.refill.rules.description": "Configure with which new item the previous stack will be refilled.", - "tweed4_tailor_screen.screen.mousewheelie.refill.rules.any-block": "Refill with any blocks", - "tweed4_tailor_screen.screen.mousewheelie.refill.rules.any-block.description": "Tries to find any other block items.", - "tweed4_tailor_screen.screen.mousewheelie.refill.rules.itemgroup": "Refill by item groups", - "tweed4_tailor_screen.screen.mousewheelie.refill.rules.itemgroup.description": "Find items that are in the same creative inventory tab.", - "tweed4_tailor_screen.screen.mousewheelie.refill.rules.item-hierarchy": "Refill with similar items", - "tweed4_tailor_screen.screen.mousewheelie.refill.rules.item-hierarchy.description": "Try to find similar items through the item type hierarchy.\nThis usually indicates a similar functionality.", - "tweed4_tailor_screen.screen.mousewheelie.refill.rules.block-hierarchy": "Refill blocks with similar blocks", - "tweed4_tailor_screen.screen.mousewheelie.refill.rules.block-hierarchy.description": "Try to find similar block items through the block type hierarchy.\nThis usually indicates a similar functionality.", - "tweed4_tailor_screen.screen.mousewheelie.refill.rules.food": "Refill with any food", - "tweed4_tailor_screen.screen.mousewheelie.refill.rules.food.description": "Try to find any other food item.", - "tweed4_tailor_screen.screen.mousewheelie.refill.rules.equal-items": "Refill with the same item (no NBT)", - "tweed4_tailor_screen.screen.mousewheelie.refill.rules.equal-items.description": "Try to find equal items (no NBT matching).", - "tweed4_tailor_screen.screen.mousewheelie.refill.rules.equal-stacks": "Refill with same stack (NBT)", - "tweed4_tailor_screen.screen.mousewheelie.refill.rules.equal-stacks.description": "Try to find equal stacks (NBT matching).", - "tweed4_tailor_screen.screen.mousewheelie.tool-picking": "Tool Picking", - "tweed4_tailor_screen.screen.mousewheelie.tool-picking.description": "Configure when and how picking the correct tool for the currently faced block will work.\nBy default tool picking will be triggered when middle clicking, that may be changed through the Vanilla Controls menu.", - "tweed4_tailor_screen.screen.mousewheelie.tool-picking.hold-tool": "Middle-click while holding a tool", - "tweed4_tailor_screen.screen.mousewheelie.tool-picking.hold-tool.description": "Pick correct tool when middle clicking (rebindable) whilst holding a tool.", - "tweed4_tailor_screen.screen.mousewheelie.tool-picking.hold-block": "Middle-click while holding the same block", - "tweed4_tailor_screen.screen.mousewheelie.tool-picking.hold-block.description": "Pick correct tool when middle clicking (rebindable) whilst holding the same block as faced.", - "tweed4_tailor_screen.screen.mousewheelie.tool-picking.pick-from-inventory": "Pick from whole inventory", - "tweed4_tailor_screen.screen.mousewheelie.tool-picking.pick-from-inventory.description": "Allows picking tools from the whole inventory.\nIf disabled picking will only happen from the hotbar." + "key.categories.mousewheelie": "Mouse Wheelie", + "key.mousewheelie.open_config_screen": "Open Config Screen", + "key.mousewheelie.whole_stack_modifier": "Whole Stack Modifier", + "key.mousewheelie.all_of_kind_modifier": "All of Kind Modifier", + "key.mousewheelie.drop_modifier": "Drop Modifier", + "key.mousewheelie.sort_inventory": "Sort Inventory", + "key.mousewheelie.scroll_up": "Scroll Items Up", + "key.mousewheelie.scroll_down": "Scroll Items Down", + "key.mousewheelie.pick_tool": "Pick the correct tool", + "mousewheelie.gui.config-screen-unavailable": "Opening the config screen with the keybinding is currently unavailable.", + "mousewheelie.gui.config-screen-unavailable.note": "Please use Mod Menu to edit the config or use an external application to edit the config directly.", + "mousewheelie.sortmode.alphabet": "By Alphabet", + "mousewheelie.sortmode.creative": "Creative Search", + "mousewheelie.sortmode.quantity": "By Quantity", + "mousewheelie.sortmode.raw_id": "By Raw Id", + "mousewheelie.sortmode.none": "Don't Sort", + "tweed4_tailor_screen.screen.mousewheelie": "Mouse Wheelie Config", + "tweed4_tailor_screen.screen.mousewheelie.general": "General", + "tweed4_tailor_screen.screen.mousewheelie.general.interaction-rate": "Interaction rate", + "tweed4_tailor_screen.screen.mousewheelie.general.interaction-rate.description": "Sets the interval in milliseconds in which interactions are sent to the server.\nLower numbers increase the speed but might be rejected by servers.", + "tweed4_tailor_screen.screen.mousewheelie.general.integrated-interaction-rate": "Singleplayer Interaction rate", + "tweed4_tailor_screen.screen.mousewheelie.general.integrated-interaction-rate.description": "Sets the interval in milliseconds for singleplayer and local multiplayer.", + "tweed4_tailor_screen.screen.mousewheelie.general.enable-quick-armor-swapping": "Quick Armor Swapping", + "tweed4_tailor_screen.screen.mousewheelie.general.enable-quick-armor-swapping.description": "Enables quick swapping of armor pieces and elytra pieces by clicking them while in hand.", + "tweed4_tailor_screen.screen.mousewheelie.general.enable-drop-modifier": "Drop with Alt+Click", + "tweed4_tailor_screen.screen.mousewheelie.general.enable-drop-modifier.description": "Enables dropping items when holding the drop modifier (alt by default) and clicking on them.\nThe modifier can be changed in the vanilla controls menu.", + "tweed4_tailor_screen.screen.mousewheelie.general.enable-quick-craft": "Enable quick crafting", + "tweed4_tailor_screen.screen.mousewheelie.general.enable-quick-craft.description": "Enables right-clicking in recipe books/villager trading to swiftly craft/trade.", + "tweed4_tailor_screen.screen.mousewheelie.general.item-kinds-nbt-match-mode": "Match item kinds by NBT", + "tweed4_tailor_screen.screen.mousewheelie.general.item-kinds-nbt-match-mode.description": "Whether item types should check nbt data.\nThis is for example used by scrolling and drop-clicking.\nNONE disables this, ALL checks for exactly the same nbt and SOME allows for differences in damage and enchantments.", + "tweed4_tailor_screen.screen.mousewheelie.general.hotbar-scoping": "Treat hotbar separately", + "tweed4_tailor_screen.screen.mousewheelie.general.hotbar-scoping.description": "Lets you define how the hotbar will be treated when e.g. scrolling or sorting items in the inventory.\n HARD: The hotbar will always be treated separately.\n SOFT: The hotbar will be treated as part of the inventory. This does not apply when sending the whole inventory (ctrl+shift).\n NONE: The hotbar will be treated as part of the inventory. This also applies when sending the whole inventory (ctrl+shift).", + "tweed4_tailor_screen.screen.mousewheelie.general.better-fast-dragging": "Better fast dragging", + "tweed4_tailor_screen.screen.mousewheelie.general.better-fast-dragging.description": "This helps when you regularly move your mouse faster than the game can pick up.\nThis will impact performance though.", + "tweed4_tailor_screen.screen.mousewheelie.general.enable-bundle-dragging": "Enable Bundle dragging", + "tweed4_tailor_screen.screen.mousewheelie.general.enable-bundle-dragging.description": "Enable clicking and dragging the bundle in the inventory to easily put in or out multiple stacks.", + "tweed4_tailor_screen.screen.mousewheelie.scrolling": "Scrolling", + "tweed4_tailor_screen.screen.mousewheelie.scrolling.description": "With this feature, scrolling while hovering over a stack lets you easily move single items in or out of your inventory.\nIn combination with modifiers such as Shift and Control (changeable in the Controls settings) you can scroll whole stacks, all of a kind of item or even all items in an inventory.", + "tweed4_tailor_screen.screen.mousewheelie.scrolling.enable": "Enable item scrolling", + "tweed4_tailor_screen.screen.mousewheelie.scrolling.invert": "Invert scroll direction", + "tweed4_tailor_screen.screen.mousewheelie.scrolling.invert.description": "Invert the scroll direction when scrolling items.", + "tweed4_tailor_screen.screen.mousewheelie.scrolling.directional-scrolling": "Directional Scrolling", + "tweed4_tailor_screen.screen.mousewheelie.scrolling.directional-scrolling.description": "If enabled items will be moved according to whether your scrolling up or down.\nIf disabled you will scroll to change the amount of items present (up will increase - down will decrease).", + "tweed4_tailor_screen.screen.mousewheelie.scrolling.scroll-creative-menu-items": "Scroll creative menu items", + "tweed4_tailor_screen.screen.mousewheelie.scrolling.scroll-creative-menu-items.description": "Sets whether to by default scroll items out of the creative menu.", + "tweed4_tailor_screen.screen.mousewheelie.scrolling.scroll-creative-menu-tabs": "Scroll creative menu tabs", + "tweed4_tailor_screen.screen.mousewheelie.scrolling.scroll-creative-menu-tabs.description": "Sets whether creative mode tabs can be switched by scrolling over them.", + "tweed4_tailor_screen.screen.mousewheelie.sort": "Sorting", + "tweed4_tailor_screen.screen.mousewheelie.sort.description": "Change sort modes. Existing sort modes are ALPHABET, RAW_ID and QUANTITY.\nFor Minecraft 1.19 and up there's also CREATIVE_SEARCH.", + "tweed4_tailor_screen.screen.mousewheelie.sort.primary-sort": "Middle mouse click", + "tweed4_tailor_screen.screen.mousewheelie.sort.primary-sort.description": "Sets the sort mode for normal sorting.", + "tweed4_tailor_screen.screen.mousewheelie.sort.shift-sort": "Shift + middle mouse click", + "tweed4_tailor_screen.screen.mousewheelie.sort.shift-sort.description": "Sets the sort mode for sorting whilst pressing shift.", + "tweed4_tailor_screen.screen.mousewheelie.sort.control-sort": "Control + middle mouse click", + "tweed4_tailor_screen.screen.mousewheelie.sort.control-sort.description": "Sets the sort mode for sorting whilst pressing control.", + "tweed4_tailor_screen.screen.mousewheelie.sort.optimize-creative-search-sort": "Optimized creative sorting", + "tweed4_tailor_screen.screen.mousewheelie.sort.optimize-creative-search-sort.description": "Whether the creative search sorting should be optimized for performance.\nThis will make use of more memory in exchange for processor time, only disable this if you run into memory issues.", + "tweed4_tailor_screen.screen.mousewheelie.refill": "Refill", + "tweed4_tailor_screen.screen.mousewheelie.refill.description": "Item refilling is a feature that automatically loads more items from your inventory when your current stack runs out.\nThis is for example useful when building with a lot of the same block so you don't have to constantly open the inventory.", + "tweed4_tailor_screen.screen.mousewheelie.refill.enable": "Enable item refilling", + "tweed4_tailor_screen.screen.mousewheelie.refill.enable.description": "Enables item refilling.\nTurn this off to disable refilling entirely.", + "tweed4_tailor_screen.screen.mousewheelie.refill.off-hand": "Refill the off hand", + "tweed4_tailor_screen.screen.mousewheelie.refill.off-hand.description": "Refills stacks in the off hand.", + "tweed4_tailor_screen.screen.mousewheelie.refill.restore-selected-slot": "Restore selected slot", + "tweed4_tailor_screen.screen.mousewheelie.refill.restore-selected-slot.description": "Restore the refilled item to the originally selected slot.\nThis will take a tad more time. You might want to turn this off on slow connections.", + "tweed4_tailor_screen.screen.mousewheelie.refill.eat": "Refill when eating food", + "tweed4_tailor_screen.screen.mousewheelie.refill.eat.description": "Refill when the last food item in the hand has been consumed.", + "tweed4_tailor_screen.screen.mousewheelie.refill.drop": "Refill when dropping items", + "tweed4_tailor_screen.screen.mousewheelie.refill.drop.description": "Refill when dropping stacks from the hotbar.", + "tweed4_tailor_screen.screen.mousewheelie.refill.use": "Refill when using items", + "tweed4_tailor_screen.screen.mousewheelie.refill.use.description": "Refill when using up items, like tools or weapons.", + "tweed4_tailor_screen.screen.mousewheelie.refill.other": "Refill on other occasions", + "tweed4_tailor_screen.screen.mousewheelie.refill.other.description": "Refill on other occasions.", + "tweed4_tailor_screen.screen.mousewheelie.refill.rules": "Refill rules", + "tweed4_tailor_screen.screen.mousewheelie.refill.rules.description": "Configure with which new item the previous stack will be refilled.", + "tweed4_tailor_screen.screen.mousewheelie.refill.rules.any-block": "Refill with any blocks", + "tweed4_tailor_screen.screen.mousewheelie.refill.rules.any-block.description": "Tries to find any other block items.", + "tweed4_tailor_screen.screen.mousewheelie.refill.rules.itemgroup": "Refill by item groups", + "tweed4_tailor_screen.screen.mousewheelie.refill.rules.itemgroup.description": "Find items that are in the same creative inventory tab.", + "tweed4_tailor_screen.screen.mousewheelie.refill.rules.item-hierarchy": "Refill with similar items", + "tweed4_tailor_screen.screen.mousewheelie.refill.rules.item-hierarchy.description": "Try to find similar items through the item type hierarchy.\nThis usually indicates a similar functionality.", + "tweed4_tailor_screen.screen.mousewheelie.refill.rules.block-hierarchy": "Refill blocks with similar blocks", + "tweed4_tailor_screen.screen.mousewheelie.refill.rules.block-hierarchy.description": "Try to find similar block items through the block type hierarchy.\nThis usually indicates a similar functionality.", + "tweed4_tailor_screen.screen.mousewheelie.refill.rules.food": "Refill with any food", + "tweed4_tailor_screen.screen.mousewheelie.refill.rules.food.description": "Try to find any other food item.", + "tweed4_tailor_screen.screen.mousewheelie.refill.rules.equal-items": "Refill with the same item (no NBT)", + "tweed4_tailor_screen.screen.mousewheelie.refill.rules.equal-items.description": "Try to find equal items (no NBT matching).", + "tweed4_tailor_screen.screen.mousewheelie.refill.rules.equal-stacks": "Refill with same stack (NBT)", + "tweed4_tailor_screen.screen.mousewheelie.refill.rules.equal-stacks.description": "Try to find equal stacks (NBT matching).", + "tweed4_tailor_screen.screen.mousewheelie.tool-picking": "Tool Picking", + "tweed4_tailor_screen.screen.mousewheelie.tool-picking.description": "Configure when and how picking the correct tool for the currently faced block will work.\nBy default tool picking will be triggered when middle clicking, that may be changed through the Vanilla Controls menu.", + "tweed4_tailor_screen.screen.mousewheelie.tool-picking.hold-tool": "Middle-click while holding a tool", + "tweed4_tailor_screen.screen.mousewheelie.tool-picking.hold-tool.description": "Pick correct tool when middle clicking (rebindable) whilst holding a tool.", + "tweed4_tailor_screen.screen.mousewheelie.tool-picking.hold-block": "Middle-click while holding the same block", + "tweed4_tailor_screen.screen.mousewheelie.tool-picking.hold-block.description": "Pick correct tool when middle clicking (rebindable) whilst holding the same block as faced.", + "tweed4_tailor_screen.screen.mousewheelie.tool-picking.pick-from-inventory": "Pick from whole inventory", + "tweed4_tailor_screen.screen.mousewheelie.tool-picking.pick-from-inventory.description": "Allows picking tools from the whole inventory.\nIf disabled picking will only happen from the hotbar." } From a3a566acfbe4590729ed2634401a5ca965ac94d2 Mon Sep 17 00:00:00 2001 From: Weblate Date: Fri, 9 Jun 2023 21:15:43 +0000 Subject: [PATCH 05/21] Translated using Weblate (Portuguese) Currently translated at 100.0% (97 of 97 strings) Translated using Weblate (Portuguese) Currently translated at 77.3% (75 of 97 strings) Translated using Weblate (Portuguese) Currently translated at 76.2% (74 of 97 strings) Added translation using Weblate (Portuguese) Co-authored-by: RiginDev Co-authored-by: Weblate Translate-URL: https://weblate.siphalor.de/projects/mouse-wheelie/lang/pt/ Translation: Mouse Wheelie/Mouse Wheelie --- .../assets/mousewheelie/lang/pt.json | 99 +++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 src/main/resources/assets/mousewheelie/lang/pt.json diff --git a/src/main/resources/assets/mousewheelie/lang/pt.json b/src/main/resources/assets/mousewheelie/lang/pt.json new file mode 100644 index 00000000..4d8f5923 --- /dev/null +++ b/src/main/resources/assets/mousewheelie/lang/pt.json @@ -0,0 +1,99 @@ +{ + "key.mousewheelie.open_config_screen": "Abrir Janela de Configuração", + "key.mousewheelie.whole_stack_modifier": "Modificador de Pilhas Inteiras", + "key.mousewheelie.all_of_kind_modifier": "Modificador de Todos do Tipo", + "key.mousewheelie.sort_inventory": "Organizar Inventário", + "key.mousewheelie.scroll_down": "Rolar Itens para Baixo", + "key.mousewheelie.pick_tool": "Selecionar a ferramenta certa", + "mousewheelie.gui.config-screen-unavailable": "Abrir a janela de configuração com a tecla está indisponível.", + "mousewheelie.gui.config-screen-unavailable.note": "Por favor use Mod Menu para editar a configuração ou use um aplicativo externo çara editar a configuração diretamente.", + "mousewheelie.sortmode.alphabet": "Por Alfabeto", + "mousewheelie.sortmode.creative": "Pesquisar Criativo", + "mousewheelie.sortmode.quantity": "Por Quantidade", + "mousewheelie.sortmode.raw_id": "Por Id Bruto", + "mousewheelie.sortmode.none": "Não Organizar", + "tweed4_tailor_screen.screen.mousewheelie": "Configuração do Mouse Wheelie", + "tweed4_tailor_screen.screen.mousewheelie.general": "Geral", + "key.mousewheelie.drop_modifier": "Modificador para largar", + "key.mousewheelie.scroll_up": "Rolar Itens para Cima", + "tweed4_tailor_screen.screen.mousewheelie.scrolling.enable": "Habilitar rolamento de itens", + "tweed4_tailor_screen.screen.mousewheelie.sort.primary-sort.description": "Define o modo de organizar para organização normal.", + "tweed4_tailor_screen.screen.mousewheelie.refill": "Preencher", + "tweed4_tailor_screen.screen.mousewheelie.refill.description": "Preenchimento de itens é um recurso que automaticamente recarrega mais itens do seu inventário quando a sua pilha atual acaba.\nIsto é, por exemplo, útil quando construindo com muitos do mesmo bloco para que você não precise abrir o inventário constantemente.", + "tweed4_tailor_screen.screen.mousewheelie.refill.enable": "Habilita preenchimento de itens", + "tweed4_tailor_screen.screen.mousewheelie.refill.enable.description": "Habilita preenchimento de itens.\nDesligue isso para desabilitar preenchimento completamente.", + "tweed4_tailor_screen.screen.mousewheelie.refill.off-hand": "Preencher a segunda mão", + "tweed4_tailor_screen.screen.mousewheelie.refill.off-hand.description": "Preenche pilhas na segunda mão.", + "tweed4_tailor_screen.screen.mousewheelie.refill.restore-selected-slot.description": "Restaura o item preenchido para o espaço selecionado originalmente.\nIsso vai demorar um pouco mais. Você pode querer desligar isso em conexões lentas.", + "tweed4_tailor_screen.screen.mousewheelie.refill.other.description": "Preenche em outras ocasiões.", + "tweed4_tailor_screen.screen.mousewheelie.general.interaction-rate": "Velocidade de Interação", + "tweed4_tailor_screen.screen.mousewheelie.general.interaction-rate.description": "Define o intervalo em milissegundos na qual interações serão enviadas ao servidor.\nNúmeros menores aumentam a velocidade mas podem ser rejeitados por servidores.", + "tweed4_tailor_screen.screen.mousewheelie.general.integrated-interaction-rate": "Velocidade de Interação em Um Jogador", + "tweed4_tailor_screen.screen.mousewheelie.general.integrated-interaction-rate.description": "Define o intervalo em milissegundos para um jogador ou múltiplos jogadores locais.", + "tweed4_tailor_screen.screen.mousewheelie.general.enable-quick-armor-swapping": "Troca Rápida de Armadura", + "tweed4_tailor_screen.screen.mousewheelie.general.enable-quick-armor-swapping.description": "Habilita a troca rápida das peças de armadura e peças de elytra clicando nelas enquanto está na mão.", + "tweed4_tailor_screen.screen.mousewheelie.general.enable-quick-craft": "Habilita a construção rápida", + "tweed4_tailor_screen.screen.mousewheelie.general.enable-quick-craft.description": "Habilita clicar com o botão direito no livro de receitas/troca com villagers para rapidamente construir/trocar.", + "tweed4_tailor_screen.screen.mousewheelie.general.item-kinds-nbt-match-mode": "Corresponder tipos de itens por NBT", + "tweed4_tailor_screen.screen.mousewheelie.general.hotbar-scoping": "Tratar hotbar separadamente", + "tweed4_tailor_screen.screen.mousewheelie.general.better-fast-dragging": "Arrastar rápido melhor", + "tweed4_tailor_screen.screen.mousewheelie.general.better-fast-dragging.description": "Isto ajuda quando você frequentemente move o mouse mais rápido do que o jogo consegue registrar.\nMas isto vai impactar a performance.", + "tweed4_tailor_screen.screen.mousewheelie.general.enable-bundle-dragging": "Habilitar arrastar a sacola", + "tweed4_tailor_screen.screen.mousewheelie.general.enable-bundle-dragging.description": "Habilitar clicar e arrastar a sacola no inventário para facilmente colocar ou tirar múltiplas pilhas.", + "tweed4_tailor_screen.screen.mousewheelie.scrolling": "Rolar", + "tweed4_tailor_screen.screen.mousewheelie.scrolling.description": "Com esse recurso, rolar sobre uma pilha permite que você facilmente mova itens individuais para dentro ou fora do seu inventário.\nCom essa combinação de modificadores como Shift e Control (trocável nas configurações de Controles) você pode rolar pilhas inteiras, todo o tipo de um item ou até todos os itens no inventário.", + "tweed4_tailor_screen.screen.mousewheelie.scrolling.invert": "Inverter direção do rolamento", + "tweed4_tailor_screen.screen.mousewheelie.scrolling.invert.description": "Inverter a direção do rolamento quando rolando itens.", + "tweed4_tailor_screen.screen.mousewheelie.scrolling.scroll-creative-menu-items": "Rolar itens do menu criativo", + "tweed4_tailor_screen.screen.mousewheelie.scrolling.scroll-creative-menu-items.description": "Define se por padrão rolar itens para fora do menu criativo.", + "tweed4_tailor_screen.screen.mousewheelie.scrolling.scroll-creative-menu-tabs.description": "Define se abas do modo criativo podem ser trocadas ao rolar sobre elas.", + "tweed4_tailor_screen.screen.mousewheelie.sort": "Organizar", + "tweed4_tailor_screen.screen.mousewheelie.sort.primary-sort": "Clique do meio do mouse", + "tweed4_tailor_screen.screen.mousewheelie.sort.shift-sort": "Shift + clique do meio do mouse", + "tweed4_tailor_screen.screen.mousewheelie.sort.control-sort.description": "Define o modo de organizar para organizar enquanto pressiona control.", + "tweed4_tailor_screen.screen.mousewheelie.sort.shift-sort.description": "Define o modo de organizar para organizar enquanto pressiona shift.", + "tweed4_tailor_screen.screen.mousewheelie.sort.optimize-creative-search-sort": "Organização do criativo otimizada", + "tweed4_tailor_screen.screen.mousewheelie.refill.restore-selected-slot": "Restaurar o espaço selecionado", + "tweed4_tailor_screen.screen.mousewheelie.refill.eat": "Preencher quando comendo comida", + "tweed4_tailor_screen.screen.mousewheelie.refill.eat.description": "Preenche quando a última comida na mão foi consumida.", + "tweed4_tailor_screen.screen.mousewheelie.refill.drop": "Preencher quando largando itens", + "tweed4_tailor_screen.screen.mousewheelie.refill.drop.description": "Preencher quando largando pilhas da hotbar.", + "tweed4_tailor_screen.screen.mousewheelie.refill.use": "Preencher quando usando itens", + "tweed4_tailor_screen.screen.mousewheelie.refill.use.description": "Preenche quando terminando de usar itens, como ferramentas e armas.", + "tweed4_tailor_screen.screen.mousewheelie.refill.other": "Preencher em outras ocasiões", + "tweed4_tailor_screen.screen.mousewheelie.refill.rules": "Regras de preenchimento", + "tweed4_tailor_screen.screen.mousewheelie.refill.rules.description": "Configure com qual item novo a última pilha deverá ser preenchida.", + "tweed4_tailor_screen.screen.mousewheelie.general.enable-drop-modifier": "Largar com Alt+Clique", + "tweed4_tailor_screen.screen.mousewheelie.general.enable-drop-modifier.description": "Habilita largar itens enquanto segura o modificador de largar (alt por padrão) e clicar nele.\nO modificador pode ser trocado no menu de controle vanilla.", + "tweed4_tailor_screen.screen.mousewheelie.general.item-kinds-nbt-match-mode.description": "Se tipos de itens deveria verificar dados nbt.\nIsso é, por exemplo, usado por rolar e clique-largar.\nNONE desabilita isso, ALL verifica para exatamente o mesmo nbt e SOME permite para diferenças em dano e encantamentos.", + "tweed4_tailor_screen.screen.mousewheelie.general.hotbar-scoping.description": "Deixa você definir como a hotbar será tratada quando por exemplo rolando ou organizando itens no inventário.\n HARD: A hotbar vai sempre ser tratada separadamente.\n SOFT: A hotbar será tratada como parte do inventário. Isso não se aplica quando enviando o inventário inteiro (ctrl+shift).\n NONE: A hotbar será tratada como parte do inventário. Isso também se aplica quando enviando o inventário inteiro (ctrl+shift).", + "tweed4_tailor_screen.screen.mousewheelie.scrolling.directional-scrolling": "Rolamento Direcional", + "tweed4_tailor_screen.screen.mousewheelie.scrolling.directional-scrolling.description": "Se habilitado, itens serão movidos de acordo com se você está rolando para cima ou para baixo.\nSe desabilitado, você vai rolar para mudar a quantidade de itens presentes (para cima irá aumentar - para baixo irá diminuir).", + "tweed4_tailor_screen.screen.mousewheelie.scrolling.scroll-creative-menu-tabs": "Rolar abas do menu criativo", + "tweed4_tailor_screen.screen.mousewheelie.sort.description": "Muda modos de organizar. Modos de organizar existentes são ALPHABET, RAW_ID e QUANTIDADE.\nPara o Minecraft 1.19 e depois também há CREATIVE_SEARCH.", + "tweed4_tailor_screen.screen.mousewheelie.sort.control-sort": "Control + clique do meio do mouse", + "tweed4_tailor_screen.screen.mousewheelie.sort.optimize-creative-search-sort.description": "Se a organização da pesquisa do criativo deveria ser otimizada para performance.\nIsto vai utilizar maios memória em troca do tempo de processamento, só desabilite isso se você encontrar problemas na memória.", + "tweed4_tailor_screen.screen.mousewheelie.refill.rules.any-block": "Preencher com qualquer bloco", + "tweed4_tailor_screen.screen.mousewheelie.refill.rules.any-block.description": "Tenta encontrar qualquer outro item de bloco.", + "key.categories.mousewheelie": "Mouse Wheelie", + "tweed4_tailor_screen.screen.mousewheelie.refill.rules.equal-stacks": "Preencher com a mesma pilha (NBT)", + "tweed4_tailor_screen.screen.mousewheelie.tool-picking.description": "Configure quando e como escolher a ferramenta correta para o bloco que está olhando irá funcionar.\nPor padrão, \"escolher a ferramenta\" será acionada quando clica com o botão do meio do mouse, isso pode ser trocado pelo menu de Controles Vanilla.", + "tweed4_tailor_screen.screen.mousewheelie.tool-picking": "Escolher Ferramenta", + "tweed4_tailor_screen.screen.mousewheelie.refill.rules.itemgroup": "Preencher por grupo de itens", + "tweed4_tailor_screen.screen.mousewheelie.refill.rules.itemgroup.description": "Encontra itens que estão na mesma aba do inventário do criativo.", + "tweed4_tailor_screen.screen.mousewheelie.refill.rules.item-hierarchy": "Preencher com itens similares", + "tweed4_tailor_screen.screen.mousewheelie.refill.rules.item-hierarchy.description": "Tenta achar itens similares através da hierarquia dos tipos de itens.\nIsso normalmente indica uma funcionalidade similar.", + "tweed4_tailor_screen.screen.mousewheelie.refill.rules.block-hierarchy": "Preencher blocos com blocos similares", + "tweed4_tailor_screen.screen.mousewheelie.refill.rules.block-hierarchy.description": "Tenta achar itens de blocos similares através da hierarquia dos tipos de blocos.\nIsso normalmente indica uma funcionalidade similar.", + "tweed4_tailor_screen.screen.mousewheelie.refill.rules.food": "Preencher com qualquer comida", + "tweed4_tailor_screen.screen.mousewheelie.refill.rules.food.description": "Tenta achar qualquer outro item de comida.", + "tweed4_tailor_screen.screen.mousewheelie.refill.rules.equal-items": "Preencher com o mesmo item (sem NBT)", + "tweed4_tailor_screen.screen.mousewheelie.refill.rules.equal-items.description": "Tenta achar itens iguais (sem corresponder o NBT).", + "tweed4_tailor_screen.screen.mousewheelie.refill.rules.equal-stacks.description": "Tenta achar pilhas iguais (correspondendo NBT).", + "tweed4_tailor_screen.screen.mousewheelie.tool-picking.hold-tool.description": "Seleciona a ferramenta correta quando clicando com o botão do meio do mouse (trocável) enquanto segura uma ferramenta.", + "tweed4_tailor_screen.screen.mousewheelie.tool-picking.hold-tool": "Clicar com o botão do meio do mouse enquanto segura uma ferramenta", + "tweed4_tailor_screen.screen.mousewheelie.tool-picking.hold-block": "Clicar com o botão do meio do mouse enquanto segura o mesmo bloco", + "tweed4_tailor_screen.screen.mousewheelie.tool-picking.hold-block.description": "Seleciona a ferramenta correta quando clicando com o botão do meio do mouse (trocável) enquanto segura o mesmo bloco que está olhando.", + "tweed4_tailor_screen.screen.mousewheelie.tool-picking.pick-from-inventory": "Seleciona de todo o inventário", + "tweed4_tailor_screen.screen.mousewheelie.tool-picking.pick-from-inventory.description": "Permite selecionar ferramentas do inventário inteiro.\nSe desabilitado, só irá selecionar da hotbar." +} From 0ffedacbf0dd59245be4960a2c47dcc38a2411dd Mon Sep 17 00:00:00 2001 From: Siphalor Date: Fri, 9 Jun 2023 23:15:20 +0200 Subject: [PATCH 06/21] Add an action for fixing language file names --- .github/workflows/push-main.yaml | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 .github/workflows/push-main.yaml diff --git a/.github/workflows/push-main.yaml b/.github/workflows/push-main.yaml new file mode 100644 index 00000000..126bb32c --- /dev/null +++ b/.github/workflows/push-main.yaml @@ -0,0 +1,27 @@ +on: + push: + branches: + - "1.16" + + +jobs: + auto-fix: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Fix language file names + run: | + for lang in src/main/resources/assets/*/lang/*.json + do + rename=$(echo "$lang" | sed -e 's/\b\w\+\.json$/\L\0/' -e 's/\b\([a-z]\+\)\.json$/\/\1_\1.json/') + mv "$lang" "$rename" || true + done + + - name: Commit + uses: EndBug/add-and-commit@v9 + with: + add: 'src/main/resources/assets' + default_author: github_actions + message: Fix language file names From def23642d850b7604992abbe30b5acaf778e932f Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 9 Jun 2023 21:26:14 +0000 Subject: [PATCH 07/21] Fix language file names --- .../resources/assets/mousewheelie/lang/{pt.json => pt_pt.json} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename src/main/resources/assets/mousewheelie/lang/{pt.json => pt_pt.json} (100%) diff --git a/src/main/resources/assets/mousewheelie/lang/pt.json b/src/main/resources/assets/mousewheelie/lang/pt_pt.json similarity index 100% rename from src/main/resources/assets/mousewheelie/lang/pt.json rename to src/main/resources/assets/mousewheelie/lang/pt_pt.json From 7f398b111ca8e1fa5d5c3af8ab984ed24e612b08 Mon Sep 17 00:00:00 2001 From: Siphalor Date: Fri, 9 Jun 2023 23:27:32 +0200 Subject: [PATCH 08/21] Change Portugese translation to use Brazil country code --- .../resources/assets/mousewheelie/lang/{pt_pt.json => pt_br.json} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename src/main/resources/assets/mousewheelie/lang/{pt_pt.json => pt_br.json} (100%) diff --git a/src/main/resources/assets/mousewheelie/lang/pt_pt.json b/src/main/resources/assets/mousewheelie/lang/pt_br.json similarity index 100% rename from src/main/resources/assets/mousewheelie/lang/pt_pt.json rename to src/main/resources/assets/mousewheelie/lang/pt_br.json From adfe0296b76165a91ffe487a3f768c50487be651 Mon Sep 17 00:00:00 2001 From: Siphalor Date: Sun, 11 Jun 2023 10:39:07 +0200 Subject: [PATCH 09/21] Add missing translations for Deposit/Restock modifiers --- src/main/resources/assets/mousewheelie/lang/en_us.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/resources/assets/mousewheelie/lang/en_us.json b/src/main/resources/assets/mousewheelie/lang/en_us.json index c409fec2..598ade82 100644 --- a/src/main/resources/assets/mousewheelie/lang/en_us.json +++ b/src/main/resources/assets/mousewheelie/lang/en_us.json @@ -4,6 +4,8 @@ "key.mousewheelie.whole_stack_modifier": "Whole Stack Modifier", "key.mousewheelie.all_of_kind_modifier": "All of Kind Modifier", "key.mousewheelie.drop_modifier": "Drop Modifier", + "key.mousewheelie.deposit_modifier": "Deposit Modifier", + "key.mousewheelie.restock_modifier": "Restock Modifier", "key.mousewheelie.sort_inventory": "Sort Inventory", "key.mousewheelie.scroll_up": "Scroll Items Up", "key.mousewheelie.scroll_down": "Scroll Items Down", From c7407ff0de067245f40fb20fdda04cb479eab474 Mon Sep 17 00:00:00 2001 From: Siphalor Date: Sun, 11 Jun 2023 18:07:24 +0200 Subject: [PATCH 10/21] Add simple CI --- .github/workflows/ci.yaml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .github/workflows/ci.yaml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 00000000..72a4a6ce --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,25 @@ +on: + push: + pull_request: + +jobs: + test: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Setup Java + uses: actions/setup-java@v3 + with: + distribution: temurin + java-version: 17 + - name: Set Gradle execution rights + run: chmod +x ./gradlew + - name: Build + uses: gradle/gradle-build-action@v2 + with: + arguments: assemble + - name: Check + uses: gradle/gradle-build-action@v2 + with: + arguments: check From 61a8e051a2b190e9ba1d9e8ebb04f5c12256dae9 Mon Sep 17 00:00:00 2001 From: Siphalor Date: Sun, 11 Jun 2023 18:31:30 +0200 Subject: [PATCH 11/21] Introduce Lombok to the project --- build.gradle | 3 +++ gradle.properties | 4 ++- .../client/inventory/ToolPicker.java | 11 +++++--- .../client/inventory/sort/SortContext.java | 25 +++++-------------- .../client/util/ScrollAction.java | 8 +++--- 5 files changed, 22 insertions(+), 29 deletions(-) diff --git a/build.gradle b/build.gradle index 7dfc044e..0833dcee 100644 --- a/build.gradle +++ b/build.gradle @@ -35,6 +35,9 @@ dependencies { mappings "net.fabricmc:yarn:${project.minecraft_version}+build.${project.yarn_build}" modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" + compileOnly(annotationProcessor("org.projectlombok:lombok:$lombok_version")) + testCompileOnly(testAnnotationProcessor("org.projectlombok:lombok:$lombok_version")) + def fabric_deps = [ 'fabric-api-base', 'fabric-events-interaction-v0', diff --git a/gradle.properties b/gradle.properties index 7e3094ff..6bf2c22a 100644 --- a/gradle.properties +++ b/gradle.properties @@ -15,7 +15,9 @@ mod_mc_versions=1.16.3;1.16.4;1.16.5 maven_group=de.siphalor archives_base_name=mousewheelie # Dependencies -amecs_version=1.4.0+mc1.16.5 +lombok_version=1.18.28 +# Mod Dependencies +amecs_version=1.5.0+mc1.16.5 coat_version=1.0.0-beta.20+mc1.16.5 fabric_api_version=0.42.0+1.16 tweed_version=1.3.0+mc1.16.5 diff --git a/src/main/java/de/siphalor/mousewheelie/client/inventory/ToolPicker.java b/src/main/java/de/siphalor/mousewheelie/client/inventory/ToolPicker.java index a44baf2d..5e78b213 100644 --- a/src/main/java/de/siphalor/mousewheelie/client/inventory/ToolPicker.java +++ b/src/main/java/de/siphalor/mousewheelie/client/inventory/ToolPicker.java @@ -19,6 +19,7 @@ import de.siphalor.mousewheelie.MWConfig; import de.siphalor.mousewheelie.client.MWClient; +import lombok.RequiredArgsConstructor; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.block.BlockState; @@ -28,13 +29,14 @@ import net.minecraft.network.packet.c2s.play.PickFromInventoryC2SPacket; @Environment(EnvType.CLIENT) +@RequiredArgsConstructor public class ToolPicker { - final PlayerInventory inventory; + private final PlayerInventory inventory; static int lastToolPickSlot = -1; - public ToolPicker(PlayerInventory inventory) { - this.inventory = inventory; + public static synchronized void setLastToolPickSlot(int lastToolPickSlot) { + ToolPicker.lastToolPickSlot = lastToolPickSlot; } public int findToolFor(BlockState blockState) { @@ -83,7 +85,8 @@ public boolean pickWeapon() { } private boolean pick(int index) { - lastToolPickSlot = index; + setLastToolPickSlot(index); + if (index != -1 && index != inventory.selectedSlot) { PickFromInventoryC2SPacket packet = new PickFromInventoryC2SPacket(index); MinecraftClient.getInstance().getNetworkHandler().sendPacket(packet); diff --git a/src/main/java/de/siphalor/mousewheelie/client/inventory/sort/SortContext.java b/src/main/java/de/siphalor/mousewheelie/client/inventory/sort/SortContext.java index 64e07226..33456991 100644 --- a/src/main/java/de/siphalor/mousewheelie/client/inventory/sort/SortContext.java +++ b/src/main/java/de/siphalor/mousewheelie/client/inventory/sort/SortContext.java @@ -17,6 +17,7 @@ package de.siphalor.mousewheelie.client.inventory.sort; +import lombok.Value; import net.minecraft.client.gui.screen.ingame.HandledScreen; import net.minecraft.item.ItemStack; import net.minecraft.screen.slot.Slot; @@ -28,29 +29,15 @@ * * @see SortMode#sort(int[], ItemStack[], SortContext) */ +@Value public class SortContext { - private final HandledScreen screen; - private final List relevantSlots; - - public SortContext(HandledScreen screen, List relevantSlots) { - this.screen = screen; - this.relevantSlots = relevantSlots; - } - /** - * Gets the screen that is currently sorted on. - * @return The screen + * The screen that is currently sorted on. */ - public HandledScreen getScreen() { - return screen; - } - + HandledScreen screen; /** - * Gets the slots that are the target of the current sort action. + * The slots that are the target of the current sort action. * These slots are usually in the same scope (see {@link de.siphalor.mousewheelie.client.inventory.ContainerScreenHelper#getScope(Slot)}). - * @return The relevant slots */ - public List getRelevantSlots() { - return relevantSlots; - } + List relevantSlots; } diff --git a/src/main/java/de/siphalor/mousewheelie/client/util/ScrollAction.java b/src/main/java/de/siphalor/mousewheelie/client/util/ScrollAction.java index dc72fed6..9e34eee9 100644 --- a/src/main/java/de/siphalor/mousewheelie/client/util/ScrollAction.java +++ b/src/main/java/de/siphalor/mousewheelie/client/util/ScrollAction.java @@ -17,16 +17,14 @@ package de.siphalor.mousewheelie.client.util; +import lombok.RequiredArgsConstructor; + +@RequiredArgsConstructor public enum ScrollAction { PASS(false, false), SUCCESS(true, true), FAILURE(false, true), ABORT(true, false); final boolean cancelCustomActions; final boolean cancelAllActions; - ScrollAction(boolean cancelCustomActions, boolean cancelAllActions) { - this.cancelCustomActions = cancelCustomActions; - this.cancelAllActions = cancelAllActions; - } - public boolean cancelsAllActions() { return cancelAllActions; } From 7d8d85d373d8d515307939080c4b8c00351d0f82 Mon Sep 17 00:00:00 2001 From: Siphalor Date: Tue, 13 Jun 2023 21:46:42 +0200 Subject: [PATCH 12/21] Implement server accelerated sorting --- src/lombok.config | 1 + .../siphalor/mousewheelie/MouseWheelie.java | 37 +++-- .../inventory/sort/InventorySorter.java | 51 +++++-- .../client/network/MWClientNetworking.java | 19 +++ .../network/MWLogicalServerNetworking.java | 141 ++++++++++++++++++ .../common/network/MWNetworking.java | 16 ++ .../network/ReorderInventoryPacket.java | 31 ++++ 7 files changed, 269 insertions(+), 27 deletions(-) create mode 100644 src/lombok.config create mode 100644 src/main/java/de/siphalor/mousewheelie/client/network/MWClientNetworking.java create mode 100644 src/main/java/de/siphalor/mousewheelie/common/network/MWLogicalServerNetworking.java create mode 100644 src/main/java/de/siphalor/mousewheelie/common/network/MWNetworking.java create mode 100644 src/main/java/de/siphalor/mousewheelie/common/network/ReorderInventoryPacket.java diff --git a/src/lombok.config b/src/lombok.config new file mode 100644 index 00000000..93c64caf --- /dev/null +++ b/src/lombok.config @@ -0,0 +1 @@ +lombok.log.custom.declaration = org.apache.logging.log4j.Logger org.apache.logging.log4j.LogManager.getLogger(TYPE) diff --git a/src/main/java/de/siphalor/mousewheelie/MouseWheelie.java b/src/main/java/de/siphalor/mousewheelie/MouseWheelie.java index 2d03aaa3..03e81ffb 100644 --- a/src/main/java/de/siphalor/mousewheelie/MouseWheelie.java +++ b/src/main/java/de/siphalor/mousewheelie/MouseWheelie.java @@ -17,33 +17,42 @@ package de.siphalor.mousewheelie; +import de.siphalor.mousewheelie.common.network.MWLogicalServerNetworking; import net.fabricmc.api.ModInitializer; import net.fabricmc.fabric.api.event.player.UseItemCallback; import net.minecraft.entity.EquipmentSlot; import net.minecraft.entity.mob.MobEntity; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; +import net.minecraft.util.Hand; import net.minecraft.util.TypedActionResult; +import net.minecraft.world.World; public class MouseWheelie implements ModInitializer { public static final String MOD_ID = "mousewheelie"; + public static final String MOD_NAME = "Mouse Wheelie"; @Override public void onInitialize() { - UseItemCallback.EVENT.register((player, world, hand) -> { - ItemStack stack = player.getStackInHand(hand); - if (MWConfig.general.enableQuickArmorSwapping && !world.isClient()) { - EquipmentSlot equipmentSlot = MobEntity.getPreferredEquipmentSlot(stack); - if (equipmentSlot.getType() == EquipmentSlot.Type.ARMOR) { - ItemStack equipmentStack = player.getEquippedStack(equipmentSlot); - int index = 5 + (3 - equipmentSlot.getEntitySlotId()); - if (!equipmentStack.isEmpty() && player.playerScreenHandler.getSlot(index).canTakeItems(player)) { - player.setStackInHand(hand, equipmentStack); - player.equipStack(equipmentSlot, stack); - return TypedActionResult.consume(equipmentStack); - } + UseItemCallback.EVENT.register(this::onPlayerUseItem); + + MWLogicalServerNetworking.setup(); + } + + private TypedActionResult onPlayerUseItem(PlayerEntity player, World world, Hand hand) { + ItemStack stack = player.getStackInHand(hand); + if (MWConfig.general.enableQuickArmorSwapping && !world.isClient()) { + EquipmentSlot equipmentSlot = MobEntity.getPreferredEquipmentSlot(stack); + if (equipmentSlot.getType() == EquipmentSlot.Type.ARMOR) { + ItemStack equipmentStack = player.getEquippedStack(equipmentSlot); + int index = 5 + (3 - equipmentSlot.getEntitySlotId()); + if (!equipmentStack.isEmpty() && player.playerScreenHandler.getSlot(index).canTakeItems(player)) { + player.setStackInHand(hand, equipmentStack); + player.equipStack(equipmentSlot, stack); + return TypedActionResult.consume(equipmentStack); } } - return TypedActionResult.pass(stack); - }); + } + return TypedActionResult.pass(stack); } } diff --git a/src/main/java/de/siphalor/mousewheelie/client/inventory/sort/InventorySorter.java b/src/main/java/de/siphalor/mousewheelie/client/inventory/sort/InventorySorter.java index e44e3d84..0650b1fe 100644 --- a/src/main/java/de/siphalor/mousewheelie/client/inventory/sort/InventorySorter.java +++ b/src/main/java/de/siphalor/mousewheelie/client/inventory/sort/InventorySorter.java @@ -19,6 +19,8 @@ import de.siphalor.mousewheelie.client.inventory.ContainerScreenHelper; import de.siphalor.mousewheelie.client.network.InteractionManager; +import de.siphalor.mousewheelie.client.network.MWClientNetworking; +import de.siphalor.mousewheelie.common.network.ReorderInventoryPacket; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.gui.screen.ingame.HandledScreen; @@ -122,48 +124,71 @@ private void combineStacks() { } public void sort(SortMode sortMode) { + if (inventorySlots.length <= 1) { + return; + } + combineStacks(); - ItemStack currentStack; - final int slotCount = stacks.length; - int[] sortIds = new int[slotCount]; + int[] sortIds = new int[stacks.length]; for (int i = 0; i < sortIds.length; i++) { sortIds[i] = i; } sortIds = sortMode.sort(sortIds, stacks, new SortContext(containerScreen, Arrays.asList(inventorySlots))); - // sortIds now maps the slot index (the target id) to which slot's contents should be moved there (the origin id) + + if (MWClientNetworking.canSendReorderPacket()) { + this.reorderInventory(sortIds); + } else { + this.sortOnClient(sortIds); + } + } + + protected void reorderInventory(int[] sortedIds) { + int[] slotMappings = new int[sortedIds.length * 2]; + for (int i = 0; i < sortedIds.length; i++) { + slotMappings[i * 2] = inventorySlots[sortedIds[i]].id; + slotMappings[i * 2 + 1] = inventorySlots[i].id; + } + MWClientNetworking.send(new ReorderInventoryPacket(containerScreen.getScreenHandler().syncId, slotMappings)); + } + + protected void sortOnClient(int[] sortedIds) { + ItemStack currentStack; + final int slotCount = stacks.length; + + // sortedIds now maps the slot index (the target id) to which slot's contents should be moved there (the origin id) int[] origin2Target = new int[slotCount]; for (int i = 0; i < origin2Target.length; i++) { - origin2Target[sortIds[i]] = i; + origin2Target[sortedIds[i]] = i; } // This is a combined bitset to save whether eac slot is done or empty. // It consists of all bits for the done states in the first half and the empty states in the second half. BitSet doneSlashEmpty = new BitSet(slotCount * 2); for (int i = 0; i < slotCount; i++) { // Iterate all slots to set up the state bit set - if (i == sortIds[i]) { // If the target slot is equal to the origin, + if (i == sortedIds[i]) { // If the target slot is equal to the origin, doneSlashEmpty.set(i); // then we're done with that slot already. continue; } if (stacks[i].isEmpty()) doneSlashEmpty.set(slotCount + i); // mark if it's empty } // Iterate all slots, with i as the target slot index - // sortIds[i] is therefore the origin slot + // sortedIds[i] is therefore the origin slot for (int i = 0; i < slotCount; i++) { if (doneSlashEmpty.get(i)) { // See if we're already done, continue; // and skip. } - if (doneSlashEmpty.get(slotCount + sortIds[i])) { // If the origin is empty, - doneSlashEmpty.set(sortIds[i]); // we can mark it as done + if (doneSlashEmpty.get(slotCount + sortedIds[i])) { // If the origin is empty, + doneSlashEmpty.set(sortedIds[i]); // we can mark it as done continue; // and skip. } // This is where the action happens. // Pick up the stack at the origin slot. - InteractionManager.push(screenHelper.createClickEvent(inventorySlots[sortIds[i]], 0, SlotActionType.PICKUP)); - doneSlashEmpty.set(slotCount + sortIds[i]); // Mark the origin slot as empty (because we picked the stack up, duh) - currentStack = stacks[sortIds[i]]; // Save the stack we're currently working with - Slot workingSlot = inventorySlots[sortIds[i]]; // A slot that we can use when fiddling around with swapping stacks + InteractionManager.push(screenHelper.createClickEvent(inventorySlots[sortedIds[i]], 0, SlotActionType.PICKUP)); + doneSlashEmpty.set(slotCount + sortedIds[i]); // Mark the origin slot as empty (because we picked the stack up, duh) + currentStack = stacks[sortedIds[i]]; // Save the stack we're currently working with + Slot workingSlot = inventorySlots[sortedIds[i]]; // A slot that we can use when fiddling around with swapping stacks int id = i; // id will reflect the target slot in the following loop do { // This loop follows chained stack moves (e.g. 1->2->5->1). if ( diff --git a/src/main/java/de/siphalor/mousewheelie/client/network/MWClientNetworking.java b/src/main/java/de/siphalor/mousewheelie/client/network/MWClientNetworking.java new file mode 100644 index 00000000..dbf16ba0 --- /dev/null +++ b/src/main/java/de/siphalor/mousewheelie/client/network/MWClientNetworking.java @@ -0,0 +1,19 @@ +package de.siphalor.mousewheelie.client.network; + +import de.siphalor.mousewheelie.common.network.MWNetworking; +import de.siphalor.mousewheelie.common.network.ReorderInventoryPacket; +import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking; +import net.minecraft.network.PacketByteBuf; + +public class MWClientNetworking extends MWNetworking { + + public static boolean canSendReorderPacket() { + return ClientPlayNetworking.canSend(REORDER_INVENTORY_C2S_PACKET); + } + + public static void send(ReorderInventoryPacket packet) { + PacketByteBuf buffer = createBuffer(); + packet.write(buffer); + ClientPlayNetworking.send(REORDER_INVENTORY_C2S_PACKET, buffer); + } +} diff --git a/src/main/java/de/siphalor/mousewheelie/common/network/MWLogicalServerNetworking.java b/src/main/java/de/siphalor/mousewheelie/common/network/MWLogicalServerNetworking.java new file mode 100644 index 00000000..f18b529a --- /dev/null +++ b/src/main/java/de/siphalor/mousewheelie/common/network/MWLogicalServerNetworking.java @@ -0,0 +1,141 @@ +package de.siphalor.mousewheelie.common.network; + +import de.siphalor.mousewheelie.MouseWheelie; +import it.unimi.dsi.fastutil.ints.IntAVLTreeSet; +import it.unimi.dsi.fastutil.ints.IntSet; +import lombok.CustomLog; +import net.fabricmc.fabric.api.networking.v1.PacketSender; +import net.fabricmc.fabric.api.networking.v1.ServerPlayNetworking; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.inventory.Inventory; +import net.minecraft.item.ItemStack; +import net.minecraft.network.PacketByteBuf; +import net.minecraft.screen.ScreenHandler; +import net.minecraft.screen.slot.Slot; +import net.minecraft.server.MinecraftServer; +import net.minecraft.server.network.ServerPlayNetworkHandler; +import net.minecraft.server.network.ServerPlayerEntity; + +import java.util.ArrayList; +import java.util.stream.Collectors; + +/** + * Class that handles functionality on the logical server side. + */ +@CustomLog +public class MWLogicalServerNetworking extends MWNetworking { + + private MWLogicalServerNetworking() {} + + public static void setup() { + ServerPlayNetworking.registerGlobalReceiver(REORDER_INVENTORY_C2S_PACKET, MWLogicalServerNetworking::onReorderInventoryPacket); + } + + private static void onReorderInventoryPacket(MinecraftServer server, ServerPlayerEntity player, ServerPlayNetworkHandler handler, PacketByteBuf buf, PacketSender responseSender) { + ReorderInventoryPacket packet = ReorderInventoryPacket.read(buf); + + if (packet == null) { + log.warn("Failed to read reorder inventory packet from player {}!", player); + return; + } + + if (player.currentScreenHandler == null) { + log.warn("Player {} tried to reorder inventory without having an open container!", player); + return; + } + + if (packet.getSyncId() == player.playerScreenHandler.syncId) { + server.execute(() -> reorder(player, player.playerScreenHandler, packet.getSlotMappings())); + } else if (packet.getSyncId() == player.currentScreenHandler.syncId) { + server.execute(() -> reorder(player, player.currentScreenHandler, packet.getSlotMappings())); + } + } + + private static void reorder(PlayerEntity player, ScreenHandler screenHandler, int[] slotMapping) { + if (!checkReorder(player, screenHandler, slotMapping)) { + log.warn("Reorder inventory packet from player {} contains invalid data, ignoring!", player); + return; + } + + ArrayList stacks = screenHandler.slots.stream().map(Slot::getStack).collect(Collectors.toCollection(ArrayList::new)); + + for (int i = 0; i < slotMapping.length; i += 2) { + int originSlotId = slotMapping[i]; + int destSlotId = slotMapping[i + 1]; + + screenHandler.slots.get(destSlotId).setStack(stacks.get(originSlotId)); + } + } + + private static boolean checkReorder(PlayerEntity player, ScreenHandler screenHandler, int[] slotMappings) { + if (slotMappings.length < 4) { + log.warn("Reorder inventory packet contains too few slots!"); + return false; + } + + IntSet requestedSlots = new IntAVLTreeSet(); + Inventory targetInv; + + Slot firstSlot = screenHandler.slots.get(slotMappings[0]); + targetInv = firstSlot.inventory; + + for (int i = 0; i < slotMappings.length; i += 2) { + int originSlotId = slotMappings[i]; + int destSlotId = slotMappings[i + 1]; + + if (!checkReorderSlot(screenHandler, originSlotId, targetInv)) { + return false; + } + if (!requestedSlots.add(originSlotId)) { + log.warn("Reorder inventory packet contains duplicate origin slot {}!", originSlotId); + return false; + } + + if (!checkReorderSlot(screenHandler, destSlotId, targetInv)) { + return false; + } + + if (originSlotId == destSlotId) { + continue; + } + + Slot originSlot = screenHandler.getSlot(originSlotId); + if (!originSlot.canTakeItems(player)) { + log.warn("Player {} tried to reorder slot {}, but that slot doesn't allow taking items!", player, originSlotId); + return false; + } + Slot destSlot = screenHandler.getSlot(destSlotId); + if (!destSlot.canInsert(originSlot.getStack())) { + log.warn("Player {} tried to reorder slot {}, but that slot doesn't allow inserting the origin stack!", player, destSlotId); + return false; + } + } + + for (int i = 1; i < slotMappings.length; i += 2) { + int destSlotId = slotMappings[i]; + if (!requestedSlots.remove(destSlotId)) { + log.warn("Reorder inventory packet contains duplicate destination slot or slot without origin: {}!", i); + return false; + } + } + if (!requestedSlots.isEmpty()) { + log.error("Invalid state during checking reorder packet, please report this to the {} bug tracker. Requested slots: {}", MouseWheelie.MOD_NAME, requestedSlots); + return false; + } + return true; + } + + private static boolean checkReorderSlot(ScreenHandler screenHandler, int slotId, Inventory targetInv) { + Slot slot = screenHandler.getSlot(slotId); + if (slot == null) { + log.warn("Reorder inventory packet contains invalid slot id!"); + return false; + } + + if (targetInv != slot.inventory) { + log.warn("Reorder inventory packet contains slots from different inventories!"); + return false; + } + return true; + } +} diff --git a/src/main/java/de/siphalor/mousewheelie/common/network/MWNetworking.java b/src/main/java/de/siphalor/mousewheelie/common/network/MWNetworking.java new file mode 100644 index 00000000..67f4a99b --- /dev/null +++ b/src/main/java/de/siphalor/mousewheelie/common/network/MWNetworking.java @@ -0,0 +1,16 @@ +package de.siphalor.mousewheelie.common.network; + +import de.siphalor.mousewheelie.MouseWheelie; +import io.netty.buffer.Unpooled; +import net.minecraft.network.PacketByteBuf; +import net.minecraft.util.Identifier; + +public class MWNetworking { + protected MWNetworking() {} + + protected static final Identifier REORDER_INVENTORY_C2S_PACKET = new Identifier(MouseWheelie.MOD_ID, "reorder_inventory_c2s"); + + protected static PacketByteBuf createBuffer() { + return new PacketByteBuf(Unpooled.buffer()); + } +} diff --git a/src/main/java/de/siphalor/mousewheelie/common/network/ReorderInventoryPacket.java b/src/main/java/de/siphalor/mousewheelie/common/network/ReorderInventoryPacket.java new file mode 100644 index 00000000..0539628e --- /dev/null +++ b/src/main/java/de/siphalor/mousewheelie/common/network/ReorderInventoryPacket.java @@ -0,0 +1,31 @@ +package de.siphalor.mousewheelie.common.network; + +import lombok.CustomLog; +import lombok.Value; +import net.minecraft.network.PacketByteBuf; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +@Value +@CustomLog +public class ReorderInventoryPacket { + int syncId; + int[] slotMappings; + + public void write(@NotNull PacketByteBuf buf) { + buf.writeVarInt(syncId); + buf.writeIntArray(slotMappings); + } + + public static @Nullable ReorderInventoryPacket read(PacketByteBuf buf) { + int syncId = buf.readVarInt(); + int[] reorderedIndices = buf.readIntArray(); + + if (reorderedIndices.length % 2 != 0) { + log.warn("Received reorder inventory packet with invalid data!"); + return null; + } + + return new ReorderInventoryPacket(syncId, reorderedIndices); + } +} From 0a86b25ecb0318432d1ca5841c61003e94dbf278 Mon Sep 17 00:00:00 2001 From: Siphalor Date: Mon, 24 Jul 2023 10:03:09 +0200 Subject: [PATCH 13/21] Various small code improvements --- .../inventory/ContainerScreenHelper.java | 16 +-- .../client/inventory/SlotRefiller.java | 119 ++++++++++-------- .../inventory/sort/InventorySorter.java | 6 +- .../client/inventory/sort/SortMode.java | 26 +--- .../gui/other/MixinAbstractButtonWidget.java | 3 +- .../client/network/InteractionManager.java | 45 ++++--- .../client/util/ReverseIterator.java | 5 + 7 files changed, 113 insertions(+), 107 deletions(-) diff --git a/src/main/java/de/siphalor/mousewheelie/client/inventory/ContainerScreenHelper.java b/src/main/java/de/siphalor/mousewheelie/client/inventory/ContainerScreenHelper.java index b57047d5..8cd66791 100644 --- a/src/main/java/de/siphalor/mousewheelie/client/inventory/ContainerScreenHelper.java +++ b/src/main/java/de/siphalor/mousewheelie/client/inventory/ContainerScreenHelper.java @@ -233,12 +233,9 @@ public int getScope(Slot slot, boolean preferSmallerScopes) { } else { if (slot.inventory instanceof PlayerInventory) { if (isHotbarSlot(slot)) { - if (MWConfig.general.hotbarScoping == MWConfig.General.HotbarScoping.HARD) { + if (MWConfig.general.hotbarScoping == MWConfig.General.HotbarScoping.HARD + || MWConfig.general.hotbarScoping == MWConfig.General.HotbarScoping.SOFT && preferSmallerScopes) { return -1; - } else if (MWConfig.general.hotbarScoping == MWConfig.General.HotbarScoping.SOFT) { - if (preferSmallerScopes) { - return -1; - } } } return 0; @@ -338,10 +335,9 @@ public void depositAllFrom(int scope) { }); runInScope(scope, slot -> { - if (slot.hasStack()) { - if (itemKinds.contains(ItemKind.of(slot.getStack()))) { - sendStackLocked(slot); - } + if (slot.hasStack() && itemKinds.contains(ItemKind.of(slot.getStack()))) { + sendStackLocked(slot); + } }); } @@ -424,7 +420,7 @@ public void restockAll(int scope) { int complementaryScope = getComplementaryScope(scope); slotsByItemKind.asMap().forEach((itemKind, slots) -> - restockAllOfAKind(slots.iterator(), complementaryScope) + restockAllOfAKind(slots.iterator(), complementaryScope) ); } diff --git a/src/main/java/de/siphalor/mousewheelie/client/inventory/SlotRefiller.java b/src/main/java/de/siphalor/mousewheelie/client/inventory/SlotRefiller.java index e10c20d0..55752ab1 100644 --- a/src/main/java/de/siphalor/mousewheelie/client/inventory/SlotRefiller.java +++ b/src/main/java/de/siphalor/mousewheelie/client/inventory/SlotRefiller.java @@ -33,8 +33,10 @@ import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; +import java.util.Objects; import java.util.concurrent.ConcurrentLinkedDeque; import java.util.function.Function; +import java.util.function.Predicate; @SuppressWarnings("unused") @Environment(EnvType.CLIENT) @@ -44,6 +46,8 @@ public class SlotRefiller { private static final ConcurrentLinkedDeque rules = new ConcurrentLinkedDeque<>(); + private SlotRefiller() {} + public static void set(PlayerInventory playerInventory, ItemStack stack) { SlotRefiller.playerInventory = playerInventory; SlotRefiller.stack = stack; @@ -59,62 +63,75 @@ public static boolean refill() { @SuppressWarnings("UnusedReturnValue") public static boolean refill(Hand hand) { - if (stack.getItem() == Items.TRIDENT) { - if (EnchantmentHelper.getLoyalty(stack) > 0) { - return false; - } + if (stack.getItem() == Items.TRIDENT && EnchantmentHelper.getLoyalty(stack) > 0) { + return false; } Iterator iterator = rules.descendingIterator(); while (iterator.hasNext()) { Rule rule = iterator.next(); - if (rule.matches(stack)) { - int slot = rule.findMatchingStack(playerInventory, stack); - if (slot != -1) { - if (slot == playerInventory.selectedSlot) { - return true; - } + if (!rule.matches(stack)) { + continue; + } - if (slot < 9) { - if (MWConfig.refill.restoreSelectedSlot) { - if (hand == Hand.MAIN_HAND && !playerInventory.offHand.get(0).isEmpty()) { - InteractionManager.push(InteractionManager.SWAP_WITH_OFFHAND_EVENT); - } - InteractionManager.push(new InteractionManager.PacketEvent(new UpdateSelectedSlotC2SPacket(slot), InteractionManager.TICK_WAITER)); - InteractionManager.push(InteractionManager.SWAP_WITH_OFFHAND_EVENT); - InteractionManager.push(new InteractionManager.PacketEvent(new UpdateSelectedSlotC2SPacket(playerInventory.selectedSlot), InteractionManager.TICK_WAITER)); - if (hand == Hand.MAIN_HAND) { - InteractionManager.push(InteractionManager.SWAP_WITH_OFFHAND_EVENT); - } - } else { - if (hand == Hand.OFF_HAND) { - InteractionManager.push(InteractionManager.SWAP_WITH_OFFHAND_EVENT); - } - playerInventory.selectedSlot = slot; - InteractionManager.push(new InteractionManager.PacketEvent(new UpdateSelectedSlotC2SPacket(slot), InteractionManager.TICK_WAITER)); - if (hand == Hand.OFF_HAND) { - InteractionManager.push(InteractionManager.SWAP_WITH_OFFHAND_EVENT); - } - } - } else { - if (hand == Hand.OFF_HAND) { - InteractionManager.push(InteractionManager.SWAP_WITH_OFFHAND_EVENT); - } - InteractionManager.push(new InteractionManager.PacketEvent( - new PickFromInventoryC2SPacket(slot), - triggerType -> triggerType == InteractionManager.TriggerType.HELD_ITEM_CHANGE - )); - if (hand == Hand.OFF_HAND) { - InteractionManager.push(InteractionManager.SWAP_WITH_OFFHAND_EVENT); - } - } - return true; - } + int slot = rule.findMatchingStack(playerInventory, stack); + + if (slot != -1) { + refillFromSlot(hand, slot); + return true; } } return false; } + private static void refillFromSlot(Hand hand, int slot) { + if (slot == playerInventory.selectedSlot) { + return; + } + + if (slot < 9) { + refillFromHotbar(hand, slot); + } else { + refillFromInventory(hand, slot); + } + } + + private static void refillFromHotbar(Hand hand, int hotbarSlot) { + if (MWConfig.refill.restoreSelectedSlot) { + if (hand == Hand.MAIN_HAND && !playerInventory.offHand.get(0).isEmpty()) { + InteractionManager.push(InteractionManager.SWAP_WITH_OFFHAND_EVENT); + } + InteractionManager.push(new InteractionManager.PacketEvent(new UpdateSelectedSlotC2SPacket(hotbarSlot), InteractionManager.TICK_WAITER)); + InteractionManager.push(InteractionManager.SWAP_WITH_OFFHAND_EVENT); + InteractionManager.push(new InteractionManager.PacketEvent(new UpdateSelectedSlotC2SPacket(playerInventory.selectedSlot), InteractionManager.TICK_WAITER)); + if (hand == Hand.MAIN_HAND) { + InteractionManager.push(InteractionManager.SWAP_WITH_OFFHAND_EVENT); + } + } else { + if (hand == Hand.OFF_HAND) { + InteractionManager.push(InteractionManager.SWAP_WITH_OFFHAND_EVENT); + } + playerInventory.selectedSlot = hotbarSlot; + InteractionManager.push(new InteractionManager.PacketEvent(new UpdateSelectedSlotC2SPacket(hotbarSlot), InteractionManager.TICK_WAITER)); + if (hand == Hand.OFF_HAND) { + InteractionManager.push(InteractionManager.SWAP_WITH_OFFHAND_EVENT); + } + } + } + + private static void refillFromInventory(Hand hand, int inventorySlot) { + if (hand == Hand.OFF_HAND) { + InteractionManager.push(InteractionManager.SWAP_WITH_OFFHAND_EVENT); + } + InteractionManager.push(new InteractionManager.PacketEvent( + new PickFromInventoryC2SPacket(inventorySlot), + triggerType -> triggerType == InteractionManager.TriggerType.HELD_ITEM_CHANGE + )); + if (hand == Hand.OFF_HAND) { + InteractionManager.push(InteractionManager.SWAP_WITH_OFFHAND_EVENT); + } + } + static { rules.add(new BlockRule()); rules.add(new ItemGroupRule()); @@ -125,12 +142,12 @@ public static boolean refill(Hand hand) { rules.add(new EqualStackRule()); } - public static abstract class Rule { + public abstract static class Rule { /** * Creates a new rule. * Automatically registers this rule to the list of rules. */ - public Rule() { + protected Rule() { rules.add(this); } @@ -154,12 +171,12 @@ public Rule() { /*** * Utility function that iterates over all slots of the player inventory and returns the first slot that matches the given predicate. * @param playerInventory The player inventory to search in. - * @param consumer The predicate to check for. + * @param predicate The predicate to check for. * @return The slot index of the matching stack or -1 if no match was found. */ - protected int iterateInventory(PlayerInventory playerInventory, Function consumer) { + protected int iterateInventory(PlayerInventory playerInventory, Predicate predicate) { for (int i = 0; i < playerInventory.main.size(); i++) { - if (consumer.apply(playerInventory.main.get(i))) + if (predicate.test(playerInventory.main.get(i))) return i; } return -1; @@ -246,7 +263,7 @@ private static int findBestThroughClassHierarchy(ItemStack baseStack, DefaultedL for (Iterator> iterator = classes.iterator(); iterator.hasNext(); classRank--) { if (classRank <= 0) break; if (classRank <= currentRank) continue outer; - if (clazz.equals(iterator.next())) { + if (Objects.equals(clazz, iterator.next())) { if (classRank >= classesSize) return i; currentRank = classRank; index = i; diff --git a/src/main/java/de/siphalor/mousewheelie/client/inventory/sort/InventorySorter.java b/src/main/java/de/siphalor/mousewheelie/client/inventory/sort/InventorySorter.java index 0650b1fe..232e151e 100644 --- a/src/main/java/de/siphalor/mousewheelie/client/inventory/sort/InventorySorter.java +++ b/src/main/java/de/siphalor/mousewheelie/client/inventory/sort/InventorySorter.java @@ -76,13 +76,13 @@ private void collectSlots(Slot originSlot) { this.inventorySlots = new Slot[0]; return; } - ArrayList inventorySlots = new ArrayList<>(); + ArrayList slotsInScope = new ArrayList<>(); for (Slot slot : containerScreen.getScreenHandler().slots) { if (originScope == screenHelper.getScope(slot, true)) { - inventorySlots.add(slot); + slotsInScope.add(slot); } } - this.inventorySlots = inventorySlots.toArray(new Slot[0]); + this.inventorySlots = slotsInScope.toArray(new Slot[0]); } private void combineStacks() { diff --git a/src/main/java/de/siphalor/mousewheelie/client/inventory/sort/SortMode.java b/src/main/java/de/siphalor/mousewheelie/client/inventory/sort/SortMode.java index 4dae5665..17134455 100644 --- a/src/main/java/de/siphalor/mousewheelie/client/inventory/sort/SortMode.java +++ b/src/main/java/de/siphalor/mousewheelie/client/inventory/sort/SortMode.java @@ -30,7 +30,10 @@ public abstract class SortMode implements DropdownMaterial { private static final Map SORT_MODES = new HashMap<>(); private final String name; - public static final SortMode NONE, ALPHABET, QUANTITY, RAW_ID; + public static final SortMode NONE; + public static final SortMode ALPHABET; + public static final SortMode QUANTITY; + public static final SortMode RAW_ID; public static T register(String name, T sortMode) { SORT_MODES.put(name, sortMode); @@ -53,27 +56,6 @@ protected SortMode(String name) { * @return The sorted array of slot indices */ public int[] sort(int[] sortIds, ItemStack[] stacks, SortContext context) { - Integer[] boxedSortIds = new Integer[sortIds.length]; - for (int i = 0; i < sortIds.length; i++) { - boxedSortIds[i] = sortIds[i]; - } - boxedSortIds = sort(boxedSortIds, stacks); - for (int i = 0; i < sortIds.length; i++) { - sortIds[i] = boxedSortIds[i]; - } - return sortIds; - } - - /** - * Sorts the given slot ids using the given stacks in the slots. Sorting may be done in place. - * @param sortIds An array of the current slot indices - * @param stacks The stacks in the respective slots - * @return The sorted array of slot indices - * @deprecated Please use the primitive variant {@link SortMode#sort(int[], ItemStack[], SortContext)} instead. - * @see SortMode#sort(int[], ItemStack[], SortContext) - */ - @Deprecated - public Integer[] sort(Integer[] sortIds, ItemStack[] stacks) { return sortIds; } diff --git a/src/main/java/de/siphalor/mousewheelie/client/mixin/gui/other/MixinAbstractButtonWidget.java b/src/main/java/de/siphalor/mousewheelie/client/mixin/gui/other/MixinAbstractButtonWidget.java index 4ee8656c..37fe5b93 100644 --- a/src/main/java/de/siphalor/mousewheelie/client/mixin/gui/other/MixinAbstractButtonWidget.java +++ b/src/main/java/de/siphalor/mousewheelie/client/mixin/gui/other/MixinAbstractButtonWidget.java @@ -34,8 +34,9 @@ public abstract class MixinAbstractButtonWidget { public void mouseClicked(double x, double y, int button, CallbackInfoReturnable callbackInfoReturnable) { if (this.clicked(x, y)) { if (this instanceof ISpecialClickableButtonWidget) { - if (((ISpecialClickableButtonWidget) this).mouseClicked(button)) + if (((ISpecialClickableButtonWidget) this).mouseClicked(button)) { callbackInfoReturnable.setReturnValue(true); + } } } } diff --git a/src/main/java/de/siphalor/mousewheelie/client/network/InteractionManager.java b/src/main/java/de/siphalor/mousewheelie/client/network/InteractionManager.java index e17a1de2..143104f7 100644 --- a/src/main/java/de/siphalor/mousewheelie/client/network/InteractionManager.java +++ b/src/main/java/de/siphalor/mousewheelie/client/network/InteractionManager.java @@ -18,6 +18,7 @@ package de.siphalor.mousewheelie.client.network; import de.siphalor.mousewheelie.client.MWClient; +import lombok.CustomLog; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.MinecraftClient; @@ -36,6 +37,7 @@ import java.util.function.Supplier; @Environment(EnvType.CLIENT) +@CustomLog public class InteractionManager { private static final Queue interactionEventQueue = new ArrayDeque<>(); private static final ScheduledThreadPoolExecutor scheduledExecutor = new ScheduledThreadPoolExecutor(1); @@ -87,24 +89,33 @@ public static void triggerSend(TriggerType triggerType) { waiter = null; break; } - if (event.shouldRunOnMainThread()) { - Waiter blockingWaiter = tt -> false; - waiter = blockingWaiter; - MinecraftClient.getInstance().execute(() -> { - synchronized (interactionEventQueue) { - if (waiter == blockingWaiter) { - waiter = event.send(); - } - } - }); - } else { - waiter = event.send(); - } + + doSendEvent(event); } while (waiter.trigger(TriggerType.INITIAL)); } } } + private static void doSendEvent(InteractionEvent event) { + if (event.shouldRunOnMainThread()) { + runOnMainThread(event); + } else { + waiter = event.send(); + } + } + + private static void runOnMainThread(InteractionEvent event) { + Waiter blockingWaiter = tt -> false; + waiter = blockingWaiter; + MinecraftClient.getInstance().execute(() -> { + synchronized (interactionEventQueue) { + if (waiter == blockingWaiter) { + waiter = event.send(); + } + } + }); + } + public static void setTickRate(long milliSeconds) { if (tickFuture != null) { tickFuture.cancel(false); @@ -116,8 +127,7 @@ public static void tick() { try { triggerSend(TriggerType.TICK); } catch (Exception e) { - System.err.println("Mouse Wheelie: Error while ticking InteractionManager"); - e.printStackTrace(); + log.error("Error while ticking InteractionManager", e); } } @@ -266,10 +276,5 @@ public Waiter send() { MinecraftClient.getInstance().getNetworkHandler().sendPacket(packet); return waiter; } - - @Override - public boolean shouldRunOnMainThread() { - return false; - } } } diff --git a/src/main/java/de/siphalor/mousewheelie/client/util/ReverseIterator.java b/src/main/java/de/siphalor/mousewheelie/client/util/ReverseIterator.java index 6dba36bd..291dfc9e 100644 --- a/src/main/java/de/siphalor/mousewheelie/client/util/ReverseIterator.java +++ b/src/main/java/de/siphalor/mousewheelie/client/util/ReverseIterator.java @@ -19,6 +19,7 @@ import java.util.Iterator; import java.util.List; +import java.util.NoSuchElementException; public class ReverseIterator implements Iterator { private final List backingList; @@ -40,6 +41,10 @@ public boolean hasNext() { @Override public T next() { + index -= 1; + if (index <= 0) { + throw new NoSuchElementException("Iterated past beginning of backing list"); + } return backingList.get(--index); } } From a9e3b4e268be84ec9423028ceb2c50e4d44f289b Mon Sep 17 00:00:00 2001 From: Siphalor Date: Mon, 24 Jul 2023 10:14:56 +0200 Subject: [PATCH 14/21] Make Mod Menu a compile-only dependency --- build.gradle | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/build.gradle b/build.gradle index 0833dcee..99bc0192 100644 --- a/build.gradle +++ b/build.gradle @@ -53,9 +53,7 @@ dependencies { fabric_deps.forEach { include(modImplementation(fabricApi.module(it, fabric_api_version)))} modImplementation(fabricApi.module("fabric-item-groups-v0", fabric_api_version)) - modImplementation("com.terraformersmc:modmenu:(,1.17)") { - exclude group: "net.fabricmc.fabric-api" - } + modCompileOnly "com.terraformersmc:modmenu:(,1.17)" include(modApi(platform("de.siphalor.tweed4:tweed4-bom-$minecraft_major_version:$tweed_version"))) def tweed_deps = [ From 4987518cd486660fd99c25a37b704c9eb5ca606a Mon Sep 17 00:00:00 2001 From: Siphalor Date: Mon, 24 Jul 2023 10:48:29 +0200 Subject: [PATCH 15/21] Implement #181 (Refill when items change) E.g. when emptying or filling water buckets. Implemented with an opt-out config option. --- .../de/siphalor/mousewheelie/MWConfig.java | 2 ++ .../mousewheelie/client/MWClient.java | 30 +++++++++++++++-- .../mixin/MixinClientPlayNetworkHandler.java | 19 +++-------- .../client/mixin/MixinContainer.java | 10 ++---- .../client/mixin/MixinMinecraftClient.java | 32 +++++++++++-------- .../mixin/entity/MixinClientPlayerEntity.java | 2 +- .../mixin/entity/MixinLivingEntity.java | 2 +- .../assets/mousewheelie/lang/en_us.json | 2 ++ 8 files changed, 59 insertions(+), 40 deletions(-) diff --git a/src/main/java/de/siphalor/mousewheelie/MWConfig.java b/src/main/java/de/siphalor/mousewheelie/MWConfig.java index e6844dd9..6aca9b5f 100644 --- a/src/main/java/de/siphalor/mousewheelie/MWConfig.java +++ b/src/main/java/de/siphalor/mousewheelie/MWConfig.java @@ -107,6 +107,8 @@ public static class Refill { public boolean offHand = true; public boolean restoreSelectedSlot = false; + public boolean itemChanges = true; + public boolean eat = true; public boolean drop = true; public boolean use = true; diff --git a/src/main/java/de/siphalor/mousewheelie/client/MWClient.java b/src/main/java/de/siphalor/mousewheelie/client/MWClient.java index 9d5c02cd..513af09b 100644 --- a/src/main/java/de/siphalor/mousewheelie/client/MWClient.java +++ b/src/main/java/de/siphalor/mousewheelie/client/MWClient.java @@ -102,9 +102,35 @@ public void onInitializeClient() { }); } - public static void scheduleRefill(Hand hand, PlayerInventory inventory, ItemStack stack) { + /** + * Schedules a refill if a refill scenario is encountered. + * @param hand the hand to potentially refill + * @param inventory the player inventory + * @param oldStack the old stack in the hand + * @param newStack the new stack in the hand + * @return whether a refill has been scheduled + */ + public static boolean scheduleRefillChecked(Hand hand, PlayerInventory inventory, ItemStack oldStack, ItemStack newStack) { + if (MinecraftClient.getInstance().currentScreen != null) { + return false; + } + + if (!oldStack.isEmpty() && (newStack.isEmpty() || (MWConfig.refill.itemChanges && oldStack.getItem() != newStack.getItem()))) { + scheduleRefillUnchecked(hand, inventory, oldStack.copy()); + return true; + } + return false; + } + + /** + * Unconditionally schedules a refill. + * @param hand the hand to refill + * @param inventory the player inventory + * @param referenceStack the stack to decide the refilling by + */ + public static void scheduleRefillUnchecked(Hand hand, PlayerInventory inventory, ItemStack referenceStack) { refillHand = hand; - SlotRefiller.set(inventory, stack); + SlotRefiller.set(inventory, referenceStack); } public static boolean performRefill() { diff --git a/src/main/java/de/siphalor/mousewheelie/client/mixin/MixinClientPlayNetworkHandler.java b/src/main/java/de/siphalor/mousewheelie/client/mixin/MixinClientPlayNetworkHandler.java index 4cd3d694..72b3ebb4 100644 --- a/src/main/java/de/siphalor/mousewheelie/client/mixin/MixinClientPlayNetworkHandler.java +++ b/src/main/java/de/siphalor/mousewheelie/client/mixin/MixinClientPlayNetworkHandler.java @@ -25,7 +25,6 @@ import net.minecraft.client.MinecraftClient; import net.minecraft.client.network.ClientPlayNetworkHandler; import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.item.ItemStack; import net.minecraft.network.Packet; import net.minecraft.network.packet.c2s.play.PlayerActionC2SPacket; import net.minecraft.network.packet.s2c.play.ConfirmScreenActionS2CPacket; @@ -69,13 +68,8 @@ public void onGuiSlotUpdateHotbar(ScreenHandlerSlotUpdateS2CPacket packet, Callb if (MWConfig.refill.enable && MWConfig.refill.other) { //noinspection ConstantConditions PlayerInventory inventory = client.player.inventory; - if (packet.getItemStack().isEmpty() && MinecraftClient.getInstance().currentScreen == null) { - if (packet.getSlot() - 36 == inventory.selectedSlot) { // MAIN_HAND - ItemStack stack = inventory.getStack(inventory.selectedSlot); - if (!stack.isEmpty()) { - MWClient.scheduleRefill(Hand.MAIN_HAND, inventory, stack.copy()); - } - } + if (packet.getSlot() - 36 == inventory.selectedSlot) { // MAIN_HAND + MWClient.scheduleRefillChecked(Hand.MAIN_HAND, inventory, inventory.getStack(inventory.selectedSlot), packet.getItemStack()); } } } @@ -85,13 +79,8 @@ public void onGuiSlotUpdateOther(ScreenHandlerSlotUpdateS2CPacket packet, Callba //noinspection ConstantConditions if (MWConfig.refill.enable && MWConfig.refill.other && client.player.currentScreenHandler == client.player.playerScreenHandler && packet.getSlot() == 45) { PlayerInventory inventory = client.player.inventory; - if (packet.getItemStack().isEmpty() && MinecraftClient.getInstance().currentScreen == null) { - if (packet.getSlot() == 45) { - ItemStack stack = inventory.offHand.get(0); - if (!stack.isEmpty()) { - MWClient.scheduleRefill(Hand.OFF_HAND, inventory, stack.copy()); - } - } + if (packet.getSlot() == 45) { // OFF_HAND + MWClient.scheduleRefillChecked(Hand.OFF_HAND, inventory, inventory.offHand.get(0), packet.getItemStack()); } } } diff --git a/src/main/java/de/siphalor/mousewheelie/client/mixin/MixinContainer.java b/src/main/java/de/siphalor/mousewheelie/client/mixin/MixinContainer.java index 459f0388..0bb8115b 100644 --- a/src/main/java/de/siphalor/mousewheelie/client/mixin/MixinContainer.java +++ b/src/main/java/de/siphalor/mousewheelie/client/mixin/MixinContainer.java @@ -50,15 +50,9 @@ public void onSlotUpdate(List itemStacks, CallbackInfo callbackInfo, if ((Object) this instanceof PlayerScreenHandler && MWConfig.refill.enable && MWConfig.refill.other) { PlayerInventory inventory = MinecraftClient.getInstance().player.inventory; if (inventory.selectedSlot == ((ISlot) getSlot(index)).mouseWheelie_getInvSlot()) { - ItemStack stack = inventory.getMainHandStack(); - if (!stack.isEmpty() && itemStacks.get(index).isEmpty()) { - MWClient.scheduleRefill(Hand.MAIN_HAND, inventory, stack.copy()); - } + MWClient.scheduleRefillChecked(Hand.MAIN_HAND, inventory, inventory.getMainHandStack(), itemStacks.get(index)); } else if (40 == ((ISlot) getSlot(index)).mouseWheelie_getInvSlot()) { - ItemStack stack = inventory.getStack(40); - if (!stack.isEmpty() && itemStacks.get(index).isEmpty()) { - MWClient.scheduleRefill(Hand.OFF_HAND, inventory, stack.copy()); - } + MWClient.scheduleRefillChecked(Hand.OFF_HAND, inventory, inventory.getStack(40), itemStacks.get(index)); } } } diff --git a/src/main/java/de/siphalor/mousewheelie/client/mixin/MixinMinecraftClient.java b/src/main/java/de/siphalor/mousewheelie/client/mixin/MixinMinecraftClient.java index 4da45809..9cf43eb2 100644 --- a/src/main/java/de/siphalor/mousewheelie/client/mixin/MixinMinecraftClient.java +++ b/src/main/java/de/siphalor/mousewheelie/client/mixin/MixinMinecraftClient.java @@ -27,37 +27,43 @@ import net.minecraft.util.Hand; 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; @Environment(EnvType.CLIENT) @Mixin(MinecraftClient.class) -public class MixinMinecraftClient { +public abstract class MixinMinecraftClient { @Shadow public ClientPlayerEntity player; - private ItemStack mouseWheelie_mainHandStack; - private ItemStack mouseWheelie_offHandStack; + + @Unique + private ItemStack mainHandStack; + @Unique + private ItemStack offHandStack; @Inject(method = "doItemUse", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/Hand;values()[Lnet/minecraft/util/Hand;")) public void onItemUse(CallbackInfo callbackInfo) { if (MWConfig.refill.enable && MWConfig.refill.use) { - mouseWheelie_mainHandStack = player.getMainHandStack(); - mouseWheelie_mainHandStack = mouseWheelie_mainHandStack.isEmpty() ? null : mouseWheelie_mainHandStack.copy(); - mouseWheelie_offHandStack = player.getOffHandStack(); - mouseWheelie_offHandStack = mouseWheelie_offHandStack.isEmpty() ? null : mouseWheelie_offHandStack.copy(); + mainHandStack = player.getMainHandStack(); + mainHandStack = mainHandStack.isEmpty() ? null : mainHandStack.copy(); + offHandStack = player.getOffHandStack(); + offHandStack = offHandStack.isEmpty() ? null : offHandStack.copy(); } } @Inject(method = "doItemUse", at = @At("RETURN")) public void onItemUsed(CallbackInfo callbackInfo) { - if (mouseWheelie_mainHandStack != null && player.getMainHandStack().isEmpty()) { - MWClient.scheduleRefill(Hand.MAIN_HAND, player.inventory, mouseWheelie_mainHandStack); - } else if (mouseWheelie_offHandStack != null && player.getOffHandStack().isEmpty()) { - MWClient.scheduleRefill(Hand.OFF_HAND, player.inventory, mouseWheelie_offHandStack); + boolean refillScheduled = false; + if (mainHandStack != null) { + refillScheduled = MWClient.scheduleRefillChecked(Hand.MAIN_HAND, player.inventory, mainHandStack, player.getMainHandStack()); + } + if (!refillScheduled && offHandStack != null) { + MWClient.scheduleRefillChecked(Hand.MAIN_HAND, player.inventory, offHandStack, player.getOffHandStack()); } MWClient.performRefill(); - mouseWheelie_mainHandStack = null; - mouseWheelie_offHandStack = null; + mainHandStack = null; + offHandStack = null; } } diff --git a/src/main/java/de/siphalor/mousewheelie/client/mixin/entity/MixinClientPlayerEntity.java b/src/main/java/de/siphalor/mousewheelie/client/mixin/entity/MixinClientPlayerEntity.java index f36dc53e..018fa399 100644 --- a/src/main/java/de/siphalor/mousewheelie/client/mixin/entity/MixinClientPlayerEntity.java +++ b/src/main/java/de/siphalor/mousewheelie/client/mixin/entity/MixinClientPlayerEntity.java @@ -47,7 +47,7 @@ public void onScreenClosed(CallbackInfo callbackInfo) { public void onDropSelectedItem(boolean all, CallbackInfoReturnable callbackInfoReturnable) { if (MWConfig.refill.enable && MWConfig.refill.drop) { if (!getMainHandStack().isEmpty()) { - MWClient.scheduleRefill(Hand.MAIN_HAND, inventory, getMainHandStack().copy()); + MWClient.scheduleRefillUnchecked(Hand.MAIN_HAND, inventory, getMainHandStack().copy()); } } } diff --git a/src/main/java/de/siphalor/mousewheelie/client/mixin/entity/MixinLivingEntity.java b/src/main/java/de/siphalor/mousewheelie/client/mixin/entity/MixinLivingEntity.java index 98f4cc14..44a05c96 100644 --- a/src/main/java/de/siphalor/mousewheelie/client/mixin/entity/MixinLivingEntity.java +++ b/src/main/java/de/siphalor/mousewheelie/client/mixin/entity/MixinLivingEntity.java @@ -47,7 +47,7 @@ protected void onItemUseFinish(CallbackInfo callbackInfo) { if ((Object) this instanceof PlayerEntity && MWConfig.refill.enable && MWConfig.refill.eat && activeItemStack.isEmpty()) { PlayerInventory playerInventory = ((PlayerEntity) (Object) this).inventory; activeItemStack.setCount(1); - MWClient.scheduleRefill(getActiveHand(), playerInventory, activeItemStack.copy()); + MWClient.scheduleRefillUnchecked(getActiveHand(), playerInventory, activeItemStack.copy()); activeItemStack.setCount(0); } } diff --git a/src/main/resources/assets/mousewheelie/lang/en_us.json b/src/main/resources/assets/mousewheelie/lang/en_us.json index 598ade82..03f36561 100644 --- a/src/main/resources/assets/mousewheelie/lang/en_us.json +++ b/src/main/resources/assets/mousewheelie/lang/en_us.json @@ -66,6 +66,8 @@ "tweed4_tailor_screen.screen.mousewheelie.refill.off-hand.description": "Refills stacks in the off hand.", "tweed4_tailor_screen.screen.mousewheelie.refill.restore-selected-slot": "Restore selected slot", "tweed4_tailor_screen.screen.mousewheelie.refill.restore-selected-slot.description": "Restore the refilled item to the originally selected slot.\nThis will take a tad more time. You might want to turn this off on slow connections.", + "tweed4_tailor_screen.screen.mousewheelie.refill.item-changes": "Refill when current item changes", + "tweed4_tailor_screen.screen.mousewheelie.refill.item-changes.description": "Refill when the item just used changes to a different item.\nThis is e.g. triggered when filling or emptying water buckets.", "tweed4_tailor_screen.screen.mousewheelie.refill.eat": "Refill when eating food", "tweed4_tailor_screen.screen.mousewheelie.refill.eat.description": "Refill when the last food item in the hand has been consumed.", "tweed4_tailor_screen.screen.mousewheelie.refill.drop": "Refill when dropping items", From 9801649600152e952d6daf0fd59019e5b3eb389c Mon Sep 17 00:00:00 2001 From: Siphalor Date: Mon, 24 Jul 2023 11:22:41 +0200 Subject: [PATCH 16/21] Add missing license headers --- .../client/network/MWClientNetworking.java | 17 +++++++++++++++++ .../network/MWLogicalServerNetworking.java | 17 +++++++++++++++++ .../common/network/MWNetworking.java | 17 +++++++++++++++++ .../common/network/ReorderInventoryPacket.java | 17 +++++++++++++++++ 4 files changed, 68 insertions(+) diff --git a/src/main/java/de/siphalor/mousewheelie/client/network/MWClientNetworking.java b/src/main/java/de/siphalor/mousewheelie/client/network/MWClientNetworking.java index dbf16ba0..b8363c8f 100644 --- a/src/main/java/de/siphalor/mousewheelie/client/network/MWClientNetworking.java +++ b/src/main/java/de/siphalor/mousewheelie/client/network/MWClientNetworking.java @@ -1,3 +1,20 @@ +/* + * Copyright 2020-2022 Siphalor + * + * 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 + * + * http://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. + */ + package de.siphalor.mousewheelie.client.network; import de.siphalor.mousewheelie.common.network.MWNetworking; diff --git a/src/main/java/de/siphalor/mousewheelie/common/network/MWLogicalServerNetworking.java b/src/main/java/de/siphalor/mousewheelie/common/network/MWLogicalServerNetworking.java index f18b529a..7219a483 100644 --- a/src/main/java/de/siphalor/mousewheelie/common/network/MWLogicalServerNetworking.java +++ b/src/main/java/de/siphalor/mousewheelie/common/network/MWLogicalServerNetworking.java @@ -1,3 +1,20 @@ +/* + * Copyright 2020-2022 Siphalor + * + * 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 + * + * http://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. + */ + package de.siphalor.mousewheelie.common.network; import de.siphalor.mousewheelie.MouseWheelie; diff --git a/src/main/java/de/siphalor/mousewheelie/common/network/MWNetworking.java b/src/main/java/de/siphalor/mousewheelie/common/network/MWNetworking.java index 67f4a99b..c5707e7e 100644 --- a/src/main/java/de/siphalor/mousewheelie/common/network/MWNetworking.java +++ b/src/main/java/de/siphalor/mousewheelie/common/network/MWNetworking.java @@ -1,3 +1,20 @@ +/* + * Copyright 2020-2022 Siphalor + * + * 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 + * + * http://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. + */ + package de.siphalor.mousewheelie.common.network; import de.siphalor.mousewheelie.MouseWheelie; diff --git a/src/main/java/de/siphalor/mousewheelie/common/network/ReorderInventoryPacket.java b/src/main/java/de/siphalor/mousewheelie/common/network/ReorderInventoryPacket.java index 0539628e..a7c06249 100644 --- a/src/main/java/de/siphalor/mousewheelie/common/network/ReorderInventoryPacket.java +++ b/src/main/java/de/siphalor/mousewheelie/common/network/ReorderInventoryPacket.java @@ -1,3 +1,20 @@ +/* + * Copyright 2020-2022 Siphalor + * + * 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 + * + * http://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. + */ + package de.siphalor.mousewheelie.common.network; import lombok.CustomLog; From 0d61eb1fbe5c8971a8d53db601842eeaa43a9ade Mon Sep 17 00:00:00 2001 From: Siphalor Date: Mon, 24 Jul 2023 11:37:13 +0200 Subject: [PATCH 17/21] Allow to disable server accelerated sorting Because... ... ... ...why not? --- src/main/java/de/siphalor/mousewheelie/MWConfig.java | 1 + .../mousewheelie/client/inventory/sort/InventorySorter.java | 3 ++- src/main/resources/assets/mousewheelie/lang/en_us.json | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/de/siphalor/mousewheelie/MWConfig.java b/src/main/java/de/siphalor/mousewheelie/MWConfig.java index 6aca9b5f..d9ee0bd3 100644 --- a/src/main/java/de/siphalor/mousewheelie/MWConfig.java +++ b/src/main/java/de/siphalor/mousewheelie/MWConfig.java @@ -96,6 +96,7 @@ public static class Sort { public SortMode primarySort = SortMode.RAW_ID; public SortMode shiftSort = SortMode.QUANTITY; public SortMode controlSort = SortMode.ALPHABET; + public boolean serverAcceleratedSorting = true; } public static Refill refill = new Refill(); diff --git a/src/main/java/de/siphalor/mousewheelie/client/inventory/sort/InventorySorter.java b/src/main/java/de/siphalor/mousewheelie/client/inventory/sort/InventorySorter.java index 232e151e..7c2a0233 100644 --- a/src/main/java/de/siphalor/mousewheelie/client/inventory/sort/InventorySorter.java +++ b/src/main/java/de/siphalor/mousewheelie/client/inventory/sort/InventorySorter.java @@ -17,6 +17,7 @@ package de.siphalor.mousewheelie.client.inventory.sort; +import de.siphalor.mousewheelie.MWConfig; import de.siphalor.mousewheelie.client.inventory.ContainerScreenHelper; import de.siphalor.mousewheelie.client.network.InteractionManager; import de.siphalor.mousewheelie.client.network.MWClientNetworking; @@ -136,7 +137,7 @@ public void sort(SortMode sortMode) { sortIds = sortMode.sort(sortIds, stacks, new SortContext(containerScreen, Arrays.asList(inventorySlots))); - if (MWClientNetworking.canSendReorderPacket()) { + if (MWConfig.sort.serverAcceleratedSorting && MWClientNetworking.canSendReorderPacket()) { this.reorderInventory(sortIds); } else { this.sortOnClient(sortIds); diff --git a/src/main/resources/assets/mousewheelie/lang/en_us.json b/src/main/resources/assets/mousewheelie/lang/en_us.json index 03f36561..b1bb9ece 100644 --- a/src/main/resources/assets/mousewheelie/lang/en_us.json +++ b/src/main/resources/assets/mousewheelie/lang/en_us.json @@ -56,6 +56,8 @@ "tweed4_tailor_screen.screen.mousewheelie.sort.shift-sort.description": "Sets the sort mode for sorting whilst pressing shift.", "tweed4_tailor_screen.screen.mousewheelie.sort.control-sort": "Control + middle mouse click", "tweed4_tailor_screen.screen.mousewheelie.sort.control-sort.description": "Sets the sort mode for sorting whilst pressing control.", + "tweed4_tailor_screen.screen.mousewheelie.sort.server-accelerated-sorting": "Server accelerated sorting", + "tweed4_tailor_screen.screen.mousewheelie.sort.server-accelerated-sorting.description": "Whether to use close to instant sorting when in singleplayer or if Mouse Wheelie is installed on the server.", "tweed4_tailor_screen.screen.mousewheelie.sort.optimize-creative-search-sort": "Optimized creative sorting", "tweed4_tailor_screen.screen.mousewheelie.sort.optimize-creative-search-sort.description": "Whether the creative search sorting should be optimized for performance.\nThis will make use of more memory in exchange for processor time, only disable this if you run into memory issues.", "tweed4_tailor_screen.screen.mousewheelie.refill": "Refill", From f71079fc6c8bbd40d11df34d13c284087a6f8301 Mon Sep 17 00:00:00 2001 From: Weblate Date: Mon, 10 Jul 2023 17:21:45 +0000 Subject: [PATCH 18/21] Translated using Weblate (German (de_de)) Currently translated at 98.9% (98 of 99 strings) Co-authored-by: WolfiiYV Translate-URL: https://weblate.siphalor.de/projects/mouse-wheelie/lang/de_de/ Translation: Mouse Wheelie/Mouse Wheelie --- src/main/resources/assets/mousewheelie/lang/de_de.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/resources/assets/mousewheelie/lang/de_de.json b/src/main/resources/assets/mousewheelie/lang/de_de.json index 5b11fa3b..4e438395 100644 --- a/src/main/resources/assets/mousewheelie/lang/de_de.json +++ b/src/main/resources/assets/mousewheelie/lang/de_de.json @@ -95,5 +95,6 @@ "tweed4_tailor_screen.screen.mousewheelie.scrolling.description": "Gegenstände können durch Scrollen über einem Gegenstandsstapel leicht in das Inventar oder heraus bewegt werden.\nIn Kombination mit Modifikationen wie der Umschalt- oder Steuerungstaste (in den Tastenbelegungseinstellungen anpassbar) können ganze Stapel gescrollt werden, alle Gegenstände einer Sorte oder alle Gegenstände eines Inventars.", "tweed4_tailor_screen.screen.mousewheelie.general.enable-bundle-dragging": "Bündelverschiebung aktivieren", "tweed4_tailor_screen.screen.mousewheelie.refill.enable.description": "Aktiviert automatische Gegenstandsauffüllung.\nDeaktiviere dies, um automatisches Auffüllen zu deaktivieren.", - "tweed4_tailor_screen.screen.mousewheelie.refill.enable": "Aktiviere automatische Gegenstandsauffüllung" + "tweed4_tailor_screen.screen.mousewheelie.refill.enable": "Aktiviere automatische Gegenstandsauffüllung", + "key.mousewheelie.restock_modifier": "Auffüll Modifikator" } From 43a5cbe83f0b0c5b99dfcded777ba363fa06611c Mon Sep 17 00:00:00 2001 From: Weblate Date: Mon, 10 Jul 2023 17:21:45 +0000 Subject: [PATCH 19/21] Translated using Weblate (Portuguese (Brazil)) Currently translated at 100.0% (99 of 99 strings) Co-authored-by: RiginDev Co-authored-by: Weblate Translate-URL: https://weblate.siphalor.de/projects/mouse-wheelie/lang/pt_BR/ Translation: Mouse Wheelie/Mouse Wheelie --- src/main/resources/assets/mousewheelie/lang/pt_br.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/resources/assets/mousewheelie/lang/pt_br.json b/src/main/resources/assets/mousewheelie/lang/pt_br.json index 4d8f5923..cdf4be2e 100644 --- a/src/main/resources/assets/mousewheelie/lang/pt_br.json +++ b/src/main/resources/assets/mousewheelie/lang/pt_br.json @@ -95,5 +95,7 @@ "tweed4_tailor_screen.screen.mousewheelie.tool-picking.hold-block": "Clicar com o botão do meio do mouse enquanto segura o mesmo bloco", "tweed4_tailor_screen.screen.mousewheelie.tool-picking.hold-block.description": "Seleciona a ferramenta correta quando clicando com o botão do meio do mouse (trocável) enquanto segura o mesmo bloco que está olhando.", "tweed4_tailor_screen.screen.mousewheelie.tool-picking.pick-from-inventory": "Seleciona de todo o inventário", - "tweed4_tailor_screen.screen.mousewheelie.tool-picking.pick-from-inventory.description": "Permite selecionar ferramentas do inventário inteiro.\nSe desabilitado, só irá selecionar da hotbar." + "tweed4_tailor_screen.screen.mousewheelie.tool-picking.pick-from-inventory.description": "Permite selecionar ferramentas do inventário inteiro.\nSe desabilitado, só irá selecionar da hotbar.", + "key.mousewheelie.restock_modifier": "Modificador de Reabastecimento", + "key.mousewheelie.deposit_modifier": "Modificador de Depósito" } From 97517b3b396ac17c4976b7c413776819236c653a Mon Sep 17 00:00:00 2001 From: Weblate Date: Mon, 24 Jul 2023 10:37:14 +0000 Subject: [PATCH 20/21] Translated using Weblate (English) Currently translated at 100.0% (103 of 103 strings) Co-authored-by: Weblate Admin Translate-URL: https://weblate.siphalor.de/projects/mouse-wheelie/lang/en/ Translation: Mouse Wheelie/Mouse Wheelie --- src/main/resources/assets/mousewheelie/lang/en_us.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/resources/assets/mousewheelie/lang/en_us.json b/src/main/resources/assets/mousewheelie/lang/en_us.json index b1bb9ece..7e207303 100644 --- a/src/main/resources/assets/mousewheelie/lang/en_us.json +++ b/src/main/resources/assets/mousewheelie/lang/en_us.json @@ -4,8 +4,8 @@ "key.mousewheelie.whole_stack_modifier": "Whole Stack Modifier", "key.mousewheelie.all_of_kind_modifier": "All of Kind Modifier", "key.mousewheelie.drop_modifier": "Drop Modifier", - "key.mousewheelie.deposit_modifier": "Deposit Modifier", - "key.mousewheelie.restock_modifier": "Restock Modifier", + "key.mousewheelie.deposit_modifier": "Deposit Modifier", + "key.mousewheelie.restock_modifier": "Restock Modifier", "key.mousewheelie.sort_inventory": "Sort Inventory", "key.mousewheelie.scroll_up": "Scroll Items Up", "key.mousewheelie.scroll_down": "Scroll Items Down", @@ -43,7 +43,7 @@ "tweed4_tailor_screen.screen.mousewheelie.scrolling.invert": "Invert scroll direction", "tweed4_tailor_screen.screen.mousewheelie.scrolling.invert.description": "Invert the scroll direction when scrolling items.", "tweed4_tailor_screen.screen.mousewheelie.scrolling.directional-scrolling": "Directional Scrolling", - "tweed4_tailor_screen.screen.mousewheelie.scrolling.directional-scrolling.description": "If enabled items will be moved according to whether your scrolling up or down.\nIf disabled you will scroll to change the amount of items present (up will increase - down will decrease).", + "tweed4_tailor_screen.screen.mousewheelie.scrolling.directional-scrolling.description": "If enabled, items will be moved based on the visual position on the screen:\nWhen scrolling up, items will be sent to the upper inventory, when scrolling down to the lower inventory.\nIf disabled, scrolling will instead affect the amount of items:\nWhen scrolling up, items will be moved towards the stack, when scrolling down items will be sent to the opposite inventory.\n\nUsing \"Invert scroll direction\", you can swap the up and down behavior for these actions.", "tweed4_tailor_screen.screen.mousewheelie.scrolling.scroll-creative-menu-items": "Scroll creative menu items", "tweed4_tailor_screen.screen.mousewheelie.scrolling.scroll-creative-menu-items.description": "Sets whether to by default scroll items out of the creative menu.", "tweed4_tailor_screen.screen.mousewheelie.scrolling.scroll-creative-menu-tabs": "Scroll creative menu tabs", @@ -61,7 +61,7 @@ "tweed4_tailor_screen.screen.mousewheelie.sort.optimize-creative-search-sort": "Optimized creative sorting", "tweed4_tailor_screen.screen.mousewheelie.sort.optimize-creative-search-sort.description": "Whether the creative search sorting should be optimized for performance.\nThis will make use of more memory in exchange for processor time, only disable this if you run into memory issues.", "tweed4_tailor_screen.screen.mousewheelie.refill": "Refill", - "tweed4_tailor_screen.screen.mousewheelie.refill.description": "Item refilling is a feature that automatically loads more items from your inventory when your current stack runs out.\nThis is for example useful when building with a lot of the same block so you don't have to constantly open the inventory.", + "tweed4_tailor_screen.screen.mousewheelie.refill.description": "Item refilling is a feature that automatically loads more items from your inventory when your current stack runs out.\nThis is for example useful when building with a lot of the same block, so you don't have to constantly open your inventory.\n\nThe first section of this config concerns which or under which circumstances items will get refilled.\nThe \"Refill rules\" section, allows you to configure how the replacement stack will be determined by searching your inventory.", "tweed4_tailor_screen.screen.mousewheelie.refill.enable": "Enable item refilling", "tweed4_tailor_screen.screen.mousewheelie.refill.enable.description": "Enables item refilling.\nTurn this off to disable refilling entirely.", "tweed4_tailor_screen.screen.mousewheelie.refill.off-hand": "Refill the off hand", From 0d507b23582a4f9b971e8a9633944c441e93b08d Mon Sep 17 00:00:00 2001 From: Siphalor Date: Mon, 24 Jul 2023 12:39:48 +0200 Subject: [PATCH 21/21] Version 1.12.0 - Implemented server accelerated sorting! In singleplayer or if Mouse Wheelie is installed on the server as well, sorting will now be near instant. - Item changes will now be picked up for refilling. That means that e.g. emptying or filling water buckets will now refill the buckets. - Translations for Portugese (Brazil), thanks to RiginDev --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 6bf2c22a..9e6d8cce 100644 --- a/gradle.properties +++ b/gradle.properties @@ -8,7 +8,7 @@ yarn_build=5:v2 loader_version=0.14.11 # Mod Properties mod_id=mousewheelie -mod_version=1.11.1 +mod_version=1.12.0 mod_release=release mod_mc_version_specifier=1.16.3+ mod_mc_versions=1.16.3;1.16.4;1.16.5