Skip to content

Commit 7ebefd6

Browse files
authored
Merge pull request #26 from RappyLabyAddons/development
Release `v1.4.3`
2 parents 38c354a + 0c8e448 commit 7ebefd6

File tree

24 files changed

+316
-385
lines changed

24 files changed

+316
-385
lines changed

.github/workflows/build.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,18 @@ name: LabyAddon Build
22

33
on:
44
push:
5-
branches: [ "master", "main" ]
5+
branches: ["master", "main"]
66
pull_request:
7-
branches: [ "master", "main" ]
7+
branches: ["master", "main"]
88
workflow_dispatch:
99

1010
jobs:
1111
build:
1212
runs-on: ubuntu-latest
1313
steps:
14-
- uses: actions/checkout@v3
14+
- uses: actions/checkout@v4
1515
- name: Set up JDK 21
16-
uses: actions/setup-java@v3
16+
uses: actions/setup-java@v4
1717
with:
1818
distribution: 'corretto'
1919
java-version: '21'
@@ -22,7 +22,7 @@ jobs:
2222
- name: Build with Gradle
2323
run: ./gradlew build --full-stacktrace
2424
- name: Upload Artifact
25-
uses: actions/upload-artifact@v3
25+
uses: actions/upload-artifact@v4
2626
with:
2727
name: Artifacts
2828
path: build/libs/*-release.jar

api/build.gradle.kts

+4-20
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,10 @@
1-
version = "0.1.0"
2-
3-
plugins {
4-
id("java-library")
5-
}
1+
import net.labymod.labygradle.common.extension.LabyModAnnotationProcessorExtension.ReferenceType
62

73
dependencies {
4+
labyProcessor()
85
labyApi("api")
9-
10-
// If you want to use external libraries, you can do that here.
11-
// The dependencies that are specified here are loaded into your project but will also
12-
// automatically be downloaded by labymod, but only if the repository is public.
13-
// If it is private, you have to add and compile the dependency manually.
14-
// You have to specify the repository, there are getters for maven central and sonatype, every
15-
// other repository has to be specified with their url. Example:
16-
// maven(mavenCentral(), "org.apache.httpcomponents:httpclient:4.5.13")
17-
}
18-
19-
labyModProcessor {
20-
referenceType = net.labymod.gradle.core.processor.ReferenceType.INTERFACE
216
}
227

23-
java {
24-
sourceCompatibility = JavaVersion.VERSION_21
25-
targetCompatibility = JavaVersion.VERSION_21
8+
labyModAnnotationProcessor {
9+
referenceType = ReferenceType.INTERFACE
2610
}

core/src/main/java/com/rappytv/toolwarn/api/ITbwSounds.java api/src/main/java/com/rappytv/toolwarn/api/IToolwarnSounds.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@
33
import net.labymod.api.client.resources.ResourceLocation;
44
import net.labymod.api.reference.annotation.Referenceable;
55
import org.jetbrains.annotations.NotNull;
6+
import org.jetbrains.annotations.Nullable;
67

8+
@Nullable
79
@Referenceable
8-
public interface ITbwSounds {
10+
public interface IToolwarnSounds {
911

1012
@NotNull ResourceLocation getPlingSound();
1113
@NotNull ResourceLocation getLevelUpSound();
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package com.rappytv.toolwarn.api;
2+
3+
public enum WarnSound {
4+
NONE,
5+
PLING,
6+
LEVEL_UP,
7+
GLASS_BREAK,
8+
ANVIL_USE
9+
}

core/src/main/java/com/rappytv/toolwarn/util/WarnTool.java api/src/main/java/com/rappytv/toolwarn/api/WarnTool.java

+19-15
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
1-
package com.rappytv.toolwarn.util;
1+
package com.rappytv.toolwarn.api;
22

33
import net.labymod.api.client.gui.icon.Icon;
44
import net.labymod.api.client.resources.ResourceLocation;
55
import net.labymod.api.client.world.item.ItemStack;
6+
import org.jetbrains.annotations.Nullable;
67

78
public class WarnTool {
89

10+
private static final ResourceLocation ICON_SPRITE = ResourceLocation.create("toolwarn",
11+
"textures/tools.png");
912
private Type type;
1013
private WarnSound sound;
1114
private WarnSound lastSound;
@@ -14,7 +17,11 @@ public class WarnTool {
1417
private boolean lastHitWarn;
1518

1619
public WarnTool() {
17-
this(Type.SWORD, WarnSound.NONE, WarnSound.NONE, 5, true, true);
20+
this(Type.SWORD);
21+
}
22+
23+
public WarnTool(Type type) {
24+
this(type, WarnSound.NONE, WarnSound.NONE, 5, true, true);
1825
}
1926

2027
public WarnTool(Type type, WarnSound sound, WarnSound lastSound, int warnAt, boolean openChat, boolean lastHitWarn) {
@@ -27,22 +34,22 @@ public WarnTool(Type type, WarnSound sound, WarnSound lastSound, int warnAt, boo
2734
}
2835

2936
public Type getType() {
30-
return type;
37+
return this.type;
3138
}
3239
public WarnSound getSound() {
33-
return sound;
40+
return this.sound;
3441
}
3542
public WarnSound getLastSound() {
36-
return lastSound;
43+
return this.lastSound;
3744
}
3845
public int getWarnAt() {
39-
return warnAt;
46+
return this.warnAt;
4047
}
4148
public boolean openChat() {
42-
return openChat;
49+
return this.openChat;
4350
}
4451
public boolean lastHitWarn() {
45-
return lastHitWarn;
52+
return this.lastHitWarn;
4653
}
4754

4855
public void setType(Type type) {
@@ -77,20 +84,17 @@ public enum Type {
7784
SHEARS(0, 2),
7885
TRIDENT(1, 2);
7986

80-
private final ResourceLocation sprite = ResourceLocation.create("toolwarn", "textures/tools.png");
81-
private final int x;
82-
private final int y;
87+
private final Icon icon;
8388

8489
Type(int x, int y) {
85-
this.x = x;
86-
this.y = y;
90+
this.icon = Icon.sprite32(ICON_SPRITE, x, y);
8791
}
8892

8993
public Icon getIcon() {
90-
return Icon.sprite32(sprite, x, y);
94+
return this.icon;
9195
}
9296

93-
public static Type getByItem(ItemStack itemStack) {
97+
public static Type getByItem(@Nullable ItemStack itemStack) {
9498
if(itemStack == null) return NONE;
9599
String path = itemStack.getIdentifier().getPath();
96100
if (path.endsWith("_sword")) {

build.gradle.kts

+16-71
Original file line numberDiff line numberDiff line change
@@ -1,95 +1,40 @@
11
plugins {
22
id("java-library")
3-
id("net.labymod.gradle")
4-
id("net.labymod.gradle.addon")
3+
id("net.labymod.labygradle")
4+
id("net.labymod.labygradle.addon")
55
}
66

7-
group = "org.example"
8-
version = "1.0.0"
7+
val versions = providers.gradleProperty("net.labymod.minecraft-versions").get().split(";")
98

10-
tasks.withType<JavaCompile> {
11-
options.encoding = "UTF-8"
12-
}
9+
group = "org.example"
10+
version = providers.environmentVariable("VERSION").getOrElse("1.4.3")
1311

1412
labyMod {
15-
defaultPackageName = "com.rappytv.toolwarn" //change this to your main package name (used by all modules)
13+
defaultPackageName = "com.rappytv.toolwarn"
1614
addonInfo {
1715
namespace = "toolwarn"
1816
displayName = "Toolbreak Warning"
1917
author = "RappyTV"
2018
description = "Stops you from using your currently used tool when its almost destroyed."
2119
minecraftVersion = "*"
22-
version = System.getenv().getOrDefault("VERSION", "1.4.2")
20+
version = rootProject.version.toString()
2321
}
2422

2523
minecraft {
26-
registerVersions(
27-
"1.8.9",
28-
"1.12.2",
29-
"1.16.5",
30-
"1.17.1",
31-
"1.18.2",
32-
"1.19.2",
33-
"1.19.3",
34-
"1.19.4",
35-
"1.20.1",
36-
"1.20.2",
37-
"1.20.4",
38-
"1.20.5",
39-
"1.20.6"
40-
) { version, provider ->
41-
configureRun(provider, version)
42-
}
43-
44-
subprojects.forEach {
45-
if (it.name != "game-runner") {
46-
filter(it.name)
24+
registerVersion(versions.toTypedArray()) {
25+
runs {
26+
getByName("client") {
27+
devLogin = true
28+
}
4729
}
4830
}
4931
}
50-
51-
addonDev {
52-
productionRelease()
53-
}
5432
}
5533

5634
subprojects {
57-
plugins.apply("java-library")
58-
plugins.apply("net.labymod.gradle")
59-
plugins.apply("net.labymod.gradle.addon")
60-
61-
repositories {
62-
maven("https://libraries.minecraft.net/")
63-
maven("https://repo.spongepowered.org/repository/maven-public/")
64-
}
65-
}
35+
plugins.apply("net.labymod.labygradle")
36+
plugins.apply("net.labymod.labygradle.addon")
6637

67-
fun configureRun(provider: net.labymod.gradle.core.minecraft.provider.VersionProvider, gameVersion: String) {
68-
provider.runConfiguration {
69-
mainClass = "net.minecraft.launchwrapper.Launch"
70-
jvmArgs("-Dnet.labymod.running-version=${gameVersion}")
71-
jvmArgs("-Dmixin.debug=true")
72-
jvmArgs("-Dnet.labymod.debugging.all=true")
73-
jvmArgs("-Dmixin.env.disableRefMap=true")
74-
75-
args("--tweakClass", "net.labymod.core.loader.vanilla.launchwrapper.LabyModLaunchWrapperTweaker")
76-
args("--labymod-dev-environment", "true")
77-
args("--addon-dev-environment", "true")
78-
}
79-
80-
provider.javaVersion = JavaVersion.VERSION_21
81-
82-
provider.mixin {
83-
val mixinMinVersion = when (gameVersion) {
84-
"1.8.9", "1.12.2", "1.16.5" -> {
85-
"0.6.6"
86-
}
87-
88-
else -> {
89-
"0.8.2"
90-
}
91-
}
92-
93-
minVersion = mixinMinVersion
94-
}
38+
group = rootProject.group
39+
version = rootProject.version
9540
}

core/build.gradle.kts

+6-23
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,13 @@
1-
version = "0.1.0"
2-
3-
plugins {
4-
id("java-library")
5-
}
6-
7-
tasks.withType<JavaCompile> {
8-
options.encoding = "UTF-8"
9-
}
1+
import net.labymod.labygradle.common.extension.LabyModAnnotationProcessorExtension.ReferenceType
102

113
dependencies {
4+
labyProcessor()
125
api(project(":api"))
136

14-
// If you want to use external libraries, you can do that here.
15-
// The dependencies that are specified here are loaded into your project but will also
16-
// automatically be downloaded by labymod, but only if the repository is public.
17-
// If it is private, you have to add and compile the dependency manually.
18-
// You have to specify the repository, there are getters for maven central and sonatype, every
19-
// other repository has to be specified with their url. Example:
20-
// maven(mavenCentral(), "org.apache.httpcomponents:httpclient:4.5.13")
21-
}
22-
23-
labyModProcessor {
24-
referenceType = net.labymod.gradle.core.processor.ReferenceType.DEFAULT
7+
// An example of how to add an external dependency that is used by the addon.
8+
// addonMavenDependency("org.jeasy:easy-random:5.0.0")
259
}
2610

27-
java {
28-
sourceCompatibility = JavaVersion.VERSION_21
29-
targetCompatibility = JavaVersion.VERSION_21
11+
labyModAnnotationProcessor {
12+
referenceType = ReferenceType.DEFAULT
3013
}

core/src/main/java/com/rappytv/toolwarn/TbwAddon.java

-60
This file was deleted.

0 commit comments

Comments
 (0)