mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-23 01:37:37 +00:00
fix walls
This commit is contained in:
parent
ed8d1849d4
commit
34afc03443
@ -316,10 +316,10 @@ public class ChunkHolder<T extends Future<T>> implements IQueueChunk {
|
||||
final IChunkGet get = getOrCreateGet();
|
||||
final IChunkSet set = getOrCreateSet();
|
||||
try {
|
||||
block = block.init(chunkX, chunkZ, get);
|
||||
if (region != null) {
|
||||
region.filter(this, filter, block, get, set, full);
|
||||
} else {
|
||||
block = block.init(chunkX, chunkZ, get);
|
||||
for (int layer = 0; layer < 16; layer++) {
|
||||
if ((!full && !get.hasSection(layer)) || !filter.appliesLayer(this, layer)) {
|
||||
continue;
|
||||
|
@ -19,6 +19,7 @@
|
||||
|
||||
package com.sk89q.worldedit.regions;
|
||||
|
||||
import com.boydti.fawe.FaweCache;
|
||||
import com.boydti.fawe.object.collection.BlockVectorSet;
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
@ -169,21 +170,14 @@ public abstract class AbstractRegion extends AbstractSet<BlockVector3> implement
|
||||
public Set<BlockVector2> getChunks() {
|
||||
final Set<BlockVector2> chunks = new HashSet<>();
|
||||
|
||||
final BlockVector3 min = getMinimumPoint();
|
||||
final BlockVector3 max = getMaximumPoint();
|
||||
final BlockVector3 min = getMinimumPoint().divide(16);
|
||||
final BlockVector3 max = getMaximumPoint().divide(16);
|
||||
|
||||
final int minY = min.getBlockY();
|
||||
|
||||
for (int x = min.getBlockX(); x <= max.getBlockX(); ++x) {
|
||||
for (int z = min.getBlockZ(); z <= max.getBlockZ(); ++z) {
|
||||
if (!contains(BlockVector3.at(x, minY, z))) {
|
||||
continue;
|
||||
for (int X = min.getBlockX(); X <= max.getBlockX(); ++X) {
|
||||
for (int Z = min.getBlockZ(); Z <= max.getBlockZ(); ++Z) {
|
||||
if (containsChunk(X, Z)) {
|
||||
chunks.add(BlockVector2.at(X, Z));
|
||||
}
|
||||
|
||||
chunks.add(BlockVector2.at(
|
||||
x >> ChunkStore.CHUNK_SHIFTS,
|
||||
z >> ChunkStore.CHUNK_SHIFTS
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -148,7 +148,7 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion {
|
||||
*
|
||||
* @return a new complex region
|
||||
*/
|
||||
public Region getFaces() {
|
||||
public RegionIntersection getFaces() {
|
||||
BlockVector3 min = getMinimumPoint();
|
||||
BlockVector3 max = getMaximumPoint();
|
||||
|
||||
@ -172,7 +172,7 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion {
|
||||
*
|
||||
* @return a new complex region
|
||||
*/
|
||||
public Region getWalls() {
|
||||
public RegionIntersection getWalls() {
|
||||
BlockVector3 min = getMinimumPoint();
|
||||
BlockVector3 max = getMaximumPoint();
|
||||
|
||||
@ -182,8 +182,8 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion {
|
||||
new CuboidRegion(pos1.withX(max.getX()), pos2.withX(max.getX())),
|
||||
|
||||
// Project to X-Y plane
|
||||
new CuboidRegion(pos1.withZ(min.getZ()), pos2.withZ(min.getZ())),
|
||||
new CuboidRegion(pos1.withZ(max.getZ()), pos2.withZ(max.getZ())));
|
||||
new CuboidRegion(pos1.withZ(min.getZ()).add(BlockVector3.UNIT_X), pos2.withZ(min.getZ()).subtract(BlockVector3.UNIT_X)),
|
||||
new CuboidRegion(pos1.withZ(max.getZ()).add(BlockVector3.UNIT_X), pos2.withZ(max.getZ()).subtract(BlockVector3.UNIT_X)));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -23,13 +23,17 @@ import com.boydti.fawe.beta.IChunk;
|
||||
import com.boydti.fawe.beta.IChunkGet;
|
||||
import com.boydti.fawe.beta.IChunkSet;
|
||||
import com.google.common.collect.Iterators;
|
||||
import com.google.common.collect.Sets;
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkArgument;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
@ -169,4 +173,52 @@ public class RegionIntersection extends AbstractRegion {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<Region> getRegions() {
|
||||
return regions;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<BlockVector2> getChunks() {
|
||||
Set<BlockVector2> set = null;
|
||||
for (Region region : regions) {
|
||||
if (set == null) {
|
||||
set = region.getChunks();
|
||||
} else {
|
||||
set = Sets.union(set, region.getChunks());
|
||||
}
|
||||
}
|
||||
return set;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<BlockVector3> getChunkCubes() {
|
||||
Set<BlockVector3> set = null;
|
||||
for (Region region : regions) {
|
||||
if (set == null) {
|
||||
set = region.getChunkCubes();
|
||||
} else {
|
||||
set = Sets.union(set, region.getChunkCubes());
|
||||
}
|
||||
}
|
||||
return set;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean containsChunk(int chunkX, int chunkZ) {
|
||||
for (Region region : regions) if (region.containsChunk(chunkX, chunkZ)) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean contains(int x, int z) {
|
||||
for (Region region : regions) if (region.contains(x, z)) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean contains(int x, int y, int z) {
|
||||
for (Region region : regions) if (region.contains(x, y, z)) return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user