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

Updated this shit +nekoslife source from the other guy #19

Open
wants to merge 11 commits 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
37 changes: 37 additions & 0 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# 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:
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 11
uses: actions/setup-java@v3
with:
java-version: '11'
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
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# E621 hud element

# E621 hud element with nekoslife updated for 1.20.2
Why did I update this?
Thanks RewardedIvan for nekoslife source
<div align="center">
<a href="https://discord.gg/9mrRPGKYU3"><img src="https://invidget.switchblade.xyz/9mrRPGKYU3"></a>
</div>
Expand Down
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.4-SNAPSHOT'
}

sourceCompatibility = targetCompatibility = JavaVersion.VERSION_17
Expand Down
15 changes: 6 additions & 9 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -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.2
yarn_mappings=1.20.2+build.4
loader_version=0.14.23

# Mod Properties
mod_version=0.1
mod_version=1.4.3
maven_group=anticope
archives_base_name=e621-addon
archives_base_name=e261-addon

# Dependency Versions.

# Meteor (https://maven.meteordev.org/)
meteor_version=0.5.1-SNAPSHOT
meteor_version=0.5.5-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.4-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
10 changes: 7 additions & 3 deletions 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 Expand Up @@ -56,8 +56,12 @@ public class ImageHUD extends HudElement {
.defaultValue(100)
.min(10)
.sliderRange(70, 1000)
.onChanged(o -> updateSize())
.build()
.onChanged(o -> {
if (o != 0) {
updateSize();
}
})
.build());
);

private final Setting<String> tags = sgGeneral.add(new StringSetting.Builder()
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