Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-11-20 01:40:06 +01:00
Cleaned up a lot of code and introduced Kotlin to the project
Dieser Commit ist enthalten in:
Ursprung
2fb1c3bdbc
Commit
2d5a8ce573
@ -2,6 +2,7 @@ import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
|||||||
import org.gradle.plugins.ide.idea.model.IdeaModel
|
import org.gradle.plugins.ide.idea.model.IdeaModel
|
||||||
import com.mendhak.gradlecrowdin.DownloadTranslationsTask
|
import com.mendhak.gradlecrowdin.DownloadTranslationsTask
|
||||||
import com.mendhak.gradlecrowdin.UploadSourceFileTask
|
import com.mendhak.gradlecrowdin.UploadSourceFileTask
|
||||||
|
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id("java-library")
|
id("java-library")
|
||||||
@ -9,10 +10,12 @@ plugins {
|
|||||||
id("net.ltgt.apt-idea")
|
id("net.ltgt.apt-idea")
|
||||||
id("antlr")
|
id("antlr")
|
||||||
id("com.mendhak.gradlecrowdin")
|
id("com.mendhak.gradlecrowdin")
|
||||||
|
kotlin("jvm") version "1.3.41"
|
||||||
}
|
}
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
maven { url = uri("http://ci.athion.net/job/PlotSquared-breaking/ws/mvn/") }
|
maven { url = uri("http://ci.athion.net/job/PlotSquared-breaking/ws/mvn/") }
|
||||||
|
mavenCentral()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -55,6 +58,7 @@ dependencies {
|
|||||||
"compile"("com.github.intellectualsites.plotsquared:PlotSquared-API:latest") {
|
"compile"("com.github.intellectualsites.plotsquared:PlotSquared-API:latest") {
|
||||||
isTransitive = false
|
isTransitive = false
|
||||||
}
|
}
|
||||||
|
implementation(kotlin("stdlib-jdk8"))
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.withType<JavaCompile>().configureEach {
|
tasks.withType<JavaCompile>().configureEach {
|
||||||
@ -132,3 +136,11 @@ if (project.hasProperty(crowdinApiKey)) {
|
|||||||
dependsOn("crowdinDownload")
|
dependsOn("crowdinDownload")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
val compileKotlin: KotlinCompile by tasks
|
||||||
|
compileKotlin.kotlinOptions {
|
||||||
|
jvmTarget = "1.8"
|
||||||
|
}
|
||||||
|
val compileTestKotlin: KotlinCompile by tasks
|
||||||
|
compileTestKotlin.kotlinOptions {
|
||||||
|
jvmTarget = "1.8"
|
||||||
|
}
|
||||||
|
@ -284,16 +284,6 @@ public class Fawe {
|
|||||||
|
|
||||||
public void setupConfigs() {
|
public void setupConfigs() {
|
||||||
MainUtil.copyFile(MainUtil.getJarFile(), "lang/strings.json", null);
|
MainUtil.copyFile(MainUtil.getJarFile(), "lang/strings.json", null);
|
||||||
// MainUtil.copyFile(MainUtil.getJarFile(), "de/message.yml", null);
|
|
||||||
// MainUtil.copyFile(MainUtil.getJarFile(), "ru/message.yml", null);
|
|
||||||
// MainUtil.copyFile(MainUtil.getJarFile(), "ru/commands.yml", null);
|
|
||||||
// MainUtil.copyFile(MainUtil.getJarFile(), "tr/message.yml", null);
|
|
||||||
// MainUtil.copyFile(MainUtil.getJarFile(), "es/message.yml", null);
|
|
||||||
// MainUtil.copyFile(MainUtil.getJarFile(), "es/commands.yml", null);
|
|
||||||
// MainUtil.copyFile(MainUtil.getJarFile(), "nl/message.yml", null);
|
|
||||||
// MainUtil.copyFile(MainUtil.getJarFile(), "fr/message.yml", null);
|
|
||||||
// MainUtil.copyFile(MainUtil.getJarFile(), "cn/message.yml", null);
|
|
||||||
// MainUtil.copyFile(MainUtil.getJarFile(), "it/message.yml", null);
|
|
||||||
// Setting up config.yml
|
// Setting up config.yml
|
||||||
File file = new File(this.IMP.getDirectory(), "config.yml");
|
File file = new File(this.IMP.getDirectory(), "config.yml");
|
||||||
Settings.IMP.PLATFORM = IMP.getPlatform().replace("\"", "");
|
Settings.IMP.PLATFORM = IMP.getPlatform().replace("\"", "");
|
||||||
@ -305,7 +295,7 @@ public class Fawe {
|
|||||||
br.close();
|
br.close();
|
||||||
this.version = FaweVersion.tryParse(versionString, commitString, dateString);
|
this.version = FaweVersion.tryParse(versionString, commitString, dateString);
|
||||||
Settings.IMP.DATE = new Date(100 + version.year, version.month, version.day).toGMTString();
|
Settings.IMP.DATE = new Date(100 + version.year, version.month, version.day).toGMTString();
|
||||||
Settings.IMP.BUILD = "https://ci.athion.net/job/FastAsyncWorldEdit-commanding-pipeline/" + version.build;
|
Settings.IMP.BUILD = "https://ci.athion.net/job/FastAsyncWorldEdit-1.15/" + version.build;
|
||||||
Settings.IMP.COMMIT = "https://github.com/IntellectualSites/FastAsyncWorldEdit-1.13/commit/" + Integer.toHexString(version.hash);
|
Settings.IMP.COMMIT = "https://github.com/IntellectualSites/FastAsyncWorldEdit-1.13/commit/" + Integer.toHexString(version.hash);
|
||||||
} catch (Throwable ignore) {}
|
} catch (Throwable ignore) {}
|
||||||
try {
|
try {
|
||||||
|
@ -4,6 +4,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.beta.Trimable;
|
import com.boydti.fawe.beta.Trimable;
|
||||||
|
import com.boydti.fawe.beta.implementation.queue.Pool;
|
||||||
|
import com.boydti.fawe.beta.implementation.queue.QueuePool;
|
||||||
import com.boydti.fawe.config.Settings;
|
import com.boydti.fawe.config.Settings;
|
||||||
import com.boydti.fawe.object.collection.BitArray4096;
|
import com.boydti.fawe.object.collection.BitArray4096;
|
||||||
import com.boydti.fawe.object.collection.CleanableThreadLocal;
|
import com.boydti.fawe.object.collection.CleanableThreadLocal;
|
||||||
@ -65,43 +67,8 @@ public enum FaweCache implements Trimable {
|
|||||||
|
|
||||||
public final char[] EMPTY_CHAR_4096 = new char[4096];
|
public final char[] EMPTY_CHAR_4096 = new char[4096];
|
||||||
|
|
||||||
private final IdentityHashMap<Class, CleanableThreadLocal> REGISTERED_SINGLETONS = new IdentityHashMap<>();
|
private final IdentityHashMap<Class<?>, CleanableThreadLocal> REGISTERED_SINGLETONS = new IdentityHashMap<>();
|
||||||
private final IdentityHashMap<Class, Pool> REGISTERED_POOLS = new IdentityHashMap<>();
|
private final IdentityHashMap<Class<?>, Pool> REGISTERED_POOLS = new IdentityHashMap<>();
|
||||||
|
|
||||||
public interface Pool<T> {
|
|
||||||
T poll();
|
|
||||||
default boolean offer(T recycle) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
default void clear() {}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class QueuePool<T> extends ConcurrentLinkedQueue<T> implements Pool<T> {
|
|
||||||
private final Supplier<T> supplier;
|
|
||||||
|
|
||||||
public QueuePool(Supplier<T> supplier) {
|
|
||||||
this.supplier = supplier;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean offer(T t) {
|
|
||||||
return super.offer(t);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public T poll() {
|
|
||||||
T result = super.poll();
|
|
||||||
if (result == null) {
|
|
||||||
return supplier.get();
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void clear() {
|
|
||||||
if (!isEmpty()) super.clear();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Palette buffers / cache
|
Palette buffers / cache
|
||||||
@ -125,11 +92,11 @@ public enum FaweCache implements Trimable {
|
|||||||
MUTABLE_VECTOR3.clean();
|
MUTABLE_VECTOR3.clean();
|
||||||
MUTABLE_BLOCKVECTOR3.clean();
|
MUTABLE_BLOCKVECTOR3.clean();
|
||||||
SECTION_BITS_TO_CHAR.clean();
|
SECTION_BITS_TO_CHAR.clean();
|
||||||
for (Map.Entry<Class, CleanableThreadLocal> entry : REGISTERED_SINGLETONS.entrySet()) {
|
for (Map.Entry<Class<?>, CleanableThreadLocal> entry : REGISTERED_SINGLETONS.entrySet()) {
|
||||||
entry.getValue().clean();
|
entry.getValue().clean();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (Map.Entry<Class, Pool> entry : REGISTERED_POOLS.entrySet()) {
|
for (Map.Entry<Class<?>, Pool> entry : REGISTERED_POOLS.entrySet()) {
|
||||||
Pool pool = entry.getValue();
|
Pool pool = entry.getValue();
|
||||||
pool.clear();
|
pool.clear();
|
||||||
}
|
}
|
||||||
@ -269,7 +236,7 @@ public enum FaweCache implements Trimable {
|
|||||||
/**
|
/**
|
||||||
* Holds data for a palette used in a chunk section
|
* Holds data for a palette used in a chunk section
|
||||||
*/
|
*/
|
||||||
public final class Palette {
|
public static final class Palette {
|
||||||
public int bitsPerEntry;
|
public int bitsPerEntry;
|
||||||
|
|
||||||
public int paletteToBlockLength;
|
public int paletteToBlockLength;
|
||||||
@ -493,7 +460,7 @@ public enum FaweCache implements Trimable {
|
|||||||
System.out.println("Invalid nbt: " + value);
|
System.out.println("Invalid nbt: " + value);
|
||||||
return null;
|
return null;
|
||||||
} else {
|
} else {
|
||||||
Class<? extends Object> clazz = value.getClass();
|
Class<?> clazz = value.getClass();
|
||||||
if (clazz.getName().startsWith("com.intellectualcrafters.jnbt")) {
|
if (clazz.getName().startsWith("com.intellectualcrafters.jnbt")) {
|
||||||
try {
|
try {
|
||||||
if (clazz.getName().equals("com.intellectualcrafters.jnbt.EndTag")) {
|
if (clazz.getName().equals("com.intellectualcrafters.jnbt.EndTag")) {
|
||||||
|
@ -10,6 +10,7 @@ import com.sk89q.worldedit.math.BlockVector3;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
public interface IBatchProcessor {
|
public interface IBatchProcessor {
|
||||||
/**
|
/**
|
||||||
@ -30,6 +31,7 @@ public interface IBatchProcessor {
|
|||||||
* @param child
|
* @param child
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@Nullable
|
||||||
Extent construct(Extent child);
|
Extent construct(Extent child);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -14,6 +14,7 @@ import com.sk89q.worldedit.world.registry.BlockRegistry;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import java.util.stream.IntStream;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shared interface for IGetBlocks and ISetBlocks
|
* Shared interface for IGetBlocks and ISetBlocks
|
||||||
@ -35,13 +36,8 @@ public interface IBlocks extends Trimable {
|
|||||||
BiomeType getBiomeType(int x, int y, int z);
|
BiomeType getBiomeType(int x, int y, int z);
|
||||||
|
|
||||||
default int getBitMask() {
|
default int getBitMask() {
|
||||||
int mask = 0;
|
return IntStream.range(0, FaweCache.IMP.CHUNK_LAYERS).filter(this::hasSection)
|
||||||
for (int layer = 0; layer < FaweCache.IMP.CHUNK_LAYERS; layer++) {
|
.map(layer -> (1 << layer)).sum();
|
||||||
if (hasSection(layer)) {
|
|
||||||
mask += (1 << layer);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return mask;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
IBlocks reset();
|
IBlocks reset();
|
||||||
|
@ -8,12 +8,14 @@ import com.sk89q.worldedit.world.block.BaseBlock;
|
|||||||
import com.sk89q.worldedit.world.block.BlockState;
|
import com.sk89q.worldedit.world.block.BlockState;
|
||||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
import org.jetbrains.annotations.Range;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a chunk in the queue {@link IQueueExtent} Used for getting and setting blocks / biomes
|
* Represents a chunk in the queue {@link IQueueExtent} Used for getting and setting blocks / biomes
|
||||||
* / entities
|
* / entities
|
||||||
*/
|
*/
|
||||||
public interface IChunk extends Trimable, IChunkGet, IChunkSet {
|
public interface IChunk extends Trimable, IChunkGet, IChunkSet {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize at the location
|
* Initialize at the location
|
||||||
* (allows for reuse)
|
* (allows for reuse)
|
||||||
@ -22,17 +24,20 @@ public interface IChunk extends Trimable, IChunkGet, IChunkSet {
|
|||||||
* @param x
|
* @param x
|
||||||
* @param z
|
* @param z
|
||||||
*/
|
*/
|
||||||
default void init(IQueueExtent extent, int x, int z) {}
|
default <V extends IChunk> void init(IQueueExtent<V> extent, int x, int z) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get chunkX
|
* Get chunkX
|
||||||
* @return
|
* @return the x coordinate of the chunk
|
||||||
*/
|
*/
|
||||||
|
@Range(from = 0, to = 15)
|
||||||
int getX();
|
int getX();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get chunkZ
|
* Get chunkZ
|
||||||
* @return
|
* @return the z coordinate of the chunk
|
||||||
*/
|
*/
|
||||||
|
@Range(from = 0, to = 15)
|
||||||
int getZ();
|
int getZ();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -78,7 +83,7 @@ public interface IChunk extends Trimable, IChunkGet, IChunkSet {
|
|||||||
boolean setTile(int x, int y, int z, CompoundTag tag);
|
boolean setTile(int x, int y, int z, CompoundTag tag);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
boolean setBlock(int x, int y, int z, BlockStateHolder block);
|
<T extends BlockStateHolder<T>> boolean setBlock(int x, int y, int z, T block);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
BiomeType getBiomeType(int x, int y, int z);
|
BiomeType getBiomeType(int x, int y, int z);
|
||||||
|
@ -21,7 +21,7 @@ public interface IChunkSet extends IBlocks, OutputExtent {
|
|||||||
boolean setBiome(int x, int y, int z, BiomeType biome);
|
boolean setBiome(int x, int y, int z, BiomeType biome);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
boolean setBlock(int x, int y, int z, BlockStateHolder holder);
|
<T extends BlockStateHolder<T>> boolean setBlock(int x, int y, int z, T holder);
|
||||||
|
|
||||||
void setBlocks(int layer, char[] data);
|
void setBlocks(int layer, char[] data);
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ public interface IDelegateChunk<U extends IQueueChunk> extends IQueueChunk {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
default boolean setBlock(int x, int y, int z, BlockStateHolder holder) {
|
default <T extends BlockStateHolder<T>> boolean setBlock(int x, int y, int z, T holder) {
|
||||||
return getParent().setBlock(x, y, z, holder);
|
return getParent().setBlock(x, y, z, holder);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -85,7 +85,7 @@ public interface IDelegateChunk<U extends IQueueChunk> extends IQueueChunk {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
default void init(IQueueExtent extent, int chunkX, int chunkZ) {
|
default <E extends IChunk> void init(IQueueExtent<E> extent, int chunkX, int chunkZ) {
|
||||||
getParent().init(extent, chunkX, chunkZ);
|
getParent().init(extent, chunkX, chunkZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ public interface IDelegateFilter extends Filter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
default IChunk applyChunk(IChunk chunk, @Nullable Region region) {
|
default <V extends IChunk> V applyChunk(V chunk, @Nullable Region region) {
|
||||||
return getParent().applyChunk(chunk, region);
|
return getParent().applyChunk(chunk, region);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,7 +80,7 @@ public interface IDelegateQueueExtent<T extends IQueueChunk> extends IQueueExten
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
default boolean setBlock(int x, int y, int z, BlockStateHolder state) {
|
default <B extends BlockStateHolder<B>> boolean setBlock(int x, int y, int z, B state) {
|
||||||
return getParent().setBlock(x, y, z, state);
|
return getParent().setBlock(x, y, z, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -171,7 +171,6 @@ public interface IDelegateQueueExtent<T extends IQueueChunk> extends IQueueExten
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Nullable
|
|
||||||
default void removeEntity(int x, int y, int z, UUID uuid) {
|
default void removeEntity(int x, int y, int z, UUID uuid) {
|
||||||
getParent().removeEntity(x, y, z, uuid);
|
getParent().removeEntity(x, y, z, uuid);
|
||||||
}
|
}
|
||||||
@ -359,7 +358,7 @@ public interface IDelegateQueueExtent<T extends IQueueChunk> extends IQueueExten
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Deprecated
|
@Deprecated
|
||||||
default <T extends BlockStateHolder<T>> boolean setBlock(BlockVector3 position, T block) throws WorldEditException {
|
default <B extends BlockStateHolder<B>> boolean setBlock(BlockVector3 position, B block) throws WorldEditException {
|
||||||
return getParent().setBlock(position, block);
|
return getParent().setBlock(position, block);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,6 +36,5 @@ public interface IQueueChunk<T extends Future<T>> extends IChunk, Callable<T> {
|
|||||||
while (future != null) {
|
while (future != null) {
|
||||||
future = future.get();
|
future = future.get();
|
||||||
}
|
}
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@ public interface IChunkExtent<T extends IChunk> extends Extent {
|
|||||||
T getOrCreateChunk(int chunkX, int chunkZ);
|
T getOrCreateChunk(int chunkX, int chunkZ);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
default boolean setBlock(int x, int y, int z, BlockStateHolder state) {
|
default <B extends BlockStateHolder<B>> boolean setBlock(int x, int y, int z, B state) {
|
||||||
final IChunk chunk = getOrCreateChunk(x >> 4, z >> 4);
|
final IChunk chunk = getOrCreateChunk(x >> 4, z >> 4);
|
||||||
return chunk.setBlock(x & 15, y, z & 15, state);
|
return chunk.setBlock(x & 15, y, z & 15, state);
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,7 @@ public class BitSetBlocks implements IChunkSet {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean setBlock(int x, int y, int z, BlockStateHolder holder) {
|
public <T extends BlockStateHolder<T>> boolean setBlock(int x, int y, int z, T holder) {
|
||||||
row.set(null, x, y, z);
|
row.set(null, x, y, z);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -109,6 +109,7 @@ public abstract class CharBlocks implements IBlocks {
|
|||||||
try {
|
try {
|
||||||
set(layer, index, value);
|
set(layer, index, value);
|
||||||
} catch (ArrayIndexOutOfBoundsException exception) {
|
} catch (ArrayIndexOutOfBoundsException exception) {
|
||||||
|
assert Fawe.imp() != null;
|
||||||
Fawe.imp().debug("Tried Setting Block at x:" + x + ", y:" + y + " , z:" + z);
|
Fawe.imp().debug("Tried Setting Block at x:" + x + ", y:" + y + " , z:" + z);
|
||||||
Fawe.imp().debug("Layer variable was = " + layer);
|
Fawe.imp().debug("Layer variable was = " + layer);
|
||||||
exception.printStackTrace();
|
exception.printStackTrace();
|
||||||
|
@ -16,11 +16,6 @@ public abstract class CharGetBlocks extends CharBlocks implements IChunkGet {
|
|||||||
return state.toBaseBlock(this, x, y, z);
|
return state.toBaseBlock(this, x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public BlockState getBlock(int x, int y, int z) {
|
|
||||||
return BlockTypesCache.states[get(x, y, z)];
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean trim(boolean aggressive) {
|
public boolean trim(boolean aggressive) {
|
||||||
for (int i = 0; i < 16; i++) {
|
for (int i = 0; i < 16; i++) {
|
||||||
|
@ -2,6 +2,7 @@ package com.boydti.fawe.beta.implementation.blocks;
|
|||||||
|
|
||||||
import com.boydti.fawe.FaweCache;
|
import com.boydti.fawe.FaweCache;
|
||||||
import com.boydti.fawe.beta.IChunkSet;
|
import com.boydti.fawe.beta.IChunkSet;
|
||||||
|
import com.boydti.fawe.beta.implementation.queue.Pool;
|
||||||
import com.boydti.fawe.config.Settings;
|
import com.boydti.fawe.config.Settings;
|
||||||
import com.boydti.fawe.object.collection.BlockVector3ChunkMap;
|
import com.boydti.fawe.object.collection.BlockVector3ChunkMap;
|
||||||
import com.boydti.fawe.util.MathMan;
|
import com.boydti.fawe.util.MathMan;
|
||||||
@ -20,9 +21,10 @@ import java.util.HashSet;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import java.util.stream.IntStream;
|
||||||
|
|
||||||
public class CharSetBlocks extends CharBlocks implements IChunkSet {
|
public class CharSetBlocks extends CharBlocks implements IChunkSet {
|
||||||
private static FaweCache.Pool<CharSetBlocks> POOL = FaweCache.IMP.registerPool(CharSetBlocks.class, CharSetBlocks::new, Settings.IMP.QUEUE.POOL);
|
private static Pool<CharSetBlocks> POOL = FaweCache.IMP.registerPool(CharSetBlocks.class, CharSetBlocks::new, Settings.IMP.QUEUE.POOL);
|
||||||
public static CharSetBlocks newInstance() {
|
public static CharSetBlocks newInstance() {
|
||||||
return POOL.poll();
|
return POOL.poll();
|
||||||
}
|
}
|
||||||
@ -80,12 +82,7 @@ public class CharSetBlocks extends CharBlocks implements IChunkSet {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockState getBlock(int x, int y, int z) {
|
public <T extends BlockStateHolder<T>> boolean setBlock(int x, int y, int z, T holder) {
|
||||||
return BlockTypesCache.states[get(x, y, z)];
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean setBlock(int x, int y, int z, BlockStateHolder holder) {
|
|
||||||
set(x, y, z, holder.getOrdinalChar());
|
set(x, y, z, holder.getOrdinalChar());
|
||||||
holder.applyTileEntity(this, x, y, z);
|
holder.applyTileEntity(this, x, y, z);
|
||||||
return true;
|
return true;
|
||||||
@ -138,12 +135,7 @@ public class CharSetBlocks extends CharBlocks implements IChunkSet {
|
|||||||
if (biomes != null) {
|
if (biomes != null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
for (int i = 0; i < 16; i++) {
|
return IntStream.range(0, 16).noneMatch(this::hasSection);
|
||||||
if (hasSection(i)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -24,7 +24,7 @@ public interface DelegateChunkSet extends IChunkSet {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
default boolean setBlock(int x, int y, int z, BlockStateHolder holder) {
|
default <T extends BlockStateHolder<T>> boolean setBlock(int x, int y, int z, T holder) {
|
||||||
return getParent().setBlock(x, y, z, holder);
|
return getParent().setBlock(x, y, z, holder);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,83 +0,0 @@
|
|||||||
package com.boydti.fawe.beta.implementation.blocks;
|
|
||||||
|
|
||||||
import com.boydti.fawe.FaweCache;
|
|
||||||
import com.boydti.fawe.beta.IBlocks;
|
|
||||||
import com.boydti.fawe.beta.IChunkGet;
|
|
||||||
import com.boydti.fawe.beta.IChunkSet;
|
|
||||||
import com.sk89q.jnbt.CompoundTag;
|
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
|
||||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
|
||||||
import com.sk89q.worldedit.world.biome.BiomeTypes;
|
|
||||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
|
||||||
import com.sk89q.worldedit.world.block.BlockState;
|
|
||||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
|
||||||
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.UUID;
|
|
||||||
import java.util.concurrent.Future;
|
|
||||||
|
|
||||||
public enum NullChunkGet implements IChunkGet {
|
|
||||||
INSTANCE
|
|
||||||
;
|
|
||||||
@Override
|
|
||||||
public BaseBlock getFullBlock(int x, int y, int z) {
|
|
||||||
return BlockTypes.AIR.getDefaultState().toBaseBlock();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public BiomeType getBiomeType(int x, int y, int z) {
|
|
||||||
return BiomeTypes.FOREST;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public BlockState getBlock(int x, int y, int z) {
|
|
||||||
return BlockTypes.AIR.getDefaultState();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Map<BlockVector3, CompoundTag> getTiles() {
|
|
||||||
return Collections.emptyMap();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public CompoundTag getTile(int x, int y, int z) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Set<CompoundTag> getEntities() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public CompoundTag getEntity(UUID uuid) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean trim(boolean aggressive) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public <T extends Future<T>> T call(IChunkSet set, Runnable finalize) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public char[] load(int layer) {
|
|
||||||
return FaweCache.IMP.EMPTY_CHAR_4096;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean hasSection(int layer) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IBlocks reset() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
@ -0,0 +1,68 @@
|
|||||||
|
package com.boydti.fawe.beta.implementation.blocks
|
||||||
|
|
||||||
|
import com.boydti.fawe.FaweCache
|
||||||
|
import com.boydti.fawe.beta.IBlocks
|
||||||
|
import com.boydti.fawe.beta.IChunkGet
|
||||||
|
import com.boydti.fawe.beta.IChunkSet
|
||||||
|
import com.sk89q.jnbt.CompoundTag
|
||||||
|
import com.sk89q.worldedit.math.BlockVector3
|
||||||
|
import com.sk89q.worldedit.world.biome.BiomeType
|
||||||
|
import com.sk89q.worldedit.world.biome.BiomeTypes
|
||||||
|
import com.sk89q.worldedit.world.block.BaseBlock
|
||||||
|
import com.sk89q.worldedit.world.block.BlockState
|
||||||
|
import com.sk89q.worldedit.world.block.BlockTypes
|
||||||
|
|
||||||
|
import java.util.Collections
|
||||||
|
import java.util.UUID
|
||||||
|
import java.util.concurrent.Future
|
||||||
|
|
||||||
|
object NullChunkGet : IChunkGet {
|
||||||
|
|
||||||
|
override fun getFullBlock(x: Int, y: Int, z: Int): BaseBlock {
|
||||||
|
return BlockTypes.AIR!!.defaultState.toBaseBlock()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getBiomeType(x: Int, y: Int, z: Int): BiomeType? {
|
||||||
|
return BiomeTypes.FOREST
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getBlock(x: Int, y: Int, z: Int): BlockState {
|
||||||
|
return BlockTypes.AIR!!.defaultState
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getTiles(): Map<BlockVector3, CompoundTag> {
|
||||||
|
return emptyMap()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getTile(x: Int, y: Int, z: Int): CompoundTag? {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getEntities(): Set<CompoundTag>? {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getEntity(uuid: UUID): CompoundTag? {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun trim(aggressive: Boolean): Boolean {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun <T : Future<T>> call(set: IChunkSet, finalize: Runnable): T? {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun load(layer: Int): CharArray {
|
||||||
|
return FaweCache.IMP.EMPTY_CHAR_4096
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun hasSection(layer: Int): Boolean {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun reset(): IBlocks? {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
}
|
@ -45,11 +45,10 @@ public class ChunkCache<T extends Trimable> implements IChunkCache<T> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public synchronized boolean trim(boolean aggressive) {
|
public synchronized boolean trim(boolean aggressive) {
|
||||||
if (getCache.size() == 0) {
|
if (getCache.isEmpty()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
boolean result = true;
|
boolean result = true;
|
||||||
if (!getCache.isEmpty()) {
|
|
||||||
final ObjectIterator<Long2ObjectMap.Entry<WeakReference<T>>> iter = getCache
|
final ObjectIterator<Long2ObjectMap.Entry<WeakReference<T>>> iter = getCache
|
||||||
.long2ObjectEntrySet().fastIterator();
|
.long2ObjectEntrySet().fastIterator();
|
||||||
while (iter.hasNext()) {
|
while (iter.hasNext()) {
|
||||||
@ -68,7 +67,6 @@ public class ChunkCache<T extends Trimable> implements IChunkCache<T> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@ import com.sk89q.worldedit.IncompleteRegionException;
|
|||||||
import com.sk89q.worldedit.LocalSession;
|
import com.sk89q.worldedit.LocalSession;
|
||||||
import com.sk89q.worldedit.WorldEdit;
|
import com.sk89q.worldedit.WorldEdit;
|
||||||
import com.sk89q.worldedit.entity.Player;
|
import com.sk89q.worldedit.entity.Player;
|
||||||
|
import com.sk89q.worldedit.extension.platform.Actor;
|
||||||
import com.sk89q.worldedit.math.BlockVector2;
|
import com.sk89q.worldedit.math.BlockVector2;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||||
@ -33,7 +34,7 @@ public class AsyncPreloader implements Preloader, Runnable {
|
|||||||
cancelAndGet(player);
|
cancelAndGet(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
private MutablePair<World, Set<BlockVector2>> cancelAndGet(Player player) {
|
private MutablePair<World, Set<BlockVector2>> cancelAndGet(Actor player) {
|
||||||
MutablePair<World, Set<BlockVector2>> existing = update.get(player.getUniqueId());
|
MutablePair<World, Set<BlockVector2>> existing = update.get(player.getUniqueId());
|
||||||
if (existing != null) {
|
if (existing != null) {
|
||||||
existing.setValue(null);
|
existing.setValue(null);
|
||||||
@ -100,7 +101,6 @@ public class AsyncPreloader implements Preloader, Runnable {
|
|||||||
}
|
}
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,6 +8,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.queue.Pool;
|
||||||
import com.boydti.fawe.config.Settings;
|
import com.boydti.fawe.config.Settings;
|
||||||
import com.sk89q.jnbt.CompoundTag;
|
import com.sk89q.jnbt.CompoundTag;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
@ -26,9 +27,9 @@ import javax.annotation.Nullable;
|
|||||||
/**
|
/**
|
||||||
* An abstract {@link IChunk} class that implements basic get/set blocks
|
* An abstract {@link IChunk} class that implements basic get/set blocks
|
||||||
*/
|
*/
|
||||||
public class ChunkHolder<T extends Future<T>> implements IQueueChunk {
|
public class ChunkHolder<T extends Future<T>> implements IQueueChunk<T> {
|
||||||
|
|
||||||
private static FaweCache.Pool<ChunkHolder> POOL = FaweCache.IMP.registerPool(ChunkHolder.class, ChunkHolder::new, Settings.IMP.QUEUE.POOL);
|
private static Pool<ChunkHolder> POOL = FaweCache.IMP.registerPool(ChunkHolder.class, ChunkHolder::new, Settings.IMP.QUEUE.POOL);
|
||||||
|
|
||||||
public static ChunkHolder newInstance() {
|
public static ChunkHolder newInstance() {
|
||||||
return POOL.poll();
|
return POOL.poll();
|
||||||
@ -121,8 +122,8 @@ public class ChunkHolder<T extends Future<T>> implements IQueueChunk {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean setBlock(ChunkHolder chunk, int x, int y, int z,
|
public <B extends BlockStateHolder<B>> boolean setBlock(ChunkHolder chunk, int x, int y, int z,
|
||||||
BlockStateHolder block) {
|
B block) {
|
||||||
return chunk.chunkSet.setBlock(x, y, z, block);
|
return chunk.chunkSet.setBlock(x, y, z, block);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -164,8 +165,8 @@ public class ChunkHolder<T extends Future<T>> implements IQueueChunk {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean setBlock(ChunkHolder chunk, int x, int y, int z,
|
public <T extends BlockStateHolder<T>> boolean setBlock(ChunkHolder chunk, int x, int y, int z,
|
||||||
BlockStateHolder block) {
|
T block) {
|
||||||
chunk.getOrCreateSet();
|
chunk.getOrCreateSet();
|
||||||
chunk.delegate = BOTH;
|
chunk.delegate = BOTH;
|
||||||
return chunk.setBlock(x, y, z, block);
|
return chunk.setBlock(x, y, z, block);
|
||||||
@ -207,7 +208,7 @@ public class ChunkHolder<T extends Future<T>> implements IQueueChunk {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean setBlock(ChunkHolder chunk, int x, int y, int z, BlockStateHolder block) {
|
public <T extends BlockStateHolder<T>> boolean setBlock(ChunkHolder chunk, int x, int y, int z, T block) {
|
||||||
return chunk.chunkSet.setBlock(x, y, z, block);
|
return chunk.chunkSet.setBlock(x, y, z, block);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -256,7 +257,7 @@ public class ChunkHolder<T extends Future<T>> implements IQueueChunk {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean setBlock(ChunkHolder chunk, int x, int y, int z, BlockStateHolder block) {
|
public <T extends BlockStateHolder<T>> boolean setBlock(ChunkHolder chunk, int x, int y, int z, T block) {
|
||||||
chunk.getOrCreateSet();
|
chunk.getOrCreateSet();
|
||||||
chunk.delegate = SET;
|
chunk.delegate = SET;
|
||||||
return chunk.setBlock(x, y, z, block);
|
return chunk.setBlock(x, y, z, block);
|
||||||
@ -388,7 +389,7 @@ public class ChunkHolder<T extends Future<T>> implements IQueueChunk {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(IQueueExtent extent, int chunkX, int chunkZ) {
|
public <V extends IChunk> void init(IQueueExtent<V> extent, int chunkX, int chunkZ) {
|
||||||
this.extent = extent;
|
this.extent = extent;
|
||||||
this.chunkX = chunkX;
|
this.chunkX = chunkX;
|
||||||
this.chunkZ = chunkZ;
|
this.chunkZ = chunkZ;
|
||||||
@ -445,7 +446,7 @@ public class ChunkHolder<T extends Future<T>> implements IQueueChunk {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean setBlock(int x, int y, int z, BlockStateHolder block) {
|
public <B extends BlockStateHolder<B>> boolean setBlock(int x, int y, int z, B block) {
|
||||||
return delegate.setBlock(this, x, y, z, block);
|
return delegate.setBlock(this, x, y, z, block);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -465,12 +466,12 @@ public class ChunkHolder<T extends Future<T>> implements IQueueChunk {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public interface IBlockDelegate {
|
public interface IBlockDelegate {
|
||||||
IChunkGet get(ChunkHolder chunk);
|
<C extends Future<C>> IChunkGet get(ChunkHolder<C> chunk);
|
||||||
IChunkSet set(ChunkHolder chunk);
|
IChunkSet set(ChunkHolder chunk);
|
||||||
|
|
||||||
boolean setBiome(ChunkHolder chunk, int x, int y, int z, BiomeType biome);
|
boolean setBiome(ChunkHolder chunk, int x, int y, int z, BiomeType biome);
|
||||||
|
|
||||||
boolean setBlock(ChunkHolder chunk, int x, int y, int z, BlockStateHolder holder);
|
<T extends BlockStateHolder<T>> boolean setBlock(ChunkHolder chunk, int x, int y, int z, T holder);
|
||||||
|
|
||||||
BiomeType getBiome(ChunkHolder chunk, int x, int y, int z);
|
BiomeType getBiome(ChunkHolder chunk, int x, int y, int z);
|
||||||
|
|
||||||
|
@ -7,11 +7,11 @@ import com.boydti.fawe.beta.IQueueExtent;
|
|||||||
* Used by {@link ReferenceChunk} to allow the chunk to be garbage collected. - When the object is
|
* Used by {@link ReferenceChunk} to allow the chunk to be garbage collected. - When the object is
|
||||||
* finalized, add it to the queue
|
* finalized, add it to the queue
|
||||||
*/
|
*/
|
||||||
public class FinalizedChunk extends DelegateChunk {
|
public class FinalizedChunk<T extends IQueueChunk> extends DelegateChunk<T> {
|
||||||
|
|
||||||
private final IQueueExtent queueExtent;
|
private final IQueueExtent queueExtent;
|
||||||
|
|
||||||
public FinalizedChunk(IQueueChunk parent, IQueueExtent queueExtent) {
|
public FinalizedChunk(T parent, IQueueExtent queueExtent) {
|
||||||
super(parent);
|
super(parent);
|
||||||
this.queueExtent = queueExtent;
|
this.queueExtent = queueExtent;
|
||||||
}
|
}
|
||||||
|
@ -83,7 +83,7 @@ public enum NullChunk implements IQueueChunk {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean setBlock(int x, int y, int z, BlockStateHolder block) {
|
public <B extends BlockStateHolder<B>> boolean setBlock(int x, int y, int z, B block) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -575,7 +575,6 @@ public class DelegateFilterBlock extends FilterBlock {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Nullable
|
|
||||||
public void removeEntity(int x, int y, int z, UUID uuid) {
|
public void removeEntity(int x, int y, int z, UUID uuid) {
|
||||||
parent.removeEntity(x, y, z, uuid);
|
parent.removeEntity(x, y, z, uuid);
|
||||||
}
|
}
|
||||||
|
@ -1,26 +0,0 @@
|
|||||||
package com.boydti.fawe.beta.implementation.processors;
|
|
||||||
|
|
||||||
import com.boydti.fawe.beta.IBatchProcessor;
|
|
||||||
import com.boydti.fawe.beta.IChunk;
|
|
||||||
import com.boydti.fawe.beta.IChunkGet;
|
|
||||||
import com.boydti.fawe.beta.IChunkSet;
|
|
||||||
import com.sk89q.worldedit.extent.Extent;
|
|
||||||
|
|
||||||
public enum EmptyBatchProcessor implements IBatchProcessor {
|
|
||||||
INSTANCE
|
|
||||||
;
|
|
||||||
@Override
|
|
||||||
public IChunkSet processSet(IChunk chunk, IChunkGet get, IChunkSet set) {
|
|
||||||
return set;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Extent construct(Extent child) {
|
|
||||||
return child;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IBatchProcessor join(IBatchProcessor other) {
|
|
||||||
return other;
|
|
||||||
}
|
|
||||||
}
|
|
@ -0,0 +1,22 @@
|
|||||||
|
package com.boydti.fawe.beta.implementation.processors
|
||||||
|
|
||||||
|
import com.boydti.fawe.beta.IBatchProcessor
|
||||||
|
import com.boydti.fawe.beta.IChunk
|
||||||
|
import com.boydti.fawe.beta.IChunkGet
|
||||||
|
import com.boydti.fawe.beta.IChunkSet
|
||||||
|
import com.sk89q.worldedit.extent.Extent
|
||||||
|
|
||||||
|
object EmptyBatchProcessor : IBatchProcessor {
|
||||||
|
|
||||||
|
override fun construct(child: Extent?): Extent {
|
||||||
|
return child!!
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun processSet(chunk: IChunk?, get: IChunkGet?, set: IChunkSet?): IChunkSet {
|
||||||
|
return set!!
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun join(other: IBatchProcessor?): IBatchProcessor {
|
||||||
|
return other!!
|
||||||
|
}
|
||||||
|
}
|
@ -92,7 +92,6 @@ public class LimitExtent extends PassthroughExtent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Nullable
|
|
||||||
public void removeEntity(int x, int y, int z, UUID uuid) {
|
public void removeEntity(int x, int y, int z, UUID uuid) {
|
||||||
limit.THROW_MAX_CHANGES();
|
limit.THROW_MAX_CHANGES();
|
||||||
limit.THROW_MAX_ENTITIES();
|
limit.THROW_MAX_ENTITIES();
|
||||||
|
@ -1,21 +0,0 @@
|
|||||||
package com.boydti.fawe.beta.implementation.processors;
|
|
||||||
|
|
||||||
import com.boydti.fawe.beta.IBatchProcessor;
|
|
||||||
import com.boydti.fawe.beta.IChunk;
|
|
||||||
import com.boydti.fawe.beta.IChunkGet;
|
|
||||||
import com.boydti.fawe.beta.IChunkSet;
|
|
||||||
import com.sk89q.worldedit.extent.Extent;
|
|
||||||
import com.sk89q.worldedit.extent.NullExtent;
|
|
||||||
|
|
||||||
public enum NullProcessor implements IBatchProcessor {
|
|
||||||
INSTANCE;
|
|
||||||
@Override
|
|
||||||
public IChunkSet processSet(IChunk chunk, IChunkGet get, IChunkSet set) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Extent construct(Extent child) {
|
|
||||||
return new NullExtent();
|
|
||||||
}
|
|
||||||
}
|
|
@ -0,0 +1,19 @@
|
|||||||
|
package com.boydti.fawe.beta.implementation.processors
|
||||||
|
|
||||||
|
import com.boydti.fawe.beta.IBatchProcessor
|
||||||
|
import com.boydti.fawe.beta.IChunk
|
||||||
|
import com.boydti.fawe.beta.IChunkGet
|
||||||
|
import com.boydti.fawe.beta.IChunkSet
|
||||||
|
import com.sk89q.worldedit.extent.Extent
|
||||||
|
import com.sk89q.worldedit.extent.NullExtent
|
||||||
|
|
||||||
|
object NullProcessor : IBatchProcessor {
|
||||||
|
|
||||||
|
override fun processSet(chunk: IChunk, get: IChunkGet, set: IChunkSet): IChunkSet? {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun construct(child: Extent): Extent {
|
||||||
|
return NullExtent()
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,10 @@
|
|||||||
|
package com.boydti.fawe.beta.implementation.queue;
|
||||||
|
|
||||||
|
public interface Pool<T> {
|
||||||
|
T poll();
|
||||||
|
default boolean offer(T recycle) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
default void clear() {}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,27 @@
|
|||||||
|
package com.boydti.fawe.beta.implementation.queue;
|
||||||
|
|
||||||
|
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||||
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
|
public class QueuePool<T> extends ConcurrentLinkedQueue<T> implements Pool<T> {
|
||||||
|
private final Supplier<T> supplier;
|
||||||
|
|
||||||
|
public QueuePool(Supplier<T> supplier) {
|
||||||
|
this.supplier = supplier;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public T poll() {
|
||||||
|
T result = super.poll();
|
||||||
|
if (result == null) {
|
||||||
|
return supplier.get();
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void clear() {
|
||||||
|
if (!isEmpty()) super.clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -101,7 +101,7 @@ public class MCAChunk implements IChunk {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(IQueueExtent extent, int x, int z) {
|
public <V extends IChunk> void init(IQueueExtent<V> extent, int x, int z) {
|
||||||
if (x != chunkX || z != chunkZ) {
|
if (x != chunkX || z != chunkZ) {
|
||||||
throw new UnsupportedOperationException("Not reuse capable");
|
throw new UnsupportedOperationException("Not reuse capable");
|
||||||
}
|
}
|
||||||
@ -414,6 +414,7 @@ public class MCAChunk implements IChunk {
|
|||||||
this.modified++;
|
this.modified++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getBitMask() {
|
public int getBitMask() {
|
||||||
int bitMask = 0;
|
int bitMask = 0;
|
||||||
for (int section = 0; section < hasSections.length; section++) {
|
for (int section = 0; section < hasSections.length; section++) {
|
||||||
@ -509,7 +510,7 @@ public class MCAChunk implements IChunk {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean setBlock(int x, int y, int z, BlockStateHolder holder) {
|
public <B extends BlockStateHolder<B>> boolean setBlock(int x, int y, int z, B holder) {
|
||||||
setBlock(x, y, z, holder.getOrdinalChar());
|
setBlock(x, y, z, holder.getOrdinalChar());
|
||||||
holder.applyTileEntity(this, x, y, z);
|
holder.applyTileEntity(this, x, y, z);
|
||||||
return true;
|
return true;
|
||||||
|
@ -35,14 +35,12 @@ public class CPUOptimizedClipboard extends LinearClipboard {
|
|||||||
private final HashMap<IntegerTrio, CompoundTag> nbtMapLoc;
|
private final HashMap<IntegerTrio, CompoundTag> nbtMapLoc;
|
||||||
private final HashMap<Integer, CompoundTag> nbtMapIndex;
|
private final HashMap<Integer, CompoundTag> nbtMapIndex;
|
||||||
|
|
||||||
private final HashSet<BlockArrayClipboard.ClipboardEntity> entities;
|
|
||||||
|
|
||||||
public CPUOptimizedClipboard(BlockVector3 dimensions) {
|
public CPUOptimizedClipboard(BlockVector3 dimensions) {
|
||||||
super(dimensions);
|
super(dimensions);
|
||||||
this.states = new char[getVolume()];
|
this.states = new char[getVolume()];
|
||||||
nbtMapLoc = new HashMap<>();
|
nbtMapLoc = new HashMap<>();
|
||||||
nbtMapIndex = new HashMap<>();
|
nbtMapIndex = new HashMap<>();
|
||||||
entities = new HashSet<>();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -216,7 +214,6 @@ public class CPUOptimizedClipboard extends LinearClipboard {
|
|||||||
this.entities.remove(entity);
|
this.entities.remove(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
|
||||||
@Override
|
@Override
|
||||||
public void removeEntity(int x, int y, int z, UUID uuid) {
|
public void removeEntity(int x, int y, int z, UUID uuid) {
|
||||||
Iterator<BlockArrayClipboard.ClipboardEntity> iter = this.entities.iterator();
|
Iterator<BlockArrayClipboard.ClipboardEntity> iter = this.entities.iterator();
|
||||||
|
@ -92,7 +92,6 @@ public class DelegateClipboard implements Clipboard {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Nullable
|
|
||||||
public void removeEntity(int x, int y, int z, UUID uuid) {
|
public void removeEntity(int x, int y, int z, UUID uuid) {
|
||||||
parent.removeEntity(x, y, z, uuid);
|
parent.removeEntity(x, y, z, uuid);
|
||||||
}
|
}
|
||||||
|
@ -11,26 +11,20 @@ import com.sk89q.jnbt.IntTag;
|
|||||||
import com.sk89q.jnbt.Tag;
|
import com.sk89q.jnbt.Tag;
|
||||||
import com.sk89q.worldedit.entity.BaseEntity;
|
import com.sk89q.worldedit.entity.BaseEntity;
|
||||||
import com.sk89q.worldedit.entity.Entity;
|
import com.sk89q.worldedit.entity.Entity;
|
||||||
import com.sk89q.worldedit.extent.Extent;
|
|
||||||
import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard;
|
import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||||
import com.sk89q.worldedit.regions.Region;
|
|
||||||
import com.sk89q.worldedit.util.Location;
|
import com.sk89q.worldedit.util.Location;
|
||||||
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.biome.BiomeTypes;
|
||||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||||
import com.sk89q.worldedit.world.block.BlockState;
|
import com.sk89q.worldedit.world.block.BlockState;
|
||||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||||
import com.sk89q.worldedit.world.block.BlockType;
|
|
||||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
import java.io.Closeable;
|
import java.io.Closeable;
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.FileNotFoundException;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.RandomAccessFile;
|
import java.io.RandomAccessFile;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
@ -42,12 +36,11 @@ import java.nio.channels.FileChannel;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A clipboard with disk backed storage. (lower memory + loads on crash)
|
* A clipboard with disk backed storage. (lower memory + loads on crash)
|
||||||
@ -59,7 +52,6 @@ public class DiskOptimizedClipboard extends LinearClipboard implements Closeable
|
|||||||
private static int HEADER_SIZE = 14;
|
private static int HEADER_SIZE = 14;
|
||||||
|
|
||||||
private final HashMap<IntegerTrio, CompoundTag> nbtMap;
|
private final HashMap<IntegerTrio, CompoundTag> nbtMap;
|
||||||
private final HashSet<BlockArrayClipboard.ClipboardEntity> entities;
|
|
||||||
private final File file;
|
private final File file;
|
||||||
|
|
||||||
private RandomAccessFile braf;
|
private RandomAccessFile braf;
|
||||||
@ -81,9 +73,8 @@ public class DiskOptimizedClipboard extends LinearClipboard implements Closeable
|
|||||||
if (getWidth() > Character.MAX_VALUE || getHeight() > Character.MAX_VALUE || getLength() > Character.MAX_VALUE) {
|
if (getWidth() > Character.MAX_VALUE || getHeight() > Character.MAX_VALUE || getLength() > Character.MAX_VALUE) {
|
||||||
throw new IllegalArgumentException("Too large");
|
throw new IllegalArgumentException("Too large");
|
||||||
}
|
}
|
||||||
try {
|
|
||||||
nbtMap = new HashMap<>();
|
nbtMap = new HashMap<>();
|
||||||
entities = new HashSet<>();
|
try {
|
||||||
this.file = file;
|
this.file = file;
|
||||||
try {
|
try {
|
||||||
if (!file.exists()) {
|
if (!file.exists()) {
|
||||||
@ -127,9 +118,8 @@ public class DiskOptimizedClipboard extends LinearClipboard implements Closeable
|
|||||||
|
|
||||||
public DiskOptimizedClipboard(File file) {
|
public DiskOptimizedClipboard(File file) {
|
||||||
super(readSize(file));
|
super(readSize(file));
|
||||||
try {
|
|
||||||
nbtMap = new HashMap<>();
|
nbtMap = new HashMap<>();
|
||||||
entities = new HashSet<>();
|
try {
|
||||||
this.file = file;
|
this.file = file;
|
||||||
this.braf = new RandomAccessFile(file, "rw");
|
this.braf = new RandomAccessFile(file, "rw");
|
||||||
braf.setLength(file.length());
|
braf.setLength(file.length());
|
||||||
@ -437,7 +427,6 @@ public class DiskOptimizedClipboard extends LinearClipboard implements Closeable
|
|||||||
this.entities.remove(entity);
|
this.entities.remove(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
|
||||||
@Override
|
@Override
|
||||||
public void removeEntity(int x, int y, int z, UUID uuid) {
|
public void removeEntity(int x, int y, int z, UUID uuid) {
|
||||||
Iterator<BlockArrayClipboard.ClipboardEntity> iter = this.entities.iterator();
|
Iterator<BlockArrayClipboard.ClipboardEntity> iter = this.entities.iterator();
|
||||||
|
@ -71,7 +71,7 @@ public class EmptyClipboard implements Clipboard {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean setBlock(BlockVector3 position, BlockStateHolder block) throws WorldEditException {
|
public <T extends BlockStateHolder<T>> boolean setBlock(BlockVector3 position, T block) throws WorldEditException {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,6 +5,8 @@ import com.boydti.fawe.jnbt.streamer.IntValueReader;
|
|||||||
import com.google.common.collect.ForwardingIterator;
|
import com.google.common.collect.ForwardingIterator;
|
||||||
import com.sk89q.jnbt.CompoundTag;
|
import com.sk89q.jnbt.CompoundTag;
|
||||||
import com.sk89q.worldedit.extent.Extent;
|
import com.sk89q.worldedit.extent.Extent;
|
||||||
|
import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard;
|
||||||
|
import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard.ClipboardEntity;
|
||||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||||
import com.sk89q.worldedit.function.visitor.Order;
|
import com.sk89q.worldedit.function.visitor.Order;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
@ -17,7 +19,9 @@ import com.sk89q.worldedit.world.block.BlockStateHolder;
|
|||||||
|
|
||||||
import java.io.Closeable;
|
import java.io.Closeable;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
import java.util.UUID;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -25,8 +29,12 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
* (Small being < Integer.MAX_VALUE/BLOCK_SIZE_BYTES blocks)
|
* (Small being < Integer.MAX_VALUE/BLOCK_SIZE_BYTES blocks)
|
||||||
*/
|
*/
|
||||||
public abstract class LinearClipboard extends SimpleClipboard implements Clipboard, Closeable {
|
public abstract class LinearClipboard extends SimpleClipboard implements Clipboard, Closeable {
|
||||||
|
|
||||||
|
protected final HashSet<ClipboardEntity> entities;
|
||||||
|
|
||||||
public LinearClipboard(BlockVector3 dimensions) {
|
public LinearClipboard(BlockVector3 dimensions) {
|
||||||
super(dimensions);
|
super(dimensions);
|
||||||
|
entities = new HashSet<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract <B extends BlockStateHolder<B>> boolean setBlock(int i, B block);
|
public abstract <B extends BlockStateHolder<B>> boolean setBlock(int i, B block);
|
||||||
@ -91,6 +99,19 @@ public abstract class LinearClipboard extends SimpleClipboard implements Clipboa
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void removeEntity(int x, int y, int z, UUID uuid) {
|
||||||
|
Iterator<ClipboardEntity> iter = this.entities.iterator();
|
||||||
|
while (iter.hasNext()) {
|
||||||
|
ClipboardEntity entity = iter.next();
|
||||||
|
UUID entUUID = entity.getState().getNbtData().getUUID();
|
||||||
|
if (uuid.equals(entUUID)) {
|
||||||
|
iter.remove();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private class LinearFilter extends AbstractFilterBlock {
|
private class LinearFilter extends AbstractFilterBlock {
|
||||||
private int index = -1;
|
private int index = -1;
|
||||||
private BlockVector3 position;
|
private BlockVector3 position;
|
||||||
|
@ -46,7 +46,6 @@ public class MemoryOptimizedClipboard extends LinearClipboard {
|
|||||||
private final HashMap<IntegerTrio, CompoundTag> nbtMapLoc;
|
private final HashMap<IntegerTrio, CompoundTag> nbtMapLoc;
|
||||||
private final HashMap<Integer, CompoundTag> nbtMapIndex;
|
private final HashMap<Integer, CompoundTag> nbtMapIndex;
|
||||||
|
|
||||||
private final HashSet<BlockArrayClipboard.ClipboardEntity> entities;
|
|
||||||
|
|
||||||
private int lastCombinedIdsI = -1;
|
private int lastCombinedIdsI = -1;
|
||||||
|
|
||||||
@ -65,7 +64,6 @@ public class MemoryOptimizedClipboard extends LinearClipboard {
|
|||||||
states = new byte[1 + (getVolume() >> BLOCK_SHIFT)][];
|
states = new byte[1 + (getVolume() >> BLOCK_SHIFT)][];
|
||||||
nbtMapLoc = new HashMap<>();
|
nbtMapLoc = new HashMap<>();
|
||||||
nbtMapIndex = new HashMap<>();
|
nbtMapIndex = new HashMap<>();
|
||||||
entities = new HashSet<>();
|
|
||||||
this.compressionLevel = compressionLevel;
|
this.compressionLevel = compressionLevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -315,17 +313,4 @@ public class MemoryOptimizedClipboard extends LinearClipboard {
|
|||||||
this.entities.remove(entity);
|
this.entities.remove(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
|
||||||
@Override
|
|
||||||
public void removeEntity(int x, int y, int z, UUID uuid) {
|
|
||||||
Iterator<BlockArrayClipboard.ClipboardEntity> iter = this.entities.iterator();
|
|
||||||
while (iter.hasNext()) {
|
|
||||||
BlockArrayClipboard.ClipboardEntity entity = iter.next();
|
|
||||||
UUID entUUID = entity.getState().getNbtData().getUUID();
|
|
||||||
if (uuid.equals(entUUID)) {
|
|
||||||
iter.remove();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -138,7 +138,7 @@ public class CleanableThreadLocal<T> extends ThreadLocal<T> implements Closeable
|
|||||||
|
|
||||||
// Get a reference to the array holding the thread local variables inside the
|
// Get a reference to the array holding the thread local variables inside the
|
||||||
// ThreadLocalMap of the current thread
|
// ThreadLocalMap of the current thread
|
||||||
Class threadLocalMapClass = Class.forName("java.lang.ThreadLocal$ThreadLocalMap");
|
Class<?> threadLocalMapClass = Class.forName("java.lang.ThreadLocal$ThreadLocalMap");
|
||||||
Field tableField = threadLocalMapClass.getDeclaredField("table");
|
Field tableField = threadLocalMapClass.getDeclaredField("table");
|
||||||
tableField.setAccessible(true);
|
tableField.setAccessible(true);
|
||||||
Object table = tableField.get(threadLocalTable);
|
Object table = tableField.get(threadLocalTable);
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package com.boydti.fawe.object.mask;
|
package com.boydti.fawe.object.mask;
|
||||||
|
|
||||||
import com.boydti.fawe.Fawe;
|
|
||||||
import com.sk89q.worldedit.extent.Extent;
|
import com.sk89q.worldedit.extent.Extent;
|
||||||
import com.sk89q.worldedit.function.mask.SolidBlockMask;
|
import com.sk89q.worldedit.function.mask.SolidBlockMask;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
@ -138,8 +137,6 @@ public class AngleMask extends SolidBlockMask implements ResettableMask {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean test(Extent extent, BlockVector3 vector) {
|
public boolean test(Extent extent, BlockVector3 vector) {
|
||||||
Fawe.imp().debug("getExtent(): " + getExtent().getClass() + " extent: " + extent.getClass());
|
|
||||||
|
|
||||||
int x = vector.getBlockX();
|
int x = vector.getBlockX();
|
||||||
int y = vector.getBlockY();
|
int y = vector.getBlockY();
|
||||||
int z = vector.getBlockZ();
|
int z = vector.getBlockZ();
|
||||||
|
@ -427,7 +427,7 @@ public class TaskBuilder extends Metadatable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static abstract class SplitTask extends RunnableTask {
|
public static abstract class SplitTask<T> extends RunnableTask<T> {
|
||||||
|
|
||||||
private final long allocation;
|
private final long allocation;
|
||||||
private final QueueHandler queue;
|
private final QueueHandler queue;
|
||||||
@ -450,7 +450,7 @@ public class TaskBuilder extends Metadatable {
|
|||||||
this.queue = Fawe.get().getQueueHandler();
|
this.queue = Fawe.get().getQueueHandler();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object execSplit(final Object previous) {
|
public Object execSplit(final T previous) {
|
||||||
this.value = previous;
|
this.value = previous;
|
||||||
final Thread thread = new Thread(() -> {
|
final Thread thread = new Thread(() -> {
|
||||||
try {
|
try {
|
||||||
@ -478,7 +478,7 @@ public class TaskBuilder extends Metadatable {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
while (thread.isAlive()) {
|
while (thread.isAlive()) {
|
||||||
TaskManager.IMP.syncWhenFree(new RunnableVal() {
|
TaskManager.IMP.syncWhenFree(new RunnableVal<T>() {
|
||||||
@Override
|
@Override
|
||||||
public void run(Object ignore) {
|
public void run(Object ignore) {
|
||||||
queue.startSet(true);
|
queue.startSet(true);
|
||||||
|
@ -151,7 +151,7 @@ public interface Extent extends InputExtent, OutputExtent {
|
|||||||
* @param z the z coordinate
|
* @param z the z coordinate
|
||||||
* @param uuid the unique identifier of the entity
|
* @param uuid the unique identifier of the entity
|
||||||
*/
|
*/
|
||||||
default @Nullable void removeEntity(int x, int y, int z, UUID uuid) {}
|
default void removeEntity(int x, int y, int z, UUID uuid) {}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Queue based methods
|
Queue based methods
|
||||||
|
@ -60,7 +60,7 @@ public interface OutputExtent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// The defaults need to remain for compatibility (the actual implementation still needs to override one of these)
|
// The defaults need to remain for compatibility (the actual implementation still needs to override one of these)
|
||||||
default <T extends BlockStateHolder<T>> boolean setBlock(int x, int y, int z, T block) throws WorldEditException {
|
default <B extends BlockStateHolder<B>> boolean setBlock(int x, int y, int z, B block) throws WorldEditException {
|
||||||
return setBlock(MutableBlockVector3.get(x, y, z), block);
|
return setBlock(MutableBlockVector3.get(x, y, z), block);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -210,7 +210,6 @@ public class BlockArrayClipboard extends DelegateClipboard implements Clipboard,
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Nullable
|
|
||||||
public void removeEntity(int x, int y, int z, UUID uuid) {
|
public void removeEntity(int x, int y, int z, UUID uuid) {
|
||||||
x -= offset.getX();
|
x -= offset.getX();
|
||||||
y -= offset.getY();
|
y -= offset.getY();
|
||||||
|
@ -34,6 +34,7 @@ import com.sk89q.worldedit.world.storage.ChunkStore;
|
|||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import org.jetbrains.annotations.Range;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents an ellipsoid region.
|
* Represents an ellipsoid region.
|
||||||
|
@ -319,6 +319,7 @@ public interface Region extends Iterable<BlockVector3>, Cloneable, IBatchProcess
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
default Extent construct(Extent child) {
|
default Extent construct(Extent child) {
|
||||||
if (isGlobal()) {
|
if (isGlobal()) {
|
||||||
return child;
|
return child;
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren