Merge pull request #144 from thatsIch/PerformanceImprovements

Use collections methods to add stuff
This commit is contained in:
Chris 2014-09-27 16:41:25 -07:00
commit 1aafe22ea9
5 changed files with 11 additions and 13 deletions

View file

@ -1,10 +1,12 @@
package appeng.block;
import java.util.ArrayList;
import java.util.Collections;
import java.util.EnumSet;
import java.util.List;
import appeng.client.texture.FlippableIcon;
import com.google.common.collect.Lists;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
@ -677,9 +679,7 @@ public class AEBaseBlock extends BlockContainer implements IAEFeature
if ( id.removedByPlayer( w, player, x, y, z, false ) )
{
List<ItemStack> l = new ArrayList<ItemStack>();
for (ItemStack iss : drops)
l.add( iss );
List<ItemStack> l = Lists.newArrayList(drops);
Platform.spawnDrops( w, x, y, z, l );
w.setBlockToAir( x, y, z );
}

View file

@ -104,7 +104,7 @@ public class ItemRepo
Method b = searchField.getClass().getMethod( "onTextChange", String.class );
NEIWord = filter;
a.invoke( searchField, new String( filter ) );
a.invoke( searchField, filter );
b.invoke( searchField, "" );
}
}

View file

@ -1,5 +1,6 @@
package appeng.me.helpers;
import java.util.Collections;
import java.util.EnumSet;
import net.minecraft.entity.player.EntityPlayer;
@ -307,8 +308,7 @@ public class AENetworkProxy implements IGridBlock
{
EnumSet<GridFlags> flags = EnumSet.noneOf( GridFlags.class );
for (GridFlags gf : requireChannel)
flags.add( gf );
Collections.addAll( flags, requireChannel );
this.flags = flags;
}

View file

@ -1,5 +1,6 @@
package appeng.recipes.handlers;
import java.util.Collections;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
@ -76,16 +77,13 @@ public class Inscribe implements ICraftHandler, IWebsiteSerializer
public void register() throws RegistrationError, MissingIngredientError
{
if ( imprintable != null )
for (ItemStack s : imprintable.getItemStackSet())
inputs.add( s );
Collections.addAll( inputs, imprintable.getItemStackSet() );
if ( plateA != null )
for (ItemStack s : plateA.getItemStackSet())
plates.add( s );
Collections.addAll( plates, plateA.getItemStackSet() );
if ( plateB != null )
for (ItemStack s : plateB.getItemStackSet())
plates.add( s );
Collections.addAll( plates, plateB.getItemStackSet() );
InscriberRecipe ir = new InscriberRecipe( imprintable.getItemStackSet(), plateA == null ? null : plateA.getItemStack(), plateB == null ? null
: plateB.getItemStack(), output.getItemStack(), usePlates );

View file

@ -74,7 +74,7 @@ public class Shaped implements ICraftHandler, IWebsiteSerializer
first++;
}
}
args.add( y, new String( row ) );
args.add( y, row );
}
ItemStack outIS = output.getItemStack();