geforkt von Mirrors/FastAsyncWorldEdit
Merge remote-tracking branch 'origin/commanding-pipeline' into commanding-pipeline
Dieser Commit ist enthalten in:
Commit
1ffe05464f
@ -267,6 +267,14 @@ public abstract class QueueHandler implements Trimable, Runnable {
|
||||
queuePool.set(null);
|
||||
}
|
||||
|
||||
private IQueueExtent pool() {
|
||||
IQueueExtent queue = queuePool.get();
|
||||
if (queue == null) {
|
||||
queuePool.set(queue = queuePool.init());
|
||||
}
|
||||
return queue;
|
||||
}
|
||||
|
||||
public abstract void startSet(boolean parallel);
|
||||
|
||||
public abstract void endSet(boolean parallel);
|
||||
@ -276,7 +284,7 @@ public abstract class QueueHandler implements Trimable, Runnable {
|
||||
}
|
||||
|
||||
public IQueueExtent getQueue(World world, IBatchProcessor processor) {
|
||||
final IQueueExtent queue = queuePool.get();
|
||||
final IQueueExtent queue = pool();
|
||||
IChunkCache<IChunkGet> cacheGet = getOrCreateWorldCache(world);
|
||||
IChunkCache<IChunkSet> set = null; // TODO cache?
|
||||
queue.init(world, cacheGet, set);
|
||||
|
@ -327,17 +327,6 @@ public interface Clipboard extends Extent, Iterable<BlockVector3>, Closeable {
|
||||
final int rely = to.getBlockY() - origin.getBlockY();
|
||||
final int relz = to.getBlockZ() - origin.getBlockZ();
|
||||
|
||||
// this.apply(this, new Filter() {
|
||||
// @Override
|
||||
// public void applyBlock(FilterBlock block) {
|
||||
//
|
||||
// }
|
||||
// });
|
||||
|
||||
System.out.println("Rel " + relx + "," + rely + "," + relz + " | " + to + " | " + origin);
|
||||
|
||||
System.out.println("TODO optimize paste using above apply");
|
||||
|
||||
Operation visitor = new RegionVisitor(region, new RegionFunction() {
|
||||
// MutableBlockVector2 mpos2d_2 = new MutableBlockVector2();
|
||||
MutableBlockVector2 mpos2d = new MutableBlockVector2();
|
||||
@ -349,7 +338,6 @@ public interface Clipboard extends Extent, Iterable<BlockVector3>, Closeable {
|
||||
@Override
|
||||
public boolean apply(BlockVector3 mutable) throws WorldEditException {
|
||||
BlockState block = getBlock(mutable);
|
||||
System.out.println("Pos " + mutable);
|
||||
int xx = mutable.getBlockX() + relx;
|
||||
int zz = mutable.getBlockZ() + relz;
|
||||
if (copyBiomes && xx != mpos2d.getBlockX() && zz != mpos2d.getBlockZ()) {
|
||||
|
@ -95,7 +95,7 @@ public class SpongeSchematicReader extends NBTSchematicReader {
|
||||
private int width, height, length;
|
||||
private int offsetX, offsetY, offsetZ;
|
||||
private char[] palette, biomePalette;
|
||||
private BlockVector3 min;
|
||||
private BlockVector3 min = BlockVector3.ZERO;
|
||||
|
||||
|
||||
/**
|
||||
@ -220,7 +220,8 @@ public class SpongeSchematicReader extends NBTSchematicReader {
|
||||
BlockVector3 dimensions = BlockVector3.at(width, height, length);
|
||||
BlockVector3 origin = min;
|
||||
if (offsetX != Integer.MIN_VALUE && offsetY != Integer.MIN_VALUE && offsetZ != Integer.MIN_VALUE) {
|
||||
origin = origin.subtract(BlockVector3.at(offsetX, offsetY, offsetZ));
|
||||
// origin = origin.subtract(BlockVector3.at(offsetX, offsetY, offsetZ));
|
||||
origin = BlockVector3.at(offsetX, offsetY, offsetZ);
|
||||
}
|
||||
|
||||
Clipboard clipboard = createOutput.apply(dimensions);
|
||||
@ -339,7 +340,6 @@ public class SpongeSchematicReader extends NBTSchematicReader {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
clipboard.setOrigin(origin);
|
||||
return clipboard;
|
||||
}
|
||||
|
@ -20,6 +20,7 @@
|
||||
package com.sk89q.worldedit.extent.clipboard.io;
|
||||
|
||||
import com.boydti.fawe.jnbt.streamer.IntValueReader;
|
||||
import com.boydti.fawe.object.FaweOutputStream;
|
||||
import com.boydti.fawe.util.IOUtil;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.sk89q.jnbt.CompoundTag;
|
||||
@ -133,7 +134,7 @@ public class SpongeSchematicWriter implements ClipboardWriter {
|
||||
});
|
||||
|
||||
ByteArrayOutputStream blocksCompressed = new ByteArrayOutputStream();
|
||||
DataOutputStream blocksOut = new DataOutputStream(new LZ4BlockOutputStream(blocksCompressed));
|
||||
FaweOutputStream blocksOut = new FaweOutputStream(new DataOutputStream(new LZ4BlockOutputStream(blocksCompressed)));
|
||||
|
||||
ByteArrayOutputStream tilesCompressed = new ByteArrayOutputStream();
|
||||
NBTOutputStream tilesOut = new NBTOutputStream(new LZ4BlockOutputStream(tilesCompressed));
|
||||
@ -141,7 +142,7 @@ public class SpongeSchematicWriter implements ClipboardWriter {
|
||||
List<Integer> paletteList = new ArrayList<>();
|
||||
char[] palette = new char[BlockTypesCache.states.length];
|
||||
Arrays.fill(palette, Character.MAX_VALUE);
|
||||
int[] paletteMax = {0};
|
||||
int paletteMax = 0;
|
||||
int numTiles = 0;
|
||||
for (BlockVector3 pos : clipboard) {
|
||||
BaseBlock block = pos.getFullBlock(clipboard);
|
||||
@ -166,12 +167,21 @@ public class SpongeSchematicWriter implements ClipboardWriter {
|
||||
numTiles++;
|
||||
tilesOut.writeTagPayload(block.getNbtData());
|
||||
}
|
||||
|
||||
int ordinal = block.getOrdinal();
|
||||
char value = palette[ordinal];
|
||||
if (value == Character.MAX_VALUE) {
|
||||
int size = paletteMax++;
|
||||
palette[ordinal] = value = (char) size;
|
||||
paletteList.add(ordinal);
|
||||
}
|
||||
blocksOut.writeVarInt(value);
|
||||
}
|
||||
// close
|
||||
tilesOut.close();
|
||||
blocksOut.close();
|
||||
|
||||
out.writeNamedTag("PaletteMax", paletteMax[0]);
|
||||
out.writeNamedTag("PaletteMax", paletteMax);
|
||||
|
||||
out.writeLazyCompoundTag("Palette", out12 -> {
|
||||
for (int i = 0; i < paletteList.size(); i++) {
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren