Exemple #1
0
 @Override
 public ItemStack onItemRightClick(
     ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
   AllomancyData data;
   data = AllomancyData.forPlayer(par3EntityPlayer);
   if (data.MetalAmounts[par1ItemStack.getItemDamage() - 1] < 10) {
     par3EntityPlayer.setItemInUse(par1ItemStack, this.getMaxItemUseDuration(par1ItemStack));
   }
   return par1ItemStack;
 }
Exemple #2
0
  @Override
  public ItemStack onEaten(
      ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
    // TODO Auto-generated method stub
    AllomancyData data;
    data = AllomancyData.forPlayer(par3EntityPlayer);
    if (par3EntityPlayer.capabilities.isCreativeMode) {
      ++par1ItemStack.stackSize;
    }
    if (data == null) {
      return par1ItemStack;
    }

    if (par1ItemStack.getItemDamage() == 0) {
      return par1ItemStack;
    }

    if (data.MetalAmounts[par1ItemStack.getItemDamage() - 1] < 10) {
      data.MetalAmounts[par1ItemStack.getItemDamage() - 1]++;
    }
    return super.onEaten(par1ItemStack, par2World, par3EntityPlayer);
  }