geforkt von Mirrors/FastAsyncWorldEdit
Fix //vis
Dieser Commit ist enthalten in:
Ursprung
c3f86fd6da
Commit
69c225c00f
@ -80,7 +80,7 @@ public class MapChunkUtil_1_14 {
|
|||||||
try {
|
try {
|
||||||
PacketPlayOutMapChunk nmsPacket;
|
PacketPlayOutMapChunk nmsPacket;
|
||||||
int bitMask = packet.getChunk().getBitMask();
|
int bitMask = packet.getChunk().getBitMask();
|
||||||
if (bitMask == 0) {
|
if (bitMask == 0) { // TODO remove once sending tiles/entities is fixed
|
||||||
nmsPacket = Fawe.get().getQueueHandler().sync((Callable<PacketPlayOutMapChunk>) () -> {
|
nmsPacket = Fawe.get().getQueueHandler().sync((Callable<PacketPlayOutMapChunk>) () -> {
|
||||||
Chunk nmsChunk = world.getChunkAt(packet.getChunkX(), packet.getChunkZ());
|
Chunk nmsChunk = world.getChunkAt(packet.getChunkX(), packet.getChunkZ());
|
||||||
PacketPlayOutMapChunk nmsPacket1 = new PacketPlayOutMapChunk(nmsChunk, 65535);
|
PacketPlayOutMapChunk nmsPacket1 = new PacketPlayOutMapChunk(nmsChunk, 65535);
|
||||||
|
@ -28,7 +28,7 @@ public class CombinedBlocks implements IBlocks {
|
|||||||
public CombinedBlocks(IBlocks secondary, IBlocks primary, int addMask) {
|
public CombinedBlocks(IBlocks secondary, IBlocks primary, int addMask) {
|
||||||
this.secondary = secondary;
|
this.secondary = secondary;
|
||||||
this.primary = primary;
|
this.primary = primary;
|
||||||
this.addMask = addMask;
|
this.addMask = addMask == 0 ? 0 : addMask & secondary.getBitMask();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -8,8 +8,10 @@ import com.sk89q.worldedit.WorldEdit;
|
|||||||
import com.sk89q.worldedit.extension.platform.Capability;
|
import com.sk89q.worldedit.extension.platform.Capability;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||||
|
import com.sk89q.worldedit.world.biome.BiomeTypes;
|
||||||
import com.sk89q.worldedit.world.block.BlockID;
|
import com.sk89q.worldedit.world.block.BlockID;
|
||||||
import com.sk89q.worldedit.world.block.BlockState;
|
import com.sk89q.worldedit.world.block.BlockState;
|
||||||
|
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||||
import com.sk89q.worldedit.world.registry.BlockRegistry;
|
import com.sk89q.worldedit.world.registry.BlockRegistry;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@ -45,11 +47,11 @@ public interface IBlocks extends Trimable {
|
|||||||
|
|
||||||
IBlocks reset();
|
IBlocks reset();
|
||||||
|
|
||||||
default byte[] toByteArray(int bitMask) {
|
default byte[] toByteArray(boolean full) {
|
||||||
return toByteArray(null, bitMask);
|
return toByteArray(null, getBitMask(), full);
|
||||||
}
|
}
|
||||||
|
|
||||||
default byte[] toByteArray(byte[] buffer, int bitMask) {
|
default byte[] toByteArray(byte[] buffer, int bitMask, boolean full) {
|
||||||
if (buffer == null) {
|
if (buffer == null) {
|
||||||
buffer = new byte[1024];
|
buffer = new byte[1024];
|
||||||
}
|
}
|
||||||
@ -58,11 +60,11 @@ public interface IBlocks extends Trimable {
|
|||||||
FastByteArrayOutputStream sectionByteArray = new FastByteArrayOutputStream(buffer);
|
FastByteArrayOutputStream sectionByteArray = new FastByteArrayOutputStream(buffer);
|
||||||
FaweOutputStream sectionWriter = new FaweOutputStream(sectionByteArray);
|
FaweOutputStream sectionWriter = new FaweOutputStream(sectionByteArray);
|
||||||
|
|
||||||
System.out.println("Bitmask " + getBitMask());
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
for (int layer = 0; layer < FaweCache.IMP.CHUNK_LAYERS; layer++) {
|
for (int layer = 0; layer < FaweCache.IMP.CHUNK_LAYERS; layer++) {
|
||||||
if (!this.hasSection(layer)) continue;
|
if (!this.hasSection(layer) || (bitMask & (1 << layer)) == 0) continue;
|
||||||
|
|
||||||
|
System.out.println("Write section " + layer);
|
||||||
|
|
||||||
char[] ids = this.load(layer);
|
char[] ids = this.load(layer);
|
||||||
|
|
||||||
@ -83,7 +85,7 @@ public interface IBlocks extends Trimable {
|
|||||||
|
|
||||||
sectionWriter.writeShort(nonEmpty); // non empty
|
sectionWriter.writeShort(nonEmpty); // non empty
|
||||||
|
|
||||||
// if (false) {
|
// if (false) { // short palette
|
||||||
// sectionWriter.writeByte(14); // globalPaletteBitsPerBlock
|
// sectionWriter.writeByte(14); // globalPaletteBitsPerBlock
|
||||||
// BitArray4096 bits = new BitArray4096(14); // globalPaletteBitsPerBlock
|
// BitArray4096 bits = new BitArray4096(14); // globalPaletteBitsPerBlock
|
||||||
// bits.setAt(0, 0);
|
// bits.setAt(0, 0);
|
||||||
@ -123,22 +125,7 @@ public interface IBlocks extends Trimable {
|
|||||||
}
|
}
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
if (full) {
|
||||||
// if (writeBiomes) {
|
|
||||||
// for (int x = 0; x < 16; x++) {
|
|
||||||
// for (int z = 0; z < 16; z++) {
|
|
||||||
// BiomeType biome = this.getBiomeType(x, z);
|
|
||||||
// if (biome == null) {
|
|
||||||
// if (writeBiomes) {
|
|
||||||
// break;
|
|
||||||
// } else {
|
|
||||||
// biome = BiomeTypes.FOREST;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
if (bitMask == Character.MAX_VALUE) {
|
|
||||||
for (int z = 0; z < 16; z++) {
|
for (int z = 0; z < 16; z++) {
|
||||||
for (int x = 0; x < 16; x++) {
|
for (int x = 0; x < 16; x++) {
|
||||||
BiomeType biome = getBiomeType(x, z);
|
BiomeType biome = getBiomeType(x, z);
|
||||||
|
@ -63,7 +63,8 @@ public class ChunkPacket implements Function<byte[], byte[]>, Supplier<byte[]> {
|
|||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
if (sectionBytes == null) {
|
if (sectionBytes == null) {
|
||||||
IBlocks tmpChunk = getChunk();
|
IBlocks tmpChunk = getChunk();
|
||||||
sectionBytes = tmpChunk.toByteArray(FaweCache.IMP.BYTE_BUFFER_8192.get(), tmpChunk.getBitMask());
|
byte[] buf = FaweCache.IMP.BYTE_BUFFER_8192.get();
|
||||||
|
sectionBytes = tmpChunk.toByteArray(buf, tmpChunk.getBitMask(), this.full);
|
||||||
}
|
}
|
||||||
tmp = sectionBytes;
|
tmp = sectionBytes;
|
||||||
}
|
}
|
||||||
|
@ -10,21 +10,20 @@ import com.boydti.fawe.beta.implementation.packet.ChunkPacket;
|
|||||||
import com.sk89q.worldedit.entity.Player;
|
import com.sk89q.worldedit.entity.Player;
|
||||||
import com.sk89q.worldedit.extent.Extent;
|
import com.sk89q.worldedit.extent.Extent;
|
||||||
import com.sk89q.worldedit.world.World;
|
import com.sk89q.worldedit.world.World;
|
||||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
import java.util.stream.Stream;
|
|
||||||
|
|
||||||
public class ChunkSendProcessor implements IBatchProcessor {
|
public class ChunkSendProcessor implements IBatchProcessor {
|
||||||
private final Supplier<Stream<Player>> players;
|
private final Supplier<Collection<Player>> players;
|
||||||
private final World world;
|
private final World world;
|
||||||
private final boolean full;
|
private final boolean full;
|
||||||
|
|
||||||
public ChunkSendProcessor(World world, Supplier<Stream<Player>> players) {
|
public ChunkSendProcessor(World world, Supplier<Collection<Player>> players) {
|
||||||
this(world, players, false);
|
this(world, players, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ChunkSendProcessor(World world, Supplier<Stream<Player>> players, boolean full) {
|
public ChunkSendProcessor(World world, Supplier<Collection<Player>> players, boolean full) {
|
||||||
this.players = players;
|
this.players = players;
|
||||||
this.world = world;
|
this.world = world;
|
||||||
this.full = full;
|
this.full = full;
|
||||||
@ -34,7 +33,7 @@ public class ChunkSendProcessor implements IBatchProcessor {
|
|||||||
return world;
|
return world;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Supplier<Stream<Player>> getPlayers() {
|
public Supplier<Collection<Player>> getPlayers() {
|
||||||
return players;
|
return players;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,12 +52,15 @@ public class ChunkSendProcessor implements IBatchProcessor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
ChunkPacket packet = new ChunkPacket(chunkX, chunkZ, () -> blocks, full);
|
ChunkPacket packet = new ChunkPacket(chunkX, chunkZ, () -> blocks, full);
|
||||||
Stream<Player> stream = this.players.get();
|
Collection<Player> stream = this.players.get();
|
||||||
if (stream == null) {
|
if (stream == null) {
|
||||||
world.sendFakeChunk(null, packet);
|
world.sendFakeChunk(null, packet);
|
||||||
} else {
|
} else {
|
||||||
stream.filter(player -> player.getWorld().equals(world))
|
for (Player player : stream) {
|
||||||
.forEach(player -> world.sendFakeChunk(player, packet));
|
if (player.getWorld().equals(world)) {
|
||||||
|
world.sendFakeChunk(player, packet);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return set;
|
return set;
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@ import com.boydti.fawe.beta.IChunk;
|
|||||||
import com.boydti.fawe.beta.IChunkGet;
|
import com.boydti.fawe.beta.IChunkGet;
|
||||||
import com.boydti.fawe.beta.IChunkSet;
|
import com.boydti.fawe.beta.IChunkSet;
|
||||||
import com.boydti.fawe.beta.IQueueExtent;
|
import com.boydti.fawe.beta.IQueueExtent;
|
||||||
|
import com.boydti.fawe.beta.implementation.IChunkExtent;
|
||||||
import com.boydti.fawe.beta.implementation.packet.ChunkPacket;
|
import com.boydti.fawe.beta.implementation.packet.ChunkPacket;
|
||||||
import com.boydti.fawe.util.MathMan;
|
import com.boydti.fawe.util.MathMan;
|
||||||
import com.sk89q.worldedit.entity.Player;
|
import com.sk89q.worldedit.entity.Player;
|
||||||
@ -14,19 +15,25 @@ import com.sk89q.worldedit.math.BlockVector2;
|
|||||||
import com.sk89q.worldedit.world.World;
|
import com.sk89q.worldedit.world.World;
|
||||||
import it.unimi.dsi.fastutil.longs.Long2ObjectLinkedOpenHashMap;
|
import it.unimi.dsi.fastutil.longs.Long2ObjectLinkedOpenHashMap;
|
||||||
import it.unimi.dsi.fastutil.longs.Long2ObjectMap;
|
import it.unimi.dsi.fastutil.longs.Long2ObjectMap;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
public class PersistentChunkSendProcessor extends ChunkSendProcessor {
|
public class PersistentChunkSendProcessor extends ChunkSendProcessor {
|
||||||
private final Long2ObjectLinkedOpenHashMap<Character> current;
|
private final Long2ObjectLinkedOpenHashMap<Character> current;
|
||||||
private final IQueueExtent queue;
|
@Nullable
|
||||||
private Long2ObjectLinkedOpenHashMap<Character> previous;
|
private Long2ObjectLinkedOpenHashMap<Character> previous;
|
||||||
|
private IChunkExtent queue;
|
||||||
|
|
||||||
public PersistentChunkSendProcessor(IQueueExtent queue, World world, PersistentChunkSendProcessor previous, Supplier<Stream<Player>> players) {
|
public PersistentChunkSendProcessor(World world, PersistentChunkSendProcessor previous, Supplier<Collection<Player>> players) {
|
||||||
super(world, players);
|
super(world, players);
|
||||||
this.current = new Long2ObjectLinkedOpenHashMap<>();
|
this.current = new Long2ObjectLinkedOpenHashMap<>();
|
||||||
this.previous = previous.current;
|
this.previous = previous != null ? previous.current : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void init(IChunkExtent queue) {
|
||||||
this.queue = queue;
|
this.queue = queue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -35,10 +42,15 @@ public class PersistentChunkSendProcessor extends ChunkSendProcessor {
|
|||||||
int chunkX = chunk.getX();
|
int chunkX = chunk.getX();
|
||||||
int chunkZ = chunk.getZ();
|
int chunkZ = chunk.getZ();
|
||||||
long pair = MathMan.pairInt(chunkX, chunkZ);
|
long pair = MathMan.pairInt(chunkX, chunkZ);
|
||||||
Character bitMask = (char) (set.hasBiomes() ? Character.MAX_VALUE : set.getBitMask());
|
char bitMask = (char) (set.hasBiomes() ? Character.MAX_VALUE : set.getBitMask());
|
||||||
current.put(pair, bitMask);
|
synchronized (this) {
|
||||||
|
current.put(pair, (Character) bitMask);
|
||||||
|
if (previous != null) {
|
||||||
Character lastValue = previous.remove(pair);
|
Character lastValue = previous.remove(pair);
|
||||||
return new CombinedBlocks(get, set, lastValue == null ? 0 : lastValue);
|
if (lastValue != null) bitMask |= lastValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return new CombinedBlocks(get, set, bitMask);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void flush() {
|
public void flush() {
|
||||||
@ -47,13 +59,15 @@ public class PersistentChunkSendProcessor extends ChunkSendProcessor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void clear() {
|
public void clear() {
|
||||||
|
if (queue == null) throw new IllegalStateException("Queue is not provided");
|
||||||
clear(current);
|
clear(current);
|
||||||
current.clear();
|
current.clear();
|
||||||
|
queue = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void clear(Long2ObjectLinkedOpenHashMap<Character> current) {
|
public void clear(Long2ObjectLinkedOpenHashMap<Character> current) {
|
||||||
if (current != null && !current.isEmpty()) {
|
if (current != null && !current.isEmpty()) {
|
||||||
Stream<Player> players = getPlayers().get();
|
Collection<Player> players = getPlayers().get();
|
||||||
for (Long2ObjectMap.Entry<Character> entry : current.long2ObjectEntrySet()) {
|
for (Long2ObjectMap.Entry<Character> entry : current.long2ObjectEntrySet()) {
|
||||||
long pair = entry.getLongKey();
|
long pair = entry.getLongKey();
|
||||||
int chunkX = MathMan.unpairIntX(pair);
|
int chunkX = MathMan.unpairIntX(pair);
|
||||||
|
@ -1187,8 +1187,6 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
|
|||||||
char combined = block.getDefaultState().getOrdinalChar();
|
char combined = block.getDefaultState().getOrdinalChar();
|
||||||
mainArr[index] = combined;
|
mainArr[index] = combined;
|
||||||
floorArr[index] = combined;
|
floorArr[index] = combined;
|
||||||
} else {
|
|
||||||
System.out.println("Block is null: " + color);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -193,7 +193,6 @@ public class DiskStorageHistory extends FaweStreamChangeSet {
|
|||||||
public void close() throws IOException {
|
public void close() throws IOException {
|
||||||
super.close();
|
super.close();
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
boolean flushed = osBD != null || osBIO != null || osNBTF != null || osNBTT != null && osENTCF != null || osENTCT != null;
|
|
||||||
try {
|
try {
|
||||||
if (osBD != null) {
|
if (osBD != null) {
|
||||||
osBD.close();
|
osBD.close();
|
||||||
@ -222,9 +221,6 @@ public class DiskStorageHistory extends FaweStreamChangeSet {
|
|||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
if (!flushed) {
|
|
||||||
throw new IOException("Empty");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,6 +48,7 @@ public abstract class FaweChangeSet implements ChangeSet, IBatchProcessor, Close
|
|||||||
private final String worldName;
|
private final String worldName;
|
||||||
protected AtomicInteger waitingCombined = new AtomicInteger(0);
|
protected AtomicInteger waitingCombined = new AtomicInteger(0);
|
||||||
protected AtomicInteger waitingAsync = new AtomicInteger(0);
|
protected AtomicInteger waitingAsync = new AtomicInteger(0);
|
||||||
|
private boolean closed;
|
||||||
|
|
||||||
public static FaweChangeSet getDefaultChangeSet(World world, UUID uuid) {
|
public static FaweChangeSet getDefaultChangeSet(World world, UUID uuid) {
|
||||||
if (Settings.IMP.HISTORY.USE_DISK) {
|
if (Settings.IMP.HISTORY.USE_DISK) {
|
||||||
@ -80,6 +81,8 @@ public abstract class FaweChangeSet implements ChangeSet, IBatchProcessor, Close
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void closeAsync() {
|
public void closeAsync() {
|
||||||
|
if (closed) return;
|
||||||
|
closed = true;
|
||||||
waitingAsync.incrementAndGet();
|
waitingAsync.incrementAndGet();
|
||||||
TaskManager.IMP.async(() -> {
|
TaskManager.IMP.async(() -> {
|
||||||
waitingAsync.decrementAndGet();
|
waitingAsync.decrementAndGet();
|
||||||
@ -116,8 +119,11 @@ public abstract class FaweChangeSet implements ChangeSet, IBatchProcessor, Close
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void close() throws IOException {
|
public void close() throws IOException {
|
||||||
|
if (!closed) {
|
||||||
|
closed = true;
|
||||||
flush();
|
flush();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public abstract void add(int x, int y, int z, int combinedFrom, int combinedTo);
|
public abstract void add(int x, int y, int z, int combinedFrom, int combinedTo);
|
||||||
|
|
||||||
|
@ -77,6 +77,7 @@ import org.enginehub.piston.annotation.param.Switch;
|
|||||||
import org.enginehub.piston.inject.InjectedValueAccess;
|
import org.enginehub.piston.inject.InjectedValueAccess;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
@ -151,7 +152,7 @@ public class RegionCommands {
|
|||||||
@Logging(REGION)
|
@Logging(REGION)
|
||||||
public void test(Player player, EditSession editSession, @Selection Region region, @Arg(desc = "hello there") BiomeType biome) throws WorldEditException {
|
public void test(Player player, EditSession editSession, @Selection Region region, @Arg(desc = "hello there") BiomeType biome) throws WorldEditException {
|
||||||
System.out.println("Test start");
|
System.out.println("Test start");
|
||||||
editSession.addProcessor(new ChunkSendProcessor(editSession.getWorld(), () -> Stream.of(player)));
|
editSession.addProcessor(new ChunkSendProcessor(editSession.getWorld(), () -> Collections.singleton(player)));
|
||||||
editSession.addProcessor(NullProcessor.INSTANCE);
|
editSession.addProcessor(NullProcessor.INSTANCE);
|
||||||
FlatRegionFunction replace = new BiomeReplace(editSession, biome);
|
FlatRegionFunction replace = new BiomeReplace(editSession, biome);
|
||||||
FlatRegionVisitor visitor = new FlatRegionVisitor(Regions.asFlatRegion(region), replace);
|
FlatRegionVisitor visitor = new FlatRegionVisitor(Regions.asFlatRegion(region), replace);
|
||||||
|
@ -23,6 +23,8 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
|||||||
import static org.slf4j.LoggerFactory.getLogger;
|
import static org.slf4j.LoggerFactory.getLogger;
|
||||||
|
|
||||||
import com.boydti.fawe.Fawe;
|
import com.boydti.fawe.Fawe;
|
||||||
|
import com.boydti.fawe.beta.IQueueExtent;
|
||||||
|
import com.boydti.fawe.beta.implementation.IChunkExtent;
|
||||||
import com.boydti.fawe.beta.implementation.processors.NullProcessor;
|
import com.boydti.fawe.beta.implementation.processors.NullProcessor;
|
||||||
import com.boydti.fawe.beta.implementation.processors.PersistentChunkSendProcessor;
|
import com.boydti.fawe.beta.implementation.processors.PersistentChunkSendProcessor;
|
||||||
import com.boydti.fawe.config.BBC;
|
import com.boydti.fawe.config.BBC;
|
||||||
@ -40,6 +42,7 @@ import com.boydti.fawe.object.mask.MaskedTargetBlock;
|
|||||||
import com.boydti.fawe.object.pattern.PatternTraverser;
|
import com.boydti.fawe.object.pattern.PatternTraverser;
|
||||||
import com.boydti.fawe.util.BrushCache;
|
import com.boydti.fawe.util.BrushCache;
|
||||||
import com.boydti.fawe.util.EditSessionBuilder;
|
import com.boydti.fawe.util.EditSessionBuilder;
|
||||||
|
import com.boydti.fawe.util.ExtentTraverser;
|
||||||
import com.boydti.fawe.util.MaskTraverser;
|
import com.boydti.fawe.util.MaskTraverser;
|
||||||
import com.boydti.fawe.util.StringMan;
|
import com.boydti.fawe.util.StringMan;
|
||||||
import com.boydti.fawe.util.TaskManager;
|
import com.boydti.fawe.util.TaskManager;
|
||||||
@ -58,6 +61,7 @@ import com.sk89q.worldedit.entity.Player;
|
|||||||
import com.sk89q.worldedit.extension.input.InputParseException;
|
import com.sk89q.worldedit.extension.input.InputParseException;
|
||||||
import com.sk89q.worldedit.extension.platform.Actor;
|
import com.sk89q.worldedit.extension.platform.Actor;
|
||||||
import com.sk89q.worldedit.extension.platform.Platform;
|
import com.sk89q.worldedit.extension.platform.Platform;
|
||||||
|
import com.sk89q.worldedit.extent.Extent;
|
||||||
import com.sk89q.worldedit.extent.inventory.BlockBag;
|
import com.sk89q.worldedit.extent.inventory.BlockBag;
|
||||||
import com.sk89q.worldedit.function.mask.Mask;
|
import com.sk89q.worldedit.function.mask.Mask;
|
||||||
import com.sk89q.worldedit.function.mask.MaskIntersection;
|
import com.sk89q.worldedit.function.mask.MaskIntersection;
|
||||||
@ -74,6 +78,8 @@ import java.io.IOException;
|
|||||||
import java.io.ObjectInputStream;
|
import java.io.ObjectInputStream;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.locks.Lock;
|
import java.util.concurrent.locks.Lock;
|
||||||
@ -653,11 +659,20 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool
|
|||||||
.combineStages(true);
|
.combineStages(true);
|
||||||
EditSession editSession = builder.build();
|
EditSession editSession = builder.build();
|
||||||
|
|
||||||
PersistentChunkSendProcessor previous = null;
|
|
||||||
World world = editSession.getWorld();
|
World world = editSession.getWorld();
|
||||||
Supplier<Stream<Player>> players = () -> Stream.of(player);
|
Supplier<Collection<Player>> players = () -> Collections.singleton(player);
|
||||||
|
|
||||||
PersistentChunkSendProcessor newVisualExtent = new PersistentChunkSendProcessor(world, previous, players);
|
PersistentChunkSendProcessor newVisualExtent = new PersistentChunkSendProcessor(world, this.visualExtent, players);
|
||||||
|
ExtentTraverser<IChunkExtent> traverser = new ExtentTraverser<>(editSession).find(IChunkExtent.class);
|
||||||
|
if (traverser == null) {
|
||||||
|
throw new IllegalStateException("No queue found");
|
||||||
|
}
|
||||||
|
|
||||||
|
IChunkExtent chunkExtent = traverser.get();
|
||||||
|
if (this.visualExtent != null) {
|
||||||
|
this.visualExtent.init(chunkExtent);
|
||||||
|
}
|
||||||
|
newVisualExtent.init(chunkExtent);
|
||||||
|
|
||||||
editSession.addProcessor(newVisualExtent);
|
editSession.addProcessor(newVisualExtent);
|
||||||
editSession.addProcessor(NullProcessor.INSTANCE);
|
editSession.addProcessor(NullProcessor.INSTANCE);
|
||||||
@ -675,6 +690,8 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
editSession.flushQueue();
|
||||||
|
|
||||||
if (visualExtent != null) {
|
if (visualExtent != null) {
|
||||||
// clear old data
|
// clear old data
|
||||||
visualExtent.flush();
|
visualExtent.flush();
|
||||||
|
@ -457,6 +457,7 @@ public final class PlatformCommandManager {
|
|||||||
c -> {
|
c -> {
|
||||||
c.accept(BrushCommandsRegistration.builder(), new BrushCommands(worldEdit));
|
c.accept(BrushCommandsRegistration.builder(), new BrushCommands(worldEdit));
|
||||||
c.accept(ToolCommandsRegistration.builder(), new ToolCommands(worldEdit));
|
c.accept(ToolCommandsRegistration.builder(), new ToolCommands(worldEdit));
|
||||||
|
c.accept(ToolUtilCommandsRegistration.builder(), new ToolUtilCommands(worldEdit));
|
||||||
},
|
},
|
||||||
manager -> {
|
manager -> {
|
||||||
PaintBrushCommands.register(commandManagerService, manager, registration);
|
PaintBrushCommands.register(commandManagerService, manager, registration);
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren