Skip to content

Commit

Permalink
Moved curiosAddHeadSlot option to common config file to fix #43 (than…
Browse files Browse the repository at this point in the history
…ks to ImKatsun)
  • Loading branch information
cech12 committed Dec 24, 2021
1 parent e89c444 commit f9af785
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 8 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Forge Recommended Versioning](https://mcforge.readthedocs.io/en/latest/conventions/versioning/).

## [1.17.1-2.0.1.0] - 2021-12-24
### Changed
- Moved curiosAddHeadSlot option to common config file to fix #43 (thanks to ImKatsun)

## [1.17.1-2.0.0.0] - 2021-12-10
### Changed
- Update mod to Forge 1.17.1-37.1.1 (fix Log4J security issue)
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ org.gradle.jvmargs=-Xmx3G
org.gradle.daemon=false

mod_id=usefulhats
mod_version=2.0.0.0
mod_version=2.1.0.0
minecraft_version=1.17.1
forge_version=37.1.1

Expand Down
3 changes: 2 additions & 1 deletion src/main/java/cech12/usefulhats/UsefulHatsMod.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import cech12.usefulhats.client.UsefulHatLayers;
import cech12.usefulhats.compat.CuriosMod;
import cech12.usefulhats.config.CommonConfig;
import cech12.usefulhats.config.ServerConfig;
import cech12.usefulhats.init.ModItems;
import net.minecraft.world.item.CreativeModeTab;
Expand Down Expand Up @@ -37,14 +38,14 @@ public ItemStack makeIcon() {
public UsefulHatsMod() {
ModItems.addEventListeners();
//Configs
ModLoadingContext.get().registerConfig(ModConfig.Type.COMMON, CommonConfig.COMMON_CONFIG);
ModLoadingContext.get().registerConfig(ModConfig.Type.SERVER, ServerConfig.SERVER_CONFIG);
ServerConfig.loadConfig(ServerConfig.SERVER_CONFIG, FMLPaths.GAMEDIR.get().resolve(FMLConfig.defaultConfigPath()).resolve(MOD_ID + "-server.toml"));
//register render layers & models
DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> {
FMLJavaModLoadingContext.get().getModEventBus().addListener(UsefulHatLayers::initLayers);
FMLJavaModLoadingContext.get().getModEventBus().addListener(UsefulHatLayers::initModels);
});

}

@SubscribeEvent
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/cech12/usefulhats/compat/CuriosMod.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package cech12.usefulhats.compat;

import cech12.usefulhats.config.ServerConfig;
import cech12.usefulhats.config.CommonConfig;
import net.minecraftforge.fml.InterModComms;
import net.minecraftforge.fml.ModList;
import top.theillusivec4.curios.api.SlotTypeMessage;
Expand All @@ -17,7 +17,7 @@ public static boolean isLoaded() {
}

public static void addHeadSlot() {
if (isLoaded() && ServerConfig.CURIOS_ADD_HEAD_SLOT.get()) {
if (isLoaded() && CommonConfig.CURIOS_ADD_HEAD_SLOT.get()) {
InterModComms.sendTo(CURIOS_ID, SlotTypeMessage.REGISTER_TYPE, () -> SlotTypePreset.HEAD.getMessageBuilder().build());
}
}
Expand Down
22 changes: 22 additions & 0 deletions src/main/java/cech12/usefulhats/config/CommonConfig.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package cech12.usefulhats.config;

import net.minecraftforge.common.ForgeConfigSpec;

public class CommonConfig {

public static ForgeConfigSpec COMMON_CONFIG;

public static final ForgeConfigSpec.BooleanValue CURIOS_ADD_HEAD_SLOT;

static {
final ForgeConfigSpec.Builder builder = new ForgeConfigSpec.Builder();

builder.comment("Some configs in relation to other mods.").push("CompatibilityOptions");
CURIOS_ADD_HEAD_SLOT = builder
.comment("Whether or not a Curios head slot should be added if Curios is installed.")
.define("curiosAddHeadSlot", false);
builder.pop();

COMMON_CONFIG = builder.build();
}
}
4 changes: 0 additions & 4 deletions src/main/java/cech12/usefulhats/config/ServerConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ public class ServerConfig {

public static final ForgeConfigSpec.BooleanValue BAUBLES_ENABLED;
public static final ForgeConfigSpec.BooleanValue CURIOS_ENABLED;
public static final ForgeConfigSpec.BooleanValue CURIOS_ADD_HEAD_SLOT;

public static final ForgeConfigSpec.BooleanValue AQUANAUT_HELMET_DAMAGE_ENABLED;
public static final ForgeConfigSpec.IntValue AQUANAUT_HELMET_DURABILITY;
Expand Down Expand Up @@ -92,9 +91,6 @@ public class ServerConfig {
CURIOS_ENABLED = builder
.comment("Whether or not hats from this mod should be placeable in Curios head slots if Curios is installed.")
.define("curiosEnabled", true);
CURIOS_ADD_HEAD_SLOT = builder
.comment("Whether or not a Curios head slot should be added if Curios is installed.")
.define("curiosAddHeadSlot", false);
builder.pop();

builder.comment("Various options that affect individual hats.").push("BalanceOptions");
Expand Down

0 comments on commit f9af785

Please sign in to comment.