我想让我的物品按右键就能放出一个瞬间治疗2药水,但是我这么写,放出来的药水没有任何治疗效果,只有特效
复制代码
想问一下,如何让药水带有治疗效果
Forge版本:14.23.4.2705
-     @Override
 
-     public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand) {
 
-         if (!world.isRemote) {
 
-             
 
-             NBTTagCompound potion3 = new NBTTagCompound().getCompoundTag("Potion");
 
-             potion3.setString("minecraft:strong_healing","1");
 
-             Item potion2 = new Item().getItemById(438);
 
-             ItemStack potion1 = new ItemStack(potion2, 1, 0, potion3);
 
-             
 
-             Entity potion = new EntityPotion(world, player.posX, player.posY, player.posZ, potion1);
 
 
-             world.spawnEntity(potion);
 
 
-         }
 
-         return super.onItemRightClick(world, player, hand);
 
- }
想问一下,如何让药水带有治疗效果
Forge版本:14.23.4.2705
为何不看看药水物品的源代码呢?
复制代码
如果要更好的自定义的说
复制代码
如果我的答案有帮助的话,请给我最高的评分
- PotionUtils.addPotionToItemStack(itemStack, PotionTypes.STRONG_HEALING);
如果要更好的自定义的说
- PotionUtils.appendEffects(itemStack, effects)
如果我的答案有帮助的话,请给我最高的评分