final variables and parameters
This commit is contained in:
@@ -65,12 +65,12 @@ public abstract class PartP2PTunnel<T extends PartP2PTunnel> extends PartBasicSt
|
||||
public boolean output;
|
||||
public long freq;
|
||||
|
||||
public PartP2PTunnel( ItemStack is )
|
||||
public PartP2PTunnel( final ItemStack is )
|
||||
{
|
||||
super( is );
|
||||
}
|
||||
|
||||
public TunnelCollection<T> getCollection( Collection<PartP2PTunnel> collection, Class<? extends PartP2PTunnel> c )
|
||||
public TunnelCollection<T> getCollection( final Collection<PartP2PTunnel> collection, final Class<? extends PartP2PTunnel> c )
|
||||
{
|
||||
if( this.type.matches( c ) )
|
||||
{
|
||||
@@ -88,16 +88,15 @@ public abstract class PartP2PTunnel<T extends PartP2PTunnel> extends PartBasicSt
|
||||
return null;
|
||||
}
|
||||
|
||||
PartP2PTunnel tunnel;
|
||||
try
|
||||
{
|
||||
tunnel = this.proxy.getP2P().getInput( this.freq );
|
||||
final PartP2PTunnel tunnel = this.proxy.getP2P().getInput( this.freq );
|
||||
if( this.getClass().isInstance( tunnel ) )
|
||||
{
|
||||
return (T) tunnel;
|
||||
}
|
||||
}
|
||||
catch( GridAccessException e )
|
||||
catch( final GridAccessException e )
|
||||
{
|
||||
// :P
|
||||
}
|
||||
@@ -114,7 +113,7 @@ public abstract class PartP2PTunnel<T extends PartP2PTunnel> extends PartBasicSt
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getBoxes( IPartCollisionHelper bch )
|
||||
public void getBoxes( final IPartCollisionHelper bch )
|
||||
{
|
||||
bch.addBox( 5, 5, 12, 11, 11, 13 );
|
||||
bch.addBox( 3, 3, 13, 13, 13, 14 );
|
||||
@@ -123,7 +122,7 @@ public abstract class PartP2PTunnel<T extends PartP2PTunnel> extends PartBasicSt
|
||||
|
||||
@Override
|
||||
@SideOnly( Side.CLIENT )
|
||||
public void renderInventory( IPartRenderHelper rh, ModelGenerator renderer )
|
||||
public void renderInventory( final IPartRenderHelper rh, final ModelGenerator renderer )
|
||||
{
|
||||
rh.setTexture( this.getTypeTexture(renderer) );
|
||||
|
||||
@@ -140,7 +139,7 @@ public abstract class PartP2PTunnel<T extends PartP2PTunnel> extends PartBasicSt
|
||||
* @param renderer
|
||||
* @return If enabled it returns the icon of an AE quartz block, else vanilla quartz block icon
|
||||
*/
|
||||
protected IAESprite getTypeTexture(ModelGenerator renderer )
|
||||
protected IAESprite getTypeTexture( final ModelGenerator renderer )
|
||||
{
|
||||
final Optional<Block> maybeBlock = AEApi.instance().definitions().blocks().quartz().maybeBlock();
|
||||
if( maybeBlock.isPresent() )
|
||||
@@ -155,7 +154,7 @@ public abstract class PartP2PTunnel<T extends PartP2PTunnel> extends PartBasicSt
|
||||
|
||||
@Override
|
||||
@SideOnly( Side.CLIENT )
|
||||
public void renderStatic( BlockPos pos, IPartRenderHelper rh, ModelGenerator renderer )
|
||||
public void renderStatic( final BlockPos pos, final IPartRenderHelper rh, final ModelGenerator renderer )
|
||||
{
|
||||
rh.setTexture( this.getTypeTexture(renderer) );
|
||||
|
||||
@@ -182,7 +181,7 @@ public abstract class PartP2PTunnel<T extends PartP2PTunnel> extends PartBasicSt
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getItemStack( PartItemStack type )
|
||||
public ItemStack getItemStack( final PartItemStack type )
|
||||
{
|
||||
if( type == PartItemStack.World || type == PartItemStack.Network || type == PartItemStack.Wrench || type == PartItemStack.Pick )
|
||||
{
|
||||
@@ -199,7 +198,7 @@ public abstract class PartP2PTunnel<T extends PartP2PTunnel> extends PartBasicSt
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT( NBTTagCompound data )
|
||||
public void readFromNBT( final NBTTagCompound data )
|
||||
{
|
||||
super.readFromNBT( data );
|
||||
this.output = data.getBoolean( "output" );
|
||||
@@ -207,7 +206,7 @@ public abstract class PartP2PTunnel<T extends PartP2PTunnel> extends PartBasicSt
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT( NBTTagCompound data )
|
||||
public void writeToNBT( final NBTTagCompound data )
|
||||
{
|
||||
super.writeToNBT( data );
|
||||
data.setBoolean( "output", this.output );
|
||||
@@ -227,44 +226,44 @@ public abstract class PartP2PTunnel<T extends PartP2PTunnel> extends PartBasicSt
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onPartActivate( EntityPlayer player, Vec3 pos )
|
||||
public boolean onPartActivate( final EntityPlayer player, final Vec3 pos )
|
||||
{
|
||||
ItemStack is = player.inventory.getCurrentItem();
|
||||
final ItemStack is = player.inventory.getCurrentItem();
|
||||
|
||||
// UniqueIdentifier id = GameRegistry.findUniqueIdentifierFor( is.getItem() );
|
||||
// AELog.info( "ID:" + id.toString() + " : " + is.getItemDamage() );
|
||||
|
||||
TunnelType tt = AEApi.instance().registries().p2pTunnel().getTunnelTypeByItem( is );
|
||||
final TunnelType tt = AEApi.instance().registries().p2pTunnel().getTunnelTypeByItem( is );
|
||||
if( is != null && is.getItem() instanceof IMemoryCard )
|
||||
{
|
||||
IMemoryCard mc = (IMemoryCard) is.getItem();
|
||||
NBTTagCompound data = mc.getData( is );
|
||||
final IMemoryCard mc = (IMemoryCard) is.getItem();
|
||||
final NBTTagCompound data = mc.getData( is );
|
||||
|
||||
ItemStack newType = ItemStack.loadItemStackFromNBT( data );
|
||||
long freq = data.getLong( "freq" );
|
||||
final ItemStack newType = ItemStack.loadItemStackFromNBT( data );
|
||||
final long freq = data.getLong( "freq" );
|
||||
|
||||
if( newType != null )
|
||||
{
|
||||
if( newType.getItem() instanceof IPartItem )
|
||||
{
|
||||
IPart testPart = ( (IPartItem) newType.getItem() ).createPartFromItemStack( newType );
|
||||
final IPart testPart = ( (IPartItem) newType.getItem() ).createPartFromItemStack( newType );
|
||||
if( testPart instanceof PartP2PTunnel )
|
||||
{
|
||||
this.getHost().removePart( this.side, true );
|
||||
AEPartLocation dir = this.getHost().addPart( newType, this.side, player );
|
||||
IPart newBus = this.getHost().getPart( dir );
|
||||
final AEPartLocation dir = this.getHost().addPart( newType, this.side, player );
|
||||
final IPart newBus = this.getHost().getPart( dir );
|
||||
|
||||
if( newBus instanceof PartP2PTunnel )
|
||||
{
|
||||
PartP2PTunnel newTunnel = (PartP2PTunnel) newBus;
|
||||
final PartP2PTunnel newTunnel = (PartP2PTunnel) newBus;
|
||||
newTunnel.output = true;
|
||||
|
||||
try
|
||||
{
|
||||
P2PCache p2p = newTunnel.proxy.getP2P();
|
||||
final P2PCache p2p = newTunnel.proxy.getP2P();
|
||||
p2p.updateFreq( newTunnel, freq );
|
||||
}
|
||||
catch( GridAccessException e )
|
||||
catch( final GridAccessException e )
|
||||
{
|
||||
// :P
|
||||
}
|
||||
@@ -288,7 +287,7 @@ public abstract class PartP2PTunnel<T extends PartP2PTunnel> extends PartBasicSt
|
||||
switch( tt )
|
||||
{
|
||||
case LIGHT:
|
||||
for( ItemStack stack : parts.p2PTunnelLight().maybeStack( 1 ).asSet() )
|
||||
for( final ItemStack stack : parts.p2PTunnelLight().maybeStack( 1 ).asSet() )
|
||||
{
|
||||
newType = stack;
|
||||
}
|
||||
@@ -304,7 +303,7 @@ public abstract class PartP2PTunnel<T extends PartP2PTunnel> extends PartBasicSt
|
||||
*/
|
||||
|
||||
case FLUID:
|
||||
for( ItemStack stack : parts.p2PTunnelLiquids().maybeStack( 1 ).asSet() )
|
||||
for( final ItemStack stack : parts.p2PTunnelLiquids().maybeStack( 1 ).asSet() )
|
||||
{
|
||||
newType = stack;
|
||||
}
|
||||
@@ -320,21 +319,21 @@ public abstract class PartP2PTunnel<T extends PartP2PTunnel> extends PartBasicSt
|
||||
*/
|
||||
|
||||
case ITEM:
|
||||
for( ItemStack stack : parts.p2PTunnelItems().maybeStack( 1 ).asSet() )
|
||||
for( final ItemStack stack : parts.p2PTunnelItems().maybeStack( 1 ).asSet() )
|
||||
{
|
||||
newType = stack;
|
||||
}
|
||||
break;
|
||||
|
||||
case ME:
|
||||
for( ItemStack stack : parts.p2PTunnelME().maybeStack( 1 ).asSet() )
|
||||
for( final ItemStack stack : parts.p2PTunnelME().maybeStack( 1 ).asSet() )
|
||||
{
|
||||
newType = stack;
|
||||
}
|
||||
break;
|
||||
|
||||
case REDSTONE:
|
||||
for( ItemStack stack : parts.p2PTunnelRedstone().maybeStack( 1 ).asSet() )
|
||||
for( final ItemStack stack : parts.p2PTunnelRedstone().maybeStack( 1 ).asSet() )
|
||||
{
|
||||
newType = stack;
|
||||
}
|
||||
@@ -363,25 +362,25 @@ public abstract class PartP2PTunnel<T extends PartP2PTunnel> extends PartBasicSt
|
||||
|
||||
if( newType != null && !Platform.isSameItem( newType, this.is ) )
|
||||
{
|
||||
boolean oldOutput = this.output;
|
||||
long myFreq = this.freq;
|
||||
final boolean oldOutput = this.output;
|
||||
final long myFreq = this.freq;
|
||||
|
||||
this.getHost().removePart( this.side, false );
|
||||
AEPartLocation dir = this.getHost().addPart( newType, this.side, player );
|
||||
IPart newBus = this.getHost().getPart( dir );
|
||||
final AEPartLocation dir = this.getHost().addPart( newType, this.side, player );
|
||||
final IPart newBus = this.getHost().getPart( dir );
|
||||
|
||||
if( newBus instanceof PartP2PTunnel )
|
||||
{
|
||||
PartP2PTunnel newTunnel = (PartP2PTunnel) newBus;
|
||||
final PartP2PTunnel newTunnel = (PartP2PTunnel) newBus;
|
||||
newTunnel.output = oldOutput;
|
||||
newTunnel.onTunnelNetworkChange();
|
||||
|
||||
try
|
||||
{
|
||||
P2PCache p2p = newTunnel.proxy.getP2P();
|
||||
final P2PCache p2p = newTunnel.proxy.getP2P();
|
||||
p2p.updateFreq( newTunnel, myFreq );
|
||||
}
|
||||
catch( GridAccessException e )
|
||||
catch( final GridAccessException e )
|
||||
{
|
||||
// :P
|
||||
}
|
||||
@@ -396,16 +395,16 @@ public abstract class PartP2PTunnel<T extends PartP2PTunnel> extends PartBasicSt
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onPartShiftActivate( EntityPlayer player, Vec3 pos )
|
||||
public boolean onPartShiftActivate( final EntityPlayer player, final Vec3 pos )
|
||||
{
|
||||
ItemStack is = player.inventory.getCurrentItem();
|
||||
final ItemStack is = player.inventory.getCurrentItem();
|
||||
if( is != null && is.getItem() instanceof IMemoryCard )
|
||||
{
|
||||
IMemoryCard mc = (IMemoryCard) is.getItem();
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
final IMemoryCard mc = (IMemoryCard) is.getItem();
|
||||
final NBTTagCompound data = new NBTTagCompound();
|
||||
|
||||
long newFreq = this.freq;
|
||||
boolean wasOutput = this.output;
|
||||
final boolean wasOutput = this.output;
|
||||
this.output = false;
|
||||
|
||||
if( wasOutput || this.freq == 0 )
|
||||
@@ -417,15 +416,15 @@ public abstract class PartP2PTunnel<T extends PartP2PTunnel> extends PartBasicSt
|
||||
{
|
||||
this.proxy.getP2P().updateFreq( this, newFreq );
|
||||
}
|
||||
catch( GridAccessException e )
|
||||
catch( final GridAccessException e )
|
||||
{
|
||||
// :P
|
||||
}
|
||||
|
||||
this.onTunnelConfigChange();
|
||||
|
||||
ItemStack p2pItem = this.getItemStack( PartItemStack.Wrench );
|
||||
String type = p2pItem.getUnlocalizedName();
|
||||
final ItemStack p2pItem = this.getItemStack( PartItemStack.Wrench );
|
||||
final String type = p2pItem.getUnlocalizedName();
|
||||
|
||||
p2pItem.writeToNBT( data );
|
||||
data.setLong( "freq", this.freq );
|
||||
@@ -448,20 +447,20 @@ public abstract class PartP2PTunnel<T extends PartP2PTunnel> extends PartBasicSt
|
||||
|
||||
@Override
|
||||
@SideOnly( Side.CLIENT )
|
||||
public TextureAtlasSprite getBreakingTexture( ModelGenerator renderer )
|
||||
public TextureAtlasSprite getBreakingTexture( final ModelGenerator renderer )
|
||||
{
|
||||
return CableBusTextures.BlockP2PTunnel2.getIcon().getAtlas();
|
||||
}
|
||||
|
||||
protected void queueTunnelDrain( PowerUnits unit, double f )
|
||||
protected void queueTunnelDrain( final PowerUnits unit, final double f )
|
||||
{
|
||||
double ae_to_tax = unit.convertTo( PowerUnits.AE, f * AEConfig.TUNNEL_POWER_LOSS );
|
||||
final double ae_to_tax = unit.convertTo( PowerUnits.AE, f * AEConfig.TUNNEL_POWER_LOSS );
|
||||
|
||||
try
|
||||
{
|
||||
this.proxy.getEnergy().extractAEPower( ae_to_tax, Actionable.MODULATE, PowerMultiplier.ONE );
|
||||
}
|
||||
catch( GridAccessException e )
|
||||
catch( final GridAccessException e )
|
||||
{
|
||||
// :P
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user