From 9cb9f7633dd71515eb972028a580c9e60fe22f89 Mon Sep 17 00:00:00 2001 From: Roman / Linnea Gräf Date: Sat, 27 May 2023 19:20:32 +0200 Subject: Allow searching armor colour (#696) --- src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/main/java/io') diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java index 0281d95b..a5bea05d 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java @@ -47,6 +47,7 @@ import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.inventory.ContainerChest; import net.minecraft.item.Item; +import net.minecraft.item.ItemArmor; import net.minecraft.item.ItemStack; import net.minecraft.nbt.CompressedStreamTools; import net.minecraft.nbt.JsonToNBT; @@ -550,6 +551,9 @@ public class NEUManager { result = result || multiSearchString(stack.getDisplayName(), query); String lore = ""; + if (stack.getItem() instanceof ItemArmor && ((ItemArmor)stack.getItem()).getArmorMaterial() == ItemArmor.ArmorMaterial.LEATHER) { + lore = String.format("#%06x ",((ItemArmor)stack.getItem()).getColor(stack)); + } NBTTagCompound tag = stack.getTagCompound(); if (tag != null) { NBTTagCompound display = tag.getCompoundTag("display"); -- cgit