Dieser Commit ist enthalten in:
MattBDev 2020-06-11 18:34:24 -04:00
Ursprung 1eacb91267
Commit 8105088d60
11 geänderte Dateien mit 33 neuen und 158 gelöschten Zeilen

Datei anzeigen

@ -151,10 +151,6 @@ public abstract class QueueHandler implements Trimable, Runnable {
return forkJoinPoolPrimary.submit(call);
}
public <T> Future<T> sync(Runnable run, T value) {
return sync(run, value, syncTasks);
}
public <T> Future<T> sync(Runnable run) {
return sync(run, syncTasks);
}

Datei anzeigen

@ -2,9 +2,9 @@ package com.boydti.fawe.object;
public final class IntTriple {
public int x;
public int y;
public int z;
private final int x;
private final int y;
private final int z;
public IntTriple(int x, int y, int z) {
this.x = x;

Datei anzeigen

@ -1,8 +0,0 @@
package com.boydti.fawe.object;
import java.util.function.Supplier;
public interface Lazy<T> extends Supplier<T> {
Supplier<T> init();
public default T get() { return init().get(); }
}

Datei anzeigen

@ -1,33 +0,0 @@
package com.boydti.fawe.object;
import java.util.function.BiConsumer;
public abstract class RunnableVal2<T, U> implements Runnable, BiConsumer<T, U> {
public T value1;
public U value2;
public RunnableVal2() {
}
public RunnableVal2(T value1, U value2) {
this.value1 = value1;
this.value2 = value2;
}
@Override
public void run() {
run(this.value1, this.value2);
}
public abstract void run(T value1, U value2);
public RunnableVal2<T, U> runAndGet(T value1, U value2) {
run(value1, value2);
return this;
}
@Override
public void accept(T t, U u) {
run(t, u);
}
}

Datei anzeigen

@ -93,7 +93,7 @@ public class CPUOptimizedClipboard extends LinearClipboard {
}
for (Map.Entry<IntTriple, CompoundTag> entry : nbtMapLoc.entrySet()) {
IntTriple key = entry.getKey();
setTile(getIndex(key.x, key.y, key.z), entry.getValue());
setTile(getIndex(key.getX(), key.getY(), key.getZ()), entry.getValue());
}
nbtMapLoc.clear();
}

Datei anzeigen

@ -324,7 +324,7 @@ public class DiskOptimizedClipboard extends LinearClipboard implements Closeable
nbt = null;
for (Map.Entry<IntTriple, CompoundTag> entry : nbtMap.entrySet()) {
IntTriple key = entry.getKey();
int index = getIndex(key.x, key.y, key.z);
int index = getIndex(key.getX(), key.getY(), key.getZ());
if (index == i) {
nbt = entry.getValue();
break;

Datei anzeigen

@ -200,7 +200,7 @@ public class MemoryOptimizedClipboard extends LinearClipboard {
nbt = null;
for (Map.Entry<IntTriple, CompoundTag> entry : nbtMap.entrySet()) {
IntTriple trio = entry.getKey();
int index = getIndex(trio.x, trio.y, trio.z);
int index = getIndex(trio.getX(), trio.getY(), trio.getZ());
if (index == i) {
nbt = entry.getValue();
break;

Datei anzeigen

@ -99,8 +99,8 @@ public abstract class DFSVisitor implements Operation {
// mutable2.mutY(from.getY() + direction.y);
// mutable2.mutZ(from.getZ() + direction.z);
BlockVector3 bv2 = BlockVector3
.at(from.getX() + direction.x, from.getY() + direction.y,
from.getZ() + direction.z);
.at(from.getX() + direction.getX(), from.getY() + direction.getY(),
from.getZ() + direction.getZ());
if (isVisitable(bv, bv2)) {
Node adjacent = new Node(bv2.getBlockX(), bv2.getBlockY(), bv2.getBlockZ());
if (!adjacent.equals(current.from)) {

Datei anzeigen

@ -5,29 +5,17 @@ import com.boydti.fawe.FaweCache;
import com.boydti.fawe.beta.IBatchProcessor;
import com.boydti.fawe.beta.IQueueChunk;
import com.boydti.fawe.beta.IQueueExtent;
import com.boydti.fawe.beta.implementation.lighting.NMSRelighter;
import com.boydti.fawe.beta.implementation.lighting.NullRelighter;
import com.boydti.fawe.beta.implementation.lighting.Relighter;
import com.boydti.fawe.beta.implementation.processors.LimitProcessor;
import com.boydti.fawe.beta.implementation.queue.ParallelQueueExtent;
import com.boydti.fawe.config.Settings;
import com.boydti.fawe.logging.rollback.RollbackOptimizedHistory;
import com.boydti.fawe.object.FaweLimit;
import com.boydti.fawe.object.HistoryExtent;
import com.boydti.fawe.object.NullChangeSet;
import com.boydti.fawe.object.RegionWrapper;
import com.boydti.fawe.object.RelightMode;
import com.boydti.fawe.object.*;
import com.boydti.fawe.object.brush.visualization.VirtualWorld;
import com.boydti.fawe.object.changeset.AbstractChangeSet;
import com.boydti.fawe.object.changeset.BlockBagChangeSet;
import com.boydti.fawe.object.changeset.DiskStorageHistory;
import com.boydti.fawe.object.changeset.MemoryOptimizedHistory;
import com.boydti.fawe.object.extent.FaweRegionExtent;
import com.boydti.fawe.object.extent.MultiRegionExtent;
import com.boydti.fawe.object.extent.NullExtent;
import com.boydti.fawe.object.extent.SingleRegionExtent;
import com.boydti.fawe.object.extent.SlowExtent;
import com.boydti.fawe.object.extent.StripNBTExtent;
import com.boydti.fawe.object.extent.*;
import com.boydti.fawe.wrappers.WorldWrapper;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.WorldEdit;

Datei anzeigen

@ -1,92 +1,51 @@
package com.boydti.fawe.util;
import static java.lang.System.arraycopy;
import static org.slf4j.LoggerFactory.getLogger;
import com.boydti.fawe.Fawe;
import com.sk89q.worldedit.util.formatting.text.Component;
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import com.boydti.fawe.config.Settings;
import com.boydti.fawe.object.FaweInputStream;
import com.boydti.fawe.object.FaweOutputStream;
import com.boydti.fawe.object.RegionWrapper;
import com.boydti.fawe.object.RunnableVal;
import com.boydti.fawe.object.RunnableVal2;
import com.boydti.fawe.object.changeset.FaweStreamChangeSet;
import com.boydti.fawe.object.io.AbstractDelegateOutputStream;
import com.github.luben.zstd.ZstdInputStream;
import com.github.luben.zstd.ZstdOutputStream;
import com.sk89q.jnbt.CompoundTag;
import com.sk89q.jnbt.DoubleTag;
import com.sk89q.jnbt.IntTag;
import com.sk89q.jnbt.ListTag;
import com.sk89q.jnbt.StringTag;
import com.sk89q.jnbt.Tag;
import com.sk89q.jnbt.*;
import com.sk89q.worldedit.entity.Entity;
import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormat;
import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormats;
import com.sk89q.worldedit.history.changeset.ChangeSet;
import com.sk89q.worldedit.util.Location;
import java.awt.Graphics2D;
import com.sk89q.worldedit.util.formatting.text.Component;
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import it.unimi.dsi.fastutil.io.FastBufferedInputStream;
import net.jpountz.lz4.*;
import org.jetbrains.annotations.NotNull;
import javax.annotation.Nullable;
import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.BufferedOutputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.io.*;
import java.lang.reflect.Array;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URISyntaxException;
import java.net.URL;
import java.net.URLConnection;
import java.net.*;
import java.nio.channels.Channels;
import java.nio.channels.FileChannel;
import java.nio.channels.ReadableByteChannel;
import java.nio.charset.StandardCharsets;
import java.nio.file.FileVisitResult;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.SimpleFileVisitor;
import java.nio.file.StandardCopyOption;
import java.nio.file.*;
import java.nio.file.attribute.BasicFileAttributes;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.Scanner;
import java.util.UUID;
import java.util.*;
import java.util.concurrent.ForkJoinPool;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicLong;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
import java.util.regex.Pattern;
import java.util.zip.DataFormatException;
import java.util.zip.Deflater;
import java.util.zip.GZIPInputStream;
import java.util.zip.Inflater;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
import javax.annotation.Nullable;
import javax.imageio.ImageIO;
import java.util.zip.*;
import it.unimi.dsi.fastutil.io.FastBufferedInputStream;
import net.jpountz.lz4.LZ4BlockInputStream;
import net.jpountz.lz4.LZ4BlockOutputStream;
import net.jpountz.lz4.LZ4Compressor;
import net.jpountz.lz4.LZ4Factory;
import net.jpountz.lz4.LZ4FastDecompressor;
import net.jpountz.lz4.LZ4InputStream;
import net.jpountz.lz4.LZ4Utils;
import org.jetbrains.annotations.NotNull;
import static java.lang.System.arraycopy;
import static org.slf4j.LoggerFactory.getLogger;
public class MainUtil {
@ -112,22 +71,22 @@ public class MainUtil {
public static long getTotalSize(Path path) {
final AtomicLong size = new AtomicLong(0);
traverse(path, new RunnableVal2<Path, BasicFileAttributes>() {
traverse(path, new RunnableVal<BasicFileAttributes>() {
@Override
public void run(Path path, BasicFileAttributes attrs) {
public void run(BasicFileAttributes attrs) {
size.addAndGet(attrs.size());
}
});
return size.get();
}
public static void traverse(Path path, final BiConsumer<Path, BasicFileAttributes> onEach) {
public static void traverse(Path path, final Consumer<BasicFileAttributes> onEach) {
try {
Files.walkFileTree(path, new SimpleFileVisitor<Path>() {
@Override
public FileVisitResult
visitFile(Path file, BasicFileAttributes attrs) {
onEach.accept(file, attrs);
onEach.accept(attrs);
return FileVisitResult.CONTINUE;
}
@ -169,7 +128,7 @@ public class MainUtil {
return out.toString();
}
public static void forEachFile(Path path, final RunnableVal2<Path, BasicFileAttributes> onEach, Comparator<File> comparator) {
public static void forEachFile(Path path, final RunnableVal<BasicFileAttributes> onEach, Comparator<File> comparator) {
File dir = path.toFile();
if (!dir.exists()) return;
File[] files = path.toFile().listFiles();
@ -178,7 +137,7 @@ public class MainUtil {
Path filePath = file.toPath();
try {
BasicFileAttributes attr = Files.readAttributes(filePath, BasicFileAttributes.class);
onEach.run(file.toPath(), attr);
onEach.run(attr);
} catch (IOException e) {
e.printStackTrace();
}

Datei anzeigen

@ -1,27 +0,0 @@
package com.boydti.fawe.util;
import com.sk89q.worldedit.entity.Player;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.regions.Region;
import java.util.Iterator;
import java.util.concurrent.ConcurrentLinkedQueue;
public class RegionCacheUtil {
public RegionCacheUtil() {
}
public void cache(Region region) {
Iterator<BlockVector3> iter = region.iterator();
}
public void run() {
TaskManager.IMP.async(new Runnable() {
@Override
public void run() {
}
});
}
}