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 1ea48fb389
commit 500fc47490
463 changed files with 5670 additions and 3757 deletions
+41 -16
View File
@@ -78,12 +78,12 @@ import appeng.util.SettingsFrom;
public abstract class AEBasePart implements IPart, IGridProxyable, IActionHost, IUpgradeableHost, ICustomNameObject
{
protected final AENetworkProxy proxy;
protected final ItemStack is;
protected ISimplifiedBundle renderCache = null;
protected TileEntity tile = null;
protected IPartHost host = null;
protected ForgeDirection side = null;
private final AENetworkProxy proxy;
private final ItemStack is;
private ISimplifiedBundle renderCache = null;
private TileEntity tile = null;
private IPartHost host = null;
private ForgeDirection side = null;
public AEBasePart( final ItemStack is )
{
@@ -114,13 +114,13 @@ public abstract class AEBasePart implements IPart, IGridProxyable, IActionHost,
@Override
public void securityBreak()
{
if( this.is.stackSize > 0 )
if( this.getItemStack().stackSize > 0 )
{
final List<ItemStack> items = new ArrayList<ItemStack>();
items.add( this.is.copy() );
this.host.removePart( this.side, false );
items.add( this.getItemStack().copy() );
this.host.removePart( this.getSide(), false );
Platform.spawnDrops( this.tile.getWorldObj(), this.tile.xCoord, this.tile.yCoord, this.tile.zCoord, items );
this.is.stackSize = 0;
this.getItemStack().stackSize = 0;
}
}
@@ -194,7 +194,7 @@ public abstract class AEBasePart implements IPart, IGridProxyable, IActionHost,
@Override
public String getCustomName()
{
return this.is.getDisplayName();
return this.getItemStack().getDisplayName();
}
@Override
@@ -208,12 +208,12 @@ public abstract class AEBasePart implements IPart, IGridProxyable, IActionHost,
@Override
public boolean hasCustomName()
{
return this.is.hasDisplayName();
return this.getItemStack().hasDisplayName();
}
public void addEntityCrashInfo( final CrashReportCategory crashreportcategory )
{
crashreportcategory.addCrashSection( "Part Side", this.side );
crashreportcategory.addCrashSection( "Part Side", this.getSide() );
}
@Override
@@ -316,7 +316,7 @@ public abstract class AEBasePart implements IPart, IGridProxyable, IActionHost,
@Override
public void setPartHostInfo( final ForgeDirection side, final IPartHost host, final TileEntity tile )
{
this.side = side;
this.setSide( side );
this.tile = tile;
this.host = host;
}
@@ -376,7 +376,7 @@ public abstract class AEBasePart implements IPart, IGridProxyable, IActionHost,
* @param from source of settings
* @param compound compound of source
*/
public void uploadSettings( final SettingsFrom from, final NBTTagCompound compound )
private void uploadSettings( final SettingsFrom from, final NBTTagCompound compound )
{
if( compound != null )
{
@@ -413,7 +413,7 @@ public abstract class AEBasePart implements IPart, IGridProxyable, IActionHost,
*
* @return compound of source
*/
public NBTTagCompound downloadSettings( final SettingsFrom from )
private NBTTagCompound downloadSettings( final SettingsFrom from )
{
final NBTTagCompound output = new NBTTagCompound();
@@ -549,4 +549,29 @@ public abstract class AEBasePart implements IPart, IGridProxyable, IActionHost,
{
return null;
}
public ForgeDirection getSide()
{
return this.side;
}
private void setSide( final ForgeDirection side )
{
this.side = side;
}
public ItemStack getItemStack()
{
return this.is;
}
public ISimplifiedBundle getRenderCache()
{
return this.renderCache;
}
public void setRenderCache( final ISimplifiedBundle renderCache )
{
this.renderCache = renderCache;
}
}