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