From 50c730331fae8b9e793dc053e668acf2673692e7 Mon Sep 17 00:00:00 2001 From: Wohlhabend Date: Thu, 9 Dec 2021 20:05:11 +0100 Subject: update to 1.4.2 and add Zailer43 to contributor --- src/main/resources/fabric.mod.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/main/resources') diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index fbb1dd91..560b5f0e 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -5,7 +5,7 @@ "name": "Skyblocker", "description": "Hypixel Skyblock Mod", "authors": ["xMrVizzy", "d3dx9", "LifeIsAParadox"], - "contributors": ["ExternalTime"], + "contributors": ["ExternalTime", "Zailer43"], "contact": { "homepage": "https://hysky.de", "sources": "https://github.com/LifeIsAParadox/Skyblocker", -- cgit From c11770ea6f633c90599f2d0f72537f2268d3edfb Mon Sep 17 00:00:00 2001 From: LifeIsAParadox Date: Sun, 12 Dec 2021 22:23:07 +0100 Subject: fix log4j2 --- build.gradle | 16 ++-------------- gradle.properties | 10 +++++----- gradle/wrapper/gradle-wrapper.properties | 4 ++-- src/main/resources/fabric.mod.json | 2 +- 4 files changed, 10 insertions(+), 22 deletions(-) (limited to 'src/main/resources') diff --git a/build.gradle b/build.gradle index 9f7503ca..c5656d10 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ plugins { - id 'fabric-loom' version '0.9-SNAPSHOT' + id 'fabric-loom' version '0.10-SNAPSHOT' id 'maven-publish' id 'com.modrinth.minotaur' version '1.2.+' } @@ -67,12 +67,6 @@ processResources { } tasks.withType(JavaCompile).configureEach { - // ensure that the encoding is set to UTF-8, no matter what the system default is - // this fixes some edge cases with special characters not displaying correctly - // see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html - // If Javadoc is generated, this must be specified in that task too. - it.options.encoding = "UTF-8" - // Minecraft 1.17 (21w19a) upwards uses Java 16. it.options.release = 16 } @@ -119,13 +113,7 @@ task publishModrinth(type: TaskModrinthUpload) { publishing { publications { mavenJava(MavenPublication) { - // add all the jars that should be included when publishing to maven - artifact(remapJar) { - builtBy remapJar - } - artifact(sourcesJar) { - builtBy remapSourcesJar - } + from components.java } } diff --git a/gradle.properties b/gradle.properties index 52dd1e8b..2d704f84 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,17 +2,17 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties (https://fabricmc.net/versions.html) minecraft_version=1.17.1 -yarn_mappings=1.17.1+build.61 -loader_version=0.11.7 +yarn_mappings=1.17.1+build.65 +loader_version=0.12.11 #Fabric api -fabric_version=0.40.0+1.17 +fabric_version=0.44.0+1.17 # Dependencies ## Cloth Api (https://www.curseforge.com/minecraft/mc-mods/cloth-config/files) -clothconfig_version=5.0.38 +clothconfig_version=5.2.47 ## Mod Menu (https://www.curseforge.com/minecraft/mc-mods/modmenu/files) -mod_menu_version=2.0.4 +mod_menu_version=2.0.14 # Mod Properties mod_version = 1.4.2 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index b3974a11..54e9a60b 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-bin.zip zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-all.zip \ No newline at end of file +zipStorePath=wrapper/dists \ No newline at end of file diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 560b5f0e..250e5737 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -26,7 +26,7 @@ "skyblocker.mixins.json" ], "depends": { - "fabricloader": ">=0.11.3", + "fabricloader": ">=0.12.11", "fabric": "*", "cloth-config2": "*", "minecraft": "1.17.x", -- cgit From c9099ba6630d82cebcf53987b0df5480c9917c12 Mon Sep 17 00:00:00 2001 From: ExternalTime <84183548+ExternalTime@users.noreply.github.com> Date: Sat, 18 Dec 2021 17:48:54 +0100 Subject: Reduced repetition in how status bars are drawn --- .../skyblocker/skyblock/FancyStatusBars.java | 152 +++++++++++---------- .../assets/skyblocker/textures/gui/bars.png | Bin 6756 -> 8158 bytes 2 files changed, 79 insertions(+), 73 deletions(-) (limited to 'src/main/resources') diff --git a/src/main/java/me/xmrvizzy/skyblocker/skyblock/FancyStatusBars.java b/src/main/java/me/xmrvizzy/skyblocker/skyblock/FancyStatusBars.java index 852a16df..84eebed3 100644 --- a/src/main/java/me/xmrvizzy/skyblocker/skyblock/FancyStatusBars.java +++ b/src/main/java/me/xmrvizzy/skyblocker/skyblock/FancyStatusBars.java @@ -15,39 +15,47 @@ import java.util.regex.Pattern; public class FancyStatusBars extends DrawableHelper { private static final MinecraftClient client = MinecraftClient.getInstance(); - private static final Identifier BARS = new Identifier(SkyblockerMod.NAMESPACE,"textures/gui/bars.png"); + private static final Identifier BARS = new Identifier(SkyblockerMod.NAMESPACE, "textures/gui/bars.png"); private static final Pattern ACTION_BAR_STATUS = Pattern.compile("^§[6c]([0-9]+)/([0-9]+)❤(?:\\+§c[0-9]+\\S)? {3,}(?:§a([0-9]+)§a❈ Defense|(\\S+(?: \\S+)*)) {3,}(?:§b([0-9]+)/([0-9]+)✎ (?:Mana|§3([0-9]+)ʬ)?|(\\S+(?: \\S+)*))(.*)$"); - private final Resource health; - private final Resource mana; - private int defense; - - public FancyStatusBars() { - health = new Resource(100, 100); - mana = new Resource(100, 100); - defense = 0; - } + + private final Resource[] resources = new Resource[]{ + // Health + new Resource(16733525), + // Mana + new Resource(5636095), + // Defense + new Resource(12106180), + // Experience + new Resource(8453920), + }; public boolean update(String actionBar) { - if(!SkyblockerConfig.get().general.bars.enableBars) + if (!SkyblockerConfig.get().general.bars.enableBars) return false; Matcher matcher = ACTION_BAR_STATUS.matcher(actionBar); - if(!matcher.matches()) + if (!matcher.matches()) return false; - health.set(matcher.group(1), matcher.group(2)); - if(matcher.group(3) != null) - defense = Integer.parseInt(matcher.group(3)); - if(matcher.group(5) != null) { - mana.set(matcher.group(5), matcher.group(6)); - if(matcher.group(7) != null) - mana.add(Integer.parseInt(matcher.group(7))); + + resources[0].setMax(Integer.parseInt(matcher.group(1)), Integer.parseInt(matcher.group(2))); + if (matcher.group(3) != null) { + int def = Integer.parseInt(matcher.group(3)); + resources[2].setFillLevel(def, (double) def / ((double) def + 100D)); } + if (matcher.group(5) != null) { + int m = Integer.parseInt(matcher.group(5)); + if (matcher.group(7) != null) + m += Integer.parseInt(matcher.group(7)); + resources[1].setMax(m, Integer.parseInt(matcher.group(6))); + } + assert client.player != null; + resources[3].setFillLevel(client.player.experienceLevel, client.player.experienceProgress); StringBuilder sb = new StringBuilder(); appendIfNotNull(sb, matcher.group(4)); appendIfNotNull(sb, matcher.group(8)); appendIfNotNull(sb, matcher.group(9)); - if(!sb.isEmpty()) { + if (!sb.isEmpty()) { assert client.player != null; client.player.sendMessage(Text.of(sb.toString()), true); } @@ -56,52 +64,34 @@ public class FancyStatusBars extends DrawableHelper { } private void appendIfNotNull(StringBuilder sb, String str) { - if(str == null) + if (str == null) return; - if(!sb.isEmpty()) + if (!sb.isEmpty()) sb.append(" "); sb.append(str); } + private static final int BAR_SPACING = 46; + public boolean render(MatrixStack matrices, int scaledWidth, int scaledHeight) { - if(!SkyblockerConfig.get().general.bars.enableBars) + if (!SkyblockerConfig.get().general.bars.enableBars) return false; int left = scaledWidth / 2 - 91; int top = scaledHeight - 35; - - int hpFillWidth = (int) (health.getFillLevel() * 33.0F); - int hpOverflowWidth = (int) (health.getOverflow() * 33.0F); - int manaFillWidth = (int) (mana.getFillLevel() * 33.0F); - assert client.player != null; - int xp = (int) (client.player.experienceProgress * 33.0F); - int defenseFill = (int) (defense / (defense + 100.0) * 33.0); - - // Icons -// this.client.getTextureManager().bindTexture(BARS); RenderSystem.setShaderTexture(0, BARS); - this.drawTexture(matrices, left, top, 0, 0, 9, 9); - this.drawTexture(matrices, left + 47, top, 9, 0, 7, 9); - this.drawTexture(matrices, left + 92, top, 16, 0, 9, 9); - this.drawTexture(matrices, left + 139, top, 25, 0, 9, 9); - - // Empty Bars - this.drawTexture(matrices, left + 10, top + 1, 0, 9, 33, 7); - this.drawTexture(matrices, left + 55, top + 1, 0, 9, 33, 7); - this.drawTexture(matrices, left + 102, top + 1, 0, 9, 33, 7); - this.drawTexture(matrices, left + 149, top + 1, 0, 9, 33, 7); - - // Progress Bars - this.drawTexture(matrices, left + 10, top + 1, 0, 16, hpFillWidth, 7); - this.drawTexture(matrices, left + 10, top + 1, 0, 44, hpOverflowWidth, 7); - this.drawTexture(matrices, left + 55, top + 1, 0, 23, manaFillWidth, 7); - this.drawTexture(matrices, left + 102, top + 1, 0, 30, defenseFill, 7); - this.drawTexture(matrices, left + 149, top + 1, 0, 37, xp, 7); - - // Progress Texts - renderText(matrices, health.getValue(), left + 11, top, 16733525); - renderText(matrices, mana.getValue(), left + 56, top, 5636095); - renderText(matrices, defense, left + 103, top, 12106180); - renderText(matrices, client.player.experienceLevel, left + 150, top, 8453920); + for (int i = 0; i < 4; i++) { + this.drawTexture(matrices, left + i * BAR_SPACING, top, 0, 9 * i, 43, 9); + int fillCount = resources[i].getFillCount(); + for (int j = 0; j < fillCount; j++) { + this.drawTexture(matrices, left + 11 + i * BAR_SPACING, top, 43 + 31 * j, 9 * i, Resource.INNER_WIDTH, 9); + } + int fillLevel = resources[i].getFillLevel(); + if (0 < fillLevel) + this.drawTexture(matrices, left + 11 + i * BAR_SPACING, top, 43 + 31 * fillCount, 9 * i, fillLevel, 9); + } + for (int i = 0; i < 4; i++) { + renderText(matrices, resources[i].getValue(), left + 11 + i * BAR_SPACING, top, resources[i].getTextColor()); + } return true; } @@ -111,35 +101,51 @@ public class FancyStatusBars extends DrawableHelper { int x = left + (33 - textRenderer.getWidth(text)) / 2; int y = top - 3; - textRenderer.draw(matrices, text, (float) (x + 1), (float) y, 0); - textRenderer.draw(matrices, text, (float) (x - 1), (float) y, 0); - textRenderer.draw(matrices, text, (float) x, (float) (y + 1), 0); - textRenderer.draw(matrices, text, (float) x, (float) (y - 1), 0); + // for i in [-1, 1] + for (int i = -1; i < 2; i += 2) { + textRenderer.draw(matrices, text, (float) (x + i), (float) y, 0); + textRenderer.draw(matrices, text, (float) x, (float) (y + i), 0); + } + textRenderer.draw(matrices, text, (float) x, (float) y, color); } private static class Resource { + static final int INNER_WIDTH = 31; private int value; - private int max; - public Resource(int value, int max) { - this.value = value; - this.max = max; + private int fillLevel; + private final int textColor; + + public Resource(int textColor) { + this.value = 0; + this.fillLevel = INNER_WIDTH; + this.textColor = textColor; } - public void set(String value, String max) { - this.value = Integer.parseInt(value); - this.max = Integer.parseInt(max); + + public void setMax(int value, int max) { + this.value = value; + this.fillLevel = value * INNER_WIDTH / max; } - public void add(int value) { - this.value += value; + + public void setFillLevel(int value, double fillLevel) { + this.value = value; + this.fillLevel = (int) (INNER_WIDTH * fillLevel); } + public int getValue() { return value; } - public double getFillLevel() { - return Math.min(((double)value)/((double)max), 1); + + public int getFillCount() { + return fillLevel / INNER_WIDTH; + } + + public int getFillLevel() { + return fillLevel % INNER_WIDTH; } - public double getOverflow() { - return Math.max(((double)value)/((double)max) - 1, 0); + + public int getTextColor() { + return textColor; } } } \ No newline at end of file diff --git a/src/main/resources/assets/skyblocker/textures/gui/bars.png b/src/main/resources/assets/skyblocker/textures/gui/bars.png index d3fc95b1..8b5ca33d 100644 Binary files a/src/main/resources/assets/skyblocker/textures/gui/bars.png and b/src/main/resources/assets/skyblocker/textures/gui/bars.png differ -- cgit From 3acbec693b93de43a91cc8bd4b5d4ba0466305ef Mon Sep 17 00:00:00 2001 From: LifeIsAParadox Date: Thu, 9 Dec 2021 19:51:35 +0100 Subject: support 1.18.x minecraft version and update to 1.4.2 [skip ci] --- .github/workflows/beta.yml | 52 ------------ .github/workflows/buildrelease.yml | 92 ---------------------- build.gradle | 14 +++- gradle.properties | 12 +-- .../skyblocker/utils/RenderUtilsLiving.java | 6 +- .../me/xmrvizzy/skyblocker/utils/Vertexer.java | 20 ++--- src/main/resources/fabric.mod.json | 4 +- src/main/resources/skyblocker.mixins.json | 3 +- 8 files changed, 32 insertions(+), 171 deletions(-) delete mode 100644 .github/workflows/beta.yml delete mode 100644 .github/workflows/buildrelease.yml (limited to 'src/main/resources') diff --git a/.github/workflows/beta.yml b/.github/workflows/beta.yml deleted file mode 100644 index 54292277..00000000 --- a/.github/workflows/beta.yml +++ /dev/null @@ -1,52 +0,0 @@ -name: Build Beta - -on: - push: - branches: - - '**' - pull_request: - - -jobs: - # This workflow contains a single job called "build" - build: - # The type of runner that the job will run on - runs-on: ubuntu-latest - # Steps represent a sequence of tasks that will be executed as part of the job - steps: - # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - uses: actions/checkout@v2 - - - uses: actions/github-script@v2 - with: - result-encoding: string - script: | - const fs = require("fs"); - let file = fs.readFileSync("./gradle.properties"); - file = file.toString().split("\n").map(e => e.trim().startsWith("mod_version") ? `${e}-beta-${process.env.GITHUB_SHA.substring(0, 7)}` : e).join("\n"); - fs.writeFileSync("./gradle.properties", file); - - - name: Set up JDK 16 - uses: actions/setup-java@v2 - with: - distribution: 'adopt' - java-version: '16' - - - name: Grant execute permission for gradlew - run: chmod +x gradlew - - - name: Build with Gradle - run: ./gradlew build - - - uses: actions/github-script@v2 - id: fname - with: - result-encoding: string - script: | - const fs = require("fs") - return fs.readdirSync("build/libs/").filter(e => !e.endsWith("dev.jar") && !e.endsWith("sources.jar") && e.endsWith(".jar"))[0].replace(".jar", ""); - - - uses: actions/upload-artifact@v2 - with: - name: ${{ steps.fname.outputs.result }} - path: build/libs/ \ No newline at end of file diff --git a/.github/workflows/buildrelease.yml b/.github/workflows/buildrelease.yml deleted file mode 100644 index afc4bf68..00000000 --- a/.github/workflows/buildrelease.yml +++ /dev/null @@ -1,92 +0,0 @@ -# This is a basic workflow to help you get started with Actions - -name: Build Release - -# Controls when the action will run. Triggers the workflow on push or pull request -# events but only for the master branch -on: - release: - types: [created] - -jobs: - # This workflow contains a single job called "build" - build: - # The type of runner that the job will run on - runs-on: ubuntu-latest - # Steps represent a sequence of tasks that will be executed as part of the job - steps: - # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - uses: actions/checkout@v2 - - name: Set up JDK 16 - uses: actions/setup-java@v2 - with: - distribution: 'adopt' - java-version: '16' - - - name: Grant execute permission for gradlew - run: chmod +x gradlew - - - name: Build with Gradle - run: ./gradlew build - - - uses: actions/upload-artifact@v2 - with: - name: Artifacts - path: build/libs/ - - - name: Read Changelog - id: read_changelog - shell: bash - run: | - CHANGELOG=$(sed '/___/Q' CHANGELOG.md | grep -v '# ') - echo "Changelog:\n$CHANGELOG" - CHANGELOG="${CHANGELOG//'%'/'%25'}" - CHANGELOG="${CHANGELOG//$'\n'/'%0A'}" - CHANGELOG="${CHANGELOG//$'\r'/'%0D'}" - echo "::set-output name=changelog::$CHANGELOG" - - - uses: actions/github-script@v2 - id: fname - with: - result-encoding: string - script: | - const fs = require("fs") - return fs.readdirSync("build/libs/").filter(e => !e.endsWith("dev.jar") && !e.endsWith("sources.jar") && e.endsWith(".jar"))[0] - - name: Release - id: uploadrelease - uses: softprops/action-gh-release@v1 - with: - body: ${{ steps.read_changelog.outputs.changelog }} - files: build/libs/${{ steps.fname.outputs.result }} - - - name: Publish to Modrinth - id: modrinth - env: - MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }} - CHANGELOG: ${{ steps.read_changelog.outputs.changelog }} - run: ./gradlew publishModrinth - - - name: Get version tag - id: version_tag - run: | - [[ ! "$GITHUB_REF" =~ refs/tags ]] && exit - echo "::set-output name=value::${GITHUB_REF#refs/tags/}" - - - name: Discord notification - env: - DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} - uses: Ilshidur/action-discord@master - with: - args: | - "@here" - "Skyblocker ${{ steps.version_tag.outputs.value }}" - "" - "Changelog" - "```md" - "${{ steps.read_changelog.outputs.changelog }}" - "```" - ":inbox_tray: Download latest version on Modrinth or Github:" - "<:modrinth:900697862206287882> <${{ steps.modrinth.outputs.url }}>" - "<:github:900697885706952725> <${{ steps.uploadrelease.outputs.url }}>" - "" - "" \ No newline at end of file diff --git a/build.gradle b/build.gradle index c5656d10..fc535314 100644 --- a/build.gradle +++ b/build.gradle @@ -7,8 +7,8 @@ plugins { import com.modrinth.minotaur.TaskModrinthUpload import com.modrinth.minotaur.request.VersionType -sourceCompatibility = JavaVersion.VERSION_16 -targetCompatibility = JavaVersion.VERSION_16 +sourceCompatibility = JavaVersion.VERSION_17 +targetCompatibility = JavaVersion.VERSION_17 archivesBaseName = project.archives_base_name version = "${project.mod_version}+${project.minecraft_version}" @@ -67,8 +67,14 @@ processResources { } tasks.withType(JavaCompile).configureEach { - // Minecraft 1.17 (21w19a) upwards uses Java 16. - it.options.release = 16 + // ensure that the encoding is set to UTF-8, no matter what the system default is + // this fixes some edge cases with special characters not displaying correctly + // see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html + // If Javadoc is generated, this must be specified in that task too. + it.options.encoding = "UTF-8" + + // Minecraft 1.18 upwards uses Java 17. + it.options.release = 17 } java { diff --git a/gradle.properties b/gradle.properties index 52e12079..e4b56d12 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,18 +1,18 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties (https://fabricmc.net/versions.html) -minecraft_version=1.17.1 -yarn_mappings=1.17.1+build.65 -loader_version=0.12.11 +minecraft_version=1.18 +yarn_mappings=1.18+build.1 +loader_version=0.12.8 #Fabric api -fabric_version=0.44.0+1.17 +fabric_version=0.43.1+1.18 # Dependencies ## Cloth Api (https://www.curseforge.com/minecraft/mc-mods/cloth-config/files) -clothconfig_version=5.2.47 +clothconfig_version=6.0.42 ## Mod Menu (https://www.curseforge.com/minecraft/mc-mods/modmenu/files) -mod_menu_version=2.0.14 +mod_menu_version=3.0.0 # Mod Properties mod_version = 1.4.3 diff --git a/src/main/java/me/xmrvizzy/skyblocker/utils/RenderUtilsLiving.java b/src/main/java/me/xmrvizzy/skyblocker/utils/RenderUtilsLiving.java index f6fb1bc1..962421b7 100644 --- a/src/main/java/me/xmrvizzy/skyblocker/utils/RenderUtilsLiving.java +++ b/src/main/java/me/xmrvizzy/skyblocker/utils/RenderUtilsLiving.java @@ -67,17 +67,17 @@ public class RenderUtilsLiving { if (fill) { int opacity = (int) (MinecraftClient.getInstance().options.getTextBackgroundOpacity(0.25F) * 255.0F) << 24; - mc.textRenderer.draw(text, -halfWidth, 0f, 553648127, false, matrices.peek().getModel(), immediate, true, opacity, 0xf000f0); + mc.textRenderer.draw(text, -halfWidth, 0f, 553648127, false, matrices.peek().getPositionMatrix(), immediate, true, opacity, 0xf000f0); immediate.draw(); } else { matrices.push(); matrices.translate(1, 1, 0); - mc.textRenderer.draw(text.copy(), -halfWidth, 0f, 0x202020, false, matrices.peek().getModel(), immediate, true, 0, 0xf000f0); + mc.textRenderer.draw(text.copy(), -halfWidth, 0f, 0x202020, false, matrices.peek().getPositionMatrix(), immediate, true, 0, 0xf000f0); immediate.draw(); matrices.pop(); } - mc.textRenderer.draw(text, -halfWidth, 0f, -1, false, matrices.peek().getModel(), immediate, true, 0, 0xf000f0); + mc.textRenderer.draw(text, -halfWidth, 0f, -1, false, matrices.peek().getPositionMatrix(), immediate, true, 0, 0xf000f0); immediate.draw(); RenderSystem.disableBlend(); diff --git a/src/main/java/me/xmrvizzy/skyblocker/utils/Vertexer.java b/src/main/java/me/xmrvizzy/skyblocker/utils/Vertexer.java index f9ac629e..12f4b0fd 100644 --- a/src/main/java/me/xmrvizzy/skyblocker/utils/Vertexer.java +++ b/src/main/java/me/xmrvizzy/skyblocker/utils/Vertexer.java @@ -57,17 +57,17 @@ public class Vertexer { int[] color = quadColor.getAllColors(); if (cullMode != CULL_FRONT) { - vertexConsumer.vertex(matrices.peek().getModel(), x1, y1, z1).color(color[0], color[1], color[2], color[3]).next(); - vertexConsumer.vertex(matrices.peek().getModel(), x2, y2, z2).color(color[4], color[5], color[6], color[7]).next(); - vertexConsumer.vertex(matrices.peek().getModel(), x3, y3, z3).color(color[8], color[9], color[10], color[11]).next(); - vertexConsumer.vertex(matrices.peek().getModel(), x4, y4, z4).color(color[12], color[13], color[14], color[15]).next(); + vertexConsumer.vertex(matrices.peek().getPositionMatrix(), x1, y1, z1).color(color[0], color[1], color[2], color[3]).next(); + vertexConsumer.vertex(matrices.peek().getPositionMatrix(), x2, y2, z2).color(color[4], color[5], color[6], color[7]).next(); + vertexConsumer.vertex(matrices.peek().getPositionMatrix(), x3, y3, z3).color(color[8], color[9], color[10], color[11]).next(); + vertexConsumer.vertex(matrices.peek().getPositionMatrix(), x4, y4, z4).color(color[12], color[13], color[14], color[15]).next(); } if (cullMode != CULL_BACK) { - vertexConsumer.vertex(matrices.peek().getModel(), x4, y4, z4).color(color[0], color[1], color[2], color[3]).next(); - vertexConsumer.vertex(matrices.peek().getModel(), x3, y3, z3).color(color[4], color[5], color[6], color[7]).next(); - vertexConsumer.vertex(matrices.peek().getModel(), x2, y2, z2).color(color[8], color[9], color[10], color[11]).next(); - vertexConsumer.vertex(matrices.peek().getModel(), x1, y1, z1).color(color[12], color[13], color[14], color[15]).next(); + vertexConsumer.vertex(matrices.peek().getPositionMatrix(), x4, y4, z4).color(color[0], color[1], color[2], color[3]).next(); + vertexConsumer.vertex(matrices.peek().getPositionMatrix(), x3, y3, z3).color(color[4], color[5], color[6], color[7]).next(); + vertexConsumer.vertex(matrices.peek().getPositionMatrix(), x2, y2, z2).color(color[8], color[9], color[10], color[11]).next(); + vertexConsumer.vertex(matrices.peek().getPositionMatrix(), x1, y1, z1).color(color[12], color[13], color[14], color[15]).next(); } } @@ -132,8 +132,8 @@ public class Vertexer { } public static void vertexLine(MatrixStack matrices, VertexConsumer vertexConsumer, float x1, float y1, float z1, float x2, float y2, float z2, LineColor lineColor) { - Matrix4f model = matrices.peek().getModel(); - Matrix3f normal = matrices.peek().getNormal(); + Matrix4f model = matrices.peek().getPositionMatrix(); + Matrix3f normal = matrices.peek().getNormalMatrix(); Vec3f normalVec = getNormal(normal, x1, y1, z1, x2, y2, z2); diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 250e5737..09320692 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -29,8 +29,8 @@ "fabricloader": ">=0.12.11", "fabric": "*", "cloth-config2": "*", - "minecraft": "1.17.x", - "java": ">=16" + "minecraft": "1.18.x", + "java": ">=17" }, "custom": { "modmenu": { diff --git a/src/main/resources/skyblocker.mixins.json b/src/main/resources/skyblocker.mixins.json index bfc6b0f2..abc219fa 100644 --- a/src/main/resources/skyblocker.mixins.json +++ b/src/main/resources/skyblocker.mixins.json @@ -1,11 +1,10 @@ { "required": true, "package": "me.xmrvizzy.skyblocker.mixin", - "compatibilityLevel": "JAVA_16", + "compatibilityLevel": "JAVA_17", "client": [ "ChatHudListenerMixin", "ClientPlayerEntityMixin", - "ClientPlayNetworkHandlerMixin", "InGameHudMixin", "ItemRendererMixin", "MinecraftClientMixin", -- cgit From 286b6df579ad8290b19338dad5f10e78e578b3bb Mon Sep 17 00:00:00 2001 From: LifeIsAParadox Date: Tue, 25 Jan 2022 00:59:23 +0100 Subject: [skip ci] --- .github/workflows/buildrelease.yml | 92 ++++++++++++++++++++++++++++++++++++++ build.gradle | 5 ++- gradle.properties | 3 +- src/main/resources/fabric.mod.json | 5 +-- 4 files changed, 99 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/buildrelease.yml (limited to 'src/main/resources') diff --git a/.github/workflows/buildrelease.yml b/.github/workflows/buildrelease.yml new file mode 100644 index 00000000..b1fa84d8 --- /dev/null +++ b/.github/workflows/buildrelease.yml @@ -0,0 +1,92 @@ +# This is a basic workflow to help you get started with Actions + +name: Build Release + +# Controls when the action will run. Triggers the workflow on push or pull request +# events but only for the master branch +on: + release: + types: [created] + +jobs: + # This workflow contains a single job called "build" + build: + # The type of runner that the job will run on + runs-on: ubuntu-latest + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - uses: actions/checkout@v2 + - name: Set up JDK 17 + uses: actions/setup-java@v2 + with: + distribution: 'adopt' + java-version: '17' + + - name: Grant execute permission for gradlew + run: chmod +x gradlew + + - name: Build with Gradle + run: ./gradlew build + + - uses: actions/upload-artifact@v2 + with: + name: Artifacts + path: build/libs/ + + - name: Read Changelog + id: read_changelog + shell: bash + run: | + CHANGELOG=$(sed '/___/Q' CHANGELOG.md | grep -v '# ') + echo "Changelog:\n$CHANGELOG" + CHANGELOG="${CHANGELOG//'%'/'%25'}" + CHANGELOG="${CHANGELOG//$'\n'/'%0A'}" + CHANGELOG="${CHANGELOG//$'\r'/'%0D'}" + echo "::set-output name=changelog::$CHANGELOG" + + - uses: actions/github-script@v2 + id: fname + with: + result-encoding: string + script: | + const fs = require("fs") + return fs.readdirSync("build/libs/").filter(e => !e.endsWith("dev.jar") && !e.endsWith("sources.jar") && e.endsWith(".jar"))[0] + - name: Release + id: uploadrelease + uses: softprops/action-gh-release@v1 + with: + body: ${{ steps.read_changelog.outputs.changelog }} + files: build/libs/${{ steps.fname.outputs.result }} + + - name: Publish to Modrinth + id: modrinth + env: + MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }} + CHANGELOG: ${{ steps.read_changelog.outputs.changelog }} + run: ./gradlew publishModrinth + + - name: Get version tag + id: version_tag + run: | + [[ ! "$GITHUB_REF" =~ refs/tags ]] && exit + echo "::set-output name=value::${GITHUB_REF#refs/tags/}" + + - name: Discord notification + env: + DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} + uses: Ilshidur/action-discord@master + with: + args: | + "@here" + "Skyblocker ${{ steps.version_tag.outputs.value }}" + "" + "Changelog" + "```md" + "${{ steps.read_changelog.outputs.changelog }}" + "```" + ":inbox_tray: Download latest version on Modrinth or Github:" + "<:modrinth:900697862206287882> <${{ steps.modrinth.outputs.url }}>" + "<:github:900697885706952725> <${{ steps.uploadrelease.outputs.url }}>" + "" + "" \ No newline at end of file diff --git a/build.gradle b/build.gradle index fc535314..a05703ab 100644 --- a/build.gradle +++ b/build.gradle @@ -11,7 +11,7 @@ sourceCompatibility = JavaVersion.VERSION_17 targetCompatibility = JavaVersion.VERSION_17 archivesBaseName = project.archives_base_name -version = "${project.mod_version}+${project.minecraft_version}" +version = "${project.mod_version}+${project.suported_version}" group = project.maven_group repositories { @@ -103,8 +103,9 @@ task publishModrinth(type: TaskModrinthUpload) { token = System.getenv('MODRINTH_TOKEN') projectId = project.modrinth_id versionNumber = "v${project.version}" - versionName = "Skyblocker ${project.mod_version} (${project.minecraft_version})" + versionName = "Skyblocker ${project.mod_version} (${project.suported_version})" uploadFile = remapJar + addGameVersion('1.17.1') addGameVersion((String) project.minecraft_version) addLoader('fabric') versionType = VersionType.RELEASE diff --git a/gradle.properties b/gradle.properties index a9840524..3952ba70 100644 --- a/gradle.properties +++ b/gradle.properties @@ -18,4 +18,5 @@ mod_menu_version=3.0.0 mod_version = 1.4.3 maven_group = me.xmrvizzy archives_base_name = skyblocker -modrinth_id=y6DuFGwJ \ No newline at end of file +modrinth_id=y6DuFGwJ +suported_version=1.17.x-1.18.x \ No newline at end of file diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 09320692..8ef1482d 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -5,7 +5,7 @@ "name": "Skyblocker", "description": "Hypixel Skyblock Mod", "authors": ["xMrVizzy", "d3dx9", "LifeIsAParadox"], - "contributors": ["ExternalTime", "Zailer43"], + "contributors": ["ExternalTime", "Zailer43", "TacoMonkey"], "contact": { "homepage": "https://hysky.de", "sources": "https://github.com/LifeIsAParadox/Skyblocker", @@ -29,8 +29,7 @@ "fabricloader": ">=0.12.11", "fabric": "*", "cloth-config2": "*", - "minecraft": "1.18.x", - "java": ">=17" + "minecraft": ["1.18.x","1.17.x"] }, "custom": { "modmenu": { -- cgit From 555e91138895e98ee36426c11b8b75e6187573dd Mon Sep 17 00:00:00 2001 From: TacoMonkey <75862693+TacoMonkey11@users.noreply.github.com> Date: Sat, 22 Jan 2022 15:45:45 -0500 Subject: Added Wiki Lookup Added a keybind which, when pressed will open up the wiki page of the player's held item. --- .../xmrvizzy/skyblocker/SkyblockerInitializer.java | 2 + .../skyblocker/skyblock/item/WikiLookup.java | 70 ++++++++++++++++++++++ .../resources/assets/skyblocker/lang/en_us.json | 1 + 3 files changed, 73 insertions(+) create mode 100644 src/main/java/me/xmrvizzy/skyblocker/skyblock/item/WikiLookup.java (limited to 'src/main/resources') diff --git a/src/main/java/me/xmrvizzy/skyblocker/SkyblockerInitializer.java b/src/main/java/me/xmrvizzy/skyblocker/SkyblockerInitializer.java index b3a50697..93eac100 100644 --- a/src/main/java/me/xmrvizzy/skyblocker/SkyblockerInitializer.java +++ b/src/main/java/me/xmrvizzy/skyblocker/SkyblockerInitializer.java @@ -3,6 +3,7 @@ package me.xmrvizzy.skyblocker; import me.xmrvizzy.skyblocker.config.SkyblockerConfig; import me.xmrvizzy.skyblocker.skyblock.HotbarSlotLock; import me.xmrvizzy.skyblocker.skyblock.item.PriceInfoTooltip; +import me.xmrvizzy.skyblocker.skyblock.item.WikiLookup; import net.fabricmc.api.ClientModInitializer; public class SkyblockerInitializer implements ClientModInitializer { @@ -11,5 +12,6 @@ public class SkyblockerInitializer implements ClientModInitializer { HotbarSlotLock.init(); SkyblockerConfig.init(); PriceInfoTooltip.init(); + WikiLookup.init(); } } diff --git a/src/main/java/me/xmrvizzy/skyblocker/skyblock/item/WikiLookup.java b/src/main/java/me/xmrvizzy/skyblocker/skyblock/item/WikiLookup.java new file mode 100644 index 00000000..ea2faeb4 --- /dev/null +++ b/src/main/java/me/xmrvizzy/skyblocker/skyblock/item/WikiLookup.java @@ -0,0 +1,70 @@ +package me.xmrvizzy.skyblocker.skyblock.item; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; +import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents; +import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper; +import net.minecraft.client.MinecraftClient; +import net.minecraft.client.option.KeyBinding; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NbtCompound; +import net.minecraft.util.Util; +import org.lwjgl.glfw.GLFW; + +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.net.URL; +import java.net.URLConnection; + +public class WikiLookup { + public static KeyBinding wikiLookup; + static MinecraftClient client = MinecraftClient.getInstance(); + static String id; + public static Gson gson = new Gson(); + + public static void init(){ + wikiLookup = KeyBindingHelper.registerKeyBinding(new KeyBinding( + "key.wikiLookup", + GLFW.GLFW_KEY_Y, + "key.categories.skyblocker" + )); + ClientTickEvents.END_CLIENT_TICK.register(client -> { + while (wikiLookup.wasPressed()) { + id = getSkyblockId(); + + try { + //Setting up a connection with the repo + String urlString = "https://raw.githubusercontent.com/NotEnoughUpdates/NotEnoughUpdates-REPO/master/items/" + id + ".json"; + URL url = new URL(urlString); + URLConnection request = url.openConnection(); + request.connect(); + + //yoinking the wiki link + JsonElement root = JsonParser.parseReader(new InputStreamReader((InputStream) request.getContent())); + JsonObject rootobj = root.getAsJsonObject(); + String wikiLink = rootobj.get("info").getAsString(); + Util.getOperatingSystem().open(wikiLink); + } catch (IOException e) { + e.printStackTrace(); + } + + } + }); + } + + public static String getSkyblockId() { + + //Grabbing the skyblock NBT data + ItemStack mainHandStack = client.player.getMainHandStack(); + NbtCompound nbt = mainHandStack.getSubNbt("ExtraAttributes"); + if (nbt != null) { + id = nbt.getString("id"); + } + + return id; + } + +} diff --git a/src/main/resources/assets/skyblocker/lang/en_us.json b/src/main/resources/assets/skyblocker/lang/en_us.json index a1f0198e..680787e8 100644 --- a/src/main/resources/assets/skyblocker/lang/en_us.json +++ b/src/main/resources/assets/skyblocker/lang/en_us.json @@ -1,6 +1,7 @@ { "key.categories.skyblocker": "Skyblocker", "key.hotbarSlotLock": "Slot Lock (Hotbar)", + "key.wikiLookup": "Wiki Lookup", "text.autoconfig.skyblocker.title": "Skyblocker Settings", -- cgit From 7510d292ca8e9e32df8efb6c204f5ece9a00d23a Mon Sep 17 00:00:00 2001 From: TacoMonkey <75862693+TacoMonkey11@users.noreply.github.com> Date: Tue, 25 Jan 2022 16:31:16 -0500 Subject: Added rich presence and fishing ding --- build.gradle | 7 +- .../java/me/xmrvizzy/skyblocker/SkyblockerMod.java | 8 ++- .../skyblocker/config/SkyblockerConfig.java | 24 +++++++ .../skyblocker/mixin/SoundManagerMixin.java | 27 ++++++++ .../java/me/xmrvizzy/skyblocker/utils/Discord.java | 74 ++++++++++++++++++++++ .../java/me/xmrvizzy/skyblocker/utils/Utils.java | 49 ++++++++++++++ .../resources/assets/skyblocker/lang/en_us.json | 10 ++- src/main/resources/skyblocker.mixins.json | 9 +-- 8 files changed, 201 insertions(+), 7 deletions(-) create mode 100644 src/main/java/me/xmrvizzy/skyblocker/mixin/SoundManagerMixin.java create mode 100644 src/main/java/me/xmrvizzy/skyblocker/utils/Discord.java (limited to 'src/main/resources') diff --git a/build.gradle b/build.gradle index a05703ab..16fe78a9 100644 --- a/build.gradle +++ b/build.gradle @@ -29,6 +29,7 @@ repositories { url 'https://repo.maven.apache.org/maven2' name 'Maven Central' } + maven {url "https://jitpack.io"} } @@ -53,7 +54,11 @@ dependencies { // Fabric API. This is technically optional, but you probably want it anyway. modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" - + + modImplementation("com.github.thatgravyboat:DiscordIPC:d813b27") { + exclude module: 'log4j' + } + include "com.github.thatgravyboat:DiscordIPC:d813b27" // PSA: Some older mods, compiled on Loom 0.2.1, might have outdated Maven POMs. // You may need to force-disable transitiveness on them. } diff --git a/src/main/java/me/xmrvizzy/skyblocker/SkyblockerMod.java b/src/main/java/me/xmrvizzy/skyblocker/SkyblockerMod.java index 6c6a6d2a..fac4107a 100644 --- a/src/main/java/me/xmrvizzy/skyblocker/SkyblockerMod.java +++ b/src/main/java/me/xmrvizzy/skyblocker/SkyblockerMod.java @@ -1,7 +1,9 @@ package me.xmrvizzy.skyblocker; +import me.xmrvizzy.skyblocker.config.SkyblockerConfig; import me.xmrvizzy.skyblocker.container.ContainerSolverManager; import me.xmrvizzy.skyblocker.skyblock.dungeon.DungeonBlaze; +import me.xmrvizzy.skyblocker.utils.Discord; import me.xmrvizzy.skyblocker.utils.Utils; import net.minecraft.client.MinecraftClient; @@ -35,7 +37,11 @@ public class SkyblockerMod { if (ticks % 20 == 0) { if (client.world != null && !client.isInSingleplayer()) Utils.sbChecker(); - + Discord.update(); + if (Discord.connected){ + if (SkyblockerConfig.get().general.richPresence.enableRichPresence) Discord.updatePresence(Discord.getInfo(), SkyblockerConfig.get().general.richPresence.customMessage); + if (!SkyblockerConfig.get().general.richPresence.enableRichPresence || !Utils.isSkyblock || client.world == null) Discord.stop(); + } ticks = 0; } } diff --git a/src/main/java/me/xmrvizzy/skyblocker/config/SkyblockerConfig.java b/src/main/java/me/xmrvizzy/skyblocker/config/SkyblockerConfig.java index 74cff226..a424ea14 100644 --- a/src/main/java/me/xmrvizzy/skyblocker/config/SkyblockerConfig.java +++ b/src/main/java/me/xmrvizzy/skyblocker/config/SkyblockerConfig.java @@ -24,6 +24,10 @@ public class SkyblockerConfig implements ConfigData { @ConfigEntry.Gui.TransitiveObject public Messages messages = new Messages(); + @ConfigEntry.Category("fishing") + @ConfigEntry.Gui.TransitiveObject + public Fishing fishing = new Fishing(); + public static class General { public String apiKey; @@ -31,6 +35,10 @@ public class SkyblockerConfig implements ConfigData { @ConfigEntry.Gui.CollapsibleObject(startExpanded = true) public Bars bars = new Bars(); + @ConfigEntry.Category("RichPresence") + @ConfigEntry.Gui.CollapsibleObject() + public RichPresence richPresence = new RichPresence(); + @ConfigEntry.Gui.Excluded public List lockedSlots = new ArrayList<>(); } @@ -38,6 +46,13 @@ public class SkyblockerConfig implements ConfigData { public static class Bars { public boolean enableBars = true; } + public static class RichPresence { + @ConfigEntry.Gui.Tooltip() + public boolean enableRichPresence = true; + @ConfigEntry.Gui.EnumHandler(option = ConfigEntry.Gui.EnumHandler.EnumDisplayOption.BUTTON) + public Info info = Info.LOCATION; + public String customMessage; + } public static class Locations { @ConfigEntry.Category("dungeons") @@ -80,6 +95,15 @@ public class SkyblockerConfig implements ConfigData { public boolean hideAds = false; } + public static class Fishing { + public boolean enableFishingDing = false; + } + public enum Info { + PIGGY, + BITS, + LOCATION + } + public static void init() { AutoConfig.register(SkyblockerConfig.class, GsonConfigSerializer::new); } diff --git a/src/main/java/me/xmrvizzy/skyblocker/mixin/SoundManagerMixin.java b/src/main/java/me/xmrvizzy/skyblocker/mixin/SoundManagerMixin.java new file mode 100644 index 00000000..94380724 --- /dev/null +++ b/src/main/java/me/xmrvizzy/skyblocker/mixin/SoundManagerMixin.java @@ -0,0 +1,27 @@ +package me.xmrvizzy.skyblocker.mixin; + + +import me.xmrvizzy.skyblocker.config.SkyblockerConfig; +import net.minecraft.client.MinecraftClient; +import net.minecraft.client.sound.SoundInstance; +import net.minecraft.client.sound.SoundManager; +import net.minecraft.sound.SoundEvents; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +@Mixin(SoundManager.class) +public class SoundManagerMixin { + + private MinecraftClient client = MinecraftClient.getInstance(); + + @Inject(at = @At("HEAD"), method = "play(Lnet/minecraft/client/sound/SoundInstance;)V") + private void play(SoundInstance sound, CallbackInfo ci) { + if (sound.getId().toString().equals("minecraft:entity.player.splash")){ + if (client.player.fishHook != null) + if (client.player.fishHook.isInOpenWater() && sound.getX() != client.player.getX() && sound.getY() != client.player.getY() && sound.getZ() != client.player.getZ() && SkyblockerConfig.get().fishing.enableFishingDing) + client.player.playSound(SoundEvents.ENTITY_ARROW_HIT_PLAYER, 1, 1); + } + } +} diff --git a/src/main/java/me/xmrvizzy/skyblocker/utils/Discord.java b/src/main/java/me/xmrvizzy/skyblocker/utils/Discord.java new file mode 100644 index 00000000..e04f2bdd --- /dev/null +++ b/src/main/java/me/xmrvizzy/skyblocker/utils/Discord.java @@ -0,0 +1,74 @@ +package me.xmrvizzy.skyblocker.utils; + +import com.jagrosh.discordipc.IPCClient; +import com.jagrosh.discordipc.IPCListener; +import com.jagrosh.discordipc.entities.RichPresence; +import com.jagrosh.discordipc.entities.RichPresenceButton; +import me.xmrvizzy.skyblocker.SkyblockerMod; +import me.xmrvizzy.skyblocker.config.SkyblockerConfig; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.text.DecimalFormat; + + +public class Discord { + public static Logger logger = LoggerFactory.getLogger(SkyblockerMod.NAMESPACE); + public static IPCClient ipcClient = new IPCClient(934607927837356052L); + public static boolean connected = false; + public static boolean warned = false; + public static DecimalFormat dFormat = new DecimalFormat("###,###.##"); + + + public static void updatePresence(String state, String details){ + logger.debug("updatePresence"); + RichPresence.Builder builder = new RichPresence.Builder(); + RichPresenceButton[] button = new RichPresenceButton[0]; + builder.setState(state) + .setDetails(details) + .setButtons(button) + .setLargeImage("skyblocker-default"); + ipcClient.sendRichPresence(builder.build()); + } + + public static String getInfo(){ + String info = null; + if (SkyblockerConfig.get().general.richPresence.info == SkyblockerConfig.Info.BITS) info = "Bits: " + Utils.getBits(); + if (SkyblockerConfig.get().general.richPresence.info == SkyblockerConfig.Info.PIGGY) info = "Purse: " + dFormat.format(Utils.getPurse()); + if (SkyblockerConfig.get().general.richPresence.info == SkyblockerConfig.Info.LOCATION) info = "⏣ " + Utils.getLocation(); + return info; + } + + public static void stop(){ + ipcClient.close(); + ipcClient = null; + connected = false; + } + + public static void update(){ + if (Utils.isSkyblock && SkyblockerConfig.get().general.richPresence.enableRichPresence){ + + if (!connected){ + try { + ipcClient = new IPCClient(934607927837356052L); + ipcClient.connect(); + connected = true; + + } catch (Exception e) { + if (!warned){ + if (e.getLocalizedMessage().equals("java.net.SocketException: Connection refused")) + logger.warn("Discord client not running"); + warned = true; + } + } + } + + ipcClient.setListener(new IPCListener() { + @Override + public void onDisconnect(IPCClient client, Throwable t) { + IPCListener.super.onDisconnect(client, t); + connected = false; + } + }); + } +}} diff --git a/src/main/java/me/xmrvizzy/skyblocker/utils/Utils.java b/src/main/java/me/xmrvizzy/skyblocker/utils/Utils.java index 87e5c846..93a28993 100644 --- a/src/main/java/me/xmrvizzy/skyblocker/utils/Utils.java +++ b/src/main/java/me/xmrvizzy/skyblocker/utils/Utils.java @@ -2,6 +2,7 @@ package me.xmrvizzy.skyblocker.utils; import com.google.common.collect.Iterables; import com.google.common.collect.Lists; +import me.xmrvizzy.skyblocker.config.SkyblockerConfig; import me.xmrvizzy.skyblocker.skyblock.item.PriceInfoTooltip; import net.fabricmc.fabric.api.client.item.v1.ItemTooltipCallback; import net.minecraft.client.MinecraftClient; @@ -33,6 +34,7 @@ public class Utils { ItemTooltipCallback.EVENT.register(PriceInfoTooltip::onInjectTooltip); } isSkyblock = true; + } else isSkyblock = false; @@ -44,6 +46,53 @@ public class Utils { } } + public static String getLocation() { + String location = null; + List sidebarLines = getSidebar(); + try{ + for (int i = 0; i < sidebarLines.size(); i++) { + if(sidebarLines.get(i).contains("⏣")) location = sidebarLines.get(i); + } + location = location.replace('⏣', ' ').strip(); + } catch (IndexOutOfBoundsException e) { + e.printStackTrace(); + } + return location; + } + public static double getPurse() { + String purseString = null; + double purse = 0; + + List sidebarLines = getSidebar(); + try{ + for (int i = 0; i < sidebarLines.size(); i++) { + if(sidebarLines.get(i).contains("Piggy:")) purseString = sidebarLines.get(i); + if(sidebarLines.get(i).contains("Purse:")) purseString = sidebarLines.get(i); + } + if (purseString != null) purse = Double.parseDouble(purseString.replaceAll("[^0-9.]", "").strip()); + else purse = 0; + + } catch (IndexOutOfBoundsException e) { + e.printStackTrace(); + } + return purse; + } + public static int getBits() { + int bits = 0; + String bitsString = null; + List sidebarLines = getSidebar(); + try{ + for (int i = 0; i < sidebarLines.size(); i++) { + if(sidebarLines.get(i).contains("Bits")) bitsString = sidebarLines.get(i); + } + bits = Integer.parseInt(bitsString.replaceAll("Bits:", "").strip()); + } catch (IndexOutOfBoundsException e) { + e.printStackTrace(); + } + return bits; + } + + public static List getSidebar() { List lines = new ArrayList<>(); MinecraftClient client = MinecraftClient.getInstance(); diff --git a/src/main/resources/assets/skyblocker/lang/en_us.json b/src/main/resources/assets/skyblocker/lang/en_us.json index 680787e8..0ad63665 100644 --- a/src/main/resources/assets/skyblocker/lang/en_us.json +++ b/src/main/resources/assets/skyblocker/lang/en_us.json @@ -9,6 +9,11 @@ "text.autoconfig.skyblocker.option.general.apiKey": "Hypixel API Key (WIP)", "text.autoconfig.skyblocker.option.general.bars": "Health, Mana, Defence & XP Bars", "text.autoconfig.skyblocker.option.general.bars.enableBars": "Enable Bars", + "text.autoconfig.skyblocker.option.general.richPresence": "Discord Rich Presence", + "text.autoconfig.skyblocker.option.general.richPresence.info": "Skyblock Info", + "text.autoconfig.skyblocker.option.general.richPresence.enableRichPresence": "Enabled", + "text.autoconfig.skyblocker.option.general.richPresence.customMessage": "Custom Message", + "text.autoconfig.skyblocker.category.locations": "Locations", "text.autoconfig.skyblocker.option.locations.dungeons": "Dungeons", @@ -32,5 +37,8 @@ "text.autoconfig.skyblocker.option.messages.hideAOTE": "Hide AOTE Messages", "text.autoconfig.skyblocker.option.messages.hideImplosion": "Hide Implosion Message", "text.autoconfig.skyblocker.option.messages.hideMoltenWave": "Hide Molten Wave Message", - "text.autoconfig.skyblocker.option.messages.hideAds": "Hide Ads From Public Chat" + "text.autoconfig.skyblocker.option.messages.hideAds": "Hide Ads From Public Chat", + + "text.autoconfig.skyblocker.category.fishing": "Fishing", + "text.autoconfig.skyblocker.option.fishing.enableFishingDing": "Enable Fishing Ding" } \ No newline at end of file diff --git a/src/main/resources/skyblocker.mixins.json b/src/main/resources/skyblocker.mixins.json index abc219fa..7fd36007 100644 --- a/src/main/resources/skyblocker.mixins.json +++ b/src/main/resources/skyblocker.mixins.json @@ -3,15 +3,16 @@ "package": "me.xmrvizzy.skyblocker.mixin", "compatibilityLevel": "JAVA_17", "client": [ + "AccessorWorldRenderer", "ChatHudListenerMixin", "ClientPlayerEntityMixin", + "GenericContainerScreenHandlerMixin", + "GenericContainerScreenMixin", "InGameHudMixin", "ItemRendererMixin", + "LeverBlockMixin", "MinecraftClientMixin", - "AccessorWorldRenderer", - "GenericContainerScreenMixin", - "GenericContainerScreenHandlerMixin", - "LeverBlockMixin" + "SoundManagerMixin" ], "injectors": { "defaultRequire": 1 -- cgit From 71a3d9c23a89753b77e53548250600211f6bcf64 Mon Sep 17 00:00:00 2001 From: TacoMonkey <75862693+TacoMonkey11@users.noreply.github.com> Date: Tue, 25 Jan 2022 19:36:10 -0500 Subject: Bikeshedded fishing ding --- FEATURES.md | 3 +-- .../skyblocker/config/SkyblockerConfig.java | 8 ------- .../mixin/ClientPlayNetworkHandlerMixin.java | 3 ++- .../skyblocker/mixin/SoundManagerMixin.java | 27 ---------------------- .../java/me/xmrvizzy/skyblocker/utils/Utils.java | 1 + src/main/resources/skyblocker.mixins.json | 2 +- 6 files changed, 5 insertions(+), 39 deletions(-) delete mode 100644 src/main/java/me/xmrvizzy/skyblocker/mixin/SoundManagerMixin.java (limited to 'src/main/resources') diff --git a/FEATURES.md b/FEATURES.md index 827cff7b..9a86591e 100644 --- a/FEATURES.md +++ b/FEATURES.md @@ -11,5 +11,4 @@ * price tooltip: npc, bazaar (avg, lbin), ah, museum * reparty: write /rp to reparty * Wiki Lookup: press f4 to open the wiki page about the held item -* Discord Rich Presence: Allows user to show either their Piggy, Bits, or location. Along with a custom message -* Fishing Ding: Plays a ding sound when you catch a fish, which can more easily notify the player \ No newline at end of file +* Discord Rich Presence: Allows user to show either their Piggy, Bits, or location. Along with a custom message \ No newline at end of file diff --git a/src/main/java/me/xmrvizzy/skyblocker/config/SkyblockerConfig.java b/src/main/java/me/xmrvizzy/skyblocker/config/SkyblockerConfig.java index 0b5a17e4..6d5e0a02 100644 --- a/src/main/java/me/xmrvizzy/skyblocker/config/SkyblockerConfig.java +++ b/src/main/java/me/xmrvizzy/skyblocker/config/SkyblockerConfig.java @@ -24,10 +24,6 @@ public class SkyblockerConfig implements ConfigData { @ConfigEntry.Gui.TransitiveObject public Messages messages = new Messages(); - @ConfigEntry.Category("fishing") - @ConfigEntry.Gui.TransitiveObject - public Fishing fishing = new Fishing(); - public static class General { public String apiKey; @@ -94,10 +90,6 @@ public class SkyblockerConfig implements ConfigData { public boolean hideMoltenWave = false; public boolean hideAds = false; } - - public static class Fishing { - public boolean enableFishingDing = false; - } public enum Info { PURSE, BITS, diff --git a/src/main/java/me/xmrvizzy/skyblocker/mixin/ClientPlayNetworkHandlerMixin.java b/src/main/java/me/xmrvizzy/skyblocker/mixin/ClientPlayNetworkHandlerMixin.java index 26012b21..ef900eef 100644 --- a/src/main/java/me/xmrvizzy/skyblocker/mixin/ClientPlayNetworkHandlerMixin.java +++ b/src/main/java/me/xmrvizzy/skyblocker/mixin/ClientPlayNetworkHandlerMixin.java @@ -5,6 +5,7 @@ import com.mojang.brigadier.CommandDispatcher; import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.network.ClientPlayNetworkHandler; +import net.minecraft.client.util.telemetry.TelemetrySender; import net.minecraft.command.CommandSource; import net.minecraft.network.ClientConnection; import net.minecraft.network.packet.s2c.play.CommandTreeS2CPacket; @@ -22,7 +23,7 @@ public class ClientPlayNetworkHandlerMixin { @Shadow private CommandDispatcher commandDispatcher; @Inject(method = "", at = @At("RETURN")) - private void init(MinecraftClient client, Screen screen, ClientConnection connection, GameProfile profile, CallbackInfo ci) { + private void init(MinecraftClient client, Screen screen, ClientConnection connection, GameProfile profile, TelemetrySender telemetrySender, CallbackInfo ci) { commandDispatcher.register(literal("skb")); } diff --git a/src/main/java/me/xmrvizzy/skyblocker/mixin/SoundManagerMixin.java b/src/main/java/me/xmrvizzy/skyblocker/mixin/SoundManagerMixin.java deleted file mode 100644 index 94380724..00000000 --- a/src/main/java/me/xmrvizzy/skyblocker/mixin/SoundManagerMixin.java +++ /dev/null @@ -1,27 +0,0 @@ -package me.xmrvizzy.skyblocker.mixin; - - -import me.xmrvizzy.skyblocker.config.SkyblockerConfig; -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.sound.SoundInstance; -import net.minecraft.client.sound.SoundManager; -import net.minecraft.sound.SoundEvents; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; - -@Mixin(SoundManager.class) -public class SoundManagerMixin { - - private MinecraftClient client = MinecraftClient.getInstance(); - - @Inject(at = @At("HEAD"), method = "play(Lnet/minecraft/client/sound/SoundInstance;)V") - private void play(SoundInstance sound, CallbackInfo ci) { - if (sound.getId().toString().equals("minecraft:entity.player.splash")){ - if (client.player.fishHook != null) - if (client.player.fishHook.isInOpenWater() && sound.getX() != client.player.getX() && sound.getY() != client.player.getY() && sound.getZ() != client.player.getZ() && SkyblockerConfig.get().fishing.enableFishingDing) - client.player.playSound(SoundEvents.ENTITY_ARROW_HIT_PLAYER, 1, 1); - } - } -} diff --git a/src/main/java/me/xmrvizzy/skyblocker/utils/Utils.java b/src/main/java/me/xmrvizzy/skyblocker/utils/Utils.java index 93a28993..d790755d 100644 --- a/src/main/java/me/xmrvizzy/skyblocker/utils/Utils.java +++ b/src/main/java/me/xmrvizzy/skyblocker/utils/Utils.java @@ -53,6 +53,7 @@ public class Utils { for (int i = 0; i < sidebarLines.size(); i++) { if(sidebarLines.get(i).contains("⏣")) location = sidebarLines.get(i); } + if (location == null) location = "Unknown"; location = location.replace('⏣', ' ').strip(); } catch (IndexOutOfBoundsException e) { e.printStackTrace(); diff --git a/src/main/resources/skyblocker.mixins.json b/src/main/resources/skyblocker.mixins.json index 1c37565f..50b69254 100644 --- a/src/main/resources/skyblocker.mixins.json +++ b/src/main/resources/skyblocker.mixins.json @@ -12,7 +12,7 @@ "LeverBlockMixin", "GenericContainerScreenMixin", "GenericContainerScreenHandlerMixin", - "SoundManagerMixin" + "ClientPlayNetworkHandlerMixin" ], "injectors": { "defaultRequire": 1 -- cgit From 9a7ff8402cab3367a3bb39a203cffdd3fb912ba1 Mon Sep 17 00:00:00 2001 From: TacoMonkey <75862693+TacoMonkey11@users.noreply.github.com> Date: Thu, 27 Jan 2022 14:42:04 -0500 Subject: Rewrote the presence to actually work --- build.gradle | 11 ++-- .../java/me/xmrvizzy/skyblocker/SkyblockerMod.java | 17 +++-- .../skyblocker/discord/DiscordRPCManager.java | 67 ++++++++++++++++++++ .../java/me/xmrvizzy/skyblocker/utils/Discord.java | 74 ---------------------- .../java/me/xmrvizzy/skyblocker/utils/Utils.java | 1 - src/main/resources/skyblocker.mixins.json | 10 +-- 6 files changed, 90 insertions(+), 90 deletions(-) create mode 100644 src/main/java/me/xmrvizzy/skyblocker/discord/DiscordRPCManager.java delete mode 100644 src/main/java/me/xmrvizzy/skyblocker/utils/Discord.java (limited to 'src/main/resources') diff --git a/build.gradle b/build.gradle index 16fe78a9..74e9e7a5 100644 --- a/build.gradle +++ b/build.gradle @@ -30,6 +30,7 @@ repositories { name 'Maven Central' } maven {url "https://jitpack.io"} + maven {url "https://maven.jaackson.me/repo"} } @@ -55,12 +56,14 @@ dependencies { // Fabric API. This is technically optional, but you probably want it anyway. modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" - modImplementation("com.github.thatgravyboat:DiscordIPC:d813b27") { - exclude module: 'log4j' - } - include "com.github.thatgravyboat:DiscordIPC:d813b27" // 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 ("com.jagrosh:DiscordIPC:0.5"){ + exclude module: "slf4j-api" + } + include "com.jagrosh:DiscordIPC:0.5" + include(modImplementation("com.kohlschutter.junixsocket:junixsocket-common:2.0.4")) + include(modImplementation("com.kohlschutter.junixsocket:junixsocket-native-common:2.0.4")) } processResources { diff --git a/src/main/java/me/xmrvizzy/skyblocker/SkyblockerMod.java b/src/main/java/me/xmrvizzy/skyblocker/SkyblockerMod.java index fac4107a..ceb55549 100644 --- a/src/main/java/me/xmrvizzy/skyblocker/SkyblockerMod.java +++ b/src/main/java/me/xmrvizzy/skyblocker/SkyblockerMod.java @@ -2,8 +2,8 @@ package me.xmrvizzy.skyblocker; import me.xmrvizzy.skyblocker.config.SkyblockerConfig; import me.xmrvizzy.skyblocker.container.ContainerSolverManager; +import me.xmrvizzy.skyblocker.discord.DiscordRPCManager; import me.xmrvizzy.skyblocker.skyblock.dungeon.DungeonBlaze; -import me.xmrvizzy.skyblocker.utils.Discord; import me.xmrvizzy.skyblocker.utils.Utils; import net.minecraft.client.MinecraftClient; @@ -11,6 +11,8 @@ public class SkyblockerMod { public static final String NAMESPACE = "skyblocker"; private static final SkyblockerMod instance = new SkyblockerMod(); public final ContainerSolverManager containerSolverManager = new ContainerSolverManager(); + public DiscordRPCManager discordRPCManager = new DiscordRPCManager(); + public static int rpTimer = 0; private SkyblockerMod() { } @@ -35,13 +37,16 @@ public class SkyblockerMod { //System.out.println("Blazesolver: " + e); } if (ticks % 20 == 0) { + rpTimer++; + if (rpTimer == 5){ + discordRPCManager.updatePresence(); + rpTimer = 0; + } if (client.world != null && !client.isInSingleplayer()) Utils.sbChecker(); - Discord.update(); - if (Discord.connected){ - if (SkyblockerConfig.get().general.richPresence.enableRichPresence) Discord.updatePresence(Discord.getInfo(), SkyblockerConfig.get().general.richPresence.customMessage); - if (!SkyblockerConfig.get().general.richPresence.enableRichPresence || !Utils.isSkyblock || client.world == null) Discord.stop(); - } + if (!discordRPCManager.isConnected && Utils.isSkyblock && SkyblockerConfig.get().general.richPresence.enableRichPresence) discordRPCManager.start(); + if (discordRPCManager.isConnected && !SkyblockerConfig.get().general.richPresence.enableRichPresence) discordRPCManager.stop(); + if (client.world == null || client.isInSingleplayer() || !Utils.isSkyblock) if (discordRPCManager.isConnected)discordRPCManager.stop(); ticks = 0; } } diff --git a/src/main/java/me/xmrvizzy/skyblocker/discord/DiscordRPCManager.java b/src/main/java/me/xmrvizzy/skyblocker/discord/DiscordRPCManager.java new file mode 100644 index 00000000..fc151371 --- /dev/null +++ b/src/main/java/me/xmrvizzy/skyblocker/discord/DiscordRPCManager.java @@ -0,0 +1,67 @@ +package me.xmrvizzy.skyblocker.discord; + +import com.jagrosh.discordipc.IPCClient; +import com.jagrosh.discordipc.IPCListener; +import com.jagrosh.discordipc.entities.RichPresence; +import me.xmrvizzy.skyblocker.config.SkyblockerConfig; +import me.xmrvizzy.skyblocker.utils.Utils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.text.DecimalFormat; +import java.time.OffsetDateTime; + +public class DiscordRPCManager implements IPCListener{ + public static long startTimestamp; + public static IPCClient client; + public boolean isConnected; + public static final Logger logger = LoggerFactory.getLogger("Skyblocker DiscordRPC"); + public static DecimalFormat dFormat = new DecimalFormat("###,###.##"); + + public void start(){ + try { + logger.info("Starting..."); + startTimestamp = OffsetDateTime.now().toEpochSecond(); + client = new IPCClient(934607927837356052L); + client.setListener(this); + try { + client.connect(); + } catch (Exception e) { + logger.warn("Failed to connect: " + e.getMessage()); + } + } catch (Throwable ex) { + logger.error("unexpected error occurred while trying to start..."); + ex.printStackTrace(); + } + } + + public void updatePresence(){ + RichPresence presence = new RichPresence.Builder() + .setState(SkyblockerConfig.get().general.richPresence.customMessage) + .setDetails(getInfo()) + .setStartTimestamp(startTimestamp) + .setLargeImage("skyblocker-default") + .build(); + if (client != null && isConnected) client.sendRichPresence(presence); + } + + public String getInfo(){ + String info = null; + if (SkyblockerConfig.get().general.richPresence.info == SkyblockerConfig.Info.BITS) info = "Bits: " + Utils.getBits(); + if (SkyblockerConfig.get().general.richPresence.info == SkyblockerConfig.Info.PURSE) info = "Purse: " + dFormat.format(Utils.getPurse()); + if (SkyblockerConfig.get().general.richPresence.info == SkyblockerConfig.Info.LOCATION) info = "⏣ " + Utils.getLocation(); + return info; + } + + public void stop(){ + isConnected = false; + client.close(); + client = null; + } + + @Override + public void onReady(IPCClient client) { + logger.info("Started!"); + isConnected = true; + } +} diff --git a/src/main/java/me/xmrvizzy/skyblocker/utils/Discord.java b/src/main/java/me/xmrvizzy/skyblocker/utils/Discord.java deleted file mode 100644 index 73ade9aa..00000000 --- a/src/main/java/me/xmrvizzy/skyblocker/utils/Discord.java +++ /dev/null @@ -1,74 +0,0 @@ -package me.xmrvizzy.skyblocker.utils; - -import com.jagrosh.discordipc.IPCClient; -import com.jagrosh.discordipc.IPCListener; -import com.jagrosh.discordipc.entities.RichPresence; -import com.jagrosh.discordipc.entities.RichPresenceButton; -import me.xmrvizzy.skyblocker.SkyblockerMod; -import me.xmrvizzy.skyblocker.config.SkyblockerConfig; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.text.DecimalFormat; - - -public class Discord { - public static Logger logger = LoggerFactory.getLogger(SkyblockerMod.NAMESPACE); - public static IPCClient ipcClient = new IPCClient(934607927837356052L); - public static boolean connected = false; - public static boolean warned = false; - public static DecimalFormat dFormat = new DecimalFormat("###,###.##"); - - - public static void updatePresence(String state, String details){ - logger.debug("updatePresence"); - RichPresence.Builder builder = new RichPresence.Builder(); - RichPresenceButton[] button = new RichPresenceButton[0]; - builder.setState(state) - .setDetails(details) - .setButtons(button) - .setLargeImage("skyblocker-default"); - ipcClient.sendRichPresence(builder.build()); - } - - public static String getInfo(){ - String info = null; - if (SkyblockerConfig.get().general.richPresence.info == SkyblockerConfig.Info.BITS) info = "Bits: " + Utils.getBits(); - if (SkyblockerConfig.get().general.richPresence.info == SkyblockerConfig.Info.PURSE) info = "Purse: " + dFormat.format(Utils.getPurse()); - if (SkyblockerConfig.get().general.richPresence.info == SkyblockerConfig.Info.LOCATION) info = "⏣ " + Utils.getLocation(); - return info; - } - - public static void stop(){ - ipcClient.close(); - ipcClient = null; - connected = false; - } - - public static void update(){ - if (Utils.isSkyblock && SkyblockerConfig.get().general.richPresence.enableRichPresence){ - - if (!connected){ - try { - ipcClient = new IPCClient(934607927837356052L); - ipcClient.connect(); - connected = true; - - } catch (Exception e) { - if (!warned){ - if (e.getLocalizedMessage().equals("java.net.SocketException: Connection refused")) - logger.warn("Discord client not running"); - warned = true; - } - } - } - - ipcClient.setListener(new IPCListener() { - @Override - public void onDisconnect(IPCClient client, Throwable t) { - IPCListener.super.onDisconnect(client, t); - connected = false; - } - }); - } -}} diff --git a/src/main/java/me/xmrvizzy/skyblocker/utils/Utils.java b/src/main/java/me/xmrvizzy/skyblocker/utils/Utils.java index d790755d..8f299ac5 100644 --- a/src/main/java/me/xmrvizzy/skyblocker/utils/Utils.java +++ b/src/main/java/me/xmrvizzy/skyblocker/utils/Utils.java @@ -2,7 +2,6 @@ package me.xmrvizzy.skyblocker.utils; import com.google.common.collect.Iterables; import com.google.common.collect.Lists; -import me.xmrvizzy.skyblocker.config.SkyblockerConfig; import me.xmrvizzy.skyblocker.skyblock.item.PriceInfoTooltip; import net.fabricmc.fabric.api.client.item.v1.ItemTooltipCallback; import net.minecraft.client.MinecraftClient; diff --git a/src/main/resources/skyblocker.mixins.json b/src/main/resources/skyblocker.mixins.json index 50b69254..318f9708 100644 --- a/src/main/resources/skyblocker.mixins.json +++ b/src/main/resources/skyblocker.mixins.json @@ -3,16 +3,16 @@ "package": "me.xmrvizzy.skyblocker.mixin", "compatibilityLevel": "JAVA_17", "client": [ + "AccessorWorldRenderer", "ChatHudListenerMixin", "ClientPlayerEntityMixin", + "ClientPlayNetworkHandlerMixin", + "GenericContainerScreenHandlerMixin", + "GenericContainerScreenMixin", "InGameHudMixin", "ItemRendererMixin", - "MinecraftClientMixin", - "AccessorWorldRenderer", "LeverBlockMixin", - "GenericContainerScreenMixin", - "GenericContainerScreenHandlerMixin", - "ClientPlayNetworkHandlerMixin" + "MinecraftClientMixin" ], "injectors": { "defaultRequire": 1 -- cgit