Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2025 DevPieter
Copyright (c) 2026 DevPieter

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
55 changes: 39 additions & 16 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,19 +1,28 @@
plugins {
id 'fabric-loom'
id 'net.fabricmc.fabric-loom'
id 'com.replaymod.preprocess'
id 'maven-publish'
}

def targetJavaVersion = 21

def isSnapshot = providers.environmentVariable("SNAPSHOT_BUILD").map { it.toBoolean() }.orElse(false).get()
def buildNumber = System.getenv('BUILD_NUMBER') ?: 'dev'

group = maven_group
version = "${mod_version}+${minecraft_version}-${max_minecraft_version}" + (isSnapshot ? "-SNAPSHOT+${buildNumber}" : "")
group = project.maven_group
version = "${project.mod_version}+${project.minecraft_version}-${project.max_minecraft_version}" + (isSnapshot ? "-SNAPSHOT+${buildNumber}" : "")

base {
archivesName = archives_base_name
archivesName = project.archives_base_name
}

loom {
splitEnvironmentSourceSets()

mods {
"utilize" {
sourceSet sourceSets.main
sourceSet sourceSets.client
}
}
}

repositories {
Expand All @@ -24,11 +33,10 @@ repositories {
}

dependencies {
minecraft "com.mojang:minecraft:${minecraft_version}"
mappings "net.fabricmc:yarn:${yarn_mappings}:v2"
modImplementation "net.fabricmc:fabric-loader:${loader_version}"
minecraft "com.mojang:minecraft:${project.minecraft_version}"
implementation "net.fabricmc:fabric-loader:${project.loader_version}"

modImplementation "net.fabricmc.fabric-api:fabric-api:${fabric_version}"
implementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"

implementation "nl.devpieter:sees:1.2.1"
include "nl.devpieter:sees:1.2.1"
Expand All @@ -54,29 +62,44 @@ processResources {
}
}

def targetJavaVersion = 25
tasks.withType(JavaCompile).configureEach {
options.encoding = "UTF-8"
// 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"
if (targetJavaVersion >= 10 || JavaVersion.current().isJava10Compatible()) {
it.options.release.set(targetJavaVersion)
}
}

java {
toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion)
def javaVersion = JavaVersion.toVersion(targetJavaVersion)
if (JavaVersion.current() < javaVersion) {
toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion)
}
// 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()
withJavadocJar()
}

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

// configure the maven publication
publishing {
publications {
mavenJava(MavenPublication) {
create("mavenJava", MavenPublication) {
artifactId = project.archives_base_name
from components.java
artifactId = artifact_id
}
}

repositories {
maven {
url = uri(providers.gradleProperty("mavenRepositoryUrl").orNull ?: "http://localhost:8081/releases/nl/devpieter/utilize")
Expand Down
7 changes: 3 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@ org.gradle.jvmargs=-Xmx1G

# Fabric Properties
# check these on https://modmuss50.me/fabric.html
loader_version=0.18.4
loader_version=0.19.3

# Mod Properties
artifact_id=utilize
mod_version=1.1.2
mod_version=2.0.0
maven_group=nl.devpieter
archives_base_name=Utilize
archives_base_name=utilize
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
4 changes: 3 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.6.1-bin.zip
networkTimeout=10000
retries=0
retryBackOffMs=500
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
18 changes: 7 additions & 11 deletions gradlew

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 12 additions & 24 deletions gradlew.bat

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 3 additions & 11 deletions root.gradle
Original file line number Diff line number Diff line change
@@ -1,16 +1,8 @@
plugins {
id 'fabric-loom' version '1.14-SNAPSHOT' apply false
// id 'com.replaymod.preprocess' version '79307437eb'
id 'com.replaymod.preprocess' version '1678b67969'
id 'net.fabricmc.fabric-loom' version '1.17-SNAPSHOT' apply false
id 'com.replaymod.preprocess' version '221276c7d4'
}

preprocess {
// def mc12105 = createNode('1.21.5', 12105, "yarn")
// def mc12102 = createNode('1.21.2', 12102, "yarn")
// def mc12100 = createNode('1.21.0', 12100, "yarn")

// mc12105.link(mc12102, null)
// mc12102.link(mc12100, null)

def mc12109 = createNode('1.21.9', 12109, "yarn")
def mc261 = createNode('26.1', 261, null)
}
12 changes: 8 additions & 4 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -1,20 +1,24 @@
pluginManagement {
def replaymodPreprocessVersion = "221276c7d4"

repositories {
maven {
name = 'Fabric'
url = 'https://maven.fabricmc.net/'
}
maven {
name = 'Jitpack'
name = 'JitPack'
url = 'https://jitpack.io'
}
mavenCentral()
gradlePluginPortal()
}

resolutionStrategy {
eachPlugin {
if (requested.id.id == "com.replaymod.preprocess") {
useModule("com.github.ReplayMod:preprocessor:${requested.version}")
def resolvedVersion = requested.version ?: replaymodPreprocessVersion
useModule("com.github.ReplayMod:preprocessor:${resolvedVersion}")
}
}
}
Expand All @@ -23,11 +27,11 @@ pluginManagement {
rootProject.buildFileName = "root.gradle"

var versions = [
"1.21.9"
"26.1"
]

versions.forEach { version ->
include(":${version}")
project(":${version}").projectDir = file("versions/${version}")
project(":${version}").buildFileName = "../../build.gradle"
}
}
56 changes: 56 additions & 0 deletions src/client/java/nl/devpieter/utilize/client/UtilizeClient.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
package nl.devpieter.utilize.client;

import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientLifecycleEvents;
import nl.devpieter.utilize.Utilize;
import nl.devpieter.utilize.client.setting.SettingManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class UtilizeClient implements ClientModInitializer {

private static UtilizeClient INSTANCE;

private final Logger logger = LoggerFactory.getLogger("Utilize Client");
private boolean isInitialized;

@Override
public void onInitializeClient() {
INSTANCE = this;

ClientLifecycleEvents.CLIENT_STOPPING.register((client) -> {
logger.info("Shutting down Utilize Client...");

SettingManager.shutdown();
// AsyncRequest.shutdown();
});

Utilize utilize = Utilize.getInstance();
logger.info("Utilize Client initialized successfully! Version: {}", utilize.getUtilizeVersion());

isInitialized = true;
}

/**
* Checks if Utilize has been initialized.
*
* @return true if the mod instance exists and is initialized, false otherwise
*/
public static boolean initialized() {
return INSTANCE != null && INSTANCE.isInitialized;
}

/**
* Returns the singleton instance of Utilize.
*
* @return the initialized Utilize instance
* @throws IllegalStateException if Utilize has not been initialized yet
*/
public static UtilizeClient getInstance() {
if (INSTANCE == null || !INSTANCE.isInitialized) {
throw new IllegalStateException("Utilize has not been initialized yet!");
}

return INSTANCE;
}
}
Loading
Loading