Changed Crystalite armor tooltips registration
This commit is contained in:
parent
7f40d46ac2
commit
990dccd1b5
7 changed files with 129 additions and 33 deletions
|
@ -2,6 +2,7 @@ package ru.betterend.item;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import net.fabricmc.fabric.api.client.item.v1.ItemTooltipCallback;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import net.fabricmc.api.EnvType;
|
||||
|
@ -25,8 +26,8 @@ import ru.betterend.registry.EndItems;
|
|||
|
||||
public class CrystaliteArmor extends EndArmorItem {
|
||||
|
||||
protected final static TranslatableComponent CHEST_DESC;
|
||||
protected final static TranslatableComponent BOOTS_DESC;
|
||||
public final static TranslatableComponent CHEST_DESC;
|
||||
public final static TranslatableComponent BOOTS_DESC;
|
||||
|
||||
public CrystaliteArmor(EquipmentSlot equipmentSlot, Properties settings) {
|
||||
super(EndArmorMaterial.CRYSTALITE, equipmentSlot, settings);
|
||||
|
@ -44,31 +45,6 @@ public class CrystaliteArmor extends EndArmorItem {
|
|||
public static void applySetEffect(LivingEntity owner) {
|
||||
owner.addEffect(new MobEffectInstance(EndStatusEffects.CRYSTALITE_HEALTH_REGEN));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Environment(EnvType.CLIENT)
|
||||
public void appendHoverText(ItemStack stack, @Nullable Level level, List<Component> lines, TooltipFlag tooltip) {
|
||||
super.appendHoverText(stack, level, lines, tooltip);
|
||||
|
||||
boolean hasSet = false;
|
||||
Player owner = Minecraft.getInstance().player;
|
||||
if (owner != null) {
|
||||
hasSet = hasFullSet(owner);
|
||||
}
|
||||
|
||||
TranslatableComponent setDesc = new TranslatableComponent("tooltip.armor.crystalite_set");
|
||||
setDesc.setStyle(Style.EMPTY.applyFormats(hasSet ? ChatFormatting.BLUE : ChatFormatting.DARK_GRAY, ChatFormatting.ITALIC));
|
||||
lines.add(TextComponent.EMPTY);
|
||||
lines.add(setDesc);
|
||||
|
||||
if (stack.getItem() == EndItems.CRYSTALITE_CHESTPLATE) {
|
||||
lines.add(1, TextComponent.EMPTY);
|
||||
lines.add(2, CHEST_DESC);
|
||||
} else if (stack.getItem() == EndItems.CRYSTALITE_BOOTS) {
|
||||
lines.add(1, TextComponent.EMPTY);
|
||||
lines.add(2, BOOTS_DESC);
|
||||
}
|
||||
}
|
||||
|
||||
static {
|
||||
Style descStyle = Style.EMPTY.applyFormats(ChatFormatting.DARK_AQUA, ChatFormatting.ITALIC);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue