Search in sources :

Example 11 with Particle

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

the class JumpUpgrade method doMultiplayerSFX.

@Override
@SideOnly(Side.CLIENT)
public void doMultiplayerSFX(@Nonnull EntityPlayer player) {
    SoundHelper.playSound(player.world, player, SoundRegistry.JUMP, 1.0f, player.world.rand.nextFloat() * 0.5f + 0.75f);
    Random rand = player.world.rand;
    for (int i = rand.nextInt(10) + 5; i >= 0; i--) {
        Particle fx = Minecraft.getMinecraft().effectRenderer.spawnEffectParticle(EnumParticleTypes.REDSTONE.getParticleID(), player.posX + (rand.nextDouble() * 0.5 - 0.25), player.posY - player.getYOffset(), player.posZ + (rand.nextDouble() * 0.5 - 0.25), 1, 1, 1);
        ClientUtil.setParticleVelocity(fx, player.motionX + (rand.nextDouble() * 0.5 - 0.25), (player.motionY / 2) + (rand.nextDouble() * -0.05), player.motionZ + (rand.nextDouble() * 0.5 - 0.25));
        Minecraft.getMinecraft().effectRenderer.addEffect(NullHelper.notnullM(fx, "spawnEffectParticle() failed unexptedly"));
    }
}
Also used : Particle(net.minecraft.client.particle.Particle) Random(java.util.Random) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 12 with Particle

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

the class BlockSoulBinder method randomDisplayTick.

@SideOnly(Side.CLIENT)
@Override
public void randomDisplayTick(@Nonnull IBlockState bs, @Nonnull World world, @Nonnull BlockPos pos, @Nonnull Random rand) {
    int x = pos.getX();
    int y = pos.getY();
    int z = pos.getZ();
    // If active, randomly throw some smoke around
    if (isActive(world, pos)) {
        float startX = x + 1.0F;
        float startY = y + 1.0F;
        float startZ = z + 1.0F;
        for (int i = 0; i < 2; i++) {
            float xOffset = -0.2F - rand.nextFloat() * 0.6F;
            float yOffset = -0.1F + rand.nextFloat() * 0.2F;
            float zOffset = -0.2F - rand.nextFloat() * 0.6F;
            Particle fx = Minecraft.getMinecraft().effectRenderer.spawnEffectParticle(EnumParticleTypes.SPELL.getParticleID(), startX + xOffset, startY + yOffset, startZ + zOffset, 0.0D, 0.0D, 0.0D, 0);
            if (fx != null) {
                fx.setRBGColorF(0.2f, 0.2f, 0.8f);
                ClientUtil.setParticleVelocityY(fx, ClientUtil.getParticleVelocityY(fx) * 0.5);
            }
        }
    }
}
Also used : Particle(net.minecraft.client.particle.Particle) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 13 with Particle

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

the class ParticleBloodDrip method onUpdate.

@Override
public void onUpdate() {
    this.prevPosX = this.posX;
    this.prevPosY = this.posY;
    this.prevPosZ = this.posZ;
    this.motionY -= this.particleGravity;
    if (this.slowTime-- > 0) {
        this.motionX *= 0.02D;
        this.motionY *= 0.02D;
        this.motionZ *= 0.02D;
        setScale();
    }
    this.move(this.motionX, this.motionY, this.motionZ);
    this.motionX *= 0.98;
    this.motionY *= 0.98;
    this.motionZ *= 0.98;
    if (this.particleMaxAge-- <= 0) {
        this.setExpired();
    }
    if (this.onGround) {
        setExpired();
        Particle fx = Minecraft.getMinecraft().effectRenderer.spawnEffectParticle(EnumParticleTypes.WATER_SPLASH.getParticleID(), posX + (0.1 * facing.getDirectionVec().getX()), posY, posZ + (0.1 * facing.getDirectionVec().getZ()), 0, 0, 0);
        if (fx != null) {
            if (ClientConfig.bloodEnabled.get()) {
                fx.setRBGColorF(1, 0, 0);
            } else {
                fx.setRBGColorF(0, 1, 0);
            }
        }
        this.motionX *= 0.7;
        this.motionZ *= 0.7;
    }
}
Also used : Particle(net.minecraft.client.particle.Particle)

Example 14 with Particle

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

the class BlockSliceAndSplice method randomDisplayTick.

@SideOnly(Side.CLIENT)
@Override
public void randomDisplayTick(@Nonnull IBlockState bs, @Nonnull World world, @Nonnull BlockPos pos, @Nonnull Random rand) {
    TileSliceAndSplice te = getTileEntity(world, pos);
    if (te != null && isActive(world, pos)) {
        int x = pos.getX();
        int y = pos.getY();
        int z = pos.getZ();
        EnumFacing front = te.getFacing();
        int count = rand.nextInt(3) + 2;
        for (int i = 0; i < count; i++) {
            double px = x + 0.5 + front.getFrontOffsetX() * 0.5;
            double pz = z + 0.5 + front.getFrontOffsetZ() * 0.5;
            double v = 0.1;
            double vx = 0;
            double vz = 0;
            if (front == EnumFacing.NORTH || front == EnumFacing.SOUTH) {
                px += rand.nextFloat() * 0.6 - 0.275;
                vz += front == EnumFacing.NORTH ? -v : v;
            } else {
                pz += rand.nextFloat() * 0.6 - 0.275;
                vx += front == EnumFacing.WEST ? -v : v;
            }
            if (rand.nextFloat() > 0.3f) {
                Particle fx = Minecraft.getMinecraft().effectRenderer.spawnEffectParticle(EnumParticleTypes.SMOKE_NORMAL.getParticleID(), px, y + 0.7, pz, vx, 0, vz, 0);
                if (fx != null) {
                    float[] colors = new float[3];
                    // Convert a dark unsaturated red to HSB
                    Color.RGBtoHSB(80, 20, 20, colors);
                    // Randomly lower saturation
                    colors[1] = Math.max(0, colors[1] + (rand.nextFloat() * 0.4f) - 0.4f);
                    // Randomly perturb the brightness slightly
                    colors[2] += (rand.nextFloat() * 0.2f) - 0.1f;
                    // Reassemble to RGB
                    Color color = Color.getHSBColor(colors[0], colors[1], colors[2]);
                    if (ClientConfig.bloodEnabled.get()) {
                        fx.setRBGColorF(color.getRed() / 255f, color.getGreen() / 255f, color.getBlue() / 255f);
                    } else {
                        fx.setRBGColorF(color.getGreen() / 255f, color.getRed() / 255f, color.getBlue() / 255f);
                    }
                    fx.multiplyVelocity(0.25f);
                }
            } else {
                Minecraft.getMinecraft().effectRenderer.addEffect(new ParticleBloodDrip(world, px + front.getFrontOffsetX() * 0.1, y + 0.325, pz + front.getFrontOffsetZ() * 0.1, front));
            }
        }
    }
}
Also used : Particle(net.minecraft.client.particle.Particle) EnumFacing(net.minecraft.util.EnumFacing) Color(java.awt.Color) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 15 with Particle

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

the class PacketXpTransferEffects method onMessage.

@Override
public IMessage onMessage(PacketXpTransferEffects message, MessageContext ctx) {
    EntityPlayer player = EnderIO.proxy.getClientPlayer();
    if (player != null) {
        int particleCount = 1;
        if (message.swing) {
            player.swingArm(EnumHand.MAIN_HAND);
            particleCount = 5;
        }
        for (int i = 0; i < particleCount; i++) {
            float xOffset = 0.1F - player.world.rand.nextFloat() * 0.2F;
            float yOffset = 0.1F - player.world.rand.nextFloat() * 0.2F;
            float zOffset = 0.1F - player.world.rand.nextFloat() * 0.2F;
            Particle fx = Minecraft.getMinecraft().effectRenderer.spawnEffectParticle(EnumParticleTypes.SPELL.getParticleID(), message.x + xOffset, message.y + yOffset, message.z + zOffset, 0.0D, 0.0D, 0.0D);
            if (fx != null) {
                fx.setRBGColorF(0.2f, 0.8f, 0.2f);
                ClientUtil.setParticleVelocityY(fx, ClientUtil.getParticleVelocityY(fx) * 0.5);
            }
        }
    }
    return null;
}
Also used : Particle(net.minecraft.client.particle.Particle) EntityPlayer(net.minecraft.entity.player.EntityPlayer)

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