Changed access to use this qualifier

This commit is contained in:
yueh
2014-12-29 15:13:47 +01:00
parent 2a5e57a59b
commit f471513bd0
604 changed files with 11573 additions and 11573 deletions
@@ -49,23 +49,23 @@ public class CompassService implements ThreadFactory
public final boolean value;
public CMUpdatePost(World w, int cx, int cz, int dcy, boolean val) {
world = w;
chunkX = cx;
doubleChunkY = dcy;
chunkZ = cz;
value = val;
this.world = w;
this.chunkX = cx;
this.doubleChunkY = dcy;
this.chunkZ = cz;
this.value = val;
}
@Override
public void run()
{
jobSize--;
CompassService.this.jobSize--;
CompassReader cr = getReader( world );
cr.setHasBeacon( chunkX, chunkZ, doubleChunkY, value );
CompassReader cr = CompassService.this.getReader( this.world );
cr.setHasBeacon( this.chunkX, this.chunkZ, this.doubleChunkY, this.value );
if ( jobSize() < 2 )
cleanUp();
if ( CompassService.this.jobSize() < 2 )
CompassService.this.cleanUp();
}
}
@@ -80,32 +80,32 @@ public class CompassService implements ThreadFactory
public CMDirectionRequest(DimensionalCoord coord, int getMaxRange, ICompassCallback cc) {
this.coord = coord;
this.maxRange = getMaxRange;
callback = cc;
this.callback = cc;
}
@Override
public void run()
{
jobSize--;
CompassService.this.jobSize--;
int cx = coord.x >> 4;
int cz = coord.z >> 4;
int cx = this.coord.x >> 4;
int cz = this.coord.z >> 4;
CompassReader cr = getReader( coord.getWorld() );
CompassReader cr = CompassService.this.getReader( this.coord.getWorld() );
// Am I standing on it?
if ( cr.hasBeacon( cx, cz ) )
{
callback.calculatedDirection( true, true, -999, 0 );
this.callback.calculatedDirection( true, true, -999, 0 );
if ( jobSize() < 2 )
cleanUp();
if ( CompassService.this.jobSize() < 2 )
CompassService.this.cleanUp();
return;
}
// spiral outward...
for (int offset = 1; offset < maxRange; offset++)
for (int offset = 1; offset < this.maxRange; offset++)
{
int minX = cx - offset;
int minZ = cz - offset;
@@ -120,7 +120,7 @@ public class CompassService implements ThreadFactory
{
if ( cr.hasBeacon( minX, z ) )
{
int closeness = dist( cx, cz, minX, z );
int closeness = CompassService.this.dist( cx, cz, minX, z );
if ( closeness < closest )
{
closest = closeness;
@@ -131,7 +131,7 @@ public class CompassService implements ThreadFactory
if ( cr.hasBeacon( maxX, z ) )
{
int closeness = dist( cx, cz, maxX, z );
int closeness = CompassService.this.dist( cx, cz, maxX, z );
if ( closeness < closest )
{
closest = closeness;
@@ -145,7 +145,7 @@ public class CompassService implements ThreadFactory
{
if ( cr.hasBeacon( x, minZ ) )
{
int closeness = dist( cx, cz, x, minZ );
int closeness = CompassService.this.dist( cx, cz, x, minZ );
if ( closeness < closest )
{
closest = closeness;
@@ -156,7 +156,7 @@ public class CompassService implements ThreadFactory
if ( cr.hasBeacon( x, maxZ ) )
{
int closeness = dist( cx, cz, x, maxZ );
int closeness = CompassService.this.dist( cx, cz, x, maxZ );
if ( closeness < closest )
{
closest = closeness;
@@ -168,37 +168,37 @@ public class CompassService implements ThreadFactory
if ( closest < Integer.MAX_VALUE )
{
callback.calculatedDirection( true, false, rad( cx, cz, chosen_x, chosen_z ), dist( cx, cz, chosen_x, chosen_z ) );
this.callback.calculatedDirection( true, false, CompassService.this.rad( cx, cz, chosen_x, chosen_z ), CompassService.this.dist( cx, cz, chosen_x, chosen_z ) );
if ( jobSize() < 2 )
cleanUp();
if ( CompassService.this.jobSize() < 2 )
CompassService.this.cleanUp();
return;
}
}
// didn't find shit...
callback.calculatedDirection( false, true, -999, 999 );
this.callback.calculatedDirection( false, true, -999, 999 );
if ( jobSize() < 2 )
cleanUp();
if ( CompassService.this.jobSize() < 2 )
CompassService.this.cleanUp();
}
}
public Future<?> getCompassDirection(DimensionalCoord coord, int maxRange, ICompassCallback cc)
{
jobSize++;
return executor.submit( new CMDirectionRequest( coord, maxRange, cc ) );
this.jobSize++;
return this.executor.submit( new CMDirectionRequest( coord, maxRange, cc ) );
}
public int jobSize()
{
return jobSize;
return this.jobSize;
}
public void cleanUp()
{
for (CompassReader cr : worldSet.values())
for (CompassReader cr : this.worldSet.values())
cr.close();
}
@@ -207,20 +207,20 @@ public class CompassService implements ThreadFactory
int x = chunkX << 4;
int z = chunkZ << 4;
updateArea( w, x, 16, z );
updateArea( w, x, 16 + 32, z );
updateArea( w, x, 16 + 64, z );
updateArea( w, x, 16 + 96, z );
this.updateArea( w, x, 16, z );
this.updateArea( w, x, 16 + 32, z );
this.updateArea( w, x, 16 + 64, z );
this.updateArea( w, x, 16 + 96, z );
updateArea( w, x, 16 + 128, z );
updateArea( w, x, 16 + 160, z );
updateArea( w, x, 16 + 192, z );
updateArea( w, x, 16 + 224, z );
this.updateArea( w, x, 16 + 128, z );
this.updateArea( w, x, 16 + 160, z );
this.updateArea( w, x, 16 + 192, z );
this.updateArea( w, x, 16 + 224, z );
}
public Future<?> updateArea(World w, int x, int y, int z)
{
jobSize++;
this.jobSize++;
int cx = x >> 4;
int cdy = y >> 5;
@@ -243,13 +243,13 @@ public class CompassService implements ThreadFactory
Block blk = c.getBlock( i, k, j );
if ( blk == skystone && c.getBlockMetadata( i, k, j ) == 0 )
{
return executor.submit( new CMUpdatePost( w, cx, cz, cdy, true ) );
return this.executor.submit( new CMUpdatePost( w, cx, cz, cdy, true ) );
}
}
}
}
return executor.submit( new CMUpdatePost( w, cx, cz, cdy, false ) );
return this.executor.submit( new CMUpdatePost( w, cx, cz, cdy, false ) );
}
final HashMap<World, CompassReader> worldSet = new HashMap<World, CompassReader>();
@@ -258,19 +258,19 @@ public class CompassService implements ThreadFactory
final File rootFolder;
public CompassService(File aEFolder) {
rootFolder = aEFolder;
executor = Executors.newSingleThreadExecutor( this );
jobSize = 0;
this.rootFolder = aEFolder;
this.executor = Executors.newSingleThreadExecutor( this );
this.jobSize = 0;
}
private CompassReader getReader(World w)
{
CompassReader cr = worldSet.get( w );
CompassReader cr = this.worldSet.get( w );
if ( cr == null )
{
cr = new CompassReader( w.provider.dimensionId, rootFolder );
worldSet.put( w, cr );
cr = new CompassReader( w.provider.dimensionId, this.rootFolder );
this.worldSet.put( w, cr );
}
return cr;
@@ -294,19 +294,19 @@ public class CompassService implements ThreadFactory
public void kill()
{
executor.shutdown();
this.executor.shutdown();
try
{
executor.awaitTermination( 6, TimeUnit.MINUTES );
jobSize = 0;
this.executor.awaitTermination( 6, TimeUnit.MINUTES );
this.jobSize = 0;
for (CompassReader cr : worldSet.values())
for (CompassReader cr : this.worldSet.values())
{
cr.close();
}
worldSet.clear();
this.worldSet.clear();
}
catch (InterruptedException e)
{
@@ -57,7 +57,7 @@ public class VersionChecker implements Runnable
{
try
{
sleep( delay );
this.sleep( this.delay );
}
catch (InterruptedException e)
{
@@ -128,13 +128,13 @@ public class VersionChecker implements Runnable
}
}
sleep( FOUR_HOURS );
this.sleep( FOUR_HOURS );
}
catch (Exception e)
{
try
{
sleep( FOUR_HOURS );
this.sleep( FOUR_HOURS );
}
catch (InterruptedException e1)
{
@@ -26,7 +26,7 @@ public class CompassException extends RuntimeException
public final Throwable inner;
public CompassException(Throwable t) {
inner = t;
this.inner = t;
}
}
@@ -46,13 +46,13 @@ public class CompassReader
public void setHasBeacon(int cx, int cz, int cdy, boolean hasBeacon)
{
CompassRegion r = getRegion( cx, cz );
CompassRegion r = this.getRegion( cx, cz );
r.setHasBeacon( cx, cz, cdy, hasBeacon );
}
public boolean hasBeacon(int cx, int cz)
{
CompassRegion r = getRegion( cx, cz );
CompassRegion r = this.getRegion( cx, cz );
return r.hasBeacon( cx, cz );
}
@@ -44,31 +44,31 @@ public class CompassRegion
public CompassRegion( int cx, int cz, int worldID, File rootFolder )
{
world = worldID;
this.world = worldID;
this.rootFolder = rootFolder;
int region_x = cx >> 10;
int region_z = cz >> 10;
low_x = region_x << 10;
low_z = region_z << 10;
this.low_x = region_x << 10;
this.low_z = region_z << 10;
hi_x = low_x + 1024;
hi_z = low_z + 1024;
this.hi_x = this.low_x + 1024;
this.hi_z = this.low_z + 1024;
openFile( false );
this.openFile( false );
}
public void close()
{
try
{
if ( hasFile )
if ( this.hasFile )
{
buffer = null;
raf.close();
raf = null;
hasFile = false;
this.buffer = null;
this.raf.close();
this.raf = null;
this.hasFile = false;
}
}
catch ( Throwable t )
@@ -79,12 +79,12 @@ public class CompassRegion
public boolean hasBeacon( int cx, int cz )
{
if ( hasFile )
if ( this.hasFile )
{
cx = cx & 0x3FF;
cz = cz & 0x3FF;
int val = read( cx, cz );
int val = this.read( cx, cz );
if ( val != 0 )
return true;
}
@@ -97,11 +97,11 @@ public class CompassRegion
cx &= 0x3FF;
cz &= 0x3FF;
openFile( hasBeacon );
this.openFile( hasBeacon );
if ( hasFile )
if ( this.hasFile )
{
int val = read( cx, cz );
int val = this.read( cx, cz );
int originalVal = val;
if ( hasBeacon )
@@ -110,7 +110,7 @@ public class CompassRegion
val &= ~( 1 << cdy );
if ( originalVal != val )
write( cx, cz, val );
this.write( cx, cz, val );
}
}
@@ -118,7 +118,7 @@ public class CompassRegion
{
try
{
buffer.put( cx + cz * 0x400, ( byte ) val );
this.buffer.put( cx + cz * 0x400, ( byte ) val );
// raf.seek( cx + cz * 0x400 );
// raf.writeByte( val );
}
@@ -132,7 +132,7 @@ public class CompassRegion
{
try
{
return buffer.get( cx + cz * 0x400 );
return this.buffer.get( cx + cz * 0x400 );
// raf.seek( cx + cz * 0x400 );
// return raf.readByte();
}
@@ -148,18 +148,18 @@ public class CompassRegion
private void openFile( boolean create )
{
File fName = getFileName();
if ( hasFile )
File fName = this.getFileName();
if ( this.hasFile )
return;
if ( create || fileExists( fName ) )
if ( create || this.fileExists( fName ) )
{
try
{
raf = new RandomAccessFile( fName, "rw" );
FileChannel fc = raf.getChannel();
buffer = fc.map( FileChannel.MapMode.READ_WRITE, 0, 0x400 * 0x400 );// fc.size() );
hasFile = true;
this.raf = new RandomAccessFile( fName, "rw" );
FileChannel fc = this.raf.getChannel();
this.buffer = fc.map( FileChannel.MapMode.READ_WRITE, 0, 0x400 * 0x400 );// fc.size() );
this.hasFile = true;
}
catch ( Throwable t )
{
@@ -176,7 +176,7 @@ public class CompassRegion
private File getFileName()
{
String folder = rootFolder.getPath() + File.separatorChar + "compass";
String folder = this.rootFolder.getPath() + File.separatorChar + "compass";
File folderFile = new File( folder );
if ( !folderFile.exists() || !folderFile.isDirectory() )
@@ -185,6 +185,6 @@ public class CompassRegion
AELog.info( "Failed to create AE2/compass/" );
}
return new File( folder + File.separatorChar + world + '_' + low_x + '_' + low_z + ".dat" );
return new File( folder + File.separatorChar + this.world + '_' + this.low_x + '_' + this.low_z + ".dat" );
}
}