mirror of
https://github.com/GTNewHorizons/AE2FluidCraft-Rework.git
synced 2026-11-16 01:54:59 +00:00
Fix fluid export bus voiding fluids on crafting only mode
The Fluid Export Bus was voiding fluids on craft only mode because it tried to craft it, and decided to continue with the normal export logic: Extract fluid from ME system and fill the tank. Unfortunately, there was a condition that prevented the extracted fluid from going anywhere depending on craft only mode, so it got voided. Commit fixes this by skipping the normal extract logic if set to craft only. It also removes fluid simulation (we will see if they were actually needed. Initial tests indicate no), which should improve performance by a little bit. Signed-off-by: Firenoo <[email protected]>
This commit is contained in:
1 parent
258465a654
commit
df045ec1a8
1 file changed
+15
-19
@@ -119,40 +119,36 @@ public class PartFluidExportBus extends FCSharedFluidBus implements ICraftingReq
|
||||
IAEFluidStack fluid = AEFluidStack
|
||||
.create(ItemFluidPacket.getFluidStack(getInv().getStackInSlot(slotToExport)));
|
||||
if (fluid != null) {
|
||||
boolean isAllowed = true;
|
||||
|
||||
final IAEFluidStack toExtract = fluid.copy();
|
||||
|
||||
toExtract.setStackSize(this.calculateAmountToSend());
|
||||
|
||||
fluid.setStackSize(this.calculateAmountToSend());
|
||||
if (this.craftOnly()) {
|
||||
isAllowed = this.craftingTracker.handleCrafting(
|
||||
this.didSomething = this.craftingTracker.handleCrafting(
|
||||
i,
|
||||
toExtract.getStackSize(),
|
||||
ItemFluidDrop.newAeStack(toExtract),
|
||||
fluid.getStackSize(),
|
||||
ItemFluidDrop.newAeStack(fluid),
|
||||
destination,
|
||||
this.getTile().getWorldObj(),
|
||||
this.getProxy().getGrid(),
|
||||
cg,
|
||||
this.source);
|
||||
continue;
|
||||
}
|
||||
|
||||
int space = fh.fill(this.getSide().getOpposite(), toExtract.getFluidStack(), false);
|
||||
toExtract.setStackSize(space);
|
||||
final IAEFluidStack real = inv.extractItems(toExtract, Actionable.MODULATE, this.source);
|
||||
if (real != null && isAllowed) {
|
||||
// Extract from the ME system.
|
||||
final IAEFluidStack real = inv.extractItems(fluid, Actionable.MODULATE, this.source);
|
||||
if (real != null) {
|
||||
int realInserted = fh.fill(this.getSide().getOpposite(), real.getFluidStack(), true);
|
||||
if (realInserted < real.getStackSize()) {
|
||||
toExtract.setStackSize(real.getStackSize() - realInserted);
|
||||
inv.injectItems(toExtract, Actionable.MODULATE, this.source);
|
||||
// Could not use the entirety of the amount we extracted, so put it back.
|
||||
fluid.setStackSize(real.getStackSize() - realInserted);
|
||||
inv.injectItems(fluid, Actionable.MODULATE, this.source);
|
||||
}
|
||||
this.fluidToSend -= realInserted;
|
||||
didSomething = true;
|
||||
} else if (this.isCraftingEnabled()) {
|
||||
this.craftingTracker.handleCrafting(
|
||||
// If we didn't send anything, try crafting it if we can.
|
||||
this.didSomething = this.craftingTracker.handleCrafting(
|
||||
i,
|
||||
toExtract.getStackSize(),
|
||||
ItemFluidDrop.newAeStack(toExtract),
|
||||
fluid.getStackSize(),
|
||||
ItemFluidDrop.newAeStack(fluid),
|
||||
destination,
|
||||
this.getTile().getWorldObj(),
|
||||
this.getProxy().getGrid(),
|
||||
|
||||
Reference in new issue
Block a user