mirror of
https://github.com/Lucaslah/No-Report-Button.git
synced 2026-01-12 08:57:52 +00:00
Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 886b2c37e0 | |||
| 256ed10cfe | |||
| 64397c5497 | |||
| 1fa8e47900 | |||
| bb3254389c | |||
| de212d0b6d |
@@ -1,25 +0,0 @@
|
||||
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.245.0/containers/java/.devcontainer/base.Dockerfile
|
||||
|
||||
# [Choice] Java version (use -bullseye variants on local arm64/Apple Silicon): 11, 17, 11-bullseye, 17-bullseye, 11-buster, 17-buster
|
||||
ARG VARIANT="17-bullseye"
|
||||
FROM mcr.microsoft.com/vscode/devcontainers/java:0-${VARIANT}
|
||||
|
||||
# [Option] Install Maven
|
||||
ARG INSTALL_MAVEN="false"
|
||||
ARG MAVEN_VERSION=""
|
||||
# [Option] Install Gradle
|
||||
ARG INSTALL_GRADLE="false"
|
||||
ARG GRADLE_VERSION=""
|
||||
RUN if [ "${INSTALL_MAVEN}" = "true" ]; then su vscode -c "umask 0002 && . /usr/local/sdkman/bin/sdkman-init.sh && sdk install maven \"${MAVEN_VERSION}\""; fi \
|
||||
&& if [ "${INSTALL_GRADLE}" = "true" ]; then su vscode -c "umask 0002 && . /usr/local/sdkman/bin/sdkman-init.sh && sdk install gradle \"${GRADLE_VERSION}\""; fi
|
||||
|
||||
# [Choice] Node.js version: none, lts/*, 16, 14, 12, 10
|
||||
ARG NODE_VERSION="none"
|
||||
RUN if [ "${NODE_VERSION}" != "none" ]; then su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi
|
||||
|
||||
# [Optional] Uncomment this section to install additional OS packages.
|
||||
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
|
||||
# && apt-get -y install --no-install-recommends <your-package-list-here>
|
||||
|
||||
# [Optional] Uncomment this line to install global node packages.
|
||||
# RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g <your-package-here>" 2>&1
|
||||
@@ -1,48 +0,0 @@
|
||||
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
|
||||
// https://github.com/microsoft/vscode-dev-containers/tree/v0.245.0/containers/java
|
||||
{
|
||||
"name": "Java",
|
||||
"build": {
|
||||
"dockerfile": "Dockerfile",
|
||||
"args": {
|
||||
// Update the VARIANT arg to pick a Java version: 11, 17
|
||||
// Append -bullseye or -buster to pin to an OS version.
|
||||
// Use the -bullseye variants on local arm64/Apple Silicon.
|
||||
"VARIANT": "17-bullseye",
|
||||
// Options
|
||||
"INSTALL_MAVEN": "false",
|
||||
"INSTALL_GRADLE": "true",
|
||||
"NODE_VERSION": "none"
|
||||
}
|
||||
},
|
||||
|
||||
// Configure tool-specific properties.
|
||||
"customizations": {
|
||||
// Configure properties specific to VS Code.
|
||||
"vscode": {
|
||||
// Set *default* container specific settings.json values on container create.
|
||||
"settings": {
|
||||
},
|
||||
|
||||
// Add the IDs of extensions you want installed when the container is created.
|
||||
"extensions": [
|
||||
"vscjava.vscode-java-pack"
|
||||
]
|
||||
}
|
||||
},
|
||||
|
||||
// Use 'forwardPorts' to make a list of ports inside the container available locally.
|
||||
// "forwardPorts": [],
|
||||
|
||||
// Use 'postCreateCommand' to run commands after the container is created.
|
||||
// "postCreateCommand": "java -version",
|
||||
|
||||
// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
|
||||
"remoteUser": "vscode",
|
||||
"features": {
|
||||
"git": "os-provided",
|
||||
"github-cli": "latest",
|
||||
"sshd": "latest",
|
||||
"fish": "latest"
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,14 @@
|
||||
[](https://fabricmc.net)
|
||||
[](https://www.curseforge.com/minecraft/mc-mods/no-report-button)
|
||||
[](https://modrinth.com/mod/nrb)
|
||||
# No Report Button
|
||||
Removes the chat report button from the game menu screen
|
||||
|
||||
Supports fabric 1.19.1+, forge support is coming soon!\
|
||||
Supports fabric 1.19.3+, forge support is coming soon!\
|
||||
The fabric api is not required.
|
||||
|
||||
For minecraft versions 1.19.2 or older use NRB v1.2.1, the latest version only supports 1.19.3+.
|
||||
|
||||
## Links
|
||||
Curseforge: https://www.curseforge.com/minecraft/mc-mods/no-report-button<br>
|
||||
Modrinth: https://modrinth.com/mod/nrb
|
||||
|
||||
38
build.gradle
38
build.gradle
@@ -10,13 +10,7 @@ archivesBaseName = project.archives_base_name
|
||||
version = project.mod_version
|
||||
group = project.maven_group
|
||||
|
||||
repositories {
|
||||
// Add repositories to retrieve artifacts from in here.
|
||||
// You should only use this when depending on other mods because
|
||||
// Loom adds the essential maven repositories to download Minecraft and libraries from automatically.
|
||||
// See https://docs.gradle.org/current/userguide/declaring_repositories.html
|
||||
// for more information about repositories.
|
||||
}
|
||||
repositories {}
|
||||
|
||||
configurations {
|
||||
includeModImplementation
|
||||
@@ -35,15 +29,6 @@ dependencies {
|
||||
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
|
||||
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
|
||||
|
||||
|
||||
// Fabric API. This is technically optional, but you probably want it anyway.
|
||||
// modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
|
||||
|
||||
// Uncomment the following line to enable the deprecated Fabric API modules.
|
||||
// These are included in the Fabric API production distribution and allow you to update your mod to the latest modules at a later more convenient time.
|
||||
|
||||
// modImplementation "net.fabricmc.fabric-api:fabric-api-deprecated:${project.fabric_version}"
|
||||
|
||||
includeModImplementation fabricApi.module("fabric-api-base", project.fabric_version)
|
||||
includeModImplementation fabricApi.module("fabric-screen-api-v1", project.fabric_version)
|
||||
}
|
||||
@@ -57,14 +42,10 @@ processResources {
|
||||
}
|
||||
|
||||
tasks.withType(JavaCompile).configureEach {
|
||||
// Minecraft 1.18 (1.18-pre2) upwards uses Java 17.
|
||||
it.options.release = 17
|
||||
}
|
||||
|
||||
java {
|
||||
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
|
||||
// if it is present.
|
||||
// If you remove this line, sources will not be generated.
|
||||
withSourcesJar()
|
||||
}
|
||||
|
||||
@@ -73,20 +54,3 @@ jar {
|
||||
rename { "${it}_${project.archivesBaseName}"}
|
||||
}
|
||||
}
|
||||
|
||||
// configure the maven publication
|
||||
publishing {
|
||||
publications {
|
||||
mavenJava(MavenPublication) {
|
||||
from components.java
|
||||
}
|
||||
}
|
||||
|
||||
// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
|
||||
repositories {
|
||||
// Add repositories to publish to here.
|
||||
// Notice: This block does NOT have the same function as the block in the top level.
|
||||
// The repositories here will be used for publishing your artifact, not for
|
||||
// retrieving dependencies.
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,14 +3,14 @@ org.gradle.jvmargs=-Xmx1G
|
||||
|
||||
# Fabric Properties
|
||||
# check these on https://fabricmc.net/develop
|
||||
minecraft_version=1.19.2
|
||||
yarn_mappings=1.19.2+build.1
|
||||
loader_version=0.14.8
|
||||
minecraft_version=1.19.3
|
||||
yarn_mappings=1.19.3+build.1
|
||||
loader_version=0.14.11
|
||||
|
||||
# Mod Properties
|
||||
mod_version = 1.2.0
|
||||
mod_version = 1.3.1
|
||||
maven_group = me.lucaslah
|
||||
archives_base_name = no-report-button
|
||||
|
||||
# Dependencies
|
||||
fabric_version=0.58.6+1.19.2
|
||||
fabric_version=0.68.1+1.19.3
|
||||
|
||||
@@ -1,55 +0,0 @@
|
||||
package me.lucaslah.ncrb.mixin;
|
||||
|
||||
import net.fabricmc.fabric.api.client.screen.v1.Screens;
|
||||
import net.minecraft.client.gui.screen.GameMenuScreen;
|
||||
import net.minecraft.client.gui.screen.OpenToLanScreen;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.gui.widget.ButtonWidget;
|
||||
import net.minecraft.client.gui.widget.ClickableWidget;
|
||||
import net.minecraft.client.resource.language.I18n;
|
||||
import net.minecraft.text.Text;
|
||||
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;
|
||||
|
||||
import java.util.List;
|
||||
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> buttons = Screens.getButtons(this);
|
||||
|
||||
ClickableWidget reportButton = null;
|
||||
boolean reportButtonFound = false;
|
||||
|
||||
for (ClickableWidget button : buttons) {
|
||||
if (button.getMessage().getString().equals(I18n.translate("menu.playerReporting"))) {
|
||||
button.setWidth(-9999);
|
||||
reportButton = button;
|
||||
reportButtonFound = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (reportButtonFound) {
|
||||
//reportButton.setWidth(-9999);
|
||||
//reportButton.setMessage(Text.of(""));
|
||||
//reportButton.active = false;
|
||||
|
||||
ButtonWidget openToLanButton = this.addDrawableChild(new ButtonWidget(this.width / 2 + 4, this.height / 4 + 96 + -16, 98, 20, Text.translatable("menu.shareToLan"), (button) -> {
|
||||
assert this.client != null;
|
||||
this.client.setScreen(new OpenToLanScreen(this));
|
||||
}));
|
||||
|
||||
assert this.client != null;
|
||||
openToLanButton.active = this.client.isIntegratedServerRunning() && !Objects.requireNonNull(this.client.getServer()).isRemote();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,8 @@
|
||||
package me.lucaslah.ncrb;
|
||||
package me.lucaslah.nrb;
|
||||
|
||||
import net.fabricmc.api.ModInitializer;
|
||||
|
||||
public class NoReportButton implements ModInitializer {
|
||||
@Override
|
||||
public void onInitialize() {
|
||||
// Do nothing
|
||||
}
|
||||
public void onInitialize() {}
|
||||
}
|
||||
55
src/main/java/me/lucaslah/nrb/mixin/GameMenuScreenMixin.java
Normal file
55
src/main/java/me/lucaslah/nrb/mixin/GameMenuScreenMixin.java
Normal file
@@ -0,0 +1,55 @@
|
||||
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;
|
||||
import net.minecraft.client.gui.widget.ClickableWidget;
|
||||
import net.minecraft.client.gui.widget.GridWidget;
|
||||
import net.minecraft.client.resource.language.I18n;
|
||||
import net.minecraft.text.Text;
|
||||
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;
|
||||
|
||||
import java.util.List;
|
||||
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);
|
||||
List<? extends Element> buttons = null;
|
||||
|
||||
for (ClickableWidget clickableWidget : widgets) {
|
||||
if (clickableWidget instanceof GridWidget widget) {
|
||||
List<? extends Element> children = widget.children();
|
||||
|
||||
if (children != null) {
|
||||
buttons = children;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (buttons != null) {
|
||||
for (Element element : buttons) {
|
||||
if (element instanceof ClickableWidget button) {
|
||||
if (button.getMessage().getString().equals(I18n.translate("menu.playerReporting"))) {
|
||||
if (this.client != null) {
|
||||
button.active = this.client.isIntegratedServerRunning() && !Objects.requireNonNull(this.client.getServer()).isRemote();
|
||||
}
|
||||
|
||||
button.setMessage(Text.translatable("menu.shareToLan"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -19,16 +19,16 @@
|
||||
"environment": "*",
|
||||
"entrypoints": {
|
||||
"main": [
|
||||
"me.lucaslah.ncrb.NoReportButton"
|
||||
"me.lucaslah.nrb.NoReportButton"
|
||||
]
|
||||
},
|
||||
"mixins": [
|
||||
"mixins.json"
|
||||
"noreportbutton.mixins.json"
|
||||
],
|
||||
|
||||
"depends": {
|
||||
"fabricloader": ">=0.14.6",
|
||||
"minecraft": "~1.19",
|
||||
"minecraft": ">=1.19.3",
|
||||
"java": ">=17",
|
||||
"fabric-screen-api-v1": ">=1.0.4"
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"required": true,
|
||||
"minVersion": "0.8",
|
||||
"package": "me.lucaslah.ncrb.mixin",
|
||||
"package": "me.lucaslah.nrb.mixin",
|
||||
"compatibilityLevel": "JAVA_17",
|
||||
"mixins": [
|
||||
],
|
||||
Reference in New Issue
Block a user