This commit is contained in:
creeper123123321 2021-07-21 15:58:44 -03:00
parent 1d6363bbb9
commit e476a36695
6 changed files with 4 additions and 34 deletions

View File

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

View File

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

View File

@ -5,7 +5,6 @@
"mixins": [
],
"client": [
"client.ScreenAccessor",
"client.MixinMultiplayerServerListPingerListener",
"client.MixinServerEntry",
"client.MixinServerInfo"

View File

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

View File

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

View File

@ -5,7 +5,6 @@
"mixins": [
],
"client": [
"client.ScreenAccessor",
"client.MixinMultiplayerServerListPingerListener",
"client.MixinServerEntry",
"client.MixinServerInfo"