mirror of
https://github.com/refactorinqq/SLC-1.8.9.git
synced 2024-11-10 09:21:32 +01:00
Fixes
This commit is contained in:
parent
655c37daa8
commit
fba96fa175
@ -6,12 +6,9 @@ import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.gui.GuiScreenServerList;
|
||||
import net.minecraft.client.multiplayer.ServerData;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.silentclient.client.Client;
|
||||
import net.silentclient.client.mixin.accessors.GuiMultiplayerAccessor;
|
||||
import net.silentclient.client.utils.ClientUtils;
|
||||
import net.silentclient.client.mixin.ducks.GuiMultiplayerExt;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
public class GuiMultiplayerInGame extends GuiMultiplayer {
|
||||
|
||||
@ -26,17 +23,9 @@ public class GuiMultiplayerInGame extends GuiMultiplayer {
|
||||
}
|
||||
|
||||
if(button.id == 4) {
|
||||
((GuiMultiplayerAccessor) this).silent$setDirectConnect(true);
|
||||
try {
|
||||
Class<?> clazz = this.getClass();
|
||||
Object cc = clazz.newInstance();
|
||||
Field f1 = cc.getClass().getSuperclass().getDeclaredField(ClientUtils.isDevelopment() ? "selectedServer" : "z");
|
||||
f1.setAccessible(true);
|
||||
f1.set(cc, new ServerData(I18n.format("selectServer.defaultName"), "", false));
|
||||
this.mc.displayGuiScreen(new GuiScreenServerList(this, (ServerData) f1.get(cc)));
|
||||
} catch (Exception err) {
|
||||
Client.logger.catching(err);
|
||||
}
|
||||
((GuiMultiplayerExt) this).silent$setDirectConnect(true);
|
||||
((GuiMultiplayerExt) this).silent$setSelectedServer(new ServerData(I18n.format("selectServer.defaultName"), "", false));
|
||||
this.mc.displayGuiScreen(new GuiScreenServerList(this, new ServerData(I18n.format("selectServer.defaultName"), "", false)));
|
||||
}
|
||||
|
||||
super.actionPerformed(button);
|
||||
@ -53,15 +42,7 @@ public class GuiMultiplayerInGame extends GuiMultiplayer {
|
||||
this.mc.theWorld.sendQuittingDisconnectingPacket();
|
||||
this.mc.loadWorld(null);
|
||||
this.mc.displayGuiScreen(null);
|
||||
try {
|
||||
Class<?> clazz = this.getClass();
|
||||
Object cc = clazz.newInstance();
|
||||
Field f1 = cc.getClass().getSuperclass().getDeclaredField(ClientUtils.isDevelopment() ? "parentScreen" : "g");
|
||||
f1.setAccessible(true);
|
||||
f1.set(cc, null);
|
||||
} catch (Exception err) {
|
||||
Client.logger.catching(err);
|
||||
}
|
||||
((GuiMultiplayerExt) this).silent$setParentScreen(null);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,12 +0,0 @@
|
||||
package net.silentclient.client.mixin.accessors;
|
||||
|
||||
import net.minecraft.client.multiplayer.ServerData;
|
||||
import net.silentclient.client.mixin.wrappers.GuiScreenWrapper;
|
||||
import net.silentclient.client.mixin.wrappers.ServerDataWrapper;
|
||||
|
||||
public interface GuiMultiplayerAccessor {
|
||||
void silent$setParentScreen(GuiScreenWrapper a);
|
||||
void silent$setDirectConnect(boolean a);
|
||||
void silent$setSelectedServer(ServerDataWrapper a);
|
||||
ServerDataWrapper silent$getSelectedServer();
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
package net.silentclient.client.mixin.ducks;
|
||||
|
||||
public interface GuiMultiplayerExt {
|
||||
void silent$setParentScreen(Object a);
|
||||
void silent$setDirectConnect(boolean a);
|
||||
void silent$setSelectedServer(Object a);
|
||||
Object silent$getSelectedServer();
|
||||
}
|
@ -4,15 +4,13 @@ import net.minecraft.client.gui.GuiMultiplayer;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.multiplayer.ServerData;
|
||||
import net.silentclient.client.gui.minecraft.GuiConnecting;
|
||||
import net.silentclient.client.mixin.accessors.GuiMultiplayerAccessor;
|
||||
import net.silentclient.client.mixin.wrappers.GuiScreenWrapper;
|
||||
import net.silentclient.client.mixin.wrappers.ServerDataWrapper;
|
||||
import net.silentclient.client.mixin.ducks.GuiMultiplayerExt;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Overwrite;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
|
||||
@Mixin(GuiMultiplayer.class)
|
||||
public abstract class GuiMultiplayerMixin extends GuiScreen implements GuiMultiplayerAccessor {
|
||||
public abstract class GuiMultiplayerMixin extends GuiScreen implements GuiMultiplayerExt {
|
||||
@Shadow private GuiScreen parentScreen;
|
||||
@Shadow private boolean directConnect;
|
||||
|
||||
@ -28,12 +26,12 @@ public abstract class GuiMultiplayerMixin extends GuiScreen implements GuiMultip
|
||||
}
|
||||
|
||||
@Override
|
||||
public void silent$setParentScreen(GuiScreenWrapper a) {
|
||||
public void silent$setParentScreen(Object a) {
|
||||
if(a == null) {
|
||||
this.parentScreen = null;
|
||||
return;
|
||||
}
|
||||
this.parentScreen = a.getScreen();
|
||||
this.parentScreen = (GuiScreen) a;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -42,16 +40,16 @@ public abstract class GuiMultiplayerMixin extends GuiScreen implements GuiMultip
|
||||
}
|
||||
|
||||
@Override
|
||||
public ServerDataWrapper silent$getSelectedServer() {
|
||||
return new ServerDataWrapper(selectedServer);
|
||||
public Object silent$getSelectedServer() {
|
||||
return selectedServer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void silent$setSelectedServer(ServerDataWrapper a) {
|
||||
public void silent$setSelectedServer(Object a) {
|
||||
if(a == null) {
|
||||
this.selectedServer = null;
|
||||
return;
|
||||
}
|
||||
this.selectedServer = a.getServerData();
|
||||
this.selectedServer = (ServerData) a;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user