Skip to content

Commit

Permalink
Add setBiome override in MaskingExtent.
Browse files Browse the repository at this point in the history
This makes biome operations respect masks set on an EditSession.
  • Loading branch information
wizjany committed Feb 1, 2025
1 parent 4b6b0d9 commit 0e2d5d0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,6 @@ public void setBiome(Actor actor, World world, LocalSession session, EditSession
@Switch(name = 'p', desc = "Use your current position")
boolean atPosition) throws WorldEditException {
Region region;
Mask mask = editSession.getMask();

if (atPosition) {
if (actor instanceof Locatable) {
Expand All @@ -188,9 +187,6 @@ public void setBiome(Actor actor, World world, LocalSession session, EditSession
}

RegionFunction replace = new BiomeReplace(editSession, target);
if (mask != null) {
replace = new RegionMaskingFilter(mask, replace);
}
RegionVisitor visitor = new RegionVisitor(region, replace);
Operations.completeLegacy(visitor);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.function.mask.Mask;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.world.biome.BiomeType;
import com.sk89q.worldedit.world.block.BlockStateHolder;

import static com.google.common.base.Preconditions.checkNotNull;
Expand Down Expand Up @@ -69,4 +70,8 @@ public <B extends BlockStateHolder<B>> boolean setBlock(BlockVector3 location, B
return mask.test(location) && super.setBlock(location, block);
}

@Override
public boolean setBiome(BlockVector3 location, BiomeType biome) {
return mask.test(location) && super.setBiome(location, biome);
}
}

0 comments on commit 0e2d5d0

Please sign in to comment.