Skip to content

Commit

Permalink
Re-package the mod and switch from build.properties to `gradle.prop…
Browse files Browse the repository at this point in the history
…erties`
  • Loading branch information
maruohon committed Oct 25, 2022
1 parent 1912e77 commit 07f7b2c
Show file tree
Hide file tree
Showing 106 changed files with 447 additions and 455 deletions.
176 changes: 84 additions & 92 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,87 +1,79 @@

buildscript {
repositories {
jcenter()
maven {
name = "forge"
url = "https://files.minecraftforge.net/maven"
}
maven {
name = 'sponge'
url = 'https://repo.spongepowered.org/repository/maven-public'
}
}

dependencies {
classpath "net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT"
classpath 'org.spongepowered:mixingradle:0.6-SNAPSHOT'
}
repositories {
maven {
name = 'forge'
url = 'https://files.minecraftforge.net/maven'
}

maven {
name = 'sponge'
url = 'https://repo.spongepowered.org/repository/maven-public'
}
}

dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT'
classpath 'org.spongepowered:mixingradle:0.6-SNAPSHOT'
}
}

repositories {
maven {
url 'https://masa.dy.fi/maven'
}
maven {
url 'https://masa.dy.fi/maven'
}
}

apply plugin: 'net.minecraftforge.gradle.liteloader'
apply plugin: 'org.spongepowered.mixin'

ext.configFile = file "build.properties"

configFile.withReader {
def prop = new Properties()
prop.load(it)
project.ext.config = new ConfigSlurper().parse prop
}

minecraft {
version = config.minecraft_version
mappings = config.mappings_version
runDir = 'minecraft'
makeObfSourceJar = false
version = project.minecraft_version
mappings = project.mappings_version
runDir = 'minecraft'
makeObfSourceJar = false

ext.mod_version = config.mod_version
ext.mod_version = project.mod_version

if (mod_version.endsWith('-dev')) {
mod_version = mod_version + "." + new Date().format('yyyyMMdd.HHmmss')
}
if (mod_version.endsWith('-dev')) {
mod_version = mod_version + "." + new Date().format('yyyyMMdd.HHmmss')
}

replaceIn "Reference.java"
replace "@MOD_VERSION@", mod_version
replaceIn 'Reference.java'
replace '@MOD_VERSION@', mod_version
}

dependencies {
deobfCompile "malilib:malilib-liteloader-" + config.minecraft_version_out + ":" + config.malilib_version + ":deobf"
deobfCompile "malilib:malilib-liteloader-${project.minecraft_version_out}:${project.malilib_version}:deobf"
}

sourceSets {
main {
ext.refMap = 'mixins.' + config.mod_id + '.refmap.json'
}
main {
ext.refMap = "mixins.${project.mod_id}.refmap.json"
}
}

group = config.group + config.mod_id // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = config.mod_file_name + '-' + config.minecraft_version_out
group = project.mod_id // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "${project.mod_file_name}-${project.minecraft_version_out}"
version = project.minecraft.mod_version

/**
* This section allows you to customise the generated litemod.json file
*/
litemod {
json {
name = config.mod_id
displayName = config.mod_name
mcversion = config.minecraft_version
version = config.mod_version
author = config.author

// Uncomment any of the following lines and fill in your own details as required
//requiredAPIs = [ 'someapi' ]
//tweakClass = 'name.of.tweaker.here'
dependsOn = [ 'malilib' ]
mixinConfigs = [ 'mixins.' + config.mod_id + '.json' ]
}
json {
name = project.mod_id
displayName = project.mod_name
mcversion = project.minecraft_version
version = project.minecraft.mod_version
author = project.author

// Uncomment any of the following lines and fill in your own details as required
//requiredAPIs = [ 'someapi' ]
//tweakClass = 'name.of.tweaker.here'
dependsOn = [ 'malilib' ]
mixinConfigs = [ "mixins.${project.mod_id}.json" ]
}
}

/**
Expand All @@ -90,49 +82,49 @@ litemod {
* include your own file from resources, simply remove the line below.
*/
jar {
// Remove the "-mc1.12" suffix from the file name
classifier = ""
// Don't append a 'mod-' filename prefix >_>
baseName = archivesBaseName

from litemod.outputs

/*
manifest.mainAttributes (
'Built-By': System.properties['user.name'],
'Created-By': System.properties['java.vm.version'] + " (" + System.properties['java.vm.vendor'] + ")",
'Implementation-Title': config.mod_id,
'Implementation-Version': project.version
)
*/
// Remove the "-mc1.12" suffix from the file name
classifier = ""
// Don't append a 'mod-' filename prefix >_>
baseName = archivesBaseName

from litemod.outputs

/*
manifest.mainAttributes (
'Built-By': System.properties['user.name'],
'Created-By': System.properties['java.vm.version'] + " (" + System.properties['java.vm.vendor'] + ")",
'Implementation-Title': project.mod_id,
'Implementation-Version': project.version
)
*/
}

mixin {
defaultObfuscationEnv notch
defaultObfuscationEnv notch
}

//tasks.withType(Jar)*.baseName = archivesBaseName

processResources
{
// Exclude the GIMP image files
exclude '**/*.xcf'
exclude '**/xcf'

// this will ensure that this task is redone when the versions change.
inputs.property "mod_version", project.minecraft.mod_version
inputs.property "minecraft_version", project.config.minecraft_version

// replace stuff in mcmod.info, nothing else
from(sourceSets.main.resources.srcDirs) {
include 'mcmod.info'
// replace version and mcversion
expand 'mod_version': project.minecraft.mod_version, 'minecraft_version': project.config.minecraft_version
}
// copy everything else, thats not the mcmod.info
from(sourceSets.main.resources.srcDirs) {
exclude 'mcmod.info'
}
// Exclude the GIMP image files
exclude '**/*.xcf'
exclude '**/xcf'

// this will ensure that this task is redone when the versions change.
inputs.property 'mod_version', project.minecraft.mod_version
inputs.property 'minecraft_version', project.minecraft_version

// replace stuff in mcmod.info, nothing else
from(sourceSets.main.resources.srcDirs) {
include 'mcmod.info'

// replace version and mcversion
expand 'mod_version': project.minecraft.mod_version, 'minecraft_version': project.minecraft_version
}

// copy everything else, thats not the mcmod.info
from(sourceSets.main.resources.srcDirs) {
exclude 'mcmod.info'
}
}
12 changes: 7 additions & 5 deletions build.properties → gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Thu Jan 14 08:33:00 EET 2016
group = fi.dy.masa
org.gradle.jvmargs = -Xmx3G
org.gradle.daemon = false
org.gradle.cache.cleanup = false

mod_id = minihud
mod_file_name = minihud-liteloader
mod_name = MiniHUD
Expand All @@ -8,10 +10,10 @@ author = masa
# Current mod version
mod_version = 0.41.1

# Required malilib version
# malilib version to build against
malilib_version = 0.55.0

# Minecraft, Forge and MCP mappings versions
# Minecraft and mappings version
minecraft_version_out = 1.12.2
minecraft_version = 1.12.2
mappings_version = stable_39
mappings_version = stable_39
Original file line number Diff line number Diff line change
@@ -1,29 +1,28 @@
package fi.dy.masa.minihud;
package minihud;

import malilib.config.JsonModConfig;
import malilib.config.JsonModConfig.ConfigDataUpdater;
import malilib.config.util.ConfigUpdateUtils.KeyBindSettingsResetter;
import malilib.event.InitializationHandler;
import malilib.gui.config.ConfigSearchInfo;
import malilib.registry.Registry;
import fi.dy.masa.minihud.config.ConfigCallbacks;
import fi.dy.masa.minihud.config.Configs;
import fi.dy.masa.minihud.config.InfoLineToggle;
import fi.dy.masa.minihud.config.RendererToggle;
import fi.dy.masa.minihud.config.StructureToggle;
import fi.dy.masa.minihud.event.ClientTickHandler;
import fi.dy.masa.minihud.event.ClientWorldChangeHandler;
import fi.dy.masa.minihud.event.RenderHandler;
import fi.dy.masa.minihud.feature.Actions;
import fi.dy.masa.minihud.gui.ConfigScreen;
import fi.dy.masa.minihud.gui.widget.InfoLineConfigWidget;
import fi.dy.masa.minihud.gui.widget.RendererToggleConfigWidget;
import fi.dy.masa.minihud.gui.widget.StructureToggleConfigWidget;
import fi.dy.masa.minihud.gui.widget.info.RendererToggleConfigStatusWidget;
import fi.dy.masa.minihud.gui.widget.info.StructureRendererConfigStatusWidget;
import fi.dy.masa.minihud.input.MiniHudHotkeyProvider;
import fi.dy.masa.minihud.network.servux.ServuxInfoSubDataPacketHandler;
import fi.dy.masa.minihud.network.servux.ServuxInfoSubRegistrationPacketHandler;
import minihud.config.ConfigCallbacks;
import minihud.config.Configs;
import minihud.config.InfoLineToggle;
import minihud.config.RendererToggle;
import minihud.config.StructureToggle;
import minihud.event.ClientTickHandler;
import minihud.event.ClientWorldChangeHandler;
import minihud.event.RenderHandler;
import minihud.gui.ConfigScreen;
import minihud.gui.widget.InfoLineConfigWidget;
import minihud.gui.widget.RendererToggleConfigWidget;
import minihud.gui.widget.StructureToggleConfigWidget;
import minihud.gui.widget.info.RendererToggleConfigStatusWidget;
import minihud.gui.widget.info.StructureRendererConfigStatusWidget;
import minihud.input.MiniHudHotkeyProvider;
import minihud.network.servux.ServuxInfoSubDataPacketHandler;
import minihud.network.servux.ServuxInfoSubRegistrationPacketHandler;

public class InitHandler implements InitializationHandler
{
Expand Down Expand Up @@ -62,7 +61,7 @@ public void registerModHandlers()
Registry.CLIENT_PACKET_CHANNEL_HANDLER.registerClientChannelHandler(ServuxInfoSubRegistrationPacketHandler.INSTANCE);
Registry.CLIENT_PACKET_CHANNEL_HANDLER.registerClientChannelHandler(ServuxInfoSubDataPacketHandler.INSTANCE);

Actions.init();
MiniHUDActions.init();
ConfigCallbacks.init();
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package fi.dy.masa.minihud;
package minihud;

import java.io.File;
import com.mumfrey.liteloader.Configurable;
Expand All @@ -8,7 +8,7 @@
import org.apache.logging.log4j.Logger;

import malilib.registry.Registry;
import fi.dy.masa.minihud.gui.MiniHudConfigPanel;
import minihud.gui.MiniHudConfigPanel;

public class LiteModMiniHud implements LiteMod, Configurable
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package fi.dy.masa.minihud;
package minihud;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import fi.dy.masa.minihud.config.Configs;
import minihud.config.Configs;

public class MiniHUD
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
package fi.dy.masa.minihud.feature;
package minihud;

import malilib.action.ActionUtils;
import malilib.action.NamedAction;
import malilib.listener.EventListener;
import fi.dy.masa.minihud.Reference;
import fi.dy.masa.minihud.config.Configs;
import fi.dy.masa.minihud.config.InfoLineToggle;
import fi.dy.masa.minihud.config.RendererToggle;
import fi.dy.masa.minihud.config.StructureToggle;
import fi.dy.masa.minihud.data.DataStorage;
import fi.dy.masa.minihud.gui.ConfigScreen;
import fi.dy.masa.minihud.gui.GuiShapeEditor;
import fi.dy.masa.minihud.gui.ShapeManagerScreen;
import minihud.config.Configs;
import minihud.config.InfoLineToggle;
import minihud.config.RendererToggle;
import minihud.config.StructureToggle;
import minihud.data.DataStorage;
import minihud.gui.ConfigScreen;
import minihud.gui.GuiShapeEditor;
import minihud.gui.ShapeManagerScreen;

public class Actions
public class MiniHUDActions
{
public static final NamedAction OPEN_CONFIG_SCREEN = register("openConfigScreen", ConfigScreen::open);
public static final NamedAction OPEN_SHAPE_EDITOR = register("openShapeEditor", GuiShapeEditor::openShapeEditor);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package fi.dy.masa.minihud;
package minihud;

import malilib.util.data.ModInfo;

Expand Down
Loading

0 comments on commit 07f7b2c

Please sign in to comment.