Make //setbiome respect global mask, if set to a biome mask

This commit is contained in:
wizjany
2013-03-28 19:53:42 -04:00
parent e7d55ca87d
commit 2846119f08
3 changed files with 37 additions and 8 deletions

View File

@@ -8,6 +8,7 @@ import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.LocalPlayer;
import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.Vector2D;
public class BiomeTypeMask implements Mask {
@@ -24,9 +25,13 @@ public class BiomeTypeMask implements Mask {
public void prepare(LocalSession session, LocalPlayer player, Vector target) {
}
public boolean matches(EditSession editSession, Vector pos) {
BiomeType biome = editSession.getWorld().getBiome(pos.toVector2D());
public boolean matches2D(EditSession editSession, Vector2D pos) {
BiomeType biome = editSession.getWorld().getBiome(pos);
return biomes.contains(biome);
}
public boolean matches(EditSession editSession, Vector pos) {
return matches2D(editSession, pos.toVector2D());
}
}

View File

@@ -22,4 +22,7 @@ public class InvertedMask implements Mask {
return !mask.matches(editSession, pos);
}
public Mask getInvertedMask() {
return mask;
}
}