move injection for removing enchantment costs
Makes the thing spam the log more, but works on servers. fixes #2
This commit is contained in:
parent
b9d0db5936
commit
fbf3961220
2 changed files with 14 additions and 19 deletions
|
@ -23,44 +23,39 @@ import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.Shadow;
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||||
|
|
||||||
import com.google.gson.JsonObject;
|
|
||||||
|
|
||||||
|
import iskallia.vault.config.gear.VaultGearEnchantmentConfig;
|
||||||
import iskallia.vault.util.EnchantmentCost;
|
import iskallia.vault.util.EnchantmentCost;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import iskallia.vault.util.EnchantmentEntry;
|
||||||
import tv.alterNERD.VaultModTweaks.Configuration;
|
import tv.alterNERD.VaultModTweaks.Configuration;
|
||||||
import tv.alterNERD.VaultModTweaks.VaultModTweaks;
|
import tv.alterNERD.VaultModTweaks.VaultModTweaks;
|
||||||
import tv.alterNERD.VaultModTweaks.util.I18n;
|
import tv.alterNERD.VaultModTweaks.util.I18n;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Changes the {@link iskallia.vault.util.EnchantmentCost} class used by the
|
* Changes the {@link iskallia.vault.config.gear.VaultGearEnchantmentConfig}
|
||||||
* Vault Enchanter.
|
* class used by the Vault Enchanter.
|
||||||
*
|
*
|
||||||
* Specifically, it removes the Emerald cost of enchantments. Just because I
|
* Specifically, it removes the Emerald cost of enchantments. Just because I
|
||||||
* cannot be arsed to bring them over every time.
|
* cannot be arsed to bring them over every time.
|
||||||
*/
|
*/
|
||||||
@Mixin(EnchantmentCost.class)
|
@Mixin(VaultGearEnchantmentConfig.class)
|
||||||
public class MixinEnchantmentCost {
|
public class MixinVaultGearEnchantmentConfig {
|
||||||
@Shadow(remap = false)
|
|
||||||
private List<ItemStack> items;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes the Emerald cost from all Vault Enchanter enchantments when
|
* Removes the Emerald cost from all Vault Enchanter enchantments.
|
||||||
* reading an existing JSON configuration.
|
|
||||||
*
|
*
|
||||||
* @param json
|
* @param entry
|
||||||
* @param ci
|
|
||||||
*/
|
*/
|
||||||
@Inject(
|
@Inject(
|
||||||
method = "readJson",
|
method = "getCost",
|
||||||
at = @At("RETURN"),
|
at = @At("RETURN"),
|
||||||
|
cancellable = true,
|
||||||
remap = false
|
remap = false
|
||||||
)
|
)
|
||||||
private void readJsonCallback(JsonObject json, CallbackInfo ci) {
|
private void readJsonCallback(EnchantmentEntry enrty, CallbackInfoReturnable<EnchantmentCost> ci) {
|
||||||
if (Configuration.ENCHANTS_FORFREE.get()) {
|
if (Configuration.ENCHANTS_FORFREE.get()) {
|
||||||
VaultModTweaks.LOGGER.info(I18n.get("the_vault_tweaks.log.inject.enchanter.forfree"));
|
VaultModTweaks.LOGGER.info(I18n.get("the_vault_tweaks.log.inject.enchanter.forfree"));
|
||||||
this.items.clear();
|
ci.setReturnValue(EnchantmentCost.EMPTY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
"mixins": [
|
"mixins": [
|
||||||
"MixinAltarConduitNode",
|
"MixinAltarConduitNode",
|
||||||
"MixinCrystalBuddingConfig",
|
"MixinCrystalBuddingConfig",
|
||||||
"MixinEnchantmentCost",
|
|
||||||
"MixinEnchantmentEntry",
|
"MixinEnchantmentEntry",
|
||||||
"MixinExpertisesGuiConfig",
|
"MixinExpertisesGuiConfig",
|
||||||
"MixinPlayerResearchesData",
|
"MixinPlayerResearchesData",
|
||||||
|
@ -16,6 +15,7 @@
|
||||||
"MixinVaultAltarBlock",
|
"MixinVaultAltarBlock",
|
||||||
"MixinVaultAltarConfig",
|
"MixinVaultAltarConfig",
|
||||||
"MixinVaultCharmConfig",
|
"MixinVaultCharmConfig",
|
||||||
|
"MixinVaultGearEnchantmentConfig",
|
||||||
"MixinVaultJewelCuttingConfig",
|
"MixinVaultJewelCuttingConfig",
|
||||||
"MixinVaultPortalConfig"
|
"MixinVaultPortalConfig"
|
||||||
],
|
],
|
||||||
|
|
Loading…
Reference in a new issue