mirror of
https://github.com/boy0001/FastAsyncWorldedit.git
synced 2024-11-28 21:56:33 +01:00
Fixes PlotSquared#1685
This commit is contained in:
parent
ea94c0c11a
commit
f85a9f08d0
@ -1,39 +1,61 @@
|
||||
package com.boydti.fawe.object;
|
||||
|
||||
import com.boydti.fawe.object.extent.FaweRegionExtent;
|
||||
import com.boydti.fawe.object.extent.HeightBoundExtent;
|
||||
import com.boydti.fawe.object.extent.MultiRegionExtent;
|
||||
import com.boydti.fawe.object.extent.SingleRegionExtent;
|
||||
import com.boydti.fawe.util.DelegateFaweQueue;
|
||||
import com.boydti.fawe.util.WEManager;
|
||||
import com.sk89q.jnbt.CompoundTag;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.Vector2D;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.world.biome.BaseBiome;
|
||||
|
||||
public class MaskedFaweQueue extends DelegateFaweQueue {
|
||||
private RegionWrapper[] mask;
|
||||
private FaweRegionExtent region;
|
||||
|
||||
public MaskedFaweQueue(FaweQueue parent, RegionWrapper[] mask) {
|
||||
super(parent);
|
||||
this.mask = mask;
|
||||
setMask(mask);
|
||||
}
|
||||
|
||||
public void setMask(RegionWrapper[] mask) {
|
||||
this.mask = mask;
|
||||
switch (mask.length) {
|
||||
case 0:
|
||||
region = new HeightBoundExtent(this, FaweLimit.MAX.copy(), Integer.MIN_VALUE, Integer.MAX_VALUE);
|
||||
break;
|
||||
case 1:
|
||||
region = new SingleRegionExtent(this, FaweLimit.MAX.copy(), mask[0]);
|
||||
break;
|
||||
default:
|
||||
region = new MultiRegionExtent(this, FaweLimit.MAX.copy(), mask);
|
||||
break;
|
||||
}
|
||||
if (mask.length == 1) {
|
||||
region = new SingleRegionExtent(this, FaweLimit.MAX.copy(), mask[0]);
|
||||
} else {
|
||||
region = new MultiRegionExtent(this, FaweLimit.MAX.copy(), mask);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTile(int x, int y, int z, CompoundTag tag) {
|
||||
if (WEManager.IMP.maskContains(mask, x, z)) {
|
||||
if (region.contains(x, y, z)) {
|
||||
super.setTile(x, y, z, tag);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEntity(int x, int y, int z, CompoundTag tag) {
|
||||
if (WEManager.IMP.maskContains(mask, x, z)) {
|
||||
if (region.contains(x, y, z)) {
|
||||
super.setEntity(x, y, z, tag);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBlock(int x, int y, int z, int id, int data) {
|
||||
if (WEManager.IMP.maskContains(mask, x, z)) {
|
||||
if (region.contains(x, y, z)) {
|
||||
return super.setBlock(x, y, z, id, data);
|
||||
}
|
||||
return false;
|
||||
@ -41,15 +63,47 @@ public class MaskedFaweQueue extends DelegateFaweQueue {
|
||||
|
||||
@Override
|
||||
public boolean setBlock(int x, int y, int z, int id, int data, CompoundTag nbt) {
|
||||
if (WEManager.IMP.maskContains(mask, x, z)) {
|
||||
if (region.contains(x, y, z)) {
|
||||
return super.setBlock(x, y, z, id, data, nbt);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBlock(Vector position, BaseBlock block) throws WorldEditException {
|
||||
if (region.contains(position.getBlockX(), position.getBlockZ())) {
|
||||
return super.setBlock(position, block);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBlock(int x, int y, int z, BaseBlock block) throws WorldEditException {
|
||||
if (region.contains(x, y, z)) {
|
||||
return super.setBlock(x, y, z, block);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBlock(int x, int y, int z, int id) {
|
||||
if (region.contains(x, y, z)) {
|
||||
return super.setBlock(x, y, z, id);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBiome(Vector2D position, BaseBiome biome) {
|
||||
if (region.contains(position.getBlockX(), position.getBlockZ())) {
|
||||
return super.setBiome(position, biome);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBiome(int x, int z, BaseBiome biome) {
|
||||
if (WEManager.IMP.maskContains(mask, x, z)) {
|
||||
if (region.contains(x, z)) {
|
||||
return super.setBiome(x, z, biome);
|
||||
}
|
||||
return false;
|
||||
|
Loading…
Reference in New Issue
Block a user