Fix multiplayer

This commit is contained in:
catfoolyou 2025-05-23 08:52:31 -04:00
parent 76b9b00e06
commit 093271cb36
18 changed files with 8541 additions and 8403 deletions

Binary file not shown.

View File

@ -10,7 +10,7 @@ sourceSets {
java {
srcDirs(
"src/main/java",
"src/lwjgl/java"
"src/teavm/java"
)
}
}
@ -26,7 +26,7 @@ tasks.withType(JavaCompile) {
}
dependencies {
implementation fileTree(dir: './lwjgl-rundir/', include: '*.jar')
//implementation fileTree(dir: './lwjgl-rundir/', include: '*.jar')
teavm(teavm.libs.jso)
teavm(teavm.libs.jsoApis)

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

Binary file not shown.

View File

@ -6,20 +6,20 @@ public class EaglercraftVersion {
/// Customize these to fit your fork:
public static final String projectForkName = "Eaglercraft 1.12";
public static final String projectForkName = "Eaglercraft Beta 1.4_01";
public static final String projectForkVersion = "u0";
public static final String projectForkVendor = "PeytonPlayz585";
public static final String projectForkVendor = "Catfoolyou";
public static final String projectForkURL = "https://github.com/Eaglercraft-1-12/1.12";
public static final String projectForkURL = "";
//////////////////////////////////////////////////////////////////////
public static final String projectOriginName = "Eaglercraft 1.12";
public static final String projectOriginAuthor = "PeytonPlayz585";
public static final String projectOriginVersion = "24w52b";
public static final String projectOriginServerVersion = "u40";
public static final String projectOriginName = "Eaglercraft Beta 1.4_01";
public static final String projectOriginAuthor = "Catfoolyou";
public static final String projectOriginVersion = "25w21b";
public static final String projectOriginServerVersion = "";
public static final String projectOriginURL = "https://github.com/Eaglercraft-1-12/1.12";
public static final String projectOriginURL = "";
// EPK Version Identifier
@ -34,20 +34,8 @@ public class EaglercraftVersion {
// Miscellaneous variables:
public static final String mainMenuStringA = "Minecraft 1.12";
public static final String mainMenuStringB = projectOriginName + " " + projectOriginVersion;
public static final String mainMenuStringC = "";
public static final String mainMenuStringD = "Resources Copyright Mojang AB";
public static final String mainMenuStringE = projectForkName + " " + projectForkVersion;
public static final String mainMenuStringF = "Made by " + projectForkVendor;
public static final long demoWorldSeed = (long) "North Carolina".hashCode();
public static final boolean mainMenuEnableGithubButton = false;
public static final boolean forceDemoMode = false;
public static final String localStorageNamespace = "_eaglercraft_1.12";
public static final String localStorageNamespace = "_eaglercraft_b1.4";
}

View File

@ -21,7 +21,7 @@ public class GuiChat extends GuiScreen {
protected void keyTyped(char var1, int var2) {
if(var2 == 1) {
this.mc.displayGuiScreen((GuiScreen)null);
this.mc.displayGuiScreen(null);
} else if(var2 == 28) {
String var3 = this.message.trim();
if(var3.length() > 0) {
@ -31,16 +31,15 @@ public class GuiChat extends GuiScreen {
}
}
this.mc.displayGuiScreen((GuiScreen)null);
this.mc.displayGuiScreen(null);
} else {
if(var2 == 14 && this.message.length() > 0) {
this.message = this.message.substring(0, this.message.length() - 1);
}
if(field_20082_i.indexOf(var1) >= 0 && this.message.length() < 100) {
if(FontAllowedCharacters.isAllowed(var1) >= 0 && this.message.length() < 100) {
this.message = this.message + var1;
}
}
}

View File

@ -32,10 +32,12 @@ public class GuiConnecting extends GuiScreen {
if(timer > 1) {
if(this.webSocket == null) {
this.webSocket = PlatformNetworking.openWebSocket(this.currentAddress);
System.out.println("opened socket on " + this.currentAddress);
if(this.webSocket == null) {
this.mc.displayGuiScreen(new GuiConnectFailed("connect.failed", "disconnect.genericReason", new Object[] {"Could not open websocket to\"" + this.currentAddress + "\"!"}));
this.mc.displayGuiScreen(new GuiConnectFailed("connect.failed", "disconnect.genericReason", "Could not open websocket to\"" + this.currentAddress + "\"!"));
}
} else {
System.out.println("websocket state " + this.webSocket.getState().toString());
if(this.webSocket.getState() == EnumEaglerConnectionState.CONNECTED) {
if(!this.successful) {
this.clientHandler.netManager.setWebsocketClient(this.webSocket);
@ -46,6 +48,7 @@ public class GuiConnecting extends GuiScreen {
this.clientHandler.processReadPackets();
}
} else if(this.webSocket.getState() == EnumEaglerConnectionState.FAILED) {
System.out.println("fuck");
if(this.webSocket != null) {
this.webSocket.close();
this.webSocket = null;
@ -54,7 +57,7 @@ public class GuiConnecting extends GuiScreen {
currentAddress = currentAddress.replace("ws://", "wss://");
timer = 0;
} else {
this.mc.displayGuiScreen(new GuiConnectFailed("connect.failed", "disconnect.genericReason", new Object[]{"Connection Refused!"}));
this.mc.displayGuiScreen(new GuiConnectFailed("connect.failed", "disconnect.genericReason", "Connection Refused!"));
}
}
}
@ -63,7 +66,7 @@ public class GuiConnecting extends GuiScreen {
this.webSocket.close();
this.webSocket = null;
}
this.mc.displayGuiScreen(new GuiConnectFailed("connect.failed", "disconnect.genericReason", new Object[] {"Connection timed out"}));
this.mc.displayGuiScreen(new GuiConnectFailed("connect.failed", "disconnect.genericReason", "Connection timed out"));
}
}
}

View File

@ -90,7 +90,7 @@ public class GuiMainMenu extends GuiScreen {
this.drawCenteredString(this.fontRenderer, this.splashText, 0, -8, 16776960);
GL11.glPopMatrix();
this.drawString(this.fontRenderer, "Minecraft Beta 1.4_01", 2, 2, 5263440);
this.drawString(this.fontRenderer, "Eaglercraft 25w21a", 2, this.height - 10, 16777215);
this.drawString(this.fontRenderer, "Eaglercraft 25w21b", 2, this.height - 10, 16777215);
this.drawString(this.fontRenderer, "site resources are", this.width - this.fontRenderer.getStringWidth("site resources are") - 2, this.height - 20, 16777215);
this.drawString(this.fontRenderer, "copyright 2010 Mojang AB", this.width - this.fontRenderer.getStringWidth("copyright 2010 Mojang AB") - 2, this.height - 10, 16777215);

View File

@ -39,8 +39,8 @@ public class GuiMultiplayer extends GuiScreen {
String var2 = this.field_22111_h.getText();
this.mc.gameSettings.lastServer = var2.replaceAll(":", "_");
this.mc.gameSettings.saveOptions();
String[] var3 = var2.split(":");
this.mc.displayGuiScreen(new GuiConnecting(this.mc, var3[0]));
System.out.println("connecting to server " + var2);
this.mc.displayGuiScreen(new GuiConnecting(this.mc, var2));
}
}

View File

@ -14,14 +14,14 @@ import net.lax1dude.eaglercraft.internal.IWebSocketFrame;
public class NetworkManager {
private boolean isRunning = true;
private NetHandler netHandler;
private List<Packet> readPackets = new ArrayList<Packet>();
private boolean isServerTerminating = false;
private final NetHandler netHandler;
private final List<Packet> readPackets = new ArrayList<Packet>();
private final boolean isServerTerminating = false;
private boolean isTerminating = false;
private String terminationReason = "";
private Object[] field_20101_t;
private int timeSinceLastRead = 0;
private int sendQueueByteLength = 0;
private final int sendQueueByteLength = 0;
public int chunkDataSendCounter = 0;
public IWebSocketClient webSocket;
@ -34,7 +34,7 @@ public class NetworkManager {
this.webSocket = client;
}
private EaglerOutputStream sendBuffer = new EaglerOutputStream();
private final EaglerOutputStream sendBuffer = new EaglerOutputStream();
public void addToSendQueue(Packet var1) {
if(!this.isServerTerminating) {
@ -54,7 +54,7 @@ public class NetworkManager {
private void onNetworkError(Exception var1) {
var1.printStackTrace();
this.networkShutdown("disconnect.genericReason", new Object[]{"Internal exception: " + var1.toString()});
this.networkShutdown("disconnect.genericReason", "Internal exception: " + var1);
}
public void networkShutdown(String var1, Object... var2) {
@ -84,7 +84,7 @@ public class NetworkManager {
if(pkt != null) {
this.readPackets.add(pkt);
} else {
this.networkShutdown("disconnect.endOfStream", new Object[0]);
this.networkShutdown("disconnect.endOfStream");
}
} catch(IOException e) {
if(!this.isTerminating) {
@ -97,12 +97,12 @@ public class NetworkManager {
public void processReadPackets() {
if(this.sendQueueByteLength > 1048576) {
this.networkShutdown("disconnect.overflow", new Object[0]);
this.networkShutdown("disconnect.overflow");
}
if(this.readPackets.isEmpty()) {
if(this.timeSinceLastRead++ == 1200) {
this.networkShutdown("disconnect.timeout", new Object[0]);
this.networkShutdown("disconnect.timeout");
}
} else {
this.timeSinceLastRead = 0;
@ -111,7 +111,7 @@ public class NetworkManager {
int var1 = 100;
while(!this.readPackets.isEmpty() && var1-- >= 0) {
Packet var2 = (Packet)this.readPackets.remove(0);
Packet var2 = this.readPackets.remove(0);
var2.processPacket(this.netHandler);
}