Pattern Rendering and other Rendering
This commit is contained in:
@@ -19,6 +19,9 @@
|
||||
package appeng.tile.inventory;
|
||||
|
||||
import alexiil.mc.lib.attributes.Simulation;
|
||||
import alexiil.mc.lib.attributes.item.FixedItemInv;
|
||||
import alexiil.mc.lib.attributes.item.LimitedFixedItemInv;
|
||||
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;
|
||||
@@ -61,6 +64,29 @@ public class AppEngInternalInventory extends DirectFixedItemInv implements Itera
|
||||
this.filter = filter;
|
||||
}
|
||||
|
||||
public FixedItemInv createFiltered(IAEItemFilter filter) {
|
||||
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);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return limitedFixedInv;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxAmount(int slot, ItemStack stack) {
|
||||
return Math.min(maxStack[slot], super.getMaxAmount(slot, stack));
|
||||
|
||||
Reference in New Issue
Block a user