Skip to content

Commit

Permalink
Update to Loom 1.9 and loader 0.16
Browse files Browse the repository at this point in the history
  • Loading branch information
thecatcore committed Dec 25, 2024
1 parent af1a8b0 commit bf00cce
Show file tree
Hide file tree
Showing 15 changed files with 97 additions and 98 deletions.
2 changes: 0 additions & 2 deletions apron-compat/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version = getSubprojectVersion(this)

loom {
accessWidenerPath = file("src/main/resources/apron-compat.accesswidener")
}
Expand Down
4 changes: 2 additions & 2 deletions apron-stapi-compat/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version = getSubprojectVersion(this)

tasks.withType(JavaCompile).configureEach {
it.options.release = 17
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}

loom {
Expand Down
4 changes: 2 additions & 2 deletions apron-stapi/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version = getSubprojectVersion(this)

tasks.withType(JavaCompile).configureEach {
it.options.release = 17
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}

dependencies {
Expand Down
2 changes: 0 additions & 2 deletions apron/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version = getSubprojectVersion(this)

loom {
accessWidenerPath = file("src/main/resources/apron.accesswidener")
}
Expand Down
12 changes: 6 additions & 6 deletions apron/src/main/java/forge/ForgeHooksClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
import java.util.HashSet;
import java.util.LinkedList;

import io.github.betterthanupdates.apron.impl.IntegerPair;
import itemspriteapi.IItemTexture;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.fabricmc.tinyremapper.extension.mixin.common.data.Pair;
import org.lwjgl.opengl.GL11;

import net.minecraft.block.Block;
Expand All @@ -34,17 +34,17 @@
@Legacy
public class ForgeHooksClient {
static LinkedList<IHighlightHandler> highlightHandlers = new LinkedList<>();
static HashMap<Pair<Integer, Integer>, Tessellator> tessellators = new HashMap<>();
static HashMap<IntegerPair, Tessellator> tessellators = new HashMap<>();
static HashMap<String, Integer> textures = new HashMap<>();
static boolean inWorld = false;
/**
* Set of tex/sub pairs.
*/
static HashSet<Pair<Integer, Integer>> renderTextureTest = new HashSet<>();
static HashSet<IntegerPair> renderTextureTest = new HashSet<>();
/**
* List of tex/sub pairs.
*/
static ArrayList<Pair<Integer, Integer>> renderTextureList = new ArrayList<>();
static ArrayList<IntegerPair> renderTextureList = new ArrayList<>();
static int renderPass = -1;

public ForgeHooksClient() {
Expand All @@ -70,7 +70,7 @@ public static boolean canRenderInPass(Block block, int pass) {
}

protected static void bindTessellator(int textureId, int sub) {
Pair<Integer, Integer> key = Pair.of(textureId, sub);
IntegerPair key = new IntegerPair(textureId, sub);
Tessellator tessellator;

if (!tessellators.containsKey(key)) {
Expand Down Expand Up @@ -133,7 +133,7 @@ public static void afterRenderPass(int pass) {
renderPass = -1;
inWorld = false;

for (Pair<Integer, Integer> l : renderTextureList) {
for (IntegerPair l : renderTextureList) {
GL11.glBindTexture(3553, l.first());
Tessellator tessellator = tessellators.get(l);
tessellator.tessellate();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package io.github.betterthanupdates.apron.impl;

public class IntegerPair {
private final int first;
private final int second;

public IntegerPair(int first, int second) {
this.first = first;
this.second = second;
}

public int first() {
return first;
}

public int second() {
return second;
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.github.betterthanupdates.modloader.mixin;

import com.llamalad7.mixinextras.injector.WrapWithCondition;
import com.llamalad7.mixinextras.injector.v2.WrapWithCondition;
import modloader.ModLoader;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import java.util.ArrayList;
import java.util.Random;

import com.llamalad7.mixinextras.injector.WrapWithCondition;
import com.llamalad7.mixinextras.injector.v2.WrapWithCondition;
import com.llamalad7.mixinextras.sugar.Local;
import org.lwjgl.opengl.GL11;
import org.spongepowered.asm.mixin.Mixin;
Expand Down
110 changes: 47 additions & 63 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,23 +1,13 @@
//file:noinspection GradlePackageVersionRange
plugins {
id "java-library"
id "eclipse"
id "idea"
id "fabric-loom" version "1.9-SNAPSHOT" apply false
id "babric-loom-extension" version "1.9-SNAPSHOT" apply false
id "maven-publish"
id "babric-loom" version "1.4-SNAPSHOT" apply false
}

sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8

def ENV = System.getenv()

version = rootProject.mod_version

def getSubprojectVersion(project) {
return rootProject.version
}

def moduleDependencies(project, List<String> depNames) {
def deps = depNames.iterator().collect { project.dependencies.project(path: ":$it", configuration: 'namedElements') }

Expand All @@ -29,28 +19,13 @@ def moduleDependencies(project, List<String> depNames) {
}

allprojects {
group = rootProject.maven_group

apply plugin: "maven-publish"
apply plugin: "java-library"
//apply plugin: "checkstyle"
apply plugin: "babric-loom"

tasks.withType(JavaCompile).configureEach {
it.options.release = 8
}

java {
// Must be added before the split source sets are setup.
withSourcesJar()
}
apply plugin: "fabric-loom"
apply plugin: "babric-loom-extension"

loom {
gluedMinecraftJar()
customMinecraftManifest.set("https://babric.github.io/manifest-polyfill/${minecraft_version}.json")
intermediaryUrl.set("https://maven.glass-launcher.net/babric/babric/intermediary/%1\$s/intermediary-%1\$s-v2.jar")
enableTransitiveAccessWideners = true
}
version = project.mod_version
group = project.maven_group

repositories {
mavenCentral()
Expand Down Expand Up @@ -104,16 +79,14 @@ allprojects {
}
}

allprojects.each { p ->
loom.mods.register(p.name) {
sourceSet p.sourceSets.main
}
loom {
enableTransitiveAccessWideners = true
}

dependencies {
minecraft "com.mojang:minecraft:${rootProject.minecraft_version}"
mappings "net.legacyfabric:beta-yarn:${rootProject.minecraft_version}+build.${rootProject.mappings}:v2"
modApi "babric:fabric-loader:${rootProject.loader_version}"
modApi "net.fabricmc:fabric-loader:${rootProject.loader_version}"

modApi("net.legacyfabric.legacy-fabric-api:legacy-fabric-logger-api-v1:${rootProject.lfapi_version}")

Expand All @@ -131,52 +104,38 @@ allprojects {
// modRuntimeOnly(group: "remapped.client", name: "reforgedsapi-client")
// modRuntimeOnly(group: "remapped.server", name: "minecraftforge-server", version: "1.0.7-20110907")
// Todo
implementation(annotationProcessor("com.github.llamalad7.mixinextras:mixinextras-fabric:${project.mixin_extras_version}"))
// implementation(annotationProcessor("com.github.llamalad7.mixinextras:mixinextras-fabric:${project.mixin_extras_version}"))
implementation("com.github.thecatcore.CursedMixinExtensions:fabric:1.0.0")
implementation("com.github.thecatcore:WFVAIO:1.1.0")
}

tasks.withType(ProcessResources).configureEach {
processResources {
inputs.property "version", project.version

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

tasks.withType(AbstractArchiveTask) {
preserveFileTimestamps = false
reproducibleFileOrder = true
tasks.withType(JavaCompile).configureEach {
it.options.encoding = "UTF-8"
it.options.release = 8
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}

publishing {
publications {
mavenJava(MavenPublication) {
from components.java
}
}

repositories {
}
java {
// Must be added before the split source sets are setup.
withSourcesJar()
}

tasks.withType(JavaCompile) {
options.deprecation = true
}
}

subprojects {
dependencies {
if (project.name != "apron") {
api(project.dependencies.project(path: ":apron", configuration: 'namedElements'))
}
}

javadoc.enabled = false
}

subprojects.each {
remapJar.dependsOn("${it.path}:remapJar")
base {
archivesName = project.archives_base_name
}

dependencies {
Expand Down Expand Up @@ -206,9 +165,19 @@ dependencies {
// }
}

subprojects {
dependencies {
if (project.name != "apron") {
api(project.dependencies.project(path: ":apron", configuration: 'namedElements'))
}
}

javadoc.enabled = false
}

jar {
from("LICENSE") {
rename { "${it}_${project.archivesBaseName}" }
rename { "${it}_${base.archivesName.get()}" }
}
from("FORGE_LICENSE")
from("PAULSCODE_LICENSE")
Expand All @@ -225,3 +194,18 @@ remapJar {
}
}
}

// configure the maven publication
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
}
}

// select the repositories you want to publish to
repositories {
// uncomment to publish to the local maven
// mavenLocal()
}
}
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ org.gradle.jvmargs=-Xmx1G
# check these on https://babric.github.io/develop/
minecraft_version=b1.7.3
mappings=5
loader_version=0.14.24-babric.1
loader_version=0.16.9
lfapi_version=1.0.4+common+ae4aa0d092
mod_remapping_api_version=1.22.1
mixin_extras_version=0.2.1
Expand Down
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,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
7 changes: 5 additions & 2 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#

##############################################################################
#
Expand Down Expand Up @@ -55,7 +57,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
Expand Down Expand Up @@ -84,7 +86,8 @@ done
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
' "$PWD" ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down
22 changes: 12 additions & 10 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@rem SPDX-License-Identifier: Apache-2.0
@rem

@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
Expand Down Expand Up @@ -43,11 +45,11 @@ set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

Expand All @@ -57,11 +59,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto execute

echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

Expand Down
Loading

0 comments on commit bf00cce

Please sign in to comment.