AlmostReliable / summoningrituals

A Minecraft mod to create custom summoning rituals for items and mobs.
https://www.curseforge.com/minecraft/mc-mods/summoningrituals
GNU Lesser General Public License v3.0
10 stars 5 forks source link

Recipes that differ only in block below (or block below and output) do not work #24

Open MelodyCube opened 10 months ago

MelodyCube commented 10 months ago

Version

summoningrituals-forge-1.20.1-2.0.7

Describe the bug!

When creating recipes that differ only in block below (or block below and output) only one of the recipes works while all others say "The Altar does not have the correct block below it". All recipes show up properly in JEI. E.g.

ServerEvents.recipes(event => {
    event.recipes.summoningrituals.altar('minecraft:dirt')
    .itemOutput('minecraft:coarse_dirt')
    .blockBelow('minecraft:gravel')
    // this recipe works

    event.recipes.summoningrituals.altar('minecraft:dirt')
    .itemOutput('minecraft:andesite')
    .blockBelow('minecraft:dirt')
    // this recipe does not work

    event.recipes.summoningrituals.altar('minecraft:dirt')
    .itemOutput('minecraft:stone')
    .input('minecraft:stick')
    .blockBelow('minecraft:gravel')
    // this recipe does not work

    event.recipes.summoningrituals.altar('minecraft:dirt')
    .itemOutput('minecraft:cobblestone')
    .input('minecraft:stick')
    .blockBelow('minecraft:dirt')
    // this recipe works
})

It'd be really great if this could also be fixed on 1.19 because that is where I found the issue.

Crash Report

No response

Log

No response

Additional Context

No

Modifications

Just KubeJS, JEI, and necessary libraries

Did the issue happen in singleplayer or on a server?

Singleplayer

rlnt commented 10 months ago

Hmm, that's a bit tricky to solve.

Right now, the recipe lookup is only considering the inputs. So the set of input items has to be unique. This ensures that I can post specific error messages to the chat when something is wrong e.g. "Not the right block below the altar."

If I include the block below in the recipe check, the mod could never tell you what's wrong because it wouldn't find a recipe in the first place if you are missing the block below. Not sure how to solve this yet but I am open for suggestions.

MelodyCube commented 9 months ago

Could you do something like if (blockbelow is part of a recipe with x inputs) { check blockbelow }? You might have to loop through all the recipes with x inputs, though, and I don't know how feasible that is. Also I guess this would be more of a feature addition but just throwing it out there in case it might make it easier somehow: could you read blockbelow as an array of blockstates and/or block tags instead of a single block?

rlnt commented 9 months ago

No, the mod would lose the ability to tell if it's the right block either way. It's a bit hard to communicate the challenge around this in the most transparent way when someone doesn't know the internals. Please give me a bit of time to figure this out. I have a few ideas, let's see if I can make this work without changing too much of the actual player experience. :)