Revert "More code quality fixes"

This reverts commit 2d6957ce
This commit is contained in:
MattBDev
2020-01-23 14:41:57 -05:00
parent 37003ec089
commit e0f6869573
115 changed files with 1688 additions and 686 deletions

View File

@ -1,10 +1,13 @@
package com.boydti.fawe.beta;
import com.boydti.fawe.FaweCache;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import com.sk89q.jnbt.CompoundTag;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.world.biome.BiomeType;
import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.block.BlockType;
import com.sk89q.worldedit.world.block.BlockTypes;
import java.util.HashMap;
@ -31,7 +34,7 @@ public class CombinedBlocks implements IBlocks {
@Override
public int getBitMask() {
int bitMask = addMask;
for (int layer = 0; layer < FaweCache.chunkLayers; layer++) {
for (int layer = 0; layer < FaweCache.CHUNK_LAYERS; layer++) {
if (primary.hasSection(layer)) {
bitMask |= (1 << layer);
}

View File

@ -56,7 +56,7 @@ public interface IBatchProcessor {
}
}
int maxLayer = (maxY + 1) >> 4;
for (int layer = maxLayer; layer < FaweCache.chunkLayers; layer++) {
for (int layer = maxLayer; layer < FaweCache.CHUNK_LAYERS; layer++) {
if (set.hasSection(layer)) {
if (layer == minLayer) {
char[] arr = set.load(layer);

View File

@ -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.chunkLayers).filter(this::hasSection)
return IntStream.range(0, FaweCache.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.chunkLayers; layer++) {
for (int layer = 0; layer < FaweCache.CHUNK_LAYERS; layer++) {
if (!this.hasSection(layer) || (bitMask & (1 << layer)) == 0) continue;
char[] ids = this.load(layer);

View File

@ -78,7 +78,7 @@ public interface IQueueExtent<T extends IChunk> extends Flushable, Trimable, ICh
@Override
default BlockVector3 getMaximumPoint() {
return BlockVector3.at(30000000, FaweCache.worldMaxY, 30000000);
return BlockVector3.at(30000000, FaweCache.WORLD_MAX_Y, 30000000);
}
/**

View File

@ -84,7 +84,7 @@ public class BitSetBlocks implements IChunkSet {
@Override
public char[] load(int layer) {
char[] arr = FaweCache.INSTANCE.getSectionBitsToChar().get();
char[] arr = FaweCache.INSTANCE.getSECTION_BITS_TO_CHAR().get();
MemBlockSet.IRow nullRowY = row.getRow(layer);
if (nullRowY instanceof MemBlockSet.RowY) {
char value = blockState.getOrdinalChar();

View File

@ -142,7 +142,7 @@ public class FallbackChunkGet implements IChunkGet {
@Override
public char[] load(int layer) {
char[] arr = FaweCache.INSTANCE.getSectionBitsToChar().get();
char[] arr = FaweCache.INSTANCE.getSECTION_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

@ -23,7 +23,6 @@ import java.util.Set;
import java.util.UUID;
import java.util.concurrent.Future;
import javax.annotation.Nullable;
import org.jetbrains.annotations.Range;
/**
* An abstract {@link IChunk} class that implements basic get/set blocks
@ -40,9 +39,7 @@ public class ChunkHolder<T extends Future<T>> implements IQueueChunk<T> {
private IChunkSet chunkSet; // The blocks to be set to the chunkExisting
private IBlockDelegate delegate; // delegate handles the abstraction of the chunk layers
private IQueueExtent extent; // the parent queue extent which has this chunk
@Range(from = 0, to = 15)
private int chunkX;
@Range(from = 0, to = 15)
private int chunkZ;
public ChunkHolder() {

View File

@ -29,21 +29,22 @@ import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.block.BlockStateHolder;
import com.sk89q.worldedit.world.block.BlockType;
import com.sk89q.worldedit.world.block.BlockTypes;
import javax.annotation.Nullable;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Set;
import java.util.UUID;
import javax.annotation.Nullable;
public class LimitExtent extends PassthroughExtent {
private final FaweLimit limit;
/**
* Create a new instance.
*
* @param extent the extent
*/
* Create a new instance.
*
* @param extent the extent
*/
public LimitExtent(Extent extent, FaweLimit limit) {
super(extent);
this.limit = limit;
@ -118,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.worldHeight);
limit.THROW_MAX_CHECKS(FaweCache.WORLD_HEIGHT);
try {
return getExtent().getHighestTerrainBlock(x, z, minY, maxY);
} catch (FaweException e) {
@ -131,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.worldHeight);
limit.THROW_MAX_CHECKS(FaweCache.WORLD_HEIGHT);
try {
return getExtent().getHighestTerrainBlock(x, z, minY, maxY, filter);
} catch (FaweException e) {
@ -144,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.worldHeight);
limit.THROW_MAX_CHECKS(FaweCache.WORLD_HEIGHT);
try {
return getExtent().getNearestSurfaceLayer(x, z, y, minY, maxY);
} catch (FaweException e) {
@ -157,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.worldHeight);
limit.THROW_MAX_CHECKS(FaweCache.WORLD_HEIGHT);
try {
return getExtent().getNearestSurfaceTerrainBlock(x, z, y, minY, maxY, ignoreAir);
} catch (FaweException e) {
@ -170,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.worldHeight);
limit.THROW_MAX_CHECKS(FaweCache.WORLD_HEIGHT);
try {
return getExtent().getNearestSurfaceTerrainBlock(x, z, y, minY, maxY);
} catch (FaweException e) {
@ -183,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.worldHeight);
limit.THROW_MAX_CHECKS(FaweCache.WORLD_HEIGHT);
try {
return getExtent().getNearestSurfaceTerrainBlock(x, z, y, minY, maxY, failedMin, failedMax);
} catch (FaweException e) {
@ -196,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.worldHeight);
limit.THROW_MAX_CHECKS(FaweCache.WORLD_HEIGHT);
try {
return getExtent().getNearestSurfaceTerrainBlock(x, z, y, minY, maxY, failedMin, failedMax, mask);
} catch (FaweException e) {
@ -209,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.worldHeight);
limit.THROW_MAX_CHECKS(FaweCache.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.INSTANCE.getMANUAL()));
return true;
}
return false;