Merge pull request #178 from thatsIch/Redundant

Removed redundant array creations just to match varargs operations
This commit is contained in:
Chris
2014-09-29 14:06:27 -07:00
23 changed files with 45 additions and 40 deletions
+2 -2
View File
@@ -106,8 +106,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 )
@@ -147,9 +147,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
@@ -96,7 +96,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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -602,7 +602,6 @@ public abstract class AEBaseContainer extends Container
if ( syncData.containsKey( idx ) )
{
syncData.get( idx ).update( value );
return;
}
}
+1 -1
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 );
}
+1 -1
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)
{
+1 -1
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();
}
@@ -32,7 +32,7 @@ public class NEIAEShapedRecipeHandler extends TemplateRecipeHandler
@Override
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" ) );
}
@Override
@@ -44,7 +44,7 @@ public class NEIAEShapedRecipeHandler extends TemplateRecipeHandler
@Override
public String getRecipeName()
{
return NEIClientUtils.translate( "recipe.shaped", new Object[0] );
return NEIClientUtils.translate( "recipe.shaped" );
}
@Override
@@ -32,7 +32,7 @@ public class NEIAEShapelessRecipeHandler extends TemplateRecipeHandler
@Override
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" ) );
}
@Override
@@ -44,7 +44,7 @@ public class NEIAEShapelessRecipeHandler extends TemplateRecipeHandler
@Override
public String getRecipeName()
{
return NEIClientUtils.translate( "recipe.shapeless", new Object[0] );
return NEIClientUtils.translate( "recipe.shapeless" );
}
@Override
@@ -28,7 +28,7 @@ public class NEIFacadeRecipeHandler extends TemplateRecipeHandler
@Override
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" ) );
}
@Override
@@ -66,7 +66,7 @@ public class NEIGrinderRecipeHandler extends TemplateRecipeHandler
@Override
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" ) );
}
@Override
@@ -38,7 +38,7 @@ public class NEIInscriberRecipeHandler extends TemplateRecipeHandler
@Override
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" ) );
}
@Override
@@ -463,7 +463,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[] {} );
}
@@ -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;
@@ -115,7 +116,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 );
}
@@ -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
@@ -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
+15 -10
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() )