How to Make Custom Arrows (TUTORIAL)

Started by Mindthemoods on

Topic category: User side tutorials

Last seen on 10:38, 22. Apr 2024
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
Last seen on 10:38, 22. Apr 2024
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.

Last seen on 07:27, 9. Apr 2024
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!

Last seen on 15:10, 24. Dec 2023
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

Last seen on 18:52, 28. Feb 2024
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?

Last seen on 21:29, 15. Feb 2024
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?

Last seen on 21:29, 15. Feb 2024
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.

Last seen on 18:52, 28. Feb 2024
Joined Jan 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Ok so I'm trying to do this…
Tue, 01/16/2024 - 20:44

Ok so I'm trying to do this for 1.16.5 and I keep getting these errors, I would appreciate any help, hope you all have a great day/night.

MCreator Crash#2 - Pastebin.com

Last seen on 06:20, 28. Jan 2024
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.

Last seen on 04:56, 22. Apr 2024
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