Improves the message generated when generating the folder for the compass data.
Outsources the encoding of the compass data into the file name Written tests for the encoding Did some internal cleaning of the class Conflicts: src/main/java/appeng/block/solids/BlockSkyStone.java src/main/java/appeng/core/WorldSettings.java src/main/java/appeng/core/features/registries/PlayerRegistry.java src/main/java/appeng/core/sync/network/NetworkHandler.java src/main/java/appeng/core/worlddata/PlayerMapping.java src/main/java/appeng/core/worlddata/PlayerMappingsInitializer.java src/main/java/appeng/services/CompassService.java src/main/java/appeng/worldgen/MeteoritePlacer.java src/main/java/appeng/worldgen/MeteoriteWorldGen.java
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
@@ -27,9 +27,10 @@ import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.ThreadFactory;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
@@ -39,18 +40,27 @@ import appeng.services.compass.CompassReader;
|
||||
import appeng.services.compass.ICompassCallback;
|
||||
|
||||
|
||||
public class CompassService implements ThreadFactory
|
||||
public final class CompassService
|
||||
{
|
||||
private static final int CHUNK_SIZE = 16;
|
||||
private final Map<World, CompassReader> worldSet = new HashMap<World, CompassReader>();
|
||||
private final ExecutorService executor;
|
||||
private final File rootFolder;
|
||||
private int jobSize = 0;
|
||||
|
||||
public CompassService( File aEFolder )
|
||||
private final Map<World, CompassReader> worldSet = new HashMap<World, CompassReader>( 10 );
|
||||
private final ExecutorService executor;
|
||||
|
||||
/**
|
||||
* AE2 Folder for each world
|
||||
*/
|
||||
private final File worldCompassFolder;
|
||||
|
||||
private int jobSize;
|
||||
|
||||
public CompassService( @Nonnull final File worldCompassFolder, @Nonnull final ThreadFactory factory )
|
||||
{
|
||||
this.rootFolder = aEFolder;
|
||||
this.executor = Executors.newSingleThreadExecutor( this );
|
||||
Preconditions.checkNotNull( worldCompassFolder );
|
||||
Preconditions.checkArgument( worldCompassFolder.isDirectory() );
|
||||
|
||||
this.worldCompassFolder = worldCompassFolder;
|
||||
this.executor = Executors.newSingleThreadExecutor( factory );
|
||||
this.jobSize = 0;
|
||||
}
|
||||
|
||||
@@ -130,7 +140,7 @@ public class CompassService implements ThreadFactory
|
||||
|
||||
if( cr == null )
|
||||
{
|
||||
cr = new CompassReader( w.provider.getDimensionId(), this.rootFolder );
|
||||
cr = new CompassReader( w.provider.getDimensionId(), this.worldCompassFolder );
|
||||
this.worldSet.put( w, cr );
|
||||
}
|
||||
|
||||
@@ -175,12 +185,6 @@ public class CompassService implements ThreadFactory
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Thread newThread( @Nonnull Runnable job )
|
||||
{
|
||||
return new Thread( job, "AE Compass Service" );
|
||||
}
|
||||
|
||||
private class CMUpdatePost implements Runnable
|
||||
{
|
||||
|
||||
|
||||
Reference in New Issue
Block a user