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);
|
return super.getCapability(cap, side);
|
||||||
}
|
}
|
||||||
|
|
||||||
class InterfaceFluidHandler implements IFluidHandler {
|
public class InterfaceFluidHandler implements IFluidHandler {
|
||||||
|
|
||||||
private IFluidHandler wrapped;
|
private IFluidHandler wrapped;
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ public class PortableFluidInterfaceTileEntity extends PortableStorageInterfaceTi
|
||||||
return 0;
|
return 0;
|
||||||
int fill = wrapped.fill(resource, action);
|
int fill = wrapped.fill(resource, action);
|
||||||
if (fill > 0 && action.execute())
|
if (fill > 0 && action.execute())
|
||||||
onContentTransferred();
|
keepAlive();
|
||||||
return fill;
|
return fill;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -95,7 +95,7 @@ public class PortableFluidInterfaceTileEntity extends PortableStorageInterfaceTi
|
||||||
return FluidStack.EMPTY;
|
return FluidStack.EMPTY;
|
||||||
FluidStack drain = wrapped.drain(resource, action);
|
FluidStack drain = wrapped.drain(resource, action);
|
||||||
if (!drain.isEmpty() && action.execute())
|
if (!drain.isEmpty() && action.execute())
|
||||||
onContentTransferred();
|
keepAlive();
|
||||||
return drain;
|
return drain;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,10 +104,14 @@ public class PortableFluidInterfaceTileEntity extends PortableStorageInterfaceTi
|
||||||
if (!canTransfer())
|
if (!canTransfer())
|
||||||
return FluidStack.EMPTY;
|
return FluidStack.EMPTY;
|
||||||
FluidStack drain = wrapped.drain(maxDrain, action);
|
FluidStack drain = wrapped.drain(maxDrain, action);
|
||||||
if (!drain.isEmpty() && (action.execute() || drain.getAmount() == 1))
|
if (!drain.isEmpty() && action.execute())
|
||||||
onContentTransferred();
|
keepAlive();
|
||||||
return drain;
|
return drain;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void keepAlive() {
|
||||||
|
onContentTransferred();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,7 @@ import java.util.function.Supplier;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
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.content.contraptions.fluids.PipeConnection.Flow;
|
||||||
import com.simibubi.create.foundation.fluid.FluidHelper;
|
import com.simibubi.create.foundation.fluid.FluidHelper;
|
||||||
import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
|
import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
|
||||||
|
@ -157,6 +158,9 @@ public class FluidNetwork {
|
||||||
source = sourceSupplier.get();
|
source = sourceSupplier.get();
|
||||||
if (!source.isPresent())
|
if (!source.isPresent())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
keepPortableFluidInterfaceEngaged();
|
||||||
|
|
||||||
if (targets.isEmpty())
|
if (targets.isEmpty())
|
||||||
return;
|
return;
|
||||||
for (Pair<BlockFace, LazyOptional<IFluidHandler>> pair : targets) {
|
for (Pair<BlockFace, LazyOptional<IFluidHandler>> pair : targets) {
|
||||||
|
@ -252,6 +256,15 @@ public class FluidNetwork {
|
||||||
// .colored(0xfaaa33);
|
// .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() {
|
public void reset() {
|
||||||
frontier.clear();
|
frontier.clear();
|
||||||
visited.clear();
|
visited.clear();
|
||||||
|
|
Loading…
Reference in a new issue