3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-07-21 09:38:03 +02:00

AbstractExtentMasks should have the correct extent.

- Fixes #843
Dieser Commit ist enthalten in:
dordsor21 2021-01-14 16:54:38 +00:00
Ursprung fa69c79160
Commit b18c646bce
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 1E53E88969FFCF0B
2 geänderte Dateien mit 13 neuen und 6 gelöschten Zeilen

Datei anzeigen

@ -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;

Datei anzeigen

@ -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);
}
}