this access

This commit is contained in:
thatsIch
2015-01-01 21:17:00 +01:00
parent eed0c11d7f
commit 8920d949d2
28 changed files with 133 additions and 133 deletions
@@ -30,27 +30,27 @@ public enum AccessRestriction
private final int permissionBit; private final int permissionBit;
private AccessRestriction(int v) { private AccessRestriction(int v) {
permissionBit = v; this.permissionBit = v;
} }
public boolean hasPermission(AccessRestriction ar) public boolean hasPermission(AccessRestriction ar)
{ {
return (permissionBit & ar.permissionBit) == ar.permissionBit; return ( this.permissionBit & ar.permissionBit) == ar.permissionBit;
} }
public AccessRestriction restrictPermissions(AccessRestriction ar) public AccessRestriction restrictPermissions(AccessRestriction ar)
{ {
return getPermByBit( permissionBit & ar.permissionBit); return this.getPermByBit( this.permissionBit & ar.permissionBit);
} }
public AccessRestriction addPermissions(AccessRestriction ar) public AccessRestriction addPermissions(AccessRestriction ar)
{ {
return getPermByBit( permissionBit | ar.permissionBit); return this.getPermByBit( this.permissionBit | ar.permissionBit);
} }
public AccessRestriction removePermissions(AccessRestriction ar) public AccessRestriction removePermissions(AccessRestriction ar)
{ {
return getPermByBit( permissionBit & (~ar.permissionBit) ); return this.getPermByBit( this.permissionBit & (~ar.permissionBit) );
} }
private AccessRestriction getPermByBit(int bit) private AccessRestriction getPermByBit(int bit)
@@ -32,13 +32,13 @@ public enum FuzzyMode
final public float percentage; final public float percentage;
private FuzzyMode(float p) { private FuzzyMode(float p) {
percentage = p; this.percentage = p;
breakPoint = p / 100.0f; this.breakPoint = p / 100.0f;
} }
public int calculateBreakPoint(int maxDamage) public int calculateBreakPoint(int maxDamage)
{ {
return (int) ((percentage * maxDamage) / 100.0f); return (int) (( this.percentage * maxDamage) / 100.0f);
} }
} }
@@ -34,11 +34,11 @@ public enum PowerMultiplier
public double multiply(double in) public double multiply(double in)
{ {
return in * multiplier; return in * this.multiplier;
} }
public double divide(double in) public double divide(double in)
{ {
return in / multiplier; return in / this.multiplier;
} }
} }
@@ -33,7 +33,7 @@ public enum PowerUnits
MK("gui.appliedenergistics2.units.mekanism"); // Mekanism - Joules MK("gui.appliedenergistics2.units.mekanism"); // Mekanism - Joules
private PowerUnits(String un) { private PowerUnits(String un) {
unlocalizedName = un; this.unlocalizedName = un;
} }
/** /**
@@ -59,7 +59,7 @@ public enum PowerUnits
*/ */
public double convertTo(PowerUnits target, double value) public double convertTo(PowerUnits target, double value)
{ {
return (value * conversionRatio) / target.conversionRatio; return (value * this.conversionRatio ) / target.conversionRatio;
} }
} }
@@ -56,15 +56,15 @@ public enum SecurityPermissions
*/ */
SECURITY; SECURITY;
final private String unlocalizedName = "gui.appliedenergistics2.security." + name().toLowerCase(); final private String unlocalizedName = "gui.appliedenergistics2.security." + this.name().toLowerCase();
public String getUnlocalizedName() public String getUnlocalizedName()
{ {
return unlocalizedName + ".name"; return this.unlocalizedName + ".name";
} }
public String getUnlocalizedTip() public String getUnlocalizedTip()
{ {
return unlocalizedName + ".tip"; return this.unlocalizedName + ".tip";
} }
} }
+2 -2
View File
@@ -57,13 +57,13 @@ public enum Settings
public EnumSet getPossibleValues() public EnumSet getPossibleValues()
{ {
return values; return this.values;
} }
private Settings(EnumSet set) { private Settings(EnumSet set) {
if ( set == null || set.isEmpty() ) if ( set == null || set.isEmpty() )
throw new RuntimeException( "Invalid configuration." ); throw new RuntimeException( "Invalid configuration." );
values = set; this.values = set;
} }
} }
@@ -44,8 +44,8 @@ public class LocatableEventAnnounce extends Event
final public LocatableEvent change; final public LocatableEvent change;
public LocatableEventAnnounce(ILocatable o, LocatableEvent ev) { public LocatableEventAnnounce(ILocatable o, LocatableEvent ev) {
target = o; this.target = o;
change = ev; this.change = ev;
} }
} }
@@ -33,7 +33,7 @@ public class TransitionResult
public final double energyUsage; public final double energyUsage;
public TransitionResult(boolean _success, double power) { public TransitionResult(boolean _success, double power) {
success = _success; this.success = _success;
energyUsage = power; this.energyUsage = power;
} }
} }
@@ -35,7 +35,7 @@ public class MENetworkChannelChanged extends MENetworkEvent
public final IGridNode node; public final IGridNode node;
public MENetworkChannelChanged(IGridNode n) { public MENetworkChannelChanged(IGridNode n) {
node = n; this.node = n;
} }
} }
@@ -31,7 +31,7 @@ public class MENetworkCraftingCpuChange extends MENetworkEvent
public final IGridNode node; public final IGridNode node;
public MENetworkCraftingCpuChange(IGridNode n) { public MENetworkCraftingCpuChange(IGridNode n) {
node = n; this.node = n;
} }
} }
@@ -33,8 +33,8 @@ public class MENetworkCraftingPatternChange extends MENetworkEvent
public final IGridNode node; public final IGridNode node;
public MENetworkCraftingPatternChange(ICraftingProvider p, IGridNode n) { public MENetworkCraftingPatternChange(ICraftingProvider p, IGridNode n) {
provider = p; this.provider = p;
node = n; this.node = n;
} }
} }
@@ -41,7 +41,7 @@ public class MENetworkEvent
*/ */
public void cancel() public void cancel()
{ {
canceled = true; this.canceled = true;
} }
/** /**
@@ -51,7 +51,7 @@ public class MENetworkEvent
*/ */
public boolean isCanceled() public boolean isCanceled()
{ {
return canceled; return this.canceled;
} }
/** /**
@@ -61,7 +61,7 @@ public class MENetworkEvent
*/ */
public int getVisitedObjects() public int getVisitedObjects()
{ {
return visited; return this.visited;
} }
/** /**
@@ -71,6 +71,6 @@ public class MENetworkEvent
*/ */
public void setVisitedObjects(int v) public void setVisitedObjects(int v)
{ {
visited = v; this.visited = v;
} }
} }
@@ -38,7 +38,7 @@ public class MENetworkPowerIdleChange extends MENetworkEvent
public final IGridNode node; public final IGridNode node;
public MENetworkPowerIdleChange(IGridNode nodeThatChanged) { public MENetworkPowerIdleChange(IGridNode nodeThatChanged) {
node = nodeThatChanged; this.node = nodeThatChanged;
} }
} }
@@ -54,8 +54,8 @@ public class MENetworkPowerStorage extends MENetworkEvent
public final PowerEventType type; public final PowerEventType type;
public MENetworkPowerStorage(IAEPowerStorage t, PowerEventType y) { public MENetworkPowerStorage(IAEPowerStorage t, PowerEventType y) {
storage = t; this.storage = t;
type = y; this.type = y;
} }
} }
@@ -39,7 +39,7 @@ public class MENetworkSpatialEvent extends MENetworkEvent
*/ */
public MENetworkSpatialEvent(IGridHost SpatialIO, double EnergyUsage) public MENetworkSpatialEvent(IGridHost SpatialIO, double EnergyUsage)
{ {
host = SpatialIO; this.host = SpatialIO;
spatialEnergyUsage = EnergyUsage; this.spatialEnergyUsage = EnergyUsage;
} }
} }
@@ -41,8 +41,8 @@ public class MENetworkStorageEvent extends MENetworkEvent
public final StorageChannel channel; public final StorageChannel channel;
public MENetworkStorageEvent(IMEMonitor o, StorageChannel chan) { public MENetworkStorageEvent(IMEMonitor o, StorageChannel chan) {
monitor = o; this.monitor = o;
channel = chan; this.channel = chan;
} }
} }
@@ -35,7 +35,7 @@ public class MachineSource extends BaseActionSource
} }
public MachineSource(IActionHost v) { public MachineSource(IActionHost v) {
via = v; this.via = v;
} }
} }
@@ -38,8 +38,8 @@ public class PlayerSource extends BaseActionSource
} }
public PlayerSource(EntityPlayer p, IActionHost v) { public PlayerSource(EntityPlayer p, IActionHost v) {
player = p; this.player = p;
via = v; this.via = v;
} }
} }
@@ -68,10 +68,10 @@ public class TickingRequest
public final boolean canBeAlerted; public final boolean canBeAlerted;
public TickingRequest(int min, int max, boolean sleep, boolean alertable) { public TickingRequest(int min, int max, boolean sleep, boolean alertable) {
minTickRate = min; this.minTickRate = min;
maxTickRate = max; this.maxTickRate = max;
isSleeping = sleep; this.isSleeping = sleep;
canBeAlerted = alertable; this.canBeAlerted = alertable;
} }
} }
@@ -35,6 +35,6 @@ public enum CableRenderMode
private CableRenderMode(boolean hideFacades) { private CableRenderMode(boolean hideFacades) {
this.transparentFacades = hideFacades; this.transparentFacades = hideFacades;
opaqueFacades = !hideFacades; this.opaqueFacades = !hideFacades;
} }
} }
@@ -47,19 +47,19 @@ public class SelectedPart
public final ForgeDirection side; public final ForgeDirection side;
public SelectedPart() { public SelectedPart() {
part = null; this.part = null;
facade = null; this.facade = null;
side = ForgeDirection.UNKNOWN; this.side = ForgeDirection.UNKNOWN;
} }
public SelectedPart(IPart part, ForgeDirection side) { public SelectedPart(IPart part, ForgeDirection side) {
this.part = part; this.part = part;
facade = null; this.facade = null;
this.side = side; this.side = side;
} }
public SelectedPart(IFacadePart facade, ForgeDirection side) { public SelectedPart(IFacadePart facade, ForgeDirection side) {
part = null; this.part = null;
this.facade = facade; this.facade = facade;
this.side = side; this.side = side;
} }
@@ -33,15 +33,15 @@ public class ResolverResult
final public NBTTagCompound compound; final public NBTTagCompound compound;
public ResolverResult(String name, int damage) { public ResolverResult(String name, int damage) {
itemName = name; this.itemName = name;
damageValue = damage; this.damageValue = damage;
compound = null; this.compound = null;
} }
public ResolverResult(String name, int damage, NBTTagCompound data) { public ResolverResult(String name, int damage, NBTTagCompound data) {
itemName = name; this.itemName = name;
damageValue = damage; this.damageValue = damage;
compound = data; this.compound = data;
} }
} }
@@ -35,8 +35,8 @@ public class ResolverResultSet
public final List<ItemStack> results; public final List<ItemStack> results;
public ResolverResultSet(String myName, ItemStack... set) { public ResolverResultSet(String myName, ItemStack... set) {
results = Arrays.asList( set ); this.results = Arrays.asList( set );
name = myName; this.name = myName;
} }
} }
@@ -51,23 +51,23 @@ public class MEMonitorHandler<StackType extends IAEStack> implements IMEMonitor<
protected IMEInventoryHandler<StackType> getHandler() protected IMEInventoryHandler<StackType> getHandler()
{ {
return internalHandler; return this.internalHandler;
} }
protected Iterator<Entry<IMEMonitorHandlerReceiver<StackType>, Object>> getListeners() protected Iterator<Entry<IMEMonitorHandlerReceiver<StackType>, Object>> getListeners()
{ {
return listeners.entrySet().iterator(); return this.listeners.entrySet().iterator();
} }
protected void postChangesToListeners( Iterable<StackType> changes, BaseActionSource src) protected void postChangesToListeners( Iterable<StackType> changes, BaseActionSource src)
{ {
notifyListenersOfChange( changes, src ); this.notifyListenersOfChange( changes, src );
} }
protected void notifyListenersOfChange(Iterable<StackType> diff, BaseActionSource src) protected void notifyListenersOfChange(Iterable<StackType> diff, BaseActionSource src)
{ {
hasChanged = true;// need to update the cache. this.hasChanged = true;// need to update the cache.
Iterator<Entry<IMEMonitorHandlerReceiver<StackType>, Object>> i = getListeners(); Iterator<Entry<IMEMonitorHandlerReceiver<StackType>, Object>> i = this.getListeners();
while (i.hasNext()) while (i.hasNext())
{ {
Entry<IMEMonitorHandlerReceiver<StackType>, Object> o = i.next(); Entry<IMEMonitorHandlerReceiver<StackType>, Object> o = i.next();
@@ -89,108 +89,108 @@ public class MEMonitorHandler<StackType extends IAEStack> implements IMEMonitor<
diff.decStackSize( leftOvers.getStackSize() ); diff.decStackSize( leftOvers.getStackSize() );
if ( diff.getStackSize() != 0 ) if ( diff.getStackSize() != 0 )
postChangesToListeners( ImmutableList.of( diff ), src ); this.postChangesToListeners( ImmutableList.of( diff ), src );
return leftOvers; return leftOvers;
} }
public MEMonitorHandler(IMEInventoryHandler<StackType> t) { public MEMonitorHandler(IMEInventoryHandler<StackType> t) {
internalHandler = t; this.internalHandler = t;
cachedList = (IItemList<StackType>) t.getChannel().createList(); this.cachedList = (IItemList<StackType>) t.getChannel().createList();
} }
public MEMonitorHandler(IMEInventoryHandler<StackType> t, StorageChannel chan) { public MEMonitorHandler(IMEInventoryHandler<StackType> t, StorageChannel chan) {
internalHandler = t; this.internalHandler = t;
cachedList = (IItemList<StackType>) chan.createList(); this.cachedList = (IItemList<StackType>) chan.createList();
} }
@Override @Override
public void addListener(IMEMonitorHandlerReceiver<StackType> l, Object verificationToken) public void addListener(IMEMonitorHandlerReceiver<StackType> l, Object verificationToken)
{ {
listeners.put( l, verificationToken ); this.listeners.put( l, verificationToken );
} }
@Override @Override
public void removeListener(IMEMonitorHandlerReceiver<StackType> l) public void removeListener(IMEMonitorHandlerReceiver<StackType> l)
{ {
listeners.remove( l ); this.listeners.remove( l );
} }
@Override @Override
public StackType injectItems(StackType input, Actionable mode, BaseActionSource src) public StackType injectItems(StackType input, Actionable mode, BaseActionSource src)
{ {
if ( mode == Actionable.SIMULATE ) if ( mode == Actionable.SIMULATE )
return getHandler().injectItems( input, mode, src ); return this.getHandler().injectItems( input, mode, src );
return monitorDifference(input.copy(), getHandler().injectItems(input, mode, src), false, src); return this.monitorDifference(input.copy(), this.getHandler().injectItems(input, mode, src), false, src);
} }
@Override @Override
public StackType extractItems(StackType request, Actionable mode, BaseActionSource src) public StackType extractItems(StackType request, Actionable mode, BaseActionSource src)
{ {
if ( mode == Actionable.SIMULATE ) if ( mode == Actionable.SIMULATE )
return getHandler().extractItems( request, mode, src ); return this.getHandler().extractItems( request, mode, src );
return monitorDifference(request.copy(), getHandler().extractItems(request, mode, src), true, src); return this.monitorDifference(request.copy(), this.getHandler().extractItems(request, mode, src), true, src);
} }
@Override @Override
public IItemList<StackType> getStorageList() public IItemList<StackType> getStorageList()
{ {
if ( hasChanged ) if ( this.hasChanged )
{ {
hasChanged = false; this.hasChanged = false;
cachedList.resetStatus(); this.cachedList.resetStatus();
return getAvailableItems( cachedList ); return this.getAvailableItems( this.cachedList );
} }
return cachedList; return this.cachedList;
} }
@Override @Override
public IItemList<StackType> getAvailableItems(IItemList out) public IItemList<StackType> getAvailableItems(IItemList out)
{ {
return getHandler().getAvailableItems( out ); return this.getHandler().getAvailableItems( out );
} }
@Override @Override
public StorageChannel getChannel() public StorageChannel getChannel()
{ {
return getHandler().getChannel(); return this.getHandler().getChannel();
} }
@Override @Override
public AccessRestriction getAccess() public AccessRestriction getAccess()
{ {
return getHandler().getAccess(); return this.getHandler().getAccess();
} }
@Override @Override
public boolean isPrioritized(StackType input) public boolean isPrioritized(StackType input)
{ {
return getHandler().isPrioritized( input ); return this.getHandler().isPrioritized( input );
} }
@Override @Override
public boolean canAccept(StackType input) public boolean canAccept(StackType input)
{ {
return getHandler().canAccept( input ); return this.getHandler().canAccept( input );
} }
@Override @Override
public int getPriority() public int getPriority()
{ {
return getHandler().getPriority(); return this.getHandler().getPriority();
} }
@Override @Override
public int getSlot() public int getSlot()
{ {
return getHandler().getSlot(); return this.getHandler().getSlot();
} }
@Override @Override
public boolean validForPass(int i) public boolean validForPass(int i)
{ {
return getHandler().validForPass( i ); return this.getHandler().validForPass( i );
} }
} }
@@ -44,7 +44,7 @@ public enum StorageChannel
public final Class<? extends IAEStack> type; public final Class<? extends IAEStack> type;
private StorageChannel( Class<? extends IAEStack> t ) { private StorageChannel( Class<? extends IAEStack> t ) {
type = t; this.type = t;
} }
public IItemList createList() { public IItemList createList() {
+5 -5
View File
@@ -89,9 +89,9 @@ public enum AEColor
AEColor(String unlocalizedName, int blackHex, int medHex, int whiteHex) { AEColor(String unlocalizedName, int blackHex, int medHex, int whiteHex) {
this.unlocalizedName = unlocalizedName; this.unlocalizedName = unlocalizedName;
blackVariant = blackHex; this.blackVariant = blackHex;
mediumVariant = medHex; this.mediumVariant = medHex;
whiteVariant = whiteHex; this.whiteVariant = whiteHex;
} }
/** /**
@@ -99,13 +99,13 @@ public enum AEColor
*/ */
public boolean matches(AEColor color) public boolean matches(AEColor color)
{ {
return equals(Transparent) || color == Transparent || equals(color); return this.equals(Transparent) || color == Transparent || this.equals(color);
} }
@Override @Override
public String toString() public String toString()
{ {
return StatCollector.translateToLocal( unlocalizedName ); return StatCollector.translateToLocal( this.unlocalizedName );
} }
} }
@@ -37,20 +37,20 @@ public class DimensionalCoord extends WorldCoord
public DimensionalCoord(DimensionalCoord s) { public DimensionalCoord(DimensionalCoord s) {
super( s.x, s.y, s.z ); super( s.x, s.y, s.z );
w = s.w; this.w = s.w;
dimId = s.dimId; this.dimId = s.dimId;
} }
public DimensionalCoord(TileEntity s) { public DimensionalCoord(TileEntity s) {
super( s ); super( s );
w = s.getWorldObj(); this.w = s.getWorldObj();
dimId = w.provider.dimensionId; this.dimId = this.w.provider.dimensionId;
} }
public DimensionalCoord(World _w, int _x, int _y, int _z) { public DimensionalCoord(World _w, int _x, int _y, int _z) {
super( _x, _y, _z ); super( _x, _y, _z );
w = _w; this.w = _w;
dimId = _w.provider.dimensionId; this.dimId = _w.provider.dimensionId;
} }
@Override @Override
@@ -61,34 +61,34 @@ public class DimensionalCoord extends WorldCoord
public boolean isEqual(DimensionalCoord c) public boolean isEqual(DimensionalCoord c)
{ {
return x == c.x && y == c.y && z == c.z && c.w == this.w; return this.x == c.x && this.y == c.y && this.z == c.z && c.w == this.w;
} }
@Override @Override
public boolean equals(Object obj) public boolean equals(Object obj)
{ {
return obj instanceof DimensionalCoord && isEqual((DimensionalCoord) obj); return obj instanceof DimensionalCoord && this.isEqual((DimensionalCoord) obj);
} }
@Override @Override
public int hashCode() public int hashCode()
{ {
return super.hashCode() ^ dimId; return super.hashCode() ^ this.dimId;
} }
public boolean isInWorld(World world) public boolean isInWorld(World world)
{ {
return w == world; return this.w == world;
} }
@Override @Override
public String toString() public String toString()
{ {
return dimId + "," + super.toString(); return this.dimId + "," + super.toString();
} }
public World getWorld() public World getWorld()
{ {
return w; return this.w;
} }
} }
+29 -29
View File
@@ -39,56 +39,56 @@ public class WorldCoord
public WorldCoord add(ForgeDirection direction, int length) public WorldCoord add(ForgeDirection direction, int length)
{ {
x += direction.offsetX * length; this.x += direction.offsetX * length;
y += direction.offsetY * length; this.y += direction.offsetY * length;
z += direction.offsetZ * length; this.z += direction.offsetZ * length;
return this; return this;
} }
public WorldCoord subtract(ForgeDirection direction, int length) public WorldCoord subtract(ForgeDirection direction, int length)
{ {
x -= direction.offsetX * length; this.x -= direction.offsetX * length;
y -= direction.offsetY * length; this.y -= direction.offsetY * length;
z -= direction.offsetZ * length; this.z -= direction.offsetZ * length;
return this; return this;
} }
public WorldCoord add(int _x, int _y, int _z) public WorldCoord add(int _x, int _y, int _z)
{ {
x += _x; this.x += _x;
y += _y; this.y += _y;
z += _z; this.z += _z;
return this; return this;
} }
public WorldCoord subtract(int _x, int _y, int _z) public WorldCoord subtract(int _x, int _y, int _z)
{ {
x -= _x; this.x -= _x;
y -= _y; this.y -= _y;
z -= _z; this.z -= _z;
return this; return this;
} }
public WorldCoord multiple(int _x, int _y, int _z) public WorldCoord multiple(int _x, int _y, int _z)
{ {
x *= _x; this.x *= _x;
y *= _y; this.y *= _y;
z *= _z; this.z *= _z;
return this; return this;
} }
public WorldCoord divide(int _x, int _y, int _z) public WorldCoord divide(int _x, int _y, int _z)
{ {
x /= _x; this.x /= _x;
y /= _y; this.y /= _y;
z /= _z; this.z /= _z;
return this; return this;
} }
public WorldCoord(int _x, int _y, int _z) { public WorldCoord(int _x, int _y, int _z) {
x = _x; this.x = _x;
y = _y; this.y = _y;
z = _z; this.z = _z;
} }
public WorldCoord(TileEntity s) { public WorldCoord(TileEntity s) {
@@ -100,9 +100,9 @@ public class WorldCoord
*/ */
public ForgeDirection directionTo(WorldCoord loc) public ForgeDirection directionTo(WorldCoord loc)
{ {
int ox = x - loc.x; int ox = this.x - loc.x;
int oy = y - loc.y; int oy = this.y - loc.y;
int oz = z - loc.z; int oz = this.z - loc.z;
int xlen = Math.abs( ox ); int xlen = Math.abs( ox );
int ylen = Math.abs( oy ); int ylen = Math.abs( oy );
@@ -131,29 +131,29 @@ public class WorldCoord
public boolean isEqual(WorldCoord c) public boolean isEqual(WorldCoord c)
{ {
return x == c.x && y == c.y && z == c.z; return this.x == c.x && this.y == c.y && this.z == c.z;
} }
public WorldCoord copy() public WorldCoord copy()
{ {
return new WorldCoord( x, y, z ); return new WorldCoord( this.x, this.y, this.z );
} }
@Override @Override
public boolean equals(Object obj) public boolean equals(Object obj)
{ {
return obj instanceof WorldCoord && isEqual((WorldCoord) obj); return obj instanceof WorldCoord && this.isEqual((WorldCoord) obj);
} }
@Override @Override
public String toString() public String toString()
{ {
return "" + x + "," + y + "," + z; return "" + this.x + "," + this.y + "," + this.z;
} }
@Override @Override
public int hashCode() public int hashCode()
{ {
return (y << 24) ^ x ^ z; return ( this.y << 24) ^ this.x ^ this.z;
} }
} }