Search in sources :

Example 6 with Particle

use of net.minecraft.client.particle.Particle in project ForestryMC by ForestryMC.

the class ParticleRender method addEntityExplodeFX.

public static void addEntityExplodeFX(World world, double x, double y, double z) {
    if (!shouldSpawnParticle(world)) {
        return;
    }
    ParticleManager effectRenderer = Minecraft.getMinecraft().effectRenderer;
    Particle Particle = effectRenderer.spawnEffectParticle(EnumParticleTypes.EXPLOSION_NORMAL.getParticleID(), x, y, z, 0, 0, 0);
    effectRenderer.addEffect(Particle);
}
Also used : Particle(net.minecraft.client.particle.Particle) ParticleManager(net.minecraft.client.particle.ParticleManager)

Example 7 with Particle

use of net.minecraft.client.particle.Particle in project ForestryMC by ForestryMC.

the class ParticleRender method addEntityPotionFX.

public static void addEntityPotionFX(World world, double x, double y, double z, int color) {
    if (!shouldSpawnParticle(world)) {
        return;
    }
    float red = (color >> 16 & 255) / 255.0F;
    float green = (color >> 8 & 255) / 255.0F;
    float blue = (color & 255) / 255.0F;
    ParticleManager effectRenderer = Minecraft.getMinecraft().effectRenderer;
    Particle particle = effectRenderer.spawnEffectParticle(EnumParticleTypes.SPELL.getParticleID(), x, y, z, 0, 0, 0);
    if (particle != null) {
        particle.setRBGColorF(red, green, blue);
        effectRenderer.addEffect(particle);
    }
}
Also used : Particle(net.minecraft.client.particle.Particle) ParticleManager(net.minecraft.client.particle.ParticleManager)

Example 8 with Particle

use of net.minecraft.client.particle.Particle in project ForestryMC by ForestryMC.

the class ParticleRender method addPortalFx.

public static void addPortalFx(World world, BlockPos pos, Random rand) {
    if (!shouldSpawnParticle(world)) {
        return;
    }
    int j = rand.nextInt(2) * 2 - 1;
    int k = rand.nextInt(2) * 2 - 1;
    double xPos = (double) pos.getX() + 0.5D + 0.25D * (double) j;
    double yPos = (double) ((float) pos.getY() + rand.nextFloat());
    double zPos = (double) pos.getZ() + 0.5D + 0.25D * (double) k;
    double xSpeed = (double) (rand.nextFloat() * (float) j);
    double ySpeed = ((double) rand.nextFloat() - 0.5D) * 0.125D;
    double zSpeed = (double) (rand.nextFloat() * (float) k);
    ParticleManager effectRenderer = Minecraft.getMinecraft().effectRenderer;
    Particle particle = effectRenderer.spawnEffectParticle(EnumParticleTypes.PORTAL.getParticleID(), xPos, yPos, zPos, xSpeed, ySpeed, zSpeed);
    if (particle != null) {
        effectRenderer.addEffect(particle);
    }
}
Also used : Particle(net.minecraft.client.particle.Particle) ParticleManager(net.minecraft.client.particle.ParticleManager)

Example 9 with Particle

use of net.minecraft.client.particle.Particle in project ForestryMC by ForestryMC.

the class ParticleRender method addEntityBiodustFX.

public static void addEntityBiodustFX(World world, double x, double y, double z) {
    if (!shouldSpawnParticle(world)) {
        return;
    }
    ParticleManager effectRenderer = Minecraft.getMinecraft().effectRenderer;
    Particle particle = effectRenderer.spawnEffectParticle(EnumParticleTypes.VILLAGER_HAPPY.ordinal(), x, y, z, 0, 0, 0);
    if (particle != null) {
        effectRenderer.addEffect(particle);
    }
}
Also used : Particle(net.minecraft.client.particle.Particle) ParticleManager(net.minecraft.client.particle.ParticleManager)

Example 10 with Particle

use of net.minecraft.client.particle.Particle in project EnderIO by SleepyTrousers.

the class ItemRodOfReturn method onUsingClient.

@SideOnly(Side.CLIENT)
private void onUsingClient(ItemStack stack, EntityLivingBase player, int timeLeft) {
    if (timeLeft > (Config.rodOfReturnTicksToActivate - 2)) {
        return;
    }
    float progress = 1 - ((float) timeLeft / Config.rodOfReturnTicksToActivate);
    float spinSpeed = progress * 2;
    if (activeSound != null) {
        activeSound.setPitch(MathHelper.clamp(0.5f + (spinSpeed / 1.5f), 0.5f, 2));
    }
    if (activeSound == null) {
        BlockPos p = player.getPosition();
        activeSound = new MachineSound(ACTIVE_RES, p.getX(), p.getY(), p.getZ(), 0.3f, 1);
        playSound();
    }
    double dist = 2 - (progress * 1.5);
    Random rand = player.world.rand;
    for (int i = 0; i < 6; i++) {
        double xo = randomOffset(rand, dist);
        double yo = randomOffset(rand, dist);
        double zo = randomOffset(rand, dist);
        double x = player.posX + xo;
        double y = player.posY + yo + player.height / 2;
        double z = player.posZ + zo;
        Vector3d velocity = new Vector3d(xo, yo, zo);
        velocity.normalize();
        Particle fx = Minecraft.getMinecraft().effectRenderer.spawnEffectParticle(EnumParticleTypes.PORTAL.getParticleID(), x, y, z, 0, 0, 0, 0);
        if (fx != null) {
            // if(rand.nextInt(8) == 0) {
            // fx.setRBGColorF((rand.nextFloat() * 0.1f), 0.6f + (rand.nextFloat() * 0.15f), 0.75f + (rand.nextFloat() * 0.2f));
            // }
            ClientUtil.setParticleVelocity(fx, velocity.x, velocity.y, velocity.z);
            fx.setMaxAge(timeLeft + 2);
        }
    }
}
Also used : Particle(net.minecraft.client.particle.Particle) Random(java.util.Random) Vector3d(com.enderio.core.common.vecmath.Vector3d) BlockPos(net.minecraft.util.math.BlockPos) MachineSound(crazypants.enderio.base.machine.sound.MachineSound) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Aggregations

Particle (net.minecraft.client.particle.Particle)52 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)21 ParticleManager (net.minecraft.client.particle.ParticleManager)9 BlockPos (net.minecraft.util.math.BlockPos)8 Vec3d (net.minecraft.util.math.Vec3d)8 IEffectSource (mods.railcraft.common.util.effects.EffectManager.IEffectSource)4 TextureAtlasSprite (net.minecraft.client.renderer.texture.TextureAtlasSprite)4 EntityPlayer (net.minecraft.entity.player.EntityPlayer)4 EnumFacing (net.minecraft.util.EnumFacing)4 Random (java.util.Random)3 Minecraft (net.minecraft.client.Minecraft)3 IBakedModel (net.minecraft.client.renderer.block.model.IBakedModel)3 World (net.minecraft.world.World)3 IStateParticleBakedModel (pl.asie.charset.lib.render.model.IStateParticleBakedModel)3 TESRSignals (mods.railcraft.client.render.tesr.TESRSignals)2 IBlockState (net.minecraft.block.state.IBlockState)2 ParticleFlame (net.minecraft.client.particle.ParticleFlame)2 ModelResourceLocation (net.minecraft.client.renderer.block.model.ModelResourceLocation)2 ResourceLocation (net.minecraft.util.ResourceLocation)2 AxisAlignedBB (net.minecraft.util.math.AxisAlignedBB)2