Fix inventory mode + nbt

Dieser Commit ist enthalten in:
Jesse Boyd 2018-09-23 17:29:13 +10:00
Ursprung 00ac111e46
Commit f07dfbfeff
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 59F1DE6293AF6E1F

Datei anzeigen

@ -5,9 +5,12 @@ import com.boydti.fawe.object.exception.FaweException;
import com.boydti.fawe.util.ReflectionUtils;
import com.sk89q.jnbt.CompoundTag;
import com.sk89q.jnbt.Tag;
import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.blocks.BaseBlock;
import com.sk89q.worldedit.extent.inventory.BlockBag;
import com.sk89q.worldedit.extent.inventory.BlockBagException;
import com.sk89q.worldedit.extent.inventory.UnplaceableBlockException;
import com.sk89q.worldedit.world.block.BlockStateHolder;
import com.sk89q.worldedit.world.block.BlockType;
import com.sk89q.worldedit.world.block.BlockTypes;
@ -68,9 +71,19 @@ public class BlockBagChangeSet extends AbstractDelegateChangeSet {
}
@Override
public void add(int x, int y, int z, int combinedFrom, int combinedTo) {
BlockType typeFrom = BlockTypes.getFromStateId(combinedFrom);
BlockType typeTo = BlockTypes.getFromStateId(combinedTo);
public void add(Vector loc, BlockStateHolder from, BlockStateHolder to) {
int x = loc.getBlockX();
int y = loc.getBlockY();
int z = loc.getBlockZ();
add(x, y, z, from, to);
}
@Override
public void add(int x, int y, int z, BlockStateHolder from, BlockStateHolder to) {
check(from.getBlockType(), to.getBlockType());
}
public void check(BlockType typeFrom, BlockType typeTo) {
if (!typeTo.getMaterial().isAir()) {
try {
blockBag.fetchPlacedBlock(typeTo.getDefaultState());
@ -89,6 +102,13 @@ public class BlockBagChangeSet extends AbstractDelegateChangeSet {
}
}
}
}
@Override
public void add(int x, int y, int z, int combinedFrom, int combinedTo) {
BlockType typeFrom = BlockTypes.getFromStateId(combinedFrom);
BlockType typeTo = BlockTypes.getFromStateId(combinedTo);
check(typeFrom, typeTo);
super.add(x, y, z, combinedFrom, combinedTo);
}