mirror of
https://github.com/ViaVersion/ViaFabric.git
synced 2024-11-24 12:06:11 +01:00
fix #149
This commit is contained in:
parent
1d6363bbb9
commit
e476a36695
@ -1,9 +1,9 @@
|
||||
package com.viaversion.fabric.mc117;
|
||||
|
||||
import com.viaversion.fabric.mc117.gui.ViaConfigScreen;
|
||||
import com.viaversion.fabric.mc117.mixin.gui.client.ScreenAccessor;
|
||||
import net.fabricmc.api.ClientModInitializer;
|
||||
import net.fabricmc.fabric.api.client.screen.v1.ScreenEvents;
|
||||
import net.fabricmc.fabric.api.client.screen.v1.Screens;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.screen.multiplayer.MultiplayerScreen;
|
||||
import net.minecraft.client.gui.widget.ButtonWidget;
|
||||
@ -30,7 +30,7 @@ public class ViaFabricClient implements ClientModInitializer {
|
||||
it -> MinecraftClient.getInstance().setScreen(new ViaConfigScreen(screen)),
|
||||
new TranslatableText("gui.via_button"));
|
||||
if (ViaFabric.config.isHideButton()) enableClientSideViaVersion.visible = false;
|
||||
((ScreenAccessor) screen).callAddDrawableChild(enableClientSideViaVersion);
|
||||
Screens.getButtons(screen).add(enableClientSideViaVersion);
|
||||
});
|
||||
} catch (NoClassDefFoundError ignored) {
|
||||
ViaFabric.JLOGGER.info("Couldn't register screen handler as Fabric Screen isn't installed");
|
||||
|
@ -1,14 +0,0 @@
|
||||
package com.viaversion.fabric.mc117.mixin.gui.client;
|
||||
|
||||
import net.minecraft.client.gui.Drawable;
|
||||
import net.minecraft.client.gui.Element;
|
||||
import net.minecraft.client.gui.Selectable;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.gen.Invoker;
|
||||
|
||||
@Mixin(Screen.class)
|
||||
public interface ScreenAccessor {
|
||||
@Invoker
|
||||
<T extends Element & Drawable & Selectable> T callAddDrawableChild(T element);
|
||||
}
|
@ -5,7 +5,6 @@
|
||||
"mixins": [
|
||||
],
|
||||
"client": [
|
||||
"client.ScreenAccessor",
|
||||
"client.MixinMultiplayerServerListPingerListener",
|
||||
"client.MixinServerEntry",
|
||||
"client.MixinServerInfo"
|
||||
|
@ -1,9 +1,9 @@
|
||||
package com.viaversion.fabric.mc118;
|
||||
|
||||
import com.viaversion.fabric.mc118.gui.ViaConfigScreen;
|
||||
import com.viaversion.fabric.mc118.mixin.gui.client.ScreenAccessor;
|
||||
import net.fabricmc.api.ClientModInitializer;
|
||||
import net.fabricmc.fabric.api.client.screen.v1.ScreenEvents;
|
||||
import net.fabricmc.fabric.api.client.screen.v1.Screens;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.screen.multiplayer.MultiplayerScreen;
|
||||
import net.minecraft.client.gui.widget.ButtonWidget;
|
||||
@ -30,7 +30,7 @@ public class ViaFabricClient implements ClientModInitializer {
|
||||
it -> MinecraftClient.getInstance().setScreen(new ViaConfigScreen(screen)),
|
||||
new TranslatableText("gui.via_button"));
|
||||
if (ViaFabric.config.isHideButton()) enableClientSideViaVersion.visible = false;
|
||||
((ScreenAccessor) screen).callAddDrawableChild(enableClientSideViaVersion);
|
||||
Screens.getButtons(screen).add(enableClientSideViaVersion);
|
||||
});
|
||||
} catch (NoClassDefFoundError ignored) {
|
||||
ViaFabric.JLOGGER.info("Couldn't register screen handler as Fabric Screen isn't installed");
|
||||
|
@ -1,14 +0,0 @@
|
||||
package com.viaversion.fabric.mc118.mixin.gui.client;
|
||||
|
||||
import net.minecraft.client.gui.Drawable;
|
||||
import net.minecraft.client.gui.Element;
|
||||
import net.minecraft.client.gui.Selectable;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.gen.Invoker;
|
||||
|
||||
@Mixin(Screen.class)
|
||||
public interface ScreenAccessor {
|
||||
@Invoker
|
||||
<T extends Element & Drawable & Selectable> T callAddDrawableChild(T element);
|
||||
}
|
@ -5,7 +5,6 @@
|
||||
"mixins": [
|
||||
],
|
||||
"client": [
|
||||
"client.ScreenAccessor",
|
||||
"client.MixinMultiplayerServerListPingerListener",
|
||||
"client.MixinServerEntry",
|
||||
"client.MixinServerInfo"
|
||||
|
Loading…
Reference in New Issue
Block a user