Skip to content
Draft
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
95 changes: 62 additions & 33 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,21 +15,41 @@ 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"(ploceus.nests(project.properties["client_nests_build"].toString(), "client"))
"serverNests"(ploceus.nests(project.properties["server_nests_build"].toString(), "server"))
"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/")

maven("https://libraries.minecraft.net") {
maven(url = "https://libraries.minecraft.net") {
name = "Mojang"
content {
includeModule("com.mojang", "datafixerupper") // https://github.com/Mojang/DataFixerUpper
Expand All @@ -55,31 +75,33 @@ 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:33.5.0-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:33.5.0-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")
//minecraft and mappings are added in the ploceus withPlugin block above

modImplementation("net.fabricmc:fabric-loader:${project.properties["loader_version"]}")

"transitiveImplementation"(implementation("org.apache.commons:commons-lang3:3.12.0") as Dependency)
"transitiveImplementation"(implementation("org.apache.commons:commons-lang3:3.17.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)
Expand All @@ -89,23 +111,24 @@ allprojects {

// convenience stuff
// adds some useful annotations for data classes. does not add any dependencies
compileOnly("org.projectlombok:lombok:1.18.30")
annotationProcessor("org.projectlombok:lombok:1.18.30")
testCompileOnly("org.projectlombok:lombok:1.18.30")
testAnnotationProcessor("org.projectlombok:lombok:1.18.30")
compileOnly("org.projectlombok:lombok:1.18.42")
annotationProcessor("org.projectlombok:lombok:1.18.42")
testCompileOnly("org.projectlombok:lombok:1.18.42")
testAnnotationProcessor("org.projectlombok:lombok:1.18.42")

// 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 @@ -138,7 +161,7 @@ allprojects {

// Include license inside of the mod jar
configure<Jar>("jar") {
from(rootProject.file("LICENSE")) {
from("LICENSE") {
rename { "${it}_${project.properties["archivesBaseName"]}" }
}
}
Expand Down Expand Up @@ -259,10 +282,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:33.5.0-jre")
include("com.google.guava:failureaccess:1.0.3")
include("org.apache.commons:commons-lang3:3.17.0")
}

// Makes java shut up
Expand All @@ -272,6 +296,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 Expand Up @@ -302,4 +331,4 @@ tasks.register<Jar>("testJar") {
// Gradle I swear to fuck stop trying to do bullshit to the maven - calm
tasks.withType<GenerateModuleMetadata> {
enabled = false
}
}
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");
}
}
16 changes: 12 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,16 @@ fabric.loom.multiProjectOptimisation=true
# Fabric Properties
# check these on https://fabricmc.net/use
minecraft_version = b1.7.3
yarn_mappings = b1.7.3+e1fe071
loader_version = 0.16.9
biny_mappings = 57cc158
loader_version = 0.18.4

# Ploceus Properties
client_raven_build = 2
server_raven_build = 2
client_sparrow_build = 2
server_sparrow_build = 2
client_nests_build = 7
server_nests_build = 4

# Library Properties
typetools_version = 0.8.3
Expand All @@ -22,11 +30,11 @@ fabric.loom.multiProjectOptimisation=true
spasm_version = 0.2.2

# Mod Properties
mod_version = 2.0.0-alpha.6.2
mod_version = 2.0.0-alpha.6.2+gen2
maven_group = net.modificationstation
archives_base_name = StationAPI

# Test properties
gcapi_version = 3.2.5
gcapi_version = 3.3.0+gen2
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 @@ -4,7 +4,6 @@
import net.minecraft.entity.EntityRegistry;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ToolMaterial;
import net.minecraft.world.World;
import net.modificationstation.stationapi.api.block.BlockState;
import net.modificationstation.stationapi.api.template.item.TemplatePickaxeItem;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import net.mine_diver.unsafeevents.listener.EventListener;
import net.minecraft.block.material.Material;
import net.minecraft.item.Item;
import net.minecraft.item.ToolMaterial;
import net.modificationstation.sltest.block.Blocks;
import net.modificationstation.sltest.block.VariationBlock;
import net.modificationstation.stationapi.api.event.registry.ItemRegistryEvent;
Expand All @@ -23,12 +22,12 @@ public class ItemListener {
@EventListener
public void registerItems(ItemRegistryEvent event) {
ToolLevel moddedNode = new TagToolLevel(TagKey.of(BlockRegistry.KEY, NAMESPACE.id("needs_tool_level_modded")));
ToolLevel.GRAPH.putEdge(ToolMaterial.STONE.getToolLevel(), moddedNode);
ToolLevel.GRAPH.putEdge(moddedNode, ToolMaterial.IRON.getToolLevel());
ToolLevel.GRAPH.putEdge(Item.ToolMaterial.STONE.getToolLevel(), moddedNode);
ToolLevel.GRAPH.putEdge(moddedNode, Item.ToolMaterial.IRON.getToolLevel());
ToolLevel siblingNode = new TagToolLevel(TagKey.of(BlockRegistry.KEY, NAMESPACE.id("needs_tool_level_sibling"))).equivalentToImmediateSiblings();
ToolLevel.GRAPH.putEdge(ToolMaterial.STONE.getToolLevel(), siblingNode);
ToolLevel.GRAPH.putEdge(siblingNode, ToolMaterial.IRON.getToolLevel());
ToolLevel.GRAPH.removeEdge(ToolMaterial.STONE.getToolLevel(), ToolMaterial.IRON.getToolLevel());
ToolLevel.GRAPH.putEdge(Item.ToolMaterial.STONE.getToolLevel(), siblingNode);
ToolLevel.GRAPH.putEdge(siblingNode, Item.ToolMaterial.IRON.getToolLevel());
ToolLevel.GRAPH.removeEdge(Item.ToolMaterial.STONE.getToolLevel(), Item.ToolMaterial.IRON.getToolLevel());

testItem = new ModdedItem(NAMESPACE.id("test_item")); //8475
testMaterial = ToolMaterialFactory.create("testMaterial", 3, Integer.MAX_VALUE, Float.MAX_VALUE, Integer.MAX_VALUE - 2).toolLevel(siblingNode);
Expand All @@ -48,7 +47,7 @@ public void registerItems(ItemRegistryEvent event) {
}

public static Item testItem;
public static ToolMaterial testMaterial;
public static Item.ToolMaterial testMaterial;
public static Item testPickaxe;
public static Item testNBTItem;
public static Item testModelItem;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import lombok.Value;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.hit.HitResultType;
import net.minecraft.util.hit.HitResult;
import net.minecraft.world.World;
import net.modificationstation.sltest.SLTest;
import net.modificationstation.stationapi.api.client.item.CustomTooltipProvider;
Expand Down Expand Up @@ -38,7 +38,7 @@ public ItemStack use(ItemStack item, World level, PlayerEntity player) {
public int hmmSho;

@Override
public double getReach(ItemStack stack, PlayerEntity player, HitResultType type, double currentReach) {
public double getReach(ItemStack stack, PlayerEntity player, HitResult.HitResultType type, double currentReach) {
return switch (type) {
case BLOCK -> 50;
case ENTITY -> 10;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ToolMaterial;
import net.minecraft.world.World;
import net.modificationstation.stationapi.api.dispenser.ItemDispenseContext;
import net.modificationstation.stationapi.api.item.CustomDispenseBehavior;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import net.minecraft.entity.EntityRegistry;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ToolMaterial;
import net.modificationstation.stationapi.api.util.Identifier;
import net.modificationstation.stationapi.api.template.item.TemplateSwordItem;

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
2 changes: 1 addition & 1 deletion src/test/resources/sltest.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"required": true,
"minVersion": "0.8",
"package": "net.modificationstation.sltest.mixin",
"compatibilityLevel": "JAVA_8",
"compatibilityLevel": "JAVA_21",
"mixins": [
"BlockBaseAccessor",
"MixinLevel",
Expand Down
2 changes: 1 addition & 1 deletion station-achievements-v0/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import net.modificationstation.stationapi.gradle.SubprojectHelpers.addModuleDependencies
import net.modificationstation.stationapi.gradle.SubprojectHelpers.getSubprojectVersion
import net.modificationstation.stationapi.gradle.SubprojectHelpers.addModuleDependencies

base.archivesName.set("station-achievements-v0")
version = getSubprojectVersion(project, "1.0.0")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"required": true,
"minVersion": "0.8",
"package": "net.modificationstation.stationapi.mixin.achievement",
"compatibilityLevel": "JAVA_17",
"compatibilityLevel": "JAVA_21",
"client": [
"client.AchievementsScreenMixin"
],
Expand Down
Loading