JoeFoxe / Hexerei-1.19

0.2.1 update (the book)
12 stars 21 forks source link

Make Mixing Cauldron Bottle Empty/Filling Data Driven #99

Closed vertexcubed closed 1 month ago

vertexcubed commented 1 month ago

This PR allows for right click filling/emptying interactions to be defined by JSON, in the form of recipes. hexerei:cauldron_filling fills the cauldron with fluid, while hexerei:cauldron_emptying empties the cauldron of some fluid. This makes it significantly easier to add new right click interactions for the mixing cauldron, for both modders and modpack developers.

Examples:

Recipe to fill the cauldron with water from a water bottle.

{
    "type": "hexerei:cauldron_filling",
    "input": {
        "item": "minecraft:potion",
        "nbt": {
            "Potion": "minecraft:water"
        }
    },
    "output": {
        "item": "minecraft:glass_bottle",
        "count": 1
    },
    "fluid": {
        "fluid": "minecraft:water",
        "amount": 250
    }
}

Water to empty water from the cauldron into a water bottle.

{
    "type": "hexerei:cauldron_emptying",
    "input": {
        "item": "minecraft:glass_bottle"
    },
    "fluid": {
        "fluid": "minecraft:water",
        "amount": 250
    },
    "output": {
        "item": "minecraft:potion",
        "count": 1,
        "nbt": {
            "Potion": "minecraft:water"
        }
    }
}

This PR also modifies the BottlingRecipeCategory JEI category to use emptying recipes. No filling recipe JEI category was made as it didn't seem necessary. The PR also makes a minor change, changing the sound when you empty the cauldron into a glass bottle from SoundEvents.BOTTLE_EMPTY to SoundEvents.BOTTLE_FILL (I assumed this was a bug).

Note: I didn't delete the BottlingRecipeJEI class, but it now has no uses and is safe to be deleted. Also, I decided to split it into two recipes as there may be an instance where it is desired for the resulting item from each direction of interaction to be different (Create has a similar system that does this too, though this code is not based on Create's).

JoeFoxe commented 1 month ago

Thank you again for this!!