build fix

This commit is contained in:
seb
2026-05-10 21:15:34 +02:00
parent 256901ff00
commit 19a85628f2
5 changed files with 78 additions and 23 deletions

View File

@@ -1,26 +1,56 @@
name: Build
on:
push:
pull_request:
jobs:
build:
runs-on: ubuntu-latest
environment: modrinth
permissions:
contents: write
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up JDK 25
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: '25'
distribution: 'temurin'
java-version: "25"
distribution: "temurin"
- name: Set up Gradle
uses: gradle/gradle-build-action@v2
- name: Execute Gradle build (all Stonecutter targets)
run: ./gradlew chiseledBuild
- run: mkdir staging && cp build/libs/*.jar staging
- run: cd build/libs && md5sum *.jar > ../../md5sum.txt
- run: echo "filename=`ls build/libs/*.jar |xargs basename`" >> $GITHUB_ENV
- name: Release
uses: softprops/action-gh-release@v1
uses: gradle/actions/setup-gradle@v4
- name: Build all Stonecutter targets
run: ./gradlew chiseledBuild --no-daemon --stacktrace
- name: Collect remapped jars (per Minecraft version)
run: |
mkdir -p staging
find versions -path '*/build/libs/*.jar' \
! -name '*-sources.jar' \
! -name '*-dev.jar' \
-exec cp -v {} staging/ \;
if [ -z "$(ls -A staging 2>/dev/null)" ]; then
echo "No jars found under versions/*/build/libs/"
exit 1
fi
(cd staging && md5sum *.jar) | tee md5sum.txt
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: jars
path: |
staging/*.jar
md5sum.txt
- name: Release (GitHub tags only)
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: build/libs/*.jar
files: |
staging/*.jar
md5sum.txt

View File

@@ -1,6 +1,7 @@
package com.github.sebseb7.autotrade.event;
import com.github.sebseb7.autotrade.config.Configs;
import com.github.sebseb7.autotrade.mixin.MultiPlayerGameModeInvoker;
import com.github.sebseb7.autotrade.util.TradeItemSpec;
import fi.dy.masa.malilib.gui.Message;
import fi.dy.masa.malilib.util.InfoUtils;
@@ -32,18 +33,17 @@ final class ContainerIoHelper {
}
/**
* After automated merchant packets (select trade + shift-clicks), client-side
* prediction can drift from the server. Flush the carried/cursor stack and run
* again on the next tick so pending slot updates have landed.
* After automated merchant packets, flush cursor/carried prediction so it matches the server.
* Implemented via {@link MultiPlayerGameModeInvoker} because {@code ensureHasSentCarriedItem()} is private.
*/
static void syncPlayerInventoryAfterMerchant(Minecraft mc) {
if (mc.player == null || mc.gameMode == null) {
return;
}
mc.gameMode.ensureHasSentCarriedItem();
((MultiPlayerGameModeInvoker) mc.gameMode).invokeEnsureHasSentCarriedItem();
mc.execute(() -> {
if (mc.player != null && mc.gameMode != null) {
mc.gameMode.ensureHasSentCarriedItem();
((MultiPlayerGameModeInvoker) mc.gameMode).invokeEnsureHasSentCarriedItem();
}
});
}

View File

@@ -0,0 +1,12 @@
package com.github.sebseb7.autotrade.mixin;
import net.minecraft.client.multiplayer.MultiPlayerGameMode;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Invoker;
@Mixin(MultiPlayerGameMode.class)
public interface MultiPlayerGameModeInvoker {
@Invoker("ensureHasSentCarriedItem")
void invokeEnsureHasSentCarriedItem();
}

View File

@@ -0,0 +1,12 @@
{
"required": true,
"minVersion": "0.8",
"package": "com.github.sebseb7.autotrade.mixin",
"compatibilityLevel": "JAVA_21",
"client": [
"MultiPlayerGameModeInvoker"
],
"injectors": {
"defaultRequire": 1
}
}

View File

@@ -27,6 +27,7 @@
},
"mixins": [
"autotrade.mixins.json"
],
"depends": {