mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-08-30 05:40:34 +00:00
fix buffered world offset
This commit is contained in:
@@ -44,7 +44,7 @@ public class BufferedWorld implements WritableWorld {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockState getBlockState(int x, int y, int z) {
|
public BlockState getBlockState(int x, int y, int z) {
|
||||||
return readInterceptor.read(x, y, z, delegate);
|
return readInterceptor.read(x + offsetX, y + offsetY, z + offsetZ, delegate);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -84,7 +84,7 @@ public class BufferedWorld implements WritableWorld {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setBlockState(int x, int y, int z, BlockState data, boolean physics) {
|
public void setBlockState(int x, int y, int z, BlockState data, boolean physics) {
|
||||||
writeInterceptor.write(x, y, z, data, delegate, physics);
|
writeInterceptor.write(x + offsetX, y + offsetY, z + offsetZ, data, delegate, physics);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -148,9 +148,9 @@ public class BufferedWorld implements WritableWorld {
|
|||||||
|
|
||||||
public BufferedWorld build() {
|
public BufferedWorld build() {
|
||||||
return new BufferedWorld(delegate,
|
return new BufferedWorld(delegate,
|
||||||
x,
|
this.x,
|
||||||
y,
|
this.y,
|
||||||
z,
|
this.z,
|
||||||
Objects.requireNonNullElse(readInterceptor, Interceptors.readThrough()),
|
Objects.requireNonNullElse(readInterceptor, Interceptors.readThrough()),
|
||||||
Objects.requireNonNullElse(writeInterceptor, Interceptors.writeThrough()));
|
Objects.requireNonNullElse(writeInterceptor, Interceptors.writeThrough()));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import com.dfsek.terra.api.entity.EntityType;
|
|||||||
import com.dfsek.terra.api.util.vector.Vector3;
|
import com.dfsek.terra.api.util.vector.Vector3;
|
||||||
import com.dfsek.terra.api.util.vector.Vector3Int;
|
import com.dfsek.terra.api.util.vector.Vector3Int;
|
||||||
import com.dfsek.terra.api.world.chunk.generation.util.Column;
|
import com.dfsek.terra.api.world.chunk.generation.util.Column;
|
||||||
import com.dfsek.terra.api.world.util.Interceptors;
|
|
||||||
|
|
||||||
|
|
||||||
public interface WritableWorld extends ReadableWorld {
|
public interface WritableWorld extends ReadableWorld {
|
||||||
@@ -56,7 +55,12 @@ public interface WritableWorld extends ReadableWorld {
|
|||||||
Entity spawnEntity(double x, double y, double z, EntityType entityType);
|
Entity spawnEntity(double x, double y, double z, EntityType entityType);
|
||||||
|
|
||||||
default BufferedWorld buffer(int offsetX, int offsetY, int offsetZ) {
|
default BufferedWorld buffer(int offsetX, int offsetY, int offsetZ) {
|
||||||
return BufferedWorld.builder(this).offsetX(offsetX).offsetY(offsetY).offsetZ(offsetZ).build();
|
return BufferedWorld
|
||||||
|
.builder(this)
|
||||||
|
.offsetX(offsetX)
|
||||||
|
.offsetY(offsetY)
|
||||||
|
.offsetZ(offsetZ)
|
||||||
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
default BufferedWorld.Builder buffer() {
|
default BufferedWorld.Builder buffer() {
|
||||||
|
|||||||
Reference in New Issue
Block a user