mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-04 03:56:41 +00:00
Merge branch '1.15' of https://github.com/IntellectualSites/FastAsyncWorldEdit-1.13 into 1.15
This commit is contained in:
@ -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;
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
@ -104,18 +106,24 @@ public abstract class CharBlocks implements IBlocks {
|
||||
public void set(int x, int y, int z, char value) {
|
||||
final int layer = y >> 4;
|
||||
final int index = (y & 15) << 8 | z << 4 | x;
|
||||
set(layer, index, value);
|
||||
try {
|
||||
set(layer, index, value);
|
||||
} catch (ArrayIndexOutOfBoundsException exception) {
|
||||
Fawe.imp().debug("Tried Setting Block at x:" + x + ", y:" + y + " , z:" + z);
|
||||
Fawe.imp().debug("Layer variable was = " + layer);
|
||||
exception.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
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) throws ArrayIndexOutOfBoundsException {
|
||||
sections[layer].set(this, layer, index, value);
|
||||
}
|
||||
|
||||
|
@ -207,8 +207,7 @@ public class ChunkHolder<T extends Future<T>> implements IQueueChunk {
|
||||
}
|
||||
|
||||
@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) {
|
||||
return chunk.chunkSet.setBlock(x, y, z, block);
|
||||
}
|
||||
|
||||
@ -250,16 +249,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 +468,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);
|
||||
|
||||
|
@ -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<>();
|
||||
|
||||
|
Reference in New Issue
Block a user