Revert migration of FaweCache to Kotlin

This commit is contained in:
MattBDev
2020-01-29 15:01:38 -05:00
parent 7d4acbdcac
commit 020c674c01
58 changed files with 647 additions and 673 deletions

View File

@ -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();

View File

@ -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();
}

View File

@ -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++) {

View File

@ -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 {

View File

@ -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();

View File

@ -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);
}

View File

@ -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;
}

View File

@ -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) {

View File

@ -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;

View File

@ -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<>();