mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-02-16 10:30:42 +00:00
fix buffered world offset
This commit is contained in:
@@ -44,7 +44,7 @@ public class BufferedWorld implements WritableWorld {
|
||||
|
||||
@Override
|
||||
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
|
||||
@@ -84,7 +84,7 @@ public class BufferedWorld implements WritableWorld {
|
||||
|
||||
@Override
|
||||
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
|
||||
@@ -148,9 +148,9 @@ public class BufferedWorld implements WritableWorld {
|
||||
|
||||
public BufferedWorld build() {
|
||||
return new BufferedWorld(delegate,
|
||||
x,
|
||||
y,
|
||||
z,
|
||||
this.x,
|
||||
this.y,
|
||||
this.z,
|
||||
Objects.requireNonNullElse(readInterceptor, Interceptors.readThrough()),
|
||||
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.Vector3Int;
|
||||
import com.dfsek.terra.api.world.chunk.generation.util.Column;
|
||||
import com.dfsek.terra.api.world.util.Interceptors;
|
||||
|
||||
|
||||
public interface WritableWorld extends ReadableWorld {
|
||||
@@ -56,7 +55,12 @@ public interface WritableWorld extends ReadableWorld {
|
||||
Entity spawnEntity(double x, double y, double z, EntityType entityType);
|
||||
|
||||
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() {
|
||||
|
||||
Reference in New Issue
Block a user