Search in sources :

Example 1 with TileAltar

use of hellfirepvp.astralsorcery.common.tile.altar.TileAltar in project AstralSorcery by HellFirePvP.

the class StarlightReceiverAltar method onStarlightReceive.

@Override
public void onStarlightReceive(World world, IWeakConstellation type, double amount) {
    TileAltar altar = getTileAtPos(world);
    if (altar != null) {
        int altarTier = altar.getAltarType().ordinal();
        altar.collectStarlight(((float) amount) * Math.min(altarTier, 1) * 60F, AltarCollectionCategory.FOCUSED_NETWORK);
    }
}
Also used : TileAltar(hellfirepvp.astralsorcery.common.tile.altar.TileAltar)

Example 2 with TileAltar

use of hellfirepvp.astralsorcery.common.tile.altar.TileAltar in project AstralSorcery by HellFirePvP.

the class ContainerAltarDiscoveryProvider method createFromPacket.

private static ContainerAltarDiscovery createFromPacket(int id, PlayerInventory plInventory, PacketBuffer data) {
    BlockPos at = ByteBufUtils.readPos(data);
    PlayerEntity player = plInventory.player;
    TileAltar ta = MiscUtils.getTileAt(player.getEntityWorld(), at, TileAltar.class, true);
    return new ContainerAltarDiscovery(ta, plInventory, id);
}
Also used : ContainerAltarDiscovery(hellfirepvp.astralsorcery.common.container.ContainerAltarDiscovery) BlockPos(net.minecraft.util.math.BlockPos) TileAltar(hellfirepvp.astralsorcery.common.tile.altar.TileAltar) PlayerEntity(net.minecraft.entity.player.PlayerEntity)

Example 3 with TileAltar

use of hellfirepvp.astralsorcery.common.tile.altar.TileAltar in project AstralSorcery by HellFirePvP.

the class ContainerAltarAttunementProvider method createFromPacket.

private static ContainerAltarAttunement createFromPacket(int id, PlayerInventory plInventory, PacketBuffer data) {
    BlockPos at = ByteBufUtils.readPos(data);
    PlayerEntity player = plInventory.player;
    TileAltar ta = MiscUtils.getTileAt(player.getEntityWorld(), at, TileAltar.class, true);
    return new ContainerAltarAttunement(ta, plInventory, id);
}
Also used : ContainerAltarAttunement(hellfirepvp.astralsorcery.common.container.ContainerAltarAttunement) BlockPos(net.minecraft.util.math.BlockPos) TileAltar(hellfirepvp.astralsorcery.common.tile.altar.TileAltar) PlayerEntity(net.minecraft.entity.player.PlayerEntity)

Example 4 with TileAltar

use of hellfirepvp.astralsorcery.common.tile.altar.TileAltar 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 5 with TileAltar

use of hellfirepvp.astralsorcery.common.tile.altar.TileAltar in project AstralSorcery by HellFirePvP.

the class TileSpectralRelay method updateAltarPos.

private void updateAltarPos() {
    Set<BlockPos> altarPositions = BlockDiscoverer.searchForTileEntitiesAround(getWorld(), getPos(), 16, tile -> tile instanceof TileAltar);
    Vector3d thisPos = Vector3d.copy(getPos());
    BlockPos closestAltar = null;
    for (BlockPos other : altarPositions) {
        if (closestAltar == null || other.distanceSq(thisPos, false) < closestAltar.distanceSq(thisPos, false)) {
            closestAltar = other;
        }
    }
    this.altarPos = closestAltar;
    this.markForUpdate();
}
Also used : Vector3d(net.minecraft.util.math.vector.Vector3d) BlockPos(net.minecraft.util.math.BlockPos) TileAltar(hellfirepvp.astralsorcery.common.tile.altar.TileAltar)

Aggregations

TileAltar (hellfirepvp.astralsorcery.common.tile.altar.TileAltar)13 BlockPos (net.minecraft.util.math.BlockPos)6 PlayerEntity (net.minecraft.entity.player.PlayerEntity)5 SimpleAltarRecipe (hellfirepvp.astralsorcery.common.crafting.recipe.SimpleAltarRecipe)3 ItemStack (net.minecraft.item.ItemStack)3 Dist (net.minecraftforge.api.distmarker.Dist)3 OnlyIn (net.minecraftforge.api.distmarker.OnlyIn)3 MatrixStack (com.mojang.blaze3d.matrix.MatrixStack)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 EffectTemplatesAS (hellfirepvp.astralsorcery.client.lib.EffectTemplatesAS)2 ActiveSimpleAltarRecipe (hellfirepvp.astralsorcery.common.crafting.recipe.altar.ActiveSimpleAltarRecipe)2 Vector3 (hellfirepvp.astralsorcery.common.util.data.Vector3)2 IRenderTypeBuffer (net.minecraft.client.renderer.IRenderTypeBuffer)2 AstralSorcery (hellfirepvp.astralsorcery.AstralSorcery)1 RefreshFunction (hellfirepvp.astralsorcery.client.effect.function.RefreshFunction)1 RenderOffsetNoisePlane (hellfirepvp.astralsorcery.client.effect.function.impl.RenderOffsetNoisePlane)1 FXFacingParticle (hellfirepvp.astralsorcery.client.effect.vfx.FXFacingParticle)1 FXSpritePlane (hellfirepvp.astralsorcery.client.effect.vfx.FXSpritePlane)1