Skip to content

Commit

Permalink
1.20.6
Browse files Browse the repository at this point in the history
  • Loading branch information
Satxm committed Jul 16, 2024
1 parent 0bd145e commit 6f047b3
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
3 changes: 3 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ neo_version = 20.6.119
quilt_loader_version = 0.26.0-beta.1
qfapi_version = 10.0.0-alpha.3+0.100.4-1.20.6

# QSL on https://maven.quiltmc.org/repository/release/org/quiltmc/qsl/maven-metadata.xml
qsl_version = 9.0.0-alpha.1+1.20.6

# Mod Config
# Fabric
fabric_version_range = >=0.90.0
Expand Down
1 change: 1 addition & 0 deletions quilt/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ dependencies {
officialMojangMappings()
}
modImplementation "org.quiltmc:quilt-loader:${project.quilt_loader_version}"
modImplementation "org.quiltmc:qsl:${project.qsl_version}"
modImplementation "org.quiltmc.quilted-fabric-api:quilted-fabric-api:${project.qfapi_version}"
}

Expand Down
19 changes: 10 additions & 9 deletions quilt/src/main/java/io/github/satxm/mcwifipnp/MCWiFiPnP.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package io.github.satxm.mcwifipnp;

import net.fabricmc.fabric.api.client.screen.v1.Screens;
import net.fabricmc.fabric.api.command.v2.CommandRegistrationCallback;
import org.quiltmc.loader.api.ModContainer;
import org.quiltmc.qsl.base.api.entrypoint.ModInitializer;
import org.quiltmc.qsl.command.api.CommandRegistrationCallback;
import org.quiltmc.qsl.lifecycle.api.event.ServerLifecycleEvents;
import org.quiltmc.qsl.screen.api.client.ScreenEvents;
import net.fabricmc.fabric.api.client.screen.v1.ScreenEvents;
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents;

import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.components.AbstractWidget;
Expand All @@ -28,8 +29,8 @@ public class MCWiFiPnP implements ModInitializer {

@Override
public void onInitialize(ModContainer mod) {
ServerLifecycleEvents.STARTING.register(this::onServerLoad);
ServerLifecycleEvents.STOPPING.register(this::onServerStop);
ServerLifecycleEvents.SERVER_STOPPING.register(this::onServerLoad);
ServerLifecycleEvents.SERVER_STOPPING.register(this::onServerStop);
ScreenEvents.AFTER_INIT.register(MCWiFiPnP::afterScreenInit);

CommandRegistrationCallback.EVENT.register((dispatcher, registryAccess, environment) -> {
Expand All @@ -42,16 +43,16 @@ public void onInitialize(ModContainer mod) {
});
}

public static void afterScreenInit(Screen screen, Minecraft client, boolean i) {
public static void afterScreenInit(Minecraft client, Screen screen, int x, int y) {
if (screen instanceof PauseScreen) {
for (AbstractWidget button : screen.getButtons()) {
for (AbstractWidget button : Screens.getButtons(screen)) {
if (button.getMessage().equals(Component.translatable("menu.shareToLan"))) {
Button newButton = Button.builder(Component.translatable("menu.shareToLan"), $ -> {
client.setScreen(new ShareToLanScreenNew(screen));
}).bounds(button.getX(), button.getY(), button.getWidth(), button.getHeight()).build();
newButton.active = button.active;
screen.getButtons().remove(button);
screen.getButtons().add(newButton);
Screens.getButtons(screen).remove(button);
Screens.getButtons(screen).add(newButton);
}
}
}
Expand Down

0 comments on commit 6f047b3

Please sign in to comment.