Search in sources :

Example 1 with EntityHealPopOffFX

use of org.blockartistry.mod.DynSurround.client.fx.particle.EntityHealPopOffFX in project BetterRain by OreCruncher.

the class DamageEffectHandler method handleEvent.

@SideOnly(Side.CLIENT)
public static void handleEvent(final HealthData data) {
    if (!ModOptions.enableDamagePopoffs)
        return;
    // Don't show the players pop-offs
    if (EnvironState.isPlayer(data.entityId))
        return;
    // Don't want to display if too far away.
    final double distance = EnvironState.distanceToPlayer(data.posX, data.posY, data.posZ);
    if (distance >= DISTANCE_THRESHOLD_SQ)
        return;
    final World world = EnvironState.getWorld();
    final EffectRenderer renderer = Minecraft.getMinecraft().effectRenderer;
    EntityFX fx;
    if (data.isCritical) {
        fx = new EntityCriticalPopOffFX(world, data.posX, data.posY, data.posZ);
        renderer.addEffect(fx);
    }
    if (data.amount > 0) {
        fx = new EntityDamagePopOffFX(world, data.posX, data.posY, data.posZ, data.amount);
    } else {
        fx = new EntityHealPopOffFX(world, data.posX, data.posY, data.posZ, MathHelper.abs_int(data.amount));
    }
    renderer.addEffect(fx);
}
Also used : EntityCriticalPopOffFX(org.blockartistry.mod.DynSurround.client.fx.particle.EntityCriticalPopOffFX) EffectRenderer(net.minecraft.client.particle.EffectRenderer) EntityHealPopOffFX(org.blockartistry.mod.DynSurround.client.fx.particle.EntityHealPopOffFX) EntityFX(net.minecraft.client.particle.EntityFX) EntityDamagePopOffFX(org.blockartistry.mod.DynSurround.client.fx.particle.EntityDamagePopOffFX) World(net.minecraft.world.World) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Aggregations

EffectRenderer (net.minecraft.client.particle.EffectRenderer)1 EntityFX (net.minecraft.client.particle.EntityFX)1 World (net.minecraft.world.World)1 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)1 EntityCriticalPopOffFX (org.blockartistry.mod.DynSurround.client.fx.particle.EntityCriticalPopOffFX)1 EntityDamagePopOffFX (org.blockartistry.mod.DynSurround.client.fx.particle.EntityDamagePopOffFX)1 EntityHealPopOffFX (org.blockartistry.mod.DynSurround.client.fx.particle.EntityHealPopOffFX)1