private static boolean isPowered( final IGrid grid ) { if( grid == null ) { return false; } final IEnergyGrid eg = grid.getCache( IEnergyGrid.class ); return eg.isNetworkPowered(); }
public boolean isPowered() { try { return this.getEnergy().isNetworkPowered(); } catch( final GridAccessException e ) { return false; } }
public boolean isPowered() { if( Platform.isClient() ) { return ( this.constructed & this.powered ) == this.powered && this.constructed != -1; } try { return this.getProxy().getEnergy().isNetworkPowered(); } catch( final GridAccessException e ) { // :P } return false; }
@Override public boolean isPowered() { if( Platform.isServer() ) { try { return this.getProxy().getEnergy().isNetworkPowered(); } catch( final GridAccessException e ) { return false; } } return this.hasPower; }
@Override public final boolean isPowered() { try { if( Platform.isServer() ) { return this.getProxy().getEnergy().isNetworkPowered(); } else { return( ( this.getClientFlags() & PartPanel.POWERED_FLAG ) == PartPanel.POWERED_FLAG ); } } catch( final GridAccessException e ) { return false; } }
@Override public void writeToStream( final ByteBuf data ) throws IOException { super.writeToStream( data ); try { data.writeBoolean( this.getProxy().getEnergy().isNetworkPowered() ); } catch( final GridAccessException e ) { data.writeBoolean( false ); } }
@Override public boolean isActive() { final IGrid g = this.getGrid(); if( g != null ) { final IPathingGrid pg = g.getCache( IPathingGrid.class ); final IEnergyGrid eg = g.getCache( IEnergyGrid.class ); return eg.isNetworkPowered() && !pg.isNetworkBooting() && this.meetsChannelRequirements(); } return false; }
@Override public boolean isPowered() { if( Platform.isClient() ) { return ( this.state & 0x40 ) == 0x40; } boolean gridPowered = this.getAECurrentPower() > 64; if( !gridPowered ) { try { gridPowered = this.getProxy().getEnergy().isNetworkPowered(); } catch( final GridAccessException ignored ) { } } return super.getAECurrentPower() > 1 || gridPowered; }
protected void updatePowerStatus() { try { if( this.networkNode != null ) { this.setPowered( this.networkNode.isActive() ); } else if( this.getPowerSource() instanceof IEnergyGrid ) { this.setPowered( ( (IEnergyGrid) this.getPowerSource() ).isNetworkPowered() ); } else { this.setPowered( this.getPowerSource().extractAEPower( 1, Actionable.SIMULATE, PowerMultiplier.CONFIG ) > 0.8 ); } } catch( final Throwable t ) { // :P } }
protected boolean hasAccess( final SecurityPermissions perm, final boolean requirePower ) { final IActionHost host = this.getActionHost(); if( host != null ) { final IGridNode gn = host.getActionableNode(); if( gn != null ) { final IGrid g = gn.getGrid(); if( g != null ) { if( requirePower ) { final IEnergyGrid eg = g.getCache( IEnergyGrid.class ); if( !eg.isNetworkPowered() ) { return false; } } final ISecurityGrid sg = g.getCache( ISecurityGrid.class ); if( sg.hasPermission( this.getInventoryPlayer().player, perm ) ) { return true; } } } } return false; }
protected void updatePowerStatus() { try { if( this.networkNode != null ) { this.setPowered( this.networkNode.isActive() ); } else if( this.getPowerSource() instanceof IEnergyGrid ) { this.setPowered( ( (IEnergyGrid) this.getPowerSource() ).isNetworkPowered() ); } else { this.setPowered( this.getPowerSource().extractAEPower( 1, Actionable.SIMULATE, PowerMultiplier.CONFIG ) > 0.8 ); } } catch( final Exception ignore ) { // :P } }
@Override public void writeToStream( final ByteBuf data ) throws IOException { super.writeToStream( data ); this.clientFlags = this.getSpin() & 3; try { if( this.getProxy().getEnergy().isNetworkPowered() ) { this.clientFlags = this.getClientFlags() | AbstractPartReporting.POWERED_FLAG; } if( this.getProxy().getPath().isNetworkBooting() ) { this.clientFlags = this.getClientFlags() | AbstractPartReporting.BOOTING_FLAG; } if( this.getProxy().getNode().meetsChannelRequirements() ) { this.clientFlags = this.getClientFlags() | AbstractPartReporting.CHANNEL_FLAG; } } catch( final GridAccessException e ) { // um.. nothing. } data.writeByte( (byte) this.getClientFlags() ); data.writeInt( this.opacity ); }
@Override protected void writeToStream( final ByteBuf data ) throws IOException { super.writeToStream( data ); this.setClientFlags( 0 ); try { if( this.getProxy().getEnergy().isNetworkPowered() ) { this.setClientFlags( this.getClientFlags() | POWERED_FLAG ); } if( this.getProxy().getNode().meetsChannelRequirements() ) { this.setClientFlags( this.getClientFlags() | CHANNEL_FLAG ); } } catch( final GridAccessException e ) { // meh } data.writeByte( (byte) this.getClientFlags() ); }
@Override public void writeToStream( final ByteBuf data ) throws IOException { super.writeToStream( data ); this.setClientFlags( 0 ); try { if( this.getProxy().getEnergy().isNetworkPowered() ) { this.setClientFlags( this.getClientFlags() | POWERED_FLAG ); } if( this.getProxy().getNode().meetsChannelRequirements() ) { this.setClientFlags( this.getClientFlags() | CHANNEL_FLAG ); } this.setClientFlags( this.populateFlags( this.getClientFlags() ) ); } catch( final GridAccessException e ) { // meh } data.writeByte( (byte) this.getClientFlags() ); }
if( this.getProxy().getEnergy().isNetworkPowered() )
if( !this.getProxy().getEnergy().isNetworkPowered() )
private void updateMeta() { if( !this.getProxy().isReady() ) { return; } ControllerBlockState metaState = ControllerBlockState.offline; try { if( this.getProxy().getEnergy().isNetworkPowered() ) { metaState = ControllerBlockState.online; if( this.getProxy().getPath().getControllerState() == ControllerState.CONTROLLER_CONFLICT ) { metaState = ControllerBlockState.conflicted; } } } catch( final GridAccessException e ) { metaState = ControllerBlockState.offline; } if( this.checkController( this.pos ) && this.world.getBlockState( this.pos ).getValue( BlockController.CONTROLLER_STATE ) != metaState ) { this.world.setBlockState( this.pos, this.world.getBlockState( this.pos ).withProperty( BlockController.CONTROLLER_STATE, metaState ) ); } }
if( this.getProxy().getEnergy().isNetworkPowered() )
if( !this.getProxy().getEnergy().isNetworkPowered() )
@MENetworkEventSubscribe public void updatePowerStatus(MENetworkPowerStatusChange event) { try { this.isPowered = GridUtil.getEnergyGrid(this).isNetworkPowered(); } catch (GridAccessException e) { // should ignore? this.isPowered = false; } }