tom5454 / Create-Ore-Excavation

Extract resources using machines powered by Rotational Force
https://www.curseforge.com/minecraft/mc-mods/create-ore-excavation
MIT License
18 stars 21 forks source link

Same ore different fluid recipes not working. #104

Closed MisterZam closed 2 months ago

MisterZam commented 3 months ago

Okay so I have discovered a bug (probably). I have a kubejs script that allows me to have 2 different recipes of the same vein but different fluids. The JEI shows both recipes, but the physical drilling machine automatically selects 1 only. I will post the kubejs script after this and the proof.

MisterZam commented 3 months ago
function veinCreation(veinName, output, spacing, separation, salt, id, veinSize1, veinSize2){
    if(veinSize1 == undefined && veinSize2 == undefined){
        event.recipes.createoreexcavation.vein(veinName, output).placement(spacing, separation, salt).alwaysInfinite().id(id)
    } else {
        event.recipes.createoreexcavation.vein(veinName, output).placement(spacing, separation, salt).alwaysFinite().veinSize(veinSize1, veinSize2).id(id)
    }
}   veinCreation('Carbon Vein', 'minecraft:diamond', 7, 6, 64825185, 'createoreexcavation:carbon_vein', 0.032, 0.064)

function oreDrillSpecial(output1, output2, id, ticks, stress, fluid){
    event.recipes.createoreexcavation.drilling([Item.of(output1), Item.of(output2).withChance(0.25)], id, ticks/2).drill('createoreexcavation:drill').stress(stress/32).fluid('minecraft:water '+fluid)
    event.recipes.createoreexcavation.drilling([Item.of(output1), Item.of(output2).withChance(0.25)], id, ticks/3).drill('createoreexcavation:diamond_drill').stress(stress/32).fluid('minecraft:water '+fluid)
    event.recipes.createoreexcavation.drilling([Item.of(output1), Item.of(output2).withChance(0.25)], id, ticks/4).drill('createoreexcavation:netherite_drill').stress(stress/32).fluid('minecraft:water '+fluid)
    event.recipes.createoreexcavation.drilling([Item.of(output1, 3), Item.of(output2, 3).withChance(0.25)], id, ticks).drill('createoreexcavation:drill').stress((stress*1.5)/32).fluid('minecraft:lava '+fluid)
    event.recipes.createoreexcavation.drilling([Item.of(output1, 3), Item.of(output2, 3).withChance(0.25)], id, ticks/2).drill('createoreexcavation:diamond_drill').stress((stress*1.5)/32).fluid('minecraft:lava '+fluid)
    event.recipes.createoreexcavation.drilling([Item.of(output1, 3), Item.of(output2, 3).withChance(0.25)], id, ticks/3).drill('createoreexcavation:netherite_drill').stress((stress*1.5)/32).fluid('minecraft:lava '+fluid)
}   oreDrillSpecial('minecraft:coal', 'createoreexcavation:raw_diamond', 'createoreexcavation:carbon_vein', 60, 512, 500)

![Uploading COE Bug.png…]()

MisterZam commented 3 months ago

The drilling machine has water inside of it but for some reason it requires 768 SU instead of 512 SU. For reference, 768 SU is for the one with the lava as input and 512 for the water as input. 768 SU because of the additional 50% increase stress based from the code. Is this a bug or a missed opportunity? Hoping for a positive reply <3

MisterZam commented 3 months ago

anyways so I tested again my code. Both have the same stress but still it automatically chooses 1 recipe. I hope it chooses recipe based on whats inside the drilling machine (fluid, drill) and correctly outputs based on that specific recipe.

M0nkeyPr0grammer commented 2 months ago

I get a similar issues, when having multiple Resources within one vein, it takes in the first resource, but doesn't allow production of any of the other resources within that vein. Attached is my code for the Veins and Drilling Resources that I created

DrillingResources.txt Veins.txt

tom5454 commented 2 months ago

The recipes have a priority field, higher priority recipes will be used if the drilling machine has the correct inputs (drill type and drilling fluid).

In the readme there is an example:

//Coal vein with 5% chance for diamond and require a diamond drill and lava for drilling
//Always finite 5x-8x base
//Use .priority(<value>) for duplicate recipes with different inputs, higher values take priority
event.recipes.createoreexcavation.vein('{"text": "My coal vein"}', 'minecraft:coal')
    .placement(128, 32, 64457512).alwaysFinite().veinSize(5, 8).id("kubejs:my_coal_vein")
event.recipes.createoreexcavation.drilling('minecraft:coal', 'kubejs:my_coal_vein', 1000).id("kubejs:my_coal1");
event.recipes.createoreexcavation.drilling([Item.of('minecraft:coal_block'), Item.of('minecraft:diamond').withChance(0.05)], 'kubejs:my_coal_vein', 500)
    .drill('createoreexcavation:diamond_drill').fluid('minecraft:lava').priority(1).id("kubejs:my_coal2");

The second recipe will be picked if the machine as lava and a diamond tagged drill.