Skip to content

Commit

Permalink
add a config for adding a curios head slot (default false) #32
Browse files Browse the repository at this point in the history
  • Loading branch information
cech12 committed Sep 22, 2020
1 parent 55ec16f commit 4488c5b
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 4 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
org.gradle.jvmargs=-Xmx3G
org.gradle.daemon=false

mod_version=1.8.3
mod_version=1.8.4
minecraft_version=1.14.4

forge_version=1.14.4-28.1.0
Expand Down
7 changes: 7 additions & 0 deletions 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.UsefulHatLayer;
import cech12.usefulhats.client.UsefulHatModel;
import cech12.usefulhats.compat.CuriosMod;
import cech12.usefulhats.config.Config;
import cech12.usefulhats.helper.UsefulHatsRecipeSerializers;
import cech12.usefulhats.init.ModItems;
Expand All @@ -14,6 +15,7 @@
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.config.ModConfig;
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
import net.minecraftforge.fml.event.lifecycle.InterModEnqueueEvent;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;

import static cech12.usefulhats.UsefulHatsMod.MOD_ID;
Expand All @@ -31,6 +33,11 @@ public UsefulHatsMod() {
FMLJavaModLoadingContext.get().getModEventBus().register(new UsefulHatsRecipeSerializers());
}

@SubscribeEvent
public static void sendImc(InterModEnqueueEvent evt) {
CuriosMod.addHeadSlot();
}

@OnlyIn(Dist.CLIENT)
@SubscribeEvent
public static void onClientRegister(FMLClientSetupEvent event) {
Expand Down
14 changes: 13 additions & 1 deletion src/main/java/cech12/usefulhats/compat/CuriosMod.java
Original file line number Diff line number Diff line change
@@ -1,13 +1,25 @@
package cech12.usefulhats.compat;

import cech12.usefulhats.config.Config;
import net.minecraftforge.fml.InterModComms;
import net.minecraftforge.fml.ModList;
import top.theillusivec4.curios.api.CuriosAPI;
import top.theillusivec4.curios.api.imc.CurioIMCMessage;

public class CuriosMod {

public static final String CURIOS_ID = "curios";

private CuriosMod() {}

public static boolean isLoaded() {
return ModList.get().isLoaded("curios");
return ModList.get().isLoaded(CURIOS_ID);
}

public static void addHeadSlot() {
if (isLoaded() && Config.CURIOS_ADD_HEAD_SLOT.getValue()) {
InterModComms.sendTo(CURIOS_ID, CuriosAPI.IMC.REGISTER_TYPE, () -> new CurioIMCMessage("head"));
}
}

}
8 changes: 6 additions & 2 deletions src/main/java/cech12/usefulhats/config/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ public class Config {

public static final ConfigType.Boolean BAUBLES_ENABLED = new ConfigType.Boolean(true);
public static final ConfigType.Boolean CURIOS_ENABLED = new ConfigType.Boolean(true);
public static final ConfigType.Boolean CURIOS_ADD_HEAD_SLOT = new ConfigType.Boolean(false);

public static final ConfigType.Boolean AQUANAUT_HELMET_ENABLED = new ConfigType.Boolean(true);
public static final ConfigType.Boolean AQUANAUT_HELMET_DAMAGE_ENABLED = new ConfigType.Boolean(true);
Expand Down Expand Up @@ -95,11 +96,14 @@ public class Config {
common.comment("Some configs in relation to other mods.").push("Compatibility option");

BAUBLES_ENABLED.configObj = common
.comment("Whether or not hats from this mod should be placeable in Baubles head slots.")
.comment("Whether or not hats from this mod should be placeable in Baubles head slot if Baubles is installed.")
.define("baublesEnabled", BAUBLES_ENABLED.getDefaultValue());
CURIOS_ENABLED.configObj = common
.comment("Whether or not hats from this mod should be placeable in Curios head slots.")
.comment("Whether or not hats from this mod should be placeable in Curios head slots if Curios is installed.")
.define("curiosEnabled", CURIOS_ENABLED.getDefaultValue());
CURIOS_ADD_HEAD_SLOT.configObj = common
.comment("Whether or not a Curios head slot should be added if Curios is installed.")
.define("curiosAddHeadSlot", CURIOS_ADD_HEAD_SLOT.getDefaultValue());

common.pop();

Expand Down

0 comments on commit 4488c5b

Please sign in to comment.