Search in sources :

Example 1 with FXSpritePlane

use of hellfirepvp.astralsorcery.client.effect.vfx.FXSpritePlane in project AstralSorcery by HellFirePvP.

the class FountainEffectVortex method tickEffects.

@OnlyIn(Dist.CLIENT)
private void tickEffects(TileFountain fountain, VortexContext ctx, int operationTick, OperationSegment currentSegment) {
    if (currentSegment.isLaterOrEqualTo(OperationSegment.STARTUP)) {
        FXSpritePlane sprite = (FXSpritePlane) ctx.fountainSprite;
        if (sprite == null) {
            sprite = EffectHelper.of(EffectTemplatesAS.TEXTURE_SPRITE).spawn(new Vector3(fountain).add(0.5, 0.5, 0.5)).setAxis(Vector3.RotAxis.Y_AXIS).setNoRotation(45).setSprite(SpritesAS.SPR_FOUNTAIN_VORTEX).setAlphaMultiplier(1F).alpha((fx, alphaIn, pTicks) -> this.getSegmentPercent(OperationSegment.STARTUP, fountain.getTickActiveFountainEffect())).setScaleMultiplier(5.5F).refresh(RefreshFunction.tileExistsAnd(fountain, (tile, fx) -> tile.getCurrentEffect() == this));
        } else if (sprite.isRemoved() || sprite.canRemove()) {
            EffectHelper.refresh(sprite, EffectTemplatesAS.TEXTURE_SPRITE);
        }
        ctx.fountainSprite = sprite;
    }
    BlockPos fountainPos = fountain.getPos();
    float segmentPercent = getSegmentPercent(currentSegment, operationTick);
    switch(currentSegment) {
        case STARTUP:
            playFountainVortexParticles(fountainPos, segmentPercent);
            playFountainArcs(fountainPos, segmentPercent);
            playCoreParticles(fountainPos, segmentPercent);
            break;
        case PREPARATION:
            playFountainArcs(fountainPos, 1F - segmentPercent);
            playFountainVortexParticles(fountainPos, 1F - segmentPercent);
            playCoreParticles(fountainPos, 1F - segmentPercent * 2F);
            playCorePrimerParticles(fountainPos, segmentPercent);
            break;
        case RUNNING:
            playFountainVortexParticles(fountainPos, 0.2F);
            playFountainArcs(fountainPos, 0.6F);
            playFountainVortexLowerParticles(fountainPos);
            playVortexEffects(fountainPos, fountain, ctx);
            break;
    }
}
Also used : Vector3(hellfirepvp.astralsorcery.common.util.data.Vector3) GameRules(net.minecraft.world.GameRules) OnlyIn(net.minecraftforge.api.distmarker.OnlyIn) AxisAlignedBB(net.minecraft.util.math.AxisAlignedBB) EventHelperEntityFreeze(hellfirepvp.astralsorcery.common.event.helper.EventHelperEntityFreeze) BlocksAS(hellfirepvp.astralsorcery.common.lib.BlocksAS) Dist(net.minecraftforge.api.distmarker.Dist) Lists(com.google.common.collect.Lists) EffectTemplatesAS(hellfirepvp.astralsorcery.client.lib.EffectTemplatesAS) AstralSorcery(hellfirepvp.astralsorcery.AstralSorcery) TileFountain(hellfirepvp.astralsorcery.common.tile.TileFountain) Nonnull(javax.annotation.Nonnull) Nullable(javax.annotation.Nullable) LogicalSide(net.minecraftforge.fml.LogicalSide) FXSpritePlane(hellfirepvp.astralsorcery.client.effect.vfx.FXSpritePlane) VFXAlphaFunction(hellfirepvp.astralsorcery.client.effect.function.VFXAlphaFunction) TechnicalEntityRegistry(hellfirepvp.astralsorcery.common.data.config.registry.TechnicalEntityRegistry) FXFacingSprite(hellfirepvp.astralsorcery.client.effect.vfx.FXFacingSprite) PlayerEntity(net.minecraft.entity.player.PlayerEntity) LivingEntity(net.minecraft.entity.LivingEntity) BlockFountainPrime(hellfirepvp.astralsorcery.common.block.tile.fountain.BlockFountainPrime) BlockPos(net.minecraft.util.math.BlockPos) EffectHelper(hellfirepvp.astralsorcery.client.effect.handler.EffectHelper) EnderDragonEntity(net.minecraft.entity.boss.dragon.EnderDragonEntity) EntityUtils(hellfirepvp.astralsorcery.common.util.entity.EntityUtils) Vector3d(net.minecraft.util.math.vector.Vector3d) List(java.util.List) VFXColorFunction(hellfirepvp.astralsorcery.client.effect.function.VFXColorFunction) RenderOffsetNoisePlane(hellfirepvp.astralsorcery.client.effect.function.impl.RenderOffsetNoisePlane) MathHelper(net.minecraft.util.math.MathHelper) RefreshFunction(hellfirepvp.astralsorcery.client.effect.function.RefreshFunction) SpritesAS(hellfirepvp.astralsorcery.client.lib.SpritesAS) FXSpritePlane(hellfirepvp.astralsorcery.client.effect.vfx.FXSpritePlane) Vector3(hellfirepvp.astralsorcery.common.util.data.Vector3) BlockPos(net.minecraft.util.math.BlockPos) OnlyIn(net.minecraftforge.api.distmarker.OnlyIn)

Example 2 with FXSpritePlane

use of hellfirepvp.astralsorcery.client.effect.vfx.FXSpritePlane in project AstralSorcery by HellFirePvP.

the class EffectLuminescenceFlare 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) {
        ResourceLocation recipeName = recipe.getRecipeToCraft().getId();
        FXSpritePlane spr = recipe.getEffectContained(INDEX_CRAFT_FLARE, i -> {
            return EffectHelper.of(EffectTemplatesAS.TEXTURE_SPRITE).spawn(new Vector3(altar).add(0.5, 0.04, 0.5)).setSprite(SpritesAS.SPR_CRAFT_FLARE).setAxis(Vector3.RotAxis.Y_AXIS).setNoRotation(0).color(VFXColorFunction.constant(ColorsAS.EFFECT_CRAFT_FLARE)).alpha(VFXAlphaFunction.fadeIn(30)).setScaleMultiplier(9F).setAlphaMultiplier(0.65F).refresh(RefreshFunction.tileExistsAnd(altar, (tAltar, fx) -> tAltar.getActiveRecipe() != null && tAltar.getActiveRecipe().getState() == ActiveSimpleAltarRecipe.CraftingState.ACTIVE && recipeName.equals(tAltar.getActiveRecipe().getRecipeToCraft().getId())));
        });
        EffectHelper.refresh(spr, EffectTemplatesAS.TEXTURE_SPRITE);
    }
}
Also used : FXSpritePlane(hellfirepvp.astralsorcery.client.effect.vfx.FXSpritePlane) 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) EffectTemplatesAS(hellfirepvp.astralsorcery.client.lib.EffectTemplatesAS) ActiveSimpleAltarRecipe(hellfirepvp.astralsorcery.common.crafting.recipe.altar.ActiveSimpleAltarRecipe) RefreshFunction(hellfirepvp.astralsorcery.client.effect.function.RefreshFunction) SpritesAS(hellfirepvp.astralsorcery.client.lib.SpritesAS) ResourceLocation(net.minecraft.util.ResourceLocation) ColorsAS(hellfirepvp.astralsorcery.common.lib.ColorsAS) MatrixStack(com.mojang.blaze3d.matrix.MatrixStack) ActiveSimpleAltarRecipe(hellfirepvp.astralsorcery.common.crafting.recipe.altar.ActiveSimpleAltarRecipe) FXSpritePlane(hellfirepvp.astralsorcery.client.effect.vfx.FXSpritePlane) ResourceLocation(net.minecraft.util.ResourceLocation) Vector3(hellfirepvp.astralsorcery.common.util.data.Vector3) OnlyIn(net.minecraftforge.api.distmarker.OnlyIn)

Example 3 with FXSpritePlane

use of hellfirepvp.astralsorcery.client.effect.vfx.FXSpritePlane in project AstralSorcery by HellFirePvP.

the class FountainEffectLiquid method tickEffects.

@OnlyIn(Dist.CLIENT)
private void tickEffects(TileFountain fountain, LiquidContext ctx, int operationTick, OperationSegment currentSegment) {
    if (currentSegment.isLaterOrEqualTo(OperationSegment.STARTUP)) {
        FXSpritePlane sprite = (FXSpritePlane) ctx.fountainSprite;
        if (sprite == null) {
            sprite = EffectHelper.of(EffectTemplatesAS.TEXTURE_SPRITE).spawn(new Vector3(fountain).add(0.5, 0.5, 0.5)).setAxis(Vector3.RotAxis.Y_AXIS).setNoRotation(45).setSprite(SpritesAS.SPR_FOUNTAIN_LIQUID).setAlphaMultiplier(1F).alpha((fx, alphaIn, pTicks) -> this.getSegmentPercent(OperationSegment.STARTUP, fountain.getTickActiveFountainEffect())).setScaleMultiplier(5.5F).refresh(RefreshFunction.tileExistsAnd(fountain, (tile, fx) -> tile.getCurrentEffect() == this));
        } else if (sprite.isRemoved() || sprite.canRemove()) {
            EffectHelper.refresh(sprite, EffectTemplatesAS.TEXTURE_SPRITE);
        }
        ctx.fountainSprite = sprite;
    }
    BlockPos fountainPos = fountain.getPos();
    float segmentPercent = getSegmentPercent(currentSegment, operationTick);
    switch(currentSegment) {
        case STARTUP:
            playFountainVortexParticles(fountainPos, segmentPercent);
            playFountainArcs(fountainPos, segmentPercent);
            break;
        case PREPARATION:
            playFountainArcs(fountainPos, 1F - segmentPercent);
            playFountainVortexParticles(fountainPos, 1F - segmentPercent);
            playDigPreparation(fountainPos, segmentPercent);
            break;
        case RUNNING:
            playFountainVortexParticles(fountainPos, 0.2F);
            playFountainArcs(fountainPos, 0.6F);
            playDigParticles(fountainPos);
            if (fountain.getTicksExisted() % 40 == 0) {
                playDigLightbeam(fountainPos);
            }
            break;
    }
}
Also used : Vector3(hellfirepvp.astralsorcery.common.util.data.Vector3) ServerWorld(net.minecraft.world.server.ServerWorld) OnlyIn(net.minecraftforge.api.distmarker.OnlyIn) BlockUtils(hellfirepvp.astralsorcery.common.util.block.BlockUtils) BlocksAS(hellfirepvp.astralsorcery.common.lib.BlocksAS) Dist(net.minecraftforge.api.distmarker.Dist) ItemStack(net.minecraft.item.ItemStack) EffectTemplatesAS(hellfirepvp.astralsorcery.client.lib.EffectTemplatesAS) AstralSorcery(hellfirepvp.astralsorcery.AstralSorcery) MiscUtils(hellfirepvp.astralsorcery.common.util.MiscUtils) Chunk(net.minecraft.world.chunk.Chunk) TileFountain(hellfirepvp.astralsorcery.common.tile.TileFountain) BlockState(net.minecraft.block.BlockState) CapabilitiesAS(hellfirepvp.astralsorcery.common.lib.CapabilitiesAS) ColorsAS(hellfirepvp.astralsorcery.common.lib.ColorsAS) Nonnull(javax.annotation.Nonnull) Nullable(javax.annotation.Nullable) LogicalSide(net.minecraftforge.fml.LogicalSide) FXSpritePlane(hellfirepvp.astralsorcery.client.effect.vfx.FXSpritePlane) Fluids(net.minecraft.fluid.Fluids) VFXAlphaFunction(hellfirepvp.astralsorcery.client.effect.function.VFXAlphaFunction) IFluidHandler(net.minecraftforge.fluids.capability.IFluidHandler) World(net.minecraft.world.World) BlockFountainPrime(hellfirepvp.astralsorcery.common.block.tile.fountain.BlockFountainPrime) BlockPos(net.minecraft.util.math.BlockPos) EffectHelper(hellfirepvp.astralsorcery.client.effect.handler.EffectHelper) List(java.util.List) VFXColorFunction(hellfirepvp.astralsorcery.client.effect.function.VFXColorFunction) BlockDropCaptureAssist(hellfirepvp.astralsorcery.common.util.BlockDropCaptureAssist) RefreshFunction(hellfirepvp.astralsorcery.client.effect.function.RefreshFunction) SpritesAS(hellfirepvp.astralsorcery.client.lib.SpritesAS) EntityVisualFX(hellfirepvp.astralsorcery.client.effect.EntityVisualFX) Vector3i(net.minecraft.util.math.vector.Vector3i) FluidStack(net.minecraftforge.fluids.FluidStack) FXSpritePlane(hellfirepvp.astralsorcery.client.effect.vfx.FXSpritePlane) Vector3(hellfirepvp.astralsorcery.common.util.data.Vector3) BlockPos(net.minecraft.util.math.BlockPos) OnlyIn(net.minecraftforge.api.distmarker.OnlyIn)

Example 4 with FXSpritePlane

use of hellfirepvp.astralsorcery.client.effect.vfx.FXSpritePlane in project AstralSorcery by HellFirePvP.

the class TileRefractionTable method playEngravingEffects.

@OnlyIn(Dist.CLIENT)
private void playEngravingEffects() {
    if (this.runTick <= 0) {
        return;
    }
    if (this.effectHalo != null && ((FXSpritePlane) this.effectHalo).isRemoved()) {
        EffectHelper.refresh((FXSpritePlane) this.effectHalo, EffectTemplatesAS.TEXTURE_SPRITE);
    }
    if (this.effectHalo == null) {
        this.effectHalo = EffectHelper.of(EffectTemplatesAS.TEXTURE_SPRITE).spawn(new Vector3(this).add(0.5, 0.8, 0.5)).setSprite(SpritesAS.SPR_HALO_INFUSION).setAxis(Vector3.RotAxis.Y_AXIS).setNoRotation(0).setScaleMultiplier(0.8F).setAlphaMultiplier(0.8F).alpha(((fx, alpha, pTicks) -> MathHelper.clamp(alpha * getRunProgress(), 0F, 1F))).refresh(RefreshFunction.tileExistsAnd(this, (thisTile, fx) -> thisTile.getRunProgress() > 0));
    }
    Vector3 offset = new Vector3(-5.0 / 16.0, 1.505, -3.0 / 16.0);
    int random = rand.nextInt(ColorsAS.REFRACTION_TABLE_COLORS.length);
    if (random >= ColorsAS.REFRACTION_TABLE_COLORS.length / 2) {
        // 0-5 is left, 6-11 is right
        offset.addX(24.0 / 16.0);
    }
    offset.addZ((random % (ColorsAS.REFRACTION_TABLE_COLORS.length / 2)) * (4.0 / 16.0));
    offset.add(rand.nextFloat() * 0.1, 0, rand.nextFloat() * 0.1).add(pos);
    Color color = ColorsAS.REFRACTION_TABLE_COLORS[random];
    EffectHelper.of(EffectTemplatesAS.GENERIC_PARTICLE).spawn(offset).setGravityStrength(-0.002F).setScaleMultiplier(0.15F + rand.nextFloat() * 0.1F).alpha(VFXAlphaFunction.FADE_OUT).color(VFXColorFunction.constant(color)).setMaxAge(30 + rand.nextInt(30));
    if (rand.nextFloat() < (getRunProgress() * 2F)) {
        Vector3 target = new Vector3(this).add(0.5, 0.9, 0.5);
        EffectHelper.of(EffectTemplatesAS.LIGHTNING).spawn(offset).makeDefault(target).color(VFXColorFunction.constant(color));
        FXFacingParticle p = EffectHelper.of(EffectTemplatesAS.GENERIC_PARTICLE).spawn(offset).setScaleMultiplier(0.15F + rand.nextFloat() * 0.1F).alpha(VFXAlphaFunction.proximity(target::clone, 1F)).color(VFXColorFunction.constant(color)).setMaxAge(45);
        Vector3 mov = target.clone().subtract(offset).normalize().multiply(0.05 * rand.nextFloat());
        p.setMotion(mov);
    }
    if (rand.nextInt(3) == 0) {
        EffectHelper.of(EffectTemplatesAS.LIGHTBEAM).spawn(offset).setup(offset.clone().addY(0.56F + rand.nextFloat() * 0.2F), 0.25F, 0.25F).color(VFXColorFunction.constant(color));
    }
    if (rand.nextInt(4) == 0) {
        Color beamColor = MiscUtils.eitherOf(rand, ColorsAS.CONSTELLATION_TYPE_MAJOR, ColorsAS.CONSTELLATION_TYPE_WEAK, ColorsAS.CONSTELLATION_TYPE_MINOR);
        Vector3 beamOffset = new Vector3(this).add(0.1 + rand.nextFloat() * 0.8, 0.8, 0.1 + rand.nextFloat() * 0.8F);
        EffectHelper.of(EffectTemplatesAS.LIGHTBEAM).spawn(beamOffset).setup(beamOffset.clone().addY(1 + rand.nextFloat() * 0.5), 0.5F, 0.5F).color(VFXColorFunction.constant(beamColor)).setMaxAge(25 + rand.nextInt(5));
    }
}
Also used : TileEntityTick(hellfirepvp.astralsorcery.common.tile.base.TileEntityTick) Vector3(hellfirepvp.astralsorcery.common.util.data.Vector3) EngravedStarMap(hellfirepvp.astralsorcery.common.constellation.engraving.EngravedStarMap) OnlyIn(net.minecraftforge.api.distmarker.OnlyIn) NBTHelper(hellfirepvp.astralsorcery.common.util.nbt.NBTHelper) CompoundNBT(net.minecraft.nbt.CompoundNBT) TileEntityTypesAS(hellfirepvp.astralsorcery.common.lib.TileEntityTypesAS) ItemsAS(hellfirepvp.astralsorcery.common.lib.ItemsAS) ITextComponent(net.minecraft.util.text.ITextComponent) TranslationTextComponent(net.minecraft.util.text.TranslationTextComponent) Dist(net.minecraftforge.api.distmarker.Dist) ItemStack(net.minecraft.item.ItemStack) DayTimeHelper(hellfirepvp.astralsorcery.common.constellation.world.DayTimeHelper) EffectTemplatesAS(hellfirepvp.astralsorcery.client.lib.EffectTemplatesAS) MiscUtils(hellfirepvp.astralsorcery.common.util.MiscUtils) SoundHelper(hellfirepvp.astralsorcery.common.util.sound.SoundHelper) ColorsAS(hellfirepvp.astralsorcery.common.lib.ColorsAS) SoundCategory(net.minecraft.util.SoundCategory) Nonnull(javax.annotation.Nonnull) DrawnConstellation(hellfirepvp.astralsorcery.common.constellation.DrawnConstellation) FXFacingParticle(hellfirepvp.astralsorcery.client.effect.vfx.FXFacingParticle) FXSpritePlane(hellfirepvp.astralsorcery.client.effect.vfx.FXSpritePlane) VFXAlphaFunction(hellfirepvp.astralsorcery.client.effect.function.VFXAlphaFunction) NamedInventoryTile(hellfirepvp.astralsorcery.common.util.tile.NamedInventoryTile) ItemInfusedGlass(hellfirepvp.astralsorcery.common.item.ItemInfusedGlass) EffectHelper(hellfirepvp.astralsorcery.client.effect.handler.EffectHelper) SoundEvents(net.minecraft.util.SoundEvents) java.awt(java.awt) List(java.util.List) VFXColorFunction(hellfirepvp.astralsorcery.client.effect.function.VFXColorFunction) MathHelper(net.minecraft.util.math.MathHelper) RefreshFunction(hellfirepvp.astralsorcery.client.effect.function.RefreshFunction) SpritesAS(hellfirepvp.astralsorcery.client.lib.SpritesAS) ItemUtils(hellfirepvp.astralsorcery.common.util.item.ItemUtils) Vector3(hellfirepvp.astralsorcery.common.util.data.Vector3) FXFacingParticle(hellfirepvp.astralsorcery.client.effect.vfx.FXFacingParticle) OnlyIn(net.minecraftforge.api.distmarker.OnlyIn)

Example 5 with FXSpritePlane

use of hellfirepvp.astralsorcery.client.effect.vfx.FXSpritePlane in project AstralSorcery by HellFirePvP.

the class TileRitualPedestal method playEffects.

// =========================================================================================
// Client effects
// =========================================================================================
@OnlyIn(Dist.CLIENT)
private void playEffects() {
    float alphaDaytime = DayTimeHelper.getCurrentDaytimeDistribution(getWorld());
    alphaDaytime *= 0.8F;
    float percRunning = this.effectWork.getAsPercentage();
    int chance = 15 + (int) ((1F - percRunning) * 50);
    if (rand.nextInt(chance) == 0) {
        Vector3 from = new Vector3(this).add(0.5, 0.05, 0.5);
        MiscUtils.applyRandomOffset(from, rand, 0.05F);
        EffectHelper.of(EffectTemplatesAS.LIGHTBEAM).setOwner(this.ownerUUID).spawn(from).setup(from.clone().addY(6), 1.5F, 1.5F).setAlphaMultiplier(0.5F + (0.5F * alphaDaytime)).setMaxAge(64);
    }
    if (this.ritualLinkTo != null) {
        if (rand.nextBoolean()) {
            Vector3 at = new Vector3(this).add(0, 0.1, 0);
            at.add(rand.nextFloat() * 0.5 + 0.25, 0, rand.nextFloat() * 0.5 + 0.25);
            EffectHelper.of(EffectTemplatesAS.GENERIC_PARTICLE).setOwner(this.ownerUUID).spawn(at).setAlphaMultiplier(0.7F).color(VFXColorFunction.WHITE).setMotion(Vector3.positiveYRandom(rand).addY(2).normalize().multiply(0.4F)).setScaleMultiplier(0.2F + rand.nextFloat() * 0.15F).motion(VFXMotionController.target(() -> new Vector3(this).add(RITUAL_ANCHOR_OFFEST).add(0.5, 0.5, 0.5), 0.1F)).setMaxAge(30 + rand.nextInt(50));
        }
    }
    List<BlockPos> activeMirrors = this.offsetMirrors.entrySet().stream().filter(Map.Entry::getValue).map(Map.Entry::getKey).collect(Collectors.toList());
    IWeakConstellation ritualConstellation = getRitualConstellation();
    if (this.working && ritualConstellation != null) {
        if (!activeMirrors.isEmpty() && DayTimeHelper.isNight(getWorld())) {
            if (rand.nextInt(chance * 2) == 0) {
                Vector3 from = new Vector3(this).add(0.5, 0.1, 0.5);
                MiscUtils.applyRandomOffset(from, rand, 2F);
                from.setY(getPos().getY() - 0.6 + 1 * rand.nextFloat() * (rand.nextBoolean() ? 1 : -1));
                EffectHelper.of(EffectTemplatesAS.LIGHTBEAM).setOwner(this.ownerUUID).spawn(from).setup(from.clone().addY(5 + rand.nextInt(3)), 1.3F, 1.3F).setAlphaMultiplier(alphaDaytime).color(VFXColorFunction.constant(ritualConstellation.getConstellationColor())).setMaxAge(64);
            }
        }
        if (this.ritualHaloEffect == null) {
            this.ritualHaloEffect = EffectHelper.of(EffectTemplatesAS.TEXTURE_SPRITE).spawn(new Vector3(this).add(0.5, 0.05, 0.5)).setSprite(SpritesAS.SPR_HALO_RITUAL).setAxis(Vector3.RotAxis.Y_AXIS).setNoRotation(25).setScaleMultiplier(6.5F).refresh(RefreshFunction.tileExistsAnd(this, (tile, effect) -> tile.isWorking() && !tile.getCurrentCrystal().isEmpty()));
        }
        if (this.ritualHaloEffect != null) {
            FXSpritePlane effectPlane = ((FXSpritePlane) this.ritualHaloEffect);
            EffectHelper.refresh(effectPlane, EffectTemplatesAS.TEXTURE_SPRITE);
            float dayTimeMul = DayTimeHelper.getCurrentDaytimeDistribution(this.getWorld());
            effectPlane.setAlphaMultiplier(Math.max(0.05F, dayTimeMul * 0.75F));
        }
        Vector3 offset = Vector3.random().setY(0).normalize().multiply(rand.nextFloat() * 4 * (rand.nextBoolean() ? 1 : -1));
        EffectHelper.of(EffectTemplatesAS.GENERIC_PARTICLE).setOwner(this.ownerUUID).spawn(new Vector3(this).add(0.5, 0.02, 0.5).add(offset)).setAlphaMultiplier(1F).setGravityStrength(-0.001F).color(VFXColorFunction.constant(ritualConstellation.getConstellationColor())).alpha(VFXAlphaFunction.FADE_OUT).setScaleMultiplier(0.3F + rand.nextFloat() * 0.15F).setMaxAge(25 + rand.nextInt(15));
        if (this.clientEffectInstance != null && !this.clientEffectInstance.getConstellation().equals(ritualConstellation)) {
            this.clientEffectInstance = null;
        }
        if (this.clientEffectInstance == null) {
            this.clientEffectInstance = ConstellationEffectRegistry.createInstance(ILocatable.fromPos(getPos()), ritualConstellation);
        }
        if (this.clientEffectInstance != null) {
            clientEffectInstance.playClientEffect(getWorld(), getPos(), this, percRunning, this.isFullyEnhanced());
            if (this.ritualLinkTo != null && getWorld().isBlockPresent(this.ritualLinkTo)) {
                clientEffectInstance.playClientEffect(getWorld(), this.ritualLinkTo, this, percRunning, this.isFullyEnhanced());
            }
        }
        CrystalAttributes prop = this.getAttributes();
        if (prop != null && rand.nextInt(3) == 0) {
            for (int i = 0; i < 3; i++) {
                Vector3 at = new Vector3(this).add(0.5, 1.35, 0.5).add(Vector3.random().multiply(0.6F));
                Vector3 motion = Vector3.random().multiply(0.02F);
                EffectHelper.of(EffectTemplatesAS.GENERIC_PARTICLE).setOwner(this.ownerUUID).spawn(at).setMotion(motion).setAlphaMultiplier(1F).color(VFXColorFunction.constant(ritualConstellation.getConstellationColor())).alpha(VFXAlphaFunction.FADE_OUT).setScaleMultiplier(0.15F + rand.nextFloat() * 0.05F).setMaxAge(16 + rand.nextInt(15));
            }
            if (rand.nextInt(3) == 0) {
                Vector3 from = new Vector3(this).add(0.5, 1.2, 0.5);
                Vector3 to;
                if (activeMirrors.isEmpty()) {
                    to = new Vector3(this).add(0.5, 3.5 + rand.nextFloat() * 2.5, 0.5);
                } else {
                    BlockPos mirror = MiscUtils.getRandomEntry(activeMirrors, rand).add(this.getPos());
                    to = new Vector3(mirror).add(0.5, 0.5, 0.5);
                }
                EffectHelper.of(EffectTemplatesAS.LIGHTNING).setOwner(this.ownerUUID).spawn(from).makeDefault(to).color(VFXColorFunction.constant(ritualConstellation.getConstellationColor()));
            }
        }
    }
    for (BlockPos mirror : this.offsetMirrors.keySet()) {
        if (ticksExisted % 32 == 0) {
            Vector3 source = new Vector3(this).add(0.5, 0.9, 0.5);
            Vector3 to = new Vector3(this).add(mirror).add(0.5, 0.5, 0.5);
            EffectHelper.of(EffectTemplatesAS.LIGHTBEAM).setOwner(this.ownerUUID).spawn(source).setup(to, 0.8F, 0.8F);
            if (this.ritualLinkTo != null && this.offsetMirrors.get(mirror)) {
                source = new Vector3(this).add(RITUAL_ANCHOR_OFFEST).add(0.5, 0.5, 0.5);
                EffectHelper.of(EffectTemplatesAS.LIGHTBEAM).setOwner(this.ownerUUID).spawn(source).setup(to, 0.8F, 0.8F).color(VFXColorFunction.random());
            }
        }
    }
}
Also used : FXSpritePlane(hellfirepvp.astralsorcery.client.effect.vfx.FXSpritePlane) CrystalAttributes(hellfirepvp.astralsorcery.common.crystal.CrystalAttributes) Vector3(hellfirepvp.astralsorcery.common.util.data.Vector3) BlockPos(net.minecraft.util.math.BlockPos) IWeakConstellation(hellfirepvp.astralsorcery.common.constellation.IWeakConstellation) OnlyIn(net.minecraftforge.api.distmarker.OnlyIn)

Aggregations

FXSpritePlane (hellfirepvp.astralsorcery.client.effect.vfx.FXSpritePlane)5 Vector3 (hellfirepvp.astralsorcery.common.util.data.Vector3)5 OnlyIn (net.minecraftforge.api.distmarker.OnlyIn)5 RefreshFunction (hellfirepvp.astralsorcery.client.effect.function.RefreshFunction)4 VFXAlphaFunction (hellfirepvp.astralsorcery.client.effect.function.VFXAlphaFunction)4 VFXColorFunction (hellfirepvp.astralsorcery.client.effect.function.VFXColorFunction)4 EffectHelper (hellfirepvp.astralsorcery.client.effect.handler.EffectHelper)4 EffectTemplatesAS (hellfirepvp.astralsorcery.client.lib.EffectTemplatesAS)4 SpritesAS (hellfirepvp.astralsorcery.client.lib.SpritesAS)4 Dist (net.minecraftforge.api.distmarker.Dist)4 ColorsAS (hellfirepvp.astralsorcery.common.lib.ColorsAS)3 List (java.util.List)3 Nonnull (javax.annotation.Nonnull)3 BlockPos (net.minecraft.util.math.BlockPos)3 AstralSorcery (hellfirepvp.astralsorcery.AstralSorcery)2 BlockFountainPrime (hellfirepvp.astralsorcery.common.block.tile.fountain.BlockFountainPrime)2 BlocksAS (hellfirepvp.astralsorcery.common.lib.BlocksAS)2 TileFountain (hellfirepvp.astralsorcery.common.tile.TileFountain)2 MiscUtils (hellfirepvp.astralsorcery.common.util.MiscUtils)2 Nullable (javax.annotation.Nullable)2