How to Make Custom Arrows (TUTORIAL)

Started by Mindthemoods on

Topic category: User side tutorials

Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How to Make Custom Arrows (TUTORIAL)
Tue, 12/12/2023 - 21:26 (edited)

This has been bugging me for awhile, and seems to be a pretty common question. Here's what I found from randomly mashing together snippets of different Github repositories until things compiled properly. (I will not pretend to have any decent knowledge of java, nor real understanding of how this stuff works, but it works.) 

You'll firstly need to create a ranged item. (A ranged item and a projectile entity, if you're using version 2023.4+. I'm writing this for 2023.3, but the basic idea should be the same.) Add whatever custom procedures, models, stats, etc; for the projectile. Then lock the mod element, open the item JSON file, (the one that ends with 'Item,') and rip out most of the ranged item code.

You instead want it to look something like this:

 

...Where 'ArrowTestItem' is replaced with the registry name of your item, 'ArrowTestEntity' is replaced with the name of the projectile entity, 'superiorstructures' is replaced with your mod id, 'SuperiorstructuresModEntities' is replaced with the name of your entity init file, (you can check your workspace src folder, but it should just be the same thing, plus a capitalized version of your mod id, since this is how MCreator formats things), and 'ARROW_TEST' is replaced with the name of your projectile as it appears in your entities init file. (Again, you can manually check this in your mod's init files, or just trust MCreator's formatting and do an uppercase version of the item name.) 

You will also probably want to change up the display json files so that the item isn't displayed in hand as a tool. (Just remove everything except the 'item generated' bit.)

Anyways, this appears to function in version 2023.3, and I hope this can at least save some people the trouble of searching the forums. 

Edited by Mindthemoods on Tue, 12/12/2023 - 21:26
Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Also, a couple of important…
Mon, 12/11/2023 - 11:53

Also, a couple of important side notes:

  • If you want your arrows to remain in the ground and be picked up like regular arrows, you need to go into the 'entity' json file of the locked element, delete the @Override section that says 'when in ground, discard,' and add a new section that looks something like this:
@Override
    protected ItemStack getPickupItem() {
        return new ItemStack(FabulousfletchingModItems.FORGED_ARROW.get());
    }
  • ...Replacing the thing that already looks like this, and making sure to replace 'fabulousfletching' with your Mod ID, and 'FORGED_ARROW' with the name of the item that should be picked up. You'll also need to add your ModItems init file to the imports underneath the ModEntities import.

    Also, it's somewhat annoying to find a vanilla arrow model. If you make your own, keep in mind that the vanilla arrows actually have their textures squished by about a third to make them look thinner. You can either rescale your texture to be bigger and thus similarly squished, or find a way to rescale the model.

Joined Dec 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Thanks! That is a useful…
Wed, 12/13/2023 - 21:50

Thanks! That is a useful tutorial!

Joined Jun 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Could you provide the…
Tue, 12/19/2023 - 21:12

Could you provide the workspace with everything that involves the arrow? I'm having problems with the texture, to be more exact ModEntities.MOD_ARROW.get() in the ArrowEntity.java

Joined Jan 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Tutorial for 1.16.5 (2022.1)…
Sun, 01/14/2024 - 22:54

Tutorial for 1.16.5 (2022.1) when?

Joined Oct 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
vanilla bows don't shoot it?
Mon, 01/15/2024 - 02:09

vanilla bows don't shoot it?

Joined Oct 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
A few more things you can…
Mon, 01/15/2024 - 02:41

A few more things you can add to make this better,

1, the item needs to be tagged with the arrow tag to be shot of out vanilla weapons,

2, if you want to render the item (inground) as a arrow replace its rendering function with:

 

public class YourArrowRenderer extends ArrowRenderer<YourArrowEntity > {

    private static final ResourceLocation texture = new ResourceLocation("yourmodId:textures/entities/textureName.png");



    public YourArrowRenderer(EntityRendererProvider.Context context) {

        super(context);

    }

    
    @Override

    public ResourceLocation getTextureLocation(YourArrowEntity entity) {

        return texture;

    }

}

Just add a custom model, then replace everything with this^

this renders a normal arrow model, with your texture, meaning you do not need to rescale anything.

Joined Jan 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
So I did everything the same…
Sun, 01/21/2024 - 09:07

So I did everything the same except for my mod and it shoots a regular arrow and uses the custom arrow. Idk what to do.

Joined Jun 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
@Mindthemoods The item Json…
Wed, 04/17/2024 - 06:05

@Mindthemoods The item Json file doesn't match the one in the image, the closest is the Java file, this is in 2023.4 however

Joined Jun 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
When I try to pick up the…
Mon, 07/29/2024 - 14:25

When I try to pick up the arrow, it gives me air