[bug] enchanted book sorting not working properly in 1.16
rmobis opened this issue · 4 comments
While working on #27 I noticed that enchanted book sorting was in fact already implemented, but wasn't working on the 1.16 build.
After some painful debugging (is there any easier way other than recompiling, replacing the file and reopening minecraft?) the culprit seems to be on line https://github.com/kyrptonaught/Inventory-Sorter/blob/1.16/src/main/java/net/kyrptonaught/inventorysorter/SortCases.java#L58. The method asString()
is not returning the formatted enchantment name, as one would expect; instead, it returns an empty string.
This could be an upstream bug (?) but I couldn't find any documentation on the net.minecraft.enchantment.*
classes. I've added a line to log the sorting key for every item and you can see on the attached log that the enchantment names are not being appended (only the blank spaces).
This is the first time I'm contributing to a Minecraft mod, so any pointers would be appreciated.
Versions:
- OS: Windows 10.0.19041
- MultiMC: 0.6.11-1430
- Java: OpenJDK 1.8.0_265
- Minecraft: 1.16.3
- Fabric: 0.10.0+build.208
- Fabric API: 0.22.0+build.408-1.16
Minecraft Log
MultiMC version: 0.6.11-1430
Minecraft folder is:
C:/MultiMC/instances/1.16.2/.minecraft
Java path is:
C:/Program Files/AdoptOpenJDK/jdk-8.0.265.01-hotspot/jre/bin/javaw.exe
Java is version 1.8.0_265, using 64-bit architecture.
Main Class:
net.fabricmc.loader.launch.knot.KnotClient
Native path:
C:/MultiMC/instances/1.16.2/natives
Traits:
traits FirstThreadOnMacOS
Libraries:
C:/MultiMC/libraries/org/lwjgl/lwjgl-glfw/3.2.2/lwjgl-glfw-3.2.2.jar
C:/MultiMC/libraries/org/lwjgl/lwjgl-jemalloc/3.2.2/lwjgl-jemalloc-3.2.2.jar
C:/MultiMC/libraries/org/lwjgl/lwjgl-openal/3.2.2/lwjgl-openal-3.2.2.jar
C:/MultiMC/libraries/org/lwjgl/lwjgl-opengl/3.2.2/lwjgl-opengl-3.2.2.jar
C:/MultiMC/libraries/org/lwjgl/lwjgl-stb/3.2.2/lwjgl-stb-3.2.2.jar
C:/MultiMC/libraries/org/lwjgl/lwjgl-tinyfd/3.2.2/lwjgl-tinyfd-3.2.2.jar
C:/MultiMC/libraries/org/lwjgl/lwjgl/3.2.2/lwjgl-3.2.2.jar
C:/MultiMC/libraries/com/mojang/patchy/1.1/patchy-1.1.jar
C:/MultiMC/libraries/oshi-project/oshi-core/1.1/oshi-core-1.1.jar
C:/MultiMC/libraries/net/java/dev/jna/jna/4.4.0/jna-4.4.0.jar
C:/MultiMC/libraries/net/java/dev/jna/platform/3.4.0/platform-3.4.0.jar
C:/MultiMC/libraries/com/ibm/icu/icu4j/66.1/icu4j-66.1.jar
C:/MultiMC/libraries/com/mojang/javabridge/1.0.22/javabridge-1.0.22.jar
C:/MultiMC/libraries/net/sf/jopt-simple/jopt-simple/5.0.3/jopt-simple-5.0.3.jar
C:/MultiMC/libraries/io/netty/netty-all/4.1.25.Final/netty-all-4.1.25.Final.jar
C:/MultiMC/libraries/com/google/guava/guava/21.0/guava-21.0.jar
C:/MultiMC/libraries/org/apache/commons/commons-lang3/3.5/commons-lang3-3.5.jar
C:/MultiMC/libraries/commons-io/commons-io/2.5/commons-io-2.5.jar
C:/MultiMC/libraries/commons-codec/commons-codec/1.10/commons-codec-1.10.jar
C:/MultiMC/libraries/com/mojang/brigadier/1.0.17/brigadier-1.0.17.jar
C:/MultiMC/libraries/com/mojang/datafixerupper/4.0.26/datafixerupper-4.0.26.jar
C:/MultiMC/libraries/com/google/code/gson/gson/2.8.0/gson-2.8.0.jar
C:/MultiMC/libraries/com/mojang/authlib/1.6.25/authlib-1.6.25.jar
C:/MultiMC/libraries/org/apache/commons/commons-compress/1.8.1/commons-compress-1.8.1.jar
C:/MultiMC/libraries/org/apache/httpcomponents/httpclient/4.3.3/httpclient-4.3.3.jar
C:/MultiMC/libraries/commons-logging/commons-logging/1.1.3/commons-logging-1.1.3.jar
C:/MultiMC/libraries/org/apache/httpcomponents/httpcore/4.3.2/httpcore-4.3.2.jar
C:/MultiMC/libraries/it/unimi/dsi/fastutil/8.2.1/fastutil-8.2.1.jar
C:/MultiMC/libraries/org/apache/logging/log4j/log4j-api/2.8.1/log4j-api-2.8.1.jar
C:/MultiMC/libraries/org/apache/logging/log4j/log4j-core/2.8.1/log4j-core-2.8.1.jar
C:/MultiMC/libraries/com/mojang/text2speech/1.11.3/text2speech-1.11.3.jar
C:/MultiMC/libraries/net/fabricmc/intermediary/1.16.3/intermediary-1.16.3.jar
C:/MultiMC/libraries/net/fabricmc/tiny-mappings-parser/0.2.2.14/tiny-mappings-parser-0.2.2.14.jar
C:/MultiMC/libraries/net/fabricmc/sponge-mixin/0.8.1+build.21/sponge-mixin-0.8.1+build.21.jar
C:/MultiMC/libraries/net/fabricmc/tiny-remapper/0.3.0.70/tiny-remapper-0.3.0.70.jar
C:/MultiMC/libraries/net/fabricmc/fabric-loader-sat4j/2.3.5.4/fabric-loader-sat4j-2.3.5.4.jar
C:/MultiMC/libraries/com/google/jimfs/jimfs/1.2-fabric/jimfs-1.2-fabric.jar
C:/MultiMC/libraries/org/ow2/asm/asm/9.0/asm-9.0.jar
C:/MultiMC/libraries/org/ow2/asm/asm-analysis/9.0/asm-analysis-9.0.jar
C:/MultiMC/libraries/org/ow2/asm/asm-commons/9.0/asm-commons-9.0.jar
C:/MultiMC/libraries/org/ow2/asm/asm-tree/9.0/asm-tree-9.0.jar
C:/MultiMC/libraries/org/ow2/asm/asm-util/9.0/asm-util-9.0.jar
C:/MultiMC/libraries/net/fabricmc/fabric-loader/0.10.0+build.208/fabric-loader-0.10.0+build.208.jar
C:/MultiMC/libraries/com/mojang/minecraft/1.16.3/minecraft-1.16.3-client.jar
Native libraries:
C:/MultiMC/libraries/org/lwjgl/lwjgl-glfw/3.2.2/lwjgl-glfw-3.2.2-natives-windows.jar
C:/MultiMC/libraries/org/lwjgl/lwjgl-jemalloc/3.2.2/lwjgl-jemalloc-3.2.2-natives-windows.jar
C:/MultiMC/libraries/org/lwjgl/lwjgl-openal/3.2.2/lwjgl-openal-3.2.2-natives-windows.jar
C:/MultiMC/libraries/org/lwjgl/lwjgl-opengl/3.2.2/lwjgl-opengl-3.2.2-natives-windows.jar
C:/MultiMC/libraries/org/lwjgl/lwjgl-stb/3.2.2/lwjgl-stb-3.2.2-natives-windows.jar
C:/MultiMC/libraries/org/lwjgl/lwjgl-tinyfd/3.2.2/lwjgl-tinyfd-3.2.2-natives-windows.jar
C:/MultiMC/libraries/org/lwjgl/lwjgl/3.2.2/lwjgl-3.2.2-natives-windows.jar
C:/MultiMC/libraries/com/mojang/text2speech/1.11.3/text2speech-1.11.3-natives-windows.jar
Mods:
[❌] canvas-mc116-1.0.974.jar (disabled)
[❌] carpet-extra-1.16.3-1.4.11.jar (disabled)
[❌] connected-block-textures-0.1.3+1.16.jar (disabled)
[✔️] fabric-api-0.22.0+build.408-1.16
[❌] fabric-carpet-1.16.3-1.4.11+v200910.jar (disabled)
[❌] illuminations-1.1-1.16.1.jar (disabled)
[✔️] InventorySorter-1.7.3-1.16
[❌] itemscroller-fabric-1.16.3-0.15.0-dev.20200912.221805.jar (disabled)
[❌] litematica-fabric-1.16.3-0.0.0-dev.20200920.161640.jar (disabled)
[❌] lithium-fabric-mc1.16.3-0.5.6.jar (disabled)
[❌] malilib-fabric-1.16.3-0.10.0-dev.21+arne.1.jar (disabled)
[❌] minihud-fabric-1.16.3-0.19.0-dev.20200912.222204.jar (disabled)
[❌] modmenu-1.14.6+build.31.jar (disabled)
[❌] okzoomer-4.0.1+1.16.2.jar (disabled)
[❌] phosphor-fabric-mc1.16.1-0.6.0+build.7.jar (disabled)
[❌] sodium-fabric-mc1.16.3-0.1.0.jar (disabled)
[❌] tinytweaks-1.0.13.jar (disabled)
[❌] traverse-2.2.15+build.30.jar (disabled)
[❌] tweakeroo-fabric-1.16.3-0.10.0-dev.20200913.175041.jar (disabled)
Params:
--username --version MultiMC5 --gameDir C:/MultiMC/instances/1.16.2/.minecraft --assetsDir C:/MultiMC/assets --assetIndex 1.16 --uuid --accessToken --userType --versionType release
Window size: 854 x 480
Java Arguments:
[-XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump, -Xms2048m, -Xmx4096m, -Duser.language=en]
Minecraft process ID: 18552
Using onesix launcher.
[04:57:36] [main/INFO]: Loading for game Minecraft 1.16.3
[04:57:37] [main/INFO]: [FabricLoader] Loading 46 mods: [email protected]+f8ac1db295, [email protected]+8724984195, [email protected], [email protected]+b50ffc7b95, [email protected]+3fa9f7c595, [email protected], [email protected]+5ce5339895, [email protected], [email protected]+build.208, [email protected]+f8ac1db295, [email protected]+f8ac1db295, [email protected]+f8ac1db295, [email protected]+045df74f95, [email protected]+f8ac1db295, [email protected]+f8ac1db295, [email protected]+f8ac1db295, [email protected]+b7f9825d95, [email protected], [email protected]+f8ac1db295, [email protected]+12a8474c95, [email protected]+f8ac1db295, [email protected]+f8ac1db295, [email protected]+730711c695, [email protected], [email protected]+f8ac1db295, [email protected]+facf3bbf95, [email protected]+eae12eb895, [email protected]+059ea86695, [email protected]+ac8e8c5995, blue_endless_jankson@+, [email protected]+c29459ab95, [email protected]+f8ac1db295, [email protected]+f8ac1db295, [email protected]+52d3083695, [email protected]+c6a8ea8995, [email protected]+74cc3b2095, [email protected]+b764ce9995, [email protected]+f8ac1db295, [email protected]+432ea18895, [email protected]+16acbe5b95, [email protected]+build.408-1.16, [email protected]+fb0d9b0e95, [email protected]+f8ac1db295, [email protected]+438f963695, [email protected]+432ea18895, [email protected]+e00ecb5f95
[04:57:37] [main/WARN]: Mod `blue_endless_jankson` (+) does not respect SemVer - comparison support is limited.
[04:57:37] [main/INFO]: SpongePowered MIXIN Subsystem Version=0.8.1 Source=file:/C:/MultiMC/libraries/net/fabricmc/sponge-mixin/0.8.1+build.21/sponge-mixin-0.8.1+build.21.jar Service=Knot/Fabric Env=CLIENT
[04:57:41] [main/INFO]: Environment: authHost='https://authserver.mojang.com', accountsHost='https://api.mojang.com', sessionHost='https://sessionserver.mojang.com', name='PROD'
[04:57:41] [main/INFO]: Setting user: rmobis
[04:57:41] [main/INFO]: [Indigo] Registering Indigo renderer!
[04:57:41] [main/INFO]: Backend library: LWJGL version 3.2.2 build 10
[04:57:45] [main/INFO]: Narrator library for x64 successfully loaded
[04:57:45] [main/INFO]: Reloading ResourceManager: Default, Cloth Config v4, Fabric API, Fabric API Base, Fabric Biome API (v1), Fabric BlockRenderLayer Registration (v1), Fabric Containers (v0), Fabric Content Registries (v0), Fabric Crash Report Info (v1), Fabric Events Interaction (v0), Fabric Events Lifecycle (v0), Fabric Game Rule API (v1), Fabric Item API (v1), Fabric Item Groups (v0), Fabric Key Binding API (v1), Fabric Key Bindings (v0), Fabric Lifecycle Events (v1), Fabric Loot Tables (v1), Fabric Mining Levels (v0), Fabric Models (v0), Fabric Networking Block Entity (v0), Fabric Networking (v0), Fabric Object Builder API (v1), Fabric Object Builders (v0), Fabric Registry Sync (v0), Fabric Renderer API (v1), Fabric Renderer - Indigo, Fabric Renderer Registries (v1), Fabric Rendering Data Attachment (v1), Fabric Rendering Fluids (v1), Fabric Rendering (v0), Fabric Rendering (v1), Fabric Resource Loader (v0), Fabric Screen Handler API (v1), Fabric Tag Extensions (v0), Fabric Textures (v0), Fabric Tool Attribute API (v1), Fabric Loader, Inventory Sorter
[04:57:52] [main/INFO]: OpenAL initialized.
[04:57:52] [main/INFO]: Sound engine started
[04:57:52] [main/INFO]: Created: 1024x1024x4 minecraft:textures/atlas/blocks.png-atlas
[04:57:52] [main/INFO]: Created: 256x128x4 minecraft:textures/atlas/signs.png-atlas
[04:57:52] [main/INFO]: Created: 1024x512x4 minecraft:textures/atlas/banner_patterns.png-atlas
[04:57:52] [main/INFO]: Created: 1024x512x4 minecraft:textures/atlas/shield_patterns.png-atlas
[04:57:52] [main/INFO]: Created: 256x256x4 minecraft:textures/atlas/chest.png-atlas
[04:57:52] [main/INFO]: Created: 512x256x4 minecraft:textures/atlas/beds.png-atlas
[04:57:52] [main/INFO]: Created: 512x256x4 minecraft:textures/atlas/shulker_boxes.png-atlas
[04:57:53] [main/INFO]: Created: 256x256x0 minecraft:textures/atlas/particles.png-atlas
[04:57:53] [main/INFO]: Created: 256x256x0 minecraft:textures/atlas/paintings.png-atlas
[04:57:53] [main/INFO]: Created: 256x128x0 minecraft:textures/atlas/mob_effects.png-atlas
[04:57:59] [main/WARN]: Ambiguity between arguments [teleport, destination] and [teleport, targets] with inputs: [Player, 0123, @e, dd12be42-52a9-4a91-a8a1-11c01849e498]
[04:57:59] [main/WARN]: Ambiguity between arguments [teleport, location] and [teleport, destination] with inputs: [0.1 -0.5 .9, 0 0 0]
[04:57:59] [main/WARN]: Ambiguity between arguments [teleport, location] and [teleport, targets] with inputs: [0.1 -0.5 .9, 0 0 0]
[04:57:59] [main/WARN]: Ambiguity between arguments [teleport, targets] and [teleport, destination] with inputs: [Player, 0123, dd12be42-52a9-4a91-a8a1-11c01849e498]
[04:57:59] [main/WARN]: Ambiguity between arguments [teleport, targets, location] and [teleport, targets, destination] with inputs: [0.1 -0.5 .9, 0 0 0]
[04:57:59] [main/INFO]: Reloading ResourceManager: Default, Fabric Tool Attribute API (v1)
[04:58:00] [main/INFO]: Loaded 7 recipes
[04:58:00] [main/INFO]: Loaded 927 advancements
[04:58:00] [main/INFO]: Environment: authHost='https://authserver.mojang.com', accountsHost='https://api.mojang.com', sessionHost='https://sessionserver.mojang.com', name='PROD'
[04:58:00] [Server thread/INFO]: Starting integrated minecraft server version 1.16.3
[04:58:00] [Server thread/INFO]: Generating keypair
[04:58:01] [Server thread/INFO]: Preparing start region for dimension minecraft:overworld
[04:58:01] [main/INFO]: Preparing spawn area: 0%
[04:58:01] [main/INFO]: Preparing spawn area: 0%
[04:58:01] [main/INFO]: Time elapsed: 770 ms
[04:58:01] [Server thread/INFO]: Changing view distance to 8, from 10
[04:58:03] [Server thread/INFO]: rmobis[local:E:ec603f6a] logged in with entity id 78 at (9.931759692800494, 63.0, 38.98704704360832)
[04:58:03] [Server thread/INFO]: rmobis joined the game
[04:58:03] [Server thread/INFO]: Saving and pausing game...
[04:58:04] [Server thread/INFO]: Saving chunks for level 'ServerLevel[Blueland 200915]'/minecraft:overworld
[04:58:04] [main/INFO]: Loaded 592 advancements
[04:58:04] [Server thread/INFO]: Saving chunks for level 'ServerLevel[Blueland 200915]'/minecraft:the_nether
[04:58:04] [Server thread/INFO]: Saving chunks for level 'ServerLevel[Blueland 200915]'/minecraft:the_end
[04:58:12] [Server thread/INFO]: [STDOUT]: Sorting Key: enchanted_book 1
[04:58:12] [Server thread/INFO]: [STDOUT]: Sorting Key: enchanted_book 1
[04:58:12] [Server thread/INFO]: [STDOUT]: Sorting Key: enchanted_book 1
[04:58:12] [Server thread/INFO]: [STDOUT]: Sorting Key: enchanted_book 1
[04:58:12] [Server thread/INFO]: [STDOUT]: Sorting Key: enchanted_book 1
[04:58:12] [Server thread/INFO]: [STDOUT]: Sorting Key: enchanted_book 1
[04:58:12] [Server thread/INFO]: [STDOUT]: Sorting Key: enchanted_book 1
[04:58:12] [Server thread/INFO]: [STDOUT]: Sorting Key: enchanted_book 1
[04:58:12] [Server thread/INFO]: [STDOUT]: Sorting Key: enchanted_book 1
[04:58:12] [Server thread/INFO]: [STDOUT]: Sorting Key: enchanted_book 1
[04:58:12] [Server thread/INFO]: [STDOUT]: Sorting Key: enchanted_book 1
[04:58:12] [Server thread/INFO]: [STDOUT]: Sorting Key: enchanted_book 1
[04:58:12] [Server thread/INFO]: [STDOUT]: Sorting Key: enchanted_book 1
[04:58:12] [Server thread/INFO]: [STDOUT]: Sorting Key: enchanted_book 1
[04:58:12] [Server thread/INFO]: [STDOUT]: Sorting Key: enchanted_book 3
[04:58:12] [Server thread/INFO]: [STDOUT]: Sorting Key: enchanted_book 1
PS: I know the log says 1.16.2 at some paths, but that's because I named my instance 1.16.2
.
Are you using an IDE like IntelliJ? IntelliJ makes it really simply. Open the build.gradle as a project, import the gradle project if it asks you to. Then inside the gradle side window run the gradle command "runClient"
If you aren't using IntelliJ you can just run "gradlew runClient" in a cmd prompt inside the projects root directory
As for the issue with the empty string, perhaps check out how I worked with the enchants in my other mod: https://github.com/kyrptonaught/EnchantedToolTips/blob/1.16/src/main/java/net/kyrptonaught/enchantedtooltips/EnchantToolTipHelper.java
That features enchant sorting that I recall working last I checked
Okey, I wasn't aware of the runClient
task. It's amazing, I'll be using it from now on. Thanks for pointing that out.
However, enchantment book sorting still isn't working for me. I've tested with the latest commit (9ba72c1) on the 1.16
branch. I've put the following books inside a chest, in this order:
Protection I
+Sharpness II
Soul Speed III
Respiration I
+Projectile Protection III
Projectile Protection IV
Sharpness III
Then I pressed the sort button on the UI and this is the result I got:
Soul Speed III
Projectile Protection IV
Sharpness III
Protection I
+Sharpness II
Respiration I
+Projectile Protection III
We can see it is properly ordering by the number of enchantments, but not by their names. If the rules were being properly followed, I'd expect this instead:
Projectile Protection IV
Sharpness III
Soul Speed III
Respiration I
+Projectile Protection III
Protection I
+Sharpness II
I've reproduced the results with the latest release build from Curse and also using all 4 sorting methods. The EnchantedToolTips mod seems to work though, so I'll take a closer look at it and see if I can figure out why.