1

Add Lore To Held Item?

Drake__archer's Avatar Drake__archer1/22/24 6:15 pm history
1 emeralds 168 4
1/23/2024 4:15 pm
michaelo's Avatar michaelo
In my exercise datapack, i have a custom item called a Dumbbell, which can be used for long periods of time to make the player stronger, (by giving them a permanent strength effect), but i wanted to make it so Dumbbells with different weights gave the player a more and more powerful strength effect.

The way you would make the Dumbbell heavier is by holding it in your main hand, holding a Weight in your off hand, and right-clicking the Dumbbell while crouching.

I wanted to show the different weights by having the lore/description show the weight in Creepers, (0.5 Creepers, 1 Creeper, 5 Creepers, ect.), and i want it to be changeable.

I tried looking online, but i couldn't find anything for changing the lore of the item the player is holding, or even anything for changing the lore of items.

Is this even possible? If so, how would i go about doing it, and if not what could i do instead?

Any help would be greatly appreciated!


















P.S, i need some ideas for Speed, Jump Boost, Resistance, Dolphin's Grace, other positive effects, and the name of the datapack, (i was thinking Bloxersise?), so leave any minecrafty, exercise-related ideas below!
Posted by Drake__archer's Avatar
Drake__archer
Level 11 : Journeyman Modder
9

Create an account or sign in to comment.

4

michaelo
01/22/2024 8:10 pm
Level 32 : Artisan Chef
michaelo's Avatar
Modifying an item can be done with an item_modifier in data packs (https://minecraft.wiki/w/Item_modifier). This is an amazing generator to help with creating them: https://misode.github.io/item-modifier/.

Helpfully there is a set_lore function for you! You'll need Entity set to "this" and Replace set to "true", and then you can add whatever lore you like. Once you're done, it goes in data > namespace > item_modifiers. To apply it to your item you'd run the command:

item modify entity @s <slot> <modifier_name>
Hope that helps!
1
Drake__archer
01/23/2024 9:07 am
Level 11 : Journeyman Modder
Drake__archer's Avatar
i want to be able to change the lore based off of a specific variable. But the way this works would make it so i would need a seperate item modifier for every possible value.
1
michaelo
01/23/2024 4:15 pm
Level 32 : Artisan Chef
michaelo's Avatar
Yea as mega7 said, you can include scores like you can in tellraw. Here's an example of what I think you're trying to do: https://pastebin.com/Fb8Nnv6y
1
mega7
01/23/2024 10:44 am
Level 46 : Master Cupcake
history
mega7's Avatar
Use a score value instead of a number. Using the item modifiers you can make it so it gets its value from a certain score.
And don't forget to put the right scale.
1
Planet Minecraft

Website

© 2010 - 2024
www.planetminecraft.com

Welcome