oierbravo / createsifter

Create Sifter mod for Forge
MIT License
5 stars 17 forks source link

Custom recipes not working as expected #13

Closed ClaudiusMinimus closed 1 year ago

ClaudiusMinimus commented 1 year ago

I am very excited to have found your mod and am working on a new pack that will use it.

I wrote a script to loop over some .json to add a lot of sifting recipes and found only a few recipes worked. Initially I thought there may be something wrong with my script, so I hard coded the following example. What is interesting is the only two recipes to work (even though they show correctly in JEI) were the acacia sapling and the amethyst, but only one or the other and not both at the same time. I could only determine something is going on with the mod. I have included screenshots of the below recipes in JEI, the kubejs log kubejs log server.txt (there are two errors in the server.txt pointing to built in recipes). latest.log, debug.log, and the list of mods used in the pack are at the bottom.

ServerEvents.recipes(event => {

    event.recipes.createsifterSifting([Item.of('minecraft:acacia_sapling').withChance(0.20).toJson()], ['createsifter:string_mesh','minecraft:dirt']);
    event.recipes.createsifterSifting([Item.of('minecraft:bamboo').withChance(0.20).toJson()], ['createsifter:string_mesh','minecraft:dirt']);
    event.recipes.createsifterSifting([Item.of('minecraft:birch_sapling').withChance(0.20).toJson()], ['createsifter:string_mesh','minecraft:dirt']);
    event.recipes.createsifterSifting([Item.of('minecraft:dark_oak_sapling').withChance(0.20).toJson()], ['createsifter:string_mesh','minecraft:dirt']);
    event.recipes.createsifterSifting([Item.of('minecraft:jungle_sapling').withChance(0.20).toJson()], ['createsifter:string_mesh','minecraft:dirt']);
    event.recipes.createsifterSifting([Item.of('minecraft:oak_sapling').withChance(0.20).toJson()], ['createsifter:string_mesh','minecraft:dirt']);
    event.recipes.createsifterSifting([Item.of('minecraft:spruce_sapling').withChance(0.20).toJson()], ['createsifter:string_mesh','minecraft:dirt']);
    event.recipes.createsifterSifting([Item.of('minecraft:amethyst_shard').withChance(0.20).toJson()], ['createsifter:string_mesh','minecraft:dirt']);
    as

});

image image image image image

List of Mods

I look forward to hearing from you!

Thank you, CM

ClaudiusMinimus commented 1 year ago

I think I found the issue, but won't know until I do a bit more testing, I have been testing a lot today. However, I won't be able to post the results until tomorrow. Just wanted to give you a heads-up!

ClaudiusMinimus commented 1 year ago

I believe there are two issues:

  1. If an unobtainable block/item is in the script, then the entire script fails without any errors.
  2. Adding sift-able items seems more reliable using a datapack and not event.recipes.createsifterSifting(...)
oierbravo commented 1 year ago

Hi! Very happy to know about your excitement! To the kubejs integration you need to put every output in the same recipe. Like in the datapack recipe (kind of).

ServerEvents.recipes(event => {
    event.recipes.createsifterSifting([
        Item.of('minecraft:acacia_sapling').withChance(0.20).toJson(),
        Item.of('minecraft:bamboo').withChance(0.20).toJson(),
        Item.of('minecraft:birch_sapling').withChance(0.20).toJson(),
        Item.of('minecraft:dark_oak_sapling').withChance(0.20).toJson(),
        Item.of('minecraft:dark_oak_sapling').withChance(0.20).toJson(),
        Item.of('minecraft:jungle_sapling').withChance(0.20).toJson(),
        Item.of('minecraft:jungle_sapling').withChance(0.20).toJson(),
        Item.of('minecraft:oak_sapling').withChance(0.20).toJson(),
        Item.of('minecraft:spruce_sapling').withChance(0.20).toJson(),
        Item.of('minecraft:amethyst_shard').withChance(0.20).toJson()
    ], ['createsifter:string_mesh','minecraft:dirt']);
});
oierbravo commented 1 year ago

About the item error, I think it's a kubejs thing.

ClaudiusMinimus commented 1 year ago

Thanks for the insight!