#How can i make this run if the specific

1 messages · Page 1 of 1 (latest)

silent heartBOT
#

I'm trying to make this function in the code if the specific items are in the barrel (doing custom crafting), but whenever I check for 2 rice it only checks 1 and it runs that function..

execute if entity @s[scores={ulti.cooking_pot_temperature=20..45,ulti.cooking_pot_cooking=0}] \
if block ~ ~ ~ barrel{Items:[{Slot:22b,id:"minecraft:bowl"},{id:"minecraft:sugar",components:{"minecraft:item_model":"ulti:rice"}},{id:"minecraft:sugar",components:{"minecraft:item_model":"ulti:rice"}}]} \
run function ulti:blocks/technical/cooking_pot/recipe/result/rice/exact
scenic pumice
#

You're checking if the same NBT exists twice, so even though you've listed it twice it's still gonna find it once, both times. You need something different between the two checks.

Are the two rice items in two different slots?

slate grotto
#

yes

#

they are in two different slots

scenic pumice
#

Why don't you check those slot IDs?

#

In fact, you can do this much easier and more performantly with execute if items

#

If the slots to check are known

slate grotto
#

I want to do slots but I dont wanna keep repeating the same thing for a single recipe

scenic pumice
#

?

slate grotto
#

e

scenic pumice
#

I don't understand

slate grotto
#

i dont wanna keep checking excute if items container.0 to 30 or smth

scenic pumice
#

Why should you need to?

slate grotto
#

to check the slots?

#

why

#

is there another way to check

#

without repeating the same code over and over

scenic pumice
#

But if the slots the items are supposed to be in are known, you can check only those slots

slate grotto
#

oh

#

alright

#

I'll try that tomorrow though I have to sleep

floral notch
#

You can also try to use a proper predicate file.

The container subpredicate can do quite a few complex checks

floral notch
#

If you have a shapeless recipe, you can quite easily do this using a predicate.

If it is shaped, you could try to use beet to generate the predicates for you using python.

It would be an any_of with however many configurations you can fit in a 3x9 grid (if you are using a barrel/chest)

#
    "condition": "minecraft:location_check",
    "predicate": {
        "block": {
            "predicates": {
                "minecraft:container": {
                    "items": {
                        "contains": [],
                        "count": [
                            {
                                "test": {
                                    "items": "#minecraft:sand"
                                },
                                "count": 5
                            },
                            {
                                "test": {
                                    "items": "minecraft:gunpowder"
                                },
                                "count": 4
                            }
                        ]
                    }
                }
            }
        }
    }
}```
Above would be true if 5 slots contain a stack of sand (any size) and 4 slots contain gunpowder (any stack size). A shapeless tnt recipe. It would however not be true if I had 5 sand in the first slot and 4 gunpowder in the second slot.
#

for shaped recipes, you must do a check on the components, for shapeless the (sub)predicates are better.

slate grotto
#

o, thank you