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
44 changes: 33 additions & 11 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,36 @@ on: [ push, pull_request ]

jobs:
build:
uses: constellation-mc/actions/.github/workflows/gradle-build.yml@main
with:
java: 21
gradle_tasks: spotbugs
reviewdog: |
cat ./build/reports/spotbugs/main/spotbugs.sarif | reviewdog -name="spotbugs" -f=sarif -reporter=github-check -level=warning
run_tests:
uses: constellation-mc/actions/.github/workflows/mc-tests.yml@main
with:
java: 21
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: gradle/actions/[email protected]
- name: Setup Java
uses: actions/setup-java@v4
with:
java-version: 21
distribution: temurin
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Setup Gradle
uses: gradle/actions/[email protected]
- name: Build project
run: ./gradlew buildAndCollect
- name: Find jars
id: find_jars
run: |
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
echo "jars<<$EOF" >> $GITHUB_OUTPUT
find ./build/libs/ -type f -name "*.jar" ! -name "*-sources.jar" >> $GITHUB_OUTPUT
echo "$EOF" >> $GITHUB_OUTPUT
- name: Get MC version and mod version
uses: christian-draeger/[email protected]
id: read_properties
with:
path: gradle.properties
properties: 'mod_version'
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: linkart-refabricated-${{ steps.read_properties.outputs.mod_version }}+build.${{ github.run_number }}
path: ${{ steps.find_jars.outputs.jars }}
23 changes: 0 additions & 23 deletions .github/workflows/publish.yml

This file was deleted.

4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Changed
- Added support for 1.21.6-1.21.10
- Updated Stonecutter to 0.7.10

## [6.1.1] - 2025-5-18

### Changed
Expand Down
118 changes: 13 additions & 105 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
import com.github.spotbugs.snom.SpotBugsTask

plugins {
id 'fabric-loom' version '1.10-SNAPSHOT'
id 'fabric-loom' version '1.12-SNAPSHOT'
id 'maven-publish'
id 'io.freefair.lombok' version '8.6'
id 'com.github.spotbugs-base' version '6.0.14'
//id 'com.diffplug.spotless' version '6.25.0'
id 'me.modmuss50.mod-publish-plugin' version "0.5.1"
}

Expand Down Expand Up @@ -37,36 +32,6 @@ base {
archivesName = "linkart-refabricated"
}

tasks.register("spotbugs", SpotBugsTask) { task ->
sourceSets.each {
task.sourceDirs.from(task.sourceDirs.files, it.allSource.sourceDirectories)
task.classDirs.from(task.classDirs.files, it.output)
task.auxClassPaths.from(task.auxClassPaths.files, it.compileClasspath)
}
excludeFilter = rootProject.file("spotbugs.xml")
ignoreFailures = true
reports {
html {
required = true
outputLocation = rootProject.file("${rootProject.buildDir}/reports/spotbugs/main/spotbugs.html")
stylesheet = 'fancy-hist.xsl'
}
sarif {
required = true
outputLocation = rootProject.file("${rootProject.buildDir}/reports/spotbugs/main/spotbugs.sarif")
}
}
}

/*spotless {
java {
removeUnusedImports()
trimTrailingWhitespace()
formatAnnotations()
importOrder('', 'java|javax', '\\#')
}
}*/

processResources {
inputs.property "minecraft", mcVersion
inputs.property "version", mod_version
Expand All @@ -88,6 +53,8 @@ loom {
ideConfigGenerated true // Run configurations are not created for subprojects by default
runDir "../../run" // Use a shared run folder and create separate worlds
}

fabricModJsonPath = rootProject.file("src/main/resources/fabric.mod.json")
}

def targetJavaVersion = 17
Expand All @@ -110,77 +77,18 @@ java {
withSourcesJar()
}

jar {
from("LICENSE") {
rename { "${it}_${project.archivesBaseName}" }
}
}

sourcesJar {
exclude {
sourceSets.main.allSource.contains it.file
}
from delombok
}
tasks.register('buildAndCollect', Copy) {
group = 'build'

/*
// configure the maven publication
publishing {
publications {
mavenJava(MavenPublication) {
artifactId 'linkart'
from components.java
}
}
from(tasks.named('remapJar').flatMap { it.archiveFile })
from(tasks.named('remapSourcesJar').flatMap { it.archiveFile })
into rootProject.layout.buildDirectory.dir("libs/${project.mod_version}").get().asFile

repositories {
maven {
name = "GitHubPackages"
url = "https://maven.pkg.github.com/constellation-mc/Linkart"
credentials {
username = System.getenv("GITHUB_ACTOR")
password = System.getenv("GITHUB_TOKEN")
}
}
}
dependsOn 'build'
}

publishMods {
file = remapJar.archiveFile
additionalFiles.from(remapSourcesJar.archiveFile)

changelog = file("CHANGELOG.md").text
type = ReleaseType.valueOf(providers.environmentVariable("VERSION_TYPE").getOrElse("BETA"))
modLoaders.add("fabric")

displayName = "${project.mod_version} (${project.minecraft_version})"

modrinth {
projectId = "sc4Mu9Zu"
accessToken = providers.environmentVariable("MODRINTH_TOKEN")
minecraftVersions.add("${project.minecraft_version}")
minecraftVersions.add("1.21")

requires("fabric-api")
embeds("midnightlib")
}
curseforge {
projectId = "622736"
accessToken = providers.environmentVariable("CURSEFORGE_TOKEN")
minecraftVersions.add("${project.minecraft_version}")
minecraftVersions.add("1.21")

requires("fabric-api")
embeds("midnightlib")
}
github {
repository = "constellation-mc/Linkart"
accessToken = providers.environmentVariable("GITHUB_TOKEN")
commitish = providers.environmentVariable("GITHUB_SHA").getOrElse("${project.minecraft_version}-fabric")

type = STABLE
jar {
from("LICENSE") {
rename { "${it}_${project.archivesBaseName}" }
}

dryRun = local
}
*/
}
5 changes: 2 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
# Done to increase the memory available to gradle.
org.gradle.jvmargs=-Xmx1G
org.gradle.jvmargs=-Xmx3G
# Fabric Properties
# check these on https://fabricmc.net/versions.html
minecraft_version=[VERSIONED]
fabric_loader=0.16.13
fabric_loader=0.17.0
yarn_mappings=[VERSIONED]
fabric_api=[VERSIONED]
midnightlib_version =[VERSIONED]
# Mod Properties
mod_version=6.1.1
maven_group=com.github.vini2003.linkart
archives_base_name=linkart
;
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-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
4 changes: 2 additions & 2 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ pluginManagement {
}

plugins {
id "dev.kikugie.stonecutter" version "0.7.6"
id "dev.kikugie.stonecutter" version "0.7.10"
}

stonecutter {
create(rootProject) {
versions "1.21.1", "1.21.4", "1.21.5", "1.21.6", "1.21.7", "1.21.8"
versions "1.21.1", "1.21.4", "1.21.5", "1.21.6", "1.21.7", "1.21.8", "1.21.9", "1.21.10"
vcsVersion = "1.21.1"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,13 @@ private Vec3d modifiedMovement(Vec3d movement) {

@Inject(at = @At("HEAD"), method = "tick")
private void linkart$tick(CallbackInfo ci) {
if (getWorld().isClient()) return;
World world = /*? if >=1.21.9 {*//*getEntityWorld()*//*?} else {*/getWorld()/*?}*/;
if (world.isClient()) return;
AbstractMinecartEntity cast = (AbstractMinecartEntity) (Object) this;
if (linkart$getFollowing() == null) return;

Vec3d pos = getPos();
Vec3d pos2 = linkart$getFollowing().getPos();
Vec3d pos = /*? if >=1.21.9 {*//*getEntityPos()*//*?} else {*/getPos()/*?}*/;
Vec3d pos2 = linkart$getFollowing()./*? if >=1.21.9 {*//*getEntityPos()*//*?} else {*/getPos()/*?}*/;
double dist = Math.max(Math.abs(pos.distanceTo(pos2)) - LinkartConfiguration.distance, 0);
Vec3d vec3d = pos.relativize(pos2);
vec3d = vec3d.multiply(LinkartConfiguration.velocityMultiplier);
Expand Down Expand Up @@ -153,10 +154,10 @@ private Vec3d modifiedMovement(Vec3d movement) {

if (LinkartConfiguration.chunkloading) {
if (linkart$getFollower() != null && !CartUtils.approximatelyZero(this.getVelocity().length())) {
((ServerWorld) this.getWorld()).getChunkManager().addTicket(ChunkTicketType.PORTAL, this.getChunkPos(), LinkartConfiguration.chunkloadingRadius/*? if <1.21.5 {*/, this.getBlockPos()/*?}*/);
LoadingCarts.getOrCreate((ServerWorld) getWorld()).addCart(cast);
((ServerWorld) world).getChunkManager().addTicket(ChunkTicketType.PORTAL, this.getChunkPos(), LinkartConfiguration.chunkloadingRadius/*? if <1.21.5 {*/, this.getBlockPos()/*?}*/);
LoadingCarts.getOrCreate((ServerWorld) world).addCart(cast);
} else {
LoadingCarts.getOrCreate((ServerWorld) getWorld()).removeCart(cast);
LoadingCarts.getOrCreate((ServerWorld) world).removeCart(cast);
}
}
}
Expand Down Expand Up @@ -208,7 +209,7 @@ void onPushAway(Entity entity, CallbackInfo ci) {
@Override
public AbstractMinecartEntity linkart$getFollowing() {
if (linkart$following == null && linkart$followingUUID != null) {
linkart$following = (AbstractMinecartEntity) ((ServerWorld) this.getWorld()).getEntity(linkart$followingUUID);
linkart$following = (AbstractMinecartEntity) ((ServerWorld) this./*? if >=1.21.9 {*//*getEntityWorld()*//*?} else {*/getWorld()/*?}*/).getEntity(linkart$followingUUID);
}
return linkart$following;
}
Expand All @@ -222,7 +223,7 @@ void onPushAway(Entity entity, CallbackInfo ci) {
@Override
public AbstractMinecartEntity linkart$getFollower() {
if (linkart$follower == null && linkart$followerUUID != null) {
linkart$follower = (AbstractMinecartEntity) ((ServerWorld) this.getWorld()).getEntity(linkart$followerUUID);
linkart$follower = (AbstractMinecartEntity) ((ServerWorld) this./*? if >=1.21.9 {*//*getEntityWorld()*//*?} else {*/getWorld()/*?}*/).getEntity(linkart$followerUUID);
}
return linkart$follower;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public abstract class EntityMixin {

@Inject(at = @At("HEAD"), method = "remove")
void linkart$removeLink(CallbackInfo callbackInformation, @Local(argsOnly = true) Entity.RemovalReason reason) {
if ((Entity) (Object) this instanceof AbstractMinecartEntity minecart && !minecart.getWorld().isClient() && reason.shouldDestroy()) {
if ((Entity) (Object) this instanceof AbstractMinecartEntity minecart && !minecart./*? if >=1.21.9 {*//*getEntityWorld()*//*?} else {*/getWorld()/*?}*/.isClient() && reason.shouldDestroy()) {
CartUtils.unlinkFromParent(minecart);
CartUtils.unlinkFromParent(minecart.linkart$getFollower());
}
Expand All @@ -29,10 +29,10 @@ public abstract class EntityMixin {
@Inject(at = @At("HEAD"), method = "adjustMovementForCollisions(Lnet/minecraft/util/math/Vec3d;)Lnet/minecraft/util/math/Vec3d;", cancellable = true)
void linkart$onRecalculateVelocity(Vec3d movement, CallbackInfoReturnable<Vec3d> cir) {
if ((Object) this instanceof AbstractMinecartEntity minecart) {
List<Entity> collisions = minecart.getWorld().getOtherEntities((Entity) (Object) this, minecart.getBoundingBox().stretch(movement));
List<Entity> collisions = minecart./*? if >=1.21.9 {*//*getEntityWorld()*//*?} else {*/getWorld()/*?}*/.getOtherEntities((Entity) (Object) this, minecart.getBoundingBox().stretch(movement));

for (Entity entity : collisions) {
if (!CollisionUtils.shouldCollide(minecart, entity) && minecart.getWorld().getBlockState(minecart.getBlockPos()).getBlock() instanceof AbstractRailBlock) {
if (!CollisionUtils.shouldCollide(minecart, entity) && minecart./*? if >=1.21.9 {*//*getEntityWorld()*//*?} else {*/getWorld()/*?}*/.getBlockState(minecart.getBlockPos()).getBlock() instanceof AbstractRailBlock) {
cir.setReturnValue(movement);
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ protected PlayerEntityMixin(EntityType<? extends LivingEntity> entityType, World
@Inject(at = @At("HEAD"), method = "interact", cancellable = true)
void onInteract(Entity entity, Hand hand, CallbackInfoReturnable<ActionResult> cir) {
if (entity instanceof AbstractMinecartEntity minecart) {
if (getWorld().isClient()) return;
if (/*? if >=1.21.9 {*//*getEntityWorld()*//*?} else {*/getWorld()/*?}*/.isClient()) return;

PlayerEntity player = (PlayerEntity) (Object) this;
ItemStack stack = player.getStackInHand(hand);
Expand Down Expand Up @@ -59,10 +59,13 @@ void onInteract(Entity entity, Hand hand, CallbackInfoReturnable<ActionResult> c
}

@Unique private void finishOperation(CallbackInfoReturnable<ActionResult> cir, AbstractMinecartEntity minecart, ActionResult result) {
ServerWorld world = (ServerWorld) minecart./*? if >=1.21.9 {*//*getEntityWorld()*//*?} else {*/getWorld()/*?}*/;
if (world.isClient()) return;

if (result.isAccepted()) {
((ServerWorld) minecart.getWorld()).spawnParticles(ParticleTypes.HAPPY_VILLAGER, minecart.getX(), minecart.getY() + 0.2, minecart.getZ(), 10, 0.5, 0.5, 0.5, 0.5);
world.spawnParticles(ParticleTypes.HAPPY_VILLAGER, minecart.getX(), minecart.getY() + 0.2, minecart.getZ(), 10, 0.5, 0.5, 0.5, 0.5);
} else {
((ServerWorld) minecart.getWorld()).spawnParticles(ParticleTypes.ANGRY_VILLAGER, minecart.getX(), minecart.getY() + 0.2, minecart.getZ(), 10, 0.5, 0.5, 0.5, 0.5);
world.spawnParticles(ParticleTypes.ANGRY_VILLAGER, minecart.getX(), minecart.getY() + 0.2, minecart.getZ(), 10, 0.5, 0.5, 0.5, 0.5);
}
cir.setReturnValue(result);
}
Expand Down
Loading