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));
|
||||
|
||||
@@ -61,7 +61,9 @@ public class ChargerBlockEntity extends AENetworkPowerBlockEntity implements ICr
|
||||
private static final int POWER_THRESHOLD = POWER_MAXIMUM_AMOUNT - 1;
|
||||
private static final int POWER_PER_CRANK_TURN = 160;
|
||||
|
||||
private final AppEngInternalInventory inv = new AppEngInternalInventory(this, 1, 1, new ChargerInvFilter());
|
||||
private final AppEngInternalInventory inv = new AppEngInternalInventory(this, 1, 1);
|
||||
|
||||
private final FixedItemInv externalInv = inv.createFiltered(new ChargerInvFilter());
|
||||
|
||||
public ChargerBlockEntity(BlockEntityType<?> tileEntityTypeIn) {
|
||||
super(tileEntityTypeIn);
|
||||
@@ -134,7 +136,7 @@ public class ChargerBlockEntity extends AENetworkPowerBlockEntity implements ICr
|
||||
|
||||
@Override
|
||||
public FixedItemInv getInternalInventory() {
|
||||
return this.inv;
|
||||
return externalInv;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package appeng.tile.misc;
|
||||
|
||||
import appeng.client.render.model.AEModelData;
|
||||
import net.minecraft.block.entity.BlockEntityType;
|
||||
|
||||
import appeng.tile.AEBaseBlockEntity;
|
||||
@@ -28,4 +29,9 @@ public class SkyCompassBlockEntity extends AEBaseBlockEntity {
|
||||
super(tileEntityTypeIn);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getRenderAttachmentData() {
|
||||
// For compasses, the forward/up are flipped
|
||||
return new AEModelData(getForward(), getUp());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user