Renamed BlockFace and BlockRelation to AbsFace and AbsRelation
- Renamed BlockFace to AbsFace - Renamed BlockRelation to AbsRelation - Renamed AbsFace constants using the following scheme: POS_X, NEG_Y, etc.
This commit is contained in:
parent
b1666fa4b9
commit
848178b343
@ -18,23 +18,23 @@
|
||||
|
||||
package ru.windcorp.progressia.client.graphics.model;
|
||||
|
||||
import static ru.windcorp.progressia.common.world.block.BlockFace.*;
|
||||
import static ru.windcorp.progressia.common.world.block.AbsFace.*;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import glm.vec._3.Vec3;
|
||||
import ru.windcorp.progressia.common.world.block.BlockFace;
|
||||
import ru.windcorp.progressia.common.world.block.AbsFace;
|
||||
|
||||
class BlockFaceVectors {
|
||||
|
||||
private static BlockFaceVectors createInner(BlockFaceVectors outer) {
|
||||
ImmutableMap.Builder<BlockFace, Vec3> originBuilder = ImmutableMap.builder();
|
||||
ImmutableMap.Builder<AbsFace, Vec3> originBuilder = ImmutableMap.builder();
|
||||
|
||||
ImmutableMap.Builder<BlockFace, Vec3> widthBuilder = ImmutableMap.builder();
|
||||
ImmutableMap.Builder<AbsFace, Vec3> widthBuilder = ImmutableMap.builder();
|
||||
|
||||
ImmutableMap.Builder<BlockFace, Vec3> heightBuilder = ImmutableMap.builder();
|
||||
ImmutableMap.Builder<AbsFace, Vec3> heightBuilder = ImmutableMap.builder();
|
||||
|
||||
for (BlockFace face : getFaces()) {
|
||||
for (AbsFace face : getFaces()) {
|
||||
Vec3 width = outer.getWidth(face);
|
||||
Vec3 height = outer.getHeight(face);
|
||||
|
||||
@ -59,36 +59,36 @@ class BlockFaceVectors {
|
||||
|
||||
static {
|
||||
OUTER = new BlockFaceVectors(
|
||||
ImmutableMap.<BlockFace, Vec3>builder()
|
||||
ImmutableMap.<AbsFace, Vec3>builder()
|
||||
|
||||
.put(TOP, new Vec3(-0.5f, +0.5f, +0.5f))
|
||||
.put(BOTTOM, new Vec3(-0.5f, -0.5f, -0.5f))
|
||||
.put(NORTH, new Vec3(+0.5f, -0.5f, -0.5f))
|
||||
.put(SOUTH, new Vec3(-0.5f, +0.5f, -0.5f))
|
||||
.put(WEST, new Vec3(+0.5f, +0.5f, -0.5f))
|
||||
.put(EAST, new Vec3(-0.5f, -0.5f, -0.5f))
|
||||
.put(POS_Z, new Vec3(-0.5f, +0.5f, +0.5f))
|
||||
.put(NEG_Z, new Vec3(-0.5f, -0.5f, -0.5f))
|
||||
.put(POS_X, new Vec3(+0.5f, -0.5f, -0.5f))
|
||||
.put(NEG_X, new Vec3(-0.5f, +0.5f, -0.5f))
|
||||
.put(POS_Y, new Vec3(+0.5f, +0.5f, -0.5f))
|
||||
.put(NEG_Y, new Vec3(-0.5f, -0.5f, -0.5f))
|
||||
|
||||
.build(),
|
||||
|
||||
ImmutableMap.<BlockFace, Vec3>builder()
|
||||
ImmutableMap.<AbsFace, Vec3>builder()
|
||||
|
||||
.put(TOP, new Vec3(0, -1, 0))
|
||||
.put(BOTTOM, new Vec3(0, +1, 0))
|
||||
.put(NORTH, new Vec3(0, +1, 0))
|
||||
.put(SOUTH, new Vec3(0, -1, 0))
|
||||
.put(WEST, new Vec3(-1, 0, 0))
|
||||
.put(EAST, new Vec3(+1, 0, 0))
|
||||
.put(POS_Z, new Vec3(0, -1, 0))
|
||||
.put(NEG_Z, new Vec3(0, +1, 0))
|
||||
.put(POS_X, new Vec3(0, +1, 0))
|
||||
.put(NEG_X, new Vec3(0, -1, 0))
|
||||
.put(POS_Y, new Vec3(-1, 0, 0))
|
||||
.put(NEG_Y, new Vec3(+1, 0, 0))
|
||||
|
||||
.build(),
|
||||
|
||||
ImmutableMap.<BlockFace, Vec3>builder()
|
||||
ImmutableMap.<AbsFace, Vec3>builder()
|
||||
|
||||
.put(TOP, new Vec3(+1, 0, 0))
|
||||
.put(BOTTOM, new Vec3(+1, 0, 0))
|
||||
.put(NORTH, new Vec3(0, 0, +1))
|
||||
.put(SOUTH, new Vec3(0, 0, +1))
|
||||
.put(WEST, new Vec3(0, 0, +1))
|
||||
.put(EAST, new Vec3(0, 0, +1))
|
||||
.put(POS_Z, new Vec3(+1, 0, 0))
|
||||
.put(NEG_Z, new Vec3(+1, 0, 0))
|
||||
.put(POS_X, new Vec3(0, 0, +1))
|
||||
.put(NEG_X, new Vec3(0, 0, +1))
|
||||
.put(POS_Y, new Vec3(0, 0, +1))
|
||||
.put(NEG_Y, new Vec3(0, 0, +1))
|
||||
|
||||
.build()
|
||||
);
|
||||
@ -100,29 +100,29 @@ class BlockFaceVectors {
|
||||
return inner ? INNER : OUTER;
|
||||
}
|
||||
|
||||
private final ImmutableMap<BlockFace, Vec3> origins;
|
||||
private final ImmutableMap<BlockFace, Vec3> widths;
|
||||
private final ImmutableMap<BlockFace, Vec3> heights;
|
||||
private final ImmutableMap<AbsFace, Vec3> origins;
|
||||
private final ImmutableMap<AbsFace, Vec3> widths;
|
||||
private final ImmutableMap<AbsFace, Vec3> heights;
|
||||
|
||||
public BlockFaceVectors(
|
||||
ImmutableMap<BlockFace, Vec3> origins,
|
||||
ImmutableMap<BlockFace, Vec3> widths,
|
||||
ImmutableMap<BlockFace, Vec3> heights
|
||||
ImmutableMap<AbsFace, Vec3> origins,
|
||||
ImmutableMap<AbsFace, Vec3> widths,
|
||||
ImmutableMap<AbsFace, Vec3> heights
|
||||
) {
|
||||
this.origins = origins;
|
||||
this.widths = widths;
|
||||
this.heights = heights;
|
||||
}
|
||||
|
||||
public Vec3 getOrigin(BlockFace face) {
|
||||
public Vec3 getOrigin(AbsFace face) {
|
||||
return origins.get(face);
|
||||
}
|
||||
|
||||
public Vec3 getWidth(BlockFace face) {
|
||||
public Vec3 getWidth(AbsFace face) {
|
||||
return widths.get(face);
|
||||
}
|
||||
|
||||
public Vec3 getHeight(BlockFace face) {
|
||||
public Vec3 getHeight(AbsFace face) {
|
||||
return heights.get(face);
|
||||
}
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ import glm.vec._3.Vec3;
|
||||
import glm.vec._4.Vec4;
|
||||
import ru.windcorp.progressia.client.graphics.model.ShapeRenderProgram.VertexBuilder;
|
||||
import ru.windcorp.progressia.client.graphics.texture.Texture;
|
||||
import ru.windcorp.progressia.common.world.block.BlockFace;
|
||||
import ru.windcorp.progressia.common.world.block.AbsFace;
|
||||
|
||||
public class Faces {
|
||||
|
||||
@ -94,7 +94,7 @@ public class Faces {
|
||||
Texture texture,
|
||||
Vec4 colorMultiplier,
|
||||
Vec3 blockCenter,
|
||||
BlockFace face,
|
||||
AbsFace face,
|
||||
boolean inner
|
||||
) {
|
||||
BlockFaceVectors vectors = BlockFaceVectors.get(inner);
|
||||
|
@ -24,7 +24,7 @@ import glm.vec._3.Vec3;
|
||||
import glm.vec._4.Vec4;
|
||||
import ru.windcorp.progressia.client.graphics.backend.Usage;
|
||||
import ru.windcorp.progressia.client.graphics.texture.Texture;
|
||||
import ru.windcorp.progressia.common.world.block.BlockFace;
|
||||
import ru.windcorp.progressia.common.world.block.AbsFace;
|
||||
|
||||
public class Shapes {
|
||||
|
||||
@ -165,16 +165,16 @@ public class Shapes {
|
||||
|
||||
public PppBuilder(
|
||||
ShapeRenderProgram program,
|
||||
Map<BlockFace, Texture> textureMap
|
||||
Map<AbsFace, Texture> textureMap
|
||||
) {
|
||||
this(
|
||||
program,
|
||||
textureMap.get(BlockFace.TOP),
|
||||
textureMap.get(BlockFace.BOTTOM),
|
||||
textureMap.get(BlockFace.NORTH),
|
||||
textureMap.get(BlockFace.SOUTH),
|
||||
textureMap.get(BlockFace.EAST),
|
||||
textureMap.get(BlockFace.WEST)
|
||||
textureMap.get(AbsFace.POS_Z),
|
||||
textureMap.get(AbsFace.NEG_Z),
|
||||
textureMap.get(AbsFace.POS_X),
|
||||
textureMap.get(AbsFace.NEG_X),
|
||||
textureMap.get(AbsFace.NEG_Y),
|
||||
textureMap.get(AbsFace.POS_Y)
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -21,7 +21,7 @@ package ru.windcorp.progressia.client.graphics.texture;
|
||||
import java.util.Map;
|
||||
|
||||
import glm.vec._2.Vec2;
|
||||
import ru.windcorp.progressia.common.world.block.BlockFace;
|
||||
import ru.windcorp.progressia.common.world.block.AbsFace;
|
||||
|
||||
public class ComplexTexture {
|
||||
|
||||
@ -54,14 +54,14 @@ public class ComplexTexture {
|
||||
);
|
||||
}
|
||||
|
||||
public Map<BlockFace, Texture> getCuboidTextures(
|
||||
public Map<AbsFace, Texture> getCuboidTextures(
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
int height,
|
||||
int depth
|
||||
) {
|
||||
return BlockFace.mapToFaces(
|
||||
return AbsFace.mapToFaces(
|
||||
get(
|
||||
x + depth + width,
|
||||
y + height + depth,
|
||||
@ -86,7 +86,7 @@ public class ComplexTexture {
|
||||
);
|
||||
}
|
||||
|
||||
public Map<BlockFace, Texture> getCuboidTextures(
|
||||
public Map<AbsFace, Texture> getCuboidTextures(
|
||||
int x,
|
||||
int y,
|
||||
int size
|
||||
|
@ -23,13 +23,13 @@ import glm.vec._3.Vec3;
|
||||
import glm.vec._3.i.Vec3i;
|
||||
import ru.windcorp.progressia.client.world.WorldRender;
|
||||
import ru.windcorp.progressia.common.world.BlockRay;
|
||||
import ru.windcorp.progressia.common.world.block.BlockFace;
|
||||
import ru.windcorp.progressia.common.world.block.AbsFace;
|
||||
import ru.windcorp.progressia.common.world.entity.EntityData;
|
||||
|
||||
public class Selection {
|
||||
|
||||
private final Vec3i block = new Vec3i();
|
||||
private BlockFace surface = null;
|
||||
private AbsFace surface = null;
|
||||
private final Vec2 pointOnSurface = new Vec2(0.5f, 0.5f);
|
||||
private final Vec3 point = new Vec3();
|
||||
|
||||
@ -70,7 +70,7 @@ public class Selection {
|
||||
return exists ? point : null;
|
||||
}
|
||||
|
||||
public BlockFace getSurface() {
|
||||
public AbsFace getSurface() {
|
||||
return exists ? surface : null;
|
||||
}
|
||||
|
||||
|
@ -30,7 +30,7 @@ import ru.windcorp.progressia.client.world.tile.TileRender;
|
||||
import ru.windcorp.progressia.client.world.tile.TileRenderRegistry;
|
||||
import ru.windcorp.progressia.client.world.tile.TileRenderStack;
|
||||
import ru.windcorp.progressia.common.world.ChunkData;
|
||||
import ru.windcorp.progressia.common.world.block.BlockFace;
|
||||
import ru.windcorp.progressia.common.world.block.AbsFace;
|
||||
import ru.windcorp.progressia.common.world.generic.GenericChunk;
|
||||
import ru.windcorp.progressia.common.world.tile.TileDataStack;
|
||||
|
||||
@ -64,12 +64,12 @@ public class ChunkRender
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileRenderStack getTiles(Vec3i blockInChunk, BlockFace face) {
|
||||
public TileRenderStack getTiles(Vec3i blockInChunk, AbsFace face) {
|
||||
return getTileStackWrapper(getData().getTiles(blockInChunk, face));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTiles(Vec3i blockInChunk, BlockFace face) {
|
||||
public boolean hasTiles(Vec3i blockInChunk, AbsFace face) {
|
||||
return getData().hasTiles(blockInChunk, face);
|
||||
}
|
||||
|
||||
@ -119,7 +119,7 @@ public class ChunkRender
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockFace getFace() {
|
||||
public AbsFace getFace() {
|
||||
return parent.getFace();
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,7 @@ import ru.windcorp.progressia.client.world.tile.TileRender;
|
||||
import ru.windcorp.progressia.client.world.tile.TileRenderNone;
|
||||
import ru.windcorp.progressia.client.world.tile.TileRenderStack;
|
||||
import ru.windcorp.progressia.common.world.ChunkData;
|
||||
import ru.windcorp.progressia.common.world.block.BlockFace;
|
||||
import ru.windcorp.progressia.common.world.block.AbsFace;
|
||||
|
||||
public class ChunkRenderModel implements Renderable {
|
||||
|
||||
@ -99,7 +99,7 @@ public class ChunkRenderModel implements Renderable {
|
||||
private void processBlockAndTiles(Vec3i blockInChunk, Builder sink) {
|
||||
processBlock(blockInChunk, sink);
|
||||
|
||||
for (BlockFace face : BlockFace.getFaces()) {
|
||||
for (AbsFace face : AbsFace.getFaces()) {
|
||||
processTileStack(blockInChunk, face, sink);
|
||||
}
|
||||
}
|
||||
@ -127,7 +127,7 @@ public class ChunkRenderModel implements Renderable {
|
||||
}
|
||||
}
|
||||
|
||||
private void processTileStack(Vec3i blockInChunk, BlockFace face, Builder sink) {
|
||||
private void processTileStack(Vec3i blockInChunk, AbsFace face, Builder sink) {
|
||||
TileRenderStack trs = chunk.getTilesOrNull(blockInChunk, face);
|
||||
|
||||
if (trs == null || trs.isEmpty()) {
|
||||
@ -137,7 +137,7 @@ public class ChunkRenderModel implements Renderable {
|
||||
trs.forEach(tile -> processTile(tile, blockInChunk, face, sink));
|
||||
}
|
||||
|
||||
private void processTile(TileRender tile, Vec3i blockInChunk, BlockFace face, Builder sink) {
|
||||
private void processTile(TileRender tile, Vec3i blockInChunk, AbsFace face, Builder sink) {
|
||||
if (tile instanceof TileRenderNone) {
|
||||
return;
|
||||
}
|
||||
@ -152,7 +152,7 @@ public class ChunkRenderModel implements Renderable {
|
||||
processTileWithCROs(tile, blockInChunk, face);
|
||||
}
|
||||
|
||||
private void processTileWithCROs(TileRender tile, Vec3i blockInChunk, BlockFace face) {
|
||||
private void processTileWithCROs(TileRender tile, Vec3i blockInChunk, AbsFace face) {
|
||||
for (ChunkRenderOptimizer optimizer : optimizers) {
|
||||
optimizer.addTile(tile, blockInChunk, face);
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ import glm.vec._3.i.Vec3i;
|
||||
import ru.windcorp.progressia.common.world.ChunkData;
|
||||
import ru.windcorp.progressia.common.world.ChunkDataListener;
|
||||
import ru.windcorp.progressia.common.world.block.BlockData;
|
||||
import ru.windcorp.progressia.common.world.block.BlockFace;
|
||||
import ru.windcorp.progressia.common.world.block.AbsFace;
|
||||
import ru.windcorp.progressia.common.world.tile.TileData;
|
||||
|
||||
class ChunkUpdateListener implements ChunkDataListener {
|
||||
@ -41,7 +41,7 @@ class ChunkUpdateListener implements ChunkDataListener {
|
||||
@Override
|
||||
public void onChunkLoaded(ChunkData chunk) {
|
||||
Vec3i cursor = new Vec3i();
|
||||
for (BlockFace face : BlockFace.getFaces()) {
|
||||
for (AbsFace face : AbsFace.getFaces()) {
|
||||
cursor.set(chunk.getX(), chunk.getY(), chunk.getZ());
|
||||
cursor.add(face.getVector());
|
||||
world.markChunkForUpdate(cursor);
|
||||
@ -57,7 +57,7 @@ class ChunkUpdateListener implements ChunkDataListener {
|
||||
public void onChunkTilesChanged(
|
||||
ChunkData chunk,
|
||||
Vec3i blockInChunk,
|
||||
BlockFace face,
|
||||
AbsFace face,
|
||||
TileData tile,
|
||||
boolean wasAdded
|
||||
) {
|
||||
|
@ -19,27 +19,27 @@
|
||||
package ru.windcorp.progressia.client.world.block;
|
||||
|
||||
import ru.windcorp.progressia.client.graphics.texture.Texture;
|
||||
import ru.windcorp.progressia.common.world.block.BlockFace;
|
||||
import ru.windcorp.progressia.common.world.block.AbsFace;
|
||||
|
||||
public class BlockRenderOpaqueCube extends BlockRenderTexturedCube {
|
||||
|
||||
public BlockRenderOpaqueCube(
|
||||
String id,
|
||||
Texture topTexture,
|
||||
Texture bottomTexture,
|
||||
Texture northTexture,
|
||||
Texture southTexture,
|
||||
Texture eastTexture,
|
||||
Texture westTexture
|
||||
Texture posZTexture,
|
||||
Texture negZTexture,
|
||||
Texture posXTexture,
|
||||
Texture negXTexture,
|
||||
Texture negYTexture,
|
||||
Texture posYTexture
|
||||
) {
|
||||
super(
|
||||
id,
|
||||
topTexture,
|
||||
bottomTexture,
|
||||
northTexture,
|
||||
southTexture,
|
||||
eastTexture,
|
||||
westTexture
|
||||
posZTexture,
|
||||
negZTexture,
|
||||
posXTexture,
|
||||
negXTexture,
|
||||
negYTexture,
|
||||
posYTexture
|
||||
);
|
||||
}
|
||||
|
||||
@ -56,7 +56,7 @@ public class BlockRenderOpaqueCube extends BlockRenderTexturedCube {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaque(BlockFace face) {
|
||||
public boolean isOpaque(AbsFace face) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
package ru.windcorp.progressia.client.world.block;
|
||||
|
||||
import static ru.windcorp.progressia.common.world.block.BlockFace.*;
|
||||
import static ru.windcorp.progressia.common.world.block.AbsFace.*;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
@ -38,44 +38,44 @@ import ru.windcorp.progressia.client.graphics.world.WorldRenderProgram;
|
||||
import ru.windcorp.progressia.client.world.cro.ChunkRenderOptimizerSurface.BlockOptimizedSurface;
|
||||
import ru.windcorp.progressia.common.util.Vectors;
|
||||
import ru.windcorp.progressia.common.world.ChunkData;
|
||||
import ru.windcorp.progressia.common.world.block.BlockFace;
|
||||
import ru.windcorp.progressia.common.world.block.AbsFace;
|
||||
|
||||
public abstract class BlockRenderTexturedCube
|
||||
extends BlockRender
|
||||
implements BlockOptimizedSurface {
|
||||
|
||||
private final Map<BlockFace, Texture> textures = new HashMap<>();
|
||||
private final Map<AbsFace, Texture> textures = new HashMap<>();
|
||||
|
||||
public BlockRenderTexturedCube(
|
||||
String id,
|
||||
Texture topTexture,
|
||||
Texture bottomTexture,
|
||||
Texture northTexture,
|
||||
Texture southTexture,
|
||||
Texture eastTexture,
|
||||
Texture westTexture
|
||||
Texture posZTexture,
|
||||
Texture negZTexture,
|
||||
Texture posXTexture,
|
||||
Texture negXTexture,
|
||||
Texture negYTexture,
|
||||
Texture posYTexture
|
||||
) {
|
||||
super(id);
|
||||
|
||||
textures.put(TOP, topTexture);
|
||||
textures.put(BOTTOM, bottomTexture);
|
||||
textures.put(NORTH, northTexture);
|
||||
textures.put(SOUTH, southTexture);
|
||||
textures.put(EAST, eastTexture);
|
||||
textures.put(WEST, westTexture);
|
||||
textures.put(POS_Z, posZTexture);
|
||||
textures.put(NEG_Z, negZTexture);
|
||||
textures.put(POS_X, posXTexture);
|
||||
textures.put(NEG_X, negXTexture);
|
||||
textures.put(NEG_Y, negYTexture);
|
||||
textures.put(POS_Y, posYTexture);
|
||||
}
|
||||
|
||||
public Texture getTexture(BlockFace blockFace) {
|
||||
public Texture getTexture(AbsFace blockFace) {
|
||||
return textures.get(blockFace);
|
||||
}
|
||||
|
||||
public Vec4 getColorMultiplier(BlockFace blockFace) {
|
||||
public Vec4 getColorMultiplier(AbsFace blockFace) {
|
||||
return Colors.WHITE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void getFaces(
|
||||
ChunkData chunk, Vec3i blockInChunk, BlockFace blockFace,
|
||||
ChunkData chunk, Vec3i blockInChunk, AbsFace blockFace,
|
||||
boolean inner,
|
||||
Consumer<Face> output,
|
||||
Vec3 offset
|
||||
@ -84,7 +84,7 @@ public abstract class BlockRenderTexturedCube
|
||||
}
|
||||
|
||||
private Face createFace(
|
||||
ChunkData chunk, Vec3i blockInChunk, BlockFace blockFace,
|
||||
ChunkData chunk, Vec3i blockInChunk, AbsFace blockFace,
|
||||
boolean inner,
|
||||
Vec3 offset
|
||||
) {
|
||||
@ -105,12 +105,12 @@ public abstract class BlockRenderTexturedCube
|
||||
Face[] faces = new Face[BLOCK_FACE_COUNT + (opaque ? BLOCK_FACE_COUNT : 0)];
|
||||
|
||||
for (int i = 0; i < BLOCK_FACE_COUNT; ++i) {
|
||||
faces[i] = createFace(chunk, blockInChunk, BlockFace.getFaces().get(i), false, Vectors.ZERO_3);
|
||||
faces[i] = createFace(chunk, blockInChunk, AbsFace.getFaces().get(i), false, Vectors.ZERO_3);
|
||||
}
|
||||
|
||||
if (!opaque) {
|
||||
for (int i = 0; i < BLOCK_FACE_COUNT; ++i) {
|
||||
faces[i + BLOCK_FACE_COUNT] = createFace(chunk, blockInChunk, BlockFace.getFaces().get(i), true, Vectors.ZERO_3);
|
||||
faces[i + BLOCK_FACE_COUNT] = createFace(chunk, blockInChunk, AbsFace.getFaces().get(i), true, Vectors.ZERO_3);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -19,27 +19,27 @@
|
||||
package ru.windcorp.progressia.client.world.block;
|
||||
|
||||
import ru.windcorp.progressia.client.graphics.texture.Texture;
|
||||
import ru.windcorp.progressia.common.world.block.BlockFace;
|
||||
import ru.windcorp.progressia.common.world.block.AbsFace;
|
||||
|
||||
public class BlockRenderTransparentCube extends BlockRenderTexturedCube {
|
||||
|
||||
public BlockRenderTransparentCube(
|
||||
String id,
|
||||
Texture topTexture,
|
||||
Texture bottomTexture,
|
||||
Texture northTexture,
|
||||
Texture southTexture,
|
||||
Texture eastTexture,
|
||||
Texture westTexture
|
||||
Texture posZTexture,
|
||||
Texture negZTexture,
|
||||
Texture posXTexture,
|
||||
Texture negXTexture,
|
||||
Texture negYTexture,
|
||||
Texture posYTexture
|
||||
) {
|
||||
super(
|
||||
id,
|
||||
topTexture,
|
||||
bottomTexture,
|
||||
northTexture,
|
||||
southTexture,
|
||||
eastTexture,
|
||||
westTexture
|
||||
posZTexture,
|
||||
negZTexture,
|
||||
posXTexture,
|
||||
negXTexture,
|
||||
negYTexture,
|
||||
posYTexture
|
||||
);
|
||||
}
|
||||
|
||||
@ -56,7 +56,7 @@ public class BlockRenderTransparentCube extends BlockRenderTexturedCube {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaque(BlockFace face) {
|
||||
public boolean isOpaque(AbsFace face) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -24,7 +24,7 @@ import ru.windcorp.progressia.client.world.ChunkRender;
|
||||
import ru.windcorp.progressia.client.world.block.BlockRender;
|
||||
import ru.windcorp.progressia.client.world.tile.TileRender;
|
||||
import ru.windcorp.progressia.common.util.namespaces.Namespaced;
|
||||
import ru.windcorp.progressia.common.world.block.BlockFace;
|
||||
import ru.windcorp.progressia.common.world.block.AbsFace;
|
||||
|
||||
/**
|
||||
* Chunk render optimizer (CRO) is an object that produces optimized models for
|
||||
@ -44,7 +44,7 @@ import ru.windcorp.progressia.common.world.block.BlockFace;
|
||||
* instance.</li>
|
||||
* <li>{@link #startRender()} is invoked. The CRO must reset its state.</li>
|
||||
* <li>{@link #addBlock(BlockRender, Vec3i)} and
|
||||
* {@link #addTile(TileRender, Vec3i, BlockFace)} are invoked for each block and
|
||||
* {@link #addTile(TileRender, Vec3i, AbsFace)} are invoked for each block and
|
||||
* tile that this CRO should optimize. {@code addTile} specifies tiles in order
|
||||
* of ascension within a tile stack.</li>
|
||||
* <li>{@link #endRender()} is invoked. The CRO may perform any pending
|
||||
@ -116,7 +116,7 @@ public abstract class ChunkRenderOptimizer extends Namespaced {
|
||||
* @param blockInChunk the position of the block that the tile belongs to
|
||||
* @param blockFace the face that the tile belongs to
|
||||
*/
|
||||
public abstract void addTile(TileRender tile, Vec3i blockInChunk, BlockFace blockFace);
|
||||
public abstract void addTile(TileRender tile, Vec3i blockInChunk, AbsFace blockFace);
|
||||
|
||||
/**
|
||||
* Requests that the CRO assembles and outputs its model. This method may
|
||||
|
@ -19,7 +19,7 @@
|
||||
package ru.windcorp.progressia.client.world.cro;
|
||||
|
||||
import static ru.windcorp.progressia.common.world.ChunkData.BLOCKS_PER_CHUNK;
|
||||
import static ru.windcorp.progressia.common.world.block.BlockFace.BLOCK_FACE_COUNT;
|
||||
import static ru.windcorp.progressia.common.world.block.AbsFace.BLOCK_FACE_COUNT;
|
||||
import static ru.windcorp.progressia.common.world.generic.GenericTileStack.TILES_PER_FACE;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@ -38,7 +38,7 @@ import ru.windcorp.progressia.client.world.block.BlockRender;
|
||||
import ru.windcorp.progressia.client.world.tile.TileRender;
|
||||
import ru.windcorp.progressia.common.util.Vectors;
|
||||
import ru.windcorp.progressia.common.world.ChunkData;
|
||||
import ru.windcorp.progressia.common.world.block.BlockFace;
|
||||
import ru.windcorp.progressia.common.world.block.AbsFace;
|
||||
|
||||
public class ChunkRenderOptimizerSurface extends ChunkRenderOptimizer {
|
||||
|
||||
@ -69,7 +69,7 @@ public class ChunkRenderOptimizerSurface extends ChunkRenderOptimizer {
|
||||
void getFaces(
|
||||
ChunkData chunk,
|
||||
Vec3i blockInChunk,
|
||||
BlockFace blockFace,
|
||||
AbsFace blockFace,
|
||||
boolean inner,
|
||||
Consumer<Face> output,
|
||||
Vec3 offset /* kostyl 156% */
|
||||
@ -77,14 +77,14 @@ public class ChunkRenderOptimizerSurface extends ChunkRenderOptimizer {
|
||||
|
||||
/**
|
||||
* Returns the opacity of the surface identified by the provided
|
||||
* {@link BlockFace}.
|
||||
* {@link AbsFace}.
|
||||
* Opaque surfaces prevent surfaces behind them from being included in
|
||||
* chunk models.
|
||||
*
|
||||
* @param blockFace the face to query
|
||||
* @return {@code true} iff the surface is opaque.
|
||||
*/
|
||||
boolean isOpaque(BlockFace blockFace);
|
||||
boolean isOpaque(AbsFace blockFace);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -168,7 +168,7 @@ public class ChunkRenderOptimizerSurface extends ChunkRenderOptimizer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addTile(TileRender tile, Vec3i pos, BlockFace face) {
|
||||
public void addTile(TileRender tile, Vec3i pos, AbsFace face) {
|
||||
if (!(tile instanceof TileOptimizedSurface))
|
||||
return;
|
||||
|
||||
@ -180,7 +180,7 @@ public class ChunkRenderOptimizerSurface extends ChunkRenderOptimizer {
|
||||
getBlock(pos).block = block;
|
||||
}
|
||||
|
||||
private void addTile(Vec3i pos, BlockFace face, TileOptimizedSurface tile) {
|
||||
private void addTile(Vec3i pos, AbsFace face, TileOptimizedSurface tile) {
|
||||
FaceInfo faceInfo = getFace(pos, face);
|
||||
|
||||
int index = faceInfo.tileCount;
|
||||
@ -201,7 +201,7 @@ public class ChunkRenderOptimizerSurface extends ChunkRenderOptimizer {
|
||||
return data[cursor.x][cursor.y][cursor.z];
|
||||
}
|
||||
|
||||
protected FaceInfo getFace(Vec3i cursor, BlockFace face) {
|
||||
protected FaceInfo getFace(Vec3i cursor, AbsFace face) {
|
||||
return getBlock(cursor).faces[face.getId()];
|
||||
}
|
||||
|
||||
@ -238,12 +238,12 @@ public class ChunkRenderOptimizerSurface extends ChunkRenderOptimizer {
|
||||
Vec3i blockInChunk,
|
||||
Consumer<Face> output
|
||||
) {
|
||||
for (BlockFace blockFace : BlockFace.getFaces()) {
|
||||
for (AbsFace blockFace : AbsFace.getFaces()) {
|
||||
processOuterFace(blockInChunk, blockFace, output);
|
||||
}
|
||||
}
|
||||
|
||||
private void processOuterFace(Vec3i blockInChunk, BlockFace blockFace, Consumer<Face> output) {
|
||||
private void processOuterFace(Vec3i blockInChunk, AbsFace blockFace, Consumer<Face> output) {
|
||||
if (!shouldRenderOuterFace(blockInChunk, blockFace))
|
||||
return;
|
||||
|
||||
@ -274,12 +274,12 @@ public class ChunkRenderOptimizerSurface extends ChunkRenderOptimizer {
|
||||
Vec3i blockInChunk,
|
||||
Consumer<Face> output
|
||||
) {
|
||||
for (BlockFace blockFace : BlockFace.getFaces()) {
|
||||
for (AbsFace blockFace : AbsFace.getFaces()) {
|
||||
processInnerFace(blockInChunk, blockFace, output);
|
||||
}
|
||||
}
|
||||
|
||||
private void processInnerFace(Vec3i blockInChunk, BlockFace blockFace, Consumer<Face> output) {
|
||||
private void processInnerFace(Vec3i blockInChunk, AbsFace blockFace, Consumer<Face> output) {
|
||||
if (!shouldRenderInnerFace(blockInChunk, blockFace))
|
||||
return;
|
||||
|
||||
@ -306,7 +306,7 @@ public class ChunkRenderOptimizerSurface extends ChunkRenderOptimizer {
|
||||
}
|
||||
}
|
||||
|
||||
private boolean shouldRenderOuterFace(Vec3i blockInChunk, BlockFace face) {
|
||||
private boolean shouldRenderOuterFace(Vec3i blockInChunk, AbsFace face) {
|
||||
blockInChunk.add(face.getVector());
|
||||
try {
|
||||
return shouldRenderWhenFacing(blockInChunk, face);
|
||||
@ -315,11 +315,11 @@ public class ChunkRenderOptimizerSurface extends ChunkRenderOptimizer {
|
||||
}
|
||||
}
|
||||
|
||||
private boolean shouldRenderInnerFace(Vec3i blockInChunk, BlockFace face) {
|
||||
private boolean shouldRenderInnerFace(Vec3i blockInChunk, AbsFace face) {
|
||||
return shouldRenderWhenFacing(blockInChunk, face);
|
||||
}
|
||||
|
||||
private boolean shouldRenderWhenFacing(Vec3i blockInChunk, BlockFace face) {
|
||||
private boolean shouldRenderWhenFacing(Vec3i blockInChunk, AbsFace face) {
|
||||
if (chunk.containsBiC(blockInChunk)) {
|
||||
return shouldRenderWhenFacingLocal(blockInChunk, face);
|
||||
} else {
|
||||
@ -327,7 +327,7 @@ public class ChunkRenderOptimizerSurface extends ChunkRenderOptimizer {
|
||||
}
|
||||
}
|
||||
|
||||
private boolean shouldRenderWhenFacingLocal(Vec3i blockInChunk, BlockFace face) {
|
||||
private boolean shouldRenderWhenFacingLocal(Vec3i blockInChunk, AbsFace face) {
|
||||
BlockOptimizedSurface block = getBlock(blockInChunk).block;
|
||||
|
||||
if (block == null) {
|
||||
@ -340,7 +340,7 @@ public class ChunkRenderOptimizerSurface extends ChunkRenderOptimizer {
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean shouldRenderWhenFacingNeighbor(Vec3i blockInLocalChunk, BlockFace face) {
|
||||
private boolean shouldRenderWhenFacingNeighbor(Vec3i blockInLocalChunk, AbsFace face) {
|
||||
Vec3i blockInChunk = Vectors.grab3i().set(blockInLocalChunk.x, blockInLocalChunk.y, blockInLocalChunk.z);
|
||||
Vec3i chunkPos = Vectors.grab3i().set(chunk.getX(), chunk.getY(), chunk.getZ());
|
||||
|
||||
|
@ -24,7 +24,7 @@ import ru.windcorp.progressia.client.graphics.model.Renderable;
|
||||
import ru.windcorp.progressia.client.world.cro.ChunkRenderOptimizer;
|
||||
import ru.windcorp.progressia.common.util.namespaces.Namespaced;
|
||||
import ru.windcorp.progressia.common.world.ChunkData;
|
||||
import ru.windcorp.progressia.common.world.block.BlockFace;
|
||||
import ru.windcorp.progressia.common.world.block.AbsFace;
|
||||
import ru.windcorp.progressia.common.world.generic.GenericTile;
|
||||
|
||||
public class TileRender extends Namespaced implements GenericTile {
|
||||
@ -33,13 +33,13 @@ public class TileRender extends Namespaced implements GenericTile {
|
||||
super(id);
|
||||
}
|
||||
|
||||
public void render(ShapeRenderHelper renderer, BlockFace face) {
|
||||
public void render(ShapeRenderHelper renderer, AbsFace face) {
|
||||
throw new UnsupportedOperationException(
|
||||
"TileRender.render() not implemented in " + this
|
||||
);
|
||||
}
|
||||
|
||||
public Renderable createRenderable(ChunkData chunk, Vec3i blockInChunk, BlockFace face) {
|
||||
public Renderable createRenderable(ChunkData chunk, Vec3i blockInChunk, AbsFace face) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,7 @@
|
||||
package ru.windcorp.progressia.client.world.tile;
|
||||
|
||||
import ru.windcorp.progressia.client.graphics.texture.Texture;
|
||||
import ru.windcorp.progressia.common.world.block.BlockFace;
|
||||
import ru.windcorp.progressia.common.world.block.AbsFace;
|
||||
|
||||
public class TileRenderGrass extends TileRenderSurface {
|
||||
|
||||
@ -37,13 +37,13 @@ public class TileRenderGrass extends TileRenderSurface {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Texture getTexture(BlockFace face) {
|
||||
return (face == BlockFace.TOP) ? topTexture : sideTexture;
|
||||
public Texture getTexture(AbsFace face) {
|
||||
return (face == AbsFace.POS_Z) ? topTexture : sideTexture;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaque(BlockFace face) {
|
||||
return face == BlockFace.TOP;
|
||||
public boolean isOpaque(AbsFace face) {
|
||||
return face == AbsFace.POS_Z;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ import glm.vec._3.i.Vec3i;
|
||||
import ru.windcorp.progressia.client.graphics.model.EmptyModel;
|
||||
import ru.windcorp.progressia.client.graphics.model.Renderable;
|
||||
import ru.windcorp.progressia.common.world.ChunkData;
|
||||
import ru.windcorp.progressia.common.world.block.BlockFace;
|
||||
import ru.windcorp.progressia.common.world.block.AbsFace;
|
||||
|
||||
public class TileRenderNone extends TileRender {
|
||||
|
||||
@ -30,7 +30,7 @@ public class TileRenderNone extends TileRender {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Renderable createRenderable(ChunkData chunk, Vec3i blockInChunk, BlockFace face) {
|
||||
public Renderable createRenderable(ChunkData chunk, Vec3i blockInChunk, AbsFace face) {
|
||||
return EmptyModel.getInstance();
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,7 @@
|
||||
package ru.windcorp.progressia.client.world.tile;
|
||||
|
||||
import ru.windcorp.progressia.client.graphics.texture.Texture;
|
||||
import ru.windcorp.progressia.common.world.block.BlockFace;
|
||||
import ru.windcorp.progressia.common.world.block.AbsFace;
|
||||
|
||||
public class TileRenderOpaqueSurface extends TileRenderSurface {
|
||||
|
||||
@ -28,7 +28,7 @@ public class TileRenderOpaqueSurface extends TileRenderSurface {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaque(BlockFace face) {
|
||||
public boolean isOpaque(AbsFace face) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,7 @@ import ru.windcorp.progressia.client.graphics.world.WorldRenderProgram;
|
||||
import ru.windcorp.progressia.client.world.cro.ChunkRenderOptimizerSurface.TileOptimizedSurface;
|
||||
import ru.windcorp.progressia.common.util.Vectors;
|
||||
import ru.windcorp.progressia.common.world.ChunkData;
|
||||
import ru.windcorp.progressia.common.world.block.BlockFace;
|
||||
import ru.windcorp.progressia.common.world.block.AbsFace;
|
||||
|
||||
public abstract class TileRenderSurface extends TileRender implements TileOptimizedSurface {
|
||||
|
||||
@ -49,17 +49,17 @@ public abstract class TileRenderSurface extends TileRender implements TileOptimi
|
||||
this(id, null);
|
||||
}
|
||||
|
||||
public Texture getTexture(BlockFace blockFace) {
|
||||
public Texture getTexture(AbsFace blockFace) {
|
||||
return texture;
|
||||
}
|
||||
|
||||
public Vec4 getColorMultiplier(BlockFace blockFace) {
|
||||
public Vec4 getColorMultiplier(AbsFace blockFace) {
|
||||
return Colors.WHITE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void getFaces(
|
||||
ChunkData chunk, Vec3i blockInChunk, BlockFace blockFace,
|
||||
ChunkData chunk, Vec3i blockInChunk, AbsFace blockFace,
|
||||
boolean inner,
|
||||
Consumer<Face> output,
|
||||
Vec3 offset
|
||||
@ -68,7 +68,7 @@ public abstract class TileRenderSurface extends TileRender implements TileOptimi
|
||||
}
|
||||
|
||||
private Face createFace(
|
||||
ChunkData chunk, Vec3i blockInChunk, BlockFace blockFace,
|
||||
ChunkData chunk, Vec3i blockInChunk, AbsFace blockFace,
|
||||
boolean inner,
|
||||
Vec3 offset
|
||||
) {
|
||||
@ -83,7 +83,7 @@ public abstract class TileRenderSurface extends TileRender implements TileOptimi
|
||||
}
|
||||
|
||||
@Override
|
||||
public Renderable createRenderable(ChunkData chunk, Vec3i blockInChunk, BlockFace blockFace) {
|
||||
public Renderable createRenderable(ChunkData chunk, Vec3i blockInChunk, AbsFace blockFace) {
|
||||
return new Shape(
|
||||
Usage.STATIC,
|
||||
WorldRenderProgram.getDefault(),
|
||||
|
@ -19,7 +19,7 @@
|
||||
package ru.windcorp.progressia.client.world.tile;
|
||||
|
||||
import ru.windcorp.progressia.client.graphics.texture.Texture;
|
||||
import ru.windcorp.progressia.common.world.block.BlockFace;
|
||||
import ru.windcorp.progressia.common.world.block.AbsFace;
|
||||
|
||||
public class TileRenderTransparentSurface extends TileRenderSurface {
|
||||
|
||||
@ -28,7 +28,7 @@ public class TileRenderTransparentSurface extends TileRenderSurface {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaque(BlockFace face) {
|
||||
public boolean isOpaque(AbsFace face) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,7 @@
|
||||
package ru.windcorp.progressia.common.collision;
|
||||
|
||||
import glm.vec._3.Vec3;
|
||||
import ru.windcorp.progressia.common.world.block.BlockFace;
|
||||
import ru.windcorp.progressia.common.world.block.AbsFace;
|
||||
|
||||
public interface AABBoid extends CollisionModel {
|
||||
|
||||
@ -27,7 +27,7 @@ public interface AABBoid extends CollisionModel {
|
||||
|
||||
void getSize(Vec3 output);
|
||||
|
||||
default Wall getWall(BlockFace face) {
|
||||
default Wall getWall(AbsFace face) {
|
||||
return getWall(face.getId());
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,7 @@ package ru.windcorp.progressia.common.collision;
|
||||
|
||||
import glm.vec._3.Vec3;
|
||||
import ru.windcorp.progressia.common.util.Vectors;
|
||||
import ru.windcorp.progressia.common.world.block.BlockFace;
|
||||
import ru.windcorp.progressia.common.world.block.AbsFace;
|
||||
|
||||
public class TranslatedAABB implements AABBoid {
|
||||
|
||||
@ -51,7 +51,7 @@ public class TranslatedAABB implements AABBoid {
|
||||
private AABBoid parent;
|
||||
private final Vec3 translation = new Vec3();
|
||||
|
||||
private final TranslatedAABBWall[] walls = new TranslatedAABBWall[BlockFace.BLOCK_FACE_COUNT];
|
||||
private final TranslatedAABBWall[] walls = new TranslatedAABBWall[AbsFace.BLOCK_FACE_COUNT];
|
||||
|
||||
{
|
||||
for (int id = 0; id < walls.length; ++id) {
|
||||
|
@ -25,7 +25,7 @@ import ru.windcorp.progressia.common.collision.colliders.Collider.ColliderWorksp
|
||||
import ru.windcorp.progressia.common.collision.colliders.Collider.Collision;
|
||||
import ru.windcorp.progressia.common.util.Matrices;
|
||||
import ru.windcorp.progressia.common.util.Vectors;
|
||||
import ru.windcorp.progressia.common.world.block.BlockFace;
|
||||
import ru.windcorp.progressia.common.world.block.AbsFace;
|
||||
|
||||
class AABBoidCollider {
|
||||
|
||||
@ -50,7 +50,7 @@ class AABBoidCollider {
|
||||
computeCollisionVelocity(collisionVelocity, obstacleBody, colliderBody);
|
||||
|
||||
// For every wall of collision space
|
||||
for (int i = 0; i < BlockFace.BLOCK_FACE_COUNT; ++i) {
|
||||
for (int i = 0; i < AbsFace.BLOCK_FACE_COUNT; ++i) {
|
||||
Wall wall = originCollisionSpace.getWall(i);
|
||||
|
||||
Collision collision = computeWallCollision(
|
||||
|
@ -22,7 +22,7 @@ import glm.vec._3.Vec3;
|
||||
import glm.vec._3.i.Vec3i;
|
||||
import ru.windcorp.progressia.common.util.VectorUtil;
|
||||
import ru.windcorp.progressia.common.util.VectorUtil.Axis;
|
||||
import ru.windcorp.progressia.common.world.block.BlockFace;
|
||||
import ru.windcorp.progressia.common.world.block.AbsFace;
|
||||
|
||||
import static java.lang.Math.*;
|
||||
|
||||
@ -34,7 +34,7 @@ public class BlockRay {
|
||||
private float distance;
|
||||
|
||||
private final Vec3i block = new Vec3i();
|
||||
private BlockFace currentFace = null;
|
||||
private AbsFace currentFace = null;
|
||||
|
||||
private boolean isValid = false;
|
||||
|
||||
@ -120,18 +120,18 @@ public class BlockRay {
|
||||
return (edge - c) / dir;
|
||||
}
|
||||
|
||||
private BlockFace computeCurrentFace(Axis axis, int sign) {
|
||||
private AbsFace computeCurrentFace(Axis axis, int sign) {
|
||||
if (sign == 0)
|
||||
throw new IllegalStateException("sign is zero");
|
||||
|
||||
switch (axis) {
|
||||
case X:
|
||||
return sign > 0 ? BlockFace.SOUTH : BlockFace.NORTH;
|
||||
return sign > 0 ? AbsFace.NEG_X : AbsFace.POS_X;
|
||||
case Y:
|
||||
return sign > 0 ? BlockFace.EAST : BlockFace.WEST;
|
||||
return sign > 0 ? AbsFace.NEG_Y : AbsFace.POS_Y;
|
||||
default:
|
||||
case Z:
|
||||
return sign > 0 ? BlockFace.BOTTOM : BlockFace.TOP;
|
||||
return sign > 0 ? AbsFace.NEG_Z : AbsFace.POS_Z;
|
||||
}
|
||||
}
|
||||
|
||||
@ -147,7 +147,7 @@ public class BlockRay {
|
||||
return output;
|
||||
}
|
||||
|
||||
public BlockFace getCurrentFace() {
|
||||
public AbsFace getCurrentFace() {
|
||||
return currentFace;
|
||||
}
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
package ru.windcorp.progressia.common.world;
|
||||
|
||||
import static ru.windcorp.progressia.common.world.block.BlockFace.*;
|
||||
import static ru.windcorp.progressia.common.world.block.AbsFace.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
@ -31,7 +31,7 @@ import java.util.function.Consumer;
|
||||
import glm.vec._3.i.Vec3i;
|
||||
import ru.windcorp.progressia.common.util.VectorUtil;
|
||||
import ru.windcorp.progressia.common.world.block.BlockData;
|
||||
import ru.windcorp.progressia.common.world.block.BlockFace;
|
||||
import ru.windcorp.progressia.common.world.block.AbsFace;
|
||||
import ru.windcorp.progressia.common.world.generic.GenericChunk;
|
||||
import ru.windcorp.progressia.common.world.tile.TileData;
|
||||
import ru.windcorp.progressia.common.world.tile.TileDataStack;
|
||||
@ -83,31 +83,31 @@ public class ChunkData
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileDataStack getTilesOrNull(Vec3i blockInChunk, BlockFace face) {
|
||||
public TileDataStack getTilesOrNull(Vec3i blockInChunk, AbsFace face) {
|
||||
return tiles[getTileIndex(blockInChunk, face)];
|
||||
}
|
||||
|
||||
/**
|
||||
* Internal use only. Modify a list returned by
|
||||
* {@link #getTiles(Vec3i, BlockFace)} or
|
||||
* {@link #getTilesOrNull(Vec3i, BlockFace)}
|
||||
* {@link #getTiles(Vec3i, AbsFace)} or
|
||||
* {@link #getTilesOrNull(Vec3i, AbsFace)}
|
||||
* to change tiles.
|
||||
*/
|
||||
protected void setTiles(
|
||||
Vec3i blockInChunk,
|
||||
BlockFace face,
|
||||
AbsFace face,
|
||||
TileDataStack tiles
|
||||
) {
|
||||
this.tiles[getTileIndex(blockInChunk, face)] = tiles;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTiles(Vec3i blockInChunk, BlockFace face) {
|
||||
public boolean hasTiles(Vec3i blockInChunk, AbsFace face) {
|
||||
return getTilesOrNull(blockInChunk, face) != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileDataStack getTiles(Vec3i blockInChunk, BlockFace face) {
|
||||
public TileDataStack getTiles(Vec3i blockInChunk, AbsFace face) {
|
||||
int index = getTileIndex(blockInChunk, face);
|
||||
|
||||
if (tiles[index] == null) {
|
||||
@ -117,15 +117,15 @@ public class ChunkData
|
||||
return tiles[index];
|
||||
}
|
||||
|
||||
private void createTileStack(Vec3i blockInChunk, BlockFace face) {
|
||||
private void createTileStack(Vec3i blockInChunk, AbsFace face) {
|
||||
Vec3i independentBlockInChunk = conjureIndependentBlockInChunkVec3i(blockInChunk);
|
||||
TileDataStackImpl stack = new TileDataStackImpl(independentBlockInChunk, face);
|
||||
setTiles(blockInChunk, face, stack);
|
||||
}
|
||||
|
||||
private Vec3i conjureIndependentBlockInChunkVec3i(Vec3i blockInChunk) {
|
||||
for (int i = 0; i < BlockFace.BLOCK_FACE_COUNT; ++i) {
|
||||
TileDataStack stack = getTilesOrNull(blockInChunk, BlockFace.getFaces().get(i));
|
||||
for (int i = 0; i < AbsFace.BLOCK_FACE_COUNT; ++i) {
|
||||
TileDataStack stack = getTilesOrNull(blockInChunk, AbsFace.getFaces().get(i));
|
||||
if (stack instanceof TileDataStackImpl) {
|
||||
return ((TileDataStackImpl) stack).blockInChunk;
|
||||
}
|
||||
@ -142,7 +142,7 @@ public class ChunkData
|
||||
posInChunk.x;
|
||||
}
|
||||
|
||||
private static int getTileIndex(Vec3i posInChunk, BlockFace face) {
|
||||
private static int getTileIndex(Vec3i posInChunk, AbsFace face) {
|
||||
return getBlockIndex(posInChunk) * BLOCK_FACE_COUNT +
|
||||
face.getId();
|
||||
}
|
||||
@ -162,14 +162,14 @@ public class ChunkData
|
||||
posInChunk.z >= 0 && posInChunk.z < BLOCKS_PER_CHUNK;
|
||||
}
|
||||
|
||||
public boolean isBorder(Vec3i blockInChunk, BlockFace face) {
|
||||
public boolean isBorder(Vec3i blockInChunk, AbsFace face) {
|
||||
final int min = 0, max = BLOCKS_PER_CHUNK - 1;
|
||||
return (blockInChunk.x == min && face == SOUTH) ||
|
||||
(blockInChunk.x == max && face == NORTH) ||
|
||||
(blockInChunk.y == min && face == EAST) ||
|
||||
(blockInChunk.y == max && face == WEST) ||
|
||||
(blockInChunk.z == min && face == BOTTOM) ||
|
||||
(blockInChunk.z == max && face == TOP);
|
||||
return (blockInChunk.x == min && face == NEG_X) ||
|
||||
(blockInChunk.x == max && face == POS_X) ||
|
||||
(blockInChunk.y == min && face == NEG_Y) ||
|
||||
(blockInChunk.y == max && face == POS_Y) ||
|
||||
(blockInChunk.z == min && face == NEG_Z) ||
|
||||
(blockInChunk.z == max && face == POS_Z);
|
||||
}
|
||||
|
||||
public void forEachBlock(Consumer<Vec3i> action) {
|
||||
@ -186,7 +186,7 @@ public class ChunkData
|
||||
|
||||
public void forEachTileStack(Consumer<TileDataStack> action) {
|
||||
forEachBlock(blockInChunk -> {
|
||||
for (BlockFace face : BlockFace.getFaces()) {
|
||||
for (AbsFace face : AbsFace.getFaces()) {
|
||||
TileDataStack stack = getTilesOrNull(blockInChunk, face);
|
||||
if (stack == null)
|
||||
continue;
|
||||
@ -309,9 +309,9 @@ public class ChunkData
|
||||
* Potentially shared
|
||||
*/
|
||||
private final Vec3i blockInChunk;
|
||||
private final BlockFace face;
|
||||
private final AbsFace face;
|
||||
|
||||
public TileDataStackImpl(Vec3i blockInChunk, BlockFace face) {
|
||||
public TileDataStackImpl(Vec3i blockInChunk, AbsFace face) {
|
||||
this.blockInChunk = blockInChunk;
|
||||
this.face = face;
|
||||
}
|
||||
@ -325,7 +325,7 @@ public class ChunkData
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockFace getFace() {
|
||||
public AbsFace getFace() {
|
||||
return face;
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,7 @@ package ru.windcorp.progressia.common.world;
|
||||
|
||||
import glm.vec._3.i.Vec3i;
|
||||
import ru.windcorp.progressia.common.world.block.BlockData;
|
||||
import ru.windcorp.progressia.common.world.block.BlockFace;
|
||||
import ru.windcorp.progressia.common.world.block.AbsFace;
|
||||
import ru.windcorp.progressia.common.world.tile.TileData;
|
||||
|
||||
public interface ChunkDataListener {
|
||||
@ -55,7 +55,7 @@ public interface ChunkDataListener {
|
||||
default void onChunkTilesChanged(
|
||||
ChunkData chunk,
|
||||
Vec3i blockInChunk,
|
||||
BlockFace face,
|
||||
AbsFace face,
|
||||
TileData tile,
|
||||
boolean wasAdded
|
||||
) {
|
||||
|
@ -23,65 +23,68 @@ import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import glm.vec._3.i.Vec3i;
|
||||
|
||||
public final class BlockFace extends BlockRelation {
|
||||
public final class AbsFace extends AbsRelation {
|
||||
|
||||
public static final BlockFace TOP = new BlockFace(0, 0, +1, true, "TOP"),
|
||||
BOTTOM = new BlockFace(0, 0, -1, false, "BOTTOM"),
|
||||
NORTH = new BlockFace(+1, 0, 0, true, "NORTH"),
|
||||
SOUTH = new BlockFace(-1, 0, 0, false, "SOUTH"),
|
||||
WEST = new BlockFace(0, +1, 0, false, "WEST"),
|
||||
EAST = new BlockFace(0, -1, 0, true, "EAST");
|
||||
// @formatter:off
|
||||
public static final AbsFace
|
||||
POS_Z = new AbsFace( 0, 0, +1, true, "POS_Z"),
|
||||
NEG_Z = new AbsFace( 0, 0, -1, false, "NEG_Z"),
|
||||
POS_X = new AbsFace(+1, 0, 0, true, "POS_X"),
|
||||
NEG_X = new AbsFace(-1, 0, 0, false, "NEG_X"),
|
||||
POS_Y = new AbsFace( 0, +1, 0, false, "POS_Y"),
|
||||
NEG_Y = new AbsFace( 0, -1, 0, true, "NEG_Y");
|
||||
// @formatter:on
|
||||
|
||||
private static final ImmutableList<BlockFace> ALL_FACES = ImmutableList.of(TOP, BOTTOM, NORTH, SOUTH, WEST, EAST);
|
||||
private static final ImmutableList<AbsFace> ALL_FACES = ImmutableList.of(POS_Z, NEG_Z, POS_X, NEG_X, POS_Y, NEG_Y);
|
||||
|
||||
static {
|
||||
link(TOP, BOTTOM);
|
||||
link(NORTH, SOUTH);
|
||||
link(WEST, EAST);
|
||||
link(POS_Z, NEG_Z);
|
||||
link(POS_X, NEG_X);
|
||||
link(POS_Y, NEG_Y);
|
||||
}
|
||||
|
||||
private static final ImmutableList<BlockFace> PRIMARY_FACES = ALL_FACES.stream().filter(BlockFace::isPrimary)
|
||||
private static final ImmutableList<AbsFace> PRIMARY_FACES = ALL_FACES.stream().filter(AbsFace::isPrimary)
|
||||
.collect(ImmutableList.toImmutableList());
|
||||
|
||||
private static final ImmutableList<BlockFace> SECONDARY_FACES = ALL_FACES.stream().filter(BlockFace::isSecondary)
|
||||
private static final ImmutableList<AbsFace> SECONDARY_FACES = ALL_FACES.stream().filter(AbsFace::isSecondary)
|
||||
.collect(ImmutableList.toImmutableList());
|
||||
|
||||
public static final int BLOCK_FACE_COUNT = ALL_FACES.size();
|
||||
public static final int PRIMARY_BLOCK_FACE_COUNT = PRIMARY_FACES.size();
|
||||
public static final int SECONDARY_BLOCK_FACE_COUNT = SECONDARY_FACES.size();
|
||||
|
||||
public static ImmutableList<BlockFace> getFaces() {
|
||||
public static ImmutableList<AbsFace> getFaces() {
|
||||
return ALL_FACES;
|
||||
}
|
||||
|
||||
public static ImmutableList<BlockFace> getPrimaryFaces() {
|
||||
public static ImmutableList<AbsFace> getPrimaryFaces() {
|
||||
return PRIMARY_FACES;
|
||||
}
|
||||
|
||||
public static ImmutableList<BlockFace> getSecondaryFaces() {
|
||||
public static ImmutableList<AbsFace> getSecondaryFaces() {
|
||||
return SECONDARY_FACES;
|
||||
}
|
||||
|
||||
private static void link(BlockFace a, BlockFace b) {
|
||||
private static void link(AbsFace a, AbsFace b) {
|
||||
a.counterFace = b;
|
||||
b.counterFace = a;
|
||||
}
|
||||
|
||||
public static <E> ImmutableMap<BlockFace, E> mapToFaces(
|
||||
E top,
|
||||
E bottom,
|
||||
E north,
|
||||
E south,
|
||||
E east,
|
||||
E west
|
||||
public static <E> ImmutableMap<AbsFace, E> mapToFaces(
|
||||
E posZ,
|
||||
E negZ,
|
||||
E posX,
|
||||
E negX,
|
||||
E negY,
|
||||
E posY
|
||||
) {
|
||||
return ImmutableMap.<BlockFace, E>builderWithExpectedSize(6)
|
||||
.put(TOP, top)
|
||||
.put(BOTTOM, bottom)
|
||||
.put(NORTH, north)
|
||||
.put(SOUTH, south)
|
||||
.put(EAST, east)
|
||||
.put(WEST, west)
|
||||
return ImmutableMap.<AbsFace, E>builderWithExpectedSize(6)
|
||||
.put(POS_Z, posZ)
|
||||
.put(NEG_Z, negZ)
|
||||
.put(POS_X, posX)
|
||||
.put(NEG_X, negX)
|
||||
.put(NEG_Y, negY)
|
||||
.put(POS_Y, posY)
|
||||
.build();
|
||||
}
|
||||
|
||||
@ -89,10 +92,10 @@ public final class BlockFace extends BlockRelation {
|
||||
|
||||
private final int id;
|
||||
private final String name;
|
||||
private BlockFace counterFace;
|
||||
private AbsFace counterFace;
|
||||
private final boolean isPrimary;
|
||||
|
||||
private BlockFace(int x, int y, int z, boolean isPrimary, String name) {
|
||||
private AbsFace(int x, int y, int z, boolean isPrimary, String name) {
|
||||
super(x, y, z);
|
||||
this.id = nextId++;
|
||||
this.isPrimary = isPrimary;
|
||||
@ -107,14 +110,14 @@ public final class BlockFace extends BlockRelation {
|
||||
return isPrimary;
|
||||
}
|
||||
|
||||
public BlockFace getPrimary() {
|
||||
public AbsFace getPrimary() {
|
||||
if (isPrimary)
|
||||
return this;
|
||||
else
|
||||
return counterFace;
|
||||
}
|
||||
|
||||
public BlockFace getPrimaryAndMoveCursor(Vec3i cursor) {
|
||||
public AbsFace getPrimaryAndMoveCursor(Vec3i cursor) {
|
||||
if (isPrimary)
|
||||
return this;
|
||||
|
||||
@ -126,14 +129,14 @@ public final class BlockFace extends BlockRelation {
|
||||
return !isPrimary;
|
||||
}
|
||||
|
||||
public BlockFace getSecondary() {
|
||||
public AbsFace getSecondary() {
|
||||
if (isPrimary)
|
||||
return counterFace;
|
||||
else
|
||||
return this;
|
||||
}
|
||||
|
||||
public BlockFace getSecondaryAndMoveCursor(Vec3i cursor) {
|
||||
public AbsFace getSecondaryAndMoveCursor(Vec3i cursor) {
|
||||
if (!isPrimary)
|
||||
return this;
|
||||
|
||||
@ -141,11 +144,11 @@ public final class BlockFace extends BlockRelation {
|
||||
return counterFace;
|
||||
}
|
||||
|
||||
public BlockFace getCounter() {
|
||||
public AbsFace getCounter() {
|
||||
return counterFace;
|
||||
}
|
||||
|
||||
public BlockFace getCounterAndMoveCursor(Vec3i cursor) {
|
||||
public AbsFace getCounterAndMoveCursor(Vec3i cursor) {
|
||||
cursor.add(getVector());
|
||||
return counterFace;
|
||||
}
|
@ -24,19 +24,19 @@ import static java.lang.Math.max;
|
||||
import glm.vec._3.Vec3;
|
||||
import glm.vec._3.i.Vec3i;
|
||||
|
||||
public class BlockRelation {
|
||||
public class AbsRelation {
|
||||
|
||||
private final Vec3i vector = new Vec3i();
|
||||
private final Vec3 floatVector = new Vec3();
|
||||
private final Vec3 normalized = new Vec3();
|
||||
|
||||
public BlockRelation(int x, int y, int z) {
|
||||
public AbsRelation(int x, int y, int z) {
|
||||
vector.set(x, y, z);
|
||||
floatVector.set(x, y, z);
|
||||
normalized.set(x, y, z).normalize();
|
||||
}
|
||||
|
||||
public BlockRelation(Vec3i vector) {
|
||||
public AbsRelation(Vec3i vector) {
|
||||
this(vector.x, vector.y, vector.z);
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ import glm.vec._3.i.Vec3i;
|
||||
import ru.windcorp.progressia.common.util.VectorUtil;
|
||||
import ru.windcorp.progressia.common.util.Vectors;
|
||||
import ru.windcorp.progressia.common.world.Coordinates;
|
||||
import ru.windcorp.progressia.common.world.block.BlockFace;
|
||||
import ru.windcorp.progressia.common.world.block.AbsFace;
|
||||
|
||||
public interface GenericChunk<Self extends GenericChunk<Self, B, T, TS>, B extends GenericBlock, T extends GenericTile, TS extends GenericTileStack<TS, T, Self>> {
|
||||
|
||||
@ -34,9 +34,9 @@ public interface GenericChunk<Self extends GenericChunk<Self, B, T, TS>, B exten
|
||||
|
||||
B getBlock(Vec3i blockInChunk);
|
||||
|
||||
TS getTiles(Vec3i blockInChunk, BlockFace face);
|
||||
TS getTiles(Vec3i blockInChunk, AbsFace face);
|
||||
|
||||
boolean hasTiles(Vec3i blockInChunk, BlockFace face);
|
||||
boolean hasTiles(Vec3i blockInChunk, AbsFace face);
|
||||
|
||||
default int getX() {
|
||||
return getPosition().x;
|
||||
@ -182,7 +182,7 @@ public interface GenericChunk<Self extends GenericChunk<Self, B, T, TS>, B exten
|
||||
);
|
||||
}
|
||||
|
||||
default TS getTilesOrNull(Vec3i blockInChunk, BlockFace face) {
|
||||
default TS getTilesOrNull(Vec3i blockInChunk, AbsFace face) {
|
||||
if (hasTiles(blockInChunk, face)) {
|
||||
return getTiles(blockInChunk, face);
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ import java.util.function.Consumer;
|
||||
|
||||
import glm.vec._3.i.Vec3i;
|
||||
import ru.windcorp.progressia.common.world.Coordinates;
|
||||
import ru.windcorp.progressia.common.world.block.BlockFace;
|
||||
import ru.windcorp.progressia.common.world.block.AbsFace;
|
||||
|
||||
public abstract class GenericTileStack<Self extends GenericTileStack<Self, T, C>, T extends GenericTile, C extends GenericChunk<C, ?, T, Self>>
|
||||
extends AbstractList<T>
|
||||
@ -41,7 +41,7 @@ public abstract class GenericTileStack<Self extends GenericTileStack<Self, T, C>
|
||||
|
||||
public abstract C getChunk();
|
||||
|
||||
public abstract BlockFace getFace();
|
||||
public abstract AbsFace getFace();
|
||||
|
||||
public Vec3i getBlockInWorld(Vec3i output) {
|
||||
// This is safe
|
||||
|
@ -26,7 +26,7 @@ import glm.vec._3.Vec3;
|
||||
import glm.vec._3.i.Vec3i;
|
||||
import ru.windcorp.progressia.common.util.Vectors;
|
||||
import ru.windcorp.progressia.common.world.Coordinates;
|
||||
import ru.windcorp.progressia.common.world.block.BlockFace;
|
||||
import ru.windcorp.progressia.common.world.block.AbsFace;
|
||||
|
||||
public interface GenericWorld<B extends GenericBlock, T extends GenericTile, TS extends GenericTileStack<TS, T, C>, C extends GenericChunk<C, B, T, TS>, E extends GenericEntity> {
|
||||
|
||||
@ -63,7 +63,7 @@ public interface GenericWorld<B extends GenericBlock, T extends GenericTile, TS
|
||||
return result;
|
||||
}
|
||||
|
||||
default TS getTiles(Vec3i blockInWorld, BlockFace face) {
|
||||
default TS getTiles(Vec3i blockInWorld, AbsFace face) {
|
||||
Vec3i v = Vectors.grab3i();
|
||||
TS result;
|
||||
|
||||
@ -78,7 +78,7 @@ public interface GenericWorld<B extends GenericBlock, T extends GenericTile, TS
|
||||
return result;
|
||||
}
|
||||
|
||||
default TS getTilesOrNull(Vec3i blockInWorld, BlockFace face) {
|
||||
default TS getTilesOrNull(Vec3i blockInWorld, AbsFace face) {
|
||||
Vec3i v = Vectors.grab3i();
|
||||
TS result;
|
||||
|
||||
@ -93,7 +93,7 @@ public interface GenericWorld<B extends GenericBlock, T extends GenericTile, TS
|
||||
return result;
|
||||
}
|
||||
|
||||
default boolean hasTiles(Vec3i blockInWorld, BlockFace face) {
|
||||
default boolean hasTiles(Vec3i blockInWorld, AbsFace face) {
|
||||
Vec3i v = Vectors.grab3i();
|
||||
boolean result;
|
||||
|
||||
@ -108,7 +108,7 @@ public interface GenericWorld<B extends GenericBlock, T extends GenericTile, TS
|
||||
return result;
|
||||
}
|
||||
|
||||
default T getTile(Vec3i blockInWorld, BlockFace face, int layer) {
|
||||
default T getTile(Vec3i blockInWorld, AbsFace face, int layer) {
|
||||
TS stack = getTilesOrNull(blockInWorld, face);
|
||||
if (stack == null || stack.size() <= layer)
|
||||
return null;
|
||||
|
@ -25,7 +25,7 @@ import java.io.IOException;
|
||||
import glm.vec._3.i.Vec3i;
|
||||
import ru.windcorp.progressia.common.world.DecodingException;
|
||||
import ru.windcorp.progressia.common.world.WorldData;
|
||||
import ru.windcorp.progressia.common.world.block.BlockFace;
|
||||
import ru.windcorp.progressia.common.world.block.AbsFace;
|
||||
|
||||
public class PacketAddTile extends PacketAffectTile {
|
||||
|
||||
@ -43,7 +43,7 @@ public class PacketAddTile extends PacketAffectTile {
|
||||
return tileId;
|
||||
}
|
||||
|
||||
public void set(TileData tile, Vec3i blockInWorld, BlockFace face) {
|
||||
public void set(TileData tile, Vec3i blockInWorld, AbsFace face) {
|
||||
super.set(blockInWorld, face, -1);
|
||||
this.tileId = tile.getId();
|
||||
}
|
||||
|
@ -26,12 +26,12 @@ import glm.vec._3.i.Vec3i;
|
||||
import ru.windcorp.progressia.common.world.Coordinates;
|
||||
import ru.windcorp.progressia.common.world.DecodingException;
|
||||
import ru.windcorp.progressia.common.world.PacketAffectChunk;
|
||||
import ru.windcorp.progressia.common.world.block.BlockFace;
|
||||
import ru.windcorp.progressia.common.world.block.AbsFace;
|
||||
|
||||
public abstract class PacketAffectTile extends PacketAffectChunk {
|
||||
|
||||
private final Vec3i blockInWorld = new Vec3i();
|
||||
private BlockFace face;
|
||||
private AbsFace face;
|
||||
private int tag;
|
||||
|
||||
public PacketAffectTile(String id) {
|
||||
@ -42,7 +42,7 @@ public abstract class PacketAffectTile extends PacketAffectChunk {
|
||||
return blockInWorld;
|
||||
}
|
||||
|
||||
public BlockFace getFace() {
|
||||
public AbsFace getFace() {
|
||||
return face;
|
||||
}
|
||||
|
||||
@ -50,7 +50,7 @@ public abstract class PacketAffectTile extends PacketAffectChunk {
|
||||
return tag;
|
||||
}
|
||||
|
||||
public void set(Vec3i blockInWorld, BlockFace face, int tag) {
|
||||
public void set(Vec3i blockInWorld, AbsFace face, int tag) {
|
||||
this.blockInWorld.set(blockInWorld.x, blockInWorld.y, blockInWorld.z);
|
||||
this.face = face;
|
||||
this.tag = tag;
|
||||
@ -59,7 +59,7 @@ public abstract class PacketAffectTile extends PacketAffectChunk {
|
||||
@Override
|
||||
public void read(DataInput input) throws IOException, DecodingException {
|
||||
this.blockInWorld.set(input.readInt(), input.readInt(), input.readInt());
|
||||
this.face = BlockFace.getFaces().get(input.readByte());
|
||||
this.face = AbsFace.getFaces().get(input.readByte());
|
||||
this.tag = input.readInt();
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,7 @@ import glm.vec._3.i.Vec3i;
|
||||
import ru.windcorp.progressia.common.util.crash.CrashReports;
|
||||
import ru.windcorp.progressia.common.world.DecodingException;
|
||||
import ru.windcorp.progressia.common.world.WorldData;
|
||||
import ru.windcorp.progressia.common.world.block.BlockFace;
|
||||
import ru.windcorp.progressia.common.world.block.AbsFace;
|
||||
|
||||
public class PacketRemoveTile extends PacketAffectTile {
|
||||
|
||||
@ -39,7 +39,7 @@ public class PacketRemoveTile extends PacketAffectTile {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void set(Vec3i blockInWorld, BlockFace face, int tag) {
|
||||
public void set(Vec3i blockInWorld, AbsFace face, int tag) {
|
||||
super.set(blockInWorld, face, tag);
|
||||
}
|
||||
|
||||
|
@ -28,7 +28,7 @@ import java.util.function.BiConsumer;
|
||||
import glm.vec._3.i.Vec3i;
|
||||
import ru.windcorp.progressia.common.world.ChunkData;
|
||||
import ru.windcorp.progressia.common.world.Coordinates;
|
||||
import ru.windcorp.progressia.common.world.block.BlockFace;
|
||||
import ru.windcorp.progressia.common.world.block.AbsFace;
|
||||
import ru.windcorp.progressia.common.world.generic.GenericChunk;
|
||||
import ru.windcorp.progressia.common.world.tile.TileDataStack;
|
||||
import ru.windcorp.progressia.common.world.tile.TileReference;
|
||||
@ -75,12 +75,12 @@ public class ChunkLogic implements GenericChunk<ChunkLogic, BlockLogic, TileLogi
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileLogicStack getTiles(Vec3i blockInChunk, BlockFace face) {
|
||||
public TileLogicStack getTiles(Vec3i blockInChunk, AbsFace face) {
|
||||
return getTileStackWrapper(getData().getTiles(blockInChunk, face));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTiles(Vec3i blockInChunk, BlockFace face) {
|
||||
public boolean hasTiles(Vec3i blockInChunk, AbsFace face) {
|
||||
return getData().hasTiles(blockInChunk, face);
|
||||
}
|
||||
|
||||
@ -149,7 +149,7 @@ public class ChunkLogic implements GenericChunk<ChunkLogic, BlockLogic, TileLogi
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockFace getFace() {
|
||||
public AbsFace getFace() {
|
||||
return parent.getFace();
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,7 @@ package ru.windcorp.progressia.server.world;
|
||||
|
||||
import glm.vec._3.i.Vec3i;
|
||||
import ru.windcorp.progressia.common.util.crash.CrashReports;
|
||||
import ru.windcorp.progressia.common.world.block.BlockFace;
|
||||
import ru.windcorp.progressia.common.world.block.AbsFace;
|
||||
import ru.windcorp.progressia.common.world.entity.EntityData;
|
||||
import ru.windcorp.progressia.server.Server;
|
||||
import ru.windcorp.progressia.server.world.block.BlockLogic;
|
||||
@ -61,7 +61,7 @@ public class TickAndUpdateUtil {
|
||||
}
|
||||
}
|
||||
|
||||
public static void tickTile(WorldLogic world, Vec3i blockInWorld, BlockFace face, int layer) {
|
||||
public static void tickTile(WorldLogic world, Vec3i blockInWorld, AbsFace face, int layer) {
|
||||
TileLogic tile = world.getTile(blockInWorld, face, layer);
|
||||
if (!(tile instanceof TickableTile))
|
||||
return;
|
||||
@ -71,7 +71,7 @@ public class TickAndUpdateUtil {
|
||||
tickTile((TickableTile) tile, tickContext);
|
||||
}
|
||||
|
||||
public static void tickTiles(WorldLogic world, Vec3i blockInWorld, BlockFace face) {
|
||||
public static void tickTiles(WorldLogic world, Vec3i blockInWorld, AbsFace face) {
|
||||
TickContextMutable.start().withWorld(world).withBlock(blockInWorld).withFace(face).build()
|
||||
.forEachTile(context -> {
|
||||
TileLogic tile = context.getTile();
|
||||
@ -106,7 +106,7 @@ public class TickAndUpdateUtil {
|
||||
}
|
||||
}
|
||||
|
||||
public static void updateTile(WorldLogic world, Vec3i blockInWorld, BlockFace face, int layer) {
|
||||
public static void updateTile(WorldLogic world, Vec3i blockInWorld, AbsFace face, int layer) {
|
||||
TileLogic tile = world.getTile(blockInWorld, face, layer);
|
||||
if (!(tile instanceof UpdateableTile))
|
||||
return;
|
||||
@ -116,7 +116,7 @@ public class TickAndUpdateUtil {
|
||||
updateTile((UpdateableTile) tile, tickContext);
|
||||
}
|
||||
|
||||
public static void updateTiles(WorldLogic world, Vec3i blockInWorld, BlockFace face) {
|
||||
public static void updateTiles(WorldLogic world, Vec3i blockInWorld, AbsFace face) {
|
||||
TickContextMutable.start().withWorld(world).withBlock(blockInWorld).withFace(face).build()
|
||||
.forEachTile(context -> {
|
||||
TileLogic tile = context.getTile();
|
||||
|
@ -25,7 +25,7 @@ import java.util.function.Function;
|
||||
import glm.vec._3.i.Vec3i;
|
||||
import ru.windcorp.progressia.common.world.ChunkData;
|
||||
import ru.windcorp.progressia.common.world.Coordinates;
|
||||
import ru.windcorp.progressia.common.world.block.BlockFace;
|
||||
import ru.windcorp.progressia.common.world.block.AbsFace;
|
||||
import ru.windcorp.progressia.common.world.generic.GenericTileStack;
|
||||
import ru.windcorp.progressia.common.world.tile.TileDataStack;
|
||||
import ru.windcorp.progressia.common.world.tile.TileReference;
|
||||
@ -126,7 +126,7 @@ public abstract class TickContextMutable implements BlockTickContext, TSTickCont
|
||||
}
|
||||
|
||||
public static interface Block extends Builder {
|
||||
Builder.TileStack withFace(BlockFace face);
|
||||
Builder.TileStack withFace(AbsFace face);
|
||||
}
|
||||
|
||||
public static interface TileStack extends Builder {
|
||||
@ -148,7 +148,7 @@ public abstract class TickContextMutable implements BlockTickContext, TSTickCont
|
||||
protected Server server;
|
||||
protected final Vec3i chunk = new Vec3i();
|
||||
protected final Vec3i blockInWorld = new Vec3i();
|
||||
protected BlockFace face;
|
||||
protected AbsFace face;
|
||||
protected int layer;
|
||||
|
||||
protected Role role = Role.NONE;
|
||||
@ -188,7 +188,7 @@ public abstract class TickContextMutable implements BlockTickContext, TSTickCont
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockFace getFace() {
|
||||
public AbsFace getFace() {
|
||||
checkContextState(Role.TILE_STACK);
|
||||
return this.face;
|
||||
}
|
||||
@ -277,7 +277,7 @@ public abstract class TickContextMutable implements BlockTickContext, TSTickCont
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileStack withFace(BlockFace face) {
|
||||
public TileStack withFace(AbsFace face) {
|
||||
Objects.requireNonNull(face, "face");
|
||||
checkBuilderState(Role.BLOCK);
|
||||
|
||||
@ -339,12 +339,12 @@ public abstract class TickContextMutable implements BlockTickContext, TSTickCont
|
||||
@Override
|
||||
public void forEachFace(Consumer<TSTickContext> action) {
|
||||
checkContextState(Role.BLOCK);
|
||||
BlockFace previousFace = this.face;
|
||||
AbsFace previousFace = this.face;
|
||||
Role previousRole = this.role;
|
||||
|
||||
this.role = Role.TILE_STACK;
|
||||
for (int i = 0; i < BlockFace.BLOCK_FACE_COUNT; ++i) {
|
||||
this.face = BlockFace.getFaces().get(i);
|
||||
for (int i = 0; i < AbsFace.BLOCK_FACE_COUNT; ++i) {
|
||||
this.face = AbsFace.getFaces().get(i);
|
||||
action.accept(this);
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,7 @@ import ru.windcorp.progressia.common.world.ChunkData;
|
||||
import ru.windcorp.progressia.common.world.ChunkDataListener;
|
||||
import ru.windcorp.progressia.common.world.Coordinates;
|
||||
import ru.windcorp.progressia.common.world.block.BlockData;
|
||||
import ru.windcorp.progressia.common.world.block.BlockFace;
|
||||
import ru.windcorp.progressia.common.world.block.AbsFace;
|
||||
import ru.windcorp.progressia.common.world.tile.TileData;
|
||||
import ru.windcorp.progressia.server.Server;
|
||||
|
||||
@ -49,7 +49,7 @@ public class UpdateTriggerer implements ChunkDataListener {
|
||||
public void onChunkTilesChanged(
|
||||
ChunkData chunk,
|
||||
Vec3i blockInChunk,
|
||||
BlockFace face,
|
||||
AbsFace face,
|
||||
TileData tile,
|
||||
boolean wasAdded
|
||||
) {
|
||||
|
@ -19,7 +19,7 @@
|
||||
package ru.windcorp.progressia.server.world.block;
|
||||
|
||||
import ru.windcorp.progressia.common.util.namespaces.Namespaced;
|
||||
import ru.windcorp.progressia.common.world.block.BlockFace;
|
||||
import ru.windcorp.progressia.common.world.block.AbsFace;
|
||||
import ru.windcorp.progressia.common.world.generic.GenericBlock;
|
||||
|
||||
public class BlockLogic extends Namespaced implements GenericBlock {
|
||||
@ -28,11 +28,11 @@ public class BlockLogic extends Namespaced implements GenericBlock {
|
||||
super(id);
|
||||
}
|
||||
|
||||
public boolean isSolid(BlockTickContext context, BlockFace face) {
|
||||
public boolean isSolid(BlockTickContext context, AbsFace face) {
|
||||
return isSolid(face);
|
||||
}
|
||||
|
||||
public boolean isSolid(BlockFace face) {
|
||||
public boolean isSolid(AbsFace face) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -25,8 +25,8 @@ import java.util.function.Function;
|
||||
import glm.vec._3.i.Vec3i;
|
||||
import ru.windcorp.progressia.common.world.Coordinates;
|
||||
import ru.windcorp.progressia.common.world.block.BlockData;
|
||||
import ru.windcorp.progressia.common.world.block.BlockFace;
|
||||
import ru.windcorp.progressia.common.world.block.BlockRelation;
|
||||
import ru.windcorp.progressia.common.world.block.AbsFace;
|
||||
import ru.windcorp.progressia.common.world.block.AbsRelation;
|
||||
import ru.windcorp.progressia.server.world.ChunkTickContext;
|
||||
import ru.windcorp.progressia.server.world.TickContextMutable;
|
||||
import ru.windcorp.progressia.server.world.tile.TSTickContext;
|
||||
@ -56,7 +56,7 @@ public interface BlockTickContext extends ChunkTickContext {
|
||||
Objects.requireNonNull(action, "action");
|
||||
TickContextMutable context = TickContextMutable.uninitialized();
|
||||
|
||||
for (BlockFace face : BlockFace.getFaces()) {
|
||||
for (AbsFace face : AbsFace.getFaces()) {
|
||||
context.rebuild().withServer(getServer()).withBlock(getBlockInWorld()).withFace(face).build();
|
||||
action.accept(context);
|
||||
}
|
||||
@ -67,7 +67,7 @@ public interface BlockTickContext extends ChunkTickContext {
|
||||
return TickContextMutable.copyWorld(this).withBlock(getBlockInWorld().add_(direction)).build();
|
||||
}
|
||||
|
||||
default BlockTickContext getNeighbor(BlockRelation relation) {
|
||||
default BlockTickContext getNeighbor(AbsRelation relation) {
|
||||
Objects.requireNonNull(relation, "relation");
|
||||
return getNeighbor(relation.getVector());
|
||||
}
|
||||
@ -78,7 +78,7 @@ public interface BlockTickContext extends ChunkTickContext {
|
||||
return action.apply(getNeighbor(direction));
|
||||
}
|
||||
|
||||
default <R> R evalNeighbor(BlockRelation relation, Function<BlockTickContext, R> action) {
|
||||
default <R> R evalNeighbor(AbsRelation relation, Function<BlockTickContext, R> action) {
|
||||
Objects.requireNonNull(action, "action");
|
||||
Objects.requireNonNull(relation, "relation");
|
||||
return evalNeighbor(relation.getVector(), action);
|
||||
@ -93,7 +93,7 @@ public interface BlockTickContext extends ChunkTickContext {
|
||||
});
|
||||
}
|
||||
|
||||
default void forNeighbor(BlockRelation relation, Consumer<BlockTickContext> action) {
|
||||
default void forNeighbor(AbsRelation relation, Consumer<BlockTickContext> action) {
|
||||
Objects.requireNonNull(action, "action");
|
||||
Objects.requireNonNull(relation, "relation");
|
||||
forNeighbor(relation.getVector(), action);
|
||||
|
@ -22,7 +22,7 @@ import java.util.function.Consumer;
|
||||
|
||||
import glm.vec._3.i.Vec3i;
|
||||
import ru.windcorp.progressia.common.world.Coordinates;
|
||||
import ru.windcorp.progressia.common.world.block.BlockFace;
|
||||
import ru.windcorp.progressia.common.world.block.AbsFace;
|
||||
import ru.windcorp.progressia.server.Server;
|
||||
import ru.windcorp.progressia.server.world.TickAndUpdateUtil;
|
||||
import ru.windcorp.progressia.server.world.WorldLogic;
|
||||
@ -41,7 +41,7 @@ class BlockTriggeredUpdate extends CachedEvaluation {
|
||||
|
||||
WorldLogic world = server.getWorld();
|
||||
|
||||
for (BlockFace face : BlockFace.getFaces()) {
|
||||
for (AbsFace face : AbsFace.getFaces()) {
|
||||
TickAndUpdateUtil.updateTiles(world, cursor, face);
|
||||
cursor.add(face.getVector());
|
||||
TickAndUpdateUtil.updateBlock(world, cursor);
|
||||
|
@ -28,7 +28,7 @@ import com.google.common.collect.ImmutableList;
|
||||
import glm.vec._3.i.Vec3i;
|
||||
import ru.windcorp.progressia.common.util.FloatMathUtil;
|
||||
import ru.windcorp.progressia.common.world.ChunkData;
|
||||
import ru.windcorp.progressia.common.world.block.BlockFace;
|
||||
import ru.windcorp.progressia.common.world.block.AbsFace;
|
||||
import ru.windcorp.progressia.common.world.tile.TileDataStack;
|
||||
import ru.windcorp.progressia.server.Server;
|
||||
import ru.windcorp.progressia.server.world.ChunkLogic;
|
||||
@ -54,7 +54,7 @@ public class TickChunk extends Evaluation {
|
||||
List<Consumer<Server>> randomTickMethods = new ArrayList<>();
|
||||
randomTickMethods.add(this::tickRandomBlock);
|
||||
|
||||
for (BlockFace face : BlockFace.getFaces()) {
|
||||
for (AbsFace face : AbsFace.getFaces()) {
|
||||
randomTickMethods.add(s -> this.tickRandomTile(s, face));
|
||||
}
|
||||
|
||||
@ -151,7 +151,7 @@ public class TickChunk extends Evaluation {
|
||||
tickable.tick(context);
|
||||
}
|
||||
|
||||
private void tickRandomTile(Server server, BlockFace face) {
|
||||
private void tickRandomTile(Server server, AbsFace face) {
|
||||
Random random = server.getAdHocRandom();
|
||||
|
||||
Vec3i blockInChunk = new Vec3i(
|
||||
|
@ -22,7 +22,7 @@ import java.util.function.Consumer;
|
||||
|
||||
import glm.vec._3.i.Vec3i;
|
||||
import ru.windcorp.progressia.common.world.Coordinates;
|
||||
import ru.windcorp.progressia.common.world.block.BlockFace;
|
||||
import ru.windcorp.progressia.common.world.block.AbsFace;
|
||||
import ru.windcorp.progressia.server.Server;
|
||||
import ru.windcorp.progressia.server.world.TickAndUpdateUtil;
|
||||
import ru.windcorp.progressia.server.world.WorldLogic;
|
||||
@ -30,7 +30,7 @@ import ru.windcorp.progressia.server.world.WorldLogic;
|
||||
class TileTriggeredUpdate extends CachedEvaluation {
|
||||
|
||||
private final Vec3i blockInWorld = new Vec3i();
|
||||
private BlockFace face = null;
|
||||
private AbsFace face = null;
|
||||
|
||||
public TileTriggeredUpdate(Consumer<? super CachedEvaluation> disposer) {
|
||||
super(disposer);
|
||||
@ -53,7 +53,7 @@ class TileTriggeredUpdate extends CachedEvaluation {
|
||||
// complement
|
||||
}
|
||||
|
||||
public void init(Vec3i blockInWorld, BlockFace face) {
|
||||
public void init(Vec3i blockInWorld, AbsFace face) {
|
||||
this.blockInWorld.set(blockInWorld.x, blockInWorld.y, blockInWorld.z);
|
||||
this.face = face;
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ import glm.vec._3.i.Vec3i;
|
||||
import ru.windcorp.progressia.common.util.MultiLOC;
|
||||
import ru.windcorp.progressia.common.world.block.BlockData;
|
||||
import ru.windcorp.progressia.common.world.block.BlockDataRegistry;
|
||||
import ru.windcorp.progressia.common.world.block.BlockFace;
|
||||
import ru.windcorp.progressia.common.world.block.AbsFace;
|
||||
import ru.windcorp.progressia.common.world.entity.EntityData;
|
||||
import ru.windcorp.progressia.common.world.tile.TileData;
|
||||
import ru.windcorp.progressia.common.world.tile.TileDataRegistry;
|
||||
@ -64,17 +64,17 @@ public class WorldAccessor {
|
||||
setBlock(blockInWorld, BlockDataRegistry.getInstance().get(id));
|
||||
}
|
||||
|
||||
public void addTile(Vec3i blockInWorld, BlockFace face, TileData tile) {
|
||||
public void addTile(Vec3i blockInWorld, AbsFace face, TileData tile) {
|
||||
AddTile change = cache.grab(AddTile.class);
|
||||
change.getPacket().set(tile, blockInWorld, face);
|
||||
server.requestChange(change);
|
||||
}
|
||||
|
||||
public void addTile(Vec3i blockInWorld, BlockFace face, String id) {
|
||||
public void addTile(Vec3i blockInWorld, AbsFace face, String id) {
|
||||
addTile(blockInWorld, face, TileDataRegistry.getInstance().get(id));
|
||||
}
|
||||
|
||||
public void removeTile(Vec3i blockInWorld, BlockFace face, int tag) {
|
||||
public void removeTile(Vec3i blockInWorld, AbsFace face, int tag) {
|
||||
RemoveTile change = cache.grab(RemoveTile.class);
|
||||
change.getPacket().set(blockInWorld, face, tag);
|
||||
server.requestChange(change);
|
||||
@ -112,7 +112,7 @@ public class WorldAccessor {
|
||||
* @param face
|
||||
*/
|
||||
// TODO rename to something meaningful
|
||||
public void triggerUpdates(Vec3i blockInWorld, BlockFace face) {
|
||||
public void triggerUpdates(Vec3i blockInWorld, AbsFace face) {
|
||||
TileTriggeredUpdate evaluation = cache.grab(TileTriggeredUpdate.class);
|
||||
evaluation.init(blockInWorld, face);
|
||||
server.requestEvaluation(evaluation);
|
||||
|
@ -23,7 +23,7 @@ import java.util.function.Consumer;
|
||||
import java.util.function.Function;
|
||||
|
||||
import ru.windcorp.progressia.common.world.ChunkData;
|
||||
import ru.windcorp.progressia.common.world.block.BlockFace;
|
||||
import ru.windcorp.progressia.common.world.block.AbsFace;
|
||||
import ru.windcorp.progressia.common.world.tile.TileDataStack;
|
||||
import ru.windcorp.progressia.server.world.ChunkLogic;
|
||||
import ru.windcorp.progressia.server.world.TickContextMutable;
|
||||
@ -35,7 +35,7 @@ public interface TSTickContext extends BlockTickContext {
|
||||
* Specifications
|
||||
*/
|
||||
|
||||
BlockFace getFace();
|
||||
AbsFace getFace();
|
||||
|
||||
/*
|
||||
* Getters
|
||||
|
@ -19,7 +19,7 @@
|
||||
package ru.windcorp.progressia.server.world.tile;
|
||||
|
||||
import ru.windcorp.progressia.common.util.namespaces.Namespaced;
|
||||
import ru.windcorp.progressia.common.world.block.BlockFace;
|
||||
import ru.windcorp.progressia.common.world.block.AbsFace;
|
||||
import ru.windcorp.progressia.common.world.generic.GenericTile;
|
||||
|
||||
public class TileLogic extends Namespaced implements GenericTile {
|
||||
@ -32,7 +32,7 @@ public class TileLogic extends Namespaced implements GenericTile {
|
||||
return canOccupyFace(context.getFace());
|
||||
}
|
||||
|
||||
public boolean canOccupyFace(BlockFace face) {
|
||||
public boolean canOccupyFace(AbsFace face) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -20,14 +20,14 @@ package ru.windcorp.progressia.test;
|
||||
|
||||
import glm.vec._3.i.Vec3i;
|
||||
import ru.windcorp.progressia.common.comms.controls.ControlData;
|
||||
import ru.windcorp.progressia.common.world.block.BlockFace;
|
||||
import ru.windcorp.progressia.common.world.block.AbsFace;
|
||||
import ru.windcorp.progressia.common.world.tile.TileData;
|
||||
|
||||
public class ControlPlaceTileData extends ControlData {
|
||||
|
||||
private TileData tile;
|
||||
private final Vec3i blockInWorld = new Vec3i();
|
||||
private BlockFace face;
|
||||
private AbsFace face;
|
||||
|
||||
public ControlPlaceTileData(String id) {
|
||||
super(id);
|
||||
@ -41,11 +41,11 @@ public class ControlPlaceTileData extends ControlData {
|
||||
return blockInWorld;
|
||||
}
|
||||
|
||||
public BlockFace getFace() {
|
||||
public AbsFace getFace() {
|
||||
return face;
|
||||
}
|
||||
|
||||
public void set(TileData block, Vec3i blockInWorld, BlockFace face) {
|
||||
public void set(TileData block, Vec3i blockInWorld, AbsFace face) {
|
||||
this.tile = block;
|
||||
this.blockInWorld.set(blockInWorld.x, blockInWorld.y, blockInWorld.z);
|
||||
this.face = face;
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
package ru.windcorp.progressia.test;
|
||||
|
||||
import ru.windcorp.progressia.common.world.block.BlockFace;
|
||||
import ru.windcorp.progressia.common.world.block.AbsFace;
|
||||
import ru.windcorp.progressia.server.world.block.BlockLogic;
|
||||
|
||||
public class TestBlockLogicAir extends BlockLogic {
|
||||
@ -28,7 +28,7 @@ public class TestBlockLogicAir extends BlockLogic {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSolid(BlockFace face) {
|
||||
public boolean isSolid(AbsFace face) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
package ru.windcorp.progressia.test;
|
||||
|
||||
import ru.windcorp.progressia.common.world.block.BlockFace;
|
||||
import ru.windcorp.progressia.common.world.block.AbsFace;
|
||||
import ru.windcorp.progressia.server.world.block.BlockLogic;
|
||||
|
||||
public class TestBlockLogicGlass extends BlockLogic {
|
||||
@ -28,7 +28,7 @@ public class TestBlockLogicGlass extends BlockLogic {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSolid(BlockFace face) {
|
||||
public boolean isSolid(AbsFace face) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -38,7 +38,7 @@ import ru.windcorp.progressia.common.world.DecodingException;
|
||||
import ru.windcorp.progressia.common.world.WorldData;
|
||||
import ru.windcorp.progressia.common.world.block.BlockData;
|
||||
import ru.windcorp.progressia.common.world.block.BlockDataRegistry;
|
||||
import ru.windcorp.progressia.common.world.block.BlockFace;
|
||||
import ru.windcorp.progressia.common.world.block.AbsFace;
|
||||
import ru.windcorp.progressia.common.world.io.ChunkCodec;
|
||||
import ru.windcorp.progressia.common.world.tile.TileData;
|
||||
import ru.windcorp.progressia.common.world.tile.TileDataRegistry;
|
||||
@ -138,7 +138,7 @@ public class TestChunkCodec extends ChunkCodec {
|
||||
break;
|
||||
|
||||
bic.set(xOrEndMarker, input.readByte() & 0xFF, input.readByte() & 0xFF);
|
||||
BlockFace face = BlockFace.getFaces().get(input.readByte() & 0xFF);
|
||||
AbsFace face = AbsFace.getFaces().get(input.readByte() & 0xFF);
|
||||
|
||||
int tiles = input.readByte() & 0xFF;
|
||||
|
||||
|
@ -413,7 +413,7 @@ public class TestContent {
|
||||
ControlPlaceTileData controlData = ((ControlPlaceTileData) packet.getControl());
|
||||
TileData tile = controlData.getTile();
|
||||
Vec3i blockInWorld = controlData.getBlockInWorld();
|
||||
BlockFace face = controlData.getFace();
|
||||
AbsFace face = controlData.getFace();
|
||||
|
||||
if (server.getWorld().getData().getChunkByBlock(blockInWorld) == null)
|
||||
return;
|
||||
|
@ -39,7 +39,7 @@ import ru.windcorp.progressia.client.world.entity.EntityRender;
|
||||
import ru.windcorp.progressia.client.world.entity.EntityRenderRegistry;
|
||||
import ru.windcorp.progressia.client.world.entity.EntityRenderable;
|
||||
import ru.windcorp.progressia.client.world.entity.QuadripedModel;
|
||||
import ru.windcorp.progressia.common.world.block.BlockFace;
|
||||
import ru.windcorp.progressia.common.world.block.AbsFace;
|
||||
import ru.windcorp.progressia.common.world.entity.EntityData;
|
||||
|
||||
public class TestEntityRenderJavapony extends EntityRender {
|
||||
@ -78,7 +78,7 @@ public class TestEntityRenderJavapony extends EntityRender {
|
||||
b.addStaticPart(
|
||||
new PppBuilder(
|
||||
WorldRenderProgram.getDefault(),
|
||||
BlockFace.mapToFaces(
|
||||
AbsFace.mapToFaces(
|
||||
tailStartTexture,
|
||||
tailStartTexture,
|
||||
tailStartTexture,
|
||||
@ -97,7 +97,7 @@ public class TestEntityRenderJavapony extends EntityRender {
|
||||
b.addStaticPart(
|
||||
new PppBuilder(
|
||||
WorldRenderProgram.getDefault(),
|
||||
BlockFace.mapToFaces(
|
||||
AbsFace.mapToFaces(
|
||||
neckTexture,
|
||||
neckTexture,
|
||||
neckTexture,
|
||||
@ -360,7 +360,7 @@ public class TestEntityRenderJavapony extends EntityRender {
|
||||
b.addPart(
|
||||
new PppBuilder(
|
||||
program,
|
||||
BlockFace.mapToFaces(
|
||||
AbsFace.mapToFaces(
|
||||
texture.get(32, 64, 0, 0),
|
||||
texture.get(32, 64, 0, 0),
|
||||
texture.get(32 + 8, 64, 16, 8),
|
||||
@ -375,7 +375,7 @@ public class TestEntityRenderJavapony extends EntityRender {
|
||||
b.addPart(
|
||||
new PppBuilder(
|
||||
program,
|
||||
BlockFace.mapToFaces(
|
||||
AbsFace.mapToFaces(
|
||||
texture.get(32, 64, 0, 0),
|
||||
texture.get(32, 64, 0, 0),
|
||||
texture.get(32 + 12, 64 + 8, 8, 4),
|
||||
@ -416,7 +416,7 @@ public class TestEntityRenderJavapony extends EntityRender {
|
||||
b.addPart(
|
||||
new PppBuilder(
|
||||
program,
|
||||
BlockFace.mapToFaces(
|
||||
AbsFace.mapToFaces(
|
||||
texture.get(128, 96, 16, 16),
|
||||
texture.get(128, 96, 16, 16),
|
||||
texture.get(128, 96, 16, 32),
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
package ru.windcorp.progressia.test;
|
||||
|
||||
import ru.windcorp.progressia.common.world.block.BlockFace;
|
||||
import ru.windcorp.progressia.common.world.block.AbsFace;
|
||||
import ru.windcorp.progressia.server.world.block.BlockLogic;
|
||||
import ru.windcorp.progressia.server.world.block.BlockTickContext;
|
||||
import ru.windcorp.progressia.server.world.ticking.TickingPolicy;
|
||||
@ -34,12 +34,12 @@ public class TestTileLogicGrass extends HangingTileLogic implements TickableTile
|
||||
|
||||
@Override
|
||||
public boolean canOccupyFace(TileTickContext context) {
|
||||
return context.getFace() != BlockFace.BOTTOM && super.canOccupyFace(context);
|
||||
return context.getFace() != AbsFace.NEG_Z && super.canOccupyFace(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canOccupyFace(BlockFace face) {
|
||||
return face != BlockFace.BOTTOM;
|
||||
public boolean canOccupyFace(AbsFace face) {
|
||||
return face != AbsFace.NEG_Z;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -64,7 +64,7 @@ public class TestTileLogicGrass extends HangingTileLogic implements TickableTile
|
||||
}
|
||||
|
||||
private boolean isBlockAboveTransparent(BlockTickContext context) {
|
||||
return context.evalNeighbor(BlockFace.TOP, bctxt -> {
|
||||
return context.evalNeighbor(AbsFace.POS_Z, bctxt -> {
|
||||
BlockLogic block = bctxt.getBlock();
|
||||
if (block == null)
|
||||
return true;
|
||||
|
@ -33,7 +33,7 @@ import ru.windcorp.progressia.common.world.WorldData;
|
||||
import ru.windcorp.progressia.common.world.WorldDataListener;
|
||||
import ru.windcorp.progressia.common.world.block.BlockData;
|
||||
import ru.windcorp.progressia.common.world.block.BlockDataRegistry;
|
||||
import ru.windcorp.progressia.common.world.block.BlockFace;
|
||||
import ru.windcorp.progressia.common.world.block.AbsFace;
|
||||
import ru.windcorp.progressia.common.world.tile.TileData;
|
||||
import ru.windcorp.progressia.common.world.tile.TileDataRegistry;
|
||||
import ru.windcorp.progressia.server.world.WorldLogic;
|
||||
@ -238,9 +238,9 @@ public class TestWorldGenerator extends AbstractWorldGenerator<Boolean> {
|
||||
BlockData air = BlockDataRegistry.getInstance().get("Test:Air");
|
||||
TileData grass = TileDataRegistry.getInstance().get("Test:Grass");
|
||||
|
||||
world.getTiles(biw, BlockFace.TOP).add(grass);
|
||||
world.getTiles(biw, AbsFace.POS_Z).add(grass);
|
||||
|
||||
for (BlockFace face : BlockFace.getFaces()) {
|
||||
for (AbsFace face : AbsFace.getFaces()) {
|
||||
if (face.getVector().z != 0)
|
||||
continue;
|
||||
biw.add(face.getVector());
|
||||
@ -257,25 +257,25 @@ public class TestWorldGenerator extends AbstractWorldGenerator<Boolean> {
|
||||
private void addDecor(ChunkData chunk, Vec3i biw, WorldData world, Random random, boolean isDirt) {
|
||||
if (isDirt) {
|
||||
if (random.nextInt(8) == 0) {
|
||||
world.getTiles(biw, BlockFace.TOP).addFarthest(
|
||||
world.getTiles(biw, AbsFace.POS_Z).addFarthest(
|
||||
TileDataRegistry.getInstance().get("Test:Sand")
|
||||
);
|
||||
}
|
||||
|
||||
if (random.nextInt(8) == 0) {
|
||||
world.getTiles(biw, BlockFace.TOP).addFarthest(
|
||||
world.getTiles(biw, AbsFace.POS_Z).addFarthest(
|
||||
TileDataRegistry.getInstance().get("Test:Stones")
|
||||
);
|
||||
}
|
||||
|
||||
if (random.nextInt(8) == 0) {
|
||||
world.getTiles(biw, BlockFace.TOP).addFarthest(
|
||||
world.getTiles(biw, AbsFace.POS_Z).addFarthest(
|
||||
TileDataRegistry.getInstance().get("Test:YellowFlowers")
|
||||
);
|
||||
}
|
||||
} else {
|
||||
if (random.nextInt(2) == 0) {
|
||||
world.getTiles(biw, BlockFace.TOP).addFarthest(
|
||||
world.getTiles(biw, AbsFace.POS_Z).addFarthest(
|
||||
TileDataRegistry.getInstance().get("Test:Stones")
|
||||
);
|
||||
}
|
||||
@ -300,8 +300,8 @@ public class TestWorldGenerator extends AbstractWorldGenerator<Boolean> {
|
||||
double halfChance = computeSnowHalfChance(height, grad);
|
||||
double opaqueChance = computeSnowOpaqueChance(height, grad);
|
||||
|
||||
for (BlockFace face : BlockFace.getFaces()) {
|
||||
if (face == BlockFace.BOTTOM)
|
||||
for (AbsFace face : AbsFace.getFaces()) {
|
||||
if (face == AbsFace.NEG_Z)
|
||||
continue;
|
||||
|
||||
if (face.getVector().z == 0) {
|
||||
|
Reference in New Issue
Block a user