Пример #1
0
  public boolean hitEntity(ItemStack itemstack, EntityLiving mob, EntityLiving entityliving1) {
    World world = entityliving1.worldObj;
    if (type1 == type2) {
      attacks(itemstack, world, entityliving1, mob, type1);
    } else {
      if (random.nextInt(100) + 1 <= 80) {
        attacks(itemstack, world, entityliving1, mob, type1);
      }
      if (random.nextInt(100) + 1 <= 20) {
        attacks(itemstack, world, entityliving1, mob, type2);
      }
    }
    int i = itemstack.getItemDamage();
    if (i >= dur) {
      itemstack.stackSize = 0;
    }
    if (type1 == 3 || type2 == 3 || type1 == 4 || type2 == 4 || type1 == 8 || type2 == 8) {
      if (random.nextInt(100) + 1 <= 90) {
        itemstack.damageItem(1, entityliving1);
      }
    } else {
      itemstack.damageItem(1, entityliving1);
    }

    return true;
  }
Пример #2
0
 public boolean onBlockDestroyed(
     ItemStack itemstack, int i, int j, int k, int l, EntityLiving entityliving) {
   int i1 = itemstack.getItemDamage();
   if (i1 >= dur) {
     itemstack.stackSize = 0;
   }
   itemstack.damageItem(2, entityliving);
   return true;
 }
Пример #3
0
 public boolean onBlockDestroyed(
     ItemStack par1ItemStack,
     int par2,
     int par3,
     int par4,
     int par5,
     EntityLiving par6EntityLiving) {
   par1ItemStack.damageItem(2, par6EntityLiving);
   return true;
 }
Пример #4
0
  public ItemStack onItemRightClick(
      ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
    super.onItemRightClick(par1ItemStack, par2World, par3EntityPlayer);
    InventoryPlayer inventory = par3EntityPlayer.inventory;
    for (int var2 = 0; var2 < par3EntityPlayer.inventory.mainInventory.length; ++var2) {
      if (par3EntityPlayer.inventory.mainInventory[var2] != null
          && par3EntityPlayer.inventory.mainInventory[var2].itemID
              == Alptraum.alpMultiItem.shiftedIndex
          && par3EntityPlayer.inventory.mainInventory[var2].getItemDamage() == 2) {
        System.out.println("yup");
        ItemStack residueItemStack = inventory.mainInventory[var2];
        int stackSize = residueItemStack.stackSize;
        if (stackSize >= 5) {
          for (int i = 0; i < 5; i++) {
            if (par3EntityPlayer.inventory.mainInventory[var2].getItemDamage() == 2) {
              par3EntityPlayer.inventory.mainInventory[var2].stackSize--;
            }
          }
          par1ItemStack.damageItem(-100, par3EntityPlayer);

        } else if (stackSize < 5) {
          System.out.println("" + stackSize);
          for (int i = 0; i <= stackSize + 1; i++) {
            if (par3EntityPlayer.inventory.mainInventory[var2] != null
                && par3EntityPlayer.inventory.mainInventory[var2].getItemDamage() == 2) {
              par3EntityPlayer.inventory.mainInventory[var2].stackSize--;
              stackSize--;
              System.out.println("" + stackSize);
              if (stackSize <= 0) {
                inventory.mainInventory[var2] = null;
              }
            }
            par1ItemStack.damageItem(-20, par3EntityPlayer);
          }
        }
        if (par1ItemStack.getItemDamage() < 0) {
          par1ItemStack.setItemDamage(0);
        }
        return par1ItemStack;
      }
    }
    return par1ItemStack;
  }
  @Override
  public boolean onItemUse(
      ItemStack itemStack,
      EntityPlayer entityPlayer,
      World world,
      int x,
      int y,
      int z,
      int l,
      float f1,
      float f2,
      float f3) {
    boolean result = TransmutationHelper.transmuteInWorld(world, entityPlayer, itemStack, x, y, z);

    if (result) {
      itemStack.damageItem(1, entityPlayer);
    }

    return result;
  }
Пример #6
0
 public void onUpdate(ItemStack itemstack, World world, Entity entity, int i, boolean flag) {
   if (itemstack.getItemDamage() > 0) {
     itemstack.damageItem(-1, (EntityLiving) entity);
   }
 }
Пример #7
0
 /**
  * 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 par1ItemStack, EntityLiving par2EntityLiving, EntityLiving par3EntityLiving) {
   par1ItemStack.damageItem(1, par3EntityLiving);
   return true;
 }