Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kubejs script to make spawn eggs shows recipe creation, but sacrifice never happens #31

Open
kragnoth opened this issue Dec 14, 2024 · 7 comments

Comments

@kragnoth
Copy link

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

@kragnoth
Copy link
Author

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.

@rlnt
Copy link
Member

rlnt commented Dec 14, 2024

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.

@kragnoth
Copy link
Author

dang... know any kubejs code to get common drops from an entity? lol

@rlnt
Copy link
Member

rlnt commented Dec 14, 2024

This is not the KubeJS support. Please stick to issue reporting. I am leaving this open as a potential improvement in the next versions.

@kragnoth
Copy link
Author

My apologies, didn't mean to make more work for you. I appreciate you leaving the ticket open.

@kragnoth
Copy link
Author

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.

@rlnt
Copy link
Member

rlnt commented Dec 15, 2024

Once again, this is an issue tracker, not a support forum. We offer support on our Discord server.

@AlmostReliable AlmostReliable locked as off-topic and limited conversation to collaborators Dec 15, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants