Finally use Java7 <>

This commit is contained in:
yueh
2017-07-20 21:21:45 +02:00
parent 8ec8babb6a
commit 7de90ed0ae
145 changed files with 315 additions and 315 deletions
@@ -52,7 +52,7 @@ public class MEMonitorHandler<StackType extends IAEStack> implements IMEMonitor<
private final IMEInventoryHandler<StackType> internalHandler; private final IMEInventoryHandler<StackType> internalHandler;
private final IItemList<StackType> cachedList; private final IItemList<StackType> cachedList;
private final HashMap<IMEMonitorHandlerReceiver<StackType>, Object> listeners = new HashMap<IMEMonitorHandlerReceiver<StackType>, Object>(); private final HashMap<IMEMonitorHandlerReceiver<StackType>, Object> listeners = new HashMap<>();
protected boolean hasChanged = true; protected boolean hasChanged = true;
+1 -1
View File
@@ -122,7 +122,7 @@ public abstract class AEBaseBlock extends Block
if( collisionHandler != null && bb != null ) if( collisionHandler != null && bb != null )
{ {
final List<AxisAlignedBB> tmp = new ArrayList<AxisAlignedBB>(); final List<AxisAlignedBB> tmp = new ArrayList<>();
collisionHandler.addCollidingBlockToList( w, pos, bb, tmp, e ); collisionHandler.addCollidingBlockToList( w, pos, bb, tmp, e );
for( final AxisAlignedBB b : tmp ) for( final AxisAlignedBB b : tmp )
{ {
@@ -185,7 +185,7 @@ public abstract class AEBaseTileBlock extends AEBaseBlock implements ITileEntity
final AEBaseTile te = this.getTileEntity( w, pos ); final AEBaseTile te = this.getTileEntity( w, pos );
if( te != null ) if( te != null )
{ {
final ArrayList<ItemStack> drops = new ArrayList<ItemStack>(); final ArrayList<ItemStack> drops = new ArrayList<>();
if( te.dropItems() ) if( te.dropItems() )
{ {
te.getDrops( w, pos, drops ); te.getDrops( w, pos, drops );
@@ -85,9 +85,9 @@ import appeng.helpers.InventoryAction;
public abstract class AEBaseGui extends GuiContainer public abstract class AEBaseGui extends GuiContainer
{ {
private static boolean switchingGuis; private static boolean switchingGuis;
private final List<InternalSlotME> meSlots = new LinkedList<InternalSlotME>(); private final List<InternalSlotME> meSlots = new LinkedList<>();
// drag y // drag y
private final Set<Slot> drag_click = new HashSet<Slot>(); private final Set<Slot> drag_click = new HashSet<>();
private final StackSizeRenderer stackSizeRenderer = new StackSizeRenderer(); private final StackSizeRenderer stackSizeRenderer = new StackSizeRenderer();
private GuiScrollbar myScrollBar = null; private GuiScrollbar myScrollBar = null;
private boolean disableShiftClick = false; private boolean disableShiftClick = false;
@@ -42,7 +42,7 @@ public class AEConfigGui extends GuiConfig
private static List<IConfigElement> getConfigElements() private static List<IConfigElement> getConfigElements()
{ {
final List<IConfigElement> list = new ArrayList<IConfigElement>(); final List<IConfigElement> list = new ArrayList<>();
for( final String cat : AEConfig.instance().getCategoryNames() ) for( final String cat : AEConfig.instance().getCategoryNames() )
{ {
@@ -66,7 +66,7 @@ public class GuiCraftConfirm extends AEBaseGui
private final IItemList<IAEItemStack> pending = AEApi.instance().storage().createItemList(); private final IItemList<IAEItemStack> pending = AEApi.instance().storage().createItemList();
private final IItemList<IAEItemStack> missing = AEApi.instance().storage().createItemList(); private final IItemList<IAEItemStack> missing = AEApi.instance().storage().createItemList();
private final List<IAEItemStack> visual = new ArrayList<IAEItemStack>(); private final List<IAEItemStack> visual = new ArrayList<>();
private GuiBridge OriginalGui; private GuiBridge OriginalGui;
private GuiButton cancel; private GuiButton cancel;
@@ -237,7 +237,7 @@ public class GuiCraftConfirm extends AEBaseGui
final int viewEnd = viewStart + 3 * this.rows; final int viewEnd = viewStart + 3 * this.rows;
String dspToolTip = ""; String dspToolTip = "";
final List<String> lineList = new LinkedList<String>(); final List<String> lineList = new LinkedList<>();
int toolPosX = 0; int toolPosX = 0;
int toolPosY = 0; int toolPosY = 0;
@@ -88,7 +88,7 @@ public class GuiCraftingCPU extends AEBaseGui implements ISortSource
private IItemList<IAEItemStack> active = AEApi.instance().storage().createItemList(); private IItemList<IAEItemStack> active = AEApi.instance().storage().createItemList();
private IItemList<IAEItemStack> pending = AEApi.instance().storage().createItemList(); private IItemList<IAEItemStack> pending = AEApi.instance().storage().createItemList();
private List<IAEItemStack> visual = new ArrayList<IAEItemStack>(); private List<IAEItemStack> visual = new ArrayList<>();
private GuiButton cancel; private GuiButton cancel;
private int tooltip = -1; private int tooltip = -1;
@@ -113,7 +113,7 @@ public class GuiCraftingCPU extends AEBaseGui implements ISortSource
this.storage = AEApi.instance().storage().createItemList(); this.storage = AEApi.instance().storage().createItemList();
this.active = AEApi.instance().storage().createItemList(); this.active = AEApi.instance().storage().createItemList();
this.pending = AEApi.instance().storage().createItemList(); this.pending = AEApi.instance().storage().createItemList();
this.visual = new ArrayList<IAEItemStack>(); this.visual = new ArrayList<>();
} }
@Override @Override
@@ -211,7 +211,7 @@ public class GuiCraftingCPU extends AEBaseGui implements ISortSource
final int viewEnd = viewStart + 3 * 6; final int viewEnd = viewStart + 3 * 6;
String dspToolTip = ""; String dspToolTip = "";
final List<String> lineList = new LinkedList<String>(); final List<String> lineList = new LinkedList<>();
int toolPosX = 0; int toolPosX = 0;
int toolPosY = 0; int toolPosY = 0;
@@ -58,12 +58,12 @@ public class GuiInterfaceTerminal extends AEBaseGui
// TODO: copied from GuiMEMonitorable. It looks not changed, maybe unneeded? // TODO: copied from GuiMEMonitorable. It looks not changed, maybe unneeded?
private final int offsetX = 9; private final int offsetX = 9;
private final HashMap<Long, ClientDCInternalInv> byId = new HashMap<Long, ClientDCInternalInv>(); private final HashMap<Long, ClientDCInternalInv> byId = new HashMap<>();
private final HashMultimap<String, ClientDCInternalInv> byName = HashMultimap.create(); private final HashMultimap<String, ClientDCInternalInv> byName = HashMultimap.create();
private final ArrayList<String> names = new ArrayList<String>(); private final ArrayList<String> names = new ArrayList<>();
private final ArrayList<Object> lines = new ArrayList<Object>(); private final ArrayList<Object> lines = new ArrayList<>();
private final Map<String, Set<Object>> cachedSearches = new WeakHashMap<String, Set<Object>>(); private final Map<String, Set<Object>> cachedSearches = new WeakHashMap<>();
private boolean refreshList = false; private boolean refreshList = false;
private MEGuiTextField searchField; private MEGuiTextField searchField;
@@ -313,7 +313,7 @@ public class GuiInterfaceTerminal extends AEBaseGui
{ {
this.lines.add( n ); this.lines.add( n );
final ArrayList<ClientDCInternalInv> clientInventories = new ArrayList<ClientDCInternalInv>(); final ArrayList<ClientDCInternalInv> clientInventories = new ArrayList<>();
clientInventories.addAll( this.byName.get( n ) ); clientInventories.addAll( this.byName.get( n ) );
Collections.sort( clientInventories ); Collections.sort( clientInventories );
@@ -371,7 +371,7 @@ public class GuiInterfaceTerminal extends AEBaseGui
{ {
if( !this.cachedSearches.containsKey( searchTerm ) ) if( !this.cachedSearches.containsKey( searchTerm ) )
{ {
this.cachedSearches.put( searchTerm, new HashSet<Object>() ); this.cachedSearches.put( searchTerm, new HashSet<>() );
} }
final Set<Object> cache = this.cachedSearches.get( searchTerm ); final Set<Object> cache = this.cachedSearches.get( searchTerm );
@@ -75,7 +75,7 @@ public class GuiImgButton extends GuiButton implements ITooltip
if( appearances == null ) if( appearances == null )
{ {
appearances = new HashMap<EnumPair, ButtonAppearance>(); appearances = new HashMap<>();
this.registerApp( 16 * 7, Settings.CONDENSER_OUTPUT, CondenserOutput.TRASH, ButtonToolTips.CondenserOutput, ButtonToolTips.Trash ); this.registerApp( 16 * 7, Settings.CONDENSER_OUTPUT, CondenserOutput.TRASH, ButtonToolTips.CondenserOutput, ButtonToolTips.Trash );
this.registerApp( 16 * 7 + 1, Settings.CONDENSER_OUTPUT, CondenserOutput.MATTER_BALLS, ButtonToolTips.CondenserOutput, ButtonToolTips.MatterBalls ); this.registerApp( 16 * 7 + 1, Settings.CONDENSER_OUTPUT, CondenserOutput.MATTER_BALLS, ButtonToolTips.CondenserOutput, ButtonToolTips.MatterBalls );
this.registerApp( 16 * 7 + 2, Settings.CONDENSER_OUTPUT, CondenserOutput.SINGULARITY, ButtonToolTips.CondenserOutput, ButtonToolTips.Singularity ); this.registerApp( 16 * 7 + 2, Settings.CONDENSER_OUTPUT, CondenserOutput.SINGULARITY, ButtonToolTips.CondenserOutput, ButtonToolTips.Singularity );
+2 -2
View File
@@ -49,8 +49,8 @@ public class ItemRepo
{ {
private final IItemList<IAEItemStack> list = AEApi.instance().storage().createItemList(); private final IItemList<IAEItemStack> list = AEApi.instance().storage().createItemList();
private final ArrayList<IAEItemStack> view = new ArrayList<IAEItemStack>(); private final ArrayList<IAEItemStack> view = new ArrayList<>();
private final ArrayList<ItemStack> dsp = new ArrayList<ItemStack>(); private final ArrayList<ItemStack> dsp = new ArrayList<>();
private final IScrollSource src; private final IScrollSource src;
private final ISortSource sortSrc; private final ISortSource sortSrc;
@@ -334,7 +334,7 @@ public enum UVLModelLoader implements ICustomModelLoader
return null; return null;
} }
object = object.get( "uvlightmap" ).getAsJsonObject(); object = object.get( "uvlightmap" ).getAsJsonObject();
return new ImmutablePair<Float, Float>( JsonUtils.getFloat( object, "sky", 0 ), JsonUtils.getFloat( object, "block", 0 ) ); return new ImmutablePair<>( JsonUtils.getFloat( object, "sky", 0 ), JsonUtils.getFloat( object, "block", 0 ) );
} }
} }
@@ -87,12 +87,12 @@ public abstract class AEBaseContainer extends Container
private final InventoryPlayer invPlayer; private final InventoryPlayer invPlayer;
private final BaseActionSource mySrc; private final BaseActionSource mySrc;
private final HashSet<Integer> locked = new HashSet<Integer>(); private final HashSet<Integer> locked = new HashSet<>();
private final TileEntity tileEntity; private final TileEntity tileEntity;
private final IPart part; private final IPart part;
private final IGuiItemObject obj; private final IGuiItemObject obj;
private final List<PacketPartialItem> dataChunks = new LinkedList<PacketPartialItem>(); private final List<PacketPartialItem> dataChunks = new LinkedList<>();
private final HashMap<Integer, SyncData> syncData = new HashMap<Integer, SyncData>(); private final HashMap<Integer, SyncData> syncData = new HashMap<>();
private boolean isContainerValid = true; private boolean isContainerValid = true;
private String customName; private String customName;
private ContainerOpenContext openContext; private ContainerOpenContext openContext;
@@ -245,7 +245,7 @@ public abstract class AEBaseContainer extends Container
CompressedStreamTools.writeCompressed( item, stream ); CompressedStreamTools.writeCompressed( item, stream );
final int maxChunkSize = 30000; final int maxChunkSize = 30000;
final List<byte[]> miniPackets = new LinkedList<byte[]>(); final List<byte[]> miniPackets = new LinkedList<>();
final byte[] data = stream.toByteArray(); final byte[] data = stream.toByteArray();
@@ -488,7 +488,7 @@ public abstract class AEBaseContainer extends Container
return ItemStack.EMPTY; return ItemStack.EMPTY;
} }
final List<Slot> selectedSlots = new ArrayList<Slot>(); final List<Slot> selectedSlots = new ArrayList<>();
/** /**
* Gather a list of valid destinations. * Gather a list of valid destinations.
@@ -825,7 +825,7 @@ public abstract class AEBaseContainer extends Container
if( action == InventoryAction.MOVE_REGION ) if( action == InventoryAction.MOVE_REGION )
{ {
final List<Slot> from = new LinkedList<Slot>(); final List<Slot> from = new LinkedList<>();
for( final Object j : this.inventorySlots ) for( final Object j : this.inventorySlots )
{ {
@@ -234,7 +234,7 @@ public class ContainerCellWorkbench extends ContainerUpgradeable
final IMEInventory<IAEItemStack> cellInv = AEApi.instance().registries().cell().getCellInventory( final IMEInventory<IAEItemStack> cellInv = AEApi.instance().registries().cell().getCellInventory(
this.getUpgradeable().getInventoryByName( "cell" ).getStackInSlot( 0 ), null, StorageChannel.ITEMS ); this.getUpgradeable().getInventoryByName( "cell" ).getStackInSlot( 0 ), null, StorageChannel.ITEMS );
Iterator<IAEItemStack> i = new NullIterator<IAEItemStack>(); Iterator<IAEItemStack> i = new NullIterator<>();
if( cellInv != null ) if( cellInv != null )
{ {
final IItemList<IAEItemStack> list = cellInv.getAvailableItems( AEApi.instance().storage().createItemList() ); final IItemList<IAEItemStack> list = cellInv.getAvailableItems( AEApi.instance().storage().createItemList() );
@@ -69,7 +69,7 @@ import appeng.util.Platform;
public class ContainerCraftConfirm extends AEBaseContainer public class ContainerCraftConfirm extends AEBaseContainer
{ {
private final ArrayList<CraftingCPURecord> cpus = new ArrayList<CraftingCPURecord>(); private final ArrayList<CraftingCPURecord> cpus = new ArrayList<>();
private Future<ICraftingJob> job; private Future<ICraftingJob> job;
private ICraftingJob result; private ICraftingJob result;
@GuiSync( 0 ) @GuiSync( 0 )
@@ -37,7 +37,7 @@ import appeng.util.Platform;
public class ContainerCraftingStatus extends ContainerCraftingCPU public class ContainerCraftingStatus extends ContainerCraftingCPU
{ {
private final List<CraftingCPURecord> cpus = new ArrayList<CraftingCPURecord>(); private final List<CraftingCPURecord> cpus = new ArrayList<>();
@GuiSync( 5 ) @GuiSync( 5 )
public int selectedCpu = -1; public int selectedCpu = -1;
@GuiSync( 6 ) @GuiSync( 6 )
@@ -62,8 +62,8 @@ public final class ContainerInterfaceTerminal extends AEBaseContainer
*/ */
private static long autoBase = Long.MIN_VALUE; private static long autoBase = Long.MIN_VALUE;
private final Map<IInterfaceHost, InvTracker> diList = new HashMap<IInterfaceHost, InvTracker>(); private final Map<IInterfaceHost, InvTracker> diList = new HashMap<>();
private final Map<Long, InvTracker> byId = new HashMap<Long, InvTracker>(); private final Map<Long, InvTracker> byId = new HashMap<>();
private IGrid grid; private IGrid grid;
private NBTTagCompound data = new NBTTagCompound(); private NBTTagCompound data = new NBTTagCompound();
@@ -282,7 +282,7 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
} }
else else
{ {
final List<ItemStack> list = new ArrayList<ItemStack>( 3 ); final List<ItemStack> list = new ArrayList<>( 3 );
boolean hasValue = false; boolean hasValue = false;
for( final OptionalSlotFake outputSlot : this.outputSlots ) for( final OptionalSlotFake outputSlot : this.outputSlots )
@@ -157,7 +157,7 @@ public class ContainerStorageBus extends ContainerUpgradeable
final IMEInventory<IAEItemStack> cellInv = this.storageBus.getInternalHandler(); final IMEInventory<IAEItemStack> cellInv = this.storageBus.getInternalHandler();
Iterator<IAEItemStack> i = new NullIterator<IAEItemStack>(); Iterator<IAEItemStack> i = new NullIterator<>();
if( cellInv != null ) if( cellInv != null )
{ {
final IItemList<IAEItemStack> list = cellInv.getAvailableItems( AEApi.instance().storage().createItemList() ); final IItemList<IAEItemStack> list = cellInv.getAvailableItems( AEApi.instance().storage().createItemList() );
@@ -141,7 +141,7 @@ public class SlotCraftingTerm extends AppEngCraftingSlot
final ItemStack extra = ia.addItems( this.craftItem( who, rs, inv, all ) ); final ItemStack extra = ia.addItems( this.craftItem( who, rs, inv, all ) );
if( !extra.isEmpty() ) if( !extra.isEmpty() )
{ {
final List<ItemStack> drops = new ArrayList<ItemStack>(); final List<ItemStack> drops = new ArrayList<>();
drops.add( extra ); drops.add( extra );
Platform.spawnDrops( who.world, new BlockPos( (int) who.posX, (int) who.posY, (int) who.posZ ), drops ); Platform.spawnDrops( who.world, new BlockPos( (int) who.posX, (int) who.posY, (int) who.posZ ), drops );
return; return;
@@ -250,7 +250,7 @@ public class SlotCraftingTerm extends AppEngCraftingSlot
private void postCraft( final EntityPlayer p, final IMEMonitor<IAEItemStack> inv, final ItemStack[] set, final ItemStack result ) private void postCraft( final EntityPlayer p, final IMEMonitor<IAEItemStack> inv, final ItemStack[] set, final ItemStack result )
{ {
final List<ItemStack> drops = new ArrayList<ItemStack>(); final List<ItemStack> drops = new ArrayList<>();
// add one of each item to the items on the board... // add one of each item to the items on the board...
if( Platform.isServer() ) if( Platform.isServer() )
+1 -1
View File
@@ -57,7 +57,7 @@ public class IMCHandler
*/ */
public IMCHandler() public IMCHandler()
{ {
this.processors = new HashMap<String, IIMCProcessor>( INITIAL_PROCESSORS_CAPACITY ); this.processors = new HashMap<>( INITIAL_PROCESSORS_CAPACITY );
this.processors.put( "blacklist-block-spatial", new IMCBlackListSpatial() ); this.processors.put( "blacklist-block-spatial", new IMCBlackListSpatial() );
this.processors.put( "whitelist-spatial", new IMCSpatial() ); this.processors.put( "whitelist-spatial", new IMCSpatial() );
+3 -3
View File
@@ -124,9 +124,9 @@ public final class Registration
private Biome storageBiome; private Biome storageBiome;
// TODO : 1.12 Improve // TODO : 1.12 Improve
private static List<Block> blocksToRegister = new ArrayList<Block>(); private static List<Block> blocksToRegister = new ArrayList<>();
private static List<Item> itemsToRegister = new ArrayList<Item>(); private static List<Item> itemsToRegister = new ArrayList<>();
private static List<IRecipe> recipesToRegister = new ArrayList<IRecipe>(); private static List<IRecipe> recipesToRegister = new ArrayList<>();
private File recipeDirectory; private File recipeDirectory;
private CustomRecipeConfig customRecipeConfig; private CustomRecipeConfig customRecipeConfig;
+1 -1
View File
@@ -75,7 +75,7 @@ public class ApiPart implements IPartHelper
} ); } );
private final Map<Class<?>, String> interfaces2Layer = new HashMap<>(); private final Map<Class<?>, String> interfaces2Layer = new HashMap<>();
private final List<String> desc = new LinkedList<String>(); private final List<String> desc = new LinkedList<>();
/** /**
* Conceptually this method will build a new class hierarchy that is rooted at the given base class, and includes a * Conceptually this method will build a new class hierarchy that is rooted at the given base class, and includes a
@@ -32,7 +32,7 @@ import appeng.core.AELog;
public final class GridCacheRegistry implements IGridCacheRegistry public final class GridCacheRegistry implements IGridCacheRegistry
{ {
private final Map<Class<? extends IGridCache>, Class<? extends IGridCache>> caches = new HashMap<Class<? extends IGridCache>, Class<? extends IGridCache>>(); private final Map<Class<? extends IGridCache>, Class<? extends IGridCache>> caches = new HashMap<>();
@Override @Override
public void registerGridCache( final Class<? extends IGridCache> iface, final Class<? extends IGridCache> implementation ) public void registerGridCache( final Class<? extends IGridCache> iface, final Class<? extends IGridCache> implementation )
@@ -50,7 +50,7 @@ public final class GridCacheRegistry implements IGridCacheRegistry
@Override @Override
public HashMap<Class<? extends IGridCache>, IGridCache> createCacheInstance( final IGrid g ) public HashMap<Class<? extends IGridCache>, IGridCache> createCacheInstance( final IGrid g )
{ {
final HashMap<Class<? extends IGridCache>, IGridCache> map = new HashMap<Class<? extends IGridCache>, IGridCache>(); final HashMap<Class<? extends IGridCache>, IGridCache> map = new HashMap<>();
for( final Class<? extends IGridCache> iface : this.caches.keySet() ) for( final Class<? extends IGridCache> iface : this.caches.keySet() )
{ {
@@ -38,7 +38,7 @@ public final class LocatableRegistry implements ILocatableRegistry
public LocatableRegistry() public LocatableRegistry()
{ {
this.set = new HashMap<Long, ILocatable>(); this.set = new HashMap<>();
MinecraftForge.EVENT_BUS.register( this ); MinecraftForge.EVENT_BUS.register( this );
} }
@@ -33,7 +33,7 @@ import appeng.util.Platform;
public class MatterCannonAmmoRegistry implements IOreListener, IMatterCannonAmmoRegistry public class MatterCannonAmmoRegistry implements IOreListener, IMatterCannonAmmoRegistry
{ {
private final HashMap<ItemStack, Double> DamageModifiers = new HashMap<ItemStack, Double>(); private final HashMap<ItemStack, Double> DamageModifiers = new HashMap<>();
public MatterCannonAmmoRegistry() public MatterCannonAmmoRegistry()
{ {
@@ -36,11 +36,11 @@ import appeng.spatial.DefaultSpatialHandler;
public class MovableTileRegistry implements IMovableRegistry public class MovableTileRegistry implements IMovableRegistry
{ {
private final HashSet<Block> blacklisted = new HashSet<Block>(); private final HashSet<Block> blacklisted = new HashSet<>();
private final HashMap<Class<? extends TileEntity>, IMovableHandler> Valid = new HashMap<Class<? extends TileEntity>, IMovableHandler>(); private final HashMap<Class<? extends TileEntity>, IMovableHandler> Valid = new HashMap<>();
private final LinkedList<Class<? extends TileEntity>> test = new LinkedList<Class<? extends TileEntity>>(); private final LinkedList<Class<? extends TileEntity>> test = new LinkedList<>();
private final LinkedList<IMovableHandler> handlers = new LinkedList<IMovableHandler>(); private final LinkedList<IMovableHandler> handlers = new LinkedList<>();
private final DefaultSpatialHandler dsh = new DefaultSpatialHandler(); private final DefaultSpatialHandler dsh = new DefaultSpatialHandler();
private final IMovableHandler nullHandler = new DefaultSpatialHandler(); private final IMovableHandler nullHandler = new DefaultSpatialHandler();
@@ -48,7 +48,7 @@ public final class P2PTunnelRegistry implements IP2PTunnelRegistry
{ {
private static final int INITIAL_CAPACITY = 40; private static final int INITIAL_CAPACITY = 40;
private final Map<ItemStack, TunnelType> tunnels = new HashMap<ItemStack, TunnelType>( INITIAL_CAPACITY ); private final Map<ItemStack, TunnelType> tunnels = new HashMap<>( INITIAL_CAPACITY );
private final Map<String, TunnelType> modIdTunnels = new HashMap<>( INITIAL_CAPACITY ); private final Map<String, TunnelType> modIdTunnels = new HashMap<>( INITIAL_CAPACITY );
public void configure() public void configure()
@@ -43,8 +43,8 @@ import appeng.recipes.RecipeHandler;
*/ */
public class RecipeHandlerRegistry implements IRecipeHandlerRegistry public class RecipeHandlerRegistry implements IRecipeHandlerRegistry
{ {
private final Map<String, Class<? extends ICraftHandler>> handlers = new HashMap<String, Class<? extends ICraftHandler>>( 20 ); private final Map<String, Class<? extends ICraftHandler>> handlers = new HashMap<>( 20 );
private final Collection<ISubItemResolver> resolvers = new LinkedList<ISubItemResolver>(); private final Collection<ISubItemResolver> resolvers = new LinkedList<>();
@Override @Override
public void addNewCraftHandler( final String name, final Class<? extends ICraftHandler> handler ) public void addNewCraftHandler( final String name, final Class<? extends ICraftHandler> handler )
@@ -36,7 +36,7 @@ public class SpecialComparisonRegistry implements ISpecialComparisonRegistry
public SpecialComparisonRegistry() public SpecialComparisonRegistry()
{ {
this.CompRegistry = new ArrayList<IItemComparisonProvider>(); this.CompRegistry = new ArrayList<>();
} }
@Override @Override
@@ -41,7 +41,7 @@ public final class WirelessRegistry implements IWirelessTermRegistry
public WirelessRegistry() public WirelessRegistry()
{ {
this.handlers = new ArrayList<IWirelessTermHandler>(); this.handlers = new ArrayList<>();
} }
@Override @Override
@@ -115,8 +115,8 @@ public final class WorldGenRegistry implements IWorldGen
private static class TypeSet private static class TypeSet
{ {
final HashSet<Class<? extends WorldProvider>> badProviders = new HashSet<Class<? extends WorldProvider>>(); final HashSet<Class<? extends WorldProvider>> badProviders = new HashSet<>();
final HashSet<Integer> badDimensions = new HashSet<Integer>(); final HashSet<Integer> badDimensions = new HashSet<>();
final HashSet<Integer> enabledDimensions = new HashSet<Integer>(); final HashSet<Integer> enabledDimensions = new HashSet<>();
} }
} }
@@ -38,7 +38,7 @@ public class CellRegistry implements ICellRegistry
public CellRegistry() public CellRegistry()
{ {
this.handlers = new ArrayList<ICellHandler>(); this.handlers = new ArrayList<>();
} }
@Override @Override
@@ -59,7 +59,7 @@ public class InscriberRecipe implements IInscriberRecipe
InscriberRecipe( @Nonnull final Collection<ItemStack> inputs, @Nonnull final ItemStack output, @Nullable final ItemStack top, @Nullable final ItemStack bot, @Nonnull final InscriberProcessType type ) InscriberRecipe( @Nonnull final Collection<ItemStack> inputs, @Nonnull final ItemStack output, @Nullable final ItemStack top, @Nullable final ItemStack bot, @Nonnull final InscriberProcessType type )
{ {
this.inputs = new ArrayList<ItemStack>( inputs.size() ); this.inputs = new ArrayList<>( inputs.size() );
this.inputs.addAll( inputs ); this.inputs.addAll( inputs );
this.output = output; this.output = output;
@@ -50,9 +50,9 @@ public final class InscriberRegistry implements IInscriberRegistry
public InscriberRegistry() public InscriberRegistry()
{ {
this.inputs = new HashSet<ItemStack>(); this.inputs = new HashSet<>();
this.optionals = new HashSet<ItemStack>(); this.optionals = new HashSet<>();
this.recipes = new HashSet<IInscriberRecipe>(); this.recipes = new HashSet<>();
} }
@Nonnull @Nonnull
@@ -128,7 +128,7 @@ public final class InscriberRegistry implements IInscriberRegistry
@Override @Override
public Builder withInputs( @Nonnull final Collection<ItemStack> inputs ) public Builder withInputs( @Nonnull final Collection<ItemStack> inputs )
{ {
this.inputs = new ArrayList<ItemStack>( inputs.size() ); this.inputs = new ArrayList<>( inputs.size() );
this.inputs.addAll( inputs ); this.inputs.addAll( inputs );
return this; return this;
@@ -53,7 +53,7 @@ import appeng.core.sync.packets.PacketValueConfig;
public class AppEngPacketHandlerBase public class AppEngPacketHandlerBase
{ {
private static final Map<Class<? extends AppEngPacket>, PacketTypes> REVERSE_LOOKUP = new HashMap<Class<? extends AppEngPacket>, AppEngPacketHandlerBase.PacketTypes>(); private static final Map<Class<? extends AppEngPacket>, PacketTypes> REVERSE_LOOKUP = new HashMap<>();
public enum PacketTypes public enum PacketTypes
{ {
@@ -77,7 +77,7 @@ public class PacketMEInventoryUpdate extends AppEngPacket
{ {
this.data = null; this.data = null;
this.compressFrame = null; this.compressFrame = null;
this.list = new LinkedList<IAEItemStack>(); this.list = new LinkedList<>();
this.ref = stream.readByte(); this.ref = stream.readByte();
// int originalBytes = stream.readableBytes(); // int originalBytes = stream.readableBytes();
@@ -101,7 +101,7 @@ final class SpawnData implements IWorldSpawnData
@Override @Override
public Collection<NBTTagCompound> getNearByMeteorites( final int dim, final int chunkX, final int chunkZ ) public Collection<NBTTagCompound> getNearByMeteorites( final int dim, final int chunkX, final int chunkZ )
{ {
final Collection<NBTTagCompound> ll = new LinkedList<NBTTagCompound>(); final Collection<NBTTagCompound> ll = new LinkedList<>();
synchronized( SpawnData.class ) synchronized( SpawnData.class )
{ {
@@ -49,7 +49,7 @@ final class StorageData implements IWorldGridStorageData, IOnWorldStartable, IOn
private static final String GRID_STORAGE_CATEGORY = "gridstorage"; private static final String GRID_STORAGE_CATEGORY = "gridstorage";
private final Map<GridStorageSearch, WeakReference<GridStorageSearch>> loadedStorage = new WeakHashMap<GridStorageSearch, WeakReference<GridStorageSearch>>( 10 ); private final Map<GridStorageSearch, WeakReference<GridStorageSearch>> loadedStorage = new WeakHashMap<>( 10 );
private final Configuration config; private final Configuration config;
private long lastGridStorage; private long lastGridStorage;
@@ -80,8 +80,8 @@ final class StorageData implements IWorldGridStorageData, IOnWorldStartable, IOn
final String id = String.valueOf( storageID ); final String id = String.valueOf( storageID );
final String data = this.config.get( "gridstorage", id, "" ).getString(); final String data = this.config.get( "gridstorage", id, "" ).getString();
final GridStorage thisStorage = new GridStorage( data, storageID, gss ); final GridStorage thisStorage = new GridStorage( data, storageID, gss );
gss.setGridStorage( new WeakReference<GridStorage>( thisStorage ) ); gss.setGridStorage( new WeakReference<>( thisStorage ) );
this.loadedStorage.put( gss, new WeakReference<GridStorageSearch>( gss ) ); this.loadedStorage.put( gss, new WeakReference<>( gss ) );
return thisStorage; return thisStorage;
} }
@@ -98,8 +98,8 @@ final class StorageData implements IWorldGridStorageData, IOnWorldStartable, IOn
final long storageID = this.nextGridStorage(); final long storageID = this.nextGridStorage();
final GridStorageSearch gss = new GridStorageSearch( storageID ); final GridStorageSearch gss = new GridStorageSearch( storageID );
final GridStorage newStorage = new GridStorage( storageID, gss ); final GridStorage newStorage = new GridStorage( storageID, gss );
gss.setGridStorage( new WeakReference<GridStorage>( newStorage ) ); gss.setGridStorage( new WeakReference<>( newStorage ) );
this.loadedStorage.put( gss, new WeakReference<GridStorageSearch>( gss ) ); this.loadedStorage.put( gss, new WeakReference<>( gss ) );
return newStorage; return newStorage;
} }
@@ -58,7 +58,7 @@ public class CraftingJob implements Runnable, ICraftingJob
private final World world; private final World world;
private final IItemList<IAEItemStack> crafting = AEApi.instance().storage().createItemList(); private final IItemList<IAEItemStack> crafting = AEApi.instance().storage().createItemList();
private final IItemList<IAEItemStack> missing = AEApi.instance().storage().createItemList(); private final IItemList<IAEItemStack> missing = AEApi.instance().storage().createItemList();
private final HashMap<String, TwoIntegers> opsAndMultiplier = new HashMap<String, TwoIntegers>(); private final HashMap<String, TwoIntegers> opsAndMultiplier = new HashMap<>();
private final Object monitor = new Object(); private final Object monitor = new Object();
private final Stopwatch watch = Stopwatch.createUnstarted(); private final Stopwatch watch = Stopwatch.createUnstarted();
private CraftingTreeNode tree; private CraftingTreeNode tree;
@@ -52,7 +52,7 @@ public class CraftingTreeNode
// what item is this? // what item is this?
private final IAEItemStack what; private final IAEItemStack what;
// what are the crafting patterns for this? // what are the crafting patterns for this?
private final ArrayList<CraftingTreeProcess> nodes = new ArrayList<CraftingTreeProcess>(); private final ArrayList<CraftingTreeProcess> nodes = new ArrayList<>();
private int bytes = 0; private int bytes = 0;
private boolean canEmit = false; private boolean canEmit = false;
private long missing = 0; private long missing = 0;
@@ -121,7 +121,7 @@ public class CraftingTreeNode
{ {
this.job.handlePausing(); this.job.handlePausing();
final List<IAEItemStack> thingsUsed = new LinkedList<IAEItemStack>(); final List<IAEItemStack> thingsUsed = new LinkedList<>();
this.what.setStackSize( l ); this.what.setStackSize( l );
if( this.getSlot() >= 0 && this.parent != null && this.parent.details.isCraftable() ) if( this.getSlot() >= 0 && this.parent != null && this.parent.details.isCraftable() )
@@ -47,7 +47,7 @@ public class CraftingTreeProcess
private final CraftingTreeNode parent; private final CraftingTreeNode parent;
final ICraftingPatternDetails details; final ICraftingPatternDetails details;
private final CraftingJob job; private final CraftingJob job;
private final Map<CraftingTreeNode, Long> nodes = new HashMap<CraftingTreeNode, Long>(); private final Map<CraftingTreeNode, Long> nodes = new HashMap<>();
private final int depth; private final int depth;
boolean possible = true; boolean possible = true;
private World world; private World world;
@@ -37,7 +37,7 @@ public class CraftingWatcher implements ICraftingWatcher
private final CraftingGridCache gsc; private final CraftingGridCache gsc;
private final ICraftingWatcherHost host; private final ICraftingWatcherHost host;
private final Set<IAEStack> myInterests = new HashSet<IAEStack>(); private final Set<IAEStack> myInterests = new HashSet<>();
public CraftingWatcher( final CraftingGridCache cache, final ICraftingWatcherHost host ) public CraftingWatcher( final CraftingGridCache cache, final ICraftingWatcherHost host )
{ {
+1 -1
View File
@@ -36,7 +36,7 @@ import appeng.tile.AEBaseTile;
public class TileItemGen extends AEBaseTile implements IInventory public class TileItemGen extends AEBaseTile implements IInventory
{ {
private static final Queue<ItemStack> POSSIBLE_ITEMS = new LinkedList<ItemStack>(); private static final Queue<ItemStack> POSSIBLE_ITEMS = new LinkedList<>();
public TileItemGen() public TileItemGen()
{ {
@@ -95,7 +95,7 @@ public class ToolDebugCard extends AEBaseItem
if( pg.getControllerState() == ControllerState.CONTROLLER_ONLINE ) if( pg.getControllerState() == ControllerState.CONTROLLER_ONLINE )
{ {
Set<IGridNode> next = new HashSet<IGridNode>(); Set<IGridNode> next = new HashSet<>();
next.add( node ); next.add( node );
final int maxLength = 10000; final int maxLength = 10000;
@@ -105,7 +105,7 @@ public class ToolDebugCard extends AEBaseItem
while( !next.isEmpty() ) while( !next.isEmpty() )
{ {
final Iterable<IGridNode> current = next; final Iterable<IGridNode> current = next;
next = new HashSet<IGridNode>(); next = new HashSet<>();
for( final IGridNode n : current ) for( final IGridNode n : current )
{ {
+2 -2
View File
@@ -50,14 +50,14 @@ public class ToolEraser extends AEBaseItem
final IBlockState state = world.getBlockState( pos ); final IBlockState state = world.getBlockState( pos );
List<BlockPos> next = new LinkedList<BlockPos>(); List<BlockPos> next = new LinkedList<>();
next.add( pos ); next.add( pos );
int blocks = 0; int blocks = 0;
while( blocks < BLOCK_ERASE_LIMIT && !next.isEmpty() ) while( blocks < BLOCK_ERASE_LIMIT && !next.isEmpty() )
{ {
final List<BlockPos> c = next; final List<BlockPos> c = next;
next = new LinkedList<BlockPos>(); next = new LinkedList<>();
for( final BlockPos wc : c ) for( final BlockPos wc : c )
{ {
@@ -116,7 +116,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
public static final int NUMBER_OF_CONFIG_SLOTS = 9; public static final int NUMBER_OF_CONFIG_SLOTS = 9;
public static final int NUMBER_OF_PATTERN_SLOTS = 9; public static final int NUMBER_OF_PATTERN_SLOTS = 9;
private static final Collection<Block> BAD_BLOCKS = new HashSet<Block>( 100 ); private static final Collection<Block> BAD_BLOCKS = new HashSet<>( 100 );
private final int[] sides = { 0, 1, 2, 3, 4, 5, 6, 7, 8 }; private final int[] sides = { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
private final IAEItemStack[] requireWork = { null, null, null, null, null, null, null, null, null }; private final IAEItemStack[] requireWork = { null, null, null, null, null, null, null, null, null };
private final MultiCraftingTracker craftingTracker; private final MultiCraftingTracker craftingTracker;
@@ -129,8 +129,8 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
private final AppEngInternalInventory storage = new AppEngInternalInventory( this, NUMBER_OF_STORAGE_SLOTS ); private final AppEngInternalInventory storage = new AppEngInternalInventory( this, NUMBER_OF_STORAGE_SLOTS );
private final AppEngInternalInventory patterns = new AppEngInternalInventory( this, NUMBER_OF_PATTERN_SLOTS ); private final AppEngInternalInventory patterns = new AppEngInternalInventory( this, NUMBER_OF_PATTERN_SLOTS );
private final WrapperInvSlot slotInv = new WrapperInvSlot( this.storage ); private final WrapperInvSlot slotInv = new WrapperInvSlot( this.storage );
private final MEMonitorPassThrough<IAEItemStack> items = new MEMonitorPassThrough<IAEItemStack>( new NullInventory<IAEItemStack>(), StorageChannel.ITEMS ); private final MEMonitorPassThrough<IAEItemStack> items = new MEMonitorPassThrough<>( new NullInventory<IAEItemStack>(), StorageChannel.ITEMS );
private final MEMonitorPassThrough<IAEFluidStack> fluids = new MEMonitorPassThrough<IAEFluidStack>( new NullInventory<IAEFluidStack>(), StorageChannel.FLUIDS ); private final MEMonitorPassThrough<IAEFluidStack> fluids = new MEMonitorPassThrough<>( new NullInventory<IAEFluidStack>(), StorageChannel.FLUIDS );
private final UpgradeInventory upgrades; private final UpgradeInventory upgrades;
private boolean hasConfig = false; private boolean hasConfig = false;
private int priority; private int priority;
@@ -272,7 +272,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
if( this.waitingToSend == null ) if( this.waitingToSend == null )
{ {
this.waitingToSend = new LinkedList<ItemStack>(); this.waitingToSend = new LinkedList<>();
} }
this.waitingToSend.add( is ); this.waitingToSend.add( is );
@@ -489,7 +489,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
{ {
if( this.craftingList == null ) if( this.craftingList == null )
{ {
this.craftingList = new LinkedList<ICraftingPatternDetails>(); this.craftingList = new LinkedList<>();
} }
this.craftingList.add( details ); this.craftingList.add( details );
@@ -146,7 +146,7 @@ public class MultiCraftingTracker
return ImmutableSet.of(); return ImmutableSet.of();
} }
return ImmutableSet.copyOf( new NonNullArrayIterator<ICraftingLink>( this.links ) ); return ImmutableSet.copyOf( new NonNullArrayIterator<>( this.links ) );
} }
public void jobStateChange( final ICraftingLink link ) public void jobStateChange( final ICraftingLink link )
@@ -58,8 +58,8 @@ public class PatternHelper implements ICraftingPatternDetails, Comparable<Patter
private final IAEItemStack[] outputs; private final IAEItemStack[] outputs;
private final boolean isCrafting; private final boolean isCrafting;
private final boolean canSubstitute; private final boolean canSubstitute;
private final Set<TestLookup> failCache = new HashSet<TestLookup>(); private final Set<TestLookup> failCache = new HashSet<>();
private final Set<TestLookup> passCache = new HashSet<TestLookup>(); private final Set<TestLookup> passCache = new HashSet<>();
private final IAEItemStack pattern; private final IAEItemStack pattern;
private int priority = 0; private int priority = 0;
@@ -80,8 +80,8 @@ public class PatternHelper implements ICraftingPatternDetails, Comparable<Patter
this.patternItem = is; this.patternItem = is;
this.pattern = AEItemStack.create( is ); this.pattern = AEItemStack.create( is );
final List<IAEItemStack> in = new ArrayList<IAEItemStack>(); final List<IAEItemStack> in = new ArrayList<>();
final List<IAEItemStack> out = new ArrayList<IAEItemStack>(); final List<IAEItemStack> out = new ArrayList<>();
for( int x = 0; x < inTag.tagCount(); x++ ) for( int x = 0; x < inTag.tagCount(); x++ )
{ {
@@ -131,7 +131,7 @@ public class PatternHelper implements ICraftingPatternDetails, Comparable<Patter
this.outputs = out.toArray( new IAEItemStack[out.size()] ); this.outputs = out.toArray( new IAEItemStack[out.size()] );
this.inputs = in.toArray( new IAEItemStack[in.size()] ); this.inputs = in.toArray( new IAEItemStack[in.size()] );
final Map<IAEItemStack, IAEItemStack> tmpOutputs = new HashMap<IAEItemStack, IAEItemStack>(); final Map<IAEItemStack, IAEItemStack> tmpOutputs = new HashMap<>();
for( final IAEItemStack io : this.outputs ) for( final IAEItemStack io : this.outputs )
{ {
@@ -152,7 +152,7 @@ public class PatternHelper implements ICraftingPatternDetails, Comparable<Patter
} }
} }
final Map<IAEItemStack, IAEItemStack> tmpInputs = new HashMap<IAEItemStack, IAEItemStack>(); final Map<IAEItemStack, IAEItemStack> tmpInputs = new HashMap<>();
for( final IAEItemStack io : this.inputs ) for( final IAEItemStack io : this.inputs )
{ {
@@ -30,7 +30,7 @@ public class CompassManager
{ {
public static final CompassManager INSTANCE = new CompassManager(); public static final CompassManager INSTANCE = new CompassManager();
private final HashMap<CompassRequest, CompassResult> requests = new HashMap<CompassRequest, CompassResult>(); private final HashMap<CompassRequest, CompassResult> requests = new HashMap<>();
public void postResult( final long attunement, final int x, final int y, final int z, final CompassResult result ) public void postResult( final long attunement, final int x, final int y, final int z, final CompassResult result )
{ {
+8 -8
View File
@@ -60,13 +60,13 @@ public class TickHandler
{ {
public static final TickHandler INSTANCE = new TickHandler(); public static final TickHandler INSTANCE = new TickHandler();
private final Queue<IWorldCallable<?>> serverQueue = new LinkedList<IWorldCallable<?>>(); private final Queue<IWorldCallable<?>> serverQueue = new LinkedList<>();
private final Multimap<World, CraftingJob> craftingJobs = LinkedListMultimap.create(); private final Multimap<World, CraftingJob> craftingJobs = LinkedListMultimap.create();
private final WeakHashMap<World, Queue<IWorldCallable<?>>> callQueue = new WeakHashMap<World, Queue<IWorldCallable<?>>>(); private final WeakHashMap<World, Queue<IWorldCallable<?>>> callQueue = new WeakHashMap<>();
private final HandlerRep server = new HandlerRep(); private final HandlerRep server = new HandlerRep();
private final HandlerRep client = new HandlerRep(); private final HandlerRep client = new HandlerRep();
private final HashMap<Integer, PlayerColor> cliPlayerColors = new HashMap<Integer, PlayerColor>(); private final HashMap<Integer, PlayerColor> cliPlayerColors = new HashMap<>();
private final HashMap<Integer, PlayerColor> srvPlayerColors = new HashMap<Integer, PlayerColor>(); private final HashMap<Integer, PlayerColor> srvPlayerColors = new HashMap<>();
private CableRenderMode crm = CableRenderMode.STANDARD; private CableRenderMode crm = CableRenderMode.STANDARD;
public HashMap<Integer, PlayerColor> getPlayerColors() public HashMap<Integer, PlayerColor> getPlayerColors()
@@ -90,7 +90,7 @@ public class TickHandler
if( queue == null ) if( queue == null )
{ {
queue = new LinkedList<IWorldCallable<?>>(); queue = new LinkedList<>();
this.callQueue.put( w, queue ); this.callQueue.put( w, queue );
} }
@@ -146,7 +146,7 @@ public class TickHandler
{ {
if( Platform.isServer() ) // for no there is no reason to care about this on the client... if( Platform.isServer() ) // for no there is no reason to care about this on the client...
{ {
final LinkedList<IGridNode> toDestroy = new LinkedList<IGridNode>(); final LinkedList<IGridNode> toDestroy = new LinkedList<>();
for( final Grid g : this.getRepo().networks ) for( final Grid g : this.getRepo().networks )
{ {
@@ -306,13 +306,13 @@ public class TickHandler
private static class HandlerRep private static class HandlerRep
{ {
private Queue<AEBaseTile> tiles = new LinkedList<AEBaseTile>(); private Queue<AEBaseTile> tiles = new LinkedList<>();
private Collection<Grid> networks = new NetworkList(); private Collection<Grid> networks = new NetworkList();
private void clear() private void clear()
{ {
this.tiles = new LinkedList<AEBaseTile>(); this.tiles = new LinkedList<>();
this.networks = new NetworkList(); this.networks = new NetworkList();
} }
} }
@@ -30,7 +30,7 @@ public enum IntegrationRegistry
{ {
INSTANCE; INSTANCE;
private final Collection<IntegrationNode> modules = new LinkedList<IntegrationNode>(); private final Collection<IntegrationNode> modules = new LinkedList<>();
public void add( final IntegrationType type ) public void add( final IntegrationType type )
{ {
@@ -92,7 +92,7 @@ class RecipeTransferHandler<T extends Container> implements IRecipeTransferHandl
if( slot.getSlotIndex() == slotIndex ) if( slot.getSlotIndex() == slotIndex )
{ {
final NBTTagList tags = new NBTTagList(); final NBTTagList tags = new NBTTagList();
final List<ItemStack> list = new LinkedList<ItemStack>(); final List<ItemStack> list = new LinkedList<>();
// prefer pure crystals. // prefer pure crystals.
for( ItemStack stack : ingredient.getAllIngredients() ) for( ItemStack stack : ingredient.getAllIngredients() )
@@ -60,7 +60,7 @@ public final class ChannelWailaDataProvider extends BasePartWailaDataProvider
* <p/> * <p/>
* The cache will be updated from the server. * The cache will be updated from the server.
*/ */
private final TObjectByteMap<IPart> cache = new TObjectByteHashMap<IPart>(); private final TObjectByteMap<IPart> cache = new TObjectByteHashMap<>();
/** /**
* Adds the used and max channel to the tool tip * Adds the used and max channel to the tool tip
@@ -62,7 +62,7 @@ public final class PowerStorageWailaDataProvider extends BaseWailaDataProvider
* <p/> * <p/>
* The cache will be updated from the server. * The cache will be updated from the server.
*/ */
private final TObjectLongMap<TileEntity> cache = new TObjectLongHashMap<TileEntity>(); private final TObjectLongMap<TileEntity> cache = new TObjectLongHashMap<>();
/** /**
* Adds the current and max power to the tool tip * Adds the current and max power to the tool tip
@@ -105,7 +105,7 @@ public final class ItemMaterial extends AEBaseItem implements IStorageComponent,
final Upgrades u = this.getType( stack ); final Upgrades u = this.getType( stack );
if( u != null ) if( u != null )
{ {
final List<String> textList = new LinkedList<String>(); final List<String> textList = new LinkedList<>();
for( final Entry<ItemStack, Integer> j : u.getSupported().entrySet() ) for( final Entry<ItemStack, Integer> j : u.getSupported().entrySet() )
{ {
String name = null; String name = null;
@@ -51,7 +51,7 @@ import appeng.util.Platform;
public class ItemEncodedPattern extends AEBaseItem implements ICraftingPatternItem public class ItemEncodedPattern extends AEBaseItem implements ICraftingPatternItem
{ {
// rather simple client side caching. // rather simple client side caching.
private static final Map<ItemStack, ItemStack> SIMPLE_CACHE = new WeakHashMap<ItemStack, ItemStack>(); private static final Map<ItemStack, ItemStack> SIMPLE_CACHE = new WeakHashMap<>();
public ItemEncodedPattern() public ItemEncodedPattern()
{ {
@@ -63,7 +63,7 @@ public class ItemEncodedPattern extends AEBaseItem implements ICraftingPatternIt
{ {
this.clearPattern( player.getHeldItem( hand ), player ); this.clearPattern( player.getHeldItem( hand ), player );
return new ActionResult<ItemStack>( EnumActionResult.SUCCESS, player.getHeldItem( hand ) ); return new ActionResult<>( EnumActionResult.SUCCESS, player.getHeldItem( hand ) );
} }
@Override @Override
@@ -105,7 +105,7 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
{ {
if( this.subTypes == null ) if( this.subTypes == null )
{ {
this.subTypes = new ArrayList<ItemStack>( 1000 ); this.subTypes = new ArrayList<>( 1000 );
for( final Object blk : Block.REGISTRY ) for( final Object blk : Block.REGISTRY )
{ {
final Block b = (Block) blk; final Block b = (Block) blk;
@@ -197,7 +197,7 @@ public final class ItemPart extends AEBaseItem implements IPartItem, IItemGroup
@Override @Override
protected void getCheckedSubItems( final CreativeTabs creativeTab, final NonNullList<ItemStack> itemStacks ) protected void getCheckedSubItems( final CreativeTabs creativeTab, final NonNullList<ItemStack> itemStacks )
{ {
final List<Entry<Integer, PartTypeWithVariant>> types = new ArrayList<Entry<Integer, PartTypeWithVariant>>( this.registered.entrySet() ); final List<Entry<Integer, PartTypeWithVariant>> types = new ArrayList<>( this.registered.entrySet() );
Collections.sort( types, REGISTERED_COMPARATOR ); Collections.sort( types, REGISTERED_COMPARATOR );
for( final Entry<Integer, PartTypeWithVariant> part : types ) for( final Entry<Integer, PartTypeWithVariant> part : types )
@@ -223,7 +223,7 @@ public final class ItemBasicStorageCell extends AEBaseItem implements IStorageCe
public ActionResult<ItemStack> onItemRightClick( final World world, final EntityPlayer player, final EnumHand hand ) public ActionResult<ItemStack> onItemRightClick( final World world, final EntityPlayer player, final EnumHand hand )
{ {
this.disassembleDrive( player.getHeldItem( hand ), world, player ); this.disassembleDrive( player.getHeldItem( hand ), world, player );
return new ActionResult<ItemStack>( EnumActionResult.SUCCESS, player.getHeldItem( hand ) ); return new ActionResult<>( EnumActionResult.SUCCESS, player.getHeldItem( hand ) );
} }
private boolean disassembleDrive( final ItemStack stack, final World world, final EntityPlayer player ) private boolean disassembleDrive( final ItemStack stack, final World world, final EntityPlayer player )
@@ -51,7 +51,7 @@ public class ItemViewCell extends AEBaseItem implements ICellWorkbenchItem
{ {
IPartitionList<IAEItemStack> myPartitionList = null; IPartitionList<IAEItemStack> myPartitionList = null;
final MergedPriorityList<IAEItemStack> myMergedList = new MergedPriorityList<IAEItemStack>(); final MergedPriorityList<IAEItemStack> myMergedList = new MergedPriorityList<>();
for( final ItemStack currentViewCell : list ) for( final ItemStack currentViewCell : list )
{ {
@@ -107,11 +107,11 @@ public class ItemViewCell extends AEBaseItem implements ICellWorkbenchItem
{ {
if( hasFuzzy ) if( hasFuzzy )
{ {
myMergedList.addNewList( new FuzzyPriorityList<IAEItemStack>( priorityList, fzMode ), !hasInverter ); myMergedList.addNewList( new FuzzyPriorityList<>( priorityList, fzMode ), !hasInverter );
} }
else else
{ {
myMergedList.addNewList( new PrecisePriorityList<IAEItemStack>( priorityList ), !hasInverter ); myMergedList.addNewList( new PrecisePriorityList<>( priorityList ), !hasInverter );
} }
myPartitionList = myMergedList; myPartitionList = myMergedList;
@@ -60,10 +60,10 @@ public class ToolBiometricCard extends AEBaseItem implements IBiometricCard
{ {
this.encode( p.getHeldItem( hand ), p ); this.encode( p.getHeldItem( hand ), p );
p.swingArm( hand ); p.swingArm( hand );
return new ActionResult<ItemStack>( EnumActionResult.SUCCESS, p.getHeldItem( hand ) ); return new ActionResult<>( EnumActionResult.SUCCESS, p.getHeldItem( hand ) );
} }
return new ActionResult<ItemStack>( EnumActionResult.PASS, p.getHeldItem( hand ) ); return new ActionResult<>( EnumActionResult.PASS, p.getHeldItem( hand ) );
} }
@Override @Override
@@ -90,7 +90,7 @@ public class ToolNetworkTool extends AEBaseItem implements IGuiItem, IAEWrench /
} }
} }
return new ActionResult<ItemStack>( EnumActionResult.SUCCESS, p.getHeldItem( hand ) ); return new ActionResult<>( EnumActionResult.SUCCESS, p.getHeldItem( hand ) );
} }
@Override @Override
@@ -87,7 +87,7 @@ import appeng.util.item.AEItemStack;
public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCell, IItemGroup, IBlockTool, IMouseWheelItem public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCell, IItemGroup, IBlockTool, IMouseWheelItem
{ {
private static final Map<Integer, AEColor> ORE_TO_COLOR = new HashMap<Integer, AEColor>(); private static final Map<Integer, AEColor> ORE_TO_COLOR = new HashMap<>();
static static
{ {
@@ -279,7 +279,7 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
} }
else else
{ {
final LinkedList<IAEItemStack> list = new LinkedList<IAEItemStack>(); final LinkedList<IAEItemStack> list = new LinkedList<>();
for( final IAEItemStack i : itemList ) for( final IAEItemStack i : itemList )
{ {
@@ -63,8 +63,8 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
{ {
super( AEConfig.instance().getEntropyManipulatorBattery() ); super( AEConfig.instance().getEntropyManipulatorBattery() );
this.heatUp = new HashMap<InWorldToolOperationIngredient, InWorldToolOperationResult>(); this.heatUp = new HashMap<>();
this.coolDown = new HashMap<InWorldToolOperationIngredient, InWorldToolOperationResult>(); this.coolDown = new HashMap<>();
this.coolDown.put( new InWorldToolOperationIngredient( Blocks.STONE.getDefaultState() ), this.coolDown.put( new InWorldToolOperationIngredient( Blocks.STONE.getDefaultState() ),
new InWorldToolOperationResult( new ItemStack( Blocks.COBBLESTONE ) ) ); new InWorldToolOperationResult( new ItemStack( Blocks.COBBLESTONE ) ) );
@@ -75,7 +75,7 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
new InWorldToolOperationResult( new ItemStack( Blocks.OBSIDIAN ) ) ); new InWorldToolOperationResult( new ItemStack( Blocks.OBSIDIAN ) ) );
this.coolDown.put( new InWorldToolOperationIngredient( Blocks.GRASS, true ), new InWorldToolOperationResult( new ItemStack( Blocks.DIRT ) ) ); this.coolDown.put( new InWorldToolOperationIngredient( Blocks.GRASS, true ), new InWorldToolOperationResult( new ItemStack( Blocks.DIRT ) ) );
final List<ItemStack> snowBalls = new ArrayList<ItemStack>(); final List<ItemStack> snowBalls = new ArrayList<>();
snowBalls.add( new ItemStack( Items.SNOWBALL ) ); snowBalls.add( new ItemStack( Items.SNOWBALL ) );
this.coolDown.put( new InWorldToolOperationIngredient( Blocks.FLOWING_WATER, true ), new InWorldToolOperationResult( ItemStack.EMPTY, snowBalls ) ); this.coolDown.put( new InWorldToolOperationIngredient( Blocks.FLOWING_WATER, true ), new InWorldToolOperationResult( ItemStack.EMPTY, snowBalls ) );
this.coolDown.put( new InWorldToolOperationIngredient( Blocks.WATER, true ), new InWorldToolOperationResult( new ItemStack( Blocks.ICE ) ) ); this.coolDown.put( new InWorldToolOperationIngredient( Blocks.WATER, true ), new InWorldToolOperationResult( new ItemStack( Blocks.ICE ) ) );
@@ -218,7 +218,7 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
if( target == null ) if( target == null )
{ {
return new ActionResult<ItemStack>( EnumActionResult.FAIL, p.getHeldItem( hand ) ); return new ActionResult<>( EnumActionResult.FAIL, p.getHeldItem( hand ) );
} }
else else
{ {
@@ -235,7 +235,7 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
} }
} }
return new ActionResult<ItemStack>( EnumActionResult.SUCCESS, p.getHeldItem( hand ) ); return new ActionResult<>( EnumActionResult.SUCCESS, p.getHeldItem( hand ) );
} }
@Override @Override
@@ -290,7 +290,7 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
} }
final ItemStack[] stack = Platform.getBlockDrops( w, pos ); final ItemStack[] stack = Platform.getBlockDrops( w, pos );
final List<ItemStack> out = new ArrayList<ItemStack>(); final List<ItemStack> out = new ArrayList<>();
boolean hasFurnaceable = false; boolean hasFurnaceable = false;
boolean canFurnaceable = true; boolean canFurnaceable = true;
@@ -136,21 +136,21 @@ public class ToolMatterCannon extends AEBasePoweredItem implements IStorageCell
if( Platform.isClient() ) if( Platform.isClient() )
{ {
return new ActionResult<ItemStack>( EnumActionResult.SUCCESS, p.getHeldItem( hand ) ); return new ActionResult<>( EnumActionResult.SUCCESS, p.getHeldItem( hand ) );
} }
aeAmmo.setStackSize( 1 ); aeAmmo.setStackSize( 1 );
final ItemStack ammo = ( (IAEItemStack) aeAmmo ).getItemStack(); final ItemStack ammo = ( (IAEItemStack) aeAmmo ).getItemStack();
if( ammo == null ) if( ammo == null )
{ {
return new ActionResult<ItemStack>( EnumActionResult.SUCCESS, p.getHeldItem( hand ) ); return new ActionResult<>( EnumActionResult.SUCCESS, p.getHeldItem( hand ) );
} }
ammo.setCount( 1 ); ammo.setCount( 1 );
aeAmmo = inv.extractItems( aeAmmo, Actionable.MODULATE, new PlayerSource( p, null ) ); aeAmmo = inv.extractItems( aeAmmo, Actionable.MODULATE, new PlayerSource( p, null ) );
if( aeAmmo == null ) if( aeAmmo == null )
{ {
return new ActionResult<ItemStack>( EnumActionResult.SUCCESS, p.getHeldItem( hand ) ); return new ActionResult<>( EnumActionResult.SUCCESS, p.getHeldItem( hand ) );
} }
final LookDirection dir = Platform.getPlayerRay( p, p.getEyeHeight() ); final LookDirection dir = Platform.getPlayerRay( p, p.getEyeHeight() );
@@ -172,7 +172,7 @@ public class ToolMatterCannon extends AEBasePoweredItem implements IStorageCell
{ {
this.shootPaintBalls( type, w, p, Vec3d, Vec3d1, direction, d0, d1, d2 ); this.shootPaintBalls( type, w, p, Vec3d, Vec3d1, direction, d0, d1, d2 );
} }
return new ActionResult<ItemStack>( EnumActionResult.SUCCESS, p.getHeldItem( hand ) ); return new ActionResult<>( EnumActionResult.SUCCESS, p.getHeldItem( hand ) );
} }
else else
{ {
@@ -186,11 +186,11 @@ public class ToolMatterCannon extends AEBasePoweredItem implements IStorageCell
{ {
p.sendMessage( PlayerMessages.AmmoDepleted.get() ); p.sendMessage( PlayerMessages.AmmoDepleted.get() );
} }
return new ActionResult<ItemStack>( EnumActionResult.SUCCESS, p.getHeldItem( hand ) ); return new ActionResult<>( EnumActionResult.SUCCESS, p.getHeldItem( hand ) );
} }
} }
} }
return new ActionResult<ItemStack>( EnumActionResult.FAIL, p.getHeldItem( hand ) ); return new ActionResult<>( EnumActionResult.FAIL, p.getHeldItem( hand ) );
} }
private void shootPaintBalls( final ItemStack type, final World w, final EntityPlayer p, final Vec3d Vec3d, final Vec3d Vec3d1, final Vec3d direction, final double d0, final double d1, final double d2 ) private void shootPaintBalls( final ItemStack type, final World w, final EntityPlayer p, final Vec3d Vec3d, final Vec3d Vec3d1, final Vec3d direction, final double d0, final double d1, final double d2 )
@@ -68,7 +68,7 @@ public class ToolPortableCell extends AEBasePoweredItem implements IStorageCell,
public ActionResult<ItemStack> onItemRightClick( final World w, final EntityPlayer player, final EnumHand hand ) public ActionResult<ItemStack> onItemRightClick( final World w, final EntityPlayer player, final EnumHand hand )
{ {
Platform.openGUI( player, null, AEPartLocation.INTERNAL, GuiBridge.GUI_PORTABLE_CELL ); Platform.openGUI( player, null, AEPartLocation.INTERNAL, GuiBridge.GUI_PORTABLE_CELL );
return new ActionResult<ItemStack>( EnumActionResult.SUCCESS, player.getHeldItem( hand ) ); return new ActionResult<>( EnumActionResult.SUCCESS, player.getHeldItem( hand ) );
} }
@SideOnly( Side.CLIENT ) @SideOnly( Side.CLIENT )
@@ -60,7 +60,7 @@ public class ToolWirelessTerminal extends AEBasePoweredItem implements IWireless
public ActionResult<ItemStack> onItemRightClick( final World w, final EntityPlayer player, final EnumHand hand ) public ActionResult<ItemStack> onItemRightClick( final World w, final EntityPlayer player, final EnumHand hand )
{ {
AEApi.instance().registries().wireless().openWirelessTerminalGui( player.getHeldItem( hand ), w, player ); AEApi.instance().registries().wireless().openWirelessTerminalGui( player.getHeldItem( hand ), w, player );
return new ActionResult<ItemStack>( EnumActionResult.SUCCESS, player.getHeldItem( hand ) ); return new ActionResult<>( EnumActionResult.SUCCESS, player.getHeldItem( hand ) );
} }
@SideOnly( Side.CLIENT ) @SideOnly( Side.CLIENT )
@@ -67,7 +67,7 @@ public class ToolQuartzCuttingKnife extends AEBaseItem implements IGuiItem
Platform.openGUI( p, null, AEPartLocation.INTERNAL, GuiBridge.GUI_QUARTZ_KNIFE ); Platform.openGUI( p, null, AEPartLocation.INTERNAL, GuiBridge.GUI_QUARTZ_KNIFE );
} }
p.swingArm( hand ); p.swingArm( hand );
return new ActionResult<ItemStack>( EnumActionResult.SUCCESS, p.getHeldItem( hand ) ); return new ActionResult<>( EnumActionResult.SUCCESS, p.getHeldItem( hand ) );
} }
@Override @Override
+3 -3
View File
@@ -44,8 +44,8 @@ import appeng.util.ReadOnlyCollection;
public class Grid implements IGrid public class Grid implements IGrid
{ {
private final NetworkEventBus eventBus = new NetworkEventBus(); private final NetworkEventBus eventBus = new NetworkEventBus();
private final Map<Class<? extends IGridHost>, MachineSet> machines = new HashMap<Class<? extends IGridHost>, MachineSet>(); private final Map<Class<? extends IGridHost>, MachineSet> machines = new HashMap<>();
private final Map<Class<? extends IGridCache>, GridCacheWrapper> caches = new HashMap<Class<? extends IGridCache>, GridCacheWrapper>(); private final Map<Class<? extends IGridCache>, GridCacheWrapper> caches = new HashMap<>();
private GridNode pivot; private GridNode pivot;
private int priority; // how import is this network? private int priority; // how import is this network?
private GridStorage myStorage; private GridStorage myStorage;
@@ -233,7 +233,7 @@ public class Grid implements IGrid
{ {
final Set<Class<? extends IGridHost>> machineKeys = this.machines.keySet(); final Set<Class<? extends IGridHost>> machineKeys = this.machines.keySet();
return new ReadOnlyCollection<Class<? extends IGridHost>>( machineKeys ); return new ReadOnlyCollection<>( machineKeys );
} }
@Override @Override
+1 -1
View File
@@ -242,7 +242,7 @@ public class GridConnection implements IGridConnection, IPathItem
@Override @Override
public IReadOnlyCollection<IPathItem> getPossibleOptions() public IReadOnlyCollection<IPathItem> getPossibleOptions()
{ {
return new ReadOnlyCollection<IPathItem>( Arrays.asList( (IPathItem) this.a(), (IPathItem) this.b() ) ); return new ReadOnlyCollection<>( Arrays.asList( (IPathItem) this.a(), (IPathItem) this.b() ) );
} }
@Override @Override
+6 -6
View File
@@ -62,7 +62,7 @@ public class GridNode implements IGridNode, IPathItem
private static final MENetworkChannelsChanged EVENT = new MENetworkChannelsChanged(); private static final MENetworkChannelsChanged EVENT = new MENetworkChannelsChanged();
private static final int[] CHANNEL_COUNT = { 0, 8, 32 }; private static final int[] CHANNEL_COUNT = { 0, 8, 32 };
private final List<IGridConnection> connections = new LinkedList<IGridConnection>(); private final List<IGridConnection> connections = new LinkedList<>();
private final IGridBlock gridProxy; private final IGridBlock gridProxy;
// old power draw, used to diff // old power draw, used to diff
private double previousDraw = 0.0; private double previousDraw = 0.0;
@@ -161,14 +161,14 @@ public class GridNode implements IGridNode, IPathItem
{ {
final Object tracker = new Object(); final Object tracker = new Object();
LinkedList<GridNode> nextRun = new LinkedList<GridNode>(); LinkedList<GridNode> nextRun = new LinkedList<>();
nextRun.add( this ); nextRun.add( this );
this.visitorIterationNumber = tracker; this.visitorIterationNumber = tracker;
if( g instanceof IGridConnectionVisitor ) if( g instanceof IGridConnectionVisitor )
{ {
final LinkedList<IGridConnection> nextConn = new LinkedList<IGridConnection>(); final LinkedList<IGridConnection> nextConn = new LinkedList<>();
final IGridConnectionVisitor gcv = (IGridConnectionVisitor) g; final IGridConnectionVisitor gcv = (IGridConnectionVisitor) g;
while( !nextRun.isEmpty() ) while( !nextRun.isEmpty() )
@@ -179,7 +179,7 @@ public class GridNode implements IGridNode, IPathItem
} }
final Iterable<GridNode> thisRun = nextRun; final Iterable<GridNode> thisRun = nextRun;
nextRun = new LinkedList<GridNode>(); nextRun = new LinkedList<>();
for( final GridNode n : thisRun ) for( final GridNode n : thisRun )
{ {
@@ -192,7 +192,7 @@ public class GridNode implements IGridNode, IPathItem
while( !nextRun.isEmpty() ) while( !nextRun.isEmpty() )
{ {
final Iterable<GridNode> thisRun = nextRun; final Iterable<GridNode> thisRun = nextRun;
nextRun = new LinkedList<GridNode>(); nextRun = new LinkedList<>();
for( final GridNode n : thisRun ) for( final GridNode n : thisRun )
{ {
@@ -301,7 +301,7 @@ public class GridNode implements IGridNode, IPathItem
@Override @Override
public IReadOnlyCollection<IGridConnection> getConnections() public IReadOnlyCollection<IGridConnection> getConnections()
{ {
return new ReadOnlyCollection<IGridConnection>( this.connections ); return new ReadOnlyCollection<>( this.connections );
} }
@Override @Override
+2 -2
View File
@@ -40,7 +40,7 @@ public class GridStorage implements IGridStorage
private final long myID; private final long myID;
private final NBTTagCompound data; private final NBTTagCompound data;
private final GridStorageSearch mySearchEntry; // keep myself in the list until I'm private final GridStorageSearch mySearchEntry; // keep myself in the list until I'm
private final WeakHashMap<GridStorage, Boolean> divided = new WeakHashMap<GridStorage, Boolean>(); private final WeakHashMap<GridStorage, Boolean> divided = new WeakHashMap<>();
private WeakReference<IGrid> internalGrid = null; private WeakReference<IGrid> internalGrid = null;
// lost... // lost...
@@ -123,7 +123,7 @@ public class GridStorage implements IGridStorage
void setGrid( final Grid grid ) void setGrid( final Grid grid )
{ {
this.internalGrid = new WeakReference<IGrid>( grid ); this.internalGrid = new WeakReference<>( grid );
} }
@Override @Override
+4 -4
View File
@@ -36,8 +36,8 @@ import appeng.core.AELog;
public class NetworkEventBus public class NetworkEventBus
{ {
private static final Collection<Class> READ_CLASSES = new HashSet<Class>(); private static final Collection<Class> READ_CLASSES = new HashSet<>();
private static final Map<Class<? extends MENetworkEvent>, Map<Class, MENetworkEventInfo>> EVENTS = new HashMap<Class<? extends MENetworkEvent>, Map<Class, MENetworkEventInfo>>(); private static final Map<Class<? extends MENetworkEvent>, Map<Class, MENetworkEventInfo>> EVENTS = new HashMap<>();
void readClass( final Class listAs, final Class c ) void readClass( final Class listAs, final Class c )
{ {
@@ -63,7 +63,7 @@ public class NetworkEventBus
Map<Class, MENetworkEventInfo> classEvents = EVENTS.get( types[0] ); Map<Class, MENetworkEventInfo> classEvents = EVENTS.get( types[0] );
if( classEvents == null ) if( classEvents == null )
{ {
EVENTS.put( types[0], classEvents = new HashMap<Class, MENetworkEventInfo>() ); EVENTS.put( types[0], classEvents = new HashMap<>() );
} }
MENetworkEventInfo thisEvent = classEvents.get( listAs ); MENetworkEventInfo thisEvent = classEvents.get( listAs );
@@ -201,7 +201,7 @@ public class NetworkEventBus
private class MENetworkEventInfo private class MENetworkEventInfo
{ {
private final List<EventMethod> methods = new ArrayList<EventMethod>(); private final List<EventMethod> methods = new ArrayList<>();
private void Add( final Class Event, final Class ObjClass, final Method ObjMethod ) private void Add( final Class Event, final Class ObjClass, final Method ObjMethod )
{ {
+2 -2
View File
@@ -31,7 +31,7 @@ import java.util.List;
public class NetworkList implements Collection<Grid> public class NetworkList implements Collection<Grid>
{ {
private List<Grid> networks = new LinkedList<Grid>(); private List<Grid> networks = new LinkedList<>();
@Override @Override
public int size() public int size()
@@ -108,6 +108,6 @@ public class NetworkList implements Collection<Grid>
@Override @Override
public void clear() public void clear()
{ {
this.networks = new LinkedList<Grid>(); this.networks = new LinkedList<>();
} }
} }
+13 -13
View File
@@ -114,16 +114,16 @@ public class CraftingGridCache implements ICraftingGrid, ICraftingProviderHelper
CRAFTING_POOL = Executors.newCachedThreadPool( factory ); CRAFTING_POOL = Executors.newCachedThreadPool( factory );
} }
private final Set<CraftingCPUCluster> craftingCPUClusters = new HashSet<CraftingCPUCluster>(); private final Set<CraftingCPUCluster> craftingCPUClusters = new HashSet<>();
private final Set<ICraftingProvider> craftingProviders = new HashSet<ICraftingProvider>(); private final Set<ICraftingProvider> craftingProviders = new HashSet<>();
private final Map<IGridNode, ICraftingWatcher> craftingWatchers = new HashMap<IGridNode, ICraftingWatcher>(); private final Map<IGridNode, ICraftingWatcher> craftingWatchers = new HashMap<>();
private final IGrid grid; private final IGrid grid;
private final Map<ICraftingPatternDetails, List<ICraftingMedium>> craftingMethods = new HashMap<ICraftingPatternDetails, List<ICraftingMedium>>(); private final Map<ICraftingPatternDetails, List<ICraftingMedium>> craftingMethods = new HashMap<>();
private final Map<IAEItemStack, ImmutableList<ICraftingPatternDetails>> craftableItems = new HashMap<IAEItemStack, ImmutableList<ICraftingPatternDetails>>(); private final Map<IAEItemStack, ImmutableList<ICraftingPatternDetails>> craftableItems = new HashMap<>();
private final Set<IAEItemStack> emitableItems = new HashSet<IAEItemStack>(); private final Set<IAEItemStack> emitableItems = new HashSet<>();
private final Map<String, CraftingLinkNexus> craftingLinks = new HashMap<String, CraftingLinkNexus>(); private final Map<String, CraftingLinkNexus> craftingLinks = new HashMap<>();
private final Multimap<IAEStack, CraftingWatcher> interests = HashMultimap.create(); private final Multimap<IAEStack, CraftingWatcher> interests = HashMultimap.create();
private final GenericInterestManager<CraftingWatcher> interestManager = new GenericInterestManager<CraftingWatcher>( this.interests ); private final GenericInterestManager<CraftingWatcher> interestManager = new GenericInterestManager<>( this.interests );
private IStorageGrid storageGrid; private IStorageGrid storageGrid;
private IEnergyGrid energyGrid; private IEnergyGrid energyGrid;
private boolean updateList = false; private boolean updateList = false;
@@ -271,7 +271,7 @@ public class CraftingGridCache implements ICraftingGrid, ICraftingProviderHelper
provider.provideCrafting( this ); provider.provideCrafting( this );
} }
final Map<IAEItemStack, Set<ICraftingPatternDetails>> tmpCraft = new HashMap<IAEItemStack, Set<ICraftingPatternDetails>>(); final Map<IAEItemStack, Set<ICraftingPatternDetails>> tmpCraft = new HashMap<>();
// new craftables! // new craftables!
for( final ICraftingPatternDetails details : this.craftingMethods.keySet() ) for( final ICraftingPatternDetails details : this.craftingMethods.keySet() )
@@ -286,7 +286,7 @@ public class CraftingGridCache implements ICraftingGrid, ICraftingProviderHelper
if( methods == null ) if( methods == null )
{ {
tmpCraft.put( out, methods = new TreeSet<ICraftingPatternDetails>( COMPARATOR ) ); tmpCraft.put( out, methods = new TreeSet<>( COMPARATOR ) );
} }
methods.add( details ); methods.add( details );
@@ -357,7 +357,7 @@ public class CraftingGridCache implements ICraftingGrid, ICraftingProviderHelper
List<ICraftingMedium> details = this.craftingMethods.get( api ); List<ICraftingMedium> details = this.craftingMethods.get( api );
if( details == null ) if( details == null )
{ {
details = new ArrayList<ICraftingMedium>(); details = new ArrayList<>();
details.add( medium ); details.add( medium );
this.craftingMethods.put( api, details ); this.craftingMethods.put( api, details );
} }
@@ -376,7 +376,7 @@ public class CraftingGridCache implements ICraftingGrid, ICraftingProviderHelper
@Override @Override
public List<IMEInventoryHandler> getCellArray( final StorageChannel channel ) public List<IMEInventoryHandler> getCellArray( final StorageChannel channel )
{ {
final List<IMEInventoryHandler> list = new ArrayList<IMEInventoryHandler>( 1 ); final List<IMEInventoryHandler> list = new ArrayList<>( 1 );
if( channel == StorageChannel.ITEMS ) if( channel == StorageChannel.ITEMS )
{ {
@@ -527,7 +527,7 @@ public class CraftingGridCache implements ICraftingGrid, ICraftingProviderHelper
if( target == null ) if( target == null )
{ {
final List<CraftingCPUCluster> validCpusClusters = new ArrayList<CraftingCPUCluster>(); final List<CraftingCPUCluster> validCpusClusters = new ArrayList<>();
for( final CraftingCPUCluster cpu : this.craftingCPUClusters ) for( final CraftingCPUCluster cpu : this.craftingCPUClusters )
{ {
if( cpu.isActive() && !cpu.isBusy() && cpu.getAvailableStorage() >= job.getByteTotal() ) if( cpu.isActive() && !cpu.isBusy() && cpu.getAvailableStorage() >= job.getByteTotal() )
+5 -5
View File
@@ -61,12 +61,12 @@ public class EnergyGridCache implements IEnergyGrid
private final NavigableSet<EnergyThreshold> interests = Sets.newTreeSet(); private final NavigableSet<EnergyThreshold> interests = Sets.newTreeSet();
private final double averageLength = 40.0; private final double averageLength = 40.0;
private final Set<IAEPowerStorage> providers = new LinkedHashSet<IAEPowerStorage>(); private final Set<IAEPowerStorage> providers = new LinkedHashSet<>();
private final Set<IAEPowerStorage> requesters = new LinkedHashSet<IAEPowerStorage>(); private final Set<IAEPowerStorage> requesters = new LinkedHashSet<>();
private final Multiset<IEnergyGridProvider> energyGridProviders = HashMultiset.create(); private final Multiset<IEnergyGridProvider> energyGridProviders = HashMultiset.create();
private final IGrid myGrid; private final IGrid myGrid;
private final HashMap<IGridNode, IEnergyWatcher> watchers = new HashMap<IGridNode, IEnergyWatcher>(); private final HashMap<IGridNode, IEnergyWatcher> watchers = new HashMap<>();
private final Set<IEnergyGrid> localSeen = new HashSet<IEnergyGrid>(); private final Set<IEnergyGrid> localSeen = new HashSet<>();
/** /**
* estimated power available. * estimated power available.
*/ */
@@ -354,7 +354,7 @@ public class EnergyGridCache implements IEnergyGrid
while( amt > 0 && i.hasNext() ) while( amt > 0 && i.hasNext() )
{ {
final IEnergyGridProvider what = i.next(); final IEnergyGridProvider what = i.next();
final Set<IEnergyGrid> listCopy = new HashSet<IEnergyGrid>(); final Set<IEnergyGrid> listCopy = new HashSet<>();
listCopy.addAll( seen ); listCopy.addAll( seen );
final double cannotHold = what.injectAEPower( amt, Actionable.SIMULATE, listCopy ); final double cannotHold = what.injectAEPower( amt, Actionable.SIMULATE, listCopy );
+9 -9
View File
@@ -59,13 +59,13 @@ public class GridStorageCache implements IStorageGrid
{ {
private final IGrid myGrid; private final IGrid myGrid;
private final HashSet<ICellProvider> activeCellProviders = new HashSet<ICellProvider>(); private final HashSet<ICellProvider> activeCellProviders = new HashSet<>();
private final HashSet<ICellProvider> inactiveCellProviders = new HashSet<ICellProvider>(); private final HashSet<ICellProvider> inactiveCellProviders = new HashSet<>();
private final SetMultimap<IAEStack, ItemWatcher> interests = HashMultimap.create(); private final SetMultimap<IAEStack, ItemWatcher> interests = HashMultimap.create();
private final GenericInterestManager<ItemWatcher> interestManager = new GenericInterestManager<ItemWatcher>( this.interests ); private final GenericInterestManager<ItemWatcher> interestManager = new GenericInterestManager<>( this.interests );
private final NetworkMonitor<IAEItemStack> itemMonitor = new NetworkMonitor<IAEItemStack>( this, StorageChannel.ITEMS ); private final NetworkMonitor<IAEItemStack> itemMonitor = new NetworkMonitor<>( this, StorageChannel.ITEMS );
private final NetworkMonitor<IAEFluidStack> fluidMonitor = new NetworkMonitor<IAEFluidStack>( this, StorageChannel.FLUIDS ); private final NetworkMonitor<IAEFluidStack> fluidMonitor = new NetworkMonitor<>( this, StorageChannel.FLUIDS );
private final HashMap<IGridNode, IStackWatcher> watchers = new HashMap<IGridNode, IStackWatcher>(); private final HashMap<IGridNode, IStackWatcher> watchers = new HashMap<>();
private NetworkInventoryHandler<IAEItemStack> myItemNetwork; private NetworkInventoryHandler<IAEItemStack> myItemNetwork;
private NetworkInventoryHandler<IAEFluidStack> myFluidNetwork; private NetworkInventoryHandler<IAEFluidStack> myFluidNetwork;
@@ -284,7 +284,7 @@ public class GridStorageCache implements IStorageGrid
switch( chan ) switch( chan )
{ {
case FLUIDS: case FLUIDS:
this.myFluidNetwork = new NetworkInventoryHandler<IAEFluidStack>( StorageChannel.FLUIDS, security ); this.myFluidNetwork = new NetworkInventoryHandler<>( StorageChannel.FLUIDS, security );
for( final ICellProvider cc : this.activeCellProviders ) for( final ICellProvider cc : this.activeCellProviders )
{ {
for( final IMEInventoryHandler<IAEFluidStack> h : cc.getCellArray( chan ) ) for( final IMEInventoryHandler<IAEFluidStack> h : cc.getCellArray( chan ) )
@@ -294,7 +294,7 @@ public class GridStorageCache implements IStorageGrid
} }
break; break;
case ITEMS: case ITEMS:
this.myItemNetwork = new NetworkInventoryHandler<IAEItemStack>( StorageChannel.ITEMS, security ); this.myItemNetwork = new NetworkInventoryHandler<>( StorageChannel.ITEMS, security );
for( final ICellProvider cc : this.activeCellProviders ) for( final ICellProvider cc : this.activeCellProviders )
{ {
for( final IMEInventoryHandler<IAEItemStack> h : cc.getCellArray( chan ) ) for( final IMEInventoryHandler<IAEItemStack> h : cc.getCellArray( chan ) )
@@ -402,7 +402,7 @@ public class GridStorageCache implements IStorageGrid
private class CellChangeTracker private class CellChangeTracker
{ {
final List<CellChangeTrackerRecord> data = new LinkedList<CellChangeTrackerRecord>(); final List<CellChangeTrackerRecord> data = new LinkedList<>();
public void postChanges( final StorageChannel channel, final int i, final IMEInventoryHandler<? extends IAEStack> h, final BaseActionSource actionSrc ) public void postChanges( final StorageChannel channel, final int i, final IMEInventoryHandler<? extends IAEStack> h, final BaseActionSource actionSrc )
{ {
+1 -1
View File
@@ -70,7 +70,7 @@ public class NetworkMonitor<T extends IAEStack<T>> implements IMEMonitor<T>
this.myGridCache = cache; this.myGridCache = cache;
this.myChannel = chan; this.myChannel = chan;
this.cachedList = (IItemList<T>) chan.createList(); this.cachedList = (IItemList<T>) chan.createList();
this.listeners = new HashMap<IMEMonitorHandlerReceiver<T>, Object>(); this.listeners = new HashMap<>();
} }
@Override @Override
+2 -2
View File
@@ -43,9 +43,9 @@ public class P2PCache implements IGridCache
{ {
private final IGrid myGrid; private final IGrid myGrid;
private final HashMap<Long, PartP2PTunnel> inputs = new HashMap<Long, PartP2PTunnel>(); private final HashMap<Long, PartP2PTunnel> inputs = new HashMap<>();
private final Multimap<Long, PartP2PTunnel> outputs = LinkedHashMultimap.create(); private final Multimap<Long, PartP2PTunnel> outputs = LinkedHashMultimap.create();
private final TunnelCollection NullColl = new TunnelCollection<PartP2PTunnel>( null, null ); private final TunnelCollection NullColl = new TunnelCollection<>( null, null );
public P2PCache( final IGrid g ) public P2PCache( final IGrid g )
{ {
+9 -9
View File
@@ -58,10 +58,10 @@ import appeng.tile.networking.TileController;
public class PathGridCache implements IPathingGrid public class PathGridCache implements IPathingGrid
{ {
private final LinkedList<PathSegment> active = new LinkedList<PathSegment>(); private final LinkedList<PathSegment> active = new LinkedList<>();
private final Set<TileController> controllers = new HashSet<TileController>(); private final Set<TileController> controllers = new HashSet<>();
private final Set<IGridNode> requireChannels = new HashSet<IGridNode>(); private final Set<IGridNode> requireChannels = new HashSet<>();
private final Set<IGridNode> blockDense = new HashSet<IGridNode>(); private final Set<IGridNode> blockDense = new HashSet<>();
private final IGrid myGrid; private final IGrid myGrid;
private int channelsInUse = 0; private int channelsInUse = 0;
private int channelsByBlocks = 0; private int channelsByBlocks = 0;
@@ -72,7 +72,7 @@ public class PathGridCache implements IPathingGrid
private ControllerState controllerState = ControllerState.NO_CONTROLLER; private ControllerState controllerState = ControllerState.NO_CONTROLLER;
private int ticksUntilReady = 20; private int ticksUntilReady = 20;
private int lastChannels = 0; private int lastChannels = 0;
private HashSet<IPathItem> semiOpen = new HashSet<IPathItem>(); private HashSet<IPathItem> semiOpen = new HashSet<>();
public PathGridCache( final IGrid g ) public PathGridCache( final IGrid g )
{ {
@@ -136,8 +136,8 @@ public class PathGridCache implements IPathingGrid
{ {
final int nodes = this.myGrid.getNodes().size(); final int nodes = this.myGrid.getNodes().size();
this.ticksUntilReady = 20 + Math.max( 0, nodes / 100 - 20 ); this.ticksUntilReady = 20 + Math.max( 0, nodes / 100 - 20 );
final HashSet<IPathItem> closedList = new HashSet<IPathItem>(); final HashSet<IPathItem> closedList = new HashSet<>();
this.semiOpen = new HashSet<IPathItem>(); this.semiOpen = new HashSet<>();
// myGrid.getPivot().beginVisit( new AdHocChannelUpdater( 0 ) // myGrid.getPivot().beginVisit( new AdHocChannelUpdater( 0 )
// ); // );
@@ -149,7 +149,7 @@ public class PathGridCache implements IPathingGrid
final GridConnection gc = (GridConnection) gcc; final GridConnection gc = (GridConnection) gcc;
if( !( gc.getOtherSide( node ).getMachine() instanceof TileController ) ) if( !( gc.getOtherSide( node ).getMachine() instanceof TileController ) )
{ {
final List<IPathItem> open = new LinkedList<IPathItem>(); final List<IPathItem> open = new LinkedList<>();
closedList.add( gc ); closedList.add( gc );
open.add( gc ); open.add( gc );
gc.setControllerRoute( (GridNode) node, true ); gc.setControllerRoute( (GridNode) node, true );
@@ -344,7 +344,7 @@ public class PathGridCache implements IPathingGrid
final Achievements lastBracket = this.getAchievementBracket( this.lastChannels ); final Achievements lastBracket = this.getAchievementBracket( this.lastChannels );
if( currentBracket != lastBracket && currentBracket != null ) if( currentBracket != lastBracket && currentBracket != null )
{ {
final Set<Integer> players = new HashSet<Integer>(); final Set<Integer> players = new HashSet<>();
for( final IGridNode n : this.requireChannels ) for( final IGridNode n : this.requireChannels )
{ {
players.add( n.getPlayerID() ); players.add( n.getPlayerID() );
+2 -2
View File
@@ -46,8 +46,8 @@ public class SecurityCache implements ISecurityGrid
{ {
private final IGrid myGrid; private final IGrid myGrid;
private final List<ISecurityProvider> securityProvider = new ArrayList<ISecurityProvider>(); private final List<ISecurityProvider> securityProvider = new ArrayList<>();
private final HashMap<Integer, EnumSet<SecurityPermissions>> playerPerms = new HashMap<Integer, EnumSet<SecurityPermissions>>(); private final HashMap<Integer, EnumSet<SecurityPermissions>> playerPerms = new HashMap<>();
private long securityKey = -1; private long securityKey = -1;
public SecurityCache( final IGrid g ) public SecurityCache( final IGrid g )
+4 -4
View File
@@ -47,8 +47,8 @@ public class SpatialPylonCache implements ISpatialCache
private DimensionalCoord captureMin; private DimensionalCoord captureMin;
private DimensionalCoord captureMax; private DimensionalCoord captureMax;
private boolean isValid = false; private boolean isValid = false;
private List<TileSpatialIOPort> ioPorts = new LinkedList<TileSpatialIOPort>(); private List<TileSpatialIOPort> ioPorts = new LinkedList<>();
private HashMap<SpatialPylonCluster, SpatialPylonCluster> clusters = new HashMap<SpatialPylonCluster, SpatialPylonCluster>(); private HashMap<SpatialPylonCluster, SpatialPylonCluster> clusters = new HashMap<>();
public SpatialPylonCache( final IGrid g ) public SpatialPylonCache( final IGrid g )
{ {
@@ -64,8 +64,8 @@ public class SpatialPylonCache implements ISpatialCache
private void reset( final IGrid grid ) private void reset( final IGrid grid )
{ {
this.clusters = new HashMap<SpatialPylonCluster, SpatialPylonCluster>(); this.clusters = new HashMap<>();
this.ioPorts = new LinkedList<TileSpatialIOPort>(); this.ioPorts = new LinkedList<>();
for( final IGridNode gm : grid.getMachines( TileSpatialIOPort.class ) ) for( final IGridNode gm : grid.getMachines( TileSpatialIOPort.class ) )
{ {
+4 -4
View File
@@ -41,10 +41,10 @@ public class TickManagerCache implements ITickManager
{ {
private final IGrid myGrid; private final IGrid myGrid;
private final HashMap<IGridNode, TickTracker> alertable = new HashMap<IGridNode, TickTracker>(); private final HashMap<IGridNode, TickTracker> alertable = new HashMap<>();
private final HashMap<IGridNode, TickTracker> sleeping = new HashMap<IGridNode, TickTracker>(); private final HashMap<IGridNode, TickTracker> sleeping = new HashMap<>();
private final HashMap<IGridNode, TickTracker> awake = new HashMap<IGridNode, TickTracker>(); private final HashMap<IGridNode, TickTracker> awake = new HashMap<>();
private final PriorityQueue<TickTracker> upcomingTicks = new PriorityQueue<TickTracker>(); private final PriorityQueue<TickTracker> upcomingTicks = new PriorityQueue<>();
private long currentTick = 0; private long currentTick = 0;
public TickManagerCache( final IGrid g ) public TickManagerCache( final IGrid g )
+1 -1
View File
@@ -31,7 +31,7 @@ import appeng.util.IWorldCallable;
public class Connections implements IWorldCallable<Void> public class Connections implements IWorldCallable<Void>
{ {
private final HashMap<IGridNode, TunnelConnection> connections = new HashMap<IGridNode, TunnelConnection>(); private final HashMap<IGridNode, TunnelConnection> connections = new HashMap<>();
private final PartP2PTunnelME me; private final PartP2PTunnelME me;
private boolean create = false; private boolean create = false;
private boolean destroy = false; private boolean destroy = false;
@@ -53,9 +53,9 @@ public class TunnelCollection<T extends PartP2PTunnel> implements Iterable<T>
{ {
if( this.tunnelSources == null ) if( this.tunnelSources == null )
{ {
return new NullIterator<T>(); return new NullIterator<>();
} }
return new TunnelIterator<T>( this.tunnelSources, this.clz ); return new TunnelIterator<>( this.tunnelSources, this.clz );
} }
public boolean matches( final Class<? extends PartP2PTunnel> c ) public boolean matches( final Class<? extends PartP2PTunnel> c )
@@ -87,12 +87,12 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
private final WorldCoord min; private final WorldCoord min;
private final WorldCoord max; private final WorldCoord max;
private final int[] usedOps = new int[3]; private final int[] usedOps = new int[3];
private final Map<ICraftingPatternDetails, TaskProgress> tasks = new HashMap<ICraftingPatternDetails, TaskProgress>(); private final Map<ICraftingPatternDetails, TaskProgress> tasks = new HashMap<>();
// INSTANCE sate // INSTANCE sate
private final LinkedList<TileCraftingTile> tiles = new LinkedList<TileCraftingTile>(); private final LinkedList<TileCraftingTile> tiles = new LinkedList<>();
private final LinkedList<TileCraftingTile> storage = new LinkedList<TileCraftingTile>(); private final LinkedList<TileCraftingTile> storage = new LinkedList<>();
private final LinkedList<TileCraftingMonitorTile> status = new LinkedList<TileCraftingMonitorTile>(); private final LinkedList<TileCraftingMonitorTile> status = new LinkedList<>();
private final HashMap<IMEMonitorHandlerReceiver<IAEItemStack>, Object> listeners = new HashMap<IMEMonitorHandlerReceiver<IAEItemStack>, Object>(); private final HashMap<IMEMonitorHandlerReceiver<IAEItemStack>, Object> listeners = new HashMap<>();
private ICraftingLink myLastLink; private ICraftingLink myLastLink;
private String myName = ""; private String myName = "";
private boolean isDestroyed = false; private boolean isDestroyed = false;
@@ -260,7 +260,7 @@ public class QuantumCluster implements ILocatable, IAECluster
@Override @Override
public Iterator<IGridHost> getTiles() public Iterator<IGridHost> getTiles()
{ {
return new ChainedIterator<IGridHost>( this.getRing()[0], this.getRing()[1], this.getRing()[2], this.getRing()[3], this.getRing()[4], this return new ChainedIterator<>( this.getRing()[0], this.getRing()[1], this.getRing()[2], this.getRing()[3], this.getRing()[4], this
.getRing()[5], this.getRing()[6], this.getRing()[7], this.center ); .getRing()[5], this.getRing()[6], this.getRing()[7], this.center );
} }
@@ -34,7 +34,7 @@ public class SpatialPylonCluster implements IAECluster
private final DimensionalCoord min; private final DimensionalCoord min;
private final DimensionalCoord max; private final DimensionalCoord max;
private final List<TileSpatialPylon> line = new ArrayList<TileSpatialPylon>(); private final List<TileSpatialPylon> line = new ArrayList<>();
private boolean isDestroyed = false; private boolean isDestroyed = false;
private Axis currentAxis = Axis.UNFORMED; private Axis currentAxis = Axis.UNFORMED;
@@ -36,7 +36,7 @@ public class EnergyWatcher implements IEnergyWatcher
private final EnergyGridCache gsc; private final EnergyGridCache gsc;
private final IEnergyWatcherHost watcherHost; private final IEnergyWatcherHost watcherHost;
private final Set<EnergyThreshold> myInterests = new HashSet<EnergyThreshold>(); private final Set<EnergyThreshold> myInterests = new HashSet<>();
public EnergyWatcher( final EnergyGridCache cache, final IEnergyWatcherHost host ) public EnergyWatcher( final EnergyGridCache cache, final IEnergyWatcherHost host )
{ {
@@ -44,7 +44,7 @@ public class AENetworkProxyMultiblock extends AENetworkProxy implements IGridMul
{ {
if( this.getCluster() == null ) if( this.getCluster() == null )
{ {
return new ChainedIterator<IGridNode>(); return new ChainedIterator<>();
} }
return new ProxyNodeIterator( this.getCluster().getTiles() ); return new ProxyNodeIterator( this.getCluster().getTiles() );
@@ -43,7 +43,7 @@ public class GenericInterestManager<T>
{ {
if( this.transDepth == 0 ) if( this.transDepth == 0 )
{ {
this.transactions = new LinkedList<SavedTransactions>(); this.transactions = new LinkedList<>();
} }
this.transDepth++; this.transDepth++;
@@ -52,7 +52,7 @@ public class PathSegment
public boolean step() public boolean step()
{ {
final List<IPathItem> oldOpen = this.open; final List<IPathItem> oldOpen = this.open;
this.open = new LinkedList<IPathItem>(); this.open = new LinkedList<>();
for( final IPathItem i : oldOpen ) for( final IPathItem i : oldOpen )
{ {
@@ -58,7 +58,7 @@ public class CellInventory implements ICellInventory
private static final String ITEM_PRE_FORMATTED_SLOT = "PF#"; private static final String ITEM_PRE_FORMATTED_SLOT = "PF#";
private static final String ITEM_PRE_FORMATTED_NAME = "PN"; private static final String ITEM_PRE_FORMATTED_NAME = "PN";
private static final String ITEM_PRE_FORMATTED_FUZZY = "FP"; private static final String ITEM_PRE_FORMATTED_FUZZY = "FP";
private static final HashSet<Integer> BLACK_LIST = new HashSet<Integer>(); private static final HashSet<Integer> BLACK_LIST = new HashSet<>();
private static String[] itemSlots; private static String[] itemSlots;
private static String[] itemSlotCount; private static String[] itemSlotCount;
private final NBTTagCompound tagCompound; private final NBTTagCompound tagCompound;
@@ -96,11 +96,11 @@ public class CellInventoryHandler extends MEInventoryHandler<IAEItemStack> imple
{ {
if( hasFuzzy ) if( hasFuzzy )
{ {
this.setPartitionList( new FuzzyPriorityList<IAEItemStack>( priorityList, fzMode ) ); this.setPartitionList( new FuzzyPriorityList<>( priorityList, fzMode ) );
} }
else else
{ {
this.setPartitionList( new PrecisePriorityList<IAEItemStack>( priorityList ) ); this.setPartitionList( new PrecisePriorityList<>( priorityList ) );
} }
} }
} }
@@ -37,7 +37,7 @@ public class ItemWatcher implements IStackWatcher
private final GridStorageCache gsc; private final GridStorageCache gsc;
private final IStackWatcherHost myObject; private final IStackWatcherHost myObject;
private final Set<IAEStack> myInterests = new HashSet<IAEStack>(); private final Set<IAEStack> myInterests = new HashSet<>();
public ItemWatcher( final GridStorageCache cache, final IStackWatcherHost host ) public ItemWatcher( final GridStorageCache cache, final IStackWatcherHost host )
{ {
@@ -53,13 +53,13 @@ public class MEInventoryHandler<T extends IAEStack<T>> implements IMEInventoryHa
} }
else else
{ {
this.internal = new MEPassThrough<T>( i, channel ); this.internal = new MEPassThrough<>( i, channel );
} }
this.myPriority = 0; this.myPriority = 0;
this.myWhitelist = IncludeExclude.WHITELIST; this.myWhitelist = IncludeExclude.WHITELIST;
this.setBaseAccess( AccessRestriction.READ_WRITE ); this.setBaseAccess( AccessRestriction.READ_WRITE );
this.myPartitionList = new DefaultPriorityList<T>(); this.myPartitionList = new DefaultPriorityList<>();
} }
IncludeExclude getWhitelist() IncludeExclude getWhitelist()
@@ -49,7 +49,7 @@ public class MEMonitorIInventory implements IMEMonitor<IAEItemStack>, ITickingMo
private final InventoryAdaptor adaptor; private final InventoryAdaptor adaptor;
private final IItemList<IAEItemStack> list = AEApi.instance().storage().createItemList(); private final IItemList<IAEItemStack> list = AEApi.instance().storage().createItemList();
private final HashMap<IMEMonitorHandlerReceiver<IAEItemStack>, Object> listeners = new HashMap<IMEMonitorHandlerReceiver<IAEItemStack>, Object>(); private final HashMap<IMEMonitorHandlerReceiver<IAEItemStack>, Object> listeners = new HashMap<>();
private final NavigableMap<Integer, CachedItemStack> memory; private final NavigableMap<Integer, CachedItemStack> memory;
private BaseActionSource mySource; private BaseActionSource mySource;
private StorageFilter mode = StorageFilter.EXTRACTABLE_ONLY; private StorageFilter mode = StorageFilter.EXTRACTABLE_ONLY;
@@ -57,7 +57,7 @@ public class MEMonitorIInventory implements IMEMonitor<IAEItemStack>, ITickingMo
public MEMonitorIInventory( final InventoryAdaptor adaptor ) public MEMonitorIInventory( final InventoryAdaptor adaptor )
{ {
this.adaptor = adaptor; this.adaptor = adaptor;
this.memory = new ConcurrentSkipListMap<Integer, CachedItemStack>(); this.memory = new ConcurrentSkipListMap<>();
} }
@Override @Override
@@ -143,7 +143,7 @@ public class MEMonitorIInventory implements IMEMonitor<IAEItemStack>, ITickingMo
public TickRateModulation onTick() public TickRateModulation onTick()
{ {
final LinkedList<IAEItemStack> changes = new LinkedList<IAEItemStack>(); final LinkedList<IAEItemStack> changes = new LinkedList<>();
this.list.resetStatus(); this.list.resetStatus();
int high = 0; int high = 0;
@@ -38,7 +38,7 @@ import appeng.util.inv.ItemListIgnoreCrafting;
public class MEMonitorPassThrough<T extends IAEStack<T>> extends MEPassThrough<T> implements IMEMonitor<T>, IMEMonitorHandlerReceiver<T> public class MEMonitorPassThrough<T extends IAEStack<T>> extends MEPassThrough<T> implements IMEMonitor<T>, IMEMonitorHandlerReceiver<T>
{ {
private final HashMap<IMEMonitorHandlerReceiver<T>, Object> listeners = new HashMap<IMEMonitorHandlerReceiver<T>, Object>(); private final HashMap<IMEMonitorHandlerReceiver<T>, Object> listeners = new HashMap<>();
private BaseActionSource changeSource; private BaseActionSource changeSource;
private IMEMonitor<T> monitor; private IMEMonitor<T> monitor;
@@ -47,8 +47,8 @@ import appeng.util.ItemSorters;
public class NetworkInventoryHandler<T extends IAEStack<T>> implements IMEInventoryHandler<T> public class NetworkInventoryHandler<T extends IAEStack<T>> implements IMEInventoryHandler<T>
{ {
private static final ThreadLocal<LinkedList> DEPTH_MOD = new ThreadLocal<LinkedList>(); private static final ThreadLocal<LinkedList> DEPTH_MOD = new ThreadLocal<>();
private static final ThreadLocal<LinkedList> DEPTH_SIM = new ThreadLocal<LinkedList>(); private static final ThreadLocal<LinkedList> DEPTH_SIM = new ThreadLocal<>();
private static final Comparator<Integer> PRIORITY_SORTER = ( o1, o2 ) -> ItemSorters.compareInt( o2, o1 ); private static final Comparator<Integer> PRIORITY_SORTER = ( o1, o2 ) -> ItemSorters.compareInt( o2, o1 );
private static int currentPass = 0; private static int currentPass = 0;
+1 -1
View File
@@ -121,7 +121,7 @@ public abstract class AEBasePart implements IPart, IGridProxyable, IActionHost,
{ {
if( this.getItemStack().getCount() > 0 ) if( this.getItemStack().getCount() > 0 )
{ {
final List<ItemStack> items = new ArrayList<ItemStack>(); final List<ItemStack> items = new ArrayList<>();
items.add( this.is.copy() ); items.add( this.is.copy() );
this.host.removePart( this.side, false ); this.host.removePart( this.side, false );
Platform.spawnDrops( this.tile.getWorld(), this.tile.getPos(), items ); Platform.spawnDrops( this.tile.getWorld(), this.tile.getPos(), items );

Some files were not shown because too many files have changed in this diff Show More