Moved region implementation to .server.world.io.region
This commit is contained in:
parent
e2308b825d
commit
6b33f231b4
@ -25,8 +25,8 @@ import java.util.function.Function;
|
||||
import ru.windcorp.progressia.common.world.DefaultWorldData;
|
||||
import ru.windcorp.progressia.server.world.generation.WorldGenerator;
|
||||
import ru.windcorp.progressia.server.world.io.WorldContainer;
|
||||
import ru.windcorp.progressia.server.world.io.region.RegionFormat;
|
||||
import ru.windcorp.progressia.test.gen.TestGenerationConfig;
|
||||
import ru.windcorp.progressia.test.region.RegionFormat;
|
||||
|
||||
public class ServerState {
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package ru.windcorp.progressia.test.region;
|
||||
package ru.windcorp.progressia.server.world.io.region;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.BufferedOutputStream;
|
||||
@ -59,7 +59,7 @@ public class Region {
|
||||
this.file.confirmHeaderHealth(offsets);
|
||||
} catch (IOException e) {
|
||||
|
||||
TestWorldDiskIO.LOG.debug("Uh the file broke");
|
||||
RegionWorldContainer.LOG.debug("Uh the file broke");
|
||||
if (RESET_CORRUPTED) {
|
||||
this.file.makeHeader();
|
||||
}
|
||||
@ -98,7 +98,7 @@ public class Region {
|
||||
|
||||
public void save(DefaultChunkData chunk, Server server) throws IOException {
|
||||
isUsing.set(true);
|
||||
Vec3i pos = TestWorldDiskIO.getInRegionCoords(chunk.getPosition());
|
||||
Vec3i pos = RegionWorldContainer.getInRegionCoords(chunk.getPosition());
|
||||
|
||||
if (!hasOffset(pos)) {
|
||||
putOffset(pos, file.allocateChunk(pos));
|
||||
@ -121,7 +121,7 @@ public class Region {
|
||||
)
|
||||
) {
|
||||
ChunkIO.save(chunk, dataStream, IOContext.SAVE);
|
||||
TestWorldDiskIO.writeGenerationHint(chunk, dataStream, server);
|
||||
RegionWorldContainer.writeGenerationHint(chunk, dataStream, server);
|
||||
}
|
||||
|
||||
return arrayStream.toByteArray();
|
||||
@ -133,7 +133,7 @@ public class Region {
|
||||
isUsing.set(true);
|
||||
|
||||
int dataOffset = 0;
|
||||
Vec3i pos = TestWorldDiskIO.getInRegionCoords(chunkPos);
|
||||
Vec3i pos = RegionWorldContainer.getInRegionCoords(chunkPos);
|
||||
|
||||
if (hasOffset(pos)) {
|
||||
dataOffset = getOffset(pos);
|
||||
@ -160,7 +160,7 @@ public class Region {
|
||||
);
|
||||
|
||||
DefaultChunkData result = ChunkIO.load(world, chunkPos, dataStream, IOContext.SAVE);
|
||||
TestWorldDiskIO.readGenerationHint(result, dataStream, server);
|
||||
RegionWorldContainer.readGenerationHint(result, dataStream, server);
|
||||
return result;
|
||||
}
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
package ru.windcorp.progressia.test.region;
|
||||
package ru.windcorp.progressia.server.world.io.region;
|
||||
|
||||
import static ru.windcorp.progressia.test.region.TestWorldDiskIO.REGION_DIAMETER;
|
||||
import static ru.windcorp.progressia.server.world.io.region.RegionWorldContainer.REGION_DIAMETER;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.RandomAccessFile;
|
@ -15,7 +15,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package ru.windcorp.progressia.test.region;
|
||||
package ru.windcorp.progressia.server.world.io.region;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Path;
|
||||
@ -31,7 +31,7 @@ public class RegionFormat extends WorldContainerFormat {
|
||||
|
||||
@Override
|
||||
public WorldContainer create(Path directory) throws IOException {
|
||||
return new TestWorldDiskIO(directory);
|
||||
return new RegionWorldContainer(directory);
|
||||
}
|
||||
|
||||
}
|
@ -16,7 +16,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package ru.windcorp.progressia.test.region;
|
||||
package ru.windcorp.progressia.server.world.io.region;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
@ -43,7 +43,7 @@ import java.io.*;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
|
||||
public class TestWorldDiskIO implements WorldContainer {
|
||||
public class RegionWorldContainer implements WorldContainer {
|
||||
|
||||
private static final boolean ENABLE = true;
|
||||
|
||||
@ -68,7 +68,7 @@ public class TestWorldDiskIO implements WorldContainer {
|
||||
private final Path path;
|
||||
private final ChunkMap<Region> regions = ChunkMaps.newHashMap();
|
||||
|
||||
public TestWorldDiskIO(Path path) throws IOException {
|
||||
public RegionWorldContainer(Path path) throws IOException {
|
||||
this.path = path;
|
||||
|
||||
Files.createDirectories(getPath());
|
@ -380,7 +380,7 @@ public class TestContent {
|
||||
ru.windcorp.progressia.client.Client client = ClientState.getInstance();
|
||||
if (client == null || !client.isReady())
|
||||
return null;
|
||||
|
||||
|
||||
return client.getLocalPlayer().getSelection();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user