diff --git a/src/main/java/com/radimous/vhatcaniroll/QOLHuntersCompat.java b/src/main/java/com/radimous/vhatcaniroll/QOLHuntersCompat.java index 1548f80..60ee4e1 100644 --- a/src/main/java/com/radimous/vhatcaniroll/QOLHuntersCompat.java +++ b/src/main/java/com/radimous/vhatcaniroll/QOLHuntersCompat.java @@ -22,8 +22,8 @@ public class QOLHuntersCompat { if (qolConfigButton == null) { // use reflection to avoid a million dependencies try { - var cl = Class.forName("io.iridium.qolhunters.config.QOLHuntersClientConfigs"); - var qolButton = cl.getField("SHOW_CONFIG_BUTTON").get(null); + Class cl = Class.forName("io.iridium.qolhunters.config.QOLHuntersClientConfigs"); + Object qolButton = cl.getField("SHOW_CONFIG_BUTTON").get(null); qolConfigButton = (ForgeConfigSpec.BooleanValue) qolButton; } catch (NoSuchFieldException | ClassNotFoundException | IllegalAccessException e) { qolHuntersLoaded = false; diff --git a/src/main/java/com/radimous/vhatcaniroll/logic/Items.java b/src/main/java/com/radimous/vhatcaniroll/logic/Items.java index 80a0bc5..a87ff50 100644 --- a/src/main/java/com/radimous/vhatcaniroll/logic/Items.java +++ b/src/main/java/com/radimous/vhatcaniroll/logic/Items.java @@ -1,8 +1,14 @@ package com.radimous.vhatcaniroll.logic; +import iskallia.vault.gear.VaultGearState; +import iskallia.vault.gear.data.VaultGearData; +import iskallia.vault.init.ModGearAttributes; import iskallia.vault.init.ModItems; +import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; +import org.apache.commons.lang3.tuple.Pair; + import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; @@ -23,35 +29,36 @@ public class Items { public static List getVHGearItems() { return List.of( - new ItemStack(ModItems.SWORD), - new ItemStack(ModItems.AXE), - new ItemStack(ModItems.HELMET), - new ItemStack(ModItems.CHESTPLATE), - new ItemStack(ModItems.LEGGINGS), - new ItemStack(ModItems.BOOTS), - new ItemStack(ModItems.FOCUS), - new ItemStack(ModItems.SHIELD), - new ItemStack(ModItems.WAND), - new ItemStack(ModItems.MAGNET), - new ItemStack(ModItems.JEWEL) - ); + withTransmog(new ItemStack(ModItems.SWORD), new ResourceLocation("the_vault:gear/sword/sword_0")), + withTransmog(new ItemStack(ModItems.AXE), new ResourceLocation("the_vault:gear/axe/axe_0")), + withTransmog(new ItemStack(ModItems.HELMET), new ResourceLocation("the_vault:gear/armor/gladiator_dark/helmet")), + withTransmog(new ItemStack(ModItems.CHESTPLATE), new ResourceLocation("the_vault:gear/armor/magmatic/chestplate")), + withTransmog(new ItemStack(ModItems.LEGGINGS), new ResourceLocation("the_vault:gear/armor/reinforced_platemail_dark/leggings")), + withTransmog(new ItemStack(ModItems.BOOTS), new ResourceLocation("the_vault:gear/armor/gladiator_dark/boots")), + withTransmog(new ItemStack(ModItems.FOCUS), new ResourceLocation("the_vault:gear/focus/tatteredtome")), + withTransmog(new ItemStack(ModItems.SHIELD), new ResourceLocation("the_vault:gear/shield/gold_plated")), + withTransmog(new ItemStack(ModItems.WAND), new ResourceLocation("the_vault:gear/wand/lunar")), + withTransmog(new ItemStack(ModItems.MAGNET), new ResourceLocation("the_vault:magnets/magnet_1")), + withTransmog(new ItemStack(ModItems.JEWEL), new ResourceLocation("the_vault:gear/jewel/sword_0")) + ); } public static List getWoldGearItems() { List woldItems = new ArrayList<>(); - List woldItemFields = Arrays.asList( - "BATTLESTAFF", - "TRIDENT", - "PLUSHIE", - "LOOT_SACK", - "RANG" + List> woldItemFields = Arrays.asList( + Pair.of("BATTLESTAFF", "the_vault:gear/battlestaff/battlestaff_redstone"), + Pair.of("TRIDENT", "the_vault:gear/trident/orange"), + Pair.of("PLUSHIE", "the_vault:gear/plushie/hrry"), + Pair.of("LOOT_SACK", "the_vault:gear/loot_sack/bundle"), + Pair.of("RANG", "the_vault:gear/rang/wooden") ); try{ Class woldItemClass = Class.forName("xyz.iwolfking.woldsvaults.init.ModItems"); - for (String woldFieldName : woldItemFields) { + for (Pair woldFieldTransmogs : woldItemFields) { try { + String woldFieldName = woldFieldTransmogs.getLeft(); Item item = (Item) woldItemClass.getField(woldFieldName).get(null); - woldItems.add(new ItemStack(item)); + woldItems.add(withTransmog(new ItemStack(item), new ResourceLocation(woldFieldTransmogs.getRight()))); } catch (IllegalArgumentException | SecurityException | NoSuchFieldException | IllegalAccessException ignored) { // no-op @@ -61,6 +68,20 @@ public class Items { // no-op } return woldItems; + } + /** + * Creates copy of the given stack with the transmog applied + * @param stack the stack to apply the transmog to + * @param transmog the transmog to apply + * @return the stack with the transmog applied + */ + public static ItemStack withTransmog(ItemStack stack, ResourceLocation transmog){ + ItemStack displayStack = stack.copy(); + VaultGearData gearData = VaultGearData.read(displayStack); + gearData.setState(VaultGearState.IDENTIFIED); + gearData.createOrReplaceAttributeValue(ModGearAttributes.GEAR_MODEL, transmog); + gearData.write(displayStack); + return displayStack; } } diff --git a/src/main/java/com/radimous/vhatcaniroll/logic/Modifiers.java b/src/main/java/com/radimous/vhatcaniroll/logic/Modifiers.java index 547a638..9fd3f0c 100644 --- a/src/main/java/com/radimous/vhatcaniroll/logic/Modifiers.java +++ b/src/main/java/com/radimous/vhatcaniroll/logic/Modifiers.java @@ -16,17 +16,26 @@ import iskallia.vault.gear.attribute.ability.special.FrostNovaVulnerabilityModif import iskallia.vault.gear.attribute.ability.special.base.SpecialAbilityConfig; import iskallia.vault.gear.attribute.ability.special.base.SpecialAbilityGearAttribute; import iskallia.vault.gear.attribute.ability.special.base.SpecialAbilityModification; +import iskallia.vault.gear.attribute.ability.special.base.template.FloatRangeModification; +import iskallia.vault.gear.attribute.ability.special.base.template.IntRangeModification; +import iskallia.vault.gear.attribute.ability.special.base.template.config.FloatRangeConfig; import iskallia.vault.gear.attribute.ability.special.base.template.config.IntRangeConfig; +import iskallia.vault.gear.attribute.ability.special.base.template.value.FloatValue; import iskallia.vault.gear.attribute.ability.special.base.template.value.IntValue; import iskallia.vault.gear.attribute.config.BooleanFlagGenerator; import iskallia.vault.gear.attribute.config.ConfigurableAttributeGenerator; import iskallia.vault.gear.attribute.custom.effect.EffectGearAttribute; +import iskallia.vault.gear.attribute.custom.loot.LootTriggerAttribute; +import iskallia.vault.gear.attribute.custom.loot.ManaPerLootAttribute; import iskallia.vault.gear.reader.VaultGearModifierReader; import iskallia.vault.init.ModConfigs; +import iskallia.vault.skill.ability.component.AbilityLabelFormatters; +import iskallia.vault.skill.base.Skill; import net.minecraft.ChatFormatting; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.MutableComponent; import net.minecraft.network.chat.Style; +import net.minecraft.network.chat.TextColor; import net.minecraft.network.chat.TextComponent; import net.minecraft.resources.ResourceLocation; import net.minecraftforge.fml.LogicalSide; @@ -37,7 +46,9 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Optional; import java.util.concurrent.atomic.AtomicBoolean; +import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.stream.Collectors; @@ -50,6 +61,7 @@ public class Modifiers { ChatFormatting.LIGHT_PURPLE, ChatFormatting.AQUA, ChatFormatting.WHITE}; private static final Pattern CLOUD_PATTERN = Pattern.compile("^(?.*?) ?(?I|II|III|IV|V|VI|VII|VIII|IX|X)? (?Cloud.*)$"); + private static final DecimalFormat DECIMAL_FORMAT = new DecimalFormat("0.##"); public static List getModifierList(int lvl, VaultGearTierConfig cfg, ModifierCategory modifierCategory) { Map modifierGroup = ((VaultGearTierConfigAccessor) cfg).getModifierGroup(); @@ -155,8 +167,8 @@ public class Modifiers { // more than 7 groups is a bit crazy, but just in case boolean useNums = groupedModifiers.size() > COLORS.length; int i = 0; - for (var modGr: groupedModifiers.values()) { - for (var mod: modGr) { + for (List modGr: groupedModifiers.values()) { + for (Component mod: modGr) { MutableComponent full = new TextComponent(useNums ? i + " " : "► ").withStyle(COLORS[i % COLORS.length]); full.append(mod); componentList.add(full); @@ -222,8 +234,8 @@ public class Modifiers { return getNormalModifierTiers(lvl, modifierTierGroup); } - var res = new ArrayList>(); - var highest = modifierTierGroup.getHighestForLevel(lvl); + ArrayList> res = new ArrayList<>(); + VaultGearTierConfig.ModifierTier highest = modifierTierGroup.getHighestForLevel(lvl); if (highest == null) { return res; // empty } @@ -231,7 +243,7 @@ public class Modifiers { return res; // empty } int index = Math.min(highest.getModifierTier() + modifierCategory.getTierIncrease(), modifierTierGroup.size() - 1); - var legendTier = modifierTierGroup.get(index); + VaultGearTierConfig.ModifierTier legendTier = modifierTierGroup.get(index); if (legendTier == null || legendTier.getWeight() == 0){ return res; // empty } @@ -274,7 +286,7 @@ public class Modifiers { } String atrName = atrRegName.toString(); - var minConfigDisplay = atrGenerator.getConfigDisplay(atr.getReader(), minConfig); + MutableComponent minConfigDisplay = atrGenerator.getConfigDisplay(atr.getReader(), minConfig); if (minConfig instanceof SpecialAbilityGearAttribute.SpecialAbilityTierConfig minConfigSpecial) { return getSpecialAbilityAttributeComponent(modifierTiers, minConfigSpecial); @@ -300,6 +312,9 @@ public class Modifiers { if (minConfig instanceof AbilityAreaOfEffectPercentAttribute.Config minConfigA) { return getAbilityAoePercentageComponent(atr, minConfigA, minConfigA); } + if (minConfig instanceof ManaPerLootAttribute.Config maxManaPerLootConfig) { + return getManaPerLootComponent(maxManaPerLootConfig, maxManaPerLootConfig); + } return res; } return new TextComponent("ERR - NULL DISPLAY " + atrName); @@ -309,30 +324,55 @@ public class Modifiers { private static @NotNull MutableComponent getSpecialAbilityAttributeComponent( ArrayList> modifierTiers, SpecialAbilityGearAttribute.SpecialAbilityTierConfig minConfigSpecial) { - var modification = minConfigSpecial.getModification(); - if (modification instanceof FrostNovaVulnerabilityModification frostNovaVulnerabilityModification) { - var minToMaxComponent = new TextComponent(""); - return (new TextComponent("Frost Nova also applies Level ").append(minToMaxComponent) - .append(" Vulnerability")); + SpecialAbilityModification, ?> modification = minConfigSpecial.getModification(); + if (modification instanceof IntRangeModification intRangeModification){ + var minValue = intRangeModification.getMinimumValue(getIntTiers(modifierTiers)); + var maxValue = intRangeModification.getMaximumValue(getIntTiers(modifierTiers)); + String minValueDisplay = minValue.map(x -> String.valueOf(x.getValue().getValue())).orElse("NULL"); + String maxValueDisplay = maxValue.map(x -> String.valueOf(x.getValue().getValue())).orElse("NULL"); + MutableComponent minToMaxComponent = new TextComponent(minValueDisplay + "-" + maxValueDisplay).withStyle(ChatFormatting.UNDERLINE).withStyle(Style.EMPTY.withColor(TextColor.fromRgb(6082075))); + if (intRangeModification instanceof FrostNovaVulnerabilityModification) { + return (new TextComponent("Frost Nova also applies Level ").append(minToMaxComponent).append(" Vulnerability")).withStyle(Style.EMPTY.withColor(TextColor.fromRgb(14076214))); + } + if (intRangeModification instanceof EntropyPoisonModification) { + return new TextComponent("Entropic Bind also applies Poison ").withStyle(Style.EMPTY.withColor(TextColor.fromRgb(14076214))).append(minToMaxComponent); + } + if (intRangeModification.getKey().toString().equals("the_vault:glacial_blast_hypothermia")){ + return (new TextComponent("Glacial Blast is ").append(minToMaxComponent).append("X more likely to shatter")).withStyle(Style.EMPTY.withColor(TextColor.fromRgb(14076214))); + } + } - if (modification instanceof EntropyPoisonModification entropyPoisonModification) { - var tiers = (List, IntRangeConfig, IntValue>>) modifierTiers.stream().map(x -> x.getModifierConfiguration()).toList(); - var minValue = entropyPoisonModification.getMinimumValue(tiers); - var minValueDisplay = new TextComponent(minValue.map(x -> String.valueOf(x.getValue().getValue())).orElse("NULL")); - var maxValue = entropyPoisonModification.getMaximumValue(tiers); - var maxValueDisplay = new TextComponent(maxValue.map(x -> String.valueOf(x.getValue().getValue())).orElse("NULL")); - MutableComponent cmp = new TextComponent("Entropic Bind also applies Poison "); - var range = new TextComponent(minValueDisplay.getString() + "-" + maxValueDisplay.getString()); - cmp.append(range); - return cmp; + if (modification instanceof FloatRangeModification floatRangeModification) { + var minValue = floatRangeModification.getMinimumValue(getFloatTiers(modifierTiers)); + var maxValue = floatRangeModification.getMaximumValue(getFloatTiers(modifierTiers)); + float minValueDisplay = minValue.map(x -> x.getValue().getValue()).orElse(0f); + float maxValueDisplay = maxValue.map(x -> x.getValue().getValue()).orElse(0f); + + MutableComponent minToMaxComponent = new TextComponent(DECIMAL_FORMAT.format(minValueDisplay*100) + "%-" + DECIMAL_FORMAT.format(maxValueDisplay*100)+"%").withStyle(ChatFormatting.UNDERLINE).withStyle(Style.EMPTY.withColor(TextColor.fromRgb(6082075))); + if (floatRangeModification.getKey().toString().equals("the_vault:fireball_special_modification")){ + return (new TextComponent("Fireball has ").append(minToMaxComponent).append(" chance to fire twice")).withStyle(Style.EMPTY.withColor(TextColor.fromRgb(14076214))); + } + } - var abilityKey = minConfigSpecial.getAbilityKey(); + + + String abilityKey = minConfigSpecial.getAbilityKey(); return ModConfigs.ABILITIES.getAbilityById(abilityKey).filter(skill -> skill.getName() != null).map(skill -> { String name = skill.getName(); return new TextComponent("Special " + name + " modification"); }).orElseGet(() -> (TextComponent) new TextComponent(abilityKey).withStyle(Style.EMPTY.withColor(14076214))); } + @SuppressWarnings("unchecked") + private static List, IntRangeConfig, IntValue>> getIntTiers(List> modifierTiers) { + return modifierTiers.stream().map(x -> (SpecialAbilityGearAttribute.SpecialAbilityTierConfig, IntRangeConfig, IntValue>) x.getModifierConfiguration()).toList(); + } + + @SuppressWarnings("unchecked") + private static List, FloatRangeConfig, FloatValue>> getFloatTiers(List> modifierTiers) { + return modifierTiers.stream().map(x -> (SpecialAbilityGearAttribute.SpecialAbilityTierConfig, FloatRangeConfig, FloatValue>) x.getModifierConfiguration()).toList(); + } + /** * This method handles combining multiple configs into a single component * VH doesn't have method for this, so we need to do it manually @@ -342,8 +382,8 @@ public class Modifiers { private static MutableComponent rangeComponent(String atrName, VaultGearAttribute atr, ConfigurableAttributeGenerator atrGenerator, C minConfig, C maxConfig) { MutableComponent res = atrGenerator.getConfigRangeDisplay(atr.getReader(), minConfig, maxConfig); - var minConfigDisplay = atrGenerator.getConfigDisplay(atr.getReader(), minConfig); - var maxConfigDisplay = atrGenerator.getConfigDisplay(atr.getReader(), maxConfig); + MutableComponent minConfigDisplay = atrGenerator.getConfigDisplay(atr.getReader(), minConfig); + MutableComponent maxConfigDisplay = atrGenerator.getConfigDisplay(atr.getReader(), maxConfig); if (res != null && minConfig instanceof AbilityLevelAttribute.Config minConfigAbility) { @@ -354,8 +394,8 @@ public class Modifiers { // res -> "30% - 50%" // single -> "30% Poison Avoidance" // minRange -> "30%" - var single = minConfigDisplay.withStyle(atr.getReader().getColoredTextStyle()); - var minRange = atrGenerator.getConfigRangeDisplay(atr.getReader(), minConfig, minConfig); + MutableComponent single = minConfigDisplay.withStyle(atr.getReader().getColoredTextStyle()); + MutableComponent minRange = atrGenerator.getConfigRangeDisplay(atr.getReader(), minConfig, minConfig); if (minRange != null && res != null) { res.append(single.getString().replace(minRange.getString(), "")); // res -> "30% - 50% Poison Avoidance" @@ -372,11 +412,15 @@ public class Modifiers { if (minConfig instanceof EffectGearAttribute.Config minEffectConfig && maxConfig instanceof EffectGearAttribute.Config && maxConfigDisplay != null) { - var effectStr = ((EffectConfigAccessor)minEffectConfig).getAmplifier() + "-" + + String effectStr = ((EffectConfigAccessor)minEffectConfig).getAmplifier() + "-" + maxConfigDisplay.getString(); return new TextComponent(effectStr).withStyle(atr.getReader().getColoredTextStyle()); } + if (minConfig instanceof ManaPerLootAttribute.Config minManaPerLootConfig && maxConfig instanceof ManaPerLootAttribute.Config maxManaPerLootConfig) { + return getManaPerLootComponent(minManaPerLootConfig, maxManaPerLootConfig); + } + if (atrName.equals("the_vault:effect_cloud")){ return new TextComponent("Special ability modification"); } @@ -387,6 +431,18 @@ public class Modifiers { return res; } + private static @NotNull MutableComponent getManaPerLootComponent(ManaPerLootAttribute.Config minManaPerLootConfig, + ManaPerLootAttribute.Config maxManaPerLootConfig) { + int minGenerated = minManaPerLootConfig.getManaGenerated().getMin(); + int maxGenerated = maxManaPerLootConfig.getManaGenerated().getMax(); + float minGenChance = minManaPerLootConfig.getManaGenerationChance().getMin(); + float maxGenChance = maxManaPerLootConfig.getManaGenerationChance().getMax(); + var minToMax = new TextComponent(DECIMAL_FORMAT.format(minGenChance*100) + "%-" + DECIMAL_FORMAT.format(maxGenChance*100) + "%").withStyle(Style.EMPTY.withColor(20479)); + var generated = new TextComponent(minGenerated + "-" + maxGenerated).withStyle(Style.EMPTY.withColor(20479)); + var loot = new TextComponent(maxManaPerLootConfig.getDisplayName()).withStyle(Style.EMPTY.withColor(20479)); + return new TextComponent("").withStyle(Style.EMPTY.withColor(65535)).append(minToMax).append(new TextComponent(" chance to generate ")).append(generated).append(" Mana per ").append(loot).append(" looted"); + } + private static @NotNull MutableComponent getAbilityAoePercentageComponent(VaultGearAttribute atr, AbilityAreaOfEffectPercentAttribute.Config minConfigA, AbilityAreaOfEffectPercentAttribute.Config maxConfigA) { @@ -423,22 +479,22 @@ public class Modifiers { // [] Cloud [when Hit] // Poison Cloud // Poison III Cloud - var minString = minConfigDisplay.getString(); - var maxString = maxConfigDisplay.getString(); + String minString = minConfigDisplay.getString(); + String maxString = maxConfigDisplay.getString(); - var minLvl = getCloudLvl(minString); - var maxLvl = getCloudLvl(maxString); + String minLvl = getCloudLvl(minString); + String maxLvl = getCloudLvl(maxString); if (minLvl.equals(maxLvl)) { return minConfigDisplay.withStyle(atr.getReader().getColoredTextStyle()); } - var cloudRange = makeCloudLvlRange(minString, minLvl, maxLvl); + String cloudRange = makeCloudLvlRange(minString, minLvl, maxLvl); return new TextComponent(cloudRange).withStyle(atr.getReader().getColoredTextStyle()); } private static String getCloudLvl(String displayString){ - var matcher = CLOUD_PATTERN.matcher(displayString); + Matcher matcher = CLOUD_PATTERN.matcher(displayString); if (matcher.find()) { if (matcher.group("lvl") != null) { return matcher.group("lvl"); @@ -449,7 +505,7 @@ public class Modifiers { } private static String makeCloudLvlRange(String displayString, String minLvl, String maxLvl){ - var matcher = CLOUD_PATTERN.matcher(displayString); + Matcher matcher = CLOUD_PATTERN.matcher(displayString); if (matcher.find()) { return matcher.group("effect") + " " + minLvl + "-" + maxLvl + " " + matcher.group("suffix"); } @@ -459,15 +515,15 @@ public class Modifiers { private static MutableComponent abilityLvlComponent(MutableComponent prev, VaultGearAttribute atr, AbilityLevelAttribute.Config minConfig) { - var abComp = new TextComponent("+").withStyle(atr.getReader().getColoredTextStyle()); - var optSkill = ModConfigs.ABILITIES.getAbilityById(minConfig.getAbilityKey()); + MutableComponent abComp = new TextComponent("+").withStyle(atr.getReader().getColoredTextStyle()); + Optional optSkill = ModConfigs.ABILITIES.getAbilityById(minConfig.getAbilityKey()); if (optSkill.isEmpty()) { return prev.append(" added ability levels").withStyle(atr.getReader().getColoredTextStyle()); } - var abName = optSkill.get().getName(); - var parts = prev.getString().split("-"); + String abName = optSkill.get().getName(); + String[] parts = prev.getString().split("-"); - var res = new TextComponent("").withStyle(prev.getStyle()); + MutableComponent res = new TextComponent("").withStyle(prev.getStyle()); if (parts.length == 2) { if (parts[0].equals(parts[1])) { res.append(parts[0]); diff --git a/src/main/java/com/radimous/vhatcaniroll/mixin/AbilityFloatValueAttributeReaderInvoker.java b/src/main/java/com/radimous/vhatcaniroll/mixin/AbilityFloatValueAttributeReaderInvoker.java index 8aa5806..bc68d40 100644 --- a/src/main/java/com/radimous/vhatcaniroll/mixin/AbilityFloatValueAttributeReaderInvoker.java +++ b/src/main/java/com/radimous/vhatcaniroll/mixin/AbilityFloatValueAttributeReaderInvoker.java @@ -5,7 +5,7 @@ import net.minecraft.network.chat.MutableComponent; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.gen.Invoker; -@Mixin(AbilityFloatValueAttribute.Reader.class) +@Mixin(value = AbilityFloatValueAttribute.Reader.class, remap = false) public interface AbilityFloatValueAttributeReaderInvoker { @Invoker MutableComponent invokeFormatAbilityName(String abilityKey); diff --git a/src/main/java/com/radimous/vhatcaniroll/mixin/StatisticsElementContainerScreenMixin.java b/src/main/java/com/radimous/vhatcaniroll/mixin/StatisticsElementContainerScreenMixin.java index 94ccb39..3c14b0a 100644 --- a/src/main/java/com/radimous/vhatcaniroll/mixin/StatisticsElementContainerScreenMixin.java +++ b/src/main/java/com/radimous/vhatcaniroll/mixin/StatisticsElementContainerScreenMixin.java @@ -59,7 +59,7 @@ public class StatisticsElementContainerScreenMixin extends AbstractSkillTabEleme }) ); // add chestplate icon to it - var chestplateStack = new ItemStack(ModItems.CHESTPLATE); + ItemStack chestplateStack = new ItemStack(ModItems.CHESTPLATE); this.addElement( new FakeItemSlotElement<>(Spatials.positionXY(-3, 3), () -> chestplateStack, () -> false, ScreenTextures.EMPTY, ScreenTextures.EMPTY ).layout( diff --git a/src/main/java/com/radimous/vhatcaniroll/ui/CraftedModifiersListContainer.java b/src/main/java/com/radimous/vhatcaniroll/ui/CraftedModifiersListContainer.java index 0c9cf60..35b8870 100644 --- a/src/main/java/com/radimous/vhatcaniroll/ui/CraftedModifiersListContainer.java +++ b/src/main/java/com/radimous/vhatcaniroll/ui/CraftedModifiersListContainer.java @@ -20,10 +20,12 @@ import iskallia.vault.client.gui.framework.spatial.spi.ISpatial; import iskallia.vault.client.gui.framework.text.LabelTextStyle; import iskallia.vault.config.gear.VaultGearWorkbenchConfig; import iskallia.vault.gear.VaultGearState; +import iskallia.vault.gear.attribute.VaultGearModifier; import iskallia.vault.gear.data.VaultGearData; import iskallia.vault.init.ModGearAttributes; import net.minecraft.ChatFormatting; import net.minecraft.client.Minecraft; +import net.minecraft.client.player.LocalPlayer; import net.minecraft.network.chat.MutableComponent; import net.minecraft.network.chat.Style; import net.minecraft.network.chat.TextColor; @@ -32,6 +34,8 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; import org.jetbrains.annotations.NotNull; +import java.util.List; +import java.util.Optional; import java.util.concurrent.atomic.AtomicInteger; import java.util.function.Supplier; @@ -49,12 +53,12 @@ public class CraftedModifiersListContainer extends VerticalScrollClipContainer crMods = VaultGearWorkbenchConfig.getConfig(gearPiece.getItem()) .map(VaultGearWorkbenchConfig::getAllCraftableModifiers).orElse(null); if (crMods == null) { cookieDialog(); @@ -76,11 +79,11 @@ public class CraftedModifiersListContainer extends VerticalScrollClipContainer mm = mod.createModifier().orElse(null); if (mm == null) { continue; } - var oCfgDisplay = mm.getConfigDisplay(gearPiece); + Optional oCfgDisplay = mm.getConfigDisplay(gearPiece); oCfgDisplay.ifPresent(fullCmp::append); MutableComponent restriction = new TextComponent(""); int minLevel = mod.getMinLevel(); @@ -123,7 +126,6 @@ public class CraftedModifiersListContainer extends VerticalScrollClipContainer minusButton; + private NineSliceButtonElement plusButton; + private LabelElement minusLabel; + private LabelElement plusLabel; private final ScrollableLvlInputElement lvlInput; private ModifierCategory modifierCategory = ModifierCategory.NORMAL; private LabelElement modifierCategoryLabel; private NineSliceButtonElement modifierCategoryButton; - private HelpContainer helpContainer; - private LabelElement windowNameLabel; + private final HelpContainer helpContainer; + private final LabelElement windowNameLabel; private int currIndex = 0; private final List> tabs = new ArrayList<>(); @@ -111,7 +115,7 @@ public class GearModifierScreen extends AbstractElementScreen { * @param keepScroll whether to keep the current scroll position */ private void updateModifierList(boolean keepScroll) { - var oldScroll = this.innerScreen.getScroll(); + float oldScroll = this.innerScreen.getScroll(); this.removeElement(this.innerScreen); ISpatial modListSpatial = Spatials.positionXY(7, 50).size(this.getGuiSpatial().width() - 14, this.getGuiSpatial().height() - 57); this.innerScreen = this.innerScreen.create(modListSpatial, lvlInput.getValue(), modifierCategory, getCurrGear()); @@ -134,9 +138,8 @@ public class GearModifierScreen extends AbstractElementScreen { updateModifierCategoryButtonLabel(); ISpatial modListSpatial = Spatials.positionXY(7, 50).size(this.getGuiSpatial().width() - 14, this.getGuiSpatial().height() - 57); this.innerScreen = new TransmogListContainer(modListSpatial, getCurrGear()).layout(this.translateWorldSpatial()); - this.modifierCategoryButton.setDisabled(true); - this.modifierCategoryButton.setVisible(false); - this.modifierCategoryLabel.setVisible(false); + this.disableCategoryButtons(); + this.disableLvlButtons(); this.windowNameLabel.set(new TranslatableComponent("vhatcaniroll.screen.title.transmogs").withStyle(ChatFormatting.BLACK)); this.addElement(this.innerScreen); ScreenLayout.requestLayout(); @@ -146,9 +149,8 @@ public class GearModifierScreen extends AbstractElementScreen { this.removeElement(this.innerScreen); ISpatial modListSpatial = Spatials.positionXY(7, 50).size(this.getGuiSpatial().width() - 14, this.getGuiSpatial().height() - 57); this.innerScreen = new ModifierListContainer(modListSpatial, lvlInput.getValue(), modifierCategory, getCurrGear()).layout(this.translateWorldSpatial()); - this.modifierCategoryButton.setDisabled(false); - this.modifierCategoryButton.setVisible(true); - this.modifierCategoryLabel.setVisible(true); + this.enableCategoryButtons(); + this.enableLvlButtons(); this.windowNameLabel.set(new TranslatableComponent("vhatcaniroll.screen.title.random").withStyle(ChatFormatting.BLACK)); this.addElement(this.innerScreen); ScreenLayout.requestLayout(); @@ -160,9 +162,8 @@ public class GearModifierScreen extends AbstractElementScreen { updateModifierCategoryButtonLabel(); ISpatial modListSpatial = Spatials.positionXY(7, 50).size(this.getGuiSpatial().width() - 14, this.getGuiSpatial().height() - 57); this.innerScreen = new CraftedModifiersListContainer(modListSpatial, lvlInput.getValue(), modifierCategory, getCurrGear()).layout(this.translateWorldSpatial()); - this.modifierCategoryButton.setDisabled(true); - this.modifierCategoryButton.setVisible(false); - this.modifierCategoryLabel.setVisible(false); + this.enableLvlButtons(); + this.disableCategoryButtons(); this.windowNameLabel.set(new TranslatableComponent("vhatcaniroll.screen.title.crafted").withStyle(ChatFormatting.BLACK)); this.addElement(this.innerScreen); ScreenLayout.requestLayout(); @@ -174,14 +175,43 @@ public class GearModifierScreen extends AbstractElementScreen { updateModifierCategoryButtonLabel(); ISpatial modListSpatial = Spatials.positionXY(7, 50).size(this.getGuiSpatial().width() - 14, this.getGuiSpatial().height() - 57); this.innerScreen = new UniqueGearListContainer(modListSpatial, lvlInput.getValue(), modifierCategory, getCurrGear()).layout(this.translateWorldSpatial()); - this.modifierCategoryButton.setDisabled(true); - this.modifierCategoryButton.setVisible(false); - this.modifierCategoryLabel.setVisible(false); + this.enableLvlButtons(); + this.disableCategoryButtons(); this.windowNameLabel.set(new TranslatableComponent("vhatcaniroll.screen.title.unique").withStyle(ChatFormatting.BLACK)); this.addElement(this.innerScreen); ScreenLayout.requestLayout(); } + + + private void enableCategoryButtons(){ + this.modifierCategoryLabel.setVisible(true); + this.modifierCategoryButton.setVisible(true); + this.modifierCategoryButton.setDisabled(false); + } + + private void disableCategoryButtons(){ + this.modifierCategoryLabel.setVisible(false); + this.modifierCategoryButton.setVisible(false); + this.modifierCategoryButton.setDisabled(true); + } + + private void enableLvlButtons(){ + this.lvlInput.setVisible(true); + this.minusButton.setVisible(true); + this.minusLabel.setVisible(true); + this.plusButton.setVisible(true); + this.plusLabel.setVisible(true); + } + + private void disableLvlButtons(){ + this.lvlInput.setVisible(false); + this.minusButton.setVisible(false); + this.minusLabel.setVisible(false); + this.plusButton.setVisible(false); + this.plusLabel.setVisible(false); + } + // pulled from QuestOverviewElementScreen private ILayoutStrategy translateWorldSpatial() { return (screen, gui, parent, world) -> world.translateXY(this.getGuiSpatial()); @@ -272,7 +302,6 @@ public class GearModifierScreen extends AbstractElementScreen { Minecraft.getInstance().font) .layout(this.translateWorldSpatial()) ); - inputElement.onTextChanged(s -> updateModifierList(true)); return inputElement; } @@ -292,10 +321,10 @@ public class GearModifierScreen extends AbstractElementScreen { NineSliceButtonElement btnPlus = new NineSliceButtonElement<>(Spatials.positionXY(this.getGuiSpatial().width() - 25 - 13, 35).size(15, 14), ScreenTextures.BUTTON_EMPTY_TEXTURES, lvlInput::increment).layout(this.translateWorldSpatial()); - this.addElement(btnMinus); - this.addElement(minusLabel); - this.addElement(plusLabel); - this.addElement(btnPlus); + this.minusButton = this.addElement(btnMinus); + this.minusLabel = this.addElement(minusLabel); + this.plusLabel = this.addElement(plusLabel); + this.plusButton = this.addElement(btnPlus); } private void nextModifierCategory() { @@ -365,9 +394,9 @@ public class GearModifierScreen extends AbstractElementScreen { if (!(this.innerScreen instanceof ModifierListContainer)) switchToModifiers(); })).layout((screen, gui, parent, world) -> { - world.width(21).height(21).translateX(gui.left() - 18).translateY(this.getGuiSpatial().bottom() - 120); + world.width(21).height(21).translateX(gui.left() - 18 - 22).translateY(this.getGuiSpatial().bottom() - 118); }).tooltip( - Tooltips.single(TooltipDirection.LEFT, () -> new TextComponent("Random Modifiers")) + Tooltips.single(TooltipDirection.LEFT, () -> new TranslatableComponent("vhatcaniroll.screen.title.random")) ); } @@ -376,9 +405,9 @@ public class GearModifierScreen extends AbstractElementScreen { if (!(this.innerScreen instanceof TransmogListContainer)) switchToTransmog(); })).layout((screen, gui, parent, world) -> { - world.width(21).height(21).translateX(gui.left() - 18).translateY(this.getGuiSpatial().bottom() - 72); + world.width(21).height(21).translateX(gui.left() - 18).translateY(this.getGuiSpatial().bottom() - 96); }).tooltip( - Tooltips.single(TooltipDirection.LEFT, () -> new TextComponent("Transmogs")) + Tooltips.single(TooltipDirection.LEFT, () -> new TranslatableComponent("vhatcaniroll.screen.title.transmogs")) ); } @@ -387,9 +416,9 @@ public class GearModifierScreen extends AbstractElementScreen { if (!(this.innerScreen instanceof CraftedModifiersListContainer)) switchToCrafted(); })).layout((screen, gui, parent, world) -> { - world.width(21).height(21).translateX(gui.left() - 18).translateY(this.getGuiSpatial().bottom() - 96); + world.width(21).height(21).translateX(gui.left() - 18 - 22).translateY(this.getGuiSpatial().bottom() - 96); }).tooltip( - Tooltips.single(TooltipDirection.LEFT, () -> new TextComponent("Crafted Modifiers")) + Tooltips.single(TooltipDirection.LEFT, () -> new TranslatableComponent("vhatcaniroll.screen.title.crafted")) ); } @@ -398,9 +427,9 @@ public class GearModifierScreen extends AbstractElementScreen { if (!(this.innerScreen instanceof UniqueGearListContainer)) switchToUnique(); })).layout((screen, gui, parent, world) -> { - world.width(21).height(21).translateX(gui.left() - 36).translateY(this.getGuiSpatial().bottom() - 96); + world.width(21).height(21).translateX(gui.left() - 18).translateY(this.getGuiSpatial().bottom() - 118); }).tooltip( - Tooltips.single(TooltipDirection.LEFT, () -> new TextComponent("Unique Modifiers")) + Tooltips.single(TooltipDirection.LEFT, () -> new TranslatableComponent("vhatcaniroll.screen.title.unique")) ); } diff --git a/src/main/java/com/radimous/vhatcaniroll/ui/HelpContainer.java b/src/main/java/com/radimous/vhatcaniroll/ui/HelpContainer.java index f38130f..2c33060 100644 --- a/src/main/java/com/radimous/vhatcaniroll/ui/HelpContainer.java +++ b/src/main/java/com/radimous/vhatcaniroll/ui/HelpContainer.java @@ -15,21 +15,21 @@ public class HelpContainer extends ContainerElement { super(spatial); this.setVisible(false); // Hide by default - var tabLabel = new LabelElement<>( + LabelElement tabLabel = new LabelElement<>( Spatials.positionXY(336, 16).width(16).height(16), new TextComponent("TAB").withStyle(ChatFormatting.GOLD), LabelTextStyle.shadow() ).layout(this.translateWorldSpatial()); this.addElement(tabLabel); - var shiftTabLabel = new LabelElement<>( + LabelElement shiftTabLabel = new LabelElement<>( Spatials.positionXY(-60, 16).width(16).height(16), new TextComponent("SHIFT + TAB").withStyle(ChatFormatting.GOLD), LabelTextStyle.shadow() ).layout(this.translateWorldSpatial()); this.addElement(shiftTabLabel); - var arrows = new LabelElement<>( + LabelElement arrows = new LabelElement<>( Spatials.positionXY(260, 54).width(16).height(16), new TextComponent("← ").withStyle(ChatFormatting.GOLD) .append(new TextComponent("scroll").withStyle(ChatFormatting.BLUE)) @@ -38,7 +38,7 @@ public class HelpContainer extends ContainerElement { ).layout(this.translateWorldSpatial()); this.addElement(arrows); - var vimArrows = new LabelElement<>( + LabelElement vimArrows = new LabelElement<>( Spatials.positionXY(262, 64).width(16).height(16), new TextComponent("h ").withStyle(ChatFormatting.GOLD) .append(new TextComponent("wheel").withStyle(ChatFormatting.BLUE)) @@ -47,42 +47,42 @@ public class HelpContainer extends ContainerElement { ).layout(this.translateWorldSpatial()); this.addElement(vimArrows); - var ctrlLabel = new LabelElement<>( - Spatials.positionXY(340, 38).width(16).height(16), + LabelElement ctrlLabel = new LabelElement<>( + Spatials.positionXY(365, 38).width(16).height(16), new TextComponent("CTRL").withStyle(ChatFormatting.GOLD), LabelTextStyle.shadow() ).layout(this.translateWorldSpatial()); this.addElement(ctrlLabel); - var categoryLabelNormal = new LabelElement<>( - Spatials.positionXY(350, 52).width(16).height(16), + LabelElement categoryLabelNormal = new LabelElement<>( + Spatials.positionXY(375, 52).width(16).height(16), new TextComponent(ModifierCategory.NORMAL.name()).withStyle(ModifierCategory.NORMAL.getStyle()), LabelTextStyle.shadow() ).layout(this.translateWorldSpatial()); this.addElement(categoryLabelNormal); - var categoryLabelGreater = new LabelElement<>( - Spatials.positionXY(350, 62).width(16).height(16), + LabelElement categoryLabelGreater = new LabelElement<>( + Spatials.positionXY(375, 62).width(16).height(16), new TextComponent(ModifierCategory.GREATER.name()).withStyle(ModifierCategory.GREATER.getStyle()), LabelTextStyle.shadow() ).layout(this.translateWorldSpatial()); this.addElement(categoryLabelGreater); - var categoryLabelLegendary = new LabelElement<>( - Spatials.positionXY(350, 72).width(16).height(16), + LabelElement categoryLabelLegendary = new LabelElement<>( + Spatials.positionXY(375, 72).width(16).height(16), new TextComponent(ModifierCategory.LEGENDARY.name()).withStyle(ModifierCategory.LEGENDARY.getStyle()), LabelTextStyle.shadow() ).layout(this.translateWorldSpatial()); this.addElement(categoryLabelLegendary); - var upLabel = new LabelElement<>( - Spatials.positionXY(340, 150).width(16).height(16), + LabelElement upLabel = new LabelElement<>( + Spatials.positionXY(340, 190).width(16).height(16), new TextComponent("↑ k").withStyle(ChatFormatting.GOLD), LabelTextStyle.shadow() ).layout(this.translateWorldSpatial()); this.addElement(upLabel); - var downLabel = new LabelElement<>( - Spatials.positionXY(340, 164).width(16).height(16), + LabelElement downLabel = new LabelElement<>( + Spatials.positionXY(340, 204).width(16).height(16), new TextComponent("↓ j").withStyle(ChatFormatting.GOLD), LabelTextStyle.shadow() ).layout(this.translateWorldSpatial()); @@ -100,10 +100,10 @@ public class HelpContainer extends ContainerElement { rolled together. """; - var array = text.split("\n"); + String[] array = text.split("\n"); int labelY = 120; for (String s : array) { - var textLabel = new LabelElement<>( + LabelElement textLabel = new LabelElement<>( Spatials.positionXY(-100, labelY).width(20).height(15), new TextComponent(s).withStyle(ChatFormatting.GOLD), LabelTextStyle.shadow() ).layout(this.translateWorldSpatial()); diff --git a/src/main/java/com/radimous/vhatcaniroll/ui/ModifierListContainer.java b/src/main/java/com/radimous/vhatcaniroll/ui/ModifierListContainer.java index 3d76c9c..2aff2aa 100644 --- a/src/main/java/com/radimous/vhatcaniroll/ui/ModifierListContainer.java +++ b/src/main/java/com/radimous/vhatcaniroll/ui/ModifierListContainer.java @@ -10,6 +10,7 @@ import iskallia.vault.client.gui.framework.spatial.spi.ISpatial; import iskallia.vault.client.gui.framework.text.LabelTextStyle; import iskallia.vault.config.gear.VaultGearTierConfig; import net.minecraft.ChatFormatting; +import net.minecraft.network.chat.Component; import net.minecraft.network.chat.TextComponent; import net.minecraft.world.item.ItemStack; @@ -35,7 +36,7 @@ public class ModifierListContainer extends VerticalScrollClipContainer optCfg = VaultGearTierConfig.getConfig(gearPiece); if (optCfg.isPresent()) { VaultGearTierConfig cfg = optCfg.get(); - for (var modifier : Modifiers.getModifierList(lvl, cfg, modifierCategory)) { + for (Component modifier : Modifiers.getModifierList(lvl, cfg, modifierCategory)) { LabelElement labelelement = new LabelElement<>( Spatials.positionXY(labelX, labelY).width(this.innerWidth() - labelX).height(15), modifier, LabelTextStyle.defaultStyle() ); diff --git a/src/main/java/com/radimous/vhatcaniroll/ui/TransmogListContainer.java b/src/main/java/com/radimous/vhatcaniroll/ui/TransmogListContainer.java index 6d34b95..4fe6400 100644 --- a/src/main/java/com/radimous/vhatcaniroll/ui/TransmogListContainer.java +++ b/src/main/java/com/radimous/vhatcaniroll/ui/TransmogListContainer.java @@ -22,10 +22,15 @@ import iskallia.vault.init.ModGearAttributes; import iskallia.vault.util.SideOnlyFixer; import iskallia.vault.util.function.ObservableSupplier; import net.minecraft.client.Minecraft; +import net.minecraft.client.player.LocalPlayer; import net.minecraft.network.chat.Style; import net.minecraft.network.chat.TextComponent; +import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.ItemStack; +import java.util.List; +import java.util.Set; + import static iskallia.vault.client.gui.framework.ScreenTextures.BUTTON_EMPTY; import static iskallia.vault.client.gui.framework.ScreenTextures.BUTTON_EMPTY_DISABLED; @@ -36,16 +41,16 @@ public class TransmogListContainer extends VerticalScrollClipContainer discoveredModelIds = ClientDiscoveredEntriesData.Models.getDiscoveredModels(); + ObservableSupplier> discoveredModelObserverIds = ClientDiscoveredEntriesData.Models.getObserverModels(); + DiscoveredModelSelectElement.DiscoveredModelSelectorModel model = new DiscoveredModelSelectElement.DiscoveredModelSelectorModel( ObservableSupplier.of(() -> gearPiece, SideOnlyFixer::stackEqualExact), discoveredModelObserverIds, x -> {}); - var mEntries = model.getEntries(); - for (var x : mEntries) { + List mEntries = model.getEntries(); + for (DiscoveredModelSelectElement.TransmogModelEntry x : mEntries) { ItemStack displayStack = new ItemStack(gearPiece.getItem()); VaultGearData gearData = VaultGearData.read(displayStack); gearData.setState(VaultGearState.IDENTIFIED); @@ -62,7 +67,7 @@ public class TransmogListContainer extends VerticalScrollClipContainer btn = new NineSliceButtonElement<>(Spatials.positionXY(0, labelY ).width(innerWidth()).height(18), new NineSliceButtonElement.NineSliceButtonTextures(BUTTON_EMPTY, BUTTON_EMPTY, BUTTON_EMPTY, BUTTON_EMPTY_DISABLED), () -> {}); - var canTransmog = TransmogTableBlock.canTransmogModel(player, discoveredModelIds, x.getModelId()); + boolean canTransmog = TransmogTableBlock.canTransmogModel(player, discoveredModelIds, x.getModelId()); btn.setDisabled(!canTransmog); this.addElement(btn); diff --git a/src/main/java/com/radimous/vhatcaniroll/ui/UniqueGearListContainer.java b/src/main/java/com/radimous/vhatcaniroll/ui/UniqueGearListContainer.java index a096f4e..f36098d 100644 --- a/src/main/java/com/radimous/vhatcaniroll/ui/UniqueGearListContainer.java +++ b/src/main/java/com/radimous/vhatcaniroll/ui/UniqueGearListContainer.java @@ -21,6 +21,7 @@ import iskallia.vault.gear.data.VaultGearData; import iskallia.vault.init.ModConfigs; import iskallia.vault.init.ModGearAttributes; import net.minecraft.ChatFormatting; +import net.minecraft.network.chat.Component; import net.minecraft.network.chat.TextComponent; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.ItemStack; @@ -36,22 +37,21 @@ public class UniqueGearListContainer extends VerticalScrollClipContainer uniqueRegistry = ((UniqueGearConfigAccessor) ModConfigs.UNIQUE_GEAR).getRegistry(); - var regName = gearPiece.getItem().getRegistryName(); + ResourceLocation regName = gearPiece.getItem().getRegistryName(); if (regName == null) { return; } - var regPath = regName.getPath(); + String regPath = regName.getPath(); var goodEntries = uniqueRegistry.entrySet().stream().filter(entry -> entry.getValue().getModel() != null && entry.getValue().getModel().toString().contains(regPath)).toList(); - List> badEntries = uniqueRegistry.entrySet().stream().filter(entry -> entry.getValue().getModel() == null || !entry.getValue().getModel().toString().contains(regPath)).toList(); - var uniqueConfig1 = (VaultGearTierConfigAccessor) ModConfigs.VAULT_GEAR_CONFIG.get(VaultGearTierConfig.UNIQUE_ITEM); + VaultGearTierConfigAccessor uniqueConfig1 = (VaultGearTierConfigAccessor) ModConfigs.VAULT_GEAR_CONFIG.get(VaultGearTierConfig.UNIQUE_ITEM); if (uniqueConfig1 == null) { return; } - for (var entry : goodEntries) { - var value = entry.getValue(); + for (Map.Entry entry : goodEntries) { + UniqueGearConfig.Entry value = entry.getValue(); String name = value.getName(); if (name == null) { continue; @@ -83,8 +83,8 @@ public class UniqueGearListContainer extends VerticalScrollClipContainer(Spatials.positionXY(labelX - 4, iconHeight).width(16).height(16), () -> displayStack, () -> false, ScreenTextures.EMPTY, ScreenTextures.EMPTY)); - var mlist = Modifiers.getUniqueModifierList(lvl, modifierCategory, modifierIdentifiers); - for (var mc : mlist) { + List mlist = Modifiers.getUniqueModifierList(lvl, modifierCategory, modifierIdentifiers); + for (Component mc : mlist) { LabelElement mcl = new LabelElement<>( Spatials.positionXY(labelX, labelY).width(this.innerWidth() - labelX).height(15), mc, LabelTextStyle.defaultStyle()); @@ -97,23 +97,24 @@ public class UniqueGearListContainer extends VerticalScrollClipContainer entry.getValue().getModel() == null || !entry.getValue().getModel().toString().contains(regPath)).toList(); this.addElement(new LabelElement<>( Spatials.positionXY(labelX, labelY).width(this.innerWidth() - labelX).height(15), new TextComponent("[DEBUG] BAD ENTRIES:").withStyle(ChatFormatting.RED), LabelTextStyle.defaultStyle())); labelY += 10; - for (var entry : badEntries) { + for (Map.Entry entry : badEntries) { this.addElement(new LabelElement<>( Spatials.positionXY(labelX, labelY).width(this.innerWidth() - labelX).height(15), new TextComponent("ID: " + entry.getKey().toString()).withStyle(ChatFormatting.RED), LabelTextStyle.defaultStyle())); labelY += 10; - var vv = entry.getValue(); - if (vv == null) { + UniqueGearConfig.Entry value = entry.getValue(); + if (value == null) { continue; } this.addElement(new LabelElement<>( Spatials.positionXY(labelX, labelY).width(this.innerWidth() - labelX).height(15), - new TextComponent("Model: " + vv.getModel()).withStyle(ChatFormatting.RED), + new TextComponent("Model: " + value.getModel()).withStyle(ChatFormatting.RED), LabelTextStyle.defaultStyle())); labelY += 16; }