Closed kindlich closed 5 months ago
I must admit, I am rather bewildered as to how this issue would occur - granted, I also did not implement the current recipe system. Did you test this exact recipe in a datapack?
You are indeed correct in assuming that data is encoded to EDM before being passed to a codec, however, said codec then uses a special DynamicOps implementation which knows how to deal with this format. I believe (this could be incorrect) that the MapLike displaying EDM data is normal since the DynamicOps implementation is used to actually interact with and get data from it.
Anyways, @Dragon-Seeker will need to look more into this
Also, don't get confused, I fat-fingered the close with comment button
Cheers
Well, I basically copied over what was written here and removed a few blocks.
Putting it into a datapack seems to load properly. I did change the recipe a bit since in my test instance there's no adamantite:
// saves/Test World/datapacks/test_alloy/data/crafttweaker/recipes/forging.testing.json
{
"type": "alloy_forgery:forging",
"fuel_per_tick": 45,
"inputs": [
{
"count": 10,
"item": "minecraft:bedrock"
}
],
"min_forge_tier": 1,
"output": {
"count": 3,
"id": "minecraft:gold_block"
},
"overrides": {
"2+": {
"count": 4
}
}
}
Works fine inside a datapack, but breaks inside a CraftTweaker script:
// scripts/test.zs
<recipetype:alloy_forgery:forging>.addJsonRecipe("forging.testing.2", {
"type": "alloy_forgery:forging",
"fuel_per_tick": 45,
"inputs": [
{
"count": 10,
"item": "minecraft:bedrock"
}
],
"min_forge_tier": 1,
"output": {
"count": 3,
"id": "minecraft:gold_block"
},
"overrides": {
"2+": {
"count": 4
}
}
});
[15:03:39.083][ERROR][CraftTweaker-ZenCode]: Error while running scripts:
java.lang.IllegalArgumentException:
No key tag in MapLike[{E(STRING, "item")=E(STRING, "minecraft:bedrock"), E(STRING, "count")=E(INT, 10)}];
No key item in MapLike[{E(STRING, "item")=E(STRING, "minecraft:bedrock"), E(STRING, "count")=E(INT, 10)}];
Not a sequence: E(MAP, {"count"=E(INT, 10), "item"=E(STRING, "minecraft:bedrock")});
Input does not contain a key [fabric:type]: MapLike[{E(STRING, "item")=E(STRING, "minecraft:bedrock"), E(STRING, "count")=E(INT, 10)}]
Will dive further into this issue coming up when I find time.
Hey there,
this issue came up in the CraftTweaker discord and I just wanted to forward it here.
Background: CraftTweaker allows modpack developers to specify their own recipes using a builtin scripting language. Mods either provide explicit support inside their mod (or an addon mod). If a mod does not provide explicit support, we can fall back to using the recipe serializer system and allow users to provide JSON recipes which are then passed to the serializer's codec.
Issue description and Steps to reproduce: When trying to add a recipe to the
alloy_forgery:forging
serializer, the ingredients cannot be parsed properly. I assume this has to do with the Endecs that this mod uses, but I cannot see if the issue lies in this mod or in uwu-lib..../.minecraft/scripts/test.zs
/reload
if you are already in one).../.minecraft/logs/crafttweaker.log
file)Analysis: To me, this looks like some part of the system serializes our input into the uwu-lib's endec format and then passes that to the recipe serializer instead of the "raw" MapLike structure. It goes without saying that a Map with EDM-Elements as keys and values does not contain a String called
"tag"
. Since CraftTweaker only callsserializer.codec().parse(...)
with the normal Minecraft Codec class, we assume the issue lies in either AlloyForgery or in uwu-lib.Possible Workarounds/Alternative Fixes:
Additional Files: