Reduced dependency scope of CompassReader
This commit is contained in:
parent
dbbfb12cc2
commit
f5823b6802
2 changed files with 12 additions and 10 deletions
|
@ -251,7 +251,7 @@ public class CompassService implements ThreadFactory
|
|||
|
||||
if ( cr == null )
|
||||
{
|
||||
cr = new CompassReader( w, rootFolder );
|
||||
cr = new CompassReader( w.provider.dimensionId, rootFolder );
|
||||
worldSet.put( w, cr );
|
||||
}
|
||||
|
||||
|
|
|
@ -3,24 +3,26 @@ package appeng.services.helpers;
|
|||
import java.io.File;
|
||||
import java.util.HashMap;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class CompassReader
|
||||
{
|
||||
private final HashMap<Long, CompassRegion> regions = new HashMap<Long, CompassRegion>();
|
||||
private final int id;
|
||||
private final int dimensionId;
|
||||
private final File rootFolder;
|
||||
|
||||
public void close()
|
||||
{
|
||||
for (CompassRegion r : regions.values())
|
||||
for (CompassRegion r : this.regions.values())
|
||||
{
|
||||
r.close();
|
||||
}
|
||||
|
||||
regions.clear();
|
||||
this.regions.clear();
|
||||
}
|
||||
|
||||
public CompassReader(World w, File rootFolder) {
|
||||
id = w.provider.dimensionId;
|
||||
public CompassReader(int dimensionId, File rootFolder)
|
||||
{
|
||||
this.dimensionId = dimensionId;
|
||||
this.rootFolder = rootFolder;
|
||||
}
|
||||
|
||||
|
@ -42,11 +44,11 @@ public class CompassReader
|
|||
pos = pos << 32;
|
||||
pos = pos | (cz >> 10);
|
||||
|
||||
CompassRegion cr = regions.get( pos );
|
||||
CompassRegion cr = this.regions.get( pos );
|
||||
if ( cr == null )
|
||||
{
|
||||
cr = new CompassRegion( cx, cz, id, rootFolder );
|
||||
regions.put( pos, cr );
|
||||
cr = new CompassRegion( cx, cz, this.dimensionId, this.rootFolder );
|
||||
this.regions.put( pos, cr );
|
||||
}
|
||||
|
||||
return cr;
|
||||
|
|
Loading…
Reference in a new issue