Archived
0

fix: Location (setWorld)

This commit is contained in:
2018-08-12 23:40:02 +03:00
parent d4785cda14
commit 0cf51120c0
3 changed files with 21 additions and 4 deletions

View File

@@ -7,6 +7,7 @@ package mc.world.flat;
import com.flowpowered.nbt.Tag;
import lombok.Getter;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import mc.core.EntityLocation;
import mc.core.world.IWorldType;
import mc.core.world.Region;
@@ -17,6 +18,7 @@ import mc.core.world.chunk.ChunkSection;
import java.util.UUID;
import java.util.stream.Stream;
@Slf4j
public class FlatWorld implements World {
@Getter
@@ -26,9 +28,7 @@ public class FlatWorld implements World {
@Setter
private String name;
@Getter
@Setter
private EntityLocation spawn = new EntityLocation(0d, 6d, 0d, 0f, 0f, this);
private EntityLocation spawn;
private ChunkSection chunkSection = new SimpleChunkSection();
@Override
@@ -36,6 +36,22 @@ public class FlatWorld implements World {
return WorldType.GENERAL;
}
@Override
public EntityLocation getSpawn() {
if (this.spawn == null) {
log.warn("Spawn is not defined! Set spawn [0, 6, 0]");
this.spawn = new EntityLocation(0d, 6d, 0d, 0f, 0f, this);
}
return this.spawn;
}
@Override
public void setSpawn(EntityLocation location) {
this.spawn = location;
this.spawn.setWorld(this);
}
@Override
public ChunkSection getChunk(int x, int y, int z) {
return chunkSection;