Search in sources :

Example 1 with ServerListEntryNormal

use of net.minecraft.client.gui.ServerListEntryNormal in project Almura by AlmuraDev.

the class MixinGuiMultiplayer method onSelectServer.

@Inject(method = "selectServer", at = @At("RETURN"))
public void onSelectServer(int index, CallbackInfo ci) {
    final GuiListExtended.IGuiListEntry entry = index < 0 ? null : this.serverListSelector.getListEntry(index);
    if (entry != null && entry instanceof ServerListEntryNormal) {
        final ServerListEntryNormal serverEntry = (ServerListEntryNormal) entry;
        if (serverEntry.getServerData().serverName.equals(PUBLIC_SERVER_DATA.serverName) && serverEntry.getServerData().serverIP.equals(PUBLIC_SERVER_DATA.serverIP)) {
            this.btnDeleteServer.enabled = false;
            this.btnEditServer.enabled = false;
        } else if (serverEntry.getServerData().serverName.equals(DEV_SERVER_DATA.serverName) && serverEntry.getServerData().serverIP.equals(DEV_SERVER_DATA.serverIP)) {
            this.btnDeleteServer.enabled = false;
            this.btnEditServer.enabled = false;
        }
    }
}
Also used : GuiListExtended(net.minecraft.client.gui.GuiListExtended) ServerListEntryNormal(net.minecraft.client.gui.ServerListEntryNormal) Inject(org.spongepowered.asm.mixin.injection.Inject)

Aggregations

GuiListExtended (net.minecraft.client.gui.GuiListExtended)1 ServerListEntryNormal (net.minecraft.client.gui.ServerListEntryNormal)1 Inject (org.spongepowered.asm.mixin.injection.Inject)1