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);
}
}
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);
}
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);
}
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);
}
}
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();
}
Aggregations