Skip to content

Commit

Permalink
Deprecate gradleTokenModId, gradleTokenModName and `gradleTokenGr…
Browse files Browse the repository at this point in the history
…oupName` (#253)
  • Loading branch information
glowredman committed Jan 15, 2024
1 parent 9fcfc9b commit b25a618
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 10 deletions.
19 changes: 16 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -428,18 +428,31 @@ minecraft {
for (f in replaceGradleTokenInFile.split(',')) {
tagReplacementFiles.add f
}
out.style(Style.Info).text('replaceGradleTokenInFile is deprecated! Consider using generateGradleTokenClass.').println()
}
if (gradleTokenModId) {
injectedTags.put gradleTokenModId, modId
if (replaceGradleTokenInFile) {
injectedTags.put gradleTokenModId, modId
} else {
out.style(Style.Failure).text('gradleTokenModId is deprecated! The field will no longer be generated.').println()
}
}
if (gradleTokenModName) {
injectedTags.put gradleTokenModName, modName
if (replaceGradleTokenInFile) {
injectedTags.put gradleTokenModName, modName
} else {
out.style(Style.Failure).text('gradleTokenModName is deprecated! The field will no longer be generated.').println()
}
}
if (gradleTokenVersion) {
injectedTags.put gradleTokenVersion, modVersion
}
if (gradleTokenGroupName) {
injectedTags.put gradleTokenGroupName, modGroup
if (replaceGradleTokenInFile) {
injectedTags.put gradleTokenGroupName, modGroup
} else {
out.style(Style.Failure).text('gradleTokenGroupName is deprecated! The field will no longer be generated.').println()
}
}
if (enableGenericInjection.toBoolean()) {
injectMissingGenerics.set(true)
Expand Down
7 changes: 3 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,11 @@ enableModernJavaSyntax = true
# Turns most publicly visible List, Map, etc. into proper List<Type>, Map<K, V> types
enableGenericInjection = false

# Generate a class with String fields for the mod id, name, version and group name named with the fields below
# Generate a class with a String field for the mod version named as defined below.
# If generateGradleTokenClass is empty or not missing, no such class will be generated.
# If gradleTokenVersion is empty or missing, the field will not be present in the class.
generateGradleTokenClass = com.myname.mymodid.Tags
gradleTokenModId = MODID
gradleTokenModName = MODNAME
gradleTokenVersion = VERSION
gradleTokenGroupName = GROUPNAME
# [DEPRECATED]
# Multiple source files can be defined here by providing a comma-seperated list: Class1.java,Class2.java,Class3.java
# public static final String VERSION = "GRADLETOKEN_VERSION";
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/myname/mymodid/CommonProxy.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public void preInit(FMLPreInitializationEvent event) {
Config.synchronizeConfiguration(event.getSuggestedConfigurationFile());

MyMod.LOG.info(Config.greeting);
MyMod.LOG.info("I am " + Tags.MODNAME + " at version " + Tags.VERSION);
MyMod.LOG.info("I am MyMod at version " + Tags.VERSION);
}

// load "Do your mod setup. Build whatever data structures you care about. Register recipes." (Remove if not needed)
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/com/myname/mymodid/MyMod.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.event.FMLServerStartingEvent;

@Mod(modid = Tags.MODID, version = Tags.VERSION, name = Tags.MODNAME, acceptedMinecraftVersions = "[1.7.10]")
@Mod(modid = MyMod.MODID, version = Tags.VERSION, name = "MyMod", acceptedMinecraftVersions = "[1.7.10]")
public class MyMod {

public static final Logger LOG = LogManager.getLogger(Tags.MODID);
public static final String MODID = "mymodid";
public static final Logger LOG = LogManager.getLogger(MODID);

@SidedProxy(clientSide = "com.myname.mymodid.ClientProxy", serverSide = "com.myname.mymodid.CommonProxy")
public static CommonProxy proxy;
Expand Down

0 comments on commit b25a618

Please sign in to comment.