wwww
This commit is contained in:
+1
-1
@@ -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 )
|
||||||
@@ -117,15 +117,7 @@ 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
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
+4
-9
@@ -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
@@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -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 )
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user