Search in sources :

Example 1 with Particle

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

the class ClientEffectProxy method chunkLoaderEffect.

@Override
public void chunkLoaderEffect(World world, Object source, Set<ChunkPos> chunks) {
    if (!isGoggleAuraActive(GoggleAura.WORLDSPIKE))
        return;
    IEffectSource es = EffectManager.getEffectSource(source);
    Vec3d sourcePos = es.getPosF();
    if (FMLClientHandler.instance().getClient().thePlayer.getDistanceSq(sourcePos.xCoord, sourcePos.yCoord, sourcePos.zCoord) > 25600)
        return;
    for (ChunkPos chunk : chunks) {
        int xCorner = chunk.chunkXPos * 16;
        int zCorner = chunk.chunkZPos * 16;
        double yCorner = sourcePos.yCoord - 8;
        //            System.out.println(xCorner + ", " + zCorner);
        if (rand.nextInt(3) == 0) {
            if (thinParticles(false))
                continue;
            double xParticle = xCorner + rand.nextFloat() * 16;
            double yParticle = yCorner + rand.nextFloat() * 16;
            double zParticle = zCorner + rand.nextFloat() * 16;
            Particle particle = new ParticleChunkLoader(world, new Vec3d(xParticle, yParticle, zParticle), es);
            spawnParticle(particle);
        }
    }
}
Also used : Particle(net.minecraft.client.particle.Particle) IEffectSource(mods.railcraft.common.util.effects.EffectManager.IEffectSource) ChunkPos(net.minecraft.util.math.ChunkPos) Vec3d(net.minecraft.util.math.Vec3d)

Example 2 with Particle

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

the class ClientEffectProxy method fireSparkEffect.

@Override
public void fireSparkEffect(World world, Vec3d start, Vec3d end) {
    if (thinParticles(false))
        return;
    IEffectSource es = EffectManager.getEffectSource(start);
    Particle particle = new ParticleFireSpark(world, start, end);
    spawnParticle(particle);
    SoundHelper.playSoundClient(world, es.getPos(), SoundEvents.BLOCK_LAVA_POP, SoundCategory.BLOCKS, .2F + rand.nextFloat() * .2F, .9F + rand.nextFloat() * .15F);
}
Also used : Particle(net.minecraft.client.particle.Particle) IEffectSource(mods.railcraft.common.util.effects.EffectManager.IEffectSource)

Example 3 with Particle

use of net.minecraft.client.particle.Particle in project Charset by CharsetMC.

the class UtilProxyClient method addRunningParticles.

@Override
public boolean addRunningParticles(IBlockState state, World world, BlockPos pos, Entity entity) {
    IBakedModel model = Minecraft.getMinecraft().getBlockRendererDispatcher().getModelForState(state);
    if (model instanceof IStateParticleBakedModel) {
        state = state.getBlock().getExtendedState(state.getActualState(world, pos), world, pos);
        TextureAtlasSprite sprite = ((IStateParticleBakedModel) model).getParticleTexture(state, EnumFacing.UP);
        Particle particle = new ParticleDiggingCharset(world, entity.posX + ((double) PacketCustomBlockDust.rand.nextFloat() - 0.5D) * (double) entity.width, entity.getEntityBoundingBox().minY + 0.1D, entity.posZ + ((double) PacketCustomBlockDust.rand.nextFloat() - 0.5D) * (double) entity.width, -entity.motionX * 4.0D, 1.5D, -entity.motionZ * 4.0D, state, pos, sprite, ((BlockBase) state.getBlock()).getParticleTintIndex());
        Minecraft.getMinecraft().effectRenderer.addEffect(particle);
        return true;
    } else {
        return false;
    }
}
Also used : Particle(net.minecraft.client.particle.Particle) ParticleDiggingCharset(pl.asie.charset.lib.render.ParticleDiggingCharset) TextureAtlasSprite(net.minecraft.client.renderer.texture.TextureAtlasSprite) IStateParticleBakedModel(pl.asie.charset.lib.render.model.IStateParticleBakedModel) IBakedModel(net.minecraft.client.renderer.block.model.IBakedModel)

Example 4 with Particle

use of net.minecraft.client.particle.Particle in project Charset by CharsetMC.

the class UtilProxyClient method spawnBlockDustClient.

@Override
public void spawnBlockDustClient(World world, BlockPos pos, Random rand, float posX, float posY, float posZ, int numberOfParticles, float particleSpeed, EnumFacing facing) {
    TextureAtlasSprite sprite;
    int tintIndex = -1;
    IBlockState state = world.getBlockState(pos);
    if (state.getBlock() instanceof BlockBase) {
        tintIndex = ((BlockBase) state.getBlock()).getParticleTintIndex();
    }
    IBakedModel model = Minecraft.getMinecraft().getBlockRendererDispatcher().getModelForState(state);
    if (model instanceof IStateParticleBakedModel) {
        state = state.getBlock().getExtendedState(state.getActualState(world, pos), world, pos);
        sprite = ((IStateParticleBakedModel) model).getParticleTexture(state, facing);
    } else {
        sprite = model.getParticleTexture();
    }
    ParticleManager manager = Minecraft.getMinecraft().effectRenderer;
    for (int i = 0; i < numberOfParticles; i++) {
        double xSpeed = rand.nextGaussian() * particleSpeed;
        double ySpeed = rand.nextGaussian() * particleSpeed;
        double zSpeed = rand.nextGaussian() * particleSpeed;
        try {
            Particle particle = new ParticleBlockDustCharset(world, posX, posY, posZ, xSpeed, ySpeed, zSpeed, state, pos, sprite, tintIndex);
            manager.addEffect(particle);
        } catch (Throwable var16) {
            ModCharset.logger.warn("Could not spawn block particle!");
            return;
        }
    }
}
Also used : Particle(net.minecraft.client.particle.Particle) IBlockState(net.minecraft.block.state.IBlockState) BlockBase(pl.asie.charset.lib.block.BlockBase) ParticleBlockDustCharset(pl.asie.charset.lib.render.ParticleBlockDustCharset) TextureAtlasSprite(net.minecraft.client.renderer.texture.TextureAtlasSprite) IStateParticleBakedModel(pl.asie.charset.lib.render.model.IStateParticleBakedModel) ParticleManager(net.minecraft.client.particle.ParticleManager) IBakedModel(net.minecraft.client.renderer.block.model.IBakedModel)

Example 5 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)

Aggregations

Particle (net.minecraft.client.particle.Particle)53 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)22 ParticleManager (net.minecraft.client.particle.ParticleManager)9 Vec3d (net.minecraft.util.math.Vec3d)9 BlockPos (net.minecraft.util.math.BlockPos)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 World (net.minecraft.world.World)4 Random (java.util.Random)3 Minecraft (net.minecraft.client.Minecraft)3 IBakedModel (net.minecraft.client.renderer.block.model.IBakedModel)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 TileEntity (net.minecraft.tileentity.TileEntity)2 ResourceLocation (net.minecraft.util.ResourceLocation)2