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
+52 -33
View File
@@ -83,17 +83,16 @@ import appeng.integration.abstraction.INEI;
public abstract class AEBaseGui extends GuiContainer
{
public static boolean switchingGuis;
protected final List<InternalSlotME> meSlots = new LinkedList<InternalSlotME>();
private static boolean switchingGuis;
private final List<InternalSlotME> meSlots = new LinkedList<InternalSlotME>();
// drag y
final Set<Slot> drag_click = new HashSet<Slot>();
final AppEngRenderItem aeRenderItem = new AppEngRenderItem();
protected GuiScrollbar myScrollBar = null;
boolean disableShiftClick = false;
Stopwatch dbl_clickTimer = Stopwatch.createStarted();
ItemStack dbl_whichItem;
Slot bl_clicked;
boolean useNEI = false;
private final Set<Slot> drag_click = new HashSet<Slot>();
private final AppEngRenderItem aeRenderItem = new AppEngRenderItem();
private GuiScrollbar scrollBar = null;
private boolean disableShiftClick = false;
private Stopwatch dbl_clickTimer = Stopwatch.createStarted();
private ItemStack dbl_whichItem;
private Slot bl_clicked;
private boolean subGui;
public AEBaseGui( final Container container )
@@ -161,9 +160,9 @@ public abstract class AEBaseGui extends GuiContainer
super.drawScreen( mouseX, mouseY, btn );
final boolean hasClicked = Mouse.isButtonDown( 0 );
if( hasClicked && this.myScrollBar != null )
if( hasClicked && this.scrollBar != null )
{
this.myScrollBar.click( this, mouseX - this.guiLeft, mouseY - this.guiTop );
this.scrollBar.click( this, mouseX - this.guiLeft, mouseY - this.guiTop );
}
for( final Object c : this.buttonList )
@@ -289,9 +288,9 @@ public abstract class AEBaseGui extends GuiContainer
final int oy = this.guiTop; // (height - ySize) / 2;
GL11.glColor4f( 1.0F, 1.0F, 1.0F, 1.0F );
if( this.myScrollBar != null )
if( this.scrollBar != null )
{
this.myScrollBar.draw( this );
this.scrollBar.draw( this );
}
this.drawFG( ox, oy, x, y );
@@ -317,14 +316,14 @@ public abstract class AEBaseGui extends GuiContainer
{
if( fs.isEnabled() )
{
this.drawTexturedModalRect( ox + fs.xDisplayPosition - 1, oy + fs.yDisplayPosition - 1, fs.srcX - 1, fs.srcY - 1, 18, 18 );
this.drawTexturedModalRect( ox + fs.xDisplayPosition - 1, oy + fs.yDisplayPosition - 1, fs.getSourceX() - 1, fs.getSourceY() - 1, 18, 18 );
}
else
{
GL11.glPushAttrib( GL11.GL_ALL_ATTRIB_BITS );
GL11.glColor4f( 1.0F, 1.0F, 1.0F, 0.4F );
GL11.glEnable( GL11.GL_BLEND );
this.drawTexturedModalRect( ox + fs.xDisplayPosition - 1, oy + fs.yDisplayPosition - 1, fs.srcX - 1, fs.srcY - 1, 18, 18 );
this.drawTexturedModalRect( ox + fs.xDisplayPosition - 1, oy + fs.yDisplayPosition - 1, fs.getSourceX() - 1, fs.getSourceY() - 1, 18, 18 );
GL11.glColor4f( 1.0F, 1.0F, 1.0F, 1.0F );
GL11.glPopAttrib();
}
@@ -490,7 +489,7 @@ public abstract class AEBaseGui extends GuiContainer
if( action != null )
{
final PacketInventoryAction p = new PacketInventoryAction( action, slot.getSlotIndex(), ( (SlotDisconnected) slot ).mySlot.id );
final PacketInventoryAction p = new PacketInventoryAction( action, slot.getSlotIndex(), ( (SlotDisconnected) slot ).getSlot().getId() );
NetworkHandler.instance.sendToServer( p );
}
@@ -680,13 +679,13 @@ public abstract class AEBaseGui extends GuiContainer
final int y = this.height - Mouse.getEventY() * this.height / this.mc.displayHeight - 1;
this.mouseWheelEvent( x, y, i / Math.abs( i ) );
}
else if( i != 0 && this.myScrollBar != null )
else if( i != 0 && this.scrollBar != null )
{
this.myScrollBar.wheel( i );
this.scrollBar.wheel( i );
}
}
protected void mouseWheelEvent( final int x, final int y, final int wheel )
private void mouseWheelEvent( final int x, final int y, final int wheel )
{
final Slot slot = this.getSlot( x, y );
if( slot instanceof SlotME )
@@ -744,22 +743,17 @@ public abstract class AEBaseGui extends GuiContainer
{
if( this.inventorySlots instanceof AEBaseContainer )
{
return ( (AEBaseContainer) this.inventorySlots ).customName != null;
return ( (AEBaseContainer) this.inventorySlots ).getCustomName() != null;
}
return false;
}
private String getInventoryName()
{
return ( (AEBaseContainer) this.inventorySlots ).customName;
return ( (AEBaseContainer) this.inventorySlots ).getCustomName();
}
public void a( final Slot s )
{
this.drawSlot( s );
}
public void drawSlot( final Slot s )
private void drawSlot( final Slot s )
{
if( s instanceof SlotME )
{
@@ -779,7 +773,7 @@ public abstract class AEBaseGui extends GuiContainer
this.zLevel = 0.0F;
itemRender.zLevel = 0.0F;
this.aeRenderItem.aeStack = ( (SlotME) s ).getAEStack();
this.aeRenderItem.setAeStack( ( (SlotME) s ).getAEStack() );
this.safeDrawSlot( s );
}
@@ -841,7 +835,7 @@ public abstract class AEBaseGui extends GuiContainer
if( is != null && s instanceof AppEngSlot )
{
if( ( (AppEngSlot) s ).isValid == hasCalculatedValidness.NotAvailable )
if( ( (AppEngSlot) s ).getIsValid() == hasCalculatedValidness.NotAvailable )
{
boolean isValid = s.isItemValid( is ) || s instanceof SlotOutput || s instanceof AppEngCraftingSlot || s instanceof SlotDisabled || s instanceof SlotInaccessible || s instanceof SlotFake || s instanceof SlotRestrictedInput || s instanceof SlotDisconnected;
if( isValid && s instanceof SlotRestrictedInput )
@@ -855,10 +849,10 @@ public abstract class AEBaseGui extends GuiContainer
AELog.error( err );
}
}
( (AppEngSlot) s ).isValid = isValid ? hasCalculatedValidness.Valid : hasCalculatedValidness.Invalid;
( (AppEngSlot) s ).setIsValid( isValid ? hasCalculatedValidness.Valid : hasCalculatedValidness.Invalid );
}
if( ( (AppEngSlot) s ).isValid == hasCalculatedValidness.Invalid )
if( ( (AppEngSlot) s ).getIsValid() == hasCalculatedValidness.Invalid )
{
this.zLevel = 100.0F;
itemRender.zLevel = 100.0F;
@@ -874,7 +868,7 @@ public abstract class AEBaseGui extends GuiContainer
if( s instanceof AppEngSlot )
{
( (AppEngSlot) s ).isDisplay = true;
( (AppEngSlot) s ).setDisplay( true );
this.safeDrawSlot( s );
}
else
@@ -933,4 +927,29 @@ public abstract class AEBaseGui extends GuiContainer
{
this.drawSlot( s );
}
protected GuiScrollbar getScrollBar()
{
return this.scrollBar;
}
protected void setScrollBar( final GuiScrollbar myScrollBar )
{
this.scrollBar = myScrollBar;
}
protected List<InternalSlotME> getMeSlots()
{
return this.meSlots;
}
public static final synchronized boolean isSwitchingGuis()
{
return switchingGuis;
}
public static final synchronized void setSwitchingGuis( final boolean switchingGuis )
{
AEBaseGui.switchingGuis = switchingGuis;
}
}