3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-11-07 12:00:07 +01:00

Fix __reserved__ being solid

Dieser Commit ist enthalten in:
Jesse Boyd 2018-08-17 19:21:45 +10:00
Ursprung 177bfaa930
Commit 43d5459595
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 59F1DE6293AF6E1F
4 geänderte Dateien mit 24 neuen und 3 gelöschten Zeilen

Datei anzeigen

@ -1,5 +1,6 @@
package com.boydti.fawe.bukkit.v0;
import com.boydti.fawe.Fawe;
import com.boydti.fawe.FaweCache;
import com.boydti.fawe.bukkit.util.BukkitReflectionUtils;
import com.boydti.fawe.config.Settings;
@ -21,6 +22,7 @@ import java.lang.reflect.Method;
import java.util.ArrayDeque;
import java.util.Map;
import java.util.concurrent.ConcurrentMap;
import java.util.function.Supplier;
import com.sk89q.worldedit.bukkit.BukkitAdapter;
import com.sk89q.worldedit.world.block.BlockStateHolder;
@ -65,7 +67,7 @@ public class BukkitQueue_All extends BukkitQueue_0<ChunkSnapshot, ChunkSnapshot,
@Override
public void onLoad(Chunk chunk) {
try {
ChunkSnapshot snapshot = chunk.getChunkSnapshot();
ChunkSnapshot snapshot = tryGetSnasphot(chunk);
operation.run(snapshot);
} catch (Throwable e) {
PAPER = false;
@ -302,8 +304,25 @@ public class BukkitQueue_All extends BukkitQueue_0<ChunkSnapshot, ChunkSnapshot,
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) {
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);
return snapshot;
}

Datei anzeigen

@ -49,6 +49,7 @@ public class BukkitBlockRegistry extends BundledBlockRegistry {
public BlockMaterial getMaterial(BlockType blockType) {
Material type = BukkitAdapter.adapt(blockType);
if (type == null) {
if (blockType == BlockTypes.__RESERVED__) return new PassthroughBlockMaterial(super.getMaterial(BlockTypes.AIR));
return new PassthroughBlockMaterial(null);
}
return materialMap.computeIfAbsent(type, m -> new BukkitBlockMaterial(BukkitBlockRegistry.super.getMaterial(blockType), m));

Datei anzeigen

@ -121,7 +121,7 @@ public class ImageBrush implements Brush {
if (color != 0) {
BlockType block = texture.getNearestBlock(color);
if (block != null) {
editSession.setBlock(vector.getBlockX(), vector.getBlockY(), vector.getBlockZ(), block.getDefaultState());
editSession.setBlock(vector, block.getDefaultState());
}
}
return true;

Datei anzeigen

@ -1012,6 +1012,7 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
@Override
public boolean setBlock(Vector position, BlockStateHolder block) throws MaxChangedBlocksException {
this.changes++;
try {
return this.extent.setBlock(position, block);
} catch (MaxChangedBlocksException e) {