From 211ecfe68292114dba95f64c09ed9e2e241ce8e8 Mon Sep 17 00:00:00 2001 From: Neil Date: Tue, 18 Feb 2020 12:18:19 +0100 Subject: [PATCH] Include gui and api inside jar --- build.gradle | 13 ++++++++----- gradle.properties | 2 +- src/main/java/kaptainwutax/seedcracker/gui/Gui.java | 13 +++++++++++-- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/build.gradle b/build.gradle index 92b8cd3..5b74c11 100644 --- a/build.gradle +++ b/build.gradle @@ -18,19 +18,21 @@ repositories { url = "http://server.bbkr.space:8081/artifactory/libs-release" } } -dependencies { - modImplementation "io.github.cottonmc:LibGui:1.6.0" -} dependencies { //to change the versions see the gradle.properties file minecraft "com.mojang:minecraft:${project.minecraft_version}" mappings "net.fabricmc:yarn:${project.yarn_mappings}" modCompile "net.fabricmc:fabric-loader:${project.loader_version}" // Fabric API. This is technically optional, but you probably want it anyway. - // modCompile "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" + //modCompile "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" // PSA: Some older mods, compiled on Loom 0.2.1, might have outdated Maven POMs. // You may need to force-disable transitiveness on them. + + modImplementation "io.github.cottonmc:LibGui:1.6.0" + include "io.github.cottonmc:LibGui:1.6.0" + modImplementation("net.fabricmc.fabric-api:fabric-api:${project.fabric_version}") + include("net.fabricmc.fabric-api:fabric-api:${project.fabric_version}") } processResources { @@ -63,14 +65,15 @@ task sourcesJar(type: Jar, dependsOn: classes) { jar { from "LICENSE" -} +} // configure the maven publication publishing { publications { mavenJava(MavenPublication) { // add all the jars that should be included when publishing to maven artifact(remapJar) { + builtBy remapJar } artifact(sourcesJar) { diff --git a/gradle.properties b/gradle.properties index 5a2683a..ddc4024 100644 --- a/gradle.properties +++ b/gradle.properties @@ -14,5 +14,5 @@ org.gradle.jvmargs=-Xmx1G # Dependencies # currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api - fabric_version=0.4.29+build.290-1.15 + fabric_version=0.4.32+build.292-1.15 modmenu_version=1.10.1+build.30 diff --git a/src/main/java/kaptainwutax/seedcracker/gui/Gui.java b/src/main/java/kaptainwutax/seedcracker/gui/Gui.java index 1ce9c35..c748589 100644 --- a/src/main/java/kaptainwutax/seedcracker/gui/Gui.java +++ b/src/main/java/kaptainwutax/seedcracker/gui/Gui.java @@ -6,6 +6,8 @@ import io.github.cottonmc.cotton.gui.widget.WButton; import io.github.cottonmc.cotton.gui.widget.WGridPanel; import io.github.cottonmc.cotton.gui.widget.WLabel; import io.github.cottonmc.cotton.gui.widget.WSprite; +import kaptainwutax.seedcracker.SeedCracker; +import kaptainwutax.seedcracker.finder.FinderQueue; import net.minecraft.text.LiteralText; import net.minecraft.text.TranslatableText; import net.minecraft.util.Identifier; @@ -19,7 +21,15 @@ public class Gui extends LightweightGuiDescription { WSprite icon = new WSprite(new Identifier("minecraft:textures/item/redstone.png")); root.add(icon, 0, 2, 1, 1); - WButton button = new WButton(new TranslatableText("gui.examplemod.examplebutton")); + WButton button = new WButton(new TranslatableText("RESET DATA")); + button.setOnClick(new Runnable() { + @Override + public void run() { + SeedCracker.get().getDataStorage().clear(); + FinderQueue.get().clear(); + } + } + ); root.add(button, 0, 3, 4, 1); WLabel label = new WLabel(new LiteralText("Test"), 0xFFFFFF); @@ -29,7 +39,6 @@ public class Gui extends LightweightGuiDescription { } - @Override public void addPainters() { getRootPanel().setBackgroundPainter(BackgroundPainter.VANILLA); //This is done automatically though