ksgfk
我想让我的物品按右键就能放出一个瞬间治疗2药水,但是我这么写,放出来的药水没有任何治疗效果,只有特效
  1.     @Override
  2.     public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand) {
  3.         if (!world.isRemote) {
  4.             
  5.             NBTTagCompound potion3 = new NBTTagCompound().getCompoundTag("Potion");
  6.             potion3.setString("minecraft:strong_healing","1");
  7.             Item potion2 = new Item().getItemById(438);
  8.             ItemStack potion1 = new ItemStack(potion2, 1, 0, potion3);
  9.             
  10.             Entity potion = new EntityPotion(world, player.posX, player.posY, player.posZ, potion1);

  11.             world.spawnEntity(potion);

  12.         }
  13.         return super.onItemRightClick(world, player, hand);
  14.     }
复制代码

想问一下,如何让药水带有治疗效果
Forge版本:14.23.4.2705

耗子
为何不看看药水物品的源代码呢?
  1. PotionUtils.addPotionToItemStack(itemStack, PotionTypes.STRONG_HEALING);
复制代码

如果要更好的自定义的说
  1. PotionUtils.appendEffects(itemStack, effects)
复制代码


如果我的答案有帮助的话,请给我最高的评分