Skip to content

Commit e6d7e3c

Browse files
authored
Merge branch '1.21.5' into feature/module/BetterFirework
2 parents f59490b + 70f95ac commit e6d7e3c

File tree

95 files changed

+1680
-1148
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+1680
-1148
lines changed

.github/workflows/build.yml

Lines changed: 10 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Build Lambda
33
on:
44
push:
55
branches:
6-
- '1.21.5'
6+
- '1.**'
77
pull_request:
88

99
jobs:
@@ -20,13 +20,11 @@ jobs:
2020

2121
env:
2222
SEGMENT_DOWNLOAD_TIMEOUT_MINS: '5'
23+
2324
steps:
2425
- name: Checkout Repository
2526
uses: actions/checkout@v4
2627

27-
- name: Set current date as env variable
28-
run: echo "DATE=$(date +'%Y-%m-%dT%H:%M:%S')" >> $GITHUB_ENV
29-
3028
- name: Get Short Commit Hash
3129
id: vars
3230
run: echo "COMMIT_HASH=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
@@ -46,38 +44,24 @@ jobs:
4644
file: gradle.properties
4745
all: true
4846

49-
- name: Build Lambda
50-
run: ./gradlew build --no-daemon
51-
52-
- name: Rename Files with Commit Hash
53-
run: |
54-
mv ./build/libs/lambda-${{ steps.all.outputs.modVersion }}+${{ steps.all.outputs.minecraftVersion }}.jar ./build/libs/lambda-${{ steps.all.outputs.modVersion }}+${{ steps.all.outputs.minecraftVersion }}-${{ env.COMMIT_HASH }}.jar
55-
56-
- name: Upload Lambda
57-
uses: ryand56/r2-upload-action@latest
47+
- name: Publish commit to maven
5848
id: upload
59-
with:
60-
r2-account-id: ${{ secrets.R2_ACCOUNT_ID }}
61-
r2-access-key-id: ${{ secrets.R2_ACCESS_KEY }}
62-
r2-secret-access-key: ${{ secrets.R2_ACCESS_SECRET }}
63-
r2-bucket: ${{ secrets.R2_BUCKET_NAME }}
64-
source-dir: |
65-
./build/libs/lambda-${{ steps.all.outputs.modVersion }}+${{ steps.all.outputs.minecraftVersion }}-${{ env.COMMIT_HASH }}.jar
66-
destination-dir: ${{ env.DATE }}-${{ env.COMMIT_HASH }}
49+
run: ./gradlew publish -PmavenType=snapshots -PcommitHash=${{ env.COMMIT_HASH }} -PmavenUsername=${{ secrets.MAVEN_USER }} -PmavenPassword=${{ secrets.MAVEN_TOKEN }}
50+
51+
- name: Publish snapshot to maven
52+
run: ./gradlew publish -PmavenType=snapshots -PcommitHash=SNAPSHOT -PmavenUsername=${{ secrets.MAVEN_USER }} -PmavenPassword=${{ secrets.MAVEN_TOKEN }}
6753

6854
- name: Generate Summary
69-
if: ${{ steps.upload.outputs.result == 'success' }}
55+
if: steps.upload.conclusion == 'success'
7056
run: |
7157
cat << EOF >> $GITHUB_STEP_SUMMARY
72-
### [Lambda ${{ steps.all.outputs.modVersion }} ${{ steps.all.outputs.minecraftVersion }} (${{ env.COMMIT_HASH }})](https://r2-bucket.edouard127.christmas/${{ env.DATE }}-${{ env.COMMIT_HASH }}/lambda-${{ steps.all.outputs.modVersion }}+${{ steps.all.outputs.minecraftVersion }}-${{ env.COMMIT_HASH }}.jar)
58+
### [Lambda ${{ steps.all.outputs.modVersion }} ${{ steps.all.outputs.minecraftVersion }} (${{ env.COMMIT_HASH }})](https://maven.lambda-client.org/snapshots/com/lambda/lambda/${{ steps.all.outputs.modVersion }}+${{ steps.all.outputs.minecraftVersion }}-${{ env.COMMIT_HASH }}/lambda-${{ steps.all.outputs.modVersion }}+${{ steps.all.outputs.minecraftVersion }}-${{ env.COMMIT_HASH }}.jar)
7359
EOF
7460
7561
- name: Failover Upload
76-
if: ${{ steps.upload.outputs.result == 'failure' }}
62+
if: steps.upload.conclusion == 'failure'
7763
uses: actions/upload-artifact@v4
7864
with:
7965
name: lambda-nightly
8066
path: |
8167
/build/libs/lambda-*-${{ steps.all.outputs.modVersion }}+${{ steps.all.outputs.minecraftVersion }}-${{ env.COMMIT_HASH }}.jar
82-
83-

.github/workflows/publish-maven.yml

Lines changed: 10 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -6,48 +6,11 @@ on:
66
- '*'
77

88
jobs:
9-
check-runner:
10-
name: Check Runner Availability
11-
runs-on: ubuntu-latest
12-
13-
outputs:
14-
runner-label: ${{ steps.set-runner.outputs.runner-label }}
15-
16-
steps:
17-
- name: Set runner
18-
id: set-runner
19-
run: |
20-
runners=$(curl -v -s -H "Accept: application/vnd.github+json" -H "Authorization: token ${{ secrets.REPO_ACCESS_TOKEN }}" "https://api.github.com/repos/${{ github.repository }}/actions/runners" --http1.1)
21-
if [ $? -ne 0 ]; then
22-
echo "Error: Failed to fetch runners from GitHub API" >&2
23-
exit 1
24-
fi
25-
26-
runners_count=$(echo "$runners" | jq '.runners | length')
27-
if [ "$runners_count" -eq 0 ]; then
28-
echo "No runners available or failed to retrieve runners." >&2
29-
echo "runner-label=ubuntu-latest" >> $GITHUB_OUTPUT
30-
exit 0
31-
fi
32-
33-
available=$(echo "$runners" | jq '.runners[] | select(.status == "online" and .busy == false and .labels[] .name == "self-hosted")')
34-
if [ $? -ne 0 ]; then
35-
echo "Error: Failed to parse JSON response" >&2
36-
exit 1
37-
fi
38-
39-
if [ -n "$available" ]; then
40-
echo "runner-label=lambda-linux-runner" >> $GITHUB_OUTPUT
41-
else
42-
echo "runner-label=ubuntu-latest" >> $GITHUB_OUTPUT
43-
fi
44-
459
publish:
4610
concurrency:
4711
group: ${{ github.workflow }}-${{ github.ref }}
4812
cancel-in-progress: true
4913

50-
needs: check-runner
5114
runs-on: ${{ needs.check-runner.outputs.runner-label }}
5215

5316
name: Publish artifacts to maven
@@ -61,6 +24,15 @@ jobs:
6124
with:
6225
distribution: 'temurin'
6326
java-version: '21'
27+
architecture: x64
28+
cache: 'gradle'
29+
30+
- name: Read Gradle Properties
31+
uses: BrycensRanch/[email protected]
32+
id: all
33+
with:
34+
file: gradle.properties
35+
all: true
6436

6537
- name: Publish to Maven
66-
run: ./gradlew publish -PreposiliteUsername=${{ secrets.MAVEN_USER }} -PreposilitePassword=${{ secrets.MAVEN_TOKEN }}
38+
run: ./gradlew publish -PmavenType=releases -PmavenUsername=${{ secrets.MAVEN_USER }} -PmavenPassword=${{ secrets.MAVEN_TOKEN }}

.github/workflows/release.yml

Lines changed: 5 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -6,57 +6,23 @@ on:
66
- '*'
77

88
jobs:
9-
check-runner:
10-
name: Check Runner Availability
11-
runs-on: ubuntu-latest
12-
13-
outputs:
14-
runner-label: ${{ steps.set-runner.outputs.runner-label }}
15-
16-
steps:
17-
- name: Set runner
18-
id: set-runner
19-
run: |
20-
runners=$(curl -v -s -H "Accept: application/vnd.github+json" -H "Authorization: token ${{ secrets.REPO_ACCESS_TOKEN }}" "https://api.github.com/repos/${{ github.repository }}/actions/runners" --http1.1)
21-
if [ $? -ne 0 ]; then
22-
echo "Error: Failed to fetch runners from GitHub API" >&2
23-
exit 1
24-
fi
25-
26-
runners_count=$(echo "$runners" | jq '.runners | length')
27-
if [ "$runners_count" -eq 0 ]; then
28-
echo "No runners available or failed to retrieve runners." >&2
29-
echo "runner-label=ubuntu-latest" >> $GITHUB_OUTPUT
30-
exit 0
31-
fi
32-
33-
available=$(echo "$runners" | jq '.runners[] | select(.status == "online" and .busy == false and .labels[] .name == "self-hosted")')
34-
if [ $? -ne 0 ]; then
35-
echo "Error: Failed to parse JSON response" >&2
36-
exit 1
37-
fi
38-
39-
if [ -n "$available" ]; then
40-
echo "runner-label=lambda-linux-runner" >> $GITHUB_OUTPUT
41-
else
42-
echo "runner-label=ubuntu-latest" >> $GITHUB_OUTPUT
43-
fi
449
build:
4510
concurrency:
4611
group: ${{ github.workflow }}-${{ github.ref }}
4712
cancel-in-progress: true
4813

49-
needs: check-runner
50-
runs-on: ${{ needs.check-runner.outputs.runner-label }}
51-
5214
name: Build and Release Lambda
15+
runs-on: ubuntu-latest
16+
5317
permissions:
5418
contents: write
19+
5520
env:
5621
SEGMENT_DOWNLOAD_TIMEOUT_MINS: '5'
22+
5723
steps:
5824
- name: Checkout Repository
59-
uses: actions/checkout@v4.1.1
25+
uses: actions/checkout@v4
6026

6127
- name: Set-Up JDK 21
6228
uses: actions/setup-java@v4

.idea/codeStyles/Project.xml

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build.gradle.kts

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ val spairVersion: String by project
3737
val lwjglVersion: String by project
3838
val sodiumVersion: String by project
3939
val litematicaVersion: String by project
40+
val maLiLibVersion: String by project
4041

4142
val libs = file("libs")
4243
val targets = listOf("fabric.mod.json")
@@ -176,6 +177,7 @@ dependencies {
176177
// Add mods
177178
modImplementation("com.github.rfresh2:baritone-fabric:$minecraftVersion")
178179
modCompileOnly("maven.modrinth:sodium:$sodiumVersion")
180+
modCompileOnly("maven.modrinth:malilib:$maLiLibVersion")
179181
modCompileOnly("maven.modrinth:litematica:$litematicaVersion")
180182

181183
// Test implementations
@@ -231,13 +233,42 @@ java {
231233
}
232234

233235
publishing {
236+
val publishType = project.findProperty("mavenType").toString()
237+
val commitHash = project.findProperty("commitHash").toString()
238+
val mavenUrl = if (project.findProperty("mavenType") == "releases") "https://maven.lambda-client.org/releases" else "https://maven.lambda-client.org/snapshots"
239+
240+
val isSnapshots = publishType == "snapshots"
241+
val isValidCommit = commitHash.matches(Regex("[A-Fa-f0-9]+")) || commitHash == "SNAPSHOT"
242+
243+
if (!isSnapshots && isValidCommit)
244+
println("WARNING: Commit hash for snapshot releases was supplied but the publish type is 'releases'. The commit will be omitted.")
245+
else if (isSnapshots && !isValidCommit)
246+
error("The maven publish type is set to 'snapshots' but no valid commit hash was supplied.")
247+
234248
publications {
235249
create<MavenPublication>("maven") {
236250
groupId = mavenGroup
237251
artifactId = modId
238-
version = "$modVersion+$minecraftVersion"
252+
version = if (isSnapshots) "$modVersion+$minecraftVersion-$commitHash"
253+
else "$modVersion+$minecraftVersion"
239254

240255
from(components["java"])
241256
}
242257
}
258+
259+
repositories {
260+
maven(mavenUrl) {
261+
name = "lambda-reposilite"
262+
263+
credentials {
264+
username = project.findProperty("mavenUsername").toString()
265+
password = project.findProperty("mavenPassword").toString()
266+
}
267+
268+
269+
authentication {
270+
create<BasicAuthentication>("basic")
271+
}
272+
}
273+
}
243274
}

gradle.properties

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ modVersion=1.0.0
2222
modDescription=Minecraft utility mod for automation
2323
modIcon=assets/lambda/lambda.png
2424
mavenGroup=com.lambda
25-
modAuthors=Constructor (Avanatiker), Blade, beanbag44, Edouard127
25+
modAuthors=Avanatiker, Blade, beanbag44, Emy
2626

2727
# General
2828
minecraftVersion=1.21.5
@@ -49,6 +49,7 @@ fabricApiVersion=0.124.0
4949
kotlinFabricVersion=1.13.4+kotlin
5050
sodiumVersion=mc1.21.5-0.6.13-fabric
5151
litematicaVersion=0.22.2
52+
maLiLibVersion=0.24.2
5253

5354
# Kotlin https://kotlinlang.org/
5455
kotlin.code.style=official
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/*
2+
* Copyright 2025 Lambda
3+
*
4+
* This program is free software: you can redistribute it and/or modify
5+
* it under the terms of the GNU General Public License as published by
6+
* the Free Software Foundation, either version 3 of the License, or
7+
* (at your option) any later version.
8+
*
9+
* This program is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU General Public License
15+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
16+
*/
17+
18+
package com.lambda.mixin.entity;
19+
20+
import com.lambda.interaction.request.inventory.InventoryManager;
21+
import net.minecraft.client.MinecraftClient;
22+
import net.minecraft.client.gui.screen.ingame.HandledScreens;
23+
import net.minecraft.screen.ScreenHandler;
24+
import net.minecraft.screen.ScreenHandlerType;
25+
import net.minecraft.text.Text;
26+
import org.spongepowered.asm.mixin.Mixin;
27+
import org.spongepowered.asm.mixin.injection.At;
28+
import org.spongepowered.asm.mixin.injection.Inject;
29+
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
30+
31+
@Mixin(HandledScreens.Provider.class)
32+
public interface HandledScreensMixin {
33+
@Inject(method = "open", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/MinecraftClient;setScreen(Lnet/minecraft/client/gui/screen/Screen;)V"))
34+
private void injectOpen(Text name, ScreenHandlerType<ScreenHandler> type, MinecraftClient client, int id, CallbackInfo ci) {
35+
if (client.player == null) return;
36+
InventoryManager.onSetScreenHandler(client.player.currentScreenHandler);
37+
}
38+
}

src/main/java/com/lambda/mixin/entity/PlayerInventoryMixin.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
package com.lambda.mixin.entity;
1919

20+
import com.lambda.Lambda;
2021
import com.lambda.interaction.request.hotbar.HotbarManager;
2122
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
2223
import net.minecraft.entity.player.PlayerInventory;
@@ -29,6 +30,7 @@ public class PlayerInventoryMixin {
2930
@SuppressWarnings({"MixinAnnotationTarget"})
3031
@ModifyExpressionValue(method = "*", at = @At(value = "FIELD", target = "Lnet/minecraft/entity/player/PlayerInventory;selectedSlot:I", opcode = Opcodes.GETFIELD))
3132
private int modifySelectedSlot(int original) {
33+
if (((PlayerInventory) ((Object) this)).player != Lambda.getMc().player) return original;
3234
final int hotbarSlot = HotbarManager.getActiveSlot();
3335
if (hotbarSlot == -1) return original;
3436
return hotbarSlot;

src/main/java/com/lambda/mixin/render/ElytraFeatureRendererMixin.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ Identifier injectElytra(BipedEntityRenderState state, Operation<Identifier> orig
5454

5555
@WrapMethod(method = "render(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;ILnet/minecraft/client/render/entity/state/BipedEntityRenderState;FF)V")
5656
private void injectRender(MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int i, BipedEntityRenderState bipedEntityRenderState, float f, float g, Operation<Void> original) {
57-
if (NoRender.INSTANCE.isDisabled() && !NoRender.getNoElytra())
57+
if (NoRender.INSTANCE.isDisabled() || !NoRender.getNoElytra())
5858
original.call(matrixStack, vertexConsumerProvider, i, bipedEntityRenderState, f, g);
5959
}
6060
}

src/main/kotlin/com/lambda/command/commands/BuildCommand.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import com.lambda.brigadier.argument.value
2525
import com.lambda.brigadier.executeWithResult
2626
import com.lambda.brigadier.required
2727
import com.lambda.command.LambdaCommand
28-
import com.lambda.context.AutomationConfig
28+
import com.lambda.config.AutomationConfig
2929
import com.lambda.interaction.construction.StructureRegistry
3030
import com.lambda.interaction.construction.blueprint.Blueprint.Companion.toStructure
3131
import com.lambda.interaction.construction.blueprint.StaticBlueprint.Companion.toBlueprint
@@ -62,7 +62,7 @@ object BuildCommand : LambdaCommand(
6262
.loadStructureByRelativePath(Path.of(pathString))
6363
.let { template ->
6464
info("Building structure $pathString with dimensions ${template.size.toShortString()} created by ${template.author}")
65-
lastBuildTask = with(AutomationConfig) {
65+
lastBuildTask = with(AutomationConfig.Companion.DEFAULT) {
6666
template.toStructure()
6767
.move(player.blockPos)
6868
.toBlueprint()

0 commit comments

Comments
 (0)