private IFlowerComponent getFlowerComponent(ItemStack stack) { IFlowerComponent c = null; if(stack.getItem() instanceof IFlowerComponent) c = (IFlowerComponent) stack.getItem(); else if(stack.getItem() instanceof ItemBlock && ((ItemBlock) stack.getItem()).getBlock() instanceof IFlowerComponent) c = (IFlowerComponent) ((ItemBlock) stack.getItem()).getBlock(); return c; }
Block block = ( (ItemBlock) item ).getBlock();
@SuppressWarnings("unchecked") @Override public BlockInteger getBlock() { return (BlockInteger) super.getBlock(); }
@Override public B getBlock() { //noinspection unchecked return (B) super.getBlock(); }
@SuppressWarnings("unchecked") @Override public BlockEnum<E> getBlock() { return (BlockEnum<E>) super.getBlock(); }
items.registerItemColorHandler((s, t) -> Minecraft.getMinecraft().getBlockColors().colorMultiplier(((ItemBlock)s.getItem()).getBlock().getStateFromMeta(s.getMetadata()), null, null, t), ModBlocks.petalBlock, ModBlocks.pool, ModBlocks.spreader);
@Nullable public static Block getBlock(ItemStack stack) { Item item = stack.getItem(); if (item instanceof ItemBlock) { return ((ItemBlock) item).getBlock(); } else { return null; } }
blockMeta = 0; stateToPlace = ((ItemBlock) stackItem).getBlock().getStateFromMeta(blockMeta);
public WorldGenHiveMarble(int rate) { super(rate); //TODO config option / more ore names OreDictionary.getOres("stoneMarble").stream().filter(s -> s.getItem() instanceof ItemBlock).map(s -> ((ItemBlock) s.getItem()).getBlock()).forEach(validBlocks::add); }
@SuppressWarnings("deprecation") @Override @Nullable public IBlockState getBlockState() { return hasBlock ? ((ItemBlock)stack.getItem()).getBlock().getStateFromMeta(stack.getItemDamage()) : null; } }
public static Block asBlock(IItemStack ingredient) { ItemStack stack = asStack(ingredient); if (stack != null && stack.getItem() instanceof ItemBlock) { return ((ItemBlock)stack.getItem()).getBlock(); } else return null; }
public GrinderInput(ItemStack stack) { this.stack = stack; Item item = stack.getItem(); if(item instanceof ItemBlock) { this.grind = (GrindableItem)((ItemBlock)stack.getItem()).getBlock(); } else { this.grind = (GrindableItem)stack.getItem(); } } }
/** * Check if a stack is a smeltable ore. * * @param stack the stack to test. * @return true if so. */ protected boolean isSmeltable(final ItemStack stack) { return !ItemStackUtils.isEmpty(stack) && ItemStackUtils.IS_SMELTABLE.and( itemStack -> itemStack.getItem() instanceof ItemBlock && ColonyManager.getCompatibilityManager().isOre(((ItemBlock) itemStack.getItem()).getBlock().getDefaultState())).test(stack); }
/** * Checks if a stack is a type of log. * * @param stack the stack to check. * @return true if it is a log type. */ private boolean isStackLog(@Nullable final ItemStack stack) { return !ItemStackUtils.isEmpty(stack) && stack.getItem() instanceof ItemBlock && ((ItemBlock) stack.getItem()).getBlock().isWood(world, new BlockPos(0, 0, 0)); }
public static IBlockState stackToState(ItemStack stack) { if (stack.getItem() instanceof ItemBlock) { return ((ItemBlock) stack.getItem()).getBlock().getStateFromMeta(stack.getMetadata()); } else { return null; } }
public static IBlockState getStateFromItem( final ItemStack bitItemStack ) { if ( bitItemStack != null && bitItemStack.getItem() instanceof ItemBlock ) { final ItemBlock blkItem = (ItemBlock) bitItemStack.getItem(); return blkItem.getBlock().getStateFromMeta( blkItem.getMetadata( bitItemStack ) ); } return null; }
@ZenMethod public static void set(IItemStack input, float speed) { ItemStack stack = InputHelper.toStack(input); if(InputHelper.isABlock(stack)) { Block block = ((ItemBlock) stack.getItem()).getBlock(); IBlockState state = block.getStateFromMeta(stack.getMetadata()); ModTweaker.LATE_ADDITIONS.add(new Set(state, speed)); } }
public static NBTTagCompound tryToCreateGTPrefixBlockNBT(ItemStack ore) { Block block = ((ItemBlock)ore.getItem()).getBlock(); NBTTagCompound nbt = null; if (isGTPrefixBlock(block)) { nbt = new NBTTagCompound(); nbt.setShort("m", (short)ore.getItemDamage()); nbt.setString("id", "gt.MetaBlockTileEntity"); } return nbt; }
public static ItemStack getCoverStack(ItemStack stack) { if (stack.getItem() instanceof ItemBlock) { return getCoverStack(((ItemBlock) stack.getItem()).getBlock(), stack.getItem().getMetadata(stack.getItemDamage())); } return ItemStack.EMPTY; }