mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-04-19 23:00:19 +00:00
remove buffer api
This commit is contained in:
@@ -9,14 +9,12 @@ package com.dfsek.terra.api.structure;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import com.dfsek.terra.api.structure.buffer.Buffer;
|
||||
import com.dfsek.terra.api.util.Rotation;
|
||||
import com.dfsek.terra.api.util.StringIdentifiable;
|
||||
import com.dfsek.terra.api.util.vector.Vector3;
|
||||
import com.dfsek.terra.api.util.vector.integer.Vector3Int;
|
||||
import com.dfsek.terra.api.world.WritableWorld;
|
||||
import com.dfsek.terra.api.world.chunk.Chunk;
|
||||
|
||||
|
||||
public interface Structure extends StringIdentifiable {
|
||||
boolean generate(Vector3 location, WritableWorld world, Random random, Rotation rotation);
|
||||
boolean generate(Vector3Int location, WritableWorld world, Random random, Rotation rotation);
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.dfsek.terra.api.block.state.BlockState;
|
||||
import com.dfsek.terra.api.entity.Entity;
|
||||
import com.dfsek.terra.api.entity.EntityType;
|
||||
import com.dfsek.terra.api.util.vector.Vector3;
|
||||
import com.dfsek.terra.api.util.vector.integer.Vector3Int;
|
||||
|
||||
|
||||
public interface WritableWorld extends ReadableWorld {
|
||||
@@ -11,10 +12,18 @@ public interface WritableWorld extends ReadableWorld {
|
||||
setBlockState(position.getBlockX(), position.getBlockY(), position.getBlockZ(), data, physics);
|
||||
}
|
||||
|
||||
default void setBlockState(Vector3Int position, BlockState data, boolean physics) {
|
||||
setBlockState(position.getX(), position.getY(), position.getZ(), data, physics);
|
||||
}
|
||||
|
||||
default void setBlockState(Vector3 position, BlockState data) {
|
||||
setBlockState(position, data, false);
|
||||
}
|
||||
|
||||
default void setBlockState(Vector3Int position, BlockState data) {
|
||||
setBlockState(position, data, false);
|
||||
}
|
||||
|
||||
default void setBlockState(int x, int y, int z, BlockState data) {
|
||||
setBlockState(x, y, z, data, false);
|
||||
}
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
|
||||
package com.dfsek.terra.api.util.vector;
|
||||
|
||||
import com.dfsek.terra.api.util.vector.integer.Vector3Int;
|
||||
|
||||
import net.jafama.FastMath;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -24,6 +26,10 @@ public class Vector3 implements Cloneable {
|
||||
this.z = z;
|
||||
}
|
||||
|
||||
public static Vector3 of(double x, double y, double z) {
|
||||
return new Vector3(x, y, z);
|
||||
}
|
||||
|
||||
public Vector3 multiply(double m) {
|
||||
x *= m;
|
||||
y *= m;
|
||||
@@ -45,6 +51,13 @@ public class Vector3 implements Cloneable {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Vector3 add(Vector3Int other) {
|
||||
this.x += other.getX();
|
||||
this.y += other.getY();
|
||||
this.z += other.getZ();
|
||||
return this;
|
||||
}
|
||||
|
||||
public Vector3 add(Vector2 other) {
|
||||
this.x += other.getX();
|
||||
this.z += other.getZ();
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
package com.dfsek.terra.api.util.vector.integer;
|
||||
|
||||
import com.dfsek.terra.api.util.vector.Vector3;
|
||||
|
||||
|
||||
public class Vector3Int {
|
||||
private static final Vector3Int ZERO = new Vector3Int(0, 0, 0);
|
||||
private static final Vector3Int UNIT = new Vector3Int(0, 1, 0);
|
||||
@@ -39,7 +42,10 @@ public class Vector3Int {
|
||||
return new Mutable(x, y, z);
|
||||
}
|
||||
|
||||
|
||||
public Vector3 toVector3() {
|
||||
return Vector3.of(x, y, z);
|
||||
}
|
||||
|
||||
public static class Mutable {
|
||||
private int x, y, z;
|
||||
|
||||
@@ -76,5 +82,16 @@ public class Vector3Int {
|
||||
public Vector3Int immutable() {
|
||||
return Vector3Int.of(x, y, z);
|
||||
}
|
||||
|
||||
public Mutable add(int x, int y, int z) {
|
||||
this.x += x;
|
||||
this.y += y;
|
||||
this.z += z;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Vector3 toVector3() {
|
||||
return Vector3.of(x, y, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user