mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 13:16:45 +01:00
A couple of reworks
- Redo how regeneration works a little to also take a cuboid region for regeneration off-chunk plots - Fix a couple of cases where we were writing to the queue instead of the world in the ChunkConsumer (dum) - this seems to be working.
This commit is contained in:
parent
18918eb3a3
commit
72c0021306
@ -97,11 +97,18 @@ public class BukkitQueueCoordinator extends BasicQueueCoordinator {
|
|||||||
@Override public boolean enqueue() {
|
@Override public boolean enqueue() {
|
||||||
final Clipboard regenClipboard;
|
final Clipboard regenClipboard;
|
||||||
if (isRegen()) {
|
if (isRegen()) {
|
||||||
Region region = new CuboidRegion(
|
BlockVector3 start =
|
||||||
BlockVector3.at(getRegenStart()[0] << 4, 0, getRegenStart()[1] << 4),
|
BlockVector3.at(getRegenStart()[0] << 4, 0, getRegenStart()[1] << 4);
|
||||||
BlockVector3.at((getRegenEnd()[0] << 4) + 15, 255, (getRegenEnd()[1] << 4) + 15));
|
BlockVector3 end =
|
||||||
|
BlockVector3.at((getRegenEnd()[0] << 4) + 15, 255, (getRegenEnd()[1] << 4) + 15);
|
||||||
|
Region region = new CuboidRegion(start, end);
|
||||||
regenClipboard = new BlockArrayClipboard(region);
|
regenClipboard = new BlockArrayClipboard(region);
|
||||||
|
regenClipboard.setOrigin(start);
|
||||||
getWorld().regenerate(region, regenClipboard);
|
getWorld().regenerate(region, regenClipboard);
|
||||||
|
} else if (getRegenRegion() != null) {
|
||||||
|
regenClipboard = new BlockArrayClipboard(getRegenRegion());
|
||||||
|
regenClipboard.setOrigin(getRegenRegion().getMinimumPoint());
|
||||||
|
getWorld().regenerate(getRegenRegion(), regenClipboard);
|
||||||
} else {
|
} else {
|
||||||
regenClipboard = null;
|
regenClipboard = null;
|
||||||
}
|
}
|
||||||
@ -121,15 +128,17 @@ public class BukkitQueueCoordinator extends BasicQueueCoordinator {
|
|||||||
for (int z = 0; z < 16; z++) {
|
for (int z = 0; z < 16; z++) {
|
||||||
BaseBlock block =
|
BaseBlock block =
|
||||||
regenClipboard.getFullBlock(BlockVector3.at(x, y, z));
|
regenClipboard.getFullBlock(BlockVector3.at(x, y, z));
|
||||||
setWorldBlock(x, y, z, block, blockVector2);
|
if (block != null) {
|
||||||
|
setWorldBlock(x, y, z, block, blockVector2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
// Allow regen and then blocks to be placed (plot schematic etc)
|
||||||
|
if (localChunk == null) {
|
||||||
return;
|
return;
|
||||||
} else if (localChunk == null) {
|
|
||||||
throw new NullPointerException(
|
|
||||||
"LocalChunk cannot be null when accessed from ChunkCoordinator");
|
|
||||||
}
|
}
|
||||||
int sx = blockVector2.getX() << 4;
|
int sx = blockVector2.getX() << 4;
|
||||||
int sz = blockVector2.getZ() << 4;
|
int sz = blockVector2.getZ() << 4;
|
||||||
@ -143,10 +152,13 @@ public class BukkitQueueCoordinator extends BasicQueueCoordinator {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
BaseBlock block = blocksLayer[j];
|
BaseBlock block = blocksLayer[j];
|
||||||
int x = sx + ChunkUtil.getX(j);
|
|
||||||
int y = ChunkUtil.getY(layer, j);
|
if (block != null) {
|
||||||
int z = sz + ChunkUtil.getZ(j);
|
int x = sx + ChunkUtil.getX(j);
|
||||||
setWorldBlock(x, y, z, block, blockVector2);
|
int y = ChunkUtil.getY(layer, j);
|
||||||
|
int z = sz + ChunkUtil.getZ(j);
|
||||||
|
setWorldBlock(x, y, z, block, blockVector2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (int layer = 0; layer < localChunk.getBaseblocks().length; layer++) {
|
for (int layer = 0; layer < localChunk.getBaseblocks().length; layer++) {
|
||||||
@ -159,10 +171,12 @@ public class BukkitQueueCoordinator extends BasicQueueCoordinator {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
BiomeType biome = biomesLayer[j];
|
BiomeType biome = biomesLayer[j];
|
||||||
int x = sx + ChunkUtil.getX(j);
|
if (biome != null) {
|
||||||
int y = ChunkUtil.getY(layer, j);
|
int x = sx + ChunkUtil.getX(j);
|
||||||
int z = sz + ChunkUtil.getZ(j);
|
int y = ChunkUtil.getY(layer, j);
|
||||||
getWorld().setBiome(BlockVector3.at(x, y, z), biome);
|
int z = sz + ChunkUtil.getZ(j);
|
||||||
|
getWorld().setBiome(BlockVector3.at(x, y, z), biome);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (localChunk.getTiles().size() > 0) {
|
if (localChunk.getTiles().size() > 0) {
|
||||||
@ -184,7 +198,6 @@ public class BukkitQueueCoordinator extends BasicQueueCoordinator {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
CuboidRegion region;
|
|
||||||
Collection<BlockVector2> read = new ArrayList<>();
|
Collection<BlockVector2> read = new ArrayList<>();
|
||||||
if (getReadChunks().size() > 0) {
|
if (getReadChunks().size() > 0) {
|
||||||
read.addAll(getReadChunks());
|
read.addAll(getReadChunks());
|
||||||
|
@ -76,7 +76,8 @@ public class BukkitRegionManager extends RegionManager {
|
|||||||
LoggerFactory.getLogger("P2/" + BukkitRegionManager.class.getSimpleName());
|
LoggerFactory.getLogger("P2/" + BukkitRegionManager.class.getSimpleName());
|
||||||
private final GlobalBlockQueue blockQueue;
|
private final GlobalBlockQueue blockQueue;
|
||||||
|
|
||||||
@Inject public BukkitRegionManager(@Nonnull WorldUtil worldUtil, @Nonnull GlobalBlockQueue blockQueue) {
|
@Inject
|
||||||
|
public BukkitRegionManager(@Nonnull WorldUtil worldUtil, @Nonnull GlobalBlockQueue blockQueue) {
|
||||||
super(worldUtil, blockQueue);
|
super(worldUtil, blockQueue);
|
||||||
this.blockQueue = blockQueue;
|
this.blockQueue = blockQueue;
|
||||||
}
|
}
|
||||||
@ -174,7 +175,9 @@ public class BukkitRegionManager extends RegionManager {
|
|||||||
final int tcz = p2z >> 4;
|
final int tcz = p2z >> 4;
|
||||||
|
|
||||||
final QueueCoordinator queue = blockQueue.getNewQueue(world);
|
final QueueCoordinator queue = blockQueue.getNewQueue(world);
|
||||||
queue.addReadChunks(new CuboidRegion(pos1.getBlockVector3(), pos2.getBlockVector3()).getChunks());
|
final QueueCoordinator regenQueue = blockQueue.getNewQueue(world);
|
||||||
|
queue.addReadChunks(
|
||||||
|
new CuboidRegion(pos1.getBlockVector3(), pos2.getBlockVector3()).getChunks());
|
||||||
queue.setChunkConsumer(chunk -> {
|
queue.setChunkConsumer(chunk -> {
|
||||||
|
|
||||||
int x = chunk.getX();
|
int x = chunk.getX();
|
||||||
@ -185,7 +188,7 @@ public class BukkitRegionManager extends RegionManager {
|
|||||||
int zzt = zzb + 15;
|
int zzt = zzb + 15;
|
||||||
if (xxb >= p1x && xxt <= p2x && zzb >= p1z && zzt <= p2z) {
|
if (xxb >= p1x && xxt <= p2x && zzb >= p1z && zzt <= p2z) {
|
||||||
AugmentedUtils
|
AugmentedUtils
|
||||||
.bypass(ignoreAugment, () -> queue.regenChunk(chunk.getX(), chunk.getZ()));
|
.bypass(ignoreAugment, () -> regenQueue.regenChunk(chunk.getX(), chunk.getZ()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
boolean checkX1 = false;
|
boolean checkX1 = false;
|
||||||
@ -285,7 +288,8 @@ public class BukkitRegionManager extends RegionManager {
|
|||||||
//map.restoreBlocks(worldObj, 0, 0);
|
//map.restoreBlocks(worldObj, 0, 0);
|
||||||
map.restoreEntities(Bukkit.getWorld(world.getName()), 0, 0);
|
map.restoreEntities(Bukkit.getWorld(world.getName()), 0, 0);
|
||||||
});
|
});
|
||||||
queue.setCompleteTask(whenDone);
|
regenQueue.setCompleteTask(whenDone);
|
||||||
|
queue.setCompleteTask(regenQueue::enqueue);
|
||||||
queue.enqueue();
|
queue.enqueue();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -370,7 +370,7 @@ public class Area extends SubCommand {
|
|||||||
blockQueue.getNewQueue(worldUtil.getWeWorld(world));
|
blockQueue.getNewQueue(worldUtil.getWeWorld(world));
|
||||||
queue.setChunkConsumer(chunk -> AugmentedUtils
|
queue.setChunkConsumer(chunk -> AugmentedUtils
|
||||||
.generate(null, world, chunk.getX(), chunk.getZ(),
|
.generate(null, world, chunk.getX(), chunk.getZ(),
|
||||||
queue));
|
null));
|
||||||
queue.addReadChunks(region.getChunks());
|
queue.addReadChunks(region.getChunks());
|
||||||
queue.enqueue();
|
queue.enqueue();
|
||||||
}
|
}
|
||||||
@ -681,7 +681,7 @@ public class Area extends SubCommand {
|
|||||||
QueueCoordinator queue =
|
QueueCoordinator queue =
|
||||||
blockQueue.getNewQueue(worldUtil.getWeWorld(area.getWorldName()));
|
blockQueue.getNewQueue(worldUtil.getWeWorld(area.getWorldName()));
|
||||||
queue.setChunkConsumer(chunk -> AugmentedUtils
|
queue.setChunkConsumer(chunk -> AugmentedUtils
|
||||||
.generate(null, area.getWorldName(), chunk.getX(), chunk.getZ(), queue));
|
.generate(null, area.getWorldName(), chunk.getX(), chunk.getZ(), null));
|
||||||
queue.addReadChunks(area.getRegion().getChunks());
|
queue.addReadChunks(area.getRegion().getChunks());
|
||||||
queue.setCompleteTask(() -> player.sendMessage("Regen complete"));
|
queue.setCompleteTask(() -> player.sendMessage("Regen complete"));
|
||||||
queue.enqueue();
|
queue.enqueue();
|
||||||
|
@ -35,7 +35,6 @@ import com.plotsquared.core.plot.PlotAreaTerrainType;
|
|||||||
import com.plotsquared.core.plot.PlotAreaType;
|
import com.plotsquared.core.plot.PlotAreaType;
|
||||||
import com.plotsquared.core.plot.PlotId;
|
import com.plotsquared.core.plot.PlotId;
|
||||||
import com.plotsquared.core.queue.QueueCoordinator;
|
import com.plotsquared.core.queue.QueueCoordinator;
|
||||||
import com.plotsquared.core.util.ChunkUtil;
|
|
||||||
import com.plotsquared.core.util.FileBytes;
|
import com.plotsquared.core.util.FileBytes;
|
||||||
import com.plotsquared.core.util.FileUtils;
|
import com.plotsquared.core.util.FileUtils;
|
||||||
import com.plotsquared.core.util.MathMan;
|
import com.plotsquared.core.util.MathMan;
|
||||||
@ -248,38 +247,19 @@ public class HybridPlotManager extends ClassicPlotManager {
|
|||||||
|
|
||||||
final BiomeType biome = hybridPlotWorld.getPlotBiome();
|
final BiomeType biome = hybridPlotWorld.getPlotBiome();
|
||||||
final QueueCoordinator queue = hybridPlotWorld.getQueue();
|
final QueueCoordinator queue = hybridPlotWorld.getQueue();
|
||||||
queue.addReadChunks(new CuboidRegion(plot.getExtendedBottomAbs().getBlockVector3(),
|
if (!canRegen) {
|
||||||
plot.getExtendedTopAbs().getBlockVector3()).getChunks());
|
queue.setCuboid(pos1.withY(0), pos2.withY(0), bedrock);
|
||||||
queue.setChunkConsumer(blockVector2 -> {
|
|
||||||
// If the chunk isn't near the edge and it isn't an augmented world we can just regen the whole chunk
|
|
||||||
if (canRegen && ChunkUtil.isWholeChunk(pos1, pos2, blockVector2)) {
|
|
||||||
queue.regenChunk(blockVector2.getX(), blockVector2.getZ());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
/* Otherwise we need to set each component, as we don't want to regenerate the road or other plots that share the same chunk.*/
|
|
||||||
// Set the biome
|
|
||||||
int x1 = Math.max(pos1.getX(), blockVector2.getX() << 4);
|
|
||||||
int z1 = Math.max(pos1.getZ(), blockVector2.getZ() << 4);
|
|
||||||
int x2 = Math.min(pos2.getX(), blockVector2.getX() << 4);
|
|
||||||
int z2 = Math.min(pos2.getZ(), blockVector2.getZ() << 4);
|
|
||||||
WorldUtil.setBiome(world, x1, z1, x2, z2, biome);
|
|
||||||
// These two locations are for each component (e.g. bedrock, main block, floor, air)
|
|
||||||
Location bot = Location.at(world, x1, 0, z1);
|
|
||||||
Location top = Location.at(world, x2, 1, z2);
|
|
||||||
queue.setCuboid(bot, top, bedrock);
|
|
||||||
// Each component has a different layer
|
// Each component has a different layer
|
||||||
bot = bot.withY(1);
|
queue.setCuboid(pos1.withY(1), pos2.withY(hybridPlotWorld.PLOT_HEIGHT - 1), filling);
|
||||||
top = top.withY(hybridPlotWorld.PLOT_HEIGHT);
|
queue.setCuboid(pos1.withY(hybridPlotWorld.PLOT_HEIGHT),
|
||||||
queue.setCuboid(bot, top, filling);
|
pos2.withY(hybridPlotWorld.PLOT_HEIGHT), plotfloor);
|
||||||
bot = bot.withY(hybridPlotWorld.PLOT_HEIGHT);
|
queue.setCuboid(pos1.withY(hybridPlotWorld.PLOT_HEIGHT + 1),
|
||||||
top = top.withY(hybridPlotWorld.PLOT_HEIGHT + 1);
|
pos2.withY(getWorldHeight()), air);
|
||||||
queue.setCuboid(bot, top, plotfloor);
|
queue.setBiomeCuboid(pos1, pos2, biome);
|
||||||
bot = bot.withY(hybridPlotWorld.PLOT_HEIGHT + 1);
|
} else {
|
||||||
top = top.withY(getWorldHeight());
|
queue.setRegenRegion(new CuboidRegion(pos1.getBlockVector3(), pos2.getBlockVector3()));
|
||||||
queue.setCuboid(bot, top, air);
|
}
|
||||||
// And finally set the schematic, the y value is unimportant for this function
|
pastePlotSchematic(queue, pos1, pos2);
|
||||||
pastePlotSchematic(queue, bot, top);
|
|
||||||
});
|
|
||||||
queue.setCompleteTask(whenDone);
|
queue.setCompleteTask(whenDone);
|
||||||
return queue.enqueue();
|
return queue.enqueue();
|
||||||
}
|
}
|
||||||
|
@ -30,6 +30,7 @@ import com.sk89q.jnbt.CompoundTag;
|
|||||||
import com.sk89q.worldedit.entity.Entity;
|
import com.sk89q.worldedit.entity.Entity;
|
||||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||||
import com.sk89q.worldedit.math.BlockVector2;
|
import com.sk89q.worldedit.math.BlockVector2;
|
||||||
|
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||||
import com.sk89q.worldedit.util.Location;
|
import com.sk89q.worldedit.util.Location;
|
||||||
import com.sk89q.worldedit.world.World;
|
import com.sk89q.worldedit.world.World;
|
||||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||||
@ -59,6 +60,7 @@ public abstract class BasicQueueCoordinator extends QueueCoordinator {
|
|||||||
private boolean regen = false;
|
private boolean regen = false;
|
||||||
private int[] regenStart;
|
private int[] regenStart;
|
||||||
private int[] regenEnd;
|
private int[] regenEnd;
|
||||||
|
private CuboidRegion regenRegion = null;
|
||||||
private Consumer<BlockVector2> consumer = null;
|
private Consumer<BlockVector2> consumer = null;
|
||||||
private boolean unloadAfter = true;
|
private boolean unloadAfter = true;
|
||||||
private GlobalBlockQueue globalBlockQueue;
|
private GlobalBlockQueue globalBlockQueue;
|
||||||
@ -155,6 +157,14 @@ public abstract class BasicQueueCoordinator extends QueueCoordinator {
|
|||||||
this.readRegion.addAll(readRegion);
|
this.readRegion.addAll(readRegion);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override public CuboidRegion getRegenRegion() {
|
||||||
|
return this.regenRegion != null ? this.regenRegion.clone() : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override public void setRegenRegion(CuboidRegion regenRegion) {
|
||||||
|
this.regenRegion = regenRegion;
|
||||||
|
}
|
||||||
|
|
||||||
@Override public void regenChunk(int x, int z) {
|
@Override public void regenChunk(int x, int z) {
|
||||||
regen = true;
|
regen = true;
|
||||||
// There will never only be one nullified coordinate pair
|
// There will never only be one nullified coordinate pair
|
||||||
|
@ -29,6 +29,7 @@ import com.sk89q.jnbt.CompoundTag;
|
|||||||
import com.sk89q.worldedit.entity.Entity;
|
import com.sk89q.worldedit.entity.Entity;
|
||||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||||
import com.sk89q.worldedit.math.BlockVector2;
|
import com.sk89q.worldedit.math.BlockVector2;
|
||||||
|
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||||
import com.sk89q.worldedit.world.World;
|
import com.sk89q.worldedit.world.World;
|
||||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||||
@ -211,6 +212,19 @@ public class DelegateQueueCoordinator extends QueueCoordinator {
|
|||||||
if (parent != null) {
|
if (parent != null) {
|
||||||
parent.setUnloadAfter(setUnloadAfter);
|
parent.setUnloadAfter(setUnloadAfter);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override public CuboidRegion getRegenRegion() {
|
||||||
|
if (parent != null) {
|
||||||
|
return parent.getRegenRegion();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override public void setRegenRegion(CuboidRegion regenRegion) {
|
||||||
|
if (parent != null) {
|
||||||
|
parent.setRegenRegion(regenRegion);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -68,7 +68,6 @@ public class GlobalBlockQueue {
|
|||||||
boolean success = false;
|
boolean success = false;
|
||||||
if (queue.size() > 0 && !activeQueues.contains(queue)) {
|
if (queue.size() > 0 && !activeQueues.contains(queue)) {
|
||||||
success = activeQueues.add(queue);
|
success = activeQueues.add(queue);
|
||||||
System.out.println("c");
|
|
||||||
queue.start();
|
queue.start();
|
||||||
}
|
}
|
||||||
return success;
|
return success;
|
||||||
|
@ -33,6 +33,7 @@ import com.sk89q.jnbt.CompoundTag;
|
|||||||
import com.sk89q.worldedit.entity.Entity;
|
import com.sk89q.worldedit.entity.Entity;
|
||||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||||
import com.sk89q.worldedit.math.BlockVector2;
|
import com.sk89q.worldedit.math.BlockVector2;
|
||||||
|
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||||
import com.sk89q.worldedit.world.World;
|
import com.sk89q.worldedit.world.World;
|
||||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||||
@ -129,6 +130,10 @@ public abstract class QueueCoordinator {
|
|||||||
|
|
||||||
public abstract void setUnloadAfter(boolean unloadAfter);
|
public abstract void setUnloadAfter(boolean unloadAfter);
|
||||||
|
|
||||||
|
public abstract CuboidRegion getRegenRegion();
|
||||||
|
|
||||||
|
public abstract void setRegenRegion(CuboidRegion regenRegion);
|
||||||
|
|
||||||
public abstract void regenChunk(int x, int z);
|
public abstract void regenChunk(int x, int z);
|
||||||
|
|
||||||
public abstract World getWorld();
|
public abstract World getWorld();
|
||||||
@ -138,7 +143,6 @@ public abstract class QueueCoordinator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean enqueue() {
|
public boolean enqueue() {
|
||||||
System.out.println("b");
|
|
||||||
return blockQueue.enqueue(this);
|
return blockQueue.enqueue(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -181,4 +185,20 @@ public abstract class QueueCoordinator {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setBiomeCuboid(Location pos1, Location pos2, BiomeType biome) {
|
||||||
|
int yMin = Math.min(pos1.getY(), pos2.getY());
|
||||||
|
int yMax = Math.min(255, Math.max(pos1.getY(), pos2.getY()));
|
||||||
|
int xMin = Math.min(pos1.getX(), pos2.getX());
|
||||||
|
int xMax = Math.max(pos1.getX(), pos2.getX());
|
||||||
|
int zMin = Math.min(pos1.getZ(), pos2.getZ());
|
||||||
|
int zMax = Math.max(pos1.getZ(), pos2.getZ());
|
||||||
|
for (int y = yMin; y <= yMax; y++) {
|
||||||
|
for (int x = xMin; x <= xMax; x++) {
|
||||||
|
for (int z = zMin; z <= zMax; z++) {
|
||||||
|
setBiome(x, y, z, biome);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -281,7 +281,6 @@ public abstract class SchematicHandler {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
final QueueCoordinator queue = plot.getArea().getQueue();
|
|
||||||
BlockVector3 dimension = schematic.getClipboard().getDimensions();
|
BlockVector3 dimension = schematic.getClipboard().getDimensions();
|
||||||
final int WIDTH = dimension.getX();
|
final int WIDTH = dimension.getX();
|
||||||
final int LENGTH = dimension.getZ();
|
final int LENGTH = dimension.getZ();
|
||||||
@ -330,50 +329,29 @@ public abstract class SchematicHandler {
|
|||||||
final int bcz = p1z >> 4;
|
final int bcz = p1z >> 4;
|
||||||
final int tcx = p2x >> 4;
|
final int tcx = p2x >> 4;
|
||||||
final int tcz = p2z >> 4;
|
final int tcz = p2z >> 4;
|
||||||
queue.addReadChunks(
|
// Paste schematic here
|
||||||
new CuboidRegion(pos1.getBlockVector3(), pos2.getBlockVector3()).getChunks());
|
final QueueCoordinator queue = plot.getArea().getQueue();
|
||||||
queue.setChunkConsumer(blockVector2 -> {
|
|
||||||
int x = blockVector2.getX();
|
|
||||||
int z = blockVector2.getZ();
|
|
||||||
int xxb = x << 4;
|
|
||||||
int zzb = z << 4;
|
|
||||||
int xxt = xxb + 15;
|
|
||||||
int zzt = zzb + 15;
|
|
||||||
if (x == bcx) {
|
|
||||||
xxb = p1x;
|
|
||||||
}
|
|
||||||
if (x == tcx) {
|
|
||||||
xxt = p2x;
|
|
||||||
}
|
|
||||||
if (z == bcz) {
|
|
||||||
zzb = p1z;
|
|
||||||
}
|
|
||||||
if (z == tcz) {
|
|
||||||
zzt = p2z;
|
|
||||||
}
|
|
||||||
// Paste schematic here
|
|
||||||
|
|
||||||
for (int ry = 0; ry < Math.min(256, HEIGHT); ry++) {
|
for (int ry = 0; ry < Math.min(256, HEIGHT); ry++) {
|
||||||
int yy = y_offset_actual + ry;
|
int yy = y_offset_actual + ry;
|
||||||
if (yy > 255) {
|
if (yy > 255) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
for (int rz = zzb - p1z; rz <= (zzt - p1z); rz++) {
|
for (int rz = 0; rz <= blockArrayClipboard.getDimensions().getZ(); rz++) {
|
||||||
for (int rx = xxb - p1x; rx <= (xxt - p1x); rx++) {
|
for (int rx = 0; rx < blockArrayClipboard.getDimensions().getX(); rx++) {
|
||||||
int xx = p1x + xOffset + rx;
|
int xx = p1x + xOffset + rx;
|
||||||
int zz = p1z + zOffset + rz;
|
int zz = p1z + zOffset + rz;
|
||||||
BaseBlock id =
|
BaseBlock id =
|
||||||
blockArrayClipboard.getFullBlock(BlockVector3.at(rx, ry, rz));
|
blockArrayClipboard.getFullBlock(BlockVector3.at(rx, ry, rz));
|
||||||
queue.setBlock(xx, yy, zz, id);
|
queue.setBlock(xx, yy, zz, id);
|
||||||
if (ry == 0) {
|
if (ry == 0) {
|
||||||
BiomeType biome =
|
BiomeType biome =
|
||||||
blockArrayClipboard.getBiome(BlockVector2.at(rx, rz));
|
blockArrayClipboard.getBiome(BlockVector3.at(rx, ry, rz));
|
||||||
queue.setBiome(xx, zz, biome);
|
queue.setBiome(xx, yy, zz, biome);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
if (whenDone != null) {
|
if (whenDone != null) {
|
||||||
whenDone.value = true;
|
whenDone.value = true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user