Kubejs script to make spawn eggs shows recipe creation, but sacrifice never happens
kragnoth opened this issue ยท 7 comments
Minecraft Version
1.20.1
Mod Version
2.08
Describe the bug!
ServerEvents.recipes(event => {
// Iterate over all items matching the regex for spawn eggs
Ingredient.of(/.*_spawn_egg/).stacks.forEach(stack => {
const spawnEggId = stack.id; // Get the spawn egg item ID
const entityName = spawnEggId.replace('_spawn_egg', ''); // Derive the entity name from the item ID
event.recipes.summoningrituals.altar('minecraft:gold_ingot') // Catalyst (gold ingot)
.itemOutput(spawnEggId) // Create the spawn egg
.input('minecraft:rotten_flesh', 'minecraft:egg')
.sacrifice(entityName, 1) // Sacrifice one of the original entity
});
});
this script goes through all spawn eggs in the modpack and generates a recipe for each. The recipes all show up just fine. However the sacrifice never happens, as it says there aren't enough sacrifices present. Is this an issue because all recipes have the same item inputs?
Crash Report
No response
Log
No response
Additions and Modifications
Yes
Additions and Modifications Description
No response
Did the issue happen in singleplayer or on a server?
Singleplayer
My apologies, didn't mean to make more work for you. I appreciate you leaving the ticket open.
seems to be the duplicate input items, if I stop the function after one iteraction (penguin) penguin boy gets sacrificed and gives me an egg just fine.
Yup, the recipe is determined via the item inputs and the catalyst. After that, it tries to find the correct entity nearby. Since your recipes have the same inputs, the altar will always look for the same entity.
This is not the KubeJS support. Please stick to issue reporting. I am leaving this open as a potential improvement in the next versions.
question on the limits of the items, it seems if I have two recipes with similar items, it makes them not recognize either... i.e. I have one recipe dirt, cobblestone, and a second is cobblestone, dirt, stick, neither seem to work. Could you say what the limitations of a successful ritual recipe is? Like, does every recipe need completely unique item lists, or am I just having bad luck due to something else? Right now I'm using a list of 10 items and using those to build 156 recipes, but it is hitting limitations that I can't quite discern what the cause is.