Search in sources :

Example 16 with Particle

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

Example 17 with Particle

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

the class SequencerFX method onRandomDisplayTick.

@SideOnly(Side.CLIENT)
@Override
public void onRandomDisplayTick(World world, BlockPos pos, Random rand) {
    if (!this.getUtil().getProcess().isInProgress()) {
        return;
    }
    Particle particle = new SequencerParticleRandomTick(world, pos, rand);
    BinnieCore.getBinnieProxy().getMinecraftInstance().effectRenderer.addEffect(particle);
}
Also used : Particle(net.minecraft.client.particle.Particle) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 18 with Particle

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

the class SequencerFX method onDisplayTick.

@SideOnly(Side.CLIENT)
@Override
public void onDisplayTick(World world, BlockPos pos, Random rand) {
    if (!this.getUtil().getProcess().isInProgress())
        return;
    final int ticks = (int) (world.getTotalWorldTime() % 16L);
    if (ticks == 0) {
        final Particle particle = new SequencerParticle(world, pos);
        BinnieCore.getBinnieProxy().getMinecraftInstance().effectRenderer.addEffect(particle);
    }
}
Also used : Particle(net.minecraft.client.particle.Particle) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 19 with Particle

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

the class GenepoolFX method onDisplayTick.

@SideOnly(Side.CLIENT)
@Override
public void onDisplayTick(World world, BlockPos pos, Random rand) {
    if (this.getUtil().getProcess().isInProgress()) {
        final Particle particle = new GenepoolParticle(world, pos, rand);
        BinnieCore.getBinnieProxy().getMinecraftInstance().effectRenderer.addEffect(particle);
    }
}
Also used : Particle(net.minecraft.client.particle.Particle) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 20 with Particle

use of net.minecraft.client.particle.Particle in project Random-Things by lumien231.

the class RTEventHandler method spawnEntityFilterParticles.

@SideOnly(Side.CLIENT)
private void spawnEntityFilterParticles(LivingUpdateEvent event) {
    EntityPlayer player = Minecraft.getMinecraft().player;
    ItemStack equipped = player.getHeldItemMainhand();
    if (!equipped.isEmpty() && equipped.getItem() instanceof IEntityFilterItem) {
        IEntityFilterItem filterInstance = (IEntityFilterItem) equipped.getItem();
        if (filterInstance.apply(equipped, event.getEntityLiving())) {
            for (int i = 0; i < 1; ++i) {
                Particle particle = Minecraft.getMinecraft().effectRenderer.spawnEffectParticle(EnumParticleTypes.PORTAL.ordinal(), event.getEntityLiving().posX + (RTEventHandler.rng.nextDouble() - 0.5D) * event.getEntityLiving().width, event.getEntityLiving().posY + RTEventHandler.rng.nextDouble() * event.getEntityLiving().height - 0.25D, event.getEntityLiving().posZ + (RTEventHandler.rng.nextDouble() - 0.5D) * event.getEntityLiving().width, (RTEventHandler.rng.nextDouble() - 0.5D) * 2.0D, -RTEventHandler.rng.nextDouble(), (RTEventHandler.rng.nextDouble() - 0.5D) * 2.0D);
                particle.setRBGColorF(0.2F, 0.2F, 1);
            }
        }
    }
}
Also used : Particle(net.minecraft.client.particle.Particle) EntityPlayer(net.minecraft.entity.player.EntityPlayer) ItemStack(net.minecraft.item.ItemStack) IEntityFilterItem(lumien.randomthings.lib.IEntityFilterItem) 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