Jump to content

Recommended Posts

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.

Posted

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.

Posted

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.

Posted

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

Posted
15 minutes ago, MrObsidy24 said:

 

EntityRenderer#setupFog() is private in 1.11.2

You're replying to a nearly 2 year old thread, 1.11.2 did not exist then.

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

Announcements



×
×
  • Create New...

Important Information

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