Added spotless back and reformatted
This commit is contained in:
@@ -1,14 +1,16 @@
|
||||
|
||||
package appeng.tile.inventory;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import alexiil.mc.lib.attributes.Simulation;
|
||||
import alexiil.mc.lib.attributes.item.filter.ItemFilter;
|
||||
import alexiil.mc.lib.attributes.item.impl.DelegatingFixedItemInv;
|
||||
import appeng.core.Api;
|
||||
|
||||
import appeng.api.storage.cells.ICellInventory;
|
||||
import appeng.api.storage.cells.ICellInventoryHandler;
|
||||
import appeng.core.Api;
|
||||
import appeng.util.inv.IAEAppEngInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class AppEngCellInventory extends DelegatingFixedItemInv {
|
||||
private static final ItemFilter CELL_FILTER = stack -> !stack.isEmpty()
|
||||
|
||||
@@ -23,13 +23,14 @@ import java.util.Iterator;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
|
||||
import alexiil.mc.lib.attributes.ListenerRemovalToken;
|
||||
import alexiil.mc.lib.attributes.ListenerToken;
|
||||
import alexiil.mc.lib.attributes.Simulation;
|
||||
import alexiil.mc.lib.attributes.item.FixedItemInv;
|
||||
import alexiil.mc.lib.attributes.item.InvMarkDirtyListener;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
|
||||
import appeng.api.storage.channels.IItemStorageChannel;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
@@ -124,7 +125,8 @@ public class AppEngInternalAEInventory implements FixedItemInv, Iterable<ItemSta
|
||||
return false;
|
||||
}
|
||||
|
||||
// FIXME: We need to implement the actual checks here, stacking /caninsert/canremove
|
||||
// FIXME: We need to implement the actual checks here, stacking
|
||||
// /caninsert/canremove
|
||||
if (true) {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
@@ -134,8 +136,7 @@ public class AppEngInternalAEInventory implements FixedItemInv, Iterable<ItemSta
|
||||
}
|
||||
|
||||
ItemStack oldStack = this.getInvStack(slot).copy();
|
||||
this.inv[slot] = Api.instance().storage().getStorageChannel(IItemStorageChannel.class)
|
||||
.createStack(to);
|
||||
this.inv[slot] = Api.instance().storage().getStorageChannel(IItemStorageChannel.class).createStack(to);
|
||||
|
||||
ItemStack newStack = to.copy();
|
||||
InvOperation op = InvOperation.SET;
|
||||
|
||||
@@ -18,6 +18,12 @@
|
||||
|
||||
package appeng.tile.inventory;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
|
||||
import alexiil.mc.lib.attributes.Simulation;
|
||||
import alexiil.mc.lib.attributes.item.FixedItemInv;
|
||||
import alexiil.mc.lib.attributes.item.LimitedFixedItemInv;
|
||||
@@ -25,15 +31,11 @@ import alexiil.mc.lib.attributes.item.compat.FixedInventoryVanillaWrapper;
|
||||
import alexiil.mc.lib.attributes.item.filter.ConstantItemFilter;
|
||||
import alexiil.mc.lib.attributes.item.filter.ItemFilter;
|
||||
import alexiil.mc.lib.attributes.item.impl.DirectFixedItemInv;
|
||||
|
||||
import appeng.util.Platform;
|
||||
import appeng.util.inv.IAEAppEngInventory;
|
||||
import appeng.util.inv.InvOperation;
|
||||
import appeng.util.inv.filter.IAEItemFilter;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
|
||||
// FIXME: the filtering is not correctly implemented and need to be reworked
|
||||
public class AppEngInternalInventory extends DirectFixedItemInv implements Iterable<ItemStack> {
|
||||
@@ -68,20 +70,18 @@ public class AppEngInternalInventory extends DirectFixedItemInv implements Itera
|
||||
LimitedFixedItemInv limitedFixedInv = this.createLimitedFixedInv();
|
||||
for (int i = 0; i < getSlotCount(); i++) {
|
||||
final int slot = i;
|
||||
limitedFixedInv.getRule(i)
|
||||
.filterExtracts(stack -> filter.allowExtract(this, slot, stack.getCount()));
|
||||
limitedFixedInv.getRule(i)
|
||||
.filterInserts(stack -> {
|
||||
if (stack.isEmpty()) {
|
||||
ItemStack current = this.getInvStack(slot);
|
||||
if (current.isEmpty()) {
|
||||
return true; // Replacing empty with empty... okay
|
||||
}
|
||||
return filter.allowExtract(this, slot, current.getCount());
|
||||
} else {
|
||||
return filter.allowInsert(this, slot, stack);
|
||||
limitedFixedInv.getRule(i).filterExtracts(stack -> filter.allowExtract(this, slot, stack.getCount()));
|
||||
limitedFixedInv.getRule(i).filterInserts(stack -> {
|
||||
if (stack.isEmpty()) {
|
||||
ItemStack current = this.getInvStack(slot);
|
||||
if (current.isEmpty()) {
|
||||
return true; // Replacing empty with empty... okay
|
||||
}
|
||||
});
|
||||
return filter.allowExtract(this, slot, current.getCount());
|
||||
} else {
|
||||
return filter.allowInsert(this, slot, stack);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return limitedFixedInv;
|
||||
|
||||
Reference in New Issue
Block a user