Random code cleanup

This commit is contained in:
FlorianMichael 2024-02-17 20:35:33 +01:00
parent aa4be98e71
commit 5507ad3bc5
No known key found for this signature in database
GPG Key ID: C2FB87E71C425126
3 changed files with 6 additions and 20 deletions

View File

@ -78,7 +78,6 @@ public abstract class MixinAddServerScreen extends Screen {
viaFabricPlus$addressField = null; viaFabricPlus$addressField = null;
} }
// Create the button
ButtonWidget.Builder buttonBuilder = ButtonWidget.builder(forcedVersion == null ? Text.translatable("base.viafabricplus.set_version") : Text.literal(forcedVersion.getName()), button -> { ButtonWidget.Builder buttonBuilder = ButtonWidget.builder(forcedVersion == null ? Text.translatable("base.viafabricplus.set_version") : Text.literal(forcedVersion.getName()), button -> {
// Store current input in case the user cancels the version selection // Store current input in case the user cancels the version selection
viaFabricPlus$nameField = serverNameField.getText(); viaFabricPlus$nameField = serverNameField.getText();
@ -87,11 +86,8 @@ public abstract class MixinAddServerScreen extends Screen {
client.setScreen(new PerServerVersionScreen(this, version -> ((IServerInfo) server).viaFabricPlus$forceVersion(version))); client.setScreen(new PerServerVersionScreen(this, version -> ((IServerInfo) server).viaFabricPlus$forceVersion(version)));
}).size(98, 20); }).size(98, 20);
// Set the button's position according to the configured orientation // Set the button's position according to the configured orientation and add the button to the screen
buttonBuilder = GeneralSettings.withOrientation(buttonBuilder, buttonPosition, width, height); this.addDrawableChild(GeneralSettings.withOrientation(buttonBuilder, buttonPosition, width, height).build());
// Add the button to the screen
this.addDrawableChild(buttonBuilder.build());
} }
} }

View File

@ -43,15 +43,10 @@ public abstract class MixinDirectConnectScreen extends Screen {
if (buttonPosition == 0) { // Off if (buttonPosition == 0) { // Off
return; return;
} }
// Create the button
ButtonWidget.Builder builder = ButtonWidget.builder(Text.literal("ViaFabricPlus"), button -> ProtocolSelectionScreen.INSTANCE.open(this)).size(98, 20); ButtonWidget.Builder builder = ButtonWidget.builder(Text.literal("ViaFabricPlus"), button -> ProtocolSelectionScreen.INSTANCE.open(this)).size(98, 20);
// Set the button's position according to the configured orientation // Set the button's position according to the configured orientation and add the button to the screen
builder = GeneralSettings.withOrientation(builder, buttonPosition, width, height); this.addDrawableChild(GeneralSettings.withOrientation(builder, buttonPosition, width, height).build());
// Add the button to the screen
this.addDrawableChild(builder.build());
} }
} }

View File

@ -43,15 +43,10 @@ public abstract class MixinMultiplayerScreen extends Screen {
if (buttonPosition == 0) { // Off if (buttonPosition == 0) { // Off
return; return;
} }
// Create the button
ButtonWidget.Builder builder = ButtonWidget.builder(Text.literal("ViaFabricPlus"), button -> ProtocolSelectionScreen.INSTANCE.open(this)).size(98, 20); ButtonWidget.Builder builder = ButtonWidget.builder(Text.literal("ViaFabricPlus"), button -> ProtocolSelectionScreen.INSTANCE.open(this)).size(98, 20);
// Set the button's position according to the configured orientation // Set the button's position according to the configured orientation and add the button to the screen
builder = GeneralSettings.withOrientation(builder, buttonPosition, width, height); this.addDrawableChild(GeneralSettings.withOrientation(builder, buttonPosition, width, height).build());
// Add the button to the screen
this.addDrawableChild(builder.build());
} }
} }