Mass-applied source clean-up

This commit is contained in:
Emmanuel BENOîT 2016-07-22 10:02:29 +02:00
parent 70e312131f
commit 639884accd
23 changed files with 46 additions and 48 deletions

View file

@ -47,7 +47,7 @@ public class Mmm
@Mod.EventHandler @Mod.EventHandler
public void postInit( FMLPostInitializationEvent event ) public void postInit( final FMLPostInitializationEvent event )
{ {
Mmm.proxy.postInit( event ); Mmm.proxy.postInit( event );
} }

View file

@ -13,12 +13,13 @@ import net.minecraftforge.fml.common.registry.GameRegistry;
public class FHelpers public class FHelpers
{ {
public static ItemFood makeBasicMeal( int amount , float saturation , boolean wolfFood , String... name ) public static ItemFood makeBasicMeal( final int amount , final float saturation , final boolean wolfFood ,
final String... name )
{ {
final ItemFood item = new ItemFood( amount , saturation , wolfFood ); final ItemFood item = new ItemFood( amount , saturation , wolfFood );
item.setCreativeTab( CreativeTabs.FOOD ); item.setCreativeTab( CreativeTabs.FOOD );
String[] fullName = new String[ name.length + 1 ]; final String[] fullName = new String[ name.length + 1 ];
fullName[ 0 ] = "food"; fullName[ 0 ] = "food";
System.arraycopy( name , 0 , fullName , 1 , name.length ); System.arraycopy( name , 0 , fullName , 1 , name.length );
CRegistry.setIdentifiers( item , fullName ); CRegistry.setIdentifiers( item , fullName );

View file

@ -47,12 +47,12 @@ public class FIngredients
GameRegistry.addShapelessRecipe( new ItemStack( this.DOUGH ) , // GameRegistry.addShapelessRecipe( new ItemStack( this.DOUGH ) , //
this.FLOUR , Items.WATER_BUCKET , MmmMaterials.ITEM.ROCK_SALT ); this.FLOUR , Items.WATER_BUCKET , MmmMaterials.ITEM.ROCK_SALT );
GameRegistry.addShapedRecipe( new ItemStack( GLASS_JAR , 16 ) , // GameRegistry.addShapedRecipe( new ItemStack( this.GLASS_JAR , 16 ) , //
"G G" , // "G G" , //
"G G" , // "G G" , //
"GGG" , // "GGG" , //
'G' , Blocks.GLASS ); 'G' , Blocks.GLASS );
GameRegistry.addShapedRecipe( new ItemStack( GLASS_JAR , 16 ) , // GameRegistry.addShapedRecipe( new ItemStack( this.GLASS_JAR , 16 ) , //
"G G" , // "G G" , //
"G G" , // "G G" , //
"GGG" , // "GGG" , //

View file

@ -15,13 +15,13 @@ public enum E_MItemType {
public final Class< ? > extraInfoType; public final Class< ? > extraInfoType;
private E_MItemType( String path ) private E_MItemType( final String path )
{ {
this( path , Object.class ); this( path , Object.class );
} }
private E_MItemType( String path , Class< ? > extraInfoType ) private E_MItemType( final String path , final Class< ? > extraInfoType )
{ {
this.path = path; this.path = path;
this.extraInfoType = extraInfoType; this.extraInfoType = extraInfoType;

View file

@ -52,7 +52,8 @@ public class MBlockTypes
} ); } );
} }
{ {
WOOD = new MBlockType( "WOOD" , ( bs ) -> LOG.matches( bs ) || PLANKS.matches( bs ) ); WOOD = new MBlockType( "WOOD" ,
( bs ) -> MBlockTypes.LOG.matches( bs ) || MBlockTypes.PLANKS.matches( bs ) );
} }
{ {
final HashSet< Block > builtinOres = new HashSet<>( ); final HashSet< Block > builtinOres = new HashSet<>( );

View file

@ -55,7 +55,7 @@ public class MItem
} }
public < T > T getExtraInfo( Class< T > cls ) public < T > T getExtraInfo( final Class< T > cls )
{ {
return cls.cast( this.extraInfo ); return cls.cast( this.extraInfo );
} }

View file

@ -51,7 +51,7 @@ public class MMetal
this.NUGGET = nugget; this.NUGGET = nugget;
if ( ingot instanceof MItem ) { if ( ingot instanceof MItem ) {
MItem miIngot = (MItem) ingot; final MItem miIngot = (MItem) ingot;
if ( miIngot.itemType != E_MItemType.INGOT ) { if ( miIngot.itemType != E_MItemType.INGOT ) {
throw new IllegalArgumentException( "invalid ingot item" ); throw new IllegalArgumentException( "invalid ingot item" );
} }
@ -59,7 +59,7 @@ public class MMetal
} }
if ( nugget instanceof MItem ) { if ( nugget instanceof MItem ) {
MItem miNugget = (MItem) nugget; final MItem miNugget = (MItem) nugget;
if ( miNugget.itemType != E_MItemType.NUGGET ) { if ( miNugget.itemType != E_MItemType.NUGGET ) {
throw new IllegalArgumentException( "invalid nugget item" ); throw new IllegalArgumentException( "invalid nugget item" );
} }

View file

@ -88,7 +88,7 @@ public class MOre
this.dropItems = item; this.dropItems = item;
this.dropMeta = meta; this.dropMeta = meta;
if ( item instanceof MItem ) { if ( item instanceof MItem ) {
MItem oreItem = (MItem) item; final MItem oreItem = (MItem) item;
if ( oreItem.itemType != E_MItemType.ORE ) { if ( oreItem.itemType != E_MItemType.ORE ) {
throw new IllegalArgumentException( "ore item expected" ); throw new IllegalArgumentException( "ore item expected" );
} }

View file

@ -45,7 +45,7 @@ public class MTraps
public < T extends Block & I_TrapBlock > T register( final T block ) public < T extends Block & I_TrapBlock > T register( final T block )
{ {
Block asMcBlock = (Block) block; final Block asMcBlock = block;
for ( final IBlockState state : block.getReplacedBlocks( ) ) { for ( final IBlockState state : block.getReplacedBlocks( ) ) {
this.traps.put( state , block ); this.traps.put( state , block );
this.trapTypes.put( state , block.getTrapType( ) ); this.trapTypes.put( state , block.getTrapType( ) );

View file

@ -229,10 +229,10 @@ public class MTree
CRegistry.setFuel( sapling , this.baseFlammability * 30 ); CRegistry.setFuel( sapling , this.baseFlammability * 30 );
} }
OreDictionary.registerOre( "logWood" , LOG ); OreDictionary.registerOre( "logWood" , this.LOG );
OreDictionary.registerOre( "plankWood" , PLANKS ); OreDictionary.registerOre( "plankWood" , this.PLANKS );
OreDictionary.registerOre( "treeLeaves" , LEAVES ); OreDictionary.registerOre( "treeLeaves" , this.LEAVES );
OreDictionary.registerOre( "treeSapling" , SAPLING ); OreDictionary.registerOre( "treeSapling" , this.SAPLING );
CRegistry.addRecipeRegistrar( this ); CRegistry.addRecipeRegistrar( this );
return this; return this;

View file

@ -39,7 +39,7 @@ public class PPlantsHelper
{ {
float total = 1.0f; float total = 1.0f;
final BlockPos blockpos = pos.down( ); final BlockPos blockpos = pos.down( );
for ( int xo = -1 ; xo <= 1 ; ++xo ) { for ( int xo = -1 ; xo <= 1 ; ++xo ) {
for ( int zo = -1 ; zo <= 1 ; ++zo ) { for ( int zo = -1 ; zo <= 1 ; ++zo ) {
float weight = 0f; float weight = 0f;
@ -58,12 +58,12 @@ public class PPlantsHelper
total += weight; total += weight;
} }
} }
final BlockPos bpNorth = pos.north( ); final BlockPos bpNorth = pos.north( );
final BlockPos bpSouth = pos.south( ); final BlockPos bpSouth = pos.south( );
final BlockPos bpWest = pos.west( ); final BlockPos bpWest = pos.west( );
final BlockPos bpEast = pos.east( ); final BlockPos bpEast = pos.east( );
final boolean surroundedEW = blockIn == worldIn.getBlockState( bpWest ).getBlock( ) final boolean surroundedEW = blockIn == worldIn.getBlockState( bpWest ).getBlock( )
|| blockIn == worldIn.getBlockState( bpEast ).getBlock( ); || blockIn == worldIn.getBlockState( bpEast ).getBlock( );
final boolean surroundedNS = blockIn == worldIn.getBlockState( bpNorth ).getBlock( ) final boolean surroundedNS = blockIn == worldIn.getBlockState( bpNorth ).getBlock( )
@ -75,7 +75,7 @@ public class PPlantsHelper
|| blockIn == worldIn.getBlockState( bpWest.south( ) ).getBlock( ) ) { || blockIn == worldIn.getBlockState( bpWest.south( ) ).getBlock( ) ) {
total /= 2f; total /= 2f;
} }
return total; return total;
} }

View file

@ -23,7 +23,7 @@ public class RMapCloningRecipeWrapperFactory
@Override @Override
public List< I_CraftingRecipeWrapper > createWrappers( IRecipe recipe ) public List< I_CraftingRecipeWrapper > createWrappers( final IRecipe recipe )
{ {
return Arrays.asList( new RMapCloningRecipeWrapper( ) ); return Arrays.asList( new RMapCloningRecipeWrapper( ) );
} }

View file

@ -37,8 +37,8 @@ public class RMapExtendingRecipeWrapper
public RMapExtendingRecipeWrapper( ) public RMapExtendingRecipeWrapper( )
{ {
requirements.put( 0 , new ItemStack( Items.FILLED_MAP , 1 , OreDictionary.WILDCARD_VALUE ) , 1 ); this.requirements.put( 0 , new ItemStack( Items.FILLED_MAP , 1 , OreDictionary.WILDCARD_VALUE ) , 1 );
requirements.put( 1 , new ItemStack( Items.PAPER ) , 8 ); this.requirements.put( 1 , new ItemStack( Items.PAPER ) , 8 );
} }

View file

@ -42,11 +42,11 @@ class ROreRecipeHelper
final ItemStack invStack = (ItemStack) input; final ItemStack invStack = (ItemStack) input;
for ( final ItemStack ciStack : combinedInputStacks ) { for ( final ItemStack ciStack : combinedInputStacks ) {
if ( OreDictionary.itemMatches( ciStack , invStack , true ) ) { if ( OreDictionary.itemMatches( ciStack , invStack , true ) ) {
ciStack.stackSize ++; ciStack.stackSize++;
continue OUTER; continue OUTER;
} }
} }
ItemStack ciStack = invStack.copy( ); final ItemStack ciStack = invStack.copy( );
ciStack.stackSize = 1; ciStack.stackSize = 1;
combinedInputStacks.add( ciStack ); combinedInputStacks.add( ciStack );

View file

@ -76,7 +76,7 @@ class RRequirements
@Override @Override
public boolean checkItemStack( final int pos , final ItemStack stack , World world ) public boolean checkItemStack( final int pos , final ItemStack stack , final World world )
{ {
if ( stack != null ) { if ( stack != null ) {
for ( final ItemStack target : this.getItemTypes( pos ) ) { for ( final ItemStack target : this.getItemTypes( pos ) ) {
@ -90,14 +90,14 @@ class RRequirements
@Override @Override
public boolean checkInventory( final IInventory inventory , World world ) public boolean checkInventory( final IInventory inventory , final World world )
{ {
return this.checkInventory( inventory , 1 , world ); return this.checkInventory( inventory , 1 , world );
} }
@Override @Override
public boolean checkInventory( final IInventory inventory , final int amount , World world ) public boolean checkInventory( final IInventory inventory , final int amount , final World world )
{ {
final int nInvItems = inventory.getSizeInventory( ); final int nInvItems = inventory.getSizeInventory( );
for ( int i = 0 ; i < this.quantities.length ; i++ ) { for ( int i = 0 ; i < this.quantities.length ; i++ ) {
@ -119,7 +119,7 @@ class RRequirements
@Override @Override
public int getMaxOutput( final IInventory inventory , World world ) public int getMaxOutput( final IInventory inventory , final World world )
{ {
final int nInvItems = inventory.getSizeInventory( ); final int nInvItems = inventory.getSizeInventory( );
int maxQuantity = Integer.MAX_VALUE; int maxQuantity = Integer.MAX_VALUE;
@ -140,7 +140,7 @@ class RRequirements
@Override @Override
public void removeFromInventory( final IInventory inventory , final int amount , World world ) public void removeFromInventory( final IInventory inventory , final int amount , final World world )
{ {
final int nInvItems = inventory.getSizeInventory( ); final int nInvItems = inventory.getSizeInventory( );
for ( int i = 0 ; i < this.quantities.length ; i++ ) { for ( int i = 0 ; i < this.quantities.length ; i++ ) {

View file

@ -22,13 +22,13 @@ public class RShapedRecipeWrapper
public RShapedRecipeWrapper( final ShapedRecipes recipe ) public RShapedRecipeWrapper( final ShapedRecipes recipe )
{ {
this.recipe = recipe; this.recipe = recipe;
this.requirements = new RRequirements( extractInputs( recipe ) ); this.requirements = new RRequirements( RShapedRecipeWrapper.extractInputs( recipe ) );
} }
private static ArrayList< ItemStack > extractInputs( final ShapedRecipes recipe ) private static ArrayList< ItemStack > extractInputs( final ShapedRecipes recipe )
{ {
ArrayList< ItemStack > inputs = new ArrayList<>( ); final ArrayList< ItemStack > inputs = new ArrayList<>( );
for ( int i = 0 ; i < recipe.recipeWidth ; i++ ) { for ( int i = 0 ; i < recipe.recipeWidth ; i++ ) {
RECIPE: for ( int j = 0 ; j < recipe.recipeHeight ; j++ ) { RECIPE: for ( int j = 0 ; j < recipe.recipeHeight ; j++ ) {
ItemStack itemStack = recipe.recipeItems[ i + j * recipe.recipeWidth ]; ItemStack itemStack = recipe.recipeItems[ i + j * recipe.recipeWidth ];
@ -37,7 +37,7 @@ public class RShapedRecipeWrapper
} }
for ( int k = 0 ; k < inputs.size( ) ; k++ ) { for ( int k = 0 ; k < inputs.size( ) ; k++ ) {
ItemStack input = inputs.get( k ); final ItemStack input = inputs.get( k );
if ( OreDictionary.itemMatches( input , itemStack , true ) ) { if ( OreDictionary.itemMatches( input , itemStack , true ) ) {
input.stackSize++; input.stackSize++;
continue RECIPE; continue RECIPE;
@ -109,12 +109,10 @@ public class RShapedRecipeWrapper
} }
@Override @Override
public I_RecipeRequirements getRequirements( ) public I_RecipeRequirements getRequirements( )
{ {
return this.requirements; return this.requirements;
} }
} }

View file

@ -24,9 +24,9 @@ public class RShapedRecipeWrapperFactory
@Override @Override
public List< I_CraftingRecipeWrapper > createWrappers( IRecipe recipe ) public List< I_CraftingRecipeWrapper > createWrappers( final IRecipe recipe )
{ {
ShapedRecipes r = (ShapedRecipes) recipe; final ShapedRecipes r = (ShapedRecipes) recipe;
if ( r.recipeHeight > 3 || r.recipeWidth > 3 ) { if ( r.recipeHeight > 3 || r.recipeWidth > 3 ) {
return Collections.emptyList( ); return Collections.emptyList( );
} }

View file

@ -1,12 +1,11 @@
package mmm.recipes; package mmm.recipes;
import mmm.core.api.recipes.I_CraftingRecipeWrapperFactory;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import mmm.core.api.recipes.I_CraftingRecipeWrapper; import mmm.core.api.recipes.I_CraftingRecipeWrapper;
import mmm.core.api.recipes.I_CraftingRecipeWrapperFactory;
import net.minecraft.item.crafting.IRecipe; import net.minecraft.item.crafting.IRecipe;
import net.minecraft.item.crafting.ShapelessRecipes; import net.minecraft.item.crafting.ShapelessRecipes;

View file

@ -172,7 +172,7 @@ public class TBAFGui
} else if ( typedChar == 't' || typedChar == 'T' ) { } else if ( typedChar == 't' || typedChar == 'T' ) {
this.tfSearch.setFocused( true ); this.tfSearch.setFocused( true );
return true; return true;
} else if ( keyCode == Keyboard.KEY_LEFT && this.bPrevious.enabled ) { } else if ( keyCode == Keyboard.KEY_LEFT && this.bPrevious.enabled ) {
this.onActionPerformed( this.bPrevious ); this.onActionPerformed( this.bPrevious );
return true; return true;

View file

@ -163,8 +163,7 @@ public abstract class A_UGTabbedContainerScreen< CTYPE extends UGContainer >
final int tabOffsetX = tab * UGui.TAB_WIDTH; final int tabOffsetX = tab * UGui.TAB_WIDTH;
final int tabX = this.guiLeft + tabOffsetX + UGui.TAB_BORDER; final int tabX = this.guiLeft + tabOffsetX + UGui.TAB_BORDER;
final int tabY = this.guiTop - UGui.TAB_HEIGHT + UGui.TAB_BORDER; final int tabY = this.guiTop - UGui.TAB_HEIGHT + UGui.TAB_BORDER;
return mouseX >= tabX && mouseY >= tabY && mouseX <= tabX + UGui.TAB_WIDTH return mouseX >= tabX && mouseY >= tabY && mouseX <= tabX + UGui.TAB_WIDTH && mouseY <= tabY + UGui.TAB_HEIGHT;
&& mouseY <= tabY + UGui.TAB_HEIGHT;
} }

View file

@ -102,9 +102,9 @@ public class UGSlotGroups
} }
public int getGroup( int slotIndex ) public int getGroup( final int slotIndex )
{ {
int nGroups = this.firstSlots.size( ); final int nGroups = this.firstSlots.size( );
for ( int i = 1 ; i < nGroups ; i++ ) { for ( int i = 1 ; i < nGroups ; i++ ) {
if ( slotIndex < this.firstSlots.getInt( i ) ) { if ( slotIndex < this.firstSlots.getInt( i ) ) {
return i - 1; return i - 1;

View file

@ -67,7 +67,7 @@ public class WDefaultGenWatcher
@SubscribeEvent @SubscribeEvent
public void onBiomeDecorate( DecorateBiomeEvent.Post event ) public void onBiomeDecorate( final DecorateBiomeEvent.Post event )
{ {
this.floraGenerator.generate( event.getWorld( ) , event.getRand( ) , event.getPos( ) ); this.floraGenerator.generate( event.getWorld( ) , event.getRand( ) , event.getPos( ) );
} }

View file

@ -66,7 +66,7 @@ public class WGFloraParameters
} }
public WGFloraParameters setPlacementAttempts( int attempts ) public WGFloraParameters setPlacementAttempts( final int attempts )
{ {
if ( attempts < 1 ) { if ( attempts < 1 ) {
throw new IllegalArgumentException( "invalid placement attempts count" ); throw new IllegalArgumentException( "invalid placement attempts count" );
@ -76,7 +76,7 @@ public class WGFloraParameters
} }
public WGFloraParameters setSuccessfulPlacements( int successes ) public WGFloraParameters setSuccessfulPlacements( final int successes )
{ {
if ( successes < 1 ) { if ( successes < 1 ) {
throw new IllegalArgumentException( "invalid successful placement count" ); throw new IllegalArgumentException( "invalid successful placement count" );