/** * Create a WorldEdit BlockState from a Bukkit ItemStack * * @param itemStack The Bukkit ItemStack * @return The WorldEdit BlockState */ public static BlockState asBlockState(ItemStack itemStack) throws WorldEditException { checkNotNull(itemStack); if (itemStack.getType().isBlock()) { return adapt(itemStack.getType().createBlockData()); } else { throw new NotABlockException(); } }
@Override public BaseBlock getBlockInHand(HandSide handSide) throws WorldEditException { final ItemType typeId = getItemInHand(handSide).getType(); if (typeId.hasBlockType()) { return typeId.getBlockType().getDefaultState().toBaseBlock(); } else { throw new NotABlockException(); } }