Skip to content

Commit

Permalink
Merge pull request #24 from RappyLabyAddons/feat/minimapIntegration
Browse files Browse the repository at this point in the history
feat: Add waypoints integration
  • Loading branch information
RappyTV authored Sep 27, 2024
2 parents 383baa9 + 03f1305 commit 40b4a8d
Show file tree
Hide file tree
Showing 33 changed files with 549 additions and 510 deletions.
24 changes: 4 additions & 20 deletions api/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,26 +1,10 @@
version = "0.1.0"

plugins {
id("java-library")
}
import net.labymod.labygradle.common.extension.LabyModAnnotationProcessorExtension.ReferenceType

dependencies {
labyProcessor()
labyApi("api")

// If you want to use external libraries, you can do that here.
// The dependencies that are specified here are loaded into your project but will also
// automatically be downloaded by labymod, but only if the repository is public.
// If it is private, you have to add and compile the dependency manually.
// You have to specify the repository, there are getters for maven central and sonatype, every
// other repository has to be specified with their url. Example:
// maven(mavenCentral(), "org.apache.httpcomponents:httpclient:4.5.13")
}

labyModProcessor {
referenceType = net.labymod.gradle.core.processor.ReferenceType.INTERFACE
}

java {
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
labyModAnnotationProcessor {
referenceType = ReferenceType.INTERFACE
}
95 changes: 19 additions & 76 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
plugins {
id("java-library")
id("net.labymod.gradle")
id("net.labymod.gradle.addon")
id("net.labymod.labygradle")
id("net.labymod.labygradle.addon")
}

group = "org.example"
version = "1.0.0"

java.toolchain.languageVersion.set(JavaLanguageVersion.of(17))
val versions = providers.gradleProperty("net.labymod.minecraft-versions").get().split(";")

tasks.withType<JavaCompile> {
options.encoding = "UTF-8"
}
group = "org.example"
version = providers.environmentVariable("VERSION").getOrElse("1.1.0")

labyMod {
defaultPackageName = "com.rappytv.deathfinder" //change this to your main package name (used by all modules)
Expand All @@ -20,79 +15,27 @@ 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.21"
version = System.getenv().getOrDefault("VERSION", "1.0.8")
minecraftVersion = "1.8<1.21.1"
version = rootProject.version.toString()

addon("labyswaypoints", true)
}

minecraft {
registerVersions(
"1.8.9",
"1.12.2",
"1.16.5",
"1.17.1",
"1.18.2",
"1.19.2",
"1.19.3",
"1.19.4",
"1.20.1",
"1.20.2",
"1.20.4",
"1.20.5",
"1.20.6",
"1.21"
) { version, provider ->
configureRun(provider, version)
}

subprojects.forEach {
if (it.name != "game-runner") {
filter(it.name)
registerVersion(versions.toTypedArray()) {
runs {
getByName("client") {
devLogin = true
}
}
}
}

addonDev {
productionRelease()
}
}

subprojects {
plugins.apply("java-library")
plugins.apply("net.labymod.gradle")
plugins.apply("net.labymod.gradle.addon")

repositories {
maven("https://libraries.minecraft.net/")
maven("https://repo.spongepowered.org/repository/maven-public/")
}
}
plugins.apply("net.labymod.labygradle")
plugins.apply("net.labymod.labygradle.addon")

fun configureRun(provider: net.labymod.gradle.core.minecraft.provider.VersionProvider, gameVersion: String) {
provider.runConfiguration {
mainClass = "net.minecraft.launchwrapper.Launch"
jvmArgs("-Dnet.labymod.running-version=${gameVersion}")
jvmArgs("-Dmixin.debug=true")
jvmArgs("-Dnet.labymod.debugging.all=true")
jvmArgs("-Dmixin.env.disableRefMap=true")

args("--tweakClass", "net.labymod.core.loader.vanilla.launchwrapper.LabyModLaunchWrapperTweaker")
args("--labymod-dev-environment", "true")
args("--addon-dev-environment", "true")
}

provider.javaVersion = JavaVersion.VERSION_21

provider.mixin {
val mixinMinVersion = when (gameVersion) {
"1.8.9", "1.12.2", "1.16.5" -> {
"0.6.6"
}

else -> {
"0.8.2"
}
}

minVersion = mixinMinVersion
}
}
group = rootProject.group
version = rootProject.version
}
29 changes: 6 additions & 23 deletions core/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,30 +1,13 @@
version = "0.1.0"

plugins {
id("java-library")
}

tasks.withType<JavaCompile> {
options.encoding = "UTF-8"
}
import net.labymod.labygradle.common.extension.LabyModAnnotationProcessorExtension.ReferenceType

dependencies {
labyProcessor()
api(project(":api"))

// If you want to use external libraries, you can do that here.
// The dependencies that are specified here are loaded into your project but will also
// automatically be downloaded by labymod, but only if the repository is public.
// If it is private, you have to add and compile the dependency manually.
// You have to specify the repository, there are getters for maven central and sonatype, every
// other repository has to be specified with their url. Example:
// maven(mavenCentral(), "org.apache.httpcomponents:httpclient:4.5.13")
}

labyModProcessor {
referenceType = net.labymod.gradle.core.processor.ReferenceType.DEFAULT
// An example of how to add an external dependency that is used by the addon.
// addonMavenDependency("org.jeasy:easy-random:5.0.0")
}

java {
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
labyModAnnotationProcessor {
referenceType = ReferenceType.DEFAULT
}
24 changes: 7 additions & 17 deletions core/src/main/java/com/rappytv/deathfinder/DeathFinderAddon.java
Original file line number Diff line number Diff line change
@@ -1,33 +1,27 @@
package com.rappytv.deathfinder;

import com.rappytv.deathfinder.commands.BackCommand;
import com.rappytv.deathfinder.commands.CoordsCommand;
import com.rappytv.deathfinder.commands.DeathFinderCommand;
import com.rappytv.deathfinder.listeners.DeathListener;
import com.rappytv.deathfinder.util.Location;
import com.rappytv.deathfinder.util.DeathLocation;
import net.labymod.api.addon.LabyAddon;
import net.labymod.api.client.component.Component;
import net.labymod.api.client.component.format.NamedTextColor;
import net.labymod.api.client.component.format.Style;
import net.labymod.api.client.component.format.TextDecoration;
import net.labymod.api.models.addon.annotation.AddonMain;

@AddonMain
public class DeathFinderAddon extends LabyAddon<DeathFinderConfig> {

public final static Component prefix = Component.empty()
.append(Component.text("DF ", Style.builder().color(NamedTextColor.DARK_PURPLE).decorate(TextDecoration.BOLD).build()))
.append(Component.text("DF ").color(NamedTextColor.DARK_PURPLE).decorate(TextDecoration.BOLD))
.append(Component.text("» ", NamedTextColor.DARK_GRAY));

private static Location deathLocation;
private static DeathFinderAddon instance;
private static DeathLocation deathLocation;

@Override
protected void enable() {
instance = this; // some static abuse lol

registerSettingCategory();
registerCommand(new BackCommand(this));
registerCommand(new CoordsCommand(this));
registerCommand(new DeathFinderCommand());
registerListener(new DeathListener(this));
}

Expand All @@ -36,15 +30,11 @@ protected Class<? extends DeathFinderConfig> configurationClass() {
return DeathFinderConfig.class;
}

public static DeathFinderAddon get() {
return instance;
}

public static void setDeathLocation(Location value) {
public static void setDeathLocation(DeathLocation value) {
deathLocation = value;
}

public static Location getDeathLocation() {
public static DeathLocation getDeathLocation() {
return deathLocation;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,30 +9,11 @@
@ConfigName("settings")
public class DeathFinderConfig extends AddonConfig {

@SettingSection("general")
@SwitchSetting
@SwitchSetting(hotkey = true)
private final ConfigProperty<Boolean> enabled = new ConfigProperty<>(true);
@SwitchSetting
private final ConfigProperty<Boolean> saveRotation = new ConfigProperty<>(false);

@SettingSection("commands")
@SwitchSetting
private final ConfigProperty<Boolean> backCommand = new ConfigProperty<>(true);
@SwitchSetting
private final ConfigProperty<Boolean> coordsCommand = new ConfigProperty<>(true);

@Override
public ConfigProperty<Boolean> enabled() {
return enabled;
}
public ConfigProperty<Boolean> saveRotation() {
return saveRotation;
}

public ConfigProperty<Boolean> backCommand() {
return backCommand;
}
public ConfigProperty<Boolean> coordsCommand() {
return coordsCommand;
}
}

This file was deleted.

This file was deleted.

Loading

0 comments on commit 40b4a8d

Please sign in to comment.