Topic category: User side tutorials
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
Have you figured how to get it to work with all 3 pulling textures?
This is how you get a bow with all its defaults except durability because i set it to 25
also TheLuxureSlime posted the code for three textures. just make sure you have 3 models for the bow pulling
still no
but still wip
@Jarglo33 (Tue, 09/01/2020 - 18:00)
ehh, sorry as question, but what you written? i just cant understand, sry
ok please tell me when you get it to fully work
doesn't ctr+w close the thing?
No it reorganizes teh the entire class, adds imports that are missing, and takes away imports that aren't used.
Please can you explain what (p_210310_0_, p_210310_1_, p_210310_2_) does?
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
sorry but what game version is this for?
Is this working on 1.16.5 with the current creator?