Skip to content

Commit 5c39a86

Browse files
committed
Spotless and add syncConfigValues
1 parent af284c2 commit 5c39a86

File tree

14 files changed

+88
-64
lines changed

14 files changed

+88
-64
lines changed

src/main/java/com/github/gtexpert/testmod/TestMod.java

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,31 @@
11
package com.github.gtexpert.testmod;
22

3-
import com.github.gtexpert.testmod.api.util.ModLog;
4-
import com.github.gtexpert.testmod.module.ModuleManager;
5-
import com.github.gtexpert.testmod.module.Modules;
63
import net.minecraft.block.Block;
74
import net.minecraft.item.Item;
85
import net.minecraft.item.crafting.IRecipe;
96
import net.minecraftforge.common.MinecraftForge;
7+
import net.minecraftforge.common.config.Config;
8+
import net.minecraftforge.common.config.ConfigManager;
109
import net.minecraftforge.event.RegistryEvent;
10+
import net.minecraftforge.fml.client.event.ConfigChangedEvent;
1111
import net.minecraftforge.fml.common.Loader;
1212
import net.minecraftforge.fml.common.Mod;
1313
import net.minecraftforge.fml.common.event.*;
1414
import net.minecraftforge.fml.common.eventhandler.EventPriority;
1515
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
1616

17+
import com.github.gtexpert.testmod.api.ModValues;
18+
import com.github.gtexpert.testmod.api.util.ModLog;
19+
import com.github.gtexpert.testmod.module.ModuleManager;
20+
import com.github.gtexpert.testmod.module.Modules;
21+
1722
@Mod(
18-
modid = Tags.MODID,
19-
name = Tags.MODNAME,
20-
version = Tags.VERSION,
21-
dependencies = ""
22-
)
23+
modid = Tags.MODID,
24+
name = Tags.MODNAME,
25+
version = Tags.VERSION,
26+
dependencies = "")
2327
public class TestMod {
28+
2429
private ModuleManager moduleManager;
2530

2631
@Mod.EventHandler
@@ -121,4 +126,11 @@ public void registerRecipesLow(RegistryEvent.Register<IRecipe> event) {
121126
public void registerRecipesLowest(RegistryEvent.Register<IRecipe> event) {
122127
moduleManager.registerRecipesLowest(event);
123128
}
129+
130+
@SubscribeEvent
131+
public static void syncConfigValues(ConfigChangedEvent.OnConfigChangedEvent event) {
132+
if (event.getModID().equals(ModValues.MODID)) {
133+
ConfigManager.sync(ModValues.MODID, Config.Type.INSTANCE);
134+
}
135+
}
124136
}

src/main/java/com/github/gtexpert/testmod/api/ModValues.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@
33
import com.github.gtexpert.testmod.Tags;
44

55
public class ModValues {
6+
67
public static final String MODID = Tags.MODID;
78
}

src/main/java/com/github/gtexpert/testmod/api/modules/IModule.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package com.github.gtexpert.testmod.api.modules;
22

3-
43
import java.util.Collections;
54
import java.util.List;
65
import java.util.Set;

src/main/java/com/github/gtexpert/testmod/api/modules/IModuleContainer.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.github.gtexpert.testmod.api.modules;
22

33
public interface IModuleContainer {
4+
45
/**
56
* The ID of this container. If this is your mod's only container, you should use your mod ID to prevent collisions.
67
*/

src/main/java/com/github/gtexpert/testmod/api/modules/IModuleManager.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
package com.github.gtexpert.testmod.api.modules;
22

3-
import com.github.gtexpert.testmod.api.util.ModUtility;
43
import net.minecraft.util.ResourceLocation;
54

5+
import com.github.gtexpert.testmod.api.util.ModUtility;
6+
67
public interface IModuleManager {
78

89
default boolean isModuleEnabled(String containerID, String moduleID) {

src/main/java/com/github/gtexpert/testmod/api/modules/ModuleStage.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package com.github.gtexpert.testmod.api.modules;
22

3-
43
/**
54
* Basically {@link net.minecraftforge.fml.common.LoaderState} but only for launch stages.
65
* Also includes early module stages.
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
package com.github.gtexpert.testmod.api.util;
22

3-
import com.github.gtexpert.testmod.Tags;
43
import org.apache.logging.log4j.LogManager;
54
import org.apache.logging.log4j.Logger;
65

6+
import com.github.gtexpert.testmod.Tags;
7+
78
public class ModLog {
9+
810
public static Logger logger = LogManager.getLogger(Tags.MODNAME);
911
}

src/main/java/com/github/gtexpert/testmod/api/util/ModUtility.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
package com.github.gtexpert.testmod.api.util;
22

3-
import com.github.gtexpert.testmod.api.ModValues;
43
import net.minecraft.util.ResourceLocation;
4+
55
import org.jetbrains.annotations.NotNull;
66

7+
import com.github.gtexpert.testmod.api.ModValues;
8+
79
public class ModUtility {
10+
811
public static @NotNull ResourceLocation id(String path) {
912
return new ResourceLocation(ModValues.MODID, path);
1013
}

src/main/java/com/github/gtexpert/testmod/api/util/Mods.java

Lines changed: 28 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
import org.jetbrains.annotations.NotNull;
2020
import org.jetbrains.annotations.Nullable;
2121

22-
2322
public enum Mods {
2423

2524
AEAdditions(Names.AE_ADDITIONS),
@@ -44,27 +43,27 @@ public enum Mods {
4443
ExtraCPUs(Names.EXTRA_CPUS),
4544
ExtraTrees(Names.EXTRA_TREES),
4645
Forestry(Names.FORESTRY),
47-
// ForestryApiculture(Names.FORESTRY, forestryModule(Names.FORESTRY_APICULTURE)),
48-
// ForestryArboriculture(Names.FORESTRY, forestryModule(Names.FORESTRY_ARBORICULTURE)),
49-
// ForestryCharcoal(Names.FORESTRY, forestryModule(Names.FORESTRY_CHARCOAL)),
50-
// ForestryCore(Names.FORESTRY, forestryModule(Names.FORESTRY_CORE)),
51-
// ForestryEnergy(Names.FORESTRY, forestryModule(Names.FORESTRY_ENERGY)),
52-
// ForestryFactory(Names.FORESTRY, forestryModule(Names.FORESTRY_FACTORY)),
53-
// ForestryWorktable(Names.FORESTRY, forestryModule(Names.FORESTRY_WORKTABLE)),
54-
// ForestryFarming(Names.FORESTRY, forestryModule(Names.FORESTRY_FARMING)),
55-
// ForestryClimatology(Names.FORESTRY, forestryModule(Names.FORESTRY_CLIMATOLOGY)),
56-
// ForestryGreenhouse(Names.FORESTRY, forestryModule(Names.FORESTRY_GREENHOUSE)),
57-
// ForestryFluids(Names.FORESTRY, forestryModule(Names.FORESTRY_FLUIDS)),
58-
// ForestryFood(Names.FORESTRY, forestryModule(Names.FORESTRY_FOOD)),
59-
// ForestryLepidopterology(Names.FORESTRY, forestryModule(Names.FORESTRY_LEPIDOPTEROLOGY)),
60-
// ForestryMail(Names.FORESTRY, forestryModule(Names.FORESTRY_MAIL)),
61-
// ForestryCrate(Names.FORESTRY, forestryModule(Names.FORESTRY_CRATE)),
62-
// ForestryBackpacks(Names.FORESTRY, forestryModule(Names.FORESTRY_BACKPACKS)),
63-
// ForestryDatabase(Names.FORESTRY, forestryModule(Names.FORESTRY_DATABASE)),
64-
// ForestrySorting(Names.FORESTRY, forestryModule(Names.FORESTRY_SORTING)),
65-
// ForestryBook(Names.FORESTRY, forestryModule(Names.FORESTRY_BOOK)),
66-
// ForestryCultivation(Names.FORESTRY, forestryModule(Names.FORESTRY_CULTIVATION)),
67-
// ForestryResearch(Names.FORESTRY, forestryModule(Names.FORESTRY_RESEARCH)),
46+
// ForestryApiculture(Names.FORESTRY, forestryModule(Names.FORESTRY_APICULTURE)),
47+
// ForestryArboriculture(Names.FORESTRY, forestryModule(Names.FORESTRY_ARBORICULTURE)),
48+
// ForestryCharcoal(Names.FORESTRY, forestryModule(Names.FORESTRY_CHARCOAL)),
49+
// ForestryCore(Names.FORESTRY, forestryModule(Names.FORESTRY_CORE)),
50+
// ForestryEnergy(Names.FORESTRY, forestryModule(Names.FORESTRY_ENERGY)),
51+
// ForestryFactory(Names.FORESTRY, forestryModule(Names.FORESTRY_FACTORY)),
52+
// ForestryWorktable(Names.FORESTRY, forestryModule(Names.FORESTRY_WORKTABLE)),
53+
// ForestryFarming(Names.FORESTRY, forestryModule(Names.FORESTRY_FARMING)),
54+
// ForestryClimatology(Names.FORESTRY, forestryModule(Names.FORESTRY_CLIMATOLOGY)),
55+
// ForestryGreenhouse(Names.FORESTRY, forestryModule(Names.FORESTRY_GREENHOUSE)),
56+
// ForestryFluids(Names.FORESTRY, forestryModule(Names.FORESTRY_FLUIDS)),
57+
// ForestryFood(Names.FORESTRY, forestryModule(Names.FORESTRY_FOOD)),
58+
// ForestryLepidopterology(Names.FORESTRY, forestryModule(Names.FORESTRY_LEPIDOPTEROLOGY)),
59+
// ForestryMail(Names.FORESTRY, forestryModule(Names.FORESTRY_MAIL)),
60+
// ForestryCrate(Names.FORESTRY, forestryModule(Names.FORESTRY_CRATE)),
61+
// ForestryBackpacks(Names.FORESTRY, forestryModule(Names.FORESTRY_BACKPACKS)),
62+
// ForestryDatabase(Names.FORESTRY, forestryModule(Names.FORESTRY_DATABASE)),
63+
// ForestrySorting(Names.FORESTRY, forestryModule(Names.FORESTRY_SORTING)),
64+
// ForestryBook(Names.FORESTRY, forestryModule(Names.FORESTRY_BOOK)),
65+
// ForestryCultivation(Names.FORESTRY, forestryModule(Names.FORESTRY_CULTIVATION)),
66+
// ForestryResearch(Names.FORESTRY, forestryModule(Names.FORESTRY_RESEARCH)),
6867
GalacticraftCore(Names.GALACTICRAFT_CORE),
6968
Genetics(Names.GENETICS),
7069
Gendustry(Names.GENDUSTRY),
@@ -297,11 +296,11 @@ private static Function<Mods, Boolean> versionExcludes(String versionPart) {
297296
}
298297

299298
/** Test if a specific Forestry module is enabled. */
300-
// private static Function<Mods, Boolean> forestryModule(String moduleID) {
301-
// if (Forestry.isModLoaded()) {
302-
// return mod -> forestry.modules.ModuleHelper.isEnabled(moduleID);
303-
// } else {
304-
// return $ -> false;
305-
// }
306-
// }
299+
// private static Function<Mods, Boolean> forestryModule(String moduleID) {
300+
// if (Forestry.isModLoaded()) {
301+
// return mod -> forestry.modules.ModuleHelper.isEnabled(moduleID);
302+
// } else {
303+
// return $ -> false;
304+
// }
305+
// }
307306
}

src/main/java/com/github/gtexpert/testmod/client/ClientProxy.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
package com.github.gtexpert.testmod.client;
22

3-
import com.github.gtexpert.testmod.common.CommonProxy;
43
import net.minecraftforge.client.event.ModelRegistryEvent;
54
import net.minecraftforge.fml.common.Mod;
65
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
76
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
87
import net.minecraftforge.fml.relauncher.Side;
98

9+
import com.github.gtexpert.testmod.common.CommonProxy;
10+
1011
@Mod.EventBusSubscriber(Side.CLIENT)
1112
public class ClientProxy extends CommonProxy {
13+
1214
@Override
1315
public void preInit(FMLPreInitializationEvent event) {
1416
super.preInit(event);

0 commit comments

Comments
 (0)