Reduces visibility of internal fields/methods

Reduces the visibility of all fields to private and create setters/getters
when necessary. Exceptions are fields with GuiSync as these need to be
public.

Reduces the visibility of internal methods to private/protected/default when possible.
This commit is contained in:
yueh
2015-10-08 15:42:42 +02:00
parent f054bd699b
commit e94a0cfccf
497 changed files with 7865 additions and 6908 deletions
@@ -35,8 +35,8 @@ import appeng.integration.abstraction.IBuildCraftTransport;
public class BCPipeInventory implements IMEInventory<IAEItemStack>
{
final TileEntity te;
final ForgeDirection direction;
private final TileEntity te;
private final ForgeDirection direction;
public BCPipeInventory( TileEntity te, ForgeDirection direction )
{
@@ -52,7 +52,7 @@ public class BetterStorage implements IIntegrationModule, IBetterStorage
{
if( te instanceof ICrateStorage )
{
return new BSCrateStorageAdaptor( te, d );
return new BSCrateStorageAdaptor( te );
}
return null;
}
@@ -192,7 +192,7 @@ public class FMP implements IIntegrationModule, IPartFactory, IPartConverter, IF
TMultiPart p = i.next();
if( p instanceof CableBusPart )
{
return ( (CableBusPart) p ).cb;
return ( (CableBusPart) p ).getCableBus();
}
}
}
@@ -177,7 +177,7 @@ public class NEIAEShapedRecipeHandler extends TemplateRecipeHandler
return RecipeInfo.getOverlayHandler( gui, "crafting2x2" );
}
public boolean isRecipe2x2( int recipe )
private boolean isRecipe2x2( final int recipe )
{
for( PositionedStack stack : this.getIngredientStacks( recipe ) )
{
@@ -195,11 +195,11 @@ public class NEIAEShapedRecipeHandler extends TemplateRecipeHandler
return NEIClientUtils.translate( "recipe.shaped" );
}
public class CachedShapedRecipe extends TemplateRecipeHandler.CachedRecipe
private class CachedShapedRecipe extends TemplateRecipeHandler.CachedRecipe
{
public final List<PositionedStack> ingredients;
public final PositionedStack result;
private final List<PositionedStack> ingredients;
private final PositionedStack result;
public CachedShapedRecipe( ShapedRecipe recipe )
{
@@ -208,7 +208,7 @@ public class NEIAEShapedRecipeHandler extends TemplateRecipeHandler
this.setIngredients( recipe.getWidth(), recipe.getHeight(), recipe.getIngredients() );
}
public void setIngredients( int width, int height, Object[] items )
private void setIngredients( final int width, final int height, final Object[] items )
{
boolean useSingleItems = AEConfig.instance.disableColoredCableRecipesInNEI();
for( int x = 0; x < width; x++ )
@@ -251,7 +251,7 @@ public class NEIAEShapedRecipeHandler extends TemplateRecipeHandler
return this.getCycledIngredients( NEIAEShapedRecipeHandler.this.cycleticks / 20, this.ingredients );
}
public void computeVisuals()
private void computeVisuals()
{
for( PositionedStack p : this.ingredients )
{
@@ -177,7 +177,11 @@ public class NEIAEShapelessRecipeHandler extends TemplateRecipeHandler
return RecipeInfo.getOverlayHandler( gui, "crafting2x2" );
}
<<<<<<< HEAD
public boolean isRecipe2x2( int recipe )
=======
private boolean isRecipe2x2( final int recipe )
>>>>>>> 500fc47... Reduces visibility of internal fields/methods
{
for( PositionedStack stack : this.getIngredientStacks( recipe ) )
{
@@ -195,11 +199,11 @@ public class NEIAEShapelessRecipeHandler extends TemplateRecipeHandler
return NEIClientUtils.translate( "recipe.shapeless" );
}
public class CachedShapelessRecipe extends TemplateRecipeHandler.CachedRecipe
private class CachedShapelessRecipe extends TemplateRecipeHandler.CachedRecipe
{
public final List<PositionedStack> ingredients;
public final PositionedStack result;
private final List<PositionedStack> ingredients;
private final PositionedStack result;
public CachedShapelessRecipe( ShapelessRecipe recipe )
{
@@ -220,7 +224,11 @@ public class NEIAEShapelessRecipeHandler extends TemplateRecipeHandler
return this.getCycledIngredients( NEIAEShapelessRecipeHandler.this.cycleticks / 20, this.ingredients );
}
<<<<<<< HEAD
public void setIngredients( Object[] items )
=======
private void setIngredients( final Object[] items )
>>>>>>> 500fc47... Reduces visibility of internal fields/methods
{
boolean useSingleItems = AEConfig.instance.disableColoredCableRecipesInNEI();
for( int x = 0; x < 3; x++ )
@@ -251,7 +259,7 @@ public class NEIAEShapelessRecipeHandler extends TemplateRecipeHandler
}
}
public void computeVisuals()
private void computeVisuals()
{
for( PositionedStack p : this.ingredients )
{
@@ -44,13 +44,11 @@ import appeng.util.Platform;
public class NEICraftingHandler implements IOverlayHandler
{
final int offsetX;
final int offsetY;
private final int offsetX;
private final int offsetY;
public NEICraftingHandler( int x, int y )
public NEICraftingHandler( final int x, final int y )
{
this.offsetX = x;
this.offsetY = y;
}
@Override
@@ -69,7 +67,7 @@ public class NEICraftingHandler implements IOverlayHandler
}
}
public void overlayRecipe( GuiContainer gui, List<PositionedStack> ingredients, boolean shift )
private void overlayRecipe( GuiContainer gui, List<PositionedStack> ingredients, boolean shift )
{
try
{
@@ -46,8 +46,8 @@ import appeng.items.parts.ItemFacade;
public class NEIFacadeRecipeHandler extends TemplateRecipeHandler
{
final ItemFacade facade;
final IItemDefinition anchorDefinition;
private final ItemFacade facade;
private final IItemDefinition anchorDefinition;
public NEIFacadeRecipeHandler()
{
@@ -176,7 +176,7 @@ public class NEIFacadeRecipeHandler extends TemplateRecipeHandler
return RecipeInfo.getOverlayHandler( gui, "crafting2x2" );
}
public boolean isRecipe2x2( int recipe )
private boolean isRecipe2x2( final int recipe )
{
for( PositionedStack stack : this.getIngredientStacks( recipe ) )
{
@@ -183,12 +183,12 @@ public class NEIGrinderRecipeHandler extends TemplateRecipeHandler
return GuiText.GrindStone.getLocal();
}
public class CachedGrindStoneRecipe extends TemplateRecipeHandler.CachedRecipe
private class CachedGrindStoneRecipe extends TemplateRecipeHandler.CachedRecipe
{
public final List<PositionedStack> ingredients;
public final PositionedStack result;
public String displayChance;
boolean hasOptional = false;
private final List<PositionedStack> ingredients;
private final PositionedStack result;
private String displayChance;
private boolean hasOptional = false;
public CachedGrindStoneRecipe( IGrinderEntry recipe )
{
@@ -231,7 +231,7 @@ public class NEIGrinderRecipeHandler extends TemplateRecipeHandler
return this.getCycledIngredients( NEIGrinderRecipeHandler.this.cycleticks / 20, this.ingredients );
}
public void computeVisuals()
private void computeVisuals()
{
for( PositionedStack p : this.ingredients )
{
@@ -160,11 +160,11 @@ public class NEIInscriberRecipeHandler extends TemplateRecipeHandler
return GuiText.Inscriber.getLocal();
}
public class CachedInscriberRecipe extends TemplateRecipeHandler.CachedRecipe
private class CachedInscriberRecipe extends TemplateRecipeHandler.CachedRecipe
{
public final List<PositionedStack> ingredients;
public final PositionedStack result;
private final List<PositionedStack> ingredients;
private final PositionedStack result;
public CachedInscriberRecipe( IInscriberRecipe recipe )
{
@@ -196,7 +196,7 @@ public class NEIInscriberRecipeHandler extends TemplateRecipeHandler
return this.getCycledIngredients( NEIInscriberRecipeHandler.this.cycleticks / 20, this.ingredients );
}
public void computeVisuals()
private void computeVisuals()
{
for( PositionedStack p : this.ingredients )
{
@@ -181,7 +181,7 @@ public class NEIWorldCraftingHandler implements ICraftingHandler, IUsageHandler
return this;
}
public NEIWorldCraftingHandler newInstance()
private NEIWorldCraftingHandler newInstance()
{
try
{
@@ -37,8 +37,8 @@ public class TerminalCraftingSlotFinder implements IStackPositioner
{
if( ps != null )
{
ps.relx += GuiMEMonitorable.CraftingGridOffsetX;
ps.rely += GuiMEMonitorable.CraftingGridOffsetY;
ps.relx += GuiMEMonitorable.craftingGridOffsetX;
ps.rely += GuiMEMonitorable.craftingGridOffsetY;
}
}
return a;
@@ -21,6 +21,10 @@ package appeng.integration.modules.helpers;
import net.mcft.copy.betterstorage.api.crate.ICrateStorage;
import net.minecraft.item.ItemStack;
<<<<<<< HEAD
=======
>>>>>>> 500fc47... Reduces visibility of internal fields/methods
import appeng.api.config.Actionable;
import appeng.api.networking.security.BaseActionSource;
import appeng.api.storage.IMEInventory;
@@ -34,12 +38,10 @@ import appeng.util.item.AEItemStack;
public class BSCrate implements IMEInventory<IAEItemStack>
{
private final ICrateStorage crateStorage;
private final ForgeDirection side;
public BSCrate( Object object, ForgeDirection d )
public BSCrate( final Object object )
{
this.crateStorage = (ICrateStorage) object;
this.side = d;
}
@Override
@@ -42,7 +42,7 @@ public class BSCrateHandler implements IExternalStorageHandler
{
if( channel == StorageChannel.ITEMS )
{
return new BSCrate( te, ForgeDirection.UNKNOWN );
return new BSCrate( te );
}
return null;
}
@@ -23,6 +23,10 @@ import java.util.Iterator;
import net.mcft.copy.betterstorage.api.crate.ICrateStorage;
import net.minecraft.item.ItemStack;
<<<<<<< HEAD
=======
>>>>>>> 500fc47... Reduces visibility of internal fields/methods
import appeng.api.config.FuzzyMode;
import appeng.api.util.ForgeDirection;
import appeng.util.InventoryAdaptor;
@@ -35,13 +39,11 @@ import appeng.util.iterators.StackToSlotIterator;
public class BSCrateStorageAdaptor extends InventoryAdaptor
{
final ICrateStorage cs;
final ForgeDirection side;
private final ICrateStorage cs;
public BSCrateStorageAdaptor( Object te, ForgeDirection d )
public BSCrateStorageAdaptor( final Object te )
{
this.cs = (ICrateStorage) te;
this.side = d;
}
@Override
@@ -26,10 +26,15 @@ import net.minecraftforge.fml.common.eventhandler.Event;
public class FMPPacketEvent extends Event
{
public final EntityPlayerMP sender;
private final EntityPlayerMP sender;
public FMPPacketEvent( EntityPlayerMP sender )
{
this.sender = sender;
}
public EntityPlayerMP getSender()
{
return this.sender;
}
}
@@ -35,7 +35,7 @@ import appeng.util.item.AEItemStack;
public class FactorizationBarrel implements IMEInventory<IAEItemStack>
{
final IFZ fProxy;
private final IFZ fProxy;
private final TileEntity te;
public FactorizationBarrel( IFZ proxy, TileEntity tile )
@@ -102,12 +102,12 @@ public class FactorizationBarrel implements IMEInventory<IAEItemStack>
return input;
}
public long remainingItemTypes()
private long remainingItemTypes()
{
return this.fProxy.barrelGetItem( this.te ) == null ? 1 : 0;
}
public boolean containsItemType( IAEItemStack i, boolean acceptEmpty )
private boolean containsItemType( final IAEItemStack i, final boolean acceptEmpty )
{
ItemStack currentItem = this.fProxy.barrelGetItem( this.te );
@@ -120,7 +120,7 @@ public class FactorizationBarrel implements IMEInventory<IAEItemStack>
return i.equals( currentItem );
}
public long storedItemCount()
private long storedItemCount()
{
return this.fProxy.barrelGetItemCount( this.te );
}
@@ -36,12 +36,10 @@ import appeng.util.item.AEItemStack;
public class MinefactoryReloadedDeepStorageUnit implements IMEInventory<IAEItemStack>
{
final IDeepStorageUnit dsu;
final TileEntity te;
private final IDeepStorageUnit dsu;
public MinefactoryReloadedDeepStorageUnit( TileEntity ta )
{
this.te = ta;
this.dsu = (IDeepStorageUnit) ta;
}