本文整理汇总了Java中net.minecraftforge.client.event.EntityViewRenderEvent.RenderFogEvent方法的典型用法代码示例。如果您正苦于以下问题:Java EntityViewRenderEvent.RenderFogEvent方法的具体用法?Java EntityViewRenderEvent.RenderFogEvent怎么用?Java EntityViewRenderEvent.RenderFogEvent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraftforge.client.event.EntityViewRenderEvent
的用法示例。
在下文中一共展示了EntityViewRenderEvent.RenderFogEvent方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: fogEvent
import net.minecraftforge.client.event.EntityViewRenderEvent; //导入方法依赖的package包/类
@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);
}
}
}
示例2: fogRenderEvent
import net.minecraftforge.client.event.EntityViewRenderEvent; //导入方法依赖的package包/类
@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);
}
示例3: fogDistance
import net.minecraftforge.client.event.EntityViewRenderEvent; //导入方法依赖的package包/类
@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);
}
示例4: onFogRender
import net.minecraftforge.client.event.EntityViewRenderEvent; //导入方法依赖的package包/类
@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);
}
}
}