+1
-1
@@ -3,7 +3,7 @@ aechannel=stable
|
|||||||
aebuild=7
|
aebuild=7
|
||||||
aegroup=appeng
|
aegroup=appeng
|
||||||
aebasename=appliedenergistics2
|
aebasename=appliedenergistics2
|
||||||
trousers=omni-fixes-v45c
|
trousers=omni-fixes-v45e
|
||||||
|
|
||||||
#########################################################
|
#########################################################
|
||||||
# Versions #
|
# Versions #
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ public interface IStorageGrid extends IGridCache, IStorageMonitorable
|
|||||||
* @param input injected items
|
* @param input injected items
|
||||||
*/
|
*/
|
||||||
void postAlterationOfStoredItems( IStorageChannel<?> chan, Iterable<? extends IAEStack<?>> input, IActionSource src );
|
void postAlterationOfStoredItems( IStorageChannel<?> chan, Iterable<? extends IAEStack<?>> input, IActionSource src );
|
||||||
|
void postCraftablesChanges( IStorageChannel<?> chan, Iterable<? extends IAEStack<?>> input, IActionSource src);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used to add a cell provider to the storage system
|
* Used to add a cell provider to the storage system
|
||||||
|
|||||||
@@ -182,7 +182,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
|||||||
{
|
{
|
||||||
this.readConfig();
|
this.readConfig();
|
||||||
}
|
}
|
||||||
else if( inv == this.patterns && ( !removed.isEmpty() || !added.isEmpty() ) )
|
else if( inv == this.patterns )
|
||||||
{
|
{
|
||||||
this.updateCraftingList();
|
this.updateCraftingList();
|
||||||
}
|
}
|
||||||
|
|||||||
+20
-11
@@ -30,22 +30,19 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.TreeSet;
|
|
||||||
import java.util.concurrent.ExecutorService;
|
import java.util.concurrent.ExecutorService;
|
||||||
import java.util.concurrent.Executors;
|
import java.util.concurrent.Executors;
|
||||||
import java.util.concurrent.Future;
|
import java.util.concurrent.Future;
|
||||||
import java.util.concurrent.ThreadFactory;
|
import java.util.concurrent.ThreadFactory;
|
||||||
|
|
||||||
|
import appeng.api.storage.data.IAEFluidStack;
|
||||||
import com.google.common.collect.HashMultimap;
|
import com.google.common.collect.HashMultimap;
|
||||||
import com.google.common.collect.ImmutableCollection;
|
import com.google.common.collect.ImmutableCollection;
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
import com.google.common.collect.Multimap;
|
import com.google.common.collect.Multimap;
|
||||||
|
|
||||||
import it.unimi.dsi.fastutil.objects.Object2ObjectMap;
|
import it.unimi.dsi.fastutil.objects.*;
|
||||||
import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
|
|
||||||
import it.unimi.dsi.fastutil.objects.ObjectRBTreeSet;
|
|
||||||
import it.unimi.dsi.fastutil.objects.ObjectSet;
|
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
import appeng.api.AEApi;
|
import appeng.api.AEApi;
|
||||||
@@ -274,17 +271,13 @@ public class CraftingGridCache implements ICraftingGrid, ICraftingProviderHelper
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final Object2ObjectMap<IAEItemStack, ImmutableList<ICraftingPatternDetails>> oldItems = this.craftableItems;
|
final Object2ObjectMap<IAEItemStack, ImmutableList<ICraftingPatternDetails>> oldItems = new Object2ObjectOpenHashMap<>(this.craftableItems);
|
||||||
|
|
||||||
// erase list.
|
// erase list.
|
||||||
this.craftingMethods.clear();
|
this.craftingMethods.clear();
|
||||||
this.craftableItems.clear();
|
this.craftableItems.clear();
|
||||||
this.emitableItems.clear();
|
this.emitableItems.clear();
|
||||||
|
|
||||||
// update the stuff that was in the list...
|
|
||||||
this.storageGrid.postAlterationOfStoredItems( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ), oldItems.keySet(),
|
|
||||||
new BaseActionSource() );
|
|
||||||
|
|
||||||
// re-create list..
|
// re-create list..
|
||||||
for( final ICraftingProvider provider : this.craftingProviders )
|
for( final ICraftingProvider provider : this.craftingProviders )
|
||||||
{
|
{
|
||||||
@@ -319,7 +312,23 @@ public class CraftingGridCache implements ICraftingGrid, ICraftingProviderHelper
|
|||||||
this.craftableItems.put( e.getKey(), ImmutableList.copyOf( e.getValue() ) );
|
this.craftableItems.put( e.getKey(), ImmutableList.copyOf( e.getValue() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
this.storageGrid.postAlterationOfStoredItems( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ), this.craftableItems.keySet(),
|
Object2ObjectMap<IAEItemStack, ImmutableList<ICraftingPatternDetails>> craftablesChanged = new Object2ObjectArrayMap<>();
|
||||||
|
|
||||||
|
ObjectSet<Entry<IAEItemStack, ImmutableList<ICraftingPatternDetails>>> i = oldItems.entrySet();
|
||||||
|
for ( Entry<IAEItemStack, ImmutableList<ICraftingPatternDetails>> ais : i) {
|
||||||
|
if (!this.craftableItems.containsKey( ais.getKey() )) {
|
||||||
|
craftablesChanged.put( ais.getKey().setCraftable( false ), ais.getValue() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ObjectSet<Entry<IAEItemStack, ImmutableList<ICraftingPatternDetails>>> j = this.craftableItems.entrySet();
|
||||||
|
for ( Entry<IAEItemStack, ImmutableList<ICraftingPatternDetails>> ais : j) {
|
||||||
|
if (!oldItems.containsKey( ais )){
|
||||||
|
craftablesChanged.put( ais.getKey().setCraftable( true ), ais.getValue() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.storageGrid.postCraftablesChanges( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ), craftablesChanged.keySet(),
|
||||||
new BaseActionSource() );
|
new BaseActionSource() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -281,6 +281,12 @@ public class GridStorageCache implements IStorageGrid
|
|||||||
this.storageMonitors.get( chan ).postChange( true, (Iterable) input, src );
|
this.storageMonitors.get( chan ).postChange( true, (Iterable) input, src );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void postCraftablesChanges( IStorageChannel<?> chan, Iterable<? extends IAEStack<?>> input, IActionSource src )
|
||||||
|
{
|
||||||
|
this.storageMonitors.get( chan ).updateCraftables( (Iterable) input, src );
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerCellProvider( final ICellProvider provider )
|
public void registerCellProvider( final ICellProvider provider )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -217,6 +217,20 @@ public class NetworkMonitor<T extends IAEStack<T>> implements IMEMonitor<T>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void updateCraftables( Iterable<T> input, IActionSource src )
|
||||||
|
{
|
||||||
|
for( final T changedItem : input )
|
||||||
|
{
|
||||||
|
if (changedItem.isCraftable()) {
|
||||||
|
this.cachedList.add( changedItem.copy().setCraftable( true ) );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.cachedList.findPrecise( changedItem ).setCraftable( false );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected void postChange( final boolean add, final Iterable<T> changes, final IActionSource src )
|
protected void postChange( final boolean add, final Iterable<T> changes, final IActionSource src )
|
||||||
{
|
{
|
||||||
if( GLOBAL_DEPTH.contains( this ) )
|
if( GLOBAL_DEPTH.contains( this ) )
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ 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.Settings;
|
||||||
import appeng.api.config.StorageFilter;
|
import appeng.api.config.StorageFilter;
|
||||||
@@ -59,6 +60,7 @@ class ItemHandlerAdapter implements IMEInventory<IAEItemStack>, IBaseMonitor<IAE
|
|||||||
private final IGridProxyable proxyable;
|
private final IGridProxyable proxyable;
|
||||||
private final InventoryCache cache;
|
private final InventoryCache cache;
|
||||||
private StorageFilter mode;
|
private StorageFilter mode;
|
||||||
|
private AccessRestriction access;
|
||||||
|
|
||||||
private ItemStack stackCache = null;
|
private ItemStack stackCache = null;
|
||||||
|
|
||||||
@@ -70,6 +72,7 @@ class ItemHandlerAdapter implements IMEInventory<IAEItemStack>, IBaseMonitor<IAE
|
|||||||
{
|
{
|
||||||
PartStorageBus partStorageBus = (PartStorageBus) this.proxyable;
|
PartStorageBus partStorageBus = (PartStorageBus) this.proxyable;
|
||||||
this.mode = ( (StorageFilter) partStorageBus.getConfigManager().getSetting( Settings.STORAGE_FILTER ) );
|
this.mode = ( (StorageFilter) partStorageBus.getConfigManager().getSetting( Settings.STORAGE_FILTER ) );
|
||||||
|
this.access = ( (AccessRestriction) partStorageBus.getConfigManager().getSetting( Settings.ACCESS ) );
|
||||||
}
|
}
|
||||||
this.cache = new InventoryCache( this.itemHandler, this.mode );
|
this.cache = new InventoryCache( this.itemHandler, this.mode );
|
||||||
}
|
}
|
||||||
@@ -220,7 +223,7 @@ class ItemHandlerAdapter implements IMEInventory<IAEItemStack>, IBaseMonitor<IAE
|
|||||||
public TickRateModulation onTick()
|
public TickRateModulation onTick()
|
||||||
{
|
{
|
||||||
List<IAEItemStack> changes = this.cache.update();
|
List<IAEItemStack> changes = this.cache.update();
|
||||||
if( !changes.isEmpty() )
|
if( !changes.isEmpty() && access.hasPermission( AccessRestriction.READ ) )
|
||||||
{
|
{
|
||||||
this.postDifference( changes );
|
this.postDifference( changes );
|
||||||
return TickRateModulation.URGENT;
|
return TickRateModulation.URGENT;
|
||||||
|
|||||||
Reference in New Issue
Block a user