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
@@ -56,7 +56,7 @@ public class GuiInterfaceTerminal extends AEBaseGui
private static final int LINES_ON_PAGE = 6;
// TODO: copied from GuiMEMonitorable. It looks not changed, maybe unneeded?
final int offsetX = 9;
private final int offsetX = 9;
private final HashMap<Long, ClientDCInternalInv> byId = new HashMap<Long, ClientDCInternalInv>();
private final HashMultimap<String, ClientDCInternalInv> byName = HashMultimap.create();
@@ -71,7 +71,9 @@ public class GuiInterfaceTerminal extends AEBaseGui
public GuiInterfaceTerminal( final InventoryPlayer inventoryPlayer, final PartInterfaceTerminal te )
{
super( new ContainerInterfaceTerminal( inventoryPlayer, te ) );
this.myScrollBar = new GuiScrollbar();
final GuiScrollbar scrollbar = new GuiScrollbar();
this.setScrollBar( scrollbar );
this.xSize = 195;
this.ySize = 222;
}
@@ -81,9 +83,9 @@ public class GuiInterfaceTerminal extends AEBaseGui
{
super.initGui();
this.myScrollBar.setLeft( 175 );
this.myScrollBar.setHeight( 106 );
this.myScrollBar.setTop( 18 );
this.getScrollBar().setLeft( 175 );
this.getScrollBar().setHeight( 106 );
this.getScrollBar().setTop( 18 );
this.searchField = new MEGuiTextField( this.fontRendererObj, this.guiLeft + Math.max( 104, this.offsetX ), this.guiTop + 4, 65, 12 );
this.searchField.setEnableBackgroundDrawing( false );
@@ -99,7 +101,7 @@ public class GuiInterfaceTerminal extends AEBaseGui
this.fontRendererObj.drawString( this.getGuiDisplayName( GuiText.InterfaceTerminal.getLocal() ), 8, 6, 4210752 );
this.fontRendererObj.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
final int ex = this.myScrollBar.getCurrentScroll();
final int ex = this.getScrollBar().getCurrentScroll();
final Iterator<Object> o = this.inventorySlots.inventorySlots.iterator();
while( o.hasNext() )
@@ -117,7 +119,7 @@ public class GuiInterfaceTerminal extends AEBaseGui
if( lineObj instanceof ClientDCInternalInv )
{
final ClientDCInternalInv inv = (ClientDCInternalInv) lineObj;
for( int z = 0; z < inv.inv.getSizeInventory(); z++ )
for( int z = 0; z < inv.getInventory().getSizeInventory(); z++ )
{
this.inventorySlots.inventorySlots.add( new SlotDisconnected( inv, z, z * 18 + 8, 1 + offset ) );
}
@@ -163,7 +165,7 @@ public class GuiInterfaceTerminal extends AEBaseGui
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, this.xSize, this.ySize );
int offset = 17;
final int ex = this.myScrollBar.getCurrentScroll();
final int ex = this.getScrollBar().getCurrentScroll();
for( int x = 0; x < LINES_ON_PAGE && ex + x < this.lines.size(); x++ )
{
@@ -173,7 +175,7 @@ public class GuiInterfaceTerminal extends AEBaseGui
final ClientDCInternalInv inv = (ClientDCInternalInv) lineObj;
GL11.glColor4f( 1, 1, 1, 1 );
final int width = inv.inv.getSizeInventory() * 18;
final int width = inv.getInventory().getSizeInventory() * 18;
this.drawTexturedModalRect( offsetX + 7, offsetY + offset, 7, 139, width, 18 );
}
offset += 18;
@@ -225,12 +227,12 @@ public class GuiInterfaceTerminal extends AEBaseGui
final NBTTagCompound invData = in.getCompoundTag( key );
final ClientDCInternalInv current = this.getById( id, invData.getLong( "sortBy" ), invData.getString( "un" ) );
for( int x = 0; x < current.inv.getSizeInventory(); x++ )
for( int x = 0; x < current.getInventory().getSizeInventory(); x++ )
{
final String which = Integer.toString( x );
if( invData.hasKey( which ) )
{
current.inv.setInventorySlotContents( x, ItemStack.loadItemStackFromNBT( invData.getCompoundTag( which ) ) );
current.getInventory().setInventorySlotContents( x, ItemStack.loadItemStackFromNBT( invData.getCompoundTag( which ) ) );
}
}
}
@@ -277,7 +279,7 @@ public class GuiInterfaceTerminal extends AEBaseGui
// Search if the current inventory holds a pattern containing the search term.
if( !found && !searchFilterLowerCase.isEmpty() )
{
for( final ItemStack itemStack : entry.inv )
for( final ItemStack itemStack : entry.getInventory() )
{
found = this.itemStackMatchesSearchTerm( itemStack, searchFilterLowerCase );
if( found )
@@ -318,7 +320,7 @@ public class GuiInterfaceTerminal extends AEBaseGui
this.lines.addAll( clientInventories );
}
this.myScrollBar.setRange( 0, this.lines.size() - LINES_ON_PAGE, 2 );
this.getScrollBar().setRange( 0, this.lines.size() - LINES_ON_PAGE, 2 );
}
private boolean itemStackMatchesSearchTerm( final ItemStack itemStack, final String searchTerm )