Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nekos.life source and 1.20.1 #18

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id 'fabric-loom' version '0.12-SNAPSHOT'
id 'fabric-loom' version '1.2-SNAPSHOT'
}

sourceCompatibility = targetCompatibility = JavaVersion.VERSION_17
Expand Down
10 changes: 5 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion src/main/java/anticope/esixtwoone/ImageHUD.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
33 changes: 33 additions & 0 deletions src/main/java/anticope/esixtwoone/sources/NekosLife.java
Original file line number Diff line number Diff line change
@@ -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;
}
}
4 changes: 3 additions & 1 deletion src/main/java/anticope/esixtwoone/sources/Source.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ public enum Size {
public enum SourceType {
e621,
gelbooru,
rule34
rule34,
nekoslife
}

protected final Random random = new Random();
Expand All @@ -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;
};
}
Expand Down