Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-11-05 19:10:07 +01:00
Revert migration of FaweCache to Kotlin
Dieser Commit ist enthalten in:
Ursprung
7d4acbdcac
Commit
020c674c01
@ -382,7 +382,7 @@
|
||||
// int z = location.getBlockZ();
|
||||
//
|
||||
// org.bukkit.block.Block bukkitBlock = location.getBlock();
|
||||
// BaseBlock block = FaweCache.INSTANCE.getBlock(bukkitBlock.getTypeId(), bukkitBlock.getData());
|
||||
// BaseBlock block = FaweCache.IMP.getBlock(bukkitBlock.getTypeId(), bukkitBlock.getData());
|
||||
//
|
||||
// // Read the NBT data
|
||||
// Object nmsWorld = getHandleWorld.invoke(craftWorld);
|
||||
|
@ -201,10 +201,10 @@ public final class BukkitAdapter_1_14 extends NMSAdapter {
|
||||
if (set == null) {
|
||||
return newChunkSection(layer);
|
||||
}
|
||||
final int[] blockToPalette = FaweCache.INSTANCE.getBLOCK_TO_PALETTE().get();
|
||||
final int[] paletteToBlock = FaweCache.INSTANCE.getPALETTE_TO_BLOCK().get();
|
||||
final long[] blockStates = FaweCache.INSTANCE.getBLOCK_STATES().get();
|
||||
final int[] blocksCopy = FaweCache.INSTANCE.getSECTION_BLOCKS().get();
|
||||
final int[] blockToPalette = FaweCache.IMP.BLOCK_TO_PALETTE.get();
|
||||
final int[] paletteToBlock = FaweCache.IMP.PALETTE_TO_BLOCK.get();
|
||||
final long[] blockStates = FaweCache.IMP.BLOCK_STATES.get();
|
||||
final int[] blocksCopy = FaweCache.IMP.SECTION_BLOCKS.get();
|
||||
try {
|
||||
int[] num_palette_buffer = new int[1];
|
||||
int air;
|
||||
|
@ -490,9 +490,9 @@ public class BukkitGetBlocks_1_14 extends CharGetBlocks {
|
||||
ChunkSection section = getSections()[layer];
|
||||
// Section is null, return empty array
|
||||
if (section == null) {
|
||||
return FaweCache.INSTANCE.getEMPTY_CHAR_4096();
|
||||
return FaweCache.IMP.EMPTY_CHAR_4096;
|
||||
}
|
||||
if (data == null || data == FaweCache.INSTANCE.getEMPTY_CHAR_4096()) {
|
||||
if (data == null || data == FaweCache.IMP.EMPTY_CHAR_4096) {
|
||||
data = new char[4096];
|
||||
}
|
||||
DelegateLock lock = BukkitAdapter_1_14.applyLock(section);
|
||||
@ -519,8 +519,8 @@ public class BukkitGetBlocks_1_14 extends CharGetBlocks {
|
||||
num_palette = ((DataPaletteHash<IBlockData>) palette).b();
|
||||
} else {
|
||||
num_palette = 0;
|
||||
int[] paletteToBlockInts = FaweCache.INSTANCE.getPALETTE_TO_BLOCK().get();
|
||||
char[] paletteToBlockChars = FaweCache.INSTANCE.getPALETTE_TO_BLOCK_CHAR().get();
|
||||
int[] paletteToBlockInts = FaweCache.IMP.PALETTE_TO_BLOCK.get();
|
||||
char[] paletteToBlockChars = FaweCache.IMP.PALETTE_TO_BLOCK_CHAR.get();
|
||||
try {
|
||||
for (int i = 0; i < 4096; i++) {
|
||||
char paletteVal = data[i];
|
||||
@ -546,7 +546,7 @@ public class BukkitGetBlocks_1_14 extends CharGetBlocks {
|
||||
return data;
|
||||
}
|
||||
|
||||
char[] paletteToOrdinal = FaweCache.INSTANCE.getPALETTE_TO_BLOCK_CHAR().get();
|
||||
char[] paletteToOrdinal = FaweCache.IMP.PALETTE_TO_BLOCK_CHAR.get();
|
||||
try {
|
||||
if (num_palette != 1) {
|
||||
for (int i = 0; i < num_palette; i++) {
|
||||
|
@ -179,10 +179,10 @@ public final class BukkitAdapter_1_15 extends NMSAdapter {
|
||||
if (set == null) {
|
||||
return newChunkSection(layer);
|
||||
}
|
||||
final int[] blockToPalette = FaweCache.INSTANCE.getBLOCK_TO_PALETTE().get();
|
||||
final int[] paletteToBlock = FaweCache.INSTANCE.getPALETTE_TO_BLOCK().get();
|
||||
final long[] blockStates = FaweCache.INSTANCE.getBLOCK_STATES().get();
|
||||
final int[] blocksCopy = FaweCache.INSTANCE.getSECTION_BLOCKS().get();
|
||||
final int[] blockToPalette = FaweCache.IMP.BLOCK_TO_PALETTE.get();
|
||||
final int[] paletteToBlock = FaweCache.IMP.PALETTE_TO_BLOCK.get();
|
||||
final long[] blockStates = FaweCache.IMP.BLOCK_STATES.get();
|
||||
final int[] blocksCopy = FaweCache.IMP.SECTION_BLOCKS.get();
|
||||
try {
|
||||
int[] num_palette_buffer = new int[1];
|
||||
int air;
|
||||
|
@ -96,7 +96,7 @@ public class BukkitGetBlocks_1_15 extends CharGetBlocks {
|
||||
BiomeStorage index = getChunk().getBiomeIndex();
|
||||
BiomeBase base = null;
|
||||
if (y == -1) {
|
||||
for (y = 0; y < FaweCache.WORLD_HEIGHT; y++) {
|
||||
for (y = 0; y < FaweCache.IMP.WORLD_HEIGHT; y++) {
|
||||
base = index.getBiome(x, y, z);
|
||||
if (base != null) break;
|
||||
}
|
||||
@ -324,7 +324,7 @@ public class BukkitGetBlocks_1_15 extends CharGetBlocks {
|
||||
if (biome != null) {
|
||||
final Biome craftBiome = BukkitAdapter.adapt(biome);
|
||||
BiomeBase nmsBiome = CraftBlock.biomeToBiomeBase(craftBiome);
|
||||
for (int y = 0; y < FaweCache.WORLD_HEIGHT; y++) {
|
||||
for (int y = 0; y < FaweCache.IMP.WORLD_HEIGHT; y++) {
|
||||
currentBiomes.setBiome(x, y, z, nmsBiome);
|
||||
}
|
||||
}
|
||||
@ -502,9 +502,9 @@ public class BukkitGetBlocks_1_15 extends CharGetBlocks {
|
||||
ChunkSection section = getSections()[layer];
|
||||
// Section is null, return empty array
|
||||
if (section == null) {
|
||||
return FaweCache.INSTANCE.getEMPTY_CHAR_4096();
|
||||
return FaweCache.IMP.EMPTY_CHAR_4096;
|
||||
}
|
||||
if (data == null || data == FaweCache.INSTANCE.getEMPTY_CHAR_4096()) {
|
||||
if (data == null || data == FaweCache.IMP.EMPTY_CHAR_4096) {
|
||||
data = new char[4096];
|
||||
}
|
||||
DelegateLock lock = BukkitAdapter_1_15.applyLock(section);
|
||||
@ -531,8 +531,8 @@ public class BukkitGetBlocks_1_15 extends CharGetBlocks {
|
||||
num_palette = ((DataPaletteHash<IBlockData>) palette).b();
|
||||
} else {
|
||||
num_palette = 0;
|
||||
int[] paletteToBlockInts = FaweCache.INSTANCE.getPALETTE_TO_BLOCK().get();
|
||||
char[] paletteToBlockChars = FaweCache.INSTANCE.getPALETTE_TO_BLOCK_CHAR().get();
|
||||
int[] paletteToBlockInts = FaweCache.IMP.PALETTE_TO_BLOCK.get();
|
||||
char[] paletteToBlockChars = FaweCache.IMP.PALETTE_TO_BLOCK_CHAR.get();
|
||||
try {
|
||||
for (int i = 0; i < 4096; i++) {
|
||||
char paletteVal = data[i];
|
||||
@ -558,7 +558,7 @@ public class BukkitGetBlocks_1_15 extends CharGetBlocks {
|
||||
return data;
|
||||
}
|
||||
|
||||
char[] paletteToOrdinal = FaweCache.INSTANCE.getPALETTE_TO_BLOCK_CHAR().get();
|
||||
char[] paletteToOrdinal = FaweCache.IMP.PALETTE_TO_BLOCK_CHAR.get();
|
||||
try {
|
||||
if (num_palette != 1) {
|
||||
for (int i = 0; i < num_palette; i++) {
|
||||
|
@ -123,7 +123,7 @@ public class CFIPacketListener implements Listener {
|
||||
protocolmanager.addPacketListener(new PacketAdapter(plugin, ListenerPriority.NORMAL, PacketType.Play.Server.MAP_CHUNK) {
|
||||
@Override
|
||||
public void onPacketSending(PacketEvent event) {
|
||||
if (!event.isServerPacket() || FaweCache.INSTANCE.getCHUNK_FLAG().get().get()) return;
|
||||
if (!event.isServerPacket() || FaweCache.IMP.CHUNK_FLAG.get().get()) return;
|
||||
VirtualWorld gen = getGenerator(event);
|
||||
if (gen != null) {
|
||||
BlockVector3 origin = gen.getOrigin().toBlockPoint();
|
||||
|
@ -54,7 +54,7 @@ public final class AsyncDataContainer implements PersistentDataContainer {
|
||||
Validate.notNull(key, "The provided key for the custom value was null");
|
||||
Validate.notNull(type, "The provided type for the custom value was null");
|
||||
Validate.notNull(value, "The provided value for the custom value was null");
|
||||
get().put(key.toString(), FaweCache.INSTANCE.asTag(type.toPrimitive(value, null)));
|
||||
get().put(key.toString(), FaweCache.IMP.asTag(type.toPrimitive(value, null)));
|
||||
}
|
||||
|
||||
public <T, Z> boolean has(NamespacedKey key, PersistentDataType<T, Z> type) {
|
||||
|
@ -347,10 +347,10 @@ public final class FAWE_Spigot_v1_14_R4 extends CachedBukkitAdapter implements I
|
||||
packet.setNativePacket(nmsPacket);
|
||||
}
|
||||
try {
|
||||
FaweCache.INSTANCE.getCHUNK_FLAG().get().set(true);
|
||||
FaweCache.IMP.CHUNK_FLAG.get().set(true);
|
||||
entityPlayer.playerConnection.sendPacket(nmsPacket);
|
||||
} finally {
|
||||
FaweCache.INSTANCE.getCHUNK_FLAG().get().set(false);
|
||||
FaweCache.IMP.CHUNK_FLAG.get().set(false);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -345,10 +345,10 @@ public final class FAWE_Spigot_v1_15_R1 extends CachedBukkitAdapter implements I
|
||||
packet.setNativePacket(nmsPacket);
|
||||
}
|
||||
try {
|
||||
FaweCache.INSTANCE.getCHUNK_FLAG().get().set(true);
|
||||
FaweCache.IMP.CHUNK_FLAG.get().set(true);
|
||||
entityPlayer.playerConnection.sendPacket(nmsPacket);
|
||||
} finally {
|
||||
FaweCache.INSTANCE.getCHUNK_FLAG().get().set(false);
|
||||
FaweCache.IMP.CHUNK_FLAG.get().set(false);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
481
worldedit-core/src/main/java/com/boydti/fawe/FaweCache.java
Normale Datei
481
worldedit-core/src/main/java/com/boydti/fawe/FaweCache.java
Normale Datei
@ -0,0 +1,481 @@
|
||||
package com.boydti.fawe;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static org.slf4j.LoggerFactory.getLogger;
|
||||
|
||||
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.object.collection.BitArray4096;
|
||||
import com.boydti.fawe.object.collection.CleanableThreadLocal;
|
||||
import com.boydti.fawe.object.collection.VariableThreadLocal;
|
||||
import com.boydti.fawe.object.exception.FaweBlockBagException;
|
||||
import com.boydti.fawe.object.exception.FaweChunkLoadException;
|
||||
import com.boydti.fawe.object.exception.FaweException;
|
||||
import com.boydti.fawe.util.IOUtil;
|
||||
import com.boydti.fawe.util.MathMan;
|
||||
import com.google.common.cache.CacheBuilder;
|
||||
import com.google.common.cache.CacheLoader;
|
||||
import com.google.common.cache.LoadingCache;
|
||||
import com.sk89q.jnbt.ByteArrayTag;
|
||||
import com.sk89q.jnbt.ByteTag;
|
||||
import com.sk89q.jnbt.CompoundTag;
|
||||
import com.sk89q.jnbt.DoubleTag;
|
||||
import com.sk89q.jnbt.EndTag;
|
||||
import com.sk89q.jnbt.FloatTag;
|
||||
import com.sk89q.jnbt.IntArrayTag;
|
||||
import com.sk89q.jnbt.IntTag;
|
||||
import com.sk89q.jnbt.ListTag;
|
||||
import com.sk89q.jnbt.LongArrayTag;
|
||||
import com.sk89q.jnbt.LongTag;
|
||||
import com.sk89q.jnbt.ShortTag;
|
||||
import com.sk89q.jnbt.StringTag;
|
||||
import com.sk89q.jnbt.Tag;
|
||||
import com.sk89q.worldedit.math.MutableBlockVector3;
|
||||
import com.sk89q.worldedit.math.MutableVector3;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.sk89q.worldedit.world.block.BlockTypesCache;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.IdentityHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ArrayBlockingQueue;
|
||||
import java.util.concurrent.CancellationException;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public enum FaweCache implements Trimable {
|
||||
IMP
|
||||
; // singleton
|
||||
|
||||
public final int BLOCKS_PER_LAYER = 4096;
|
||||
public final int CHUNK_LAYERS = 16;
|
||||
public final int WORLD_HEIGHT = CHUNK_LAYERS << 4;
|
||||
public final int WORLD_MAX_Y = WORLD_HEIGHT - 1;
|
||||
|
||||
public final char[] EMPTY_CHAR_4096 = new char[4096];
|
||||
|
||||
private final IdentityHashMap<Class<?>, CleanableThreadLocal> REGISTERED_SINGLETONS = new IdentityHashMap<>();
|
||||
private final IdentityHashMap<Class<?>, Pool> REGISTERED_POOLS = new IdentityHashMap<>();
|
||||
|
||||
/*
|
||||
Palette buffers / cache
|
||||
*/
|
||||
|
||||
@Override
|
||||
public synchronized boolean trim(boolean aggressive) {
|
||||
if (aggressive) {
|
||||
CleanableThreadLocal.cleanAll();
|
||||
} else {
|
||||
CHUNK_FLAG.clean();
|
||||
BYTE_BUFFER_8192.clean();
|
||||
BLOCK_TO_PALETTE.clean();
|
||||
PALETTE_TO_BLOCK.clean();
|
||||
BLOCK_STATES.clean();
|
||||
SECTION_BLOCKS.clean();
|
||||
PALETTE_CACHE.clean();
|
||||
PALETTE_TO_BLOCK_CHAR.clean();
|
||||
INDEX_STORE.clean();
|
||||
|
||||
MUTABLE_VECTOR3.clean();
|
||||
MUTABLE_BLOCKVECTOR3.clean();
|
||||
SECTION_BITS_TO_CHAR.clean();
|
||||
for (Map.Entry<Class<?>, CleanableThreadLocal> entry : REGISTERED_SINGLETONS.entrySet()) {
|
||||
entry.getValue().clean();
|
||||
}
|
||||
}
|
||||
for (Map.Entry<Class<?>, Pool> entry : REGISTERED_POOLS.entrySet()) {
|
||||
Pool pool = entry.getValue();
|
||||
pool.clear();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public synchronized <T> Pool<T> registerPool(Class<T> clazz, Supplier<T> cache, boolean buffer) {
|
||||
checkNotNull(cache);
|
||||
Pool<T> pool;
|
||||
if (buffer) {
|
||||
pool = new QueuePool<>(cache);
|
||||
} else {
|
||||
pool = cache::get;
|
||||
}
|
||||
Pool<T> previous = REGISTERED_POOLS.putIfAbsent(clazz, pool);
|
||||
if (previous != null) {
|
||||
throw new IllegalStateException("Previous key");
|
||||
}
|
||||
return pool;
|
||||
}
|
||||
|
||||
public <T, V> LoadingCache<T, V> createCache(Supplier<V> withInitial) {
|
||||
return CacheBuilder.newBuilder().build(new CacheLoader<T, V>() {
|
||||
@Override
|
||||
public V load(T key) {
|
||||
return withInitial.get();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public <T, V> LoadingCache<T, V> createCache(Function<T, V> withInitial) {
|
||||
return CacheBuilder.newBuilder().build(new CacheLoader<T, V>() {
|
||||
@Override
|
||||
public V load(T key) {
|
||||
return withInitial.apply(key);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
Exceptions
|
||||
*/
|
||||
public static final FaweChunkLoadException CHUNK = new FaweChunkLoadException();
|
||||
public static final FaweBlockBagException BLOCK_BAG = new FaweBlockBagException();
|
||||
public static final FaweException MANUAL = new FaweException(TranslatableComponent.of("fawe.cancel.worldedit.cancel.reason.manual"));
|
||||
public static final FaweException NO_REGION = new FaweException(TranslatableComponent.of("fawe.cancel.worldedit.cancel.reason.no.region"));
|
||||
public static final FaweException OUTSIDE_REGION = new FaweException(TranslatableComponent.of("fawe.cancel.worldedit.cancel.reason.outside.region"));
|
||||
public static final FaweException MAX_CHECKS = new FaweException(TranslatableComponent.of("fawe.cancel.worldedit.cancel.reason.max.checks"));
|
||||
public static final FaweException MAX_CHANGES = new FaweException(TranslatableComponent.of("fawe.cancel.worldedit.cancel.reason.max.changes"));
|
||||
public static final FaweException LOW_MEMORY = new FaweException(TranslatableComponent.of("fawe.cancel.worldedit.cancel.reason.low.memory"));
|
||||
public static final FaweException MAX_ENTITIES = new FaweException(TranslatableComponent.of("fawe.cancel.worldedit.cancel.reason.max.entities"));
|
||||
public static final FaweException MAX_TILES = new FaweException(TranslatableComponent.of("fawe.cancel.worldedit.cancel.reason.max.tiles"));
|
||||
public static final FaweException MAX_ITERATIONS = new FaweException(TranslatableComponent.of("fawe.cancel.worldedit.cancel.reason.max.iterations"));
|
||||
|
||||
/*
|
||||
thread cache
|
||||
*/
|
||||
public final CleanableThreadLocal<AtomicBoolean> CHUNK_FLAG = new CleanableThreadLocal<>(AtomicBoolean::new); // resets to false
|
||||
|
||||
public final CleanableThreadLocal<long[]> LONG_BUFFER_1024 = new CleanableThreadLocal<>(() -> new long[1024]);
|
||||
|
||||
public final CleanableThreadLocal<byte[]> BYTE_BUFFER_8192 = new CleanableThreadLocal<>(() -> new byte[8192]);
|
||||
|
||||
public final VariableThreadLocal BYTE_BUFFER_VAR = new VariableThreadLocal();
|
||||
|
||||
public final CleanableThreadLocal<int[]> BLOCK_TO_PALETTE = new CleanableThreadLocal<>(() -> {
|
||||
int[] result = new int[BlockTypesCache.states.length];
|
||||
Arrays.fill(result, Integer.MAX_VALUE);
|
||||
return result;
|
||||
});
|
||||
|
||||
public final CleanableThreadLocal<char[]> SECTION_BITS_TO_CHAR = new CleanableThreadLocal<>(() -> new char[4096]);
|
||||
|
||||
public final CleanableThreadLocal<int[]> PALETTE_TO_BLOCK = new CleanableThreadLocal<>(() -> new int[Character.MAX_VALUE + 1]);
|
||||
|
||||
public final CleanableThreadLocal<char[]> PALETTE_TO_BLOCK_CHAR = new CleanableThreadLocal<>(
|
||||
() -> new char[Character.MAX_VALUE + 1], a -> {
|
||||
Arrays.fill(a, Character.MAX_VALUE);
|
||||
}
|
||||
);
|
||||
|
||||
public final CleanableThreadLocal<long[]> BLOCK_STATES = new CleanableThreadLocal<>(() -> new long[2048]);
|
||||
|
||||
public final CleanableThreadLocal<int[]> SECTION_BLOCKS = new CleanableThreadLocal<>(() -> new int[4096]);
|
||||
|
||||
public final CleanableThreadLocal<int[]> INDEX_STORE = new CleanableThreadLocal<>(() -> new int[256]);
|
||||
|
||||
public final CleanableThreadLocal<int[]> HEIGHT_STORE = new CleanableThreadLocal<>(() -> new int[256]);
|
||||
|
||||
/**
|
||||
* Holds data for a palette used in a chunk section
|
||||
*/
|
||||
public static final class Palette {
|
||||
public int bitsPerEntry;
|
||||
|
||||
public int paletteToBlockLength;
|
||||
/**
|
||||
* Reusable buffer array, MUST check paletteToBlockLength for actual length
|
||||
*/
|
||||
public int[] paletteToBlock;
|
||||
|
||||
public int blockStatesLength;
|
||||
/**
|
||||
* Reusable buffer array, MUST check blockStatesLength for actual length
|
||||
*/
|
||||
public long[] blockStates;
|
||||
}
|
||||
|
||||
private final CleanableThreadLocal<Palette> PALETTE_CACHE = new CleanableThreadLocal<>(Palette::new);
|
||||
|
||||
/**
|
||||
* Convert raw char array to palette
|
||||
* @param layerOffset
|
||||
* @param blocks
|
||||
* @return palette
|
||||
*/
|
||||
public Palette toPalette(int layerOffset, char[] blocks) {
|
||||
return toPalette(layerOffset, null, blocks);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert raw int array to palette
|
||||
* @param layerOffset
|
||||
* @param blocks
|
||||
* @return palette
|
||||
*/
|
||||
public Palette toPalette(int layerOffset, int[] blocks) {
|
||||
return toPalette(layerOffset, blocks, null);
|
||||
}
|
||||
|
||||
private Palette toPalette(int layerOffset, int[] blocksInts, char[] blocksChars) {
|
||||
int[] blockToPalette = BLOCK_TO_PALETTE.get();
|
||||
int[] paletteToBlock = PALETTE_TO_BLOCK.get();
|
||||
long[] blockStates = BLOCK_STATES.get();
|
||||
int[] blocksCopy = SECTION_BLOCKS.get();
|
||||
|
||||
int blockIndexStart = layerOffset << 12;
|
||||
int blockIndexEnd = blockIndexStart + 4096;
|
||||
int num_palette = 0;
|
||||
try {
|
||||
if (blocksChars != null) {
|
||||
for (int i = blockIndexStart, j = 0; i < blockIndexEnd; i++, j++) {
|
||||
int ordinal = blocksChars[i];
|
||||
int palette = blockToPalette[ordinal];
|
||||
if (palette == Integer.MAX_VALUE) {
|
||||
blockToPalette[ordinal] = palette = num_palette;
|
||||
paletteToBlock[num_palette] = ordinal;
|
||||
num_palette++;
|
||||
}
|
||||
blocksCopy[j] = palette;
|
||||
}
|
||||
} else if (blocksInts != null) {
|
||||
for (int i = blockIndexStart, j = 0; i < blockIndexEnd; i++, j++) {
|
||||
int ordinal = blocksInts[i];
|
||||
int palette = blockToPalette[ordinal];
|
||||
if (palette == Integer.MAX_VALUE) {
|
||||
// BlockState state = BlockTypesCache.states[ordinal];
|
||||
blockToPalette[ordinal] = palette = num_palette;
|
||||
paletteToBlock[num_palette] = ordinal;
|
||||
num_palette++;
|
||||
}
|
||||
blocksCopy[j] = palette;
|
||||
}
|
||||
} else {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
for (int i = 0; i < num_palette; i++) {
|
||||
blockToPalette[paletteToBlock[i]] = Integer.MAX_VALUE;
|
||||
}
|
||||
|
||||
// BlockStates
|
||||
int bitsPerEntry = MathMan.log2nlz(num_palette - 1);
|
||||
if (Settings.IMP.PROTOCOL_SUPPORT_FIX || num_palette != 1) {
|
||||
bitsPerEntry = Math.max(bitsPerEntry, 4); // Protocol support breaks <4 bits per entry
|
||||
} else {
|
||||
bitsPerEntry = Math.max(bitsPerEntry, 1); // For some reason minecraft needs 4096 bits to store 0 entries
|
||||
}
|
||||
int blockBitArrayEnd = (bitsPerEntry * 4096) >> 6;
|
||||
if (num_palette == 1) {
|
||||
// Set a value, because minecraft needs it for some reason
|
||||
blockStates[0] = 0;
|
||||
blockBitArrayEnd = 1;
|
||||
} else {
|
||||
BitArray4096 bitArray = new BitArray4096(blockStates, bitsPerEntry);
|
||||
bitArray.fromRaw(blocksCopy);
|
||||
}
|
||||
|
||||
// Construct palette
|
||||
Palette palette = PALETTE_CACHE.get();
|
||||
palette.bitsPerEntry = bitsPerEntry;
|
||||
palette.paletteToBlockLength = num_palette;
|
||||
palette.paletteToBlock = paletteToBlock;
|
||||
|
||||
palette.blockStatesLength = blockBitArrayEnd;
|
||||
palette.blockStates = blockStates;
|
||||
|
||||
return palette;
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
Arrays.fill(blockToPalette, Integer.MAX_VALUE);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Vector cache
|
||||
*/
|
||||
|
||||
public CleanableThreadLocal<MutableBlockVector3> MUTABLE_BLOCKVECTOR3 = new CleanableThreadLocal<>(MutableBlockVector3::new);
|
||||
|
||||
public CleanableThreadLocal<MutableVector3> MUTABLE_VECTOR3 = new CleanableThreadLocal<MutableVector3>(MutableVector3::new) {
|
||||
@Override
|
||||
public MutableVector3 init() {
|
||||
return new MutableVector3();
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
Conversion methods between JNBT tags and raw values
|
||||
*/
|
||||
public Map<String, Object> asMap(Object... pairs) {
|
||||
HashMap<String, Object> map = new HashMap<>(pairs.length >> 1);
|
||||
for (int i = 0; i < pairs.length; i += 2) {
|
||||
String key = (String) pairs[i];
|
||||
Object value = pairs[i + 1];
|
||||
map.put(key, value);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
public ShortTag asTag(short value) {
|
||||
return new ShortTag(value);
|
||||
}
|
||||
|
||||
public IntTag asTag(int value) {
|
||||
return new IntTag(value);
|
||||
}
|
||||
|
||||
public DoubleTag asTag(double value) {
|
||||
return new DoubleTag(value);
|
||||
}
|
||||
|
||||
public ByteTag asTag(byte value) {
|
||||
return new ByteTag(value);
|
||||
}
|
||||
|
||||
public FloatTag asTag(float value) {
|
||||
return new FloatTag(value);
|
||||
}
|
||||
|
||||
public LongTag asTag(long value) {
|
||||
return new LongTag(value);
|
||||
}
|
||||
|
||||
public ByteArrayTag asTag(byte[] value) {
|
||||
return new ByteArrayTag(value);
|
||||
}
|
||||
|
||||
public IntArrayTag asTag(int[] value) {
|
||||
return new IntArrayTag(value);
|
||||
}
|
||||
|
||||
public LongArrayTag asTag(long[] value) {
|
||||
return new LongArrayTag(value);
|
||||
}
|
||||
|
||||
public StringTag asTag(String value) {
|
||||
return new StringTag(value);
|
||||
}
|
||||
|
||||
public CompoundTag asTag(Map<String, Object> value) {
|
||||
HashMap<String, Tag> map = new HashMap<>();
|
||||
for (Map.Entry<String, Object> entry : value.entrySet()) {
|
||||
Object child = entry.getValue();
|
||||
Tag tag = asTag(child);
|
||||
map.put(entry.getKey(), tag);
|
||||
}
|
||||
return new CompoundTag(map);
|
||||
}
|
||||
|
||||
public Tag asTag(Object value) {
|
||||
if (value instanceof Integer) {
|
||||
return asTag((int) value);
|
||||
} else if (value instanceof Short) {
|
||||
return asTag((short) value);
|
||||
} else if (value instanceof Double) {
|
||||
return asTag((double) value);
|
||||
} else if (value instanceof Byte) {
|
||||
return asTag((byte) value);
|
||||
} else if (value instanceof Float) {
|
||||
return asTag((float) value);
|
||||
} else if (value instanceof Long) {
|
||||
return asTag((long) value);
|
||||
} else if (value instanceof String) {
|
||||
return asTag((String) value);
|
||||
} else if (value instanceof Map) {
|
||||
return asTag((Map<String, Object>) value);
|
||||
} else if (value instanceof Collection) {
|
||||
return asTag((Collection) value);
|
||||
} else if (value instanceof Object[]) {
|
||||
return asTag((Object[]) value);
|
||||
} else if (value instanceof byte[]) {
|
||||
return asTag((byte[]) value);
|
||||
} else if (value instanceof int[]) {
|
||||
return asTag((int[]) value);
|
||||
} else if (value instanceof long[]) {
|
||||
return asTag((long[]) value);
|
||||
} else if (value instanceof Tag) {
|
||||
return (Tag) value;
|
||||
} else if (value instanceof Boolean) {
|
||||
return asTag((byte) ((boolean) value ? 1 : 0));
|
||||
}
|
||||
System.out.println("Invalid nbt: " + value);
|
||||
return null;
|
||||
}
|
||||
|
||||
public ListTag asTag(Object... values) {
|
||||
Class<? extends Tag> clazz = null;
|
||||
List<Tag> list = new ArrayList<>(values.length);
|
||||
for (Object value : values) {
|
||||
Tag tag = asTag(value);
|
||||
if (clazz == null) {
|
||||
clazz = tag.getClass();
|
||||
}
|
||||
list.add(tag);
|
||||
}
|
||||
if (clazz == null) clazz = EndTag.class;
|
||||
return new ListTag(clazz, list);
|
||||
}
|
||||
|
||||
public ListTag asTag(Collection values) {
|
||||
Class<? extends Tag> clazz = null;
|
||||
List<Tag> list = new ArrayList<>(values.size());
|
||||
for (Object value : values) {
|
||||
Tag tag = asTag(value);
|
||||
if (clazz == null) {
|
||||
clazz = tag.getClass();
|
||||
}
|
||||
list.add(tag);
|
||||
}
|
||||
if (clazz == null) clazz = EndTag.class;
|
||||
return new ListTag(clazz, list);
|
||||
}
|
||||
|
||||
/*
|
||||
Thread stuff
|
||||
*/
|
||||
public ThreadPoolExecutor newBlockingExecutor() {
|
||||
int nThreads = Settings.IMP.QUEUE.PARALLEL_THREADS;
|
||||
ArrayBlockingQueue<Runnable> queue = new ArrayBlockingQueue<>(nThreads);
|
||||
return new ThreadPoolExecutor(nThreads, nThreads,
|
||||
0L, TimeUnit.MILLISECONDS, queue
|
||||
, Executors.defaultThreadFactory(),
|
||||
new ThreadPoolExecutor.CallerRunsPolicy()) {
|
||||
protected void afterExecute(Runnable r, Throwable t) {
|
||||
try {
|
||||
super.afterExecute(r, t);
|
||||
if (t == null && r instanceof Future<?>) {
|
||||
try {
|
||||
Future<?> future = (Future<?>) r;
|
||||
if (future.isDone()) {
|
||||
future.get();
|
||||
}
|
||||
} catch (CancellationException ce) {
|
||||
t = ce;
|
||||
} catch (ExecutionException ee) {
|
||||
t = ee.getCause();
|
||||
} catch (InterruptedException ie) {
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
}
|
||||
if (t != null) {
|
||||
t.printStackTrace();
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
@ -1,507 +0,0 @@
|
||||
package com.boydti.fawe
|
||||
|
||||
import com.boydti.fawe.`object`.collection.BitArray4096
|
||||
import com.boydti.fawe.`object`.collection.CleanableThreadLocal
|
||||
import com.boydti.fawe.`object`.collection.VariableThreadLocal
|
||||
import com.boydti.fawe.`object`.exception.FaweBlockBagException
|
||||
import com.boydti.fawe.`object`.exception.FaweChunkLoadException
|
||||
import com.boydti.fawe.`object`.exception.FaweException
|
||||
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.util.IOUtil
|
||||
import com.boydti.fawe.util.MathMan
|
||||
import com.google.common.base.Preconditions.checkNotNull
|
||||
import com.google.common.cache.CacheBuilder
|
||||
import com.google.common.cache.CacheLoader
|
||||
import com.google.common.cache.LoadingCache
|
||||
import com.sk89q.jnbt.*
|
||||
import com.sk89q.worldedit.math.MutableBlockVector3
|
||||
import com.sk89q.worldedit.math.MutableVector3
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent
|
||||
import com.sk89q.worldedit.world.block.BlockTypesCache
|
||||
import org.slf4j.LoggerFactory.getLogger
|
||||
import java.util.*
|
||||
import java.util.concurrent.*
|
||||
import java.util.concurrent.atomic.AtomicBoolean
|
||||
import java.util.function.Function
|
||||
import java.util.function.Supplier
|
||||
|
||||
object FaweCache : Trimable {
|
||||
|
||||
const val BLOCKS_PER_LAYER = 4096
|
||||
const val CHUNK_LAYERS = 16
|
||||
const val WORLD_HEIGHT = CHUNK_LAYERS shl 4
|
||||
const val WORLD_MAX_Y = WORLD_HEIGHT - 1
|
||||
|
||||
val EMPTY_CHAR_4096 = CharArray(4096)
|
||||
|
||||
private val REGISTERED_SINGLETONS = IdentityHashMap<Class<*>, CleanableThreadLocal<*>>()
|
||||
private val REGISTERED_POOLS = IdentityHashMap<Class<*>, Pool<*>>()
|
||||
|
||||
/*
|
||||
thread cache
|
||||
*/
|
||||
val CHUNK_FLAG = CleanableThreadLocal(Supplier { AtomicBoolean() }) // resets to false
|
||||
|
||||
val LONG_BUFFER_1024 = CleanableThreadLocal { LongArray(1024) }
|
||||
|
||||
val BYTE_BUFFER_8192 = CleanableThreadLocal { ByteArray(8192) }
|
||||
|
||||
val BYTE_BUFFER_VAR = VariableThreadLocal()
|
||||
|
||||
val BLOCK_TO_PALETTE = CleanableThreadLocal {
|
||||
val result = IntArray(BlockTypesCache.states.size)
|
||||
Arrays.fill(result, Integer.MAX_VALUE)
|
||||
result
|
||||
}
|
||||
|
||||
val SECTION_BITS_TO_CHAR = CleanableThreadLocal { CharArray(4096) }
|
||||
|
||||
val PALETTE_TO_BLOCK = CleanableThreadLocal { IntArray(Character.MAX_VALUE.toInt() + 1) }
|
||||
|
||||
val PALETTE_TO_BLOCK_CHAR = CleanableThreadLocal<CharArray>(
|
||||
fun(): CharArray {
|
||||
return CharArray(Char.MAX_VALUE.toInt() + 1)
|
||||
}, fun(a: CharArray): Unit = Arrays.fill(a, Char.MAX_VALUE)
|
||||
)
|
||||
|
||||
val BLOCK_STATES = CleanableThreadLocal { LongArray(2048) }
|
||||
|
||||
val SECTION_BLOCKS = CleanableThreadLocal { IntArray(4096) }
|
||||
|
||||
val INDEX_STORE = CleanableThreadLocal { IntArray(256) }
|
||||
|
||||
val HEIGHT_STORE = CleanableThreadLocal { IntArray(256) }
|
||||
|
||||
private val PALETTE_CACHE = CleanableThreadLocal(Supplier { Palette() })
|
||||
|
||||
/*
|
||||
* Vector cache
|
||||
*/
|
||||
|
||||
var MUTABLE_BLOCKVECTOR3 = CleanableThreadLocal(Supplier { MutableBlockVector3() })
|
||||
|
||||
var MUTABLE_VECTOR3: CleanableThreadLocal<MutableVector3> = object : CleanableThreadLocal<MutableVector3>(Supplier { MutableVector3() }) {
|
||||
override fun init(): MutableVector3 {
|
||||
return MutableVector3()
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Palette buffers / cache
|
||||
*/
|
||||
|
||||
@Synchronized
|
||||
override fun trim(aggressive: Boolean): Boolean {
|
||||
if (aggressive) {
|
||||
CleanableThreadLocal.cleanAll()
|
||||
} else {
|
||||
CHUNK_FLAG.clean()
|
||||
BYTE_BUFFER_8192.clean()
|
||||
BLOCK_TO_PALETTE.clean()
|
||||
PALETTE_TO_BLOCK.clean()
|
||||
BLOCK_STATES.clean()
|
||||
SECTION_BLOCKS.clean()
|
||||
PALETTE_CACHE.clean()
|
||||
PALETTE_TO_BLOCK_CHAR.clean()
|
||||
INDEX_STORE.clean()
|
||||
|
||||
MUTABLE_VECTOR3.clean()
|
||||
MUTABLE_BLOCKVECTOR3.clean()
|
||||
SECTION_BITS_TO_CHAR.clean()
|
||||
for ((_, value) in REGISTERED_SINGLETONS) {
|
||||
value.clean()
|
||||
}
|
||||
}
|
||||
for ((_, pool) in REGISTERED_POOLS) {
|
||||
pool.clear()
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
fun <T> getPool(clazz: Class<T>): Pool<T>? {
|
||||
var pool: Pool<T>? = REGISTERED_POOLS[clazz] as Pool<T>?
|
||||
if (pool == null) {
|
||||
synchronized(this) {
|
||||
pool = REGISTERED_POOLS[clazz] as Pool<T>?
|
||||
if (pool == null) {
|
||||
getLogger(FaweCache::class.java).debug("Not registered $clazz")
|
||||
val supplier = IOUtil.supplier<T> { clazz.newInstance() }
|
||||
pool = Pool { supplier.get() }
|
||||
REGISTERED_POOLS[clazz] = pool
|
||||
}
|
||||
}
|
||||
}
|
||||
return pool
|
||||
}
|
||||
|
||||
fun <T> getFromPool(clazz: Class<T>): T? {
|
||||
val pool = getPool(clazz)
|
||||
return pool?.poll()
|
||||
}
|
||||
|
||||
fun <T> getSingleton(clazz: Class<T>): T {
|
||||
var cache: CleanableThreadLocal<T>? = REGISTERED_SINGLETONS[clazz] as CleanableThreadLocal<T>?
|
||||
if (cache == null) {
|
||||
synchronized(this) {
|
||||
cache = REGISTERED_SINGLETONS[clazz] as CleanableThreadLocal<T>?
|
||||
if (cache == null) {
|
||||
getLogger(FaweCache::class.java).debug("Not registered $clazz")
|
||||
cache = CleanableThreadLocal(IOUtil.supplier { clazz.newInstance() })
|
||||
REGISTERED_SINGLETONS[clazz] = cache
|
||||
}
|
||||
}
|
||||
}
|
||||
return cache!!.get()
|
||||
}
|
||||
|
||||
@Synchronized
|
||||
fun <T> registerSingleton(clazz: Class<T>, cache: Supplier<T>): CleanableThreadLocal<T> {
|
||||
checkNotNull(cache)
|
||||
val local = CleanableThreadLocal(cache)
|
||||
val previous = (REGISTERED_SINGLETONS as java.util.Map<Class<*>, CleanableThreadLocal<*>>).putIfAbsent(clazz, local)
|
||||
check(previous == null) { "Previous key" }
|
||||
return local
|
||||
}
|
||||
|
||||
@Synchronized
|
||||
fun <T> registerPool(clazz: Class<T>, cache: Supplier<T>, buffer: Boolean): Pool<T> {
|
||||
checkNotNull(cache)
|
||||
val pool: Pool<T>
|
||||
if (buffer) {
|
||||
pool = QueuePool(cache)
|
||||
} else {
|
||||
pool = Pool { cache.get() }
|
||||
}
|
||||
val previous = (REGISTERED_POOLS as java.util.Map<Class<*>, Pool<*>>).putIfAbsent(clazz, pool)
|
||||
check(previous == null) { "Previous key" }
|
||||
return pool
|
||||
}
|
||||
|
||||
fun <T, V> createCache(withInitial: Supplier<V>): LoadingCache<T, V> {
|
||||
return CacheBuilder.newBuilder().build(object : CacheLoader<T, V>() {
|
||||
override fun load(key: T): V {
|
||||
return withInitial.get()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
fun <T, V> createCache(withInitial: Function<T, V>): LoadingCache<T, V> {
|
||||
return CacheBuilder.newBuilder().build(object : CacheLoader<T, V>() {
|
||||
override fun load(key: T): V {
|
||||
return withInitial.apply(key)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Holds data for a palette used in a chunk section
|
||||
*/
|
||||
class Palette {
|
||||
var bitsPerEntry: Int = 0
|
||||
|
||||
var paletteToBlockLength: Int = 0
|
||||
/**
|
||||
* Reusable buffer array, MUST check paletteToBlockLength for actual length
|
||||
*/
|
||||
var paletteToBlock: IntArray? = null
|
||||
|
||||
var blockStatesLength: Int = 0
|
||||
/**
|
||||
* Reusable buffer array, MUST check blockStatesLength for actual length
|
||||
*/
|
||||
var blockStates: LongArray? = null
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert raw char array to palette
|
||||
* @param layerOffset
|
||||
* @param blocks
|
||||
* @return palette
|
||||
*/
|
||||
fun toPalette(layerOffset: Int, blocks: CharArray): Palette {
|
||||
return toPalette(layerOffset, null, blocks)
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert raw int array to palette
|
||||
* @param layerOffset
|
||||
* @param blocks
|
||||
* @return palette
|
||||
*/
|
||||
fun toPalette(layerOffset: Int, blocks: IntArray): Palette {
|
||||
return toPalette(layerOffset, blocks, null)
|
||||
}
|
||||
|
||||
private fun toPalette(layerOffset: Int, blocksInts: IntArray?, blocksChars: CharArray?): Palette {
|
||||
val blockToPalette = BLOCK_TO_PALETTE.get()
|
||||
val paletteToBlock = PALETTE_TO_BLOCK.get()
|
||||
val blockStates = BLOCK_STATES.get()
|
||||
val blocksCopy = SECTION_BLOCKS.get()
|
||||
|
||||
val blockIndexStart = layerOffset shl 12
|
||||
val blockIndexEnd = blockIndexStart + 4096
|
||||
var num_palette = 0
|
||||
try {
|
||||
if (blocksChars != null) {
|
||||
var i = blockIndexStart
|
||||
var j = 0
|
||||
while (i < blockIndexEnd) {
|
||||
val ordinal = blocksChars[i].toInt()
|
||||
var palette = blockToPalette[ordinal]
|
||||
if (palette == Integer.MAX_VALUE) {
|
||||
palette = num_palette
|
||||
blockToPalette[ordinal] = palette
|
||||
paletteToBlock[num_palette] = ordinal
|
||||
num_palette++
|
||||
}
|
||||
blocksCopy[j] = palette
|
||||
i++
|
||||
j++
|
||||
}
|
||||
} else if (blocksInts != null) {
|
||||
var i = blockIndexStart
|
||||
var j = 0
|
||||
while (i < blockIndexEnd) {
|
||||
val ordinal = blocksInts[i]
|
||||
var palette = blockToPalette[ordinal]
|
||||
if (palette == Integer.MAX_VALUE) {
|
||||
// BlockState state = BlockTypesCache.states[ordinal];
|
||||
palette = num_palette
|
||||
blockToPalette[ordinal] = palette
|
||||
paletteToBlock[num_palette] = ordinal
|
||||
num_palette++
|
||||
}
|
||||
blocksCopy[j] = palette
|
||||
i++
|
||||
j++
|
||||
}
|
||||
} else {
|
||||
throw IllegalArgumentException()
|
||||
}
|
||||
|
||||
for (i in 0 until num_palette) {
|
||||
blockToPalette[paletteToBlock[i]] = Integer.MAX_VALUE
|
||||
}
|
||||
|
||||
// BlockStates
|
||||
var bitsPerEntry = MathMan.log2nlz(num_palette - 1)
|
||||
if (Settings.IMP.PROTOCOL_SUPPORT_FIX || num_palette != 1) {
|
||||
bitsPerEntry = Math.max(bitsPerEntry, 4) // Protocol support breaks <4 bits per entry
|
||||
} else {
|
||||
bitsPerEntry = Math.max(bitsPerEntry, 1) // For some reason minecraft needs 4096 bits to store 0 entries
|
||||
}
|
||||
var blockBitArrayEnd = bitsPerEntry * 4096 shr 6
|
||||
if (num_palette == 1) {
|
||||
// Set a value, because minecraft needs it for some reason
|
||||
blockStates[0] = 0
|
||||
blockBitArrayEnd = 1
|
||||
} else {
|
||||
val bitArray = BitArray4096(blockStates, bitsPerEntry)
|
||||
bitArray.fromRaw(blocksCopy)
|
||||
}
|
||||
|
||||
// Construct palette
|
||||
val palette = PALETTE_CACHE.get()
|
||||
palette.bitsPerEntry = bitsPerEntry
|
||||
palette.paletteToBlockLength = num_palette
|
||||
palette.paletteToBlock = paletteToBlock
|
||||
|
||||
palette.blockStatesLength = blockBitArrayEnd
|
||||
palette.blockStates = blockStates
|
||||
|
||||
return palette
|
||||
} catch (e: Throwable) {
|
||||
e.printStackTrace()
|
||||
Arrays.fill(blockToPalette, Integer.MAX_VALUE)
|
||||
throw e
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
Conversion methods between JNBT tags and raw values
|
||||
*/
|
||||
fun asMap(vararg pairs: Any): Map<String, Any> {
|
||||
val map = HashMap<String, Any>(pairs.size shr 1)
|
||||
var i = 0
|
||||
while (i < pairs.size) {
|
||||
val key = pairs[i] as String
|
||||
val value = pairs[i + 1]
|
||||
map[key] = value
|
||||
i += 2
|
||||
}
|
||||
return map
|
||||
}
|
||||
|
||||
fun asTag(value: Short): ShortTag {
|
||||
return ShortTag(value)
|
||||
}
|
||||
|
||||
fun asTag(value: Int): IntTag {
|
||||
return IntTag(value)
|
||||
}
|
||||
|
||||
fun asTag(value: Double): DoubleTag {
|
||||
return DoubleTag(value)
|
||||
}
|
||||
|
||||
fun asTag(value: Byte): ByteTag {
|
||||
return ByteTag(value)
|
||||
}
|
||||
|
||||
fun asTag(value: Float): FloatTag {
|
||||
return FloatTag(value)
|
||||
}
|
||||
|
||||
fun asTag(value: Long): LongTag {
|
||||
return LongTag(value)
|
||||
}
|
||||
|
||||
fun asTag(value: ByteArray): ByteArrayTag {
|
||||
return ByteArrayTag(value)
|
||||
}
|
||||
|
||||
fun asTag(value: IntArray): IntArrayTag {
|
||||
return IntArrayTag(value)
|
||||
}
|
||||
|
||||
fun asTag(value: LongArray): LongArrayTag {
|
||||
return LongArrayTag(value)
|
||||
}
|
||||
|
||||
fun asTag(value: String): StringTag {
|
||||
return StringTag(value)
|
||||
}
|
||||
|
||||
fun asTag(value: Map<String, Any>): CompoundTag {
|
||||
val map = HashMap<String, Tag>()
|
||||
for ((key, child) in value) {
|
||||
val tag = asTag(child)
|
||||
map[key] = tag
|
||||
}
|
||||
return CompoundTag(map)
|
||||
}
|
||||
|
||||
fun asTag(value: Any?): Tag? {
|
||||
if (value is Int) {
|
||||
return asTag(value)
|
||||
} else if (value is Short) {
|
||||
return asTag(value)
|
||||
} else if (value is Double) {
|
||||
return asTag(value)
|
||||
} else if (value is Byte) {
|
||||
return asTag(value)
|
||||
} else if (value is Float) {
|
||||
return asTag(value)
|
||||
} else if (value is Long) {
|
||||
return asTag(value)
|
||||
} else if (value is String) {
|
||||
return asTag(value as String?)
|
||||
} else if (value is Map<*, *>) {
|
||||
return asTag((value as Map<String, Any>?)!!)
|
||||
} else if (value is Collection<*>) {
|
||||
return asTag((value as Collection<*>?)!!)
|
||||
} else if (value is Array<*>) {
|
||||
return asTag(*(value as Array<Any>?)!!)
|
||||
} else if (value is ByteArray) {
|
||||
return asTag(value as ByteArray?)
|
||||
} else if (value is IntArray) {
|
||||
return asTag(value as IntArray?)
|
||||
} else if (value is LongArray) {
|
||||
return asTag(value as LongArray?)
|
||||
} else if (value is Tag) {
|
||||
return value
|
||||
} else if (value is Boolean) {
|
||||
return asTag((if (value) 1 else 0).toByte())
|
||||
} else if (value == null) {
|
||||
println("Invalid nbt: " + value!!)
|
||||
return null
|
||||
} else {
|
||||
val clazz = value.javaClass
|
||||
println("Invalid nbt: $value")
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
fun asTag(vararg values: Any): ListTag {
|
||||
var clazz: Class<out Tag>? = null
|
||||
val list = ArrayList<Tag>(values.size)
|
||||
for (value in values) {
|
||||
val tag = asTag(value)
|
||||
if (clazz == null) {
|
||||
clazz = tag.javaClass
|
||||
}
|
||||
list.add(tag)
|
||||
}
|
||||
if (clazz == null) clazz = EndTag::class.java
|
||||
return ListTag(clazz, list)
|
||||
}
|
||||
|
||||
fun asTag(values: Collection<*>): ListTag {
|
||||
var clazz: Class<out Tag>? = null
|
||||
val list: ArrayList<Tag> = ArrayList<Tag>(values.size)
|
||||
for (value in values) {
|
||||
val tag = asTag(value)
|
||||
if (clazz == null) {
|
||||
clazz = tag!!.javaClass
|
||||
}
|
||||
if (tag != null) {
|
||||
list.add(tag)
|
||||
}
|
||||
}
|
||||
if (clazz == null) clazz = EndTag::class.java
|
||||
return ListTag(clazz, list)
|
||||
}
|
||||
|
||||
/*
|
||||
Thread stuff
|
||||
*/
|
||||
fun newBlockingExecutor(): ThreadPoolExecutor {
|
||||
val nThreads = Settings.IMP.QUEUE.PARALLEL_THREADS
|
||||
val queue = ArrayBlockingQueue<Runnable>(nThreads)
|
||||
return object : ThreadPoolExecutor(nThreads, nThreads,
|
||||
0L, TimeUnit.MILLISECONDS, queue, Executors.defaultThreadFactory(), CallerRunsPolicy()) {
|
||||
override fun afterExecute(r: Runnable?, t: Throwable?) {
|
||||
var throwable = t
|
||||
try {
|
||||
super.afterExecute(r, throwable)
|
||||
if (t == null && r is Future<*>) {
|
||||
try {
|
||||
val future = r as Future<*>?
|
||||
if (future!!.isDone) {
|
||||
future.get()
|
||||
}
|
||||
} catch (ce: CancellationException) {
|
||||
throwable = ce
|
||||
} catch (ee: ExecutionException) {
|
||||
throwable = ee.cause
|
||||
} catch (ie: InterruptedException) {
|
||||
Thread.currentThread().interrupt()
|
||||
}
|
||||
|
||||
}
|
||||
throwable?.printStackTrace()
|
||||
} catch (e: Throwable) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val CHUNK = FaweChunkLoadException()
|
||||
val BLOCK_BAG = FaweBlockBagException()
|
||||
val MANUAL = FaweException(TranslatableComponent.of("fawe.cancel.worldedit.cancel.reason.manual"))
|
||||
val NO_REGION = FaweException(TranslatableComponent.of("fawe.cancel.worldedit.cancel.reason.no.region"))
|
||||
val OUTSIDE_REGION = FaweException(TranslatableComponent.of("fawe.cancel.worldedit.cancel.reason.outside.region"))
|
||||
val MAX_CHECKS = FaweException(TranslatableComponent.of("fawe.cancel.worldedit.cancel.reason.max.checks"))
|
||||
val MAX_CHANGES = FaweException(TranslatableComponent.of("fawe.cancel.worldedit.cancel.reason.max.changes"))
|
||||
val LOW_MEMORY = FaweException(TranslatableComponent.of("fawe.cancel.worldedit.cancel.reason.low.memory"))
|
||||
val MAX_ENTITIES = FaweException(TranslatableComponent.of("fawe.cancel.worldedit.cancel.reason.max.entities"))
|
||||
val MAX_TILES = FaweException(TranslatableComponent.of("fawe.cancel.worldedit.cancel.reason.max.tiles"))
|
||||
val MAX_ITERATIONS = FaweException(TranslatableComponent.of("fawe.cancel.worldedit.cancel.reason.max.iterations"))
|
||||
}
|
@ -34,7 +34,7 @@ public class CombinedBlocks implements IBlocks {
|
||||
@Override
|
||||
public int getBitMask() {
|
||||
int bitMask = addMask;
|
||||
for (int layer = 0; layer < FaweCache.CHUNK_LAYERS; layer++) {
|
||||
for (int layer = 0; layer < FaweCache.IMP.CHUNK_LAYERS; layer++) {
|
||||
if (primary.hasSection(layer)) {
|
||||
bitMask |= (1 << layer);
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ public interface IBatchProcessor {
|
||||
}
|
||||
}
|
||||
int maxLayer = (maxY + 1) >> 4;
|
||||
for (int layer = maxLayer; layer < FaweCache.CHUNK_LAYERS; layer++) {
|
||||
for (int layer = maxLayer; layer < FaweCache.IMP.CHUNK_LAYERS; layer++) {
|
||||
if (set.hasSection(layer)) {
|
||||
if (layer == minLayer) {
|
||||
char[] arr = set.load(layer);
|
||||
|
@ -36,7 +36,7 @@ public interface IBlocks extends Trimable {
|
||||
BiomeType getBiomeType(int x, int y, int z);
|
||||
|
||||
default int getBitMask() {
|
||||
return IntStream.range(0, FaweCache.CHUNK_LAYERS).filter(this::hasSection)
|
||||
return IntStream.range(0, FaweCache.IMP.CHUNK_LAYERS).filter(this::hasSection)
|
||||
.map(layer -> (1 << layer)).sum();
|
||||
}
|
||||
|
||||
@ -56,7 +56,7 @@ public interface IBlocks extends Trimable {
|
||||
FaweOutputStream sectionWriter = new FaweOutputStream(sectionByteArray);
|
||||
|
||||
try {
|
||||
for (int layer = 0; layer < FaweCache.CHUNK_LAYERS; layer++) {
|
||||
for (int layer = 0; layer < FaweCache.IMP.CHUNK_LAYERS; layer++) {
|
||||
if (!this.hasSection(layer) || (bitMask & (1 << layer)) == 0) continue;
|
||||
|
||||
char[] ids = this.load(layer);
|
||||
@ -92,12 +92,12 @@ public interface IBlocks extends Trimable {
|
||||
// }
|
||||
// sectionWriter.write(bits.getData());
|
||||
// } else {
|
||||
FaweCache.Palette palette = FaweCache.INSTANCE.toPalette(0, ids);
|
||||
FaweCache.Palette palette = FaweCache.IMP.toPalette(0, ids);
|
||||
|
||||
sectionWriter.writeByte(palette.getBitsPerEntry()); // bits per block
|
||||
sectionWriter.writeVarInt(palette.getPaletteToBlockLength());
|
||||
for (int i = 0; i < palette.getPaletteToBlockLength(); i++) {
|
||||
int ordinal = palette.getPaletteToBlock()[i];
|
||||
sectionWriter.writeByte(palette.bitsPerEntry); // bits per block
|
||||
sectionWriter.writeVarInt(palette.paletteToBlockLength);
|
||||
for (int i = 0; i < palette.paletteToBlockLength; i++) {
|
||||
int ordinal = palette.paletteToBlock[i];
|
||||
switch (ordinal) {
|
||||
case BlockID.__RESERVED__:
|
||||
case BlockID.CAVE_AIR:
|
||||
@ -112,9 +112,9 @@ public interface IBlocks extends Trimable {
|
||||
break;
|
||||
}
|
||||
}
|
||||
sectionWriter.writeVarInt(palette.getBlockStatesLength());
|
||||
for (int i = 0; i < palette.getBlockStatesLength(); i++) {
|
||||
sectionWriter.writeLong(palette.getBlockStates()[i]);
|
||||
sectionWriter.writeVarInt(palette.blockStatesLength);
|
||||
for (int i = 0; i < palette.blockStatesLength; i++) {
|
||||
sectionWriter.writeLong(palette.blockStates[i]);
|
||||
}
|
||||
// }
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ public interface IQueueExtent<T extends IChunk> extends Flushable, Trimable, ICh
|
||||
|
||||
@Override
|
||||
default BlockVector3 getMaximumPoint() {
|
||||
return BlockVector3.at(30000000, FaweCache.WORLD_MAX_Y, 30000000);
|
||||
return BlockVector3.at(30000000, FaweCache.IMP.WORLD_MAX_Y, 30000000);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -84,7 +84,7 @@ public class BitSetBlocks implements IChunkSet {
|
||||
|
||||
@Override
|
||||
public char[] load(int layer) {
|
||||
char[] arr = FaweCache.INSTANCE.getSECTION_BITS_TO_CHAR().get();
|
||||
char[] arr = FaweCache.IMP.SECTION_BITS_TO_CHAR.get();
|
||||
MemBlockSet.IRow nullRowY = row.getRow(layer);
|
||||
if (nullRowY instanceof MemBlockSet.RowY) {
|
||||
char value = blockState.getOrdinalChar();
|
||||
|
@ -25,7 +25,7 @@ import java.util.stream.IntStream;
|
||||
import org.jetbrains.annotations.Range;
|
||||
|
||||
public class CharSetBlocks extends CharBlocks implements IChunkSet {
|
||||
private static Pool<CharSetBlocks> POOL = FaweCache.INSTANCE.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() {
|
||||
return POOL.poll();
|
||||
}
|
||||
|
@ -142,7 +142,7 @@ public class FallbackChunkGet implements IChunkGet {
|
||||
|
||||
@Override
|
||||
public char[] load(int layer) {
|
||||
char[] arr = FaweCache.INSTANCE.getSECTION_BITS_TO_CHAR().get();
|
||||
char[] arr = FaweCache.IMP.SECTION_BITS_TO_CHAR.get();
|
||||
int by = layer << 4;
|
||||
for (int y = 0, i = 0; y < 16; y++) {
|
||||
for (int z = 0; z < 16; z++) {
|
||||
|
@ -55,7 +55,7 @@ object NullChunkGet : IChunkGet {
|
||||
}
|
||||
|
||||
override fun load(layer: Int): CharArray {
|
||||
return FaweCache.EMPTY_CHAR_4096
|
||||
return FaweCache.IMP.EMPTY_CHAR_4096
|
||||
}
|
||||
|
||||
override fun hasSection(layer: Int): Boolean {
|
||||
|
@ -30,7 +30,7 @@ import org.jetbrains.annotations.Range;
|
||||
*/
|
||||
public class ChunkHolder<T extends Future<T>> implements IQueueChunk<T> {
|
||||
|
||||
private static Pool<ChunkHolder> POOL = FaweCache.INSTANCE.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() {
|
||||
return POOL.poll();
|
||||
|
@ -67,7 +67,7 @@ public class CharFilterBlock extends ChunkFilterBlock {
|
||||
this.layer = layer;
|
||||
final IBlocks get = (CharGetBlocks) iget;
|
||||
if (!get.hasSection(layer)) {
|
||||
getArr = FaweCache.INSTANCE.getEMPTY_CHAR_4096();
|
||||
getArr = FaweCache.IMP.EMPTY_CHAR_4096;
|
||||
} else {
|
||||
getArr = get.load(layer);
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ public class ChunkPacket implements Function<byte[], byte[]>, Supplier<byte[]> {
|
||||
synchronized (this) {
|
||||
if (sectionBytes == null) {
|
||||
IBlocks tmpChunk = getChunk();
|
||||
byte[] buf = FaweCache.INSTANCE.getBYTE_BUFFER_8192().get();
|
||||
byte[] buf = FaweCache.IMP.BYTE_BUFFER_8192.get();
|
||||
sectionBytes = tmpChunk.toByteArray(buf, tmpChunk.getBitMask(), this.full);
|
||||
}
|
||||
tmp = sectionBytes;
|
||||
@ -83,13 +83,13 @@ public class ChunkPacket implements Function<byte[], byte[]>, Supplier<byte[]> {
|
||||
@Override
|
||||
@Deprecated
|
||||
public byte[] get() {
|
||||
return apply(FaweCache.INSTANCE.getBYTE_BUFFER_8192().get());
|
||||
return apply(FaweCache.IMP.BYTE_BUFFER_8192.get());
|
||||
}
|
||||
|
||||
public CompoundTag getHeightMap() {
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
map.put("MOTION_BLOCKING", new long[36]);
|
||||
CompoundTag tag = FaweCache.INSTANCE.asTag(map);
|
||||
CompoundTag tag = FaweCache.IMP.asTag(map);
|
||||
// TODO
|
||||
return tag;
|
||||
}
|
||||
|
@ -119,7 +119,7 @@ public class LimitExtent extends PassthroughExtent {
|
||||
|
||||
@Override
|
||||
public int getHighestTerrainBlock(int x, int z, int minY, int maxY) {
|
||||
limit.THROW_MAX_CHECKS(FaweCache.WORLD_HEIGHT);
|
||||
limit.THROW_MAX_CHECKS(FaweCache.IMP.WORLD_HEIGHT);
|
||||
try {
|
||||
return getExtent().getHighestTerrainBlock(x, z, minY, maxY);
|
||||
} catch (FaweException e) {
|
||||
@ -132,7 +132,7 @@ public class LimitExtent extends PassthroughExtent {
|
||||
|
||||
@Override
|
||||
public int getHighestTerrainBlock(int x, int z, int minY, int maxY, Mask filter) {
|
||||
limit.THROW_MAX_CHECKS(FaweCache.WORLD_HEIGHT);
|
||||
limit.THROW_MAX_CHECKS(FaweCache.IMP.WORLD_HEIGHT);
|
||||
try {
|
||||
return getExtent().getHighestTerrainBlock(x, z, minY, maxY, filter);
|
||||
} catch (FaweException e) {
|
||||
@ -145,7 +145,7 @@ public class LimitExtent extends PassthroughExtent {
|
||||
|
||||
@Override
|
||||
public int getNearestSurfaceLayer(int x, int z, int y, int minY, int maxY) {
|
||||
limit.THROW_MAX_CHECKS(FaweCache.WORLD_HEIGHT);
|
||||
limit.THROW_MAX_CHECKS(FaweCache.IMP.WORLD_HEIGHT);
|
||||
try {
|
||||
return getExtent().getNearestSurfaceLayer(x, z, y, minY, maxY);
|
||||
} catch (FaweException e) {
|
||||
@ -158,7 +158,7 @@ public class LimitExtent extends PassthroughExtent {
|
||||
|
||||
@Override
|
||||
public int getNearestSurfaceTerrainBlock(int x, int z, int y, int minY, int maxY, boolean ignoreAir) {
|
||||
limit.THROW_MAX_CHECKS(FaweCache.WORLD_HEIGHT);
|
||||
limit.THROW_MAX_CHECKS(FaweCache.IMP.WORLD_HEIGHT);
|
||||
try {
|
||||
return getExtent().getNearestSurfaceTerrainBlock(x, z, y, minY, maxY, ignoreAir);
|
||||
} catch (FaweException e) {
|
||||
@ -171,7 +171,7 @@ public class LimitExtent extends PassthroughExtent {
|
||||
|
||||
@Override
|
||||
public int getNearestSurfaceTerrainBlock(int x, int z, int y, int minY, int maxY) {
|
||||
limit.THROW_MAX_CHECKS(FaweCache.WORLD_HEIGHT);
|
||||
limit.THROW_MAX_CHECKS(FaweCache.IMP.WORLD_HEIGHT);
|
||||
try {
|
||||
return getExtent().getNearestSurfaceTerrainBlock(x, z, y, minY, maxY);
|
||||
} catch (FaweException e) {
|
||||
@ -184,7 +184,7 @@ public class LimitExtent extends PassthroughExtent {
|
||||
|
||||
@Override
|
||||
public int getNearestSurfaceTerrainBlock(int x, int z, int y, int minY, int maxY, int failedMin, int failedMax) {
|
||||
limit.THROW_MAX_CHECKS(FaweCache.WORLD_HEIGHT);
|
||||
limit.THROW_MAX_CHECKS(FaweCache.IMP.WORLD_HEIGHT);
|
||||
try {
|
||||
return getExtent().getNearestSurfaceTerrainBlock(x, z, y, minY, maxY, failedMin, failedMax);
|
||||
} catch (FaweException e) {
|
||||
@ -197,7 +197,7 @@ public class LimitExtent extends PassthroughExtent {
|
||||
|
||||
@Override
|
||||
public int getNearestSurfaceTerrainBlock(int x, int z, int y, int minY, int maxY, int failedMin, int failedMax, Mask mask) {
|
||||
limit.THROW_MAX_CHECKS(FaweCache.WORLD_HEIGHT);
|
||||
limit.THROW_MAX_CHECKS(FaweCache.IMP.WORLD_HEIGHT);
|
||||
try {
|
||||
return getExtent().getNearestSurfaceTerrainBlock(x, z, y, minY, maxY, failedMin, failedMax, mask);
|
||||
} catch (FaweException e) {
|
||||
@ -210,7 +210,7 @@ public class LimitExtent extends PassthroughExtent {
|
||||
|
||||
@Override
|
||||
public int getNearestSurfaceTerrainBlock(int x, int z, int y, int minY, int maxY, int failedMin, int failedMax, boolean ignoreAir) {
|
||||
limit.THROW_MAX_CHECKS(FaweCache.WORLD_HEIGHT);
|
||||
limit.THROW_MAX_CHECKS(FaweCache.IMP.WORLD_HEIGHT);
|
||||
try {
|
||||
return getExtent().getNearestSurfaceTerrainBlock(x, z, y, minY, maxY, failedMin, failedMax, ignoreAir);
|
||||
} catch (FaweException e) {
|
||||
|
@ -58,7 +58,7 @@ public class ParallelQueueExtent extends PassthroughExtent implements IQueueWrap
|
||||
@Override
|
||||
public boolean cancel() {
|
||||
if (super.cancel()) {
|
||||
processor.setProcessor(new NullExtent(this, FaweCache.INSTANCE.getMANUAL()));
|
||||
processor.setProcessor(new NullExtent(this, FaweCache.MANUAL));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -40,7 +40,7 @@ public abstract class QueueHandler implements Trimable, Runnable {
|
||||
|
||||
private ForkJoinPool forkJoinPoolPrimary = new ForkJoinPool();
|
||||
private ForkJoinPool forkJoinPoolSecondary = new ForkJoinPool();
|
||||
private ThreadPoolExecutor blockingExecutor = FaweCache.INSTANCE.newBlockingExecutor();
|
||||
private ThreadPoolExecutor blockingExecutor = FaweCache.IMP.newBlockingExecutor();
|
||||
private ConcurrentLinkedQueue<FutureTask> syncTasks = new ConcurrentLinkedQueue<>();
|
||||
private ConcurrentLinkedQueue<FutureTask> syncWhenFree = new ConcurrentLinkedQueue<>();
|
||||
|
||||
|
@ -475,7 +475,7 @@ public class AnvilCommands {
|
||||
// });
|
||||
// if (useData) {
|
||||
// for (long[] c : map) {
|
||||
// BaseBlock block = FaweCache.INSTANCE.CACHE_BLOCK[(int) c[0]];
|
||||
// BaseBlock block = FaweCache.IMP.CACHE_BLOCK[(int) c[0]];
|
||||
// String name = BlockType.fromID(block.getId()).getName();
|
||||
// String str = String.format("%-7s (%.3f%%) %s #%d:%d",
|
||||
// String.valueOf(c[1]),
|
||||
|
@ -72,7 +72,7 @@ public class MCAChunk implements IChunk {
|
||||
|
||||
int bitsPerEntry = MathMan.log2nlz(section.palette.length - 1);
|
||||
BitArray4096 bitArray = new BitArray4096(section.blocks, bitsPerEntry);
|
||||
char[] buffer = FaweCache.INSTANCE.getSECTION_BITS_TO_CHAR().get();
|
||||
char[] buffer = FaweCache.IMP.SECTION_BITS_TO_CHAR.get();
|
||||
bitArray.toRaw(buffer);
|
||||
int offset = section.layer << 12;
|
||||
for (int i = 0; i < buffer.length; i++) {
|
||||
@ -152,20 +152,20 @@ public class MCAChunk implements IChunk {
|
||||
StreamDelegate blockStates = layer.add("BlockStates");
|
||||
blockStates.withInfo((length, type) -> {
|
||||
if (section.blocks == null) {
|
||||
section.blocks = FaweCache.INSTANCE.getLONG_BUFFER_1024().get();
|
||||
section.blocks = FaweCache.IMP.LONG_BUFFER_1024.get();
|
||||
}
|
||||
section.blocksLength = length;
|
||||
});
|
||||
blockStates.withLong((index, value) -> section.blocks[index] = value);
|
||||
level.add("TileEntities").withElem((ValueReader<Map<String, Object>>) (index, value) -> {
|
||||
CompoundTag tile = FaweCache.INSTANCE.asTag(value);
|
||||
CompoundTag tile = FaweCache.IMP.asTag(value);
|
||||
int x = tile.getInt("x") & 15;
|
||||
int y = tile.getInt("y");
|
||||
int z = tile.getInt("z") & 15;
|
||||
tiles.put(x, y, z, tile);
|
||||
});
|
||||
level.add("Entities").withElem((ValueReader<Map<String, Object>>) (index, value) -> {
|
||||
CompoundTag entity = FaweCache.INSTANCE.asTag(value);
|
||||
CompoundTag entity = FaweCache.IMP.asTag(value);
|
||||
entities.put(entity.getUUID(), entity);
|
||||
});
|
||||
level.add("Biomes").withInt((index, value) -> biomes[index] = BiomeTypes.getLegacy(value));
|
||||
@ -218,10 +218,10 @@ public class MCAChunk implements IChunk {
|
||||
}
|
||||
|
||||
public void write(NBTOutputStream nbtOut) throws IOException {
|
||||
int[] blockToPalette = FaweCache.INSTANCE.getBLOCK_TO_PALETTE().get();
|
||||
int[] paletteToBlock = FaweCache.INSTANCE.getPALETTE_TO_BLOCK().get();
|
||||
long[] blockstates = FaweCache.INSTANCE.getBLOCK_STATES().get();
|
||||
int[] blocksCopy = FaweCache.INSTANCE.getSECTION_BLOCKS().get();
|
||||
int[] blockToPalette = FaweCache.IMP.BLOCK_TO_PALETTE.get();
|
||||
int[] paletteToBlock = FaweCache.IMP.PALETTE_TO_BLOCK.get();
|
||||
long[] blockstates = FaweCache.IMP.BLOCK_STATES.get();
|
||||
int[] blocksCopy = FaweCache.IMP.SECTION_BLOCKS.get();
|
||||
|
||||
nbtOut.writeNamedTagName("", NBTConstants.TYPE_COMPOUND);
|
||||
nbtOut.writeNamedTag("DataVersion", 1631);
|
||||
@ -524,7 +524,7 @@ public class MCAChunk implements IChunk {
|
||||
|
||||
@Override
|
||||
public char[] load(int layer) {
|
||||
char[] tmp = FaweCache.INSTANCE.getSECTION_BITS_TO_CHAR().get();
|
||||
char[] tmp = FaweCache.IMP.SECTION_BITS_TO_CHAR.get();
|
||||
int offset = layer << 12;
|
||||
System.arraycopy(blocks, offset, tmp, 0, 4096);
|
||||
return tmp;
|
||||
|
@ -138,7 +138,7 @@ public class MCAFile extends ExtentBatchProcessorHolder implements Trimable, ICh
|
||||
|
||||
@Override
|
||||
public BlockVector3 getMaximumPoint() {
|
||||
return BlockVector3.at((this.X << 9) + 511, FaweCache.WORLD_MAX_Y, (this.Z << 9) + 511);
|
||||
return BlockVector3.at((this.X << 9) + 511, FaweCache.IMP.WORLD_MAX_Y, (this.Z << 9) + 511);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -361,7 +361,7 @@ public class MCAFile extends ExtentBatchProcessorHolder implements Trimable, ICh
|
||||
raf.seek(offset);
|
||||
int size = raf.readInt();
|
||||
int compression = raf.read();
|
||||
byte[] data = FaweCache.INSTANCE.getBYTE_BUFFER_VAR().get(size);
|
||||
byte[] data = FaweCache.IMP.BYTE_BUFFER_VAR.get(size);
|
||||
raf.readFully(data, 0, size);
|
||||
FastByteArrayInputStream result = new FastByteArrayInputStream(data, 0, size);
|
||||
return result;
|
||||
@ -379,7 +379,7 @@ public class MCAFile extends ExtentBatchProcessorHolder implements Trimable, ICh
|
||||
|
||||
private NBTInputStream getChunkIS(InputStream is) throws IllegalAccessException {
|
||||
InflaterInputStream iis = new InflaterInputStream(is, new Inflater(), 1);
|
||||
fieldBuf2.set(iis, FaweCache.INSTANCE.getBYTE_BUFFER_8192().get());
|
||||
fieldBuf2.set(iis, FaweCache.IMP.BYTE_BUFFER_8192.get());
|
||||
BufferedInputStream bis = new BufferedInputStream(iis);
|
||||
NBTInputStream nis = new NBTInputStream(bis);
|
||||
return nis;
|
||||
@ -414,13 +414,13 @@ public class MCAFile extends ExtentBatchProcessorHolder implements Trimable, ICh
|
||||
if (chunk.isDeleted()) {
|
||||
return null;
|
||||
}
|
||||
byte[] writeBuffer = FaweCache.INSTANCE.getBYTE_BUFFER_VAR().get(4096);
|
||||
byte[] writeBuffer = FaweCache.IMP.BYTE_BUFFER_VAR.get(4096);
|
||||
FastByteArrayOutputStream uncompressed = chunk.toBytes(writeBuffer);
|
||||
if (uncompressed.array.length > writeBuffer.length) {
|
||||
FaweCache.INSTANCE.getBYTE_BUFFER_VAR().set(uncompressed.array);
|
||||
FaweCache.IMP.BYTE_BUFFER_VAR.set(uncompressed.array);
|
||||
}
|
||||
writeBuffer = uncompressed.array;
|
||||
byte[] buffer = FaweCache.INSTANCE.getBYTE_BUFFER_8192().get();
|
||||
byte[] buffer = FaweCache.IMP.BYTE_BUFFER_8192.get();
|
||||
int length = uncompressed.length;
|
||||
uncompressed.reset();
|
||||
// cheat, reusing the same buffer to read/write
|
||||
|
@ -55,10 +55,10 @@ public class LoggingChangeSet extends AbstractDelegateChangeSet {
|
||||
// loc.x = x;
|
||||
// loc.y = y;
|
||||
// loc.z = z;
|
||||
// oldBlock.id = FaweCache.INSTANCE.getId(combinedId4DataFrom);
|
||||
// oldBlock.data = FaweCache.INSTANCE.getData(combinedId4DataFrom);
|
||||
// newBlock.id = FaweCache.INSTANCE.getId(combinedId4DataTo);
|
||||
// newBlock.data = FaweCache.INSTANCE.getData(combinedId4DataTo);
|
||||
// oldBlock.id = FaweCache.IMP.getId(combinedId4DataFrom);
|
||||
// oldBlock.data = FaweCache.IMP.getData(combinedId4DataFrom);
|
||||
// newBlock.id = FaweCache.IMP.getId(combinedId4DataTo);
|
||||
// newBlock.data = FaweCache.IMP.getData(combinedId4DataTo);
|
||||
// // Log to BlocksHub and parent
|
||||
// api.logBlock(loc, player, world, oldBlock, newBlock);
|
||||
parent.add(x, y, z, combinedId4DataFrom, combinedId4DataTo);
|
||||
|
@ -136,51 +136,51 @@ public class FaweLimit {
|
||||
}
|
||||
|
||||
public void THROW_MAX_CHANGES() {
|
||||
if (MAX_CHANGES-- <= 0) throw FaweCache.INSTANCE.getMAX_CHANGES();
|
||||
if (MAX_CHANGES-- <= 0) throw FaweCache.MAX_CHANGES;
|
||||
}
|
||||
|
||||
public void THROW_MAX_FAILS() {
|
||||
if (MAX_FAILS-- <= 0) throw FaweCache.INSTANCE.getMAX_CHECKS();
|
||||
if (MAX_FAILS-- <= 0) throw FaweCache.MAX_CHECKS;
|
||||
}
|
||||
|
||||
public void THROW_MAX_CHECKS() {
|
||||
if (MAX_CHECKS-- <= 0) throw FaweCache.INSTANCE.getMAX_CHECKS();
|
||||
if (MAX_CHECKS-- <= 0) throw FaweCache.MAX_CHECKS;
|
||||
}
|
||||
|
||||
public void THROW_MAX_ITERATIONS() {
|
||||
if (MAX_ITERATIONS-- <= 0) throw FaweCache.INSTANCE.getMAX_ITERATIONS();
|
||||
if (MAX_ITERATIONS-- <= 0) throw FaweCache.MAX_ITERATIONS;
|
||||
}
|
||||
|
||||
public void THROW_MAX_BLOCKSTATES() {
|
||||
if (MAX_BLOCKSTATES-- <= 0) throw FaweCache.INSTANCE.getMAX_TILES();
|
||||
if (MAX_BLOCKSTATES-- <= 0) throw FaweCache.MAX_TILES;
|
||||
}
|
||||
|
||||
public void THROW_MAX_ENTITIES() {
|
||||
if (MAX_ENTITIES-- <= 0) throw FaweCache.INSTANCE.getMAX_ENTITIES();
|
||||
if (MAX_ENTITIES-- <= 0) throw FaweCache.MAX_ENTITIES;
|
||||
}
|
||||
|
||||
public void THROW_MAX_CHANGES(int amt) {
|
||||
if ((MAX_CHANGES -= amt) <= 0) throw FaweCache.INSTANCE.getMAX_CHANGES();
|
||||
if ((MAX_CHANGES -= amt) <= 0) throw FaweCache.MAX_CHANGES;
|
||||
}
|
||||
|
||||
public void THROW_MAX_FAILS(int amt) {
|
||||
if ((MAX_FAILS -= amt) <= 0) throw FaweCache.INSTANCE.getMAX_CHECKS();
|
||||
if ((MAX_FAILS -= amt) <= 0) throw FaweCache.MAX_CHECKS;
|
||||
}
|
||||
|
||||
public void THROW_MAX_CHECKS(int amt) {
|
||||
if ((MAX_CHECKS -= amt) <= 0) throw FaweCache.INSTANCE.getMAX_CHECKS();
|
||||
if ((MAX_CHECKS -= amt) <= 0) throw FaweCache.MAX_CHECKS;
|
||||
}
|
||||
|
||||
public void THROW_MAX_ITERATIONS(int amt) {
|
||||
if ((MAX_ITERATIONS -= amt) <= 0) throw FaweCache.INSTANCE.getMAX_ITERATIONS();
|
||||
if ((MAX_ITERATIONS -= amt) <= 0) throw FaweCache.MAX_ITERATIONS;
|
||||
}
|
||||
|
||||
public void THROW_MAX_BLOCKSTATES(int amt) {
|
||||
if ((MAX_BLOCKSTATES -= amt) <= 0) throw FaweCache.INSTANCE.getMAX_TILES();
|
||||
if ((MAX_BLOCKSTATES -= amt) <= 0) throw FaweCache.MAX_TILES;
|
||||
}
|
||||
|
||||
public void THROW_MAX_ENTITIES(int amt) {
|
||||
if ((MAX_ENTITIES -= amt) <= 0) throw FaweCache.INSTANCE.getMAX_ENTITIES();
|
||||
if ((MAX_ENTITIES -= amt) <= 0) throw FaweCache.MAX_ENTITIES;
|
||||
}
|
||||
|
||||
public boolean isUnlimited() {
|
||||
|
@ -63,7 +63,7 @@ public class SplineBrush implements Brush, ResettableTool {
|
||||
this.position = position;
|
||||
if (newPos) {
|
||||
if (positionSets.size() >= MAX_POINTS) {
|
||||
throw FaweCache.INSTANCE.getMAX_CHECKS();
|
||||
throw FaweCache.MAX_CHECKS;
|
||||
}
|
||||
final ArrayList<BlockVector3> points = new ArrayList<>();
|
||||
if (size > 0) {
|
||||
|
@ -1563,12 +1563,12 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
|
||||
char[] floor = this.floor.get();
|
||||
char[] overlay = this.overlay != null ? this.overlay.get() : null;
|
||||
try {
|
||||
int[] indexes = FaweCache.INSTANCE.getINDEX_STORE().get();
|
||||
int[] indexes = FaweCache.IMP.INDEX_STORE.get();
|
||||
|
||||
int index;
|
||||
int maxY = 0;
|
||||
int minY = Integer.MAX_VALUE;
|
||||
int[] heightMap = FaweCache.INSTANCE.getHEIGHT_STORE().get();
|
||||
int[] heightMap = FaweCache.IMP.HEIGHT_STORE.get();
|
||||
int globalIndex;
|
||||
for (int z = csz; z <= cez; z++) {
|
||||
globalIndex = z * getWidth() + csx;
|
||||
|
@ -171,7 +171,7 @@ public abstract class AbstractChangeSet implements ChangeSet, IBatchProcessor, C
|
||||
// add each block and tile
|
||||
char[] blocksGet = get.load(layer);
|
||||
if (blocksGet == null) {
|
||||
blocksGet = FaweCache.INSTANCE.getEMPTY_CHAR_4096();
|
||||
blocksGet = FaweCache.IMP.EMPTY_CHAR_4096;
|
||||
}
|
||||
char[] blocksSet = set.load(layer);
|
||||
|
||||
|
@ -87,10 +87,10 @@ public class BlockBagChangeSet extends AbstractDelegateChangeSet {
|
||||
try {
|
||||
blockBag.fetchPlacedBlock(typeTo.getDefaultState());
|
||||
} catch (UnplaceableBlockException e) {
|
||||
throw FaweCache.INSTANCE.getBLOCK_BAG();
|
||||
throw FaweCache.IMP.BLOCK_BAG;
|
||||
} catch (BlockBagException e) {
|
||||
missingBlocks[typeTo.getInternalId()]++;
|
||||
throw FaweCache.INSTANCE.getBLOCK_BAG();
|
||||
throw FaweCache.IMP.BLOCK_BAG;
|
||||
}
|
||||
}
|
||||
if (mine) {
|
||||
|
@ -223,7 +223,7 @@ public class ClipboardRemapper {
|
||||
// String name = entry.getKey();
|
||||
// int id = value.get("id").getAsInt();
|
||||
// int data = value.get("data").getAsInt();
|
||||
// int combined = FaweCache.INSTANCE.getCombined(id, data);
|
||||
// int combined = FaweCache.IMP.getCombined(id, data);
|
||||
// map.putIfAbsent(name, new ArrayList<>());
|
||||
// map.get(name).add(combined);
|
||||
// }
|
||||
@ -496,7 +496,7 @@ public class ClipboardRemapper {
|
||||
// int combined = block.getCombined();
|
||||
// if (remap[combined]) {
|
||||
// char value = remapCombined[combined];
|
||||
// BaseBlock newBlock = FaweCache.INSTANCE.CACHE_BLOCK[value];
|
||||
// BaseBlock newBlock = FaweCache.IMP.CACHE_BLOCK[value];
|
||||
// newBlock.setNbtData(block.getNbtData());
|
||||
// return newBlock;
|
||||
// }
|
||||
|
@ -20,7 +20,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
*/
|
||||
public final class MemBlockSet extends BlockSet {
|
||||
public final static int BITS_PER_WORD = 6;
|
||||
public final static int WORDS = FaweCache.BLOCKS_PER_LAYER >> BITS_PER_WORD;
|
||||
public final static int WORDS = FaweCache.IMP.BLOCKS_PER_LAYER >> BITS_PER_WORD;
|
||||
public final static IRow NULL_ROW_X = new NullRowX();
|
||||
public final static IRow NULL_ROW_Z = new NullRowZ();
|
||||
public final static IRow NULL_ROW_Y = new NullRowY();
|
||||
@ -357,8 +357,8 @@ public final class MemBlockSet extends BlockSet {
|
||||
maxy = y + 1;
|
||||
}
|
||||
by = (Y << 4) + y;
|
||||
if (by == FaweCache.WORLD_MAX_Y)
|
||||
return FaweCache.WORLD_MAX_Y;
|
||||
if (by == FaweCache.IMP.WORLD_MAX_Y)
|
||||
return FaweCache.IMP.WORLD_MAX_Y;
|
||||
break outer;
|
||||
}
|
||||
}
|
||||
@ -827,7 +827,7 @@ public final class MemBlockSet extends BlockSet {
|
||||
public final IRow[] rows;
|
||||
|
||||
public RowZ() {
|
||||
this.rows = new IRow[FaweCache.CHUNK_LAYERS];
|
||||
this.rows = new IRow[FaweCache.IMP.CHUNK_LAYERS];
|
||||
reset();
|
||||
}
|
||||
|
||||
@ -874,7 +874,7 @@ public final class MemBlockSet extends BlockSet {
|
||||
}
|
||||
|
||||
public void reset() {
|
||||
for (int i = 0; i < FaweCache.CHUNK_LAYERS; i++) rows[i] = NULL_ROW_Y;
|
||||
for (int i = 0; i < FaweCache.IMP.CHUNK_LAYERS; i++) rows[i] = NULL_ROW_Y;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -71,7 +71,7 @@ public abstract class FaweRegionExtent extends ResettableExtent implements IBatc
|
||||
public <B extends BlockStateHolder<B>> boolean setBlock(int x, int y, int z, B block) throws WorldEditException {
|
||||
if (!contains(x, y, z)) {
|
||||
if (!limit.MAX_FAILS()) {
|
||||
WEManager.IMP.cancelEditSafe(this, FaweCache.INSTANCE.getOUTSIDE_REGION());
|
||||
WEManager.IMP.cancelEditSafe(this, FaweCache.OUTSIDE_REGION);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -82,7 +82,7 @@ public abstract class FaweRegionExtent extends ResettableExtent implements IBatc
|
||||
public boolean setBiome(int x, int y, int z, BiomeType biome) {
|
||||
if (!contains(x, y, z)) {
|
||||
if (!limit.MAX_FAILS()) {
|
||||
WEManager.IMP.cancelEditSafe(this, FaweCache.INSTANCE.getOUTSIDE_REGION());
|
||||
WEManager.IMP.cancelEditSafe(this, FaweCache.OUTSIDE_REGION);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -93,7 +93,7 @@ public abstract class FaweRegionExtent extends ResettableExtent implements IBatc
|
||||
public BiomeType getBiome(BlockVector2 position) {
|
||||
if (!contains(position)) {
|
||||
if (!limit.MAX_FAILS()) {
|
||||
WEManager.IMP.cancelEditSafe(this, FaweCache.INSTANCE.getOUTSIDE_REGION());
|
||||
WEManager.IMP.cancelEditSafe(this, FaweCache.OUTSIDE_REGION);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@ -104,7 +104,7 @@ public abstract class FaweRegionExtent extends ResettableExtent implements IBatc
|
||||
public BiomeType getBiomeType(int x, int y, int z) {
|
||||
if (!contains(x, z)) {
|
||||
if (!limit.MAX_FAILS()) {
|
||||
WEManager.IMP.cancelEditSafe(this, FaweCache.INSTANCE.getOUTSIDE_REGION());
|
||||
WEManager.IMP.cancelEditSafe(this, FaweCache.OUTSIDE_REGION);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@ -115,7 +115,7 @@ public abstract class FaweRegionExtent extends ResettableExtent implements IBatc
|
||||
public BaseBlock getFullBlock(BlockVector3 position) {
|
||||
if (!contains(position)) {
|
||||
if (!limit.MAX_FAILS()) {
|
||||
WEManager.IMP.cancelEditSafe(this, FaweCache.INSTANCE.getOUTSIDE_REGION());
|
||||
WEManager.IMP.cancelEditSafe(this, FaweCache.OUTSIDE_REGION);
|
||||
}
|
||||
return BlockTypes.AIR.getDefaultState().toBaseBlock();
|
||||
}
|
||||
@ -126,7 +126,7 @@ public abstract class FaweRegionExtent extends ResettableExtent implements IBatc
|
||||
public BlockState getBlock(BlockVector3 position) {
|
||||
if (!contains(position)) {
|
||||
if (!limit.MAX_FAILS()) {
|
||||
WEManager.IMP.cancelEditSafe(this, FaweCache.INSTANCE.getOUTSIDE_REGION());
|
||||
WEManager.IMP.cancelEditSafe(this, FaweCache.OUTSIDE_REGION);
|
||||
}
|
||||
return BlockTypes.AIR.getDefaultState();
|
||||
}
|
||||
@ -137,7 +137,7 @@ public abstract class FaweRegionExtent extends ResettableExtent implements IBatc
|
||||
public int getBlockLight(int x, int y, int z) {
|
||||
if (!contains(x, y, z)) {
|
||||
if (!limit.MAX_FAILS()) {
|
||||
WEManager.IMP.cancelEditSafe(this, FaweCache.INSTANCE.getOUTSIDE_REGION());
|
||||
WEManager.IMP.cancelEditSafe(this, FaweCache.OUTSIDE_REGION);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -148,7 +148,7 @@ public abstract class FaweRegionExtent extends ResettableExtent implements IBatc
|
||||
public int getBrightness(int x, int y, int z) {
|
||||
if (!contains(x, y, z)) {
|
||||
if (!limit.MAX_FAILS()) {
|
||||
WEManager.IMP.cancelEditSafe(this, FaweCache.INSTANCE.getOUTSIDE_REGION());
|
||||
WEManager.IMP.cancelEditSafe(this, FaweCache.OUTSIDE_REGION);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -159,7 +159,7 @@ public abstract class FaweRegionExtent extends ResettableExtent implements IBatc
|
||||
public int getLight(int x, int y, int z) {
|
||||
if (!contains(x, y, z)) {
|
||||
if (!limit.MAX_FAILS()) {
|
||||
WEManager.IMP.cancelEditSafe(this, FaweCache.INSTANCE.getOUTSIDE_REGION());
|
||||
WEManager.IMP.cancelEditSafe(this, FaweCache.OUTSIDE_REGION);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -170,7 +170,7 @@ public abstract class FaweRegionExtent extends ResettableExtent implements IBatc
|
||||
public int getOpacity(int x, int y, int z) {
|
||||
if (!contains(x, y, z)) {
|
||||
if (!limit.MAX_FAILS()) {
|
||||
WEManager.IMP.cancelEditSafe(this, FaweCache.INSTANCE.getOUTSIDE_REGION());
|
||||
WEManager.IMP.cancelEditSafe(this, FaweCache.OUTSIDE_REGION);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -181,7 +181,7 @@ public abstract class FaweRegionExtent extends ResettableExtent implements IBatc
|
||||
public int getSkyLight(int x, int y, int z) {
|
||||
if (!contains(x, y, z)) {
|
||||
if (!limit.MAX_FAILS()) {
|
||||
WEManager.IMP.cancelEditSafe(this, FaweCache.INSTANCE.getOUTSIDE_REGION());
|
||||
WEManager.IMP.cancelEditSafe(this, FaweCache.OUTSIDE_REGION);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -193,7 +193,7 @@ public abstract class FaweRegionExtent extends ResettableExtent implements IBatc
|
||||
public Entity createEntity(Location location, BaseEntity entity) {
|
||||
if (!contains(location.getBlockX(), location.getBlockY(), location.getBlockZ())) {
|
||||
if (!limit.MAX_FAILS()) {
|
||||
WEManager.IMP.cancelEditSafe(this, FaweCache.INSTANCE.getOUTSIDE_REGION());
|
||||
WEManager.IMP.cancelEditSafe(this, FaweCache.OUTSIDE_REGION);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ public class MemoryCheckingExtent extends PassthroughExtent {
|
||||
this.player.print(TranslatableComponent.of("fawe.info.worldedit.oom.admin"));
|
||||
}
|
||||
}
|
||||
WEManager.IMP.cancelEdit(this, FaweCache.INSTANCE.getLOW_MEMORY());
|
||||
WEManager.IMP.cancelEdit(this, FaweCache.LOW_MEMORY);
|
||||
}
|
||||
return super.getExtent();
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ public class NullExtent extends FaweRegionExtent implements IBatchProcessor {
|
||||
}
|
||||
|
||||
public NullExtent() {
|
||||
this(new com.sk89q.worldedit.extent.NullExtent(), FaweCache.INSTANCE.getMANUAL());
|
||||
this(new com.sk89q.worldedit.extent.NullExtent(), FaweCache.MANUAL);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -38,7 +38,7 @@ public class ProcessedWEExtent extends AbstractDelegateExtent {
|
||||
return null;
|
||||
}
|
||||
if (!limit.MAX_ENTITIES()) {
|
||||
WEManager.IMP.cancelEditSafe(this, FaweCache.INSTANCE.getMAX_ENTITIES());
|
||||
WEManager.IMP.cancelEditSafe(this, FaweCache.MAX_ENTITIES);
|
||||
return null;
|
||||
}
|
||||
return super.createEntity(location, entity);
|
||||
@ -47,7 +47,7 @@ public class ProcessedWEExtent extends AbstractDelegateExtent {
|
||||
@Override
|
||||
public BlockState getBlock(int x, int y, int z) {
|
||||
if (!limit.MAX_CHECKS()) {
|
||||
WEManager.IMP.cancelEditSafe(this, FaweCache.INSTANCE.getMAX_CHECKS());
|
||||
WEManager.IMP.cancelEditSafe(this, FaweCache.MAX_CHECKS);
|
||||
return BlockTypes.AIR.getDefaultState();
|
||||
} else {
|
||||
return extent.getBlock(x, y, z);
|
||||
@ -57,7 +57,7 @@ public class ProcessedWEExtent extends AbstractDelegateExtent {
|
||||
@Override
|
||||
public BaseBlock getFullBlock(BlockVector3 pos) {
|
||||
if (!limit.MAX_CHECKS()) {
|
||||
WEManager.IMP.cancelEditSafe(this, FaweCache.INSTANCE.getMAX_CHECKS());
|
||||
WEManager.IMP.cancelEditSafe(this, FaweCache.MAX_CHECKS);
|
||||
return BlockTypes.AIR.getDefaultState().toBaseBlock();
|
||||
} else {
|
||||
return extent.getFullBlock(pos);
|
||||
@ -79,18 +79,18 @@ public class ProcessedWEExtent extends AbstractDelegateExtent {
|
||||
boolean hasNbt = block instanceof BaseBlock && block.hasNbtData();
|
||||
if (hasNbt) {
|
||||
if (!limit.MAX_BLOCKSTATES()) {
|
||||
WEManager.IMP.cancelEdit(this, FaweCache.INSTANCE.getMAX_TILES());
|
||||
WEManager.IMP.cancelEdit(this, FaweCache.MAX_TILES);
|
||||
return false;
|
||||
} else {
|
||||
if (!limit.MAX_CHANGES()) {
|
||||
WEManager.IMP.cancelEdit(this, FaweCache.INSTANCE.getMAX_CHANGES());
|
||||
WEManager.IMP.cancelEdit(this, FaweCache.MAX_CHANGES);
|
||||
return false;
|
||||
}
|
||||
return extent.setBlock(x, y, z, block);
|
||||
}
|
||||
}
|
||||
if (!limit.MAX_CHANGES()) {
|
||||
WEManager.IMP.cancelEdit(this, FaweCache.INSTANCE.getMAX_CHANGES());
|
||||
WEManager.IMP.cancelEdit(this, FaweCache.MAX_CHANGES);
|
||||
return false;
|
||||
} else {
|
||||
return extent.setBlock(x, y, z, block);
|
||||
@ -100,7 +100,7 @@ public class ProcessedWEExtent extends AbstractDelegateExtent {
|
||||
@Override
|
||||
public boolean setBiome(BlockVector2 position, BiomeType biome) {
|
||||
if (!limit.MAX_CHANGES()) {
|
||||
WEManager.IMP.cancelEditSafe(this, FaweCache.INSTANCE.getMAX_CHANGES());
|
||||
WEManager.IMP.cancelEditSafe(this, FaweCache.MAX_CHANGES);
|
||||
return false;
|
||||
}
|
||||
return super.setBiome(position, biome);
|
||||
|
@ -31,10 +31,10 @@ public abstract class FaweBlockMatcher {
|
||||
// public boolean apply(BaseBlock oldBlock) {
|
||||
// int currentId = oldBlock.getId();
|
||||
// oldBlock.setId(id);
|
||||
// if (FaweCache.INSTANCE.hasData(currentId)) {
|
||||
// if (FaweCache.IMP.hasData(currentId)) {
|
||||
// oldBlock.setData(0);
|
||||
// }
|
||||
// if (FaweCache.INSTANCE.hasNBT(currentId)) {
|
||||
// if (FaweCache.IMP.hasNBT(currentId)) {
|
||||
// oldBlock.setNbtData(null);
|
||||
// }
|
||||
// return true;
|
||||
@ -47,7 +47,7 @@ public abstract class FaweBlockMatcher {
|
||||
// int currentId = oldBlock.getId();
|
||||
// oldBlock.setId(id);
|
||||
// oldBlock.setData(data);
|
||||
// if (FaweCache.INSTANCE.hasNBT(currentId)) {
|
||||
// if (FaweCache.IMP.hasNBT(currentId)) {
|
||||
// oldBlock.setNbtData(null);
|
||||
// }
|
||||
// return true;
|
||||
@ -67,10 +67,10 @@ public abstract class FaweBlockMatcher {
|
||||
// BaseBlock replace = array[random.random(size)];
|
||||
// int currentId = block.getId();
|
||||
// block.setId(replace.getId());
|
||||
// if (FaweCache.INSTANCE.hasNBT(currentId)) {
|
||||
// if (FaweCache.IMP.hasNBT(currentId)) {
|
||||
// block.setNbtData(null);
|
||||
// }
|
||||
// if (FaweCache.INSTANCE.hasData(currentId) || replace.getData() != 0) {
|
||||
// if (FaweCache.IMP.hasData(currentId) || replace.getData() != 0) {
|
||||
// block.setData(replace.getData());
|
||||
// }
|
||||
// return true;
|
||||
@ -82,7 +82,7 @@ public abstract class FaweBlockMatcher {
|
||||
public static FaweBlockMatcher fromBlock(BaseBlock block, boolean checkData) {
|
||||
// final int id = block.getId();
|
||||
// final int data = block.getData();
|
||||
// if (checkData && FaweCache.INSTANCE.hasData(id)) {
|
||||
// if (checkData && FaweCache.IMP.hasData(id)) {
|
||||
// return new FaweBlockMatcher() {
|
||||
// @Override
|
||||
// public boolean apply(BaseBlock block) {
|
||||
@ -104,13 +104,13 @@ public abstract class FaweBlockMatcher {
|
||||
// if (searchBlocks.size() == 1) {
|
||||
// return fromBlock(searchBlocks.iterator().next(), checkData);
|
||||
// }
|
||||
// final boolean[] allowedId = new boolean[FaweCache.INSTANCE.getId(Character.MAX_VALUE)];
|
||||
// final boolean[] allowedId = new boolean[FaweCache.IMP.getId(Character.MAX_VALUE)];
|
||||
// for (BaseBlock block : searchBlocks) {
|
||||
// allowedId[block.getId()] = true;
|
||||
// }
|
||||
// final boolean[] allowed = new boolean[Character.MAX_VALUE];
|
||||
// for (BaseBlock block : searchBlocks) {
|
||||
// allowed[FaweCache.INSTANCE.getCombined(block)] = true;
|
||||
// allowed[FaweCache.IMP.getCombined(block)] = true;
|
||||
// }
|
||||
// if (checkData) {
|
||||
// return new FaweBlockMatcher() {
|
||||
@ -118,7 +118,7 @@ public abstract class FaweBlockMatcher {
|
||||
// public boolean apply(BaseBlock block) {
|
||||
// int id = block.getId();
|
||||
// if (allowedId[id]) {
|
||||
// if (FaweCache.INSTANCE.hasData(id)) {
|
||||
// if (FaweCache.IMP.hasData(id)) {
|
||||
// return allowed[(id << 4) + block.getData()];
|
||||
// }
|
||||
// return true;
|
||||
|
@ -162,7 +162,7 @@ public class MinecraftStructure implements ClipboardReader, ClipboardWriter {
|
||||
if (width > WARN_SIZE || height > WARN_SIZE || length > WARN_SIZE) {
|
||||
getLogger(MinecraftStructure.class).debug("A structure longer than 32 is unsupported by minecraft (but probably still works)");
|
||||
}
|
||||
Map<String, Object> structure = FaweCache.INSTANCE.asMap("version", 1, "author", owner);
|
||||
Map<String, Object> structure = FaweCache.IMP.asMap("version", 1, "author", owner);
|
||||
// ignored: version / owner
|
||||
MutableBlockVector3 mutable = new MutableBlockVector3(0, 0, 0);
|
||||
Int2ObjectArrayMap<Integer> indexes = new Int2ObjectArrayMap<>();
|
||||
@ -212,10 +212,10 @@ public class MinecraftStructure implements ClipboardReader, ClipboardWriter {
|
||||
List<Integer> pos = Arrays.asList(point.getX() - min.getX(),
|
||||
point.getY() - min.getY(), point.getZ() - min.getZ());
|
||||
if (!block.hasNbtData()) {
|
||||
blocks.add(FaweCache.INSTANCE.asMap("state", index, "pos", pos));
|
||||
blocks.add(FaweCache.IMP.asMap("state", index, "pos", pos));
|
||||
} else {
|
||||
blocks.add(
|
||||
FaweCache.INSTANCE.asMap("state", index, "pos", pos, "nbt", block.getNbtData()));
|
||||
FaweCache.IMP.asMap("state", index, "pos", pos, "nbt", block.getNbtData()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -235,14 +235,14 @@ public class MinecraftStructure implements ClipboardReader, ClipboardWriter {
|
||||
// Replace rotation data
|
||||
nbtMap.put("Rotation", writeRotation(entity.getLocation()));
|
||||
nbtMap.put("id", new StringTag(state.getType().getId()));
|
||||
Map<String, Object> entityMap = FaweCache.INSTANCE.asMap("pos", pos, "blockPos", blockPos, "nbt", nbt);
|
||||
Map<String, Object> entityMap = FaweCache.IMP.asMap("pos", pos, "blockPos", blockPos, "nbt", nbt);
|
||||
entities.add(entityMap);
|
||||
}
|
||||
}
|
||||
if (!entities.isEmpty()) {
|
||||
structure.put("entities", entities);
|
||||
}
|
||||
out.writeNamedTag("", FaweCache.INSTANCE.asTag(structure));
|
||||
out.writeNamedTag("", FaweCache.IMP.asTag(structure));
|
||||
close();
|
||||
}
|
||||
|
||||
|
@ -124,7 +124,7 @@ public class FaweLocalBlockQueue extends LocalBlockQueue {
|
||||
|
||||
@Override
|
||||
public boolean setTile(int x, int y, int z, CompoundTag tag) {
|
||||
IMP.setTile(x, y, z, (com.sk89q.jnbt.CompoundTag) FaweCache.INSTANCE.asTag(tag));
|
||||
IMP.setTile(x, y, z, (com.sk89q.jnbt.CompoundTag) FaweCache.IMP.asTag(tag));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -108,7 +108,7 @@ public class FaweSchematicHandler extends SchematicHandler {
|
||||
com.github.intellectualsites.plotsquared.plot.util.TaskManager.runTask(whenDone);
|
||||
return;
|
||||
}
|
||||
CompoundTag weTag = (CompoundTag) FaweCache.INSTANCE.asTag(tag);
|
||||
CompoundTag weTag = (CompoundTag) FaweCache.IMP.asTag(tag);
|
||||
if (weTag instanceof CompressedSchematicTag) {
|
||||
Clipboard clipboard = ((CompressedSchematicTag) weTag).getSource();
|
||||
URL url = FaweAPI.upload(clipboard, BuiltInClipboardFormat.SPONGE_SCHEMATIC);
|
||||
|
@ -92,7 +92,7 @@ public final class BrushCache {
|
||||
} else {
|
||||
displayMap = ReflectionUtils.getMap(display.getValue());
|
||||
}
|
||||
displayMap.put("Lore", FaweCache.INSTANCE.asTag(json.split("\\r?\\n")));
|
||||
displayMap.put("Lore", FaweCache.IMP.asTag(json.split("\\r?\\n")));
|
||||
String primary = (String) tool.getPrimary().getSettings().get(BrushSettings.SettingType.BRUSH);
|
||||
String secondary = (String) tool.getSecondary().getSettings().get(BrushSettings.SettingType.BRUSH);
|
||||
if (primary == null) primary = secondary;
|
||||
|
@ -232,11 +232,11 @@ public class EditSessionBuilder {
|
||||
event.setExtent(extent);
|
||||
eventBus.post(event);
|
||||
if (event.isCancelled()) {
|
||||
return new NullExtent(extent, FaweCache.INSTANCE.getMANUAL());
|
||||
return new NullExtent(extent, FaweCache.MANUAL);
|
||||
}
|
||||
final Extent toReturn = event.getExtent();
|
||||
if(toReturn instanceof com.sk89q.worldedit.extent.NullExtent) {
|
||||
return new NullExtent(toReturn, FaweCache.INSTANCE.getMANUAL());
|
||||
return new NullExtent(toReturn, FaweCache.MANUAL);
|
||||
}
|
||||
// if (!(toReturn instanceof AbstractDelegateExtent)) {
|
||||
// Fawe.debug("Extent " + toReturn + " must be AbstractDelegateExtent");
|
||||
@ -316,7 +316,7 @@ public class EditSessionBuilder {
|
||||
if (Permission.hasPermission(player, "worldedit.fast")) {
|
||||
player.print(TranslatableComponent.of("fawe.info.worldedit.oom.admin"));
|
||||
}
|
||||
throw FaweCache.INSTANCE.getLOW_MEMORY();
|
||||
throw FaweCache.LOW_MEMORY;
|
||||
}
|
||||
}
|
||||
// this.originalLimit = limit;
|
||||
@ -420,7 +420,7 @@ public class EditSessionBuilder {
|
||||
FaweRegionExtent regionExtent = null;
|
||||
if (allowedRegions != null) {
|
||||
if (allowedRegions.length == 0) {
|
||||
regionExtent = new NullExtent(this.extent, FaweCache.INSTANCE.getNO_REGION());
|
||||
regionExtent = new NullExtent(this.extent, FaweCache.NO_REGION);
|
||||
} else {
|
||||
// this.extent = new ProcessedWEExtent(this.extent, this.limit);
|
||||
if (allowedRegions.length == 1) {
|
||||
|
@ -58,7 +58,7 @@ public class SchemSync implements Runnable {
|
||||
|
||||
private void close(Error error) throws IOException {
|
||||
this.clientSocket.getOutputStream().write(error.ordinal());
|
||||
throw FaweCache.INSTANCE.getMANUAL();
|
||||
throw FaweCache.MANUAL;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -2803,7 +2803,7 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
|
||||
BlockVector3 max = region.getMaximumPoint();
|
||||
BlockVector3 min = region.getMinimumPoint();
|
||||
if (!fe.contains(max.getBlockX(), max.getBlockY(), max.getBlockZ()) && !fe.contains(min.getBlockX(), min.getBlockY(), min.getBlockZ())) {
|
||||
throw FaweCache.INSTANCE.getOUTSIDE_REGION();
|
||||
throw FaweCache.OUTSIDE_REGION;
|
||||
}
|
||||
}
|
||||
final Set<BlockVector2> chunks = region.getChunks();
|
||||
|
@ -128,7 +128,7 @@ public class ClipboardCommands {
|
||||
((long) max.getX() - (long) min.getX() + 1) * ((long) max.getY() - (long) min.getY() + 1) * ((long) max.getZ() - (long) min.getZ() + 1);
|
||||
FaweLimit limit = actor.getLimit();
|
||||
if (volume >= limit.MAX_CHECKS) {
|
||||
throw FaweCache.INSTANCE.getMAX_CHECKS();
|
||||
throw FaweCache.MAX_CHECKS;
|
||||
}
|
||||
session.setClipboard(null);
|
||||
|
||||
@ -235,10 +235,10 @@ public class ClipboardCommands {
|
||||
long volume = (((long) max.getX() - (long) min.getX() + 1) * ((long) max.getY() - (long) min.getY() + 1) * ((long) max.getZ() - (long) min.getZ() + 1));
|
||||
FaweLimit limit = actor.getLimit();
|
||||
if (volume >= limit.MAX_CHECKS) {
|
||||
throw FaweCache.INSTANCE.getMAX_CHECKS();
|
||||
throw FaweCache.MAX_CHECKS;
|
||||
}
|
||||
if (volume >= limit.MAX_CHANGES) {
|
||||
throw FaweCache.INSTANCE.getMAX_CHANGES();
|
||||
throw FaweCache.MAX_CHANGES;
|
||||
}
|
||||
session.setClipboard(null);
|
||||
|
||||
|
@ -422,7 +422,7 @@ public class RegionCommands {
|
||||
long volume = (((long) max.getX() - (long) min.getX() + 1) * ((long) max.getY() - (long) min.getY() + 1) * ((long) max.getZ() - (long) min.getZ() + 1));
|
||||
FaweLimit limit = actor.getLimit();
|
||||
if (volume >= limit.MAX_CHECKS) {
|
||||
throw FaweCache.INSTANCE.getMAX_CHECKS();
|
||||
throw FaweCache.MAX_CHECKS;
|
||||
}
|
||||
int affected = 0;
|
||||
try {
|
||||
|
@ -457,7 +457,7 @@ public interface Extent extends InputExtent, OutputExtent {
|
||||
default boolean cancel() {
|
||||
ExtentTraverser<Extent> traverser = new ExtentTraverser<>(this);
|
||||
|
||||
NullExtent nullExtent = new NullExtent(this, FaweCache.INSTANCE.getMANUAL());
|
||||
NullExtent nullExtent = new NullExtent(this, FaweCache.MANUAL);
|
||||
|
||||
ExtentTraverser<Extent> next = traverser.next();
|
||||
if (next != null) {
|
||||
|
@ -51,7 +51,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
public class MaskingExtent extends AbstractDelegateExtent implements IBatchProcessor, Filter {
|
||||
|
||||
private Mask mask;
|
||||
private LoadingCache<Long, ChunkFilterBlock> threadIdToFilter = FaweCache.INSTANCE.createCache(() -> new CharFilterBlock(getExtent()));
|
||||
private LoadingCache<Long, ChunkFilterBlock> threadIdToFilter = FaweCache.IMP.createCache(() -> new CharFilterBlock(getExtent()));
|
||||
|
||||
/**
|
||||
* Create a new instance.
|
||||
|
@ -268,7 +268,7 @@ public class FastSchematicReader extends NBTSchematicReader {
|
||||
// tiles
|
||||
if (tiles != null && !tiles.isEmpty()) {
|
||||
for (Map<String, Object> tileRaw : tiles) {
|
||||
CompoundTag tile = FaweCache.INSTANCE.asTag(tileRaw);
|
||||
CompoundTag tile = FaweCache.IMP.asTag(tileRaw);
|
||||
|
||||
int[] pos = tile.getIntArray("Pos");
|
||||
int x,y,z;
|
||||
@ -303,7 +303,7 @@ public class FastSchematicReader extends NBTSchematicReader {
|
||||
// entities
|
||||
if (entities != null && !entities.isEmpty()) {
|
||||
for (Map<String, Object> entRaw : entities) {
|
||||
CompoundTag ent = FaweCache.INSTANCE.asTag(entRaw);
|
||||
CompoundTag ent = FaweCache.IMP.asTag(entRaw);
|
||||
|
||||
Map<String, Tag> value = ent.getValue();
|
||||
StringTag id = (StringTag) value.get("Id");
|
||||
|
@ -322,7 +322,7 @@ public class SchematicReader implements ClipboardReader {
|
||||
if (tiles != null && !tiles.isEmpty()) {
|
||||
outer:
|
||||
for (Map<String, Object> tileRaw : tiles) {
|
||||
CompoundTag tile = FaweCache.INSTANCE.asTag(tileRaw);
|
||||
CompoundTag tile = FaweCache.IMP.asTag(tileRaw);
|
||||
int x = (int) tileRaw.get("x");
|
||||
int y = (int) tileRaw.get("y");
|
||||
int z = (int) tileRaw.get("z");
|
||||
@ -350,7 +350,7 @@ public class SchematicReader implements ClipboardReader {
|
||||
entRaw.put("Id", id);
|
||||
EntityType type = EntityTypes.parse(id);
|
||||
if (type != null) {
|
||||
CompoundTag ent = FaweCache.INSTANCE.asTag(entRaw);
|
||||
CompoundTag ent = FaweCache.IMP.asTag(entRaw);
|
||||
for (EntityNBTCompatibilityHandler compat : ENTITY_COMPATIBILITY_HANDLERS) {
|
||||
if (compat.isAffectedEntity(type, ent)) {
|
||||
ent = compat.updateNBT(type, ent);
|
||||
|
@ -107,10 +107,10 @@ public class BlockBagExtent extends AbstractDelegateExtent {
|
||||
try {
|
||||
blockBag.fetchPlacedBlock(block.toImmutableState());
|
||||
} catch (UnplaceableBlockException e) {
|
||||
throw FaweCache.INSTANCE.getBLOCK_BAG();
|
||||
throw FaweCache.BLOCK_BAG;
|
||||
} catch (BlockBagException e) {
|
||||
missingBlocks[block.getBlockType().getInternalId()]++;
|
||||
throw FaweCache.INSTANCE.getBLOCK_BAG();
|
||||
throw FaweCache.BLOCK_BAG;
|
||||
}
|
||||
}
|
||||
if (mine) {
|
||||
|
@ -13,7 +13,7 @@ public class MutableBlockVector3 extends BlockVector3 {
|
||||
}
|
||||
|
||||
public static MutableBlockVector3 get(int x, int y, int z) {
|
||||
return FaweCache.INSTANCE.getMUTABLE_BLOCKVECTOR3().get().setComponents(x, y, z);
|
||||
return FaweCache.IMP.MUTABLE_BLOCKVECTOR3.get().setComponents(x, y, z);
|
||||
}
|
||||
|
||||
public MutableBlockVector3() {}
|
||||
|
@ -10,11 +10,11 @@ public class MutableVector3 extends Vector3 {
|
||||
}
|
||||
|
||||
public static MutableVector3 get(int x, int y, int z) {
|
||||
return FaweCache.INSTANCE.getMUTABLE_VECTOR3().get().setComponents(x, y, z);
|
||||
return FaweCache.IMP.MUTABLE_VECTOR3.get().setComponents(x, y, z);
|
||||
}
|
||||
|
||||
public static MutableVector3 get(double x, double y, double z) {
|
||||
return FaweCache.INSTANCE.getMUTABLE_VECTOR3().get().setComponents(x, y, z);
|
||||
return FaweCache.IMP.MUTABLE_VECTOR3.get().setComponents(x, y, z);
|
||||
}
|
||||
|
||||
public MutableVector3(double x, double y, double z) {
|
||||
|
@ -124,8 +124,8 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion {
|
||||
if (pos1 == null || pos2 == null) {
|
||||
return;
|
||||
}
|
||||
pos1 = pos1.clampY(world == null ? 0 : 0, world == null ? FaweCache.WORLD_MAX_Y : world.getMaxY());
|
||||
pos2 = pos2.clampY(world == null ? 0 : 0, world == null ? FaweCache.WORLD_MAX_Y : world.getMaxY());
|
||||
pos1 = pos1.clampY(world == null ? 0 : 0, world == null ? FaweCache.IMP.WORLD_MAX_Y : world.getMaxY());
|
||||
pos2 = pos2.clampY(world == null ? 0 : 0, world == null ? FaweCache.IMP.WORLD_MAX_Y : world.getMaxY());
|
||||
minX = Math.min(pos1.getX(), pos2.getX());
|
||||
minY = Math.min(pos1.getY(), pos2.getY());
|
||||
minZ = Math.min(pos1.getZ(), pos2.getZ());
|
||||
@ -730,7 +730,7 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion {
|
||||
boolean trimZ = lowerZ != 0 || upperZ != 15;
|
||||
|
||||
int indexY, index;
|
||||
for (int layer = 0; layer < FaweCache.CHUNK_LAYERS; layer++) {
|
||||
for (int layer = 0; layer < FaweCache.IMP.CHUNK_LAYERS; layer++) {
|
||||
if (set.hasSection(layer)) {
|
||||
char[] arr = set.load(layer);
|
||||
if (trimX || trimZ) {
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren