remove emerald cost from vault enchanter

This commit is contained in:
alterNERDtive 2023-06-20 23:32:11 +02:00
parent ced6923a12
commit 69c64a69fe
Signed by: alterNERDtive
GPG key ID: 547787A4FE6533F1
5 changed files with 75 additions and 0 deletions

View file

@ -1,5 +1,6 @@
# devel # devel
* Removed Emerald cost from Vault Enchanter.
* Lots of refactoring work behind the scenes. * Lots of refactoring work behind the scenes.
* Added i18n support and lots of logging. * 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. * Fixed AE2 fake player in existing worlds not getting new research when it is added to the pack.

View file

@ -31,6 +31,8 @@ public class Configuration {
public static BooleanValue FORTUNE_ENABLED; public static BooleanValue FORTUNE_ENABLED;
public static IntValue FORTUNE_LEVEL; public static IntValue FORTUNE_LEVEL;
public static BooleanValue ENCHANTS_FORFREE;
public static BooleanValue JEWELER_ENABLED; public static BooleanValue JEWELER_ENABLED;
public static DoubleValue JEWELER_CHANCE; public static DoubleValue JEWELER_CHANCE;
@ -69,6 +71,12 @@ public class Configuration {
FORTUNE_LEVEL = builder.defineInRange("maxLevel", 5, 3, 5); FORTUNE_LEVEL = builder.defineInRange("maxLevel", 5, 3, 5);
builder.pop(); builder.pop();
// Enchantment Cost
builder.push("VaultEnchanter");
builder.comment("Remove the Emerald cost from the Vault Enchanter");
ENCHANTS_FORFREE = builder.define("removeEmeraldCost", true);
builder.pop();
// Jeweler // Jeweler
builder.push("Jeweler"); builder.push("Jeweler");
builder.comment("Remove the Jeweler Expertise and change the default cutting chance accordingly"); builder.comment("Remove the Jeweler Expertise and change the default cutting chance accordingly");

View file

@ -0,0 +1,64 @@
/**
* 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.LinkedList;
import java.util.List;
import org.spongepowered.asm.mixin.Mixin;
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 iskallia.vault.util.EnchantmentCost;
import net.minecraft.world.item.ItemStack;
import tv.alterNERD.VaultModTweaks.Configuration;
import tv.alterNERD.VaultModTweaks.VaultModTweaks;
/**
* Changes the {@link iskallia.vault.util.EnchantmentCost} class used by the
* Vault Enchanter.
*
* Specifically, it removes the Emerald cost of enchantments. Just because I
* cannot be arsed to bring them over every time.
*/
@Mixin(EnchantmentCost.class)
public class MixinEnchantmentCost {
@Shadow(remap = false)
private List<ItemStack> items;
/**
* Removes the Emerald cost from all Vault Enchanter enchantments.
*
* @param items
* @param levels
* @param ci
*/
@Inject(
method = "<init>(Ljava/util/List;I)V",
at = @At("RETURN"),
remap = false
)
private void initCallback(List<ItemStack> items, int levels, CallbackInfo ci) {
if (Configuration.ENCHANTS_FORFREE.get()) {
VaultModTweaks.LOGGER.info("the_vault_tweaks.log.inject.enchanter.forfree");
this.items = new LinkedList<ItemStack>();
}
}
}

View file

@ -1,6 +1,7 @@
{ {
"the_vault_tweaks.log.inject.ae2research": "Injecting research for AE2 fake player …", "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.buddingcrystal": "Injecting Budding Crystal settings …",
"the_vault_tweaks.log.inject.enchanter.forfree": "Removing Emerald cost from Vault Enchanter …",
"the_vault_tweaks.log.inject.expertise.fortunate": "Removing Fortunate expertise …", "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.expertise.jeweler": "Removing Jeweler expertise …",
"the_vault_tweaks.log.inject.fortune.level": "Injecting maximum Fortune level: %1$d …", "the_vault_tweaks.log.inject.fortune.level": "Injecting maximum Fortune level: %1$d …",

View file

@ -6,6 +6,7 @@
"refmap": "mixins.the_vault_tweaks.refmap.json", "refmap": "mixins.the_vault_tweaks.refmap.json",
"mixins": [ "mixins": [
"MixinCrystalBuddingConfig", "MixinCrystalBuddingConfig",
"MixinEnchantmentCost",
"MixinEnchantmentEntry", "MixinEnchantmentEntry",
"MixinExpertisesGuiConfig", "MixinExpertisesGuiConfig",
"MixinPlayerResearchesData", "MixinPlayerResearchesData",