Skip to content

Commit

Permalink
Made config server-side
Browse files Browse the repository at this point in the history
  • Loading branch information
Majrusz committed Aug 28, 2022
1 parent 9560800 commit aa3f1c0
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 12 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 @@ -10,7 +10,7 @@
public class MajruszsDifficulty {
public static final String MOD_ID = "majruszsdifficulty";
public static final String NAME = "Majrusz's Progressive Difficulty";
public static final ConfigHandler CONFIG_HANDLER = new ConfigHandler( ModConfig.Type.COMMON, "common.toml", MOD_ID );
public static final ConfigHandler SERVER_CONFIG = new ConfigHandler( ModConfig.Type.SERVER );

public MajruszsDifficulty() {
com.majruszsdifficulty.Registries.initialize();
Expand Down
17 changes: 6 additions & 11 deletions src/main/java/com/majruszsdifficulty/Registries.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import com.mlib.registries.DeferredRegisterHelper;
import com.mlib.triggers.BasicTrigger;
import com.mojang.serialization.Codec;
import com.mojang.serialization.codecs.RecordCodecBuilder;
import net.minecraft.advancements.CriteriaTriggers;
import net.minecraft.core.Registry;
import net.minecraft.core.particles.ParticleType;
Expand All @@ -47,8 +46,6 @@
import net.minecraft.world.item.SpawnEggItem;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.LevelAccessor;
import net.minecraft.world.level.biome.Biome;
import net.minecraft.world.level.biome.MobSpawnSettings;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.levelgen.Heightmap;
import net.minecraft.world.level.levelgen.feature.ConfiguredFeature;
Expand All @@ -75,19 +72,18 @@
import java.util.List;
import java.util.function.Supplier;

import static com.majruszsdifficulty.MajruszsDifficulty.CONFIG_HANDLER;
import static com.majruszsdifficulty.MajruszsDifficulty.SERVER_CONFIG;

public class Registries {
private static final DeferredRegisterHelper HELPER = new DeferredRegisterHelper( MajruszsDifficulty.MOD_ID );
public static final ConfigGroup UNDEAD_ARMY_GROUP;

static {
CONFIG_HANDLER.addGroup( GameModifier.addNewGroup( Modifiers.DEFAULT ) );
SERVER_CONFIG.addGroup( GameModifier.addNewGroup( Modifiers.DEFAULT ) );
UNDEAD_ARMY_GROUP = GameModifier.addNewGroup( Modifiers.UNDEAD_ARMY, "UndeadArmy", "" );
CONFIG_HANDLER.addGroup( UNDEAD_ARMY_GROUP );
CONFIG_HANDLER.addGroup( GameModifier.addNewGroup( Modifiers.GAME_STAGE, "GameStage", "" ) );
CONFIG_HANDLER.addGroup( GameModifier.addNewGroup( Modifiers.TREASURE_BAG, "TreasureBag", "" ) );
CONFIG_HANDLER.addGroup( GameModifier.addNewGroup( Modifiers.ACCESSORY, "Accessory", "" ) );
SERVER_CONFIG.addGroup( UNDEAD_ARMY_GROUP );
SERVER_CONFIG.addGroup( GameModifier.addNewGroup( Modifiers.GAME_STAGE, "GameStage", "" ) );
SERVER_CONFIG.addGroup( GameModifier.addNewGroup( Modifiers.TREASURE_BAG, "TreasureBag", "" ) );
}

// Groups
Expand Down Expand Up @@ -281,7 +277,7 @@ public static void initialize() {
forgeEventBus.addListener( Registries::onSavingLevel );
forgeEventBus.addListener( Registries::registerCommands );

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

private static void setupClient( final FMLClientSetupEvent event ) {
Expand Down Expand Up @@ -338,6 +334,5 @@ public static class Modifiers {
public static final String UNDEAD_ARMY = Registries.getLocationString( "undead_army" );
public static final String GAME_STAGE = Registries.getLocationString( "game_stage" );
public static final String TREASURE_BAG = Registries.getLocationString( "treasure_bag" );
public static final String ACCESSORY = Registries.getLocationString( "accessory" );
}
}

0 comments on commit aa3f1c0

Please sign in to comment.