Archived
0

Chunk implementation

This commit is contained in:
Forwolk
2018-08-04 21:56:04 +03:00
parent a1ee3a240e
commit a23f7b15b5
6 changed files with 369 additions and 5 deletions

View File

@@ -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));
}
}

View File

@@ -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();