Exemplo n.º 1
0
 public void useCurrentItemOnEntity(Entity entity) {
   if (entity.interact(this)) {
     return;
   }
   ItemStack itemstack = getCurrentEquippedItem();
   if (itemstack != null && (entity instanceof EntityLiving)) {
     itemstack.useItemOnEntity((EntityLiving) entity);
     if (itemstack.stackSize <= 0) {
       itemstack.onItemDestroyedByUse(this);
       destroyCurrentEquippedItem();
     }
   }
 }
Exemplo n.º 2
0
  /** Uses the currently equipped item on the specified entity. Args: entity */
  public void useCurrentItemOnEntity(Entity par1Entity) {
    if (!ForgeHooks.onEntityInteract(this, par1Entity, false)) {
      return;
    }
    if (!par1Entity.interact(this)) {
      ItemStack var2 = this.getCurrentEquippedItem();

      if (var2 != null && par1Entity instanceof EntityLiving) {
        var2.useItemOnEntity((EntityLiving) par1Entity);

        if (var2.stackSize <= 0) {
          var2.onItemDestroyedByUse(this);
          this.destroyCurrentEquippedItem();
        }
      }
    }
  }