use of com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter in project FastAsyncWorldEdit by IntellectualSites.
the class PaperweightGetBlocks_Copy method storeEntity.
@SuppressWarnings({ "unchecked", "rawtypes" })
protected void storeEntity(Entity entity) {
BukkitImplAdapter adapter = WorldEditPlugin.getInstance().getBukkitImplAdapter();
net.minecraft.nbt.CompoundTag compoundTag = new net.minecraft.nbt.CompoundTag();
entities.add((CompoundTag) adapter.toNative(entity.save(compoundTag)));
}
use of com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter in project FastAsyncWorldEdit by IntellectualSites.
the class BukkitWorld method clearContainerBlockContents.
@Override
public boolean clearContainerBlockContents(BlockVector3 pt) {
checkNotNull(pt);
BukkitImplAdapter adapter = WorldEditPlugin.getInstance().getBukkitImplAdapter();
if (adapter != null) {
try {
return adapter.clearContainerBlockContents(getWorld(), pt);
} catch (Exception ignored) {
}
}
if (!getBlock(pt).getBlockType().getMaterial().hasContainer()) {
return false;
}
Block block = getWorld().getBlockAt(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ());
BlockState state = PaperLib.getBlockState(block, false).getState();
if (!(state instanceof InventoryHolder)) {
return false;
}
InventoryHolder chest = (InventoryHolder) state;
Inventory inven = chest.getInventory();
if (chest instanceof Chest) {
inven = ((Chest) chest).getBlockInventory();
}
inven.clear();
return true;
}
use of com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter in project FastAsyncWorldEdit by IntellectualSites.
the class BukkitPlayer method sendFakeBlock.
@Override
public <B extends BlockStateHolder<B>> void sendFakeBlock(BlockVector3 pos, B block) {
Location loc = new Location(player.getWorld(), pos.getX(), pos.getY(), pos.getZ());
if (block == null) {
player.sendBlockChange(loc, player.getWorld().getBlockAt(loc).getBlockData());
} else {
player.sendBlockChange(loc, BukkitAdapter.adapt(block));
BukkitImplAdapter adapter = WorldEditPlugin.getInstance().getBukkitImplAdapter();
if (adapter != null) {
if (block.getBlockType() == BlockTypes.STRUCTURE_BLOCK && block instanceof BaseBlock) {
CompoundBinaryTag nbt = ((BaseBlock) block).getNbt();
if (nbt != null) {
adapter.sendFakeNBT(player, pos, nbt);
adapter.sendFakeOP(player);
}
}
}
}
}
Aggregations