mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-02 19:36:41 +00:00
More code quality fixes
This commit is contained in:
@ -1,13 +1,10 @@
|
||||
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;
|
||||
@ -34,7 +31,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.chunkLayers; 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.chunkLayers; 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.chunkLayers).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.chunkLayers; layer++) {
|
||||
if (!this.hasSection(layer) || (bitMask & (1 << layer)) == 0) continue;
|
||||
|
||||
char[] ids = this.load(layer);
|
||||
|
@ -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.worldMaxY, 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.INSTANCE.getSectionBitsToChar().get();
|
||||
MemBlockSet.IRow nullRowY = row.getRow(layer);
|
||||
if (nullRowY instanceof MemBlockSet.RowY) {
|
||||
char value = blockState.getOrdinalChar();
|
||||
|
@ -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.INSTANCE.getSectionBitsToChar().get();
|
||||
int by = layer << 4;
|
||||
for (int y = 0, i = 0; y < 16; y++) {
|
||||
for (int z = 0; z < 16; z++) {
|
||||
|
@ -23,6 +23,7 @@ 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
|
||||
@ -39,7 +40,9 @@ 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() {
|
||||
|
@ -29,22 +29,21 @@ 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;
|
||||
@ -119,7 +118,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.worldHeight);
|
||||
try {
|
||||
return getExtent().getHighestTerrainBlock(x, z, minY, maxY);
|
||||
} catch (FaweException e) {
|
||||
@ -132,7 +131,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.worldHeight);
|
||||
try {
|
||||
return getExtent().getHighestTerrainBlock(x, z, minY, maxY, filter);
|
||||
} catch (FaweException e) {
|
||||
@ -145,7 +144,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.worldHeight);
|
||||
try {
|
||||
return getExtent().getNearestSurfaceLayer(x, z, y, minY, maxY);
|
||||
} catch (FaweException e) {
|
||||
@ -158,7 +157,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.worldHeight);
|
||||
try {
|
||||
return getExtent().getNearestSurfaceTerrainBlock(x, z, y, minY, maxY, ignoreAir);
|
||||
} catch (FaweException e) {
|
||||
@ -171,7 +170,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.worldHeight);
|
||||
try {
|
||||
return getExtent().getNearestSurfaceTerrainBlock(x, z, y, minY, maxY);
|
||||
} catch (FaweException e) {
|
||||
@ -184,7 +183,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.worldHeight);
|
||||
try {
|
||||
return getExtent().getNearestSurfaceTerrainBlock(x, z, y, minY, maxY, failedMin, failedMax);
|
||||
} catch (FaweException e) {
|
||||
@ -197,7 +196,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.worldHeight);
|
||||
try {
|
||||
return getExtent().getNearestSurfaceTerrainBlock(x, z, y, minY, maxY, failedMin, failedMax, mask);
|
||||
} catch (FaweException e) {
|
||||
@ -210,7 +209,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.worldHeight);
|
||||
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.INSTANCE.getManual()));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
Reference in New Issue
Block a user