Search in sources :

Example 1 with RenderOffsetNoisePlane

use of hellfirepvp.astralsorcery.client.effect.function.impl.RenderOffsetNoisePlane in project AstralSorcery by HellFirePvP.

the class ActivePlayerAttunementRecipe method setupPlanes.

@OnlyIn(Dist.CLIENT)
private void setupPlanes() {
    if (this.playerNoisePlanes.isEmpty()) {
        this.playerNoisePlanes.add(new RenderOffsetNoisePlane(1F));
        this.playerNoisePlanes.add(new RenderOffsetNoisePlane(1.4F));
        this.playerNoisePlanes.add(new RenderOffsetNoisePlane(1.8F));
    }
}
Also used : RenderOffsetNoisePlane(hellfirepvp.astralsorcery.client.effect.function.impl.RenderOffsetNoisePlane) OnlyIn(net.minecraftforge.api.distmarker.OnlyIn)

Example 2 with RenderOffsetNoisePlane

use of hellfirepvp.astralsorcery.client.effect.function.impl.RenderOffsetNoisePlane in project AstralSorcery by HellFirePvP.

the class ActivePlayerAttunementRecipe method doEffectTick.

@OnlyIn(Dist.CLIENT)
private void doEffectTick(TileAttunementAltar altar) {
    IConstellation cst = altar.getActiveConstellation();
    if (cst == null) {
        return;
    }
    Vector3 playerTarget = new Vector3(altar).add(0.5, 2.5, 0.5);
    VFXColorFunction<?> beamColor = VFXColorFunction.constant(ColorsAS.DEFAULT_GENERIC_PARTICLE);
    int tick = getTick();
    if (tick % 40 == 0) {
        for (BlockPos pos : altar.getConstellationPositions(cst)) {
            Vector3 from = new Vector3(pos).add(0.5, 0, 0.5);
            MiscUtils.applyRandomOffset(from, rand, 0.1F);
            EffectHelper.of(EffectTemplatesAS.LIGHTBEAM).spawn(from).setup(from.clone().addY(6), 1.2, 1.2).setAlphaMultiplier(0.8F).color(beamColor).setMaxAge(60);
        }
    }
    double scale = 7.0D;
    double edgeScale = (scale * 2 + 1);
    for (int i = 0; i < 7; i++) {
        Vector3 offset = new Vector3(altar).add(-scale, 0.1, -scale);
        if (rand.nextBoolean()) {
            offset.add(edgeScale * (rand.nextBoolean() ? 1 : 0), 0, rand.nextFloat() * edgeScale);
        } else {
            offset.add(rand.nextFloat() * edgeScale, 0, edgeScale * (rand.nextBoolean() ? 1 : 0));
        }
        FXFacingParticle particle = EffectHelper.of(EffectTemplatesAS.GENERIC_PARTICLE).spawn(offset).alpha(VFXAlphaFunction.FADE_OUT).setGravityStrength(-0.0002F + rand.nextFloat() * -0.0001F).setScaleMultiplier(0.3F + rand.nextFloat() * 0.15F).color(VFXColorFunction.WHITE).setMaxAge(40 + rand.nextInt(10));
        if (rand.nextBoolean()) {
            particle.color(VFXColorFunction.constant(this.constellation.getConstellationColor()));
        }
    }
    for (int i = 0; i < 5; i++) {
        Set<BlockPos> offsets = altar.getConstellationPositions(cst);
        BlockPos pos = MiscUtils.getRandomEntry(offsets, rand);
        if (tick <= 380) {
            Vector3 offset = new Vector3(pos).add(0.5, 0, 0.5).add(Vector3.random().setY(0).multiply(0.6));
            EffectHelper.of(EffectTemplatesAS.GENERIC_PARTICLE).spawn(offset).color(VFXColorFunction.WHITE).setGravityStrength(-0.0006F + rand.nextFloat() * -0.003F).setMotion(Vector3.random().addY(4).normalize().multiply(0.015 + rand.nextFloat() * 0.01)).setAlphaMultiplier(0.6F).setScaleMultiplier(0.3F + rand.nextFloat() * 0.15F).alpha(VFXAlphaFunction.FADE_OUT).setMaxAge(60 + rand.nextInt(20));
        } else {
            Vector3 offset = new Vector3(pos).add(0.5, 0, 0.5).add(Vector3.random().setY(0).multiply(0.5));
            EffectHelper.of(EffectTemplatesAS.GENERIC_PARTICLE).spawn(offset).setAlphaMultiplier(0.6F).alpha(VFXAlphaFunction.proximity(playerTarget::clone, 3F)).motion(VFXMotionController.target(playerTarget::clone, 0.08F)).setScaleMultiplier(0.2F + rand.nextFloat() * 0.1F).color(VFXColorFunction.WHITE).setMotion(new Vector3(0, 0.2 + rand.nextFloat() * 0.15F, 0)).setMaxAge(60 + rand.nextInt(20));
            offset = new Vector3(altar).add(0.5, 0, 0.5).add(Vector3.random().setY(0).multiply(0.6));
            EffectHelper.of(EffectTemplatesAS.GENERIC_PARTICLE).spawn(offset).color(VFXColorFunction.WHITE).setGravityStrength(-0.0006F + rand.nextFloat() * -0.004F).setMotion(Vector3.random().addY(4).normalize().multiply(0.02 + rand.nextFloat() * 0.01)).setAlphaMultiplier(0.75F).setScaleMultiplier(0.3F + rand.nextFloat() * 0.1F).alpha(VFXAlphaFunction.FADE_OUT).setMaxAge(40 + rand.nextInt(10));
        }
    }
    if (tick >= 220) {
        Vector3 offset = new Vector3(altar).add(0.5, 0, 0.5).add(Vector3.random().setY(0));
        FXFacingParticle p = EffectHelper.of(EffectTemplatesAS.GENERIC_PARTICLE).spawn(offset).setAlphaMultiplier(1F).alpha(VFXAlphaFunction.proximity(playerTarget::clone, 3F)).motion(VFXMotionController.target(playerTarget::clone, 0.1F)).setScaleMultiplier(0.2F + rand.nextFloat() * 0.1F).color(VFXColorFunction.WHITE).setMotion(Vector3.positiveYRandom().setY(1).normalize().multiply(0.5F + rand.nextFloat() * 0.1F)).setMaxAge(60 + rand.nextInt(20));
        if (rand.nextBoolean()) {
            p.color(VFXColorFunction.constant(this.constellation.getConstellationColor()));
        }
        for (int i = 0; i < 3; i++) {
            Vector3 at = new Vector3(altar).add(0.5, 0, 0.5);
            at.addX(rand.nextFloat() * 7F * (rand.nextBoolean() ? 1 : -1));
            at.addZ(rand.nextFloat() * 7F * (rand.nextBoolean() ? 1 : -1));
            p = EffectHelper.of(EffectTemplatesAS.GENERIC_PARTICLE).spawn(at).setAlphaMultiplier(0.75F).alpha(VFXAlphaFunction.FADE_OUT).setGravityStrength(-0.001F + rand.nextFloat() * -0.0005F).color(VFXColorFunction.WHITE).setScaleMultiplier(0.3F + rand.nextFloat() * 0.1F).setMaxAge(20 + rand.nextInt(10));
            if (rand.nextBoolean()) {
                p.color(VFXColorFunction.constant(this.constellation.getConstellationColor()));
            }
            if (tick >= 500) {
                p.setScaleMultiplier(0.3F + rand.nextFloat() * 0.15F);
            }
        }
    }
    if (tick >= 400) {
        int amt = tick >= 500 ? 4 : 1;
        for (int i = 0; i < amt; i++) {
            RenderOffsetNoisePlane plane = (RenderOffsetNoisePlane) MiscUtils.getRandomEntry(this.playerNoisePlanes, rand);
            FXFacingParticle p = plane.createParticle(playerTarget.clone()).setMotion(Vector3.random().setY(0).multiply(rand.nextFloat() * 0.015F)).setAlphaMultiplier(0.6F).setScaleMultiplier(0.2F + rand.nextFloat() * 0.05F).alpha(VFXAlphaFunction.FADE_OUT).setMaxAge(60 + rand.nextInt(20));
            if (rand.nextBoolean()) {
                p.color(VFXColorFunction.constant(this.constellation.getConstellationColor()));
            }
        }
    }
    if (tick >= 600) {
        if (tick % 10 == 0) {
            Vector3 from = new Vector3(altar).add(0.5, 0, 0.5);
            MiscUtils.applyRandomOffset(from, rand, 0.25F);
            EffectHelper.of(EffectTemplatesAS.LIGHTBEAM).spawn(from).setup(from.clone().addY(8), 2.4, 2).setAlphaMultiplier(0.8F).setMaxAge(40 + rand.nextInt(20));
        }
    }
    if (tick >= (DURATION_PLAYER_ATTUNEMENT - 4)) {
        for (int i = 0; i < 60; i++) {
            Vector3 at = new Vector3(altar).add(0.5, 0, 0.5).addY(rand.nextFloat() * 15);
            FXFacingParticle p = EffectHelper.of(EffectTemplatesAS.GENERIC_PARTICLE).spawn(at).color(VFXColorFunction.WHITE).setMotion(Vector3.random().setY(0).normalize().multiply(0.03 + rand.nextFloat() * 0.01)).setAlphaMultiplier(0.7F).setScaleMultiplier(0.3F + rand.nextFloat() * 0.15F).alpha(VFXAlphaFunction.FADE_OUT).setMaxAge(140 + rand.nextInt(60));
            if (rand.nextBoolean()) {
                p.color(VFXColorFunction.constant(this.constellation.getConstellationColor()));
            }
        }
    }
}
Also used : RenderOffsetNoisePlane(hellfirepvp.astralsorcery.client.effect.function.impl.RenderOffsetNoisePlane) Vector3(hellfirepvp.astralsorcery.common.util.data.Vector3) BlockPos(net.minecraft.util.math.BlockPos) FXFacingParticle(hellfirepvp.astralsorcery.client.effect.vfx.FXFacingParticle) IConstellation(hellfirepvp.astralsorcery.common.constellation.IConstellation) OnlyIn(net.minecraftforge.api.distmarker.OnlyIn)

Example 3 with RenderOffsetNoisePlane

use of hellfirepvp.astralsorcery.client.effect.function.impl.RenderOffsetNoisePlane in project AstralSorcery by HellFirePvP.

the class EffectVortexPlane method onTick.

@Override
@OnlyIn(Dist.CLIENT)
public void onTick(TileAltar altar, ActiveSimpleAltarRecipe.CraftingState state) {
    ActiveSimpleAltarRecipe recipe = altar.getActiveRecipe();
    if (recipe != null && state == ActiveSimpleAltarRecipe.CraftingState.ACTIVE) {
        Vector3 at = new Vector3(altar).add(0.5, 0, 0.5);
        Vector3 target = at.clone().add(getFocusRelayOffset(altar.getAltarType()));
        RenderOffsetNoisePlane plane = recipe.getEffectContained(INDEX_NOISE_PLANE_LAYER1, i -> new RenderOffsetNoisePlane(1.2F));
        for (int i = 0; i < 3; i++) {
            FXFacingParticle p = plane.createParticle(target);
            p.alpha(VFXAlphaFunction.FADE_OUT).setMotion(new Vector3(rand.nextFloat() * 0.005 * (rand.nextBoolean() ? 1 : -1), rand.nextFloat() * 0.005 * (rand.nextBoolean() ? 1 : -1), rand.nextFloat() * 0.005 * (rand.nextBoolean() ? 1 : -1))).setScaleMultiplier(0.15F + rand.nextFloat() * 0.1F).setMaxAge(20 + rand.nextInt(15));
        }
        plane = recipe.getEffectContained(INDEX_NOISE_PLANE_LAYER2, i -> new RenderOffsetNoisePlane(1.6F));
        for (int i = 0; i < 3; i++) {
            FXFacingParticle p = plane.createParticle(target);
            p.alpha(VFXAlphaFunction.FADE_OUT).setMotion(new Vector3(rand.nextFloat() * 0.005 * (rand.nextBoolean() ? 1 : -1), rand.nextFloat() * 0.005 * (rand.nextBoolean() ? 1 : -1), rand.nextFloat() * 0.005 * (rand.nextBoolean() ? 1 : -1))).setScaleMultiplier(0.15F + rand.nextFloat() * 0.1F).setMaxAge(20 + rand.nextInt(15));
        }
        double scale = getRandomPillarOffset(altar.getAltarType()).getX();
        double edgeScale = (scale * 2 + 1);
        for (int i = 0; i < 2; i++) {
            Vector3 pos = new Vector3(altar).add(-scale + rand.nextFloat() * edgeScale, 0.02, -scale + rand.nextFloat() * edgeScale);
            Vector3 mot = pos.vectorFromHereTo(target).normalize().multiply(0.1F);
            EffectHelper.of(EffectTemplatesAS.GENERIC_PARTICLE).spawn(pos).alpha(VFXAlphaFunction.FADE_OUT).color(VFXColorFunction.WHITE).setScaleMultiplier(0.2F + rand.nextFloat() * 0.1F).setMotion(mot);
        }
        for (int i = 0; i < 2; i++) {
            Vector3 pos = target.clone().add(Vector3.random().multiply(4F));
            Vector3 dst = pos.vectorFromHereTo(target);
            Vector3 mot = dst.clone().multiply(dst.length() / 250);
            EffectHelper.of(EffectTemplatesAS.GENERIC_PARTICLE).spawn(pos).alpha(VFXAlphaFunction.PYRAMID).color(VFXColorFunction.WHITE).setScaleMultiplier(0.2F + rand.nextFloat() * 0.1F).setMotion(mot);
        }
    }
}
Also used : FXFacingParticle(hellfirepvp.astralsorcery.client.effect.vfx.FXFacingParticle) VFXAlphaFunction(hellfirepvp.astralsorcery.client.effect.function.VFXAlphaFunction) Vector3(hellfirepvp.astralsorcery.common.util.data.Vector3) OnlyIn(net.minecraftforge.api.distmarker.OnlyIn) IRenderTypeBuffer(net.minecraft.client.renderer.IRenderTypeBuffer) EffectHelper(hellfirepvp.astralsorcery.client.effect.handler.EffectHelper) TileAltar(hellfirepvp.astralsorcery.common.tile.altar.TileAltar) Dist(net.minecraftforge.api.distmarker.Dist) VFXColorFunction(hellfirepvp.astralsorcery.client.effect.function.VFXColorFunction) RenderOffsetNoisePlane(hellfirepvp.astralsorcery.client.effect.function.impl.RenderOffsetNoisePlane) EffectTemplatesAS(hellfirepvp.astralsorcery.client.lib.EffectTemplatesAS) ActiveSimpleAltarRecipe(hellfirepvp.astralsorcery.common.crafting.recipe.altar.ActiveSimpleAltarRecipe) MatrixStack(com.mojang.blaze3d.matrix.MatrixStack) ActiveSimpleAltarRecipe(hellfirepvp.astralsorcery.common.crafting.recipe.altar.ActiveSimpleAltarRecipe) RenderOffsetNoisePlane(hellfirepvp.astralsorcery.client.effect.function.impl.RenderOffsetNoisePlane) Vector3(hellfirepvp.astralsorcery.common.util.data.Vector3) FXFacingParticle(hellfirepvp.astralsorcery.client.effect.vfx.FXFacingParticle) OnlyIn(net.minecraftforge.api.distmarker.OnlyIn)

Example 4 with RenderOffsetNoisePlane

use of hellfirepvp.astralsorcery.client.effect.function.impl.RenderOffsetNoisePlane in project AstralSorcery by HellFirePvP.

the class FountainEffectVortex method playVortexEffects.

@OnlyIn(Dist.CLIENT)
private void playVortexEffects(BlockPos pos, TileFountain fountain, VortexContext ctx) {
    Vector3 at = new Vector3(pos).add(0.5, 0.5, 0.5);
    Vector3 vortexAt = at.clone().addY(-4);
    FXFacingSprite sprite = (FXFacingSprite) ctx.facingVortexPlane;
    if (sprite == null) {
        sprite = EffectHelper.of(EffectTemplatesAS.FACING_SPRITE).spawn(vortexAt).setSprite(SpritesAS.SPR_ATTUNEMENT_FLARE).setAlphaMultiplier(1F).setScaleMultiplier(2F).refresh(RefreshFunction.tileExistsAnd(fountain, (tile, fx) -> tile.getCurrentEffect() == this));
    } else if (sprite.isRemoved() || sprite.canRemove()) {
        EffectHelper.refresh(sprite, EffectTemplatesAS.FACING_SPRITE);
    }
    ctx.facingVortexPlane = sprite;
    if (ctx.ctrlEffectNoise == null) {
        ctx.ctrlEffectNoise = Lists.newArrayList(new RenderOffsetNoisePlane(1.2F), new RenderOffsetNoisePlane(2.0F), new RenderOffsetNoisePlane(2.8F));
    }
    for (Object objPlane : ctx.ctrlEffectNoise) {
        RenderOffsetNoisePlane plane = (RenderOffsetNoisePlane) objPlane;
        for (int i = 0; i < 3; i++) {
            plane.createParticle(vortexAt).setMotion(Vector3.random().normalize().multiply(0.005F)).alpha(VFXAlphaFunction.FADE_OUT).setScaleMultiplier(0.2F + rand.nextFloat() * 0.1F).setMaxAge(30 + rand.nextInt(15));
        }
    }
}
Also used : FXFacingSprite(hellfirepvp.astralsorcery.client.effect.vfx.FXFacingSprite) RenderOffsetNoisePlane(hellfirepvp.astralsorcery.client.effect.function.impl.RenderOffsetNoisePlane) Vector3(hellfirepvp.astralsorcery.common.util.data.Vector3) OnlyIn(net.minecraftforge.api.distmarker.OnlyIn)

Aggregations

RenderOffsetNoisePlane (hellfirepvp.astralsorcery.client.effect.function.impl.RenderOffsetNoisePlane)4 OnlyIn (net.minecraftforge.api.distmarker.OnlyIn)4 Vector3 (hellfirepvp.astralsorcery.common.util.data.Vector3)3 FXFacingParticle (hellfirepvp.astralsorcery.client.effect.vfx.FXFacingParticle)2 MatrixStack (com.mojang.blaze3d.matrix.MatrixStack)1 VFXAlphaFunction (hellfirepvp.astralsorcery.client.effect.function.VFXAlphaFunction)1 VFXColorFunction (hellfirepvp.astralsorcery.client.effect.function.VFXColorFunction)1 EffectHelper (hellfirepvp.astralsorcery.client.effect.handler.EffectHelper)1 FXFacingSprite (hellfirepvp.astralsorcery.client.effect.vfx.FXFacingSprite)1 EffectTemplatesAS (hellfirepvp.astralsorcery.client.lib.EffectTemplatesAS)1 IConstellation (hellfirepvp.astralsorcery.common.constellation.IConstellation)1 ActiveSimpleAltarRecipe (hellfirepvp.astralsorcery.common.crafting.recipe.altar.ActiveSimpleAltarRecipe)1 TileAltar (hellfirepvp.astralsorcery.common.tile.altar.TileAltar)1 IRenderTypeBuffer (net.minecraft.client.renderer.IRenderTypeBuffer)1 BlockPos (net.minecraft.util.math.BlockPos)1 Dist (net.minecraftforge.api.distmarker.Dist)1