Chunk implementation
This commit is contained in:
@@ -7,6 +7,7 @@ package mc.core;
|
||||
import lombok.Data;
|
||||
import mc.core.exception.ResourceUnloadedException;
|
||||
import mc.core.world.Chunk;
|
||||
import mc.core.world.Region;
|
||||
import mc.core.world.World;
|
||||
import sun.reflect.generics.reflectiveObjects.NotImplementedException;
|
||||
|
||||
@@ -114,7 +115,8 @@ public class Location implements Serializable{
|
||||
}
|
||||
|
||||
public Chunk getChunk() {
|
||||
throw new NotImplementedException();
|
||||
Region region = getWorld().getRegion((int) (x / 256), (int) (z / 256));
|
||||
return region.getChunk((int) ((x % 256) / 16), (int) ((z % 256) / 16));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -24,6 +24,11 @@ public interface Region extends Serializable{
|
||||
Chunk getChunk (int x, int z);
|
||||
void setChunk(int x, int z, Chunk chunk);
|
||||
|
||||
@Deprecated
|
||||
ChunkSection getChunkAt(int x, int y, int z);
|
||||
@Deprecated
|
||||
void setChunk(int x, int y, int z, ChunkSection chunkSection);
|
||||
|
||||
int getX();
|
||||
int getZ();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user