unique support 90% done
This commit is contained in:
parent
de646fd885
commit
e25ebd4de2
6 changed files with 277 additions and 164 deletions
|
|
@ -16,6 +16,7 @@ public class Config {
|
|||
public static final ForgeConfigSpec.BooleanValue SHOW_CHANCE;
|
||||
public static final ForgeConfigSpec.BooleanValue QOL_HUNTERS_CONFLICT_RESOLUTION;
|
||||
public static final ForgeConfigSpec.BooleanValue SHOW_UNOBTAINABLE_CRAFTED;
|
||||
public static final ForgeConfigSpec.BooleanValue DEBUG_UNIQUE_GEAR;
|
||||
// string instead of enum, because forge would remove enum values that are not present in the enum
|
||||
// (this could cause problems if mods are extending the enum - like wold's)
|
||||
public static final ForgeConfigSpec.ConfigValue<List<String>> AFFIX_TAG_GROUP_CHANCE_BLACKLIST;
|
||||
|
|
@ -41,11 +42,16 @@ public class Config {
|
|||
QOL_HUNTERS_CONFLICT_RESOLUTION = builder
|
||||
.comment("QOL Hunters conflict resolution (shouldn't be disabled unless it causes issues)")
|
||||
.define("QOLHuntersConflictResolution", true);
|
||||
builder.pop();
|
||||
|
||||
AFFIX_TAG_GROUP_CHANCE_BLACKLIST = builder
|
||||
.comment("vhcir won't show chance/weight for affixes in these groups")
|
||||
.define("affixTagGroupBlacklist", List.of(VaultGearTierConfig.ModifierAffixTagGroup.CRAFTED_PREFIX.name(), VaultGearTierConfig.ModifierAffixTagGroup.CRAFTED_SUFFIX.name()));
|
||||
MAX_LEVEL_OVERRIDE = builder
|
||||
.comment("override max level")
|
||||
.defineInRange("maxLevelOverride", -1, -1, Integer.MAX_VALUE);
|
||||
DEBUG_UNIQUE_GEAR = builder
|
||||
.comment("debug unique gear")
|
||||
.define("debugUniqueGear", false);
|
||||
builder.pop();
|
||||
|
||||
SHOW_ABILITY_ENHANCEMENTS = builder
|
||||
.comment("show ability enhancements")
|
||||
|
|
@ -59,10 +65,6 @@ public class Config {
|
|||
.comment("show chance")
|
||||
.define("showChance", true);
|
||||
|
||||
AFFIX_TAG_GROUP_CHANCE_BLACKLIST = builder
|
||||
.comment("vhcir won't show chance/weight for affixes in these groups")
|
||||
.define("affixTagGroupBlacklist", List.of(VaultGearTierConfig.ModifierAffixTagGroup.CRAFTED_PREFIX.name(), VaultGearTierConfig.ModifierAffixTagGroup.CRAFTED_SUFFIX.name()));
|
||||
|
||||
SHOW_UNOBTAINABLE_CRAFTED = builder
|
||||
.comment("show unobtainable crafted modifiers (above current lvl)")
|
||||
.define("showUnobtainableCrafted", false);
|
||||
|
|
|
|||
|
|
@ -1,15 +1,27 @@
|
|||
package com.radimous.vhatcaniroll.logic;
|
||||
|
||||
import com.radimous.vhatcaniroll.Config;
|
||||
import com.radimous.vhatcaniroll.mixin.AbilityFloatValueAttributeReaderInvoker;
|
||||
import com.radimous.vhatcaniroll.mixin.EffectConfigAccessor;
|
||||
import com.radimous.vhatcaniroll.mixin.VaultGearTierConfigAccessor;
|
||||
import iskallia.vault.config.UniqueGearConfig;
|
||||
import iskallia.vault.config.gear.VaultGearTierConfig;
|
||||
import iskallia.vault.gear.attribute.VaultGearAttribute;
|
||||
import iskallia.vault.gear.attribute.VaultGearAttributeRegistry;
|
||||
import iskallia.vault.gear.attribute.VaultGearModifier;
|
||||
import iskallia.vault.gear.attribute.ability.AbilityAreaOfEffectPercentAttribute;
|
||||
import iskallia.vault.gear.attribute.ability.AbilityLevelAttribute;
|
||||
import iskallia.vault.gear.attribute.ability.special.EntropyPoisonModification;
|
||||
import iskallia.vault.gear.attribute.ability.special.FrostNovaVulnerabilityModification;
|
||||
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.config.IntRangeConfig;
|
||||
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.reader.VaultGearModifierReader;
|
||||
import iskallia.vault.init.ModConfigs;
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.network.chat.Component;
|
||||
|
|
@ -20,6 +32,7 @@ import net.minecraft.resources.ResourceLocation;
|
|||
import net.minecraftforge.fml.LogicalSide;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
|
@ -44,14 +57,24 @@ public class Modifiers {
|
|||
ArrayList<Component> modList = new ArrayList<>();
|
||||
|
||||
for (VaultGearTierConfig.ModifierAffixTagGroup affixTagGroup : modifierGroup.keySet()) {
|
||||
modList.addAll(getAffixGroupComponents(lvl, affixTagGroup, modifierGroup, modifierCategory));
|
||||
modList.addAll(getAffixGroupComponents(lvl, affixTagGroup, modifierGroup.get(affixTagGroup), modifierCategory));
|
||||
}
|
||||
|
||||
return modList;
|
||||
}
|
||||
|
||||
private static List<Component> getAffixGroupComponents(int lvl, VaultGearTierConfig.ModifierAffixTagGroup affixTagGroup,
|
||||
Map<VaultGearTierConfig.ModifierAffixTagGroup, VaultGearTierConfig.AttributeGroup> modifierGroup,
|
||||
public static List<Component> getUniqueModifierList(int lvl, ModifierCategory modifierCategory, Map<UniqueGearConfig.AffixTargetType, List<ResourceLocation>> modifierIdentifiers) {
|
||||
ArrayList<Component> modList = new ArrayList<>();
|
||||
|
||||
for (Map.Entry<UniqueGearConfig.AffixTargetType, List<ResourceLocation>> modifierIdentifier : modifierIdentifiers.entrySet()) {
|
||||
modList.addAll(getUniqueAffixComponents(lvl, modifierIdentifier, modifierCategory));
|
||||
}
|
||||
|
||||
return modList;
|
||||
}
|
||||
|
||||
public static List<Component> getAffixGroupComponents(int lvl, VaultGearTierConfig.ModifierAffixTagGroup affixTagGroup,
|
||||
VaultGearTierConfig.AttributeGroup modifierGroups,
|
||||
ModifierCategory modifierCategory) {
|
||||
|
||||
ArrayList<Component> componentList = new ArrayList<>();
|
||||
|
|
@ -60,10 +83,10 @@ public class Modifiers {
|
|||
}
|
||||
|
||||
|
||||
Map<String, Integer> groupCounts = countGroups(lvl, affixTagGroup, modifierGroup, modifierCategory);
|
||||
Map<String, Integer> groupCounts = countGroups(lvl, modifierGroups, modifierCategory);
|
||||
|
||||
AtomicBoolean noWeightAttr = new AtomicBoolean(false);
|
||||
int totalWeight = modifierGroup.get(affixTagGroup).stream()
|
||||
int totalWeight = modifierGroups.stream()
|
||||
.mapToInt(modTierGroup -> getModifierTiers(lvl, modTierGroup, modifierCategory).stream().mapToInt(
|
||||
tier -> {
|
||||
if ((affixTagGroup == VaultGearTierConfig.ModifierAffixTagGroup.IMPLICIT
|
||||
|
|
@ -88,10 +111,8 @@ public class Modifiers {
|
|||
componentList.add(new TextComponent("Total Weight: " + totalWeight).withStyle(ChatFormatting.BOLD));
|
||||
}
|
||||
|
||||
|
||||
|
||||
Map<String, List<Component>> groupedModifiers = new HashMap<>();
|
||||
for (VaultGearTierConfig.ModifierTierGroup modifierTierGroup : modifierGroup.get(affixTagGroup)) {
|
||||
for (VaultGearTierConfig.ModifierTierGroup modifierTierGroup :modifierGroups) {
|
||||
ArrayList<VaultGearTierConfig.ModifierTier<?>> mTierList;
|
||||
|
||||
mTierList = getModifierTiers(lvl, modifierTierGroup, modifierCategory);
|
||||
|
|
@ -103,7 +124,6 @@ public class Modifiers {
|
|||
|
||||
MutableComponent modComp = getModifierComponent(VaultGearAttributeRegistry.getAttribute(modifierTierGroup.getAttribute()),mTierList);
|
||||
|
||||
// //if (implicit||base) && groupCounts == 0
|
||||
if (!(
|
||||
(affixTagGroup == VaultGearTierConfig.ModifierAffixTagGroup.BASE_ATTRIBUTES
|
||||
|| affixTagGroup == VaultGearTierConfig.ModifierAffixTagGroup.IMPLICIT
|
||||
|
|
@ -114,7 +134,7 @@ public class Modifiers {
|
|||
modComp.append(new TextComponent(" w"+weight).withStyle(ChatFormatting.GRAY));
|
||||
}
|
||||
|
||||
if (Config.SHOW_CHANCE.get() && shouldShowWeight(modifierCategory, affixTagGroup)) {
|
||||
if (Config.SHOW_CHANCE.get() && shouldShowWeight(modifierCategory, affixTagGroup) && totalWeight > 0) {
|
||||
modComp.append(new TextComponent(String.format(" %.2f%%", ((double) weight * 100 / totalWeight))).withStyle(ChatFormatting.GRAY));
|
||||
}
|
||||
}
|
||||
|
|
@ -147,11 +167,44 @@ public class Modifiers {
|
|||
return componentList;
|
||||
}
|
||||
|
||||
private static Map<String, Integer> countGroups(int lvl, VaultGearTierConfig.ModifierAffixTagGroup affixTagGroup,
|
||||
Map<VaultGearTierConfig.ModifierAffixTagGroup, VaultGearTierConfig.AttributeGroup> modifierGroup,
|
||||
ModifierCategory modifierCategory) {
|
||||
/**
|
||||
* Same as getAffixGroupComponents, but for unique gear without chances and groups
|
||||
*/
|
||||
public static List<Component> getUniqueAffixComponents(int lvl,Map.Entry<UniqueGearConfig.AffixTargetType, List<ResourceLocation>> modifierIdentifier, ModifierCategory modifierCategory) {
|
||||
|
||||
ArrayList<Component> componentList = new ArrayList<>();
|
||||
if (modifierIdentifier.getValue().isEmpty()) {
|
||||
return componentList; // no affix for this type
|
||||
}
|
||||
UniqueGearConfig.AffixTargetType affixTagGroup = modifierIdentifier.getKey();
|
||||
componentList.add(new TextComponent(affixTagGroup.toString().replace("_", " ")).withStyle(ChatFormatting.BOLD));
|
||||
for (ResourceLocation modifier : modifierIdentifier.getValue()) {
|
||||
VaultGearTierConfig.ModifierTierGroup modifierTierGroup = ModConfigs.VAULT_GEAR_CONFIG.get(VaultGearTierConfig.UNIQUE_ITEM).getTierGroup(modifier);
|
||||
if (modifierTierGroup == null) {
|
||||
continue;
|
||||
}
|
||||
ArrayList<VaultGearTierConfig.ModifierTier<?>> mTierList;
|
||||
mTierList = getModifierTiers(lvl, modifierTierGroup, modifierCategory);
|
||||
if (mTierList.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
MutableComponent modComp = getModifierComponent(VaultGearAttributeRegistry.getAttribute(modifierTierGroup.getAttribute()),mTierList);
|
||||
MutableComponent full = new TextComponent(" ");
|
||||
full.append(modComp);
|
||||
componentList.add(full);
|
||||
}
|
||||
|
||||
if (componentList.size() == 1) { // only header
|
||||
return new ArrayList<>(); // no affixes for this type (all tiers are unobtainable)
|
||||
}
|
||||
|
||||
componentList.add(TextComponent.EMPTY);
|
||||
return componentList;
|
||||
}
|
||||
|
||||
private static Map<String, Integer> countGroups(int lvl, VaultGearTierConfig.AttributeGroup modifierTierGroups, ModifierCategory modifierCategory) {
|
||||
Map<String, Integer> groupCounts = new HashMap<>();
|
||||
for (VaultGearTierConfig.ModifierTierGroup modifierTierGroup : modifierGroup.get(affixTagGroup)) {
|
||||
for (VaultGearTierConfig.ModifierTierGroup modifierTierGroup : modifierTierGroups) {
|
||||
ArrayList<VaultGearTierConfig.ModifierTier<?>> mTierList;
|
||||
mTierList = getModifierTiers(lvl, modifierTierGroup, modifierCategory);
|
||||
if (mTierList.isEmpty()) {
|
||||
|
|
@ -163,8 +216,7 @@ public class Modifiers {
|
|||
return groupCounts;
|
||||
}
|
||||
|
||||
public static ArrayList<VaultGearTierConfig.ModifierTier<?>> getModifierTiers(int lvl,
|
||||
VaultGearTierConfig.ModifierTierGroup modifierTierGroup, ModifierCategory modifierCategory) {
|
||||
public static ArrayList<VaultGearTierConfig.ModifierTier<?>> getModifierTiers(int lvl, VaultGearTierConfig.ModifierTierGroup modifierTierGroup, ModifierCategory modifierCategory) {
|
||||
|
||||
if (modifierCategory == ModifierCategory.NORMAL) {
|
||||
return getNormalModifierTiers(lvl, modifierTierGroup);
|
||||
|
|
@ -224,6 +276,10 @@ public class Modifiers {
|
|||
|
||||
var minConfigDisplay = atrGenerator.getConfigDisplay(atr.getReader(), minConfig);
|
||||
|
||||
if (minConfig instanceof SpecialAbilityGearAttribute.SpecialAbilityTierConfig<?,?,?> minConfigSpecial) {
|
||||
return getSpecialAbilityAttributeComponent(modifierTiers, minConfigSpecial);
|
||||
}
|
||||
|
||||
MutableComponent res = null;
|
||||
if (modifierTiers.size() > 1) {
|
||||
res = rangeComponent(atrName, atr, atrGenerator, minConfig, maxConfig);
|
||||
|
|
@ -240,11 +296,43 @@ public class Modifiers {
|
|||
if (minConfig instanceof EffectGearAttribute.Config ) {
|
||||
return minConfigDisplay;
|
||||
}
|
||||
|
||||
if (minConfig instanceof AbilityAreaOfEffectPercentAttribute.Config minConfigA) {
|
||||
return getAbilityAoePercentageComponent(atr, minConfigA, minConfigA);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
return new TextComponent("ERR - NULL DISPLAY " + atrName);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked") // this thing is insane
|
||||
private static @NotNull MutableComponent getSpecialAbilityAttributeComponent(
|
||||
ArrayList<VaultGearTierConfig.ModifierTier<?>> modifierTiers,
|
||||
SpecialAbilityGearAttribute.SpecialAbilityTierConfig<?, ?, ?> minConfigSpecial) {
|
||||
var modification = minConfigSpecial.getModification();
|
||||
if (modification instanceof FrostNovaVulnerabilityModification frostNovaVulnerabilityModification) {
|
||||
var minToMaxComponent = new TextComponent("<TODO>");
|
||||
return (new TextComponent("Frost Nova also applies Level ").append(minToMaxComponent)
|
||||
.append(" Vulnerability"));
|
||||
}
|
||||
if (modification instanceof EntropyPoisonModification entropyPoisonModification) {
|
||||
var tiers = (List<SpecialAbilityGearAttribute.SpecialAbilityTierConfig<SpecialAbilityModification<IntRangeConfig, IntValue>, 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;
|
||||
}
|
||||
var 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)));
|
||||
}
|
||||
|
||||
/**
|
||||
* This method handles combining multiple configs into a single component
|
||||
* VH doesn't have method for this, so we need to do it manually
|
||||
|
|
@ -277,20 +365,60 @@ public class Modifiers {
|
|||
return getCloudRangeComponent(minConfigDisplay, maxConfigDisplay, atr);
|
||||
}
|
||||
|
||||
if ((minConfig instanceof AbilityAreaOfEffectPercentAttribute.Config minConfigA) && (maxConfig instanceof AbilityAreaOfEffectPercentAttribute.Config maxConfigA)) {
|
||||
return getAbilityAoePercentageComponent(atr, minConfigA, maxConfigA);
|
||||
}
|
||||
|
||||
if (minConfig instanceof EffectGearAttribute.Config minEffectConfig
|
||||
&& maxConfig instanceof EffectGearAttribute.Config
|
||||
&& maxConfigDisplay != null) {
|
||||
var effectStr = ((EffectConfigAccessor)minEffectConfig).getAmplifier() + "-" +
|
||||
maxConfigDisplay.getString();
|
||||
return new TextComponent(effectStr).withStyle(atr.getReader().getColoredTextStyle());
|
||||
|
||||
}
|
||||
|
||||
if (atrName.equals("the_vault:effect_cloud")){
|
||||
return new TextComponent("Special ability modification");
|
||||
}
|
||||
|
||||
if (res != null) {
|
||||
return atr.getReader().formatConfigDisplay(LogicalSide.CLIENT, res);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
private static <T> @NotNull MutableComponent getAbilityAoePercentageComponent(VaultGearAttribute<T> atr,
|
||||
AbilityAreaOfEffectPercentAttribute.Config minConfigA,
|
||||
AbilityAreaOfEffectPercentAttribute.Config maxConfigA) {
|
||||
float min = minConfigA.getMin();
|
||||
float max = maxConfigA.generateMaximumValue();
|
||||
|
||||
VaultGearModifierReader<T> reader = atr.getReader();
|
||||
MutableComponent minValueDisplay = new TextComponent(new DecimalFormat("0.#").format(Math.abs(min * 100.0F)) + "%");
|
||||
MutableComponent maxValueDisplay = new TextComponent(new DecimalFormat("0.#").format(Math.abs(max * 100.0F)) + "%");
|
||||
boolean positive = min > 0;
|
||||
MutableComponent areaCmp = new TextComponent("Area Of Effect").withStyle(Style.EMPTY.withColor(ModConfigs.COLORS.getColor("areaOfEffect")));
|
||||
String cdInfo;
|
||||
if (positive) {
|
||||
cdInfo = " more ";
|
||||
} else {
|
||||
cdInfo = " less ";
|
||||
}
|
||||
|
||||
return new TextComponent("")
|
||||
.append(VaultGearModifier.AffixType.IMPLICIT.getAffixPrefixComponent(true)
|
||||
.withStyle(Style.EMPTY.withColor(6082075)))
|
||||
.append(minValueDisplay.withStyle(Style.EMPTY.withColor(6082075)))
|
||||
.append(new TextComponent("-").withStyle(Style.EMPTY.withColor(6082075)))
|
||||
.append(maxValueDisplay.withStyle(Style.EMPTY.withColor(6082075)))
|
||||
.append(cdInfo)
|
||||
.append(areaCmp)
|
||||
.append(" of ")
|
||||
.append(
|
||||
((AbilityFloatValueAttributeReaderInvoker) reader).invokeFormatAbilityName(minConfigA.getAbilityKey()))
|
||||
.setStyle(reader.getColoredTextStyle());
|
||||
}
|
||||
|
||||
private static MutableComponent getCloudRangeComponent(MutableComponent minConfigDisplay, MutableComponent maxConfigDisplay, VaultGearAttribute<?> atr) {
|
||||
// <Effect> [<LVL>] Cloud [when Hit]
|
||||
// Poison Cloud
|
||||
|
|
|
|||
|
|
@ -0,0 +1,12 @@
|
|||
package com.radimous.vhatcaniroll.mixin;
|
||||
|
||||
import iskallia.vault.gear.attribute.ability.AbilityFloatValueAttribute;
|
||||
import net.minecraft.network.chat.MutableComponent;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.gen.Invoker;
|
||||
|
||||
@Mixin(AbilityFloatValueAttribute.Reader.class)
|
||||
public interface AbilityFloatValueAttributeReaderInvoker {
|
||||
@Invoker
|
||||
MutableComponent invokeFormatAbilityName(String abilityKey);
|
||||
}
|
||||
|
|
@ -1,11 +1,14 @@
|
|||
package com.radimous.vhatcaniroll.ui;
|
||||
|
||||
import com.radimous.vhatcaniroll.Config;
|
||||
import com.radimous.vhatcaniroll.logic.ModifierCategory;
|
||||
import com.radimous.vhatcaniroll.logic.Modifiers;
|
||||
import com.radimous.vhatcaniroll.mixin.UniqueGearConfigAccessor;
|
||||
import com.radimous.vhatcaniroll.mixin.VaultGearTierConfigAccessor;
|
||||
import iskallia.vault.client.gui.framework.ScreenTextures;
|
||||
import iskallia.vault.client.gui.framework.element.FakeItemSlotElement;
|
||||
import iskallia.vault.client.gui.framework.element.LabelElement;
|
||||
import iskallia.vault.client.gui.framework.element.NineSliceElement;
|
||||
import iskallia.vault.client.gui.framework.element.VerticalScrollClipContainer;
|
||||
import iskallia.vault.client.gui.framework.spatial.Padding;
|
||||
import iskallia.vault.client.gui.framework.spatial.Spatials;
|
||||
|
|
@ -13,33 +16,24 @@ import iskallia.vault.client.gui.framework.spatial.spi.ISpatial;
|
|||
import iskallia.vault.client.gui.framework.text.LabelTextStyle;
|
||||
import iskallia.vault.config.UniqueGearConfig;
|
||||
import iskallia.vault.config.gear.VaultGearTierConfig;
|
||||
import iskallia.vault.gear.attribute.VaultGearAttributeRegistry;
|
||||
import iskallia.vault.gear.VaultGearState;
|
||||
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.TextComponent;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
public class UniqueGearListContainer extends VerticalScrollClipContainer<UniqueGearListContainer> implements InnerGearScreen {
|
||||
|
||||
public UniqueGearListContainer(ISpatial spatial, int lvl, ModifierCategory modifierCategory, ItemStack gearPiece) {
|
||||
super(spatial, Padding.ZERO, ScreenTextures.INSET_BLACK_BACKGROUND);
|
||||
int labelX = 9;
|
||||
int labelY = 20;
|
||||
|
||||
|
||||
// Label for the item name and level (GOLD if legendary, AQUA if greater, WHITE if common)
|
||||
LabelElement<?> itemName = new LabelElement<>(
|
||||
Spatials.positionXY(labelX, 5).width(this.innerWidth() - labelX).height(15), new TextComponent(
|
||||
gearPiece.getItem().toString().toUpperCase() + " - LVL " + lvl)
|
||||
.withStyle(ChatFormatting.UNDERLINE).withStyle(modifierCategory.getStyle()), LabelTextStyle.defaultStyle()
|
||||
);
|
||||
this.addElement(itemName);
|
||||
int labelY = 9;
|
||||
|
||||
Map<ResourceLocation, UniqueGearConfig.Entry> uniqueRegistry = ((UniqueGearConfigAccessor) ModConfigs.UNIQUE_GEAR).getRegistry();
|
||||
var regName = gearPiece.getItem().getRegistryName();
|
||||
|
|
@ -51,94 +45,67 @@ public class UniqueGearListContainer extends VerticalScrollClipContainer<UniqueG
|
|||
var goodEntries = uniqueRegistry.entrySet().stream().filter(entry -> entry.getValue().getModel() != null && entry.getValue().getModel().toString().contains(regPath)).toList();
|
||||
List<Map.Entry<ResourceLocation, UniqueGearConfig.Entry>> 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);
|
||||
if (uniqueConfig1 == null) {
|
||||
return;
|
||||
}
|
||||
for (var entry : goodEntries) {
|
||||
var value = entry.getValue();
|
||||
ResourceLocation id = value.getId() == null ? new ResourceLocation("minecraft", "missing") : value.getId();
|
||||
String name = value.getName() == null ? "missing" : value.getName();
|
||||
ResourceLocation model = value.getModel() == null ? new ResourceLocation("minecraft", "missing") : value.getModel();
|
||||
|
||||
List<String> modifierTags = value.getModifierTags() == null ? List.of("missing") : value.getModifierTags();
|
||||
Map<UniqueGearConfig.AffixTargetType, List<ResourceLocation>> modifierIdentifiers = value.getModifierIdentifiers() == null ? Map.of(UniqueGearConfig.AffixTargetType.PREFIX, List.of(new ResourceLocation("minecraft", "missing"))) : value.getModifierIdentifiers();
|
||||
|
||||
LabelElement<?> idLabel = new LabelElement<>(
|
||||
Spatials.positionXY(labelX, labelY).width(this.innerWidth() - labelX).height(15),
|
||||
new TextComponent(
|
||||
"ID: " + id.toString()), LabelTextStyle.defaultStyle()
|
||||
);
|
||||
this.addElement(idLabel);
|
||||
labelY += 10;
|
||||
LabelElement<?> nameLabel = new LabelElement<>(
|
||||
Spatials.positionXY(labelX, labelY).width(this.innerWidth() - labelX).height(15),
|
||||
new TextComponent(
|
||||
"Name: " + name), LabelTextStyle.defaultStyle()
|
||||
);
|
||||
this.addElement(nameLabel);
|
||||
labelY += 10;
|
||||
LabelElement<?> modelLabel = new LabelElement<>(
|
||||
Spatials.positionXY(labelX, labelY).width(this.innerWidth() - labelX).height(15),
|
||||
new TextComponent(
|
||||
"Model: " + model.toString()), LabelTextStyle.defaultStyle()
|
||||
);
|
||||
this.addElement(modelLabel);
|
||||
labelY += 10;
|
||||
LabelElement<?> modifierTagsLabel = new LabelElement<>(
|
||||
Spatials.positionXY(labelX, labelY).width(this.innerWidth() - labelX).height(15),
|
||||
new TextComponent(
|
||||
"Modifier Tags: " + modifierTags.toString()), LabelTextStyle.defaultStyle()
|
||||
);
|
||||
this.addElement(modifierTagsLabel);
|
||||
labelY += 10;
|
||||
for (Map.Entry<UniqueGearConfig.AffixTargetType, List<ResourceLocation>> modifierIdentifier : modifierIdentifiers.entrySet()) {
|
||||
if (modifierIdentifier.getValue().isEmpty()) {
|
||||
String name = value.getName();
|
||||
if (name == null) {
|
||||
continue;
|
||||
}
|
||||
this.addElement(new LabelElement<>(
|
||||
Spatials.positionXY(labelX, labelY).width(this.innerWidth() - labelX).height(15),
|
||||
new TextComponent(modifierIdentifier.getKey().toString()), LabelTextStyle.defaultStyle()));
|
||||
labelY += 10;
|
||||
for (ResourceLocation modifier : modifierIdentifier.getValue()) {
|
||||
Map<VaultGearTierConfig.ModifierAffixTagGroup, VaultGearTierConfig.AttributeGroup> ff = uniqueConfig1.getModifierGroup();
|
||||
List<VaultGearTierConfig.AttributeGroup> kk = new ArrayList<>();
|
||||
for (Map.Entry<VaultGearTierConfig.ModifierAffixTagGroup, VaultGearTierConfig.AttributeGroup> f : ff.entrySet()) {
|
||||
kk.add(f.getValue());
|
||||
ResourceLocation model = value.getModel();
|
||||
if (model == null) {
|
||||
continue;
|
||||
}
|
||||
var someModTierGroup = kk.get(0).get(0);
|
||||
var mTierList = Modifiers.getModifierTiers(lvl,someModTierGroup , modifierCategory);
|
||||
var mc = Modifiers.getModifierComponent(VaultGearAttributeRegistry.getAttribute(modifier),mTierList);
|
||||
|
||||
//TODO: figure this out
|
||||
// LabelElement<?> mcl = new LabelElement<>(
|
||||
// Spatials.positionXY(labelX, labelY).width(this.innerWidth() - labelX).height(15),
|
||||
// mc, LabelTextStyle.defaultStyle());
|
||||
// this.addElement(mcl);
|
||||
labelY += 10;
|
||||
LabelElement<?> modifierIdentifierLabel = new LabelElement<>(
|
||||
Spatials.positionXY(labelX, labelY).width(this.innerWidth() - labelX).height(15),
|
||||
new TextComponent(" " + modifier.toString()), LabelTextStyle.defaultStyle());
|
||||
this.addElement(modifierIdentifierLabel);
|
||||
labelY += 10;
|
||||
Map<UniqueGearConfig.AffixTargetType, List<ResourceLocation>> modifierIdentifiers = value.getModifierIdentifiers();
|
||||
if (modifierIdentifiers == null) {
|
||||
continue;
|
||||
}
|
||||
labelY += 10;
|
||||
}
|
||||
labelY += 10;
|
||||
int iconHeight = labelY;
|
||||
|
||||
this.addElement(new LabelElement<>(
|
||||
labelY += 5;
|
||||
LabelElement<?> nameLabel = new LabelElement<>(
|
||||
Spatials.positionXY(labelX + 20, labelY).width(this.innerWidth() - labelX).height(15),
|
||||
new TextComponent(name), LabelTextStyle.defaultStyle()
|
||||
);
|
||||
this.addElement(nameLabel);
|
||||
labelY += 20;
|
||||
|
||||
ItemStack displayStack = new ItemStack(gearPiece.getItem());
|
||||
VaultGearData gearData = VaultGearData.read(displayStack);
|
||||
gearData.setState(VaultGearState.IDENTIFIED);
|
||||
gearData.createOrReplaceAttributeValue(ModGearAttributes.GEAR_MODEL, model);
|
||||
gearData.write(displayStack);
|
||||
this.addElement(new FakeItemSlotElement<>(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) {
|
||||
LabelElement<?> mcl = new LabelElement<>(
|
||||
Spatials.positionXY(labelX, labelY).width(this.innerWidth() - labelX).height(15),
|
||||
new TextComponent("----------------------------------------"), LabelTextStyle.defaultStyle()));
|
||||
mc, LabelTextStyle.defaultStyle());
|
||||
this.addElement(mcl);
|
||||
labelY += 10;
|
||||
}
|
||||
this.addElement(new NineSliceElement<>(
|
||||
Spatials.positionXY(0, labelY).width(this.innerWidth()).height(3),
|
||||
ScreenTextures.BUTTON_EMPTY));
|
||||
labelY += 10;
|
||||
}
|
||||
if (Config.DEBUG_UNIQUE_GEAR.get()) {
|
||||
this.addElement(new LabelElement<>(
|
||||
Spatials.positionXY(labelX, labelY).width(this.innerWidth() - labelX).height(15),
|
||||
new TextComponent("BAD ENTRIES:").withStyle(ChatFormatting.RED), LabelTextStyle.defaultStyle()));
|
||||
new TextComponent("[DEBUG] BAD ENTRIES:").withStyle(ChatFormatting.RED), LabelTextStyle.defaultStyle()));
|
||||
labelY += 10;
|
||||
for (var 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()));
|
||||
new TextComponent("ID: " + entry.getKey().toString()).withStyle(ChatFormatting.RED),
|
||||
LabelTextStyle.defaultStyle()));
|
||||
labelY += 10;
|
||||
var vv = entry.getValue();
|
||||
if (vv == null) {
|
||||
|
|
@ -146,10 +113,12 @@ public class UniqueGearListContainer extends VerticalScrollClipContainer<UniqueG
|
|||
}
|
||||
this.addElement(new LabelElement<>(
|
||||
Spatials.positionXY(labelX, labelY).width(this.innerWidth() - labelX).height(15),
|
||||
new TextComponent("Model: " + vv.getModel()).withStyle(ChatFormatting.RED), LabelTextStyle.defaultStyle()));
|
||||
new TextComponent("Model: " + vv.getModel()).withStyle(ChatFormatting.RED),
|
||||
LabelTextStyle.defaultStyle()));
|
||||
labelY += 16;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public float getScroll() {
|
||||
return this.verticalScrollBarElement.getValue();
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
{
|
||||
"vhatcaniroll.screen.title.random": "Random Modifiers",
|
||||
"vhatcaniroll.screen.title.crafted": "Crafted Modifiers",
|
||||
"vhatcaniroll.screen.title.unique": "Unique Gear",
|
||||
"vhatcaniroll.screen.title.transmogs": "Transmogs",
|
||||
"vhatcaniroll.openmodscreen": "Open VHat can I roll? screen",
|
||||
"key.categories.vhatcaniroll": "VHat can I roll?"
|
||||
|
|
|
|||
|
|
@ -7,10 +7,11 @@
|
|||
"mixins": [
|
||||
],
|
||||
"client": [
|
||||
"StatisticsElementContainerScreenMixin",
|
||||
"VaultGearTierConfigAccessor",
|
||||
"EffectConfigAccessor",
|
||||
"UniqueGearConfigAccessor"
|
||||
"StatisticsElementContainerScreenMixin",
|
||||
"UniqueGearConfigAccessor",
|
||||
"VaultGearTierConfigAccessor",
|
||||
"AbilityFloatValueAttributeReaderInvoker"
|
||||
],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue