diff --git a/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/trait/SpellTraits.java b/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/trait/SpellTraits.java index c0e2f3f9..05271bad 100644 --- a/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/trait/SpellTraits.java +++ b/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/trait/SpellTraits.java @@ -148,7 +148,7 @@ public final class SpellTraits implements Iterable> { return of(block.asItem()); } - private static Optional getEmbeddedTraits(ItemStack stack) { + public static Optional getEmbeddedTraits(ItemStack stack) { if (!(stack.hasTag() && stack.getTag().contains("spell_traits", NbtElement.COMPOUND_TYPE))) { return Optional.empty(); } diff --git a/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/trait/TraitDiscovery.java b/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/trait/TraitDiscovery.java index 277128a3..8aa9b6a9 100644 --- a/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/trait/TraitDiscovery.java +++ b/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/trait/TraitDiscovery.java @@ -78,7 +78,10 @@ public class TraitDiscovery implements NbtSerialisable { @Environment(EnvType.CLIENT) public void appendTooltip(ItemStack stack, @Nullable World world, List tooltip) { - getKnownTraits(stack.getItem()).appendTooltip(tooltip); + SpellTraits.getEmbeddedTraits(stack) + .flatMap(embedded -> SpellTraits.fromEntries(embedded.entries().stream().filter(e -> isKnown(e.getKey())))) + .orElseGet(() -> getKnownTraits(stack.getItem())) + .appendTooltip(tooltip); } @Override diff --git a/src/main/java/com/minelittlepony/unicopia/client/gui/ItemTraitsTooltipRenderer.java b/src/main/java/com/minelittlepony/unicopia/client/gui/ItemTraitsTooltipRenderer.java index f56e6fb4..5efe14df 100644 --- a/src/main/java/com/minelittlepony/unicopia/client/gui/ItemTraitsTooltipRenderer.java +++ b/src/main/java/com/minelittlepony/unicopia/client/gui/ItemTraitsTooltipRenderer.java @@ -52,14 +52,14 @@ public class ItemTraitsTooltipRenderer extends BaseText implements OrderedText, var entries = traits.stream().toList(); for (int i = 0; i < entries.size(); i++) { - int xx = x + (i % columns); - int yy = y + (i / columns); + int xx = x + (i % columns) * 10; + int yy = y + (i / columns) * 10; Entry entry = entries.get(i); RenderSystem.setShaderTexture(0, entry.getKey().getSprite()); DrawableHelper.drawTexture(matrices, xx, yy, 1, 0, 0, 8, 8, 8, 8); - String string = String.valueOf(entry.getValue()); + String string = String.format("%.2f", entry.getValue()); matrices.push(); xx += 19 - 2 - textRenderer.getWidth(string);