Removed redundant array creations just to match varargs operations

This commit is contained in:
thatsIch 2014-09-29 09:12:06 +02:00
parent 72106c877d
commit f49407de2c
24 changed files with 47 additions and 42 deletions

View file

@ -107,8 +107,8 @@ public class AEBaseBlock extends BlockContainer implements IAEFeature
try
{
ResourceLocation resLoc = new ResourceLocation( Name );
resLoc = new ResourceLocation( resLoc.getResourceDomain(), String.format( "%s/%s%s", new Object[] { "textures/blocks",
resLoc.getResourcePath(), ".png" } ) );
resLoc = new ResourceLocation( resLoc.getResourceDomain(), String.format( "%s/%s%s", "textures/blocks",
resLoc.getResourcePath(), ".png" ) );
IResource res = Minecraft.getMinecraft().getResourceManager().getResource( resLoc );
if ( res != null )

View file

@ -148,9 +148,9 @@ public class BlockCharger extends AEBaseBlock implements ICustomCollision
break;
}
return Arrays.asList( new AxisAlignedBB[] { bb } );
return Arrays.asList( bb );
}
return Arrays.asList( new AxisAlignedBB[] { AxisAlignedBB.getBoundingBox( 0.0, 0, 0.0, 1.0, 1.0, 1.0 ) } );
return Arrays.asList( AxisAlignedBB.getBoundingBox( 0.0, 0, 0.0, 1.0, 1.0, 1.0 ) );
}
@Override

View file

@ -97,7 +97,7 @@ public class BlockQuartzTorch extends AEBaseBlock implements IOrientableBlock, I
double xOff = -0.3 * up.offsetX;
double yOff = -0.3 * up.offsetY;
double zOff = -0.3 * up.offsetZ;
return Arrays.asList( new AxisAlignedBB[] { AxisAlignedBB.getBoundingBox( xOff + 0.3, yOff + 0.3, zOff + 0.3, xOff + 0.7, yOff + 0.7, zOff + 0.7 ) } );
return Arrays.asList( AxisAlignedBB.getBoundingBox( xOff + 0.3, yOff + 0.3, zOff + 0.3, xOff + 0.7, yOff + 0.7, zOff + 0.7 ) );
}
@Override

View file

@ -142,9 +142,9 @@ public class BlockSkyCompass extends AEBaseBlock implements ICustomCollision
break;
}
return Arrays.asList( new AxisAlignedBB[] { AxisAlignedBB.getBoundingBox( minX, minY, minZ, maxX, maxY, maxZ ) } );
return Arrays.asList( AxisAlignedBB.getBoundingBox( minX, minY, minZ, maxX, maxY, maxZ ) );
}
return Arrays.asList( new AxisAlignedBB[] { AxisAlignedBB.getBoundingBox( 0.0, 0, 0.0, 1.0, 1.0, 1.0 ) } );
return Arrays.asList( AxisAlignedBB.getBoundingBox( 0.0, 0, 0.0, 1.0, 1.0, 1.0 ) );
}
@Override

View file

@ -152,7 +152,7 @@ public class BlockTinyTNT extends AEBaseBlock implements ICustomCollision
@Override
public Iterable<AxisAlignedBB> getSelectedBoundingBoxesFromPool(World w, int x, int y, int z, Entity e, boolean isVisual)
{
return Arrays.asList( new AxisAlignedBB[] { AxisAlignedBB.getBoundingBox( 0.25, 0, 0.25, 0.75, 0.5, 0.75 ) } );
return Arrays.asList( AxisAlignedBB.getBoundingBox( 0.25, 0, 0.25, 0.75, 0.5, 0.75 ) );
}
@Override

View file

@ -101,9 +101,9 @@ public class BlockWireless extends AEBaseBlock implements ICustomCollision
break;
}
return Arrays.asList( new AxisAlignedBB[] { AxisAlignedBB.getBoundingBox( minX, minY, minZ, maxX, maxY, maxZ ) } );
return Arrays.asList( AxisAlignedBB.getBoundingBox( minX, minY, minZ, maxX, maxY, maxZ ) );
}
return Arrays.asList( new AxisAlignedBB[] { AxisAlignedBB.getBoundingBox( 0.0, 0, 0.0, 1.0, 1.0, 1.0 ) } );
return Arrays.asList( AxisAlignedBB.getBoundingBox( 0.0, 0, 0.0, 1.0, 1.0, 1.0 ) );
}
@Override

View file

@ -97,7 +97,7 @@ public class BlockQuantumLinkChamber extends AEBaseBlock implements ICustomColli
public Iterable<AxisAlignedBB> getSelectedBoundingBoxesFromPool(World w, int x, int y, int z, Entity e, boolean isVisual)
{
double OnePx = 2.0 / 16.0;
return Arrays.asList( new AxisAlignedBB[] { AxisAlignedBB.getBoundingBox( OnePx, OnePx, OnePx, 1.0 - OnePx, 1.0 - OnePx, 1.0 - OnePx ) } );
return Arrays.asList( AxisAlignedBB.getBoundingBox( OnePx, OnePx, OnePx, 1.0 - OnePx, 1.0 - OnePx, 1.0 - OnePx ) );
}
@Override

View file

@ -66,7 +66,7 @@ public class BlockQuantumRing extends AEBaseBlock implements ICustomCollision
{
OnePx = 1.0 / 16.0;
}
return Arrays.asList( new AxisAlignedBB[] { AxisAlignedBB.getBoundingBox( OnePx, OnePx, OnePx, 1.0 - OnePx, 1.0 - OnePx, 1.0 - OnePx ) } );
return Arrays.asList( AxisAlignedBB.getBoundingBox( OnePx, OnePx, OnePx, 1.0 - OnePx, 1.0 - OnePx, 1.0 - OnePx ) );
}
@Override

View file

@ -110,9 +110,9 @@ public class BlockSkyChest extends AEBaseBlock implements ICustomCollision
double Y = o.offsetY == 0 ? 0.06 : 0.0;
double Z = o.offsetZ == 0 ? 0.06 : 0.0;
return Arrays.asList( new AxisAlignedBB[] { AxisAlignedBB.getBoundingBox( Math.max( 0.0, X - o.offsetX * sc ), Math.max( 0.0, Y - o.offsetY * sc ),
return Arrays.asList( AxisAlignedBB.getBoundingBox( Math.max( 0.0, X - o.offsetX * sc ), Math.max( 0.0, Y - o.offsetY * sc ),
Math.max( 0.0, Z - o.offsetZ * sc ), Math.min( 1.0, (1.0 - X) - o.offsetX * sc ), Math.min( 1.0, (1.0 - Y) - o.offsetY * sc ),
Math.min( 1.0, (1.0 - Z) - o.offsetZ * sc ) ) } );
Math.min( 1.0, (1.0 - Z) - o.offsetZ * sc ) ) );
}
@Override

View file

@ -588,7 +588,7 @@ public abstract class AEBaseContainer extends Container
{
if ( syncData.containsKey( idx ) )
{
syncData.get( idx ).update( (long) value );
syncData.get( idx ).update( value );
return;
}
@ -600,7 +600,6 @@ public abstract class AEBaseContainer extends Container
if ( syncData.containsKey( idx ) )
{
syncData.get( idx ).update( value );
return;
}
}

View file

@ -280,7 +280,7 @@ public class AEConfig extends Configuration implements IConfigurableObject, ICon
ModContainer imb = cpw.mods.fml.common.Loader.instance().getIndexedModList().get( "ImmibisCore" );
if ( imb != null )
{
List<String> version = Arrays.asList( new String[] { "59.0.0", "59.0.1", "59.0.2" } );
List<String> version = Arrays.asList( "59.0.0", "59.0.1", "59.0.2" );
if ( version.contains( imb.getVersion() ) )
featureFlags.remove( AEFeature.AlphaPass );
}

View file

@ -297,7 +297,7 @@ public class WorldSettings extends Configuration
{
try
{
manager.scheduleOutboundPacket( (new PacketNewStorageDimension( newDim )).getProxy(), new GenericFutureListener[0] );
manager.scheduleOutboundPacket( (new PacketNewStorageDimension( newDim )).getProxy() );
}
catch (IOException e)
{

View file

@ -22,7 +22,7 @@ public enum Stats
{
if ( stat == null )
{
stat = new StatBasic( "stat.ae2." + name(), new ChatComponentTranslation( "stat.ae2." + name(), new Object[0] ) );
stat = new StatBasic( "stat.ae2." + name(), new ChatComponentTranslation( "stat.ae2." + name() ) );
stat.registerStat();
}

View file

@ -168,7 +168,7 @@ public class ToolDebugCard extends AEBaseItem
if ( te instanceof IGridHost )
{
IGridNode node = (IGridNode) ((IGridHost) te).getGridNode( ForgeDirection.getOrientation( side ) );
IGridNode node = ((IGridHost) te).getGridNode( ForgeDirection.getOrientation( side ) );
if ( node != null && node.getGrid() != null )
{
IEnergyGrid eg = node.getGrid().getCache( IEnergyGrid.class );

View file

@ -31,7 +31,7 @@ public class NEIAEShapedRecipeHandler extends TemplateRecipeHandler
public void loadTransferRects()
{
this.transferRects.add( new TemplateRecipeHandler.RecipeTransferRect( new Rectangle( 84, 23, 24, 18 ), "crafting", new Object[0] ) );
this.transferRects.add( new TemplateRecipeHandler.RecipeTransferRect( new Rectangle( 84, 23, 24, 18 ), "crafting" ) );
}
public Class<? extends GuiContainer> getGuiClass()
@ -42,7 +42,7 @@ public class NEIAEShapedRecipeHandler extends TemplateRecipeHandler
@Override
public String getRecipeName()
{
return NEIClientUtils.translate( "recipe.shaped", new Object[0] );
return NEIClientUtils.translate( "recipe.shaped" );
}
@Override

View file

@ -31,7 +31,7 @@ public class NEIAEShapelessRecipeHandler extends TemplateRecipeHandler
public void loadTransferRects()
{
this.transferRects.add( new TemplateRecipeHandler.RecipeTransferRect( new Rectangle( 84, 23, 24, 18 ), "crafting", new Object[0] ) );
this.transferRects.add( new TemplateRecipeHandler.RecipeTransferRect( new Rectangle( 84, 23, 24, 18 ), "crafting" ) );
}
public Class<? extends GuiContainer> getGuiClass()
@ -42,7 +42,7 @@ public class NEIAEShapelessRecipeHandler extends TemplateRecipeHandler
@Override
public String getRecipeName()
{
return NEIClientUtils.translate( "recipe.shapeless", new Object[0] );
return NEIClientUtils.translate( "recipe.shapeless" );
}
@Override

View file

@ -27,7 +27,7 @@ public class NEIFacadeRecipeHandler extends TemplateRecipeHandler
public void loadTransferRects()
{
this.transferRects.add( new TemplateRecipeHandler.RecipeTransferRect( new Rectangle( 84, 23, 24, 18 ), "crafting", new Object[0] ) );
this.transferRects.add( new TemplateRecipeHandler.RecipeTransferRect( new Rectangle( 84, 23, 24, 18 ), "crafting" ) );
}
public Class<? extends GuiContainer> getGuiClass()

View file

@ -64,7 +64,7 @@ public class NEIGrinderRecipeHandler extends TemplateRecipeHandler
public void loadTransferRects()
{
this.transferRects.add( new TemplateRecipeHandler.RecipeTransferRect( new Rectangle( 84, 23, 24, 18 ), "grindstone", new Object[0] ) );
this.transferRects.add( new TemplateRecipeHandler.RecipeTransferRect( new Rectangle( 84, 23, 24, 18 ), "grindstone" ) );
}
public Class<? extends GuiContainer> getGuiClass()

View file

@ -36,7 +36,7 @@ public class NEIInscriberRecipeHandler extends TemplateRecipeHandler
public void loadTransferRects()
{
this.transferRects.add( new TemplateRecipeHandler.RecipeTransferRect( new Rectangle( 84, 23, 24, 18 ), "inscriber", new Object[0] ) );
this.transferRects.add( new TemplateRecipeHandler.RecipeTransferRect( new Rectangle( 84, 23, 24, 18 ), "inscriber" ) );
}
public Class<? extends GuiContainer> getGuiClass()

View file

@ -460,7 +460,7 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
{
IMEInventoryHandler out = proxy.isActive() ? getInternalHandler() : null;
if ( out != null )
return Arrays.asList( new IMEInventoryHandler[] { out } );
return Arrays.asList( out );
}
return Arrays.asList( new IMEInventoryHandler[] {} );
}

View file

@ -3,6 +3,7 @@ package appeng.parts.reporting;
import java.util.Arrays;
import java.util.List;
import com.google.common.collect.Lists;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
@ -114,7 +115,7 @@ public class PartConversionMonitor extends PartStorageMonitor
if ( newItems != null )
{
TileEntity te = tile;
List<ItemStack> list = Arrays.asList( new ItemStack[] { newItems } );
List<ItemStack> list = Arrays.asList( newItems );
Platform.spawnDrops( player.worldObj, te.xCoord + side.offsetX, te.yCoord + side.offsetY, te.zCoord + side.offsetZ, list );
}

View file

@ -122,7 +122,7 @@ public class TileCrank extends AEBaseTile implements ICustomCollision
double yOff = -0.15 * getUp().offsetY;
double zOff = -0.15 * getUp().offsetZ;
return Arrays
.asList( new AxisAlignedBB[] { AxisAlignedBB.getBoundingBox( xOff + 0.15, yOff + 0.15, zOff + 0.15, xOff + 0.85, yOff + 0.85, zOff + 0.85 ) } );
.asList( AxisAlignedBB.getBoundingBox( xOff + 0.15, yOff + 0.15, zOff + 0.15, xOff + 0.85, yOff + 0.85, zOff + 0.85 ) );
}
@Override

View file

@ -576,14 +576,14 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
{
try
{
return Arrays.asList( new IMEInventoryHandler[] { getHandler( channel ) } );
return Arrays.asList( getHandler( channel ) );
}
catch (ChestNoHandler e)
{
// :P
}
}
return new ArrayList();
return new ArrayList<IMEInventoryHandler>();
}
@Override

View file

@ -1,12 +1,6 @@
package appeng.util.item;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.TreeMap;
import java.util.*;
import net.minecraftforge.oredict.OreDictionary;
import appeng.api.config.FuzzyMode;
@ -15,6 +9,8 @@ import appeng.api.storage.data.IAEItemStack;
import appeng.api.storage.data.IAEStack;
import appeng.api.storage.data.IItemList;
import com.google.common.collect.Lists;
public final class ItemList<StackType extends IAEStack> implements IItemList<StackType>
{
@ -26,7 +22,8 @@ public final class ItemList<StackType extends IAEStack> implements IItemList<Sta
int iteration = Integer.MIN_VALUE;
public Throwable stacktrace;
public ItemList(Class<? extends IAEStack> cla) {
public ItemList(Class<? extends IAEStack> cla)
{
clz = cla;
}
@ -200,8 +197,16 @@ public final class ItemList<StackType extends IAEStack> implements IItemList<Sta
return new ArrayList<StackType>();
if ( filter instanceof IAEFluidStack )
return filter.equals( this ) ? (List<StackType>) Arrays.asList( new IAEFluidStack[] { (IAEFluidStack) filter } ) : (List<StackType>) Arrays
.asList( new IAEFluidStack[] {} );
{
List<StackType> result = Lists.newArrayList();
if ( filter.equals( this ) )
{
result.add( filter );
}
return result;
}
AEItemStack ais = (AEItemStack) filter;
if ( ais.isOre() )