Java源码示例:net.minecraft.client.gui.screen.ConnectScreen
示例1
public void init() {
super.init();
reconnectTime = System.currentTimeMillis();
addButton(new ButtonWidget(width / 2 - 100, height / 2 + reasonH / 2 + 35, 200, 20, "Reconnect", (button) -> {
if (server != null) minecraft.openScreen(new ConnectScreen(new MultiplayerScreen(new TitleScreen()), minecraft, server));
}));
addButton(new ButtonWidget(width / 2 - 100, height / 2 + reasonH / 2 + 57, 200, 20,
(getSettings().get(0).toToggle().state ? "§a" : "§c") + "AutoReconnect ["
+ ((reconnectTime + getSettings().get(1).toSlider().getValue() * 1000) - System.currentTimeMillis())
+ "]", (button) -> {
getSettings().get(0).toToggle().state = !getSettings().get(0).toToggle().state;
reconnectTime = System.currentTimeMillis();
}));
}
示例2
public void render(int int_1, int int_2, float float_1) {
super.render(int_1, int_2, float_1);
buttons.get(2).setMessage((getSettings().get(0).toToggle().state ? "§aAutoReconnect ["
+ ((reconnectTime + getSettings().get(1).toSlider().getValue() * 1000) - System.currentTimeMillis())
+ "]" : "§cAutoReconnect [" + getSettings().get(1).toSlider().getValue() * 1000 + "]"));
if (reconnectTime + getSettings().get(1).toSlider().getValue() * 1000 < System.currentTimeMillis() && getSettings().get(0).toToggle().state) {
if (server != null) minecraft.openScreen(new ConnectScreen(new MultiplayerScreen(new TitleScreen()), minecraft, server));
reconnectTime = System.currentTimeMillis();
}
}
示例3
public void init() {
super.init();
reconnectTime = System.currentTimeMillis();
addButton(new ButtonWidget(width / 2 - 100, height / 2 + reasonH / 2 + 35, 200, 20, new LiteralText("Reconnect"), (button) -> {
if (server != null) client.openScreen(new ConnectScreen(new MultiplayerScreen(new TitleScreen()), client, server));
}));
addButton(new ButtonWidget(width / 2 - 100, height / 2 + reasonH / 2 + 57, 200, 20,
new LiteralText((getSettings().get(0).toToggle().state ? "\u00a7a" : "\u00a7c") + "AutoReconnect ["
+ ((reconnectTime + getSettings().get(1).toSlider().getValue() * 1000) - System.currentTimeMillis())
+ "]"), (button) -> {
getSettings().get(0).toToggle().state = !getSettings().get(0).toToggle().state;
reconnectTime = System.currentTimeMillis();
}));
}
示例4
public void render(MatrixStack matrix, int mouseX, int mouseY, float delta) {
super.render(matrix, mouseX, mouseY, delta);
buttons.get(2).setMessage(new LiteralText((getSettings().get(0).toToggle().state ? "\u00a7aAutoReconnect ["
+ ((reconnectTime + getSettings().get(1).toSlider().getValue() * 1000) - System.currentTimeMillis())
+ "]" : "\u00a7cAutoReconnect [" + getSettings().get(1).toSlider().getValue() * 1000 + "]")));
if (reconnectTime + getSettings().get(1).toSlider().getValue() * 1000 < System.currentTimeMillis() && getSettings().get(0).toToggle().state) {
if (server != null) client.openScreen(new ConnectScreen(new MultiplayerScreen(new TitleScreen()), client, server));
reconnectTime = System.currentTimeMillis();
}
}
示例5
public void init() {
super.init();
reconnectTime = System.currentTimeMillis();
addButton(new ButtonWidget(width / 2 - 100, height / 2 + reasonH / 2 + 35, 200, 20, "Reconnect", (button) -> {
if (server != null) minecraft.openScreen(new ConnectScreen(new MultiplayerScreen(new TitleScreen()), minecraft, server));
}));
addButton(new ButtonWidget(width / 2 - 100, height / 2 + reasonH / 2 + 57, 200, 20,
(getSettings().get(0).toToggle().state ? "§a" : "§c") + "AutoReconnect ["
+ ((reconnectTime + getSettings().get(1).toSlider().getValue() * 1000) - System.currentTimeMillis())
+ "]", (button) -> {
getSettings().get(0).toToggle().state = !getSettings().get(0).toToggle().state;
reconnectTime = System.currentTimeMillis();
}));
}
示例6
public void render(int int_1, int int_2, float float_1) {
super.render(int_1, int_2, float_1);
buttons.get(2).setMessage((getSettings().get(0).toToggle().state ? "§aAutoReconnect ["
+ ((reconnectTime + getSettings().get(1).toSlider().getValue() * 1000) - System.currentTimeMillis())
+ "]" : "§cAutoReconnect [" + getSettings().get(1).toSlider().getValue() * 1000 + "]"));
if (reconnectTime + getSettings().get(1).toSlider().getValue() * 1000 < System.currentTimeMillis() && getSettings().get(0).toToggle().state) {
if (server != null) minecraft.openScreen(new ConnectScreen(new MultiplayerScreen(new TitleScreen()), minecraft, server));
reconnectTime = System.currentTimeMillis();
}
}