Interfaces fix
This commit is contained in:
@@ -20,6 +20,10 @@ public class Location {
|
||||
);
|
||||
}
|
||||
|
||||
public static Location startPointLocation () {
|
||||
return new Location(0,10,0);
|
||||
}
|
||||
|
||||
public void set(Location location) {
|
||||
this.x = location.x;
|
||||
this.y = location.y;
|
||||
|
||||
27
core/src/main/java/mc/core/world/ChunkLoader.java
Normal file
27
core/src/main/java/mc/core/world/ChunkLoader.java
Normal file
@@ -0,0 +1,27 @@
|
||||
package mc.core.world;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
public interface ChunkLoader {
|
||||
|
||||
/**
|
||||
* Loads chunk from cache. If chunk in cache doesn't exist, loads from file (or other storage)
|
||||
*
|
||||
* @param x chunk position
|
||||
* @param y chunk position
|
||||
* @param z chunk position
|
||||
* @return optional of chunk (nullable)
|
||||
*/
|
||||
Optional<Chunk> loadChunk (int x, int y, int z);
|
||||
|
||||
/**
|
||||
* Tries to load chunk like {@link #loadChunk(int, int, int)}
|
||||
* If chunk doesn't exist, generates it with selected world generator
|
||||
*
|
||||
* @param x chunk position
|
||||
* @param y chunk position
|
||||
* @param z chunk position
|
||||
* @return chunk
|
||||
*/
|
||||
Chunk loadOrGenerateChunk (int x, int y, int z);
|
||||
}
|
||||
@@ -6,10 +6,14 @@ package mc.core.world;
|
||||
|
||||
import mc.core.Location;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public interface World {
|
||||
UUID getWorldId();
|
||||
|
||||
Location getSpawn();
|
||||
void setSpawn(Location location);
|
||||
|
||||
Chunk getChunk(int x, int z);
|
||||
void setChunk(int x, int z, Chunk chunk);
|
||||
Chunk getChunk(int x, int y, int z);
|
||||
void setChunk(int x, int y, int z, Chunk chunk);
|
||||
}
|
||||
|
||||
6
core/src/main/java/mc/core/world/WorldGenerator.java
Normal file
6
core/src/main/java/mc/core/world/WorldGenerator.java
Normal file
@@ -0,0 +1,6 @@
|
||||
package mc.core.world;
|
||||
|
||||
public interface WorldGenerator {
|
||||
|
||||
Chunk generateChunk (int x, int z, World world);
|
||||
}
|
||||
Reference in New Issue
Block a user