Mask getBlock

This commit is contained in:
Jesse Boyd 2016-06-05 19:46:52 +10:00
parent 7427d83ae2
commit 7d44850bb0
3 changed files with 19 additions and 1 deletions

View File

@ -41,6 +41,14 @@ public class ProcessedWEExtent extends AbstractDelegateExtent {
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
public boolean setBlock(Vector location, BaseBlock block) throws WorldEditException {
int id = block.getType();

View File

@ -40,4 +40,12 @@ public class WEExtent extends AbstractDelegateExtent {
public boolean setBiome(Vector2D position, BaseBiome 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;
}
}

View File

@ -8,12 +8,14 @@ import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.PlotArea;
import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.object.RegionWrapper;
import com.sk89q.worldedit.blocks.BaseBlock;
import java.util.HashSet;
import java.util.UUID;
public class WEManager {
public static BaseBlock AIR = new BaseBlock(0, 0);
public static boolean maskContains(HashSet<RegionWrapper> mask, int x, int y, int z) {
for (RegionWrapper region : mask) {
if (region.isIn(x, y, z)) {