Creating Tipped Arrows

Hi guys,

just wondering how you can create tipped arrows? By which I mean controlling which effect they have (e.g. Arrow of Regeneration, Arrow of Harming II). Currently the code I have just says:

items.add(ItemStack.builder().itemType(ItemTypes.TIPPED_ARROW).quantity(3).build());

But of course that doesn’t actually tip the arrows with anything, does it?

Thanks in advance,

  • Nickick

Thats a case for data.
Try offering Keys.POTION_EFFECTS to the ItemStack.

Thanks for that :slight_smile:

I’ve written the following, and it works… To an extent haha - the arrows are called “Uncraftable Arrows of Slowness”. Just got to edit the names now.

ItemStack tippedArrows = ItemStack.builder().itemType(ItemTypes.TIPPED_ARROW).quantity(3).build();
PotionEffectData arrowEffect = tippedArrows.getOrCreate(PotionEffectData.class).get();
arrowEffect.addElement(PotionEffect.builder().amplifier(0).duration(1000).potionType(PotionEffectTypes.SLOWNESS).build());
tippedArrows.offer(arrowEffect);
items.add(tippedArrows);

I’d guess the “correct” name only shows up if you actually use the same PotionEffect as the craftable Potions have.

Actually it seems to be that the Tipped_Arrow item simply is that, I got the same effect from the /give command in game. And you can’t give normal arrows tipped effects with the method I used apparently. Anyways, it’s all good now, thanks for the help a bunch! :slight_smile: