Code format

This commit is contained in:
yueh
2015-08-06 18:49:57 +02:00
parent c21a44d8c0
commit 9c8deac9de
119 changed files with 430 additions and 401 deletions
@@ -185,12 +185,9 @@ public class Ingredient implements IIngredient
/*
* Object o = Item.itemRegistry.getObject( nameSpace + ":" + itemName ); if ( o instanceof Item ) return new
* ItemStack( (Item) o, qty, meta );
*
* if ( o instanceof Block ) return new ItemStack( (Block) o, qty, meta );
*
* o = Item.itemRegistry.getObject( nameSpace + ":item." + itemName ); if ( o instanceof Item ) return new
* ItemStack( (Item) o, qty, meta );
*
* o = Block.blockRegistry.getObject( nameSpace + ":tile." + itemName ); if ( o instanceof Block && (!(o
* instanceof BlockAir)) ) return new ItemStack( (Block) o, qty, meta );
*/
@@ -106,7 +106,7 @@ public class ShapedRecipe implements IRecipe, IRecipeBakeable
Map<Character, IIngredient> itemMap = new HashMap<Character, IIngredient>();
for(; idx < recipe.length; idx += 2 )
for( ; idx < recipe.length; idx += 2 )
{
Character chr = (Character) recipe[idx];
Object in = recipe[idx + 1];
@@ -271,7 +271,7 @@ public class ShapedRecipe implements IRecipe, IRecipeBakeable
{
return false;
}
return ( target.getItem() == input.getItem() && ( target.getItemDamage() == OreDictionary.WILDCARD_VALUE || target.getItemDamage() == input.getItemDamage() ) );
return( target.getItem() == input.getItem() && ( target.getItemDamage() == OreDictionary.WILDCARD_VALUE || target.getItemDamage() == input.getItemDamage() ) );
}
public ShapedRecipe setMirrored( boolean mirror )
@@ -146,7 +146,7 @@ public class ShapelessRecipe implements IRecipe, IRecipeBakeable
private boolean checkItemEquals( ItemStack target, ItemStack input )
{
return ( target.getItem() == input.getItem() && ( target.getItemDamage() == OreDictionary.WILDCARD_VALUE || target.getItemDamage() == input.getItemDamage() ) );
return( target.getItem() == input.getItem() && ( target.getItemDamage() == OreDictionary.WILDCARD_VALUE || target.getItemDamage() == input.getItemDamage() ) );
}
/**
@@ -46,11 +46,11 @@ public final class Inscribe extends InscriberProcess
@Override
public void register() throws RegistrationError, MissingIngredientError
{
if ( this.getImprintable() == null )
if( this.getImprintable() == null )
{
return;
}
if ( this.getOutput() == null )
if( this.getOutput() == null )
{
return;
}
@@ -58,8 +58,8 @@ public final class Inscribe extends InscriberProcess
final ItemStack[] realInput = this.getImprintable().getItemStackSet();
final List<ItemStack> inputs = new ArrayList<ItemStack>( realInput.length );
Collections.addAll( inputs, realInput );
final ItemStack top = (this.getTopOptional() == null) ? null : this.getTopOptional().getItemStack();
final ItemStack bot = (this.getBotOptional() == null) ? null : this.getBotOptional().getItemStack();
final ItemStack top = ( this.getTopOptional() == null ) ? null : this.getTopOptional().getItemStack();
final ItemStack bot = ( this.getBotOptional() == null ) ? null : this.getBotOptional().getItemStack();
final ItemStack output = this.getOutput().getItemStack();
final InscriberProcessType type = InscriberProcessType.Inscribe;
@@ -1,3 +1,4 @@
package appeng.recipes.handlers;
@@ -78,7 +79,7 @@ public abstract class InscriberProcess implements ICraftHandler, IWebsiteSeriali
{
String pattern = "inscriber ";
if ( this.output != null )
if( this.output != null )
{
pattern += this.output.getQty() + '\n';
pattern += handler.getName( this.output ) + '\n';
@@ -89,7 +90,7 @@ public abstract class InscriberProcess implements ICraftHandler, IWebsiteSeriali
pattern += handler.getName( this.topOptional ) + '\n';
}
if ( this.imprintable != null )
if( this.imprintable != null )
{
pattern += handler.getName( this.imprintable );
}
@@ -46,11 +46,11 @@ public final class Press extends InscriberProcess
@Override
public void register() throws RegistrationError, MissingIngredientError
{
if ( this.getImprintable() == null )
if( this.getImprintable() == null )
{
return;
}
if ( this.getOutput() == null )
if( this.getOutput() == null )
{
return;
}
@@ -78,9 +78,9 @@ public class RecipeResourceCopier
*
* @param destination destination folder to which the recipes are copied to
*
* @throws URISyntaxException {@see #getResourceListing}
* @throws IOException {@see #getResourceListing} and if copying the detected resource to file is not possible
* @throws NullPointerException if either parameter is <tt>null</tt>
* @throws URISyntaxException {@see #getResourceListing}
* @throws IOException {@see #getResourceListing} and if copying the detected resource to file is not possible
* @throws NullPointerException if either parameter is <tt>null</tt>
* @throws IllegalArgumentException if destination is not a directory
*/
public void copyTo( @Nonnull File destination ) throws URISyntaxException, IOException
@@ -113,12 +113,12 @@ public class RecipeResourceCopier
* Works for regular files and also JARs.
*
* @param clazz Any java class that lives in the same place as the resources you want.
* @param path Should end with "/", but not start with one.
* @param path Should end with "/", but not start with one.
*
* @return Just the name of each member item, not the full paths.
*
* @throws URISyntaxException if it is a file path and the URL can not be converted to URI
* @throws IOException if jar path can not be decoded
* @throws URISyntaxException if it is a file path and the URL can not be converted to URI
* @throws IOException if jar path can not be decoded
* @throws UnsupportedOperationException if it is neither in jar nor in file path
*/
@Nonnull
@@ -136,28 +136,31 @@ public class RecipeResourceCopier
if( dirURL == null )
{
/*
* In case of a jar file, we can't actually find a directory.
* Have to assume the same jar as clazz.
*/
/*
* In case of a jar file, we can't actually find a directory.
* Have to assume the same jar as clazz.
*/
final String me = DOT_COMPILE_PATTERN.matcher( clazz.getName() ).replaceAll( "/" ) + ".class";
dirURL = clazz.getClassLoader().getResource( me );
}
if( dirURL != null && dirURL.getProtocol().equals( "jar" ) )
{
/* A JAR path */
final String jarPath = dirURL.getPath().substring( 5, dirURL.getPath().indexOf( '!' ) ); //strip out only the JAR file
/* A JAR path */
final String jarPath = dirURL.getPath().substring( 5, dirURL.getPath().indexOf( '!' ) ); // strip out only
// the JAR file
final JarFile jar = new JarFile( URLDecoder.decode( jarPath, "UTF-8" ) );
try
{
final Enumeration<JarEntry> entries = jar.entries(); //gives ALL entries in jar
final Collection<String> result = new HashSet<String>( INITIAL_RESOURCE_CAPACITY ); //avoid duplicates in case it is a subdirectory
final Enumeration<JarEntry> entries = jar.entries(); // gives ALL entries in jar
final Collection<String> result = new HashSet<String>( INITIAL_RESOURCE_CAPACITY ); // avoid duplicates
// in case it is a
// subdirectory
while( entries.hasMoreElements() )
{
final String name = entries.nextElement().getName();
if( name.startsWith( path ) )
{ //filter according to the path
{ // filter according to the path
String entry = name.substring( path.length() );
final int checkSubDir = entry.indexOf( '/' );
if( checkSubDir >= 0 )