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
@@ -118,31 +118,31 @@ public enum MaterialType
private final EnumSet<AEFeature> features;
// TextureAtlasSprite for the material.
@SideOnly( Side.CLIENT )
public TextureAtlasSprite IIcon;
public Item itemInstance;
public int damageValue;
private TextureAtlasSprite IIcon;
private Item itemInstance;
private int damageValue;
// stack!
public MaterialStackSrc stackSrc;
private MaterialStackSrc stackSrc;
private String oreName;
private Class<? extends Entity> droppedEntity;
private boolean isRegistered = false;
MaterialType( final int metaValue )
{
this.damageValue = metaValue;
this.setDamageValue( metaValue );
this.features = EnumSet.of( AEFeature.Core );
}
MaterialType( final int metaValue, final AEFeature part )
{
this.damageValue = metaValue;
this.setDamageValue( metaValue );
this.features = EnumSet.of( part );
}
MaterialType( final int metaValue, final AEFeature part, final Class<? extends Entity> c )
{
this.features = EnumSet.of( part );
this.damageValue = metaValue;
this.setDamageValue( metaValue );
this.droppedEntity = c;
EntityRegistry.registerModEntity( this.droppedEntity, this.droppedEntity.getSimpleName(), EntityIds.get( this.droppedEntity ), AppEng.instance(), 16, 4, true );
@@ -151,7 +151,7 @@ public enum MaterialType
MaterialType( final int metaValue, final AEFeature part, final String oreDictionary, final Class<? extends Entity> c )
{
this.features = EnumSet.of( part );
this.damageValue = metaValue;
this.setDamageValue( metaValue );
this.oreName = oreDictionary;
this.droppedEntity = c;
EntityRegistry.registerModEntity( this.droppedEntity, this.droppedEntity.getSimpleName(), EntityIds.get( this.droppedEntity ), AppEng.instance(), 16, 4, true );
@@ -160,16 +160,16 @@ public enum MaterialType
MaterialType( final int metaValue, final AEFeature part, final String oreDictionary )
{
this.features = EnumSet.of( part );
this.damageValue = metaValue;
this.setDamageValue( metaValue );
this.oreName = oreDictionary;
}
public ItemStack stack( final int size )
{
return new ItemStack( this.itemInstance, size, this.damageValue );
return new ItemStack( this.getItemInstance(), size, this.getDamageValue() );
}
public EnumSet<AEFeature> getFeature()
EnumSet<AEFeature> getFeature()
{
return this.features;
}
@@ -179,12 +179,12 @@ public enum MaterialType
return this.oreName;
}
public boolean hasCustomEntity()
boolean hasCustomEntity()
{
return this.droppedEntity != null;
}
public Class<? extends Entity> getCustomEntityClass()
Class<? extends Entity> getCustomEntityClass()
{
return this.droppedEntity;
}
@@ -194,9 +194,49 @@ public enum MaterialType
return this.isRegistered;
}
public void markReady()
void markReady()
{
this.isRegistered = true;
}
public int getDamageValue()
{
return this.damageValue;
}
void setDamageValue( final int damageValue )
{
this.damageValue = damageValue;
}
public Item getItemInstance()
{
return this.itemInstance;
}
void setItemInstance( final Item itemInstance )
{
this.itemInstance = itemInstance;
}
TextureAtlasSprite getIIcon()
{
return this.IIcon;
}
void setIIcon( final TextureAtlasSprite iIcon )
{
this.IIcon = iIcon;
}
MaterialStackSrc getStackSrc()
{
return this.stackSrc;
}
void setStackSrc( final MaterialStackSrc stackSrc )
{
this.stackSrc = stackSrc;
}
}
@@ -71,9 +71,10 @@ import appeng.util.Platform;
public final class MultiItem extends AEBaseItem implements IStorageComponent, IUpgradeModule
{
public static final int KILO_SCALAR = 1024;
public static MultiItem instance;
private static final int KILO_SCALAR = 1024;
private final Map<Integer, MaterialType> dmgToMaterial = new HashMap<Integer, MaterialType>();
public MultiItem()
@@ -146,7 +147,7 @@ public final class MultiItem extends AEBaseItem implements IStorageComponent, IU
{
if( type != MaterialType.InvalidType )
{
proxy.setIcon( this, type.damageValue, name + "." + type.name() );
proxy.setIcon( this, type.getDamageValue(), name + "." + type.name() );
}
}
}
@@ -193,13 +194,13 @@ public final class MultiItem extends AEBaseItem implements IStorageComponent, IU
enabled = enabled && AEConfig.instance.isFeatureEnabled( f );
}
mat.stackSrc = new MaterialStackSrc( mat );
mat.setStackSrc( new MaterialStackSrc( mat ) );
if( enabled )
{
mat.itemInstance = this;
mat.setItemInstance( this );
mat.markReady();
final int newMaterialNum = mat.damageValue;
final int newMaterialNum = mat.getDamageValue();
if( this.dmgToMaterial.get( newMaterialNum ) == null )
{
@@ -212,7 +213,7 @@ public final class MultiItem extends AEBaseItem implements IStorageComponent, IU
}
}
return mat.stackSrc;
return mat.getStackSrc();
}
public void makeUnique()
@@ -256,13 +257,13 @@ public final class MultiItem extends AEBaseItem implements IStorageComponent, IU
}
else
{
if( mt.itemInstance == this )
if( mt.getItemInstance() == this )
{
this.dmgToMaterial.remove( mt.damageValue );
this.dmgToMaterial.remove( mt.getDamageValue() );
}
mt.itemInstance = replacement.getItem();
mt.damageValue = replacement.getItemDamage();
mt.setItemInstance( replacement.getItem() );
mt.setDamageValue( replacement.getItemDamage() );
}
}
}
@@ -290,9 +291,9 @@ public final class MultiItem extends AEBaseItem implements IStorageComponent, IU
for( final MaterialType mat : types )
{
if( mat.damageValue >= 0 && mat.isRegistered() && mat.itemInstance == this )
if( mat.getDamageValue() >= 0 && mat.isRegistered() && mat.getItemInstance() == this )
{
itemStacks.add( new ItemStack( this, 1, mat.damageValue ) );
itemStacks.add( new ItemStack( this, 1, mat.getDamageValue() ) );
}
}
}