Posted June 6, 20187 yr Hello, what I am trying to do, Is for my elevator mod, have the player's screen fade to black, then teleport the player to another floor, then fade the black out. I did see a post regarding something similar, regarding a similar effect when you start losing air under water. Using what I saw there, I attempted two of the methods listed there but I could use some more input in to how I would go about implementing it. That page can be found here. The code that I have atm are as follows public static void renderBlindness(){ ScaledResolution scaledresolution = new ScaledResolution(Minecraft.getMinecraft()); int i = scaledresolution.getScaledWidth(); int j = scaledresolution.getScaledHeight(); Minecraft.getMinecraft().mcProfiler.startSection("elevator"); GlStateManager.disableDepth(); GlStateManager.disableAlpha(); int j1 = 10; float f1 = (float)j1 / 100.0F; if (f1 > 1.0F) { f1 = 1.0F - (float)(j1 - 100) / 10.0F; } int k = (int)(220.0F * f1) << 24 | 1052704; drawRect(0, 0, i, j, k); GlStateManager.enableAlpha(); GlStateManager.enableDepth(); Minecraft.getMinecraft().mcProfiler.endSection(); } With this code I am at a fault for trying to figure out how to have it render properly. But that is only a slightly modified version of the way that vanilla minecraft does the fade for the bed. This is the other code that is my attempt to mess with the blindness potion effect: @Subscribe public void fogDensity(FogDensity event){ if(event.entity instanceof EntityLiving){ EntityLiving entity = (EntityLiving)event.entity; PotionEffect effect = entity.getActivePotionEffect(Potion.blindness); if(effect != null && effect.getAmplifier() == 255){ event.density = 2; } } } What I was trying to get that to do, is when a player has the blindness effect with an amplifier of 255 to change the density. but I didn't see much change when I tested in the debug mode. Anyways, The way that I had attempted to run the first one, was just calling it before the method to teleport the player to the other elevators. The second one was registered (I may have done it the wrong way, as it has been a while since the last time I have coded) but I just used "FMLCommonHandler.instance().bus().register()" to register the FogDensity. Any help is welcome, feel free to give me constructive advice on what I can do better, this is my attempt to get my 1.7.10 mod upgraded for all the versions, I have builds for each version (1.8.9, 1.9, 1.9.4, 1.10.2, 1.12.2) but there are some bugs I need to iron out, and I was hoping to add this black out method to them when I update. -Elrol
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.