Skip to content

Commit

Permalink
Add validation for biome set positions to prevent errors with incorre…
Browse files Browse the repository at this point in the history
…ct API usage (#2416)
  • Loading branch information
me4502 authored Nov 17, 2023
1 parent a24ea43 commit 300198f
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.world.World;
import com.sk89q.worldedit.world.biome.BiomeType;
import com.sk89q.worldedit.world.block.BlockStateHolder;
import com.sk89q.worldedit.world.block.BlockType;

Expand Down Expand Up @@ -64,4 +65,14 @@ public <B extends BlockStateHolder<B>> boolean setBlock(BlockVector3 location, B
return super.setBlock(location, block);
}

@Override
public boolean setBiome(BlockVector3 location, BiomeType biome) {
final int y = location.getBlockY();

if (y < world.getMinY() || y > world.getMaxY()) {
return false;
}

return super.setBiome(location, biome);
}
}

0 comments on commit 300198f

Please sign in to comment.