pick 97420a31d The big reformat of 2020
This commit is contained in:
@@ -18,7 +18,6 @@
|
||||
|
||||
package appeng.parts;
|
||||
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -31,97 +30,80 @@ import appeng.api.networking.events.MENetworkEventSubscribe;
|
||||
import appeng.api.networking.events.MENetworkPowerStatusChange;
|
||||
import appeng.me.GridAccessException;
|
||||
|
||||
public abstract class PartBasicState extends AEBasePart implements IPowerChannelState {
|
||||
|
||||
public abstract class PartBasicState extends AEBasePart implements IPowerChannelState
|
||||
{
|
||||
protected static final int POWERED_FLAG = 1;
|
||||
protected static final int CHANNEL_FLAG = 2;
|
||||
|
||||
protected static final int POWERED_FLAG = 1;
|
||||
protected static final int CHANNEL_FLAG = 2;
|
||||
private int clientFlags = 0; // sent as byte.
|
||||
|
||||
private int clientFlags = 0; // sent as byte.
|
||||
public PartBasicState(final ItemStack is) {
|
||||
super(is);
|
||||
this.getProxy().setFlags(GridFlags.REQUIRE_CHANNEL);
|
||||
}
|
||||
|
||||
public PartBasicState( final ItemStack is )
|
||||
{
|
||||
super( is );
|
||||
this.getProxy().setFlags( GridFlags.REQUIRE_CHANNEL );
|
||||
}
|
||||
@MENetworkEventSubscribe
|
||||
public void chanRender(final MENetworkChannelsChanged c) {
|
||||
this.getHost().markForUpdate();
|
||||
}
|
||||
|
||||
@MENetworkEventSubscribe
|
||||
public void chanRender( final MENetworkChannelsChanged c )
|
||||
{
|
||||
this.getHost().markForUpdate();
|
||||
}
|
||||
@MENetworkEventSubscribe
|
||||
public void powerRender(final MENetworkPowerStatusChange c) {
|
||||
this.getHost().markForUpdate();
|
||||
}
|
||||
|
||||
@MENetworkEventSubscribe
|
||||
public void powerRender( final MENetworkPowerStatusChange c )
|
||||
{
|
||||
this.getHost().markForUpdate();
|
||||
}
|
||||
@Override
|
||||
public void writeToStream(final PacketBuffer data) throws IOException {
|
||||
super.writeToStream(data);
|
||||
|
||||
@Override
|
||||
public void writeToStream( final PacketBuffer data ) throws IOException
|
||||
{
|
||||
super.writeToStream( data );
|
||||
this.setClientFlags(0);
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
if( this.getProxy().getNode().meetsChannelRequirements() )
|
||||
{
|
||||
this.setClientFlags( this.getClientFlags() | CHANNEL_FLAG );
|
||||
}
|
||||
this.setClientFlags(this.populateFlags(this.getClientFlags()));
|
||||
} catch (final GridAccessException e) {
|
||||
// meh
|
||||
}
|
||||
|
||||
this.setClientFlags( this.populateFlags( this.getClientFlags() ) );
|
||||
}
|
||||
catch( final GridAccessException e )
|
||||
{
|
||||
// meh
|
||||
}
|
||||
data.writeByte((byte) this.getClientFlags());
|
||||
}
|
||||
|
||||
data.writeByte( (byte) this.getClientFlags() );
|
||||
}
|
||||
protected int populateFlags(final int cf) {
|
||||
return cf;
|
||||
}
|
||||
|
||||
protected int populateFlags( final int cf )
|
||||
{
|
||||
return cf;
|
||||
}
|
||||
@Override
|
||||
public boolean readFromStream(final PacketBuffer data) throws IOException {
|
||||
final boolean eh = super.readFromStream(data);
|
||||
|
||||
@Override
|
||||
public boolean readFromStream( final PacketBuffer data ) throws IOException
|
||||
{
|
||||
final boolean eh = super.readFromStream( data );
|
||||
final int old = this.getClientFlags();
|
||||
this.setClientFlags(data.readByte());
|
||||
|
||||
final int old = this.getClientFlags();
|
||||
this.setClientFlags( data.readByte() );
|
||||
return eh || old != this.getClientFlags();
|
||||
}
|
||||
|
||||
return eh || old != this.getClientFlags();
|
||||
}
|
||||
@Override
|
||||
public boolean isPowered() {
|
||||
return (this.getClientFlags() & POWERED_FLAG) == POWERED_FLAG;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPowered()
|
||||
{
|
||||
return ( this.getClientFlags() & POWERED_FLAG ) == POWERED_FLAG;
|
||||
}
|
||||
@Override
|
||||
public boolean isActive() {
|
||||
return (this.getClientFlags() & CHANNEL_FLAG) == CHANNEL_FLAG;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isActive()
|
||||
{
|
||||
return ( this.getClientFlags() & CHANNEL_FLAG ) == CHANNEL_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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user