super secret new feature

This commit is contained in:
alterNERDtive 2023-07-25 01:06:36 +02:00
parent 464a941ad0
commit 87d7cfb0ca
Signed by: alterNERDtive
GPG key ID: 547787A4FE6533F1
3 changed files with 85 additions and 0 deletions

View file

@ -17,6 +17,9 @@
*/ */
package tv.alterNERD.VaultModTweaks; package tv.alterNERD.VaultModTweaks;
import java.util.ArrayList;
import java.util.List;
import net.minecraftforge.common.ForgeConfigSpec; import net.minecraftforge.common.ForgeConfigSpec;
import net.minecraftforge.common.ForgeConfigSpec.BooleanValue; import net.minecraftforge.common.ForgeConfigSpec.BooleanValue;
import net.minecraftforge.common.ForgeConfigSpec.DoubleValue; import net.minecraftforge.common.ForgeConfigSpec.DoubleValue;
@ -60,6 +63,9 @@ public class Configuration {
public static ConfigValue<Integer> JUNKMGMT_T3; public static ConfigValue<Integer> JUNKMGMT_T3;
public static ConfigValue<Integer> JUNKMGMT_T4; public static ConfigValue<Integer> JUNKMGMT_T4;
public static ConfigValue<List<? extends String>> GOBLINS;
public static ConfigValue<List<? extends String>> CHAMPIONS;
static { static {
Builder builder = new Builder(); Builder builder = new Builder();
@ -142,6 +148,14 @@ public class Configuration {
FRAGMENT_WEIGHT_FIX = builder.define("fragmentFix", true); FRAGMENT_WEIGHT_FIX = builder.define("fragmentFix", true);
builder.pop(); builder.pop();
// Transmogs
builder.push("Transmogs");
GOBLINS = builder.comment("Additional “Goblin” tier Patrons")
.defineList("goblins", new ArrayList<String>(), entry -> true);
CHAMPIONS = builder.comment("Additional “Champion” tier Patrons")
.defineList("champions", new ArrayList<String>(), entry -> true);
builder.pop();
CONFIG = builder.build(); CONFIG = builder.build();
builder = new Builder(); builder = new Builder();

View file

@ -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 <https://www.gnu.org/licenses/>.
*/
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<Long> CHAMPION_LIST;
@Shadow(remap = false)
private static Set<Long> 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<ResourceLocation> 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));
}
}

View file

@ -11,6 +11,7 @@
"MixinPlayerResearchesData", "MixinPlayerResearchesData",
"MixinStageManager", "MixinStageManager",
"MixinToolType", "MixinToolType",
"MixinTransmogTableBlock",
"MixinUnidentifiedRelicFragmentsConfig", "MixinUnidentifiedRelicFragmentsConfig",
"MixinVaultAltarBlock", "MixinVaultAltarBlock",
"MixinVaultAltarConfig", "MixinVaultAltarConfig",