mirror of
https://github.com/boy0001/FastAsyncWorldedit.git
synced 2024-11-28 21:56:33 +01:00
Fixes #612
This commit is contained in:
parent
d7d897d11b
commit
3252c0464d
@ -83,6 +83,7 @@ import com.sk89q.worldedit.extent.Extent;
|
|||||||
import com.sk89q.worldedit.extent.MaskingExtent;
|
import com.sk89q.worldedit.extent.MaskingExtent;
|
||||||
import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard;
|
import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard;
|
||||||
import com.sk89q.worldedit.extent.inventory.BlockBag;
|
import com.sk89q.worldedit.extent.inventory.BlockBag;
|
||||||
|
import com.sk89q.worldedit.extent.inventory.BlockBagExtent;
|
||||||
import com.sk89q.worldedit.extent.world.SurvivalModeExtent;
|
import com.sk89q.worldedit.extent.world.SurvivalModeExtent;
|
||||||
import com.sk89q.worldedit.function.GroundFunction;
|
import com.sk89q.worldedit.function.GroundFunction;
|
||||||
import com.sk89q.worldedit.function.RegionFunction;
|
import com.sk89q.worldedit.function.RegionFunction;
|
||||||
@ -315,14 +316,17 @@ public class EditSession extends AbstractWorld implements HasFaweQueue, Lighting
|
|||||||
if (player != null && Fawe.imp().getBlocksHubApi() != null) {
|
if (player != null && Fawe.imp().getBlocksHubApi() != null) {
|
||||||
changeSet = LoggingChangeSet.wrap(player, changeSet);
|
changeSet = LoggingChangeSet.wrap(player, changeSet);
|
||||||
}
|
}
|
||||||
if (this.blockBag != null && limit.INVENTORY_MODE > 0) {
|
|
||||||
changeSet = new BlockBagChangeSet(changeSet, blockBag, limit.INVENTORY_MODE == 1);
|
|
||||||
}
|
|
||||||
if (combineStages) {
|
if (combineStages) {
|
||||||
|
if (this.blockBag != null) {
|
||||||
|
changeSet = new BlockBagChangeSet(changeSet, blockBag, limit.INVENTORY_MODE == 1);
|
||||||
|
}
|
||||||
changeTask = changeSet;
|
changeTask = changeSet;
|
||||||
changeSet.addChangeTask(queue);
|
changeSet.addChangeTask(queue);
|
||||||
} else {
|
} else {
|
||||||
this.extent = (history = new HistoryExtent(this, bypassHistory, changeSet, queue));
|
this.extent = (history = new HistoryExtent(this, bypassHistory, changeSet, queue));
|
||||||
|
if (this.blockBag != null) {
|
||||||
|
this.extent = new BlockBagExtent(this.extent, blockBag, limit.INVENTORY_MODE == 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -895,7 +895,7 @@ public class LocalSession {
|
|||||||
@Nullable
|
@Nullable
|
||||||
public BlockBag getBlockBag(Player player) {
|
public BlockBag getBlockBag(Player player) {
|
||||||
checkNotNull(player);
|
checkNotNull(player);
|
||||||
if (!useInventory) {
|
if (!useInventory && FawePlayer.wrap(player).getLimit().INVENTORY_MODE == 0) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return player.getInventoryBlockBag();
|
return player.getInventoryBlockBag();
|
||||||
|
@ -298,7 +298,7 @@ public class RegionCommands extends MethodCommands {
|
|||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
aliases = {"/replace", "/re", "/rep", "/r"},
|
aliases = {"/replace", "/re", "/rep", "/r"},
|
||||||
usage = "[from-block] <to-block>",
|
usage = "[from-mask] <to-pattern>",
|
||||||
desc = "Replace all blocks in the selection with another",
|
desc = "Replace all blocks in the selection with another",
|
||||||
flags = "f",
|
flags = "f",
|
||||||
min = 1,
|
min = 1,
|
||||||
|
@ -80,7 +80,12 @@ public class BlockBagExtent extends AbstractDelegateExtent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean setBlock(Vector position, BaseBlock block) throws WorldEditException {
|
public boolean setBlock(Vector pos, BaseBlock block) throws WorldEditException {
|
||||||
|
return setBlock(pos.getBlockX(), pos.getBlockY(), pos.getBlockZ(), block);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean setBlock(int x, int y, int z, BaseBlock block) throws WorldEditException {
|
||||||
CompoundTag nbt = block.getNbtData();
|
CompoundTag nbt = block.getNbtData();
|
||||||
final int type = block.getType();
|
final int type = block.getType();
|
||||||
if (type != 0) {
|
if (type != 0) {
|
||||||
@ -97,10 +102,12 @@ public class BlockBagExtent extends AbstractDelegateExtent {
|
|||||||
} catch (BlockBagException e) {
|
} catch (BlockBagException e) {
|
||||||
missingBlocks[type]++;
|
missingBlocks[type]++;
|
||||||
return false;
|
return false;
|
||||||
|
} catch (Throwable e) {
|
||||||
|
throw e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (mine) {
|
if (mine) {
|
||||||
BaseBlock lazyBlock = getExtent().getLazyBlock(position);
|
BaseBlock lazyBlock = getExtent().getLazyBlock(x, y, z);
|
||||||
int existing = lazyBlock.getType();
|
int existing = lazyBlock.getType();
|
||||||
if (existing != 0) {
|
if (existing != 0) {
|
||||||
try {
|
try {
|
||||||
@ -109,7 +116,7 @@ public class BlockBagExtent extends AbstractDelegateExtent {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return super.setBlock(position, block);
|
return super.setBlock(x, y, z, block);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Class<?> inject() {
|
public static Class<?> inject() {
|
||||||
|
Loading…
Reference in New Issue
Block a user