TheIllusiveC4 6 years ago
parent
commit
1766794396

+ 68 - 20
build.gradle

@@ -1,42 +1,58 @@
 buildscript {
     repositories {
         maven { url = 'https://files.minecraftforge.net/maven' }
+        maven { url 'https://plugins.gradle.org/m2/' }
         jcenter()
         mavenCentral()
     }
     dependencies {
         classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '3.+', changing: true
+        classpath 'gradle.plugin.com.matthewprenger:CurseGradle:1.2.0'
     }
 }
 apply plugin: 'net.minecraftforge.gradle'
+apply plugin: 'com.matthewprenger.cursegradle'
 
-version = "${version_minecraft}-${version_mod}"
-group = "${mod_group}.${mod_id}"
+version = "${version_minecraft}-${mod_version}"
+group = "${mod_group}"
 archivesBaseName = "${mod_id}"
 
 sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8'
 
 minecraft {
-    mappings channel: 'snapshot', version: '20180921-1.13'
-	
+    mappings channel: 'snapshot', version: "${version_mcp}".toString()
+
     runs {
-        client = {
-            properties 'forge.logging.markers': 'SCAN,REGISTRIES,REGISTRYDUMP'
-            properties 'forge.logging.console.level': 'debug'
-            workingDirectory project.file('run').canonicalPath
-            source sourceSets.main
+        client {
+            workingDirectory project.file('run')
+
+            property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
+            property 'forge.logging.console.level', 'debug'
+
+            mods {
+                cakechomps {
+                    source sourceSets.main
+                }
+            }
         }
-        server = {
-            properties 'forge.logging.markers': 'SCAN,REGISTRIES,REGISTRYDUMP'
-            properties 'forge.logging.console.level': 'debug'
-            workingDirectory project.file('run').canonicalPath
-            source sourceSets.main
+
+        server {
+            workingDirectory project.file('run')
+
+            property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
+            property 'forge.logging.console.level', 'debug'
+
+            mods {
+                cakechomps {
+                    source sourceSets.main
+                }
+            }
         }
     }
 }
 
 dependencies {
-    minecraft 'net.minecraftforge:forge:1.13.2-25.0.10'
+    minecraft "net.minecraftforge:forge:${version_forge}"
 }
 
 sourceSets {
@@ -49,12 +65,44 @@ sourceSets {
 
 jar {
     manifest {
-        attributes(["Specification-Title": "${archivesBaseName}",
-                    "Specification-Vendor": "C4",
-                    "Specification-Version": "24.0",
-                    "Implementation-Title": project.name,
+        attributes(["Specification-Title": "${mod_name}",
+                    "Specification-Vendor": "${mod_author}",
+                    "Specification-Version": "${version}",
+                    "Implementation-Title": "${mod_name}",
                     "Implementation-Version": "${version}",
-                    "Implementation-Vendor" :"C4",
+                    "Implementation-Vendor" :"${mod_author}",
                     "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")],)
     }
+}
+
+task sourcesJar(type: Jar) {
+    classifier = 'sources'
+    from sourceSets.main.allJava
+}
+
+tasks.build.dependsOn sourcesJar
+
+processResources {
+
+    from(sourceSets.main.resources.srcDirs) {
+        include 'META-INF/mods.toml'
+        expand 'version': project.version, 'mod_id' : mod_id, 'mod_name': mod_name, 'mod_url': mod_url, 'mod_author': mod_author, 'mod_description': mod_description, 'mod_icon': mod_icon
+    }
+
+    from(sourceSets.main.resources.srcDirs) {
+        exclude 'META-INF/mods.toml'
+    }
+}
+
+
+curseforge {
+
+    project {
+        apiKey = findProperty('curseKey') ?: 0
+        id = "${curse_id}"
+        releaseType = "${curse_release}"
+        changelogType = 'markdown'
+        changelog = file('docs/CHANGELOG.md')
+        addArtifact(sourcesJar)
+    }
 }

+ 20 - 4
gradle.properties

@@ -1,6 +1,22 @@
-mod_group=top.theillusivec4
+# Gradle
+org.gradle.jvmargs=-Xmx3G
+org.gradle.daemon=false
+
+# Mod
+mod_version=2.0-pre1
+mod_group=top.theillusivec4.customfov
 mod_id=customfov
-mod_class=CustomFoV
+mod_name=Custom FoV
+mod_url=https://minecraft.curseforge.com/projects/custom-fov
+mod_author=C4
+mod_description=Allows customization of various field of view settings.
+mod_icon=customfov_icon.png
+
+# Dependencies
+version_minecraft=1.13.2
+version_forge=1.13.2-25.0.92
+version_mcp=20190316-1.13.2
 
-version_mod=2.0-pre1
-version_minecraft=1.13.2
+# Curse
+curse_id=303938
+curse_release=beta

+ 2 - 2
src/main/java/top/theillusivec4/customfov/CustomFoV.java

@@ -25,7 +25,7 @@ import net.minecraftforge.fml.common.Mod;
 import net.minecraftforge.fml.config.ModConfig;
 import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
 import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
-import top.theillusivec4.customfov.core.EventHandler;
+import top.theillusivec4.customfov.core.EventHandlerFoV;
 import top.theillusivec4.customfov.core.FoVConfig;
 
 @Mod(CustomFoV.MODID)
@@ -39,6 +39,6 @@ public class CustomFoV {
     }
 
     private void setupClient(final FMLClientSetupEvent evt) {
-        MinecraftForge.EVENT_BUS.register(new EventHandler());
+        MinecraftForge.EVENT_BUS.register(new EventHandlerFoV());
     }
 }

+ 1 - 1
src/main/java/top/theillusivec4/customfov/core/EventHandler.java → src/main/java/top/theillusivec4/customfov/core/EventHandlerFoV.java

@@ -33,7 +33,7 @@ import net.minecraftforge.client.event.FOVUpdateEvent;
 import net.minecraftforge.eventbus.api.EventPriority;
 import net.minecraftforge.eventbus.api.SubscribeEvent;
 
-public class EventHandler {
+public class EventHandlerFoV {
 
     @SubscribeEvent(priority = EventPriority.HIGHEST)
     public void onFoVUpdate(FOVUpdateEvent evt) {

+ 4 - 4
src/main/java/top/theillusivec4/customfov/core/FoVConfig.java

@@ -19,10 +19,10 @@
 
 package top.theillusivec4.customfov.core;
 
-import net.minecraftforge.common.ForgeConfig;
 import net.minecraftforge.common.ForgeConfigSpec;
-import net.minecraftforge.common.ForgeConfigSpec.*;
-import org.apache.commons.lang3.tuple.Pair;
+import net.minecraftforge.common.ForgeConfigSpec.BooleanValue;
+import net.minecraftforge.common.ForgeConfigSpec.Builder;
+import net.minecraftforge.common.ForgeConfigSpec.DoubleValue;
 import top.theillusivec4.customfov.CustomFoV;
 
 public class FoVConfig {
@@ -132,7 +132,7 @@ public class FoVConfig {
         }
 
         {
-            builder.push("Effects");
+            builder.push("Speed Effects");
 
             effectsModifier = builder
                     .comment("The modifier to multiply by the original FoV modifier")

+ 11 - 11
src/main/resources/META-INF/mods.toml

@@ -1,25 +1,25 @@
 modLoader="javafml"
 loaderVersion="[25,)"
 issueTrackerURL="https://github.com/TheIllusiveC4/CustomFoV/issues"
-displayURL="https://minecraft.curseforge.com/projects/custom-fov"
-logoFile="customfov_icon.png"
-authors="C4"
+displayURL="${mod_url}"
+logoFile="${mod_icon}"
+authors="${mod_author}"
 [[mods]]
-modId="customfov"
-version="${file.jarVersion}"
-displayName="Custom FoV"
+modId="${mod_id}"
+version="${version}"
+displayName="${mod_name}"
 description='''
-Allows customization of various field of view settings.
+${mod_description}
 '''
-[[dependencies.comforts]]
+[[dependencies.customfov]]
     modId="forge"
     mandatory=true
     versionRange="[25,)"
     ordering="NONE"
-    side="BOTH"
-[[dependencies.comforts]]
+    side="CLIENT"
+[[dependencies.customfov]]
     modId="minecraft"
     mandatory=true
     versionRange="[1.13,1.14)"
     ordering="NONE"
-    side="BOTH"
+    side="CLIENT"

+ 0 - 53
src/main/resources/assets/customfov/lang/en_us.lang

@@ -1,53 +0,0 @@
-###############
-#    Config   #
-###############
-gui.customfov.config.staticFoV=Static FoV
-gui.customfov.config.staticFoV.tooltip=Set to true to disable all vanilla FoV modifiers
-
-customfov.general.flying=Flying
-customfov.general.flying.tooltip=Configure flying FoV settings
-customfov.general.flying.modifier=Modifier
-customfov.general.flying.modifier.tooltip=The modifier to multiply by the original FoV modifier
-customfov.general.flying.maxvalue=Max Value
-customfov.general.flying.maxvalue.tooltip=The maximum FoV flying modifier value
-customfov.general.flying.minvalue=Min Value
-customfov.general.flying.minvalue.tooltip=The minimum FoV flying modifier value
-
-customfov.general.aiming=Aiming
-customfov.general.aiming.tooltip=Configure aiming FoV settings
-customfov.general.aiming.modifier=Modifier
-customfov.general.aiming.modifier.tooltip=The modifier to multiply by the original FoV modifier
-customfov.general.aiming.maxvalue=Max Value
-customfov.general.aiming.maxvalue.tooltip=The maximum FoV aiming modifier value
-customfov.general.aiming.minvalue=Min Value
-customfov.general.aiming.minvalue.tooltip=The minimum FoV aiming modifier value
-
-customfov.general.speed=Speed
-customfov.general.speed.tooltip=Configure speed FoV settings
-
-customfov.general.speed.sprinting=Sprinting
-customfov.general.speed.sprinting.tooltip=Configure sprinting FoV settings
-customfov.general.speed.sprinting.modifier=Modifier
-customfov.general.speed.sprinting.modifier.tooltip=The modifier to multiply by the original FoV modifier
-customfov.general.speed.sprinting.maxvalue=Max Value
-customfov.general.speed.sprinting.maxvalue.tooltip=The maximum FoV sprinting modifier value
-customfov.general.speed.sprinting.minvalue=Min Value
-customfov.general.speed.sprinting.minvalue.tooltip=The minimum FoV sprinting modifier value
-
-customfov.general.speed.effects=Effects
-customfov.general.speed.effects.tooltip=Configure speed potion effects FoV settings
-customfov.general.speed.effects.modifier=Modifier
-customfov.general.speed.effects.modifier.tooltip=The modifier to multiply by the original FoV modifier
-customfov.general.speed.effects.maxvalue=Max Value
-customfov.general.speed.effects.maxvalue.tooltip=The maximum FoV effects modifier value
-customfov.general.speed.effects.minvalue=Min Value
-customfov.general.speed.effects.minvalue.tooltip=The minimum FoV effects modifier value
-
-customfov.general.underwater=Underwater
-customfov.general.underwater.tooltip=Configure underwater FoV settings
-customfov.general.underwater.modifier=Modifier
-customfov.general.underwater.modifier.tooltip=The modifier to multiply by the original FoV modifier
-customfov.general.underwater.maxvalue=Max Value
-customfov.general.underwater.maxvalue.tooltip=The maximum FoV underwater modifier value
-customfov.general.underwater.minvalue=Min Value
-customfov.general.underwater.minvalue.tooltip=The minimum FoV underwater modifier value