Archived
0

Merge branch 'proto_1.12.2' into h2-playermanager

# Conflicts:
#	core/src/main/java/mc/core/EntityLocation.java
#	core/src/main/java/mc/core/Location.java
#	core/src/test/java/mc/core/TestEntityLocation.java
#	core/src/test/java/mc/core/TestLocation.java
This commit is contained in:
2018-09-08 17:18:20 +03:00
43 changed files with 703 additions and 470 deletions

View File

@@ -5,6 +5,7 @@
package mc.world.flat;
import lombok.Getter;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import mc.core.EntityLocation;
import mc.core.world.World;
@@ -18,6 +19,7 @@ public class FlatWorld implements World {
private final String name = "flat";
@Getter
private final WorldType worldType = WorldType.FLAT;
@Setter
private EntityLocation spawn;
private ChunkSection chunkSection = new SimpleChunkSection();
@@ -25,18 +27,12 @@ public class FlatWorld implements World {
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);
this.spawn = new EntityLocation(0d, 6d, 0d, 0f, 0f);
}
return this.spawn;
}
@Override
public void setSpawn(EntityLocation location) {
this.spawn = location;
this.spawn.setWorld(this);
}
@Override
public Chunk getChunk(int x, int z) {
Chunk chunk = new SimpleChunk(x, z, this);

View File

@@ -9,12 +9,8 @@ import mc.core.world.World;
import mc.core.world.block.Block;
import mc.core.world.block.BlockFactory;
import mc.core.world.block.BlockType;
import mc.core.world.chunk.Chunk;
import mc.core.world.chunk.ChunkSection;
import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
public class SimpleChunkSection implements ChunkSection {
@Override
public int getSkyLight(int x, int y, int z) {
@@ -63,10 +59,10 @@ public class SimpleChunkSection implements ChunkSection {
public Block getBlock(int x, int y, int z) {
BlockFactory blockFactory = new BlockFactory();
if (y == 0) return blockFactory.create(BlockType.BEDROCK, x, y, z, getWorld());
else if (y >= 1 && y <= 2) return blockFactory.create(BlockType.DIRT, x, y, z, getWorld());
else if (y == 3) return blockFactory.create(BlockType.GRASS, x, y, z, getWorld());
else return blockFactory.create(BlockType.AIR, x, y, z, getWorld());
if (y == 0) return blockFactory.create(BlockType.BEDROCK, x, y, z);
else if (y >= 1 && y <= 2) return blockFactory.create(BlockType.DIRT, x, y, z);
else if (y == 3) return blockFactory.create(BlockType.GRASS, x, y, z);
else return blockFactory.create(BlockType.AIR, x, y, z);
}
@Override