Skip to content

Commit

Permalink
Merge pull request #6 from RappyLabyAddons/feat/1.20.3
Browse files Browse the repository at this point in the history
Add `1.20.3` support
  • Loading branch information
RappyTV authored Dec 6, 2023
2 parents 8541c3c + e34e381 commit 12ac2b8
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 4 deletions.
7 changes: 4 additions & 3 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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();
}
}
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 = "waila"

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

0 comments on commit 12ac2b8

Please sign in to comment.