Skip to content

Commit

Permalink
Port to Ornithe 1.12.2
Browse files Browse the repository at this point in the history
  • Loading branch information
maruohon committed Dec 26, 2023
1 parent e59c3d0 commit 438c7ce
Show file tree
Hide file tree
Showing 14 changed files with 196 additions and 187 deletions.
198 changes: 99 additions & 99 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,130 +1,130 @@
plugins {
id 'fabric-loom' version '1.4.5'
id 'ploceus' version '1.4.2'
id 'maven-publish'
}

buildscript {
repositories {
maven {
name = 'forge'
url = 'https://files.minecraftforge.net/maven'
}
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8

maven {
name = 'sponge'
url = 'https://repo.spongepowered.org/repository/maven-public'
}
}
group = project.mod_id // http://maven.apache.org/guides/mini/guide-naming-conventions.html
version = project.mod_version

dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT'
classpath 'org.spongepowered:mixingradle:0.6-SNAPSHOT'
}
if (version.endsWith('-dev')) {
version = version + "." + new Date().format('yyyyMMdd.HHmmss')
}

repositories {
maven {
url 'https://masa.dy.fi/maven'
}
base {
archivesName = project.mod_file_name + '-' + project.minecraft_version_out
}

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

minecraft {
version = project.minecraft_version
mappings = project.mappings_version
runDir = 'minecraft'
makeObfSourceJar = false
repositories {
// Add repositories to retrieve artifacts from in here.
// You should only use this when depending on other mods because
// Loom adds the essential maven repositories to download Minecraft and libraries from automatically.
// See https://docs.gradle.org/current/userguide/declaring_repositories.html
// for more information about repositories.
// maven { url 'https://maven.terraformersmc.com/releases/' }

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

ext.mod_version = project.mod_version
dependencies {
minecraft "com.mojang:minecraft:${project.minecraft_version}"

if (mod_version.endsWith('-dev')) {
mod_version = mod_version + "." + new Date().format('yyyyMMdd.HHmmss')
mappings loom.layered {
addLayer ploceus.mcpMappings('stable', '1.12', '39')
//mappings "net.ornithemc:feather:${project.minecraft_version}+build.${project.feather_build}:v2"
//addLayer ploceus.nestedMappings() // remove this line if not using nests
}
//nests "net.ornithemc:nests:${project.minecraft_version}+build.${project.nests_build}" // remove this line if not using nests

replaceIn 'Reference.java'
replace '@MOD_VERSION@', mod_version
}
modImplementation "net.fabricmc:fabric-loader:${project.fabric_loader_version}"
modImplementation "com.terraformersmc:modmenu:${project.mod_menu_version}"
implementation "com.google.code.findbugs:jsr305:3.0.2"

dependencies {
deobfCompile "malilib:malilib-liteloader-${project.minecraft_version_out}:${project.malilib_version}:deobf"
//ploceus.addCommonLibraries()
ploceus.dependOsl(project.osl_version)

modImplementation "malilib:malilib-ornithe-${project.minecraft_version_out}:${project.malilib_version}"
}

sourceSets {
main {
ext.refMap = "mixins.${project.mod_id}.refmap.json"
loom {
decompilers {
vineflower {
options.put("ind", " ")
//preferences {
// ind = ' '
//}
}
}
}

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 = 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" ]
processResources {
// Exclude the GIMP image files
exclude '**/*.xcf'
exclude '**/xcf'

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

inputs.property "mod_version", version

filesMatching("fabric.mod.json") {
expand "mod_version": version
}
}

/**
* This section allows you to customise your generated jar (litemod) file. By
* default it includes the generated litemod.json file, however if you prefer to
* 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': project.mod_id,
'Implementation-Version': project.version
)
*/
}
tasks.withType(JavaCompile).configureEach {
// ensure that the encoding is set to UTF-8, no matter what the system default is
// this fixes some edge cases with special characters not displaying correctly
// see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
// If Javadoc is generated, this must be specified in that task too.
it.options.encoding = "UTF-8"

mixin {
defaultObfuscationEnv notch
it.options.release = 8
}

//tasks.withType(Jar)*.baseName = archivesBaseName
java {
// Still required by IDEs such as Eclipse and Visual Studio Code
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8

processResources
{
// Exclude the GIMP image files
exclude '**/*.xcf'
exclude '**/xcf'
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task if it is present.
// If you remove this line, sources will not be generated.
withSourcesJar()

// 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
// If this mod is going to be a library, then it should also generate Javadocs in order to aid with development.
// Uncomment this line to generate them.
// withJavadocJar()
}

// If you plan to use a different file for the license, don't forget to change the file name here!
/*
jar {
from('LICENSE') {
rename { "${it}_${base.archivesName.get()}" }
}
}
*/

// replace stuff in mcmod.info, nothing else
from(sourceSets.main.resources.srcDirs) {
include 'mcmod.info'
// Configure the maven publication
tasks.publish.dependsOn build

// replace version and mcversion
expand 'mod_version': project.minecraft.mod_version, 'minecraft_version': project.minecraft_version
publishing {
publications {
mavenJava(MavenPublication) {
artifactId project.archivesBaseName

// add all the jars that should be included when publishing to maven
//artifact(jar) { builtBy remapJar }
from components.java
}
}

// copy everything else, thats not the mcmod.info
from(sourceSets.main.resources.srcDirs) {
exclude 'mcmod.info'
repositories {
maven {
url "$projectDir/../../CommonMaven"
}
}
}
15 changes: 8 additions & 7 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,18 @@ org.gradle.daemon = false
org.gradle.cache.cleanup = false

mod_id = minihud
mod_file_name = minihud-liteloader
mod_name = MiniHUD
author = masa
mod_file_name = minihud-ornithe

# Current mod version
mod_version = 0.41.1
mod_version = 0.50.0-alpha.1

# malilib version to build against
malilib_version = 0.55.0
# Required malilib version
malilib_version = 0.60.0-alpha.1

# Minecraft and mappings version
# Minecraft, Fabric Loader, mappings and dependencies versions
minecraft_version_out = 1.12.2
minecraft_version = 1.12.2
mappings_version = stable_39
fabric_loader_version = 0.15.3
osl_version = 0.11.3
mod_menu_version = 0.1.1+mc1.12.2
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
17 changes: 17 additions & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
pluginManagement {
repositories {
maven {
name = 'Fabric'
url = 'https://maven.fabricmc.net/'
}
maven {
name = 'Ornithe Releases'
url = 'https://maven.ornithemc.net/releases'
}
maven {
name = 'Ornithe Snapshots'
url = 'https://maven.ornithemc.net/snapshots'
}
gradlePluginPortal()
}
}
45 changes: 0 additions & 45 deletions src/main/java/minihud/LiteModMiniHud.java

This file was deleted.

10 changes: 9 additions & 1 deletion src/main/java/minihud/MiniHud.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
package minihud;

import net.ornithemc.osl.entrypoints.api.client.ClientModInitializer;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import malilib.registry.Registry;
import minihud.config.Configs;

public class MiniHud
public class MiniHud implements ClientModInitializer
{
public static final Logger LOGGER = LogManager.getLogger(Reference.MOD_ID);

Expand All @@ -16,4 +18,10 @@ public static void debugLog(String msg, Object... args)
LOGGER.info(msg, args);
}
}

@Override
public void initClient()
{
Registry.INITIALIZATION_DISPATCHER.registerInitializationHandler(new InitHandler());
}
}
20 changes: 20 additions & 0 deletions src/main/java/minihud/compat/modmenu/ModMenuImpl.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package minihud.compat.modmenu;

import com.terraformersmc.modmenu.api.ConfigScreenFactory;
import com.terraformersmc.modmenu.api.ModMenuApi;

import malilib.gui.BaseScreen;
import minihud.gui.ConfigScreen;

public class ModMenuImpl implements ModMenuApi
{
@Override
public ConfigScreenFactory<?> getModConfigScreenFactory()
{
return (currentScreen) -> {
BaseScreen screen = ConfigScreen.create();
screen.setParent(currentScreen);
return screen;
};
}
}
11 changes: 0 additions & 11 deletions src/main/java/minihud/gui/MiniHudConfigPanel.java

This file was deleted.

Binary file added src/main/resources/assets/minihud/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 438c7ce

Please sign in to comment.