mirror of
https://github.com/Lucaslah/No-Report-Button.git
synced 2026-01-02 19:47:51 +00:00
fix: mod menu mods button offset
- fixes #5 - bump version to 1.3.1 - update button logic that replaces the report button to fix mod menu issue - rename mixins.json to noreportbutton.mixins.json - updated package from ncrb to nrb - minor cleanup
This commit is contained in:
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.
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ yarn_mappings=1.19.3+build.1
|
||||
loader_version=0.14.11
|
||||
|
||||
# Mod Properties
|
||||
mod_version = 1.3.0
|
||||
mod_version = 1.3.1
|
||||
maven_group = me.lucaslah
|
||||
archives_base_name = no-report-button
|
||||
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
package me.lucaslah.ncrb;
|
||||
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.screen.OpenToLanScreen;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.gui.screen.narration.NarrationMessageBuilder;
|
||||
import net.minecraft.client.gui.widget.PressableWidget;
|
||||
import net.minecraft.text.Text;
|
||||
|
||||
public class OpenToLanButton extends PressableWidget {
|
||||
private final Screen screen;
|
||||
public OpenToLanButton(Screen screen, int i, int j, int k, int l, Text text) {
|
||||
super(i, j, k, l, text);
|
||||
this.screen = screen;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPress() {
|
||||
MinecraftClient client = MinecraftClient.getInstance();
|
||||
assert client != null;
|
||||
client.setScreen(new OpenToLanScreen(screen));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void appendClickableNarrations(NarrationMessageBuilder builder) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -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() {}
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
package me.lucaslah.ncrb.mixin;
|
||||
package me.lucaslah.nrb.mixin;
|
||||
|
||||
import me.lucaslah.ncrb.OpenToLanButton;
|
||||
import net.fabricmc.fabric.api.client.screen.v1.Screens;
|
||||
import net.minecraft.client.gui.Element;
|
||||
import net.minecraft.client.gui.screen.GameMenuScreen;
|
||||
@@ -39,28 +38,18 @@ public abstract class GameMenuScreenMixin extends Screen {
|
||||
}
|
||||
}
|
||||
|
||||
boolean reportButtonFound = false;
|
||||
|
||||
if (buttons != null) {
|
||||
for (Element element : buttons) {
|
||||
if (element instanceof ClickableWidget button) {
|
||||
if (button.getMessage().getString().equals(I18n.translate("menu.playerReporting"))) {
|
||||
button.visible = false;
|
||||
button.active = false;
|
||||
reportButtonFound = true;
|
||||
if (this.client != null) {
|
||||
button.active = this.client.isIntegratedServerRunning() && !Objects.requireNonNull(this.client.getServer()).isRemote();
|
||||
}
|
||||
|
||||
button.setMessage(Text.translatable("menu.shareToLan"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (reportButtonFound) {
|
||||
OpenToLanButton openToLanButton = new OpenToLanButton(this,this.width / 2 + 4, this.height / 4 + 96 + -16, 98, 20, Text.translatable("menu.shareToLan"));
|
||||
|
||||
if (this.client != null) {
|
||||
openToLanButton.active = this.client.isIntegratedServerRunning() && !Objects.requireNonNull(this.client.getServer()).isRemote();
|
||||
}
|
||||
|
||||
widgets.add(openToLanButton);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -19,11 +19,11 @@
|
||||
"environment": "*",
|
||||
"entrypoints": {
|
||||
"main": [
|
||||
"me.lucaslah.ncrb.NoReportButton"
|
||||
"me.lucaslah.nrb.NoReportButton"
|
||||
]
|
||||
},
|
||||
"mixins": [
|
||||
"mixins.json"
|
||||
"noreportbutton.mixins.json"
|
||||
],
|
||||
|
||||
"depends": {
|
||||
|
||||
@@ -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