Skip to content
Open
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
78 changes: 54 additions & 24 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import net.modificationstation.stationapi.gradle.SubprojectHelpers.addDependency

plugins {
id("maven-publish")
id("fabric-loom") version "1.9-SNAPSHOT"
id("babric-loom-extension") version "1.9.2"
id("net.fabricmc.fabric-loom-remap") version "1.15.+"
id("ploceus") version "1.15-SNAPSHOT"
}

// https://stackoverflow.com/a/40101046 - Even with kotlin, gradle can't get it's shit together.
Expand All @@ -15,18 +15,38 @@ inline fun <reified C> Project.configure(name: String, configuration: C.() -> Un
}

allprojects {
apply(plugin = "maven-publish")
apply(plugin = "fabric-loom")
apply(plugin = "babric-loom-extension")
if (project != rootProject) {
apply(plugin = "maven-publish")
apply(plugin = "net.fabricmc.fabric-loom-remap")
apply(plugin = "ploceus")
}

pluginManager.withPlugin("ploceus") {
val ploceus = extensions.getByName<net.ornithemc.ploceus.api.PloceusGradleExtensionApi>("ploceus")
ploceus.setIntermediaryGeneration(2)

dependencies {
"minecraft"("com.mojang:minecraft:${project.properties["minecraft_version"]}")
"mappings"(ploceus.mappings("net.glasslauncher:biny-ornithe:b1.7.3+build.${project.properties["biny_mappings"]}:mergedv2"))
"clientExceptions"(ploceus.raven(project.properties["client_raven_build"].toString(), "client"))
"serverExceptions"(ploceus.raven(project.properties["server_raven_build"].toString(), "server"))
"clientSignatures"(ploceus.sparrow(project.properties["client_sparrow_build"].toString(), "client"))
"serverSignatures"(ploceus.sparrow(project.properties["server_sparrow_build"].toString(), "server"))
"clientNests"("net.glasslauncher:biny-nests:b1.7.3-client+build.2")
"serverNests"("net.glasslauncher:biny-nests:b1.7.3-server+build.2")
"modImplementation"("net.fabricmc:fabric-loader:${project.properties["loader_version"]}")
}
}

java.sourceCompatibility = JavaVersion.VERSION_17
java.targetCompatibility = JavaVersion.VERSION_17
java.sourceCompatibility = JavaVersion.VERSION_21
java.targetCompatibility = JavaVersion.VERSION_21

repositories {
maven(url = "https://maven.minecraftforge.net/")
maven(url = "https://maven.glass-launcher.net/babric")
maven(url = "https://maven.glass-launcher.net/snapshots")
maven(url = "https://maven.glass-launcher.net/releases")
maven(url = "https://maven.glass-launcher.net/snapshots")
maven(url = "https://mvn.devos.one/releases")
maven(url = "https://maven.wispforest.io")
maven(url = "https://jitpack.io/")
mavenCentral()
exclusiveContent {
Expand All @@ -47,37 +67,40 @@ allprojects {
all {
exclude(group = "org.ow2.asm", module = "asm-debug-all")
exclude(group = "org.ow2.asm", module = "asm-all")
exclude(group = "babric")
// Force correct Guava version to avoid conflicts
resolutionStrategy {
force("com.google.guava:guava:31.1-jre")
}
}
}

dependencies {
implementation("org.slf4j:slf4j-api:1.8.0-beta4")
implementation("org.apache.logging.log4j:log4j-slf4j18-impl:2.17.2")

implementation("org.apache.logging.log4j:log4j-core:2.17.2")
implementation("com.google.guava:guava:33.2.1-jre")
implementation("org.apache.logging.log4j:log4j-core:2.17.2") {
exclude(group = "com.google.guava", module = "guava")
}
implementation("net.ornithemc:logger-config:1.0.0") {
exclude(group = "com.google.guava", module = "guava")
}
implementation("com.google.guava:guava:31.1-jre")
implementation("com.google.code.gson:gson:2.9.0")

//to change the versions see the gradle.properties file
minecraft("com.mojang:minecraft:${project.properties["minecraft_version"]}")

mappings("net.glasslauncher:biny:${project.properties["yarn_mappings"]}:v2")

modImplementation("net.fabricmc:fabric-loader:${project.properties["loader_version"]}")
//minecraft and mappings are added in the ploceus withPlugin block above

"transitiveImplementation"(implementation("org.apache.commons:commons-lang3:3.12.0") as Dependency)
"transitiveImplementation"(implementation("commons-io:commons-io:2.11.0") as Dependency)
"transitiveImplementation"(implementation("net.jodah:typetools:${project.properties["typetools_version"]}") as Dependency)
"transitiveImplementation"(implementation("com.github.mineLdiver:UnsafeEvents:${project.properties["unsafeevents_version"]}") as Dependency)
"transitiveImplementation"(implementation("it.unimi.dsi:fastutil:${project.properties["fastutil_version"]}") as Dependency)
"transitiveImplementation"(implementation("com.github.ben-manes.caffeine:caffeine:${project.properties["caffeine_version"]}") as Dependency)
"transitiveImplementation"(implementation("com.mojang:datafixerupper:${project.properties["dfu_version"]}") as Dependency)
"transitiveImplementation"(implementation("maven.modrinth:spasm:${project.properties["spasm_version"]}") as Dependency)
"transitiveImplementation"(implementation("me.carleslc:Simple-Yaml:1.8.4") as Dependency)

// not a runtime dependency unless we use something outside its events.
modImplementation("net.glasslauncher.mods:GlassConfigAPI:${project.properties["gcapi_version"]}")
modImplementation("net.glasslauncher.mods:GlassConfigAPI:${project.properties["gcapi_version"]}+gen2")

// convenience stuff
// adds some useful annotations for data classes. does not add any dependencies
Expand All @@ -89,15 +112,16 @@ allprojects {
// adds some useful annotations for miscellaneous uses. does not add any dependencies, though people without the lib will be missing some useful context hints.
implementation("org.jetbrains:annotations:23.0.0")

modLocalRuntime("net.glasslauncher.mods:ModMenu:${project.properties["modmenu_version"]}")
modLocalRuntime("maven.modrinth:retrocommands:${project.properties["rc_version"]}") {
isTransitive = false
}
// modLocalRuntime("net.glasslauncher.mods:ModMenu:${project.properties["modmenu_version"]}")
// modLocalRuntime("maven.modrinth:retrocommands:${project.properties["rc_version"]}") {
// isTransitive = false
// }

annotationProcessor("io.github.llamalad7:mixinextras-fabric:0.4.1")

// Optional bugfix mod for testing qol. Remove the // to enable.
//modLocalRuntime "maven.modrinth:mojangfix:${project.properties["mojangfix_version"]}"

}

sourceSets {
Expand Down Expand Up @@ -251,10 +275,11 @@ subprojects {
dependencies {
include("net.jodah:typetools:${project.properties["typetools_version"]}")
include("com.github.mineLdiver:UnsafeEvents:${project.properties["unsafeevents_version"]}")
include("it.unimi.dsi:fastutil:${project.properties["fastutil_version"]}")
include("com.github.ben-manes.caffeine:caffeine:${project.properties["caffeine_version"]}")
include("com.mojang:datafixerupper:${project.properties["dfu_version"]}")
include("maven.modrinth:spasm:${project.properties["spasm_version"]}")
include("com.google.guava:guava:31.1-jre")
include("org.apache.commons:commons-lang3:3.12.0")
}

// Makes java shut up
Expand All @@ -264,6 +289,11 @@ configure<JavaCompile>("compileTestJava") {
options.forkOptions.executable = System.getProperty("java.home") + "/bin/javac" + (if (System.getProperty("os.name").startsWith("Windows")) ".exe" else "")
}

// Don't fail test task when no tests are discovered (these are mod test classes, not unit tests)
tasks.withType<Test> {
failOnNoDiscoveredTests = false
}

publishing {
publications {
getByName("mavenJava", MavenPublication::class) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
package net.fabricmc.loom.util;

import groovy.util.Node;
import groovy.xml.QName;
import groovy.namespace.QName;

public final class GroovyXmlUtil {
private GroovyXmlUtil() { }
Expand All @@ -49,11 +49,6 @@ private static boolean isSameName(Object nodeName, String givenName) {
return qName.matches(givenName);
}

// New groovy 3 (gradle 7) class
if (nodeName instanceof groovy.namespace.QName qName) {
return qName.matches(givenName);
}

throw new UnsupportedOperationException("Cannot determine if " + nodeName.getClass() + " is the same as a String");
}
}
10 changes: 8 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,15 @@ fabric.loom.multiProjectOptimisation=true
# Fabric Properties
# check these on https://fabricmc.net/use
minecraft_version = b1.7.3
yarn_mappings = b1.7.3+e1fe071
biny_mappings = 9859f76
loader_version = 0.16.9

# Ploceus Properties
client_raven_build = 2
server_raven_build = 2
client_sparrow_build = 2
server_sparrow_build = 2

# Library Properties
typetools_version = 0.8.3
unsafeevents_version = e31096e
Expand All @@ -27,6 +33,6 @@ fabric.loom.multiProjectOptimisation=true
archives_base_name = StationAPI

# Test properties
gcapi_version = 3.2.5
gcapi_version = 3.3.0
modmenu_version = 1.8.5-beta.11
rc_version = 0.5.4
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.12.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.0-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
17 changes: 13 additions & 4 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
pluginManagement {
repositories {
maven(url = "https://maven.glass-launcher.net/babric")
maven(url = "https://maven.fabricmc.net/")
maven(url = "https://jitpack.io/")
mavenCentral()
maven {
name = "Fabric"
url = uri("https://maven.fabricmc.net/")
}
maven {
name = "Ornithe Releases"
url = uri("https://maven.ornithemc.net/releases")
}
maven {
name = "Ornithe Snapshots"
url = uri("https://maven.ornithemc.net/snapshots")
}
mavenLocal()
gradlePluginPortal()
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"environment": "*",

"depends": {
"java": ">=17",
"java": ">=21",
"fabricloader": "*",
"minecraft": "1.0.0-beta.7.3",
"station-api-configuration": "*",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

@Mixin(World.class)
public abstract class MixinLevel {
@Shadow public abstract BiomeSource method_1781();
@Shadow public abstract BiomeSource getBiomeSource();

/*@Inject(
method = "<init>(Lnet/minecraft/level/dimension/DimensionData;Ljava/lang/String;J)V",
Expand All @@ -27,7 +27,7 @@ private void onInit(WorldStorage string, String l, long par3, CallbackInfo ci) {
int[] pixels = ((DataBufferInt) buffer.getRaster().getDataBuffer()).getData();

int start = -(side >> 1);
BiomeSource biomeSource = method_1781();
BiomeSource biomeSource = getBiomeSource();
Biome[] biomes = biomeSource.getBiomesInArea(new Biome[side * side], start, start, side, side);

for (int i = 0; i < pixels.length; i++) {
Expand Down
7 changes: 1 addition & 6 deletions station-blockitems-v0/src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"schemaVersion": 1,
"id": "station-blockitems-v0",
"version": "${version}",

"name": "Station BlockItems (v0)",
"description": "API for custom block items.",
"authors": [
Expand All @@ -13,10 +12,8 @@
"sources": "https://github.com/ModificationStation/StationAPI",
"issues": "https://github.com/ModificationStation/StationAPI/issues"
},

"license": "MIT",
"icon": "assets/station-blockitems-v0/icon.png",

"environment": "*",
"entrypoints": {
"stationapi:event_bus": [
Expand All @@ -29,16 +26,14 @@
"mixins": [
"station-blockitems-v0.mixins.json"
],

"depends": {
"fabricloader": "*",
"minecraft": "1.0.0-beta.7.3"
},

"custom": {
"modmenu:api": true,
"loom:injected_interfaces": {
"net/minecraft/class_17": [
"net/minecraft/unmapped/C_81592558": [
"net/modificationstation/stationapi/api/block/StationBlockItemsBlock"
]
}
Expand Down
9 changes: 2 additions & 7 deletions station-blocks-v0/src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"schemaVersion": 1,
"id": "station-blocks-v0",
"version": "${version}",

"name": "Station Blocks (v0)",
"description": "Essential systems for modded blocks.",
"authors": [
Expand All @@ -13,26 +12,22 @@
"sources": "https://github.com/ModificationStation/StationAPI",
"issues": "https://github.com/ModificationStation/StationAPI/issues"
},

"license": "MIT",
"icon": "assets/station-blocks-v0/icon.png",

"environment": "*",
"mixins": [
"station-blocks-v0.mixins.json"
],

"depends": {
"fabricloader": "*",
"minecraft": "1.0.0-beta.7.3"
},

"custom": {
"modmenu:api": true,
"loom:injected_interfaces": {
"net/minecraft/class_17": [
"net/minecraft/unmapped/C_81592558": [
"net/modificationstation/stationapi/api/block/StationBlock"
]
}
}
}
}
9 changes: 2 additions & 7 deletions station-effects-api-v0/src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"schemaVersion": 1,
"id": "station-effects-api-v0",
"version": "${version}",

"name": "Station Entities (v0)",
"description": "Provides essential systems for modded entities.",
"authors": [
Expand All @@ -13,10 +12,8 @@
"sources": "https://github.com/ModificationStation/StationAPI",
"issues": "https://github.com/ModificationStation/StationAPI/issues"
},

"license": "MIT",
"icon": "assets/station-effects-api-v0/icon.png",

"environment": "*",
"entrypoints": {
"stationapi:event_bus": [
Expand All @@ -26,18 +23,16 @@
"mixins": [
"station-effects-api-v0.mixins.json"
],

"depends": {
"fabricloader": "*",
"minecraft": "1.0.0-beta.7.3"
},

"custom": {
"modmenu:api": true,
"loom:injected_interfaces": {
"net/minecraft/class_57": [
"net/minecraft/unmapped/C_42232651": [
"net/modificationstation/stationapi/api/entity/StationEffectsEntity"
]
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.io.IOException;

public interface EntitySpawnDataProvider extends StationSpawnDataProvider {

Expand All @@ -32,7 +33,11 @@ default Packet getSpawnData() {
}
if (syncTrackerAtSpawn()) {
var stream = new ByteArrayOutputStream();
entity.getDataTracker().writeAllEntries(new DataOutputStream(stream));
try {
entity.getDataTracker().writeAllEntries(new DataOutputStream(stream));
} catch (IOException e) {
throw new RuntimeException(e);
}
message.bytes = stream.toByteArray();
}
writeToMessage(message);
Expand Down
Loading