pick 97420a31d The big reformat of 2020

This commit is contained in:
yueh
2020-06-16 21:41:28 +02:00
parent 5304b3febe
commit 5225ea426b
2252 changed files with 95466 additions and 118582 deletions
@@ -18,8 +18,8 @@
package appeng.tile.networking;
import com.mojang.blaze3d.matrix.MatrixStack;
import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
@@ -28,27 +28,24 @@ import net.minecraft.util.Direction;
import appeng.api.parts.IPart;
import appeng.tile.AEBaseTile;
public class CableBusTESR extends TileEntityRenderer<TileCableBus> {
public class CableBusTESR extends TileEntityRenderer<TileCableBus>
{
public CableBusTESR(TileEntityRendererDispatcher rendererDispatcherIn) {
super(rendererDispatcherIn);
}
public CableBusTESR(TileEntityRendererDispatcher rendererDispatcherIn) {
super(rendererDispatcherIn);
}
@Override
public void render(TileCableBus te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffers,
int combinedLightIn, int combinedOverlayIn) {
if (!te.getCableBus().isRequiresDynamicRender()) {
return;
}
@Override
public void render(TileCableBus te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffers, int combinedLightIn, int combinedOverlayIn) {
if (!te.getCableBus().isRequiresDynamicRender()) {
return;
}
for( Direction facing : Direction.values() )
{
IPart part = te.getPart( facing );
if( part != null && part.requireDynamicRender() )
{
part.renderDynamic(partialTicks, ms, buffers, combinedLightIn, combinedOverlayIn);
}
}
}
for (Direction facing : Direction.values()) {
IPart part = te.getPart(facing);
if (part != null && part.requireDynamicRender()) {
part.renderDynamic(partialTicks, ms, buffers, combinedLightIn, combinedOverlayIn);
}
}
}
}
@@ -18,23 +18,13 @@
package appeng.tile.networking;
import java.io.IOException;
import java.util.List;
import java.util.Set;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import appeng.api.networking.IGridNode;
import appeng.api.parts.IFacadeContainer;
import appeng.api.parts.IPart;
import appeng.api.parts.LayerFlags;
import appeng.api.parts.SelectedPart;
import appeng.api.util.AECableType;
import appeng.api.util.AEColor;
import appeng.api.util.AEPartLocation;
import appeng.api.util.DimensionalCoord;
import appeng.block.networking.BlockCableBus;
import appeng.client.render.cablebus.CableBusRenderState;
import appeng.helpers.AEMultiTile;
import appeng.hooks.TickHandler;
import appeng.parts.CableBusContainer;
import appeng.tile.AEBaseTile;
import appeng.util.Platform;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
@@ -52,69 +42,73 @@ import net.minecraftforge.client.model.data.ModelProperty;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.util.LazyOptional;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.io.IOException;
import java.util.List;
import java.util.Set;
import appeng.api.networking.IGridNode;
import appeng.api.parts.IFacadeContainer;
import appeng.api.parts.IPart;
import appeng.api.parts.LayerFlags;
import appeng.api.parts.SelectedPart;
import appeng.api.util.AECableType;
import appeng.api.util.AEColor;
import appeng.api.util.AEPartLocation;
import appeng.api.util.DimensionalCoord;
import appeng.block.networking.BlockCableBus;
import appeng.client.render.cablebus.CableBusRenderState;
import appeng.helpers.AEMultiTile;
import appeng.hooks.TickHandler;
import appeng.parts.CableBusContainer;
import appeng.tile.AEBaseTile;
import appeng.util.Platform;
public class TileCableBus extends AEBaseTile implements AEMultiTile {
public class TileCableBus extends AEBaseTile implements AEMultiTile
{
private CableBusContainer cb = new CableBusContainer(this);
private CableBusContainer cb = new CableBusContainer( this );
private int oldLV = -1; // on re-calculate light when it changes
private int oldLV = -1; // on re-calculate light when it changes
public TileCableBus(TileEntityType<?> tileEntityTypeIn) {
super(tileEntityTypeIn);
}
public TileCableBus(TileEntityType<?> tileEntityTypeIn) {
super(tileEntityTypeIn);
}
@Override
public void read(final CompoundNBT data) {
super.read(data);
this.getCableBus().readFromNBT(data);
}
@Override
public void read(final CompoundNBT data )
{
super.read( data );
this.getCableBus().readFromNBT( data );
}
@Override
public CompoundNBT write(final CompoundNBT data) {
super.write(data);
this.getCableBus().writeToNBT(data);
return data;
}
@Override
public CompoundNBT write(final CompoundNBT data )
{
super.write( data );
this.getCableBus().writeToNBT( data );
return data;
}
@Override
protected boolean readFromStream(final PacketBuffer data) throws IOException {
final boolean c = super.readFromStream(data);
boolean ret = this.getCableBus().readFromStream(data);
@Override
protected boolean readFromStream( final PacketBuffer data ) throws IOException
{
final boolean c = super.readFromStream( data );
boolean ret = this.getCableBus().readFromStream( data );
final int newLV = this.getCableBus().getLightValue();
if (newLV != this.oldLV) {
this.oldLV = newLV;
this.world.getLightManager().checkBlock(this.pos);
ret = true;
}
final int newLV = this.getCableBus().getLightValue();
if( newLV != this.oldLV )
{
this.oldLV = newLV;
this.world.getLightManager().checkBlock( this.pos );
ret = true;
}
this.updateTileSetting();
return ret || c;
}
this.updateTileSetting();
return ret || c;
}
@Override
protected void writeToStream(final PacketBuffer data) throws IOException {
super.writeToStream(data);
this.getCableBus().writeToStream(data);
}
@Override
protected void writeToStream( final PacketBuffer data ) throws IOException
{
super.writeToStream( data );
this.getCableBus().writeToStream( data );
}
/**
* Changes this tile to the TESR version if any of the parts require dynamic rendering.
*/
protected void updateTileSetting()
{
/**
* Changes this tile to the TESR version if any of the parts require dynamic
* rendering.
*/
protected void updateTileSetting() {
// FIXME if( this.getCableBus().isRequiresDynamicRender() )
// FIXME {
// FIXME try
@@ -128,279 +122,234 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile
// FIXME
// FIXME }
// FIXME }
}
}
protected void copyFrom( final TileCableBus oldTile )
{
final CableBusContainer tmpCB = this.getCableBus();
this.setCableBus( oldTile.getCableBus() );
this.oldLV = oldTile.oldLV;
oldTile.setCableBus( tmpCB );
}
protected void copyFrom(final TileCableBus oldTile) {
final CableBusContainer tmpCB = this.getCableBus();
this.setCableBus(oldTile.getCableBus());
this.oldLV = oldTile.oldLV;
oldTile.setCableBus(tmpCB);
}
@Override
public double getMaxRenderDistanceSquared()
{
return 900.0;
}
@Override
public double getMaxRenderDistanceSquared() {
return 900.0;
}
@Override
public void remove()
{
super.remove();
this.getCableBus().removeFromWorld();
}
@Override
public void remove() {
super.remove();
this.getCableBus().removeFromWorld();
}
@Override
public void validate()
{
super.validate();
TickHandler.INSTANCE.addInit( this );
}
@Override
public void validate() {
super.validate();
TickHandler.INSTANCE.addInit(this);
}
@Override
public IGridNode getGridNode( final AEPartLocation dir )
{
return this.getCableBus().getGridNode( dir );
}
@Override
public IGridNode getGridNode(final AEPartLocation dir) {
return this.getCableBus().getGridNode(dir);
}
@Override
public AECableType getCableConnectionType( final AEPartLocation side )
{
return this.getCableBus().getCableConnectionType( side );
}
@Override
public AECableType getCableConnectionType(final AEPartLocation side) {
return this.getCableBus().getCableConnectionType(side);
}
@Override
public float getCableConnectionLength( AECableType cable )
{
return this.getCableBus().getCableConnectionLength( cable );
}
@Override
public float getCableConnectionLength(AECableType cable) {
return this.getCableBus().getCableConnectionLength(cable);
}
@Override
public void onChunkUnloaded()
{
super.onChunkUnloaded();
this.getCableBus().removeFromWorld();
}
@Override
public void onChunkUnloaded() {
super.onChunkUnloaded();
this.getCableBus().removeFromWorld();
}
@Override
public void markForUpdate()
{
if( this.world == null )
{
return;
}
@Override
public void markForUpdate() {
if (this.world == null) {
return;
}
final int newLV = this.getCableBus().getLightValue();
if( newLV != this.oldLV )
{
this.oldLV = newLV;
this.world.getLightManager().checkBlock( this.pos );
}
final int newLV = this.getCableBus().getLightValue();
if (newLV != this.oldLV) {
this.oldLV = newLV;
this.world.getLightManager().checkBlock(this.pos);
}
super.markForUpdate();
}
super.markForUpdate();
}
@Override
public boolean canBeRotated()
{
return false;
}
@Override
public boolean canBeRotated() {
return false;
}
@Override
public void getDrops( final World w, final BlockPos pos, final List drops )
{
this.getCableBus().getDrops( drops );
}
@Override
public void getDrops(final World w, final BlockPos pos, final List drops) {
this.getCableBus().getDrops(drops);
}
@Override
public void getNoDrops( final World w, final BlockPos pos, final List<ItemStack> drops )
{
this.getCableBus().getNoDrops( drops );
}
@Override
public void getNoDrops(final World w, final BlockPos pos, final List<ItemStack> drops) {
this.getCableBus().getNoDrops(drops);
}
@Override
public void onReady()
{
super.onReady();
if( this.getCableBus().isEmpty() )
{
if( this.world.getTileEntity( this.pos ) == this )
{
this.world.destroyBlock( this.pos, true );
}
}
else
{
this.getCableBus().addToWorld();
}
}
@Override
public void onReady() {
super.onReady();
if (this.getCableBus().isEmpty()) {
if (this.world.getTileEntity(this.pos) == this) {
this.world.destroyBlock(this.pos, true);
}
} else {
this.getCableBus().addToWorld();
}
}
@Override
public IFacadeContainer getFacadeContainer()
{
return this.getCableBus().getFacadeContainer();
}
@Override
public IFacadeContainer getFacadeContainer() {
return this.getCableBus().getFacadeContainer();
}
@Override
public boolean canAddPart( final ItemStack is, final AEPartLocation side )
{
return this.getCableBus().canAddPart( is, side );
}
@Override
public boolean canAddPart(final ItemStack is, final AEPartLocation side) {
return this.getCableBus().canAddPart(is, side);
}
@Override
public AEPartLocation addPart( final ItemStack is, final AEPartLocation side, final PlayerEntity player, final Hand hand )
{
return this.getCableBus().addPart( is, side, player, hand );
}
@Override
public AEPartLocation addPart(final ItemStack is, final AEPartLocation side, final PlayerEntity player,
final Hand hand) {
return this.getCableBus().addPart(is, side, player, hand);
}
@Override
public IPart getPart( final AEPartLocation side )
{
return this.cb.getPart( side );
}
@Override
public IPart getPart(final AEPartLocation side) {
return this.cb.getPart(side);
}
@Override
public IPart getPart( final Direction side )
{
return this.getCableBus().getPart( side );
}
@Override
public IPart getPart(final Direction side) {
return this.getCableBus().getPart(side);
}
@Override
public void removePart( final AEPartLocation side, final boolean suppressUpdate )
{
this.getCableBus().removePart( side, suppressUpdate );
}
@Override
public void removePart(final AEPartLocation side, final boolean suppressUpdate) {
this.getCableBus().removePart(side, suppressUpdate);
}
@Override
public DimensionalCoord getLocation()
{
return new DimensionalCoord( this );
}
@Override
public DimensionalCoord getLocation() {
return new DimensionalCoord(this);
}
@Override
public AEColor getColor()
{
return this.getCableBus().getColor();
}
@Override
public AEColor getColor() {
return this.getCableBus().getColor();
}
@Override
public void clearContainer()
{
this.setCableBus( new CableBusContainer( this ) );
}
@Override
public void clearContainer() {
this.setCableBus(new CableBusContainer(this));
}
@Override
public boolean isBlocked( final Direction side )
{
// TODO 1.10.2-R - Stuff.
return false;
}
@Override
public boolean isBlocked(final Direction side) {
// TODO 1.10.2-R - Stuff.
return false;
}
@Override
public SelectedPart selectPart( final Vec3d pos )
{
return this.getCableBus().selectPart( pos );
}
@Override
public SelectedPart selectPart(final Vec3d pos) {
return this.getCableBus().selectPart(pos);
}
@Override
public void markForSave()
{
this.saveChanges();
}
@Override
public void markForSave() {
this.saveChanges();
}
@Override
public void partChanged()
{
this.notifyNeighbors();
}
@Override
public void partChanged() {
this.notifyNeighbors();
}
@Override
public boolean hasRedstone( final AEPartLocation side )
{
return this.getCableBus().hasRedstone( side );
}
@Override
public boolean hasRedstone(final AEPartLocation side) {
return this.getCableBus().hasRedstone(side);
}
@Override
public boolean isEmpty()
{
return this.getCableBus().isEmpty();
}
@Override
public boolean isEmpty() {
return this.getCableBus().isEmpty();
}
@Override
public Set<LayerFlags> getLayerFlags()
{
return this.getCableBus().getLayerFlags();
}
@Override
public Set<LayerFlags> getLayerFlags() {
return this.getCableBus().getLayerFlags();
}
@Override
public void cleanup()
{
this.getWorld().removeBlock(this.pos, false);
}
@Override
public void cleanup() {
this.getWorld().removeBlock(this.pos, false);
}
@Override
public void notifyNeighbors()
{
if( this.world != null && this.world.isBlockLoaded( this.pos ) && !CableBusContainer.isLoading() )
{
Platform.notifyBlocksOfNeighbors( this.world, this.pos );
}
}
@Override
public void notifyNeighbors() {
if (this.world != null && this.world.isBlockLoaded(this.pos) && !CableBusContainer.isLoading()) {
Platform.notifyBlocksOfNeighbors(this.world, this.pos);
}
}
@Override
public boolean isInWorld()
{
return this.getCableBus().isInWorld();
}
@Override
public boolean isInWorld() {
return this.getCableBus().isInWorld();
}
@Override
public boolean recolourBlock( final Direction side, final AEColor colour, final PlayerEntity who )
{
return this.getCableBus().recolourBlock( side, colour, who );
}
@Override
public boolean recolourBlock(final Direction side, final AEColor colour, final PlayerEntity who) {
return this.getCableBus().recolourBlock(side, colour, who);
}
public CableBusContainer getCableBus()
{
return this.cb;
}
public CableBusContainer getCableBus() {
return this.cb;
}
private void setCableBus( final CableBusContainer cb )
{
this.cb = cb;
}
private void setCableBus(final CableBusContainer cb) {
this.cb = cb;
}
@Override
public <T> LazyOptional<T> getCapability(Capability<T> capabilityClass, @Nullable Direction fromSide )
{
// Note that null will be translated to INTERNAL here
AEPartLocation partLocation = AEPartLocation.fromFacing( fromSide );
@Override
public <T> LazyOptional<T> getCapability(Capability<T> capabilityClass, @Nullable Direction fromSide) {
// Note that null will be translated to INTERNAL here
AEPartLocation partLocation = AEPartLocation.fromFacing(fromSide);
IPart part = this.getPart( partLocation );
LazyOptional<T> result = part == null ? LazyOptional.empty() : part.getCapability(capabilityClass);
IPart part = this.getPart(partLocation);
LazyOptional<T> result = part == null ? LazyOptional.empty() : part.getCapability(capabilityClass);
if( result != null )
{
return result;
}
if (result != null) {
return result;
}
return super.getCapability( capabilityClass, fromSide );
}
return super.getCapability(capabilityClass, fromSide);
}
@Nonnull
@Override
public IModelData getModelData() {
World world = getWorld();
if (world == null) {
return EmptyModelData.INSTANCE;
}
@Nonnull
@Override
public IModelData getModelData() {
World world = getWorld();
if (world == null) {
return EmptyModelData.INSTANCE;
}
CableBusRenderState renderState = this.cb.getRenderState();
renderState.setWorld(world);
renderState.setPos(pos);
return new ModelDataMap.Builder()
.withInitial(CableBusRenderState.PROPERTY, renderState)
.build();
CableBusRenderState renderState = this.cb.getRenderState();
renderState.setWorld(world);
renderState.setPos(pos);
return new ModelDataMap.Builder().withInitial(CableBusRenderState.PROPERTY, renderState).build();
}
}
}
@@ -18,24 +18,22 @@
package appeng.tile.networking;
import appeng.block.networking.BlockCableBus;
import net.minecraft.tileentity.TileEntityType;
import appeng.block.networking.BlockCableBus;
public class TileCableBusTESR extends TileCableBus
{
public class TileCableBusTESR extends TileCableBus {
public TileCableBusTESR(TileEntityType<?> tileEntityTypeIn) {
super(tileEntityTypeIn);
}
public TileCableBusTESR(TileEntityType<?> tileEntityTypeIn) {
super(tileEntityTypeIn);
}
/**
* Changes this tile to the non-TESR version, if none of the parts require dynamic rendering.
*/
@Override
protected void updateTileSetting()
{
/**
* Changes this tile to the non-TESR version, if none of the parts require
* dynamic rendering.
*/
@Override
protected void updateTileSetting() {
// FIXME if( !this.getCableBus().isRequiresDynamicRender() )
// FIXME {
// FIXME try
@@ -49,5 +47,5 @@ public class TileCableBusTESR extends TileCableBus
// FIXME
// FIXME }
// FIXME }
}
}
}
@@ -18,7 +18,6 @@
package appeng.tile.networking;
import java.util.EnumSet;
import net.minecraft.item.ItemStack;
@@ -46,176 +45,148 @@ import appeng.me.GridAccessException;
import appeng.tile.grid.AENetworkPowerTile;
import appeng.util.inv.InvOperation;
public class TileController extends AENetworkPowerTile {
private boolean isValid = false;
public class TileController extends AENetworkPowerTile
{
private boolean isValid = false;
public TileController(TileEntityType<?> tileEntityTypeIn) {
super(tileEntityTypeIn);
this.setInternalMaxPower(8000);
this.setInternalPublicPowerStorage(true);
this.getProxy().setIdlePowerUsage(3);
this.getProxy().setFlags(GridFlags.CANNOT_CARRY, GridFlags.DENSE_CAPACITY);
}
public TileController(TileEntityType<?> tileEntityTypeIn) {
super(tileEntityTypeIn);
this.setInternalMaxPower( 8000 );
this.setInternalPublicPowerStorage( true );
this.getProxy().setIdlePowerUsage( 3 );
this.getProxy().setFlags( GridFlags.CANNOT_CARRY, GridFlags.DENSE_CAPACITY );
}
@Override
public AECableType getCableConnectionType(final AEPartLocation dir) {
return AECableType.DENSE_SMART;
}
@Override
public AECableType getCableConnectionType( final AEPartLocation dir )
{
return AECableType.DENSE_SMART;
}
@Override
public void onReady() {
this.onNeighborChange(true);
super.onReady();
}
@Override
public void onReady()
{
this.onNeighborChange( true );
super.onReady();
}
public void onNeighborChange(final boolean force) {
final boolean xx = this.checkController(this.pos.offset(Direction.EAST))
&& this.checkController(this.pos.offset(Direction.WEST));
final boolean yy = this.checkController(this.pos.offset(Direction.UP))
&& this.checkController(this.pos.offset(Direction.DOWN));
final boolean zz = this.checkController(this.pos.offset(Direction.NORTH))
&& this.checkController(this.pos.offset(Direction.SOUTH));
public void onNeighborChange( final boolean force )
{
final boolean xx = this.checkController( this.pos.offset( Direction.EAST ) ) && this.checkController( this.pos.offset( Direction.WEST ) );
final boolean yy = this.checkController( this.pos.offset( Direction.UP ) ) && this.checkController( this.pos.offset( Direction.DOWN ) );
final boolean zz = this.checkController( this.pos.offset( Direction.NORTH ) ) && this.checkController( this.pos.offset( Direction.SOUTH ) );
// int meta = world.getBlockMetadata( xCoord, yCoord, zCoord );
// boolean hasPower = meta > 0;
// boolean isConflict = meta == 2;
// int meta = world.getBlockMetadata( xCoord, yCoord, zCoord );
// boolean hasPower = meta > 0;
// boolean isConflict = meta == 2;
final boolean oldValid = this.isValid;
final boolean oldValid = this.isValid;
this.isValid = (xx && !yy && !zz) || (!xx && yy && !zz) || (!xx && !yy && zz)
|| ((xx ? 1 : 0) + (yy ? 1 : 0) + (zz ? 1 : 0) <= 1);
this.isValid = ( xx && !yy && !zz ) || ( !xx && yy && !zz ) || ( !xx && !yy && zz ) || ( ( xx ? 1 : 0 ) + ( yy ? 1 : 0 ) + ( zz ? 1 : 0 ) <= 1 );
if (oldValid != this.isValid || force) {
if (this.isValid) {
this.getProxy().setValidSides(EnumSet.allOf(Direction.class));
} else {
this.getProxy().setValidSides(EnumSet.noneOf(Direction.class));
}
if( oldValid != this.isValid || force )
{
if( this.isValid )
{
this.getProxy().setValidSides( EnumSet.allOf( Direction.class ) );
}
else
{
this.getProxy().setValidSides( EnumSet.noneOf( Direction.class ) );
}
this.updateMeta();
}
this.updateMeta();
}
}
}
private void updateMeta() {
if (!this.getProxy().isReady()) {
return;
}
private void updateMeta()
{
if( !this.getProxy().isReady() )
{
return;
}
ControllerBlockState metaState = ControllerBlockState.offline;
ControllerBlockState metaState = ControllerBlockState.offline;
try {
if (this.getProxy().getEnergy().isNetworkPowered()) {
metaState = ControllerBlockState.online;
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.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).get(BlockController.CONTROLLER_STATE) != metaState) {
this.world.setBlockState(this.pos,
this.world.getBlockState(this.pos).with(BlockController.CONTROLLER_STATE, metaState));
}
if( this.checkController( this.pos ) && this.world.getBlockState( this.pos ).get( BlockController.CONTROLLER_STATE ) != metaState )
{
this.world.setBlockState( this.pos, this.world.getBlockState( this.pos ).with( BlockController.CONTROLLER_STATE, metaState ) );
}
}
}
@Override
protected double getFunnelPowerDemand(final double maxReceived) {
try {
final IEnergyGrid grid = this.getProxy().getEnergy();
@Override
protected double getFunnelPowerDemand( final double maxReceived )
{
try
{
final IEnergyGrid grid = this.getProxy().getEnergy();
return grid.getEnergyDemand(maxReceived);
} catch (final GridAccessException e) {
// no grid? use local...
return super.getFunnelPowerDemand(maxReceived);
}
}
return grid.getEnergyDemand( maxReceived );
}
catch( final GridAccessException e )
{
// no grid? use local...
return super.getFunnelPowerDemand( maxReceived );
}
}
@Override
protected double funnelPowerIntoStorage(final double power, final Actionable mode) {
try {
final IEnergyGrid grid = this.getProxy().getEnergy();
final double leftOver = grid.injectPower(power, mode);
@Override
protected double funnelPowerIntoStorage( final double power, final Actionable mode )
{
try
{
final IEnergyGrid grid = this.getProxy().getEnergy();
final double leftOver = grid.injectPower( power, mode );
return leftOver;
} catch (final GridAccessException e) {
// no grid? use local...
return super.funnelPowerIntoStorage(power, mode);
}
}
return leftOver;
}
catch( final GridAccessException e )
{
// no grid? use local...
return super.funnelPowerIntoStorage( power, mode );
}
}
@Override
protected void PowerEvent(final PowerEventType x) {
try {
this.getProxy().getGrid().postEvent(new MENetworkPowerStorage(this, x));
} catch (final GridAccessException e) {
// not ready!
}
}
@Override
protected void PowerEvent( final PowerEventType x )
{
try
{
this.getProxy().getGrid().postEvent( new MENetworkPowerStorage( this, x ) );
}
catch( final GridAccessException e )
{
// not ready!
}
}
@MENetworkEventSubscribe
public void onControllerChange(final MENetworkControllerChange status) {
this.updateMeta();
}
@MENetworkEventSubscribe
public void onControllerChange( final MENetworkControllerChange status )
{
this.updateMeta();
}
@MENetworkEventSubscribe
public void onPowerChange(final MENetworkPowerStatusChange status) {
this.updateMeta();
}
@MENetworkEventSubscribe
public void onPowerChange( final MENetworkPowerStatusChange status )
{
this.updateMeta();
}
@Override
public IItemHandler getInternalInventory() {
return EmptyHandler.INSTANCE;
}
@Override
public IItemHandler getInternalInventory()
{
return EmptyHandler.INSTANCE;
}
@Override
public void onChangeInventory(final IItemHandler inv, final int slot, final InvOperation mc,
final ItemStack removed, final ItemStack added) {
}
@Override
public void onChangeInventory( final IItemHandler inv, final int slot, final InvOperation mc, final ItemStack removed, final ItemStack added )
{
}
/**
* Check for a controller at this coordinates as well as is it loaded.
*
* @return true if there is a loaded controller
*/
private boolean checkController(final BlockPos pos) {
if (this.world.getChunkProvider().isChunkLoaded(new ChunkPos(pos.getX() >> 4, pos.getZ() >> 4))) {
return this.world.getTileEntity(pos) instanceof TileController;
}
/**
* Check for a controller at this coordinates as well as is it loaded.
*
* @return true if there is a loaded controller
*/
private boolean checkController( final BlockPos pos )
{
if( this.world.getChunkProvider().isChunkLoaded( new ChunkPos(pos.getX() >> 4, pos.getZ() >> 4)) )
{
return this.world.getTileEntity( pos ) instanceof TileController;
}
return false;
}
return false;
}
}
@@ -18,6 +18,7 @@
package appeng.tile.networking;
import net.minecraft.tileentity.TileEntityType;
import appeng.api.config.AccessRestriction;
import appeng.api.config.Actionable;
@@ -26,56 +27,46 @@ import appeng.api.networking.energy.IAEPowerStorage;
import appeng.api.util.AECableType;
import appeng.api.util.AEPartLocation;
import appeng.tile.grid.AENetworkTile;
import net.minecraft.tileentity.TileEntityType;
public class TileCreativeEnergyCell extends AENetworkTile implements IAEPowerStorage {
public class TileCreativeEnergyCell extends AENetworkTile implements IAEPowerStorage
{
public TileCreativeEnergyCell(TileEntityType<?> tileEntityTypeIn) {
super(tileEntityTypeIn);
this.getProxy().setIdlePowerUsage(0);
}
public TileCreativeEnergyCell(TileEntityType<?> tileEntityTypeIn) {
super(tileEntityTypeIn);
this.getProxy().setIdlePowerUsage( 0 );
}
@Override
public AECableType getCableConnectionType(final AEPartLocation dir) {
return AECableType.COVERED;
}
@Override
public AECableType getCableConnectionType( final AEPartLocation dir )
{
return AECableType.COVERED;
}
@Override
public double injectAEPower(final double amt, final Actionable mode) {
return 0;
}
@Override
public double injectAEPower( final double amt, final Actionable mode )
{
return 0;
}
@Override
public double getAEMaxPower() {
return Long.MAX_VALUE / 10000;
}
@Override
public double getAEMaxPower()
{
return Long.MAX_VALUE / 10000;
}
@Override
public double getAECurrentPower() {
return Long.MAX_VALUE / 10000;
}
@Override
public double getAECurrentPower()
{
return Long.MAX_VALUE / 10000;
}
@Override
public boolean isAEPublicPowerStorage() {
return true;
}
@Override
public boolean isAEPublicPowerStorage()
{
return true;
}
@Override
public AccessRestriction getPowerFlow() {
return AccessRestriction.READ_WRITE;
}
@Override
public AccessRestriction getPowerFlow()
{
return AccessRestriction.READ_WRITE;
}
@Override
public double extractAEPower( final double amt, final Actionable mode, final PowerMultiplier pm )
{
return amt;
}
@Override
public double extractAEPower(final double amt, final Actionable mode, final PowerMultiplier pm) {
return amt;
}
}
@@ -18,15 +18,13 @@
package appeng.tile.networking;
import net.minecraft.tileentity.TileEntityType;
public class TileDenseEnergyCell extends TileEnergyCell
{
public class TileDenseEnergyCell extends TileEnergyCell {
public TileDenseEnergyCell(TileEntityType<?> tileEntityTypeIn) {
super(tileEntityTypeIn);
this.setInternalMaxPower( 200000 * 8 );
}
public TileDenseEnergyCell(TileEntityType<?> tileEntityTypeIn) {
super(tileEntityTypeIn);
this.setInternalMaxPower(200000 * 8);
}
}
@@ -18,7 +18,6 @@
package appeng.tile.networking;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntityType;
import net.minecraftforge.items.IItemHandler;
@@ -32,62 +31,50 @@ import appeng.me.GridAccessException;
import appeng.tile.grid.AENetworkPowerTile;
import appeng.util.inv.InvOperation;
public class TileEnergyAcceptor extends AENetworkPowerTile {
public class TileEnergyAcceptor extends AENetworkPowerTile
{
public TileEnergyAcceptor(TileEntityType<?> tileEntityTypeIn) {
super(tileEntityTypeIn);
this.getProxy().setIdlePowerUsage(0.0);
this.setInternalMaxPower(0);
}
public TileEnergyAcceptor(TileEntityType<?> tileEntityTypeIn) {
super(tileEntityTypeIn);
this.getProxy().setIdlePowerUsage( 0.0 );
this.setInternalMaxPower( 0 );
}
@Override
public AECableType getCableConnectionType(final AEPartLocation dir) {
return AECableType.COVERED;
}
@Override
public AECableType getCableConnectionType( final AEPartLocation dir )
{
return AECableType.COVERED;
}
@Override
protected double getFunnelPowerDemand(final double maxRequired) {
try {
final IEnergyGrid grid = this.getProxy().getEnergy();
@Override
protected double getFunnelPowerDemand( final double maxRequired )
{
try
{
final IEnergyGrid grid = this.getProxy().getEnergy();
return grid.getEnergyDemand(maxRequired);
} catch (final GridAccessException e) {
return this.getInternalMaxPower();
}
}
return grid.getEnergyDemand( maxRequired );
}
catch( final GridAccessException e )
{
return this.getInternalMaxPower();
}
}
@Override
protected double funnelPowerIntoStorage(final double power, final Actionable mode) {
try {
final IEnergyGrid grid = this.getProxy().getEnergy();
final double leftOver = grid.injectPower(power, mode);
@Override
protected double funnelPowerIntoStorage( final double power, final Actionable mode )
{
try
{
final IEnergyGrid grid = this.getProxy().getEnergy();
final double leftOver = grid.injectPower( power, mode );
return leftOver;
} catch (final GridAccessException e) {
return super.funnelPowerIntoStorage(power, mode);
}
}
return leftOver;
}
catch( final GridAccessException e )
{
return super.funnelPowerIntoStorage( power, mode );
}
}
@Override
public IItemHandler getInternalInventory() {
return EmptyHandler.INSTANCE;
}
@Override
public IItemHandler getInternalInventory()
{
return EmptyHandler.INSTANCE;
}
@Override
public void onChangeInventory(final IItemHandler inv, final int slot, final InvOperation mc,
final ItemStack removed, final ItemStack added) {
@Override
public void onChangeInventory( final IItemHandler inv, final int slot, final InvOperation mc, final ItemStack removed, final ItemStack added )
{
}
}
}
@@ -18,8 +18,8 @@
package appeng.tile.networking;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.tileentity.TileEntityType;
import appeng.api.config.AccessRestriction;
import appeng.api.config.Actionable;
@@ -33,225 +33,189 @@ import appeng.block.networking.BlockEnergyCell;
import appeng.me.GridAccessException;
import appeng.tile.grid.AENetworkTile;
import appeng.util.SettingsFrom;
import net.minecraft.tileentity.TileEntityType;
public class TileEnergyCell extends AENetworkTile implements IAEPowerStorage {
public class TileEnergyCell extends AENetworkTile implements IAEPowerStorage
{
private double internalCurrentPower = 0.0;
private double internalMaxPower = 200000.0;
private double internalCurrentPower = 0.0;
private double internalMaxPower = 200000.0;
private byte currentMeta = -1;
private byte currentMeta = -1;
public TileEnergyCell(TileEntityType<?> tileEntityTypeIn) {
super(tileEntityTypeIn);
this.getProxy().setIdlePowerUsage(0);
}
public TileEnergyCell(TileEntityType<?> tileEntityTypeIn) {
super(tileEntityTypeIn);
this.getProxy().setIdlePowerUsage( 0 );
}
@Override
public AECableType getCableConnectionType(final AEPartLocation dir) {
return AECableType.COVERED;
}
@Override
public AECableType getCableConnectionType( final AEPartLocation dir )
{
return AECableType.COVERED;
}
@Override
public void onReady() {
super.onReady();
final int value = this.world.getBlockState(this.pos).get(BlockEnergyCell.ENERGY_STORAGE);
this.currentMeta = (byte) value;
this.changePowerLevel();
}
@Override
public void onReady()
{
super.onReady();
final int value = this.world.getBlockState( this.pos ).get( BlockEnergyCell.ENERGY_STORAGE );
this.currentMeta = (byte) value;
this.changePowerLevel();
}
/**
* Given a fill factor, return the storage level (0-7) used for the state of the
* block. This is also used for determining the item model.
*/
public static int getStorageLevelFromFillFactor(double fillFactor) {
byte boundMetadata = (byte) (8.0 * (fillFactor));
/**
* Given a fill factor, return the storage level (0-7) used for the state of the block.
* This is also used for determining the item model.
*/
public static int getStorageLevelFromFillFactor( double fillFactor )
{
byte boundMetadata = (byte) ( 8.0 * ( fillFactor ) );
if (boundMetadata > 7) {
boundMetadata = 7;
}
if (boundMetadata < 0) {
boundMetadata = 0;
}
return boundMetadata;
}
if( boundMetadata > 7 )
{
boundMetadata = 7;
}
if( boundMetadata < 0 )
{
boundMetadata = 0;
}
return boundMetadata;
}
private void changePowerLevel() {
if (this.notLoaded() || this.isRemoved()) {
return;
}
private void changePowerLevel()
{
if( this.notLoaded() || this.isRemoved() )
{
return;
}
int storageLevel = getStorageLevelFromFillFactor(this.internalCurrentPower / this.getInternalMaxPower());
int storageLevel = getStorageLevelFromFillFactor( this.internalCurrentPower / this.getInternalMaxPower() );
if (this.currentMeta != storageLevel) {
this.currentMeta = (byte) storageLevel;
this.world.setBlockState(this.pos,
this.world.getBlockState(this.pos).with(BlockEnergyCell.ENERGY_STORAGE, storageLevel));
}
}
if( this.currentMeta != storageLevel )
{
this.currentMeta = (byte) storageLevel;
this.world.setBlockState( this.pos, this.world.getBlockState( this.pos ).with( BlockEnergyCell.ENERGY_STORAGE, storageLevel ) );
}
}
@Override
public CompoundNBT write(final CompoundNBT data) {
super.write(data);
data.putDouble("internalCurrentPower", this.internalCurrentPower);
return data;
}
@Override
public CompoundNBT write(final CompoundNBT data )
{
super.write( data );
data.putDouble("internalCurrentPower", this.internalCurrentPower);
return data;
}
@Override
public void read(final CompoundNBT data) {
super.read(data);
this.internalCurrentPower = data.getDouble("internalCurrentPower");
}
@Override
public void read(final CompoundNBT data )
{
super.read( data );
this.internalCurrentPower = data.getDouble( "internalCurrentPower" );
}
@Override
public boolean canBeRotated() {
return false;
}
@Override
public boolean canBeRotated()
{
return false;
}
@Override
public void uploadSettings(final SettingsFrom from, final CompoundNBT compound) {
if (from == SettingsFrom.DISMANTLE_ITEM) {
this.internalCurrentPower = compound.getDouble("internalCurrentPower");
}
}
@Override
public void uploadSettings( final SettingsFrom from, final CompoundNBT compound )
{
if( from == SettingsFrom.DISMANTLE_ITEM )
{
this.internalCurrentPower = compound.getDouble( "internalCurrentPower" );
}
}
@Override
public CompoundNBT downloadSettings(final SettingsFrom from) {
if (from == SettingsFrom.DISMANTLE_ITEM) {
final CompoundNBT tag = new CompoundNBT();
tag.putDouble("internalCurrentPower", this.internalCurrentPower);
tag.putDouble("internalMaxPower", this.getInternalMaxPower()); // used for tool tip.
return tag;
}
return null;
}
@Override
public CompoundNBT downloadSettings( final SettingsFrom from )
{
if( from == SettingsFrom.DISMANTLE_ITEM )
{
final CompoundNBT tag = new CompoundNBT();
tag.putDouble("internalCurrentPower", this.internalCurrentPower);
tag.putDouble("internalMaxPower", this.getInternalMaxPower()); // used for tool tip.
return tag;
}
return null;
}
@Override
public final double injectAEPower(double amt, final Actionable mode) {
if (mode == Actionable.SIMULATE) {
final double fakeBattery = this.internalCurrentPower + amt;
if (fakeBattery > this.getInternalMaxPower()) {
return fakeBattery - this.getInternalMaxPower();
}
@Override
public final double injectAEPower( double amt, final Actionable mode )
{
if( mode == Actionable.SIMULATE )
{
final double fakeBattery = this.internalCurrentPower + amt;
if( fakeBattery > this.getInternalMaxPower() )
{
return fakeBattery - this.getInternalMaxPower();
}
return 0;
}
return 0;
}
if (this.internalCurrentPower < 0.01 && amt > 0.01) {
this.getProxy().getNode().getGrid()
.postEvent(new MENetworkPowerStorage(this, PowerEventType.PROVIDE_POWER));
}
if( this.internalCurrentPower < 0.01 && amt > 0.01 )
{
this.getProxy().getNode().getGrid().postEvent( new MENetworkPowerStorage( this, PowerEventType.PROVIDE_POWER ) );
}
this.internalCurrentPower += amt;
if (this.internalCurrentPower > this.getInternalMaxPower()) {
amt = this.internalCurrentPower - this.getInternalMaxPower();
this.internalCurrentPower = this.getInternalMaxPower();
this.internalCurrentPower += amt;
if( this.internalCurrentPower > this.getInternalMaxPower() )
{
amt = this.internalCurrentPower - this.getInternalMaxPower();
this.internalCurrentPower = this.getInternalMaxPower();
this.changePowerLevel();
return amt;
}
this.changePowerLevel();
return amt;
}
this.changePowerLevel();
return 0;
}
this.changePowerLevel();
return 0;
}
@Override
public double getAEMaxPower() {
return this.getInternalMaxPower();
}
@Override
public double getAEMaxPower()
{
return this.getInternalMaxPower();
}
@Override
public double getAECurrentPower() {
return this.internalCurrentPower;
}
@Override
public double getAECurrentPower()
{
return this.internalCurrentPower;
}
@Override
public boolean isAEPublicPowerStorage() {
return true;
}
@Override
public boolean isAEPublicPowerStorage()
{
return true;
}
@Override
public AccessRestriction getPowerFlow() {
return AccessRestriction.READ_WRITE;
}
@Override
public AccessRestriction getPowerFlow()
{
return AccessRestriction.READ_WRITE;
}
@Override
public final double extractAEPower(final double amt, final Actionable mode, final PowerMultiplier pm) {
return pm.divide(this.extractAEPower(pm.multiply(amt), mode));
}
@Override
public final double extractAEPower( final double amt, final Actionable mode, final PowerMultiplier pm )
{
return pm.divide( this.extractAEPower( pm.multiply( amt ), mode ) );
}
private double extractAEPower(double amt, final Actionable mode) {
if (mode == Actionable.SIMULATE) {
if (this.internalCurrentPower > amt) {
return amt;
}
return this.internalCurrentPower;
}
private double extractAEPower( double amt, final Actionable mode )
{
if( mode == Actionable.SIMULATE )
{
if( this.internalCurrentPower > amt )
{
return amt;
}
return this.internalCurrentPower;
}
final boolean wasFull = this.internalCurrentPower >= this.getInternalMaxPower() - 0.001;
final boolean wasFull = this.internalCurrentPower >= this.getInternalMaxPower() - 0.001;
if (wasFull && amt > 0.001) {
try {
this.getProxy().getGrid().postEvent(new MENetworkPowerStorage(this, PowerEventType.REQUEST_POWER));
} catch (final GridAccessException ignored) {
if( wasFull && amt > 0.001 )
{
try
{
this.getProxy().getGrid().postEvent( new MENetworkPowerStorage( this, PowerEventType.REQUEST_POWER ) );
}
catch( final GridAccessException ignored )
{
}
}
}
}
if (this.internalCurrentPower > amt) {
this.internalCurrentPower -= amt;
if( this.internalCurrentPower > amt )
{
this.internalCurrentPower -= amt;
this.changePowerLevel();
return amt;
}
this.changePowerLevel();
return amt;
}
amt = this.internalCurrentPower;
this.internalCurrentPower = 0;
amt = this.internalCurrentPower;
this.internalCurrentPower = 0;
this.changePowerLevel();
return amt;
}
this.changePowerLevel();
return amt;
}
private double getInternalMaxPower() {
return this.internalMaxPower;
}
private double getInternalMaxPower()
{
return this.internalMaxPower;
}
void setInternalMaxPower( final double internalMaxPower )
{
this.internalMaxPower = internalMaxPower;
}
void setInternalMaxPower(final double internalMaxPower) {
this.internalMaxPower = internalMaxPower;
}
}
@@ -18,7 +18,6 @@
package appeng.tile.networking;
import java.io.IOException;
import java.util.EnumSet;
@@ -47,171 +46,142 @@ import appeng.util.Platform;
import appeng.util.inv.InvOperation;
import appeng.util.inv.filter.AEItemDefinitionFilter;
public class TileWireless extends AENetworkInvTile implements IWirelessAccessPoint, IPowerChannelState {
public class TileWireless extends AENetworkInvTile implements IWirelessAccessPoint, IPowerChannelState
{
public static final int POWERED_FLAG = 1;
public static final int CHANNEL_FLAG = 2;
public static final int POWERED_FLAG = 1;
public static final int CHANNEL_FLAG = 2;
private final AppEngInternalInventory inv = new AppEngInternalInventory(this, 1);
private final AppEngInternalInventory inv = new AppEngInternalInventory( this, 1 );
private int clientFlags = 0;
private int clientFlags = 0;
public TileWireless(TileEntityType<?> tileEntityTypeIn) {
super(tileEntityTypeIn);
this.inv.setFilter(new AEItemDefinitionFilter(AEApi.instance().definitions().materials().wirelessBooster()));
this.getProxy().setFlags(GridFlags.REQUIRE_CHANNEL);
this.getProxy().setValidSides(EnumSet.noneOf(Direction.class));
}
public TileWireless(TileEntityType<?> tileEntityTypeIn) {
super(tileEntityTypeIn);
this.inv.setFilter( new AEItemDefinitionFilter( AEApi.instance().definitions().materials().wirelessBooster() ) );
this.getProxy().setFlags( GridFlags.REQUIRE_CHANNEL );
this.getProxy().setValidSides( EnumSet.noneOf( Direction.class ) );
}
@Override
public void setOrientation(final Direction inForward, final Direction inUp) {
super.setOrientation(inForward, inUp);
this.getProxy().setValidSides(EnumSet.of(this.getForward().getOpposite()));
}
@Override
public void setOrientation( final Direction inForward, final Direction inUp )
{
super.setOrientation( inForward, inUp );
this.getProxy().setValidSides( EnumSet.of( this.getForward().getOpposite() ) );
}
@MENetworkEventSubscribe
public void chanRender(final MENetworkChannelsChanged c) {
this.markForUpdate();
}
@MENetworkEventSubscribe
public void chanRender( final MENetworkChannelsChanged c )
{
this.markForUpdate();
}
@MENetworkEventSubscribe
public void powerRender(final MENetworkPowerStatusChange c) {
this.markForUpdate();
}
@MENetworkEventSubscribe
public void powerRender( final MENetworkPowerStatusChange c )
{
this.markForUpdate();
}
@Override
protected boolean readFromStream(final PacketBuffer data) throws IOException {
final boolean c = super.readFromStream(data);
final int old = this.getClientFlags();
this.setClientFlags(data.readByte());
@Override
protected boolean readFromStream( final PacketBuffer data ) throws IOException
{
final boolean c = super.readFromStream( data );
final int old = this.getClientFlags();
this.setClientFlags( data.readByte() );
return old != this.getClientFlags() || c;
}
return old != this.getClientFlags() || c;
}
@Override
protected void writeToStream(final PacketBuffer data) throws IOException {
super.writeToStream(data);
this.setClientFlags(0);
@Override
protected void writeToStream( final PacketBuffer data ) throws IOException
{
super.writeToStream( data );
this.setClientFlags( 0 );
try {
if (this.getProxy().getEnergy().isNetworkPowered()) {
this.setClientFlags(this.getClientFlags() | POWERED_FLAG);
}
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
}
if( this.getProxy().getNode().meetsChannelRequirements() )
{
this.setClientFlags( this.getClientFlags() | CHANNEL_FLAG );
}
}
catch( final GridAccessException e )
{
// meh
}
data.writeByte((byte) this.getClientFlags());
}
data.writeByte( (byte) this.getClientFlags() );
}
@Override
public AECableType getCableConnectionType(final AEPartLocation dir) {
return AECableType.SMART;
}
@Override
public AECableType getCableConnectionType( final AEPartLocation dir )
{
return AECableType.SMART;
}
@Override
public DimensionalCoord getLocation() {
return new DimensionalCoord(this);
}
@Override
public DimensionalCoord getLocation()
{
return new DimensionalCoord( this );
}
@Override
public IItemHandler getInternalInventory() {
return this.inv;
}
@Override
public IItemHandler getInternalInventory()
{
return this.inv;
}
@Override
public void onChangeInventory(final IItemHandler inv, final int slot, final InvOperation mc,
final ItemStack removed, final ItemStack added) {
// :P
}
@Override
public void onChangeInventory( final IItemHandler inv, final int slot, final InvOperation mc, final ItemStack removed, final ItemStack added )
{
// :P
}
@Override
public void onReady() {
this.updatePower();
super.onReady();
}
@Override
public void onReady()
{
this.updatePower();
super.onReady();
}
private void updatePower() {
this.getProxy().setIdlePowerUsage(AEConfig.instance().wireless_getPowerDrain(this.getBoosters()));
}
private void updatePower()
{
this.getProxy().setIdlePowerUsage( AEConfig.instance().wireless_getPowerDrain( this.getBoosters() ) );
}
private int getBoosters() {
final ItemStack boosters = this.inv.getStackInSlot(0);
return boosters == null ? 0 : boosters.getCount();
}
private int getBoosters()
{
final ItemStack boosters = this.inv.getStackInSlot( 0 );
return boosters == null ? 0 : boosters.getCount();
}
@Override
public void saveChanges() {
this.updatePower();
super.saveChanges();
}
@Override
public void saveChanges()
{
this.updatePower();
super.saveChanges();
}
@Override
public double getRange() {
return AEConfig.instance().wireless_getMaxRange(this.getBoosters());
}
@Override
public double getRange()
{
return AEConfig.instance().wireless_getMaxRange( this.getBoosters() );
}
@Override
public boolean isActive() {
if (isRemote()) {
return this.isPowered() && (CHANNEL_FLAG == (this.getClientFlags() & CHANNEL_FLAG));
}
@Override
public boolean isActive()
{
if( isRemote() )
{
return this.isPowered() && ( CHANNEL_FLAG == ( this.getClientFlags() & CHANNEL_FLAG ) );
}
return this.getProxy().isActive();
}
return this.getProxy().isActive();
}
@Override
public IGrid getGrid() {
try {
return this.getProxy().getGrid();
} catch (final GridAccessException e) {
return null;
}
}
@Override
public IGrid getGrid()
{
try
{
return this.getProxy().getGrid();
}
catch( final GridAccessException e )
{
return null;
}
}
@Override
public boolean isPowered() {
return POWERED_FLAG == (this.getClientFlags() & POWERED_FLAG);
}
@Override
public boolean isPowered()
{
return POWERED_FLAG == ( this.getClientFlags() & POWERED_FLAG );
}
public int getClientFlags() {
return this.clientFlags;
}
public int getClientFlags()
{
return this.clientFlags;
}
private void setClientFlags( final int clientFlags )
{
this.clientFlags = clientFlags;
}
private void setClientFlags(final int clientFlags) {
this.clientFlags = clientFlags;
}
}