geforkt von Mirrors/FastAsyncWorldEdit
Moved containsFuzzy from EditSession to BaseBlock.
Dieser Commit ist enthalten in:
Ursprung
d467bf1386
Commit
68b8218bea
@ -19,7 +19,6 @@
|
||||
package com.sk89q.worldedit;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Deque;
|
||||
import java.util.HashMap;
|
||||
@ -542,18 +541,6 @@ public class EditSession {
|
||||
return countBlocks(region, passOn);
|
||||
}
|
||||
|
||||
private static boolean containsFuzzy(Collection<BaseBlock> collection, Object o) {
|
||||
// allow -1 data in the searchBlocks to match any type
|
||||
for (BaseBlock b : collection) {
|
||||
if (o instanceof BaseBlock) {
|
||||
if (b.equalsFuzzy((BaseBlock) o)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Count the number of blocks of a list of types in a region.
|
||||
*
|
||||
@ -582,7 +569,7 @@ public class EditSession {
|
||||
Vector pt = new Vector(x, y, z);
|
||||
|
||||
BaseBlock compare = new BaseBlock(getBlockType(pt), getBlockData(pt));
|
||||
if (containsFuzzy(searchBlocks, compare)) {
|
||||
if (BaseBlock.containsFuzzy(searchBlocks, compare)) {
|
||||
++count;
|
||||
}
|
||||
}
|
||||
@ -591,7 +578,7 @@ public class EditSession {
|
||||
} else {
|
||||
for (Vector pt : region) {
|
||||
BaseBlock compare = new BaseBlock(getBlockType(pt), getBlockData(pt));
|
||||
if (containsFuzzy(searchBlocks, compare)) {
|
||||
if (BaseBlock.containsFuzzy(searchBlocks, compare)) {
|
||||
++count;
|
||||
}
|
||||
}
|
||||
|
@ -22,6 +22,8 @@ package com.sk89q.worldedit.blocks;
|
||||
import com.sk89q.worldedit.CuboidClipboard.FlipDirection;
|
||||
import com.sk89q.worldedit.foundation.Block;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* Represents a block.
|
||||
*
|
||||
@ -161,7 +163,7 @@ public class BaseBlock extends Block {
|
||||
/**
|
||||
* @param iter
|
||||
* @return
|
||||
* @deprecated This method is silly
|
||||
* @deprecated This method is silly, use {@link #containsFuzzy(java.util.Collection, BaseBlock)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public boolean inIterable(Iterable<BaseBlock> iter) {
|
||||
@ -172,4 +174,14 @@ public class BaseBlock extends Block {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean containsFuzzy(Collection<BaseBlock> collection, BaseBlock o) {
|
||||
// allow masked data in the searchBlocks to match various types
|
||||
for (BaseBlock b : collection) {
|
||||
if (b.equalsFuzzy(o)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren