setBlockData -> setBlockState

This commit is contained in:
dfsek
2021-12-17 08:40:02 -07:00
parent 23fcd4a651
commit 31e20b12c0
8 changed files with 15 additions and 15 deletions
@@ -113,7 +113,7 @@ public class TerraFlora implements Structure {
.setIfPresent(Properties.EAST, faces.contains(Direction.EAST)) .setIfPresent(Properties.EAST, faces.contains(Direction.EAST))
.setIfPresent(Properties.WEST, faces.contains(Direction.WEST)); .setIfPresent(Properties.WEST, faces.contains(Direction.WEST));
} }
world.setBlockData(location.clone().add(0, i + c, 0), data, physics); world.setBlockState(location.clone().add(0, i + c, 0), data, physics);
} }
return true; return true;
} }
@@ -106,7 +106,7 @@ public class VanillaOre implements Structure {
if(y >= world.getMaxHeight() || y < world.getMinHeight()) continue; if(y >= world.getMaxHeight() || y < world.getMinHeight()) continue;
BlockType block = world.getBlockState(x, y, z).getBlockType(); BlockType block = world.getBlockState(x, y, z).getBlockType();
if((d13 * d13 + d14 * d14 + d15 * d15 < 1.0D) && getReplaceable().contains(block)) { if((d13 * d13 + d14 * d14 + d15 * d15 < 1.0D) && getReplaceable().contains(block)) {
world.setBlockData(x, y, z, getMaterial(block), isApplyGravity()); world.setBlockState(x, y, z, getMaterial(block), isApplyGravity());
} }
} }
} }
@@ -52,7 +52,7 @@ public class SpongeStructure implements Structure {
for(int y = 0; y < blocks[z].length; y++) { for(int y = 0; y < blocks[z].length; y++) {
BlockState state = blocks[x][z][y]; BlockState state = blocks[x][z][y];
if(state == null) continue; if(state == null) continue;
world.setBlockData(bX + rX, bY + y, bZ + rZ, state); world.setBlockState(bX + rX, bY + y, bZ + rZ, state);
} }
} }
} }
@@ -89,7 +89,7 @@ public class SpongeStructure implements Structure {
for(int y = 0; y < blocks[z].length; y++) { for(int y = 0; y < blocks[z].length; y++) {
BlockState state = blocks[x][z][y]; BlockState state = blocks[x][z][y];
if(state == null) continue; if(state == null) continue;
world.setBlockData(bX + rX, bY + y, bZ + rZ, state); world.setBlockState(bX + rX, bY + y, bZ + rZ, state);
} }
} }
} }
@@ -25,7 +25,7 @@ public class BufferedPulledBlock implements BufferedItem {
Vector3 mutable = origin.clone(); Vector3 mutable = origin.clone();
while(mutable.getY() > world.getMinHeight()) { while(mutable.getY() > world.getMinHeight()) {
if(!world.getBlockState(mutable).isAir()) { if(!world.getBlockState(mutable).isAir()) {
world.setBlockData(mutable, data); world.setBlockState(mutable, data);
break; break;
} }
mutable.subtract(0, 1, 0); mutable.subtract(0, 1, 0);
@@ -43,7 +43,7 @@ public class BufferedBlock implements BufferedItem {
if(waterlog && current.has(Properties.WATERLOGGED) && current.getBlockType().isWater()) { if(waterlog && current.has(Properties.WATERLOGGED) && current.getBlockType().isWater()) {
current.set(Properties.WATERLOGGED, true); current.set(Properties.WATERLOGGED, true);
} }
world.setBlockData(origin, data); world.setBlockState(origin, data);
} }
} catch(RuntimeException e) { } catch(RuntimeException e) {
logger.error("Failed to place block at location {}", origin, e); logger.error("Failed to place block at location {}", origin, e);
@@ -7,19 +7,19 @@ import com.dfsek.terra.api.util.vector.Vector3;
public interface WritableWorld extends ReadableWorld { public interface WritableWorld extends ReadableWorld {
default void setBlockData(Vector3 position, BlockState data, boolean physics) { default void setBlockState(Vector3 position, BlockState data, boolean physics) {
setBlockData(position.getBlockX(), position.getBlockY(), position.getBlockZ(), data, physics); setBlockState(position.getBlockX(), position.getBlockY(), position.getBlockZ(), data, physics);
} }
default void setBlockData(Vector3 position, BlockState data) { default void setBlockState(Vector3 position, BlockState data) {
setBlockData(position, data, false); setBlockState(position, data, false);
} }
default void setBlockData(int x, int y, int z, BlockState data) { default void setBlockState(int x, int y, int z, BlockState data) {
setBlockData(x, y, z, data, false); setBlockState(x, y, z, data, false);
} }
void setBlockData(int x, int y, int z, BlockState data, boolean physics); void setBlockState(int x, int y, int z, BlockState data, boolean physics);
default Entity spawnEntity(Vector3 location, EntityType entityType) { default Entity spawnEntity(Vector3 location, EntityType entityType) {
@@ -30,7 +30,7 @@ public class BukkitProtoWorld implements ProtoWorld {
} }
@Override @Override
public void setBlockData(int x, int y, int z, BlockState data, boolean physics) { public void setBlockState(int x, int y, int z, BlockState data, boolean physics) {
delegate.setBlockData(x, y, z, BukkitAdapter.adapt(data)); delegate.setBlockData(x, y, z, BukkitAdapter.adapt(data));
if(physics) { if(physics) {
delegate.scheduleBlockUpdate(x, y, z); delegate.scheduleBlockUpdate(x, y, z);
@@ -48,7 +48,7 @@ public class BukkitServerWorld implements ServerWorld {
} }
@Override @Override
public void setBlockData(int x, int y, int z, BlockState data, boolean physics) { public void setBlockState(int x, int y, int z, BlockState data, boolean physics) {
delegate.getBlockAt(x, y, z).setBlockData(BukkitAdapter.adapt(data), physics); delegate.getBlockAt(x, y, z).setBlockData(BukkitAdapter.adapt(data), physics);
} }