diff --git a/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/effect/CustomisedSpellType.java b/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/effect/CustomisedSpellType.java index 9490f63f..c8229747 100644 --- a/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/effect/CustomisedSpellType.java +++ b/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/effect/CustomisedSpellType.java @@ -92,6 +92,9 @@ public record CustomisedSpellType ( @Override public void appendTooltip(TooltipContext context, Consumer tooltip, TooltipType type) { + if (isEmpty()) { + return; + } MutableText lore = Text.translatable(type().getTranslationKey() + ".lore").formatted(type().getAffinity().getColor()); if (!InteractionManager.getInstance().getClientSpecies().canCast()) { diff --git a/src/main/java/com/minelittlepony/unicopia/mixin/MixinItemStack.java b/src/main/java/com/minelittlepony/unicopia/mixin/MixinItemStack.java index 12818c52..33b30a02 100644 --- a/src/main/java/com/minelittlepony/unicopia/mixin/MixinItemStack.java +++ b/src/main/java/com/minelittlepony/unicopia/mixin/MixinItemStack.java @@ -12,6 +12,8 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import com.google.common.base.Suppliers; import com.llamalad7.mixinextras.injector.ModifyReturnValue; +import com.llamalad7.mixinextras.sugar.Local; +import com.minelittlepony.unicopia.client.ModifierTooltipRenderer; import com.minelittlepony.unicopia.entity.effect.FoodPoisoningStatusEffect; import com.minelittlepony.unicopia.item.DamageChecker; import com.minelittlepony.unicopia.item.ItemStackDuck; @@ -45,7 +47,7 @@ abstract class MixinItemStack implements ItemStackDuck { getTransientComponents().setCarrier(user); TypedActionResult result = FoodPoisoningStatusEffect.apply((ItemStack)(Object)this, user); if (result.getResult() != ActionResult.PASS) { - info.setReturnValue(result); + info.setReturnValue(result) ; } } @@ -69,6 +71,15 @@ abstract class MixinItemStack implements ItemStackDuck { getTransientComponents().setCarrier(null); } + @Inject(method = "getTooltip", + at = @At(value = "INVOKE", + target = "net/minecraft/item/ItemStack.appendAttributeModifiersTooltip(Ljava/util/function/Consumer;Lnet/minecraft/entity/player/PlayerEntity;)V" + )) + public void onGetTooltip(Item.TooltipContext context, @Nullable PlayerEntity player, TooltipType type, CallbackInfoReturnable> info, @Local List lines) { + ItemStack self = (ItemStack)(Object)this; + ModifierTooltipRenderer.INSTANCE.getTooltip(self, context, player, type, lines); + } + @ModifyReturnValue(method = "takesDamageFrom", at = @At("RETURN")) private boolean onTakesDamageFrom(boolean takesDamage, DamageSource source) { ItemStack self = (ItemStack)(Object)this;