made client MP compatible. again, fixed chat

This commit is contained in:
LAX1DUDE 2022-07-29 22:37:01 -07:00
parent aa02e00ca3
commit 9a85b5e696
12 changed files with 26218 additions and 26239 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -18,10 +18,24 @@ public class ChatAllowedCharacters {
* the characters that minecraft can render Strings on screen.
*/
private static String getAllowedCharacters() {
return "!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_'abcdefghijklmnopqrstuvwxyz{|}~\u2302" +
"\u00c7\u00fc\u00e9\u00e2\u00e4\u00e0\u00e5\u00e7\u00ea\u00eb\u00e8\u00ef\u00ee\u00ec\u00c4\u00c5" +
"\u00c9\u00e6\u00c6\u00f4\u00f6\u00f2\u00fb\u00f9\u00ff\u00d6\u00dc\u00f8\u00a3\u00d8\u00d7\u0192" +
"\u00e1\u00ed\u00f3\u00fa\u00f1\u00d1\u00aa\u00ba\u00bf\u00ae\u00ac\u00bd\u00bc\u00a1\u00ab\u00bb";
int[] codePoints = new int[]{
32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,
48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,
64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,
80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,
39,97,98,99,100,101,102,103,104,105,106,107,108,
109,110,111,112,113,114,115,116,117,118,119,120,
121,122,123,124,125,126,8962,199,252,233,226,228,
224,229,231,234,235,232,239,238,236,196,197,201,
230,198,244,246,242,251,249,255,214,220,248,163,
216,215,402,225,237,243,250,241,209,170,186,191,
174,172,189,188,161,171,187
};
char[] chars = new char[codePoints.length];
for(int i = 0; i < codePoints.length; ++i) {
chars[i] = (char)codePoints[i];
}
return new String(chars);
}
public static final boolean isAllowedCharacter(char par0) {

View File

@ -75,7 +75,7 @@ public class Packet56MapChunks extends Packet {
*/
public void writePacketData(DataOutputStream par1DataOutputStream) throws IOException {
par1DataOutputStream.writeShort(this.chunkPostX.length);
par1DataOutputStream.writeInt(this.dataLength);
par1DataOutputStream.writeInt(this.dataLength | 0x10000000);
par1DataOutputStream.writeBoolean(this.skyLightSent);
par1DataOutputStream.write(this.chunkDataBuffer, 0, this.dataLength);

View File

@ -1,47 +0,0 @@
package net.lax1dude.eaglercraft;
import net.minecraft.src.GuiButton;
import net.minecraft.src.GuiScreen;
import net.minecraft.src.GuiSelectWorld;
public class GuiScreenSingleplayerNotice extends GuiScreen {
private GuiScreen mainmenu;
public GuiScreenSingleplayerNotice(GuiScreen mainmenu) {
this.mainmenu = mainmenu;
}
public void initGui() {
this.buttonList.add(new GuiButton(0, this.width / 2 - 100, this.height / 6 + 165, "I Understand"));
}
public void drawScreen(int par1, int par2, float par3) {
this.drawDefaultBackground();
float f = 2.0f;
int top = this.height / 7;
EaglerAdapter.glPushMatrix();
EaglerAdapter.glScalef(f, f, f);
this.drawCenteredString(fontRenderer, "Attention!", this.width / 4, top / 2, 0xFF0000);
EaglerAdapter.glPopMatrix();
this.drawCenteredString(fontRenderer, "singleplayer is still in development", this.width / 2, top + 35, 0xFFCCAA);
this.drawCenteredString(fontRenderer, "there are still bugs and glitches", this.width / 2, top + 50, 0xFFCCAA);
this.drawCenteredString(fontRenderer, "if you run into any issues, DO NOT REPORT", this.width / 2, top + 80, 0xFFCCAA);
this.drawCenteredString(fontRenderer, "NOBODY WANTS TO HEAR YOUR COMPLAINTS", this.width / 2, top + 95, 0xFF5555);
this.drawCenteredString(fontRenderer, "DO NOT OPEN ANY ISSUES ON GitHub", this.width / 2, top + 123, 0xFFCCAA);
this.drawCenteredString(fontRenderer, "DO NOT PING LAX1DUDE OR AYUNAMI", this.width / 2, top + 136, 0xFFCCAA);
this.drawCenteredString(fontRenderer, "DO NOT COMMENT ON YOUTUBE VIDEOS", this.width / 2, top + 149, 0xFFCCAA);
super.drawScreen(par1, par2, par3);
}
protected void actionPerformed(GuiButton par1GuiButton) {
if(par1GuiButton.id == 0) {
IntegratedServer.begin();
this.mc.displayGuiScreen(new GuiScreenSingleplayerLoading(new GuiSelectWorld(mainmenu), "starting up integrated server", () -> IntegratedServer.isReady()));
}
}
}

View File

@ -101,9 +101,10 @@ public class IntegratedServer {
}
public static void unloadWorld() {
ensureWorldReady();
statusState = IntegratedState.WORLD_UNLOADING;
sendIPCPacket(new IPCPacket01StopServer());
if(isWorldRunning()) {
statusState = IntegratedState.WORLD_UNLOADING;
sendIPCPacket(new IPCPacket01StopServer());
}
}
public static void autoSave() {

View File

@ -433,10 +433,10 @@ public class GuiIngame extends Gui {
this.drawString(var8, "Press F+6 to " + (mc.gameSettings.showCoordinates ? "disable" : "enable") + " showing coords in ingame GUI", 2, 135, 0xFFFFFFFF);
if(IntegratedServer.isWorldRunning()) {
this.drawString(var8, "IntegratedServer is running", 2, 106, 14737632);
this.drawString(var8, "IntegratedServer is running", 2, 154, 14737632);
List<String> info = IntegratedServer.getTPS();
for(int i = 0, size = info.size(); i < size; ++i) {
this.drawString(var8, info.get(i), 2, 122 + i * 8, 14737632);
this.drawString(var8, info.get(i), 2, 173 + i * 9, 14737632);
}
}

View File

@ -73,7 +73,9 @@ public class GuiIngameMenu extends GuiScreen {
*/
public void updateScreen() {
super.updateScreen();
voiceMenu.updateScreen();
if(!mc.isSingleplayer()) {
voiceMenu.updateScreen();
}
}
/**
@ -97,12 +99,16 @@ public class GuiIngameMenu extends GuiScreen {
drawString(fontRenderer, "Eaglercraft: " + ConfigConstants.version, 6, 27, 0x999999);
try {
if(voiceMenu.isBlockingInput()) {
super.drawScreen(0, 0, par3);
if(!mc.isSingleplayer()) {
if(voiceMenu.isBlockingInput()) {
super.drawScreen(0, 0, par3);
}else {
super.drawScreen(par1, par2, par3);
}
voiceMenu.drawScreen(par1, par2, par3);
}else {
super.drawScreen(par1, par2, par3);
}
voiceMenu.drawScreen(par1, par2, par3);
}catch(AbortedException ex) {
}
@ -114,7 +120,9 @@ public class GuiIngameMenu extends GuiScreen {
*/
protected void keyTyped(char par1, int par2) {
try {
voiceMenu.keyTyped(par1, par2);
if(!mc.isSingleplayer()) {
voiceMenu.keyTyped(par1, par2);
}
super.keyTyped(par1, par2);
}catch(AbortedException ex) {
}
@ -125,7 +133,9 @@ public class GuiIngameMenu extends GuiScreen {
*/
protected void mouseClicked(int par1, int par2, int par3) {
try {
voiceMenu.mouseClicked(par1, par2, par3);
if(!mc.isSingleplayer()) {
voiceMenu.mouseClicked(par1, par2, par3);
}
super.mouseClicked(par1, par2, par3);
}catch(AbortedException ex) {
}
@ -138,7 +148,9 @@ public class GuiIngameMenu extends GuiScreen {
protected void mouseMovedOrUp(int par1, int par2, int par3) {
try {
voiceMenu.mouseMovedOrUp(par1, par2, par3);
if(!mc.isSingleplayer()) {
voiceMenu.mouseMovedOrUp(par1, par2, par3);
}
super.mouseMovedOrUp(par1, par2, par3);
}catch(AbortedException ex) {
}

View File

@ -9,7 +9,6 @@ import net.lax1dude.eaglercraft.ConfigConstants;
import net.lax1dude.eaglercraft.EaglerAdapter;
import net.lax1dude.eaglercraft.EaglercraftRandom;
import net.lax1dude.eaglercraft.GuiScreenEditProfile;
import net.lax1dude.eaglercraft.GuiScreenSingleplayerNotice;
import net.lax1dude.eaglercraft.GuiScreenSingleplayerLoading;
import net.lax1dude.eaglercraft.IntegratedServer;
import net.lax1dude.eaglercraft.LocalStorageManager;
@ -273,15 +272,11 @@ public class GuiMainMenu extends GuiScreen {
if (par1GuiButton.id == 1) {
if(EaglerAdapter.isIntegratedServerAvailable()) {
if(!hasClickedSingleplayer) {
this.mc.displayGuiScreen(new GuiScreenSingleplayerNotice(this));
if(!IntegratedServer.isAlive()) {
IntegratedServer.begin();
this.mc.displayGuiScreen(new GuiScreenSingleplayerLoading(new GuiSelectWorld(this), "starting up integrated server", () -> IntegratedServer.isReady()));
}else {
if(!IntegratedServer.isAlive()) {
IntegratedServer.begin();
this.mc.displayGuiScreen(new GuiScreenSingleplayerLoading(new GuiSelectWorld(this), "starting up integrated server", () -> IntegratedServer.isReady()));
}else {
this.mc.displayGuiScreen(new GuiSelectWorld(this));
}
this.mc.displayGuiScreen(new GuiSelectWorld(this));
}
hasClickedSingleplayer = true;
}

View File

@ -5,6 +5,8 @@ import java.io.DataOutputStream;
import java.io.IOException;
import java.util.List;
import net.lax1dude.eaglercraft.EaglerInflater;
public class Packet56MapChunks extends Packet {
private int[] chunkPostX;
private int[] chunkPosZ;
@ -44,8 +46,18 @@ public class Packet56MapChunks extends Packet {
this.field_73588_b = new int[var2];
this.field_73584_f = new byte[var2][];
byte[] var3 = new byte[this.dataLength];
par1DataInputStream.readFully(var3, 0, this.dataLength);
byte[] var3;
if((this.dataLength & 0x10000000) == 0x10000000) {
this.dataLength &= 0xFFFFFFF;
var3 = new byte[this.dataLength];
par1DataInputStream.readFully(var3, 0, this.dataLength);
}else {
if (chunkDataNotCompressed.length < this.dataLength) {
chunkDataNotCompressed = new byte[this.dataLength];
}
par1DataInputStream.readFully(chunkDataNotCompressed, 0, this.dataLength);
var3 = EaglerInflater.uncompress(chunkDataNotCompressed);
}
int var5 = 0;