mirror of
https://github.com/ViaVersion/ViaFabricPlus.git
synced 2025-02-03 23:41:40 +01:00
Add VFPList abstraction layer to globally remove selection highlighting
This commit is contained in:
parent
964d3fbd48
commit
6fa75395d5
@ -0,0 +1,37 @@
|
||||
/*
|
||||
* This file is part of ViaFabricPlus - https://github.com/FlorianMichael/ViaFabricPlus
|
||||
* Copyright (C) 2021-2024 FlorianMichael/EnZaXD <florian.michael07@gmail.com> and RK_01/RaphiMC
|
||||
* Copyright (C) 2023-2024 contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.viafabricplus.screen;
|
||||
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.gui.widget.AlwaysSelectedEntryListWidget;
|
||||
|
||||
public class VFPList<T extends AlwaysSelectedEntryListWidget.Entry<T>> extends AlwaysSelectedEntryListWidget<T> {
|
||||
|
||||
public VFPList(MinecraftClient minecraftClient, int width, int height, int top, int bottom, int entryHeight) {
|
||||
super(minecraftClient, width, height - top - bottom, top, entryHeight);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawSelectionHighlight(DrawContext context, int y, int entryWidth, int entryHeight, int borderColor, int fillColor) {
|
||||
// Remove selection box
|
||||
}
|
||||
|
||||
}
|
@ -20,6 +20,7 @@
|
||||
package de.florianmichael.viafabricplus.screen.base;
|
||||
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.screen.VFPList;
|
||||
import de.florianmichael.viafabricplus.screen.VFPScreen;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.font.TextRenderer;
|
||||
@ -61,10 +62,10 @@ public class PerServerVersionScreen extends VFPScreen {
|
||||
this.renderTitle(context);
|
||||
}
|
||||
|
||||
public class SlotList extends AlwaysSelectedEntryListWidget<SharedSlot> {
|
||||
public class SlotList extends VFPList<SharedSlot> {
|
||||
|
||||
public SlotList(MinecraftClient minecraftClient, int width, int height, int top, int bottom, int entryHeight) {
|
||||
super(minecraftClient, width, height - top - bottom, top, entryHeight);
|
||||
super(minecraftClient, width, height, top, bottom, entryHeight);
|
||||
|
||||
this.addEntry(new ResetSlot());
|
||||
ProtocolVersionList.getProtocolsNewToOld().stream().map(ProtocolSlot::new).forEach(this::addEntry);
|
||||
|
@ -21,6 +21,7 @@ package de.florianmichael.viafabricplus.screen.base;
|
||||
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator;
|
||||
import de.florianmichael.viafabricplus.screen.VFPList;
|
||||
import de.florianmichael.viafabricplus.screen.VFPScreen;
|
||||
import de.florianmichael.viafabricplus.screen.settings.SettingsScreen;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
@ -65,10 +66,10 @@ public class ProtocolSelectionScreen extends VFPScreen {
|
||||
this.renderTitle(context);
|
||||
}
|
||||
|
||||
public static class SlotList extends AlwaysSelectedEntryListWidget<ProtocolSlot> {
|
||||
public static class SlotList extends VFPList<ProtocolSlot> {
|
||||
|
||||
public SlotList(MinecraftClient minecraftClient, int width, int height, int top, int bottom, int entryHeight) {
|
||||
super(minecraftClient, width, height - top - bottom, top, entryHeight);
|
||||
super(minecraftClient, width, height, top, bottom, entryHeight);
|
||||
|
||||
ProtocolVersionList.getProtocolsNewToOld().stream().map(ProtocolSlot::new).forEach(this::addEntry);
|
||||
}
|
||||
|
@ -22,6 +22,7 @@ package de.florianmichael.viafabricplus.screen.classic4j;
|
||||
import de.florianmichael.classic4j.model.betacraft.BCServerInfoSpec;
|
||||
import de.florianmichael.classic4j.model.betacraft.BCServerList;
|
||||
import de.florianmichael.classic4j.model.betacraft.BCVersionCategory;
|
||||
import de.florianmichael.viafabricplus.screen.VFPList;
|
||||
import de.florianmichael.viafabricplus.screen.VFPListEntry;
|
||||
import de.florianmichael.viafabricplus.screen.VFPScreen;
|
||||
import de.florianmichael.viafabricplus.screen.settings.TitleRenderer;
|
||||
@ -30,7 +31,6 @@ import net.minecraft.client.font.TextRenderer;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.gui.screen.ConfirmLinkScreen;
|
||||
import net.minecraft.client.gui.screen.multiplayer.ConnectScreen;
|
||||
import net.minecraft.client.gui.widget.AlwaysSelectedEntryListWidget;
|
||||
import net.minecraft.client.gui.widget.ButtonWidget;
|
||||
import net.minecraft.client.network.ServerAddress;
|
||||
import net.minecraft.client.network.ServerInfo;
|
||||
@ -71,10 +71,10 @@ public class BetaCraftScreen extends VFPScreen {
|
||||
this.renderTitle(context);
|
||||
}
|
||||
|
||||
public static class SlotList extends AlwaysSelectedEntryListWidget<VFPListEntry> {
|
||||
public static class SlotList extends VFPList<VFPListEntry> {
|
||||
|
||||
public SlotList(MinecraftClient minecraftClient, int width, int height, int top, int bottom, int entryHeight) {
|
||||
super(minecraftClient, width, height - top - bottom, top, entryHeight);
|
||||
super(minecraftClient, width, height, top, bottom, entryHeight);
|
||||
if (SERVER_LIST == null) return;
|
||||
|
||||
for (BCVersionCategory value : BCVersionCategory.values()) {
|
||||
|
@ -26,6 +26,7 @@ import de.florianmichael.classic4j.model.classicube.server.CCServerInfo;
|
||||
import de.florianmichael.viafabricplus.ViaFabricPlus;
|
||||
import de.florianmichael.viafabricplus.injection.access.IServerInfo;
|
||||
import de.florianmichael.viafabricplus.protocoltranslator.impl.provider.vialegacy.ViaFabricPlusClassicMPPassProvider;
|
||||
import de.florianmichael.viafabricplus.screen.VFPList;
|
||||
import de.florianmichael.viafabricplus.screen.VFPListEntry;
|
||||
import de.florianmichael.viafabricplus.screen.VFPScreen;
|
||||
import de.florianmichael.viafabricplus.settings.impl.AuthenticationSettings;
|
||||
@ -34,7 +35,6 @@ import net.minecraft.client.font.TextRenderer;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.gui.screen.multiplayer.ConnectScreen;
|
||||
import net.minecraft.client.gui.widget.AlwaysSelectedEntryListWidget;
|
||||
import net.minecraft.client.gui.widget.ButtonWidget;
|
||||
import net.minecraft.client.network.ServerAddress;
|
||||
import net.minecraft.client.network.ServerInfo;
|
||||
@ -96,10 +96,10 @@ public class ClassiCubeServerListScreen extends VFPScreen {
|
||||
}
|
||||
}
|
||||
|
||||
public static class SlotList extends AlwaysSelectedEntryListWidget<VFPListEntry> {
|
||||
public static class SlotList extends VFPList<VFPListEntry> {
|
||||
|
||||
public SlotList(MinecraftClient minecraftClient, int width, int height, int top, int bottom, int entryHeight) {
|
||||
super(minecraftClient, width, height - top - bottom, top, entryHeight);
|
||||
super(minecraftClient, width, height, top, bottom, entryHeight);
|
||||
|
||||
SERVER_LIST.forEach(serverInfo -> this.addEntry(new ServerSlot(serverInfo)));
|
||||
}
|
||||
|
@ -20,13 +20,13 @@
|
||||
package de.florianmichael.viafabricplus.screen.settings;
|
||||
|
||||
import de.florianmichael.viafabricplus.ViaFabricPlus;
|
||||
import de.florianmichael.viafabricplus.screen.VFPList;
|
||||
import de.florianmichael.viafabricplus.screen.VFPListEntry;
|
||||
import de.florianmichael.viafabricplus.screen.VFPScreen;
|
||||
import de.florianmichael.viafabricplus.settings.base.AbstractSetting;
|
||||
import de.florianmichael.viafabricplus.settings.base.SettingGroup;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.gui.widget.AlwaysSelectedEntryListWidget;
|
||||
|
||||
public class SettingsScreen extends VFPScreen {
|
||||
|
||||
@ -52,10 +52,10 @@ public class SettingsScreen extends VFPScreen {
|
||||
this.renderTitle(context);
|
||||
}
|
||||
|
||||
public static class SlotList extends AlwaysSelectedEntryListWidget<VFPListEntry> {
|
||||
public static class SlotList extends VFPList<VFPListEntry> {
|
||||
|
||||
public SlotList(MinecraftClient minecraftClient, int width, int height, int top, int bottom, int entryHeight) {
|
||||
super(minecraftClient, width, height - top - bottom, top, entryHeight);
|
||||
super(minecraftClient, width, height, top, bottom, entryHeight);
|
||||
|
||||
for (SettingGroup group : ViaFabricPlus.global().getSettingsManager().getGroups()) {
|
||||
this.addEntry(new TitleRenderer(group.getName()));
|
||||
|
Loading…
Reference in New Issue
Block a user