mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-12 08:08:34 +00:00
Copy paste/merge FAWE classes to this WorldEdit fork
- so certain people can look at the diff and complain about my sloppy code :( Signed-off-by: Jesse Boyd <jessepaleg@gmail.com>
This commit is contained in:
@ -19,25 +19,32 @@
|
||||
|
||||
package com.sk89q.worldedit.extent;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.sk89q.worldedit.MutableBlockVector;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.Vector2D;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.function.mask.Mask;
|
||||
import com.sk89q.worldedit.world.biome.BaseBiome;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
/**
|
||||
* Requires that all mutating methods pass a given {@link Mask}.
|
||||
*/
|
||||
public class MaskingExtent extends AbstractDelegateExtent {
|
||||
|
||||
private Mask mask;
|
||||
private MutableBlockVector mutable = new MutableBlockVector();
|
||||
|
||||
/**
|
||||
* Create a new instance.
|
||||
*
|
||||
* @param extent the extent
|
||||
* @param mask the mask
|
||||
* @param mask the mask
|
||||
*/
|
||||
public MaskingExtent(Extent extent, Mask mask) {
|
||||
super(extent);
|
||||
@ -69,4 +76,18 @@ public class MaskingExtent extends AbstractDelegateExtent {
|
||||
return mask.test(location) && super.setBlock(location, block);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBiome(Vector2D position, BaseBiome biome) {
|
||||
return mask.test(mutable.setComponents(position.getBlockX(), 0, position.getBlockZ())) && super.setBiome(position, biome);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBiome(int x, int y, int z, BaseBiome biome) {
|
||||
return mask.test(mutable.setComponents(x, y, z)) && super.setBiome(x, y, z, biome);
|
||||
}
|
||||
|
||||
public static Class<?> inject() {
|
||||
return MaskingExtent.class;
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user