This commit is contained in:
PrototypeTrousers
2021-12-09 23:08:26 -03:00
parent b51af43dba
commit 94d73aec7c
9 changed files with 1164 additions and 1358 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-v49j trousers=omni-fixes-v49k
######################################################### #########################################################
# Versions # # Versions #
@@ -93,7 +93,7 @@ public class DualityFluidInterface implements IGridTickable, IStorageMonitorable
private final MEMonitorPassThrough<IAEItemStack> items = new MEMonitorPassThrough<>( new NullInventory<IAEItemStack>(), AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) ); private final MEMonitorPassThrough<IAEItemStack> items = new MEMonitorPassThrough<>( new NullInventory<IAEItemStack>(), AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) );
private final MEMonitorPassThrough<IAEFluidStack> fluids = new MEMonitorPassThrough<>( new NullInventory<IAEFluidStack>(), AEApi.instance().storage().getStorageChannel( IFluidStorageChannel.class ) ); private final MEMonitorPassThrough<IAEFluidStack> fluids = new MEMonitorPassThrough<>( new NullInventory<IAEFluidStack>(), AEApi.instance().storage().getStorageChannel( IFluidStorageChannel.class ) );
private boolean resetConfigCache; private boolean resetConfigCache = true;
private IMEMonitor<IAEFluidStack> configCachedHandler; private IMEMonitor<IAEFluidStack> configCachedHandler;
public DualityFluidInterface( final AENetworkProxy networkProxy, final IFluidInterfaceHost ih ) public DualityFluidInterface( final AENetworkProxy networkProxy, final IFluidInterfaceHost ih )
@@ -116,17 +116,9 @@ public class DualityFluidInterface implements IGridTickable, IStorageMonitorable
} }
public IUpgradeableHost getHost() public IUpgradeableHost getHost()
{
if( this.iHost instanceof IUpgradeableHost )
{ {
return this.iHost; return this.iHost;
} }
if( this.iHost instanceof IUpgradeableHost )
{
return this.iHost;
}
return null;
}
@Override @Override
public <T extends IAEStack<T>> IMEMonitor<T> getInventory( IStorageChannel<T> channel ) public <T extends IAEStack<T>> IMEMonitor<T> getInventory( IStorageChannel<T> channel )
@@ -19,17 +19,54 @@
package appeng.fluids.parts; package appeng.fluids.parts;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import appeng.api.AEApi;
import appeng.api.config.*;
import appeng.api.networking.IGridNode;
import appeng.api.networking.events.MENetworkCellArrayUpdate;
import appeng.api.networking.events.MENetworkChannelsChanged;
import appeng.api.networking.events.MENetworkEventSubscribe;
import appeng.api.networking.events.MENetworkPowerStatusChange;
import appeng.api.networking.security.IActionSource;
import appeng.api.networking.storage.IBaseMonitor;
import appeng.api.networking.storage.IStorageGrid; import appeng.api.networking.storage.IStorageGrid;
import appeng.api.storage.channels.IItemStorageChannel; import appeng.api.networking.ticking.IGridTickable;
import appeng.api.networking.ticking.ITickManager;
import appeng.api.networking.ticking.TickRateModulation;
import appeng.api.networking.ticking.TickingRequest;
import appeng.api.parts.IPart;
import appeng.api.parts.IPartCollisionHelper;
import appeng.api.parts.IPartModel;
import appeng.api.storage.*;
import appeng.api.storage.channels.IFluidStorageChannel;
import appeng.api.storage.data.IAEFluidStack;
import appeng.api.storage.data.IItemList;
import appeng.api.util.AECableType;
import appeng.api.util.IConfigManager;
import appeng.capabilities.Capabilities;
import appeng.core.AppEng;
import appeng.core.settings.TickRates;
import appeng.core.sync.GuiBridge;
import appeng.fluids.helper.IConfigurableFluidInventory; import appeng.fluids.helper.IConfigurableFluidInventory;
import appeng.fluids.tile.TileFluidInterface;
import appeng.fluids.util.AEFluidInventory;
import appeng.fluids.util.IAEFluidInventory;
import appeng.fluids.util.IAEFluidTank;
import appeng.helpers.IPriorityHost;
import appeng.items.parts.PartModels;
import appeng.me.GridAccessException;
import appeng.me.cache.GridStorageCache; import appeng.me.cache.GridStorageCache;
import appeng.me.helpers.MachineSource;
import appeng.me.storage.ITickingMonitor;
import appeng.me.storage.MEInventoryHandler;
import appeng.parts.PartModel;
import appeng.parts.automation.PartUpgradeable;
import appeng.tile.networking.TileCableBus;
import appeng.util.ConfigManager; import appeng.util.ConfigManager;
import appeng.util.Platform;
import appeng.util.prioritylist.FuzzyPriorityList;
import appeng.util.prioritylist.PrecisePriorityList;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
@@ -37,54 +74,15 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand; import net.minecraft.util.EnumHand;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d; import net.minecraft.util.math.Vec3d;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
import net.minecraftforge.fluids.capability.IFluidHandler; import net.minecraftforge.fluids.capability.IFluidHandler;
import appeng.api.AEApi; import java.util.Collections;
import appeng.api.config.AccessRestriction; import java.util.List;
import appeng.api.config.FuzzyMode; import java.util.Objects;
import appeng.api.config.IncludeExclude;
import appeng.api.config.Settings;
import appeng.api.config.StorageFilter;
import appeng.api.config.Upgrades;
import appeng.api.networking.IGridNode;
import appeng.api.networking.events.MENetworkCellArrayUpdate;
import appeng.api.networking.security.IActionSource;
import appeng.api.networking.storage.IBaseMonitor;
import appeng.api.networking.ticking.ITickManager;
import appeng.api.networking.ticking.TickRateModulation;
import appeng.api.networking.ticking.TickingRequest;
import appeng.api.parts.IPartHost;
import appeng.api.parts.IPartModel;
import appeng.api.storage.IMEInventory;
import appeng.api.storage.IMEInventoryHandler;
import appeng.api.storage.IMEMonitorHandlerReceiver;
import appeng.api.storage.IStorageChannel;
import appeng.api.storage.IStorageMonitorable;
import appeng.api.storage.IStorageMonitorableAccessor;
import appeng.api.storage.channels.IFluidStorageChannel;
import appeng.api.storage.data.IAEFluidStack;
import appeng.api.storage.data.IItemList;
import appeng.api.util.AEPartLocation;
import appeng.capabilities.Capabilities;
import appeng.core.AppEng;
import appeng.core.settings.TickRates;
import appeng.core.sync.GuiBridge;
import appeng.fluids.util.AEFluidInventory;
import appeng.fluids.util.IAEFluidInventory;
import appeng.fluids.util.IAEFluidTank;
import appeng.helpers.IInterfaceHost;
import appeng.items.parts.PartModels;
import appeng.me.GridAccessException;
import appeng.me.helpers.MachineSource;
import appeng.me.storage.ITickingMonitor;
import appeng.me.storage.MEInventoryHandler;
import appeng.parts.PartModel;
import appeng.parts.misc.PartSharedStorageBus;
import appeng.util.Platform;
import appeng.util.prioritylist.FuzzyPriorityList;
import appeng.util.prioritylist.PrecisePriorityList;
/** /**
@@ -92,7 +90,7 @@ import appeng.util.prioritylist.PrecisePriorityList;
* @version rv6 - 22/05/2018 * @version rv6 - 22/05/2018
* @since rv6 22/05/2018 * @since rv6 22/05/2018
*/ */
public class PartFluidStorageBus extends PartSharedStorageBus implements IMEMonitorHandlerReceiver<IAEFluidStack>, IAEFluidInventory, IConfigurableFluidInventory public class PartFluidStorageBus extends PartUpgradeable implements IGridTickable, ICellContainer, IMEMonitorHandlerReceiver<IAEFluidStack>, IAEFluidInventory, IConfigurableFluidInventory, IPriorityHost
{ {
public static final ResourceLocation MODEL_BASE = new ResourceLocation( AppEng.MOD_ID, "part/fluid_storage_bus_base" ); public static final ResourceLocation MODEL_BASE = new ResourceLocation( AppEng.MOD_ID, "part/fluid_storage_bus_base" );
@PartModels @PartModels
@@ -104,11 +102,15 @@ public class PartFluidStorageBus extends PartSharedStorageBus implements IMEMoni
private final IActionSource source; private final IActionSource source;
private final AEFluidInventory config = new AEFluidInventory( this, 63 ); private final AEFluidInventory config = new AEFluidInventory( this, 63 );
private int priority = 0;
private boolean cached = false; private boolean cached = false;
private ITickingMonitor monitor = null; private ITickingMonitor monitor = null;
private MEInventoryHandler<IAEFluidStack> handler = null; private MEInventoryHandler<IAEFluidStack> handler = null;
private int handlerHash = 0; private int handlerHash = 0;
private boolean wasActive = false;
private byte resetCacheLogic = 0; private byte resetCacheLogic = 0;
private boolean accessChanged;
private boolean readOncePass;
public PartFluidStorageBus( ItemStack is ) public PartFluidStorageBus( ItemStack is )
{ {
@@ -119,34 +121,228 @@ public class PartFluidStorageBus extends PartSharedStorageBus implements IMEMoni
this.source = new MachineSource( this ); this.source = new MachineSource( this );
} }
private IMEInventory<IAEFluidStack> getInventoryWrapper( TileEntity target ) @Override
@MENetworkEventSubscribe
public void powerRender( final MENetworkPowerStatusChange c )
{ {
EnumFacing targetSide = this.getSide().getFacing().getOpposite(); this.updateStatus();
// Prioritize a handler to directly link to another ME network
IStorageMonitorableAccessor accessor = target.getCapability( Capabilities.STORAGE_MONITORABLE_ACCESSOR, targetSide );
if( accessor != null )
{
IStorageMonitorable inventory = accessor.getInventory( this.source );
if( inventory != null )
{
return inventory.getInventory( AEApi.instance().storage().getStorageChannel( IFluidStorageChannel.class ) );
} }
// So this could / can be a design decision. If the tile does support our custom capability, protected void updateStatus()
// but it does not return an inventory for the action source, we do NOT fall back to using {
// IItemHandler's, as that might circumvent the security setings, and might also cause final boolean currentActive = this.getProxy().isActive();
// performance issues. if( this.wasActive != currentActive )
{
this.wasActive = currentActive;
try
{
this.getProxy().getGrid().postEvent( new MENetworkCellArrayUpdate() );
this.getHost().markForUpdate();
}
catch( final GridAccessException e )
{
// :P
}
}
}
@Override
@MENetworkEventSubscribe
public void chanRender( final MENetworkChannelsChanged changedChannels )
{
this.updateStatus();
}
@Override
protected int getUpgradeSlots()
{
return 5;
}
@Override
public void updateSetting( final IConfigManager manager, final Enum settingName, final Enum newValue )
{
if( settingName.name().equals( "ACCESS" ) )
{
this.accessChanged = true;
}
this.resetCache( true );
this.getHost().markForSave();
}
@Override
public void onFluidInventoryChanged( IAEFluidTank inv, int slot )
{
if( inv == this.config )
{
this.resetCache( true );
}
}
@Override
public void upgradesChanged()
{
super.upgradesChanged();
this.resetCache( true );
}
@Override
public void readFromNBT( final NBTTagCompound data )
{
super.readFromNBT( data );
this.config.readFromNBT( data, "config" );
this.priority = data.getInteger( "priority" );
this.accessChanged = false;
}
@Override
public void writeToNBT( final NBTTagCompound data )
{
super.writeToNBT( data );
this.config.writeToNBT( data, "config" );
data.setInteger( "priority", this.priority );
}
@Override
public IFluidHandler getFluidInventoryByName( final String name )
{
if( name.equals( "config" ) )
{
return this.config;
}
return null; return null;
} }
// Check via cap for IItemHandler protected void resetCache( final boolean fullReset )
IFluidHandler handlerExt = target.getCapability( CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, targetSide );
if( handlerExt != null )
{ {
return new FluidHandlerAdapter( handlerExt, this ); if( this.getHost() == null || this.getHost().getTile() == null || this.getHost().getTile().getWorld() == null || this.getHost().getTile().getWorld().isRemote )
{
return;
} }
return null; if( fullReset )
{
this.resetCacheLogic = 2;
}
else if( this.resetCacheLogic < 2 )
{
this.resetCacheLogic = 1;
}
try
{
this.getProxy().getTick().alertDevice( this.getProxy().getNode() );
}
catch( final GridAccessException e )
{
// :P
}
}
@Override
public boolean isValid( final Object verificationToken )
{
return this.handler == verificationToken;
}
@Override
public void postChange( final IBaseMonitor<IAEFluidStack> monitor, final Iterable<IAEFluidStack> change, final IActionSource source )
{
if( this.getProxy().isActive() )
{
AccessRestriction currentAccess = (AccessRestriction) ( (ConfigManager) this.getConfigManager() ).getSetting( Settings.ACCESS );
if( readOncePass )
{
readOncePass = false;
try
{
this.getProxy().getStorage().postAlterationOfStoredItems( AEApi.instance().storage().getStorageChannel( IFluidStorageChannel.class ), change, this.source );
}
catch( final GridAccessException e )
{
// :(
}
return;
}
if( !currentAccess.hasPermission( AccessRestriction.READ ) )
{
return;
}
try
{
this.getProxy().getStorage().postAlterationOfStoredItems( AEApi.instance().storage().getStorageChannel( IFluidStorageChannel.class ), change, source );
}
catch( final GridAccessException e )
{
// :(
}
}
}
@Override
public void onListUpdate()
{
// not used here.
}
@Override
public void getBoxes( final IPartCollisionHelper bch )
{
bch.addBox( 3, 3, 15, 13, 13, 16 );
bch.addBox( 2, 2, 14, 14, 14, 15 );
bch.addBox( 5, 5, 12, 11, 11, 14 );
}
@Override
public void onNeighborChanged( IBlockAccess w, BlockPos pos, BlockPos neighbor )
{
if( pos.offset( this.getSide().getFacing() ).equals( neighbor ) )
{
final TileEntity te = w.getTileEntity( neighbor );
// In case the TE was destroyed, we have to do a full reset immediately.
if( te instanceof TileCableBus )
{
IPart iPart = ( (TileCableBus) te ).getPart( this.getSide().getOpposite() );
if( iPart == null || iPart instanceof PartFluidInterface )
{
this.resetCache( true );
this.resetCache();
}
}
else if( te == null || te instanceof TileFluidInterface )
{
this.resetCache( true );
this.resetCache();
}
else
{
this.resetCache( false );
}
}
}
@Override
public float getCableConnectionLength( AECableType cable )
{
return 4;
}
@Override
public boolean onPartActivate( final EntityPlayer player, final EnumHand hand, final Vec3d pos )
{
if( Platform.isServer() )
{
Platform.openGUI( player, this.getHost().getTile(), this.getSide(), GuiBridge.GUI_STORAGEBUS_FLUID );
}
return true;
}
@Override
public TickingRequest getTickingRequest( IGridNode node )
{
return new TickingRequest( TickRates.FluidStorageBus.getMin(), TickRates.FluidStorageBus.getMax(), monitor == null, true );
} }
@Override @Override
@@ -165,7 +361,6 @@ public class PartFluidStorageBus extends PartSharedStorageBus implements IMEMoni
return TickRateModulation.SLEEP; return TickRateModulation.SLEEP;
} }
@Override
protected void resetCache() protected void resetCache()
{ {
final boolean fullReset = this.resetCacheLogic == 2; final boolean fullReset = this.resetCacheLogic == 2;
@@ -213,106 +408,58 @@ public class PartFluidStorageBus extends PartSharedStorageBus implements IMEMoni
} }
} }
@Override private IMEInventory<IAEFluidStack> getInventoryWrapper( TileEntity target )
protected void resetCache( final boolean fullReset )
{ {
if( this.getHost() == null || this.getHost().getTile() == null || this.getHost().getTile().getWorld() == null || this.getHost() EnumFacing targetSide = this.getSide().getFacing().getOpposite();
.getTile() // Prioritize a handler to directly link to another ME network
.getWorld().isRemote ) IStorageMonitorableAccessor accessor = target.getCapability( Capabilities.STORAGE_MONITORABLE_ACCESSOR, targetSide );
if( accessor != null )
{ {
return; IStorageMonitorable inventory = accessor.getInventory( this.source );
if( inventory != null )
{
return inventory.getInventory( AEApi.instance().storage().getStorageChannel( IFluidStorageChannel.class ) );
} }
if( fullReset ) // So this could / can be a design decision. If the tile does support our custom capability,
{ // but it does not return an inventory for the action source, we do NOT fall back to using
this.resetCacheLogic = 2; // IItemHandler's, as that might circumvent the security setings, and might also cause
} // performance issues.
else if( this.resetCacheLogic < 2 ) return null;
{
this.resetCacheLogic = 1;
} }
try // Check via cap for IItemHandler
IFluidHandler handlerExt = target.getCapability( CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, targetSide );
if( handlerExt != null )
{ {
this.getProxy().getTick().alertDevice( this.getProxy().getNode() ); return new FluidHandlerAdapter( handlerExt, this );
}
catch( final GridAccessException e )
{
// :P
}
} }
@Override return null;
public boolean onPartActivate( final EntityPlayer player, final EnumHand hand, final Vec3d pos )
{
if( Platform.isServer() )
{
Platform.openGUI( player, this.getHost().getTile(), this.getSide(), GuiBridge.GUI_STORAGEBUS_FLUID );
}
return true;
} }
@Override private int createHandlerHash( TileEntity target )
public void onFluidInventoryChanged( IAEFluidTank inv, int slot )
{ {
if( inv == this.config ) if( target == null )
{ {
this.resetCache( true ); return 0;
}
} }
@Override final EnumFacing targetSide = this.getSide().getFacing().getOpposite();
public void readFromNBT( final NBTTagCompound data )
if( target.hasCapability( Capabilities.STORAGE_MONITORABLE_ACCESSOR, targetSide ) )
{ {
super.readFromNBT( data ); return Objects.hash( target, target.getCapability( Capabilities.STORAGE_MONITORABLE_ACCESSOR, targetSide ) );
this.config.readFromNBT( data, "config" );
} }
@Override final IFluidHandler fluidHandler = target.getCapability( CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, targetSide );
public void writeToNBT( final NBTTagCompound data )
if( fluidHandler != null )
{ {
super.writeToNBT( data ); return Objects.hash( target, fluidHandler, fluidHandler.getTankProperties().length );
this.config.writeToNBT( data, "config" );
} }
@Override return 0;
public boolean isValid( final Object verificationToken )
{
return this.handler == verificationToken;
}
@Override
public void postChange( final IBaseMonitor<IAEFluidStack> monitor, final Iterable<IAEFluidStack> change, final IActionSource source )
{
if( this.getProxy().isActive() )
{
AccessRestriction currentAccess = (AccessRestriction) ( (ConfigManager) this.getConfigManager() ).getSetting( Settings.ACCESS );
if( readOncePass )
{
readOncePass = false;
try
{
this.getProxy().getStorage().postAlterationOfStoredItems( AEApi.instance().storage().getStorageChannel( IFluidStorageChannel.class ), change, source );
}
catch( final GridAccessException e )
{
// :(
}
return;
}
if( !currentAccess.hasPermission( AccessRestriction.READ ) )
{
return;
}
try
{
this.getProxy().getStorage().postAlterationOfStoredItems( AEApi.instance().storage().getStorageChannel( IFluidStorageChannel.class ), change, source );
}
catch( final GridAccessException e )
{
// :(
}
}
} }
public MEInventoryHandler<IAEFluidStack> getInternalHandler() public MEInventoryHandler<IAEFluidStack> getInternalHandler()
@@ -353,8 +500,6 @@ public class PartFluidStorageBus extends PartSharedStorageBus implements IMEMoni
if( inv != null ) if( inv != null )
{ {
this.checkInterfaceVsStorageBus( target, this.getSide().getOpposite() );
this.handler = new MEInventoryHandler<>( inv, AEApi.instance().storage().getStorageChannel( IFluidStorageChannel.class ) ); this.handler = new MEInventoryHandler<>( inv, AEApi.instance().storage().getStorageChannel( IFluidStorageChannel.class ) );
this.handler.setBaseAccess( (AccessRestriction) this.getConfigManager().getSetting( Settings.ACCESS ) ); this.handler.setBaseAccess( (AccessRestriction) this.getConfigManager().getSetting( Settings.ACCESS ) );
@@ -375,8 +520,7 @@ public class PartFluidStorageBus extends PartSharedStorageBus implements IMEMoni
if( this.getInstalledUpgrades( Upgrades.FUZZY ) > 0 ) if( this.getInstalledUpgrades( Upgrades.FUZZY ) > 0 )
{ {
this.handler.setPartitionList( this.handler.setPartitionList( new FuzzyPriorityList<IAEFluidStack>( priorityList, (FuzzyMode) this.getConfigManager().getSetting( Settings.FUZZY_MODE ) ) );
new FuzzyPriorityList<IAEFluidStack>( priorityList, (FuzzyMode) this.getConfigManager().getSetting( Settings.FUZZY_MODE ) ) );
} }
else else
{ {
@@ -417,9 +561,9 @@ public class PartFluidStorageBus extends PartSharedStorageBus implements IMEMoni
try try
{ {
// force grid to update handlers... // force grid to update handlers...
(( GridStorageCache ) this.getProxy().getGrid().getCache( IStorageGrid.class )).cellUpdate( null ); ( (GridStorageCache) this.getProxy().getGrid().getCache( IStorageGrid.class ) ).cellUpdate( null );
} }
catch( final GridAccessException ignore ) catch( final GridAccessException e )
{ {
// :3 // :3
} }
@@ -427,36 +571,10 @@ public class PartFluidStorageBus extends PartSharedStorageBus implements IMEMoni
return this.handler; return this.handler;
} }
private void checkInterfaceVsStorageBus( final TileEntity target, final AEPartLocation side )
{
IInterfaceHost achievement = null;
if( target instanceof IInterfaceHost )
{
achievement = (IInterfaceHost) target;
}
if( target instanceof IPartHost )
{
final Object part = ( (IPartHost) target ).getPart( side );
if( part instanceof IInterfaceHost )
{
achievement = (IInterfaceHost) part;
}
}
if( achievement != null && achievement.getActionableNode() != null )
{
// Platform.addStat( achievement.getActionableNode().getPlayerID(), Achievements.Recursive.getAchievement()
// );
// Platform.addStat( getActionableNode().getPlayerID(), Achievements.Recursive.getAchievement() );
}
}
@Override @Override
public List<IMEInventoryHandler> getCellArray( final IStorageChannel channel ) public List<IMEInventoryHandler> getCellArray( final IStorageChannel channel )
{ {
if( channel == this.getStorageChannel() ) if( channel == AEApi.instance().storage().getStorageChannel( IFluidStorageChannel.class ) )
{ {
final IMEInventoryHandler<IAEFluidStack> out = this.getInternalHandler(); final IMEInventoryHandler<IAEFluidStack> out = this.getInternalHandler();
if( out != null ) if( out != null )
@@ -464,49 +582,33 @@ public class PartFluidStorageBus extends PartSharedStorageBus implements IMEMoni
return Collections.singletonList( out ); return Collections.singletonList( out );
} }
} }
return super.getCellArray( channel ); return Collections.emptyList();
}
private int createHandlerHash( TileEntity target )
{
if( target == null )
{
return 0;
}
final EnumFacing targetSide = this.getSide().getFacing().getOpposite();
if( target.hasCapability( Capabilities.STORAGE_MONITORABLE_ACCESSOR, targetSide ) )
{
return Objects.hash( target, target.getCapability( Capabilities.STORAGE_MONITORABLE_ACCESSOR, targetSide ) );
}
final IFluidHandler fluidHandler = target.getCapability( CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, targetSide );
if( fluidHandler != null )
{
return Objects.hash( target, fluidHandler, fluidHandler.getTankProperties().length );
}
return 0;
} }
@Override @Override
public TickingRequest getTickingRequest( IGridNode node ) public int getPriority()
{ {
return new TickingRequest( TickRates.FluidStorageBus.getMin(), TickRates.FluidStorageBus.getMax(), this.isSleeping(), true ); return this.priority;
} }
@Override @Override
public void onListUpdate() public void setPriority( int newValue )
{ {
// not used here. this.priority = newValue;
this.getHost().markForSave();
this.resetCache( true );
} }
@Override @Override
public IStorageChannel getStorageChannel() public void blinkCell( int slot )
{ {
return AEApi.instance().storage().getStorageChannel( IFluidStorageChannel.class );
}
@Override
public void saveChanges( @Nullable ICellInventory<?> cellInventory )
{
} }
public IAEFluidTank getConfig() public IAEFluidTank getConfig()
@@ -514,14 +616,6 @@ public class PartFluidStorageBus extends PartSharedStorageBus implements IMEMoni
return this.config; return this.config;
} }
@Override
public IFluidHandler getFluidInventoryByName(final String name) {
if (name.equals("config")) {
return this.config;
}
return null;
}
@Nonnull @Nonnull
@Override @Override
public IPartModel getStaticModels() public IPartModel getStaticModels()
+4 -9
View File
@@ -170,15 +170,14 @@ public class GridStorageCache implements IStorageGrid
private CellChangeTracker addCellProvider( final ICellProvider cc, final CellChangeTracker tracker ) private CellChangeTracker addCellProvider( final ICellProvider cc, final CellChangeTracker tracker )
{ {
if( this.inactiveCellProviders.contains( cc ) && !this.activeCellProviders.contains( cc )) if( this.inactiveCellProviders.contains( cc ) )
{ {
this.inactiveCellProviders.remove( cc ); this.inactiveCellProviders.remove( cc );
this.activeCellProviders.add( cc ); this.activeCellProviders.add( cc );
final IActionSource actionSrc = cc instanceof IActionHost ? new MachineSource( (IActionHost) cc ) : new BaseActionSource(); final IActionSource actionSrc = cc instanceof IActionHost ? new MachineSource( (IActionHost) cc ) : new BaseActionSource();
this.storageMonitors.forEach( ( channel, monitor ) -> this.storageMonitors.forEach( ( channel, monitor ) -> {
{
for( final IMEInventoryHandler<?> h : cc.getCellArray( channel ) ) for( final IMEInventoryHandler<?> h : cc.getCellArray( channel ) )
{ {
tracker.postChanges( channel, 1, h, actionSrc ); tracker.postChanges( channel, 1, h, actionSrc );
@@ -223,7 +222,7 @@ public class GridStorageCache implements IStorageGrid
for( final ICellProvider cc : ll ) for( final ICellProvider cc : ll )
{ {
boolean active = true; boolean active = false;
if( cc instanceof IActionHost ) if( cc instanceof IActionHost )
{ {
@@ -232,10 +231,6 @@ public class GridStorageCache implements IStorageGrid
{ {
active = true; active = true;
} }
else
{
active = false;
}
} }
if( active ) if( active )
@@ -249,7 +244,7 @@ public class GridStorageCache implements IStorageGrid
} }
tracker.applyChanges(); tracker.applyChanges();
this.storageMonitors.forEach( ( channel, monitor ) -> monitor.forceUpdate() ); this.storageMonitors.forEach( ( channel, monitor ) -> monitor.setForceUpdate( true ) );
} }
private <T extends IAEStack<T>, C extends IStorageChannel<T>> void postChangesToNetwork( final C chan, final int upOrDown, final IItemList<T> availableItems, final IActionSource src ) private <T extends IAEStack<T>, C extends IStorageChannel<T>> void postChangesToNetwork( final C chan, final int upOrDown, final IItemList<T> availableItems, final IActionSource src )
+12 -2
View File
@@ -63,6 +63,7 @@ public class NetworkMonitor<T extends IAEStack<T>> implements IMEMonitor<T>
private boolean sendEvent = false; private boolean sendEvent = false;
private long gridItemCount; private long gridItemCount;
private long gridFluidCount; private long gridFluidCount;
public boolean forceUpdate;
public NetworkMonitor( final GridStorageCache cache, final IStorageChannel<T> chan ) public NetworkMonitor( final GridStorageCache cache, final IStorageChannel<T> chan )
{ {
@@ -232,7 +233,6 @@ public class NetworkMonitor<T extends IAEStack<T>> implements IMEMonitor<T>
return; return;
} }
src2MonitorsMap.get( src ).add( this ); src2MonitorsMap.get( src ).add( this );
isNested = false;
this.sendEvent = true; this.sendEvent = true;
@@ -285,7 +285,7 @@ public class NetworkMonitor<T extends IAEStack<T>> implements IMEMonitor<T>
if( networkMonitor.isNested != networkMonitor.wasNested ) if( networkMonitor.isNested != networkMonitor.wasNested )
{ {
networkMonitor.wasNested = networkMonitor.isNested; networkMonitor.wasNested = networkMonitor.isNested;
networkMonitor.forceUpdate(); networkMonitor.setForceUpdate( true );
} }
} ); } );
src2MonitorsMap.remove( src ); src2MonitorsMap.remove( src );
@@ -293,8 +293,14 @@ public class NetworkMonitor<T extends IAEStack<T>> implements IMEMonitor<T>
} }
} }
public void setForceUpdate( boolean forceUpdate )
{
this.forceUpdate = forceUpdate;
}
void forceUpdate() void forceUpdate()
{ {
forceUpdate = false;
this.cachedList.resetStatus(); this.cachedList.resetStatus();
this.getAvailableItems( this.cachedList ); this.getAvailableItems( this.cachedList );
@@ -357,6 +363,10 @@ public class NetworkMonitor<T extends IAEStack<T>> implements IMEMonitor<T>
void onTick() void onTick()
{ {
if( forceUpdate )
{
forceUpdate();
}
if( this.sendEvent ) if( this.sendEvent )
{ {
this.sendEvent = false; this.sendEvent = false;
@@ -1,231 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2018, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.parts.misc;
import java.util.Collections;
import java.util.List;
import appeng.api.config.AccessRestriction;
import appeng.api.parts.IPart;
import appeng.fluids.parts.PartFluidInterface;
import appeng.fluids.tile.TileFluidInterface;
import appeng.tile.misc.TileInterface;
import appeng.tile.networking.TileCableBus;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import appeng.api.AEApi;
import appeng.api.networking.events.MENetworkCellArrayUpdate;
import appeng.api.networking.events.MENetworkChannelsChanged;
import appeng.api.networking.events.MENetworkEventSubscribe;
import appeng.api.networking.events.MENetworkPowerStatusChange;
import appeng.api.networking.ticking.IGridTickable;
import appeng.api.parts.IPartCollisionHelper;
import appeng.api.storage.ICellContainer;
import appeng.api.storage.ICellInventory;
import appeng.api.storage.IMEInventoryHandler;
import appeng.api.storage.IStorageChannel;
import appeng.api.storage.channels.IItemStorageChannel;
import appeng.api.util.AECableType;
import appeng.api.util.IConfigManager;
import appeng.helpers.IPriorityHost;
import appeng.me.GridAccessException;
import appeng.parts.automation.PartUpgradeable;
/**
* @author BrockWS
* @version rv6 - 22/05/2018
* @since rv6 22/05/2018
*/
public abstract class PartSharedStorageBus extends PartUpgradeable implements IGridTickable, ICellContainer, IPriorityHost
{
private boolean wasActive = false;
private int priority = 0;
protected boolean accessChanged;
protected boolean readOncePass;
public PartSharedStorageBus( ItemStack is )
{
super( is );
}
protected void updateStatus()
{
final boolean currentActive = this.getProxy().isActive();
if( this.wasActive != currentActive )
{
this.wasActive = currentActive;
try
{
this.getProxy().getGrid().postEvent( new MENetworkCellArrayUpdate() );
this.getHost().markForUpdate();
}
catch( final GridAccessException ignore )
{
// :P
}
}
}
@Override
@MENetworkEventSubscribe
public void chanRender( final MENetworkChannelsChanged changedChannels )
{
this.updateStatus();
}
/**
* Helper method to get this parts storage channel
*
* @return Storage channel
*/
public IStorageChannel getStorageChannel()
{
return AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class );
}
protected abstract void resetCache();
protected abstract void resetCache( boolean fullReset );
@Override
public List<IMEInventoryHandler> getCellArray( final IStorageChannel channel )
{
return Collections.emptyList();
}
@Override
public void blinkCell( int slot )
{
}
@Override
public void saveChanges( ICellInventory<?> cellInventory )
{
}
@Override
public int getPriority()
{
return this.priority;
}
@Override
public void setPriority( final int newValue )
{
this.priority = newValue;
this.getHost().markForSave();
this.resetCache( true );
}
@Override
@MENetworkEventSubscribe
public void powerRender( final MENetworkPowerStatusChange c )
{
this.updateStatus();
}
@Override
public void upgradesChanged()
{
super.upgradesChanged();
this.resetCache( true );
}
@Override
public void updateSetting( final IConfigManager manager, final Enum settingName, final Enum newValue )
{
if( settingName.name().equals( "ACCESS" ) )
{
this.accessChanged = true;
}
this.resetCache( true );
this.getHost().markForSave();
}
@Override
public void onNeighborChanged( IBlockAccess w, BlockPos pos, BlockPos neighbor )
{
if( pos.offset( this.getSide().getFacing() ).equals( neighbor ) )
{
final TileEntity te = w.getTileEntity( neighbor );
// In case the TE was destroyed, we have to do a full reset immediately.
if( te instanceof TileCableBus )
{
IPart iPart = ( (TileCableBus) te ).getPart( this.getSide().getOpposite() );
if( iPart == null || iPart instanceof PartFluidInterface )
{
this.resetCache( true );
this.resetCache();
}
}
else if( te == null || te instanceof TileFluidInterface )
{
this.resetCache( true );
this.resetCache();
}
else
{
this.resetCache( false );
}
}
}
@Override
public void readFromNBT( final NBTTagCompound data )
{
super.readFromNBT( data );
this.priority = data.getInteger( "priority" );
this.accessChanged = false;
}
@Override
public void writeToNBT( final NBTTagCompound data )
{
super.writeToNBT( data );
data.setInteger( "priority", this.priority );
}
@Override
public void getBoxes( final IPartCollisionHelper bch )
{
bch.addBox( 3, 3, 15, 13, 13, 16 );
bch.addBox( 2, 2, 14, 14, 14, 15 );
bch.addBox( 5, 5, 12, 11, 11, 14 );
}
@Override
protected int getUpgradeSlots()
{
return 5;
}
@Override
public float getCableConnectionLength( AECableType cable )
{
return 4;
}
}
@@ -19,16 +19,51 @@
package appeng.parts.misc; package appeng.parts.misc;
import java.util.Collections; import appeng.api.AEApi;
import java.util.List; import appeng.api.config.*;
import java.util.Objects; import appeng.api.networking.IGridNode;
import appeng.api.networking.events.MENetworkCellArrayUpdate;
import appeng.api.networking.events.MENetworkChannelsChanged;
import appeng.api.networking.events.MENetworkEventSubscribe;
import appeng.api.networking.events.MENetworkPowerStatusChange;
import appeng.api.networking.security.IActionSource;
import appeng.api.networking.storage.IBaseMonitor;
import appeng.api.networking.storage.IStorageGrid; import appeng.api.networking.storage.IStorageGrid;
import appeng.api.networking.ticking.IGridTickable;
import appeng.api.networking.ticking.ITickManager;
import appeng.api.networking.ticking.TickRateModulation;
import appeng.api.networking.ticking.TickingRequest;
import appeng.api.parts.IPart; import appeng.api.parts.IPart;
import appeng.api.parts.IPartCollisionHelper;
import appeng.api.parts.IPartModel;
import appeng.api.storage.*;
import appeng.api.storage.channels.IItemStorageChannel;
import appeng.api.storage.data.IAEItemStack;
import appeng.api.storage.data.IItemList;
import appeng.api.util.AECableType;
import appeng.api.util.IConfigManager;
import appeng.capabilities.Capabilities;
import appeng.core.AppEng;
import appeng.core.settings.TickRates;
import appeng.core.sync.GuiBridge;
import appeng.helpers.IPriorityHost;
import appeng.helpers.Reflected;
import appeng.items.parts.PartModels;
import appeng.me.GridAccessException;
import appeng.me.cache.GridStorageCache; import appeng.me.cache.GridStorageCache;
import appeng.me.helpers.MachineSource;
import appeng.me.storage.ITickingMonitor;
import appeng.me.storage.MEInventoryHandler;
import appeng.parts.PartModel;
import appeng.parts.automation.PartUpgradeable;
import appeng.tile.inventory.AppEngInternalAEInventory;
import appeng.tile.misc.TileInterface; import appeng.tile.misc.TileInterface;
import appeng.tile.networking.TileCableBus; import appeng.tile.networking.TileCableBus;
import appeng.util.ConfigManager; import appeng.util.ConfigManager;
import appeng.util.Platform;
import appeng.util.inv.InvOperation;
import appeng.util.prioritylist.FuzzyPriorityList;
import appeng.util.prioritylist.PrecisePriorityList;
import com.jaquadro.minecraft.storagedrawers.api.capabilities.IItemRepository; import com.jaquadro.minecraft.storagedrawers.api.capabilities.IItemRepository;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@@ -45,78 +80,22 @@ import net.minecraftforge.common.capabilities.CapabilityInject;
import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.items.CapabilityItemHandler;
import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.IItemHandler;
import appeng.api.AEApi; import java.util.Collections;
import appeng.api.config.AccessRestriction; import java.util.List;
import appeng.api.config.FuzzyMode; import java.util.Objects;
import appeng.api.config.IncludeExclude;
import appeng.api.config.Settings;
import appeng.api.config.StorageFilter;
import appeng.api.config.Upgrades;
import appeng.api.networking.IGridNode;
import appeng.api.networking.events.MENetworkCellArrayUpdate;
import appeng.api.networking.events.MENetworkChannelsChanged;
import appeng.api.networking.events.MENetworkEventSubscribe;
import appeng.api.networking.events.MENetworkPowerStatusChange;
import appeng.api.networking.security.IActionSource;
import appeng.api.networking.storage.IBaseMonitor;
import appeng.api.networking.ticking.IGridTickable;
import appeng.api.networking.ticking.ITickManager;
import appeng.api.networking.ticking.TickRateModulation;
import appeng.api.networking.ticking.TickingRequest;
import appeng.api.parts.IPartCollisionHelper;
import appeng.api.parts.IPartHost;
import appeng.api.parts.IPartModel;
import appeng.api.storage.ICellContainer;
import appeng.api.storage.ICellInventory;
import appeng.api.storage.IMEInventory;
import appeng.api.storage.IMEInventoryHandler;
import appeng.api.storage.IMEMonitorHandlerReceiver;
import appeng.api.storage.IStorageChannel;
import appeng.api.storage.IStorageMonitorable;
import appeng.api.storage.IStorageMonitorableAccessor;
import appeng.api.storage.channels.IItemStorageChannel;
import appeng.api.storage.data.IAEItemStack;
import appeng.api.storage.data.IItemList;
import appeng.api.util.AECableType;
import appeng.api.util.AEPartLocation;
import appeng.api.util.IConfigManager;
import appeng.capabilities.Capabilities;
import appeng.core.AppEng;
import appeng.core.settings.TickRates;
import appeng.core.sync.GuiBridge;
import appeng.helpers.IInterfaceHost;
import appeng.helpers.IPriorityHost;
import appeng.helpers.Reflected;
import appeng.items.parts.PartModels;
import appeng.me.GridAccessException;
import appeng.me.helpers.MachineSource;
import appeng.me.storage.ITickingMonitor;
import appeng.me.storage.MEInventoryHandler;
import appeng.parts.PartModel;
import appeng.parts.automation.PartUpgradeable;
import appeng.tile.inventory.AppEngInternalAEInventory;
import appeng.util.Platform;
import appeng.util.inv.InvOperation;
import appeng.util.prioritylist.FuzzyPriorityList;
import appeng.util.prioritylist.PrecisePriorityList;
public class PartStorageBus extends PartUpgradeable implements IGridTickable, ICellContainer, IMEMonitorHandlerReceiver<IAEItemStack>, IPriorityHost public class PartStorageBus extends PartUpgradeable implements IGridTickable, ICellContainer, IMEMonitorHandlerReceiver<IAEItemStack>, IPriorityHost
{ {
@CapabilityInject(IItemRepository.class)
public static Capability<IItemRepository> ITEM_REPOSITORY_CAPABILITY = null;
public static final ResourceLocation MODEL_BASE = new ResourceLocation( AppEng.MOD_ID, "part/storage_bus_base" ); public static final ResourceLocation MODEL_BASE = new ResourceLocation( AppEng.MOD_ID, "part/storage_bus_base" );
@PartModels @PartModels
public static final IPartModel MODELS_OFF = new PartModel( MODEL_BASE, new ResourceLocation( AppEng.MOD_ID, "part/storage_bus_off" ) ); public static final IPartModel MODELS_OFF = new PartModel( MODEL_BASE, new ResourceLocation( AppEng.MOD_ID, "part/storage_bus_off" ) );
@PartModels @PartModels
public static final IPartModel MODELS_ON = new PartModel( MODEL_BASE, new ResourceLocation( AppEng.MOD_ID, "part/storage_bus_on" ) ); public static final IPartModel MODELS_ON = new PartModel( MODEL_BASE, new ResourceLocation( AppEng.MOD_ID, "part/storage_bus_on" ) );
@PartModels @PartModels
public static final IPartModel MODELS_HAS_CHANNEL = new PartModel( MODEL_BASE, new ResourceLocation( AppEng.MOD_ID, "part/storage_bus_has_channel" ) ); public static final IPartModel MODELS_HAS_CHANNEL = new PartModel( MODEL_BASE, new ResourceLocation( AppEng.MOD_ID, "part/storage_bus_has_channel" ) );
@CapabilityInject( IItemRepository.class )
public static Capability<IItemRepository> ITEM_REPOSITORY_CAPABILITY = null;
private final IActionSource mySrc; private final IActionSource mySrc;
private final AppEngInternalAEInventory Config = new AppEngInternalAEInventory( this, 63 ); private final AppEngInternalAEInventory Config = new AppEngInternalAEInventory( this, 63 );
private int priority = 0; private int priority = 0;
@@ -236,9 +215,7 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
private void resetCache( final boolean fullReset ) private void resetCache( final boolean fullReset )
{ {
if( this.getHost() == null || this.getHost().getTile() == null || this.getHost().getTile().getWorld() == null || this.getHost() if( this.getHost() == null || this.getHost().getTile() == null || this.getHost().getTile().getWorld() == null || this.getHost().getTile().getWorld().isRemote )
.getTile()
.getWorld().isRemote )
{ {
return; return;
} }
@@ -279,7 +256,7 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
readOncePass = false; readOncePass = false;
try try
{ {
this.getProxy().getStorage().postAlterationOfStoredItems( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ), change, source ); this.getProxy().getStorage().postAlterationOfStoredItems( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ), change, mySrc );
} }
catch( final GridAccessException e ) catch( final GridAccessException e )
{ {
@@ -321,7 +298,6 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
{ {
if( pos.offset( this.getSide().getFacing() ).equals( neighbor ) ) if( pos.offset( this.getSide().getFacing() ).equals( neighbor ) )
{ {
final TileEntity te = w.getTileEntity( neighbor ); final TileEntity te = w.getTileEntity( neighbor );
// In case the TE was destroyed, we have to do a full reset immediately. // In case the TE was destroyed, we have to do a full reset immediately.
@@ -457,7 +433,7 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
} }
// Check via cap for IItemRepository // Check via cap for IItemRepository
if (ITEM_REPOSITORY_CAPABILITY != null && target.hasCapability( ITEM_REPOSITORY_CAPABILITY, targetSide )) if( ITEM_REPOSITORY_CAPABILITY != null && target.hasCapability( ITEM_REPOSITORY_CAPABILITY, targetSide ) )
{ {
IItemRepository handlerRepo = target.getCapability( ITEM_REPOSITORY_CAPABILITY, targetSide ); IItemRepository handlerRepo = target.getCapability( ITEM_REPOSITORY_CAPABILITY, targetSide );
if( handlerRepo != null ) if( handlerRepo != null )
@@ -539,9 +515,7 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
if( inv != null ) if( inv != null )
{ {
this.checkInterfaceVsStorageBus( target, this.getSide().getOpposite() ); this.handler = new MEInventoryHandler<>( inv, AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) );
this.handler = new MEInventoryHandler<IAEItemStack>( inv, AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) );
this.handler.setBaseAccess( (AccessRestriction) this.getConfigManager().getSetting( Settings.ACCESS ) ); this.handler.setBaseAccess( (AccessRestriction) this.getConfigManager().getSetting( Settings.ACCESS ) );
this.handler.setWhitelist( this.getInstalledUpgrades( Upgrades.INVERTER ) > 0 ? IncludeExclude.BLACKLIST : IncludeExclude.WHITELIST ); this.handler.setWhitelist( this.getInstalledUpgrades( Upgrades.INVERTER ) > 0 ? IncludeExclude.BLACKLIST : IncludeExclude.WHITELIST );
@@ -561,13 +535,11 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
if( this.getInstalledUpgrades( Upgrades.FUZZY ) > 0 ) if( this.getInstalledUpgrades( Upgrades.FUZZY ) > 0 )
{ {
this.handler this.handler.setPartitionList( new FuzzyPriorityList<>( priorityList, (FuzzyMode) this.getConfigManager().getSetting( Settings.FUZZY_MODE ) ) );
.setPartitionList( new FuzzyPriorityList<IAEItemStack>( priorityList, (FuzzyMode) this.getConfigManager()
.getSetting( Settings.FUZZY_MODE ) ) );
} }
else else
{ {
this.handler.setPartitionList( new PrecisePriorityList<IAEItemStack>( priorityList ) ); this.handler.setPartitionList( new PrecisePriorityList<>( priorityList ) );
} }
if( inv instanceof IBaseMonitor ) if( inv instanceof IBaseMonitor )
@@ -614,32 +586,6 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
return this.handler; return this.handler;
} }
private void checkInterfaceVsStorageBus( final TileEntity target, final AEPartLocation side )
{
IInterfaceHost achievement = null;
if( target instanceof IInterfaceHost )
{
achievement = (IInterfaceHost) target;
}
if( target instanceof IPartHost )
{
final Object part = ( (IPartHost) target ).getPart( side );
if( part instanceof IInterfaceHost )
{
achievement = (IInterfaceHost) part;
}
}
if( achievement != null && achievement.getActionableNode() != null )
{
// Platform.addStat( achievement.getActionableNode().getPlayerID(), Achievements.Recursive.getAchievement()
// );
// Platform.addStat( getActionableNode().getPlayerID(), Achievements.Recursive.getAchievement() );
}
}
@Override @Override
public List<IMEInventoryHandler> getCellArray( final IStorageChannel channel ) public List<IMEInventoryHandler> getCellArray( final IStorageChannel channel )
{ {
@@ -495,12 +495,12 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, ITerminal
try try
{ {
this.getProxy().getGrid().postEvent( new MENetworkCellArrayUpdate() );
if( this.getProxy().isActive() ) if( this.getProxy().isActive() )
{ {
final IStorageGrid gs = this.getProxy().getStorage(); final IStorageGrid gs = this.getProxy().getStorage();
Platform.postChanges( gs, removed, added, this.mySrc ); Platform.postChanges( gs, removed, added, this.mySrc );
} }
this.getProxy().getGrid().postEvent( new MENetworkCellArrayUpdate() );
} }
catch( final GridAccessException ignored ) catch( final GridAccessException ignored )
{ {
@@ -263,12 +263,12 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior
try try
{ {
this.getProxy().getGrid().postEvent( new MENetworkCellArrayUpdate() );
if( this.getProxy().isActive() ) if( this.getProxy().isActive() )
{ {
final IStorageGrid gs = this.getProxy().getStorage(); final IStorageGrid gs = this.getProxy().getStorage();
Platform.postChanges( gs, removed, added, this.mySrc ); Platform.postChanges( gs, removed, added, this.mySrc );
} }
this.getProxy().getGrid().postEvent( new MENetworkCellArrayUpdate() );
} }
catch( final GridAccessException ignored ) catch( final GridAccessException ignored )
{ {