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

I am working on creating gases at which I want the players view to change when the player is inside the gas, just like hwen it is in water. I am currently searching through the fluid water stuff to get some ideas how to but I am currently at a loss, how would I change colours, distory the general rendering and such like in water and stuff?

 

 

Anything visual is considered "rendering".  There are several render events that may help you.  Such as the RenderGameOverlay event.  You could also possibly use a fog effect to make cool distorition -- this might make sense for gas.  You can create colored fog with the FogDensity and FogColor events.

 

If you want to know more about event handling generally, you can look at my tutorial here: http://jabelarminecraft.blogspot.com/p/minecraft-forge-172-event-handling.html

 

At the end of that tutorial I have an example where I used the FogDensity event to create a basic fog effect (in my case I made the fog thicker as person flew into cloud level, but you could change the logic to make fog density based on your gas effect).

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

  • Author

Dear Lord  :o

That shit works! I gotta figure out how to detect the player in the gases but thank you! that was exacly what I wnated

  • Author

I am getting this strange horizon effect now

 

and this is my handler, not quite sure what is causing it otehr than obviously fog being the cause, how do I get rid of it while keeping it happen when they are inside the blocks?

 

package aerosteam.handler;

import aerosteam.AeroSteam;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraftforge.client.event.EntityViewRenderEvent.FogColors;
import net.minecraftforge.client.event.EntityViewRenderEvent.FogDensity;
import net.minecraftforge.event.entity.living.LivingEvent.LivingJumpEvent;
import cpw.mods.fml.common.eventhandler.EventPriority;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;

public class VisualGasHandler {
@SideOnly(Side.CLIENT)
@SubscribeEvent(priority=EventPriority.NORMAL, receiveCanceled=true)
public void onEvent(FogColors event)
{
	//System.out.println("Fogged");
    event.red = (float) 0.0F;
    event.blue = (float) 0.0F;
    event.green = (float) 0.0F;
}

@SideOnly(Side.CLIENT)
@SubscribeEvent(priority=EventPriority.NORMAL, receiveCanceled=true)
public void onEvent(FogDensity event)
{
	//System.out.println("Fogged");
	if (event.entity instanceof EntityPlayer){
		int x = (int) event.entity.posX;
		int y = (int) event.entity.posY;
		int z = (int) event.entity.posZ;
		Block block = event.entity.worldObj.getBlock(x, y, z);
		//System.out.println("Is Player-" + x + "," + y + "," + z);
		if (block == AeroSteam.phlogium){
			System.out.println("Inside Block");
		    event.density = (float) 0.3F;
		}else event.density = (float) 0.0F;
	}else event.density = (float) 0.0F;
    event.setCanceled(true); // must be canceled to affect the fog density 
}
@SubscribeEvent(priority=EventPriority.HIGHEST, receiveCanceled=true)
public void onEvent(LivingJumpEvent event)
{
    // DEBUG
    if (event.entity instanceof EntityPlayer)
    {
        System.out.println("Boing");
    }
        
}
}

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.