

Energy Flashlight Modification
Energy Flashlight - Redstone-Powered Flashlight
This datapack modification adds a modern flashlight to the game that illuminates the entire path of its beam!
🔦 Main Purpose
Dealing with darkness in mines or caves? Now you have a reliable solution - a flashlight that uses redstone as an energy source and creates realistic lighting along the entire beam path.
⚙️ Important Features
Technical requirements: For proper light passage through incomplete blocks (such as slabs) you need to install the library datapack MIDWUT. Currently available in Russian, English, and Old Slavic languages.
Key Characteristics:
- Redstone particles are used as an energy source
- Realistic lighting system using light blocks
- Automatic charge consumption even when flashlight is not in hand
- Illumination range - 20 blocks forward with full beam path coverage
🛠️ Acquisition and Usage
Player can craft the flashlight or get it using command: /function energy_flashlight:give/flashlight
The crafting recipe becomes automatically available upon obtaining redstone lamp or redstone dust.
Charging Process: When flashlight charge reaches zero, charging instructions appear: hold flashlight in main hand, redstone dust in offhand, press Shift and use the flashlight.
Charging parameters:
- Maximum capacity - 10 units of redstone dust
- Each unit provides 6 minutes of real-world operation time
- Total operation time at full charge - 1 hour
💻 Technical Information for Developers
Custom Light Beams
The modification allows creating custom light beams. Note that the datapack tick function runs on a 2-tick schedule for optimization, so I added the function tag #energy_flashlight:tick
. You can add your own functions for creating light beams to this tag.
Why this is necessary:
- Optimize light source processing through unified mechanism
- Avoid synchronization errors during light block updates and removal
To create a custom light beam, you need to set its length and run the corresponding function. Length is measured in 0.5 block units, for example, beam length of 10 units equals 5 blocks.
# Basic range reaches 40 units
scoreboard players set #raycast main_score 40
execute anchored eyes positioned ^ ^ ^ run function energy_flashlight:other/raycast/loop
Alternative Charging Items
By default, flashlight accepts only vanilla redstone dust. However, if you add the tag energy_flashlight.energy_for_flashlight:true
to the minecraft:custom_data
component of any item, it can also be used for energy replenishment.
Operation Notes:
- System saves game time in the item and compares it with current time when picked up
- If more than an hour has passed since last use, flashlight automatically turns off
- Battery status updates every time flashlight is picked up