mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-25 22:56:45 +01:00
Mask getBlock
This commit is contained in:
parent
7427d83ae2
commit
7d44850bb0
@ -41,6 +41,14 @@ public class ProcessedWEExtent extends AbstractDelegateExtent {
|
|||||||
this.parent = parent;
|
this.parent = parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BaseBlock getBlock(Vector location) {
|
||||||
|
if (WEManager.maskContains(this.mask, location.getBlockX(), location.getBlockY(), location.getBlockZ())) {
|
||||||
|
return super.getBlock(location);
|
||||||
|
}
|
||||||
|
return WEManager.AIR;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean setBlock(Vector location, BaseBlock block) throws WorldEditException {
|
public boolean setBlock(Vector location, BaseBlock block) throws WorldEditException {
|
||||||
int id = block.getType();
|
int id = block.getType();
|
||||||
|
@ -40,4 +40,12 @@ public class WEExtent extends AbstractDelegateExtent {
|
|||||||
public boolean setBiome(Vector2D position, BaseBiome biome) {
|
public boolean setBiome(Vector2D position, BaseBiome biome) {
|
||||||
return WEManager.maskContains(this.mask, position.getBlockX(), position.getBlockZ()) && super.setBiome(position, biome);
|
return WEManager.maskContains(this.mask, position.getBlockX(), position.getBlockZ()) && super.setBiome(position, biome);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BaseBlock getBlock(Vector location) {
|
||||||
|
if (WEManager.maskContains(this.mask, location.getBlockX(), location.getBlockY(), location.getBlockZ())) {
|
||||||
|
return super.getBlock(location);
|
||||||
|
}
|
||||||
|
return WEManager.AIR;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,12 +8,14 @@ import com.intellectualcrafters.plot.object.Plot;
|
|||||||
import com.intellectualcrafters.plot.object.PlotArea;
|
import com.intellectualcrafters.plot.object.PlotArea;
|
||||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
import com.intellectualcrafters.plot.object.RegionWrapper;
|
import com.intellectualcrafters.plot.object.RegionWrapper;
|
||||||
|
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
public class WEManager {
|
public class WEManager {
|
||||||
|
|
||||||
|
public static BaseBlock AIR = new BaseBlock(0, 0);
|
||||||
|
|
||||||
public static boolean maskContains(HashSet<RegionWrapper> mask, int x, int y, int z) {
|
public static boolean maskContains(HashSet<RegionWrapper> mask, int x, int y, int z) {
|
||||||
for (RegionWrapper region : mask) {
|
for (RegionWrapper region : mask) {
|
||||||
if (region.isIn(x, y, z)) {
|
if (region.isIn(x, y, z)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user