
itemOutputsRanged() with min set to 0 in kubejs makes the ranged output broken
Closed this issue ยท 1 comments
Checked for existing issues
- I have checked for existing issues, and have found none.
Tested latest version
- I have checked that this occurs on the latest version.
GregTech CEu Version
v7.0.2
Minecraft Version
1.20.1 Forge
Recipe Viewer Installed
EMI
Environment
Singleplayer
Cross-Mod Interaction
Yes
Other Installed Mods
Architectury v9.2.14
EMI v1.1.22+1.20.1+forge
GregTech v7.0.2
KubeJS v2001.6.5-build.16
Rhino v2001.2.3-build.10
Expected Behavior
expected itemOutputsRanged(item, 0, 2)
to give between 0 and 2 of item
uniformly, so, for example, to get (on average) 96 iron ingots and 64 gold ingots per 64 of a recipe that outputs from 1-2 iron ingots and 0-2 gold ingots, and to see all the item outputs from the recipe in EMI
Actual Behavior
the output that has the minimum of 0 sometimes appears and sometimes doesn't after a reload, here's an example of when it doesn't:

when it doesn't appear, it also never drops: 1,536 iron ingots (24 stacks) from 1,024 (16 stacks) of the recipe displayed above.
when it does appear, it drops, but definitely not in a uniform way - from 1,024 tests of this recipe:

got: 1,728 iron ingots + 192 gold ingots (exactly 27 and 3 stacks respectively), which, per 64 items is 108 iron ingots and 12 gold ingots.
Steps to Reproduce
- save this script to
kubejs/server_scripts/test.js
:
ServerEvents.recipes(event => {
event.recipes.gtceu.centrifuge("testing")
.itemInputs(Item.of("minecraft:cobblestone"))
.itemOutputsRanged(Item.of("minecraft:iron_ingot"), 1, 2)
.itemOutputsRanged(Item.of("minecraft:gold_ingot"), 0, 2)
.duration(1)
.EUt(1)
})
/reload
- observe how the gold ingot can randomly disappear from the recipe output list after a certain amount of reloads
- run the recipe by centrifuging cobblestone
Additional Information
nothing is broken if the ranged output min is >0