Various debugging and cleaning

This commit is contained in:
MattBDev
2020-01-03 12:02:18 -05:00
parent a5ee0b197d
commit cfb6e3bca4
21 changed files with 247 additions and 253 deletions

View File

@ -4,13 +4,10 @@ import com.boydti.fawe.FaweCache;
import com.boydti.fawe.beta.IChunkSet;
import com.boydti.fawe.object.collection.MemBlockSet;
import com.sk89q.jnbt.CompoundTag;
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.math.BlockVector2;
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.BlockStateHolder;
import java.util.Arrays;
import java.util.Collections;
import java.util.Map;

View File

@ -1,9 +1,11 @@
package com.boydti.fawe.beta.implementation.blocks;
import com.boydti.fawe.Fawe;
import com.boydti.fawe.beta.IBlocks;
import com.boydti.fawe.beta.IChunkSet;
import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.block.BlockTypesCache;
import org.jetbrains.annotations.Range;
public abstract class CharBlocks implements IBlocks {
@ -66,7 +68,7 @@ public abstract class CharBlocks implements IBlocks {
return null;
}
public void reset(int layer) {
public void reset(@Range(from = 0, to = 15) int layer) {
sections[layer] = EMPTY;
}
@ -81,12 +83,12 @@ public abstract class CharBlocks implements IBlocks {
}
@Override
public boolean hasSection(int layer) {
public boolean hasSection(@Range(from = 0, to = 15) int layer) {
return sections[layer] == FULL;
}
@Override
public char[] load(int layer) {
public char[] load(@Range(from = 0, to = 15) int layer) {
return sections[layer].get(this, layer);
}
@ -102,6 +104,7 @@ public abstract class CharBlocks implements IBlocks {
}
public void set(int x, int y, int z, char value) {
Fawe.imp().debug("Setting Block at x:" + x + ", y:" + y + " , z:" + z);
final int layer = y >> 4;
final int index = (y & 15) << 8 | z << 4 | x;
set(layer, index, value);
@ -111,11 +114,11 @@ public abstract class CharBlocks implements IBlocks {
Section
*/
public final char get(int layer, int index) {
public final char get(@Range(from = 0, to = 15)int layer, int index) {
return sections[layer].get(this, layer, index);
}
public final void set(int layer, int index, char value) {
public final void set(@Range(from = 0, to = 15) int layer, int index, char value) {
sections[layer].set(this, layer, index, value);
}

View File

@ -250,16 +250,14 @@ public class ChunkHolder<T extends Future<T>> implements IQueueChunk {
}
@Override
public boolean setBiome(ChunkHolder chunk, int x, int y, int z,
BiomeType biome) {
public boolean setBiome(ChunkHolder chunk, int x, int y, int z, BiomeType biome) {
chunk.getOrCreateSet();
chunk.delegate = SET;
return chunk.setBiome(x, y, z, biome);
}
@Override
public boolean setBlock(ChunkHolder chunk, int x, int y, int z,
BlockStateHolder block) {
public boolean setBlock(ChunkHolder chunk, int x, int y, int z, BlockStateHolder block) {
chunk.getOrCreateSet();
chunk.delegate = SET;
return chunk.setBlock(x, y, z, block);
@ -471,11 +469,9 @@ public class ChunkHolder<T extends Future<T>> implements IQueueChunk {
IChunkGet get(ChunkHolder chunk);
IChunkSet set(ChunkHolder chunk);
boolean setBiome(ChunkHolder chunk, int x, int y, int z,
BiomeType biome);
boolean setBiome(ChunkHolder chunk, int x, int y, int z, BiomeType biome);
boolean setBlock(ChunkHolder chunk, int x, int y, int z,
BlockStateHolder holder);
boolean setBlock(ChunkHolder chunk, int x, int y, int z, BlockStateHolder holder);
BiomeType getBiome(ChunkHolder chunk, int x, int y, int z);

View File

@ -33,8 +33,8 @@ import java.util.concurrent.Future;
*/
public class SingleThreadQueueExtent extends ExtentBatchProcessorHolder implements IQueueExtent<IQueueChunk> {
// // Pool discarded chunks for reuse (can safely be cleared by another thread)
// private static final ConcurrentLinkedQueue<IChunk> CHUNK_POOL = new ConcurrentLinkedQueue<>();
// Pool discarded chunks for reuse (can safely be cleared by another thread)
// private static final ConcurrentLinkedQueue<IChunk> CHUNK_POOL = new ConcurrentLinkedQueue<>();
// Chunks currently being queued / worked on
private final Long2ObjectLinkedOpenHashMap<IQueueChunk> chunks = new Long2ObjectLinkedOpenHashMap<>();