Skip to content

Commit

Permalink
ornithe-ify
Browse files Browse the repository at this point in the history
  • Loading branch information
SpaceWalkerRS committed Sep 22, 2023
1 parent 1e38122 commit fb2597c
Show file tree
Hide file tree
Showing 18 changed files with 148 additions and 287 deletions.
170 changes: 55 additions & 115 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,150 +1,90 @@
buildscript {
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'
}
plugins {
id 'maven-publish'
id 'fabric-loom' version '1.3-SNAPSHOT'
id 'ploceus' version '1.3-SNAPSHOT'
}

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

minecraft {
version = project.minecraft_version
mappings = project.mappings_version
runDir = 'minecraft'
makeObfSourceJar = false
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8

ext.mod_version = project.mod_version

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

replaceIn "MaLiLibReference.java"
replace "@MOD_VERSION@", mod_version
repositories {
}

compileJava {
sourceCompatibility = 1.8
targetCompatibility = 1.8
options.encoding = 'UTF-8'
}
ext.configFile = file "build.properties"

sourceSets {
main {
ext.refMap = 'mixins.' + project.mod_id + '.refmap.json'
}
configFile.withReader {
def prop = new Properties()
prop.load(it)
project.ext.config = new ConfigSlurper().parse prop
}

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
//dependsOn = [ 'modid', 'othermod' ]
//requiredAPIs = [ 'someapi' ]
//tweakClass = 'name.of.tweaker.here'
mixinConfigs = [ 'mixins.' + project.mod_id + '.json' ]
}
dependencies {
minecraft "com.mojang:minecraft:${config.minecraft_version}"
mappings loom.layered {
addLayer ploceus.mcpMappings('stable', '1.12', '39')
}
modImplementation "net.fabricmc:fabric-loader:${config.fabric_loader_version}"
implementation "com.google.code.findbugs:jsr305:3.0.2"
ploceus.dependOsl(config.osl_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
)
*/
group = config.group + "." + config.mod_id
base {
archivesName = config.mod_file_name + '-' + config.minecraft_version_out
}
version = config.mod_version

mixin {
defaultObfuscationEnv notch
if (version.endsWith('-dev')) {
version += "." + new Date().format('yyyyMMdd.HHmmss')
}

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

processResources
{
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.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'
//inputs.property "minecraft_version", project.config.minecraft_version

inputs.property "mod_version", config.mod_version

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

task deobfJar(type: Jar) {
from sourceSets.main.output
// This classifier is standard and should not be changed
classifier = 'deobf'
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"

it.options.release = 8
}

// This section enables the last two tasks
artifacts {
//archives sourcesJar
archives deobfJar
java {
// 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()
}

jar {
from("LICENSE") {
rename { "${it}_${project.base.archivesName.get()}"}
}
}

tasks.publish.dependsOn build
publishing {
publications {
mavenJava(MavenPublication) {
artifactId project.archivesBaseName
from components.java

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

Expand Down
16 changes: 16 additions & 0 deletions build.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Thu Jan 14 08:33:00 EET 2016
group = fi.dy.masa
mod_id = malilib
mod_name = MaLiLib
author = masa
mod_file_name = malilib-fabric

# Current mod version
mod_version = 0.54.0.2

# Minecraft, Fabric and mappings versions
minecraft_version_out = 1.12.2
minecraft_version = 1.12.2

fabric_loader_version = 0.14.22
osl_version = 0.10.0
16 changes: 0 additions & 16 deletions gradle.properties

This file was deleted.

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()
}
}
63 changes: 0 additions & 63 deletions src/main/java/malilib/LiteModMaLiLib.java

This file was deleted.

8 changes: 7 additions & 1 deletion src/main/java/malilib/MaLiLib.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,17 @@

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

public class MaLiLib
public class MaLiLib implements ModInitializer
{
public static final Logger LOGGER = LogManager.getLogger(MaLiLibReference.MOD_ID);

@Override
public void init()
{
}

public static boolean canShowCoordinates()
{
return MaLiLibConfigs.Generic.HIDE_ALL_COORDINATES.getBooleanValue() == false;
Expand Down
11 changes: 0 additions & 11 deletions src/main/java/malilib/MaLiLibConfigPanel.java

This file was deleted.

3 changes: 1 addition & 2 deletions src/main/java/malilib/config/util/ConfigUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import java.util.List;
import java.util.Map;
import java.util.function.Predicate;
import com.mumfrey.liteloader.core.LiteLoader;
import org.apache.commons.lang3.StringUtils;

import net.minecraft.util.text.TextFormatting;
Expand Down Expand Up @@ -38,7 +37,7 @@ public class ConfigUtils
{
public static Path getConfigDirectory()
{
return LiteLoader.getCommonConfigFolder().toPath();
return FileUtils.getMinecraftDirectory().resolve("config");
}

/**
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/malilib/gui/BaseScreen.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package malilib.gui;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.function.Predicate;
Expand Down Expand Up @@ -695,7 +694,7 @@ public boolean isMouseOver(int mouseX, int mouseY)
}

@Override
public void handleKeyboardInput() throws IOException
public void handleKeyboardInput()
{
if (Keyboard.getEventKeyState() == false &&
this.onKeyReleased(Keyboard.getEventKey(), 0, 0))
Expand Down
Loading

0 comments on commit fb2597c

Please sign in to comment.