mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-28 16:06:48 +01:00
Finding bugs explaining things
- The portable fluid interface now waits until extracting pipes have completed their flow before disengaging
This commit is contained in:
parent
1bab1bc6d3
commit
91bc678ab4
2 changed files with 22 additions and 5 deletions
|
@ -51,7 +51,7 @@ public class PortableFluidInterfaceTileEntity extends PortableStorageInterfaceTi
|
|||
return super.getCapability(cap, side);
|
||||
}
|
||||
|
||||
class InterfaceFluidHandler implements IFluidHandler {
|
||||
public class InterfaceFluidHandler implements IFluidHandler {
|
||||
|
||||
private IFluidHandler wrapped;
|
||||
|
||||
|
@ -85,7 +85,7 @@ public class PortableFluidInterfaceTileEntity extends PortableStorageInterfaceTi
|
|||
return 0;
|
||||
int fill = wrapped.fill(resource, action);
|
||||
if (fill > 0 && action.execute())
|
||||
onContentTransferred();
|
||||
keepAlive();
|
||||
return fill;
|
||||
}
|
||||
|
||||
|
@ -95,7 +95,7 @@ public class PortableFluidInterfaceTileEntity extends PortableStorageInterfaceTi
|
|||
return FluidStack.EMPTY;
|
||||
FluidStack drain = wrapped.drain(resource, action);
|
||||
if (!drain.isEmpty() && action.execute())
|
||||
onContentTransferred();
|
||||
keepAlive();
|
||||
return drain;
|
||||
}
|
||||
|
||||
|
@ -104,11 +104,15 @@ public class PortableFluidInterfaceTileEntity extends PortableStorageInterfaceTi
|
|||
if (!canTransfer())
|
||||
return FluidStack.EMPTY;
|
||||
FluidStack drain = wrapped.drain(maxDrain, action);
|
||||
if (!drain.isEmpty() && (action.execute() || drain.getAmount() == 1))
|
||||
onContentTransferred();
|
||||
if (!drain.isEmpty() && action.execute())
|
||||
keepAlive();
|
||||
return drain;
|
||||
}
|
||||
|
||||
public void keepAlive() {
|
||||
onContentTransferred();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ import java.util.function.Supplier;
|
|||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import com.simibubi.create.content.contraptions.components.actors.PortableFluidInterfaceTileEntity.InterfaceFluidHandler;
|
||||
import com.simibubi.create.content.contraptions.fluids.PipeConnection.Flow;
|
||||
import com.simibubi.create.foundation.fluid.FluidHelper;
|
||||
import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
|
||||
|
@ -157,6 +158,9 @@ public class FluidNetwork {
|
|||
source = sourceSupplier.get();
|
||||
if (!source.isPresent())
|
||||
return;
|
||||
|
||||
keepPortableFluidInterfaceEngaged();
|
||||
|
||||
if (targets.isEmpty())
|
||||
return;
|
||||
for (Pair<BlockFace, LazyOptional<IFluidHandler>> pair : targets) {
|
||||
|
@ -252,6 +256,15 @@ public class FluidNetwork {
|
|||
// .colored(0xfaaa33);
|
||||
// }
|
||||
|
||||
private void keepPortableFluidInterfaceEngaged() {
|
||||
IFluidHandler handler = source.orElse(null);
|
||||
if (!(handler instanceof InterfaceFluidHandler))
|
||||
return;
|
||||
if (frontier.isEmpty())
|
||||
return;
|
||||
((InterfaceFluidHandler) handler).keepAlive();
|
||||
}
|
||||
|
||||
public void reset() {
|
||||
frontier.clear();
|
||||
visited.clear();
|
||||
|
|
Loading…
Reference in a new issue