mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-23 21:38:00 +01:00
Populate the tooltips for traits
This commit is contained in:
parent
bee5e0049a
commit
8a6c23f18e
2 changed files with 65 additions and 8 deletions
|
@ -4,6 +4,7 @@ import java.util.List;
|
|||
|
||||
import com.minelittlepony.common.client.gui.IViewRoot;
|
||||
import com.minelittlepony.common.client.gui.ScrollContainer;
|
||||
import com.minelittlepony.common.client.gui.Tooltip;
|
||||
import com.minelittlepony.common.client.gui.element.Button;
|
||||
import com.minelittlepony.common.client.gui.sprite.TextureSprite;
|
||||
import com.minelittlepony.unicopia.ability.magic.spell.trait.Trait;
|
||||
|
@ -17,10 +18,12 @@ import net.minecraft.client.gui.screen.ingame.HandledScreen;
|
|||
import net.minecraft.client.render.GameRenderer;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.screen.slot.Slot;
|
||||
import net.minecraft.text.LiteralText;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.text.TranslatableText;
|
||||
import net.minecraft.util.Formatting;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
public class SpellbookScreen extends HandledScreen<SpellbookScreenHandler> {
|
||||
|
@ -209,14 +212,23 @@ public class SpellbookScreen extends HandledScreen<SpellbookScreenHandler> {
|
|||
.setTextureSize(16, 16)
|
||||
.setSize(16, 16)
|
||||
.setTexture(trait.getSprite()));
|
||||
getStyle().setTooltip(List.of(
|
||||
new TranslatableText("trait." + trait.getId().getNamespace() + "." + trait.getId().getPath() + ".name"),
|
||||
new TranslatableText("trait." + trait.getId().getNamespace() + "." + trait.getId().getPath() + ".description")
|
||||
));
|
||||
getStyle().setTooltip(List.of(
|
||||
new LiteralText(trait.name()),
|
||||
new LiteralText("Test description")
|
||||
));
|
||||
|
||||
Formatting corruptionColor = trait.getGroup().getCorruption() < -0.01F
|
||||
? Formatting.GREEN
|
||||
: trait.getGroup().getCorruption() > 0.25F
|
||||
? Formatting.RED
|
||||
: Formatting.WHITE;
|
||||
|
||||
getStyle().setTooltip(Tooltip.of(
|
||||
new TranslatableText("gui.unicopia.trait.label",
|
||||
new TranslatableText("trait." + trait.getId().getNamespace() + "." + trait.getId().getPath() + ".name")
|
||||
).formatted(Formatting.YELLOW)
|
||||
.append(new TranslatableText("gui.unicopia.trait.group", trait.getGroup().name().toLowerCase()).formatted(Formatting.ITALIC, Formatting.GRAY))
|
||||
.append(new LiteralText("\n\n").formatted(Formatting.WHITE)
|
||||
.append(new TranslatableText("trait." + trait.getId().getNamespace() + "." + trait.getId().getPath() + ".description").formatted(Formatting.GRAY))
|
||||
.append("\n")
|
||||
.append(new TranslatableText("gui.unicopia.trait.corruption", ItemStack.MODIFIER_FORMAT.format(trait.getGroup().getCorruption())).formatted(Formatting.ITALIC, corruptionColor)))
|
||||
, 200));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -171,6 +171,51 @@
|
|||
"spell.unicopia.transformation": "Transformation",
|
||||
"spell.unicopia.transformation.lore": "Chaos II",
|
||||
|
||||
"gui.unicopia.trait.label": "Element of %s",
|
||||
"gui.unicopia.trait.group": "\n %s",
|
||||
"gui.unicopia.trait.corruption": "\n %s corruption",
|
||||
|
||||
"trait.unicopia.strength.name": "Strength",
|
||||
"trait.unicopia.strength.description": "An ebued trait of the Earth\nMay be used to impose force or enhance the endurance of some spells.",
|
||||
"trait.unicopia.knowledge.name": "Knowledge",
|
||||
"trait.unicopia.knowledge.description": "A mechanical harvest born of machinery and technology.\nSome spells require a little...ingenuity.",
|
||||
"trait.unicopia.power.name": "Power",
|
||||
"trait.unicopia.power.description": "Force for force's sake.\nExtends or ehanced a spell's natural duration.",
|
||||
"trait.unicopia.blood.name": "Blood",
|
||||
"trait.unicopia.blood.description": "Blood for the blood god",
|
||||
"trait.unicopia.focus.name": "Focus",
|
||||
"trait.unicopia.focus.description": "Blood for the blood god",
|
||||
"trait.unicopia.water.name": "Water",
|
||||
"trait.unicopia.water.description": "Embodies the first natural element. Counter to the Element of Fire.",
|
||||
"trait.unicopia.earth.name": "Earth",
|
||||
"trait.unicopia.earth.description": "Embodies the second natural element. An Earthly energy inherent to all things derived from below the ground.",
|
||||
"trait.unicopia.fire.name": "Fire",
|
||||
"trait.unicopia.fire.description": "Embodies the third natural element. Complemented by the Element of Air, adds a destructive spark to your spells",
|
||||
"trait.unicopia.air.name": "Air",
|
||||
"trait.unicopia.air.description": "Embodies the fourth natural element",
|
||||
"trait.unicopia.ice.name": "Ice",
|
||||
"trait.unicopia.ice.description": "A chilling touch. Complementary to the Element of Water.",
|
||||
"trait.unicopia.darkness.name": "Darkness",
|
||||
"trait.unicopia.darkness.description": "Beware the dark, for it can lead to abilities some might say are unnatural.",
|
||||
"trait.unicopia.order.name": "Harmony",
|
||||
"trait.unicopia.order.description": "Counter-balance to chaos.",
|
||||
"trait.unicopia.chaos.name": "Discord",
|
||||
"trait.unicopia.chaos.description": "Unpredicatable in nature, uncontrollable in captivity.",
|
||||
"trait.unicopia.famine.name": "Famine",
|
||||
"trait.unicopia.famine.description": "You are consumed by an overwhelming hunger. A hunger for power.",
|
||||
"trait.unicopia.happiness.name": "Laughter",
|
||||
"trait.unicopia.happiness.description": "Complemented by the Element of Harmony, wants nothing more than to bring happiness into this world.",
|
||||
"trait.unicopia.kindness.name": "Kindness",
|
||||
"trait.unicopia.kindness.description": "Complemented by the Element of Harmony and the Element of Laughter, wants nothing more than to bring happiness into this world.",
|
||||
"trait.unicopia.generosity.name": "Generosity",
|
||||
"trait.unicopia.generosity.description": "Complemented by the Element of Harmony and the Element of Kindness. Spells with this trait are better ruited to lending aid to those in need.",
|
||||
"trait.unicopia.rot.name": "Rot",
|
||||
"trait.unicopia.rot.description": "Death and destruction enter this world. All will die, all must die. It has been written and so shall it be.",
|
||||
"trait.unicopia.life.name": "Life",
|
||||
"trait.unicopia.life.description": "Ambodies the energy that resides within all living beings.",
|
||||
"trait.unicopia.poison.name": "Poison",
|
||||
"trait.unicopia.poison.description": "A deadly dart kill a beast.",
|
||||
|
||||
"toxicity.safe.name": "Safe",
|
||||
"toxicity.mild.name": "Mildly Toxic",
|
||||
"toxicity.fair.name": "Fairly Toxic",
|
||||
|
|
Loading…
Reference in a new issue