Fixed another edge case

This commit is contained in:
Alexander Anishin authored and Martin Robertz committed 2023-12-22 22:53:21 +01:00
1 parent 3286c10be9
commit 8845ff4a2d
1 file changed
+9 -3
@@ -633,14 +633,20 @@ public class TileEssentiaCompressor extends SynchronizedTileEntity
@Override
public boolean doesContainerAccept(Aspect aspect) {
return this.isMultiblockFormed() && this.isAccessPoint() && this.canAccept(aspect);
if (this.isMultiblockFormed() && this.isAccessPoint()) {
TileEssentiaCompressor master = tryFindMasterTile();
if (master != null) {
return master.canAccept(aspect);
}
}
return false;
}
@Override
public int addToContainer(Aspect aspect, int amount) {
if (this.doesContainerAccept(aspect) && this.canAccept(aspect)) {
if (this.isMultiblockFormed() && this.isAccessPoint()) {
TileEssentiaCompressor master = this.tryFindMasterTile();
if (master == null) return 0;
if (master == null || !master.canAccept(aspect)) return amount;
int available = master.currentStorageSize() - master.al.getAmount(aspect);
if (available <= 0) return amount;
int amountToAdd = Math.min(amount, available);