Skip to content

Commit

Permalink
Merge pull request #22 from RappyLabyAddons/feat/update
Browse files Browse the repository at this point in the history
Support new versions, use java 21
  • Loading branch information
RappyTV authored Jun 24, 2024
2 parents 8d31820 + 77400c2 commit 08081a2
Show file tree
Hide file tree
Showing 9 changed files with 129 additions and 20 deletions.
8 changes: 2 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,16 @@ on:
branches: [ "master", "main" ]
workflow_dispatch:

env:
PUBLIC_RELEASE_BUILD: true
PUBLIC_RELEASE_BUILD_TOKEN: ${{ secrets.PUBLIC_RELEASE_BUILD_TOKEN }}

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v3
with:
distribution: 'corretto'
java-version: '17'
java-version: '21'
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
Expand Down
4 changes: 2 additions & 2 deletions api/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ labyModProcessor {
}

java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}
15 changes: 7 additions & 8 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ labyMod {
displayName = "Death Finder"
author = "RappyTV"
description = "This addon saves your last death point, so you can find your items again."
minecraftVersion = "1.8<1.20.4"
version = System.getenv().getOrDefault("VERSION", "1.0.7")
minecraftVersion = "1.8<1.21"
version = System.getenv().getOrDefault("VERSION", "1.0.8")
}

minecraft {
Expand All @@ -36,7 +36,10 @@ labyMod {
"1.19.4",
"1.20.1",
"1.20.2",
"1.20.4"
"1.20.4",
"1.20.5",
"1.20.6",
"1.21"
) { version, provider ->
configureRun(provider, version)
}
Expand Down Expand Up @@ -77,11 +80,7 @@ fun configureRun(provider: net.labymod.gradle.core.minecraft.provider.VersionPro
args("--addon-dev-environment", "true")
}

provider.javaVersion = when (gameVersion) {
else -> {
JavaVersion.VERSION_17
}
}
provider.javaVersion = JavaVersion.VERSION_21

provider.mixin {
val mixinMinVersion = when (gameVersion) {
Expand Down
4 changes: 2 additions & 2 deletions core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ labyModProcessor {
}

java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package com.rappytv.deathfinder.v1_20_5;

import com.rappytv.deathfinder.DeathFinderAddon;
import com.rappytv.deathfinder.events.DeathEvent;
import com.rappytv.deathfinder.util.Location;
import net.labymod.api.Laby;
import net.minecraft.client.gui.screens.DeathScreen;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.client.player.LocalPlayer;
import net.minecraft.network.chat.Component;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

@Mixin(DeathScreen.class)
public class DeathScreenMixin extends Screen {

protected DeathScreenMixin(Component title) {
super(title);
}

@Inject(method = "init", at = @At("TAIL"))
public void onDeathScreen(CallbackInfo ci) {
if(this.minecraft == null || this.minecraft.player == null) return;

LocalPlayer player = this.minecraft.player;
Location deathLocation = new Location(player.getX(), player.getY(), player.getZ());

if(DeathFinderAddon.get().configuration().saveRotation().get()) {
deathLocation.setYaw(player.getYRot());
deathLocation.setPitch(player.getXRot());
}
if(deathLocation.equals(DeathFinderAddon.getDeathLocation())) return;

Laby.fireEvent(new DeathEvent(deathLocation));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package com.rappytv.deathfinder.v1_20_6;

import com.rappytv.deathfinder.DeathFinderAddon;
import com.rappytv.deathfinder.events.DeathEvent;
import com.rappytv.deathfinder.util.Location;
import net.labymod.api.Laby;
import net.minecraft.client.gui.screens.DeathScreen;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.client.player.LocalPlayer;
import net.minecraft.network.chat.Component;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

@Mixin(DeathScreen.class)
public class DeathScreenMixin extends Screen {

protected DeathScreenMixin(Component title) {
super(title);
}

@Inject(method = "init", at = @At("TAIL"))
public void onDeathScreen(CallbackInfo ci) {
if(this.minecraft == null || this.minecraft.player == null) return;

LocalPlayer player = this.minecraft.player;
Location deathLocation = new Location(player.getX(), player.getY(), player.getZ());

if(DeathFinderAddon.get().configuration().saveRotation().get()) {
deathLocation.setYaw(player.getYRot());
deathLocation.setPitch(player.getXRot());
}
if(deathLocation.equals(DeathFinderAddon.getDeathLocation())) return;

Laby.fireEvent(new DeathEvent(deathLocation));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package com.rappytv.deathfinder.v1_21;

import com.rappytv.deathfinder.DeathFinderAddon;
import com.rappytv.deathfinder.events.DeathEvent;
import com.rappytv.deathfinder.util.Location;
import net.labymod.api.Laby;
import net.minecraft.client.gui.screens.DeathScreen;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.client.player.LocalPlayer;
import net.minecraft.network.chat.Component;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

@Mixin(DeathScreen.class)
public class DeathScreenMixin extends Screen {

protected DeathScreenMixin(Component title) {
super(title);
}

@Inject(method = "init", at = @At("TAIL"))
public void onDeathScreen(CallbackInfo ci) {
if(this.minecraft == null || this.minecraft.player == null) return;

LocalPlayer player = this.minecraft.player;
Location deathLocation = new Location(player.getX(), player.getY(), player.getZ());

if(DeathFinderAddon.get().configuration().saveRotation().get()) {
deathLocation.setYaw(player.getYRot());
deathLocation.setPitch(player.getXRot());
}
if(deathLocation.equals(DeathFinderAddon.getDeathLocation())) return;

Laby.fireEvent(new DeathEvent(deathLocation));
}
}
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
2 changes: 1 addition & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
rootProject.name = "deathfinder"

pluginManagement {
val labyGradlePluginVersion = "0.3.40"
val labyGradlePluginVersion = "0.4.1"
plugins {
id("net.labymod.gradle") version (labyGradlePluginVersion)
}
Expand Down

0 comments on commit 08081a2

Please sign in to comment.