Search in sources :

Example 6 with ParticleManager

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

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

the class ParticleRender method addEntityIgnitionFX.

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

Example 8 with ParticleManager

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

the class ParticleRender method addEntitySnowFX.

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

Example 9 with ParticleManager

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

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

the class BlockCombustionGenerator method randomDisplayTick.

@Override
public void randomDisplayTick(@Nonnull IBlockState bs, @Nonnull World world, @Nonnull BlockPos pos, @Nonnull Random rand) {
    // If active, randomly throw some smoke around
    if (isActive(world, pos)) {
        TileEntity te = world.getTileEntity(pos);
        EnumFacing facing = EnumFacing.SOUTH;
        if (te instanceof AbstractMachineEntity) {
            AbstractMachineEntity me = (AbstractMachineEntity) te;
            facing = me.facing;
        }
        for (int j = 0; j < (isEnhanced ? 3 : 1); j++) {
            boolean toTop = rand.nextBoolean();
            // top:front<->back or side:bottom<->top
            float offsetA = rand.nextFloat();
            // right<->left
            float offsetB = .5f + rand.nextFloat() * .2f - rand.nextFloat() * .2f;
            float startX = pos.getX(), startY = pos.getY(), startZ = pos.getZ();
            if (toTop) {
                startY += 0.95f;
                switch(facing) {
                    case NORTH:
                    case SOUTH:
                        startX += offsetB;
                        startZ += offsetA;
                        break;
                    case EAST:
                    case WEST:
                    default:
                        startX += offsetA;
                        startZ += offsetB;
                        break;
                }
            } else {
                boolean swap = rand.nextBoolean();
                startY += offsetA;
                switch(facing) {
                    case NORTH:
                    case SOUTH:
                        startX += offsetB;
                        startZ += swap ? 0.05f : 0.95f;
                        break;
                    case EAST:
                    case WEST:
                    default:
                        startX += swap ? 0.05f : 0.95f;
                        startZ += offsetB;
                        break;
                }
            }
            for (int i = 0; i < (isEnhanced ? 5 : 2); i++) {
                ParticleManager er = Minecraft.getMinecraft().effectRenderer;
                Particle fx = er.spawnEffectParticle(EnumParticleTypes.SMOKE_NORMAL.getParticleID(), startX, startY, startZ, 0.0D, 0.0D, 0.0D);
                if (fx != null && rand.nextFloat() > .75f) {
                    fx.setRBGColorF(1 - (rand.nextFloat() * 0.2f), 1 - (rand.nextFloat() * 0.1f), 1 - (rand.nextFloat() * 0.2f));
                }
                startX += rand.nextFloat() * .1f - rand.nextFloat() * .1f;
                startY += rand.nextFloat() * .1f - rand.nextFloat() * .1f;
                startZ += rand.nextFloat() * .1f - rand.nextFloat() * .1f;
            }
        }
    }
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) Particle(net.minecraft.client.particle.Particle) AbstractMachineEntity(crazypants.enderio.base.machine.base.te.AbstractMachineEntity) EnumFacing(net.minecraft.util.EnumFacing) ParticleManager(net.minecraft.client.particle.ParticleManager)

Aggregations

ParticleManager (net.minecraft.client.particle.ParticleManager)16 Particle (net.minecraft.client.particle.Particle)9 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)3 IBlockState (net.minecraft.block.state.IBlockState)2 EnumFacing (net.minecraft.util.EnumFacing)2 BlockPos (net.minecraft.util.math.BlockPos)2 World (net.minecraft.world.World)2 AbstractMachineEntity (crazypants.enderio.base.machine.base.te.AbstractMachineEntity)1 IHiveTile (forestry.api.apiculture.IHiveTile)1 ParticleBeeExplore (forestry.apiculture.entities.ParticleBeeExplore)1 ParticleBeeRoundTrip (forestry.apiculture.entities.ParticleBeeRoundTrip)1 ParticleBeeTargetEntity (forestry.apiculture.entities.ParticleBeeTargetEntity)1 ParticleHoneydust (forestry.core.entities.ParticleHoneydust)1 ParticleIgnition (forestry.core.entities.ParticleIgnition)1 ParticleSmoke (forestry.core.entities.ParticleSmoke)1 ParticleSnow (forestry.core.entities.ParticleSnow)1 Random (java.util.Random)1 IBakedModel (net.minecraft.client.renderer.block.model.IBakedModel)1 TextureAtlasSprite (net.minecraft.client.renderer.texture.TextureAtlasSprite)1 EntityLivingBase (net.minecraft.entity.EntityLivingBase)1