mirror of
https://github.com/ViaVersion/ViaFabricPlus.git
synced 2024-11-25 12:25:22 +01:00
added Values menu to OptionsScreen
This commit is contained in:
parent
0610c81a71
commit
a704ca6f22
@ -5,7 +5,7 @@ minecraft_version=1.19.3
|
||||
yarn_mappings=1.19.3+build.5
|
||||
loader_version=0.14.14
|
||||
|
||||
mod_version=1.2.3
|
||||
mod_version=1.2.4
|
||||
maven_group=de.florianmichael
|
||||
archives_base_name=viafabricplus
|
||||
|
||||
|
@ -0,0 +1,31 @@
|
||||
package de.florianmichael.viafabricplus.injection.mixin.base;
|
||||
|
||||
import de.florianmichael.viafabricplus.screen.ValuesScreen;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.gui.screen.option.OptionsScreen;
|
||||
import net.minecraft.client.gui.widget.ButtonWidget;
|
||||
import net.minecraft.client.gui.widget.GridWidget;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.Formatting;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
@Mixin(OptionsScreen.class)
|
||||
public abstract class MixinOptionsScreen {
|
||||
|
||||
@Shadow protected abstract ButtonWidget createButton(Text message, Supplier<Screen> screenSupplier);
|
||||
|
||||
@Inject(method = "init", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/widget/GridWidget$Adder;add(Lnet/minecraft/client/gui/widget/ClickableWidget;)Lnet/minecraft/client/gui/widget/ClickableWidget;", ordinal = 10, shift = At.Shift.AFTER), locals = LocalCapture.CAPTURE_FAILHARD)
|
||||
public void addValuesButton(CallbackInfo ci, GridWidget gridWidget, GridWidget.Adder adder) {
|
||||
adder.add(this.createButton(Text.literal("ViaFabricPlus").styled(style -> style.withColor(Formatting.GOLD)).append(" ").append("values"), () -> {
|
||||
ValuesScreen.INSTANCE.prevScreen = (OptionsScreen) (Object) this;
|
||||
return ValuesScreen.INSTANCE;
|
||||
}));
|
||||
}
|
||||
}
|
@ -6,6 +6,7 @@ import de.florianmichael.viafabricplus.ViaFabricPlus;
|
||||
import de.florianmichael.vialoadingbase.ViaLoadingBase;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.hud.DebugHud;
|
||||
import net.minecraft.util.Formatting;
|
||||
import net.raphimc.vialegacy.api.LegacyProtocolVersion;
|
||||
import net.raphimc.vialegacy.protocols.release.protocol1_2_1_3to1_1.storage.SeedStorage;
|
||||
import net.raphimc.vialegacy.protocols.release.protocol1_8to1_7_6_10.storage.EntityTracker;
|
||||
@ -27,7 +28,7 @@ public class MixinDebugHud {
|
||||
final List<String> information = new ArrayList<>();
|
||||
if (MinecraftClient.getInstance().getNetworkHandler() != null) {
|
||||
information.add("");
|
||||
information.add("[ViaFabricPlus]");
|
||||
information.add(Formatting.GOLD + "[ViaFabricPlus]");
|
||||
final UserConnection userConnection = MinecraftClient.getInstance().getNetworkHandler().getConnection().channel.attr(ViaFabricPlus.LOCAL_VIA_CONNECTION).get();
|
||||
|
||||
information.add("Pipeline count: " + userConnection.getProtocolInfo().getPipeline().pipes().size());
|
||||
|
@ -19,7 +19,7 @@ import java.awt.*;
|
||||
|
||||
@SuppressWarnings({"DataFlowIssue", "DuplicatedCode"})
|
||||
public class ValuesScreen extends Screen {
|
||||
private final static ValuesScreen INSTANCE = new ValuesScreen();
|
||||
public final static ValuesScreen INSTANCE = new ValuesScreen();
|
||||
public Screen prevScreen;
|
||||
|
||||
protected ValuesScreen() {
|
||||
|
@ -125,6 +125,7 @@
|
||||
"defaultRequire": 1
|
||||
},
|
||||
"client": [
|
||||
"base.MixinOptionsScreen",
|
||||
"bridge.MixinConnectScreen",
|
||||
"bridge.MixinDownloadingTerrainScreen"
|
||||
]
|
||||
|
Loading…
Reference in New Issue
Block a user