Jump to content

Using custom sky graphics (sun/moon textures, sizes, positions, etc)?


Recommended Posts

Posted

Despite extensive searching, I've been unable to find resources on how to do this...

 

At the bare minimum, I want to change the textures the sun and moon uses in my custom dimension. It currently uses the normal overworld sky, with the sky color and fog color modified, and still renders the vanilla moon and sun. I've been trying to track down how to do this, but have been unable too:

 

  • WorldProvider has an obvious set of routines responsible for how the sky is rendered, setSkyRenderer() and getSkyRenderer(). However, I seem to be completely unable to figure out which vanilla class is actually used in these routines (I'm hoping to extend it onto my own class so I can make minor tweaks to it, or at least view its' code so I can figure out what it even does). I tried getting its' class name and outputting that to the console, but apparently the client uses a different console then the server (the latter of which is the only console I can see, as far as I can tell). I'm not sure how I'd even debug client side stuff in general without a console to check...
  • The sun and moon textures themselves, as well as a bunch of code seemingly for handling how the sky renders, is in "net.minecraft.client.renderer.RenderGlobal". The code for rendering the sky looks pretty hard coded and not exactly extendable, and it only seems to be called by minecrafts' main run loop, so I doubt that trying to replace it with a child class would be wise, or even possible.

 

So how would I change the textures for the sun and moon? Can the visible size of the textures in the sky be changed? And if possible, how could I change their movement/positions in the sky, or add more/remove objects from the sky?

 

I apologize if I've tripped over basic java or minecraft forge coding knowledge here, or forgot to mention something important; my java is very rusty, and this is the second mod I've ever made (first one being a basic crops/tools/armor/etc. mod for 1.7).

Posted
  On 8/7/2019 at 6:47 PM, pacguy said:

However, I seem to be completely unable to figure out which vanilla class is actually used in these routines (I'm hoping to extend it onto my own class so I can make minor tweaks to it, or at least view its' code so I can figure out what it even does).

Expand  

There isn't a class in vanilla that does it. There are methods in WorldRenderer. To have your own sky call setSkyRenderer or override getSkyRenderer in your Dimension class. This will instead be rendered in place of what vanilla does.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Posted (edited)

Ah, I see. Are there any examples of using it like this I can work off of? Could I copy the vanilla code into a SkyRenderer and tweak it to do what I need? If so, what routine should I put it in?

 

I could take a gander at Galacticrafts implementation if push comes to shove, but I'd feel bad copying and messing with their implementation.

Edited by pacguy
Posted
  On 8/8/2019 at 5:18 AM, pacguy said:

Are there any examples of using it like this I can work off of?

Expand  

Vanilla any mod that has a custom sky in their dimension.
 

  On 8/8/2019 at 5:18 AM, pacguy said:

Could I copy the vanilla code into a SkyRenderer and tweak it to do what I need?

Expand  

If you understand Java of course.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Posted
  On 8/8/2019 at 5:24 AM, Animefan8888 said:

Vanilla any mod that has a custom sky in their dimension.

Expand  

Ah, I guess that's alright. I'll try to copy the vanilla code into a custom SkyRenderer class and see what I can do.

 

  On 8/8/2019 at 5:24 AM, Animefan8888 said:

If you understand Java of course.

Expand  

Like I said in the OP, I do understand java, I have a fair amount of experience in it even if I am a bit rusty. It's the minecraft engine I don't understand.

Posted
  On 8/8/2019 at 5:29 AM, pacguy said:

Like I said in the OP, I do understand java, I have a fair amount of experience in it even if I am a bit rusty. It's the minecraft engine I don't understand.

Expand  

I only said it that way because it should've been self explanatory.

  • Thanks 1

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Make a test with another Launcher like the Curseforge Launcher, MultiMC or AT Launcher
    • can anyone help me i am opening forge and add modpacks and then it says unable to update native luancher and i redownlaod java and the luancher it self?
    • The problem occurs also in 1.20.1 Forge, but with an "Error executing task on client" instead. I have "Sinytra Connector" installed. On 1.21.5 Fabric, there is no problem. When this happens, the chat message before the death screen appears gets sent, with an extra dash added.
    • Well, as usual, it was user error. Naming mismatch in sounds.json.  Please delete this post if you find it necessary. 
    • Hello Forge community.  I'm running into an issue with a mod I'm working on.  To preface, I can call /playsound modId:name music @a and I can hear the sound I registered being played in game. Great!  However, I cannot get it to trigger via my mod code.    Registration: public static final RegistryObject<SoundEvent> A_WORLD_OF_MADNESS = SOUND_EVENTS.register("a_world_of_madness", () -> new SoundEvent(new ResourceLocation("tetheredsouls", "a_world_of_madness")));   Playback: Minecraft mc = Minecraft.getInstance(); if (!(mc.player instanceof LocalPlayer) || mc.level == null) return; LocalPlayer player = (LocalPlayer) mc.player; BlockPos pos = player.blockPosition(); SoundEvent track = ModSounds.A_WORLD_OF_MADNESS.get(); System.out.println(track); System.out.println(pos); System.out.println(player); // play exactly like the tutorial: client-only, at the player's position try { mc.level.playLocalSound( player.getX(), player.getY(), player.getZ(), track, SoundSource.MUSIC, // Or MASTER if needed 1f, 1f, false ); System.out.println("[DEBUG] playSound success: " + track.getLocation()); } catch (Exception e) { System.err.println("[ERROR] Failed to play sound: " + track.getLocation()); e.printStackTrace(); } Sounds.json:   { "theme_of_laura": { "category": "music", "sounds": [ { "name": "tetheredsouls:a_world_of_madness", "stream": true } ] } } Things I have tried: - multiple .ogg files. Short .ogg files (5 seconds, <100KB).  - default minecraft sounds imported from import net.minecraft.sounds.SoundEvents; These work given my code. No idea why these are different.  - playSound() method, as well as several others in past iterations that did not work   I would be forever grateful if somebody could point me in the right direction. I've looked at several mod github repositories and found extremely similar code to what I'm doing. I've also found several threads in this forum that did not solve my issue. I just cannot figure out what I'm doing differently, and why I'm able to queue sounds manually with playsound but the code won't play it (despite confirming the code is being run with the debug statements.)
  • Topics

×
×
  • Create New...

Important Information

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