Search in sources :

Example 1 with ProgressionTier

use of hellfirepvp.astralsorcery.common.data.research.ProgressionTier in project AstralSorcery by HellFirePvP.

the class RenderPageRecipeTemplate method addAltarRecipeTooltip.

protected void addAltarRecipeTooltip(SimpleAltarRecipe altarRecipe, List<ITextProperties> toolTip) {
    if (altarRecipe.getStarlightRequirement() > 0) {
        AltarType highestPossible = null;
        ProgressionTier reached = ResearchHelper.getClientProgress().getTierReached();
        for (AltarType type : AltarType.values()) {
            if ((highestPossible == null || !type.isThisLEThan(highestPossible)) && reached.isThisLaterOrEqual(type.getAssociatedTier().getRequiredProgress())) {
                highestPossible = type;
            }
        }
        if (highestPossible != null) {
            long indexSel = (ClientScheduler.getClientTick() / 30) % (highestPossible.ordinal() + 1);
            AltarType typeSelected = AltarType.values()[((int) indexSel)];
            ITextProperties itemName = typeSelected.getAltarItemRepresentation().getDisplayName();
            ITextProperties starlightRequired = getAltarStarlightAmountDescription(itemName, altarRecipe.getStarlightRequirement(), typeSelected.getStarlightCapacity());
            ITextProperties starlightRequirementDescription = new TranslationTextComponent("astralsorcery.journal.recipe.altar.starlight.desc");
            toolTip.add(starlightRequirementDescription);
            toolTip.add(starlightRequired);
        }
    }
    if (altarRecipe instanceof AltarUpgradeRecipe) {
        toolTip.add(new TranslationTextComponent("astralsorcery.journal.recipe.altar.upgrade"));
    }
}
Also used : AltarType(hellfirepvp.astralsorcery.common.block.tile.altar.AltarType) ITextProperties(net.minecraft.util.text.ITextProperties) TranslationTextComponent(net.minecraft.util.text.TranslationTextComponent) AltarUpgradeRecipe(hellfirepvp.astralsorcery.common.crafting.recipe.altar.AltarUpgradeRecipe) ProgressionTier(hellfirepvp.astralsorcery.common.data.research.ProgressionTier)

Example 2 with ProgressionTier

use of hellfirepvp.astralsorcery.common.data.research.ProgressionTier in project AstralSorcery by HellFirePvP.

the class ProgressGatedPerk method serializeData.

@Override
public void serializeData(JsonObject perkData) {
    super.serializeData(perkData);
    if (!this.neededConstellations.isEmpty()) {
        JsonArray array = new JsonArray();
        for (IConstellation cst : this.neededConstellations) {
            array.add(cst.getRegistryName().toString());
        }
        perkData.add("neededConstellations", array);
    }
    if (!this.neededResearch.isEmpty()) {
        JsonArray array = new JsonArray();
        for (ResearchProgression research : this.neededResearch) {
            array.add(research.name());
        }
        perkData.add("neededResearch", array);
    }
    if (!this.neededProgression.isEmpty()) {
        JsonArray array = new JsonArray();
        for (ProgressionTier progress : this.neededProgression) {
            array.add(progress.name());
        }
        perkData.add("neededProgression", array);
    }
}
Also used : JsonArray(com.google.gson.JsonArray) ResearchProgression(hellfirepvp.astralsorcery.common.data.research.ResearchProgression) IConstellation(hellfirepvp.astralsorcery.common.constellation.IConstellation) ProgressionTier(hellfirepvp.astralsorcery.common.data.research.ProgressionTier)

Example 3 with ProgressionTier

use of hellfirepvp.astralsorcery.common.data.research.ProgressionTier in project AstralSorcery by HellFirePvP.

the class BlockCollectorCrystal method addInformation.

@Override
@OnlyIn(Dist.CLIENT)
public void addInformation(ItemStack stack, @Nullable IBlockReader world, List<ITextComponent> toolTip, ITooltipFlag flag) {
    super.addInformation(stack, world, toolTip, flag);
    CrystalAttributes attr = CrystalAttributes.getCrystalAttributes(stack);
    CrystalAttributes.TooltipResult result = null;
    if (attr != null) {
        result = attr.addTooltip(toolTip, CalculationContext.Builder.withSource(new AttunedSourceInstance(CrystalPropertiesAS.Sources.SOURCE_TILE_COLLECTOR_CRYSTAL, ((ConstellationItem) stack.getItem()).getAttunedConstellation(stack))).addUsage(CrystalPropertiesAS.Usages.USE_COLLECTOR_CRYSTAL).addUsage(CrystalPropertiesAS.Usages.USE_LENS_TRANSFER).build());
    }
    if (result != null) {
        PlayerProgress clientProgress = ResearchHelper.getClientProgress();
        ProgressionTier tier = clientProgress.getTierReached();
        boolean addedMissing = result != CrystalAttributes.TooltipResult.ADDED_ALL;
        IWeakConstellation c = ((ConstellationItem) stack.getItem()).getAttunedConstellation(stack);
        if (c != null) {
            if (GatedKnowledge.COLLECTOR_TYPE.canSee(tier) && clientProgress.hasConstellationDiscovered(c)) {
                toolTip.add(new TranslationTextComponent("crystal.info.astralsorcery.collect.type", c.getConstellationName().mergeStyle(TextFormatting.BLUE)).mergeStyle(TextFormatting.GRAY));
            } else if (!addedMissing) {
                toolTip.add(new TranslationTextComponent("astralsorcery.progress.missing.knowledge").mergeStyle(TextFormatting.GRAY));
            }
        }
        IMinorConstellation tr = ((ConstellationItem) stack.getItem()).getTraitConstellation(stack);
        if (tr != null) {
            if (GatedKnowledge.CRYSTAL_TRAIT.canSee(tier) && clientProgress.hasConstellationDiscovered(tr)) {
                toolTip.add(new TranslationTextComponent("crystal.info.astralsorcery.trait", tr.getConstellationName().mergeStyle(TextFormatting.BLUE)).mergeStyle(TextFormatting.GRAY));
            } else if (!addedMissing) {
                toolTip.add(new TranslationTextComponent("astralsorcery.progress.missing.knowledge").mergeStyle(TextFormatting.GRAY));
            }
        }
    }
}
Also used : CrystalAttributes(hellfirepvp.astralsorcery.common.crystal.CrystalAttributes) TranslationTextComponent(net.minecraft.util.text.TranslationTextComponent) AttunedSourceInstance(hellfirepvp.astralsorcery.common.crystal.source.AttunedSourceInstance) IMinorConstellation(hellfirepvp.astralsorcery.common.constellation.IMinorConstellation) PlayerProgress(hellfirepvp.astralsorcery.common.data.research.PlayerProgress) ProgressionTier(hellfirepvp.astralsorcery.common.data.research.ProgressionTier) IWeakConstellation(hellfirepvp.astralsorcery.common.constellation.IWeakConstellation) ConstellationItem(hellfirepvp.astralsorcery.common.constellation.ConstellationItem) OnlyIn(net.minecraftforge.api.distmarker.OnlyIn)

Example 4 with ProgressionTier

use of hellfirepvp.astralsorcery.common.data.research.ProgressionTier in project AstralSorcery by HellFirePvP.

the class ItemKnowledgeShare method tryGiveKnowledge.

private void tryGiveKnowledge(ItemStack stack, PlayerEntity player) {
    if (player instanceof ServerPlayerEntity && MiscUtils.isPlayerFakeMP((ServerPlayerEntity) player)) {
        return;
    }
    if (isCreative(stack)) {
        ResearchManager.forceMaximizeAll(player);
        return;
    }
    // Means it's either empty or the player that has incsribed the knowledge is trying to use it.
    if (canInscribeKnowledge(stack, player))
        return;
    PlayerProgress progress = getKnowledge(stack);
    if (progress == null)
        return;
    ProgressionTier prev = progress.getTierReached();
    if (ResearchHelper.mergeApplyPlayerprogress(progress, player) && progress.getTierReached().isThisLater(prev)) {
        PktProgressionUpdate pkt = new PktProgressionUpdate(progress.getTierReached());
        PacketChannel.CHANNEL.sendToPlayer(player, pkt);
    }
}
Also used : PktProgressionUpdate(hellfirepvp.astralsorcery.common.network.play.server.PktProgressionUpdate) ServerPlayerEntity(net.minecraft.entity.player.ServerPlayerEntity) PlayerProgress(hellfirepvp.astralsorcery.common.data.research.PlayerProgress) ProgressionTier(hellfirepvp.astralsorcery.common.data.research.ProgressionTier)

Example 5 with ProgressionTier

use of hellfirepvp.astralsorcery.common.data.research.ProgressionTier in project AstralSorcery by HellFirePvP.

the class ItemAttunedCrystalBase method addInformation.

@Override
@OnlyIn(Dist.CLIENT)
public void addInformation(ItemStack stack, @Nullable World world, List<ITextComponent> toolTip, ITooltipFlag flag) {
    CrystalAttributes.TooltipResult result = addCrystalPropertyToolTip(stack, toolTip);
    if (result != null) {
        ProgressionTier tier = ResearchHelper.getClientProgress().getTierReached();
        boolean addedMissing = result != CrystalAttributes.TooltipResult.ADDED_ALL;
        IWeakConstellation c = getAttunedConstellation(stack);
        if (c != null) {
            if (GatedKnowledge.CRYSTAL_TUNE.canSee(tier) && ResearchHelper.getClientProgress().hasConstellationDiscovered(c)) {
                toolTip.add(new TranslationTextComponent("crystal.info.astralsorcery.attuned", c.getConstellationName().mergeStyle(TextFormatting.BLUE)).mergeStyle(TextFormatting.GRAY));
            } else if (!addedMissing) {
                toolTip.add(new TranslationTextComponent("astralsorcery.progress.missing.knowledge").mergeStyle(TextFormatting.GRAY));
                addedMissing = true;
            }
        }
        IMinorConstellation tr = getTraitConstellation(stack);
        if (tr != null) {
            if (GatedKnowledge.CRYSTAL_TUNE.canSee(tier) && ResearchHelper.getClientProgress().hasConstellationDiscovered(tr)) {
                toolTip.add(new TranslationTextComponent("crystal.info.astralsorcery.trait", tr.getConstellationName().mergeStyle(TextFormatting.BLUE)).mergeStyle(TextFormatting.GRAY));
            } else if (!addedMissing) {
                toolTip.add(new TranslationTextComponent("astralsorcery.progress.missing.knowledge").mergeStyle(TextFormatting.GRAY));
            }
        }
    }
}
Also used : CrystalAttributes(hellfirepvp.astralsorcery.common.crystal.CrystalAttributes) TranslationTextComponent(net.minecraft.util.text.TranslationTextComponent) IMinorConstellation(hellfirepvp.astralsorcery.common.constellation.IMinorConstellation) ProgressionTier(hellfirepvp.astralsorcery.common.data.research.ProgressionTier) IWeakConstellation(hellfirepvp.astralsorcery.common.constellation.IWeakConstellation) OnlyIn(net.minecraftforge.api.distmarker.OnlyIn)

Aggregations

ProgressionTier (hellfirepvp.astralsorcery.common.data.research.ProgressionTier)5 TranslationTextComponent (net.minecraft.util.text.TranslationTextComponent)3 IMinorConstellation (hellfirepvp.astralsorcery.common.constellation.IMinorConstellation)2 IWeakConstellation (hellfirepvp.astralsorcery.common.constellation.IWeakConstellation)2 CrystalAttributes (hellfirepvp.astralsorcery.common.crystal.CrystalAttributes)2 PlayerProgress (hellfirepvp.astralsorcery.common.data.research.PlayerProgress)2 OnlyIn (net.minecraftforge.api.distmarker.OnlyIn)2 JsonArray (com.google.gson.JsonArray)1 AltarType (hellfirepvp.astralsorcery.common.block.tile.altar.AltarType)1 ConstellationItem (hellfirepvp.astralsorcery.common.constellation.ConstellationItem)1 IConstellation (hellfirepvp.astralsorcery.common.constellation.IConstellation)1 AltarUpgradeRecipe (hellfirepvp.astralsorcery.common.crafting.recipe.altar.AltarUpgradeRecipe)1 AttunedSourceInstance (hellfirepvp.astralsorcery.common.crystal.source.AttunedSourceInstance)1 ResearchProgression (hellfirepvp.astralsorcery.common.data.research.ResearchProgression)1 PktProgressionUpdate (hellfirepvp.astralsorcery.common.network.play.server.PktProgressionUpdate)1 ServerPlayerEntity (net.minecraft.entity.player.ServerPlayerEntity)1 ITextProperties (net.minecraft.util.text.ITextProperties)1