Search in sources :

Example 1 with TileFountain

use of hellfirepvp.astralsorcery.common.tile.TileFountain 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 TileFountain

use of hellfirepvp.astralsorcery.common.tile.TileFountain 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)

Aggregations

AstralSorcery (hellfirepvp.astralsorcery.AstralSorcery)2 RefreshFunction (hellfirepvp.astralsorcery.client.effect.function.RefreshFunction)2 VFXAlphaFunction (hellfirepvp.astralsorcery.client.effect.function.VFXAlphaFunction)2 VFXColorFunction (hellfirepvp.astralsorcery.client.effect.function.VFXColorFunction)2 EffectHelper (hellfirepvp.astralsorcery.client.effect.handler.EffectHelper)2 FXSpritePlane (hellfirepvp.astralsorcery.client.effect.vfx.FXSpritePlane)2 EffectTemplatesAS (hellfirepvp.astralsorcery.client.lib.EffectTemplatesAS)2 SpritesAS (hellfirepvp.astralsorcery.client.lib.SpritesAS)2 BlockFountainPrime (hellfirepvp.astralsorcery.common.block.tile.fountain.BlockFountainPrime)2 BlocksAS (hellfirepvp.astralsorcery.common.lib.BlocksAS)2 TileFountain (hellfirepvp.astralsorcery.common.tile.TileFountain)2 Vector3 (hellfirepvp.astralsorcery.common.util.data.Vector3)2 List (java.util.List)2 Nonnull (javax.annotation.Nonnull)2 Nullable (javax.annotation.Nullable)2 BlockPos (net.minecraft.util.math.BlockPos)2 Dist (net.minecraftforge.api.distmarker.Dist)2 OnlyIn (net.minecraftforge.api.distmarker.OnlyIn)2 LogicalSide (net.minecraftforge.fml.LogicalSide)2 Lists (com.google.common.collect.Lists)1