Dynamic patches disappear after /reload
Minecrafthyr opened this issue · 2 comments
Dynamic patches disappear after /reload.
Fabric 1.21.4.
Files:
pack.mcmeta
...
{
"pack_type": "server_data",
"patch": "planks",
"targets": [
{
"namespace": [
"minecraft"
],
"path": [
{
"pattern": "recipe/.+_planks\\.json"
}
]
}
]
},
...
Dynamic Patching patches/planks.json.patch
{
"op": "replace",
"path": "/result/count",
"value": 1
}
Normal Patching data/minecraft/recipe/blaze_powder.json.patch
{
"op": "replace",
"path": "/result/count",
"value": 1
}
Run command:
/patched dump file minecraft:recipe/acacia_planks.json
/patched dump file minecraft:recipe/blaze_powder.json
Before reload:
{
"type": "minecraft:crafting_shapeless",
"category": "building",
"group": "planks",
"ingredients": [
"#minecraft:acacia_logs"
],
"result": {
"count": 1, // replaced by file/Minecraft Remade
"id": "minecraft:acacia_planks"
}
}
{
"type": "minecraft:crafting_shapeless",
"category": "misc",
"ingredients": [
"minecraft:blaze_rod"
],
"result": {
"count": 1, // replaced by file/Minecraft Remade
"id": "minecraft:blaze_powder"
}
}
After reload:
{
"type": "minecraft:crafting_shapeless",
"category": "building",
"group": "planks",
"ingredients": [
"#minecraft:acacia_logs"
],
"result": {
"count": 4,
"id": "minecraft:acacia_planks"
}
}
{
"type": "minecraft:crafting_shapeless",
"category": "misc",
"ingredients": [
"minecraft:blaze_rod"
],
"result": {
"count": 1, // replaced by file/Minecraft Remade
"id": "minecraft:blaze_powder"
}
}
This issue appears to also affect 1.21.1 (at least based on code analysis). It looks like I missed MinecraftServer.reloadResources()
when I was implementing the dynamic patching system — most likely because it calls Pack.open()
manually rather than using openAllSelected()
like everything else. This should be a simple fix.
It also looks like the patched:registered
test condition will currently crash 1.21.4 due to Registry.get()
now returning an Optional
. I'll see if I can fix that too.