Skip to content

Commit

Permalink
Made common config to be server-side
Browse files Browse the repository at this point in the history
  • Loading branch information
Majrusz committed Aug 28, 2022
1 parent b4f8a6e commit 56e8003
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 10 deletions.
Binary file modified libs/majrusz-library-1.19.2-2.15.0.jar
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
public class MajruszsEnchantments {
public static final String MOD_ID = "majruszsenchantments";
public static final String NAME = "Majrusz's Enchantments";
public static final ConfigHandler CONFIG_HANDLER = new ConfigHandler( ModConfig.Type.COMMON, "common.toml", MOD_ID );
public static final ConfigHandler CONFIG_HANDLER_CLIENT = new ConfigHandler( ModConfig.Type.CLIENT, "client.toml", MOD_ID );
public static final ConfigHandler SERVER_CONFIG = new ConfigHandler( ModConfig.Type.SERVER );
public static final ConfigHandler CLIENT_CONFIG = new ConfigHandler( ModConfig.Type.CLIENT );

public MajruszsEnchantments() {
com.majruszsenchantments.Registries.initialize();
Expand Down
13 changes: 6 additions & 7 deletions src/main/java/com/majruszsenchantments/Registries.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.fml.DistExecutor;
import net.minecraftforge.fml.ModLoadingContext;
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries;
Expand All @@ -28,16 +27,16 @@
import java.util.ArrayList;
import java.util.List;

import static com.majruszsenchantments.MajruszsEnchantments.CONFIG_HANDLER;
import static com.majruszsenchantments.MajruszsEnchantments.CONFIG_HANDLER_CLIENT;
import static com.majruszsenchantments.MajruszsEnchantments.SERVER_CONFIG;
import static com.majruszsenchantments.MajruszsEnchantments.CLIENT_CONFIG;

public class Registries {
private static final DeferredRegisterHelper HELPER = new DeferredRegisterHelper( MajruszsEnchantments.MOD_ID );
public static final List< GameModifier > GAME_MODIFIERS = new ArrayList<>();

static {
CONFIG_HANDLER.addGroup( GameModifier.addNewGroup( EnchantmentModifier.ENCHANTMENT, "Enchantments", "" ) );
CONFIG_HANDLER.addGroup( GameModifier.addNewGroup( EnchantmentModifier.CURSE, "Curses", "" ) );
SERVER_CONFIG.addGroup( GameModifier.addNewGroup( EnchantmentModifier.ENCHANTMENT, "Enchantments", "" ) );
SERVER_CONFIG.addGroup( GameModifier.addNewGroup( EnchantmentModifier.CURSE, "Curses", "" ) );
}

// Groups
Expand Down Expand Up @@ -105,8 +104,8 @@ public static void initialize() {
modEventBus.addListener( PacketHandler::registerPacket );
DistExecutor.unsafeRunWhenOn( Dist.CLIENT, ()->RegistriesClient::initialize );

CONFIG_HANDLER.register( ModLoadingContext.get() );
CONFIG_HANDLER_CLIENT.register( ModLoadingContext.get() );
SERVER_CONFIG.register( ModLoadingContext.get() );
CLIENT_CONFIG.register( ModLoadingContext.get() );
}

private static void addEnchantmentTypesToItemGroups() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public class RegistriesClient {

public static void initialize() {
UNIQUE_BOOK_TEXTURE = new BooleanConfig( "unique_book_texture", "Should the Enchanted Book has a different texture when it has any of the new enchantments on it (disabling it may fix some bugs with other mods)?", true, true );
MajruszsEnchantments.CONFIG_HANDLER_CLIENT.addConfig( UNIQUE_BOOK_TEXTURE );
MajruszsEnchantments.CLIENT_CONFIG.addConfig( UNIQUE_BOOK_TEXTURE );
FMLJavaModLoadingContext.get().getModEventBus().addListener( RegistriesClient::register );
}

Expand Down

0 comments on commit 56e8003

Please sign in to comment.