@SubscribeEvent public void onRenderFog(EntityViewRenderEvent.FogDensity event) { if (event.getEntity() instanceof EntityPlayer) { EntityPlayer player = (EntityPlayer) event.getEntity(); PossessivePlayer possessivePlayer = PossessHandler.get(player); if (possessivePlayer != null && (possessivePlayer.getPossessing().canBreatheUnderwater() || possessivePlayer.getPossessing() instanceof EntityGuardian)) { if (ActiveRenderInfo.getBlockStateAtEntityViewpoint(ClientEventHandler.MINECRAFT.theWorld, player, (float) event.getRenderPartialTicks()).getMaterial() != Material.WATER) { GlStateManager.setFog(GlStateManager.FogMode.EXP); event.setDensity(0.125F); event.setCanceled(true); } else { GlStateManager.setFog(GlStateManager.FogMode.EXP); event.setDensity(0.02F); event.setCanceled(true); } } } }
@SubscribeEvent @SideOnly(Side.CLIENT) public void fogEvent(EntityViewRenderEvent.RenderFogEvent event) { if (ExtendedConfig.isFogEnabled) { if (fogDensity < fogDensityPerTick) { fogDensity += DENSITY_PER_TICK; } else if (fogDensity > fogDensityPerTick) { fogDensity -= DENSITY_PER_TICK; } if (fogDensity < DENSITY_PER_TICK) { fogDensity = 0; } if (fogDensity > 0) { GL11.glFogi(GL11.GL_FOG_MODE, GL11.GL_EXP); GL11.glFogf(GL11.GL_FOG_DENSITY, fogDensity); } else { GL11.glFogi(GL11.GL_FOG_MODE, GL11.GL_LINEAR); } } }
@SubscribeEvent(priority = EventPriority.HIGHEST) public void fogColorEvent(final EntityViewRenderEvent.FogColors event) { if (doFog()) { final IBlockState block = ActiveRenderInfo.getBlockStateAtEntityViewpoint(event.getEntity().world, event.getEntity(), (float) event.getRenderPartialTicks()); if (block.getMaterial() == Material.LAVA || block.getMaterial() == Material.WATER) return; final Color color = this.scanner.getFogColor(EnvironState.getWorld(), (float) event.getRenderPartialTicks()); if (color != null) { event.setRed(color.red); event.setGreen(color.green); event.setBlue(color.blue); } } }
@SubscribeEvent(priority = EventPriority.LOWEST) public void fogRenderEvent(final EntityViewRenderEvent.RenderFogEvent event) { if (!doFog() || event.getResult() != Result.DEFAULT) return; final float planeDistance = this.scanner.getPlaneDistance(event.getFarPlaneDistance()); if (event.getFogMode() < 0) { GlStateManager.setFogStart(0F); GlStateManager.setFogEnd(planeDistance); } else { GlStateManager.setFogStart(planeDistance * this.scanner.getPlaneDistanceScale()); GlStateManager.setFogEnd(planeDistance); } event.setResult(Result.ALLOW); }
@SideOnly(Side.CLIENT) @SubscribeEvent public void EntityViewRenderEvent(EntityViewRenderEvent.FogDensity event) { EntityLivingBase entityLiving = event.entity; if (hasEquippedSet(entityLiving, ModArmor.fireHelmet, ModArmor.fireChest, ModArmor.fireLeggings, ModArmor.fireBoots) || hasEquippedSet(entityLiving, ModArmor.chaosHelmet, ModArmor.chaosChest, ModArmor.chaosLeggings, ModArmor.chaosBoots) || hasEquippedSet(entityLiving, ModArmor.orderHelmet, ModArmor.orderChest, ModArmor.orderLeggings, ModArmor.orderBoots)) { if (event.entity.isInsideOfMaterial(Material.lava)) { event.setCanceled(true); event.density = 0.2f; GL11.glFogi(GL11.GL_FOG_MODE, GL11.GL_EXP); } } }
@SideOnly(Side.CLIENT) @SubscribeEvent public void EntityViewRenderEvent(EntityViewRenderEvent.FogColors event) { EntityLivingBase entityLiving = event.entity; if (hasEquippedSet(entityLiving, ModArmor.fireHelmet, ModArmor.fireChest, ModArmor.fireLeggings, ModArmor.fireBoots) || hasEquippedSet(entityLiving, ModArmor.chaosHelmet, ModArmor.chaosChest, ModArmor.chaosLeggings, ModArmor.chaosBoots) || hasEquippedSet(entityLiving, ModArmor.orderHelmet, ModArmor.orderChest, ModArmor.orderLeggings, ModArmor.orderBoots)) { if (event.entity.isInsideOfMaterial(Material.lava)) { event.red = 0.5f; event.green = 0; event.blue = 0; } } }
@SideOnly(Side.CLIENT) @SubscribeEvent public void EntityViewRenderEvent(RenderBlockOverlayEvent event) { EntityLivingBase entityLiving = event.player; if (hasEquippedSet(entityLiving, ModArmor.fireHelmet, ModArmor.fireChest, ModArmor.fireLeggings, ModArmor.fireBoots) || hasEquippedSet(entityLiving, ModArmor.chaosHelmet, ModArmor.chaosChest, ModArmor.chaosLeggings, ModArmor.chaosBoots) || hasEquippedSet(entityLiving, ModArmor.orderHelmet, ModArmor.orderChest, ModArmor.orderLeggings, ModArmor.orderBoots)) { if (event.player.isInsideOfMaterial(Material.lava)) { event.setCanceled(true); } } }
/** * Disables water/lava fog */ @SubscribeEvent public void onFogRender(EntityViewRenderEvent.FogDensity event) { if(event.getState().getMaterial().equals(Material.WATER) || event.getState().getMaterial().equals(Material.LAVA)) { event.setDensity(0); event.setCanceled(true); } }
@SubscribeEvent @SideOnly(Side.CLIENT) public void onFovModifier(EntityViewRenderEvent.FOVModifier event) { if (event.getEntity() instanceof EntityLivingBase) { EntityLivingBase living = (EntityLivingBase)event.getEntity(); if (living.getActivePotionEffect(Thermionics.POTION_EFFORTLESS_SPEED)!=null) { event.setFOV( Minecraft.getMinecraft().gameSettings.fovSetting ); } } }
@SubscribeEvent public void onGetFogColor(EntityViewRenderEvent.FogColors event) { if (event.getEntity() instanceof EntityPlayer) { EntityPlayer player = (EntityPlayer) event.getEntity(); World world = player.world; int x = MathHelper.floor(player.posX); int y = MathHelper.floor(player.posY); int z = MathHelper.floor(player.posZ); IBlockState stateAtEyes = ActiveRenderInfo.getBlockStateAtEntityViewpoint(world, event.getEntity(), (float) event.getRenderPartialTicks()); if (stateAtEyes.getMaterial() == Material.LAVA) { return; } Vec3d mixedColor; if (stateAtEyes.getMaterial() == Material.WATER) { mixedColor = getFogBlendColorWater(world, player, x, y, z, event.getRenderPartialTicks()); } else { mixedColor = getFogBlendColour(world, player, x, y, z, event.getRed(), event.getGreen(), event.getBlue(), event.getRenderPartialTicks()); } event.setRed((float) mixedColor.x); event.setGreen((float) mixedColor.y); event.setBlue((float) mixedColor.z); } }
@SubscribeEvent public void applyRecoil(EntityViewRenderEvent.CameraSetup event) { if (event.getEntity().hasCapability(TF2weapons.WEAPONS_CAP, null)) { WeaponsCapability cap = event.getEntity().getCapability(TF2weapons.WEAPONS_CAP, null); event.setPitch(event.getPitch() - cap.recoil); if (cap.recoil > 0) { cap.recoil = Math.max((cap.recoil * 0.8f) - 0.06f, 0); } } }
@SubscribeEvent @SideOnly(Side.CLIENT) public void fogDistance(EntityViewRenderEvent.RenderFogEvent fogEvent) { if (!InteractionBWA.OBVIOUS_SAND_STORMS) return; Entity entity = fogEvent.getEntity(); World world = entity.world; BlockPos pos = entity.getPosition(); if (world.isRaining()) { desiredDistance = 0; desiredDistanceScale = 0; int totalweight = 0; BlockPos[] probes = new BlockPos[]{pos, pos.add(1, 0, 0), pos.add(0, 0, 1), pos.add(-1, 0, 0), pos.add(0, 0, -1)}; for (BlockPos probepos : probes) { boolean aboveground = false; if (isDesert(world, probepos) && (aboveground = world.canSeeSky(probepos))) { desiredDistance += fogEvent.getFarPlaneDistance() / 3f; desiredDistanceScale += -1.0f; totalweight += 1; } else if (aboveground) { desiredDistance += fogEvent.getFarPlaneDistance(); desiredDistanceScale += 0.75f; totalweight += 1; } } desiredDistance /= totalweight; desiredDistanceScale /= totalweight; } else { desiredDistance = fogEvent.getFarPlaneDistance(); desiredDistanceScale = 0.75F; } if (Math.abs(fogEvent.getFarPlaneDistance() - currentDistance) > 0.001f) renderFog(fogEvent.getFogMode(), currentDistance, currentDistanceScale); //renderFog(fogEvent.getFogMode(),fogEvent.getFarPlaneDistance(),-1.0f); }
@SubscribeEvent @SideOnly(Side.CLIENT) public void onEntityViewRender_FOVModifier(EntityViewRenderEvent.FOVModifier event) { Entity render = Minecraft.getMinecraft().getRenderViewEntity(); if (render != null) { TimeSnapshot snapshot = render.getCapability(AlchemyCapabilityLoader.time_leap, null); if (snapshot != null && snapshot.isLeaping()) event.setFOV(max(80, event.getFOV())); } }
@SubscribeEvent public void onOrientCamera(final EntityViewRenderEvent.CameraSetup e) { // Do not explicitly set roll to 0 (when the player is hurt for example // minecraft uses roll) if (CameraRoll.roll == 0) { return; } e.setRoll(CameraRoll.roll); }
@SubscribeEvent public void onFogRender(EntityViewRenderEvent.RenderFogEvent event) { Minecraft mc = Minecraft.getMinecraft(); if (mc.theWorld.isRaining() && event.farPlaneDistance > 45f) { if (event.fogMode == 0 || event.fogMode == -1) { float rain_strength = mc.theWorld.rainingStrength; float far_mod = rain_strength; if (mc.theWorld.isThundering()) { // Only reach the densest rain if it's thundering far_mod = (far_mod + 0.2f); } far_mod /= 1f + 0.2f; int x = MathHelper.floor_double(mc.thePlayer.posX); int y = MathHelper.floor_double(mc.thePlayer.posY); int z = MathHelper.floor_double(mc.thePlayer.posZ); if (mc.theWorld != null && mc.theWorld.blockExists(x, y, z)) { // Fade the effect out if the player cannot see skylight Chunk chunk = mc.theWorld.getChunkFromBlockCoords(x, z); int sl = chunk.getSavedLightValue(EnumSkyBlock.Sky, x & 15, y, z & 15); far_mod *= sl/15f; } // Slowly progress to the the densest possible rain but float fogf = mix(event.farPlaneDistance, 45f, far_mod); GL11.glFogf(GL11.GL_FOG_START, mix(0.75f * event.farPlaneDistance, 0.0f, rain_strength)); GL11.glFogf(GL11.GL_FOG_END, fogf); } } }
@SubscribeEvent public void onGetFOV(EntityViewRenderEvent.FOVModifier event) { if (State.getRecording()) { // Always set the FoV, to prevent sprinting or speed effects from affecting the camera's FoV. if ((Configs.getUseFreeCamera() && event.getEntity() == this.cameraEntity) || (Configs.getUseFreeCamera() == false)) { // 0..140 is somewhat "sane" event.setFOV(70.0f - ((float) Configs.getZoom() * 69.9f / 100.0f)); } } }
@SideOnly(Side.CLIENT) @SubscribeEvent public void onSetupFog(EntityViewRenderEvent.FogDensity event) { EntityPlayer player = Minecraft.getMinecraft().thePlayer; if (clearFog && player != null && player.isInWater()) event.density = 0f;//.025F; }
@SideOnly(Side.CLIENT) @SubscribeEvent public void onSetupFog(EntityViewRenderEvent.FogColors event) { EntityPlayer player = Minecraft.getMinecraft().thePlayer; if (clearFog && player != null && player.isInWater()) { float multi = 7.5F; event.red *= multi; event.blue *= multi; event.green *= multi; } }
@SuppressWarnings("unused") @SubscribeEvent public void onFogColor(EntityViewRenderEvent.FogColors event) { if (!ZombieTC.editorModeManager.enabled) { event.red = 0.28f; event.blue = 0.28f; event.green = 0.28f; } }
@SubscribeEvent public void getFogDensity(EntityViewRenderEvent.FogDensity event) { if (event.entity instanceof EntityPlayer) { EntityPlayer player = (EntityPlayer) event.entity; ItemStack helm = player.getCurrentArmor(ArmorIndex.WORN_HELM); if (helm != null && !player.isPotionActive(Potion.blindness)) { if (event.block.getMaterial() == Material.lava && (helm.getItem() == ZSSItems.tunicGoronHelm || helm.getItem() == ZSSItems.maskGoron)) { event.density = 0.85F; GlStateManager.setFog(2048); event.setCanceled(true); } } } }
@SubscribeEvent public void fogColors(EntityViewRenderEvent.FogColors evt){ if (evt.block == Blocks.water && ArmorBonusEvent.getAquatic()){ evt.red = 0.6f; evt.green = 0.6f; evt.blue = 0.7f; } }
@SubscribeEvent public void fogDensity(EntityViewRenderEvent.FogDensity evt){ if (evt.block == Blocks.lava && ArmorBonusEvent.getFlamestone()){ evt.density = 0.1f; evt.setCanceled(true); } else if (evt.block == Blocks.water && ArmorBonusEvent.getAquatic()){ evt.density = 0.01f; evt.setCanceled(true); } }
@SubscribeEvent public void onCameraSetupEvent(EntityViewRenderEvent.CameraSetup event) { if(cameraRoll != 0F && WorldPortalRenderer.renderLevel <= 0) { event.setRoll(EntityHelper.interpolateValues(prevCameraRoll, cameraRoll, (float)event.getRenderPartialTicks())); } }
@SubscribeEvent public void onFogDensity(EntityViewRenderEvent.FogDensity event) { event.setDensity(0); event.setCanceled(true); }
@SubscribeEvent public void onFogColor(EntityViewRenderEvent.FogColors event) { event.setRed(55); event.setGreen(55); event.setBlue(55); }
public static float getFOVModifier(EntityRenderer renderer, Entity entity, IBlockState state, double renderPartialTicks, float fov) { EntityViewRenderEvent.FOVModifier event = new EntityViewRenderEvent.FOVModifier(renderer, entity, state, renderPartialTicks, fov); MinecraftForge.EVENT_BUS.post(event); return event.getFOV(); }
public static float getFogDensity(EntityRenderer renderer, Entity entity, IBlockState state, float partial, float density) { EntityViewRenderEvent.FogDensity event = new EntityViewRenderEvent.FogDensity(renderer, entity, state, partial, density); if (MinecraftForge.EVENT_BUS.post(event)) return event.getDensity(); return -1; }
public static void onFogRender(EntityRenderer renderer, Entity entity, IBlockState state, float partial, int mode, float distance) { MinecraftForge.EVENT_BUS.post(new EntityViewRenderEvent.RenderFogEvent(renderer, entity, state, partial, mode, distance)); }
@SubscribeEvent @SideOnly(Side.CLIENT) public void fogColor(EntityViewRenderEvent.FogColors fogEvent) { if (!InteractionBWA.OBVIOUS_SAND_STORMS) return; Entity entity = fogEvent.getEntity(); World world = entity.world; BlockPos pos = entity.getPosition(); Color desiredcolor = new Color( Math.min(fogEvent.getRed(),1.0f), Math.min(fogEvent.getGreen(),1.0f), Math.min(fogEvent.getBlue(),1.0f) ); if (world.isRaining()) { float red = 0; float green = 0; float blue = 0; int totalweight = 0; BlockPos[] probes = new BlockPos[]{pos, pos.add(1, 0, 0), pos.add(0, 0, 1), pos.add(-1, 0, 0), pos.add(0, 0, -1)}; for (BlockPos probepos : probes) { boolean aboveground = false; if (isDesert(world, probepos) && (aboveground = world.canSeeSky(probepos))) { Biome biome = world.getBiome(probepos); MapColor mapcolor = biome.topBlock.getMapColor(); Color color = new Color(mapcolor.colorValue); red += 2 * (color.getRed() / 255.0f); green += 2 * (color.getGreen() / 255.0f); blue += 2 * (color.getBlue() / 255.0f); totalweight += 2; } else if (aboveground) { red += fogEvent.getRed(); green += fogEvent.getGreen(); blue += fogEvent.getBlue(); totalweight += 1; } } desiredcolor = new Color(Math.min(red / totalweight,1.0f), Math.min(green / totalweight,1.0f), Math.min(blue / totalweight,1.0f)); fogEvent.setRed(currentRed / 255.0f); fogEvent.setGreen(currentGreen / 255.0f); fogEvent.setBlue(currentBlue / 255.0f); } desiredRed = desiredcolor.getRed(); desiredGreen = desiredcolor.getGreen(); desiredBlue = desiredcolor.getBlue(); }
@SubscribeEvent public void onFogDensity(EntityViewRenderEvent.FogDensity evt) { if (!enabled) { return; } // update zoom and rotation if (!modifierKeyPressed()) { int ticksElapsed = tick - tickPrevious; double partial = evt.getRenderPartialTicks(); double elapsed = ticksElapsed + (partial - partialPrevious); elapsed *= SECONDS_PER_TICK * ROTATE_SPEED; updateZoomAndRotation(elapsed); tickPrevious = tick; partialPrevious = partial; } float width = zoom * (MC.displayWidth / (float) MC.displayHeight); float height = zoom; // override projection matrix GlStateManager.matrixMode(GL_PROJECTION); GlStateManager.loadIdentity(); Projection.ortho(-width, width, -height, height, clip ? 0 : -9999, 9999); // rotate the orthographic camera with the player view if (freeCam) { xRot = MC.player.rotationPitch; yRot = MC.player.rotationYaw - 180; } // override camera view matrix GlStateManager.matrixMode(GL_MODELVIEW); GlStateManager.loadIdentity(); GlStateManager.rotate(xRot, 1, 0, 0); GlStateManager.rotate(yRot, 0, 1, 0); // fix particle rotation if the camera isn't following the player view if (!freeCam) { float pitch = xRot; float yaw = yRot + 180; setRotationX(MathHelper.cos(yaw * (float) Math.PI / 180f)); setRotationZ(MathHelper.sin(yaw * (float) Math.PI / 180f)); setRotationYZ(-ActiveRenderInfo.getRotationZ() * MathHelper.sin(pitch * (float) Math.PI / 180f)); setRotationXY(ActiveRenderInfo.getRotationX() * MathHelper.sin(pitch * (float) Math.PI / 180f)); setRotationXZ(MathHelper.cos(pitch * (float) Math.PI / 180f)); } }
@SuppressWarnings("unused") @SubscribeEvent public void onFogDensity(EntityViewRenderEvent.FogDensity event) { event.setCanceled(true); event.density = ZombieTC.editorModeManager.enabled ? 0.0001f : 0.03f; }
@SubscribeEvent(priority = EventPriority.LOWEST) public void onFogColor(EntityViewRenderEvent.FogColors evt) { fogRed = evt.getRed(); fogGreen = evt.getGreen(); fogBlue = evt.getBlue(); }
@SubscribeEvent public void setupCamera(EntityViewRenderEvent.CameraSetup e) { }