Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-11-03 01:50:07 +01:00
*Actually rename section index everywhere
(cherry picked from commit 3ea3bd2a78
)
Dieser Commit ist enthalten in:
Ursprung
7876ab825e
Commit
f5d6d4079a
@ -25,17 +25,17 @@ public class Flood {
|
|||||||
private int chunkYLayer;
|
private int chunkYLayer;
|
||||||
private int chunkZ;
|
private int chunkZ;
|
||||||
private final ConcurrentLinkedQueue<int[]> queuePool = new ConcurrentLinkedQueue<>();
|
private final ConcurrentLinkedQueue<int[]> queuePool = new ConcurrentLinkedQueue<>();
|
||||||
private final int minSectionIndex;
|
private final int minSectionPosition;
|
||||||
private final int maxSectionIndex;
|
private final int maxSectionPosition;
|
||||||
private final int sectionCount;
|
private final int sectionCount;
|
||||||
|
|
||||||
public Flood(int maxBranch, int maxDepth, Direction[] directions, int minSectionIndex, int maxSectionIndex) {
|
public Flood(int maxBranch, int maxDepth, Direction[] directions, int minSectionPosition, int maxSectionPosition) {
|
||||||
this.maxBranch = maxBranch;
|
this.maxBranch = maxBranch;
|
||||||
this.maxDepth = maxDepth;
|
this.maxDepth = maxDepth;
|
||||||
this.directions = directions;
|
this.directions = directions;
|
||||||
this.minSectionIndex = minSectionIndex;
|
this.minSectionPosition = minSectionPosition;
|
||||||
this.maxSectionIndex = maxSectionIndex;
|
this.maxSectionPosition = maxSectionPosition;
|
||||||
this.sectionCount = maxSectionIndex - minSectionIndex + 1;
|
this.sectionCount = maxSectionPosition - minSectionPosition + 1;
|
||||||
|
|
||||||
this.queues = new int[27][];
|
this.queues = new int[27][];
|
||||||
this.visits = new long[27][];
|
this.visits = new long[27][];
|
||||||
@ -70,7 +70,7 @@ public class Flood {
|
|||||||
int chunkX = x >> 4;
|
int chunkX = x >> 4;
|
||||||
int chunkZ = z >> 4;
|
int chunkZ = z >> 4;
|
||||||
long pair = MathMan.pairInt(chunkX, chunkZ);
|
long pair = MathMan.pairInt(chunkX, chunkZ);
|
||||||
int layer = (y >> 4) - minSectionIndex;
|
int layer = (y >> 4) - minSectionPosition;
|
||||||
int[] section = getOrCreateQueue(pair, layer);
|
int[] section = getOrCreateQueue(pair, layer);
|
||||||
int val = (x & 15) + ((z & 15) << 4) + ((y & 15) << 8) + (depth << 12);
|
int val = (x & 15) + ((z & 15) << 4) + ((y & 15) << 8) + (depth << 12);
|
||||||
push(section, val);
|
push(section, val);
|
||||||
@ -160,7 +160,7 @@ public class Flood {
|
|||||||
if (visit == null || queue == null) {
|
if (visit == null || queue == null) {
|
||||||
long pair = MathMan.pairInt(this.chunkX + nextX, this.chunkZ + nextZ);
|
long pair = MathMan.pairInt(this.chunkX + nextX, this.chunkZ + nextZ);
|
||||||
int layer = this.chunkYLayer + nextY;
|
int layer = this.chunkYLayer + nextY;
|
||||||
if (layer < minSectionIndex || layer > maxSectionIndex) {
|
if (layer < minSectionPosition || layer > maxSectionPosition) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
queues[sectionIndex] = queue = getOrCreateQueue(pair, layer);
|
queues[sectionIndex] = queue = getOrCreateQueue(pair, layer);
|
||||||
|
@ -20,21 +20,21 @@ public class BitSetBlocks implements IChunkSet {
|
|||||||
|
|
||||||
private final MemBlockSet.RowZ row;
|
private final MemBlockSet.RowZ row;
|
||||||
private final BlockState blockState;
|
private final BlockState blockState;
|
||||||
private final int minSectionIndex;
|
private final int minSectionPosition;
|
||||||
private final int maxSectionIndex;
|
private final int maxSectionPosition;
|
||||||
private final int layers;
|
private final int layers;
|
||||||
|
|
||||||
public BitSetBlocks(BlockState blockState, int minSectionIndex, int maxSectionIndex) {
|
public BitSetBlocks(BlockState blockState, int minSectionPosition, int maxSectionPosition) {
|
||||||
this.row = new MemBlockSet.RowZ(minSectionIndex, maxSectionIndex);
|
this.row = new MemBlockSet.RowZ(minSectionPosition, maxSectionPosition);
|
||||||
this.blockState = blockState;
|
this.blockState = blockState;
|
||||||
this.minSectionIndex = minSectionIndex;
|
this.minSectionPosition = minSectionPosition;
|
||||||
this.maxSectionIndex = maxSectionIndex;
|
this.maxSectionPosition = maxSectionPosition;
|
||||||
this.layers = maxSectionIndex - minSectionIndex + 1;
|
this.layers = maxSectionPosition - minSectionPosition + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasSection(int layer) {
|
public boolean hasSection(int layer) {
|
||||||
layer -= minSectionIndex;
|
layer -= minSectionPosition;
|
||||||
return row.rows[layer] != MemBlockSet.NULL_ROW_Y;
|
return row.rows[layer] != MemBlockSet.NULL_ROW_Y;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -46,21 +46,21 @@ public class BitSetBlocks implements IChunkSet {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <T extends BlockStateHolder<T>> boolean setBlock(int x, int y, int z, T holder) {
|
public <T extends BlockStateHolder<T>> boolean setBlock(int x, int y, int z, T holder) {
|
||||||
y -= minSectionIndex << 4;
|
y -= minSectionPosition << 4;
|
||||||
row.set(null, x, y, z, minSectionIndex, maxSectionIndex);
|
row.set(null, x, y, z, minSectionPosition, maxSectionPosition);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setBlocks(int layer, char[] data) {
|
public void setBlocks(int layer, char[] data) {
|
||||||
layer -= minSectionIndex;
|
layer -= minSectionPosition;
|
||||||
row.reset(layer);
|
row.reset(layer);
|
||||||
int by = layer << 4;
|
int by = layer << 4;
|
||||||
for (int y = 0, index = 0; y < 16; y++) {
|
for (int y = 0, index = 0; y < 16; y++) {
|
||||||
for (int z = 0; z < 16; z++) {
|
for (int z = 0; z < 16; z++) {
|
||||||
for (int x = 0; x < 16; x++, index++) {
|
for (int x = 0; x < 16; x++, index++) {
|
||||||
if (data[index] != 0) {
|
if (data[index] != 0) {
|
||||||
row.set(null, x, by + y, z, minSectionIndex, maxSectionIndex);
|
row.set(null, x, by + y, z, minSectionPosition, maxSectionPosition);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -123,7 +123,7 @@ public class BitSetBlocks implements IChunkSet {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public char[] load(int layer) {
|
public char[] load(int layer) {
|
||||||
layer -= minSectionIndex;
|
layer -= minSectionPosition;
|
||||||
char[] arr = FaweCache.IMP.SECTION_BITS_TO_CHAR.get();
|
char[] arr = FaweCache.IMP.SECTION_BITS_TO_CHAR.get();
|
||||||
MemBlockSet.IRow nullRowY = row.getRow(layer);
|
MemBlockSet.IRow nullRowY = row.getRow(layer);
|
||||||
if (nullRowY instanceof MemBlockSet.RowY) {
|
if (nullRowY instanceof MemBlockSet.RowY) {
|
||||||
@ -211,12 +211,12 @@ public class BitSetBlocks implements IChunkSet {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMaxSectionPosition() {
|
public int getMaxSectionPosition() {
|
||||||
return minSectionIndex;
|
return minSectionPosition;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMinSectionPosition() {
|
public int getMinSectionPosition() {
|
||||||
return maxSectionIndex;
|
return maxSectionPosition;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -13,8 +13,8 @@ public abstract class CharGetBlocks extends CharBlocks implements IChunkGet {
|
|||||||
/**
|
/**
|
||||||
* New instance given the min/max section indices
|
* New instance given the min/max section indices
|
||||||
*/
|
*/
|
||||||
public CharGetBlocks(final int minSectionIndex, final int maxSectionIndex) {
|
public CharGetBlocks(final int minSectionPosition, final int maxSectionPosition) {
|
||||||
super(minSectionIndex, maxSectionIndex);
|
super(minSectionPosition, maxSectionPosition);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -43,7 +43,7 @@ public abstract class CharGetBlocks extends CharBlocks implements IChunkGet {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public synchronized boolean trim(boolean aggressive, int layer) {
|
public synchronized boolean trim(boolean aggressive, int layer) {
|
||||||
layer -= minSectionIndex;
|
layer -= minSectionPosition;
|
||||||
sections[layer] = empty;
|
sections[layer] = empty;
|
||||||
blocks[layer] = null;
|
blocks[layer] = null;
|
||||||
return true;
|
return true;
|
||||||
|
@ -60,10 +60,10 @@ public class CharSetBlocks extends CharBlocks implements IChunkSet {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BiomeType getBiomeType(int x, int y, int z) {
|
public BiomeType getBiomeType(int x, int y, int z) {
|
||||||
if (biomes == null || (y >> 4) < minSectionIndex || (y >> 4) > maxSectionIndex) {
|
if (biomes == null || (y >> 4) < minSectionPosition || (y >> 4) > maxSectionPosition) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
y -= minSectionIndex << 4;
|
y -= minSectionPosition << 4;
|
||||||
return biomes[(y >> 2) << 4 | (z >> 2) << 2 | x >> 2];
|
return biomes[(y >> 2) << 4 | (z >> 2) << 2 | x >> 2];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -95,7 +95,7 @@ public class CharSetBlocks extends CharBlocks implements IChunkSet {
|
|||||||
@Override
|
@Override
|
||||||
public boolean setBiome(int x, int y, int z, BiomeType biome) {
|
public boolean setBiome(int x, int y, int z, BiomeType biome) {
|
||||||
updateSectionIndexRange(y >> 4);
|
updateSectionIndexRange(y >> 4);
|
||||||
y -= minSectionIndex << 4;
|
y -= minSectionPosition << 4;
|
||||||
if (biomes == null) {
|
if (biomes == null) {
|
||||||
biomes = new BiomeType[64 * sectionCount];
|
biomes = new BiomeType[64 * sectionCount];
|
||||||
}
|
}
|
||||||
@ -114,7 +114,7 @@ public class CharSetBlocks extends CharBlocks implements IChunkSet {
|
|||||||
@Override
|
@Override
|
||||||
public void setBlocks(int layer, char[] data) {
|
public void setBlocks(int layer, char[] data) {
|
||||||
updateSectionIndexRange(layer);
|
updateSectionIndexRange(layer);
|
||||||
layer -= minSectionIndex;
|
layer -= minSectionPosition;
|
||||||
this.blocks[layer] = data;
|
this.blocks[layer] = data;
|
||||||
this.sections[layer] = data == null ? empty : FULL;
|
this.sections[layer] = data == null ? empty : FULL;
|
||||||
}
|
}
|
||||||
@ -141,7 +141,7 @@ public class CharSetBlocks extends CharBlocks implements IChunkSet {
|
|||||||
if (light == null) {
|
if (light == null) {
|
||||||
light = new char[sectionCount][];
|
light = new char[sectionCount][];
|
||||||
}
|
}
|
||||||
final int layer = (y >> 4) - minSectionIndex;
|
final int layer = (y >> 4) - minSectionPosition;
|
||||||
if (light[layer] == null) {
|
if (light[layer] == null) {
|
||||||
char[] c = new char[4096];
|
char[] c = new char[4096];
|
||||||
Arrays.fill(c, (char) 16);
|
Arrays.fill(c, (char) 16);
|
||||||
@ -157,7 +157,7 @@ public class CharSetBlocks extends CharBlocks implements IChunkSet {
|
|||||||
if (skyLight == null) {
|
if (skyLight == null) {
|
||||||
skyLight = new char[sectionCount][];
|
skyLight = new char[sectionCount][];
|
||||||
}
|
}
|
||||||
final int layer = (y >> 4) - minSectionIndex;
|
final int layer = (y >> 4) - minSectionPosition;
|
||||||
if (skyLight[layer] == null) {
|
if (skyLight[layer] == null) {
|
||||||
char[] c = new char[4096];
|
char[] c = new char[4096];
|
||||||
Arrays.fill(c, (char) 16);
|
Arrays.fill(c, (char) 16);
|
||||||
@ -181,7 +181,7 @@ public class CharSetBlocks extends CharBlocks implements IChunkSet {
|
|||||||
if (light == null) {
|
if (light == null) {
|
||||||
light = new char[sectionCount][];
|
light = new char[sectionCount][];
|
||||||
}
|
}
|
||||||
layer -= minSectionIndex;
|
layer -= minSectionPosition;
|
||||||
light[layer] = toSet;
|
light[layer] = toSet;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -191,7 +191,7 @@ public class CharSetBlocks extends CharBlocks implements IChunkSet {
|
|||||||
if (skyLight == null) {
|
if (skyLight == null) {
|
||||||
skyLight = new char[sectionCount][];
|
skyLight = new char[sectionCount][];
|
||||||
}
|
}
|
||||||
layer -= minSectionIndex;
|
layer -= minSectionPosition;
|
||||||
skyLight[layer] = toSet;
|
skyLight[layer] = toSet;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -208,7 +208,7 @@ public class CharSetBlocks extends CharBlocks implements IChunkSet {
|
|||||||
@Override
|
@Override
|
||||||
public void removeSectionLighting(int layer, boolean sky) {
|
public void removeSectionLighting(int layer, boolean sky) {
|
||||||
updateSectionIndexRange(layer);
|
updateSectionIndexRange(layer);
|
||||||
layer -= minSectionIndex;
|
layer -= minSectionPosition;
|
||||||
if (light == null) {
|
if (light == null) {
|
||||||
light = new char[sectionCount][];
|
light = new char[sectionCount][];
|
||||||
}
|
}
|
||||||
@ -230,7 +230,7 @@ public class CharSetBlocks extends CharBlocks implements IChunkSet {
|
|||||||
@Override
|
@Override
|
||||||
public void setFullBright(int layer) {
|
public void setFullBright(int layer) {
|
||||||
updateSectionIndexRange(layer);
|
updateSectionIndexRange(layer);
|
||||||
layer -= minSectionIndex;
|
layer -= minSectionPosition;
|
||||||
if (light == null) {
|
if (light == null) {
|
||||||
light = new char[sectionCount][];
|
light = new char[sectionCount][];
|
||||||
}
|
}
|
||||||
@ -293,7 +293,7 @@ public class CharSetBlocks extends CharBlocks implements IChunkSet {
|
|||||||
if (biomes != null || light != null || skyLight != null) {
|
if (biomes != null || light != null || skyLight != null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return IntStream.range(minSectionIndex, maxSectionIndex + 1).noneMatch(this::hasSection);
|
return IntStream.range(minSectionPosition, maxSectionPosition + 1).noneMatch(this::hasSection);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -308,7 +308,7 @@ public class CharSetBlocks extends CharBlocks implements IChunkSet {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasBiomes(int layer) {
|
public boolean hasBiomes(int layer) {
|
||||||
layer -= minSectionIndex;
|
layer -= minSectionPosition;
|
||||||
if (layer < 0 || layer >= sections.length) {
|
if (layer < 0 || layer >= sections.length) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -328,21 +328,21 @@ public class CharSetBlocks extends CharBlocks implements IChunkSet {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMaxSectionPosition() {
|
public int getMaxSectionPosition() {
|
||||||
return maxSectionIndex;
|
return maxSectionPosition;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMinSectionPosition() {
|
public int getMinSectionPosition() {
|
||||||
return minSectionIndex;
|
return minSectionPosition;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Checks and updates the various section arrays against the new layer index
|
// Checks and updates the various section arrays against the new layer index
|
||||||
private void updateSectionIndexRange(int layer) {
|
private void updateSectionIndexRange(int layer) {
|
||||||
if (layer >= minSectionIndex && layer <= maxSectionIndex) {
|
if (layer >= minSectionPosition && layer <= maxSectionPosition) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (layer < minSectionIndex) {
|
if (layer < minSectionPosition) {
|
||||||
int diff = minSectionIndex - layer;
|
int diff = minSectionPosition - layer;
|
||||||
sectionCount += diff;
|
sectionCount += diff;
|
||||||
char[][] tmpBlocks = new char[sectionCount][];
|
char[][] tmpBlocks = new char[sectionCount][];
|
||||||
Section[] tmpSections = new Section[sectionCount];
|
Section[] tmpSections = new Section[sectionCount];
|
||||||
@ -353,7 +353,7 @@ public class CharSetBlocks extends CharBlocks implements IChunkSet {
|
|||||||
}
|
}
|
||||||
blocks = tmpBlocks;
|
blocks = tmpBlocks;
|
||||||
sections = tmpSections;
|
sections = tmpSections;
|
||||||
minSectionIndex = layer;
|
minSectionPosition = layer;
|
||||||
if (biomes != null) {
|
if (biomes != null) {
|
||||||
BiomeType[] tmpBiomes = new BiomeType[sectionCount * 64];
|
BiomeType[] tmpBiomes = new BiomeType[sectionCount * 64];
|
||||||
System.arraycopy(biomes, 0, tmpBiomes, 64 * diff, biomes.length);
|
System.arraycopy(biomes, 0, tmpBiomes, 64 * diff, biomes.length);
|
||||||
@ -370,7 +370,7 @@ public class CharSetBlocks extends CharBlocks implements IChunkSet {
|
|||||||
skyLight = tmplight;
|
skyLight = tmplight;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
int diff = layer - maxSectionIndex;
|
int diff = layer - maxSectionPosition;
|
||||||
sectionCount += diff;
|
sectionCount += diff;
|
||||||
char[][] tmpBlocks = new char[sectionCount][];
|
char[][] tmpBlocks = new char[sectionCount][];
|
||||||
Section[] tmpSections = new Section[sectionCount];
|
Section[] tmpSections = new Section[sectionCount];
|
||||||
@ -381,7 +381,7 @@ public class CharSetBlocks extends CharBlocks implements IChunkSet {
|
|||||||
}
|
}
|
||||||
blocks = tmpBlocks;
|
blocks = tmpBlocks;
|
||||||
sections = tmpSections;
|
sections = tmpSections;
|
||||||
maxSectionIndex = layer;
|
maxSectionPosition = layer;
|
||||||
if (biomes != null) {
|
if (biomes != null) {
|
||||||
BiomeType[] tmpBiomes = new BiomeType[sectionCount * 64];
|
BiomeType[] tmpBiomes = new BiomeType[sectionCount * 64];
|
||||||
System.arraycopy(biomes, 0, tmpBiomes, 0, biomes.length);
|
System.arraycopy(biomes, 0, tmpBiomes, 0, biomes.length);
|
||||||
|
@ -82,7 +82,7 @@ public final class NullChunkGet implements IChunkGet {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setSkyLightingToGet(char[][] lighting, int minSectionIndex, int maxSectionIndex) {
|
public void setSkyLightingToGet(char[][] lighting, int minSectionPosition, int maxSectionPosition) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -165,12 +165,12 @@ public class ChunkHolder<T extends Future<T>> implements IQueueChunk<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setLightingToGet(char[][] lighting, int minSectionIndex, int maxSectionIndex) {
|
public void setLightingToGet(char[][] lighting, int minSectionPosition, int maxSectionPosition) {
|
||||||
delegate.setLightingToGet(this, lighting);
|
delegate.setLightingToGet(this, lighting);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setSkyLightingToGet(char[][] lighting, int minSectionIndex, int maxSectionIndex) {
|
public void setSkyLightingToGet(char[][] lighting, int minSectionPosition, int maxSectionPosition) {
|
||||||
delegate.setSkyLightingToGet(this, lighting);
|
delegate.setSkyLightingToGet(this, lighting);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -187,11 +187,11 @@ public final class NullChunk implements IQueueChunk {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setLightingToGet(char[][] lighting, int minSectionIndex, int maxSectionIndex) {
|
public void setLightingToGet(char[][] lighting, int minSectionPosition, int maxSectionPosition) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setSkyLightingToGet(char[][] lighting, int minSectionIndex, int maxSectionIndex) {
|
public void setSkyLightingToGet(char[][] lighting, int minSectionPosition, int maxSectionPosition) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -28,17 +28,17 @@ public final class MemBlockSet extends BlockSet {
|
|||||||
public static final IRow NULL_ROW_Y = new NullRowY();
|
public static final IRow NULL_ROW_Y = new NullRowY();
|
||||||
public final IRow[] rows;
|
public final IRow[] rows;
|
||||||
public final MutableBlockVector3 mutable;
|
public final MutableBlockVector3 mutable;
|
||||||
private final int minSectionIndex;
|
private final int minSectionPosition;
|
||||||
private final int maxSectionIndex;
|
private final int maxSectionPosition;
|
||||||
|
|
||||||
public MemBlockSet(int size, int offsetX, int offsetZ, int minSectionIndex, int maxSectionIndex) {
|
public MemBlockSet(int size, int offsetX, int offsetZ, int minSectionPosition, int maxSectionPosition) {
|
||||||
super(offsetX, offsetZ);
|
super(offsetX, offsetZ);
|
||||||
this.rows = new IRow[size];
|
this.rows = new IRow[size];
|
||||||
for (int i = 0; i < size; i++) {
|
for (int i = 0; i < size; i++) {
|
||||||
rows[i] = NULL_ROW_X;
|
rows[i] = NULL_ROW_X;
|
||||||
}
|
}
|
||||||
this.minSectionIndex = minSectionIndex;
|
this.minSectionPosition = minSectionPosition;
|
||||||
this.maxSectionIndex = maxSectionIndex;
|
this.maxSectionPosition = maxSectionPosition;
|
||||||
this.mutable = new MutableBlockVector3();
|
this.mutable = new MutableBlockVector3();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,14 +53,14 @@ public final class MemBlockSet extends BlockSet {
|
|||||||
public boolean add(int x, int y, int z) {
|
public boolean add(int x, int y, int z) {
|
||||||
x -= getBlockOffsetX();
|
x -= getBlockOffsetX();
|
||||||
z -= getBlockOffsetZ();
|
z -= getBlockOffsetZ();
|
||||||
return rows[x >> 4].add(this.rows, x, y, z - getBlockOffsetZ(), minSectionIndex, maxSectionIndex);
|
return rows[x >> 4].add(this.rows, x, y, z - getBlockOffsetZ(), minSectionPosition, maxSectionPosition);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void set(int x, int y, int z) {
|
public void set(int x, int y, int z) {
|
||||||
x -= getBlockOffsetX();
|
x -= getBlockOffsetX();
|
||||||
z -= getBlockOffsetZ();
|
z -= getBlockOffsetZ();
|
||||||
rows[x >> 4].set(this.rows, x, y, z - getBlockOffsetZ(), minSectionIndex, maxSectionIndex);
|
rows[x >> 4].set(this.rows, x, y, z - getBlockOffsetZ(), minSectionPosition, maxSectionPosition);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -234,7 +234,7 @@ public final class MemBlockSet extends BlockSet {
|
|||||||
@Override
|
@Override
|
||||||
public BlockVector3 next() {
|
public BlockVector3 next() {
|
||||||
mutable.setComponents(
|
mutable.setComponents(
|
||||||
setX + getBlockOffsetX(), setY - (minSectionIndex << 4), setZ + getBlockOffsetX());
|
setX + getBlockOffsetX(), setY - (minSectionPosition << 4), setZ + getBlockOffsetX());
|
||||||
init();
|
init();
|
||||||
return mutable;
|
return mutable;
|
||||||
}
|
}
|
||||||
@ -282,7 +282,7 @@ public final class MemBlockSet extends BlockSet {
|
|||||||
if (rowx instanceof RowX) {
|
if (rowx instanceof RowX) {
|
||||||
IRow rowz = ((RowX) rowx).rows[other.getZ()];
|
IRow rowz = ((RowX) rowx).rows[other.getZ()];
|
||||||
if (rowz instanceof RowZ) {
|
if (rowz instanceof RowZ) {
|
||||||
return ((RowZ) rowz).rows[other.getY() - (minSectionIndex << 4) - getChunkOffsetZ()] instanceof RowY;
|
return ((RowZ) rowz).rows[other.getY() - (minSectionPosition << 4) - getChunkOffsetZ()] instanceof RowY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -293,7 +293,7 @@ public final class MemBlockSet extends BlockSet {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMinimumY() {
|
public int getMinimumY() {
|
||||||
int maxY = maxSectionIndex;
|
int maxY = maxSectionPosition;
|
||||||
int maxy = 16;
|
int maxy = 16;
|
||||||
int by = Integer.MAX_VALUE;
|
int by = Integer.MAX_VALUE;
|
||||||
for (IRow nullRowX : rows) {
|
for (IRow nullRowX : rows) {
|
||||||
@ -357,7 +357,7 @@ public final class MemBlockSet extends BlockSet {
|
|||||||
}
|
}
|
||||||
RowZ rowz = (RowZ) nullRowZ;
|
RowZ rowz = (RowZ) nullRowZ;
|
||||||
outer:
|
outer:
|
||||||
for (int Y = maxSectionIndex; Y >= maxY; Y--) {
|
for (int Y = maxSectionPosition; Y >= maxY; Y--) {
|
||||||
IRow nullRowY = rowz.rows[Y];
|
IRow nullRowY = rowz.rows[Y];
|
||||||
if (!(nullRowY instanceof RowY)) {
|
if (!(nullRowY instanceof RowY)) {
|
||||||
continue;
|
continue;
|
||||||
@ -376,8 +376,8 @@ public final class MemBlockSet extends BlockSet {
|
|||||||
maxy = y + 1;
|
maxy = y + 1;
|
||||||
}
|
}
|
||||||
by = (Y << 4) + y;
|
by = (Y << 4) + y;
|
||||||
if (by == (maxSectionIndex << 4) + 15) {
|
if (by == (maxSectionPosition << 4) + 15) {
|
||||||
return (maxSectionIndex << 4) + 15;
|
return (maxSectionPosition << 4) + 15;
|
||||||
}
|
}
|
||||||
break outer;
|
break outer;
|
||||||
}
|
}
|
||||||
@ -582,7 +582,7 @@ public final class MemBlockSet extends BlockSet {
|
|||||||
if (!(nullRowY instanceof RowY)) {
|
if (!(nullRowY instanceof RowY)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
int by = ((Y - minSectionIndex) << 4);
|
int by = ((Y - minSectionPosition) << 4);
|
||||||
RowY rowY = (RowY) nullRowY;
|
RowY rowY = (RowY) nullRowY;
|
||||||
for (int y = 0, i = 0; y < 16; y++) {
|
for (int y = 0, i = 0; y < 16; y++) {
|
||||||
for (int z = 0; z < 16; z += 4, i++) {
|
for (int z = 0; z < 16; z += 4, i++) {
|
||||||
@ -817,10 +817,10 @@ public final class MemBlockSet extends BlockSet {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void set(IRow[] rows, int x, int y, int z, int minSectionIndex, int maxSectionIndex);
|
void set(IRow[] rows, int x, int y, int z, int minSectionPosition, int maxSectionPosition);
|
||||||
|
|
||||||
default boolean add(IRow[] rows, int x, int y, int z, int minSectionIndex, int maxSectionIndex) {
|
default boolean add(IRow[] rows, int x, int y, int z, int minSectionPosition, int maxSectionPosition) {
|
||||||
set(rows, x, y, z, minSectionIndex, maxSectionIndex);
|
set(rows, x, y, z, minSectionPosition, maxSectionPosition);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -837,10 +837,10 @@ public final class MemBlockSet extends BlockSet {
|
|||||||
public static final class NullRowX implements IRow {
|
public static final class NullRowX implements IRow {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void set(IRow[] parent, int x, int y, int z, int minSectionIndex, int maxSectionIndex) {
|
public void set(IRow[] parent, int x, int y, int z, int minSectionPosition, int maxSectionPosition) {
|
||||||
IRow row = new RowX(parent.length);
|
IRow row = new RowX(parent.length);
|
||||||
parent[x >> 4] = row;
|
parent[x >> 4] = row;
|
||||||
row.set(parent, x, y, z, minSectionIndex, maxSectionIndex);
|
row.set(parent, x, y, z, minSectionPosition, maxSectionPosition);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -848,10 +848,10 @@ public final class MemBlockSet extends BlockSet {
|
|||||||
public static final class NullRowZ implements IRow {
|
public static final class NullRowZ implements IRow {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void set(IRow[] parent, int x, int y, int z, int minSectionIndex, int maxSectionIndex) {
|
public void set(IRow[] parent, int x, int y, int z, int minSectionPosition, int maxSectionPosition) {
|
||||||
IRow row = new RowZ(minSectionIndex, maxSectionIndex);
|
IRow row = new RowZ(minSectionPosition, maxSectionPosition);
|
||||||
parent[z >> 4] = row;
|
parent[z >> 4] = row;
|
||||||
row.set(parent, x, y, z, minSectionIndex, maxSectionIndex);
|
row.set(parent, x, y, z, minSectionPosition, maxSectionPosition);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -859,10 +859,10 @@ public final class MemBlockSet extends BlockSet {
|
|||||||
public static final class NullRowY implements IRow {
|
public static final class NullRowY implements IRow {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void set(IRow[] parent, int x, int y, int z, int minSectionIndex, int maxSectionIndex) {
|
public void set(IRow[] parent, int x, int y, int z, int minSectionPosition, int maxSectionPosition) {
|
||||||
IRow row = new RowY();
|
IRow row = new RowY();
|
||||||
parent[y >> 4] = row;
|
parent[y >> 4] = row;
|
||||||
row.set(parent, x, y, z, minSectionIndex, maxSectionIndex);
|
row.set(parent, x, y, z, minSectionPosition, maxSectionPosition);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -884,13 +884,13 @@ public final class MemBlockSet extends BlockSet {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void set(IRow[] parent, int x, int y, int z, int minSectionIndex, int maxSectionIndex) {
|
public void set(IRow[] parent, int x, int y, int z, int minSectionPosition, int maxSectionPosition) {
|
||||||
this.rows[z >> 4].set(this.rows, x, y, z, minSectionIndex, maxSectionIndex);
|
this.rows[z >> 4].set(this.rows, x, y, z, minSectionPosition, maxSectionPosition);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean add(IRow[] parent, int x, int y, int z, int minSectionIndex, int maxSectionIndex) {
|
public boolean add(IRow[] parent, int x, int y, int z, int minSectionPosition, int maxSectionPosition) {
|
||||||
return this.rows[z >> 4].add(this.rows, x, y, z, minSectionIndex, maxSectionIndex);
|
return this.rows[z >> 4].add(this.rows, x, y, z, minSectionPosition, maxSectionPosition);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -909,8 +909,8 @@ public final class MemBlockSet extends BlockSet {
|
|||||||
|
|
||||||
public final IRow[] rows;
|
public final IRow[] rows;
|
||||||
|
|
||||||
public RowZ(int minSectionIndex, int maxSectionIndex) {
|
public RowZ(int minSectionPosition, int maxSectionPosition) {
|
||||||
this.rows = new IRow[maxSectionIndex - minSectionIndex + 1];
|
this.rows = new IRow[maxSectionPosition - minSectionPosition + 1];
|
||||||
reset();
|
reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -924,13 +924,13 @@ public final class MemBlockSet extends BlockSet {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void set(IRow[] parent, int x, int y, int z, int minSectionIndex, int maxSectionIndex) {
|
public void set(IRow[] parent, int x, int y, int z, int minSectionPosition, int maxSectionPosition) {
|
||||||
this.rows[y >> 4].set(this.rows, x, y, z, minSectionIndex, maxSectionIndex);
|
this.rows[y >> 4].set(this.rows, x, y, z, minSectionPosition, maxSectionPosition);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean add(IRow[] parent, int x, int y, int z, int minSectionIndex, int maxSectionIndex) {
|
public boolean add(IRow[] parent, int x, int y, int z, int minSectionPosition, int maxSectionPosition) {
|
||||||
return this.rows[y >> 4].add(this.rows, x, y, z, minSectionIndex, maxSectionIndex);
|
return this.rows[y >> 4].add(this.rows, x, y, z, minSectionPosition, maxSectionPosition);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -982,13 +982,13 @@ public final class MemBlockSet extends BlockSet {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void set(IRow[] parent, int x, int y, int z, int minSectionIndex, int maxSectionIndex) {
|
public void set(IRow[] parent, int x, int y, int z, int minSectionPosition, int maxSectionPosition) {
|
||||||
int i = ((y & 15) << 8) | ((z & 15) << 4) | (x & 15);
|
int i = ((y & 15) << 8) | ((z & 15) << 4) | (x & 15);
|
||||||
bits[i >> 6] |= (1L << (i & 0x3F));
|
bits[i >> 6] |= (1L << (i & 0x3F));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean add(IRow[] parent, int x, int y, int z, int minSectionIndex, int maxSectionIndex) {
|
public boolean add(IRow[] parent, int x, int y, int z, int minSectionPosition, int maxSectionPosition) {
|
||||||
int i = ((y & 15) << 8) | ((z & 15) << 4) | (x & 15);
|
int i = ((y & 15) << 8) | ((z & 15) << 4) | (x & 15);
|
||||||
int offset = i >> 6;
|
int offset = i >> 6;
|
||||||
long value = bits[offset];
|
long value = bits[offset];
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren