[Tutorial] Custom Bow pulling

Started by TheLuxureSlime on

Topic category: User side tutorials

Joined Sep 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
[Tutorial] Custom Bow pulling

Howdy everyone!
It's my first tutorial and im gonna show how to make pulling for your (maybe) amazing bow!


1 step: Modifying model
Go by this path: ~/src/main/resources/assets/your_mod_name/models/item
There choose your bow name. Example: example.json
Open your bow file.
Put in the end of your file this lines:
  },
    "overrides": [
        {
            "predicate": {
                "pulling": 1
            },
            "model": "your_mod_name:item/example_bow_pulling0"
        },
        {
            "predicate": {
                "pulling": 1,
                "pull": 0.65
            },
            "model": "your_mod_name:item/example_bow_pulling1"
        },
        {
            "predicate": {
                "pulling": 1,
                "pull": 0.9
            },
            "model": "your_mod_name:item/example_bow_pulling2"
        }
    ]
}

After make file: example_bow_pulling0.json
Replace pulling0 by pulling1, pulling2 or stay pulling0.
In pulling files write this:
{
    "parent": "item/bow",
    "textures": 
    {
        "layer0": "your_mod_name:items/example_bow_pulling0"
    }
}

Also, you need texture for your bow as well. So first step is finished! Let's go in second step.


2nd step: Codding


Don't scary! It will be easy! I hope!
1st: Find public ItemRanged():
Put in it this lines:
this.addPropertyOverride(new ResourceLocation("pull"), (p_210310_0_, p_210310_1_, p_210310_2_) -> {
                if (p_210310_2_ == null) {
                    return 0.0F;
                } else {
                    return !(p_210310_2_.getActiveItemStack().getItem() instanceof BowItem)
                            ? 0.0F
                            : (float) (p_210310_0_.getUseDuration() - p_210310_2_.getItemInUseCount()) / 20.0F;
                }
            });
            this.addPropertyOverride(new ResourceLocation("pulling"), (p_210309_0_, p_210309_1_, p_210309_2_) -> {
                return p_210309_2_ != null && p_210309_2_.isHandActive() && p_210309_2_.getActiveItemStack() == p_210309_0_ ? 1.0F : 0.0F;
            });

And finished!
Also, click on CTRL+W. It possibly will fix some errors in your code.
Currently, it works only with pulling0 so when i will figured how make pulling1 and pulling2 work im will update this 'tutorial'. (I would not call it a tutorial)


And thanks what read this.
If you have any questions, feel free to ask me

Joined Jun 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Have you figured how to get…
Sat, 08/29/2020 - 19:45

Have you figured how to get it to work with all 3 pulling textures?

 

Joined Aug 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
public static class…
Tue, 09/01/2020 - 17:59
public static class ItemRanged extends BowItem {
        public ItemRanged() {
            super(new Item.Properties().group(ItemGroup.COMBAT).maxDamage(25));
            setRegistryName("dirt_bow");
        }
    }

 

Joined Aug 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
This is how you get a bow…
Tue, 09/01/2020 - 18:00

This is how you get a bow with all its defaults except durability because i set it to 25

Joined Aug 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
also TheLuxureSlime posted…
Tue, 09/01/2020 - 18:13

also TheLuxureSlime posted the code for three textures. just make sure you have 3 models for the bow pulling

Joined Sep 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
@Jarglo33 (Tue, 09/01/2020 -…
Sat, 09/05/2020 - 14:00

@Jarglo33 (Tue, 09/01/2020 - 18:00)
ehh, sorry as question, but what you written? i just cant understand, sry

Joined Jun 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
ok please tell me when you…
Sat, 09/05/2020 - 19:06

ok please tell me when you get it to fully work

Joined Jun 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
doesn't ctr+w close the…
Wed, 09/23/2020 - 07:55

doesn't ctr+w close the thing?

Joined Jun 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
No it reorganizes teh the…
Thu, 09/24/2020 - 02:36

No it reorganizes teh the entire class, adds imports that are missing, and takes away imports that aren't used.

Joined Nov 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Please can you explain what …
Thu, 10/08/2020 - 15:34

Please can you explain what (p_210310_0_, p_210310_1_, p_210310_2_) does?

Joined Jan 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
do you have how to do the…
Sun, 02/28/2021 - 16:44

do you have how to do the rest of the animations? is that I am making a mod that adds skins to the game (such as pickaxes, axes, shovels, tridents, bows, etc) and I need to know how to make the complete animations of the bow-crossbow

Joined Mar 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
sorry but what game version…
Thu, 03/04/2021 - 23:28

sorry but what game version is this for?

Joined May 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Is this working on 1.16.5…
Thu, 05/06/2021 - 17:38

Is this working on 1.16.5 with the current creator?