Posted September 16, 201411 yr 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?
September 16, 201411 yr 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/
September 17, 201411 yr Author Dear Lord That shit works! I gotta figure out how to detect the player in the gases but thank you! that was exacly what I wnated
September 17, 201411 yr 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.