diff --git a/src/main/java/tv/alterNERD/VaultModTweaks/Configuration.java b/src/main/java/tv/alterNERD/VaultModTweaks/Configuration.java index 8c12c76..878038c 100644 --- a/src/main/java/tv/alterNERD/VaultModTweaks/Configuration.java +++ b/src/main/java/tv/alterNERD/VaultModTweaks/Configuration.java @@ -17,6 +17,9 @@ */ package tv.alterNERD.VaultModTweaks; +import java.util.ArrayList; +import java.util.List; + import net.minecraftforge.common.ForgeConfigSpec; import net.minecraftforge.common.ForgeConfigSpec.BooleanValue; import net.minecraftforge.common.ForgeConfigSpec.DoubleValue; @@ -60,6 +63,9 @@ public class Configuration { public static ConfigValue JUNKMGMT_T3; public static ConfigValue JUNKMGMT_T4; + public static ConfigValue> GOBLINS; + public static ConfigValue> CHAMPIONS; + static { Builder builder = new Builder(); @@ -142,6 +148,14 @@ public class Configuration { FRAGMENT_WEIGHT_FIX = builder.define("fragmentFix", true); builder.pop(); + // Transmogs + builder.push("Transmogs"); + GOBLINS = builder.comment("Additional “Goblin” tier Patrons") + .defineList("goblins", new ArrayList(), entry -> true); + CHAMPIONS = builder.comment("Additional “Champion” tier Patrons") + .defineList("champions", new ArrayList(), entry -> true); + builder.pop(); + CONFIG = builder.build(); builder = new Builder(); diff --git a/src/main/java/tv/alterNERD/VaultModTweaks/integration/mixin/MixinTransmogTableBlock.java b/src/main/java/tv/alterNERD/VaultModTweaks/integration/mixin/MixinTransmogTableBlock.java new file mode 100644 index 0000000..b15bc79 --- /dev/null +++ b/src/main/java/tv/alterNERD/VaultModTweaks/integration/mixin/MixinTransmogTableBlock.java @@ -0,0 +1,70 @@ +/** + * Copyright 2023 alterNERDtive. + * + * This file is part of Vault Mod Tweaks. + * + * Vault Mod Tweaks is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Vault Mod Tweaks is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * You should have received a copy of the GNU General Public License + * along with Vault Mod Tweaks. If not, see . + */ +package tv.alterNERD.VaultModTweaks.integration.mixin; + +import java.util.Collection; +import java.util.Set; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Overwrite; +import org.spongepowered.asm.mixin.Shadow; +import iskallia.vault.block.TransmogTableBlock; +import iskallia.vault.dynamodel.model.armor.ArmorPieceModel; +import iskallia.vault.init.ModDynamicModels; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.player.Player; +import tv.alterNERD.VaultModTweaks.Configuration; +import tv.alterNERD.VaultModTweaks.VaultModTweaks; + +/** + * Changes the {@link iskallia.vault.block.TransmogTableBlock} class for + * managing the Transmog Table. + * + * Specifically, unlocks Patreon transmogs. + */ +@Mixin(TransmogTableBlock.class) +public abstract class MixinTransmogTableBlock { + @Shadow(remap = false) + private static Set CHAMPION_LIST; + + @Shadow(remap = false) + private static Set GOBLIN_LIST; + + /*** + * Injects some new Goblin / Champion tier patrons into the transmogajigga + * thing. + * + * @param player + * @param discoveredModelIds + * @param modelId + */ + @Overwrite(remap = false) + public static boolean canTransmogModel(Player player, Collection discoveredModelIds, ResourceLocation modelId) { + return ModDynamicModels.Armor.PIECE_REGISTRY.get(modelId).map(ArmorPieceModel::getArmorModel).map(armorModel -> { + VaultModTweaks.LOGGER.debug(player.getName().getString()); + long id = player.getUUID().getMostSignificantBits() ^ player.getUUID().getLeastSignificantBits(); + String name = player.getName().getString(); + if (armorModel.equals(ModDynamicModels.Armor.CHAMPION)) { + return CHAMPION_LIST.contains(id) || Configuration.CHAMPIONS.get().contains(name); + } + if (armorModel.equals(ModDynamicModels.Armor.GOBLIN)) { + return GOBLIN_LIST.contains(id) || CHAMPION_LIST.contains(id) || Configuration.GOBLINS.get().contains(name) || Configuration.CHAMPIONS.get().contains(name); + } + return null; + }).orElse(discoveredModelIds.contains(modelId)); + } +} diff --git a/src/main/resources/mixins.the_vault_tweaks.json b/src/main/resources/mixins.the_vault_tweaks.json index e2c36b5..adaac69 100644 --- a/src/main/resources/mixins.the_vault_tweaks.json +++ b/src/main/resources/mixins.the_vault_tweaks.json @@ -11,6 +11,7 @@ "MixinPlayerResearchesData", "MixinStageManager", "MixinToolType", + "MixinTransmogTableBlock", "MixinUnidentifiedRelicFragmentsConfig", "MixinVaultAltarBlock", "MixinVaultAltarConfig",