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

The following are Jave code examples for showing how to use fish() 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: EntityOcelot.java   View Source Code Vote up 4 votes
/**
 * Called when a player interacts with a mob. e.g. gets milk from a cow, gets into the saddle on a pig.
 */
public boolean interact(EntityPlayer player)
{
    ItemStack itemstack = player.inventory.getCurrentItem();

    if (this.isTamed())
    {
        if (this.isOwner(player) && !this.worldObj.isRemote && !this.isBreedingItem(itemstack))
        {
            this.aiSit.setSitting(!this.isSitting());
        }
    }
    else if (this.aiTempt.isRunning() && itemstack != null && itemstack.getItem() == Items.fish && player.getDistanceSqToEntity(this) < 9.0D)
    {
        if (!player.capabilities.isCreativeMode)
        {
            --itemstack.stackSize;
        }

        if (itemstack.stackSize <= 0)
        {
            player.inventory.setInventorySlotContents(player.inventory.currentItem, (ItemStack)null);
        }

        if (!this.worldObj.isRemote)
        {
            if (this.rand.nextInt(3) == 0)
            {
                this.setTamed(true);
                this.setTameSkin(1 + this.worldObj.rand.nextInt(3));
                this.setOwnerId(player.getUniqueID().toString());
                this.playTameEffect(true);
                this.aiSit.setSitting(true);
                this.worldObj.setEntityState(this, (byte)7);
            }
            else
            {
                this.playTameEffect(false);
                this.worldObj.setEntityState(this, (byte)6);
            }
        }

        return true;
    }

    return super.interact(player);
}
 
Example 2
Project: DecompiledMinecraft   File: EntityOcelot.java   View Source Code Vote up 4 votes
/**
 * Checks if the parameter is an item which this animal can be fed to breed it (wheat, carrots or seeds depending on
 * the animal type)
 */
public boolean isBreedingItem(ItemStack stack)
{
    return stack != null && stack.getItem() == Items.fish;
}
 
Example 3
Project: DecompiledMinecraft   File: EntityOcelot.java   View Source Code Vote up 4 votes
/**
 * Called when a player interacts with a mob. e.g. gets milk from a cow, gets into the saddle on a pig.
 */
public boolean interact(EntityPlayer player)
{
    ItemStack itemstack = player.inventory.getCurrentItem();

    if (this.isTamed())
    {
        if (this.isOwner(player) && !this.worldObj.isRemote && !this.isBreedingItem(itemstack))
        {
            this.aiSit.setSitting(!this.isSitting());
        }
    }
    else if (this.aiTempt.isRunning() && itemstack != null && itemstack.getItem() == Items.fish && player.getDistanceSqToEntity(this) < 9.0D)
    {
        if (!player.capabilities.isCreativeMode)
        {
            --itemstack.stackSize;
        }

        if (itemstack.stackSize <= 0)
        {
            player.inventory.setInventorySlotContents(player.inventory.currentItem, (ItemStack)null);
        }

        if (!this.worldObj.isRemote)
        {
            if (this.rand.nextInt(3) == 0)
            {
                this.setTamed(true);
                this.setTameSkin(1 + this.worldObj.rand.nextInt(3));
                this.setOwnerId(player.getUniqueID().toString());
                this.playTameEffect(true);
                this.aiSit.setSitting(true);
                this.worldObj.setEntityState(this, (byte)7);
            }
            else
            {
                this.playTameEffect(false);
                this.worldObj.setEntityState(this, (byte)6);
            }
        }

        return true;
    }

    return super.interact(player);
}
 
Example 4
Project: DecompiledMinecraft   File: EntityOcelot.java   View Source Code Vote up 4 votes
/**
 * Checks if the parameter is an item which this animal can be fed to breed it (wheat, carrots or seeds depending on
 * the animal type)
 */
public boolean isBreedingItem(ItemStack stack)
{
    return stack != null && stack.getItem() == Items.fish;
}
 
Example 5
Project: BaseClient   File: EntityOcelot.java   View Source Code Vote up 4 votes
/**
 * Called when a player interacts with a mob. e.g. gets milk from a cow, gets into the saddle on a pig.
 */
public boolean interact(EntityPlayer player)
{
    ItemStack itemstack = player.inventory.getCurrentItem();

    if (this.isTamed())
    {
        if (this.isOwner(player) && !this.worldObj.isRemote && !this.isBreedingItem(itemstack))
        {
            this.aiSit.setSitting(!this.isSitting());
        }
    }
    else if (this.aiTempt.isRunning() && itemstack != null && itemstack.getItem() == Items.fish && player.getDistanceSqToEntity(this) < 9.0D)
    {
        if (!player.capabilities.isCreativeMode)
        {
            --itemstack.stackSize;
        }

        if (itemstack.stackSize <= 0)
        {
            player.inventory.setInventorySlotContents(player.inventory.currentItem, (ItemStack)null);
        }

        if (!this.worldObj.isRemote)
        {
            if (this.rand.nextInt(3) == 0)
            {
                this.setTamed(true);
                this.setTameSkin(1 + this.worldObj.rand.nextInt(3));
                this.setOwnerId(player.getUniqueID().toString());
                this.playTameEffect(true);
                this.aiSit.setSitting(true);
                this.worldObj.setEntityState(this, (byte)7);
            }
            else
            {
                this.playTameEffect(false);
                this.worldObj.setEntityState(this, (byte)6);
            }
        }

        return true;
    }

    return super.interact(player);
}
 
Example 6
Project: BaseClient   File: EntityOcelot.java   View Source Code Vote up 4 votes
/**
 * Checks if the parameter is an item which this animal can be fed to breed it (wheat, carrots or seeds depending on
 * the animal type)
 */
public boolean isBreedingItem(ItemStack stack)
{
    return stack != null && stack.getItem() == Items.fish;
}
 
Example 7
Project: BaseClient   File: EntityOcelot.java   View Source Code Vote up 4 votes
/**
 * Called when a player interacts with a mob. e.g. gets milk from a cow, gets into the saddle on a pig.
 */
public boolean interact(EntityPlayer player)
{
    ItemStack itemstack = player.inventory.getCurrentItem();

    if (this.isTamed())
    {
        if (this.isOwner(player) && !this.worldObj.isRemote && !this.isBreedingItem(itemstack))
        {
            this.aiSit.setSitting(!this.isSitting());
        }
    }
    else if (this.aiTempt.isRunning() && itemstack != null && itemstack.getItem() == Items.fish && player.getDistanceSqToEntity(this) < 9.0D)
    {
        if (!player.capabilities.isCreativeMode)
        {
            --itemstack.stackSize;
        }

        if (itemstack.stackSize <= 0)
        {
            player.inventory.setInventorySlotContents(player.inventory.currentItem, (ItemStack)null);
        }

        if (!this.worldObj.isRemote)
        {
            if (this.rand.nextInt(3) == 0)
            {
                this.setTamed(true);
                this.setTameSkin(1 + this.worldObj.rand.nextInt(3));
                this.setOwnerId(player.getUniqueID().toString());
                this.playTameEffect(true);
                this.aiSit.setSitting(true);
                this.worldObj.setEntityState(this, (byte)7);
            }
            else
            {
                this.playTameEffect(false);
                this.worldObj.setEntityState(this, (byte)6);
            }
        }

        return true;
    }

    return super.interact(player);
}
 
Example 8
Project: BaseClient   File: EntityOcelot.java   View Source Code Vote up 4 votes
/**
 * Checks if the parameter is an item which this animal can be fed to breed it (wheat, carrots or seeds depending on
 * the animal type)
 */
public boolean isBreedingItem(ItemStack stack)
{
    return stack != null && stack.getItem() == Items.fish;
}