final variables and parameters
This commit is contained in:
@@ -75,20 +75,20 @@ public final class DisassembleRecipe implements IRecipe
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches( InventoryCrafting inv, World w )
|
||||
public boolean matches( final InventoryCrafting inv, final World w )
|
||||
{
|
||||
return this.getOutput( inv ) != null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private ItemStack getOutput( IInventory inventory )
|
||||
private ItemStack getOutput( final IInventory inventory )
|
||||
{
|
||||
int itemCount = 0;
|
||||
ItemStack output = MISMATCHED_STACK;
|
||||
|
||||
for( int slotIndex = 0; slotIndex < inventory.getSizeInventory(); slotIndex++ )
|
||||
{
|
||||
ItemStack stackInSlot = inventory.getStackInSlot( slotIndex );
|
||||
final ItemStack stackInSlot = inventory.getStackInSlot( slotIndex );
|
||||
if( stackInSlot != null )
|
||||
{
|
||||
// needs a single input in the recipe
|
||||
@@ -99,13 +99,13 @@ public final class DisassembleRecipe implements IRecipe
|
||||
}
|
||||
|
||||
// handle storage cells
|
||||
for( ItemStack storageCellStack : this.getCellOutput( stackInSlot ).asSet() )
|
||||
for( final ItemStack storageCellStack : this.getCellOutput( stackInSlot ).asSet() )
|
||||
{
|
||||
// make sure the storage cell stackInSlot empty...
|
||||
IMEInventory<IAEItemStack> cellInv = AEApi.instance().registries().cell().getCellInventory( stackInSlot, null, StorageChannel.ITEMS );
|
||||
final IMEInventory<IAEItemStack> cellInv = AEApi.instance().registries().cell().getCellInventory( stackInSlot, null, StorageChannel.ITEMS );
|
||||
if( cellInv != null )
|
||||
{
|
||||
IItemList<IAEItemStack> list = cellInv.getAvailableItems( StorageChannel.ITEMS.createList() );
|
||||
final IItemList<IAEItemStack> list = cellInv.getAvailableItems( StorageChannel.ITEMS.createList() );
|
||||
if( !list.isEmpty() )
|
||||
{
|
||||
return null;
|
||||
@@ -116,7 +116,7 @@ public final class DisassembleRecipe implements IRecipe
|
||||
}
|
||||
|
||||
// handle crafting storage blocks
|
||||
for( ItemStack craftingStorageStack : this.getNonCellOutput( stackInSlot ).asSet() )
|
||||
for( final ItemStack craftingStorageStack : this.getNonCellOutput( stackInSlot ).asSet() )
|
||||
{
|
||||
output = craftingStorageStack;
|
||||
}
|
||||
@@ -127,9 +127,9 @@ public final class DisassembleRecipe implements IRecipe
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
private Optional<ItemStack> getCellOutput( ItemStack compared )
|
||||
private Optional<ItemStack> getCellOutput( final ItemStack compared )
|
||||
{
|
||||
for( Map.Entry<IItemDefinition, IItemDefinition> entry : this.cellMappings.entrySet() )
|
||||
for( final Map.Entry<IItemDefinition, IItemDefinition> entry : this.cellMappings.entrySet() )
|
||||
{
|
||||
if( entry.getKey().isSameAs( compared ) )
|
||||
{
|
||||
@@ -141,9 +141,9 @@ public final class DisassembleRecipe implements IRecipe
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
private Optional<ItemStack> getNonCellOutput( ItemStack compared )
|
||||
private Optional<ItemStack> getNonCellOutput( final ItemStack compared )
|
||||
{
|
||||
for( Map.Entry<IItemDefinition, IItemDefinition> entry : this.nonCellMappings.entrySet() )
|
||||
for( final Map.Entry<IItemDefinition, IItemDefinition> entry : this.nonCellMappings.entrySet() )
|
||||
{
|
||||
if( entry.getKey().isSameAs( compared ) )
|
||||
{
|
||||
@@ -156,7 +156,7 @@ public final class DisassembleRecipe implements IRecipe
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public ItemStack getCraftingResult( InventoryCrafting inv )
|
||||
public ItemStack getCraftingResult( final InventoryCrafting inv )
|
||||
{
|
||||
return this.getOutput( inv );
|
||||
}
|
||||
@@ -176,7 +176,7 @@ public final class DisassembleRecipe implements IRecipe
|
||||
|
||||
@Override
|
||||
public ItemStack[] getRemainingItems(
|
||||
InventoryCrafting inv )
|
||||
final InventoryCrafting inv )
|
||||
{
|
||||
return ForgeHooks.defaultRecipeGetRemainingItems(inv);
|
||||
}
|
||||
|
||||
@@ -50,23 +50,23 @@ public final class FacadeRecipe implements IRecipe
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches( InventoryCrafting inv, World w )
|
||||
public boolean matches( final InventoryCrafting inv, final World w )
|
||||
{
|
||||
return this.getOutput( inv, false ) != null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private ItemStack getOutput( IInventory inv, boolean createFacade )
|
||||
private ItemStack getOutput( final IInventory inv, final boolean createFacade )
|
||||
{
|
||||
if( inv.getStackInSlot( 0 ) == null && inv.getStackInSlot( 2 ) == null && inv.getStackInSlot( 6 ) == null && inv.getStackInSlot( 8 ) == null )
|
||||
{
|
||||
if( this.anchor.isSameAs( inv.getStackInSlot( 1 ) ) && this.anchor.isSameAs( inv.getStackInSlot( 3 ) ) && this.anchor.isSameAs( inv.getStackInSlot( 5 ) ) && this.anchor.isSameAs( inv.getStackInSlot( 7 ) ) )
|
||||
{
|
||||
for( Item facadeItemDefinition : this.maybeFacade.asSet() )
|
||||
for( final Item facadeItemDefinition : this.maybeFacade.asSet() )
|
||||
{
|
||||
final ItemFacade facade = (ItemFacade) facadeItemDefinition;
|
||||
|
||||
ItemStack facades = facade.createFacadeForItem( inv.getStackInSlot( 4 ), !createFacade );
|
||||
final ItemStack facades = facade.createFacadeForItem( inv.getStackInSlot( 4 ), !createFacade );
|
||||
if( facades != null && createFacade )
|
||||
{
|
||||
facades.stackSize = 4;
|
||||
@@ -80,7 +80,7 @@ public final class FacadeRecipe implements IRecipe
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getCraftingResult( InventoryCrafting inv )
|
||||
public ItemStack getCraftingResult( final InventoryCrafting inv )
|
||||
{
|
||||
return this.getOutput( inv, true );
|
||||
}
|
||||
@@ -99,7 +99,7 @@ public final class FacadeRecipe implements IRecipe
|
||||
|
||||
@Override
|
||||
public ItemStack[] getRemainingItems(
|
||||
InventoryCrafting inv )
|
||||
final InventoryCrafting inv )
|
||||
{
|
||||
return ForgeHooks.defaultRecipeGetRemainingItems(inv);
|
||||
}
|
||||
|
||||
@@ -47,11 +47,11 @@ public class ShapedRecipe implements IRecipe, IRecipeBakeable
|
||||
private boolean mirrored = true;
|
||||
private boolean disable = false;
|
||||
|
||||
public ShapedRecipe( ItemStack result, Object... recipe )
|
||||
public ShapedRecipe( final ItemStack result, Object... recipe )
|
||||
{
|
||||
this.output = result.copy();
|
||||
|
||||
StringBuilder shape = new StringBuilder();
|
||||
final StringBuilder shape = new StringBuilder();
|
||||
int idx = 0;
|
||||
|
||||
if( recipe[idx] instanceof Boolean )
|
||||
@@ -69,10 +69,10 @@ public class ShapedRecipe implements IRecipe, IRecipeBakeable
|
||||
|
||||
if( recipe[idx] instanceof String[] )
|
||||
{
|
||||
String[] parts = ( (String[]) recipe[idx] );
|
||||
final String[] parts = ( (String[]) recipe[idx] );
|
||||
idx++;
|
||||
|
||||
for( String s : parts )
|
||||
for( final String s : parts )
|
||||
{
|
||||
this.width = s.length();
|
||||
shape.append( s );
|
||||
@@ -84,7 +84,7 @@ public class ShapedRecipe implements IRecipe, IRecipeBakeable
|
||||
{
|
||||
while( recipe[idx] instanceof String )
|
||||
{
|
||||
String s = (String) recipe[idx];
|
||||
final String s = (String) recipe[idx];
|
||||
idx++;
|
||||
shape.append( s );
|
||||
this.width = s.length();
|
||||
@@ -94,8 +94,8 @@ public class ShapedRecipe implements IRecipe, IRecipeBakeable
|
||||
|
||||
if( this.width * this.height != shape.length() )
|
||||
{
|
||||
StringBuilder ret = new StringBuilder( "Invalid shaped ore recipe: " );
|
||||
for( Object tmp : recipe )
|
||||
final StringBuilder ret = new StringBuilder( "Invalid shaped ore recipe: " );
|
||||
for( final Object tmp : recipe )
|
||||
{
|
||||
ret.append( tmp ).append( ", " );
|
||||
}
|
||||
@@ -103,12 +103,12 @@ public class ShapedRecipe implements IRecipe, IRecipeBakeable
|
||||
throw new IllegalStateException( ret.toString() );
|
||||
}
|
||||
|
||||
Map<Character, IIngredient> itemMap = new HashMap<Character, IIngredient>();
|
||||
final Map<Character, IIngredient> itemMap = new HashMap<Character, IIngredient>();
|
||||
|
||||
for(; idx < recipe.length; idx += 2 )
|
||||
{
|
||||
Character chr = (Character) recipe[idx];
|
||||
Object in = recipe[idx + 1];
|
||||
final Character chr = (Character) recipe[idx];
|
||||
final Object in = recipe[idx + 1];
|
||||
|
||||
if( in instanceof IIngredient )
|
||||
{
|
||||
@@ -116,8 +116,8 @@ public class ShapedRecipe implements IRecipe, IRecipeBakeable
|
||||
}
|
||||
else
|
||||
{
|
||||
StringBuilder ret = new StringBuilder( "Invalid shaped ore recipe: " );
|
||||
for( Object tmp : recipe )
|
||||
final StringBuilder ret = new StringBuilder( "Invalid shaped ore recipe: " );
|
||||
for( final Object tmp : recipe )
|
||||
{
|
||||
ret.append( tmp ).append( ", " );
|
||||
}
|
||||
@@ -128,7 +128,7 @@ public class ShapedRecipe implements IRecipe, IRecipeBakeable
|
||||
|
||||
this.input = new Object[this.width * this.height];
|
||||
int x = 0;
|
||||
for( char chr : shape.toString().toCharArray() )
|
||||
for( final char chr : shape.toString().toCharArray() )
|
||||
{
|
||||
this.input[x] = itemMap.get( chr );
|
||||
x++;
|
||||
@@ -141,7 +141,7 @@ public class ShapedRecipe implements IRecipe, IRecipeBakeable
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches( InventoryCrafting inv, World world )
|
||||
public boolean matches( final InventoryCrafting inv, final World world )
|
||||
{
|
||||
if( this.disable )
|
||||
{
|
||||
@@ -168,7 +168,7 @@ public class ShapedRecipe implements IRecipe, IRecipeBakeable
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getCraftingResult( InventoryCrafting var1 )
|
||||
public ItemStack getCraftingResult( final InventoryCrafting var1 )
|
||||
{
|
||||
return this.output.copy();
|
||||
}
|
||||
@@ -186,7 +186,7 @@ public class ShapedRecipe implements IRecipe, IRecipeBakeable
|
||||
}
|
||||
|
||||
@SuppressWarnings( "unchecked" )
|
||||
private boolean checkMatch( InventoryCrafting inv, int startX, int startY, boolean mirror )
|
||||
private boolean checkMatch( final InventoryCrafting inv, final int startX, final int startY, final boolean mirror )
|
||||
{
|
||||
if( this.disable )
|
||||
{
|
||||
@@ -197,8 +197,8 @@ public class ShapedRecipe implements IRecipe, IRecipeBakeable
|
||||
{
|
||||
for( int y = 0; y < MAX_CRAFT_GRID_HEIGHT; y++ )
|
||||
{
|
||||
int subX = x - startX;
|
||||
int subY = y - startY;
|
||||
final int subX = x - startX;
|
||||
final int subY = y - startY;
|
||||
Object target = null;
|
||||
|
||||
if( subX >= 0 && subY >= 0 && subX < this.width && subY < this.height )
|
||||
@@ -213,7 +213,7 @@ public class ShapedRecipe implements IRecipe, IRecipeBakeable
|
||||
}
|
||||
}
|
||||
|
||||
ItemStack slot = inv.getStackInRowAndColumn( x, y );
|
||||
final ItemStack slot = inv.getStackInRowAndColumn( x, y );
|
||||
|
||||
if( target instanceof IIngredient )
|
||||
{
|
||||
@@ -221,16 +221,16 @@ public class ShapedRecipe implements IRecipe, IRecipeBakeable
|
||||
|
||||
try
|
||||
{
|
||||
for( ItemStack item : ( (IIngredient) target ).getItemStackSet() )
|
||||
for( final ItemStack item : ( (IIngredient) target ).getItemStackSet() )
|
||||
{
|
||||
matched = matched || this.checkItemEquals( item, slot );
|
||||
}
|
||||
}
|
||||
catch( RegistrationError e )
|
||||
catch( final RegistrationError e )
|
||||
{
|
||||
// :P
|
||||
}
|
||||
catch( MissingIngredientError e )
|
||||
catch( final MissingIngredientError e )
|
||||
{
|
||||
// :P
|
||||
}
|
||||
@@ -244,7 +244,7 @@ public class ShapedRecipe implements IRecipe, IRecipeBakeable
|
||||
{
|
||||
boolean matched = false;
|
||||
|
||||
for( ItemStack item : (Iterable<ItemStack>) target )
|
||||
for( final ItemStack item : (Iterable<ItemStack>) target )
|
||||
{
|
||||
matched = matched || this.checkItemEquals( item, slot );
|
||||
}
|
||||
@@ -264,7 +264,7 @@ public class ShapedRecipe implements IRecipe, IRecipeBakeable
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean checkItemEquals( ItemStack target, ItemStack input )
|
||||
private boolean checkItemEquals( final ItemStack target, final ItemStack input )
|
||||
{
|
||||
if( input == null && target != null || input != null && target == null )
|
||||
{
|
||||
@@ -273,7 +273,7 @@ public class ShapedRecipe implements IRecipe, IRecipeBakeable
|
||||
return ( target.getItem() == input.getItem() && ( target.getItemDamage() == OreDictionary.WILDCARD_VALUE || target.getItemDamage() == input.getItemDamage() ) );
|
||||
}
|
||||
|
||||
public ShapedRecipe setMirrored( boolean mirror )
|
||||
public ShapedRecipe setMirrored( final boolean mirror )
|
||||
{
|
||||
this.mirrored = mirror;
|
||||
return this;
|
||||
@@ -311,7 +311,7 @@ public class ShapedRecipe implements IRecipe, IRecipeBakeable
|
||||
try
|
||||
{
|
||||
this.disable = false;
|
||||
for( Object o : this.input )
|
||||
for( final Object o : this.input )
|
||||
{
|
||||
if( o instanceof IIngredient )
|
||||
{
|
||||
@@ -319,7 +319,7 @@ public class ShapedRecipe implements IRecipe, IRecipeBakeable
|
||||
}
|
||||
}
|
||||
}
|
||||
catch( MissingIngredientError err )
|
||||
catch( final MissingIngredientError err )
|
||||
{
|
||||
this.disable = true;
|
||||
}
|
||||
@@ -327,7 +327,7 @@ public class ShapedRecipe implements IRecipe, IRecipeBakeable
|
||||
|
||||
@Override
|
||||
public ItemStack[] getRemainingItems(
|
||||
InventoryCrafting inv )
|
||||
final InventoryCrafting inv )
|
||||
{
|
||||
return ForgeHooks.defaultRecipeGetRemainingItems(inv);
|
||||
}
|
||||
|
||||
@@ -39,10 +39,10 @@ public class ShapelessRecipe implements IRecipe, IRecipeBakeable
|
||||
private ItemStack output = null;
|
||||
private boolean disable = false;
|
||||
|
||||
public ShapelessRecipe( ItemStack result, Object... recipe )
|
||||
public ShapelessRecipe( final ItemStack result, final Object... recipe )
|
||||
{
|
||||
this.output = result.copy();
|
||||
for( Object in : recipe )
|
||||
for( final Object in : recipe )
|
||||
{
|
||||
if( in instanceof IIngredient )
|
||||
{
|
||||
@@ -50,8 +50,8 @@ public class ShapelessRecipe implements IRecipe, IRecipeBakeable
|
||||
}
|
||||
else
|
||||
{
|
||||
StringBuilder ret = new StringBuilder( "Invalid shapeless ore recipe: " );
|
||||
for( Object tmp : recipe )
|
||||
final StringBuilder ret = new StringBuilder( "Invalid shapeless ore recipe: " );
|
||||
for( final Object tmp : recipe )
|
||||
{
|
||||
ret.append( tmp ).append( ", " );
|
||||
}
|
||||
@@ -68,24 +68,24 @@ public class ShapelessRecipe implements IRecipe, IRecipeBakeable
|
||||
|
||||
@SuppressWarnings( "unchecked" )
|
||||
@Override
|
||||
public boolean matches( InventoryCrafting var1, World world )
|
||||
public boolean matches( final InventoryCrafting var1, final World world )
|
||||
{
|
||||
if( this.disable )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
ArrayList<Object> required = new ArrayList<Object>( this.input );
|
||||
final ArrayList<Object> required = new ArrayList<Object>( this.input );
|
||||
|
||||
for( int x = 0; x < var1.getSizeInventory(); x++ )
|
||||
{
|
||||
ItemStack slot = var1.getStackInSlot( x );
|
||||
final ItemStack slot = var1.getStackInSlot( x );
|
||||
|
||||
if( slot != null )
|
||||
{
|
||||
boolean inRecipe = false;
|
||||
|
||||
for( Object next : required )
|
||||
for( final Object next : required )
|
||||
{
|
||||
boolean match = false;
|
||||
|
||||
@@ -93,16 +93,16 @@ public class ShapelessRecipe implements IRecipe, IRecipeBakeable
|
||||
{
|
||||
try
|
||||
{
|
||||
for( ItemStack item : ( (IIngredient) next ).getItemStackSet() )
|
||||
for( final ItemStack item : ( (IIngredient) next ).getItemStackSet() )
|
||||
{
|
||||
match = match || this.checkItemEquals( item, slot );
|
||||
}
|
||||
}
|
||||
catch( RegistrationError e )
|
||||
catch( final RegistrationError e )
|
||||
{
|
||||
// :P
|
||||
}
|
||||
catch( MissingIngredientError e )
|
||||
catch( final MissingIngredientError e )
|
||||
{
|
||||
// :P
|
||||
}
|
||||
@@ -127,7 +127,7 @@ public class ShapelessRecipe implements IRecipe, IRecipeBakeable
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getCraftingResult( InventoryCrafting var1 )
|
||||
public ItemStack getCraftingResult( final InventoryCrafting var1 )
|
||||
{
|
||||
return this.output.copy();
|
||||
}
|
||||
@@ -144,7 +144,7 @@ public class ShapelessRecipe implements IRecipe, IRecipeBakeable
|
||||
return this.output;
|
||||
}
|
||||
|
||||
private boolean checkItemEquals( ItemStack target, ItemStack input )
|
||||
private boolean checkItemEquals( final ItemStack target, final ItemStack input )
|
||||
{
|
||||
return ( target.getItem() == input.getItem() && ( target.getItemDamage() == OreDictionary.WILDCARD_VALUE || target.getItemDamage() == input.getItemDamage() ) );
|
||||
}
|
||||
@@ -166,7 +166,7 @@ public class ShapelessRecipe implements IRecipe, IRecipeBakeable
|
||||
try
|
||||
{
|
||||
this.disable = false;
|
||||
for( Object o : this.input )
|
||||
for( final Object o : this.input )
|
||||
{
|
||||
if( o instanceof IIngredient )
|
||||
{
|
||||
@@ -174,7 +174,7 @@ public class ShapelessRecipe implements IRecipe, IRecipeBakeable
|
||||
}
|
||||
}
|
||||
}
|
||||
catch( MissingIngredientError e )
|
||||
catch( final MissingIngredientError e )
|
||||
{
|
||||
this.disable = true;
|
||||
}
|
||||
@@ -182,7 +182,7 @@ public class ShapelessRecipe implements IRecipe, IRecipeBakeable
|
||||
|
||||
@Override
|
||||
public ItemStack[] getRemainingItems(
|
||||
InventoryCrafting inv )
|
||||
final InventoryCrafting inv )
|
||||
{
|
||||
return ForgeHooks.defaultRecipeGetRemainingItems(inv);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user