Jump to content

How can I change the direction of sun via x, y, z coordinates?


Recommended Posts

Posted

Hi, I'm making the Stellarium mod, which changes minecraft into configurable universe.

I want to make the minecraft world sphere,

but I realized that full minecraft code is designed for planar minecraft world.

 

What I have to do is only changing the direction of sun via coordinates,

but the 'getCelestialAngle' method returns constant for every coordinates..

 

Then can I hook the Light-level calculation, etc.?

or are there any other ways?

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

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

Posted

How you even make a 2D grid of squares represent a sphere?

 

Pretty much all the code that cares about the sun, moon and light assumes a flat world, with the values being the same at a given point in time for the entire world. So there really is no hooks to cover everything that is needed, and you will have to modify lots of core classes (not sure what best practice is there in terms of Forge. Ideally I guess you would want to override/replace specific functions, not entire class files to replace the normal minecraft/forge ones, either way you have to be very careful to support multiple Forge versions, and things like MCPC+ which are also changing these files).

 

So I suggest you look at every place that cares, and see what you can do to make it different. You can likely implement other improvements to Minecraft that would be nice as a seperate permissive mod, e.g. the ability to have the moon and sun follow different orbits, to have seasons (variable daylength), and for localised weather (storms only need to reduce light within a certain area, not globally).

 

Some of the code that cares uses stuff like "World.getBlockLightValue(x,y,z)" so if you modify the relevant functions in World that should be enough. However there is also various bits of code, including some logic stuff as well as rendering that deal with the angle directly, which obviously means those bits need changing as well to take account of their location (or the players camera location in the case of rendering) in the world.

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.

Guest
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.

Announcements



×
×
  • Create New...

Important Information

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