SihenZhang / CrockPot

Bring Crock Pot from Don't Starve to Minecraft.
MIT License
19 stars 7 forks source link

[bug]Cannot overwrite crockpot internal data by datapacks #40

Closed khjxiaogu closed 2 years ago

khjxiaogu commented 2 years ago

Tried to add datapack for rotten flesh, but got this.

java.lang.IllegalArgumentException: Duplicate definition for item minecraft:rotten_flesh
    at com.sihenzhang.crockpot.base.FoodCategoryManager.apply(FoodCategoryManager.java:177) ~[crockpot:1.5.2-release]
    at com.sihenzhang.crockpot.base.FoodCategoryManager.func_212853_a_(FoodCategoryManager.java:22) ~[crockpot:1.5.2-release]
    at net.minecraft.client.resources.ReloadListener.func_215269_a(SourceFile:13) ~[?:?]
    at java.util.concurrent.CompletableFuture$UniAccept.tryFire(CompletableFuture.java:714) ~[?:?]
    at java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:478) ~[?:?]
    at net.minecraft.resources.AsyncReloader.func_219557_a(SourceFile:71) ~[?:?]
    at net.minecraft.util.concurrent.ThreadTaskExecutor.func_213166_h(ThreadTaskExecutor.java:189) ~[?:?]
    at net.minecraft.util.concurrent.RecursiveEventLoop.func_213166_h(SourceFile:23) ~[?:?]
    at net.minecraft.util.concurrent.ThreadTaskExecutor.func_213168_p(ThreadTaskExecutor.java:151) ~[?:?]
    at net.minecraft.util.concurrent.ThreadTaskExecutor.func_213161_c(ThreadTaskExecutor.java:167) ~[?:?]
    at net.minecraft.client.Minecraft.func_238189_a_(Minecraft.java:1863) ~[?:?]

I think overwrite default definition is expected behaviour.

SihenZhang commented 2 years ago

OK, so we will use IRecipe from vanilla instead of our own JsonReloadListener. I think you can overwrite the internal datapacks now but everything should be rewritten.🤔

khjxiaogu commented 2 years ago

OK, so we will use IRecipe from vanilla instead of our own JsonReloadListener. I think you can overwrite the internal datapacks now but everything should be rewritten.🤔

Maybe, there's any chance to do this without rewrite? Just remove that Exception should work?

SihenZhang commented 2 years ago

OK, so we will use IRecipe from vanilla instead of our own JsonReloadListener. I think you can overwrite the internal datapacks now but everything should be rewritten.🤔

Maybe, there's any chance to do this without rewrite? Just remove that Exception should work?

IRecipe has a loading order that your own datapack will overwrite the internal datapack while regular datapack doesn't. So in regular datapack, the internal datapack maybe overwrite your datapack, which is not what you want.