Fix all Channel Behavior and its mis-behaving.
This commit is contained in:
@@ -117,6 +117,9 @@ public class PartExportBus extends PartSharedItemBus implements IGridTickable
|
||||
@Override
|
||||
TickRateModulation doBusWork()
|
||||
{
|
||||
if ( !proxy.isActive() )
|
||||
return TickRateModulation.IDLE;
|
||||
|
||||
itemToSend = 1;
|
||||
didSomething = false;
|
||||
|
||||
|
||||
@@ -142,6 +142,9 @@ public class PartImportBus extends PartSharedItemBus implements IGridTickable, I
|
||||
|
||||
TickRateModulation doBusWork()
|
||||
{
|
||||
if ( !proxy.isActive() )
|
||||
return TickRateModulation.IDLE;
|
||||
|
||||
worked = false;
|
||||
|
||||
InventoryAdaptor myAdaptor = getHandler();
|
||||
|
||||
@@ -19,6 +19,8 @@ import appeng.api.config.Settings;
|
||||
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.security.BaseActionSource;
|
||||
import appeng.api.networking.security.MachineSource;
|
||||
import appeng.api.networking.ticking.IGridTickable;
|
||||
@@ -76,6 +78,25 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
|
||||
MEInventoryHandler handler = null;
|
||||
|
||||
int handlerHash = 0;
|
||||
boolean wasActive = false;
|
||||
|
||||
@MENetworkEventSubscribe
|
||||
public void updateChannels(MENetworkChannelsChanged chann)
|
||||
{
|
||||
boolean currentActive = proxy.isActive();
|
||||
if ( wasActive != currentActive )
|
||||
{
|
||||
wasActive = currentActive;
|
||||
try
|
||||
{
|
||||
proxy.getGrid().postEvent( new MENetworkCellArrayUpdate() );
|
||||
}
|
||||
catch (GridAccessException e)
|
||||
{
|
||||
// :P
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onActivate(EntityPlayer player, Vec3 pos)
|
||||
@@ -332,7 +353,7 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
|
||||
@Override
|
||||
public List<IMEInventoryHandler> getCellArray(StorageChannel channel)
|
||||
{
|
||||
IMEInventoryHandler out = getHandler();
|
||||
IMEInventoryHandler out = proxy.isActive() ? getHandler() : null;
|
||||
if ( out == null )
|
||||
return Arrays.asList( new IMEInventoryHandler[] {} );
|
||||
return Arrays.asList( new IMEInventoryHandler[] { out } );
|
||||
@@ -354,7 +375,8 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
|
||||
{
|
||||
try
|
||||
{
|
||||
proxy.getStorage().postAlterationOfStoredItems( StorageChannel.ITEMS, change, mySrc );
|
||||
if ( proxy.isActive() )
|
||||
proxy.getStorage().postAlterationOfStoredItems( StorageChannel.ITEMS, change, mySrc );
|
||||
}
|
||||
catch (GridAccessException e)
|
||||
{
|
||||
|
||||
@@ -35,6 +35,9 @@ public class PartConversionMonitor extends PartStorageMonitor
|
||||
if ( Platform.isClient() )
|
||||
return true;
|
||||
|
||||
if ( !proxy.isActive() )
|
||||
return false;
|
||||
|
||||
boolean ModeB = false;
|
||||
|
||||
ItemStack item = player.getCurrentEquippedItem();
|
||||
|
||||
@@ -123,6 +123,9 @@ public class PartStorageMonitor extends PartMonitor implements IPartStorageMonit
|
||||
if ( Platform.isClient() )
|
||||
return true;
|
||||
|
||||
if ( !proxy.isActive() )
|
||||
return false;
|
||||
|
||||
TileEntity te = this.tile;
|
||||
ItemStack eq = player.getCurrentEquippedItem();
|
||||
if ( Platform.isWrench( player, eq, te.xCoord, te.yCoord, te.zCoord ) )
|
||||
|
||||
@@ -6,6 +6,7 @@ import net.minecraft.util.Vec3;
|
||||
import appeng.api.storage.IMEMonitor;
|
||||
import appeng.api.storage.IStorageMonitorable;
|
||||
import appeng.client.texture.CableBusTextures;
|
||||
import appeng.core.localization.PlayerMessages;
|
||||
import appeng.core.sync.GuiBridge;
|
||||
import appeng.me.GridAccessException;
|
||||
import appeng.util.Platform;
|
||||
@@ -29,7 +30,16 @@ public class PartTerminal extends PartMonitor implements IStorageMonitorable
|
||||
if ( Platform.isClient() )
|
||||
return true;
|
||||
|
||||
Platform.openGUI( player, getHost().getTile(), side, GuiBridge.GUI_ME );
|
||||
if ( proxy.isActive() )
|
||||
Platform.openGUI( player, getHost().getTile(), side, GuiBridge.GUI_ME );
|
||||
else
|
||||
{
|
||||
if ( proxy.isPowered() )
|
||||
player.sendChatToPlayer( PlayerMessages.CommunicationError.get() );
|
||||
else
|
||||
player.sendChatToPlayer( PlayerMessages.MachineNotPowered.get() );
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user