Jump to content

The Celestial Model of Minecraft (Including day/night)


Recommended Posts

Since minecraft modding is mainly focused on the blocks, items, entities, and GUIs,

The simple celestial mechanism of the minecraft is largely unknown.

So I'd like to introduce the celestial model of minecraft, on how it controls and manages the celestial motion.


I'll start from the fact that everyone playing minecraft would know.


1. Basic Model of Universe of Minecraft



In the universe of vanilla minecraft, the 'Celestial Sphere' rotates around the polar axis like the oldest model on cosmology.

There is no planet on the sphere, so every celestial object just 'sticks' to the sphere.

Yes, the only celestial motion in the vanilla minecraft is the Rotation.

  (Note: This is not true with ours! The celestial sphere is only conceptional,

    which is caused by the limit of the binocular parallax of our eyes)




2. The holy, Celestial Angle



Since there is only 'Celestial Sphere' that moves on the sky, The angle is very important; It controls the day and night; It controls the position of sun and moon and stars; It controls nearly everything!


The holy angle is called 'Celestial Angle'!


It is specified on the each world, and calculated in WorldProvider. So if you have your own custom dimension, you can change the day and night however you want!


So you might want to know how it is calculated and how you can modify that.

First, all entries getting celestial angle calls this method: World#getCelstialAngle(float partialTicks).

The method just returns WorldProvider#calculateCelestialAngle(long tick, float partialTicks).

You can override the method, and change the celestial angle.


NOTE: The angle is in range from 0.0F to 1.0F

NOTE2: The angle is 0.0F on the noon, 0.25F on the sunset, 0.5F on the midnight, and 0.75F on the sunrise.




3. Phase of the Moon



Every entries getting the phase of the moon call WorldProvider#getMoonPhase(),

So you can override the method to change phase of the moon.

  (The phase varies from 0.0F(New moon) to 1.0F(Next New Moon))

Also, WorldProvider#moonPhaseFactors gives the moon phase factor per phase index of the moon.

(From New moon to last phase of the moon)

The moon phase factor seems to change the slime spawn rate.


PS. You can override WorldProvider#getCurrentMoonPhaseFactor on the latter version of 1.7.10




4. Rendering mechanism of Sun and Moon



Sun and moon are rendered on RenderGlobal#renderSky(). Before they are rendered, celestial rotation is applied.

Then sun is just rendered on the top of the sky, and moon on the bottom.


You can change the rendering using WorldProvider#setSkyRenderer(IRenderHandler renderer).

Call the method to change the sky renderer with your custom renderer on World Load Event.

You just need to override the IRenderHandler#render(float partialTicks) and input your own sky rendering code.

(But it would be really hard; see RenderGlobal#renderSky() multiple times, and how it works, since it is so hard work)




5. Rendering mechanism of Stars



Stars are rendered before everything happens. Actually, they are just some random 'dots' with fixed seed(10842L).

  See RenderGlobal#renderStars() (on 1.7.10), It lets you know how they are drawn.

When they are drawn, they are saved on rendering buffer.

When sky is getting rendered in RenderGlobal#renderSky(),

  the buffer just displayed on the sky with celestial rotation is applied.


So if you want to change the arrangement of the stars,

you should code the star rendering code on your own in the custom sky renderer.



I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP)

II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Losing a significant amount of money to scammers can be a bizarre experience that leaves you feeling helpless and betrayed. This was the situation I found myself in after investing over a hundred thousand dollars in a crypto platform that turned out to be a scam. I was introduced to this platform by a friend of my cousin, and everything seemed legitimate until it was too late for me to realize that I had been duped. The days following the realization of my loss were some of the darkest I have ever experienced. I was consumed by feelings of depression and desperation as I tried everything in my power to retrieve my hard-earned money. I reached out to various authorities and sought advice from friends and family, but it seemed like there was no way to recover what I had lost. It was during this time that a friend mentioned a platform called Wizard Web Recovery that specialized in recovering funds lost to scams. At first, I was skeptical and hesitant to trust another company with my money, but I was running out of options and decided to give them a chance. Looking back, this decision turned out to be the best one I could have made. From the moment I contacted Wizard Web Recovery, I was impressed by their dedication to helping me recover my funds. Their team of experts guided me through the process step by step, explaining each stage clearly and answering all of my questions along the way. They kept me informed of their progress and worked tirelessly to ensure that my case was given the attention it deserved. I was amazed at how quickly Wizard Web Recovery was able to track down the scammers and retrieve my money. Within a relatively short period, I received the news that my funds had been successfully recovered, and I couldn't believe it. It felt like a weight had been lifted off my shoulders, and I was filled with gratitude for the team at Wizard Web Recovery who had made it possible.    
    • my game crashed and I have no idea why here is a link to the pastebin of the crash https://pastebin.com/vv89r9vC
    • ok apparently the issue is even stupider than that. the folder the server was in was called "𝓯𝓻𝓮𝓪𝓴𝔂 server" and apparently the special characters in the folder name break the whole damn thing. this is the stupidest thing in the history of ever
    • Thanks, but now I have the 3d model in hand (and in inventory bcz I won't need that anymore) but now when I try to throw it, it doesnt rotate and its just the end of the trident not the head part. Edit: I removed the 3d custom model. I use the original minecraft files. Json and etc. In minecraft the rendering is made in code. I sent the code in the first message. I have mostly the code. But I don't know how to register the renderers like minecraft do. For example, in minecraft there are 2 jsons: trident_in_hand and trident_throwing , I have both of them. They don't render while I have the item in hand. That's the main problem. I checked the code but I still can't figure out how to register and render the entity basically, in hand
  • Topics

  • Create New...

Important Information

By using this site, you agree to our Terms of Use.