Novârch Posted May 14, 2020 Posted May 14, 2020 I'm trying to make a potion effect that combines a few vanilla potion effects, the purpose being being able to easily remove it without removing effects the player might have had prior to getting it, one of these effects is blindness. How does the blindness effect work? Does the game check whether you have it while rendering, can I replicate it's functionality with an event? Quote It's sad how much time mods spend saying "x is no longer supported on this forum. Please update to a modern version of Minecraft to receive support".
imacatlolol Posted May 14, 2020 Posted May 14, 2020 The effect is controlled by FogRenderer#updateFogColor, and FogRenderer#setupFog. Look for the usages of Effects.BLINDNESS to see the exact math it performs. Hook on to the EntityViewRenderEvent$FogDensity and EntityViewRenderEvent$FogColors events to override the vanilla behavior and do your own logic (the former event will need to be canceled for your stuff to work). I recommend using a lower event priority and then checking the state of the events so that other mods can override your system if desired. Quote I'm eager to learn and am prone to mistakes. Don't hesitate to tell me how I can improve.
Novârch Posted May 14, 2020 Author Posted May 14, 2020 1 hour ago, imacatlolol said: The effect is controlled by FogRenderer#updateFogColor, and FogRenderer#setupFog. Look for the usages of Effects.BLINDNESS to see the exact math it performs. Hook on to the EntityViewRenderEvent$FogDensity and EntityViewRenderEvent$FogColors events to override the vanilla behavior and do your own logic (the former event will need to be canceled for your stuff to work). I recommend using a lower event priority and then checking the state of the events so that other mods can override your system if desired. Thanks for the help! Everything works fine except this line, and it seems that it's pretty important because nothing renders when I remove it. Quote It's sad how much time mods spend saying "x is no longer supported on this forum. Please update to a modern version of Minecraft to receive support".
Draco18s Posted May 14, 2020 Posted May 14, 2020 That lets other mods be notified about fog and change it if they want. Quote Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
Novârch Posted May 14, 2020 Author Posted May 14, 2020 1 minute ago, Draco18s said: That lets other mods be notified about fog and change it if they want. Than I must've goofed something else up, but I don't know what because I just copied the vanilla FogRenderer code. Quote It's sad how much time mods spend saying "x is no longer supported on this forum. Please update to a modern version of Minecraft to receive support".
imacatlolol Posted May 14, 2020 Posted May 14, 2020 (edited) 1 hour ago, Novârch said: I just copied the vanilla FogRenderer code. There's your problem. The event is normally intended to be used by simply setting the fog density via the event's setDensity method. The same goes for the fog color. A density of 0.3 will produce a very similar effect as the vanilla method, but it's not perfectly identical since vanilla uses more complex methods. However, the difference is very subtle and none of your users will likely even notice. If you really want an identical effect, you should set the density to 0 and then use those four RenderSystem method calls towards the end. Edited May 14, 2020 by imacatlolol Slightly better wording Quote I'm eager to learn and am prone to mistakes. Don't hesitate to tell me how I can improve.
Novârch Posted May 15, 2020 Author Posted May 15, 2020 9 hours ago, imacatlolol said: There's your problem. The event is normally intended to be used by simply setting the fog density via the event's setDensity method. The same goes for the fog color. A density of 0.3 will produce a very similar effect as the vanilla method, but it's not perfectly identical since vanilla uses more complex methods. However, the difference is very subtle and none of your users will likely even notice. If you really want an identical effect, you should set the density to 0 and then use those four RenderSystem method calls towards the end. Thanks for the help, gotten the exact effect I was looking for! Quote It's sad how much time mods spend saying "x is no longer supported on this forum. Please update to a modern version of Minecraft to receive support".
Recommended Posts
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.