use of com.sk89q.jnbt.CompoundTag in project FastAsyncWorldEdit by IntellectualSites.
the class AbstractChangeSet method add.
public void add(int x, int y, int z, BaseBlock from, BaseBlock to) {
try {
if (from.hasNbtData()) {
CompoundTag nbt = from.getNbtData();
assert nbt != null;
addTileRemove(MainUtil.setPosition(nbt, x, y, z));
}
if (to.hasNbtData()) {
CompoundTag nbt = to.getNbtData();
assert nbt != null;
addTileCreate(MainUtil.setPosition(nbt, x, y, z));
}
int combinedFrom = from.getOrdinal();
int combinedTo = to.getOrdinal();
add(x, y, z, combinedFrom, combinedTo);
} catch (Exception e) {
e.printStackTrace();
}
}
use of com.sk89q.jnbt.CompoundTag in project FastAsyncWorldEdit by IntellectualSites.
the class CompressedCompoundTag method decompress.
private void decompress() {
try (NBTInputStream nbtIn = new NBTInputStream(adapt(in))) {
in = null;
CompoundTag tag = (CompoundTag) nbtIn.readTag();
Map<String, Tag> value = tag.getValue();
Map<String, Tag> raw = super.getValue();
raw.putAll(value);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
use of com.sk89q.jnbt.CompoundTag in project FastAsyncWorldEdit by IntellectualSites.
the class DefaultBlockParser method validate.
// FAWE Start
private <T extends BlockStateHolder> T validate(ParserContext context, T holder) {
if (context.isRestricted()) {
Actor actor = context.requireActor();
if (!actor.hasPermission("worldedit.anyblock") && worldEdit.getConfiguration().checkDisallowedBlocks(holder)) {
throw new DisallowedUsageException(Caption.of("worldedit.error.disallowed-block", TextComponent.of(String.valueOf(holder))));
}
CompoundTag nbt = holder.getNbtData();
if (nbt != null) {
if (!actor.hasPermission("worldedit.anyblock.nbt")) {
throw new DisallowedUsageException(Caption.of("fawe.error.nbt.forbidden", TextComponent.of("worldedit.anyblock.nbt")));
}
}
}
return holder;
}
use of com.sk89q.jnbt.CompoundTag in project FastAsyncWorldEdit by IntellectualSites.
the class CharFilterBlock method getFullBlock.
@Override
public final BaseBlock getFullBlock() {
final BlockState state = getBlock();
final BlockMaterial material = state.getMaterial();
if (material.hasContainer()) {
final CompoundTag tag = get.getTile(x, y + yy, z);
return state.toBaseBlock(tag);
}
return state.toBaseBlock();
}
use of com.sk89q.jnbt.CompoundTag in project FastAsyncWorldEdit by IntellectualSites.
the class CharFilterBlock method setFullBlock.
@Override
public void setFullBlock(BaseBlock block) {
delegate.set(this, block.getOrdinalChar());
final CompoundTag nbt = block.getNbtData();
if (nbt != null) {
// TODO optimize check via ImmutableBaseBlock
set.setTile(x, yy + y, z, nbt);
}
}
Aggregations