fix adapters insert-only mode still reporting items

This commit is contained in:
Salomão
2021-07-27 12:33:32 -03:00
parent 6eadb8f861
commit e4af7b1947
3 changed files with 20 additions and 12 deletions
+1 -1
View File
@@ -3,7 +3,7 @@ aechannel=stable
aebuild=7 aebuild=7
aegroup=appeng aegroup=appeng
aebasename=appliedenergistics2 aebasename=appliedenergistics2
trousers=omni-fixes-v45f trousers=omni-fixes-v45g
######################################################### #########################################################
# Versions # # Versions #
@@ -67,7 +67,6 @@ public class FluidHandlerAdapter implements IMEInventory<IAEFluidStack>, IBaseMo
private StorageFilter mode; private StorageFilter mode;
private AccessRestriction access; private AccessRestriction access;
FluidHandlerAdapter( IFluidHandler fluidHandler, IGridProxyable proxy ) FluidHandlerAdapter( IFluidHandler fluidHandler, IGridProxyable proxy )
{ {
this.fluidHandler = fluidHandler; this.fluidHandler = fluidHandler;
@@ -2,7 +2,10 @@ package appeng.parts.misc;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import appeng.api.AEApi; import appeng.api.AEApi;
import appeng.api.config.AccessRestriction;
import appeng.api.config.Actionable; import appeng.api.config.Actionable;
import appeng.api.config.Settings;
import appeng.api.config.StorageFilter;
import appeng.api.networking.security.IActionSource; import appeng.api.networking.security.IActionSource;
import appeng.api.networking.storage.IBaseMonitor; import appeng.api.networking.storage.IBaseMonitor;
import appeng.api.networking.ticking.TickRateModulation; import appeng.api.networking.ticking.TickRateModulation;
@@ -38,6 +41,8 @@ class ItemRepositoryAdapter implements IMEInventory<IAEItemStack>, IBaseMonitor<
private final IItemRepository itemRepository; private final IItemRepository itemRepository;
private final IGridProxyable proxyable; private final IGridProxyable proxyable;
private final InventoryCache cache; private final InventoryCache cache;
private StorageFilter mode;
private AccessRestriction access;
private ItemStack stackCache; private ItemStack stackCache;
@@ -46,6 +51,12 @@ class ItemRepositoryAdapter implements IMEInventory<IAEItemStack>, IBaseMonitor<
this.itemRepository = itemRepository; this.itemRepository = itemRepository;
this.proxyable = proxy; this.proxyable = proxy;
this.cache = new InventoryCache( this.itemRepository ); this.cache = new InventoryCache( this.itemRepository );
if( this.proxyable instanceof PartStorageBus )
{
PartStorageBus partStorageBus = (PartStorageBus) this.proxyable;
this.mode = ( ( StorageFilter ) partStorageBus.getConfigManager().getSetting( Settings.STORAGE_FILTER ) );
this.access = ( (AccessRestriction) partStorageBus.getConfigManager().getSetting( Settings.ACCESS ) );
}
} }
@Override @Override
@@ -180,17 +191,15 @@ class ItemRepositoryAdapter implements IMEInventory<IAEItemStack>, IBaseMonitor<
@Override @Override
public TickRateModulation onTick() public TickRateModulation onTick()
{ {
List<IAEItemStack> changes = this.cache.update();
if( !changes.isEmpty() && access.hasPermission( AccessRestriction.READ ) )
{ {
List<IAEItemStack> changes = this.cache.update(); this.postDifference( changes );
if( !changes.isEmpty() ) return TickRateModulation.URGENT;
{ }
this.postDifference( changes ); else
return TickRateModulation.URGENT; {
} return TickRateModulation.SLOWER;
else
{
return TickRateModulation.SLOWER;
}
} }
} }