From af64fa4363cce2b3d696c77682449b861aeb07b1 Mon Sep 17 00:00:00 2001 From: "yrsegal@gmail.com" Date: Thu, 2 Jun 2022 12:01:09 -0400 Subject: [PATCH] soup up mindless tooltip too --- .../fabric/interop/emi/VillagerEmiStack.java | 27 ++++++++++++++++--- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/VillagerEmiStack.java b/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/VillagerEmiStack.java index c8b13a07..78e9c55f 100644 --- a/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/VillagerEmiStack.java +++ b/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/VillagerEmiStack.java @@ -9,12 +9,14 @@ import com.mojang.blaze3d.vertex.PoseStack; import dev.emi.emi.EmiRenderHelper; import dev.emi.emi.api.stack.EmiStack; import dev.emi.emi.screen.tooltip.RemainderTooltipComponent; +import net.minecraft.ChatFormatting; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.screens.inventory.tooltip.ClientTooltipComponent; import net.minecraft.client.multiplayer.ClientLevel; import net.minecraft.core.Registry; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.TextComponent; import net.minecraft.network.chat.TranslatableComponent; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.EntityType; @@ -22,6 +24,7 @@ import net.minecraft.world.entity.npc.Villager; import net.minecraft.world.entity.npc.VillagerProfession; import net.minecraft.world.entity.npc.VillagerType; +import java.util.ArrayList; import java.util.List; import java.util.Objects; import java.util.stream.Collectors; @@ -89,11 +92,27 @@ public class VillagerEmiStack extends EmiStack { @Override public List getTooltipText() { - if (mindless) - return List.of(new TranslatableComponent("hexcasting.tooltip.brainsweep.product"), ingredient.getModNameComponent()); - Minecraft mc = Minecraft.getInstance(); - return ingredient.getTooltip(mc.options.advancedItemTooltips); + boolean advanced = mc.options.advancedItemTooltips; + + if (mindless) { + List tooltip = new ArrayList<>(); + tooltip.add(new TranslatableComponent("hexcasting.tooltip.brainsweep.product")); + + if (advanced) { + if (ingredient.biome() != null) { + tooltip.add(new TextComponent(ingredient.biome().toString()).withStyle(ChatFormatting.DARK_GRAY)); + } + + ResourceLocation displayId = Objects.requireNonNullElseGet(ingredient.profession(), () -> Registry.ENTITY_TYPE.getKey(EntityType.VILLAGER)); + tooltip.add(new TextComponent(displayId.toString()).withStyle(ChatFormatting.DARK_GRAY)); + } + + tooltip.add(ingredient.getModNameComponent()); + return tooltip; + } + + return ingredient.getTooltip(advanced); } @Override