Java Code Examples for net.minecraft.init.Items.FISHING_ROD

The following are Jave code examples for showing how to use FISHING_ROD 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: EntityFishHook.java   View Source Code Vote up 6 votes
private boolean func_190625_o()
{
    ItemStack itemstack = this.angler.getHeldItemMainhand();
    ItemStack itemstack1 = this.angler.getHeldItemOffhand();
    boolean flag = itemstack.getItem() == Items.FISHING_ROD;
    boolean flag1 = itemstack1.getItem() == Items.FISHING_ROD;

    if (!this.angler.isDead && this.angler.isEntityAlive() && (flag || flag1) && this.getDistanceSqToEntity(this.angler) <= 1024.0D)
    {
        return false;
    }
    else
    {
        this.setDead();
        return true;
    }
}
 
Example 2
Project: CustomWorldGen   File: ItemCarrotOnAStick.java   View Source Code Vote up 6 votes
public ActionResult<ItemStack> onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn, EnumHand hand)
{
    if (playerIn.isRiding() && playerIn.getRidingEntity() instanceof EntityPig)
    {
        EntityPig entitypig = (EntityPig)playerIn.getRidingEntity();

        if (itemStackIn.getMaxDamage() - itemStackIn.getMetadata() >= 7 && entitypig.boost())
        {
            itemStackIn.damageItem(7, playerIn);

            if (itemStackIn.stackSize == 0)
            {
                ItemStack itemstack = new ItemStack(Items.FISHING_ROD);
                itemstack.setTagCompound(itemStackIn.getTagCompound());
                return new ActionResult(EnumActionResult.SUCCESS, itemstack);
            }

            return new ActionResult(EnumActionResult.SUCCESS, itemStackIn);
        }
    }

    playerIn.addStat(StatList.getObjectUseStats(this));
    return new ActionResult(EnumActionResult.PASS, itemStackIn);
}
 
Example 3
Project: Backmemed   File: ItemCarrotOnAStick.java   View Source Code Vote up 5 votes
public ActionResult<ItemStack> onItemRightClick(World itemStackIn, EntityPlayer worldIn, EnumHand playerIn)
{
    ItemStack itemstack = worldIn.getHeldItem(playerIn);

    if (itemStackIn.isRemote)
    {
        return new ActionResult(EnumActionResult.PASS, itemstack);
    }
    else
    {
        if (worldIn.isRiding() && worldIn.getRidingEntity() instanceof EntityPig)
        {
            EntityPig entitypig = (EntityPig)worldIn.getRidingEntity();

            if (itemstack.getMaxDamage() - itemstack.getMetadata() >= 7 && entitypig.boost())
            {
                itemstack.damageItem(7, worldIn);

                if (itemstack.func_190926_b())
                {
                    ItemStack itemstack1 = new ItemStack(Items.FISHING_ROD);
                    itemstack1.setTagCompound(itemstack.getTagCompound());
                    return new ActionResult(EnumActionResult.SUCCESS, itemstack1);
                }

                return new ActionResult(EnumActionResult.SUCCESS, itemstack);
            }
        }

        worldIn.addStat(StatList.getObjectUseStats(this));
        return new ActionResult(EnumActionResult.PASS, itemstack);
    }
}
 
Example 4
Project: Backmemed   File: TileEntityFurnace.java   View Source Code Vote up 5 votes
/**
 * Returns the number of ticks that the supplied fuel item will keep the furnace burning, or 0 if the item isn't
 * fuel
 */
public static int getItemBurnTime(ItemStack stack)
{
    if (stack.func_190926_b())
    {
        return 0;
    }
    else
    {
        Item item = stack.getItem();
        return item == Item.getItemFromBlock(Blocks.WOODEN_SLAB) ? 150 : (item == Item.getItemFromBlock(Blocks.WOOL) ? 100 : (item == Item.getItemFromBlock(Blocks.CARPET) ? 67 : (item == Item.getItemFromBlock(Blocks.LADDER) ? 300 : (item == Item.getItemFromBlock(Blocks.WOODEN_BUTTON) ? 100 : (Block.getBlockFromItem(item).getDefaultState().getMaterial() == Material.WOOD ? 300 : (item == Item.getItemFromBlock(Blocks.COAL_BLOCK) ? 16000 : (item instanceof ItemTool && "WOOD".equals(((ItemTool)item).getToolMaterialName()) ? 200 : (item instanceof ItemSword && "WOOD".equals(((ItemSword)item).getToolMaterialName()) ? 200 : (item instanceof ItemHoe && "WOOD".equals(((ItemHoe)item).getMaterialName()) ? 200 : (item == Items.STICK ? 100 : (item != Items.BOW && item != Items.FISHING_ROD ? (item == Items.SIGN ? 200 : (item == Items.COAL ? 1600 : (item == Items.LAVA_BUCKET ? 20000 : (item != Item.getItemFromBlock(Blocks.SAPLING) && item != Items.BOWL ? (item == Items.BLAZE_ROD ? 2400 : (item instanceof ItemDoor && item != Items.IRON_DOOR ? 200 : (item instanceof ItemBoat ? 400 : 0))) : 100)))) : 300)))))))))));
    }
}