Skip to content

Commit 08081a2

Browse files
authored
Merge pull request #22 from RappyLabyAddons/feat/update
Support new versions, use java 21
2 parents 8d31820 + 77400c2 commit 08081a2

File tree

9 files changed

+129
-20
lines changed

9 files changed

+129
-20
lines changed

.github/workflows/build.yml

+2-6
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,16 @@ on:
77
branches: [ "master", "main" ]
88
workflow_dispatch:
99

10-
env:
11-
PUBLIC_RELEASE_BUILD: true
12-
PUBLIC_RELEASE_BUILD_TOKEN: ${{ secrets.PUBLIC_RELEASE_BUILD_TOKEN }}
13-
1410
jobs:
1511
build:
1612
runs-on: ubuntu-latest
1713
steps:
1814
- uses: actions/checkout@v3
19-
- name: Set up JDK 17
15+
- name: Set up JDK 21
2016
uses: actions/setup-java@v3
2117
with:
2218
distribution: 'corretto'
23-
java-version: '17'
19+
java-version: '21'
2420
- name: Grant execute permission for gradlew
2521
run: chmod +x gradlew
2622
- name: Build with Gradle

api/build.gradle.kts

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@ labyModProcessor {
2121
}
2222

2323
java {
24-
sourceCompatibility = JavaVersion.VERSION_17
25-
targetCompatibility = JavaVersion.VERSION_17
24+
sourceCompatibility = JavaVersion.VERSION_21
25+
targetCompatibility = JavaVersion.VERSION_21
2626
}

build.gradle.kts

+7-8
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ labyMod {
2020
displayName = "Death Finder"
2121
author = "RappyTV"
2222
description = "This addon saves your last death point, so you can find your items again."
23-
minecraftVersion = "1.8<1.20.4"
24-
version = System.getenv().getOrDefault("VERSION", "1.0.7")
23+
minecraftVersion = "1.8<1.21"
24+
version = System.getenv().getOrDefault("VERSION", "1.0.8")
2525
}
2626

2727
minecraft {
@@ -36,7 +36,10 @@ labyMod {
3636
"1.19.4",
3737
"1.20.1",
3838
"1.20.2",
39-
"1.20.4"
39+
"1.20.4",
40+
"1.20.5",
41+
"1.20.6",
42+
"1.21"
4043
) { version, provider ->
4144
configureRun(provider, version)
4245
}
@@ -77,11 +80,7 @@ fun configureRun(provider: net.labymod.gradle.core.minecraft.provider.VersionPro
7780
args("--addon-dev-environment", "true")
7881
}
7982

80-
provider.javaVersion = when (gameVersion) {
81-
else -> {
82-
JavaVersion.VERSION_17
83-
}
84-
}
83+
provider.javaVersion = JavaVersion.VERSION_21
8584

8685
provider.mixin {
8786
val mixinMinVersion = when (gameVersion) {

core/build.gradle.kts

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,6 @@ labyModProcessor {
2525
}
2626

2727
java {
28-
sourceCompatibility = JavaVersion.VERSION_17
29-
targetCompatibility = JavaVersion.VERSION_17
28+
sourceCompatibility = JavaVersion.VERSION_21
29+
targetCompatibility = JavaVersion.VERSION_21
3030
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
package com.rappytv.deathfinder.v1_20_5;
2+
3+
import com.rappytv.deathfinder.DeathFinderAddon;
4+
import com.rappytv.deathfinder.events.DeathEvent;
5+
import com.rappytv.deathfinder.util.Location;
6+
import net.labymod.api.Laby;
7+
import net.minecraft.client.gui.screens.DeathScreen;
8+
import net.minecraft.client.gui.screens.Screen;
9+
import net.minecraft.client.player.LocalPlayer;
10+
import net.minecraft.network.chat.Component;
11+
import org.spongepowered.asm.mixin.Mixin;
12+
import org.spongepowered.asm.mixin.injection.At;
13+
import org.spongepowered.asm.mixin.injection.Inject;
14+
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
15+
16+
@Mixin(DeathScreen.class)
17+
public class DeathScreenMixin extends Screen {
18+
19+
protected DeathScreenMixin(Component title) {
20+
super(title);
21+
}
22+
23+
@Inject(method = "init", at = @At("TAIL"))
24+
public void onDeathScreen(CallbackInfo ci) {
25+
if(this.minecraft == null || this.minecraft.player == null) return;
26+
27+
LocalPlayer player = this.minecraft.player;
28+
Location deathLocation = new Location(player.getX(), player.getY(), player.getZ());
29+
30+
if(DeathFinderAddon.get().configuration().saveRotation().get()) {
31+
deathLocation.setYaw(player.getYRot());
32+
deathLocation.setPitch(player.getXRot());
33+
}
34+
if(deathLocation.equals(DeathFinderAddon.getDeathLocation())) return;
35+
36+
Laby.fireEvent(new DeathEvent(deathLocation));
37+
}
38+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
package com.rappytv.deathfinder.v1_20_6;
2+
3+
import com.rappytv.deathfinder.DeathFinderAddon;
4+
import com.rappytv.deathfinder.events.DeathEvent;
5+
import com.rappytv.deathfinder.util.Location;
6+
import net.labymod.api.Laby;
7+
import net.minecraft.client.gui.screens.DeathScreen;
8+
import net.minecraft.client.gui.screens.Screen;
9+
import net.minecraft.client.player.LocalPlayer;
10+
import net.minecraft.network.chat.Component;
11+
import org.spongepowered.asm.mixin.Mixin;
12+
import org.spongepowered.asm.mixin.injection.At;
13+
import org.spongepowered.asm.mixin.injection.Inject;
14+
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
15+
16+
@Mixin(DeathScreen.class)
17+
public class DeathScreenMixin extends Screen {
18+
19+
protected DeathScreenMixin(Component title) {
20+
super(title);
21+
}
22+
23+
@Inject(method = "init", at = @At("TAIL"))
24+
public void onDeathScreen(CallbackInfo ci) {
25+
if(this.minecraft == null || this.minecraft.player == null) return;
26+
27+
LocalPlayer player = this.minecraft.player;
28+
Location deathLocation = new Location(player.getX(), player.getY(), player.getZ());
29+
30+
if(DeathFinderAddon.get().configuration().saveRotation().get()) {
31+
deathLocation.setYaw(player.getYRot());
32+
deathLocation.setPitch(player.getXRot());
33+
}
34+
if(deathLocation.equals(DeathFinderAddon.getDeathLocation())) return;
35+
36+
Laby.fireEvent(new DeathEvent(deathLocation));
37+
}
38+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
package com.rappytv.deathfinder.v1_21;
2+
3+
import com.rappytv.deathfinder.DeathFinderAddon;
4+
import com.rappytv.deathfinder.events.DeathEvent;
5+
import com.rappytv.deathfinder.util.Location;
6+
import net.labymod.api.Laby;
7+
import net.minecraft.client.gui.screens.DeathScreen;
8+
import net.minecraft.client.gui.screens.Screen;
9+
import net.minecraft.client.player.LocalPlayer;
10+
import net.minecraft.network.chat.Component;
11+
import org.spongepowered.asm.mixin.Mixin;
12+
import org.spongepowered.asm.mixin.injection.At;
13+
import org.spongepowered.asm.mixin.injection.Inject;
14+
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
15+
16+
@Mixin(DeathScreen.class)
17+
public class DeathScreenMixin extends Screen {
18+
19+
protected DeathScreenMixin(Component title) {
20+
super(title);
21+
}
22+
23+
@Inject(method = "init", at = @At("TAIL"))
24+
public void onDeathScreen(CallbackInfo ci) {
25+
if(this.minecraft == null || this.minecraft.player == null) return;
26+
27+
LocalPlayer player = this.minecraft.player;
28+
Location deathLocation = new Location(player.getX(), player.getY(), player.getZ());
29+
30+
if(DeathFinderAddon.get().configuration().saveRotation().get()) {
31+
deathLocation.setYaw(player.getYRot());
32+
deathLocation.setPitch(player.getXRot());
33+
}
34+
if(deathLocation.equals(DeathFinderAddon.getDeathLocation())) return;
35+
36+
Laby.fireEvent(new DeathEvent(deathLocation));
37+
}
38+
}
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

settings.gradle.kts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
rootProject.name = "deathfinder"
22

33
pluginManagement {
4-
val labyGradlePluginVersion = "0.3.40"
4+
val labyGradlePluginVersion = "0.4.1"
55
plugins {
66
id("net.labymod.gradle") version (labyGradlePluginVersion)
77
}

0 commit comments

Comments
 (0)