Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

	

            @SubscribeEvent
            public void EntityViewRenderEvent(EntityViewRenderEvent.FogDensity event){
                   
                    if(event.entity.isInsideOfMaterial(Material.lava)){
                            event.setCanceled(true);
                            event.density = 0.5f;
                    }
            }

 

The event is getting canceled, but the new density setting it not taking effect.

 

Any help would be appreciated.

Try adding

GL11.glFogi(GL11.GL_FOG_MODE, GL11.GL_EXP);

after you change the event.density.

I'm not sure why, but it works for me.

  • Author

Thanks Azaka7!! That worked great.  Don't know why it's like that.  If anyone could offer an explanation, feel free.

It is a method named EntityRenderer#setupFog() that does this and it seems like when the event is cancelled all further interactions with Fog are cancelled. This means that GL11.glFogi(); is never called and you have to do it yourself.

 

Note: You may also want to call

                    GL11.glFogf(GL11.GL_FOG_START, whereFogStarts);

                    GL11.glFogf(GL11.GL_FOG_END, whereFogIsAtFullValue);

 

I didn't try it out though and I don't really see what could change except that fog is linearly sampled.... try it out, I guess.

I don't know.  I have a great fog effect for a "Jack and the Beanstalk" mod where as you climb up the beanstalk the fog gets thicker and thicker.  It works without doing anything with GL11.

 

Here is the code I used.  You can try it and go into Creative Mode and just fly up to cloud level (I made the fog get thicker when you got into the clouds).

 

    @SideOnly(Side.CLIENT)
    @SubscribeEvent(priority=EventPriority.NORMAL, receiveCanceled=true)
    public void onEvent(FogDensity event)
    {
        event.density = (float) Math.abs(Math.pow(((event.entity.posY-63)/(255-63)),4));
        event.setCanceled(true); // must be canceled to affect the fog density   		
     }

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

  • 2 years later...
On 29.7.2014 at 4:55 AM, WorldsEnder said:

It is a method named EntityRenderer#setupFog() that does this and it seems like when the event is cancelled all further interactions with Fog are cancelled. This means that GL11.glFogi(); is never called and you have to do it yourself.

 

Note: You may also want to call

                    GL11.glFogf(GL11.GL_FOG_START, whereFogStarts);

                    GL11.glFogf(GL11.GL_FOG_END, whereFogIsAtFullValue);

 

I didn't try it out though and I don't really see what could change except that fog is linearly sampled.... try it out, I guess.

 

EntityRenderer#setupFog() is private in 1.11.2

  • Guest locked this topic
Guest
This topic is now closed to further replies.

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.