Search in sources :

Example 1 with AttunedSourceInstance

use of hellfirepvp.astralsorcery.common.crystal.source.AttunedSourceInstance 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)

Aggregations

ConstellationItem (hellfirepvp.astralsorcery.common.constellation.ConstellationItem)1 IMinorConstellation (hellfirepvp.astralsorcery.common.constellation.IMinorConstellation)1 IWeakConstellation (hellfirepvp.astralsorcery.common.constellation.IWeakConstellation)1 CrystalAttributes (hellfirepvp.astralsorcery.common.crystal.CrystalAttributes)1 AttunedSourceInstance (hellfirepvp.astralsorcery.common.crystal.source.AttunedSourceInstance)1 PlayerProgress (hellfirepvp.astralsorcery.common.data.research.PlayerProgress)1 ProgressionTier (hellfirepvp.astralsorcery.common.data.research.ProgressionTier)1 TranslationTextComponent (net.minecraft.util.text.TranslationTextComponent)1 OnlyIn (net.minecraftforge.api.distmarker.OnlyIn)1