Mods / lantern

Category: #Tweak
Author: OmegaHaxors
Side: Both
Created: Oct 9th at 4:00 AM
Last modified: Nov 14th at 7:22 AM
Downloads: 376
Follow Unfollow 9

Extends the range of all player-held lights with the "lightdistance" attribute with little invisible light entities.
Now with mod support, configurable distance, and colored lights support.


Hey, isn't that the "Mario is Missing" box art?
I have no idea what you're talking about.

Are you kidding?? But that's clearly Luigi...
You must be mistaken. That's Mr. Lantern.

Why is Mr. Lantern frowning?
Because he didn't install the lantern mod.

So now that mod support is a thing, how do I make my light block compatible?
Just give it the "lightdistance: 21" attribute with the value representing how far (in blocks) you want the light beam to reach.
Here's how it works internally: First it creates an orb 9 blocks away. It will then create a new light orb every 4 blocks until it reaches or surpasses the defined distance.

Do I need to be a coder or can JSON modders/patchers use this system too?
You can add the value to the "attributes" or "attributesbytype" section of your JSON.
attributes: {lightdistance: 21} Simple as.

Do I have to worry about setting the light level and color?
Nope not at all. It uses the HSV already defined in JSON.

You think Mr. Lantern is going to download the mod now?
Probably not. He's too busy looking for his lost brother.

Is there a max limit to how far lantern light can go?
There isn't any, but any past 80 becomes meaningless since entities (and their light) stop rendering that far out.

Version For Game version Downloads Release date Changelog Download
v2.0.2 93 Nov 14th at 7:22 AM Show
v2.0.1 162 Oct 11th at 4:03 AM Show
v2.0.0 20 Oct 11th at 3:21 AM Show
v1.2.0 42 Oct 9th at 5:14 PM Show
v1.1.1 33 Oct 9th at 1:53 PM Show
v1.1.0 26 Oct 9th at 4:01 AM Show

22 Comments (oldest first | newest first)

💬 OmegaHaxors, Nov 20th at 5:34 PM

Thanks for reporting, yeah sounds like my mod exposed a memory leak in the base game. Nothing I can do about it sadly.

💬 macoto_hino, Nov 20th at 2:56 PM

I used the performance-reduced version, and while previously there was a noticeable FPS drop after 30 to 40 minutes, this time the FPS drop did not occur until 3 hours.
When continuing to view a fixed point, the flickering of lights is a concern, but it is a small disadvantage compared to the advantage of being able to illuminate a pitch-black front.
I look forward to a more complete and stable version.😆

💬 OmegaHaxors, Nov 14th at 6:27 PM

May have had something to do with it, yes. New low-lag version will especially help the Temporal Lamp

💬 l33tmaan, Nov 14th at 6:20 PM

Oh! I had suspicions that my temporal lantern's god-like beam of light was causing part of my performance issues. That thing is bonkers, man. Hopefully this helps!

💬 OmegaHaxors, Nov 14th at 6:53 AM

Just a theory but one way of making it less hard on performance would be to spawn moving light orbs which cast out forwards of the player and increase the frequency until it looks congruent.

EDIT: Couldn't figure out how to do that, instead i'm uploading a "low lag" version with the following changes:
- Light spawn rate and life increased from 0.1s -> 1s (runs 10x slower therefore producing 10x less lights)
- Near-light distance increased from 9 ->12 and far-light distance increased from 4 -> 7 (reduces lights from 4 -> 3)

This won't fix the core problem but it will make things a little better for servers and low-performance worlds.

💬 SpearAndFang, Nov 14th at 4:52 AM

I hope something can be done to mitigate the lag.  I really want to use this mod but unfortunately it's just too overwhelming for my machine.

💬 TheNiteFox, Nov 3rd at 11:12 PM

@macoto_hino Yeah this has been happening to me, the LAg Issue that is, Ive been going thru my mods and only keeping ones that dont completely freeze my screen. Though if you are playing in 1.17 like myself there seems to be some vanilla base game bugs with fruit tree textures that occassionally cause memory leaks, saving and reloading seems to do the trick if that error pops up because its totally random x.x and its freaking annoying. I really hopedits fixed by 1.18

💬 macoto_hino, Oct 30th at 3:28 AM

Oh, I see.
I'm not sure about recompiling, and I thought the range of the lantern was just fine, but I'm going to give up using it because the FPS starts dropping 30-40 minutes after logging into the server.
By the way, is this symptom happening to you or anyone else who has installed other mods?

💬 OmegaHaxors, Oct 29th at 11:56 PM

There is a way to lower lag but you'd need to decompile the mod then recompile it from source.
Your two options is to make the entities last longer which may cause flickering and delay on the light.
The other option is to increase the distance between each light orb which will cause the beam to become misshapen.

The only way to lower lag without code is to lower the range of lanterns, you can do this in the mod's JSON patch.

💬 macoto_hino, Oct 29th at 10:58 PM

You are saying that the entity's judgment continues to remain in the area where you pointed the lantern and shined the light, right?
Can that be mitigated by some setting?

💬 OmegaHaxors, Oct 29th at 5:32 PM

The mod works by creating lots of little light entities with a short life span.
My guess is that the game isn't garbage-collecting them after they die?

💬 macoto_hino, Oct 29th at 3:41 PM

I think this mod, which can add directional lights in the direction the mouse cursor is pointed, is very nice.
However, when this mod is installed, it seems to cause the FPS to drop over time.
I have confirmed this symptom in multiplayer, but I am happy to report that the symptom was reset when I logged back in.

💬 l33tmaan, Oct 11th at 4:51 AM

Oh, that image helps a LOT. I'm going to install this immediately.

💬 SpearAndFang, Oct 11th at 4:43 AM

So good, thanks for this.  this is seriously one of my new must have mods.  

💬 OmegaHaxors, Oct 11th at 3:21 AM

Thanks to SpearAndFang for helping me with this one.
Two huge updates:
1) Now supports colored lights and custom lightvalue and
2) Now works with ANY block light. That's right, ANY.

To allow your block light to use the system, simply set the attribute lightdistance: 21 in JSON, replacing 21 with your distance of choice.
The system will take the HSV value from the block so that the casted light will be the same strength and color as the original block.
The new update will come bundled with a patch which gives this attribute to the lantern, so nothing will change from your prospective.

💬 OmegaHaxors, Oct 10th at 5:06 PM

That would be lovely. I took a few stabs at it myself but didn't have any success.
I'm just no good when it comes to client-sided code.

💬 SpearAndFang, Oct 10th at 8:16 AM

"If you find a way around this please tell me so I don't have to hard-code the light HSV."

I have found a way around that.  It requires a few changes here and there so I'd rather not post it here.  I could PM you on Discord if you like.

💬 OmegaHaxors, Oct 9th at 5:11 PM

Courtesy of

💬 OmegaHaxors, Oct 9th at 1:26 PM

Any way to make them not produce bubbles in water? They just use the base EntityAgent class.
EDIT: figured it out. Turns out that entityagents will produce particles when moving in water.
EDIT2: Sadly turns out all entities are hard-coded to interact with fluids, so this is impossible to fix.

Also thanks for reminding me to make them work in the offhand. They now work in the offhand.

Lamps have more range.

💬 Edel_Recke, Oct 9th at 11:50 AM


quote: "Extends the range of all player-held lights using class: "BlockLantern" with little invisible light entities."

so, - i think - every item with class "lantern" get's additionally invisible "copies", so that yoau have more light in futher range.

Quote: "Sadly does not support [...] hard-code the light HSV."

So, if you have a green/red/yellow/... lantern, you get white light copies or nothing or a bug/crash.


💬 l33tmaan, Oct 9th at 7:26 AM

My brain is small. What does this actually do? Does it just make lanterns better or something?

💬 SpearAndFang, Oct 9th at 6:59 AM

Simple but elegant solution.  Very cool!  Just an fyi, your invisible light entity blows a lot of little bubbles when it's in water.  Bonus points if you can make this lantern work when it's in your off hand.

(edit comment delete)