From 7762474ae724d6d7df288cb09d6d7a398c8dc737 Mon Sep 17 00:00:00 2001 From: RewardedIvan Date: Fri, 25 Aug 2023 23:58:11 +0300 Subject: [PATCH] nekos.life source and 1.20.1 --- build.gradle | 2 +- gradle.properties | 10 +++--- gradle/wrapper/gradle-wrapper.properties | 2 +- .../java/anticope/esixtwoone/ImageHUD.java | 2 +- .../esixtwoone/sources/NekosLife.java | 33 +++++++++++++++++++ .../anticope/esixtwoone/sources/Source.java | 4 ++- 6 files changed, 44 insertions(+), 9 deletions(-) create mode 100644 src/main/java/anticope/esixtwoone/sources/NekosLife.java diff --git a/build.gradle b/build.gradle index 69da813..714d7d0 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ plugins { - id 'fabric-loom' version '0.12-SNAPSHOT' + id 'fabric-loom' version '1.2-SNAPSHOT' } sourceCompatibility = targetCompatibility = JavaVersion.VERSION_17 diff --git a/gradle.properties b/gradle.properties index a84f61b..21227f5 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,16 +1,16 @@ org.gradle.jvmargs=-Xmx2G # Fabric (https://fabricmc.net/versions.html) -minecraft_version=1.19.2 -yarn_mappings=1.19.2+build.4 -loader_version=0.14.9 +minecraft_version=1.20.1 +yarn_mappings=1.20.1+build.10 +loader_version=0.14.22 # Mod Properties -mod_version=0.1 +mod_version=0.2 maven_group=anticope archives_base_name=e621-addon # Dependency Versions. # Meteor (https://maven.meteordev.org/) -meteor_version=0.5.1-SNAPSHOT +meteor_version=0.5.4-SNAPSHOT diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 2e6e589..59bc51a 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/src/main/java/anticope/esixtwoone/ImageHUD.java b/src/main/java/anticope/esixtwoone/ImageHUD.java index 31326b4..21a8411 100644 --- a/src/main/java/anticope/esixtwoone/ImageHUD.java +++ b/src/main/java/anticope/esixtwoone/ImageHUD.java @@ -25,7 +25,7 @@ import anticope.esixtwoone.sources.Source.Size; import anticope.esixtwoone.sources.Source.SourceType; -import static baritone.api.utils.Helper.mc; +import static meteordevelopment.meteorclient.MeteorClient.mc; import static meteordevelopment.meteorclient.utils.Utils.WHITE; public class ImageHUD extends HudElement { diff --git a/src/main/java/anticope/esixtwoone/sources/NekosLife.java b/src/main/java/anticope/esixtwoone/sources/NekosLife.java new file mode 100644 index 0000000..cea7ece --- /dev/null +++ b/src/main/java/anticope/esixtwoone/sources/NekosLife.java @@ -0,0 +1,33 @@ +package anticope.esixtwoone.sources; + +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; + +import meteordevelopment.meteorclient.utils.network.Http; + +public class NekosLife extends Source { + + private final String domain; + + public NekosLife(String domain) { + this.domain = domain; + } + + @Override + public void reset() {} + + @Override + public String randomImage(String filter, Size size) { + String query = String.format("%s/api/v2/img/%s", domain, filter); + JsonElement result = Http.get(query).sendJson(JsonElement.class); + if (result == null) return null; + + if (result instanceof JsonObject object) { + if (object.get("url") != null) { + return object.get("url").getAsString(); + } + } + + return null; + } +} diff --git a/src/main/java/anticope/esixtwoone/sources/Source.java b/src/main/java/anticope/esixtwoone/sources/Source.java index 9f0dcb6..6f7cd58 100644 --- a/src/main/java/anticope/esixtwoone/sources/Source.java +++ b/src/main/java/anticope/esixtwoone/sources/Source.java @@ -16,7 +16,8 @@ public enum Size { public enum SourceType { e621, gelbooru, - rule34 + rule34, + nekoslife } protected final Random random = new Random(); @@ -39,6 +40,7 @@ public static Source getSource(SourceType type) { case e621 -> new ESixTwoOne(); case gelbooru -> new GelBooru("https://gelbooru.com/", 700); case rule34 -> new GelBooru("https://api.rule34.xxx/", 700); + case nekoslife -> new NekosLife("https://nekos.life"); default -> null; }; }