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

The following are Jave code examples for showing how to use diamond() 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: DecompiledMinecraft   File: EntityItem.java   View Source Code Vote up 4 votes
/**
 * Called by a player entity when they collide with an entity
 */
public void onCollideWithPlayer(EntityPlayer entityIn)
{
    if (!this.worldObj.isRemote)
    {
        ItemStack itemstack = this.getEntityItem();
        int i = itemstack.stackSize;

        if (this.delayBeforeCanPickup == 0 && (this.owner == null || 6000 - this.age <= 200 || this.owner.equals(entityIn.getName())) && entityIn.inventory.addItemStackToInventory(itemstack))
        {
            if (itemstack.getItem() == Item.getItemFromBlock(Blocks.log))
            {
                entityIn.triggerAchievement(AchievementList.mineWood);
            }

            if (itemstack.getItem() == Item.getItemFromBlock(Blocks.log2))
            {
                entityIn.triggerAchievement(AchievementList.mineWood);
            }

            if (itemstack.getItem() == Items.leather)
            {
                entityIn.triggerAchievement(AchievementList.killCow);
            }

            if (itemstack.getItem() == Items.diamond)
            {
                entityIn.triggerAchievement(AchievementList.diamonds);
            }

            if (itemstack.getItem() == Items.blaze_rod)
            {
                entityIn.triggerAchievement(AchievementList.blazeRod);
            }

            if (itemstack.getItem() == Items.diamond && this.getThrower() != null)
            {
                EntityPlayer entityplayer = this.worldObj.getPlayerEntityByName(this.getThrower());

                if (entityplayer != null && entityplayer != entityIn)
                {
                    entityplayer.triggerAchievement(AchievementList.diamondsToYou);
                }
            }

            if (!this.isSilent())
            {
                this.worldObj.playSoundAtEntity(entityIn, "random.pop", 0.2F, ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F);
            }

            entityIn.onItemPickup(this, i);

            if (itemstack.stackSize <= 0)
            {
                this.setDead();
            }
        }
    }
}
 
Example 2
Project: DecompiledMinecraft   File: Item.java   View Source Code Vote up 4 votes
public Item getRepairItem()
{
    return this == WOOD ? Item.getItemFromBlock(Blocks.planks) : (this == STONE ? Item.getItemFromBlock(Blocks.cobblestone) : (this == GOLD ? Items.gold_ingot : (this == IRON ? Items.iron_ingot : (this == EMERALD ? Items.diamond : null))));
}
 
Example 3
Project: DecompiledMinecraft   File: ItemArmor.java   View Source Code Vote up 4 votes
public Item getRepairItem()
{
    return this == LEATHER ? Items.leather : (this == CHAIN ? Items.iron_ingot : (this == GOLD ? Items.gold_ingot : (this == IRON ? Items.iron_ingot : (this == DIAMOND ? Items.diamond : null))));
}
 
Example 4
Project: BaseClient   File: BlockOre.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 == Blocks.coal_ore ? Items.coal : (this == Blocks.diamond_ore ? Items.diamond : (this == Blocks.lapis_ore ? Items.dye : (this == Blocks.emerald_ore ? Items.emerald : (this == Blocks.quartz_ore ? Items.quartz : Item.getItemFromBlock(this)))));
}
 
Example 5
Project: DecompiledMinecraft   File: ContainerBeacon.java   View Source Code Vote up 4 votes
public boolean isItemValid(ItemStack stack)
{
    return stack == null ? false : stack.getItem() == Items.emerald || stack.getItem() == Items.diamond || stack.getItem() == Items.gold_ingot || stack.getItem() == Items.iron_ingot;
}
 
Example 6
Project: DecompiledMinecraft   File: TileEntityBeacon.java   View Source Code Vote up 4 votes
/**
 * Returns true if automation is allowed to insert the given stack (ignoring stack size) into the given slot.
 */
public boolean isItemValidForSlot(int index, ItemStack stack)
{
    return stack.getItem() == Items.emerald || stack.getItem() == Items.diamond || stack.getItem() == Items.gold_ingot || stack.getItem() == Items.iron_ingot;
}
 
Example 7
Project: DecompiledMinecraft   File: EntityItem.java   View Source Code Vote up 4 votes
/**
 * Called by a player entity when they collide with an entity
 */
public void onCollideWithPlayer(EntityPlayer entityIn)
{
    if (!this.worldObj.isRemote)
    {
        ItemStack itemstack = this.getEntityItem();
        int i = itemstack.stackSize;

        if (this.delayBeforeCanPickup == 0 && (this.owner == null || 6000 - this.age <= 200 || this.owner.equals(entityIn.getName())) && entityIn.inventory.addItemStackToInventory(itemstack))
        {
            if (itemstack.getItem() == Item.getItemFromBlock(Blocks.log))
            {
                entityIn.triggerAchievement(AchievementList.mineWood);
            }

            if (itemstack.getItem() == Item.getItemFromBlock(Blocks.log2))
            {
                entityIn.triggerAchievement(AchievementList.mineWood);
            }

            if (itemstack.getItem() == Items.leather)
            {
                entityIn.triggerAchievement(AchievementList.killCow);
            }

            if (itemstack.getItem() == Items.diamond)
            {
                entityIn.triggerAchievement(AchievementList.diamonds);
            }

            if (itemstack.getItem() == Items.blaze_rod)
            {
                entityIn.triggerAchievement(AchievementList.blazeRod);
            }

            if (itemstack.getItem() == Items.diamond && this.getThrower() != null)
            {
                EntityPlayer entityplayer = this.worldObj.getPlayerEntityByName(this.getThrower());

                if (entityplayer != null && entityplayer != entityIn)
                {
                    entityplayer.triggerAchievement(AchievementList.diamondsToYou);
                }
            }

            if (!this.isSilent())
            {
                this.worldObj.playSoundAtEntity(entityIn, "random.pop", 0.2F, ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F);
            }

            entityIn.onItemPickup(this, i);

            if (itemstack.stackSize <= 0)
            {
                this.setDead();
            }
        }
    }
}
 
Example 8
Project: DecompiledMinecraft   File: Item.java   View Source Code Vote up 4 votes
public Item getRepairItem()
{
    return this == WOOD ? Item.getItemFromBlock(Blocks.planks) : (this == STONE ? Item.getItemFromBlock(Blocks.cobblestone) : (this == GOLD ? Items.gold_ingot : (this == IRON ? Items.iron_ingot : (this == EMERALD ? Items.diamond : null))));
}
 
Example 9
Project: BaseClient   File: ContainerBeacon.java   View Source Code Vote up 4 votes
public boolean isItemValid(ItemStack stack)
{
    return stack == null ? false : stack.getItem() == Items.emerald || stack.getItem() == Items.diamond || stack.getItem() == Items.gold_ingot || stack.getItem() == Items.iron_ingot;
}
 
Example 10
Project: DecompiledMinecraft   File: BlockOre.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 == Blocks.coal_ore ? Items.coal : (this == Blocks.diamond_ore ? Items.diamond : (this == Blocks.lapis_ore ? Items.dye : (this == Blocks.emerald_ore ? Items.emerald : (this == Blocks.quartz_ore ? Items.quartz : Item.getItemFromBlock(this)))));
}
 
Example 11
Project: DecompiledMinecraft   File: ContainerBeacon.java   View Source Code Vote up 4 votes
public boolean isItemValid(ItemStack stack)
{
    return stack == null ? false : stack.getItem() == Items.emerald || stack.getItem() == Items.diamond || stack.getItem() == Items.gold_ingot || stack.getItem() == Items.iron_ingot;
}
 
Example 12
Project: DecompiledMinecraft   File: TileEntityBeacon.java   View Source Code Vote up 4 votes
/**
 * Returns true if automation is allowed to insert the given stack (ignoring stack size) into the given slot.
 */
public boolean isItemValidForSlot(int index, ItemStack stack)
{
    return stack.getItem() == Items.emerald || stack.getItem() == Items.diamond || stack.getItem() == Items.gold_ingot || stack.getItem() == Items.iron_ingot;
}
 
Example 13
Project: BaseClient   File: EntityItem.java   View Source Code Vote up 4 votes
/**
 * Called by a player entity when they collide with an entity
 */
public void onCollideWithPlayer(EntityPlayer entityIn)
{
    if (!this.worldObj.isRemote)
    {
        ItemStack itemstack = this.getEntityItem();
        int i = itemstack.stackSize;

        if (this.delayBeforeCanPickup == 0 && (this.owner == null || 6000 - this.age <= 200 || this.owner.equals(entityIn.getName())) && entityIn.inventory.addItemStackToInventory(itemstack))
        {
            if (itemstack.getItem() == Item.getItemFromBlock(Blocks.log))
            {
                entityIn.triggerAchievement(AchievementList.mineWood);
            }

            if (itemstack.getItem() == Item.getItemFromBlock(Blocks.log2))
            {
                entityIn.triggerAchievement(AchievementList.mineWood);
            }

            if (itemstack.getItem() == Items.leather)
            {
                entityIn.triggerAchievement(AchievementList.killCow);
            }

            if (itemstack.getItem() == Items.diamond)
            {
                entityIn.triggerAchievement(AchievementList.diamonds);
            }

            if (itemstack.getItem() == Items.blaze_rod)
            {
                entityIn.triggerAchievement(AchievementList.blazeRod);
            }

            if (itemstack.getItem() == Items.diamond && this.getThrower() != null)
            {
                EntityPlayer entityplayer = this.worldObj.getPlayerEntityByName(this.getThrower());

                if (entityplayer != null && entityplayer != entityIn)
                {
                    entityplayer.triggerAchievement(AchievementList.diamondsToYou);
                }
            }

            if (!this.isSilent())
            {
                this.worldObj.playSoundAtEntity(entityIn, "random.pop", 0.2F, ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F);
            }

            entityIn.onItemPickup(this, i);

            if (itemstack.stackSize <= 0)
            {
                this.setDead();
            }
        }
    }
}
 
Example 14
Project: BaseClient   File: Item.java   View Source Code Vote up 4 votes
public Item getRepairItem()
{
    return this == WOOD ? Item.getItemFromBlock(Blocks.planks) : (this == STONE ? Item.getItemFromBlock(Blocks.cobblestone) : (this == GOLD ? Items.gold_ingot : (this == IRON ? Items.iron_ingot : (this == EMERALD ? Items.diamond : null))));
}
 
Example 15
Project: BaseClient   File: ItemArmor.java   View Source Code Vote up 4 votes
public Item getRepairItem()
{
    return this == LEATHER ? Items.leather : (this == CHAIN ? Items.iron_ingot : (this == GOLD ? Items.gold_ingot : (this == IRON ? Items.iron_ingot : (this == DIAMOND ? Items.diamond : null))));
}
 
Example 16
Project: BaseClient   File: BlockOre.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 == Blocks.coal_ore ? Items.coal : (this == Blocks.diamond_ore ? Items.diamond : (this == Blocks.lapis_ore ? Items.dye : (this == Blocks.emerald_ore ? Items.emerald : (this == Blocks.quartz_ore ? Items.quartz : Item.getItemFromBlock(this)))));
}
 
Example 17
Project: BaseClient   File: ContainerBeacon.java   View Source Code Vote up 4 votes
public boolean isItemValid(ItemStack stack)
{
    return stack == null ? false : stack.getItem() == Items.emerald || stack.getItem() == Items.diamond || stack.getItem() == Items.gold_ingot || stack.getItem() == Items.iron_ingot;
}
 
Example 18
Project: BaseClient   File: TileEntityBeacon.java   View Source Code Vote up 4 votes
/**
 * Returns true if automation is allowed to insert the given stack (ignoring stack size) into the given slot.
 */
public boolean isItemValidForSlot(int index, ItemStack stack)
{
    return stack.getItem() == Items.emerald || stack.getItem() == Items.diamond || stack.getItem() == Items.gold_ingot || stack.getItem() == Items.iron_ingot;
}
 
Example 19
Project: BaseClient   File: EntityItem.java   View Source Code Vote up 4 votes
/**
 * Called by a player entity when they collide with an entity
 */
public void onCollideWithPlayer(EntityPlayer entityIn)
{
    if (!this.worldObj.isRemote)
    {
        ItemStack itemstack = this.getEntityItem();
        int i = itemstack.stackSize;

        if (this.delayBeforeCanPickup == 0 && (this.owner == null || 6000 - this.age <= 200 || this.owner.equals(entityIn.getName())) && entityIn.inventory.addItemStackToInventory(itemstack))
        {
            if (itemstack.getItem() == Item.getItemFromBlock(Blocks.log))
            {
                entityIn.triggerAchievement(AchievementList.mineWood);
            }

            if (itemstack.getItem() == Item.getItemFromBlock(Blocks.log2))
            {
                entityIn.triggerAchievement(AchievementList.mineWood);
            }

            if (itemstack.getItem() == Items.leather)
            {
                entityIn.triggerAchievement(AchievementList.killCow);
            }

            if (itemstack.getItem() == Items.diamond)
            {
                entityIn.triggerAchievement(AchievementList.diamonds);
            }

            if (itemstack.getItem() == Items.blaze_rod)
            {
                entityIn.triggerAchievement(AchievementList.blazeRod);
            }

            if (itemstack.getItem() == Items.diamond && this.getThrower() != null)
            {
                EntityPlayer entityplayer = this.worldObj.getPlayerEntityByName(this.getThrower());

                if (entityplayer != null && entityplayer != entityIn)
                {
                    entityplayer.triggerAchievement(AchievementList.diamondsToYou);
                }
            }

            if (!this.isSilent())
            {
                this.worldObj.playSoundAtEntity(entityIn, "random.pop", 0.2F, ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F);
            }

            entityIn.onItemPickup(this, i);

            if (itemstack.stackSize <= 0)
            {
                this.setDead();
            }
        }
    }
}
 
Example 20
Project: BaseClient   File: Item.java   View Source Code Vote up 4 votes
public Item getRepairItem()
{
    return this == WOOD ? Item.getItemFromBlock(Blocks.planks) : (this == STONE ? Item.getItemFromBlock(Blocks.cobblestone) : (this == GOLD ? Items.gold_ingot : (this == IRON ? Items.iron_ingot : (this == EMERALD ? Items.diamond : null))));
}