diff --git a/.github/workflows/dev_build.yml b/.github/workflows/dev_build.yml
index f7ccacf..adc8567 100644
--- a/.github/workflows/dev_build.yml
+++ b/.github/workflows/dev_build.yml
@@ -1,42 +1,25 @@
-# This workflow will build a Java project with Gradle
-# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle
-
-name: Java CI with Gradle
-
-concurrency:
- group: "build-1.19"
- cancel-in-progress: true
-
-on:
- push:
- branches: [ master ]
- paths-ignore:
- - '*.md'
-
+name: Publish Development Build
+on: push
jobs:
build:
-
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v2
- - name: Set up JDK 17
- uses: actions/setup-java@v2
- with:
- java-version: 17
- distribution: 'zulu'
- - name: Grant execute permission for gradlew
- run: chmod +x gradlew
- - name: Build with Gradle
- run: ./gradlew build
- - name: Remove *-dev.jar
- run: rm ./build/libs/*-dev.jar || true
- - uses: "marvinpinto/action-automatic-releases@latest"
- with:
- repo_token: "${{ secrets.GITHUB_TOKEN }}"
- automatic_release_tag: "latest-1.19"
- prerelease: false
- title: "1.19 Build"
+ - uses: actions/checkout@v2
+ - uses: actions/setup-java@v2
+ with:
+ java-version: 17
+ distribution: adopt
+ - name: Change wrapper permissions
+ run: chmod +x ./gradlew
+ - name: Build
+ run: ./gradlew build
+ - name: Release
+ uses: marvinpinto/action-automatic-releases@latest
+ with:
+ repo_token: '${{ secrets.GITHUB_TOKEN }}'
+ automatic_release_tag: latest
+ prerelease: true
+ title: Dev Build
files: |
./build/libs/*.jar
-
diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml
new file mode 100644
index 0000000..adb7685
--- /dev/null
+++ b/.github/workflows/gradle.yml
@@ -0,0 +1,38 @@
+# This workflow uses actions that are not certified by GitHub.
+# They are provided by a third-party and are governed by
+# separate terms of service, privacy policy, and support
+# documentation.
+# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
+# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle
+
+name: Java CI with Gradle
+
+on:
+ workflow_dispatch:
+ push:
+ branches: [ "master" ]
+ pull_request:
+ branches: [ "master" ]
+
+permissions:
+ contents: read
+
+jobs:
+ build:
+
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v3
+ - name: Set up JDK 17
+ uses: actions/setup-java@v3
+ with:
+ java-version: '17'
+ distribution: 'temurin'
+ - name: Change wrapper permissions
+ run: chmod +x ./gradlew
+
+ - name: Build with Gradle
+ uses: gradle/gradle-build-action@bd5760595778326ba7f1441bcf7e88b49de61a25 # v2.6.0
+ with:
+ arguments: build
diff --git a/README.md b/README.md
index f693eb5..e32e874 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,11 @@
-# E621 hud element
+
+

+
+# E621 hud element with nekoslife, e926, danbooru and safebooru updated for 1.20.4
+Why did I update this?
+We all know how many people rely on this every day.
+Thanks RewardedIvan for nekoslife source
@@ -10,7 +16,7 @@
-
+
diff --git a/build.gradle b/build.gradle
index 69da813..7d02c21 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,5 +1,5 @@
plugins {
- id 'fabric-loom' version '0.12-SNAPSHOT'
+ id 'fabric-loom' version '1.5-SNAPSHOT'
}
sourceCompatibility = targetCompatibility = JavaVersion.VERSION_17
diff --git a/gradle.properties b/gradle.properties
index a84f61b..315f73f 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -1,16 +1,13 @@
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.4
+yarn_mappings=1.20.4+build.2
+loader_version=0.15.1
# Mod Properties
-mod_version=0.1
+mod_version=1.4.5
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.6-SNAPSHOT
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index 2e6e589..e411586 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.4-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..2afd113 100644
--- a/src/main/java/anticope/esixtwoone/ImageHUD.java
+++ b/src/main/java/anticope/esixtwoone/ImageHUD.java
@@ -25,7 +25,12 @@
import anticope.esixtwoone.sources.Source.Size;
import anticope.esixtwoone.sources.Source.SourceType;
-import static baritone.api.utils.Helper.mc;
+import javax.imageio.ImageIO;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+
+import static meteordevelopment.meteorclient.MeteorClient.mc;
import static meteordevelopment.meteorclient.utils.Utils.WHITE;
public class ImageHUD extends HudElement {
@@ -56,7 +61,11 @@ public class ImageHUD extends HudElement {
.defaultValue(100)
.min(10)
.sliderRange(70, 1000)
- .onChanged(o -> updateSize())
+ .onChanged(o -> {
+ if (o != 0) {
+ updateSize();
+ }
+ })
.build()
);
@@ -154,8 +163,10 @@ private void loadImage() {
return;
}
E621Hud.LOG.info(url);
- var img = NativeImage.read(Http.get(url).sendInputStream());
- mc.getTextureManager().registerTexture(TEXID, new NativeImageBackedTexture(img));
+ var img = ImageIO.read(Http.get(url).sendInputStream());
+ var baos = new ByteArrayOutputStream();
+ ImageIO.write(img, "png", baos);
+ mc.getTextureManager().registerTexture(TEXID, new NativeImageBackedTexture(NativeImage.read(new ByteArrayInputStream(baos.toByteArray()))));
empty = false;
} catch (Exception ex) {
E621Hud.LOG.error("Failed to render the image.", ex);
diff --git a/src/main/java/anticope/esixtwoone/sources/DanBooru.java b/src/main/java/anticope/esixtwoone/sources/DanBooru.java
new file mode 100644
index 0000000..1ac5bbe
--- /dev/null
+++ b/src/main/java/anticope/esixtwoone/sources/DanBooru.java
@@ -0,0 +1,39 @@
+package anticope.esixtwoone.sources;
+
+import com.google.gson.JsonArray;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonObject;
+
+import meteordevelopment.meteorclient.utils.network.Http;
+
+public class DanBooru extends Source {
+
+ private final String domain;
+ private final int lastPage;
+
+ public DanBooru(String domain, int lastPage) {
+ this.domain = domain;
+ this.lastPage = lastPage;
+ }
+
+ @Override
+ public void reset() {}
+
+ @Override
+ public String randomImage(String filter, Size size) {
+ String query = String.format("%s/posts.json?tags=%s&page=%d&format=json&limit=10", domain, filter, random.nextInt(0, lastPage));
+ JsonElement result = Http.get(query).sendJson(JsonElement.class);
+ if (result == null) return null;
+
+ if (result instanceof JsonArray array) {
+ if (array.get(random.nextInt(0, Math.min(11, array.size()))) instanceof JsonObject post) {
+ return switch (size) {
+ case preview -> post.get("preview_file_url").getAsString();
+ case sample -> post.get("large_file_url").getAsString();
+ case file -> post.get("file_url").getAsString();
+ };
+ }
+ }
+ return null;
+ }
+}
diff --git a/src/main/java/anticope/esixtwoone/sources/ESixTwoOne.java b/src/main/java/anticope/esixtwoone/sources/ESixTwoOne.java
index 52ed983..ed49f6d 100644
--- a/src/main/java/anticope/esixtwoone/sources/ESixTwoOne.java
+++ b/src/main/java/anticope/esixtwoone/sources/ESixTwoOne.java
@@ -7,6 +7,12 @@
public class ESixTwoOne extends Source {
+ private final String domain;
+
+ public ESixTwoOne(String domain) {
+ this.domain = domain;
+ }
+
private int maxPage = 30;
@Override
@@ -17,15 +23,14 @@ public void reset() {
@Override
public String randomImage(String filter, Size size) {
int pageNum = random.nextInt(1, maxPage);
- JsonObject result = Http.get("https://e621.net/posts.json?limit=320&tags="+filter+"&page="+ pageNum).sendJson(JsonObject.class);
+ JsonObject result = Http.get(domain + "/posts.json?limit=320&tags="+filter+"&page="+ pageNum).sendJson(JsonObject.class);
if (result.get("posts") instanceof JsonArray array) {
if(array.size() <= 0) {
maxPage = pageNum - 1;
return null;
}
if (array.get(random.nextInt(array.size())) instanceof JsonObject post) {
- var url = post.get(size.toString()).getAsJsonObject().get("url").getAsString();
- return url;
+ return post.get(size.toString()).getAsJsonObject().get("url").getAsString();
}
}
return null;
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..15accb4 100644
--- a/src/main/java/anticope/esixtwoone/sources/Source.java
+++ b/src/main/java/anticope/esixtwoone/sources/Source.java
@@ -15,8 +15,13 @@ public enum Size {
public enum SourceType {
e621,
+ e926,
+
gelbooru,
- rule34
+ danbooru,
+ safebooru,
+ rule34,
+ nekoslife
}
protected final Random random = new Random();
@@ -36,10 +41,13 @@ public String getRandomImage(String filter, Size size) {
public static Source getSource(SourceType type) {
return switch (type) {
- case e621 -> new ESixTwoOne();
- case gelbooru -> new GelBooru("https://gelbooru.com/", 700);
- case rule34 -> new GelBooru("https://api.rule34.xxx/", 700);
- default -> null;
+ case e621 -> new ESixTwoOne("https://e621.net");
+ case e926 -> new ESixTwoOne("https://e926.net");
+ case gelbooru -> new GelBooru("https://gelbooru.com", 700);
+ case danbooru -> new DanBooru("https://danbooru.donmai.us", 700);
+ case safebooru -> new GelBooru("https://safebooru.org", 700);
+ case rule34 -> new GelBooru("https://api.rule34.xxx", 700);
+ case nekoslife -> new NekosLife("https://nekos.life");
};
}
}
diff --git a/src/main/resources/assets/e621/icon.png b/src/main/resources/assets/e621/icon.png
index b6c0d33..ccd90af 100644
Binary files a/src/main/resources/assets/e621/icon.png and b/src/main/resources/assets/e621/icon.png differ
diff --git a/src/main/resources/assets/e621/logo.png b/src/main/resources/assets/e621/logo.png
new file mode 100644
index 0000000..f337a6c
Binary files /dev/null and b/src/main/resources/assets/e621/logo.png differ
diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json
index 01cfc38..bf2064f 100644
--- a/src/main/resources/fabric.mod.json
+++ b/src/main/resources/fabric.mod.json
@@ -3,12 +3,15 @@
"id": "e621-hud",
"version": "${version}",
"name": "E621 hud",
- "description": "An addon template for the Meteor addons.",
+ "description": "E621 hud element for meteor client.",
"authors": [
- "AntiCope"
+ "AntiCope",
+ "veronoicc"
],
"contact": {
- "repo": "https://github.com/MeteorDevelopment/meteor-addon-template"
+ "homepage": "https://github.com/veronoicc/meteor-e621-integration",
+ "issues": "https://github.com/veronoicc/meteor-e621-integration/issues",
+ "repo": "https://github.com/veronoicc/meteor-e621-integration"
},
"icon": "assets/e621/icon.png",
"environment": "client",