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