Topic category: User side tutorials
(Used and tested for MCreator 2024.3 only, no guarantees it will work in the future)
This tutorial was largely based off of https://mcreator.net/forum/102341/how-make-custom-arrows-tutorial, with some tweaks for 2024.3 and some additional info
1. Create an Item game element. Set its properties, triggers, and whatnot now, because changing it later will be more difficult.
2. Create a Projectile game element. If you want the vanilla arrow model, set the model to something that's not Default anyways as this will generate the Renderer file for the element.
3. Lock the item element by using Right Click -> Lock/unlock mod element or the sixth (bottom-most) button in the workspace (it looks like a lock)
4. Go into the Item element's java file
4a. Add these imports, if they're not there already:
Note that naming will differ, so use your mod / item / projectile's name when necessary.
If you're unaware of java syntax, anything starting with // is a comment, so you can leave those out.
4b. Add this method to the same file
Explanation: this method is called by BowItem.java and CrossbowItem.java when accessing the entity to shoot. If invalid or not given, the entity will default to a vanilla arrow.
4c. Change the parent class from Item to ArrowItem.
public class TestItem extends ArrowItem
Explanation: BowItem.java and CrossbowItem.java will check if the given item stack is an child of ArrowItem. If not, the arrow entity will be default to a vanilla arrow.
Your item code should now look something like this:
5. Go to Element Tags and add the item and projectile elements to their respective arrow tags. If the tags aren't already there, click on Add common tags -> Items / Entities -> minecraft:arrows. Also add the projectile to minecraft:impact_projectiles if applicable.
Explanation: (I think) this tells minecraft that the item element can be consumed as an arrow. I'm not sure what the entity tag does though.
6 (optional). To make the item able to be picked up from the ground, lock the projectile element and open its Entity java file. Delete the lines
if (this.inGround)
this.discard();
from the tick method.
7 (optional). If you want a vanilla arrow model, lock the projectile element (if you haven't already) and go to the Renderer java file. Add
import net.minecraft.client.renderer.entity.ArrowRenderer;
and then change the parent class from EntityRenderer<> to ArrowRenderer<>
public class TestProjectileRenderer extends ArrowRenderer<TestProjectileEntity>
Then, delete the render method and the model variable. Free free to delete any unused imports. Your Renderer file should now look something like this:
Explanation: (I think) removing the render method lets minecraft use the default arrow model.
Make sure your custom texture matches the arrow model.
This should work? If it doesn't the issue is probably:
1. The names aren't changed to that of your mod elements
2. There is some missing import
3. I forgot something (very likely)
hopefully this was helpful!