Exemplo n.º 1
0
  /** Called when a player right clicks an entity with an item. */
  public boolean itemInteractionForEntity(ItemStack par1ItemStack, EntityLiving par2EntityLiving) {
    if (par2EntityLiving instanceof EntityPig) {
      EntityPig entitypig = (EntityPig) par2EntityLiving;

      if (!entitypig.getSaddled() && !entitypig.isChild()) {
        entitypig.setSaddled(true);
        --par1ItemStack.stackSize;
      }

      return true;
    } else {
      return false;
    }
  }
Exemplo n.º 2
0
  public boolean func_111207_a(
      ItemStack p_111207_1_, EntityPlayer p_111207_2_, EntityLivingBase p_111207_3_) {
    if (p_111207_3_ instanceof EntityPig) {
      EntityPig var4 = (EntityPig) p_111207_3_;
      if (!var4.func_70901_n() && !var4.func_70631_g_()) {
        var4.func_70900_e(true);
        --p_111207_1_.field_77994_a;
      }

      return true;
    } else {
      return false;
    }
  }
Exemplo n.º 3
0
  /** Returns true if the item can be used on the given entity, e.g. shears on sheep. */
  public boolean itemInteractionForEntity(
      ItemStack stack, EntityPlayer playerIn, EntityLivingBase target) {
    if (target instanceof EntityPig) {
      EntityPig var4 = (EntityPig) target;

      if (!var4.getSaddled() && !var4.isChild()) {
        var4.setSaddled(true);
        var4.worldObj.playSoundAtEntity(var4, "mob.horse.leather", 0.5F, 1.0F);
        --stack.stackSize;
      }

      return true;
    } else {
      return false;
    }
  }
Exemplo n.º 4
0
  /**
   * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack,
   * world, entityPlayer
   */
  public ItemStack onItemRightClick(
      ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
    if (par3EntityPlayer.isRiding() && par3EntityPlayer.ridingEntity instanceof EntityPig) {
      EntityPig var4 = (EntityPig) par3EntityPlayer.ridingEntity;

      if (var4.getAIControlledByPlayer().isControlledByPlayer()
          && par1ItemStack.getMaxDamage() - par1ItemStack.getItemDamage() >= 7) {
        var4.getAIControlledByPlayer().boostSpeed();
        par1ItemStack.damageItem(7, par3EntityPlayer);

        if (par1ItemStack.stackSize == 0) {
          ItemStack var5 = new ItemStack(Item.fishingRod);
          var5.setTagCompound(par1ItemStack.stackTagCompound);
          return var5;
        }
      }
    }

    return par1ItemStack;
  }
  public int getDamageVsEntity(Entity var1) {
    if (var1 instanceof EntityCreeper) {
      ((EntityCreeper) var1).getDataWatcher().updateObject(17, Byte.valueOf((byte) 1));
    }

    if (var1 instanceof EntityPig) {
      ((EntityPig) var1).onStruckByLightning((EntityLightningBolt) null);
      return 0;
    } else {
      return super.getDamageVsEntity(var1);
    }
  }
 @Override
 public void dropFewItems(boolean isHitByPlayer, int looting, List<EntityItem> drops) {
   super.dropFewItems(isHitByPlayer, looting, drops);
   if (this.entity.getSaddled()) {
     this.entity.dropItem(Items.saddle, 1);
   }
   if (entity.isBurning()) {
     for (EntityItem i : drops) {
       if (i.getEntityItem().getItem() == Items.porkchop) {
         i.setEntityItemStack(new ItemStack(Items.cooked_porkchop, i.getEntityItem().stackSize));
       }
     }
   }
 }