refactoring ’n’ javadoc ’n’ i18n ’n’ shit

This commit is contained in:
alterNERDtive 2023-06-20 22:55:07 +02:00
parent fc6a8ae80e
commit ced6923a12
Signed by: alterNERDtive
GPG key ID: 547787A4FE6533F1
20 changed files with 578 additions and 53 deletions

View file

@ -1,10 +1,14 @@
# devel
* Lots of refactoring work behind the scenes.
* Added i18n support and lots of logging.
* Fixed AE2 fake player in existing worlds not getting new research when it is added to the pack.
# 3.10.1.1 (2023-06-20)
* fixed AE2 auto crafting needing NBT editing
* removed colour handler fix; install <https://github.com/radimous/FastVaultGear> instead
* Fixed AE2 auto crafting needing NBT editing.
* Removed colour handler fix; install <https://github.com/radimous/FastVaultGear> instead.
# 3.10.1.0 (2023-06-19)
initial release for The Vault 3.10.1
Initial release for The Vault 3.10.1.

View file

@ -1,21 +1,16 @@
# Vault Mod Tweaks
This little companion mod for the Vault mod of the Vault Hunters mod pack fixes
a few bugs and brings a couple QoL and balance changes.
This little companion mod for the Vault mod of the Vault Hunters mod pack fixes a few bugs and brings a couple QoL and balance changes.
All of these can be individually disabled in client & server config files.
If you do not disable the changes that affect expertises, I recommend a full
expertise reset after installing this mod.
If you do not disable the changes that affect expertises, I recommend a full expertise reset after installing this mod.
## Fixes
* Removed the “Andersite” “joke”.
* ~~Removed call to a colour handling event that is called several thousand times
per second; gives a noticeable performance boost, but turns jewels and
unidentified items white~~ use <https://github.com/radimous/FastVaultGear>
* Fake players work with research again (e.g. Routers + Botany Pots, AE2 auto
crafting)
* ~~Removed call to a colour handling event that is called several thousand times per second; gives a noticeable performance boost, but turns jewels and unidentified items white~~ use <https://github.com/radimous/FastVaultGear>
* Fake players work with research again (e.g. Routers + Botany Pots, AE2 auto crafting)
* Fake players can put Vault Rocks on the Altar again
* Relic fragments \#5 are now equally as likely to drop as the others
* AE2 auto crafting no longer requires manually giving its fake player all research
@ -25,7 +20,6 @@ expertise reset after installing this mod.
* Vault Enchanters offer Fortune 5, Fortunate expertise removed
* Jewel cutting has a base 25% chance of failure, Jeweler expertise removed
* Budding Crystal (Sky Vaults only) growth time reduced
* Altar infusion time (time between redstone signal and the crystal popping off)
reduced
* Vault Charm upgrades (Junk Management) tier 1 and 2 buffed
* Altar infusion time (time between redstone signal and the crystal popping off) reduced
* Vault Junk Upgrades (Junk Management) tier 1 and 2 buffed
* Jewel cutting buffed from 110 size reduction to 310

View file

@ -35,7 +35,7 @@ versioning {
//saveOn "<task-name>"
}
version = '1.18.2-' + versioning.name + '.' + versioning.build
version = "1.18.2-${versioning.name}.${versioning.build}"
group = 'tv.alternerd.vault_tweaks' // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = 'the_vault-tweaks'
@ -161,12 +161,21 @@ repositories {
// ForgeGradle automatically adds the Forge maven and Maven Central for you
maven {
name "Cursemaven"
url "https://cursemaven.com"
content {
includeGroup "curse.maven"
}
}
maven {
name = "Modmaven"
url = uri("https://modmaven.dev/")
content {
includeGroup "appeng"
}
}
// If you have mod jar dependencies in ./libs, you can declare them as a repository like so:
//flatDir {
// dir 'libs'
@ -182,6 +191,7 @@ dependencies {
annotationProcessor 'org.spongepowered:mixin:0.8.5:processor'
implementation fg.deobf('curse.maven:vault-hunters-official-mod-458203:4570130')
implementation fg.deobf('appeng:appliedenergistics2-forge:11.7.4')
// Vault dependency
implementation fg.deobf("curse.maven:curios-309927:4418032")
@ -242,7 +252,26 @@ tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation
}
javadoc {
options.encoding = 'UTF-8'
}
mixin {
add sourceSets.main, 'mixins.the_vault_tweaks.refmap.json'
config 'mixins.the_vault_tweaks.json'
}
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
artifacts {
archives sourcesJar
archives javadocJar
}

View file

@ -1,3 +1,20 @@
/**
* 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;
import net.minecraftforge.common.ForgeConfigSpec;
@ -29,6 +46,8 @@ public class Configuration {
public static BooleanValue VAULTAR_ENABLED;
public static IntValue VAULTAR_INFUSION_TIME;
public static BooleanValue PORTAL_TEMPLATE_ENABLED;
public static BooleanValue FAKE_PLAYER_FIX;
public static BooleanValue ROUTER_VAULTAR_FIX;
public static BooleanValue FRAGMENT_WEIGHT_FIX;
@ -99,6 +118,12 @@ public class Configuration {
JUNKMGMT_T4 = builder.define("tier4Multiplier", 228);
builder.pop();
// Vault Portal
builder.push("VaultPortal");
builder.comment("Allow Template Frame Blocks extruded by Modular Routers Extruder Mk2 module as Vault Portal Frame blocks");
PORTAL_TEMPLATE_ENABLED = builder.define("allowTemplateFrames", true);
builder.pop();
// Bug fixes
builder.push("Fixes");
builder.comment("Fix fake player research (e.g. Router + Botany Pots interaction, AE2 auto crafting, …)");

View file

@ -1,3 +1,20 @@
/**
* 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;
import org.slf4j.Logger;
@ -13,7 +30,7 @@ import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
@Mod("the_vault_tweaks")
public class VaultModTweaks
{
private static final Logger LOGGER = LogUtils.getLogger();
public static final Logger LOGGER = LogUtils.getLogger();
public VaultModTweaks()
{

View file

@ -1,3 +1,20 @@
/**
* 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 org.spongepowered.asm.mixin.Mixin;
@ -6,7 +23,15 @@ import org.spongepowered.asm.mixin.Shadow;
import iskallia.vault.config.Config;
import iskallia.vault.config.CrystalBuddingConfig;
import tv.alterNERD.VaultModTweaks.Configuration;
import tv.alterNERD.VaultModTweaks.VaultModTweaks;
import tv.alterNERD.VaultModTweaks.util.I18n;
/**
* Changes the {@link iskallia.vault.config.CrystalBuddingConfig} class for
* managing the Budding Crystal configuration (Sky Vaults).
*
* Specifically, sets new values for min and max growth times.
*/
@Mixin(CrystalBuddingConfig.class)
public abstract class MixinCrystalBuddingConfig extends Config {
@Shadow(remap = false)
@ -15,10 +40,14 @@ public abstract class MixinCrystalBuddingConfig extends Config {
@Shadow(remap = false)
private float minSecondsBetweenGrowthUpdates;
/**
* Overrides the min and max growth times on loading the configuration file.
*/
@Override
protected void onLoad(Config oldConfigInstance) {
super.onLoad(oldConfigInstance);
if (Configuration.BUDDING_ENABLED.get()) {
VaultModTweaks.LOGGER.info(I18n.get("the_vault_tweaks.log.inject.buddingcrystal"));
this.maxSecondsBetweenGrowthUpdates = Configuration.BUDDING_MAX.get();
this.minSecondsBetweenGrowthUpdates = Configuration.BUDDING_MIN.get();
}

View file

@ -1,13 +1,42 @@
/**
* 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 org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import iskallia.vault.util.EnchantmentEntry;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.enchantment.Enchantment;
import tv.alterNERD.VaultModTweaks.Configuration;
import tv.alterNERD.VaultModTweaks.VaultModTweaks;
import tv.alterNERD.VaultModTweaks.util.I18n;
/**
* Changes the {@link iskallia.vault.util.EnchantmentEntry} class used by the
* Vault Enchanter.
*
* Specifically, allows for it to enchant Fortune V.
*/
@Mixin(EnchantmentEntry.class)
public abstract class MixinEnchantmentEntry
{
@ -16,23 +45,41 @@ public abstract class MixinEnchantmentEntry
@Shadow(remap = false)
private Enchantment enchantment;
@Overwrite(remap = false)
public int getLevel() {
/**
* Sets the level of the Fortune enchantment to 5.
*/
@Inject(
method = "<init>",
at = @At("RETURN"),
remap = false
)
private void initCallback(Enchantment enchantment, int level, CallbackInfo ci) {
if (Configuration.FORTUNE_ENABLED.get()) {
if (this.enchantment.getRegistryName().toString().equals("minecraft:fortune")) {
ResourceLocation registryName = this.enchantment.getRegistryName();
if (registryName != null && registryName.toString().equals("minecraft:fortune")) {
VaultModTweaks.LOGGER.info(I18n.get("the_vault_tweaks.log.inject.fortune.level", 5));
this.level = Configuration.FORTUNE_LEVEL.get();
}
}
return this.level;
}
@Overwrite(remap = false)
public boolean isValid() {
/**
* Makes sure that Fortune level 5 is considered a valid enchantment.
*/
@Inject(
method = "isValid()Z",
at = @At("RETURN"),
cancellable = true,
remap = false
)
private void isValidCallback(CallbackInfoReturnable<Boolean> ci) {
if (Configuration.FORTUNE_ENABLED.get()) {
if (this.enchantment.getRegistryName().toString().equals("minecraft:fortune") && this.level <= Configuration.FORTUNE_LEVEL.get()) {
return true;
ResourceLocation registryName = this.enchantment.getRegistryName();
if (registryName != null && registryName.toString().equals("minecraft:fortune")
&& this.level <= Configuration.FORTUNE_LEVEL.get()) {
VaultModTweaks.LOGGER.info(I18n.get("the_vault_tweaks.log.inject.fortune.valid"));
ci.setReturnValue(true);
}
}
return this.enchantment != null && this.level > 0 && this.level <= this.enchantment.getMaxLevel();
}
}

View file

@ -1,3 +1,20 @@
/**
* 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.HashMap;
@ -9,19 +26,33 @@ import iskallia.vault.config.Config;
import iskallia.vault.config.ExpertisesGUIConfig;
import iskallia.vault.config.entry.SkillStyle;
import tv.alterNERD.VaultModTweaks.Configuration;
import tv.alterNERD.VaultModTweaks.VaultModTweaks;
import tv.alterNERD.VaultModTweaks.util.I18n;
/**
* Changes the {@link iskallia.vault.config.ExpertisesGUIConfig} class for
* managing the configuration for the Expertises GUI.
*
* Specifically, it removes the Jeweler and Fortunate expertises.
*/
@Mixin(ExpertisesGUIConfig.class)
public abstract class MixinExpertisesGuiConfig extends Config {
@Shadow(remap = false)
private HashMap<String, SkillStyle> styles;
/**
* Removes the Jeweler and Fortunate expertises on loading the configuration
* file.
*/
@Override
protected void onLoad(Config oldConfigInstance) {
super.onLoad(oldConfigInstance);
if (Configuration.FORTUNE_ENABLED.get()) {
VaultModTweaks.LOGGER.info(I18n.get("the_vault_tweaks.log.inject.expertise.fortunate"));
this.styles.remove("Fortunate");
}
if (Configuration.JEWELER_ENABLED.get()) {
VaultModTweaks.LOGGER.info(I18n.get("the_vault_tweaks.log.inject.expertise.jeweler"));
this.styles.remove("Jeweler");
}
}

View file

@ -1,3 +1,20 @@
/**
* 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.HashMap;
@ -5,30 +22,55 @@ import java.util.Map;
import java.util.UUID;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import iskallia.vault.init.ModConfigs;
import iskallia.vault.research.ResearchTree;
import iskallia.vault.research.type.Research;
import iskallia.vault.world.data.PlayerResearchesData;
import tv.alterNERD.VaultModTweaks.Configuration;
import tv.alterNERD.VaultModTweaks.VaultModTweaks;
import tv.alterNERD.VaultModTweaks.util.I18n;
/**
* Changes the {@link iskallia.vault.world.data.PlayerResearchesData} class for
* managing the Research data.
*
* Specifically, it makes the fake player used by Applied Energistics for auto
* crafting have all researches available.
*/
@Mixin(PlayerResearchesData.class)
public class MixinPlayerResearchesData {
@Shadow(remap = false)
private final Map<UUID, ResearchTree> playerMap = new HashMap<UUID, ResearchTree>();
@Overwrite(remap = false)
public ResearchTree getResearches(UUID uuid) {
return this.playerMap.computeIfAbsent(uuid, id -> {
private boolean ae2ResearchInjected = false;
private static UUID ae2Uuid = UUID.fromString("41c82c87-7afb-4024-ba57-13d2c99cae77");
/**
* Generates a {@link iskallia.vault.research.ResearchTree} for the AE2 fake
* player with every research unlocked.
*/
@Inject(
method = "getResearches(Ljava/util/UUID;)Liskallia/vault/research/ResearchTree;",
at = @At("RETURN"),
cancellable = true,
remap = false
)
private void getResearchesCallback(UUID uuid, CallbackInfoReturnable<ResearchTree> ci) {
if (Configuration.FAKE_PLAYER_FIX.get() && uuid.equals(ae2Uuid) && !this.ae2ResearchInjected) {
VaultModTweaks.LOGGER.info(I18n.get("the_vault_tweaks.log.inject.ae2research"));
this.playerMap.remove(ae2Uuid);
ResearchTree tree = ResearchTree.empty();
if (Configuration.FAKE_PLAYER_FIX.get() && id.equals(UUID.fromString("41c82c87-7afb-4024-ba57-13d2c99cae77"))) {
for (Research research : ModConfigs.RESEARCHES.getAll()) {
tree.research(research);
}
for (Research research : ModConfigs.RESEARCHES.getAll()) {
tree.research(research);
}
return tree;
});
this.playerMap.put(ae2Uuid, tree);
this.ae2ResearchInjected = true;
ci.setReturnValue(tree);
}
}
}

View file

@ -1,3 +1,20 @@
/**
* 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 org.spongepowered.asm.mixin.Mixin;
@ -12,7 +29,16 @@ import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.entity.player.Player;
import net.minecraftforge.common.util.FakePlayer;
import tv.alterNERD.VaultModTweaks.Configuration;
import tv.alterNERD.VaultModTweaks.VaultModTweaks;
import tv.alterNERD.VaultModTweaks.util.I18n;
/**
* Changes the {@link iskallia.vault.research.StageManager} class for managing
* everything related to research locks.
*
* Specifically, it actually returns a valid research tree for fake players
* (e.g. Modular routers, AE2 Molecular Assemblers).
*/
@Mixin(StageManager.class)
public abstract class MixinStageManager {
@Shadow(remap = false)
@ -28,7 +54,7 @@ public abstract class MixinStageManager {
remap = false
)
private static ResearchTree overrideOnItemCrafted(Player player) {
return overrideGetResearchTree(player);
return getResearchTreeOverride(player);
}
@Redirect(
@ -41,7 +67,7 @@ public abstract class MixinStageManager {
remap = false
)
private static ResearchTree overrideOnBlockInteraction(Player player) {
return overrideGetResearchTree(player);
return getResearchTreeOverride(player);
}
@Redirect(
@ -54,7 +80,7 @@ public abstract class MixinStageManager {
remap = false
)
private static ResearchTree overrideOnItemUse(Player player) {
return overrideGetResearchTree(player);
return getResearchTreeOverride(player);
}
@Redirect(
@ -67,11 +93,18 @@ public abstract class MixinStageManager {
remap = false
)
private static ResearchTree overrideOnEntityInteraction(Player player) {
return overrideGetResearchTree(player);
return getResearchTreeOverride(player);
}
private static ResearchTree overrideGetResearchTree(Player player) {
/**
* Actually returns a working {@link iskallia.vault.research.ResearchTree}
* for fake players.
* @param player
* @return
*/
private static ResearchTree getResearchTreeOverride(Player player) {
if (!Configuration.FAKE_PLAYER_FIX.get() && player instanceof FakePlayer) {
VaultModTweaks.LOGGER.info(I18n.get("the_vault_tweaks.log.inject.research.fakeplayerfix", player.getUUID()));
return ResearchTree.empty();
}
if (player.level.isClientSide) {

View file

@ -1,3 +1,20 @@
/**
* 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 org.spongepowered.asm.mixin.Mixin;
@ -8,16 +25,31 @@ import iskallia.vault.config.UnidentifiedRelicFragmentsConfig;
import iskallia.vault.util.data.WeightedList;
import net.minecraft.resources.ResourceLocation;
import tv.alterNERD.VaultModTweaks.Configuration;
import tv.alterNERD.VaultModTweaks.VaultModTweaks;
import tv.alterNERD.VaultModTweaks.util.I18n;
/**
* Changes the {@link iskallia.vault.config.UnidentifiedRelicFragmentsConfig}
* class for managing the relic fragment configuration.
*
* Specifically, fixes the weight for rolling #5 fragments.
*/
@Mixin(UnidentifiedRelicFragmentsConfig.class)
public abstract class MixinUnidentifiedRelicFragmentsConfig extends Config {
@Shadow(remap = false)
private WeightedList<ResourceLocation> fragments;
/**
* Dynamically sets all fragment weights to the same (2) when the
* configuration is loaded.
*
* @param oldConfigInstance
*/
@Override
public void onLoad(Config oldConfigInstance) {
super.onLoad(oldConfigInstance);
if (Configuration.FRAGMENT_WEIGHT_FIX.get()) {
VaultModTweaks.LOGGER.info(I18n.get("the_vault_tweaks.log.inject.relicfragments"));
for (WeightedList.Entry<ResourceLocation> item : fragments) {
item.weight = 2;
}

View file

@ -1,3 +1,20 @@
/**
* 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 org.spongepowered.asm.mixin.Mixin;
@ -19,7 +36,14 @@ import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.BlockHitResult;
import tv.alterNERD.VaultModTweaks.Configuration;
import tv.alterNERD.VaultModTweaks.VaultModTweaks;
import tv.alterNERD.VaultModTweaks.util.I18n;
/**
* Changes the {@link iskallia.vault.block.VaultAltarBlock} class.
*
* Specifically, allows fake players to place Vault Rocks on it.
*/
@Mixin(VaultAltarBlock.class)
public class MixinVaultAltarBlock {
@Shadow(remap = false)
@ -27,6 +51,18 @@ public class MixinVaultAltarBlock {
throw new UnsupportedOperationException("Unimplemented method 'getAltarTileEntity'");
}
/**
* Actually allows fake players to interact with the Vault Altar block if
* they are holding a Vault Rock in their main hand.
*
* @param state
* @param world
* @param pos
* @param player
* @param hand
* @param hit
* @param ci
*/
@Inject(
method = "use",
at = @At(
@ -42,6 +78,7 @@ public class MixinVaultAltarBlock {
VaultAltarTileEntity altar = this.getAltarTileEntity(world, pos);
if (altar.getAltarState() == VaultAltarTileEntity.AltarState.IDLE) {
if (heldItem.getItem() == ModItems.VAULT_ROCK) {
VaultModTweaks.LOGGER.info(I18n.get("the_vault_tweaks.log.inject.vaultar.rock"));
ci.setReturnValue(altar.onAddVaultRock(serverPlayer, heldItem));
}
}

View file

@ -1,3 +1,20 @@
/**
* 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 org.spongepowered.asm.mixin.Mixin;
@ -8,18 +25,34 @@ import com.google.gson.annotations.Expose;
import iskallia.vault.config.Config;
import iskallia.vault.config.VaultAltarConfig;
import tv.alterNERD.VaultModTweaks.Configuration;
import tv.alterNERD.VaultModTweaks.VaultModTweaks;
import tv.alterNERD.VaultModTweaks.util.I18n;
/**
* Changes the {@link iskallia.vault.config.VaultAltarConfig} class for
* managing the Vault Altar configuration.
*
* Specifically, it changes the infusion time.
*/
@Mixin(VaultAltarConfig.class)
public abstract class MixinVaultAltarConfig extends Config {
@Shadow(remap = false)
@Expose
public int INFUSION_TIME;
/**
* Overrides the default Vault Altar infusion time whenever the config is
* loaded.
*
* @param oldConfigInstance
*/
@Override
protected void onLoad(Config oldConfigInstance) {
super.onLoad(oldConfigInstance);
if (Configuration.VAULTAR_ENABLED.get()) {
this.INFUSION_TIME = Configuration.VAULTAR_INFUSION_TIME.get();
int time = Configuration.VAULTAR_INFUSION_TIME.get();
VaultModTweaks.LOGGER.info(I18n.get("the_vault_tweaks.log.inject.vaultar.infusion", time));
this.INFUSION_TIME = time;
}
}

View file

@ -1,3 +1,20 @@
/**
* 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.HashMap;
@ -8,21 +25,39 @@ import org.spongepowered.asm.mixin.Shadow;
import iskallia.vault.config.Config;
import iskallia.vault.config.VaultCharmConfig;
import tv.alterNERD.VaultModTweaks.Configuration;
import tv.alterNERD.VaultModTweaks.VaultModTweaks;
import tv.alterNERD.VaultModTweaks.util.I18n;
/**
* Changes the {@link iskallia.vault.config.VaultCharmConfig} class for
* managing the Junk Management configuration.
*
* Specifically, it changes the multiplier for the Vault Junk Upgrades.
*/
@Mixin(VaultCharmConfig.class)
public abstract class MixinVaultCharmConfig extends Config {
@Shadow(remap = false)
private HashMap<Integer, Integer> tierMultipliers;
/**
* Overrides the Vault Junk Upgrade multipliers whenever they are loaded.
*
* @param oldConfigInstance
*/
@Override
protected void onLoad(Config oldConfigInstance) {
super.onLoad(oldConfigInstance);
if (Configuration.JUNKMGMT_ENABLED.get()) {
int t1 = Configuration.JUNKMGMT_T1.get();
int t2 = Configuration.JUNKMGMT_T2.get();
int t3 = Configuration.JUNKMGMT_T3.get();
int t4 = Configuration.JUNKMGMT_T4.get();
VaultModTweaks.LOGGER.info(I18n.get("the_vault_tweaks.log.inject.junkmgmt.upgrades", t1, t2, t3, t4));
tierMultipliers = new HashMap<Integer, Integer>(4);
tierMultipliers.put(1, Configuration.JUNKMGMT_T1.get());
tierMultipliers.put(2, Configuration.JUNKMGMT_T2.get());
tierMultipliers.put(3, Configuration.JUNKMGMT_T3.get());
tierMultipliers.put(4, Configuration.JUNKMGMT_T4.get());
tierMultipliers.put(1, t1);
tierMultipliers.put(2, t2);
tierMultipliers.put(3, t3);
tierMultipliers.put(4, t4);
}
}

View file

@ -1,3 +1,20 @@
/**
* 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 org.spongepowered.asm.mixin.Mixin;
@ -7,7 +24,16 @@ import iskallia.vault.config.Config;
import iskallia.vault.config.VaultJewelCuttingConfig;
import iskallia.vault.config.VaultJewelCuttingConfig.JewelCuttingRange;
import tv.alterNERD.VaultModTweaks.Configuration;
import tv.alterNERD.VaultModTweaks.VaultModTweaks;
import tv.alterNERD.VaultModTweaks.util.I18n;
/**
* Changes the {@link iskallia.vault.config.VaultJewelCuttingConfig} class for
* managing the Jewel Cutting Station configuration.
*
* Specifically, it changes the minimum and maximum size change and the chance
* of failure.
*/
@Mixin(VaultJewelCuttingConfig.class)
public abstract class MixinVaultJewelCuttingConfig extends Config {
@Shadow(remap = false)
@ -16,12 +42,23 @@ public abstract class MixinVaultJewelCuttingConfig extends Config {
@Shadow(remap = false)
private JewelCuttingRange jewelCuttingRange;
/**
* Changes the minimum and maximum size change and the chance of failure
* whenever the configuration is loaded.
*
* @param oldConfigInstance
*/
@Override
protected void onLoad(Config oldConfigInstance) {
super.onLoad(oldConfigInstance);
if (Configuration.JEWELER_ENABLED.get()) {
this.jewelCuttingModifierRemovalChance = Configuration.JEWELER_CHANCE.get().floatValue();
this.jewelCuttingRange = new JewelCuttingRange(Configuration.JEWELS_MIN.get(), Configuration.JEWELS_MAX.get());
float chance = Configuration.JEWELER_CHANCE.get().floatValue();
VaultModTweaks.LOGGER.info(I18n.get("the_vault_tweaks.log.inject.jewelcutting.failurechance", chance));
this.jewelCuttingModifierRemovalChance = chance;
int min = Configuration.JEWELS_MIN.get();
int max = Configuration.JEWELS_MAX.get();
VaultModTweaks.LOGGER.info(I18n.get("the_vault_tweaks.log.inject.jewelcutting.sizes", min, max));
this.jewelCuttingRange = new JewelCuttingRange(min, max);
}
}

View file

@ -1,3 +1,20 @@
/**
* 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.ArrayList;
@ -10,19 +27,35 @@ import com.google.gson.annotations.Expose;
import iskallia.vault.config.Config;
import iskallia.vault.config.VaultPortalConfig;
import tv.alterNERD.VaultModTweaks.Configuration;
/**
* Changes the {@link iskallia.vault.config.VaultPortalConfig} class for
* managing the Vault Portal configuration.
*
* Specifically, it allows making a portal out of Modular Routers Template
* Frame Blocks.
*/
@Mixin(VaultPortalConfig.class)
public abstract class MixinVaultPortalConfig extends Config {
@Shadow(remap = false)
@Expose
public String[] VALID_BLOCKS;
/**
* Adds Template Frame Blocks to the list of valid Vault Portal blocks
* whenever it is loaded.
*
* @param oldConfigInstance
*/
@Override
protected void onLoad(Config oldConfigInstance) {
super.onLoad(oldConfigInstance);
ArrayList<String> list = new ArrayList<String>(Arrays.asList(VALID_BLOCKS));
list.add("modularrouters:template_frame");
VALID_BLOCKS = list.toArray(VALID_BLOCKS);
if (Configuration.PORTAL_TEMPLATE_ENABLED.get()) {
ArrayList<String> list = new ArrayList<String>(Arrays.asList(VALID_BLOCKS));
list.add("modularrouters:template_frame");
VALID_BLOCKS = list.toArray(VALID_BLOCKS);
}
}
@Shadow(remap = false)

View file

@ -0,0 +1,48 @@
/**
* 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.util;
import net.minecraft.network.chat.TranslatableComponent;
/**
* Provides a shorthand for getting localized {@link java.lang.String}s from
* Minecrafts {@link net.minecraft.network.chat.TranslatableComponent}s.
*/
public class I18n {
/**
* Provides the localized {@link java.lang.String} to a given key.
*
* @param key The key
* @return The localized {@link java.lang.String}
*/
public static String get(String key) {
return new TranslatableComponent(key).getString();
}
/**
* Provides the localized {@link java.lang.String} to a given key and
* arguments.
*
* @param key The key
* @param args The arguments used for String formatting
* @return The localized {@link java.lang.String}
*/
public static String get(String key, Object... args) {
return new TranslatableComponent(key, args).getString();
}
}

View file

@ -0,0 +1,4 @@
{
"the_vault_tweaks.log.inject.ae2research": "Füge Forschung für den AE2 fake player ein …",
"the_vault_tweaks.log.inject.buddingcrystal": "Füge Einstellungen für den Budding Crystal ein …"
}

View file

@ -1,4 +1,18 @@
{
"the_vault_tweaks.log.inject.ae2research": "Injecting research for AE2 fake player …",
"the_vault_tweaks.log.inject.buddingcrystal": "Injecting Budding Crystal settings …",
"the_vault_tweaks.log.inject.expertise.fortunate": "Removing Fortunate expertise …",
"the_vault_tweaks.log.inject.expertise.jeweler": "Removing Jeweler expertise …",
"the_vault_tweaks.log.inject.fortune.level": "Injecting maximum Fortune level: %1$d …",
"the_vault_tweaks.log.inject.fortune.valid": "Overwriting validity check for Fortune …",
"the_vault_tweaks.log.inject.jewelcutting.failurechance": "Injecting jewel cutting failure chance: %1$.2f …",
"the_vault_tweaks.log.inject.jewelcutting.sizes": "Injecting jewel cutting size values: %1$d%2$d …",
"the_vault_tweaks.log.inject.junkmgmt.upgrades": "Injecting Vault Junk Upgrade mulitpliers: %1$d, %2$d, %3$d, %4$d …",
"the_vault_tweaks.log.inject.relicfragments": "Balancing relic fragment weights …",
"the_vault_tweaks.log.inject.research.fakeplayerfix": "Returning valid research tree for fake player with UUID %1s …",
"the_vault_tweaks.log.inject.vaultar.infusion": "Injecting Vault Altar infusion time: %1$ds …",
"the_vault_tweaks.log.inject.vaultar.rock": "Injecting fake player interaction with Vault Altar …",
"block.minecraft.andesite": "Andesite",
"block.minecraft.polished_andesite": "Polished Andesite",
"block.minecraft.andesite_stairs": "Andesite Stairs",

View file

@ -1,5 +1,6 @@
{
"required": true,
"require": 1,
"package": "tv.alterNERD.VaultModTweaks.integration.mixin",
"compatibilityLevel": "JAVA_17",
"refmap": "mixins.the_vault_tweaks.refmap.json",