From 5c5988f8a768561a8a38b213d4d84bf4237d8478 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Mon, 19 Oct 2020 20:30:55 +0200 Subject: [PATCH] fixed the spring causing an overflow if connected to an overeager pipe --- .../naturesaura/blocks/tiles/TileEntitySpring.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntitySpring.java b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntitySpring.java index 391e85e9..f94ba6b8 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntitySpring.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntitySpring.java @@ -143,17 +143,17 @@ public class TileEntitySpring extends TileEntityImpl implements ITickableTileEnt private class InfiniteTank implements IFluidTank { @Override public FluidStack getFluid() { - return new FluidStack(Fluids.WATER, Integer.MAX_VALUE); + return new FluidStack(Fluids.WATER, 1000); } @Override public int getFluidAmount() { - return Integer.MAX_VALUE; + return 1000; } @Override public int getCapacity() { - return Integer.MAX_VALUE; + return 1000; } @Override @@ -168,9 +168,10 @@ public class TileEntitySpring extends TileEntityImpl implements ITickableTileEnt @Override public FluidStack drain(int maxDrain, IFluidHandler.FluidAction action) { + int drain = Math.min(maxDrain, 1000); if (action.execute()) - TileEntitySpring.this.consumeAura(2 * maxDrain); - return new FluidStack(Fluids.WATER, maxDrain); + TileEntitySpring.this.consumeAura(2 * drain); + return new FluidStack(Fluids.WATER, drain); } @Override