Snownee / Lychee

Minecraft data-driven in-world crafting mod.
https://www.curseforge.com/minecraft/mc-mods/lychee
28 stars 3 forks source link

Contextual condition checks are run in the wrong position depending on the block face #8

Closed TheInfine closed 2 years ago

TheInfine commented 2 years ago

Mod loader

Forge

Minecraft version

1.18.1

Mod version

1.6.1

Modloader version

39.0.85

Modpack info

No response

If bug:

If bug: The latest.log file

No response

Issue description

I'm trying to make a block interaction recipe possible only if there is no log below the targeted block. This is possible with a contextual condition, execute. There is one problem though. The command is not run exactly where to block is and this results in weird behaviour.

Below is a video demonstration and the recipe file that I'm using.

Demonstration (play it with sound enabled):

https://user-images.githubusercontent.com/98822450/155847859-5a4051ca-faed-4054-a6cc-7998dfaceba6.mp4

Recipe file:

{
    "type": "lychee:block_interacting",
    "item_in": {
        "item": "minecraft:iron_axe"
    },
    "block_in": "minecraft:stripped_oak_log",
    "post": [
        {
            "type": "prevent_default"
        },
        {
            "type": "execute",
            "command": "playsound minecraft:entity.experience_orb.pickup block @a",
            "contextual": {
                "type": "execute",
                "command": "execute unless block ~ ~-1 ~ minecraft:oak_log"
            }
        }
    ]
}
Snownee commented 2 years ago

I will fix this tomorrow. Have you tried using location check? That one will run faster

https://lycheetweaker.readthedocs.io/en/latest/contextual-condition/#location-check-location

TheInfine commented 2 years ago

I didn't realise I could use location check. I should definitely be using that instead. Thanks for telling me.