[Tutorial] Custom Bow pulling

Started by TheLuxureSlime on Fri, 08/28/2020 - 16:29

Topic category: User side tutorials

Last seen on 15:15, 23. Oct 2020
Joined Sep 2018
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
[Tutorial] Custom Bow pulling
Fri, 08/28/2020 - 16:29

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

Last seen on 04:17, 24. Oct 2020
Joined Jun 2020
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • 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?

 

Last seen on 17:21, 11. Sep 2020
Joined Aug 2020
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • 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");
        }
    }

 

Last seen on 17:21, 11. Sep 2020
Joined Aug 2020
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • 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

Last seen on 17:21, 11. Sep 2020
Joined Aug 2020
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • 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

Last seen on 15:15, 23. Oct 2020
Joined Sep 2018
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
still no
Sat, 09/05/2020 - 13:56

still no

Last seen on 15:15, 23. Oct 2020
Joined Sep 2018
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
but still wip
Sat, 09/05/2020 - 13:57

but still wip

Last seen on 15:15, 23. Oct 2020
Joined Sep 2018
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • 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

Last seen on 04:17, 24. Oct 2020
Joined Jun 2020
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • 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

Last seen on 23:03, 23. Oct 2020
Joined Jun 2020
User points:

User statistics:

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

doesn't ctr+w close the thing?

Last seen on 04:17, 24. Oct 2020
Joined Jun 2020
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • 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.

Last seen on 20:10, 23. Oct 2020
Joined Nov 2018
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • 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?