Applied Energistics 2

Applied Energistics 2

137M Downloads

Fluid export is limited to 26512.1437... buckets (INT_MAX / 81000)

9p4 opened this issue ยท 0 comments

commented

Describe the bug

When extracting more than 26.5k buckets from the ME system (autocrafting), the autocraft fails due to a limit imposed in

var extractAmount = Math.min(Integer.MAX_VALUE, amount);

How to reproduce the bug

Have a fluid storage cell with more than 27k buckets of fluid in it. Create a crafting job that uses more than 26.5k buckets of that fluid (ie lava -> obsidian).

Expected behavior

There shouldn't be an artificial limit imposed on the system.

Additional details

Discord transcript:

[12:57 PM] ษ™๐–—๐–˜๐–Šษช : I'm getting this strange error some ingredients could not be extracted from the network
[12:58 PM] ษ™๐–—๐–˜๐–Šษช : Image
[12:59 PM] ษ™๐–—๐–˜๐–Šษช : i have a machine that makes obsidian and I have roughly 110k buckets of lava in my system
[12:59 PM] ษ™๐–—๐–˜๐–Šษช : there is enough space in the crafting storage
[12:59 PM] ษ™๐–—๐–˜๐–Šษช : (its just a 256k crafting cpu)
[12:59 PM] ษ™๐–—๐–˜๐–Šษช : and im setting it to craft 80k obsidian
[1:01 PM] Sire Denathrius : are you using storage bus to see lava in your system?
[1:01 PM] Sire Denathrius : check if you storage bus' extraction option
[1:01 PM] Sire Denathrius : or the fluid tank you store in it
[1:02 PM] ษ™๐–—๐–˜๐–Šษช : nope the lava is stored in one 16k fluid storage drive
[1:02 PM] ษ™๐–—๐–˜๐–Šษช : Image
[1:03 PM] ษ™๐–—๐–˜๐–Šษช : Image
[1:05 PM] Sire Denathrius : i see you configured your cell maybe you accidentally set it insert only
[1:06 PM] ษ™๐–—๐–˜๐–Šษช : adding coprocessors doesn't help
[1:06 PM] Sire Denathrius : cpus are not the case
[1:06 PM] Sire Denathrius : system cannot extract the lava
[1:06 PM] ษ™๐–—๐–˜๐–Šษช : it can extract the lava though
[1:06 PM] Sire Denathrius : can you manually extract with bucket ?
[1:06 PM] Sire Denathrius : ๐Ÿค”
[1:06 PM] ษ™๐–—๐–˜๐–Šษช : as long as i keep the requested amount low
[1:07 PM] ษ™๐–—๐–˜๐–Šษช : i can do it in batches of 10k obsidian at a time and the lava level decreases from the cell
[1:07 PM] ษ™๐–—๐–˜๐–Šษช : i can bucket out lava
[1:07 PM] ษ™๐–—๐–˜๐–Šษช : but i can't do more than about 17k obsidian at a time
[1:07 PM] Sire Denathrius : i think it has problem with bytes
[1:08 PM] ษ™๐–—๐–˜๐–Šษช : how so
[1:08 PM] Sire Denathrius : because using 1 type of item in storage cells cost less than using multible types in storage cells
[1:09 PM] ษ™๐–—๐–˜๐–Šษช : so do i need more crafting cpu?
[1:09 PM] ษ™๐–—๐–˜๐–Šษช : or a bigger lava storage cell
[1:09 PM] Sire Denathrius : i thing storage cell is the problem
[1:10 PM] Sire Denathrius : try bigger storage cells i think
[1:10 PM] Sire Denathrius : it is very strange issue
[1:12 PM] ษ™๐–—๐–˜๐–Šษช : so should i add another 16k drive and have it configured to store lava?
[1:12 PM] ษ™๐–—๐–˜๐–Šษช : or should i make this drive bigger
[1:12 PM] ษ™๐–—๐–˜๐–Šษช : (coz it took some time n effort to get that much lava in the system in the first place)
[1:13 PM] Random : don't forget cyclic sack of holding, if we're making a list of trivial ways to move blocks
[1:20 PM] ษ™๐–—๐–˜๐–Šษช : is it possible to move fluids from one fluid cell into another bigger cell fast
[1:23 PM] 90 [MEGA] : yes, with an ME IO Port
[1:24 PM] ษ™๐–—๐–˜๐–Šษช : @Sire Denathrius ive moved to a 64k storage drive and the issue still persists
[1:24 PM] ษ™๐–—๐–˜๐–Šษช : interesting thing was that the number was lower when the lava was distributed over multiple cells
[1:26 PM] Sire Denathrius : ๐Ÿค” ๐Ÿค”
[1:30 PM] ษ™๐–—๐–˜๐–Šษช : so the error is coming from src/main/java/appeng/crafting/execution/CraftingCpuHelper.java where it checks to see if the extracted storage is the same as the requested storage
[1:30 PM] ษ™๐–—๐–˜๐–Šษช : and if not, return the missing ingredients
[1:40 PM] ษ™๐–—๐–˜๐–Šษช : perhaps a dev can come help out?
[1:43 PM] ษ™๐–—๐–˜๐–Šษช : i can only extract a maximum of 26512.144 lava when using a crafting cpu
[1:48 PM] Sire Denathrius : @Technici4n sory to ping you but can you help if you free pls
[1:48 PM] ษ™๐–—๐–˜๐–Šษช : (but u gotta use whole numbers so 26512 items max)
[1:48 PM] ษ™๐–—๐–˜๐–Šษช : i'm poking around the source code and see everything is stored as a long
[1:48 PM] ษ™๐–—๐–˜๐–Šษช : so are fluids stored as millibuckets?
[1:49 PM] Technici4n : how are you storing the lava?
[1:50 PM] Technici4n : are you on fabric? I think we have a "hardcoded" limit of 26.5k buckets extracted at once... can you confirm?
[1:50 PM] Technici4n : (it's an accidental limit, essentially MAX_INT / 81000)
[1:51 PM] ษ™๐–—๐–˜๐–Šษช : I am on fabric
[1:51 PM] ษ™๐–—๐–˜๐–Šษช : ^^
[1:51 PM] ษ™๐–—๐–˜๐–Šษช : lava is being stored in fluid cells
[1:52 PM] Sire Denathrius : this reminds me something ๐Ÿค”
[1:52 PM] ษ™๐–—๐–˜๐–Šษช : seems like that's the issue
[1:53 PM] ษ™๐–—๐–˜๐–Šษช : where is that limit in the code
[1:53 PM] Technici4n :

    @Override
    public long extract(AEKey what, long amount, Actionable mode, IActionSource source) {
        // To avoid long-overflow on the extracting callers side
        var extractAmount = Math.min(Integer.MAX_VALUE, amount);

๐Ÿ˜…
[1:54 PM] Technici4n : been like this for a year, oops
[1:54 PM] Technici4n : would you mind opening an issue? thanks a lot for the ping, sadly I can't fix it rn
[1:54 PM] ษ™๐–—๐–˜๐–Šษช : should it be long.max_value or something
[1:54 PM] Technici4n : there's no need to do Math.min, but I want a proper test
[1:54 PM] Technici4n : so don't PR if you're not going to add a test with it
[1:55 PM] ษ™๐–—๐–˜๐–Šษช : alright thanks!
[1:55 PM] Technici4n : or actually? if you're feeling motivated you can add the test in src/test/java/appeng/me/cells/BasicInventoryTest.java
[1:56 PM] ษ™๐–—๐–˜๐–Šษช : is it junit 4?
[1:57 PM] Technici4n : idk, you'll need to import the gradle project and run gradlew runData to have all the models, recipes, etc
[1:57 PM] Technici4n : then you can run the test
[2:00 PM] ษ™๐–—๐–˜๐–Šษช : alright i'll poke around and get that going
[2:01 PM] ษ™๐–—๐–˜๐–Šษช : anything in specific that should be tested for or just being able to extract more than 26.5k buckets
[2:09 PM] Technici4n : yeah anything bigger than max int

Which minecraft version are you using?

1.18

On which mod loaders does it happen?

Fabric

Crash log

N/A