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
@@ -29,14 +29,15 @@ import appeng.util.ItemSorters;
public class ClientDCInternalInv implements Comparable<ClientDCInternalInv>
{
public final String unlocalizedName;
public final AppEngInternalInventory inv;
public final long id;
public final long sortBy;
private final String unlocalizedName;
private final AppEngInternalInventory inventory;
private final long id;
private final long sortBy;
public ClientDCInternalInv( final int size, final long id, final long sortBy, final String unlocalizedName )
{
this.inv = new AppEngInternalInventory( null, size );
this.inventory = new AppEngInternalInventory( null, size );
this.unlocalizedName = unlocalizedName;
this.id = id;
this.sortBy = sortBy;
@@ -57,4 +58,14 @@ public class ClientDCInternalInv implements Comparable<ClientDCInternalInv>
{
return ItemSorters.compareLong( this.sortBy, o.sortBy );
}
public AppEngInternalInventory getInventory()
{
return this.inventory;
}
public long getId()
{
return this.id;
}
}
@@ -26,9 +26,9 @@ import appeng.api.storage.data.IAEItemStack;
public class InternalSlotME
{
public final int offset;
public final int xPos;
public final int yPos;
private final int offset;
private final int xPos;
private final int yPos;
private final ItemRepo repo;
public InternalSlotME( final ItemRepo def, final int offset, final int displayX, final int displayY )
@@ -39,18 +39,28 @@ public class InternalSlotME
this.yPos = displayY;
}
public ItemStack getStack()
ItemStack getStack()
{
return this.repo.getItem( this.offset );
}
public IAEItemStack getAEStack()
IAEItemStack getAEStack()
{
return this.repo.getReferenceItem( this.offset );
}
public boolean hasPower()
boolean hasPower()
{
return this.repo.hasPower();
}
int getxPosition()
{
return this.xPos;
}
int getyPosition()
{
return this.yPos;
}
}
+26 -4
View File
@@ -25,6 +25,8 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.regex.Pattern;
import javax.annotation.Nonnull;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.relauncher.ReflectionHelper;
import appeng.api.AEApi;
@@ -53,10 +55,10 @@ public class ItemRepo
private final IScrollSource src;
private final ISortSource sortSrc;
public int rowSize = 9;
private int rowSize = 9;
public String searchString = "";
IPartitionList<IAEItemStack> myPartitionList;
private String searchString = "";
private IPartitionList<IAEItemStack> myPartitionList;
private String innerSearch = "";
private String NEIWord = null;
private boolean hasPower;
@@ -216,7 +218,7 @@ public class ItemRepo
final Enum SortBy = this.sortSrc.getSortBy();
final Enum SortDir = this.sortSrc.getSortDir();
ItemSorters.Direction = (appeng.api.config.SortDir) SortDir;
ItemSorters.setDirection( (appeng.api.config.SortDir) SortDir );
ItemSorters.init();
if( SortBy == SortOrder.MOD )
@@ -285,4 +287,24 @@ public class ItemRepo
{
this.hasPower = hasPower;
}
public int getRowSize()
{
return this.rowSize;
}
public void setRowSize( final int rowSize )
{
this.rowSize = rowSize;
}
public String getSearchString()
{
return this.searchString;
}
public void setSearchString( @Nonnull final String searchString )
{
this.searchString = searchString;
}
}
@@ -30,11 +30,11 @@ import appeng.util.Platform;
public class SlotDisconnected extends AppEngSlot
{
public final ClientDCInternalInv mySlot;
private final ClientDCInternalInv mySlot;
public SlotDisconnected( final ClientDCInternalInv me, final int which, final int x, final int y )
{
super( me.inv, which, x, y );
super( me.getInventory(), which, x, y );
this.mySlot = me;
}
@@ -103,4 +103,9 @@ public class SlotDisconnected extends AppEngSlot
{
return false;
}
public ClientDCInternalInv getSlot()
{
return this.mySlot;
}
}
+2 -2
View File
@@ -30,11 +30,11 @@ import appeng.api.storage.data.IAEItemStack;
public class SlotME extends Slot
{
public final InternalSlotME mySlot;
private final InternalSlotME mySlot;
public SlotME( final InternalSlotME me )
{
super( null, 0, me.xPos, me.yPos );
super( null, 0, me.getxPosition(), me.getyPosition() );
this.mySlot = me;
}