mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-06 04:46:40 +00:00
Added block damage support to //replace and //replacenear
This commit is contained in:
@ -999,7 +999,7 @@ public class EditSession {
|
||||
* @return number of blocks affected
|
||||
* @throws MaxChangedBlocksException
|
||||
*/
|
||||
public int replaceBlocks(Region region, Set<Integer> fromBlockTypes,
|
||||
public int replaceBlocks(Region region, Set<BaseBlock> fromBlockTypes,
|
||||
BaseBlock toBlock) throws MaxChangedBlocksException {
|
||||
int affected = 0;
|
||||
|
||||
@ -1019,11 +1019,10 @@ public class EditSession {
|
||||
for (int y = minY; y <= maxY; ++y) {
|
||||
for (int z = minZ; z <= maxZ; ++z) {
|
||||
Vector pt = new Vector(x, y, z);
|
||||
int curBlockType = getBlockType(pt);
|
||||
BaseBlock curBlockType = getBlock(pt);
|
||||
|
||||
if ((fromBlockTypes == null && curBlockType != 0)
|
||||
|| (fromBlockTypes != null && fromBlockTypes
|
||||
.contains(curBlockType))) {
|
||||
if ((fromBlockTypes == null && !curBlockType.isAir())
|
||||
|| (fromBlockTypes != null && curBlockType.inIterable(fromBlockTypes))) {
|
||||
if (setBlock(pt, toBlock)) {
|
||||
++affected;
|
||||
}
|
||||
@ -1033,10 +1032,10 @@ public class EditSession {
|
||||
}
|
||||
} else {
|
||||
for (Vector pt : region) {
|
||||
int curBlockType = getBlockType(pt);
|
||||
BaseBlock curBlockType = getBlock(pt);
|
||||
|
||||
if (fromBlockTypes == null && curBlockType != 0
|
||||
|| fromBlockTypes.contains(curBlockType)) {
|
||||
if (fromBlockTypes == null && !curBlockType.isAir()
|
||||
|| fromBlockTypes != null && curBlockType.inIterable(fromBlockTypes)) {
|
||||
if (setBlock(pt, toBlock)) {
|
||||
++affected;
|
||||
}
|
||||
@ -1056,7 +1055,7 @@ public class EditSession {
|
||||
* @return number of blocks affected
|
||||
* @throws MaxChangedBlocksException
|
||||
*/
|
||||
public int replaceBlocks(Region region, Set<Integer> fromBlockTypes,
|
||||
public int replaceBlocks(Region region, Set<BaseBlock> fromBlockTypes,
|
||||
Pattern pattern) throws MaxChangedBlocksException {
|
||||
int affected = 0;
|
||||
|
||||
@ -1076,11 +1075,10 @@ public class EditSession {
|
||||
for (int y = minY; y <= maxY; ++y) {
|
||||
for (int z = minZ; z <= maxZ; ++z) {
|
||||
Vector pt = new Vector(x, y, z);
|
||||
int curBlockType = getBlockType(pt);
|
||||
BaseBlock curBlockType = getBlock(pt);
|
||||
|
||||
if ((fromBlockTypes == null && curBlockType != 0)
|
||||
|| (fromBlockTypes != null && fromBlockTypes
|
||||
.contains(curBlockType))) {
|
||||
if ((fromBlockTypes == null && !curBlockType.isAir())
|
||||
|| (fromBlockTypes != null && curBlockType.inIterable(fromBlockTypes))) {
|
||||
if (setBlock(pt, pattern.next(pt))) {
|
||||
++affected;
|
||||
}
|
||||
@ -1090,10 +1088,10 @@ public class EditSession {
|
||||
}
|
||||
} else {
|
||||
for (Vector pt : region) {
|
||||
int curBlockType = getBlockType(pt);
|
||||
BaseBlock curBlockType = getBlock(pt);
|
||||
|
||||
if (fromBlockTypes == null && curBlockType != 0
|
||||
|| fromBlockTypes.contains(curBlockType)) {
|
||||
if (fromBlockTypes == null && !curBlockType.isAir()
|
||||
|| curBlockType.inIterable(fromBlockTypes)) {
|
||||
if (setBlock(pt, pattern.next(pt))) {
|
||||
++affected;
|
||||
}
|
||||
|
Reference in New Issue
Block a user