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