Split into internal and external inventories.
Fixes Charger not being able to load inventories that violated the filter.
This commit is contained in:
@@ -59,6 +59,13 @@ public abstract class AEBaseInvBlockEntity extends AEBaseBlockEntity implements
|
|||||||
|
|
||||||
public abstract @Nonnull FixedItemInv getInternalInventory();
|
public abstract @Nonnull FixedItemInv getInternalInventory();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Inventory offered to other mods accessing this block externally.
|
||||||
|
*/
|
||||||
|
public @Nonnull FixedItemInv getExternalInventory() {
|
||||||
|
return getInternalInventory();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CompoundTag toTag(final CompoundTag data) {
|
public CompoundTag toTag(final CompoundTag data) {
|
||||||
super.toTag(data);
|
super.toTag(data);
|
||||||
@@ -95,7 +102,7 @@ public abstract class AEBaseInvBlockEntity extends AEBaseBlockEntity implements
|
|||||||
ItemStack added);
|
ItemStack added);
|
||||||
|
|
||||||
protected @Nonnull FixedItemInv getItemHandlerForSide(@Nonnull Direction side) {
|
protected @Nonnull FixedItemInv getItemHandlerForSide(@Nonnull Direction side) {
|
||||||
return this.getInternalInventory();
|
return this.getExternalInventory();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -107,7 +114,7 @@ public abstract class AEBaseInvBlockEntity extends AEBaseBlockEntity implements
|
|||||||
private void offerItemInventory(AttributeList<?> to) {
|
private void offerItemInventory(AttributeList<?> to) {
|
||||||
Direction searchDirection = to.getSearchDirection();
|
Direction searchDirection = to.getSearchDirection();
|
||||||
if (searchDirection == null) {
|
if (searchDirection == null) {
|
||||||
to.offer(getInternalInventory());
|
to.offer(getExternalInventory());
|
||||||
} else {
|
} else {
|
||||||
Direction side = searchDirection.getOpposite();
|
Direction side = searchDirection.getOpposite();
|
||||||
to.offer(getItemHandlerForSide(side));
|
to.offer(getItemHandlerForSide(side));
|
||||||
|
|||||||
@@ -56,6 +56,7 @@ import appeng.util.Platform;
|
|||||||
import appeng.util.inv.InvOperation;
|
import appeng.util.inv.InvOperation;
|
||||||
import appeng.util.inv.filter.IAEItemFilter;
|
import appeng.util.inv.filter.IAEItemFilter;
|
||||||
import appeng.util.item.AEItemStack;
|
import appeng.util.item.AEItemStack;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class ChargerBlockEntity extends AENetworkPowerBlockEntity implements ICrankable, IGridTickable {
|
public class ChargerBlockEntity extends AENetworkPowerBlockEntity implements ICrankable, IGridTickable {
|
||||||
private static final int POWER_MAXIMUM_AMOUNT = 1600;
|
private static final int POWER_MAXIMUM_AMOUNT = 1600;
|
||||||
@@ -137,6 +138,12 @@ public class ChargerBlockEntity extends AENetworkPowerBlockEntity implements ICr
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FixedItemInv getInternalInventory() {
|
public FixedItemInv getInternalInventory() {
|
||||||
|
return inv;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@Override
|
||||||
|
public FixedItemInv getExternalInventory() {
|
||||||
return externalInv;
|
return externalInv;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -255,7 +262,7 @@ public class ChargerBlockEntity extends AENetworkPowerBlockEntity implements ICr
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private class ChargerInvFilter implements IAEItemFilter {
|
private static class ChargerInvFilter implements IAEItemFilter {
|
||||||
@Override
|
@Override
|
||||||
public boolean allowInsert(FixedItemInv inv, final int i, final ItemStack itemstack) {
|
public boolean allowInsert(FixedItemInv inv, final int i, final ItemStack itemstack) {
|
||||||
final IItemDefinition cert = Api.instance().definitions().materials().certusQuartzCrystal();
|
final IItemDefinition cert = Api.instance().definitions().materials().certusQuartzCrystal();
|
||||||
|
|||||||
Reference in New Issue
Block a user