This commit is contained in:
Jesse Boyd 2019-06-29 02:24:57 +10:00
parent ec8422bc13
commit 5a67363a78
No known key found for this signature in database
GPG Key ID: 59F1DE6293AF6E1F
5 changed files with 48 additions and 5 deletions

View File

@ -6,6 +6,7 @@ import com.boydti.fawe.util.TaskManager;
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.bukkit.BukkitAdapter;
import com.sk89q.worldedit.world.biome.BiomeType;
import com.sk89q.worldedit.world.block.BlockID;
import com.sk89q.worldedit.world.block.BlockType;
import com.sk89q.worldedit.world.block.BlockTypes;
import org.bukkit.FluidCollisionMode;
@ -219,11 +220,14 @@ public class AsyncBlock implements Block {
public AsyncBlockState getState() {
int combined = queue.getCombinedId4Data(x, y, z, 0);
BlockType type = BlockTypes.getFromStateId(combined);
if (type == BlockTypes.SIGN || type == BlockTypes.WALL_SIGN) {
switch (type.getInternalId()) {
case BlockID.SIGN:
case BlockID.WALL_SIGN:
return new AsyncSign(this, combined);
}
default:
return new AsyncBlockState(this, combined);
}
}
@NotNull @Override
public AsyncBlockState getState(boolean useSnapshot) {

View File

@ -853,4 +853,33 @@ public class MainUtil {
}
}
public static void warnDeprecated(Class... alternatives) {
StackTraceElement[] stacktrace = new RuntimeException().getStackTrace();
if (stacktrace.length > 1) {
for (int i = 1; i < stacktrace.length; i++) {
StackTraceElement stack = stacktrace[i];
String s = stack.toString();
if (s.startsWith("com.sk89q")) {
continue;
}
try {
StackTraceElement creatorElement = stacktrace[1];
String className = creatorElement.getClassName();
Class clazz = Class.forName(className);
String creator = clazz.getSimpleName();
String packageName = clazz.getPackage().getName();
StackTraceElement deprecatedElement = stack;
String myName = Class.forName(deprecatedElement.getClassName()).getSimpleName();
Fawe.debug("@" + creator + " used by " + myName + "." + deprecatedElement.getMethodName() + "():" + deprecatedElement.getLineNumber() + " is deprecated.");
Fawe.debug(" - Alternatives: " + StringMan.getString(alternatives));
} catch (Throwable throwable) {
throwable.printStackTrace();
} finally {
break;
}
}
}
}
}

View File

@ -1833,7 +1833,7 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
* @throws MaxChangedBlocksException thrown if too many blocks are changed
*/
public int replaceBlocks(Region region, Set<BaseBlock> filter, Pattern pattern) throws MaxChangedBlocksException {
Mask mask = filter == null ? new ExistingBlockMask(this) : new BlockMask(this, filter);
Mask mask = filter == null ? new ExistingBlockMask(this) : new BlockMaskBuilder().addBlocks(filter).build(this);
return replaceBlocks(region, mask, pattern);
}

View File

@ -20,6 +20,7 @@
package com.sk89q.worldedit.function.mask;
import com.boydti.fawe.object.collection.FastBitSet;
import com.boydti.fawe.util.MainUtil;
import com.boydti.fawe.util.StringMan;
import static com.google.common.base.Preconditions.checkNotNull;
@ -47,7 +48,9 @@ import java.util.Map;
*
* <p>This mask checks for both an exact block type and state value match,
* respecting fuzzy status of the BlockState.</p>
* @deprecated use BlockMaskBuilder
*/
@Deprecated
public class BlockMask extends AbstractExtentMask {
private final long[][] bitSets;
@ -62,6 +65,7 @@ public class BlockMask extends AbstractExtentMask {
*/
public BlockMask(Extent extent, Collection<BaseBlock> blocks) {
super(extent);
MainUtil.warnDeprecated(BlockMaskBuilder.class);
checkNotNull(blocks);
this.bitSets = new BlockMaskBuilder().addBlocks(blocks).optimize().getBits();
}
@ -74,6 +78,7 @@ public class BlockMask extends AbstractExtentMask {
*/
public BlockMask(Extent extent, BaseBlock... block) {
super(extent);
MainUtil.warnDeprecated(BlockMaskBuilder.class);
checkNotNull(block);
this.bitSets = new BlockMaskBuilder().addBlocks(block).optimize().getBits();
}

View File

@ -546,7 +546,12 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion {
@Override
public BlockVector2 next() {
if (!hasNext()) throw new NoSuchElementException();
if (!hasNext()) throw new NoSuchElementException() {
@Override
public synchronized Throwable fillInStackTrace() {
return this;
}
};
BlockVector2 answer = BlockVector2.at(nextX, nextZ);
if (++nextX > max.getBlockX()) {
nextX = min.getBlockX();