Skip to content

Commit

Permalink
Merge pull request #4 from RappyLabyAddons/feat/update
Browse files Browse the repository at this point in the history
Add support for `1.20.2`
  • Loading branch information
RappyTV authored Sep 28, 2023
2 parents 52c2fe0 + a6c06f2 commit f5c8a6f
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.1"
version = System.getenv().getOrDefault("VERSION", "1.0.0")
minecraftVersion = "1.12<1.20.2"
version = System.getenv().getOrDefault("VERSION", "1.0.1")
}

minecraft {
Expand All @@ -34,7 +34,8 @@ labyMod {
"1.19.2",
"1.19.3",
"1.19.4",
"1.20.1"
"1.20.1",
"1.20.2"
) { 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_2;

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.28"
val labyGradlePluginVersion = "0.3.29"
plugins {
id("net.labymod.gradle") version (labyGradlePluginVersion)
}
Expand Down

0 comments on commit f5c8a6f

Please sign in to comment.