本文整理汇总了Java中net.minecraftforge.client.event.EntityViewRenderEvent类的典型用法代码示例。如果您正苦于以下问题:Java EntityViewRenderEvent类的具体用法?Java EntityViewRenderEvent怎么用?Java EntityViewRenderEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EntityViewRenderEvent类属于net.minecraftforge.client.event包,在下文中一共展示了EntityViewRenderEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onRenderFog
import net.minecraftforge.client.event.EntityViewRenderEvent; //导入依赖的package包/类
@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);
}
}
}
}
示例2: 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);
}
}
}
示例3: fogColorEvent
import net.minecraftforge.client.event.EntityViewRenderEvent; //导入依赖的package包/类
@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);
}
}
}
示例4: 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);
}
示例5: EntityViewRenderEvent
import net.minecraftforge.client.event.EntityViewRenderEvent; //导入依赖的package包/类
@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);
}
}
}
示例6: onFogRender
import net.minecraftforge.client.event.EntityViewRenderEvent; //导入依赖的package包/类
/**
* 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);
}
}
示例7: onFovModifier
import net.minecraftforge.client.event.EntityViewRenderEvent; //导入依赖的package包/类
@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 );
}
}
}
示例8: onGetFogColor
import net.minecraftforge.client.event.EntityViewRenderEvent; //导入依赖的package包/类
@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);
}
}
示例9: applyRecoil
import net.minecraftforge.client.event.EntityViewRenderEvent; //导入依赖的package包/类
@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);
}
}
}
示例10: 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);
}
示例11: onEntityViewRender_FOVModifier
import net.minecraftforge.client.event.EntityViewRenderEvent; //导入依赖的package包/类
@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()));
}
}
示例12: onOrientCamera
import net.minecraftforge.client.event.EntityViewRenderEvent; //导入依赖的package包/类
@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);
}
示例13: 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);
}
}
}
示例14: onGetFOV
import net.minecraftforge.client.event.EntityViewRenderEvent; //导入依赖的package包/类
@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));
}
}
}
示例15: onSetupFog
import net.minecraftforge.client.event.EntityViewRenderEvent; //导入依赖的package包/类
@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;
}