Closed gisellevonbingen closed 1 year ago
I saw ServerThread be paused when called PlatformFluidItemHandler.getTankAmount in fabric. Because occur Infinite loop by 'while (storage.iterator().hasNext())' in below codes. Looks incorrect usage of iterator.
while (storage.iterator().hasNext())
https://github.com/terrarium-earth/Botarium/blob/6c9133a87739175682c49809fde89527bb41deef/fabric/src/main/java/earth/terrarium/botarium/fabric/fluid/FabricFluidHandler.java#L39-L46 https://github.com/terrarium-earth/Botarium/blob/b8cbebf32758abf48b9d22b17fcfbedea81f2b85/fabric/src/main/java/earth/terrarium/botarium/fabric/fluid/FabricFluidItemHandler.java#L53-L60
Must call next() of iterator in loop. This is just example. (Not tested)
next()
@Override public int getTankAmount() { int size = 0; Iterator<StorageView<FluidVariant>> iterator = storage.iterator(); while (iterator.hasNext()) { iterator.next(); size++; } return size; }
Fixed in 1.17.12
I saw ServerThread be paused when called PlatformFluidItemHandler.getTankAmount in fabric. Because occur Infinite loop by '
while (storage.iterator().hasNext())
' in below codes. Looks incorrect usage of iterator.https://github.com/terrarium-earth/Botarium/blob/6c9133a87739175682c49809fde89527bb41deef/fabric/src/main/java/earth/terrarium/botarium/fabric/fluid/FabricFluidHandler.java#L39-L46 https://github.com/terrarium-earth/Botarium/blob/b8cbebf32758abf48b9d22b17fcfbedea81f2b85/fabric/src/main/java/earth/terrarium/botarium/fabric/fluid/FabricFluidItemHandler.java#L53-L60
Must call
next()
of iterator in loop. This is just example. (Not tested)