Java Code Examples for net.minecraft.init.Items.field_190931_a()

The following are Jave code examples for showing how to use field_190931_a() of the net.minecraft.init.Items class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: Backmemed   File: Block.java   View Source Code Vote up 6 votes
/**
 * Spawns this Block's drops into the World as EntityItems.
 */
public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune)
{
    if (!worldIn.isRemote)
    {
        int i = this.quantityDroppedWithBonus(fortune, worldIn.rand);

        for (int j = 0; j < i; ++j)
        {
            if (worldIn.rand.nextFloat() <= chance)
            {
                Item item = this.getItemDropped(state, worldIn.rand, fortune);

                if (item != Items.field_190931_a)
                {
                    spawnAsEntity(worldIn, pos, new ItemStack(item, 1, this.damageDropped(state)));
                }
            }
        }
    }
}
 
Example 2
Project: Backmemed   File: StatList.java   View Source Code Vote up 6 votes
private static void initMiningStats()
{
    for (Block block : Block.REGISTRY)
    {
        Item item = Item.getItemFromBlock(block);

        if (item != Items.field_190931_a)
        {
            int i = Block.getIdFromBlock(block);
            String s = getItemName(item);

            if (s != null && block.getEnableStats())
            {
                BLOCKS_STATS[i] = (new StatCrafting("stat.mineBlock.", s, new TextComponentTranslation("stat.mineBlock", new Object[] {(new ItemStack(block)).getTextComponent()}), item)).registerStat();
                MINE_BLOCK_STATS.add((StatCrafting)BLOCKS_STATS[i]);
            }
        }
    }

    replaceAllSimilarBlocks(BLOCKS_STATS);
}
 
Example 3
Project: Backmemed   File: BlockDoublePlant.java   View Source Code Vote up 5 votes
/**
 * Get the Item that this Block should drop when harvested.
 */
public Item getItemDropped(IBlockState state, Random rand, int fortune)
{
    if (state.getValue(HALF) == BlockDoublePlant.EnumBlockHalf.UPPER)
    {
        return Items.field_190931_a;
    }
    else
    {
        BlockDoublePlant.EnumPlantType blockdoubleplant$enumplanttype = (BlockDoublePlant.EnumPlantType)state.getValue(VARIANT);
        return blockdoubleplant$enumplanttype == BlockDoublePlant.EnumPlantType.FERN ? Items.field_190931_a : (blockdoubleplant$enumplanttype == BlockDoublePlant.EnumPlantType.GRASS ? (rand.nextInt(8) == 0 ? Items.WHEAT_SEEDS : Items.field_190931_a) : super.getItemDropped(state, rand, fortune));
    }
}
 
Example 4
Project: Backmemed   File: BlockContainer.java   View Source Code Vote up 5 votes
public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, @Nullable TileEntity te, ItemStack stack)
{
    if (te instanceof IWorldNameable && ((IWorldNameable)te).hasCustomName())
    {
        player.addStat(StatList.getBlockStats(this));
        player.addExhaustion(0.005F);

        if (worldIn.isRemote)
        {
            return;
        }

        int i = EnchantmentHelper.getEnchantmentLevel(Enchantments.FORTUNE, stack);
        Item item = this.getItemDropped(state, worldIn.rand, i);

        if (item == Items.field_190931_a)
        {
            return;
        }

        ItemStack itemstack = new ItemStack(item, this.quantityDropped(worldIn.rand));
        itemstack.setStackDisplayName(((IWorldNameable)te).getName());
        spawnAsEntity(worldIn, pos, itemstack);
    }
    else
    {
        super.harvestBlock(worldIn, player, pos, state, (TileEntity)null, stack);
    }
}
 
Example 5
Project: Backmemed   File: Item.java   View Source Code Vote up 4 votes
public static Item getItemFromBlock(Block blockIn)
{
    Item item = (Item)BLOCK_TO_ITEM.get(blockIn);
    return item == null ? Items.field_190931_a : item;
}
 
Example 6
Project: Backmemed   File: BlockPistonMoving.java   View Source Code Vote up 4 votes
/**
 * Get the Item that this Block should drop when harvested.
 */
public Item getItemDropped(IBlockState state, Random rand, int fortune)
{
    return Items.field_190931_a;
}
 
Example 7
Project: Backmemed   File: BlockStem.java   View Source Code Vote up 4 votes
/**
 * Get the Item that this Block should drop when harvested.
 */
public Item getItemDropped(IBlockState state, Random rand, int fortune)
{
    return Items.field_190931_a;
}
 
Example 8
Project: Backmemed   File: BlockDoor.java   View Source Code Vote up 4 votes
/**
 * Get the Item that this Block should drop when harvested.
 */
public Item getItemDropped(IBlockState state, Random rand, int fortune)
{
    return state.getValue(HALF) == BlockDoor.EnumDoorHalf.UPPER ? Items.field_190931_a : this.getItem();
}
 
Example 9
Project: Backmemed   File: BlockBed.java   View Source Code Vote up 4 votes
/**
 * Get the Item that this Block should drop when harvested.
 */
public Item getItemDropped(IBlockState state, Random rand, int fortune)
{
    return state.getValue(PART) == BlockBed.EnumPartType.HEAD ? Items.field_190931_a : Items.BED;
}
 
Example 10
Project: Backmemed   File: BlockVine.java   View Source Code Vote up 4 votes
/**
 * Get the Item that this Block should drop when harvested.
 */
public Item getItemDropped(IBlockState state, Random rand, int fortune)
{
    return Items.field_190931_a;
}
 
Example 11
Project: Backmemed   File: BlockPane.java   View Source Code Vote up 4 votes
/**
 * Get the Item that this Block should drop when harvested.
 */
public Item getItemDropped(IBlockState state, Random rand, int fortune)
{
    return !this.canDrop ? Items.field_190931_a : super.getItemDropped(state, rand, fortune);
}
 
Example 12
Project: Backmemed   File: BlockNetherWart.java   View Source Code Vote up 4 votes
/**
 * Get the Item that this Block should drop when harvested.
 */
public Item getItemDropped(IBlockState state, Random rand, int fortune)
{
    return Items.field_190931_a;
}
 
Example 13
Project: Backmemed   File: BlockEmptyDrops.java   View Source Code Vote up 4 votes
/**
 * Get the Item that this Block should drop when harvested.
 */
public Item getItemDropped(IBlockState state, Random rand, int fortune)
{
    return Items.field_190931_a;
}
 
Example 14
Project: Backmemed   File: BlockMobSpawner.java   View Source Code Vote up 4 votes
/**
 * Get the Item that this Block should drop when harvested.
 */
public Item getItemDropped(IBlockState state, Random rand, int fortune)
{
    return Items.field_190931_a;
}
 
Example 15
Project: Backmemed   File: BlockCake.java   View Source Code Vote up 4 votes
/**
 * Get the Item that this Block should drop when harvested.
 */
public Item getItemDropped(IBlockState state, Random rand, int fortune)
{
    return Items.field_190931_a;
}
 
Example 16
Project: Backmemed   File: BlockLiquid.java   View Source Code Vote up 4 votes
/**
 * Get the Item that this Block should drop when harvested.
 */
public Item getItemDropped(IBlockState state, Random rand, int fortune)
{
    return Items.field_190931_a;
}
 
Example 17
Project: Backmemed   File: BlockTallGrass.java   View Source Code Vote up 4 votes
/**
 * Get the Item that this Block should drop when harvested.
 */
public Item getItemDropped(IBlockState state, Random rand, int fortune)
{
    return rand.nextInt(8) == 0 ? Items.WHEAT_SEEDS : Items.field_190931_a;
}
 
Example 18
Project: Backmemed   File: BlockChorusFlower.java   View Source Code Vote up 4 votes
/**
 * Get the Item that this Block should drop when harvested.
 */
public Item getItemDropped(IBlockState state, Random rand, int fortune)
{
    return Items.field_190931_a;
}
 
Example 19
Project: Backmemed   File: BlockEndPortalFrame.java   View Source Code Vote up 4 votes
/**
 * Get the Item that this Block should drop when harvested.
 */
public Item getItemDropped(IBlockState state, Random rand, int fortune)
{
    return Items.field_190931_a;
}
 
Example 20
Project: Backmemed   File: GuiCreateFlatWorld.java   View Source Code Vote up 4 votes
protected void drawSlot(int entryID, int insideLeft, int yPos, int insideSlotHeight, int mouseXIn, int mouseYIn)
{
    FlatLayerInfo flatlayerinfo = (FlatLayerInfo)GuiCreateFlatWorld.this.theFlatGeneratorInfo.getFlatLayers().get(GuiCreateFlatWorld.this.theFlatGeneratorInfo.getFlatLayers().size() - entryID - 1);
    IBlockState iblockstate = flatlayerinfo.getLayerMaterial();
    Block block = iblockstate.getBlock();
    Item item = Item.getItemFromBlock(block);

    if (item == Items.field_190931_a)
    {
        if (block != Blocks.WATER && block != Blocks.FLOWING_WATER)
        {
            if (block == Blocks.LAVA || block == Blocks.FLOWING_LAVA)
            {
                item = Items.LAVA_BUCKET;
            }
        }
        else
        {
            item = Items.WATER_BUCKET;
        }
    }

    ItemStack itemstack = new ItemStack(item, 1, item.getHasSubtypes() ? block.getMetaFromState(iblockstate) : 0);
    String s = item.getItemStackDisplayName(itemstack);
    this.drawItem(insideLeft, yPos, itemstack);
    GuiCreateFlatWorld.this.fontRendererObj.drawString(s, insideLeft + 18 + 5, yPos + 3, 16777215);
    String s1;

    if (entryID == 0)
    {
        s1 = I18n.format("createWorld.customize.flat.layer.top", new Object[] {Integer.valueOf(flatlayerinfo.getLayerCount())});
    }
    else if (entryID == GuiCreateFlatWorld.this.theFlatGeneratorInfo.getFlatLayers().size() - 1)
    {
        s1 = I18n.format("createWorld.customize.flat.layer.bottom", new Object[] {Integer.valueOf(flatlayerinfo.getLayerCount())});
    }
    else
    {
        s1 = I18n.format("createWorld.customize.flat.layer", new Object[] {Integer.valueOf(flatlayerinfo.getLayerCount())});
    }

    GuiCreateFlatWorld.this.fontRendererObj.drawString(s1, insideLeft + 2 + 213 - GuiCreateFlatWorld.this.fontRendererObj.getStringWidth(s1), yPos + 3, 16777215);
}