mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-04-08 08:46:13 +00:00
BlockData -> BlockState
This commit is contained in:
@@ -2,13 +2,13 @@ package com.dfsek.terra.api.block;
|
||||
|
||||
import com.dfsek.terra.api.Handle;
|
||||
|
||||
public interface BlockData extends Cloneable, Handle {
|
||||
public interface BlockState extends Cloneable, Handle {
|
||||
|
||||
BlockType getBlockType();
|
||||
|
||||
boolean matches(BlockData other);
|
||||
boolean matches(BlockState other);
|
||||
|
||||
BlockData clone();
|
||||
BlockState clone();
|
||||
|
||||
String getAsString();
|
||||
|
||||
@@ -3,7 +3,7 @@ package com.dfsek.terra.api.block;
|
||||
import com.dfsek.terra.api.Handle;
|
||||
|
||||
public interface BlockType extends Handle {
|
||||
BlockData getDefaultData();
|
||||
BlockState getDefaultData();
|
||||
|
||||
boolean isSolid();
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.dfsek.terra.api.block.data;
|
||||
|
||||
import com.dfsek.terra.api.block.BlockData;
|
||||
import com.dfsek.terra.api.block.BlockState;
|
||||
|
||||
public interface AnaloguePowerable extends BlockData {
|
||||
public interface AnaloguePowerable extends BlockState {
|
||||
int getMaximumPower();
|
||||
|
||||
int getPower();
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.dfsek.terra.api.block.data;
|
||||
|
||||
import com.dfsek.terra.api.block.BlockData;
|
||||
import com.dfsek.terra.api.block.BlockState;
|
||||
|
||||
public interface Bisected extends BlockData {
|
||||
public interface Bisected extends BlockState {
|
||||
Half getHalf();
|
||||
|
||||
void setHalf(Half half);
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package com.dfsek.terra.api.block.data;
|
||||
|
||||
import com.dfsek.terra.api.block.BlockData;
|
||||
import com.dfsek.terra.api.block.BlockState;
|
||||
import com.dfsek.terra.api.block.BlockFace;
|
||||
|
||||
public interface Directional extends BlockData {
|
||||
public interface Directional extends BlockState {
|
||||
BlockFace getFacing();
|
||||
|
||||
void setFacing(BlockFace facing);
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package com.dfsek.terra.api.block.data;
|
||||
|
||||
import com.dfsek.terra.api.block.BlockData;
|
||||
import com.dfsek.terra.api.block.BlockState;
|
||||
import com.dfsek.terra.api.block.BlockFace;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
public interface MultipleFacing extends BlockData {
|
||||
public interface MultipleFacing extends BlockState {
|
||||
Set<BlockFace> getFaces();
|
||||
|
||||
void setFace(BlockFace face, boolean facing);
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package com.dfsek.terra.api.block.data;
|
||||
|
||||
import com.dfsek.terra.api.block.Axis;
|
||||
import com.dfsek.terra.api.block.BlockData;
|
||||
import com.dfsek.terra.api.block.BlockState;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
public interface Orientable extends BlockData {
|
||||
public interface Orientable extends BlockState {
|
||||
Set<Axis> getAxes();
|
||||
|
||||
Axis getAxis();
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.dfsek.terra.api.block.data;
|
||||
|
||||
import com.dfsek.terra.api.block.BlockData;
|
||||
import com.dfsek.terra.api.block.BlockState;
|
||||
|
||||
public interface Rail extends BlockData {
|
||||
public interface Rail extends BlockState {
|
||||
Shape getShape();
|
||||
|
||||
void setShape(Shape newShape);
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package com.dfsek.terra.api.block.data;
|
||||
|
||||
import com.dfsek.terra.api.block.BlockData;
|
||||
import com.dfsek.terra.api.block.BlockState;
|
||||
import com.dfsek.terra.api.block.BlockFace;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
public interface RedstoneWire extends BlockData, AnaloguePowerable {
|
||||
public interface RedstoneWire extends BlockState, AnaloguePowerable {
|
||||
Set<BlockFace> getAllowedFaces();
|
||||
|
||||
Connection getFace(BlockFace face);
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package com.dfsek.terra.api.block.data;
|
||||
|
||||
import com.dfsek.terra.api.block.BlockData;
|
||||
import com.dfsek.terra.api.block.BlockState;
|
||||
import com.dfsek.terra.api.block.BlockFace;
|
||||
|
||||
public interface Rotatable extends BlockData {
|
||||
public interface Rotatable extends BlockState {
|
||||
BlockFace getRotation();
|
||||
|
||||
void setRotation(BlockFace face);
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package com.dfsek.terra.api.block.data;
|
||||
|
||||
import com.dfsek.terra.api.block.BlockData;
|
||||
import com.dfsek.terra.api.block.BlockState;
|
||||
import com.dfsek.terra.api.block.BlockFace;
|
||||
|
||||
public interface Wall extends BlockData, Waterlogged {
|
||||
public interface Wall extends BlockState, Waterlogged {
|
||||
boolean isUp();
|
||||
|
||||
void setHeight(BlockFace face, Height height);
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.dfsek.terra.api.block.data;
|
||||
|
||||
import com.dfsek.terra.api.block.BlockData;
|
||||
import com.dfsek.terra.api.block.BlockState;
|
||||
|
||||
public interface Waterlogged extends BlockData {
|
||||
public interface Waterlogged extends BlockState {
|
||||
boolean isWaterlogged();
|
||||
|
||||
void setWaterlogged(boolean waterlogged);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.dfsek.terra.api.block.state;
|
||||
|
||||
import com.dfsek.terra.api.Handle;
|
||||
import com.dfsek.terra.api.block.BlockData;
|
||||
import com.dfsek.terra.api.block.BlockState;
|
||||
import com.dfsek.terra.api.vector.Vector3;
|
||||
|
||||
public interface BlockEntity extends Handle {
|
||||
@@ -13,7 +13,7 @@ public interface BlockEntity extends Handle {
|
||||
|
||||
int getZ();
|
||||
|
||||
BlockData getBlockData();
|
||||
BlockState getBlockData();
|
||||
|
||||
boolean update(boolean applyPhysics);
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.dfsek.terra.api.handle;
|
||||
|
||||
import com.dfsek.terra.api.block.BlockData;
|
||||
import com.dfsek.terra.api.block.BlockState;
|
||||
import com.dfsek.terra.api.entity.EntityType;
|
||||
import com.dfsek.terra.api.entity.Player;
|
||||
import com.dfsek.terra.api.util.generic.pair.Pair;
|
||||
@@ -10,7 +10,7 @@ import com.dfsek.terra.api.vector.Vector3;
|
||||
* Interface to be implemented for world manipulation.
|
||||
*/
|
||||
public interface WorldHandle {
|
||||
BlockData createBlockData(String data);
|
||||
BlockState createBlockData(String data);
|
||||
|
||||
EntityType getEntity(String id);
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.dfsek.terra.api.world;
|
||||
|
||||
import com.dfsek.terra.api.block.BlockData;
|
||||
import com.dfsek.terra.api.block.BlockState;
|
||||
|
||||
public interface Chunk extends ChunkAccess {
|
||||
int getX();
|
||||
@@ -9,11 +9,11 @@ public interface Chunk extends ChunkAccess {
|
||||
|
||||
World getWorld();
|
||||
|
||||
BlockData getBlock(int x, int y, int z);
|
||||
BlockState getBlock(int x, int y, int z);
|
||||
|
||||
void setBlock(int x, int y, int z, BlockData data, boolean physics);
|
||||
void setBlock(int x, int y, int z, BlockState data, boolean physics);
|
||||
|
||||
default void setBlock(int x, int y, int z, BlockData data) {
|
||||
default void setBlock(int x, int y, int z, BlockState data) {
|
||||
setBlock(x, y, z, data, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.dfsek.terra.api.world;
|
||||
|
||||
import com.dfsek.terra.api.Handle;
|
||||
import com.dfsek.terra.api.block.BlockData;
|
||||
import com.dfsek.terra.api.block.BlockState;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public interface ChunkAccess extends Handle {
|
||||
@@ -13,9 +13,9 @@ public interface ChunkAccess extends Handle {
|
||||
* @param x the x location in the chunk from 0-15 inclusive
|
||||
* @param y the y location in the chunk from 0 (inclusive) - maxHeight (exclusive)
|
||||
* @param z the z location in the chunk from 0-15 inclusive
|
||||
* @param blockData the type to set the block to
|
||||
* @param blockState the type to set the block to
|
||||
*/
|
||||
void setBlock(int x, int y, int z, @NotNull BlockData blockData);
|
||||
void setBlock(int x, int y, int z, @NotNull BlockState blockState);
|
||||
|
||||
/**
|
||||
* Get the type and data of the block at x, y, z.
|
||||
@@ -27,5 +27,5 @@ public interface ChunkAccess extends Handle {
|
||||
* @param z the z location in the chunk from 0-15 inclusive
|
||||
* @return the data of the block or the BlockData for air if x, y or z are outside the chunk's bounds
|
||||
*/
|
||||
@NotNull BlockData getBlock(int x, int y, int z);
|
||||
@NotNull BlockState getBlock(int x, int y, int z);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.dfsek.terra.api.world;
|
||||
|
||||
import com.dfsek.terra.api.block.BlockData;
|
||||
import com.dfsek.terra.api.block.BlockState;
|
||||
import com.dfsek.terra.api.config.WorldConfig;
|
||||
import com.dfsek.terra.api.vector.Vector3;
|
||||
import com.dfsek.terra.api.world.biome.generation.BiomeProvider;
|
||||
@@ -22,7 +22,7 @@ public interface TerraWorld {
|
||||
* @param z Z coordinate
|
||||
* @return BlockData
|
||||
*/
|
||||
BlockData getUngeneratedBlock(int x, int y, int z);
|
||||
BlockState getUngeneratedBlock(int x, int y, int z);
|
||||
|
||||
BlockData getUngeneratedBlock(Vector3 v);
|
||||
BlockState getUngeneratedBlock(Vector3 v);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.dfsek.terra.api.world;
|
||||
|
||||
import com.dfsek.terra.api.Handle;
|
||||
import com.dfsek.terra.api.block.BlockData;
|
||||
import com.dfsek.terra.api.block.BlockState;
|
||||
import com.dfsek.terra.api.block.state.BlockEntity;
|
||||
import com.dfsek.terra.api.entity.Entity;
|
||||
import com.dfsek.terra.api.entity.EntityType;
|
||||
@@ -23,23 +23,23 @@ public interface World extends Handle {
|
||||
return getChunkAt(location.getBlockX() >> 4, location.getBlockZ() >> 4);
|
||||
}
|
||||
|
||||
BlockData getBlockData(int x, int y, int z);
|
||||
BlockState getBlockData(int x, int y, int z);
|
||||
|
||||
default BlockData getBlockData(Vector3 position) {
|
||||
default BlockState getBlockData(Vector3 position) {
|
||||
return getBlockData(position.getBlockX(), position.getBlockY(), position.getBlockZ());
|
||||
}
|
||||
|
||||
void setBlockData(int x, int y, int z, BlockData data, boolean physics);
|
||||
void setBlockData(int x, int y, int z, BlockState data, boolean physics);
|
||||
|
||||
default void setBlockData(int x, int y, int z, BlockData data) {
|
||||
default void setBlockData(int x, int y, int z, BlockState data) {
|
||||
setBlockData(x, y, z, data, false);
|
||||
}
|
||||
|
||||
default void setBlockData(Vector3 position, BlockData data) {
|
||||
default void setBlockData(Vector3 position, BlockState data) {
|
||||
setBlockData(position, data, false);
|
||||
}
|
||||
|
||||
default void setBlockData(Vector3 position, BlockData data, boolean physics) {
|
||||
default void setBlockData(Vector3 position, BlockState data, boolean physics) {
|
||||
setBlockData(position.getBlockX(), position.getBlockY(), position.getBlockZ(), data, physics);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
package com.dfsek.terra.api.world.generator;
|
||||
|
||||
import com.dfsek.terra.api.block.BlockData;
|
||||
import com.dfsek.terra.api.block.BlockState;
|
||||
import com.dfsek.terra.api.noise.NoiseSampler;
|
||||
import com.dfsek.terra.api.util.ProbabilityCollection;
|
||||
|
||||
public interface Palette {
|
||||
Palette add(BlockData m, int layers, NoiseSampler sampler);
|
||||
Palette add(BlockState m, int layers, NoiseSampler sampler);
|
||||
|
||||
Palette add(ProbabilityCollection<BlockData> m, int layers, NoiseSampler sampler);
|
||||
Palette add(ProbabilityCollection<BlockState> m, int layers, NoiseSampler sampler);
|
||||
|
||||
/**
|
||||
* Fetches a material from the palette, at a given layer.
|
||||
@@ -15,7 +15,7 @@ public interface Palette {
|
||||
* @param layer - The layer at which to fetch the material.
|
||||
* @return BlockData - The material fetched.
|
||||
*/
|
||||
BlockData get(int layer, double x, double y, double z);
|
||||
BlockState get(int layer, double x, double y, double z);
|
||||
|
||||
int getSize();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user