3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-12-27 03:12:37 +01:00

Don't paste biomes out of bounds, fix #1009

Also some preparations for variable world heights
Dieser Commit ist enthalten in:
Hannes Greule 2021-04-09 22:59:31 +02:00
Ursprung 4b371e2c3f
Commit 911d3a00eb

Datei anzeigen

@ -223,6 +223,7 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
private final Extent bypassHistory; private final Extent bypassHistory;
private Extent bypassAll; private Extent bypassAll;
private final int minY;
private final int maxY; private final int maxY;
private final List<WatchdogTickingExtent> watchdogExtents = new ArrayList<>(2); private final List<WatchdogTickingExtent> watchdogExtents = new ArrayList<>(2);
@ -263,6 +264,7 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
this.limit = builder.getLimit().copy(); this.limit = builder.getLimit().copy();
this.player = builder.getPlayer(); this.player = builder.getPlayer();
this.changeSet = builder.getChangeTask(); this.changeSet = builder.getChangeTask();
this.minY = world.getMinY();
this.maxY = world.getMaxY(); this.maxY = world.getMaxY();
this.blockBag = builder.getBlockBag(); this.blockBag = builder.getBlockBag();
this.history = changeSet != null; this.history = changeSet != null;
@ -796,12 +798,18 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
@Override @Override
public boolean setBiome(BlockVector3 position, BiomeType biome) { public boolean setBiome(BlockVector3 position, BiomeType biome) {
if (position.getY() < this.minY || position.getY() > this.maxY) {
return false;
}
this.changes++; this.changes++;
return this.getExtent().setBiome(position, biome); return this.getExtent().setBiome(position, biome);
} }
@Override @Override
public boolean setBiome(int x, int y, int z, BiomeType biome) { public boolean setBiome(int x, int y, int z, BiomeType biome) {
if (y < this.minY || y > this.maxY) {
return false;
}
this.changes++; this.changes++;
return this.getExtent().setBiome(x, y, z, biome); return this.getExtent().setBiome(x, y, z, biome);
} }
@ -859,7 +867,7 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
*/ */
@Deprecated @Deprecated
public <B extends BlockStateHolder<B>> boolean setBlock(BlockVector3 position, B block, Stage stage) throws WorldEditException { public <B extends BlockStateHolder<B>> boolean setBlock(BlockVector3 position, B block, Stage stage) throws WorldEditException {
if (position.getBlockY() < 0 || position.getBlockY() > 255) { if (position.getBlockY() < this.minY || position.getBlockY() > this.maxY) {
return false; return false;
} }
@ -885,7 +893,7 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
*/ */
@Deprecated @Deprecated
public <B extends BlockStateHolder<B>> boolean rawSetBlock(BlockVector3 position, B block) { public <B extends BlockStateHolder<B>> boolean rawSetBlock(BlockVector3 position, B block) {
if (position.getBlockY() < 0 || position.getBlockY() > 255) { if (position.getBlockY() < this.minY || position.getBlockY() > this.maxY) {
return false; return false;
} }
@ -905,7 +913,7 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
* @return whether the block changed * @return whether the block changed
*/ */
public <B extends BlockStateHolder<B>> boolean smartSetBlock(BlockVector3 position, B block) { public <B extends BlockStateHolder<B>> boolean smartSetBlock(BlockVector3 position, B block) {
if (position.getBlockY() < 0 || position.getBlockY() > 255) { if (position.getBlockY() < this.minY || position.getBlockY() > this.maxY) {
return false; return false;
} }
@ -920,7 +928,7 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
@Override @Override
@Deprecated @Deprecated
public <B extends BlockStateHolder<B>> boolean setBlock(BlockVector3 position, B block) throws MaxChangedBlocksException { public <B extends BlockStateHolder<B>> boolean setBlock(BlockVector3 position, B block) throws MaxChangedBlocksException {
if (position.getBlockY() < 0 || position.getBlockY() > 255) { if (position.getBlockY() < this.minY || position.getBlockY() > this.maxY) {
return false; return false;
} }
@ -937,7 +945,7 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
@Override @Override
public <B extends BlockStateHolder<B>> boolean setBlock(int x, int y, int z, B block) { public <B extends BlockStateHolder<B>> boolean setBlock(int x, int y, int z, B block) {
if (y < 0 || y > 255) { if (y < this.minY || y > this.maxY) {
return false; return false;
} }
@ -960,7 +968,7 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
* @throws MaxChangedBlocksException thrown if too many blocks are changed * @throws MaxChangedBlocksException thrown if too many blocks are changed
*/ */
public boolean setBlock(int x, int y, int z, Pattern pattern) { public boolean setBlock(int x, int y, int z, Pattern pattern) {
if (y < 0 || y > 255) { if (y < this.minY || y > this.maxY) {
return false; return false;
} }
@ -982,7 +990,7 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
* @throws MaxChangedBlocksException thrown if too many blocks are changed * @throws MaxChangedBlocksException thrown if too many blocks are changed
*/ */
public boolean setBlock(BlockVector3 position, Pattern pattern) throws MaxChangedBlocksException { public boolean setBlock(BlockVector3 position, Pattern pattern) throws MaxChangedBlocksException {
if (position.getBlockY() < 0 || position.getBlockY() > 255) { if (position.getBlockY() < this.minY || position.getBlockY() > this.maxY) {
return false; return false;
} }