You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
51 lines
1.5 KiB
Java
51 lines
1.5 KiB
Java
package net.minecraft.item;
|
|
|
|
import net.minecraft.creativetab.CreativeTabs;
|
|
import net.minecraft.entity.EntityLivingBase;
|
|
import net.minecraft.entity.passive.EntityPig;
|
|
import net.minecraft.entity.player.EntityPlayer;
|
|
|
|
public class ItemSaddle extends Item
|
|
{
|
|
private static final String __OBFID = "CL_00000059";
|
|
|
|
public ItemSaddle()
|
|
{
|
|
this.maxStackSize = 1;
|
|
this.setCreativeTab(CreativeTabs.tabTransport);
|
|
}
|
|
|
|
/**
|
|
* Returns true if the item can be used on the given entity, e.g. shears on sheep.
|
|
*/
|
|
public boolean itemInteractionForEntity(ItemStack stack, EntityPlayer player, EntityLivingBase target)
|
|
{
|
|
if (target instanceof EntityPig)
|
|
{
|
|
EntityPig entitypig = (EntityPig)target;
|
|
|
|
if (!entitypig.getSaddled() && !entitypig.isChild())
|
|
{
|
|
entitypig.setSaddled(true);
|
|
entitypig.worldObj.playSoundAtEntity(entitypig, "mob.horse.leather", 0.5F, 1.0F);
|
|
--stack.stackSize;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
else
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Current implementations of this method in child classes do not use the entry argument beside ev. They just raise
|
|
* the damage on the stack.
|
|
*/
|
|
public boolean hitEntity(ItemStack stack, EntityLivingBase p_77644_2_, EntityLivingBase p_77644_3_)
|
|
{
|
|
this.itemInteractionForEntity(stack, (EntityPlayer)null, p_77644_2_);
|
|
return true;
|
|
}
|
|
} |