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

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.

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

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.