advanced/regular tooltips
This commit is contained in:
parent
d188a20366
commit
f91b26057e
6 changed files with 35 additions and 42 deletions
|
@ -42,8 +42,11 @@ public record VillagerIngredient(
|
||||||
|
|
||||||
boolean addedAny = false;
|
boolean addedAny = false;
|
||||||
|
|
||||||
if (profession != null) {
|
if (minLevel >= 5) {
|
||||||
component.append(new TranslatableComponent("entity.minecraft.villager." + profession.getPath()));
|
component.append(new TranslatableComponent("merchant.level.5"));
|
||||||
|
addedAny = true;
|
||||||
|
} else if (minLevel > 1) {
|
||||||
|
component.append(new TranslatableComponent("merchant.level." + minLevel));
|
||||||
addedAny = true;
|
addedAny = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,48 +57,39 @@ public record VillagerIngredient(
|
||||||
addedAny = true;
|
addedAny = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (minLevel >= 5) {
|
if (profession != null) {
|
||||||
if (addedAny)
|
if (addedAny)
|
||||||
component.append(" ");
|
component.append(" ");
|
||||||
component.append(new TranslatableComponent("merchant.level.5"));
|
component.append(new TranslatableComponent("entity.minecraft.villager." + profession.getPath()));
|
||||||
addedAny = true;
|
} else {
|
||||||
} else if (minLevel > 1) {
|
|
||||||
if (addedAny)
|
if (addedAny)
|
||||||
component.append(" ");
|
component.append(" ");
|
||||||
component.append(new TranslatableComponent("merchant.level." + minLevel));
|
component.append(EntityType.VILLAGER.getDescription());
|
||||||
addedAny = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (addedAny)
|
|
||||||
component.append(" ");
|
|
||||||
component.append(EntityType.VILLAGER.getDescription());
|
|
||||||
|
|
||||||
return component;
|
return component;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Component> getTooltip() {
|
public List<Component> getTooltip(boolean advanced) {
|
||||||
List<Component> tooltip = new ArrayList<>();
|
List<Component> tooltip = new ArrayList<>();
|
||||||
tooltip.add(EntityType.VILLAGER.getDescription());
|
tooltip.add(name());
|
||||||
|
|
||||||
if (profession != null) {
|
if (advanced) {
|
||||||
var professionKey = "entity.minecraft.villager." + profession.getPath();
|
if (minLevel >= 5) {
|
||||||
tooltip.add(new TranslatableComponent("hexcasting.tooltip.brainsweep.profession",
|
tooltip.add(new TranslatableComponent("hexcasting.tooltip.brainsweep.level", 5).withStyle(ChatFormatting.DARK_GRAY));
|
||||||
new TranslatableComponent(professionKey)));
|
} else if (minLevel > 1) {
|
||||||
|
tooltip.add(new TranslatableComponent("hexcasting.tooltip.brainsweep.min_level", minLevel).withStyle(ChatFormatting.DARK_GRAY));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (biome != null) {
|
||||||
|
tooltip.add(new TextComponent(biome.toString()).withStyle(ChatFormatting.DARK_GRAY));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (profession != null) {
|
||||||
|
tooltip.add(new TextComponent(profession.toString()).withStyle(ChatFormatting.DARK_GRAY));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (biome != null) {
|
|
||||||
var biomeKey = "biome.minecraft." + biome.getPath();
|
|
||||||
tooltip.add(new TranslatableComponent("hexcasting.tooltip.brainsweep.biome",
|
|
||||||
new TranslatableComponent(biomeKey)));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (minLevel >= 5)
|
|
||||||
tooltip.add(new TranslatableComponent("hexcasting.tooltip.brainsweep.level",
|
|
||||||
new TranslatableComponent("merchant.level.5")));
|
|
||||||
else if (minLevel > 1)
|
|
||||||
tooltip.add(new TranslatableComponent("hexcasting.tooltip.brainsweep.min_level",
|
|
||||||
new TranslatableComponent("merchant.level." + minLevel)));
|
|
||||||
|
|
||||||
tooltip.add(getModNameComponent());
|
tooltip.add(getModNameComponent());
|
||||||
|
|
||||||
return tooltip;
|
return tooltip;
|
||||||
|
|
|
@ -58,7 +58,8 @@ public class BrainsweepProcessor implements IComponentProcessor {
|
||||||
return IVariable.wrap(iHatePatchouli);
|
return IVariable.wrap(iHatePatchouli);
|
||||||
}
|
}
|
||||||
case "entityTooltip" -> {
|
case "entityTooltip" -> {
|
||||||
return IVariable.wrapList(this.recipe.villagerIn().getTooltip().stream().map(IVariable::from).toList());
|
Minecraft mc = Minecraft.getInstance();
|
||||||
|
return IVariable.wrapList(this.recipe.villagerIn().getTooltip(mc.options.advancedItemTooltips).stream().map(IVariable::from).toList());
|
||||||
}
|
}
|
||||||
default -> {
|
default -> {
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -130,13 +130,8 @@
|
||||||
"hexcasting.tooltip.lens.akashic.bookshelf.location": "Record at %s",
|
"hexcasting.tooltip.lens.akashic.bookshelf.location": "Record at %s",
|
||||||
"hexcasting.tooltip.lens.akashic.record.count": "%s iotas stored",
|
"hexcasting.tooltip.lens.akashic.record.count": "%s iotas stored",
|
||||||
"hexcasting.tooltip.lens.akashic.record.count.single": "%s iota stored",
|
"hexcasting.tooltip.lens.akashic.record.count.single": "%s iota stored",
|
||||||
"hexcasting.tooltip.brainsweep.profession": "Profession: %s",
|
"hexcasting.tooltip.brainsweep.min_level": "Level %s or higher",
|
||||||
"hexcasting.tooltip.brainsweep.profession.any": "Profession: Any",
|
"hexcasting.tooltip.brainsweep.level": "Level %s",
|
||||||
"hexcasting.tooltip.brainsweep.biome": "Biome: %s",
|
|
||||||
"hexcasting.tooltip.brainsweep.biome.any": "Biome: Any",
|
|
||||||
"hexcasting.tooltip.brainsweep.min_level": "Rank: %s or higher",
|
|
||||||
"hexcasting.tooltip.brainsweep.level": "Rank: %s",
|
|
||||||
"hexcasting.tooltip.brainsweep.level.any": "Rank: Any",
|
|
||||||
"hexcasting.tooltip.brainsweep.product": "Mindless Body",
|
"hexcasting.tooltip.brainsweep.product": "Mindless Body",
|
||||||
"hexcasting.spelldata.onitem": "Contains: %s",
|
"hexcasting.spelldata.onitem": "Contains: %s",
|
||||||
"hexcasting.spelldata.anything": "Anything",
|
"hexcasting.spelldata.anything": "Anything",
|
||||||
|
|
|
@ -92,7 +92,8 @@ public class VillagerEmiStack extends EmiStack {
|
||||||
if (mindless)
|
if (mindless)
|
||||||
return List.of(new TranslatableComponent("hexcasting.tooltip.brainsweep.product"), ingredient.getModNameComponent());
|
return List.of(new TranslatableComponent("hexcasting.tooltip.brainsweep.product"), ingredient.getModNameComponent());
|
||||||
|
|
||||||
return ingredient.getTooltip();
|
Minecraft mc = Minecraft.getInstance();
|
||||||
|
return ingredient.getTooltip(mc.options.advancedItemTooltips);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -72,7 +72,8 @@ public class VillagerWidget extends Widget {
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public Tooltip getTooltip(Point mouse) {
|
public Tooltip getTooltip(Point mouse) {
|
||||||
return Tooltip.create(mouse, villager.getTooltip());
|
Minecraft mc = Minecraft.getInstance();
|
||||||
|
return Tooltip.create(mouse, villager.getTooltip(mc.options.advancedItemTooltips));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -71,7 +71,8 @@ public class BrainsweepRecipeCategory implements IRecipeCategory<BrainsweepRecip
|
||||||
public @NotNull List<Component> getTooltipStrings(@NotNull BrainsweepRecipe recipe,
|
public @NotNull List<Component> getTooltipStrings(@NotNull BrainsweepRecipe recipe,
|
||||||
@NotNull IRecipeSlotsView recipeSlotsView, double mouseX, double mouseY) {
|
@NotNull IRecipeSlotsView recipeSlotsView, double mouseX, double mouseY) {
|
||||||
if (37 <= mouseX && mouseX <= 37 + 26 && 19 <= mouseY && mouseY <= 19 + 48) {
|
if (37 <= mouseX && mouseX <= 37 + 26 && 19 <= mouseY && mouseY <= 19 + 48) {
|
||||||
return recipe.villagerIn().getTooltip();
|
Minecraft mc = Minecraft.getInstance();
|
||||||
|
return recipe.villagerIn().getTooltip(mc.options.advancedItemTooltips);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
|
|
Loading…
Reference in a new issue