Exporter in fluid mode no longer duplicates fluids that are less than 1 bucket, fixes #369

This commit is contained in:
Raoul Van den Berge
2016-09-20 17:22:40 +02:00
parent a16898231a
commit 4323f872cf
3 changed files with 14 additions and 7 deletions

View File

@@ -8,6 +8,7 @@
- Added Disk Manipulator (way2muchnoise) - Added Disk Manipulator (way2muchnoise)
- Added ingame config (way2muchnoise) - Added ingame config (way2muchnoise)
- When a machine is in use by a crafting pattern, inserting of items from other patterns will be avoided (raoulvdberge) - When a machine is in use by a crafting pattern, inserting of items from other patterns will be avoided (raoulvdberge)
- Exporter in fluid mode no longer duplicates fluids that are less than 1 bucket (raoulvdberge)
- Updated Dutch translation (raoulvdberge) - Updated Dutch translation (raoulvdberge)
### 1.0.4 ### 1.0.4

View File

@@ -84,13 +84,19 @@ public class TileExporter extends TileMultipartNode implements IComparable, ITyp
if (handler != null) { if (handler != null) {
for (FluidStack stack : fluidFilters.getFluids()) { for (FluidStack stack : fluidFilters.getFluids()) {
if (stack != null) { if (stack != null) {
FluidStack took = network.extractFluid(stack, Fluid.BUCKET_VOLUME, compare); FluidStack stackInStorage = network.getFluidStorage().get(stack, compare);
if (took != null) { if (stackInStorage != null) {
int remainder = Fluid.BUCKET_VOLUME - handler.fill(took, true); int toExtract = Math.min(Fluid.BUCKET_VOLUME, stackInStorage.amount);
if (remainder > 0) { FluidStack took = network.extractFluid(stack, toExtract, compare);
network.insertFluid(took, remainder, false);
if (took != null) {
int remainder = toExtract - handler.fill(took, true);
if (remainder > 0) {
network.insertFluid(took, remainder, false);
}
} }
} }
} }

View File

@@ -22,9 +22,9 @@ public enum RedstoneMode {
return world.isBlockPowered(pos); return world.isBlockPowered(pos);
case LOW: case LOW:
return !world.isBlockPowered(pos); return !world.isBlockPowered(pos);
default:
return false;
} }
return false;
} }
public void write(NBTTagCompound tag) { public void write(NBTTagCompound tag) {