MehVahdJukaar / polytone

Other
38 stars 3 forks source link

[BUG] [FABRIC] Components with Compound{} data type are not supported and return an exception if used #85

Open magmamir opened 2 weeks ago

magmamir commented 2 weeks ago

Polytone 1.21-2.4.6 Fabric Fabric API 0.102.0+1.21

Components like "minecraft:jukebox_playable" or "minecraft:enchantments" don't work, because they use compound data type and seems Polytone don't processes it properly. I tested it with creative tab modifiers feature, but this may apply to every .json file in Polytone that somehow interacts with item components.

For example, components like this:

"minecraft:custom_model_data": 22201,
"minecraft:custom_data": "{smithed:{ignore:{crafting:1b}},mmdp:{deformation:{test_data:1b}}}"

will work, as they use int and string data types.

But for example components like this:

"minecraft:jukebox_playable": {
    "song": "ls2:life",
    "show_in_tooltip": true
}

return exception to Polytone, and deactivate all resource packs.

This is what logs say:

[13:52:10] [Render thread/INFO]: Starting up renderer (fabric)
>> [13:52:10] [Render thread/INFO]: Renderer starting up.
>> [13:52:10] [Render thread/ERROR]: Creative tab modifiers Reloader failed to parse some resources
>> [13:52:10] [Render thread/INFO]: Caught error loading resourcepacks, removing all selected resourcepacks
>> java.util.concurrent.CompletionException: java.lang.IllegalStateException: Could not decode Creative Mode Tab Modifier with json id minecraft:tools_and_utilities - error: Can't access registry ResourceKey[minecraft:root / minecraft:enchantment] missed input: {"minecraft:fortune":3} missed input: {"minecraft:enchantments":{"minecraft:fortune":3}}
>>  at java.base/java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:315) ~[?:?]
>>  at java.base/java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:320) ~[?:?]
>>  at java.base/java.util.concurrent.CompletableFuture$UniAccept.tryFire(CompletableFuture.java:722) ~[?:?]
>>  at java.base/java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:482) ~[?:?]
>>  at net.minecraft.class_4014.method_18365(class_4014.java:69) ~[transformed-mod-minecraft-v1.21.jar:?]
>>  at net.minecraft.class_1255.method_18859(class_1255.java:162) ~[transformed-mod-minecraft-v1.21.jar:?]
>>  at net.minecraft.class_4093.method_18859(class_4093.java:23) ~[transformed-mod-minecraft-v1.21.jar:?]
>>  at net.minecraft.class_1255.method_16075(class_1255.java:136) ~[transformed-mod-minecraft-v1.21.jar:?]
>>  at net.minecraft.class_1255.method_5383(class_1255.java:121) ~[transformed-mod-minecraft-v1.21.jar:?]
>>  at net.minecraft.class_310.method_1523(class_310.java:1240) [transformed-mod-minecraft-v1.21.jar:?]
>>  at net.minecraft.class_310.method_1514(class_310.java:882) [transformed-mod-minecraft-v1.21.jar:?]
>>  at net.minecraft.client.main.Main.main(Main.java:256) [transformed-mod-minecraft-v1.21.jar:?]
>>  at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103) ~[?:?]
>>  at java.base/java.lang.reflect.Method.invoke(Method.java:580) ~[?:?]
>>  at org.quiltmc.loader.impl.game.minecraft.MinecraftGameProvider.launch(MinecraftGameProvider.java:557) [quilt-loader-0.26.0.jar:?]
>>  at org.quiltmc.loader.impl.launch.knot.Knot.launch(Knot.java:84) [quilt-loader-0.26.0.jar:?]
>>  at org.quiltmc.loader.impl.launch.knot.KnotClient.main(KnotClient.java:28) [quilt-loader-0.26.0.jar:?]
>> Caused by: java.lang.IllegalStateException: Could not decode Creative Mode Tab Modifier with json id minecraft:tools_and_utilities - error: Can't access registry ResourceKey[minecraft:root / minecraft:enchantment] missed input: {"minecraft:fortune":3} missed input: {"minecraft:enchantments":{"minecraft:fortune":3}}
>>  at net.mehvahdjukaar.polytone.tabs.CreativeTabsModifiersManager.lambda$process$0(CreativeTabsModifiersManager.java:87) ~[polytone-1.21-2.4.6.i0:0/:?]
>>  at com.mojang.serialization.DataResult$Error.getOrThrow(DataResult.java:287) ~[transformed-mod-minecraft-v1.21.jar:?]
>>  at net.mehvahdjukaar.polytone.tabs.CreativeTabsModifiersManager.process(CreativeTabsModifiersManager.java:87) ~[polytone-1.21-2.4.6.i0:0/:?]
>>  at net.mehvahdjukaar.polytone.tabs.CreativeTabsModifiersManager.process(CreativeTabsModifiersManager.java:22) ~[polytone-1.21-2.4.6.i0:0/:?]
>>  at net.mehvahdjukaar.polytone.utils.CompoundReloader.processTyped(CompoundReloader.java:89) ~[polytone-1.21-2.4.6.i0:0/:?]
>>  at net.mehvahdjukaar.polytone.utils.CompoundReloader.apply(CompoundReloader.java:46) ~[polytone-1.21-2.4.6.i0:0/:?]
>>  at net.mehvahdjukaar.polytone.utils.CompoundReloader.method_18788(CompoundReloader.java:15) ~[polytone-1.21-2.4.6.i0:0/:?]
>>  at net.minecraft.class_4080.method_18790(class_4080.java:13) ~[transformed-mod-minecraft-v1.21.jar:?]
>>  at java.base/java.util.concurrent.CompletableFuture$UniAccept.tryFire(CompletableFuture.java:718) ~[?:?]
>>  ... 14 more

More specifically, this is Creative Tab Modifiers json file that work properly: working.json These are Creative Tab Modifiers that do not work properly, although they should: not_wroking_1.json not_wroking_2.json

MehVahdJukaar commented 2 weeks ago

actual issue is that some components are now using some datapack registry content and polytone, being resource pack driven, is loading them on pack load that happens way before a world is loaded. I should mvoe their loading after, same time as to when biome modifiers and others apply

magmamir commented 2 weeks ago

Seems that this is fixed in 2.4.7-version. Thank you for the quick patch! But now it seems that there is another issue. If you re-enter the world, added items with creative tab modifiers will stack with each entry into the world, until you reload your resources. When you reload them everything becomes normal. normal after 4 reentries into the world

MehVahdJukaar commented 2 weeks ago

more info? i tried this with the sample pack and i cant replicate

magmamir commented 2 weeks ago

Issue exist on both, the last release of Quilt Loader and the last release of Fabric Loader Only Fabric API 0.102.0+1.21 and polytone-1.21-2.4.10-fabric were installed.

Steps to reproduce:

  1. Download this resourcepack.zip
  2. Open minecraft and enable it.
  3. Open a world with this datapack ls2-dp.zip (For some reason, all resources fail to load when jukebox_song ids are not registered by dp.)
  4. Look at Tools & Utilities tab
  5. Close the world and open any world with this dp again.
  6. At Tools & Utilities tab you will see how the number of added items doubled.
  7. You can continue doing this loop, and with each re-enter into the world, the number of copied items in the tab will grow.

(as far as I've been able to find out, this bug doesn't always show itself if there is no jukebox_playable component in creative_tab_modifier)