From 968b99b376cdd812a36507decd40cf4c3bace780 Mon Sep 17 00:00:00 2001 From: RappyTV Date: Wed, 6 Dec 2023 23:21:51 +0100 Subject: [PATCH 1/3] Bump labygradle --- settings.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/settings.gradle.kts b/settings.gradle.kts index bb7cfe6..e7adef0 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,7 +1,7 @@ rootProject.name = "waila" pluginManagement { - val labyGradlePluginVersion = "0.3.29" + val labyGradlePluginVersion = "0.3.38" plugins { id("net.labymod.gradle") version (labyGradlePluginVersion) } From fcd87030414888942e654697bba3b86cba87ab10 Mon Sep 17 00:00:00 2001 From: RappyTV Date: Wed, 6 Dec 2023 23:22:13 +0100 Subject: [PATCH 2/3] Implement 1.20.3 code --- .../rappytv/waila/v1_20_3/ImplWailaApi.java | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 game-runner/src/v1_20_3/java/com/rappytv/waila/v1_20_3/ImplWailaApi.java diff --git a/game-runner/src/v1_20_3/java/com/rappytv/waila/v1_20_3/ImplWailaApi.java b/game-runner/src/v1_20_3/java/com/rappytv/waila/v1_20_3/ImplWailaApi.java new file mode 100644 index 0000000..5805013 --- /dev/null +++ b/game-runner/src/v1_20_3/java/com/rappytv/waila/v1_20_3/ImplWailaApi.java @@ -0,0 +1,28 @@ +package com.rappytv.waila.v1_20_3; + +import com.rappytv.waila.util.IWailaApi; +import net.labymod.api.models.Implements; +import net.minecraft.client.Minecraft; +import net.minecraft.client.player.LocalPlayer; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.world.phys.HitResult; +import net.minecraft.world.phys.HitResult.Type; + +@Implements(IWailaApi.class) +public class ImplWailaApi implements IWailaApi { + + @Override + public String getLookingAt(boolean fluid, int range) { + Minecraft minecraft = Minecraft.getInstance(); + LocalPlayer player = minecraft.player; + + if(player == null) return null; + HitResult result = player.pick(range, 0f, fluid); + if(result.getType() != Type.BLOCK || minecraft.level == null) return null; + + BlockState state = minecraft.level.getBlockState(((BlockHitResult) result).getBlockPos()); + + return state.getBlock().getName().getString(); + } +} From e34e381965de61add60611bdc402b559be1445dd Mon Sep 17 00:00:00 2001 From: RappyTV Date: Wed, 6 Dec 2023 23:26:16 +0100 Subject: [PATCH 3/3] Register 1.20.3, adapt version string, bump version --- build.gradle.kts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 0145ce2..eb18b28 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -20,8 +20,8 @@ labyMod { displayName = "Waila" author = "RappyTV" description = "Adds Widgets, which display what block and fluid you're looking at." - minecraftVersion = "1.12<1.20.2" - version = System.getenv().getOrDefault("VERSION", "1.0.1") + minecraftVersion = "1.12<1.20.3" + version = System.getenv().getOrDefault("VERSION", "1.0.2") } minecraft { @@ -35,7 +35,8 @@ labyMod { "1.19.3", "1.19.4", "1.20.1", - "1.20.2" + "1.20.2", + "1.20.3" ) { version, provider -> configureRun(provider, version) }