feat: add forge support

This commit is contained in:
2023-02-06 16:47:16 -05:00
parent 10ab15bd4d
commit a9ca8a8e19
21 changed files with 305 additions and 75 deletions

32
.github/workflows/build.yml vendored Normal file
View File

@@ -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

View File

@@ -1,20 +1,26 @@
[![Mod Loader](https://img.shields.io/badge/Mod%20Loader-Fabric-lightyellow?logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAACXBIWXMAAAsTAAALEwEAmpwYAAAFHGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNS42LWMxNDIgNzkuMTYwOTI0LCAyMDE3LzA3LzEzLTAxOjA2OjM5ICAgICAgICAiPiA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPiA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtbG5zOmRjPSJodHRwOi8vcHVybC5vcmcvZGMv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W49IjIwMTgtMTItMTZUMTY6NTQ6MTctMDg6MDAiIHN0RXZ0OnNvZnR3YXJlQWdlbnQ9IkFkb2JlIFBob3Rvc2hvcCBDQyAyMDE4IChXaW5kb3dzKSIvPiA8L3JkZjpTZXE+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<br>
Curseforge: https://www.curseforge.com/minecraft/mc-mods/no-report-button <br>
Modrinth: https://modrinth.com/mod/nrb

View File

@@ -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

View File

@@ -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()
}
}

8
common/build.gradle Normal file
View File

@@ -0,0 +1,8 @@
architectury {
injectInjectables = false
common(rootProject.properties["enabled_platforms"].split(","))
}
dependencies {
modImplementation "net.fabricmc:fabric-loader:${rootProject.property("fabric_loader_version")}"
}

View File

@@ -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<ClickableWidget> widgets = Screens.getButtons(this);
final List<Element> widgets = ((ScreenAccessor) this).getChildren();
List<? extends Element> buttons = null;
for (ClickableWidget clickableWidget : widgets) {
for (Element clickableWidget : widgets) {
if (clickableWidget instanceof GridWidget widget) {
List<? extends Element> children = widget.children();

View File

@@ -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<Element> getChildren();
}

View File

@@ -0,0 +1,2 @@
{
}

View File

Before

Width:  |  Height:  |  Size: 6.4 KiB

After

Width:  |  Height:  |  Size: 6.4 KiB

View File

@@ -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
}
}
}

63
fabric/build.gradle Normal file
View File

@@ -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()
}
}

View File

@@ -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() {}
}

View File

@@ -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"
}
}

69
forge/build.gradle Normal file
View File

@@ -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()
}
}

1
forge/gradle.properties Normal file
View File

@@ -0,0 +1 @@
loom.platform=forge

View File

@@ -0,0 +1,7 @@
package me.lucaslah.nrb;
import net.minecraftforge.fml.common.Mod;
@Mod("noreportbutton")
public class NoReportButtonForge {
}

View File

@@ -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"

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

View File

@@ -0,0 +1,6 @@
{
"pack": {
"description": "NoReportButton",
"pack_format": 9
}
}

View File

@@ -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

View File

@@ -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'