Fix ME Interface deadlocking (#478)
This commit is contained in:
@@ -224,8 +224,8 @@ public class DualityFluidInterface implements IGridTickable, IStorageMonitorable
|
||||
this.items.setInternal(this.gridProxy.getStorage().getInventory(AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class)));
|
||||
this.fluids.setInternal(this.gridProxy.getStorage().getInventory(AEApi.instance().storage().getStorageChannel(IFluidStorageChannel.class)));
|
||||
} catch (final GridAccessException gae) {
|
||||
this.items.setInternal(new NullInventory<IAEItemStack>());
|
||||
this.fluids.setInternal(new NullInventory<IAEFluidStack>());
|
||||
this.items.setInternal(new NullInventory<>());
|
||||
this.fluids.setInternal(new NullInventory<>());
|
||||
}
|
||||
|
||||
this.notifyNeighbors();
|
||||
@@ -491,6 +491,16 @@ public class DualityFluidInterface implements IGridTickable, IStorageMonitorable
|
||||
onFluidInventoryChanged(inv, slot, null, null, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFluidInventoryChanged(final IAEFluidTank inventory, FluidStack added, FluidStack removed) {
|
||||
if (inventory == this.tanks) {
|
||||
if (added != null) {
|
||||
iHost.onStackReturnNetwork(AEFluidStack.fromFluidStack(added));
|
||||
}
|
||||
this.saveChanges();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFluidInventoryChanged(final IAEFluidTank inventory, final int slot, InvOperation operation, FluidStack added, FluidStack removed) {
|
||||
if (this.isWorking == slot) {
|
||||
|
||||
@@ -14,7 +14,7 @@ import java.util.Objects;
|
||||
|
||||
public class AEFluidInventory implements IAEFluidTank {
|
||||
private final IAEFluidStack[] fluids;
|
||||
private final IAEFluidInventory handler;
|
||||
protected final IAEFluidInventory handler;
|
||||
private int capacity;
|
||||
private IFluidTankProperties[] props = null;
|
||||
|
||||
|
||||
@@ -35,8 +35,16 @@ public class AENetworkFluidInventory extends AEFluidInventory {
|
||||
if (overflow != null && overflow.getStackSize() == originAmt) {
|
||||
return super.fill(fluid, doFill);
|
||||
} else if (overflow != null) {
|
||||
if (doFill) {
|
||||
FluidStack added = fluid.copy();
|
||||
added.amount = (int) (fluid.amount - overflow.getStackSize());
|
||||
this.handler.onFluidInventoryChanged(this, added, null);
|
||||
}
|
||||
return (int) (originAmt - overflow.getStackSize());
|
||||
} else {
|
||||
if (doFill) {
|
||||
this.handler.onFluidInventoryChanged(this, fluid, null);
|
||||
}
|
||||
return originAmt;
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -28,4 +28,8 @@ public interface IAEFluidInventory {
|
||||
|
||||
default void onFluidInventoryChanged(final IAEFluidTank inv, final int slot, InvOperation operation, FluidStack added, FluidStack removed) {
|
||||
}
|
||||
|
||||
default void onFluidInventoryChanged(final IAEFluidTank inv, FluidStack added, FluidStack removed) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user