mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-22 17:27:38 +00:00
parent
fa69c79160
commit
b18c646bce
@ -36,6 +36,7 @@ import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.function.GroundFunction;
|
||||
import com.sk89q.worldedit.function.generator.FloraGenerator;
|
||||
import com.sk89q.worldedit.function.mask.AbstractExtentMask;
|
||||
import com.sk89q.worldedit.function.mask.ExistingBlockMask;
|
||||
import com.sk89q.worldedit.function.mask.Mask;
|
||||
import com.sk89q.worldedit.function.mask.MaskIntersection;
|
||||
@ -300,6 +301,9 @@ public class RegionCommands {
|
||||
if (from == null) {
|
||||
from = new ExistingBlockMask(editSession);
|
||||
}
|
||||
if (from instanceof AbstractExtentMask) {
|
||||
((AbstractExtentMask) from).setExtent(editSession);
|
||||
}
|
||||
int affected = editSession.replaceBlocks(region, from, to);
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.replace.replaced", TextComponent.of(affected)));
|
||||
return affected;
|
||||
|
@ -34,9 +34,8 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
||||
/**
|
||||
* Tests true if the biome at applied points is the same as the one given.
|
||||
*/
|
||||
public class BiomeMask extends AbstractMask {
|
||||
public class BiomeMask extends AbstractExtentMask {
|
||||
|
||||
private final Extent extent;
|
||||
private final Set<BiomeType> biomes = new HashSet<>();
|
||||
|
||||
/**
|
||||
@ -46,9 +45,8 @@ public class BiomeMask extends AbstractMask {
|
||||
* @param biomes a list of biomes to match
|
||||
*/
|
||||
public BiomeMask(Extent extent, Collection<BiomeType> biomes) {
|
||||
checkNotNull(extent);
|
||||
super(extent);
|
||||
checkNotNull(biomes);
|
||||
this.extent = extent;
|
||||
this.biomes.addAll(biomes);
|
||||
}
|
||||
|
||||
@ -92,7 +90,7 @@ public class BiomeMask extends AbstractMask {
|
||||
|
||||
@Override
|
||||
public boolean test(BlockVector3 vector) {
|
||||
BiomeType biome = extent.getBiome(vector);
|
||||
BiomeType biome = getExtent().getBiome(vector);
|
||||
return biomes.contains(biome);
|
||||
}
|
||||
|
||||
@ -104,7 +102,12 @@ public class BiomeMask extends AbstractMask {
|
||||
|
||||
@Override
|
||||
public Mask copy() {
|
||||
return new BiomeMask(extent, new HashSet<>(biomes));
|
||||
return new BiomeMask(getExtent(), new HashSet<>(biomes));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean test(Extent extent, BlockVector3 position) {
|
||||
BiomeType biome = getExtent().getBiome(position);
|
||||
return biomes.contains(biome);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user