diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..eeb4e40 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,32 @@ +name: build +on: [push] + +jobs: + build: + strategy: + matrix: + java: [17] + os: [ubuntu-22.04] + runs-on: ${{ matrix.os }} + steps: + - name: checkout repository + uses: actions/checkout@v3 + - name: validate gradle wrapper + uses: gradle/wrapper-validation-action@v1 + - name: setup jdk ${{ matrix.java }} + uses: actions/setup-java@v3 + with: + java-version: ${{ matrix.java }} + distribution: 'temurin' + - name: make gradle wrapper executable + run: chmod +x ./gradlew + - name: build + run: ./gradlew build + - name: upload build artifacts + if: ${{ matrix.java == '17' }} + uses: actions/upload-artifact@v3 + with: + name: NoReportButtonBuild + path: | + fabric/build/libs + forge/build/libs \ No newline at end of file diff --git a/README.md b/README.md index 47c7428..0b2bed7 100644 --- a/README.md +++ b/README.md @@ -1,20 +1,26 @@ -[![Mod Loader](https://img.shields.io/badge/Mod%20Loader-Fabric-lightyellow?logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAACXBIWXMAAAsTAAALEwEAmpwYAAAFHGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNS42LWMxNDIgNzkuMTYwOTI0LCAyMDE3LzA3LzEzLTAxOjA2OjM5ICAgICAgICAiPiA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPiA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtbG5z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00OTVkNGYxNGM3NjAiIHN0RXZ0OndoZW49IjIwMTgtMTItMTZUMTY6NTQ6MTctMDg6MDAiIHN0RXZ0OnNvZnR3YXJlQWdlbnQ9IkFkb2JlIFBob3Rvc2hvcCBDQyAyMDE4IChXaW5kb3dzKSIvPiA8L3JkZjpTZXE+IDwveG1wTU06SGlzdG9yeT4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz4/HiGMAAAAtUlEQVRYw+XXrQqAMBQF4D2P2eBL+QIG8RnEJFaNBjEum+0+zMQLtwwv+wV3ZzhhMDgfJ0wUSinxZUQWgKos1JP/AbD4OneIDyQPwCFniA+EJ4CaXm4TxAXCC0BNHgLhAdAnx9hC8PwGSRtAFVMQjF7cNTWED8B1cgwW20yfJgAvrssAsZ1cB3g/xckAxr6FmCDU5N6f488BrpCQ4rQBJkiMYh4ACmLzwOQF0CExinkCsvw7vgGikl+OotaKRwAAAABJRU5ErkJggg==)](https://fabricmc.net) [![curseforge-downloads](https://cf.way2muchnoise.eu/full_658722_downloads.svg)](https://www.curseforge.com/minecraft/mc-mods/no-report-button) [![modrinth-downloads](https://modrinth-utils.vercel.app/api/badge/downloads?id=9WJeSpTH&logo=true)](https://modrinth.com/mod/nrb) # No Report Button Removes the chat report button from the game menu screen -Supports fabric 1.19.3+, forge support is coming soon!\ -The fabric api is not required. +Supports fabric, forge and quilt 1.19.1+\ +Should be compatible with any mods, but if you do find a mod that is not please open an issue. -For minecraft versions 1.19.2 or older use NRB v1.2.1, the latest version only supports 1.19.3+. +**Fabric API not required.**\ +**Mod is client size only, this mod will not do anything if used on the server.** -## Supported Version -| Version | MC Version | Branch | -|---------|---------------|-----------| -| 1.2.1 | 1.19.1-1.19.2 | mc-1.19.1 | -| 1.3.1 | 1.19.3+ | mc-1.19.3 | +For Minecraft versions 1.19.1 and 1.19.2 use NRB v1.2.1, the latest version only supports 1.19.3+. + +## Released Versions +| Version | MC Version | Mod loaders | Git tag | Supported | +|---------|---------------|----------------------|---------------------------------------------------------------------------|-----------| +| 1.4.0 | 1.19.3 | fabric, forge, quilt | [1.4.0](https://github.com/Lucaslah/No-Report-Button/releases/tag/v1.4.0) | yes | +| 1.3.1 | 1.19.3 | fabric | [1.3.1](https://github.com/Lucaslah/No-Report-Button/releases/tag/v1.3.1) | no | +| 1.3.0 | 1.19.3 | fabric | [1.3.0](https://github.com/Lucaslah/No-Report-Button/releases/tag/v1.3.0) | no | +| 1.2.1 | 1.19.1-1.19.2 | fabric | [1.2.1](https://github.com/Lucaslah/No-Report-Button/releases/tag/v1.2.1) | yes | +| 1.2.0 | 1.19.1-1.19.2 | fabric | [1.2.0](https://github.com/Lucaslah/No-Report-Button/releases/tag/v1.2.0) | no | +| 1.1.0 | 1.19.1-1.19.2 | fabric | [1.1.0](https://github.com/Lucaslah/No-Report-Button/releases/tag/v1.1.0) | no | ## Links -Curseforge: https://www.curseforge.com/minecraft/mc-mods/no-report-button
+Curseforge: https://www.curseforge.com/minecraft/mc-mods/no-report-button
Modrinth: https://modrinth.com/mod/nrb diff --git a/SECURITY.md b/SECURITY.md index ebee2fa..779a2ec 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -3,11 +3,12 @@ ## Supported Versions | Version | Supported | -| ------- | ------------------ | -| 1.3.1 | :white_check_mark: | +|---------|--------------------| +| 1.4.0 | :white_check_mark: | +| 1.3.1 | :x: | | 1.3.0 | :x: | | 1.2.1 | :white_check_mark: | -| < 1.2.1 | :x: | +| < 1.2.1 | :x: | ## Reporting a Vulnerability diff --git a/build.gradle b/build.gradle index 45c20cf..d06c5b1 100644 --- a/build.gradle +++ b/build.gradle @@ -1,56 +1,41 @@ plugins { - id 'fabric-loom' version '0.12-SNAPSHOT' - id 'maven-publish' + id "architectury-plugin" version "3.4-SNAPSHOT" + id "dev.architectury.loom" version "1.0-SNAPSHOT" apply false } -sourceCompatibility = JavaVersion.VERSION_17 -targetCompatibility = JavaVersion.VERSION_17 - -archivesBaseName = project.archives_base_name -version = project.mod_version -group = project.maven_group - -repositories {} - -configurations { - includeModImplementation - includeImplementation - - include.extendsFrom includeImplementation - include.extendsFrom includeModImplementation - - implementation.extendsFrom includeImplementation - modImplementation.extendsFrom includeModImplementation +architectury { + injectInjectables = false + minecraft = rootProject.properties["minecraft_version"] } -dependencies { - // To change the versions see the gradle.properties file - minecraft "com.mojang:minecraft:${project.minecraft_version}" - mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" - modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" +subprojects { + apply plugin: "dev.architectury.loom" - includeModImplementation fabricApi.module("fabric-api-base", project.fabric_version) - includeModImplementation fabricApi.module("fabric-screen-api-v1", project.fabric_version) -} + loom { + silentMojangMappingsLicense() + } -processResources { - inputs.property "version", project.version - - filesMatching("fabric.mod.json") { - expand "version": project.version + dependencies { + minecraft "com.mojang:minecraft:${rootProject.properties["minecraft_version"]}" + mappings "net.fabricmc:yarn:${rootProject.properties["yarn_mappings"]}:v2" } } -tasks.withType(JavaCompile).configureEach { - it.options.release = 17 -} +allprojects { + apply plugin: "java" + apply plugin: "architectury-plugin" + apply plugin: "maven-publish" -java { - withSourcesJar() -} + archivesBaseName = rootProject.properties["archives_base_name"] + version = rootProject.properties["mod_version"] + group = rootProject.properties["maven_group"] -jar { - from("LICENSE") { - rename { "${it}_${project.archivesBaseName}"} + tasks.withType(JavaCompile).configureEach { + options.encoding = "UTF-8" + options.release.set(17) + } + + java { + withSourcesJar() } } diff --git a/common/build.gradle b/common/build.gradle new file mode 100644 index 0000000..f04d856 --- /dev/null +++ b/common/build.gradle @@ -0,0 +1,8 @@ +architectury { + injectInjectables = false + common(rootProject.properties["enabled_platforms"].split(",")) +} + +dependencies { + modImplementation "net.fabricmc:fabric-loader:${rootProject.property("fabric_loader_version")}" +} diff --git a/src/main/java/me/lucaslah/nrb/mixin/GameMenuScreenMixin.java b/common/src/main/java/me/lucaslah/nrb/mixin/GameMenuScreenMixin.java similarity index 89% rename from src/main/java/me/lucaslah/nrb/mixin/GameMenuScreenMixin.java rename to common/src/main/java/me/lucaslah/nrb/mixin/GameMenuScreenMixin.java index c103f32..fe5eb2e 100644 --- a/src/main/java/me/lucaslah/nrb/mixin/GameMenuScreenMixin.java +++ b/common/src/main/java/me/lucaslah/nrb/mixin/GameMenuScreenMixin.java @@ -1,6 +1,5 @@ package me.lucaslah.nrb.mixin; -import net.fabricmc.fabric.api.client.screen.v1.Screens; import net.minecraft.client.gui.Element; import net.minecraft.client.gui.screen.GameMenuScreen; import net.minecraft.client.gui.screen.Screen; @@ -18,17 +17,16 @@ import java.util.Objects; @Mixin(GameMenuScreen.class) public abstract class GameMenuScreenMixin extends Screen { - protected GameMenuScreenMixin(Text title) { super(title); } @Inject(method = "initWidgets()V", at = @At(value = "RETURN")) public void initWidgets(CallbackInfo ci) { - final List widgets = Screens.getButtons(this); + final List widgets = ((ScreenAccessor) this).getChildren(); List buttons = null; - for (ClickableWidget clickableWidget : widgets) { + for (Element clickableWidget : widgets) { if (clickableWidget instanceof GridWidget widget) { List children = widget.children(); diff --git a/common/src/main/java/me/lucaslah/nrb/mixin/ScreenAccessor.java b/common/src/main/java/me/lucaslah/nrb/mixin/ScreenAccessor.java new file mode 100644 index 0000000..7f8ca99 --- /dev/null +++ b/common/src/main/java/me/lucaslah/nrb/mixin/ScreenAccessor.java @@ -0,0 +1,14 @@ +package me.lucaslah.nrb.mixin; + +import net.minecraft.client.gui.Element; +import net.minecraft.client.gui.screen.Screen; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.gen.Accessor; + +import java.util.List; + +@Mixin(Screen.class) +public interface ScreenAccessor { + @Accessor + List getChildren(); +} diff --git a/common/src/main/resources/architectury.common.json b/common/src/main/resources/architectury.common.json new file mode 100644 index 0000000..7a73a41 --- /dev/null +++ b/common/src/main/resources/architectury.common.json @@ -0,0 +1,2 @@ +{ +} \ No newline at end of file diff --git a/src/main/resources/assets/noreportbutton/icon.png b/common/src/main/resources/assets/noreportbutton/icon.png similarity index 100% rename from src/main/resources/assets/noreportbutton/icon.png rename to common/src/main/resources/assets/noreportbutton/icon.png diff --git a/src/main/resources/noreportbutton.mixins.json b/common/src/main/resources/noreportbutton.mixins.json similarity index 78% rename from src/main/resources/noreportbutton.mixins.json rename to common/src/main/resources/noreportbutton.mixins.json index b463673..6284ae5 100644 --- a/src/main/resources/noreportbutton.mixins.json +++ b/common/src/main/resources/noreportbutton.mixins.json @@ -1,14 +1,13 @@ { "required": true, - "minVersion": "0.8", "package": "me.lucaslah.nrb.mixin", "compatibilityLevel": "JAVA_17", - "mixins": [ - ], + "minVersion": "0.8", "client": [ - "GameMenuScreenMixin" + "GameMenuScreenMixin", + "ScreenAccessor" ], "injectors": { "defaultRequire": 1 } -} +} \ No newline at end of file diff --git a/fabric/build.gradle b/fabric/build.gradle new file mode 100644 index 0000000..56b4d38 --- /dev/null +++ b/fabric/build.gradle @@ -0,0 +1,63 @@ +plugins { + id "com.github.johnrengelman.shadow" version "7.1.2" +} + +architectury { + injectInjectables = false + platformSetupLoomIde() + fabric() +} + +configurations { + common + shadowCommon + compileClasspath.extendsFrom common + runtimeClasspath.extendsFrom common + developmentFabric.extendsFrom common + archivesBaseName = rootProject.archives_base_name + "-fabric" +} + +dependencies { + modImplementation "net.fabricmc:fabric-loader:${rootProject.properties["fabric_loader_version"]}" + + common(project(path: ":common", configuration: "namedElements")) { transitive false } + shadowCommon(project(path: ":common", configuration: "transformProductionFabric")) { transitive false } +} + +processResources { + inputs.property "version", project.version + + filesMatching("fabric.mod.json") { + expand "version": project.version + } +} + + +shadowJar { + exclude "architectury.common.json" + + configurations = [project.configurations.shadowCommon] + classifier "dev-shadow" +} + +remapJar { + input.set shadowJar.archiveFile + dependsOn shadowJar + classifier null +} + +jar { + classifier "dev" +} + +sourcesJar { + def commonSources = project(":common").sourcesJar + dependsOn commonSources + from commonSources.archiveFile.map { zipTree(it) } +} + +components.java { + withVariantsFromConfiguration(project.configurations.shadowRuntimeElements) { + skip() + } +} diff --git a/src/main/java/me/lucaslah/nrb/NoReportButton.java b/fabric/src/main/java/me/lucaslah/nrb/NoReportButtonFabric.java similarity index 65% rename from src/main/java/me/lucaslah/nrb/NoReportButton.java rename to fabric/src/main/java/me/lucaslah/nrb/NoReportButtonFabric.java index 9e84ea3..affb901 100644 --- a/src/main/java/me/lucaslah/nrb/NoReportButton.java +++ b/fabric/src/main/java/me/lucaslah/nrb/NoReportButtonFabric.java @@ -2,7 +2,7 @@ package me.lucaslah.nrb; import net.fabricmc.api.ModInitializer; -public class NoReportButton implements ModInitializer { +public class NoReportButtonFabric implements ModInitializer { @Override public void onInitialize() {} } diff --git a/src/main/resources/fabric.mod.json b/fabric/src/main/resources/fabric.mod.json similarity index 83% rename from src/main/resources/fabric.mod.json rename to fabric/src/main/resources/fabric.mod.json index 860327a..82b7a0f 100644 --- a/src/main/resources/fabric.mod.json +++ b/fabric/src/main/resources/fabric.mod.json @@ -16,10 +16,10 @@ "license": "lgpl-3", "icon": "assets/noreportbutton/icon.png", - "environment": "*", + "environment": "client", "entrypoints": { "main": [ - "me.lucaslah.nrb.NoReportButton" + "me.lucaslah.nrb.NoReportButtonFabric" ] }, "mixins": [ @@ -29,7 +29,6 @@ "depends": { "fabricloader": ">=0.14.6", "minecraft": ">=1.19.3", - "java": ">=17", - "fabric-screen-api-v1": ">=1.0.4" + "java": ">=17" } } diff --git a/forge/build.gradle b/forge/build.gradle new file mode 100644 index 0000000..75b8108 --- /dev/null +++ b/forge/build.gradle @@ -0,0 +1,69 @@ +plugins { + id "com.github.johnrengelman.shadow" version "7.1.2" +} + +architectury { + injectInjectables = false + platformSetupLoomIde() + forge() +} + +loom { + forge { + mixinConfig "noreportbutton.mixins.json" + } +} + +configurations { + common + shadowCommon + compileClasspath.extendsFrom common + runtimeClasspath.extendsFrom common + developmentForge.extendsFrom common + archivesBaseName = rootProject.archives_base_name + "-forge" +} + +dependencies { + forge "net.minecraftforge:forge:${rootProject.properties["forge_version"]}" + + common(project(path: ":common", configuration: "namedElements")) { transitive false } + shadowCommon(project(path: ":common", configuration: "transformProductionForge")) { transitive = false } +} + +processResources { + inputs.property "version", project.version + + filesMatching("META-INF/mods.toml") { + expand "version": project.version + } +} + +shadowJar { + exclude "fabric.mod.json" + exclude "architectury.common.json" + + configurations = [project.configurations.shadowCommon] + classifier "dev-shadow" +} + +remapJar { + input.set shadowJar.archiveFile + dependsOn shadowJar + classifier null +} + +jar { + classifier "dev" +} + +sourcesJar { + def commonSources = project(":common").sourcesJar + dependsOn commonSources + from commonSources.archiveFile.map { zipTree(it) } +} + +components.java { + withVariantsFromConfiguration(project.configurations.shadowRuntimeElements) { + skip() + } +} diff --git a/forge/gradle.properties b/forge/gradle.properties new file mode 100644 index 0000000..32f842a --- /dev/null +++ b/forge/gradle.properties @@ -0,0 +1 @@ +loom.platform=forge \ No newline at end of file diff --git a/forge/src/main/java/me/lucaslah/nrb/NoReportButtonForge.java b/forge/src/main/java/me/lucaslah/nrb/NoReportButtonForge.java new file mode 100644 index 0000000..3a627af --- /dev/null +++ b/forge/src/main/java/me/lucaslah/nrb/NoReportButtonForge.java @@ -0,0 +1,7 @@ +package me.lucaslah.nrb; + +import net.minecraftforge.fml.common.Mod; + +@Mod("noreportbutton") +public class NoReportButtonForge { +} diff --git a/forge/src/main/resources/META-INF/mods.toml b/forge/src/main/resources/META-INF/mods.toml new file mode 100644 index 0000000..07c5627 --- /dev/null +++ b/forge/src/main/resources/META-INF/mods.toml @@ -0,0 +1,27 @@ +modLoader = "javafml" +loaderVersion = "[43,)" +license = "GNU LESSER GENERAL PUBLIC LICENSE" + +[[mods]] +modId = "noreportbutton" +version = "${version}" +displayName = "No Report Button" +authors = "Lucaslah" +description = ''' +Removes the chat report button from the multiplayer menu screen +''' +logoFile = "icon.png" + +[[dependencies.noreportbutton]] +modId = "forge" +mandatory = true +versionRange = "[43,)" +ordering = "NONE" +side = "CLIENT" + +[[dependencies.noreportbutton]] +modId = "minecraft" +mandatory = true +versionRange = "[1.19.3,)" +ordering = "NONE" +side = "CLIENT" diff --git a/forge/src/main/resources/icon.png b/forge/src/main/resources/icon.png new file mode 100644 index 0000000..c0975fd Binary files /dev/null and b/forge/src/main/resources/icon.png differ diff --git a/forge/src/main/resources/pack.mcmeta b/forge/src/main/resources/pack.mcmeta new file mode 100644 index 0000000..0cf0874 --- /dev/null +++ b/forge/src/main/resources/pack.mcmeta @@ -0,0 +1,6 @@ +{ + "pack": { + "description": "NoReportButton", + "pack_format": 9 + } +} diff --git a/gradle.properties b/gradle.properties index 8803597..c7612db 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,16 +1,19 @@ # Done to increase the memory available to gradle. -org.gradle.jvmargs=-Xmx1G +org.gradle.jvmargs=-Xmx2G -# Fabric Properties -# check these on https://fabricmc.net/develop +# Minecraft Properties minecraft_version=1.19.3 -yarn_mappings=1.19.3+build.1 -loader_version=0.14.11 +yarn_mappings=1.19.3+build.3 +fabric_loader_version=0.14.11 +quilt_loader_version=0.18.1-beta.23 +enabled_platforms=quilt,fabric,forge # Mod Properties -mod_version = 1.3.1 +mod_version = 1.4.0 maven_group = me.lucaslah archives_base_name = no-report-button # Dependencies +architectury_version=6.2.43 fabric_version=0.68.1+1.19.3 +forge_version=1.19.3-44.0.18 diff --git a/settings.gradle b/settings.gradle index b02216b..5d19ad5 100644 --- a/settings.gradle +++ b/settings.gradle @@ -4,7 +4,17 @@ pluginManagement { name = 'Fabric' url = 'https://maven.fabricmc.net/' } + maven { url "https://maven.architectury.dev/" } + maven { url "https://maven.minecraftforge.net/" } + mavenCentral() gradlePluginPortal() } } + +rootProject.name = "no-report-button" + +include 'common' +include 'fabric' +include 'forge' +