Search in sources :

Example 1 with ParticleManager

use of net.minecraft.client.particle.ParticleManager 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 2 with ParticleManager

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

the class ParticleRender method addEntitySmokeFX.

public static void addEntitySmokeFX(World world, double x, double y, double z) {
    if (!shouldSpawnParticle(world)) {
        return;
    }
    ParticleManager effectRenderer = Minecraft.getMinecraft().effectRenderer;
    effectRenderer.addEffect(new ParticleSmoke(world, x, y, z));
}
Also used : ParticleManager(net.minecraft.client.particle.ParticleManager) ParticleSmoke(forestry.core.entities.ParticleSmoke)

Example 3 with ParticleManager

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

the class ParticleRender method addEntityHoneyDustFX.

public static void addEntityHoneyDustFX(World world, double x, double y, double z) {
    if (!shouldSpawnParticle(world)) {
        return;
    }
    ParticleManager effectRenderer = Minecraft.getMinecraft().effectRenderer;
    effectRenderer.addEffect(new ParticleHoneydust(world, x, y, z, 0, 0, 0));
}
Also used : ParticleHoneydust(forestry.core.entities.ParticleHoneydust) ParticleManager(net.minecraft.client.particle.ParticleManager)

Example 4 with ParticleManager

use of net.minecraft.client.particle.ParticleManager 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 5 with ParticleManager

use of net.minecraft.client.particle.ParticleManager 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)

Aggregations

ParticleManager (net.minecraft.client.particle.ParticleManager)22 Particle (net.minecraft.client.particle.Particle)9 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)7 IBlockState (net.minecraft.block.state.IBlockState)5 World (net.minecraft.world.World)5 Random (java.util.Random)4 EnumFacing (net.minecraft.util.EnumFacing)4 BlockPos (net.minecraft.util.math.BlockPos)4 TextureAtlasSprite (net.minecraft.client.renderer.texture.TextureAtlasSprite)3 EntityPlayer (net.minecraft.entity.player.EntityPlayer)3 TileEntity (net.minecraft.tileentity.TileEntity)3 Vec3d (net.minecraft.util.math.Vec3d)3 Collection (java.util.Collection)2 Collections (java.util.Collections)2 List (java.util.List)2 Objects (java.util.Objects)2 Optional (java.util.Optional)2 Collectors (java.util.stream.Collectors)2 Nonnull (javax.annotation.Nonnull)2 Nullable (javax.annotation.Nullable)2