Enchantment config (#334)

This commit is contained in:
paulevsGitch 2021-10-26 16:49:28 +03:00
parent 3b570cd80e
commit ce7a8fc70a
4 changed files with 24 additions and 19 deletions

View file

@ -7,7 +7,6 @@ import ru.bclib.api.WorldDataAPI;
import ru.bclib.util.Logger; import ru.bclib.util.Logger;
import ru.betterend.api.BetterEndPlugin; import ru.betterend.api.BetterEndPlugin;
import ru.betterend.config.Configs; import ru.betterend.config.Configs;
import ru.betterend.effects.EndEnchantments;
import ru.betterend.effects.EndPotions; import ru.betterend.effects.EndPotions;
import ru.betterend.integration.Integrations; import ru.betterend.integration.Integrations;
import ru.betterend.recipe.AlloyingRecipes; import ru.betterend.recipe.AlloyingRecipes;
@ -18,6 +17,7 @@ import ru.betterend.recipe.InfusionRecipes;
import ru.betterend.recipe.SmithingRecipes; import ru.betterend.recipe.SmithingRecipes;
import ru.betterend.registry.EndBiomes; import ru.betterend.registry.EndBiomes;
import ru.betterend.registry.EndBlockEntities; import ru.betterend.registry.EndBlockEntities;
import ru.betterend.registry.EndEnchantments;
import ru.betterend.registry.EndEntities; import ru.betterend.registry.EndEntities;
import ru.betterend.registry.EndFeatures; import ru.betterend.registry.EndFeatures;
import ru.betterend.registry.EndPortals; import ru.betterend.registry.EndPortals;

View file

@ -15,6 +15,7 @@ public class Configs {
public static final IdConfig BIOME_CONFIG = new EntryConfig(BetterEnd.MOD_ID, "biomes"); public static final IdConfig BIOME_CONFIG = new EntryConfig(BetterEnd.MOD_ID, "biomes");
public static final PathConfig GENERATOR_CONFIG = new PathConfig(BetterEnd.MOD_ID, "generator", false); public static final PathConfig GENERATOR_CONFIG = new PathConfig(BetterEnd.MOD_ID, "generator", false);
public static final PathConfig RECIPE_CONFIG = new PathConfig(BetterEnd.MOD_ID, "recipes"); public static final PathConfig RECIPE_CONFIG = new PathConfig(BetterEnd.MOD_ID, "recipes");
public static final PathConfig ENCHANTMENT_CONFIG = new PathConfig(BetterEnd.MOD_ID, "enchantments");
@Environment(value = EnvType.CLIENT) @Environment(value = EnvType.CLIENT)
public static final PathConfig CLENT_CONFIG = new PathConfig(BetterEnd.MOD_ID, "client", false); public static final PathConfig CLENT_CONFIG = new PathConfig(BetterEnd.MOD_ID, "client", false);
@ -26,6 +27,7 @@ public class Configs {
ITEM_CONFIG.saveChanges(); ITEM_CONFIG.saveChanges();
GENERATOR_CONFIG.saveChanges(); GENERATOR_CONFIG.saveChanges();
RECIPE_CONFIG.saveChanges(); RECIPE_CONFIG.saveChanges();
ENCHANTMENT_CONFIG.saveChanges();
if (BCLib.isClient()) { if (BCLib.isClient()) {
CLENT_CONFIG.saveChanges(); CLENT_CONFIG.saveChanges();

View file

@ -8,8 +8,8 @@ import org.spongepowered.asm.mixin.Mixin;
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.CallbackInfoReturnable; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import ru.betterend.effects.EndEnchantments;
import ru.betterend.effects.EndStatusEffects; import ru.betterend.effects.EndStatusEffects;
import ru.betterend.registry.EndEnchantments;
@Mixin(EnderMan.class) @Mixin(EnderMan.class)
public abstract class EnderManMixin { public abstract class EnderManMixin {

View file

@ -1,17 +1,20 @@
package ru.betterend.effects; package ru.betterend.registry;
import net.minecraft.core.Registry; import net.minecraft.core.Registry;
import net.minecraft.world.item.enchantment.Enchantment; import net.minecraft.world.item.enchantment.Enchantment;
import ru.betterend.BetterEnd; import ru.betterend.BetterEnd;
import ru.betterend.config.Configs;
import ru.betterend.effects.enchantment.EndVeilEnchantment; import ru.betterend.effects.enchantment.EndVeilEnchantment;
public class EndEnchantments { public class EndEnchantments {
public final static Enchantment END_VEIL = registerEnchantment("end_veil", new EndVeilEnchantment()); public final static Enchantment END_VEIL = registerEnchantment("end_veil", new EndVeilEnchantment());
public static Enchantment registerEnchantment(String name, Enchantment enchantment) { public static Enchantment registerEnchantment(String name, Enchantment enchantment) {
if (!Configs.ENCHANTMENT_CONFIG.getBooleanRoot(name, true)) {
return enchantment;
}
return Registry.register(Registry.ENCHANTMENT, BetterEnd.makeID(name), enchantment); return Registry.register(Registry.ENCHANTMENT, BetterEnd.makeID(name), enchantment);
} }
public static void register() { public static void register() {}
}
} }