mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-23 01:37:37 +00:00
Fix __reserved__ being solid
This commit is contained in:
parent
177bfaa930
commit
43d5459595
@ -1,5 +1,6 @@
|
|||||||
package com.boydti.fawe.bukkit.v0;
|
package com.boydti.fawe.bukkit.v0;
|
||||||
|
|
||||||
|
import com.boydti.fawe.Fawe;
|
||||||
import com.boydti.fawe.FaweCache;
|
import com.boydti.fawe.FaweCache;
|
||||||
import com.boydti.fawe.bukkit.util.BukkitReflectionUtils;
|
import com.boydti.fawe.bukkit.util.BukkitReflectionUtils;
|
||||||
import com.boydti.fawe.config.Settings;
|
import com.boydti.fawe.config.Settings;
|
||||||
@ -21,6 +22,7 @@ import java.lang.reflect.Method;
|
|||||||
import java.util.ArrayDeque;
|
import java.util.ArrayDeque;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.ConcurrentMap;
|
import java.util.concurrent.ConcurrentMap;
|
||||||
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
||||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||||
@ -65,7 +67,7 @@ public class BukkitQueue_All extends BukkitQueue_0<ChunkSnapshot, ChunkSnapshot,
|
|||||||
@Override
|
@Override
|
||||||
public void onLoad(Chunk chunk) {
|
public void onLoad(Chunk chunk) {
|
||||||
try {
|
try {
|
||||||
ChunkSnapshot snapshot = chunk.getChunkSnapshot();
|
ChunkSnapshot snapshot = tryGetSnasphot(chunk);
|
||||||
operation.run(snapshot);
|
operation.run(snapshot);
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
PAPER = false;
|
PAPER = false;
|
||||||
@ -302,8 +304,25 @@ public class BukkitQueue_All extends BukkitQueue_0<ChunkSnapshot, ChunkSnapshot,
|
|||||||
return chunk.isLoaded() ? getAndCacheChunk(chunk) : null;
|
return chunk.isLoaded() ? getAndCacheChunk(chunk) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private ChunkSnapshot tryGetSnasphot(Chunk chunk) {
|
||||||
|
try {
|
||||||
|
return chunk.getChunkSnapshot(false, true, false);
|
||||||
|
} catch (IllegalStateException ignore) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private ChunkSnapshot getAndCacheChunk(Chunk chunk) {
|
private ChunkSnapshot getAndCacheChunk(Chunk chunk) {
|
||||||
ChunkSnapshot snapshot = chunk.getChunkSnapshot(false, true, false);
|
ChunkSnapshot snapshot = tryGetSnasphot(chunk);
|
||||||
|
if (snapshot == null) {
|
||||||
|
snapshot = tryGetSnasphot(chunk);
|
||||||
|
if (snapshot == null) {
|
||||||
|
snapshot = TaskManager.IMP.sync(() -> tryGetSnasphot(chunk));
|
||||||
|
if (snapshot == null) {
|
||||||
|
snapshot = chunk.getChunkSnapshot(false, true, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
chunkCache.put(MathMan.pairInt(chunk.getX(), chunk.getZ()), snapshot);
|
chunkCache.put(MathMan.pairInt(chunk.getX(), chunk.getZ()), snapshot);
|
||||||
return snapshot;
|
return snapshot;
|
||||||
}
|
}
|
||||||
|
@ -49,6 +49,7 @@ public class BukkitBlockRegistry extends BundledBlockRegistry {
|
|||||||
public BlockMaterial getMaterial(BlockType blockType) {
|
public BlockMaterial getMaterial(BlockType blockType) {
|
||||||
Material type = BukkitAdapter.adapt(blockType);
|
Material type = BukkitAdapter.adapt(blockType);
|
||||||
if (type == null) {
|
if (type == null) {
|
||||||
|
if (blockType == BlockTypes.__RESERVED__) return new PassthroughBlockMaterial(super.getMaterial(BlockTypes.AIR));
|
||||||
return new PassthroughBlockMaterial(null);
|
return new PassthroughBlockMaterial(null);
|
||||||
}
|
}
|
||||||
return materialMap.computeIfAbsent(type, m -> new BukkitBlockMaterial(BukkitBlockRegistry.super.getMaterial(blockType), m));
|
return materialMap.computeIfAbsent(type, m -> new BukkitBlockMaterial(BukkitBlockRegistry.super.getMaterial(blockType), m));
|
||||||
|
@ -121,7 +121,7 @@ public class ImageBrush implements Brush {
|
|||||||
if (color != 0) {
|
if (color != 0) {
|
||||||
BlockType block = texture.getNearestBlock(color);
|
BlockType block = texture.getNearestBlock(color);
|
||||||
if (block != null) {
|
if (block != null) {
|
||||||
editSession.setBlock(vector.getBlockX(), vector.getBlockY(), vector.getBlockZ(), block.getDefaultState());
|
editSession.setBlock(vector, block.getDefaultState());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -1012,6 +1012,7 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean setBlock(Vector position, BlockStateHolder block) throws MaxChangedBlocksException {
|
public boolean setBlock(Vector position, BlockStateHolder block) throws MaxChangedBlocksException {
|
||||||
|
this.changes++;
|
||||||
try {
|
try {
|
||||||
return this.extent.setBlock(position, block);
|
return this.extent.setBlock(position, block);
|
||||||
} catch (MaxChangedBlocksException e) {
|
} catch (MaxChangedBlocksException e) {
|
||||||
|
Loading…
Reference in New Issue
Block a user