Flashlight in minecraft [Datapack]

Hi all! I want to present you my resource pack and data pack in minecraft, which add a real flashlight! The flashlight is fully functional, has a battery that needs to be charged regularly. The flashlight is activated by RMB and works both in the right and in the left hand! This datapack is a very worthy replacement for minecraft mods! Always wanted a flashlight in vanilla minecraft, but could never afford it? Then you've come to the right place! This news is also suitable for the creators of maps to pass.

The resource pack replaces the texture of the worn pumpkin with the texture of the light from the flashlight and adds a 3d model of the tool itself. The datapack, when pressed with RMB, puts a pumpkin on the player and gives the effect of night vision. When you press RMB again or if the player removes the lantern from their hand, the datapack removes the pumpkin from the player and removes the night vision effect.

There was a bug in the previous version of the datapack: when a player was put on a pumpkin, any helmet that was on his head at that moment was ruthlessly removed. In this version of the datapack, I fixed this bug. Now you don't have to worry about your super enchanted diamond helmet. When a pumpkin is put on you, the helmet will be saved in a special place. When the pumpkin is removed from you, the helmet will safely return to your head safe and sound.

To charge the flashlight, you need to take Glowstone Dust in your right hand. ~80 glowstone dust is enough to fully charge the flashlight battery. You can configure this parameter for yourself by going to the folder with the datapack in the /data/main/functions/battery folder. The battery.json file must be opened with Notepad++. Having entered the file, we change the value of adding scoreboard points battery. The higher the number, the less it takes to fully charge Glowstone Dust.

scoreboard players add @s battery 40
change the number 40 to whatever you want

Then we press Ctrl + s to save the changes, enter the world and write / reload.
If suddenly the datapack is bugged, enter /scoreboard players set @a click 0

List of changes:
Fixed bugs Improved flashlight model. The video shows the old version of the flashlight. The new version of the flashlight is shown in the gallery.