Archived
0

Merge branch 'proto_1.12.2' into develop

Tests: FAILED
This commit is contained in:
2018-08-07 10:03:46 +03:00
12 changed files with 255 additions and 86 deletions

View File

@@ -1,4 +1,4 @@
package mc.core.block;
package mc.core.world.block;
import com.flowpowered.nbt.Tag;
import lombok.Getter;
@@ -10,7 +10,8 @@ import java.util.Map;
import java.util.stream.Stream;
public abstract class AbstractBlock implements Block {
@Getter@Setter
@Getter
@Setter
private Location location;
@Getter
private int meta;

View File

@@ -1,6 +1,5 @@
package mc.core.block;
package mc.core.world.block;
import com.flowpowered.nbt.Tag;
import mc.core.Location;
import mc.core.nbt.Taggable;
@@ -29,20 +28,6 @@ import java.io.Serializable;
public interface Block extends Taggable, Serializable{
static Block airBlock (int x, int y, int z) {
return new AbstractBlock(BlockType.AIR) {
@Override
public Tag<?> getTag(String name) {
return null;
}
@Override
public Location getLocation() {
return new Location(x, y, z);
}
};
}
/** Block id */
int getId();

View File

@@ -1,4 +1,4 @@
package mc.core.block;
package mc.core.world.block;
import mc.core.Location;
@@ -8,6 +8,10 @@ public class BlockFactory {
return new EmbeddedBlock(blockType, meta);
}
public Block create(BlockType blockType) {
return create(blockType, 0);
}
/**
* For first-time generation
*/

View File

@@ -4,7 +4,8 @@
*/
package mc.core.world;
import mc.core.block.Block;
import mc.core.Location;
import mc.core.world.block.Block;
import java.io.Serializable;
@@ -23,14 +24,11 @@ import java.io.Serializable;
*/
/* 16x16x16 */
public interface Chunk extends Serializable{
int getBlockType(int x, int y, int z);
void setBlockType(int x, int y, int z, int type);
int getBlockMetadata(int x, int y, int z);
void setBlockMetadata(int x, int y, int z, int metadata);
int getBlockLight(int x, int y, int z);
void setBlockLight(int x, int y, int z, int lightLevel);
Block getBlock(int x, int y, int z);
default Block getBlock(Location location) {
return getBlock(location.getBlockX(), location.getBlockY(), location.getBlockZ());
}
void setBlock(Block block);
int getSkyLight(int x, int y, int z);
void setSkyLight(int x, int y, int z, int lightLevel);
@@ -44,7 +42,4 @@ public interface Chunk extends Serializable{
int getX();
int getY();
int getZ();
void setBlock (int x, int y, int z, Block block);
Block getBlock (int x, int y, int z);
}