Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-11-07 20:10:06 +01:00
Dieser Commit ist enthalten in:
Ursprung
ec8422bc13
Commit
5a67363a78
@ -6,6 +6,7 @@ import com.boydti.fawe.util.TaskManager;
|
|||||||
import com.sk89q.worldedit.WorldEditException;
|
import com.sk89q.worldedit.WorldEditException;
|
||||||
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
||||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
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.BlockType;
|
||||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||||
import org.bukkit.FluidCollisionMode;
|
import org.bukkit.FluidCollisionMode;
|
||||||
@ -219,10 +220,13 @@ public class AsyncBlock implements Block {
|
|||||||
public AsyncBlockState getState() {
|
public AsyncBlockState getState() {
|
||||||
int combined = queue.getCombinedId4Data(x, y, z, 0);
|
int combined = queue.getCombinedId4Data(x, y, z, 0);
|
||||||
BlockType type = BlockTypes.getFromStateId(combined);
|
BlockType type = BlockTypes.getFromStateId(combined);
|
||||||
if (type == BlockTypes.SIGN || type == BlockTypes.WALL_SIGN) {
|
switch (type.getInternalId()) {
|
||||||
return new AsyncSign(this, combined);
|
case BlockID.SIGN:
|
||||||
|
case BlockID.WALL_SIGN:
|
||||||
|
return new AsyncSign(this, combined);
|
||||||
|
default:
|
||||||
|
return new AsyncBlockState(this, combined);
|
||||||
}
|
}
|
||||||
return new AsyncBlockState(this, combined);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull @Override
|
@NotNull @Override
|
||||||
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1833,7 +1833,7 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
|
|||||||
* @throws MaxChangedBlocksException thrown if too many blocks are changed
|
* @throws MaxChangedBlocksException thrown if too many blocks are changed
|
||||||
*/
|
*/
|
||||||
public int replaceBlocks(Region region, Set<BaseBlock> filter, Pattern pattern) throws MaxChangedBlocksException {
|
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);
|
return replaceBlocks(region, mask, pattern);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
package com.sk89q.worldedit.function.mask;
|
package com.sk89q.worldedit.function.mask;
|
||||||
|
|
||||||
import com.boydti.fawe.object.collection.FastBitSet;
|
import com.boydti.fawe.object.collection.FastBitSet;
|
||||||
|
import com.boydti.fawe.util.MainUtil;
|
||||||
import com.boydti.fawe.util.StringMan;
|
import com.boydti.fawe.util.StringMan;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
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,
|
* <p>This mask checks for both an exact block type and state value match,
|
||||||
* respecting fuzzy status of the BlockState.</p>
|
* respecting fuzzy status of the BlockState.</p>
|
||||||
|
* @deprecated use BlockMaskBuilder
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public class BlockMask extends AbstractExtentMask {
|
public class BlockMask extends AbstractExtentMask {
|
||||||
|
|
||||||
private final long[][] bitSets;
|
private final long[][] bitSets;
|
||||||
@ -62,6 +65,7 @@ public class BlockMask extends AbstractExtentMask {
|
|||||||
*/
|
*/
|
||||||
public BlockMask(Extent extent, Collection<BaseBlock> blocks) {
|
public BlockMask(Extent extent, Collection<BaseBlock> blocks) {
|
||||||
super(extent);
|
super(extent);
|
||||||
|
MainUtil.warnDeprecated(BlockMaskBuilder.class);
|
||||||
checkNotNull(blocks);
|
checkNotNull(blocks);
|
||||||
this.bitSets = new BlockMaskBuilder().addBlocks(blocks).optimize().getBits();
|
this.bitSets = new BlockMaskBuilder().addBlocks(blocks).optimize().getBits();
|
||||||
}
|
}
|
||||||
@ -74,6 +78,7 @@ public class BlockMask extends AbstractExtentMask {
|
|||||||
*/
|
*/
|
||||||
public BlockMask(Extent extent, BaseBlock... block) {
|
public BlockMask(Extent extent, BaseBlock... block) {
|
||||||
super(extent);
|
super(extent);
|
||||||
|
MainUtil.warnDeprecated(BlockMaskBuilder.class);
|
||||||
checkNotNull(block);
|
checkNotNull(block);
|
||||||
this.bitSets = new BlockMaskBuilder().addBlocks(block).optimize().getBits();
|
this.bitSets = new BlockMaskBuilder().addBlocks(block).optimize().getBits();
|
||||||
}
|
}
|
||||||
|
@ -546,7 +546,12 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockVector2 next() {
|
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);
|
BlockVector2 answer = BlockVector2.at(nextX, nextZ);
|
||||||
if (++nextX > max.getBlockX()) {
|
if (++nextX > max.getBlockX()) {
|
||||||
nextX = min.getBlockX();
|
nextX = min.getBlockX();
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren