final variables and parameters

This commit is contained in:
thatsIch
2015-09-30 14:24:40 +02:00
parent 059523f543
commit 8b3a954f73
732 changed files with 9253 additions and 9256 deletions
@@ -68,30 +68,30 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
@Override
public boolean onItemUseFirst(
ItemStack is,
EntityPlayer player,
World world,
BlockPos pos,
EnumFacing side,
float hitX,
float hitY,
float hitZ )
final ItemStack is,
final EntityPlayer player,
final World world,
final BlockPos pos,
final EnumFacing side,
final float hitX,
final float hitY,
final float hitZ )
{
return AEApi.instance().partHelper().placeBus( is, pos, side, player, world );
}
@Override
public String getItemStackDisplayName( ItemStack is )
public String getItemStackDisplayName( final ItemStack is )
{
try
{
ItemStack in = this.getTextureItem( is );
final ItemStack in = this.getTextureItem( is );
if( in != null )
{
return super.getItemStackDisplayName( is ) + " - " + in.getDisplayName();
}
}
catch( Throwable ignored )
catch( final Throwable ignored )
{
}
@@ -100,7 +100,7 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
}
@Override
protected void getCheckedSubItems( Item sameItem, CreativeTabs creativeTab, List<ItemStack> itemStacks )
protected void getCheckedSubItems( final Item sameItem, final CreativeTabs creativeTab, final List<ItemStack> itemStacks )
{
this.calculateSubTypes();
itemStacks.addAll( this.subTypes );
@@ -111,25 +111,25 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
if( this.subTypes == null )
{
this.subTypes = new ArrayList<ItemStack>( 1000 );
for( Object blk : Block.blockRegistry )
for( final Object blk : Block.blockRegistry )
{
Block b = (Block) blk;
final Block b = (Block) blk;
try
{
Item item = Item.getItemFromBlock( b );
final Item item = Item.getItemFromBlock( b );
List<ItemStack> tmpList = new ArrayList<ItemStack>( 100 );
final List<ItemStack> tmpList = new ArrayList<ItemStack>( 100 );
b.getSubBlocks( item, b.getCreativeTabToDisplayOn(), tmpList );
for( ItemStack l : tmpList )
for( final ItemStack l : tmpList )
{
ItemStack facade = this.createFacadeForItem( l, false );
final ItemStack facade = this.createFacadeForItem( l, false );
if( facade != null )
{
this.subTypes.add( facade );
}
}
}
catch( Throwable t )
catch( final Throwable t )
{
// just absorb..
}
@@ -142,26 +142,26 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
}
}
public ItemStack createFacadeForItem( ItemStack l, boolean returnItem )
public ItemStack createFacadeForItem( final ItemStack l, final boolean returnItem )
{
if( l == null )
{
return null;
}
Block b = Block.getBlockFromItem( l.getItem() );
final Block b = Block.getBlockFromItem( l.getItem() );
if( b == null || l.hasTagCompound() )
{
return null;
}
int metadata = l.getItem().getMetadata( l.getItemDamage() );
final int metadata = l.getItem().getMetadata( l.getItemDamage() );
boolean hasTile = b.hasTileEntity( b.getStateFromMeta( metadata ) );
boolean enableGlass = b instanceof BlockGlass || b instanceof BlockStainedGlass;
boolean disableOre = b instanceof QuartzOreBlock;
final boolean hasTile = b.hasTileEntity( b.getStateFromMeta( metadata ) );
final boolean enableGlass = b instanceof BlockGlass || b instanceof BlockStainedGlass;
final boolean disableOre = b instanceof QuartzOreBlock;
boolean defaultValue = ( b.isOpaqueCube() && !b.getTickRandomly() && !hasTile && !disableOre ) || enableGlass;
final boolean defaultValue = ( b.isOpaqueCube() && !b.getTickRandomly() && !hasTile && !disableOre ) || enableGlass;
if( FacadeConfig.instance.checkEnabled( b, metadata, defaultValue ) )
{
if( returnItem )
@@ -169,13 +169,13 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
return l;
}
ItemStack is = new ItemStack( this );
NBTTagCompound data = new NBTTagCompound();
int[] ds = new int[2];
final ItemStack is = new ItemStack( this );
final NBTTagCompound data = new NBTTagCompound();
final int[] ds = new int[2];
ds[0] = Item.getIdFromItem( l.getItem() );
ds[1] = metadata;
data.setIntArray( "x", ds );
UniqueIdentifier ui = GameRegistry.findUniqueIdentifierFor( l.getItem() );
final UniqueIdentifier ui = GameRegistry.findUniqueIdentifierFor( l.getItem() );
data.setString( "modid", ui.modId );
data.setString( "itemname", ui.name );
is.setTagCompound( data );
@@ -185,9 +185,9 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
}
@Override
public FacadePart createPartFromItemStack( ItemStack is, AEPartLocation side )
public FacadePart createPartFromItemStack( final ItemStack is, final AEPartLocation side )
{
ItemStack in = this.getTextureItem( is );
final ItemStack in = this.getTextureItem( is );
if( in != null )
{
return new FacadePart( is, side );
@@ -196,9 +196,9 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
}
@Override
public ItemStack getTextureItem( ItemStack is )
public ItemStack getTextureItem( final ItemStack is )
{
Block blk = this.getBlock( is );
final Block blk = this.getBlock( is );
if( blk != null )
{
return new ItemStack( blk, 1, this.getMeta( is ) );
@@ -207,12 +207,12 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
}
@Override
public int getMeta( ItemStack is )
public int getMeta( final ItemStack is )
{
NBTTagCompound data = is.getTagCompound();
final NBTTagCompound data = is.getTagCompound();
if( data != null )
{
int[] blk = data.getIntArray( "x" );
final int[] blk = data.getIntArray( "x" );
if( blk != null && blk.length == 2 )
{
return blk[1];
@@ -222,9 +222,9 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
}
@Override
public Block getBlock( ItemStack is )
public Block getBlock( final ItemStack is )
{
NBTTagCompound data = is.getTagCompound();
final NBTTagCompound data = is.getTagCompound();
if( data != null )
{
if( data.hasKey( "modid" ) && data.hasKey( "itemname" ) )
@@ -236,7 +236,7 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
}
else
{
int[] blk = data.getIntArray( "x" );
final int[] blk = data.getIntArray( "x" );
if( blk != null && blk.length == 2 )
{
return Block.getBlockById( blk[0] );
@@ -262,11 +262,11 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
return this.subTypes.get( 0 );
}
public ItemStack createFromIDs( int[] ids )
public ItemStack createFromIDs( final int[] ids )
{
for( ItemStack facadeStack : AEApi.instance().definitions().items().facade().maybeStack( 1 ).asSet() )
for( final ItemStack facadeStack : AEApi.instance().definitions().items().facade().maybeStack( 1 ).asSet() )
{
NBTTagCompound facadeTag = new NBTTagCompound();
final NBTTagCompound facadeTag = new NBTTagCompound();
facadeTag.setIntArray( "x", ids.clone() );
facadeStack.setTagCompound( facadeTag );
@@ -277,16 +277,16 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
}
@Override
public boolean useAlphaPass( ItemStack is )
public boolean useAlphaPass( final ItemStack is )
{
ItemStack out = this.getTextureItem( is );
final ItemStack out = this.getTextureItem( is );
if( out == null || out.getItem() == null )
{
return false;
}
Block blk = Block.getBlockFromItem( out.getItem() );
final Block blk = Block.getBlockFromItem( out.getItem() );
if( blk != null && blk.canRenderInLayer( EnumWorldBlockLayer.TRANSLUCENT ) )
{
return true;
@@ -297,7 +297,7 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
@Override
public void registerCustomIcon(
TextureMap map )
final TextureMap map )
{
myIcon = new BaseIcon( map.registerSprite( new ResourceLocation( AppEng.MOD_ID, "blocks/ItemFacade" ) ));
}
@@ -74,7 +74,7 @@ public final class ItemMultiPart extends AEBaseItem implements IPartItem, IItemG
public static ItemMultiPart instance;
private final Map<Integer, PartTypeWithVariant> registered;
public ItemMultiPart( IPartHelper partHelper )
public ItemMultiPart( final IPartHelper partHelper )
{
Preconditions.checkNotNull( partHelper );
@@ -88,7 +88,7 @@ public final class ItemMultiPart extends AEBaseItem implements IPartItem, IItemG
}
@Nonnull
public final ItemStackSrc createPart( PartType mat )
public final ItemStackSrc createPart( final PartType mat )
{
Preconditions.checkNotNull( mat );
@@ -96,7 +96,7 @@ public final class ItemMultiPart extends AEBaseItem implements IPartItem, IItemG
}
@Nonnull
public ItemStackSrc createPart( PartType mat, AEColor color )
public ItemStackSrc createPart( final PartType mat, final AEColor color )
{
Preconditions.checkNotNull( mat );
Preconditions.checkNotNull( color );
@@ -107,13 +107,13 @@ public final class ItemMultiPart extends AEBaseItem implements IPartItem, IItemG
}
@Nonnull
private ItemStackSrc createPart( PartType mat, int varID )
private ItemStackSrc createPart( final PartType mat, final int varID )
{
assert mat != null;
assert varID >= 0;
// verify
for( PartTypeWithVariant p : this.registered.values() )
for( final PartTypeWithVariant p : this.registered.values() )
{
if( p.part == mat && p.variant == varID )
{
@@ -122,12 +122,12 @@ public final class ItemMultiPart extends AEBaseItem implements IPartItem, IItemG
}
boolean enabled = true;
for( AEFeature f : mat.getFeature() )
for( final AEFeature f : mat.getFeature() )
{
enabled = enabled && AEConfig.instance.isFeatureEnabled( f );
}
for( IntegrationType integrationType : mat.getIntegrations() )
for( final IntegrationType integrationType : mat.getIntegrations() )
{
enabled &= IntegrationRegistry.INSTANCE.isEnabled( integrationType );
}
@@ -143,7 +143,7 @@ public final class ItemMultiPart extends AEBaseItem implements IPartItem, IItemG
return output;
}
private void processMetaOverlap( boolean enabled, int partDamage, PartType mat, PartTypeWithVariant pti )
private void processMetaOverlap( final boolean enabled, final int partDamage, final PartType mat, final PartTypeWithVariant pti )
{
assert partDamage >= 0;
assert mat != null;
@@ -161,11 +161,11 @@ public final class ItemMultiPart extends AEBaseItem implements IPartItem, IItemG
}
}
public int getDamageByType( PartType t )
public int getDamageByType( final PartType t )
{
Preconditions.checkNotNull( t );
for( Entry<Integer, PartTypeWithVariant> pt : this.registered.entrySet() )
for( final Entry<Integer, PartTypeWithVariant> pt : this.registered.entrySet() )
{
if( pt.getValue().part == t )
{
@@ -176,7 +176,7 @@ public final class ItemMultiPart extends AEBaseItem implements IPartItem, IItemG
}
@Override
public boolean onItemUse( ItemStack is, EntityPlayer player, World w, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ )
public boolean onItemUse( final ItemStack is, final EntityPlayer player, final World w, final BlockPos pos, final EnumFacing side, final float hitX, final float hitY, final float hitZ )
{
if( this.getTypeByStack( is ) == PartType.InvalidType )
{
@@ -187,7 +187,7 @@ public final class ItemMultiPart extends AEBaseItem implements IPartItem, IItemG
}
@Override
public String getUnlocalizedName( ItemStack is )
public String getUnlocalizedName( final ItemStack is )
{
return "item.appliedenergistics2." + this.getName( is );
}
@@ -196,16 +196,16 @@ public final class ItemMultiPart extends AEBaseItem implements IPartItem, IItemG
@Override
@SideOnly(Side.CLIENT)
public void registerCustomIcon(
TextureMap map )
final TextureMap map )
{
for( Entry<Integer, PartTypeWithVariant> part : this.registered.entrySet() )
for( final Entry<Integer, PartTypeWithVariant> part : this.registered.entrySet() )
{
part.getValue().texture= new BaseIcon( map.registerSprite( new ResourceLocation( AppEng.MOD_ID, "blocks/" + this.getName( new ItemStack( this, 1, part.getKey() ) ) )) );
}
}
@Override
public IAESprite getIcon( ItemStack is )
public IAESprite getIcon( final ItemStack is )
{
final int dmg = is.getMetadata();
final PartTypeWithVariant registeredType = this.registered.get( dmg );
@@ -218,7 +218,7 @@ public final class ItemMultiPart extends AEBaseItem implements IPartItem, IItemG
}
@Override
public String getItemStackDisplayName( ItemStack is )
public String getItemStackDisplayName( final ItemStack is )
{
final PartType pt = this.getTypeByStack( is );
@@ -243,18 +243,18 @@ public final class ItemMultiPart extends AEBaseItem implements IPartItem, IItemG
}
@Override
protected void getCheckedSubItems( Item sameItem, CreativeTabs creativeTab, List<ItemStack> itemStacks )
protected void getCheckedSubItems( final Item sameItem, final CreativeTabs creativeTab, final List<ItemStack> itemStacks )
{
List<Entry<Integer, PartTypeWithVariant>> types = new ArrayList<Entry<Integer, PartTypeWithVariant>>( this.registered.entrySet() );
final List<Entry<Integer, PartTypeWithVariant>> types = new ArrayList<Entry<Integer, PartTypeWithVariant>>( this.registered.entrySet() );
Collections.sort( types, REGISTERED_COMPARATOR );
for( Entry<Integer, PartTypeWithVariant> part : types )
for( final Entry<Integer, PartTypeWithVariant> part : types )
{
itemStacks.add( new ItemStack( this, 1, part.getKey() ) );
}
}
public String getName( ItemStack is )
public String getName( final ItemStack is )
{
Preconditions.checkNotNull( is );
@@ -265,7 +265,7 @@ public final class ItemMultiPart extends AEBaseItem implements IPartItem, IItemG
}
@Nonnull
public PartType getTypeByStack( ItemStack is )
public PartType getTypeByStack( final ItemStack is )
{
Preconditions.checkNotNull( is );
@@ -280,7 +280,7 @@ public final class ItemMultiPart extends AEBaseItem implements IPartItem, IItemG
@Nullable
@Override
public IPart createPartFromItemStack( ItemStack is )
public IPart createPartFromItemStack( final ItemStack is )
{
final PartType type = this.getTypeByStack( is );
final Class<? extends IPart> part = type.getPart();
@@ -298,25 +298,25 @@ public final class ItemMultiPart extends AEBaseItem implements IPartItem, IItemG
return type.constructor.newInstance( is );
}
catch( InstantiationException e )
catch( final InstantiationException e )
{
throw new IllegalStateException( "Unable to construct IBusPart from IBusItem : " + part.getName() + " ; Possibly didn't have correct constructor( ItemStack )", e );
}
catch( IllegalAccessException e )
catch( final IllegalAccessException e )
{
throw new IllegalStateException( "Unable to construct IBusPart from IBusItem : " + part.getName() + " ; Possibly didn't have correct constructor( ItemStack )", e );
}
catch( InvocationTargetException e )
catch( final InvocationTargetException e )
{
throw new IllegalStateException( "Unable to construct IBusPart from IBusItem : " + part.getName() + " ; Possibly didn't have correct constructor( ItemStack )", e );
}
catch( NoSuchMethodException e )
catch( final NoSuchMethodException e )
{
throw new IllegalStateException( "Unable to construct IBusPart from IBusItem : " + part.getName() + " ; Possibly didn't have correct constructor( ItemStack )", e );
}
}
public int variantOf( int itemDamage )
public int variantOf( final int itemDamage )
{
final PartTypeWithVariant registeredPartType = this.registered.get( itemDamage );
if( registeredPartType != null )
@@ -329,19 +329,19 @@ public final class ItemMultiPart extends AEBaseItem implements IPartItem, IItemG
@Nullable
@Override
public String getUnlocalizedGroupName( Set<ItemStack> others, ItemStack is )
public String getUnlocalizedGroupName( final Set<ItemStack> others, final ItemStack is )
{
boolean importBus = false;
boolean exportBus = false;
boolean group = false;
PartType u = this.getTypeByStack( is );
final PartType u = this.getTypeByStack( is );
for( ItemStack stack : others )
for( final ItemStack stack : others )
{
if( stack.getItem() == this )
{
PartType pt = this.getTypeByStack( stack );
final PartType pt = this.getTypeByStack( stack );
switch( pt )
{
case ImportBus:
@@ -379,7 +379,7 @@ public final class ItemMultiPart extends AEBaseItem implements IPartItem, IItemG
@SideOnly(Side.CLIENT)
public IAESprite texture = null;
private PartTypeWithVariant( PartType part, int variant )
private PartTypeWithVariant( final PartType part, final int variant )
{
assert part != null;
assert variant >= 0;
@@ -401,7 +401,7 @@ public final class ItemMultiPart extends AEBaseItem implements IPartItem, IItemG
private static final class RegisteredComparator implements Comparator<Entry<Integer, PartTypeWithVariant>>
{
@Override
public int compare( Entry<Integer, PartTypeWithVariant> o1, Entry<Integer, PartTypeWithVariant> o2 )
public int compare( final Entry<Integer, PartTypeWithVariant> o1, final Entry<Integer, PartTypeWithVariant> o2 )
{
return o1.getValue().part.name().compareTo( o2.getValue().part.name() );
}
@@ -167,12 +167,12 @@ public enum PartType
private final GuiText extraName;
public Constructor<? extends IPart> constructor;
PartType( int baseMetaValue, Set<AEFeature> features, Set<IntegrationType> integrations, Class<? extends IPart> c )
PartType( final int baseMetaValue, final Set<AEFeature> features, final Set<IntegrationType> integrations, final Class<? extends IPart> c )
{
this( baseMetaValue, features, integrations, c, null );
}
PartType( int baseMetaValue, Set<AEFeature> features, Set<IntegrationType> integrations, Class<? extends IPart> c, GuiText en )
PartType( final int baseMetaValue, final Set<AEFeature> features, final Set<IntegrationType> integrations, final Class<? extends IPart> c, final GuiText en )
{
this.features = Collections.unmodifiableSet( features );
this.integrations = Collections.unmodifiableSet( integrations );