Compare commits
6
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d6ca1140b5 | ||
|
|
7a2f697024 | ||
|
|
4d0750e993 | ||
|
|
c49673801f | ||
|
|
5386c7ac8a | ||
|
|
eb25625a45 |
+8
-2
@@ -6,13 +6,19 @@ Ce journal suit les **versions du modpack**. Lorsqu'un seul module change, sa ve
|
||||
- Depuis `26.2.0-alpha.6`, le pack et les modules ont des versions indépendantes. I Like To Move It et Only Fun deviennent les cinquième et sixième modules actifs dans l'alpha 46.
|
||||
- Les versions ci-dessous ont été reconstituées à partir des JAR archivés, des packs locaux et du code source actuel. Les dates n'étant pas enregistrées de manière fiable, elles ne sont pas inventées.
|
||||
|
||||
## Non distribué
|
||||
## `26.2.0-alpha.222`
|
||||
|
||||
Module modifié : **Sanctuary `0.0.0-alpha.123`**. Le pack public reste temporairement en `26.2.0-alpha.221` jusqu'à la publication.
|
||||
Modules modifiés : **Red-Stoner `0.0.0-alpha.13`** et **Sanctuary `0.0.0-alpha.124`**. Les huit autres modules conservent leur version issue de l'alpha.221.
|
||||
|
||||
- ajoute au terminal de stockage une recherche clavier focalisée à l'ouverture, compatible avec les noms affichés, les IDs, les traductions, les accents et Unicode ;
|
||||
- affiche les grandes quantités du terminal sous forme compacte (`1K`, `1.2K`, `12K`, `1.2M`) tout en conservant la valeur exacte dans l'infobulle ;
|
||||
- stabilise les emplacements du terminal lorsqu'une pile est vidée afin que les ressources suivantes ne glissent plus sous le curseur, puis recompacte volontairement lors d'une nouvelle recherche ou à la réouverture ;
|
||||
- ajoute un suivi d'avancement des quêtes, affichable ou masquable par une touche configurable (`J` par défaut) ;
|
||||
- affiche chaque quête active comme un simple texte ombré en haut à gauche, sans panneau, bordure, titre, message vide ni barre de progression ;
|
||||
- synchronise un snapshot borné des quêtes acceptées et des contrats réservés, sans les demandes que le joueur a lui-même créées, ni changer les données Sanctuary v11 ni le protocole réseau 22 ;
|
||||
- propose une saisie assistée des IDs d'item et de mob dans l'éditeur de demande, avec icône et noms proches.
|
||||
- actualise JEI vers la bêta Fabric 26.2 `30.29.0.196` et synchronise Packwiz avec l'index Prism/Modrinth ;
|
||||
- conserve Red-Stoner data v3/protocole 7, Sanctuary data v11/protocole 22, les IDs et les sauvegardes existantes ; aucun nouveau monde ni réinitialisation n'est nécessaire.
|
||||
|
||||
## `26.2.0-alpha.221`
|
||||
|
||||
|
||||
@@ -22,10 +22,12 @@ Licence : **GNU GPL 3.0 or Later** (`GPL-3.0-or-later`)
|
||||
|
||||
Les descriptions FR/EN/RU sont déclarées dans chaque `fabric.mod.json` et dans les fichiers de langue. Les images fournies servent d'icônes Fabric de leur module.
|
||||
|
||||
Version courante du pack distribué : **`26.2.0-alpha.221`**. Cette release distribue Ambiance **`0.0.0-alpha.22`** ; les neuf autres modules conservent leur version issue de l'alpha.220.
|
||||
Version courante du pack distribué : **`26.2.0-alpha.222`**. Cette release distribue Red-Stoner **`0.0.0-alpha.13`** et Sanctuary **`0.0.0-alpha.124`** ; les huit autres modules conservent leur version issue de l'alpha.221.
|
||||
|
||||
La migration [CANA-01 à CANA-09](CANAPLIA.md) porte Canaplia vers Minecraft 26.2. It's Alive **`0.0.0-alpha.35`** enregistre les seize familles, les découvertes, hybridations, résines, effets serveur et le Livre interdit personnel, partageable temporairement sur un pupitre. Ambiance **`0.0.0-alpha.14`** compose les profils visuels bornés avec ses réglages d'accessibilité, et Only Fun **`0.0.0-alpha.21`** exclut explicitement Canaplia et les raccourcis de progression du Shop.
|
||||
|
||||
L’alpha.222 améliore le terminal de stockage avec une recherche Unicode, des quantités compactes et des emplacements qui ne glissent plus lorsqu'une pile est vidée. Elle ajoute aussi le suivi textuel des quêtes actives en haut à gauche, masquable avec une touche configurable, ainsi que des suggestions d’IDs d’items et de mobs dans l’éditeur de demandes. JEI passe à la bêta Fabric 26.2 `30.29.0.196`.
|
||||
|
||||
L’alpha.221 corrige la cause réelle du disque blanc ralenti et trop grave : Ambiance décode désormais la source AAC en stéréo native à 48 kHz, puis moyenne explicitement chaque paire gauche/droite vers le flux mono positionnel de Minecraft. OpenAL reste à sa hauteur normale `1.0`, sans compensation artificielle ni changement de durée.
|
||||
|
||||
L’alpha.220 transforme le terminal de stockage en véritable menu de conteneur, sans bouton de fermeture propriétaire. Les clics gauche/droit et shift-clic permettent maintenant de retirer ou déposer des piles depuis toutes les rangées d’inventaire débloquées par Sanctuary, jusqu’à six ; la grille agrégée reste non réorganisable et remplit chaque coffre ou baril dans l’ordre de découverte avant de passer au suivant.
|
||||
|
||||
+287
-190
File diff suppressed because it is too large
Load Diff
+2
-2
@@ -28,7 +28,7 @@ iliketomoveit_version=0.0.0-alpha.16
|
||||
iliketomoveit_lifecycle=active
|
||||
onlyfun_version=0.0.0-alpha.25
|
||||
onlyfun_lifecycle=active
|
||||
sanctuary_version=0.0.0-alpha.123
|
||||
sanctuary_version=0.0.0-alpha.124
|
||||
sanctuary_lifecycle=active
|
||||
pack_version=26.2.0-alpha.221
|
||||
pack_version=26.2.0-alpha.222
|
||||
maven_group=fr.koka99cab.sanctuary26
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
{
|
||||
"schema_version": 1,
|
||||
"source": {
|
||||
"pack_version": "26.2.0-alpha.221",
|
||||
"modules": {
|
||||
"redstoner": "0.0.0-alpha.12",
|
||||
"sanctuary": "0.0.0-alpha.122"
|
||||
}
|
||||
},
|
||||
"target": {
|
||||
"pack_version": "26.2.0-alpha.222",
|
||||
"modules": {
|
||||
"redstoner": "0.0.0-alpha.13",
|
||||
"sanctuary": "0.0.0-alpha.124"
|
||||
}
|
||||
},
|
||||
"storage_terminal_search": {
|
||||
"owner": "redstoner",
|
||||
"maximum_search_length": 32,
|
||||
"searches_display_name_item_id_and_translation": true,
|
||||
"accent_and_unicode_folding": true,
|
||||
"compact_quantity_labels": true,
|
||||
"exact_quantity_tooltip": true,
|
||||
"empty_slots_remain_stable_until_new_search_or_reopen": true,
|
||||
"server_authoritative_transfers": true
|
||||
},
|
||||
"quest_tracker": {
|
||||
"owner": "sanctuary",
|
||||
"default_key": "J",
|
||||
"maximum_entries": 8,
|
||||
"accepted_quests_only": true,
|
||||
"reserved_contracts_included": true,
|
||||
"own_published_requests_excluded": true,
|
||||
"transparent_text_only_hud": true,
|
||||
"item_and_mob_id_suggestions": true,
|
||||
"server_authoritative_snapshot": true
|
||||
},
|
||||
"compatibility": {
|
||||
"new_world_required": false,
|
||||
"save_reset_required": false,
|
||||
"existing_saves_supported": true,
|
||||
"registry_ids_changed": false,
|
||||
"redstoner_data_version": 3,
|
||||
"redstoner_network_protocol": 7,
|
||||
"sanctuary_data_version": 11,
|
||||
"sanctuary_network_protocol": 22
|
||||
},
|
||||
"distribution": {
|
||||
"pack_release_updated": true,
|
||||
"packwiz_index_refreshed": true,
|
||||
"prism_modrinth_index_updated": true,
|
||||
"shared_client_server_mrpack": true,
|
||||
"jei": {
|
||||
"source": "30.28.0.193",
|
||||
"target": "30.29.0.196",
|
||||
"modrinth_version_id": "vvwsu2BR",
|
||||
"packwiz_and_prism_synchronized": true
|
||||
}
|
||||
}
|
||||
}
|
||||
+13
-13
@@ -14,15 +14,15 @@ hash = "41f4f4c88c71d0a23446d5014f7407d55ad477441847099cad24492b032335a0"
|
||||
|
||||
[[files]]
|
||||
file = "mods/ambiance-0.0.0-alpha.22.jar"
|
||||
hash = "4d5c31315c436c716a48e7d563fd179be2f39951c24bf4641f83a05a24323a3e"
|
||||
hash = "a6b7d98971f411b202f5679aae05c1bc93754ee9a42d10dc903413b17ba97a63"
|
||||
|
||||
[[files]]
|
||||
file = "mods/anotherworld-0.0.0-alpha.55.jar"
|
||||
hash = "7fbe2ac0d2ece62285aa8277ff92284760f2ccfd6d08159015661978bd0cde9a"
|
||||
hash = "cac322006ad9a724bb656b400cf47d84a18e76cd1a35f4bd13c112f443d89275"
|
||||
|
||||
[[files]]
|
||||
file = "mods/events-0.0.0-alpha.0.jar"
|
||||
hash = "cbf8d47fb82ca06c438b75fd72f805acc9813dffc6168d6786d54644ef8bb387"
|
||||
hash = "8d2566ceb838a486fe9d8539acd127446e51d7085dcbefa86ee3c1aea4630a6d"
|
||||
|
||||
[[files]]
|
||||
file = "mods/fabric-api.pw.toml"
|
||||
@@ -31,7 +31,7 @@ metafile = true
|
||||
|
||||
[[files]]
|
||||
file = "mods/iliketomoveit-0.0.0-alpha.16.jar"
|
||||
hash = "26156014813bfa4384194ac0f20395b6df590a5bc29cd91a32114ced988bbaf3"
|
||||
hash = "94e5afefab9485c40a47342dc84f401fa126be40064832929601e781b3a03738"
|
||||
|
||||
[[files]]
|
||||
file = "mods/iris.pw.toml"
|
||||
@@ -40,32 +40,32 @@ metafile = true
|
||||
|
||||
[[files]]
|
||||
file = "mods/itsalive-0.0.0-alpha.36.jar"
|
||||
hash = "5673ab7d605f2f1d18d807f0939f90ecedc13c892d03991fd60f7d02d74f9404"
|
||||
hash = "94899dba383aff41c39f7f25ee1a6b7998aa1e9889e7b9e9039a984e0bc0882f"
|
||||
|
||||
[[files]]
|
||||
file = "mods/jei.pw.toml"
|
||||
hash = "a213ae237f9b3934bdcd0d282119d4166d0ccbb7c7223daa8d7ed956c69a0e3f"
|
||||
hash = "115d2239bc86ecdad88705dbc215d27ddb6a08d94f74fa538abb6a67a00bf71e"
|
||||
metafile = true
|
||||
|
||||
[[files]]
|
||||
file = "mods/masterkey-0.0.0-alpha.8.jar"
|
||||
hash = "202b159fd04b7447cda7fa9f7360693106927904819e834956ab46f6e07f658e"
|
||||
hash = "102c3da5d201452be23ab84338e023c284f4770270ca945b0c63b6a996fb2922"
|
||||
|
||||
[[files]]
|
||||
file = "mods/onlyfun-0.0.0-alpha.25.jar"
|
||||
hash = "6551d75cb3cb7be220b2aa6033d4eb533fa28a39ee88d66bbb0c40244c08c259"
|
||||
hash = "2676072de7dbc9b27c4fd0e50e797832356fbc903e80c5bd9a5bd55c1a5aff1b"
|
||||
|
||||
[[files]]
|
||||
file = "mods/ouch-0.0.0-alpha.10.jar"
|
||||
hash = "0c2e0e2ef7f6c944d0b6d5609c42431a0a31f1d92087c3b5c28b67f76795d8cf"
|
||||
hash = "59815a0415c48c92acfc7c18bd2399780bab9b0b5eee69c2b35a66cb1474109b"
|
||||
|
||||
[[files]]
|
||||
file = "mods/redstoner-0.0.0-alpha.12.jar"
|
||||
hash = "fee65e8d865f918ec8174b7a808762658ed91b566af590d99a3448f9d237175a"
|
||||
file = "mods/redstoner-0.0.0-alpha.13.jar"
|
||||
hash = "0bd3888b13c894aed806696a5e73e076c7ed985eff2c242f0df9ec64ff3fcb37"
|
||||
|
||||
[[files]]
|
||||
file = "mods/sanctuary-0.0.0-alpha.122.jar"
|
||||
hash = "9183652d13fd3c15663ca645f96f2a70026cb4d3a82f62e92fc3c72aea72d589"
|
||||
file = "mods/sanctuary-0.0.0-alpha.124.jar"
|
||||
hash = "39a3db3d1d9876ac5c7a7135a3b524c82508d0ee2e0c5c410c6515ff8931c6fb"
|
||||
|
||||
[[files]]
|
||||
file = "mods/simple-voice-chat.pw.toml"
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
name = "Just Enough Items (JEI)"
|
||||
filename = "jei-26.2-fabric-30.28.0.193.jar"
|
||||
filename = "jei-26.2-fabric-30.29.0.196.jar"
|
||||
side = "both"
|
||||
pin = true
|
||||
|
||||
[download]
|
||||
url = "https://cdn.modrinth.com/data/u6dRKJwZ/versions/qaCQ7LGO/jei-26.2-fabric-30.28.0.193.jar"
|
||||
url = "https://cdn.modrinth.com/data/u6dRKJwZ/versions/vvwsu2BR/jei-26.2-fabric-30.29.0.196.jar"
|
||||
hash-format = "sha512"
|
||||
hash = "0869f4d5840a732a04bedc7684b40140f087f3d759066c206d9d1ec710007f7c9585e4f5ebb04f10e56bef1cf2eddc6978bb2b2c93541cff5fcf7e1609859468"
|
||||
hash = "c62a3e264d4b0ec398b9aa717a4832eecb8663bbcec4483dc58a9999d5e4e55ca4f5bca285a0d4a003220c698c3e87c8a3294366e085e72545e4afe84aec92c7"
|
||||
|
||||
[update]
|
||||
[update.modrinth]
|
||||
mod-id = "u6dRKJwZ"
|
||||
version = "qaCQ7LGO"
|
||||
version = "vvwsu2BR"
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
name = "Sanctuary 26.2"
|
||||
author = "KOKA99CAB"
|
||||
version = "26.2.0-alpha.221"
|
||||
version = "26.2.0-alpha.222"
|
||||
pack-format = "packwiz:1.1.0"
|
||||
|
||||
[index]
|
||||
file = "index.toml"
|
||||
hash-format = "sha256"
|
||||
hash = "60e8342eef216dd225488fe4225a28c9b9940858642cbfc8025541affd150ab0"
|
||||
hash = "53b5bec1b113ab2b353e6a142e3dbc4617ea7d27003bcbb09b668938dd262ddd"
|
||||
|
||||
[versions]
|
||||
fabric = "0.19.3"
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
"game": "minecraft",
|
||||
"name": "Sanctuary 26.2",
|
||||
"summary": "Sanctuary 26.2 — progression, exploration, worldgen and multiplayer systems by KOKA99CAB.",
|
||||
"versionId": "26.2.0-alpha.221",
|
||||
"versionId": "26.2.0-alpha.222",
|
||||
"files": [
|
||||
{
|
||||
"path": "mods/fabric-api-0.158.0+26.2.jar",
|
||||
@@ -21,19 +21,19 @@
|
||||
"fileSize": 2535765
|
||||
},
|
||||
{
|
||||
"path": "mods/jei-26.2-fabric-30.28.0.193.jar",
|
||||
"path": "mods/jei-26.2-fabric-30.29.0.196.jar",
|
||||
"hashes": {
|
||||
"sha1": "494f9dc787d6c9cd9d32793da2784ab16834faf3",
|
||||
"sha512": "0869f4d5840a732a04bedc7684b40140f087f3d759066c206d9d1ec710007f7c9585e4f5ebb04f10e56bef1cf2eddc6978bb2b2c93541cff5fcf7e1609859468"
|
||||
"sha1": "c2f2c6b5822a560fe9872921b908ffc2f3297d00",
|
||||
"sha512": "c62a3e264d4b0ec398b9aa717a4832eecb8663bbcec4483dc58a9999d5e4e55ca4f5bca285a0d4a003220c698c3e87c8a3294366e085e72545e4afe84aec92c7"
|
||||
},
|
||||
"env": {
|
||||
"client": "required",
|
||||
"server": "required"
|
||||
},
|
||||
"downloads": [
|
||||
"https://cdn.modrinth.com/data/u6dRKJwZ/versions/qaCQ7LGO/jei-26.2-fabric-30.28.0.193.jar"
|
||||
"https://cdn.modrinth.com/data/u6dRKJwZ/versions/vvwsu2BR/jei-26.2-fabric-30.29.0.196.jar"
|
||||
],
|
||||
"fileSize": 1822836
|
||||
"fileSize": 1838353
|
||||
},
|
||||
{
|
||||
"path": "mods/voicechat-fabric-2.6.22+26.2.jar",
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"schema_version": 1,
|
||||
"pack_version": "26.2.0-alpha.221",
|
||||
"pack_version": "26.2.0-alpha.222",
|
||||
"release_channel": "alpha",
|
||||
"minecraft_version": "26.2",
|
||||
"fabric_loader_version": "0.19.3",
|
||||
@@ -9,7 +9,7 @@
|
||||
"project_id": "FgOqyAXd",
|
||||
"project_slug": "sanctuary-koka99",
|
||||
"project_url": "https://modrinth.com/modpack/sanctuary-koka99",
|
||||
"primary_file": "sanctuary-26.2.0-alpha.221.mrpack",
|
||||
"primary_file": "sanctuary-26.2.0-alpha.222.mrpack",
|
||||
"shared_client_server_pack": true,
|
||||
"update_owner": "packwiz-installer",
|
||||
"check_on_launch": true,
|
||||
|
||||
+30
-11
@@ -108,6 +108,14 @@ tasks.register("capeJoinSyncSmoke", JavaExec) {
|
||||
mainClass = "fr.koka99cab.sanctuary26.sanctuary.gameplay.CapeJoinSyncQueueSmoke"
|
||||
}
|
||||
|
||||
tasks.register("inventorySortSmoke", JavaExec) {
|
||||
group = "verification"
|
||||
description = "Checks that storage stacks merge and sort while the hotbar row stays out of the sort."
|
||||
dependsOn tasks.named("testClasses")
|
||||
classpath = sourceSets.test.runtimeClasspath
|
||||
mainClass = "fr.koka99cab.sanctuary26.sanctuary.gameplay.SanctuaryInventorySortSmoke"
|
||||
}
|
||||
|
||||
tasks.register("alphaIndevGeneratorSmoke", JavaExec) {
|
||||
group = "verification"
|
||||
description = "Checks deterministic finite Indev islands, residences and safe portal arrivals."
|
||||
@@ -151,7 +159,7 @@ tasks.register("verifyBlackMarket") {
|
||||
def questData = file("src/main/java/fr/koka99cab/sanctuary26/sanctuary/shop/QuestBoardData.java").text
|
||||
def quests = file("src/main/java/fr/koka99cab/sanctuary26/sanctuary/shop/QuestBoardService.java").text
|
||||
def inventoryView = file("src/main/java/fr/koka99cab/sanctuary26/sanctuary/api/inventory/SanctuaryPlayerInventoryView.java").text
|
||||
if (project.version.toString() != "0.0.0-alpha.123"
|
||||
if (project.version.toString() != "0.0.0-alpha.124"
|
||||
|| !data.contains('SAVE_KEY = "black_market"') || !data.contains("DATA_VERSION = 2")
|
||||
|| !data.contains("ItemStack.CODEC.fieldOf(\"item\")") || !data.contains("replaceListing")
|
||||
|| !service.contains("LISTING_FEE_RUBIES = 1") || !service.contains("COMMISSION_PERCENT = 5")
|
||||
@@ -298,6 +306,7 @@ tasks.register("verifySanctuary") {
|
||||
tasks.named("questIdSuggestionsSmoke"),
|
||||
tasks.named("shopHeaderLayoutSmoke"), tasks.named("zombieNamesSmoke"),
|
||||
tasks.named("capeJoinSyncSmoke"),
|
||||
tasks.named("inventorySortSmoke"),
|
||||
tasks.named("verifyBlackMarket")
|
||||
|
||||
doLast {
|
||||
@@ -614,6 +623,14 @@ tasks.register("verifySanctuary") {
|
||||
,'class SanctuaryHotbarRowsClient'
|
||||
,'id("c2s/hotbar_row_switch")'
|
||||
,'id("s2c/hotbar_row_sync")'
|
||||
,'class SanctuaryInventorySort'
|
||||
,'class SanctuaryInventorySorter'
|
||||
,'id("c2s/sort_inventory")'
|
||||
,'key.sanctuary.sort_inventory'
|
||||
,'GLFW.GLFW_MOUSE_BUTTON_MIDDLE'
|
||||
,'matchesMouse'
|
||||
,'int bankIndex(int visualRow, int visibleRows)'
|
||||
,'playButtonClickSound'
|
||||
,'GLFW.GLFW_KEY_TAB'
|
||||
,'HOTBAR_TEXTURE'
|
||||
,'0.0F, 0.0F, 182, 22, 182, 22'
|
||||
@@ -2850,7 +2867,7 @@ tasks.register("verifyShopCurrencyRowsRelease") {
|
||||
"src/main/java/fr/koka99cab/sanctuary26/sanctuary/shop/BlackMarketService.java").text
|
||||
def shop = file(
|
||||
"src/main/java/fr/koka99cab/sanctuary26/sanctuary/shop/ShopService.java").text
|
||||
if (project.version.toString() != "0.0.0-alpha.123"
|
||||
if (project.version.toString() != "0.0.0-alpha.124"
|
||||
|| migration.target?.modules?.sanctuary != "0.0.0-alpha.117"
|
||||
|| migration.shop_currency_inventory?.all_unlocked_rows_counted != true
|
||||
|| migration.shop_currency_inventory?.overflow_rows_counted != true
|
||||
@@ -3016,7 +3033,7 @@ tasks.register("verifyProgressivePauseMenu") {
|
||||
"pack/migrations/26.2.0-alpha.190-progressive-pause-menu-to-alpha.191.json"))
|
||||
def pauseMenu = file("src/main/java/fr/koka99cab/sanctuary26/sanctuary/mixin/client/PauseScreenMixin.java").text
|
||||
def costs = file("src/main/java/fr/koka99cab/sanctuary26/sanctuary/progression/SanctuaryProgressionCosts.java").text
|
||||
if (project.version.toString() != "0.0.0-alpha.123"
|
||||
if (project.version.toString() != "0.0.0-alpha.124"
|
||||
|| migration.target?.pack_version != "26.2.0-alpha.191"
|
||||
|| migration.target?.modules?.sanctuary != "0.0.0-alpha.109"
|
||||
|| migration.pause_menu?.progression_full_width != true
|
||||
@@ -3054,7 +3071,7 @@ tasks.register("verifyShopPricingLayout") {
|
||||
"pack/migrations/26.2.0-alpha.192-shop-pricing-layout-to-alpha.193.json"))
|
||||
def screen = file("src/main/java/fr/koka99cab/sanctuary26/sanctuary/client/SanctuaryShopScreen.java").text
|
||||
def progression = file("src/main/java/fr/koka99cab/sanctuary26/sanctuary/shop/ShopProgression.java").text
|
||||
if (project.version.toString() != "0.0.0-alpha.123"
|
||||
if (project.version.toString() != "0.0.0-alpha.124"
|
||||
|| migration.target?.modules?.sanctuary != "0.0.0-alpha.110"
|
||||
|| migration.shop_layout?.locked_offer_buttons != 6
|
||||
|| migration.shop_layout?.button_slots != [4, 5, 6, 7, 8, 9]
|
||||
@@ -3085,7 +3102,7 @@ tasks.register("verifyShopCsvBossGates") {
|
||||
"pack/migrations/26.2.0-alpha.194-shop-csv-boss-gates-to-alpha.195.json"))
|
||||
def provider = file("src/main/java/fr/koka99cab/sanctuary26/sanctuary/shop/ShopCatalogProvider.java").text
|
||||
def catalog = file("src/main/java/fr/koka99cab/sanctuary26/sanctuary/shop/ShopOfferCatalog.java").text
|
||||
if (project.version.toString() != "0.0.0-alpha.123"
|
||||
if (project.version.toString() != "0.0.0-alpha.124"
|
||||
|| migration.target?.pack_version != "26.2.0-alpha.195"
|
||||
|| migration.target?.modules?.sanctuary != "0.0.0-alpha.111"
|
||||
|| migration.compatibility?.sanctuary_data_version != 11
|
||||
@@ -3116,7 +3133,7 @@ tasks.register("verifyDeliveryBoxOrientation") {
|
||||
def blockstate = new JsonSlurper().parse(
|
||||
file("src/main/resources/assets/sanctuary/blockstates/delivery_box.json"))
|
||||
def expectedVariants = ["facing=north", "facing=east", "facing=south", "facing=west"].toSet()
|
||||
if (project.version.toString() != "0.0.0-alpha.123"
|
||||
if (project.version.toString() != "0.0.0-alpha.124"
|
||||
|| migration.target?.modules?.sanctuary != "0.0.0-alpha.112"
|
||||
|| migration.mailbox?.id != "sanctuary:delivery_box"
|
||||
|| migration.mailbox?.horizontal_facing != true
|
||||
@@ -3144,7 +3161,7 @@ tasks.register("verifyInventoryShiftClick") {
|
||||
def mixin = file("src/main/java/fr/koka99cab/sanctuary26/sanctuary/mixin/AbstractContainerMenuMixin.java").text
|
||||
def screen = file("src/main/java/fr/koka99cab/sanctuary26/sanctuary/mixin/client/AbstractContainerScreenMixin.java").text
|
||||
def gui = file("INVENTORY_GUI.md").text
|
||||
if (project.version.toString() != "0.0.0-alpha.123"
|
||||
if (project.version.toString() != "0.0.0-alpha.124"
|
||||
|| !transfer.contains("shouldAppendOverflow")
|
||||
|| !transfer.contains("isVanillaStorageRange")
|
||||
|| !transfer.contains("hotbarStart")
|
||||
@@ -3190,7 +3207,7 @@ tasks.register("verifyQuestRequests") {
|
||||
new JsonSlurper().parse(file("src/main/resources/data/sanctuary/loot_table/blocks/${path}.json"))
|
||||
.pools[0].entries[0].name
|
||||
}
|
||||
if (project.version.toString() != "0.0.0-alpha.123"
|
||||
if (project.version.toString() != "0.0.0-alpha.124"
|
||||
|| migration.target?.modules?.sanctuary != "0.0.0-alpha.113"
|
||||
|| migration.quest_requests?.save_key != "quest_requests"
|
||||
|| migration.quest_requests?.data_version != 1
|
||||
@@ -3248,7 +3265,7 @@ tasks.register("verifyQuestRequestContracts") {
|
||||
def locales = ["fr_fr", "en_us", "ru_ru"].collectEntries { locale ->
|
||||
[(locale): new JsonSlurper().parse(file("src/main/resources/assets/sanctuary/lang/${locale}.json"))]
|
||||
}
|
||||
if (project.version.toString() != "0.0.0-alpha.123"
|
||||
if (project.version.toString() != "0.0.0-alpha.124"
|
||||
|| migration.source?.pack_version != "26.2.0-alpha.198"
|
||||
|| migration.source?.modules?.sanctuary != "0.0.0-alpha.114"
|
||||
|| migration.target?.pack_version != "26.2.0-alpha.199"
|
||||
@@ -3317,7 +3334,7 @@ tasks.register("verifyQuestRequestEscrow") {
|
||||
def locales = ["fr_fr", "en_us", "ru_ru"].collectEntries { locale ->
|
||||
[(locale): new JsonSlurper().parse(file("src/main/resources/assets/sanctuary/lang/${locale}.json"))]
|
||||
}
|
||||
if (project.version.toString() != "0.0.0-alpha.123"
|
||||
if (project.version.toString() != "0.0.0-alpha.124"
|
||||
|| migration.source?.pack_version != "26.2.0-alpha.200"
|
||||
|| migration.source?.modules?.sanctuary != "0.0.0-alpha.115"
|
||||
|| migration.target?.pack_version != "26.2.0-alpha.201"
|
||||
@@ -3389,7 +3406,7 @@ tasks.register("verifyAlphaIndev") {
|
||||
def locales = ["fr_fr", "en_us", "ru_ru"].collect {
|
||||
new JsonSlurper().parse(file("src/main/resources/assets/sanctuary/lang/${it}.json"))
|
||||
}
|
||||
if (project.version.toString() != "0.0.0-alpha.123"
|
||||
if (project.version.toString() != "0.0.0-alpha.124"
|
||||
|| migration.target?.modules?.sanctuary != "0.0.0-alpha.122"
|
||||
|| migration.alpha_world?.dimension != "sanctuary:alpha"
|
||||
|| migration.alpha_world?.legacy_dimension != "portals:alpha"
|
||||
@@ -3423,5 +3440,7 @@ tasks.named("check") {
|
||||
dependsOn tasks.named("questTrackerModelSmoke")
|
||||
dependsOn tasks.named("questIdSuggestionsSmoke")
|
||||
dependsOn tasks.named("alphaIndevGeneratorSmoke")
|
||||
dependsOn tasks.named("capeJoinSyncSmoke")
|
||||
dependsOn tasks.named("inventorySortSmoke")
|
||||
dependsOn tasks.named("verifyAlphaIndev")
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import fr.koka99cab.sanctuary26.sanctuary.gameplay.SanctuaryBulkActions;
|
||||
import fr.koka99cab.sanctuary26.sanctuary.gameplay.SanctuaryInventoryCapacity;
|
||||
import fr.koka99cab.sanctuary26.sanctuary.gameplay.SanctuaryCompanions;
|
||||
import fr.koka99cab.sanctuary26.sanctuary.gameplay.SanctuaryHotbarRows;
|
||||
import fr.koka99cab.sanctuary26.sanctuary.gameplay.SanctuaryInventorySort;
|
||||
import fr.koka99cab.sanctuary26.sanctuary.gameplay.SanctuaryCompanionPowers;
|
||||
import fr.koka99cab.sanctuary26.sanctuary.gameplay.SanctuaryCapeService;
|
||||
import fr.koka99cab.sanctuary26.sanctuary.gameplay.SanctuarySitting;
|
||||
@@ -55,6 +56,7 @@ public final class SanctuaryMod implements ModInitializer {
|
||||
SanctuaryBulkActions.initialize();
|
||||
SanctuaryInventoryCapacity.initialize();
|
||||
SanctuaryHotbarRows.initialize();
|
||||
SanctuaryInventorySort.initialize();
|
||||
SanctuaryCompanions.initialize();
|
||||
SanctuaryCompanionPowers.initialize();
|
||||
SanctuaryCapeService.initialize();
|
||||
|
||||
+11
-35
@@ -14,19 +14,12 @@ import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.resources.Identifier;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
|
||||
/** Compact toggleable overlay for accepted quests. */
|
||||
/** Transparent, toggleable text overlay for accepted quests. */
|
||||
final class QuestTrackerHud {
|
||||
private static final int PANEL_WIDTH = 168;
|
||||
private static final int MARGIN = 6;
|
||||
private static final int HEADER_HEIGHT = 14;
|
||||
private static final int ENTRY_HEIGHT = 22;
|
||||
private static final int EMPTY_HEIGHT = 22;
|
||||
private static final int BACKGROUND = 0xD0181417;
|
||||
private static final int OUTLINE = 0xFFE8A8C3;
|
||||
private static final int TITLE = 0xFFF2C4D7;
|
||||
private static final int MAX_WIDTH = 240;
|
||||
private static final int MARGIN = 2;
|
||||
private static final int ENTRY_SPACING = 2;
|
||||
private static final int BODY = 0xFFE9DDE2;
|
||||
private static final int MUTED = 0xFF9F8B95;
|
||||
private static final int BAR_BACK = 0xFF3A2A30;
|
||||
|
||||
private QuestTrackerHud() {}
|
||||
|
||||
@@ -39,39 +32,22 @@ final class QuestTrackerHud {
|
||||
if (client.player == null || client.level == null || client.gui.screen() != null) return;
|
||||
if (!SanctuaryClientQuests.visible()) return;
|
||||
List<QuestTrackerSnapshotPayload.Entry> entries = SanctuaryClientQuests.entries();
|
||||
int height = HEADER_HEIGHT + 6 + (entries.isEmpty() ? EMPTY_HEIGHT : entries.size() * ENTRY_HEIGHT);
|
||||
int left = MARGIN;
|
||||
int top = MARGIN;
|
||||
int right = left + PANEL_WIDTH;
|
||||
int bottom = top + height;
|
||||
graphics.fill(left, top, right, bottom, BACKGROUND);
|
||||
graphics.outline(left, top, PANEL_WIDTH, height, OUTLINE);
|
||||
graphics.text(client.font, Component.translatable("hud.sanctuary.quest_tracker.title"),
|
||||
left + 6, top + 4, TITLE);
|
||||
if (entries.isEmpty()) {
|
||||
graphics.text(client.font, Component.translatable("hud.sanctuary.quest_tracker.empty"),
|
||||
left + 6, top + HEADER_HEIGHT + 4, MUTED);
|
||||
return;
|
||||
}
|
||||
int y = top + HEADER_HEIGHT + 2;
|
||||
if (entries.isEmpty()) return;
|
||||
int width = Math.max(1, Math.min(MAX_WIDTH, graphics.guiWidth() - MARGIN * 2));
|
||||
int y = MARGIN;
|
||||
for (QuestTrackerSnapshotPayload.Entry entry : entries) {
|
||||
drawEntry(graphics, client.font, entry, left + 6, y, PANEL_WIDTH - 12);
|
||||
y += ENTRY_HEIGHT;
|
||||
drawEntry(graphics, client.font, entry, MARGIN, y, width);
|
||||
y += client.font.lineHeight * 2 + ENTRY_SPACING;
|
||||
}
|
||||
}
|
||||
|
||||
private static void drawEntry(GuiGraphicsExtractor graphics, Font font,
|
||||
QuestTrackerSnapshotPayload.Entry entry, int x, int y, int width) {
|
||||
int accent = 0xFF000000 | (entry.accent() & 0xFFFFFF);
|
||||
graphics.text(font, ellipsize(font, title(entry), width), x, y, accent);
|
||||
graphics.text(font, ellipsize(font, title(entry), width), x, y, accent, true);
|
||||
Component progress = Component.translatable("hud.sanctuary.quest_tracker.progress",
|
||||
action(entry), describeTarget(entry), entry.progress(), entry.required());
|
||||
graphics.text(font, ellipsize(font, progress, width), x, y + 9, BODY);
|
||||
int barTop = y + 18;
|
||||
int barRight = x + width;
|
||||
graphics.fill(x, barTop, barRight, barTop + 2, BAR_BACK);
|
||||
int filled = Math.round(width * Math.min(1.0F, entry.progress() / (float) entry.required()));
|
||||
if (filled > 0) graphics.fill(x, barTop, x + filled, barTop + 2, accent);
|
||||
graphics.text(font, ellipsize(font, progress, width), x, y + font.lineHeight, BODY, true);
|
||||
}
|
||||
|
||||
private static Component title(QuestTrackerSnapshotPayload.Entry entry) {
|
||||
|
||||
+16
@@ -28,6 +28,7 @@ import net.minecraft.client.KeyMapping;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.Screenshot;
|
||||
import net.minecraft.client.input.KeyEvent;
|
||||
import net.minecraft.client.input.MouseButtonEvent;
|
||||
import net.minecraft.client.gui.screens.inventory.ContainerScreen;
|
||||
import net.minecraft.client.gui.screens.inventory.CraftingScreen;
|
||||
import net.minecraft.client.gui.screens.inventory.InventoryScreen;
|
||||
@@ -49,6 +50,7 @@ public final class SanctuaryClient implements ClientModInitializer {
|
||||
private static KeyMapping zoomKey;
|
||||
private static KeyMapping celestialKey;
|
||||
private static KeyMapping switchHotbarRowKey;
|
||||
private static KeyMapping sortInventoryKey;
|
||||
private static KeyMapping questTrackerKey;
|
||||
private static boolean zoomWasHeld;
|
||||
private static boolean smokeScreenOpened;
|
||||
@@ -93,6 +95,12 @@ public final class SanctuaryClient implements ClientModInitializer {
|
||||
GLFW.GLFW_KEY_TAB,
|
||||
SANCTUARY_CATEGORY
|
||||
));
|
||||
sortInventoryKey = KeyMappingHelper.registerKeyMapping(new KeyMapping(
|
||||
"key.sanctuary.sort_inventory",
|
||||
InputConstants.Type.MOUSE,
|
||||
GLFW.GLFW_MOUSE_BUTTON_MIDDLE,
|
||||
SANCTUARY_CATEGORY
|
||||
));
|
||||
questTrackerKey = KeyMappingHelper.registerKeyMapping(new KeyMapping(
|
||||
"key.sanctuary.quest_tracker",
|
||||
InputConstants.Type.KEYSYM,
|
||||
@@ -222,6 +230,14 @@ public final class SanctuaryClient implements ClientModInitializer {
|
||||
return switchHotbarRowKey != null && switchHotbarRowKey.matches(event);
|
||||
}
|
||||
|
||||
public static boolean isSortInventoryKey(KeyEvent event) {
|
||||
return sortInventoryKey != null && sortInventoryKey.matches(event);
|
||||
}
|
||||
|
||||
public static boolean isSortInventoryMouse(MouseButtonEvent event) {
|
||||
return sortInventoryKey != null && sortInventoryKey.matchesMouse(event);
|
||||
}
|
||||
|
||||
public static boolean handleBlackMarketMiddleClick(Minecraft client) {
|
||||
if (client.player == null || client.level == null || client.gui.screen() != null
|
||||
|| !(client.hitResult instanceof BlockHitResult hit)
|
||||
|
||||
+4
@@ -24,6 +24,10 @@ public final class SanctuaryHotbarRowsClient {
|
||||
return VISUAL_ROW_BY_LOGICAL[logicalRow];
|
||||
}
|
||||
|
||||
public static int bankIndex(int logicalRow, int visibleRows) {
|
||||
return SanctuaryInventoryCapacity.bankIndex(visualRow(logicalRow), visibleRows);
|
||||
}
|
||||
|
||||
public static int activeVisualRow() {
|
||||
return VISUAL_ROW_BY_LOGICAL[0];
|
||||
}
|
||||
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
package fr.koka99cab.sanctuary26.sanctuary.client;
|
||||
|
||||
import fr.koka99cab.sanctuary26.sanctuary.network.SortInventoryPayload;
|
||||
import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.components.AbstractWidget;
|
||||
import net.minecraft.client.gui.components.EditBox;
|
||||
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen;
|
||||
import net.minecraft.client.gui.screens.inventory.CreativeModeInventoryScreen;
|
||||
|
||||
/** Sends a sort request while a survival container is open. */
|
||||
public final class SanctuaryInventorySortClient {
|
||||
private SanctuaryInventorySortClient() {
|
||||
}
|
||||
|
||||
public static boolean requestFromKeyboard(Minecraft client) {
|
||||
if (client.gui.screen() != null && client.gui.screen().getFocused() instanceof EditBox) {
|
||||
return false;
|
||||
}
|
||||
return request(client);
|
||||
}
|
||||
|
||||
public static boolean request(Minecraft client) {
|
||||
if (client.player == null || client.level == null
|
||||
|| !(client.gui.screen() instanceof AbstractContainerScreen<?>)
|
||||
|| client.gui.screen() instanceof CreativeModeInventoryScreen
|
||||
|| !ClientPlayNetworking.canSend(SortInventoryPayload.ID)) {
|
||||
return false;
|
||||
}
|
||||
AbstractWidget.playButtonClickSound(client.getSoundManager());
|
||||
ClientPlayNetworking.send(new SortInventoryPayload());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
+6
@@ -88,6 +88,12 @@ public final class SanctuaryHotbarRows {
|
||||
return layout;
|
||||
}
|
||||
|
||||
/** Visual row of each physical row. Index 0 is the live hotbar. */
|
||||
public static int[] visualLayout(ServerPlayer player) {
|
||||
int[] layout = SESSION_LAYOUTS.get(player.getUUID());
|
||||
return layout == null ? identityLayout() : layout.clone();
|
||||
}
|
||||
|
||||
private static int indexOf(int[] layout, int visualRow) {
|
||||
for (int index = 0; index < layout.length; index++) {
|
||||
if (layout[index] == visualRow) return index;
|
||||
|
||||
+21
@@ -20,6 +20,27 @@ public final class SanctuaryInventoryCapacity {
|
||||
private SanctuaryInventoryCapacity() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Turns a visual row (0 = live hotbar) into a top-to-bottom bank index.
|
||||
* Storage occupies the first lines; the hotbar sits on the last one, like vanilla.
|
||||
*/
|
||||
public static int bankIndex(int visualRow, int visibleRows) {
|
||||
visibleRows = Math.clamp(visibleRows, 1, MAX_ROW_COUNT);
|
||||
visualRow = Math.clamp(visualRow, 0, visibleRows - 1);
|
||||
return visibleRows - 1 - visualRow;
|
||||
}
|
||||
|
||||
public static int physicalRowAtBankIndex(int bankIndex, int[] visualByPhysical, int unlockedRows) {
|
||||
unlockedRows = Math.clamp(unlockedRows, 1, MAX_ROW_COUNT);
|
||||
bankIndex = Math.clamp(bankIndex, 0, unlockedRows - 1);
|
||||
for (int physical = 0; physical < unlockedRows; physical++) {
|
||||
int visual = visualByPhysical == null || physical >= visualByPhysical.length
|
||||
? physical : visualByPhysical[physical];
|
||||
if (bankIndex(visual, unlockedRows) == bankIndex) return physical;
|
||||
}
|
||||
return bankIndex;
|
||||
}
|
||||
|
||||
public static void initialize() {
|
||||
if (initialized) return;
|
||||
initialized = true;
|
||||
|
||||
+144
@@ -0,0 +1,144 @@
|
||||
package fr.koka99cab.sanctuary26.sanctuary.gameplay;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import net.fabricmc.fabric.api.entity.event.v1.ServerPlayerEvents;
|
||||
import net.minecraft.core.registries.BuiltInRegistries;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.Container;
|
||||
import net.minecraft.world.entity.player.Inventory;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
|
||||
/**
|
||||
* Server-authoritative sort of every unlocked inventory row except the live hotbar.
|
||||
* Armor, off-hand, crafting, cape and companion slots stay untouched.
|
||||
*/
|
||||
public final class SanctuaryInventorySort {
|
||||
private static final int COOLDOWN_TICKS = 8;
|
||||
private static final Map<UUID, Long> LAST_SORT_TICK = new HashMap<>();
|
||||
private static final SanctuaryInventorySorter.StackAccess<ItemStack> STACKS =
|
||||
new SanctuaryInventorySorter.StackAccess<>() {
|
||||
@Override
|
||||
public boolean isEmpty(ItemStack stack) {
|
||||
return stack == null || stack.isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int count(ItemStack stack) {
|
||||
return stack.getCount();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int maxStackSize(ItemStack stack) {
|
||||
return stack.getMaxStackSize();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean sameItem(ItemStack first, ItemStack second) {
|
||||
return ItemStack.isSameItemSameComponents(first, second);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack copy(ItemStack stack) {
|
||||
return stack.copy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack withCount(ItemStack stack, int count) {
|
||||
if (count <= 0) return ItemStack.EMPTY;
|
||||
ItemStack copy = stack.copy();
|
||||
copy.setCount(count);
|
||||
return copy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack empty() {
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compare(ItemStack first, ItemStack second) {
|
||||
boolean firstEmpty = first.isEmpty();
|
||||
boolean secondEmpty = second.isEmpty();
|
||||
if (firstEmpty || secondEmpty) return Boolean.compare(firstEmpty, secondEmpty);
|
||||
int byId = BuiltInRegistries.ITEM.getKey(first.getItem()).toString()
|
||||
.compareTo(BuiltInRegistries.ITEM.getKey(second.getItem()).toString());
|
||||
if (byId != 0) return byId;
|
||||
int byComponents = String.valueOf(first.getComponents())
|
||||
.compareTo(String.valueOf(second.getComponents()));
|
||||
if (byComponents != 0) return byComponents;
|
||||
return Integer.compare(second.getCount(), first.getCount());
|
||||
}
|
||||
};
|
||||
|
||||
private static boolean initialized;
|
||||
|
||||
private SanctuaryInventorySort() {
|
||||
}
|
||||
|
||||
public static void initialize() {
|
||||
if (initialized) return;
|
||||
initialized = true;
|
||||
ServerPlayerEvents.LEAVE.register(player -> LAST_SORT_TICK.remove(player.getUUID()));
|
||||
}
|
||||
|
||||
public static void sort(ServerPlayer player) {
|
||||
long now = player.level().getGameTime();
|
||||
Long previous = LAST_SORT_TICK.get(player.getUUID());
|
||||
if (previous != null && now - previous < COOLDOWN_TICKS) return;
|
||||
LAST_SORT_TICK.put(player.getUUID(), now);
|
||||
|
||||
int unlockedRows = SanctuaryInventoryCapacity.unlockedRows(player);
|
||||
if (unlockedRows <= 1) return;
|
||||
|
||||
Inventory inventory = player.getInventory();
|
||||
SanctuaryOverflowContainer overflow = SanctuaryOverflowAccess.of(player);
|
||||
int[] visualByPhysical = SanctuaryHotbarRows.visualLayout(player);
|
||||
List<ItemStack> slots = new ArrayList<>(
|
||||
(unlockedRows - 1) * SanctuaryInventoryCapacity.ROW_SIZE);
|
||||
for (int bank = 0; bank < unlockedRows; bank++) {
|
||||
int row = SanctuaryInventoryCapacity.physicalRowAtBankIndex(
|
||||
bank, visualByPhysical, unlockedRows);
|
||||
if (row == 0) continue;
|
||||
for (int column = 0; column < SanctuaryInventoryCapacity.ROW_SIZE; column++) {
|
||||
slots.add(getRowItem(inventory, overflow, row, column).copy());
|
||||
}
|
||||
}
|
||||
SanctuaryInventorySorter.compactAndSort(slots, STACKS);
|
||||
int index = 0;
|
||||
for (int bank = 0; bank < unlockedRows; bank++) {
|
||||
int row = SanctuaryInventoryCapacity.physicalRowAtBankIndex(
|
||||
bank, visualByPhysical, unlockedRows);
|
||||
if (row == 0) continue;
|
||||
for (int column = 0; column < SanctuaryInventoryCapacity.ROW_SIZE; column++) {
|
||||
setRowItem(inventory, overflow, row, column, slots.get(index++));
|
||||
}
|
||||
}
|
||||
inventory.setChanged();
|
||||
overflow.setChanged();
|
||||
player.inventoryMenu.broadcastChanges();
|
||||
if (player.containerMenu != player.inventoryMenu) player.containerMenu.broadcastChanges();
|
||||
}
|
||||
|
||||
private static ItemStack getRowItem(Inventory inventory, Container overflow,
|
||||
int logicalRow, int column) {
|
||||
if (logicalRow < SanctuaryInventoryCapacity.VANILLA_ROW_COUNT) {
|
||||
return inventory.getItem(logicalRow * SanctuaryInventoryCapacity.ROW_SIZE + column);
|
||||
}
|
||||
return overflow.getItem((logicalRow - SanctuaryInventoryCapacity.VANILLA_ROW_COUNT)
|
||||
* SanctuaryInventoryCapacity.ROW_SIZE + column);
|
||||
}
|
||||
|
||||
private static void setRowItem(Inventory inventory, Container overflow,
|
||||
int logicalRow, int column, ItemStack stack) {
|
||||
if (logicalRow < SanctuaryInventoryCapacity.VANILLA_ROW_COUNT) {
|
||||
inventory.setItem(logicalRow * SanctuaryInventoryCapacity.ROW_SIZE + column, stack);
|
||||
return;
|
||||
}
|
||||
overflow.setItem((logicalRow - SanctuaryInventoryCapacity.VANILLA_ROW_COUNT)
|
||||
* SanctuaryInventoryCapacity.ROW_SIZE + column, stack);
|
||||
}
|
||||
}
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
package fr.koka99cab.sanctuary26.sanctuary.gameplay;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Merges identical stacks then orders them, leaving empty slots at the end.
|
||||
* The access adapter keeps this independent of Minecraft types so smoke tests
|
||||
* can cover the contract without a running game.
|
||||
*/
|
||||
public final class SanctuaryInventorySorter {
|
||||
private SanctuaryInventorySorter() {
|
||||
}
|
||||
|
||||
public interface StackAccess<T> {
|
||||
boolean isEmpty(T stack);
|
||||
|
||||
int count(T stack);
|
||||
|
||||
int maxStackSize(T stack);
|
||||
|
||||
boolean sameItem(T first, T second);
|
||||
|
||||
T copy(T stack);
|
||||
|
||||
T withCount(T stack, int count);
|
||||
|
||||
T empty();
|
||||
|
||||
int compare(T first, T second);
|
||||
}
|
||||
|
||||
public static <T> void compactAndSort(List<T> slots, StackAccess<T> access) {
|
||||
List<T> merged = new ArrayList<>();
|
||||
for (T slot : slots) {
|
||||
if (access.isEmpty(slot)) continue;
|
||||
T remaining = access.copy(slot);
|
||||
for (int index = 0; index < merged.size() && !access.isEmpty(remaining); index++) {
|
||||
T existing = merged.get(index);
|
||||
if (!access.sameItem(existing, remaining)) continue;
|
||||
int space = access.maxStackSize(existing) - access.count(existing);
|
||||
if (space <= 0) continue;
|
||||
int moved = Math.min(space, access.count(remaining));
|
||||
merged.set(index, access.withCount(existing, access.count(existing) + moved));
|
||||
remaining = access.withCount(remaining, access.count(remaining) - moved);
|
||||
}
|
||||
if (!access.isEmpty(remaining)) merged.add(remaining);
|
||||
}
|
||||
merged.sort(access::compare);
|
||||
for (int index = 0; index < slots.size(); index++) {
|
||||
slots.set(index, index < merged.size() ? merged.get(index) : access.empty());
|
||||
}
|
||||
}
|
||||
}
|
||||
+14
-2
@@ -1,7 +1,9 @@
|
||||
package fr.koka99cab.sanctuary26.sanctuary.mixin.client;
|
||||
|
||||
import fr.koka99cab.sanctuary26.sanctuary.SanctuaryMod;
|
||||
import fr.koka99cab.sanctuary26.sanctuary.client.SanctuaryClient;
|
||||
import fr.koka99cab.sanctuary26.sanctuary.client.SanctuaryInventoryClient;
|
||||
import fr.koka99cab.sanctuary26.sanctuary.client.SanctuaryInventorySortClient;
|
||||
import fr.koka99cab.sanctuary26.sanctuary.client.SanctuaryHotbarRowsClient;
|
||||
import fr.koka99cab.sanctuary26.sanctuary.client.SanctuaryContainerScreenGeometry;
|
||||
import fr.koka99cab.sanctuary26.sanctuary.gameplay.SanctuaryExtendedInventoryMenu;
|
||||
@@ -191,7 +193,7 @@ abstract class AbstractContainerScreenMixin implements SanctuaryContainerScreenG
|
||||
sanctuary$panelLeft + PANEL_BANK_X - 3
|
||||
+ minecraft.player.getInventory().getSelectedSlot() * BANK_ROW_STEP,
|
||||
sanctuary$panelTop + PANEL_BANK_Y - 3
|
||||
+ SanctuaryHotbarRowsClient.activeVisualRow() * BANK_ROW_STEP, 22, 21);
|
||||
+ SanctuaryHotbarRowsClient.bankIndex(0, sanctuary$visibleRows) * BANK_ROW_STEP, 22, 21);
|
||||
}
|
||||
graphics.text(minecraft.font,
|
||||
Component.translatable("screen.sanctuary.inventory.banks",
|
||||
@@ -245,6 +247,15 @@ abstract class AbstractContainerScreenMixin implements SanctuaryContainerScreenG
|
||||
cir.setReturnValue(true);
|
||||
}
|
||||
|
||||
@Inject(method = "mouseClicked", at = @At("HEAD"), cancellable = true)
|
||||
private void sanctuary$sortInventory(MouseButtonEvent event, boolean doubleClick,
|
||||
CallbackInfoReturnable<Boolean> cir) {
|
||||
if (!SanctuaryClient.isSortInventoryMouse(event)) return;
|
||||
if (SanctuaryInventorySortClient.request(Minecraft.getInstance())) {
|
||||
cir.setReturnValue(true);
|
||||
}
|
||||
}
|
||||
|
||||
/** Shift + held left click quick-moves every slot crossed exactly once. */
|
||||
@Inject(method = "mouseClicked", at = @At("HEAD"), cancellable = true)
|
||||
private void sanctuary$startRapidTransfer(MouseButtonEvent event, boolean doubleClick,
|
||||
@@ -373,7 +384,8 @@ abstract class AbstractContainerScreenMixin implements SanctuaryContainerScreenG
|
||||
}
|
||||
sanctuary$move(slot,
|
||||
sanctuary$panelLeft + PANEL_BANK_X + column * BANK_ROW_STEP,
|
||||
sanctuary$panelTop + PANEL_BANK_Y + visualRow * BANK_ROW_STEP);
|
||||
sanctuary$panelTop + PANEL_BANK_Y
|
||||
+ SanctuaryHotbarRowsClient.bankIndex(logicalRow, sanctuary$visibleRows) * BANK_ROW_STEP);
|
||||
}
|
||||
|
||||
@Unique
|
||||
|
||||
+5
-4
@@ -163,15 +163,15 @@ abstract class InventoryScreenMixin {
|
||||
}
|
||||
}
|
||||
if (minecraft.player != null) {
|
||||
int activeRow = SanctuaryHotbarRowsClient.activeVisualRow();
|
||||
int hotbarRow = SanctuaryHotbarRowsClient.bankIndex(0, sanctuary$visibleRows);
|
||||
graphics.blit(RenderPipelines.GUI_TEXTURED, HOTBAR_TEXTURE,
|
||||
leftPos + HOTBAR_X,
|
||||
topPos + BANK_Y + activeRow * BANK_ROW_STEP - 3,
|
||||
topPos + BANK_Y + hotbarRow * BANK_ROW_STEP - 3,
|
||||
0.0F, 0.0F, 182, 22, 182, 22);
|
||||
graphics.blitSprite(RenderPipelines.GUI_TEXTURED, HOTBAR_SELECTION_SPRITE,
|
||||
leftPos + HOTBAR_X - 1
|
||||
+ minecraft.player.getInventory().getSelectedSlot() * HOTBAR_COLUMN_STEP,
|
||||
topPos + BANK_Y + activeRow * BANK_ROW_STEP - 4, 24, 23);
|
||||
topPos + BANK_Y + hotbarRow * BANK_ROW_STEP - 4, 24, 23);
|
||||
}
|
||||
if (minecraft.player != null) {
|
||||
InventoryScreen.extractEntityInInventoryFollowsMouse(
|
||||
@@ -212,7 +212,8 @@ abstract class InventoryScreenMixin {
|
||||
return;
|
||||
}
|
||||
int x = hotbar ? HOTBAR_SLOT_X + column * HOTBAR_COLUMN_STEP : BANK_X + column * 18;
|
||||
move(slot, x, BANK_Y + visualRow * BANK_ROW_STEP);
|
||||
move(slot, x, BANK_Y + SanctuaryHotbarRowsClient.bankIndex(logicalRow, sanctuary$visibleRows)
|
||||
* BANK_ROW_STEP);
|
||||
}
|
||||
|
||||
@Unique
|
||||
|
||||
+14
@@ -2,6 +2,7 @@ package fr.koka99cab.sanctuary26.sanctuary.mixin.client;
|
||||
|
||||
import fr.koka99cab.sanctuary26.sanctuary.client.SanctuaryClient;
|
||||
import fr.koka99cab.sanctuary26.sanctuary.client.SanctuaryHotbarRowsClient;
|
||||
import fr.koka99cab.sanctuary26.sanctuary.client.SanctuaryInventorySortClient;
|
||||
import fr.koka99cab.sanctuary26.sanctuary.client.SanctuarySittingClient;
|
||||
import net.minecraft.client.KeyboardHandler;
|
||||
import net.minecraft.client.Minecraft;
|
||||
@@ -45,4 +46,17 @@ public abstract class KeyboardHandlerMixin {
|
||||
callback.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "keyPress", at = @At("HEAD"), cancellable = true)
|
||||
private void sanctuary$sortInventory(long windowPointer, int action, KeyEvent event,
|
||||
CallbackInfo callback) {
|
||||
Minecraft client = Minecraft.getInstance();
|
||||
if (windowPointer != client.getWindow().handle() || action != GLFW.GLFW_PRESS
|
||||
|| !SanctuaryClient.isSortInventoryKey(event)) {
|
||||
return;
|
||||
}
|
||||
if (SanctuaryInventorySortClient.requestFromKeyboard(client)) {
|
||||
callback.cancel();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+19
@@ -1,8 +1,14 @@
|
||||
package fr.koka99cab.sanctuary26.sanctuary.mixin.client;
|
||||
|
||||
import fr.koka99cab.sanctuary26.sanctuary.client.SanctuaryBulkActionsClient;
|
||||
import fr.koka99cab.sanctuary26.sanctuary.client.SanctuaryClient;
|
||||
import fr.koka99cab.sanctuary26.sanctuary.client.SanctuaryInventorySortClient;
|
||||
import fr.koka99cab.sanctuary26.sanctuary.client.SanctuaryZoom;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.MouseHandler;
|
||||
import net.minecraft.client.input.MouseButtonEvent;
|
||||
import net.minecraft.client.input.MouseButtonInfo;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
@@ -19,4 +25,17 @@ public abstract class MouseHandlerMixin {
|
||||
callback.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "onButton", at = @At("HEAD"), cancellable = true)
|
||||
private void sanctuary$sortInventory(long windowPointer, MouseButtonInfo buttonInfo, int action,
|
||||
CallbackInfo callback) {
|
||||
if (action != GLFW.GLFW_PRESS) return;
|
||||
Minecraft client = Minecraft.getInstance();
|
||||
if (windowPointer != client.getWindow().handle()) return;
|
||||
MouseButtonEvent event = new MouseButtonEvent(0.0, 0.0, buttonInfo);
|
||||
if (!SanctuaryClient.isSortInventoryMouse(event)) return;
|
||||
if (SanctuaryInventorySortClient.request(client)) {
|
||||
callback.cancel();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+4
@@ -6,6 +6,7 @@ import fr.koka99cab.sanctuary26.sanctuary.progression.SanctuaryMealHeartsService
|
||||
import fr.koka99cab.sanctuary26.sanctuary.gameplay.building.SanctuaryBuildingManager;
|
||||
import fr.koka99cab.sanctuary26.sanctuary.gameplay.mining.SanctuaryMiningManager;
|
||||
import fr.koka99cab.sanctuary26.sanctuary.gameplay.SanctuaryHotbarRows;
|
||||
import fr.koka99cab.sanctuary26.sanctuary.gameplay.SanctuaryInventorySort;
|
||||
import fr.koka99cab.sanctuary26.sanctuary.gameplay.SanctuaryCompanionPowers;
|
||||
import fr.koka99cab.sanctuary26.sanctuary.gameplay.SanctuarySitting;
|
||||
import fr.koka99cab.sanctuary26.sanctuary.celestial.CelestialSkyService;
|
||||
@@ -48,6 +49,7 @@ public final class SanctuaryNetworking {
|
||||
PayloadTypeRegistry.serverboundPlay().register(BuildControlPayload.ID, BuildControlPayload.CODEC);
|
||||
PayloadTypeRegistry.serverboundPlay().register(MiningControlPayload.ID, MiningControlPayload.CODEC);
|
||||
PayloadTypeRegistry.serverboundPlay().register(HotbarRowSwitchPayload.ID, HotbarRowSwitchPayload.CODEC);
|
||||
PayloadTypeRegistry.serverboundPlay().register(SortInventoryPayload.ID, SortInventoryPayload.CODEC);
|
||||
PayloadTypeRegistry.serverboundPlay().register(CompanionPowerUsePayload.ID, CompanionPowerUsePayload.CODEC);
|
||||
PayloadTypeRegistry.serverboundPlay().register(SitRequestPayload.ID, SitRequestPayload.CODEC);
|
||||
PayloadTypeRegistry.serverboundPlay().register(CelestialActionPayload.ID, CelestialActionPayload.CODEC);
|
||||
@@ -72,6 +74,8 @@ public final class SanctuaryNetworking {
|
||||
new HotbarRowSyncPayload(accepted, payload.logicalRow()));
|
||||
}
|
||||
}));
|
||||
ServerPlayNetworking.registerGlobalReceiver(SortInventoryPayload.ID, (payload, context) ->
|
||||
context.server().execute(() -> SanctuaryInventorySort.sort(context.player())));
|
||||
ServerPlayNetworking.registerGlobalReceiver(CompanionPowerUsePayload.ID, (payload, context) ->
|
||||
context.server().execute(() -> SanctuaryCompanionPowers.use(context.player())));
|
||||
ServerPlayNetworking.registerGlobalReceiver(SitRequestPayload.ID, (payload, context) ->
|
||||
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
package fr.koka99cab.sanctuary26.sanctuary.network;
|
||||
|
||||
import fr.koka99cab.sanctuary26.sanctuary.SanctuaryMod;
|
||||
import net.minecraft.network.RegistryFriendlyByteBuf;
|
||||
import net.minecraft.network.codec.StreamCodec;
|
||||
import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
|
||||
|
||||
/** A parameterless client intent. The server owns which unlocked rows are sorted. */
|
||||
public record SortInventoryPayload() implements CustomPacketPayload {
|
||||
public static final Type<SortInventoryPayload> ID =
|
||||
new Type<>(SanctuaryMod.id("c2s/sort_inventory"));
|
||||
public static final StreamCodec<RegistryFriendlyByteBuf, SortInventoryPayload> CODEC =
|
||||
CustomPacketPayload.codec(SortInventoryPayload::write, SortInventoryPayload::new);
|
||||
|
||||
private SortInventoryPayload(RegistryFriendlyByteBuf buffer) {
|
||||
this();
|
||||
}
|
||||
|
||||
private void write(RegistryFriendlyByteBuf buffer) {
|
||||
// Intentionally empty: no client-supplied slot list or item identity can be trusted.
|
||||
}
|
||||
|
||||
@Override
|
||||
public Type<? extends CustomPacketPayload> type() {
|
||||
return ID;
|
||||
}
|
||||
}
|
||||
@@ -243,9 +243,8 @@
|
||||
"key.sanctuary.companion_power": "Companion power",
|
||||
"key.sanctuary.zoom": "Telephoto zoom",
|
||||
"key.sanctuary.switch_hotbar_row": "Cycle hotbar row",
|
||||
"key.sanctuary.sort_inventory": "Sort inventory",
|
||||
"key.sanctuary.quest_tracker": "Quest tracker",
|
||||
"hud.sanctuary.quest_tracker.title": "Quests",
|
||||
"hud.sanctuary.quest_tracker.empty": "No quest in progress",
|
||||
"hud.sanctuary.quest_tracker.toggle_on": "Quest tracker shown",
|
||||
"hud.sanctuary.quest_tracker.toggle_off": "Quest tracker hidden",
|
||||
"hud.sanctuary.quest_tracker.source.request": "Accepted request",
|
||||
|
||||
@@ -243,9 +243,8 @@
|
||||
"key.sanctuary.companion_power": "Pouvoir du familier",
|
||||
"key.sanctuary.zoom": "Zoom téléobjectif",
|
||||
"key.sanctuary.switch_hotbar_row": "Changer de rangée de hotbar",
|
||||
"key.sanctuary.sort_inventory": "Trier l'inventaire",
|
||||
"key.sanctuary.quest_tracker": "Suivi des quêtes",
|
||||
"hud.sanctuary.quest_tracker.title": "Quêtes",
|
||||
"hud.sanctuary.quest_tracker.empty": "Aucune quête en cours",
|
||||
"hud.sanctuary.quest_tracker.toggle_on": "Suivi des quêtes affiché",
|
||||
"hud.sanctuary.quest_tracker.toggle_off": "Suivi des quêtes masqué",
|
||||
"hud.sanctuary.quest_tracker.source.request": "Demande acceptée",
|
||||
|
||||
@@ -155,9 +155,8 @@
|
||||
"key.sanctuary.companion_power": "Способность спутника",
|
||||
"key.sanctuary.zoom": "Телефото-зум",
|
||||
"key.sanctuary.switch_hotbar_row": "Сменить ряд панели быстрого доступа",
|
||||
"key.sanctuary.sort_inventory": "Сортировать инвентарь",
|
||||
"key.sanctuary.quest_tracker": "Трекер заданий",
|
||||
"hud.sanctuary.quest_tracker.title": "Задания",
|
||||
"hud.sanctuary.quest_tracker.empty": "Нет активного задания",
|
||||
"hud.sanctuary.quest_tracker.toggle_on": "Трекер заданий показан",
|
||||
"hud.sanctuary.quest_tracker.toggle_off": "Трекер заданий скрыт",
|
||||
"hud.sanctuary.quest_tracker.source.request": "Принятый запрос",
|
||||
|
||||
+115
@@ -0,0 +1,115 @@
|
||||
package fr.koka99cab.sanctuary26.sanctuary.gameplay;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/** Executable coverage for merging, ordering and leaving the hotbar row out of the sort. */
|
||||
public final class SanctuaryInventorySortSmoke {
|
||||
private SanctuaryInventorySortSmoke() {
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
require(SanctuaryInventoryCapacity.bankIndex(0, 4) == 3,
|
||||
"The live hotbar must sit on the last bank row");
|
||||
require(SanctuaryInventoryCapacity.bankIndex(3, 4) == 0,
|
||||
"The last storage row must sit on the first bank line");
|
||||
require(SanctuaryInventoryCapacity.physicalRowAtBankIndex(0, null, 4) == 3,
|
||||
"Packing must start at the top storage row, not the hotbar");
|
||||
require(SanctuaryInventoryCapacity.physicalRowAtBankIndex(3, null, 4) == 0,
|
||||
"The bottom bank row must remain the live hotbar");
|
||||
|
||||
SanctuaryInventorySorter.StackAccess<FakeStack> access = FakeStack.ACCESS;
|
||||
List<FakeStack> storage = new ArrayList<>(List.of(
|
||||
new FakeStack("minecraft:dirt", "", 32, 64),
|
||||
new FakeStack("minecraft:cobblestone", "", 16, 64),
|
||||
FakeStack.EMPTY,
|
||||
new FakeStack("minecraft:dirt", "", 40, 64),
|
||||
new FakeStack("minecraft:diamond_sword", "sharpness", 1, 1),
|
||||
new FakeStack("minecraft:cobblestone", "", 64, 64),
|
||||
new FakeStack("minecraft:diamond_sword", "", 1, 1)
|
||||
));
|
||||
SanctuaryInventorySorter.compactAndSort(storage, access);
|
||||
require(storage.get(0).id.equals("minecraft:cobblestone") && storage.get(0).count == 64,
|
||||
"Full cobblestone stack must come first");
|
||||
require(storage.get(1).id.equals("minecraft:cobblestone") && storage.get(1).count == 16,
|
||||
"Leftover cobblestone must follow the merged full stack");
|
||||
require(storage.get(2).id.equals("minecraft:diamond_sword") && storage.get(2).components.isEmpty(),
|
||||
"Unenchanted sword must sort before the enchanted one");
|
||||
require(storage.get(3).id.equals("minecraft:diamond_sword") && storage.get(3).components.equals("sharpness"),
|
||||
"Component variants must stay distinct");
|
||||
require(storage.get(4).id.equals("minecraft:dirt") && storage.get(4).count == 64,
|
||||
"Dirt must merge up to max stack size");
|
||||
require(storage.get(5).id.equals("minecraft:dirt") && storage.get(5).count == 8,
|
||||
"Dirt remainder must keep the leftover count");
|
||||
require(storage.get(6).isEmpty(), "Unused storage slots must end empty");
|
||||
|
||||
List<FakeStack> hotbar = new ArrayList<>(List.of(
|
||||
new FakeStack("minecraft:torch", "", 8, 64),
|
||||
new FakeStack("minecraft:bread", "", 3, 64)
|
||||
));
|
||||
List<FakeStack> snapshot = List.copyOf(hotbar);
|
||||
require(hotbar.equals(snapshot), "Hotbar snapshot must remain untouched by storage sorting");
|
||||
}
|
||||
|
||||
private static void require(boolean condition, String message) {
|
||||
if (!condition) throw new IllegalStateException(message);
|
||||
}
|
||||
|
||||
private record FakeStack(String id, String components, int count, int maxSize) {
|
||||
static final FakeStack EMPTY = new FakeStack("", "", 0, 64);
|
||||
static final SanctuaryInventorySorter.StackAccess<FakeStack> ACCESS =
|
||||
new SanctuaryInventorySorter.StackAccess<>() {
|
||||
@Override
|
||||
public boolean isEmpty(FakeStack stack) {
|
||||
return stack == null || stack.count <= 0 || stack.id.isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int count(FakeStack stack) {
|
||||
return stack.count;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int maxStackSize(FakeStack stack) {
|
||||
return stack.maxSize;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean sameItem(FakeStack first, FakeStack second) {
|
||||
return first.id.equals(second.id) && first.components.equals(second.components);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FakeStack copy(FakeStack stack) {
|
||||
return stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FakeStack withCount(FakeStack stack, int count) {
|
||||
if (count <= 0) return EMPTY;
|
||||
return new FakeStack(stack.id, stack.components, count, stack.maxSize);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FakeStack empty() {
|
||||
return EMPTY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compare(FakeStack first, FakeStack second) {
|
||||
boolean firstEmpty = isEmpty(first);
|
||||
boolean secondEmpty = isEmpty(second);
|
||||
if (firstEmpty || secondEmpty) return Boolean.compare(firstEmpty, secondEmpty);
|
||||
int byId = first.id.compareTo(second.id);
|
||||
if (byId != 0) return byId;
|
||||
int byComponents = first.components.compareTo(second.components);
|
||||
if (byComponents != 0) return byComponents;
|
||||
return Integer.compare(second.count, first.count);
|
||||
}
|
||||
};
|
||||
|
||||
boolean isEmpty() {
|
||||
return ACCESS.isEmpty(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user