Search in sources :

Example 1 with AbstractRenderableTexture

use of hellfirepvp.astralsorcery.client.resource.AbstractRenderableTexture in project AstralSorcery by HellFirePvP.

the class AstralSkyRenderer method initialize.

private void initialize() {
    sky.batch(AstralSkyRendererSetup::generateSky);
    skyHorizon.batch(AstralSkyRendererSetup::generateSkyHorizon);
    for (int i = 0; i < 20; i++) {
        AbstractRenderableTexture starTexture = (i % 2 == 0 ? TexturesAS.TEX_STAR_1 : TexturesAS.TEX_STAR_2);
        int flicker = 12 + RAND.nextInt(5);
        StarDrawList starList = new StarDrawList(starTexture, flicker);
        starList.batch(buf -> AstralSkyRendererSetup.generateStars(buf, 60 + RAND.nextInt(60), 1.1F + RAND.nextFloat() * 0.3F));
        starLists.add(starList);
    }
    this.initialized = true;
}
Also used : AbstractRenderableTexture(hellfirepvp.astralsorcery.client.resource.AbstractRenderableTexture)

Example 2 with AbstractRenderableTexture

use of hellfirepvp.astralsorcery.client.resource.AbstractRenderableTexture in project AstralSorcery by HellFirePvP.

the class CelestialStrike method playEffect.

@OnlyIn(Dist.CLIENT)
public static void playEffect(PktPlayEffect effect) {
    Random r = new Random();
    Vector3 vec = ByteBufUtils.readVector(effect.getExtraData());
    Vector3 effectPos = vec.clone();
    EffectHelper.of(EffectTemplatesAS.LIGHTBEAM).spawn(effectPos.clone().addY(-4)).setup(effectPos.clone().addY(16), 9, 6).alpha(VFXAlphaFunction.FADE_OUT).color(VFXColorFunction.WHITE).setAlphaMultiplier(1F).setMaxAge(25);
    effectPos.add(r.nextFloat() - r.nextFloat(), 0, r.nextFloat() - r.nextFloat());
    EffectHelper.of(EffectTemplatesAS.LIGHTBEAM).spawn(effectPos.clone().addY(-4)).setup(effectPos.clone().addY(16).addY(r.nextFloat() * 2F), 9, 6).alpha(VFXAlphaFunction.FADE_OUT).color(VFXColorFunction.constant(ColorsAS.EFFECT_BLUE_LIGHT)).setAlphaMultiplier(1F).setMaxAge(24 + r.nextInt(6));
    effectPos.add(r.nextFloat() - r.nextFloat(), 0, r.nextFloat() - r.nextFloat());
    EffectHelper.of(EffectTemplatesAS.LIGHTBEAM).spawn(effectPos.clone().addY(-4)).setup(effectPos.clone().addY(16).addY(r.nextFloat() * 2F), 9, 6).alpha(VFXAlphaFunction.FADE_OUT).color(VFXColorFunction.constant(ColorsAS.EFFECT_BLUE_DARK)).setAlphaMultiplier(1F).setMaxAge(24 + r.nextInt(6));
    AbstractRenderableTexture tex = MiscUtils.eitherOf(r, TexturesAS.TEX_SMOKE_1, TexturesAS.TEX_SMOKE_2, TexturesAS.TEX_SMOKE_3, TexturesAS.TEX_SMOKE_4);
    EffectHelper.of(EffectTemplatesAS.TEXTURE_SPRITE).spawn(vec.clone().addY(0.1F)).setAxis(Vector3.RotAxis.Y_AXIS.clone().negate()).setSprite(tex).setNoRotation(r.nextFloat() * 360F).setAlphaMultiplier(0.4F).alpha(VFXAlphaFunction.FADE_OUT).setScaleMultiplier(17F).setMaxAge(30 + r.nextInt(10));
    for (int i = 0; i < 43; i++) {
        Vector3 randTo = new Vector3((r.nextDouble() * 9) - (r.nextDouble() * 9), r.nextDouble() * 5, (r.nextDouble() * 9) - (r.nextDouble() * 9));
        randTo.add(vec.clone());
        FXLightning lightning = EffectHelper.of(EffectTemplatesAS.LIGHTNING).spawn(vec.clone()).makeDefault(randTo);
        lightning.color(MiscUtils.eitherOf(r, VFXColorFunction.constant(Color.WHITE), VFXColorFunction.constant(ColorsAS.EFFECT_BLUE_LIGHT), VFXColorFunction.constant(ColorsAS.EFFECT_BLUE_DARK)));
    }
    for (int i = 0; i < 40; i++) {
        FXFacingParticle p = EffectHelper.of(EffectTemplatesAS.GENERIC_PARTICLE).spawn(vec.clone().add((r.nextFloat() - r.nextFloat()) * 4, r.nextFloat() * 9, (r.nextFloat() - r.nextFloat()) * 4)).setGravityStrength(-0.005F).setScaleMultiplier(0.85F).setMaxAge(14 + r.nextInt(6));
        p.color(MiscUtils.eitherOf(r, VFXColorFunction.constant(Color.WHITE), VFXColorFunction.constant(ColorsAS.EFFECT_BLUE_LIGHT), VFXColorFunction.constant(ColorsAS.EFFECT_BLUE_DARK)));
    }
    List<Vector3> circle = MiscUtils.getCirclePositions(vec, Vector3.RotAxis.Y_AXIS, 7.5F + r.nextFloat(), 200 + r.nextInt(40));
    for (Vector3 at : circle) {
        Vector3 dir = at.clone().subtract(vec).normalize().multiply(0.3 + 0.4 * r.nextFloat());
        EffectHelper.of(EffectTemplatesAS.GENERIC_PARTICLE).spawn(at).setAlphaMultiplier(0.4F).setMotion(dir).color(VFXColorFunction.constant(ColorsAS.EFFECT_BLUE_LIGHT)).setScaleMultiplier(1.2F).setMaxAge(14 + r.nextInt(6));
    }
    circle = MiscUtils.getCirclePositions(vec, Vector3.RotAxis.Y_AXIS, 7.5F + r.nextFloat(), 100 + r.nextInt(40));
    for (Vector3 at : circle) {
        Vector3 dir = at.clone().subtract(vec).normalize().multiply(0.2 + 0.1 * r.nextFloat());
        EffectHelper.of(EffectTemplatesAS.GENERIC_PARTICLE).spawn(at).setAlphaMultiplier(0.4F).setMotion(dir).color(VFXColorFunction.constant(ColorsAS.EFFECT_BLUE_DARK)).setScaleMultiplier(1.5F).setMaxAge(14 + r.nextInt(6));
    }
}
Also used : AbstractRenderableTexture(hellfirepvp.astralsorcery.client.resource.AbstractRenderableTexture) Random(java.util.Random) Vector3(hellfirepvp.astralsorcery.common.util.data.Vector3) FXFacingParticle(hellfirepvp.astralsorcery.client.effect.vfx.FXFacingParticle) FXLightning(hellfirepvp.astralsorcery.client.effect.vfx.FXLightning) OnlyIn(net.minecraftforge.api.distmarker.OnlyIn)

Example 3 with AbstractRenderableTexture

use of hellfirepvp.astralsorcery.client.resource.AbstractRenderableTexture in project AstralSorcery by HellFirePvP.

the class SpriteQuery method resolveSprite.

@Nonnull
@OnlyIn(Dist.CLIENT)
public SpriteSheetResource resolveSprite() {
    if (spriteResource == null) {
        AbstractRenderableTexture res = resolve();
        spriteResource = new SpriteSheetResource(res, getRows(), getColumns());
    }
    return (SpriteSheetResource) spriteResource;
}
Also used : AbstractRenderableTexture(hellfirepvp.astralsorcery.client.resource.AbstractRenderableTexture) SpriteSheetResource(hellfirepvp.astralsorcery.client.resource.SpriteSheetResource) Nonnull(javax.annotation.Nonnull) OnlyIn(net.minecraftforge.api.distmarker.OnlyIn)

Aggregations

AbstractRenderableTexture (hellfirepvp.astralsorcery.client.resource.AbstractRenderableTexture)3 OnlyIn (net.minecraftforge.api.distmarker.OnlyIn)2 FXFacingParticle (hellfirepvp.astralsorcery.client.effect.vfx.FXFacingParticle)1 FXLightning (hellfirepvp.astralsorcery.client.effect.vfx.FXLightning)1 SpriteSheetResource (hellfirepvp.astralsorcery.client.resource.SpriteSheetResource)1 Vector3 (hellfirepvp.astralsorcery.common.util.data.Vector3)1 Random (java.util.Random)1 Nonnull (javax.annotation.Nonnull)1