u40
This commit is contained in:
parent
d50d01b735
commit
207270171f
|
@ -158,6 +158,7 @@ The default eaglercraftXOpts values is this:
|
||||||
- `demoMode:` whether to launch the game in java edition demo mode
|
- `demoMode:` whether to launch the game in java edition demo mode
|
||||||
- `servers:` a list of default servers to display on the Multiplayer screen
|
- `servers:` a list of default servers to display on the Multiplayer screen
|
||||||
- `relays:` the default list of shared world relays to use for invites
|
- `relays:` the default list of shared world relays to use for invites
|
||||||
|
- `checkGLErrors:` if the game should check for opengl errors
|
||||||
- `checkShaderGLErrors:` enables more verbose opengl error logging for the shaders
|
- `checkShaderGLErrors:` enables more verbose opengl error logging for the shaders
|
||||||
- `enableDownloadOfflineButton:` whether to show a "Download Offline" button on the title screen
|
- `enableDownloadOfflineButton:` whether to show a "Download Offline" button on the title screen
|
||||||
- `downloadOfflineButtonLink:` overrides the download link for the "Download Offline" button
|
- `downloadOfflineButtonLink:` overrides the download link for the "Download Offline" button
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
u39
|
u40
|
|
@ -48,6 +48,7 @@
|
||||||
"autoFixLegacyStyleAttr": true,
|
"autoFixLegacyStyleAttr": true,
|
||||||
"allowUpdateDL": true,
|
"allowUpdateDL": true,
|
||||||
"logInvalidCerts": false,
|
"logInvalidCerts": false,
|
||||||
|
"checkGLErrors": false,
|
||||||
"checkShaderGLErrors": false,
|
"checkShaderGLErrors": false,
|
||||||
"crashOnUncaughtExceptions": false,
|
"crashOnUncaughtExceptions": false,
|
||||||
"forceWebGL1": false,
|
"forceWebGL1": false,
|
||||||
|
|
|
@ -48,6 +48,7 @@
|
||||||
"autoFixLegacyStyleAttr": true,
|
"autoFixLegacyStyleAttr": true,
|
||||||
"allowUpdateDL": true,
|
"allowUpdateDL": true,
|
||||||
"logInvalidCerts": false,
|
"logInvalidCerts": false,
|
||||||
|
"checkGLErrors": false,
|
||||||
"checkShaderGLErrors": false,
|
"checkShaderGLErrors": false,
|
||||||
"crashOnUncaughtExceptions": false,
|
"crashOnUncaughtExceptions": false,
|
||||||
"forceWebGL1": false,
|
"forceWebGL1": false,
|
||||||
|
|
|
@ -48,6 +48,7 @@
|
||||||
"autoFixLegacyStyleAttr": true,
|
"autoFixLegacyStyleAttr": true,
|
||||||
"allowUpdateDL": true,
|
"allowUpdateDL": true,
|
||||||
"logInvalidCerts": false,
|
"logInvalidCerts": false,
|
||||||
|
"checkGLErrors": false,
|
||||||
"checkShaderGLErrors": false,
|
"checkShaderGLErrors": false,
|
||||||
"crashOnUncaughtExceptions": false,
|
"crashOnUncaughtExceptions": false,
|
||||||
"forceWebGL1": false,
|
"forceWebGL1": false,
|
||||||
|
|
Binary file not shown.
|
@ -1 +1 @@
|
||||||
{"pluginName":"EaglercraftXBungee","pluginVersion":"1.3.1","pluginButton":"Download \"EaglerXBungee-1.3.1.jar\"","pluginFilename":"EaglerXBungee.zip"}
|
{"pluginName":"EaglercraftXBungee","pluginVersion":"1.3.2","pluginButton":"Download \"EaglerXBungee-1.3.2.jar\"","pluginFilename":"EaglerXBungee.zip"}
|
|
@ -195,13 +195,6 @@ public class LoadingScreenRenderer implements IProgressUpdate {
|
||||||
(float) (l / 2 - 4 + 8), 16777215);
|
(float) (l / 2 - 4 + 8), 16777215);
|
||||||
}
|
}
|
||||||
this.mc.updateDisplay();
|
this.mc.updateDisplay();
|
||||||
|
|
||||||
try {
|
|
||||||
Thread.yield();
|
|
||||||
} catch (Exception var15) {
|
|
||||||
;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,6 @@ import net.lax1dude.eaglercraft.v1_8.PauseMenuCustomizeState;
|
||||||
import net.lax1dude.eaglercraft.v1_8.PointerInputAbstraction;
|
import net.lax1dude.eaglercraft.v1_8.PointerInputAbstraction;
|
||||||
import net.lax1dude.eaglercraft.v1_8.Touch;
|
import net.lax1dude.eaglercraft.v1_8.Touch;
|
||||||
import net.lax1dude.eaglercraft.v1_8.cookie.ServerCookieDataStore;
|
import net.lax1dude.eaglercraft.v1_8.cookie.ServerCookieDataStore;
|
||||||
import net.lax1dude.eaglercraft.v1_8.internal.PlatformInput;
|
|
||||||
|
|
||||||
import org.apache.commons.lang3.Validate;
|
import org.apache.commons.lang3.Validate;
|
||||||
|
|
||||||
|
@ -228,7 +227,7 @@ public class Minecraft implements IThreadListener {
|
||||||
private static Minecraft theMinecraft;
|
private static Minecraft theMinecraft;
|
||||||
public PlayerControllerMP playerController;
|
public PlayerControllerMP playerController;
|
||||||
private boolean fullscreen;
|
private boolean fullscreen;
|
||||||
private boolean enableGLErrorChecking = true;
|
private boolean enableGLErrorChecking = false;
|
||||||
private boolean hasCrashed;
|
private boolean hasCrashed;
|
||||||
private CrashReport crashReporter;
|
private CrashReport crashReporter;
|
||||||
public int displayWidth;
|
public int displayWidth;
|
||||||
|
@ -271,7 +270,7 @@ public class Minecraft implements IThreadListener {
|
||||||
long systemTime = getSystemTime();
|
long systemTime = getSystemTime();
|
||||||
private int joinPlayerCounter;
|
private int joinPlayerCounter;
|
||||||
public final FrameTimer field_181542_y = new FrameTimer();
|
public final FrameTimer field_181542_y = new FrameTimer();
|
||||||
long field_181543_z = System.nanoTime();
|
long field_181543_z = EagRuntime.nanoTime();
|
||||||
private final boolean jvm64bit;
|
private final boolean jvm64bit;
|
||||||
private EaglercraftNetworkManager myNetworkManager;
|
private EaglercraftNetworkManager myNetworkManager;
|
||||||
private boolean integratedServerIsRunning;
|
private boolean integratedServerIsRunning;
|
||||||
|
@ -347,6 +346,7 @@ public class Minecraft implements IThreadListener {
|
||||||
this.tempDisplayHeight = gameConfig.displayInfo.height;
|
this.tempDisplayHeight = gameConfig.displayInfo.height;
|
||||||
this.fullscreen = gameConfig.displayInfo.fullscreen;
|
this.fullscreen = gameConfig.displayInfo.fullscreen;
|
||||||
this.jvm64bit = isJvm64bit();
|
this.jvm64bit = isJvm64bit();
|
||||||
|
this.enableGLErrorChecking = EagRuntime.getConfiguration().isCheckGLErrors();
|
||||||
String serverToJoin = EagRuntime.getConfiguration().getServerToJoin();
|
String serverToJoin = EagRuntime.getConfiguration().getServerToJoin();
|
||||||
if (serverToJoin != null) {
|
if (serverToJoin != null) {
|
||||||
ServerAddress addr = AddressResolver.resolveAddressFromURI(serverToJoin);
|
ServerAddress addr = AddressResolver.resolveAddressFromURI(serverToJoin);
|
||||||
|
@ -795,14 +795,14 @@ public class Minecraft implements IThreadListener {
|
||||||
if (SingleplayerServerController.isWorldRunning()) {
|
if (SingleplayerServerController.isWorldRunning()) {
|
||||||
SingleplayerServerController.shutdownEaglercraftServer();
|
SingleplayerServerController.shutdownEaglercraftServer();
|
||||||
while (SingleplayerServerController.getStatusState() == IntegratedServerState.WORLD_UNLOADING) {
|
while (SingleplayerServerController.getStatusState() == IntegratedServerState.WORLD_UNLOADING) {
|
||||||
EagUtils.sleep(50l);
|
EagUtils.sleep(50);
|
||||||
SingleplayerServerController.runTick();
|
SingleplayerServerController.runTick();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (SingleplayerServerController.isIntegratedServerWorkerAlive()
|
if (SingleplayerServerController.isIntegratedServerWorkerAlive()
|
||||||
&& SingleplayerServerController.canKillWorker()) {
|
&& SingleplayerServerController.canKillWorker()) {
|
||||||
SingleplayerServerController.killWorker();
|
SingleplayerServerController.killWorker();
|
||||||
EagUtils.sleep(50l);
|
EagUtils.sleep(50);
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
EagRuntime.destroy();
|
EagRuntime.destroy();
|
||||||
|
@ -817,7 +817,7 @@ public class Minecraft implements IThreadListener {
|
||||||
* Called repeatedly from run()
|
* Called repeatedly from run()
|
||||||
*/
|
*/
|
||||||
private void runGameLoop() throws IOException {
|
private void runGameLoop() throws IOException {
|
||||||
long i = System.nanoTime();
|
long i = EagRuntime.nanoTime();
|
||||||
if (Display.isCloseRequested()) {
|
if (Display.isCloseRequested()) {
|
||||||
this.shutdown();
|
this.shutdown();
|
||||||
}
|
}
|
||||||
|
@ -839,26 +839,16 @@ public class Minecraft implements IThreadListener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
long l = System.nanoTime();
|
long l = EagRuntime.nanoTime();
|
||||||
|
|
||||||
if (this.timer.elapsedTicks > 1) {
|
for (int j = 0; j < this.timer.elapsedTicks; ++j) {
|
||||||
long watchdog = EagRuntime.steadyTimeMillis();
|
|
||||||
for (int j = 0; j < this.timer.elapsedTicks; ++j) {
|
|
||||||
this.runTick();
|
|
||||||
if (j < this.timer.elapsedTicks - 1) {
|
|
||||||
PointerInputAbstraction.runGameLoop();
|
|
||||||
}
|
|
||||||
long millis = EagRuntime.steadyTimeMillis();
|
|
||||||
if (millis - watchdog > 50l) {
|
|
||||||
watchdog = millis;
|
|
||||||
EagRuntime.immediateContinue();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (this.timer.elapsedTicks == 1) {
|
|
||||||
this.runTick();
|
this.runTick();
|
||||||
|
if (j < this.timer.elapsedTicks - 1) {
|
||||||
|
PointerInputAbstraction.runGameLoop();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
long i1 = System.nanoTime() - l;
|
long i1 = EagRuntime.nanoTime() - l;
|
||||||
this.checkGLError("Pre render");
|
this.checkGLError("Pre render");
|
||||||
this.mcSoundHandler.setListener(this.thePlayer, this.timer.renderPartialTicks);
|
this.mcSoundHandler.setListener(this.thePlayer, this.timer.renderPartialTicks);
|
||||||
|
|
||||||
|
@ -887,7 +877,7 @@ public class Minecraft implements IThreadListener {
|
||||||
this.checkGLError("Post render");
|
this.checkGLError("Post render");
|
||||||
|
|
||||||
++this.fpsCounter;
|
++this.fpsCounter;
|
||||||
long k = System.nanoTime();
|
long k = EagRuntime.nanoTime();
|
||||||
this.field_181542_y.func_181747_a(k - this.field_181543_z);
|
this.field_181542_y.func_181747_a(k - this.field_181543_z);
|
||||||
this.field_181543_z = k;
|
this.field_181543_z = k;
|
||||||
|
|
||||||
|
@ -906,9 +896,9 @@ public class Minecraft implements IThreadListener {
|
||||||
this.fpsCounter = 0;
|
this.fpsCounter = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.isFramerateLimitBelowMax()) {
|
// if (this.isFramerateLimitBelowMax()) {
|
||||||
Display.sync(this.getLimitFramerate());
|
// Display.sync(this.getLimitFramerate());
|
||||||
}
|
// }
|
||||||
|
|
||||||
Mouse.tickCursorShape();
|
Mouse.tickCursorShape();
|
||||||
}
|
}
|
||||||
|
@ -919,7 +909,11 @@ public class Minecraft implements IThreadListener {
|
||||||
} else {
|
} else {
|
||||||
this.gameSettings.enableVsync = false;
|
this.gameSettings.enableVsync = false;
|
||||||
}
|
}
|
||||||
Display.update();
|
if (!this.gameSettings.enableVsync && this.isFramerateLimitBelowMax()) {
|
||||||
|
Display.update(this.getLimitFramerate());
|
||||||
|
} else {
|
||||||
|
Display.update(0);
|
||||||
|
}
|
||||||
this.checkWindowResize();
|
this.checkWindowResize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1388,7 +1382,7 @@ public class Minecraft implements IThreadListener {
|
||||||
|
|
||||||
while (Keyboard.next()) {
|
while (Keyboard.next()) {
|
||||||
int k = Keyboard.getEventKey() == 0 ? Keyboard.getEventCharacter() + 256 : Keyboard.getEventKey();
|
int k = Keyboard.getEventKey() == 0 ? Keyboard.getEventCharacter() + 256 : Keyboard.getEventKey();
|
||||||
if (k == 0x1D && (areKeysLocked() || isFullScreen())) {
|
if (k == 0x1D && (Keyboard.areKeysLocked() || isFullScreen())) {
|
||||||
KeyBinding.setKeyBindState(gameSettings.keyBindSprint.getKeyCode(), Keyboard.getEventKeyState());
|
KeyBinding.setKeyBindState(gameSettings.keyBindSprint.getKeyCode(), Keyboard.getEventKeyState());
|
||||||
}
|
}
|
||||||
KeyBinding.setKeyBindState(k, Keyboard.getEventKeyState());
|
KeyBinding.setKeyBindState(k, Keyboard.getEventKeyState());
|
||||||
|
@ -2413,10 +2407,6 @@ public class Minecraft implements IThreadListener {
|
||||||
return EaglercraftGPU.glGetInteger(GL_MAX_TEXTURE_SIZE);
|
return EaglercraftGPU.glGetInteger(GL_MAX_TEXTURE_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean areKeysLocked() {
|
|
||||||
return PlatformInput.lockKeys;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ModelManager getModelManager() {
|
public ModelManager getModelManager() {
|
||||||
return modelManager;
|
return modelManager;
|
||||||
}
|
}
|
||||||
|
|
|
@ -122,7 +122,7 @@ public class GuiChat extends GuiScreenVisualViewport {
|
||||||
* on the key), keyCode (lwjgl Keyboard key code)
|
* on the key), keyCode (lwjgl Keyboard key code)
|
||||||
*/
|
*/
|
||||||
protected void keyTyped(char parChar1, int parInt1) {
|
protected void keyTyped(char parChar1, int parInt1) {
|
||||||
if (parInt1 == 1 && (this.mc.gameSettings.keyBindClose.getKeyCode() == 0 || this.mc.areKeysLocked())) {
|
if (parInt1 == 1 && (this.mc.gameSettings.keyBindClose.getKeyCode() == 0 || Keyboard.areKeysLocked())) {
|
||||||
this.mc.displayGuiScreen((GuiScreen) null);
|
this.mc.displayGuiScreen((GuiScreen) null);
|
||||||
} else {
|
} else {
|
||||||
this.waitingOnAutocomplete = false;
|
this.waitingOnAutocomplete = false;
|
||||||
|
|
|
@ -14,7 +14,7 @@ import net.lax1dude.eaglercraft.v1_8.sp.gui.GuiShareToLan;
|
||||||
import net.lax1dude.eaglercraft.v1_8.sp.lan.LANServerController;
|
import net.lax1dude.eaglercraft.v1_8.sp.lan.LANServerController;
|
||||||
import net.lax1dude.eaglercraft.v1_8.update.GuiUpdateCheckerOverlay;
|
import net.lax1dude.eaglercraft.v1_8.update.GuiUpdateCheckerOverlay;
|
||||||
import net.lax1dude.eaglercraft.v1_8.voice.GuiVoiceMenu;
|
import net.lax1dude.eaglercraft.v1_8.voice.GuiVoiceMenu;
|
||||||
import net.lax1dude.eaglercraft.v1_8.webview.GuiScreenPhishingWaring;
|
import net.lax1dude.eaglercraft.v1_8.webview.GuiScreenPhishingWarning;
|
||||||
import net.lax1dude.eaglercraft.v1_8.webview.GuiScreenRecieveServerInfo;
|
import net.lax1dude.eaglercraft.v1_8.webview.GuiScreenRecieveServerInfo;
|
||||||
import net.lax1dude.eaglercraft.v1_8.webview.GuiScreenServerInfo;
|
import net.lax1dude.eaglercraft.v1_8.webview.GuiScreenServerInfo;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
|
@ -191,8 +191,8 @@ public class GuiIngameMenu extends GuiScreen {
|
||||||
if (PauseMenuCustomizeState.serverInfoURL != null) {
|
if (PauseMenuCustomizeState.serverInfoURL != null) {
|
||||||
GuiScreen screen = GuiScreenServerInfo.createForCurrentState(this,
|
GuiScreen screen = GuiScreenServerInfo.createForCurrentState(this,
|
||||||
PauseMenuCustomizeState.serverInfoURL);
|
PauseMenuCustomizeState.serverInfoURL);
|
||||||
if (!this.mc.gameSettings.hasHiddenPhishWarning && !GuiScreenPhishingWaring.hasShownMessage) {
|
if (!this.mc.gameSettings.hasHiddenPhishWarning && !GuiScreenPhishingWarning.hasShownMessage) {
|
||||||
screen = new GuiScreenPhishingWaring(screen);
|
screen = new GuiScreenPhishingWarning(screen);
|
||||||
}
|
}
|
||||||
this.mc.displayGuiScreen(screen);
|
this.mc.displayGuiScreen(screen);
|
||||||
}
|
}
|
||||||
|
@ -200,8 +200,8 @@ public class GuiIngameMenu extends GuiScreen {
|
||||||
case PauseMenuCustomizeState.SERVER_INFO_MODE_SHOW_EMBED_OVER_WS:
|
case PauseMenuCustomizeState.SERVER_INFO_MODE_SHOW_EMBED_OVER_WS:
|
||||||
if (PauseMenuCustomizeState.serverInfoHash != null) {
|
if (PauseMenuCustomizeState.serverInfoHash != null) {
|
||||||
GuiScreen screen = new GuiScreenRecieveServerInfo(this, PauseMenuCustomizeState.serverInfoHash);
|
GuiScreen screen = new GuiScreenRecieveServerInfo(this, PauseMenuCustomizeState.serverInfoHash);
|
||||||
if (!this.mc.gameSettings.hasHiddenPhishWarning && !GuiScreenPhishingWaring.hasShownMessage) {
|
if (!this.mc.gameSettings.hasHiddenPhishWarning && !GuiScreenPhishingWarning.hasShownMessage) {
|
||||||
screen = new GuiScreenPhishingWaring(screen);
|
screen = new GuiScreenPhishingWarning(screen);
|
||||||
}
|
}
|
||||||
this.mc.displayGuiScreen(screen);
|
this.mc.displayGuiScreen(screen);
|
||||||
}
|
}
|
||||||
|
|
|
@ -166,8 +166,8 @@ public abstract class GuiScreen extends Gui implements GuiYesNoCallback {
|
||||||
if (!canCloseGui())
|
if (!canCloseGui())
|
||||||
return;
|
return;
|
||||||
if (((this.mc.theWorld == null || this.mc.thePlayer.getHealth() <= 0.0F) && parInt1 == 1)
|
if (((this.mc.theWorld == null || this.mc.thePlayer.getHealth() <= 0.0F) && parInt1 == 1)
|
||||||
|| parInt1 == this.mc.gameSettings.keyBindClose.getKeyCode()
|
|| parInt1 == this.mc.gameSettings.keyBindClose.getKeyCode() || (parInt1 == 1
|
||||||
|| (parInt1 == 1 && (this.mc.gameSettings.keyBindClose.getKeyCode() == 0 || this.mc.areKeysLocked()))) {
|
&& (this.mc.gameSettings.keyBindClose.getKeyCode() == 0 || Keyboard.areKeysLocked()))) {
|
||||||
this.mc.displayGuiScreen((GuiScreen) null);
|
this.mc.displayGuiScreen((GuiScreen) null);
|
||||||
if (this.mc.currentScreen == null) {
|
if (this.mc.currentScreen == null) {
|
||||||
this.mc.setIngameFocus();
|
this.mc.setIngameFocus();
|
||||||
|
|
|
@ -592,8 +592,8 @@ public abstract class GuiContainer extends GuiScreen {
|
||||||
*/
|
*/
|
||||||
protected void keyTyped(char parChar1, int parInt1) {
|
protected void keyTyped(char parChar1, int parInt1) {
|
||||||
if (parInt1 == this.mc.gameSettings.keyBindClose.getKeyCode()
|
if (parInt1 == this.mc.gameSettings.keyBindClose.getKeyCode()
|
||||||
|| parInt1 == this.mc.gameSettings.keyBindInventory.getKeyCode()
|
|| parInt1 == this.mc.gameSettings.keyBindInventory.getKeyCode() || (parInt1 == 1
|
||||||
|| (parInt1 == 1 && (this.mc.gameSettings.keyBindClose.getKeyCode() == 0 || this.mc.areKeysLocked()))) {
|
&& (this.mc.gameSettings.keyBindClose.getKeyCode() == 0 || Keyboard.areKeysLocked()))) {
|
||||||
this.mc.thePlayer.closeScreen();
|
this.mc.thePlayer.closeScreen();
|
||||||
if (this.mc.currentScreen == null) {
|
if (this.mc.currentScreen == null) {
|
||||||
this.mc.setIngameFocus();
|
this.mc.setIngameFocus();
|
||||||
|
|
|
@ -284,7 +284,7 @@ public class GuiContainerCreative extends InventoryEffectRenderer {
|
||||||
this.searchField.setText("");
|
this.searchField.setText("");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (parInt1 == getCloseKey() || (parInt1 == 1 && this.mc.areKeysLocked())) {
|
if (parInt1 == getCloseKey() || (parInt1 == 1 && Keyboard.areKeysLocked())) {
|
||||||
mc.displayGuiScreen(null);
|
mc.displayGuiScreen(null);
|
||||||
} else if (!this.checkHotbarKeys(parInt1)) {
|
} else if (!this.checkHotbarKeys(parInt1)) {
|
||||||
if (this.searchField.textboxKeyTyped(parChar1, parInt1)) {
|
if (this.searchField.textboxKeyTyped(parChar1, parInt1)) {
|
||||||
|
|
|
@ -25,7 +25,7 @@ import net.minecraft.util.Session;
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class Main {
|
public class Main {
|
||||||
public static void appMain(String[] astring) {
|
public static void appMain() {
|
||||||
System.setProperty("java.net.preferIPv6Addresses", "true");
|
System.setProperty("java.net.preferIPv6Addresses", "true");
|
||||||
GameConfiguration gameconfiguration = new GameConfiguration(
|
GameConfiguration gameconfiguration = new GameConfiguration(
|
||||||
new GameConfiguration.UserInformation(new Session()),
|
new GameConfiguration.UserInformation(new Session()),
|
||||||
|
|
|
@ -924,10 +924,10 @@ public class EntityRenderer implements IResourceManagerReloadListener {
|
||||||
if (this.mc.theWorld != null) {
|
if (this.mc.theWorld != null) {
|
||||||
int i = Math.min(Minecraft.getDebugFPS(), l1);
|
int i = Math.min(Minecraft.getDebugFPS(), l1);
|
||||||
i = Math.max(i, 60);
|
i = Math.max(i, 60);
|
||||||
long j = System.nanoTime() - parLong1;
|
long j = EagRuntime.nanoTime() - parLong1;
|
||||||
long k = Math.max((long) (1000000000 / i / 4) - j, 0L);
|
long k = Math.max((long) (1000000000 / i / 4) - j, 0L);
|
||||||
this.renderWorld(parFloat1, System.nanoTime() + k);
|
this.renderWorld(parFloat1, EagRuntime.nanoTime() + k);
|
||||||
this.renderEndNanoTime = System.nanoTime();
|
this.renderEndNanoTime = EagRuntime.nanoTime();
|
||||||
final boolean b = !this.mc.gameSettings.hideGUI || this.mc.currentScreen != null;
|
final boolean b = !this.mc.gameSettings.hideGUI || this.mc.currentScreen != null;
|
||||||
if (b) {
|
if (b) {
|
||||||
GlStateManager.alphaFunc(GL_GREATER, 0.1F);
|
GlStateManager.alphaFunc(GL_GREATER, 0.1F);
|
||||||
|
@ -983,7 +983,7 @@ public class EntityRenderer implements IResourceManagerReloadListener {
|
||||||
GlStateManager.matrixMode(GL_MODELVIEW);
|
GlStateManager.matrixMode(GL_MODELVIEW);
|
||||||
GlStateManager.loadIdentity();
|
GlStateManager.loadIdentity();
|
||||||
this.setupOverlayRendering();
|
this.setupOverlayRendering();
|
||||||
this.renderEndNanoTime = System.nanoTime();
|
this.renderEndNanoTime = EagRuntime.nanoTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.mc.notifRenderer.renderOverlay(j1, k1);
|
this.mc.notifRenderer.renderOverlay(j1, k1);
|
||||||
|
|
|
@ -6,6 +6,8 @@ import com.google.common.collect.Maps;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
import net.minecraft.network.handshake.client.C00Handshake;
|
import net.minecraft.network.handshake.client.C00Handshake;
|
||||||
import net.minecraft.network.login.client.C00PacketLoginStart;
|
import net.minecraft.network.login.client.C00PacketLoginStart;
|
||||||
import net.minecraft.network.login.client.C01PacketEncryptionResponse;
|
import net.minecraft.network.login.client.C01PacketEncryptionResponse;
|
||||||
|
@ -132,121 +134,179 @@ import net.lax1dude.eaglercraft.v1_8.log4j.LogManager;
|
||||||
public enum EnumConnectionState {
|
public enum EnumConnectionState {
|
||||||
HANDSHAKING(-1) {
|
HANDSHAKING(-1) {
|
||||||
{
|
{
|
||||||
this.registerPacket(EnumPacketDirection.SERVERBOUND, C00Handshake.class);
|
this.registerPacket(EnumPacketDirection.SERVERBOUND, C00Handshake.class, C00Handshake::new);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
PLAY(0) {
|
PLAY(0) {
|
||||||
{
|
{
|
||||||
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S00PacketKeepAlive.class);
|
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S00PacketKeepAlive.class, S00PacketKeepAlive::new);
|
||||||
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S01PacketJoinGame.class);
|
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S01PacketJoinGame.class, S01PacketJoinGame::new);
|
||||||
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S02PacketChat.class);
|
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S02PacketChat.class, S02PacketChat::new);
|
||||||
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S03PacketTimeUpdate.class);
|
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S03PacketTimeUpdate.class, S03PacketTimeUpdate::new);
|
||||||
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S04PacketEntityEquipment.class);
|
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S04PacketEntityEquipment.class,
|
||||||
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S05PacketSpawnPosition.class);
|
S04PacketEntityEquipment::new);
|
||||||
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S06PacketUpdateHealth.class);
|
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S05PacketSpawnPosition.class,
|
||||||
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S07PacketRespawn.class);
|
S05PacketSpawnPosition::new);
|
||||||
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S08PacketPlayerPosLook.class);
|
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S06PacketUpdateHealth.class,
|
||||||
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S09PacketHeldItemChange.class);
|
S06PacketUpdateHealth::new);
|
||||||
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S0APacketUseBed.class);
|
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S07PacketRespawn.class, S07PacketRespawn::new);
|
||||||
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S0BPacketAnimation.class);
|
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S08PacketPlayerPosLook.class,
|
||||||
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S0CPacketSpawnPlayer.class);
|
S08PacketPlayerPosLook::new);
|
||||||
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S0DPacketCollectItem.class);
|
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S09PacketHeldItemChange.class,
|
||||||
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S0EPacketSpawnObject.class);
|
S09PacketHeldItemChange::new);
|
||||||
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S0FPacketSpawnMob.class);
|
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S0APacketUseBed.class, S0APacketUseBed::new);
|
||||||
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S10PacketSpawnPainting.class);
|
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S0BPacketAnimation.class, S0BPacketAnimation::new);
|
||||||
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S11PacketSpawnExperienceOrb.class);
|
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S0CPacketSpawnPlayer.class, S0CPacketSpawnPlayer::new);
|
||||||
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S12PacketEntityVelocity.class);
|
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S0DPacketCollectItem.class, S0DPacketCollectItem::new);
|
||||||
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S13PacketDestroyEntities.class);
|
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S0EPacketSpawnObject.class, S0EPacketSpawnObject::new);
|
||||||
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S14PacketEntity.class);
|
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S0FPacketSpawnMob.class, S0FPacketSpawnMob::new);
|
||||||
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S14PacketEntity.S15PacketEntityRelMove.class);
|
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S10PacketSpawnPainting.class,
|
||||||
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S14PacketEntity.S16PacketEntityLook.class);
|
S10PacketSpawnPainting::new);
|
||||||
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S14PacketEntity.S17PacketEntityLookMove.class);
|
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S11PacketSpawnExperienceOrb.class,
|
||||||
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S18PacketEntityTeleport.class);
|
S11PacketSpawnExperienceOrb::new);
|
||||||
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S19PacketEntityHeadLook.class);
|
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S12PacketEntityVelocity.class,
|
||||||
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S19PacketEntityStatus.class);
|
S12PacketEntityVelocity::new);
|
||||||
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S1BPacketEntityAttach.class);
|
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S13PacketDestroyEntities.class,
|
||||||
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S1CPacketEntityMetadata.class);
|
S13PacketDestroyEntities::new);
|
||||||
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S1DPacketEntityEffect.class);
|
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S14PacketEntity.class, S14PacketEntity::new);
|
||||||
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S1EPacketRemoveEntityEffect.class);
|
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S14PacketEntity.S15PacketEntityRelMove.class,
|
||||||
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S1FPacketSetExperience.class);
|
S14PacketEntity.S15PacketEntityRelMove::new);
|
||||||
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S20PacketEntityProperties.class);
|
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S14PacketEntity.S16PacketEntityLook.class,
|
||||||
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S21PacketChunkData.class);
|
S14PacketEntity.S16PacketEntityLook::new);
|
||||||
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S22PacketMultiBlockChange.class);
|
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S14PacketEntity.S17PacketEntityLookMove.class,
|
||||||
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S23PacketBlockChange.class);
|
S14PacketEntity.S17PacketEntityLookMove::new);
|
||||||
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S24PacketBlockAction.class);
|
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S18PacketEntityTeleport.class,
|
||||||
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S25PacketBlockBreakAnim.class);
|
S18PacketEntityTeleport::new);
|
||||||
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S26PacketMapChunkBulk.class);
|
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S19PacketEntityHeadLook.class,
|
||||||
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S27PacketExplosion.class);
|
S19PacketEntityHeadLook::new);
|
||||||
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S28PacketEffect.class);
|
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S19PacketEntityStatus.class,
|
||||||
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S29PacketSoundEffect.class);
|
S19PacketEntityStatus::new);
|
||||||
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S2APacketParticles.class);
|
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S1BPacketEntityAttach.class,
|
||||||
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S2BPacketChangeGameState.class);
|
S1BPacketEntityAttach::new);
|
||||||
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S2CPacketSpawnGlobalEntity.class);
|
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S1CPacketEntityMetadata.class,
|
||||||
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S2DPacketOpenWindow.class);
|
S1CPacketEntityMetadata::new);
|
||||||
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S2EPacketCloseWindow.class);
|
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S1DPacketEntityEffect.class,
|
||||||
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S2FPacketSetSlot.class);
|
S1DPacketEntityEffect::new);
|
||||||
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S30PacketWindowItems.class);
|
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S1EPacketRemoveEntityEffect.class,
|
||||||
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S31PacketWindowProperty.class);
|
S1EPacketRemoveEntityEffect::new);
|
||||||
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S32PacketConfirmTransaction.class);
|
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S1FPacketSetExperience.class,
|
||||||
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S33PacketUpdateSign.class);
|
S1FPacketSetExperience::new);
|
||||||
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S34PacketMaps.class);
|
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S20PacketEntityProperties.class,
|
||||||
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S35PacketUpdateTileEntity.class);
|
S20PacketEntityProperties::new);
|
||||||
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S36PacketSignEditorOpen.class);
|
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S21PacketChunkData.class, S21PacketChunkData::new);
|
||||||
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S37PacketStatistics.class);
|
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S22PacketMultiBlockChange.class,
|
||||||
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S38PacketPlayerListItem.class);
|
S22PacketMultiBlockChange::new);
|
||||||
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S39PacketPlayerAbilities.class);
|
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S23PacketBlockChange.class, S23PacketBlockChange::new);
|
||||||
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S3APacketTabComplete.class);
|
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S24PacketBlockAction.class, S24PacketBlockAction::new);
|
||||||
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S3BPacketScoreboardObjective.class);
|
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S25PacketBlockBreakAnim.class,
|
||||||
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S3CPacketUpdateScore.class);
|
S25PacketBlockBreakAnim::new);
|
||||||
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S3DPacketDisplayScoreboard.class);
|
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S26PacketMapChunkBulk.class,
|
||||||
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S3EPacketTeams.class);
|
S26PacketMapChunkBulk::new);
|
||||||
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S3FPacketCustomPayload.class);
|
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S27PacketExplosion.class, S27PacketExplosion::new);
|
||||||
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S40PacketDisconnect.class);
|
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S28PacketEffect.class, S28PacketEffect::new);
|
||||||
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S41PacketServerDifficulty.class);
|
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S29PacketSoundEffect.class, S29PacketSoundEffect::new);
|
||||||
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S42PacketCombatEvent.class);
|
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S2APacketParticles.class, S2APacketParticles::new);
|
||||||
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S43PacketCamera.class);
|
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S2BPacketChangeGameState.class,
|
||||||
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S44PacketWorldBorder.class);
|
S2BPacketChangeGameState::new);
|
||||||
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S45PacketTitle.class);
|
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S2CPacketSpawnGlobalEntity.class,
|
||||||
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S46PacketSetCompressionLevel.class);
|
S2CPacketSpawnGlobalEntity::new);
|
||||||
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S47PacketPlayerListHeaderFooter.class);
|
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S2DPacketOpenWindow.class, S2DPacketOpenWindow::new);
|
||||||
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S48PacketResourcePackSend.class);
|
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S2EPacketCloseWindow.class, S2EPacketCloseWindow::new);
|
||||||
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S49PacketUpdateEntityNBT.class);
|
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S2FPacketSetSlot.class, S2FPacketSetSlot::new);
|
||||||
this.registerPacket(EnumPacketDirection.SERVERBOUND, C00PacketKeepAlive.class);
|
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S30PacketWindowItems.class, S30PacketWindowItems::new);
|
||||||
this.registerPacket(EnumPacketDirection.SERVERBOUND, C01PacketChatMessage.class);
|
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S31PacketWindowProperty.class,
|
||||||
this.registerPacket(EnumPacketDirection.SERVERBOUND, C02PacketUseEntity.class);
|
S31PacketWindowProperty::new);
|
||||||
this.registerPacket(EnumPacketDirection.SERVERBOUND, C03PacketPlayer.class);
|
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S32PacketConfirmTransaction.class,
|
||||||
this.registerPacket(EnumPacketDirection.SERVERBOUND, C03PacketPlayer.C04PacketPlayerPosition.class);
|
S32PacketConfirmTransaction::new);
|
||||||
this.registerPacket(EnumPacketDirection.SERVERBOUND, C03PacketPlayer.C05PacketPlayerLook.class);
|
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S33PacketUpdateSign.class, S33PacketUpdateSign::new);
|
||||||
this.registerPacket(EnumPacketDirection.SERVERBOUND, C03PacketPlayer.C06PacketPlayerPosLook.class);
|
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S34PacketMaps.class, S34PacketMaps::new);
|
||||||
this.registerPacket(EnumPacketDirection.SERVERBOUND, C07PacketPlayerDigging.class);
|
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S35PacketUpdateTileEntity.class,
|
||||||
this.registerPacket(EnumPacketDirection.SERVERBOUND, C08PacketPlayerBlockPlacement.class);
|
S35PacketUpdateTileEntity::new);
|
||||||
this.registerPacket(EnumPacketDirection.SERVERBOUND, C09PacketHeldItemChange.class);
|
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S36PacketSignEditorOpen.class,
|
||||||
this.registerPacket(EnumPacketDirection.SERVERBOUND, C0APacketAnimation.class);
|
S36PacketSignEditorOpen::new);
|
||||||
this.registerPacket(EnumPacketDirection.SERVERBOUND, C0BPacketEntityAction.class);
|
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S37PacketStatistics.class, S37PacketStatistics::new);
|
||||||
this.registerPacket(EnumPacketDirection.SERVERBOUND, C0CPacketInput.class);
|
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S38PacketPlayerListItem.class,
|
||||||
this.registerPacket(EnumPacketDirection.SERVERBOUND, C0DPacketCloseWindow.class);
|
S38PacketPlayerListItem::new);
|
||||||
this.registerPacket(EnumPacketDirection.SERVERBOUND, C0EPacketClickWindow.class);
|
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S39PacketPlayerAbilities.class,
|
||||||
this.registerPacket(EnumPacketDirection.SERVERBOUND, C0FPacketConfirmTransaction.class);
|
S39PacketPlayerAbilities::new);
|
||||||
this.registerPacket(EnumPacketDirection.SERVERBOUND, C10PacketCreativeInventoryAction.class);
|
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S3APacketTabComplete.class, S3APacketTabComplete::new);
|
||||||
this.registerPacket(EnumPacketDirection.SERVERBOUND, C11PacketEnchantItem.class);
|
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S3BPacketScoreboardObjective.class,
|
||||||
this.registerPacket(EnumPacketDirection.SERVERBOUND, C12PacketUpdateSign.class);
|
S3BPacketScoreboardObjective::new);
|
||||||
this.registerPacket(EnumPacketDirection.SERVERBOUND, C13PacketPlayerAbilities.class);
|
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S3CPacketUpdateScore.class, S3CPacketUpdateScore::new);
|
||||||
this.registerPacket(EnumPacketDirection.SERVERBOUND, C14PacketTabComplete.class);
|
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S3DPacketDisplayScoreboard.class,
|
||||||
this.registerPacket(EnumPacketDirection.SERVERBOUND, C15PacketClientSettings.class);
|
S3DPacketDisplayScoreboard::new);
|
||||||
this.registerPacket(EnumPacketDirection.SERVERBOUND, C16PacketClientStatus.class);
|
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S3EPacketTeams.class, S3EPacketTeams::new);
|
||||||
this.registerPacket(EnumPacketDirection.SERVERBOUND, C17PacketCustomPayload.class);
|
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S3FPacketCustomPayload.class,
|
||||||
this.registerPacket(EnumPacketDirection.SERVERBOUND, C18PacketSpectate.class);
|
S3FPacketCustomPayload::new);
|
||||||
this.registerPacket(EnumPacketDirection.SERVERBOUND, C19PacketResourcePackStatus.class);
|
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S40PacketDisconnect.class, S40PacketDisconnect::new);
|
||||||
|
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S41PacketServerDifficulty.class,
|
||||||
|
S41PacketServerDifficulty::new);
|
||||||
|
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S42PacketCombatEvent.class, S42PacketCombatEvent::new);
|
||||||
|
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S43PacketCamera.class, S43PacketCamera::new);
|
||||||
|
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S44PacketWorldBorder.class, S44PacketWorldBorder::new);
|
||||||
|
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S45PacketTitle.class, S45PacketTitle::new);
|
||||||
|
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S46PacketSetCompressionLevel.class,
|
||||||
|
S46PacketSetCompressionLevel::new);
|
||||||
|
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S47PacketPlayerListHeaderFooter.class,
|
||||||
|
S47PacketPlayerListHeaderFooter::new);
|
||||||
|
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S48PacketResourcePackSend.class,
|
||||||
|
S48PacketResourcePackSend::new);
|
||||||
|
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S49PacketUpdateEntityNBT.class,
|
||||||
|
S49PacketUpdateEntityNBT::new);
|
||||||
|
this.registerPacket(EnumPacketDirection.SERVERBOUND, C00PacketKeepAlive.class, C00PacketKeepAlive::new);
|
||||||
|
this.registerPacket(EnumPacketDirection.SERVERBOUND, C01PacketChatMessage.class, C01PacketChatMessage::new);
|
||||||
|
this.registerPacket(EnumPacketDirection.SERVERBOUND, C02PacketUseEntity.class, C02PacketUseEntity::new);
|
||||||
|
this.registerPacket(EnumPacketDirection.SERVERBOUND, C03PacketPlayer.class, C03PacketPlayer::new);
|
||||||
|
this.registerPacket(EnumPacketDirection.SERVERBOUND, C03PacketPlayer.C04PacketPlayerPosition.class,
|
||||||
|
C03PacketPlayer.C04PacketPlayerPosition::new);
|
||||||
|
this.registerPacket(EnumPacketDirection.SERVERBOUND, C03PacketPlayer.C05PacketPlayerLook.class,
|
||||||
|
C03PacketPlayer.C05PacketPlayerLook::new);
|
||||||
|
this.registerPacket(EnumPacketDirection.SERVERBOUND, C03PacketPlayer.C06PacketPlayerPosLook.class,
|
||||||
|
C03PacketPlayer.C06PacketPlayerPosLook::new);
|
||||||
|
this.registerPacket(EnumPacketDirection.SERVERBOUND, C07PacketPlayerDigging.class,
|
||||||
|
C07PacketPlayerDigging::new);
|
||||||
|
this.registerPacket(EnumPacketDirection.SERVERBOUND, C08PacketPlayerBlockPlacement.class,
|
||||||
|
C08PacketPlayerBlockPlacement::new);
|
||||||
|
this.registerPacket(EnumPacketDirection.SERVERBOUND, C09PacketHeldItemChange.class,
|
||||||
|
C09PacketHeldItemChange::new);
|
||||||
|
this.registerPacket(EnumPacketDirection.SERVERBOUND, C0APacketAnimation.class, C0APacketAnimation::new);
|
||||||
|
this.registerPacket(EnumPacketDirection.SERVERBOUND, C0BPacketEntityAction.class,
|
||||||
|
C0BPacketEntityAction::new);
|
||||||
|
this.registerPacket(EnumPacketDirection.SERVERBOUND, C0CPacketInput.class, C0CPacketInput::new);
|
||||||
|
this.registerPacket(EnumPacketDirection.SERVERBOUND, C0DPacketCloseWindow.class, C0DPacketCloseWindow::new);
|
||||||
|
this.registerPacket(EnumPacketDirection.SERVERBOUND, C0EPacketClickWindow.class, C0EPacketClickWindow::new);
|
||||||
|
this.registerPacket(EnumPacketDirection.SERVERBOUND, C0FPacketConfirmTransaction.class,
|
||||||
|
C0FPacketConfirmTransaction::new);
|
||||||
|
this.registerPacket(EnumPacketDirection.SERVERBOUND, C10PacketCreativeInventoryAction.class,
|
||||||
|
C10PacketCreativeInventoryAction::new);
|
||||||
|
this.registerPacket(EnumPacketDirection.SERVERBOUND, C11PacketEnchantItem.class, C11PacketEnchantItem::new);
|
||||||
|
this.registerPacket(EnumPacketDirection.SERVERBOUND, C12PacketUpdateSign.class, C12PacketUpdateSign::new);
|
||||||
|
this.registerPacket(EnumPacketDirection.SERVERBOUND, C13PacketPlayerAbilities.class,
|
||||||
|
C13PacketPlayerAbilities::new);
|
||||||
|
this.registerPacket(EnumPacketDirection.SERVERBOUND, C14PacketTabComplete.class, C14PacketTabComplete::new);
|
||||||
|
this.registerPacket(EnumPacketDirection.SERVERBOUND, C15PacketClientSettings.class,
|
||||||
|
C15PacketClientSettings::new);
|
||||||
|
this.registerPacket(EnumPacketDirection.SERVERBOUND, C16PacketClientStatus.class,
|
||||||
|
C16PacketClientStatus::new);
|
||||||
|
this.registerPacket(EnumPacketDirection.SERVERBOUND, C17PacketCustomPayload.class,
|
||||||
|
C17PacketCustomPayload::new);
|
||||||
|
this.registerPacket(EnumPacketDirection.SERVERBOUND, C18PacketSpectate.class, C18PacketSpectate::new);
|
||||||
|
this.registerPacket(EnumPacketDirection.SERVERBOUND, C19PacketResourcePackStatus.class,
|
||||||
|
C19PacketResourcePackStatus::new);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
LOGIN(2) {
|
LOGIN(2) {
|
||||||
{
|
{
|
||||||
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S00PacketDisconnect.class);
|
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S00PacketDisconnect.class, S00PacketDisconnect::new);
|
||||||
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S01PacketEncryptionRequest.class);
|
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S01PacketEncryptionRequest.class,
|
||||||
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S02PacketLoginSuccess.class);
|
S01PacketEncryptionRequest::new);
|
||||||
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S03PacketEnableCompression.class);
|
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S02PacketLoginSuccess.class,
|
||||||
this.registerPacket(EnumPacketDirection.SERVERBOUND, C00PacketLoginStart.class);
|
S02PacketLoginSuccess::new);
|
||||||
this.registerPacket(EnumPacketDirection.SERVERBOUND, C01PacketEncryptionResponse.class);
|
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S03PacketEnableCompression.class,
|
||||||
|
S03PacketEnableCompression::new);
|
||||||
|
this.registerPacket(EnumPacketDirection.SERVERBOUND, C00PacketLoginStart.class, C00PacketLoginStart::new);
|
||||||
|
this.registerPacket(EnumPacketDirection.SERVERBOUND, C01PacketEncryptionResponse.class,
|
||||||
|
C01PacketEncryptionResponse::new);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -257,26 +317,35 @@ public enum EnumConnectionState {
|
||||||
private static final Map<Class<? extends Packet>, EnumConnectionState> STATES_BY_CLASS = Maps.newHashMap();
|
private static final Map<Class<? extends Packet>, EnumConnectionState> STATES_BY_CLASS = Maps.newHashMap();
|
||||||
private final int id;
|
private final int id;
|
||||||
private final Map<EnumPacketDirection, BiMap<Integer, Class<? extends Packet>>> directionMaps;
|
private final Map<EnumPacketDirection, BiMap<Integer, Class<? extends Packet>>> directionMaps;
|
||||||
|
private final Map<EnumPacketDirection, Map<Integer, Supplier<Packet<?>>>> directionCtors;
|
||||||
|
|
||||||
private EnumConnectionState(int protocolId) {
|
private EnumConnectionState(int protocolId) {
|
||||||
this.directionMaps = Maps.newEnumMap(EnumPacketDirection.class);
|
this.directionMaps = Maps.newEnumMap(EnumPacketDirection.class);
|
||||||
|
this.directionCtors = Maps.newEnumMap(EnumPacketDirection.class);
|
||||||
this.id = protocolId;
|
this.id = protocolId;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected EnumConnectionState registerPacket(EnumPacketDirection direction, Class<? extends Packet> packetClass) {
|
protected EnumConnectionState registerPacket(EnumPacketDirection direction, Class<? extends Packet> packetClass,
|
||||||
Object object = (BiMap) this.directionMaps.get(direction);
|
Supplier<Packet<?>> packetCtor) {
|
||||||
|
BiMap<Integer, Class<? extends Packet>> object = this.directionMaps.get(direction);
|
||||||
|
Map<Integer, Supplier<Packet<?>>> object2;
|
||||||
if (object == null) {
|
if (object == null) {
|
||||||
object = HashBiMap.create();
|
object = HashBiMap.create();
|
||||||
this.directionMaps.put(direction, (BiMap<Integer, Class<? extends Packet>>) object);
|
object2 = Maps.newHashMap();
|
||||||
|
this.directionMaps.put(direction, object);
|
||||||
|
this.directionCtors.put(direction, object2);
|
||||||
|
} else {
|
||||||
|
object2 = this.directionCtors.get(direction);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (((BiMap) object).containsValue(packetClass)) {
|
if (object.containsValue(packetClass)) {
|
||||||
String s = direction + " packet " + packetClass + " is already known to ID "
|
String s = direction + " packet " + packetClass + " is already known to ID "
|
||||||
+ ((BiMap) object).inverse().get(packetClass);
|
+ object.inverse().get(packetClass);
|
||||||
LogManager.getLogger().fatal(s);
|
LogManager.getLogger().fatal(s);
|
||||||
throw new IllegalArgumentException(s);
|
throw new IllegalArgumentException(s);
|
||||||
} else {
|
} else {
|
||||||
((BiMap) object).put(Integer.valueOf(((BiMap) object).size()), packetClass);
|
object.put(Integer.valueOf(object.size()), packetClass);
|
||||||
|
object2.put(Integer.valueOf(object2.size()), packetCtor);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -287,8 +356,8 @@ public enum EnumConnectionState {
|
||||||
|
|
||||||
public Packet getPacket(EnumPacketDirection direction, int packetId)
|
public Packet getPacket(EnumPacketDirection direction, int packetId)
|
||||||
throws IllegalAccessException, InstantiationException {
|
throws IllegalAccessException, InstantiationException {
|
||||||
Class oclass = (Class) ((BiMap) this.directionMaps.get(direction)).get(Integer.valueOf(packetId));
|
Supplier<Packet<?>> oclass = this.directionCtors.get(direction).get(Integer.valueOf(packetId));
|
||||||
return oclass == null ? null : (Packet) oclass.newInstance();
|
return oclass == null ? null : oclass.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getId() {
|
public int getId() {
|
||||||
|
@ -322,12 +391,6 @@ public enum EnumConnectionState {
|
||||||
+ STATES_BY_CLASS.get(oclass) + " - can\'t reassign to " + enumconnectionstate);
|
+ STATES_BY_CLASS.get(oclass) + " - can\'t reassign to " + enumconnectionstate);
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
|
||||||
oclass.newInstance();
|
|
||||||
} catch (Throwable var10) {
|
|
||||||
throw new Error("Packet " + oclass + " fails instantiation checks! " + oclass);
|
|
||||||
}
|
|
||||||
|
|
||||||
STATES_BY_CLASS.put(oclass, enumconnectionstate);
|
STATES_BY_CLASS.put(oclass, enumconnectionstate);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@ import java.util.Queue;
|
||||||
import java.util.concurrent.Callable;
|
import java.util.concurrent.Callable;
|
||||||
|
|
||||||
import net.lax1dude.eaglercraft.v1_8.EagRuntime;
|
import net.lax1dude.eaglercraft.v1_8.EagRuntime;
|
||||||
|
import net.lax1dude.eaglercraft.v1_8.EagUtils;
|
||||||
import net.lax1dude.eaglercraft.v1_8.EaglercraftRandom;
|
import net.lax1dude.eaglercraft.v1_8.EaglercraftRandom;
|
||||||
import net.lax1dude.eaglercraft.v1_8.EaglercraftUUID;
|
import net.lax1dude.eaglercraft.v1_8.EaglercraftUUID;
|
||||||
import net.lax1dude.eaglercraft.v1_8.futures.FutureTask;
|
import net.lax1dude.eaglercraft.v1_8.futures.FutureTask;
|
||||||
|
@ -408,7 +409,7 @@ public abstract class MinecraftServer implements Runnable, ICommandSender, IThre
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Thread.sleep(Math.max(1L, 50L - i));
|
EagUtils.sleep(Math.max(1L, 50L - i));
|
||||||
this.serverIsRunning = true;
|
this.serverIsRunning = true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package net.minecraft.stats;
|
package net.minecraft.stats;
|
||||||
|
|
||||||
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
@ -115,8 +117,9 @@ public class Achievement extends StatBase {
|
||||||
return ichatcomponent;
|
return ichatcomponent;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Achievement func_150953_b(Class<? extends IJsonSerializable> parClass1) {
|
public Achievement func_150953_b(Class<? extends IJsonSerializable> parClass1,
|
||||||
return (Achievement) super.func_150953_b(parClass1);
|
Supplier<? extends IJsonSerializable> ctor) {
|
||||||
|
return (Achievement) super.func_150953_b(parClass1, ctor);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**+
|
/**+
|
||||||
|
|
|
@ -135,7 +135,8 @@ public class AchievementList {
|
||||||
fullBeacon = (new Achievement("achievement.fullBeacon", "fullBeacon", 7, 8, Blocks.beacon, killWither))
|
fullBeacon = (new Achievement("achievement.fullBeacon", "fullBeacon", 7, 8, Blocks.beacon, killWither))
|
||||||
.setSpecial().registerStat();
|
.setSpecial().registerStat();
|
||||||
exploreAllBiomes = (new Achievement("achievement.exploreAllBiomes", "exploreAllBiomes", 4, 8,
|
exploreAllBiomes = (new Achievement("achievement.exploreAllBiomes", "exploreAllBiomes", 4, 8,
|
||||||
Items.diamond_boots, theEnd)).func_150953_b(JsonSerializableSet.class).setSpecial().registerStat();
|
Items.diamond_boots, theEnd)).func_150953_b(JsonSerializableSet.class, JsonSerializableSet::new)
|
||||||
|
.setSpecial().registerStat();
|
||||||
overpowered = (new Achievement("achievement.overpowered", "overpowered", 6, 4,
|
overpowered = (new Achievement("achievement.overpowered", "overpowered", 6, 4,
|
||||||
new ItemStack(Items.golden_apple, 1, 1), buildBetterPickaxe)).setSpecial().registerStat();
|
new ItemStack(Items.golden_apple, 1, 1), buildBetterPickaxe)).setSpecial().registerStat();
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ package net.minecraft.stats;
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
import java.text.NumberFormat;
|
import java.text.NumberFormat;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
import net.minecraft.event.HoverEvent;
|
import net.minecraft.event.HoverEvent;
|
||||||
import net.minecraft.scoreboard.IScoreObjectiveCriteria;
|
import net.minecraft.scoreboard.IScoreObjectiveCriteria;
|
||||||
|
@ -38,6 +39,7 @@ public class StatBase {
|
||||||
private final IStatType type;
|
private final IStatType type;
|
||||||
private final IScoreObjectiveCriteria field_150957_c;
|
private final IScoreObjectiveCriteria field_150957_c;
|
||||||
private Class<? extends IJsonSerializable> field_150956_d;
|
private Class<? extends IJsonSerializable> field_150956_d;
|
||||||
|
private Supplier<? extends IJsonSerializable> field_150956_d_ctor;
|
||||||
private static NumberFormat numberFormat = NumberFormat.getIntegerInstance(Locale.US);
|
private static NumberFormat numberFormat = NumberFormat.getIntegerInstance(Locale.US);
|
||||||
public static IStatType simpleStatType = new IStatType() {
|
public static IStatType simpleStatType = new IStatType() {
|
||||||
public String format(int parInt1) {
|
public String format(int parInt1) {
|
||||||
|
@ -164,8 +166,14 @@ public class StatBase {
|
||||||
return this.field_150956_d;
|
return this.field_150956_d;
|
||||||
}
|
}
|
||||||
|
|
||||||
public StatBase func_150953_b(Class<? extends IJsonSerializable> oclass) {
|
public Supplier<? extends IJsonSerializable> func_150954_l_ctor() {
|
||||||
|
return this.field_150956_d_ctor;
|
||||||
|
}
|
||||||
|
|
||||||
|
public StatBase func_150953_b(Class<? extends IJsonSerializable> oclass,
|
||||||
|
Supplier<? extends IJsonSerializable> octor) {
|
||||||
this.field_150956_d = oclass;
|
this.field_150956_d = oclass;
|
||||||
|
this.field_150956_d_ctor = octor;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -131,9 +131,8 @@ public class StatisticsFile extends StatFileWriter {
|
||||||
|
|
||||||
if (jsonobject1.has("progress") && statbase.func_150954_l() != null) {
|
if (jsonobject1.has("progress") && statbase.func_150954_l() != null) {
|
||||||
try {
|
try {
|
||||||
Constructor constructor = statbase.func_150954_l().getConstructor();
|
IJsonSerializable ijsonserializable = (IJsonSerializable) statbase.func_150954_l_ctor()
|
||||||
IJsonSerializable ijsonserializable = (IJsonSerializable) constructor
|
.get();
|
||||||
.newInstance(new Object[0]);
|
|
||||||
ijsonserializable.fromJson(jsonobject1.get("progress"));
|
ijsonserializable.fromJson(jsonobject1.get("progress"));
|
||||||
tupleintjsonserializable.setJsonSerializableValue(ijsonserializable);
|
tupleintjsonserializable.setJsonSerializableValue(ijsonserializable);
|
||||||
} catch (Throwable throwable) {
|
} catch (Throwable throwable) {
|
||||||
|
|
|
@ -2,6 +2,7 @@ package net.minecraft.tileentity;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.Callable;
|
import java.util.concurrent.Callable;
|
||||||
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
|
|
||||||
|
@ -41,6 +42,7 @@ import net.minecraft.world.World;
|
||||||
public abstract class TileEntity {
|
public abstract class TileEntity {
|
||||||
private static final Logger logger = LogManager.getLogger();
|
private static final Logger logger = LogManager.getLogger();
|
||||||
private static Map<String, Class<? extends TileEntity>> nameToClassMap = Maps.newHashMap();
|
private static Map<String, Class<? extends TileEntity>> nameToClassMap = Maps.newHashMap();
|
||||||
|
private static Map<String, Supplier<? extends TileEntity>> nameToCtorMap = Maps.newHashMap();
|
||||||
private static Map<Class<? extends TileEntity>, String> classToNameMap = Maps.newHashMap();
|
private static Map<Class<? extends TileEntity>, String> classToNameMap = Maps.newHashMap();
|
||||||
protected World worldObj;
|
protected World worldObj;
|
||||||
protected BlockPos pos = BlockPos.ORIGIN;
|
protected BlockPos pos = BlockPos.ORIGIN;
|
||||||
|
@ -52,11 +54,12 @@ public abstract class TileEntity {
|
||||||
* Adds a new two-way mapping between the class and its string
|
* Adds a new two-way mapping between the class and its string
|
||||||
* name in both hashmaps.
|
* name in both hashmaps.
|
||||||
*/
|
*/
|
||||||
private static void addMapping(Class<? extends TileEntity> cl, String id) {
|
private static void addMapping(Class<? extends TileEntity> cl, Supplier<? extends TileEntity> ct, String id) {
|
||||||
if (nameToClassMap.containsKey(id)) {
|
if (nameToClassMap.containsKey(id)) {
|
||||||
throw new IllegalArgumentException("Duplicate id: " + id);
|
throw new IllegalArgumentException("Duplicate id: " + id);
|
||||||
} else {
|
} else {
|
||||||
nameToClassMap.put(id, cl);
|
nameToClassMap.put(id, cl);
|
||||||
|
nameToCtorMap.put(id, ct);
|
||||||
classToNameMap.put(cl, id);
|
classToNameMap.put(cl, id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -107,9 +110,9 @@ public abstract class TileEntity {
|
||||||
TileEntity tileentity = null;
|
TileEntity tileentity = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Class oclass = (Class) nameToClassMap.get(nbt.getString("id"));
|
Supplier<? extends TileEntity> oclass = nameToCtorMap.get(nbt.getString("id"));
|
||||||
if (oclass != null) {
|
if (oclass != null) {
|
||||||
tileentity = (TileEntity) oclass.newInstance();
|
tileentity = (TileEntity) oclass.get();
|
||||||
}
|
}
|
||||||
} catch (Exception exception) {
|
} catch (Exception exception) {
|
||||||
logger.error("Could not create TileEntity", exception);
|
logger.error("Could not create TileEntity", exception);
|
||||||
|
@ -265,26 +268,26 @@ public abstract class TileEntity {
|
||||||
}
|
}
|
||||||
|
|
||||||
static {
|
static {
|
||||||
addMapping(TileEntityFurnace.class, "Furnace");
|
addMapping(TileEntityFurnace.class, TileEntityFurnace::new, "Furnace");
|
||||||
addMapping(TileEntityChest.class, "Chest");
|
addMapping(TileEntityChest.class, TileEntityChest::new, "Chest");
|
||||||
addMapping(TileEntityEnderChest.class, "EnderChest");
|
addMapping(TileEntityEnderChest.class, TileEntityEnderChest::new, "EnderChest");
|
||||||
addMapping(BlockJukebox.TileEntityJukebox.class, "RecordPlayer");
|
addMapping(BlockJukebox.TileEntityJukebox.class, BlockJukebox.TileEntityJukebox::new, "RecordPlayer");
|
||||||
addMapping(TileEntityDispenser.class, "Trap");
|
addMapping(TileEntityDispenser.class, TileEntityDispenser::new, "Trap");
|
||||||
addMapping(TileEntityDropper.class, "Dropper");
|
addMapping(TileEntityDropper.class, TileEntityDropper::new, "Dropper");
|
||||||
addMapping(TileEntitySign.class, "Sign");
|
addMapping(TileEntitySign.class, TileEntitySign::new, "Sign");
|
||||||
addMapping(TileEntityMobSpawner.class, "MobSpawner");
|
addMapping(TileEntityMobSpawner.class, TileEntityMobSpawner::new, "MobSpawner");
|
||||||
addMapping(TileEntityNote.class, "Music");
|
addMapping(TileEntityNote.class, TileEntityNote::new, "Music");
|
||||||
addMapping(TileEntityPiston.class, "Piston");
|
addMapping(TileEntityPiston.class, TileEntityPiston::new, "Piston");
|
||||||
addMapping(TileEntityBrewingStand.class, "Cauldron");
|
addMapping(TileEntityBrewingStand.class, TileEntityBrewingStand::new, "Cauldron");
|
||||||
addMapping(TileEntityEnchantmentTable.class, "EnchantTable");
|
addMapping(TileEntityEnchantmentTable.class, TileEntityEnchantmentTable::new, "EnchantTable");
|
||||||
addMapping(TileEntityEndPortal.class, "Airportal");
|
addMapping(TileEntityEndPortal.class, TileEntityEndPortal::new, "Airportal");
|
||||||
addMapping(TileEntityCommandBlock.class, "Control");
|
addMapping(TileEntityCommandBlock.class, TileEntityCommandBlock::new, "Control");
|
||||||
addMapping(TileEntityBeacon.class, "Beacon");
|
addMapping(TileEntityBeacon.class, TileEntityBeacon::new, "Beacon");
|
||||||
addMapping(TileEntitySkull.class, "Skull");
|
addMapping(TileEntitySkull.class, TileEntitySkull::new, "Skull");
|
||||||
addMapping(TileEntityDaylightDetector.class, "DLDetector");
|
addMapping(TileEntityDaylightDetector.class, TileEntityDaylightDetector::new, "DLDetector");
|
||||||
addMapping(TileEntityHopper.class, "Hopper");
|
addMapping(TileEntityHopper.class, TileEntityHopper::new, "Hopper");
|
||||||
addMapping(TileEntityComparator.class, "Comparator");
|
addMapping(TileEntityComparator.class, TileEntityComparator::new, "Comparator");
|
||||||
addMapping(TileEntityFlowerPot.class, "FlowerPot");
|
addMapping(TileEntityFlowerPot.class, TileEntityFlowerPot::new, "FlowerPot");
|
||||||
addMapping(TileEntityBanner.class, "Banner");
|
addMapping(TileEntityBanner.class, TileEntityBanner::new, "Banner");
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -44,9 +44,12 @@ import net.minecraft.world.World;
|
||||||
*/
|
*/
|
||||||
public class ComponentScatteredFeaturePieces {
|
public class ComponentScatteredFeaturePieces {
|
||||||
public static void registerScatteredFeaturePieces() {
|
public static void registerScatteredFeaturePieces() {
|
||||||
MapGenStructureIO.registerStructureComponent(ComponentScatteredFeaturePieces.DesertPyramid.class, "TeDP");
|
MapGenStructureIO.registerStructureComponent(ComponentScatteredFeaturePieces.DesertPyramid.class,
|
||||||
MapGenStructureIO.registerStructureComponent(ComponentScatteredFeaturePieces.JunglePyramid.class, "TeJP");
|
ComponentScatteredFeaturePieces.DesertPyramid::new, "TeDP");
|
||||||
MapGenStructureIO.registerStructureComponent(ComponentScatteredFeaturePieces.SwampHut.class, "TeSH");
|
MapGenStructureIO.registerStructureComponent(ComponentScatteredFeaturePieces.JunglePyramid.class,
|
||||||
|
ComponentScatteredFeaturePieces.JunglePyramid::new, "TeJP");
|
||||||
|
MapGenStructureIO.registerStructureComponent(ComponentScatteredFeaturePieces.SwampHut.class,
|
||||||
|
ComponentScatteredFeaturePieces.SwampHut::new, "TeSH");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class DesertPyramid extends ComponentScatteredFeaturePieces.Feature {
|
public static class DesertPyramid extends ComponentScatteredFeaturePieces.Feature {
|
||||||
|
|
|
@ -2,6 +2,8 @@ package net.minecraft.world.gen.structure;
|
||||||
|
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.lax1dude.eaglercraft.v1_8.log4j.LogManager;
|
import net.lax1dude.eaglercraft.v1_8.log4j.LogManager;
|
||||||
|
@ -30,17 +32,23 @@ import net.lax1dude.eaglercraft.v1_8.log4j.Logger;
|
||||||
public class MapGenStructureIO {
|
public class MapGenStructureIO {
|
||||||
private static final Logger logger = LogManager.getLogger();
|
private static final Logger logger = LogManager.getLogger();
|
||||||
private static Map<String, Class<? extends StructureStart>> startNameToClassMap = Maps.newHashMap();
|
private static Map<String, Class<? extends StructureStart>> startNameToClassMap = Maps.newHashMap();
|
||||||
|
private static Map<String, Supplier<? extends StructureStart>> startNameToSupplierMap = Maps.newHashMap();
|
||||||
private static Map<Class<? extends StructureStart>, String> startClassToNameMap = Maps.newHashMap();
|
private static Map<Class<? extends StructureStart>, String> startClassToNameMap = Maps.newHashMap();
|
||||||
private static Map<String, Class<? extends StructureComponent>> componentNameToClassMap = Maps.newHashMap();
|
private static Map<String, Class<? extends StructureComponent>> componentNameToClassMap = Maps.newHashMap();
|
||||||
|
private static Map<String, Supplier<? extends StructureComponent>> componentNameToSupplierMap = Maps.newHashMap();
|
||||||
private static Map<Class<? extends StructureComponent>, String> componentClassToNameMap = Maps.newHashMap();
|
private static Map<Class<? extends StructureComponent>, String> componentClassToNameMap = Maps.newHashMap();
|
||||||
|
|
||||||
private static void registerStructure(Class<? extends StructureStart> startClass, String structureName) {
|
private static void registerStructure(Class<? extends StructureStart> startClass,
|
||||||
|
Supplier<? extends StructureStart> startSupplier, String structureName) {
|
||||||
startNameToClassMap.put(structureName, startClass);
|
startNameToClassMap.put(structureName, startClass);
|
||||||
|
startNameToSupplierMap.put(structureName, startSupplier);
|
||||||
startClassToNameMap.put(startClass, structureName);
|
startClassToNameMap.put(startClass, structureName);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void registerStructureComponent(Class<? extends StructureComponent> componentClass, String componentName) {
|
static void registerStructureComponent(Class<? extends StructureComponent> componentClass,
|
||||||
|
Supplier<? extends StructureComponent> startSupplier, String componentName) {
|
||||||
componentNameToClassMap.put(componentName, componentClass);
|
componentNameToClassMap.put(componentName, componentClass);
|
||||||
|
componentNameToSupplierMap.put(componentName, startSupplier);
|
||||||
componentClassToNameMap.put(componentClass, componentName);
|
componentClassToNameMap.put(componentClass, componentName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,9 +64,9 @@ public class MapGenStructureIO {
|
||||||
StructureStart structurestart = null;
|
StructureStart structurestart = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Class oclass = (Class) startNameToClassMap.get(tagCompound.getString("id"));
|
Supplier<? extends StructureStart> oclass = startNameToSupplierMap.get(tagCompound.getString("id"));
|
||||||
if (oclass != null) {
|
if (oclass != null) {
|
||||||
structurestart = (StructureStart) oclass.newInstance();
|
structurestart = oclass.get();
|
||||||
}
|
}
|
||||||
} catch (Exception exception) {
|
} catch (Exception exception) {
|
||||||
logger.warn("Failed Start with id " + tagCompound.getString("id"));
|
logger.warn("Failed Start with id " + tagCompound.getString("id"));
|
||||||
|
@ -78,9 +86,9 @@ public class MapGenStructureIO {
|
||||||
StructureComponent structurecomponent = null;
|
StructureComponent structurecomponent = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Class oclass = (Class) componentNameToClassMap.get(tagCompound.getString("id"));
|
Supplier<? extends StructureComponent> oclass = componentNameToSupplierMap.get(tagCompound.getString("id"));
|
||||||
if (oclass != null) {
|
if (oclass != null) {
|
||||||
structurecomponent = (StructureComponent) oclass.newInstance();
|
structurecomponent = oclass.get();
|
||||||
}
|
}
|
||||||
} catch (Exception exception) {
|
} catch (Exception exception) {
|
||||||
logger.warn("Failed Piece with id " + tagCompound.getString("id"));
|
logger.warn("Failed Piece with id " + tagCompound.getString("id"));
|
||||||
|
@ -97,12 +105,13 @@ public class MapGenStructureIO {
|
||||||
}
|
}
|
||||||
|
|
||||||
static {
|
static {
|
||||||
registerStructure(StructureMineshaftStart.class, "Mineshaft");
|
registerStructure(StructureMineshaftStart.class, StructureMineshaftStart::new, "Mineshaft");
|
||||||
registerStructure(MapGenVillage.Start.class, "Village");
|
registerStructure(MapGenVillage.Start.class, MapGenVillage.Start::new, "Village");
|
||||||
registerStructure(MapGenNetherBridge.Start.class, "Fortress");
|
registerStructure(MapGenNetherBridge.Start.class, MapGenNetherBridge.Start::new, "Fortress");
|
||||||
registerStructure(MapGenStronghold.Start.class, "Stronghold");
|
registerStructure(MapGenStronghold.Start.class, MapGenStronghold.Start::new, "Stronghold");
|
||||||
registerStructure(MapGenScatteredFeature.Start.class, "Temple");
|
registerStructure(MapGenScatteredFeature.Start.class, MapGenScatteredFeature.Start::new, "Temple");
|
||||||
registerStructure(StructureOceanMonument.StartMonument.class, "Monument");
|
registerStructure(StructureOceanMonument.StartMonument.class, StructureOceanMonument.StartMonument::new,
|
||||||
|
"Monument");
|
||||||
StructureMineshaftPieces.registerStructurePieces();
|
StructureMineshaftPieces.registerStructurePieces();
|
||||||
StructureVillagePieces.registerVillagePieces();
|
StructureVillagePieces.registerVillagePieces();
|
||||||
StructureNetherBridgePieces.registerNetherFortressPieces();
|
StructureNetherBridgePieces.registerNetherFortressPieces();
|
||||||
|
|
|
@ -56,10 +56,14 @@ public class StructureMineshaftPieces {
|
||||||
new WeightedRandomChestContent(Items.iron_horse_armor, 0, 1, 1, 1) });
|
new WeightedRandomChestContent(Items.iron_horse_armor, 0, 1, 1, 1) });
|
||||||
|
|
||||||
public static void registerStructurePieces() {
|
public static void registerStructurePieces() {
|
||||||
MapGenStructureIO.registerStructureComponent(StructureMineshaftPieces.Corridor.class, "MSCorridor");
|
MapGenStructureIO.registerStructureComponent(StructureMineshaftPieces.Corridor.class,
|
||||||
MapGenStructureIO.registerStructureComponent(StructureMineshaftPieces.Cross.class, "MSCrossing");
|
StructureMineshaftPieces.Corridor::new, "MSCorridor");
|
||||||
MapGenStructureIO.registerStructureComponent(StructureMineshaftPieces.Room.class, "MSRoom");
|
MapGenStructureIO.registerStructureComponent(StructureMineshaftPieces.Cross.class,
|
||||||
MapGenStructureIO.registerStructureComponent(StructureMineshaftPieces.Stairs.class, "MSStairs");
|
StructureMineshaftPieces.Cross::new, "MSCrossing");
|
||||||
|
MapGenStructureIO.registerStructureComponent(StructureMineshaftPieces.Room.class,
|
||||||
|
StructureMineshaftPieces.Room::new, "MSRoom");
|
||||||
|
MapGenStructureIO.registerStructureComponent(StructureMineshaftPieces.Stairs.class,
|
||||||
|
StructureMineshaftPieces.Stairs::new, "MSStairs");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static StructureComponent func_175892_a(List<StructureComponent> listIn, EaglercraftRandom rand, int x,
|
private static StructureComponent func_175892_a(List<StructureComponent> listIn, EaglercraftRandom rand, int x,
|
||||||
|
|
|
@ -52,21 +52,36 @@ public class StructureNetherBridgePieces {
|
||||||
new StructureNetherBridgePieces.PieceWeight(StructureNetherBridgePieces.NetherStalkRoom.class, 5, 2) };
|
new StructureNetherBridgePieces.PieceWeight(StructureNetherBridgePieces.NetherStalkRoom.class, 5, 2) };
|
||||||
|
|
||||||
public static void registerNetherFortressPieces() {
|
public static void registerNetherFortressPieces() {
|
||||||
MapGenStructureIO.registerStructureComponent(StructureNetherBridgePieces.Crossing3.class, "NeBCr");
|
MapGenStructureIO.registerStructureComponent(StructureNetherBridgePieces.Crossing3.class,
|
||||||
MapGenStructureIO.registerStructureComponent(StructureNetherBridgePieces.End.class, "NeBEF");
|
StructureNetherBridgePieces.Crossing3::new, "NeBCr");
|
||||||
MapGenStructureIO.registerStructureComponent(StructureNetherBridgePieces.Straight.class, "NeBS");
|
MapGenStructureIO.registerStructureComponent(StructureNetherBridgePieces.End.class,
|
||||||
MapGenStructureIO.registerStructureComponent(StructureNetherBridgePieces.Corridor3.class, "NeCCS");
|
StructureNetherBridgePieces.End::new, "NeBEF");
|
||||||
MapGenStructureIO.registerStructureComponent(StructureNetherBridgePieces.Corridor4.class, "NeCTB");
|
MapGenStructureIO.registerStructureComponent(StructureNetherBridgePieces.Straight.class,
|
||||||
MapGenStructureIO.registerStructureComponent(StructureNetherBridgePieces.Entrance.class, "NeCE");
|
StructureNetherBridgePieces.Straight::new, "NeBS");
|
||||||
MapGenStructureIO.registerStructureComponent(StructureNetherBridgePieces.Crossing2.class, "NeSCSC");
|
MapGenStructureIO.registerStructureComponent(StructureNetherBridgePieces.Corridor3.class,
|
||||||
MapGenStructureIO.registerStructureComponent(StructureNetherBridgePieces.Corridor.class, "NeSCLT");
|
StructureNetherBridgePieces.Corridor3::new, "NeCCS");
|
||||||
MapGenStructureIO.registerStructureComponent(StructureNetherBridgePieces.Corridor5.class, "NeSC");
|
MapGenStructureIO.registerStructureComponent(StructureNetherBridgePieces.Corridor4.class,
|
||||||
MapGenStructureIO.registerStructureComponent(StructureNetherBridgePieces.Corridor2.class, "NeSCRT");
|
StructureNetherBridgePieces.Corridor4::new, "NeCTB");
|
||||||
MapGenStructureIO.registerStructureComponent(StructureNetherBridgePieces.NetherStalkRoom.class, "NeCSR");
|
MapGenStructureIO.registerStructureComponent(StructureNetherBridgePieces.Entrance.class,
|
||||||
MapGenStructureIO.registerStructureComponent(StructureNetherBridgePieces.Throne.class, "NeMT");
|
StructureNetherBridgePieces.Entrance::new, "NeCE");
|
||||||
MapGenStructureIO.registerStructureComponent(StructureNetherBridgePieces.Crossing.class, "NeRC");
|
MapGenStructureIO.registerStructureComponent(StructureNetherBridgePieces.Crossing2.class,
|
||||||
MapGenStructureIO.registerStructureComponent(StructureNetherBridgePieces.Stairs.class, "NeSR");
|
StructureNetherBridgePieces.Crossing2::new, "NeSCSC");
|
||||||
MapGenStructureIO.registerStructureComponent(StructureNetherBridgePieces.Start.class, "NeStart");
|
MapGenStructureIO.registerStructureComponent(StructureNetherBridgePieces.Corridor.class,
|
||||||
|
StructureNetherBridgePieces.Corridor::new, "NeSCLT");
|
||||||
|
MapGenStructureIO.registerStructureComponent(StructureNetherBridgePieces.Corridor5.class,
|
||||||
|
StructureNetherBridgePieces.Corridor5::new, "NeSC");
|
||||||
|
MapGenStructureIO.registerStructureComponent(StructureNetherBridgePieces.Corridor2.class,
|
||||||
|
StructureNetherBridgePieces.Corridor2::new, "NeSCRT");
|
||||||
|
MapGenStructureIO.registerStructureComponent(StructureNetherBridgePieces.NetherStalkRoom.class,
|
||||||
|
StructureNetherBridgePieces.NetherStalkRoom::new, "NeCSR");
|
||||||
|
MapGenStructureIO.registerStructureComponent(StructureNetherBridgePieces.Throne.class,
|
||||||
|
StructureNetherBridgePieces.Throne::new, "NeMT");
|
||||||
|
MapGenStructureIO.registerStructureComponent(StructureNetherBridgePieces.Crossing.class,
|
||||||
|
StructureNetherBridgePieces.Crossing::new, "NeRC");
|
||||||
|
MapGenStructureIO.registerStructureComponent(StructureNetherBridgePieces.Stairs.class,
|
||||||
|
StructureNetherBridgePieces.Stairs::new, "NeSR");
|
||||||
|
MapGenStructureIO.registerStructureComponent(StructureNetherBridgePieces.Start.class,
|
||||||
|
StructureNetherBridgePieces.Start::new, "NeStart");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static StructureNetherBridgePieces.Piece func_175887_b(
|
private static StructureNetherBridgePieces.Piece func_175887_b(
|
||||||
|
|
|
@ -40,17 +40,28 @@ import net.minecraft.world.World;
|
||||||
*/
|
*/
|
||||||
public class StructureOceanMonumentPieces {
|
public class StructureOceanMonumentPieces {
|
||||||
public static void registerOceanMonumentPieces() {
|
public static void registerOceanMonumentPieces() {
|
||||||
MapGenStructureIO.registerStructureComponent(StructureOceanMonumentPieces.MonumentBuilding.class, "OMB");
|
MapGenStructureIO.registerStructureComponent(StructureOceanMonumentPieces.MonumentBuilding.class,
|
||||||
MapGenStructureIO.registerStructureComponent(StructureOceanMonumentPieces.MonumentCoreRoom.class, "OMCR");
|
StructureOceanMonumentPieces.MonumentBuilding::new, "OMB");
|
||||||
MapGenStructureIO.registerStructureComponent(StructureOceanMonumentPieces.DoubleXRoom.class, "OMDXR");
|
MapGenStructureIO.registerStructureComponent(StructureOceanMonumentPieces.MonumentCoreRoom.class,
|
||||||
MapGenStructureIO.registerStructureComponent(StructureOceanMonumentPieces.DoubleXYRoom.class, "OMDXYR");
|
StructureOceanMonumentPieces.MonumentCoreRoom::new, "OMCR");
|
||||||
MapGenStructureIO.registerStructureComponent(StructureOceanMonumentPieces.DoubleYRoom.class, "OMDYR");
|
MapGenStructureIO.registerStructureComponent(StructureOceanMonumentPieces.DoubleXRoom.class,
|
||||||
MapGenStructureIO.registerStructureComponent(StructureOceanMonumentPieces.DoubleYZRoom.class, "OMDYZR");
|
StructureOceanMonumentPieces.DoubleXRoom::new, "OMDXR");
|
||||||
MapGenStructureIO.registerStructureComponent(StructureOceanMonumentPieces.DoubleZRoom.class, "OMDZR");
|
MapGenStructureIO.registerStructureComponent(StructureOceanMonumentPieces.DoubleXYRoom.class,
|
||||||
MapGenStructureIO.registerStructureComponent(StructureOceanMonumentPieces.EntryRoom.class, "OMEntry");
|
StructureOceanMonumentPieces.DoubleXYRoom::new, "OMDXYR");
|
||||||
MapGenStructureIO.registerStructureComponent(StructureOceanMonumentPieces.Penthouse.class, "OMPenthouse");
|
MapGenStructureIO.registerStructureComponent(StructureOceanMonumentPieces.DoubleYRoom.class,
|
||||||
MapGenStructureIO.registerStructureComponent(StructureOceanMonumentPieces.SimpleRoom.class, "OMSimple");
|
StructureOceanMonumentPieces.DoubleYRoom::new, "OMDYR");
|
||||||
MapGenStructureIO.registerStructureComponent(StructureOceanMonumentPieces.SimpleTopRoom.class, "OMSimpleT");
|
MapGenStructureIO.registerStructureComponent(StructureOceanMonumentPieces.DoubleYZRoom.class,
|
||||||
|
StructureOceanMonumentPieces.DoubleYZRoom::new, "OMDYZR");
|
||||||
|
MapGenStructureIO.registerStructureComponent(StructureOceanMonumentPieces.DoubleZRoom.class,
|
||||||
|
StructureOceanMonumentPieces.DoubleZRoom::new, "OMDZR");
|
||||||
|
MapGenStructureIO.registerStructureComponent(StructureOceanMonumentPieces.EntryRoom.class,
|
||||||
|
StructureOceanMonumentPieces.EntryRoom::new, "OMEntry");
|
||||||
|
MapGenStructureIO.registerStructureComponent(StructureOceanMonumentPieces.Penthouse.class,
|
||||||
|
StructureOceanMonumentPieces.Penthouse::new, "OMPenthouse");
|
||||||
|
MapGenStructureIO.registerStructureComponent(StructureOceanMonumentPieces.SimpleRoom.class,
|
||||||
|
StructureOceanMonumentPieces.SimpleRoom::new, "OMSimple");
|
||||||
|
MapGenStructureIO.registerStructureComponent(StructureOceanMonumentPieces.SimpleTopRoom.class,
|
||||||
|
StructureOceanMonumentPieces.SimpleTopRoom::new, "OMSimpleT");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class DoubleXRoom extends StructureOceanMonumentPieces.Piece {
|
public static class DoubleXRoom extends StructureOceanMonumentPieces.Piece {
|
||||||
|
|
|
@ -63,19 +63,32 @@ public class StructureStrongholdPieces {
|
||||||
private static final StructureStrongholdPieces.Stones strongholdStones = new StructureStrongholdPieces.Stones();
|
private static final StructureStrongholdPieces.Stones strongholdStones = new StructureStrongholdPieces.Stones();
|
||||||
|
|
||||||
public static void registerStrongholdPieces() {
|
public static void registerStrongholdPieces() {
|
||||||
MapGenStructureIO.registerStructureComponent(StructureStrongholdPieces.ChestCorridor.class, "SHCC");
|
MapGenStructureIO.registerStructureComponent(StructureStrongholdPieces.ChestCorridor.class,
|
||||||
MapGenStructureIO.registerStructureComponent(StructureStrongholdPieces.Corridor.class, "SHFC");
|
StructureStrongholdPieces.ChestCorridor::new, "SHCC");
|
||||||
MapGenStructureIO.registerStructureComponent(StructureStrongholdPieces.Crossing.class, "SH5C");
|
MapGenStructureIO.registerStructureComponent(StructureStrongholdPieces.Corridor.class,
|
||||||
MapGenStructureIO.registerStructureComponent(StructureStrongholdPieces.LeftTurn.class, "SHLT");
|
StructureStrongholdPieces.Corridor::new, "SHFC");
|
||||||
MapGenStructureIO.registerStructureComponent(StructureStrongholdPieces.Library.class, "SHLi");
|
MapGenStructureIO.registerStructureComponent(StructureStrongholdPieces.Crossing.class,
|
||||||
MapGenStructureIO.registerStructureComponent(StructureStrongholdPieces.PortalRoom.class, "SHPR");
|
StructureStrongholdPieces.Crossing::new, "SH5C");
|
||||||
MapGenStructureIO.registerStructureComponent(StructureStrongholdPieces.Prison.class, "SHPH");
|
MapGenStructureIO.registerStructureComponent(StructureStrongholdPieces.LeftTurn.class,
|
||||||
MapGenStructureIO.registerStructureComponent(StructureStrongholdPieces.RightTurn.class, "SHRT");
|
StructureStrongholdPieces.LeftTurn::new, "SHLT");
|
||||||
MapGenStructureIO.registerStructureComponent(StructureStrongholdPieces.RoomCrossing.class, "SHRC");
|
MapGenStructureIO.registerStructureComponent(StructureStrongholdPieces.Library.class,
|
||||||
MapGenStructureIO.registerStructureComponent(StructureStrongholdPieces.Stairs.class, "SHSD");
|
StructureStrongholdPieces.Library::new, "SHLi");
|
||||||
MapGenStructureIO.registerStructureComponent(StructureStrongholdPieces.Stairs2.class, "SHStart");
|
MapGenStructureIO.registerStructureComponent(StructureStrongholdPieces.PortalRoom.class,
|
||||||
MapGenStructureIO.registerStructureComponent(StructureStrongholdPieces.Straight.class, "SHS");
|
StructureStrongholdPieces.PortalRoom::new, "SHPR");
|
||||||
MapGenStructureIO.registerStructureComponent(StructureStrongholdPieces.StairsStraight.class, "SHSSD");
|
MapGenStructureIO.registerStructureComponent(StructureStrongholdPieces.Prison.class,
|
||||||
|
StructureStrongholdPieces.Prison::new, "SHPH");
|
||||||
|
MapGenStructureIO.registerStructureComponent(StructureStrongholdPieces.RightTurn.class,
|
||||||
|
StructureStrongholdPieces.RightTurn::new, "SHRT");
|
||||||
|
MapGenStructureIO.registerStructureComponent(StructureStrongholdPieces.RoomCrossing.class,
|
||||||
|
StructureStrongholdPieces.RoomCrossing::new, "SHRC");
|
||||||
|
MapGenStructureIO.registerStructureComponent(StructureStrongholdPieces.Stairs.class,
|
||||||
|
StructureStrongholdPieces.Stairs::new, "SHSD");
|
||||||
|
MapGenStructureIO.registerStructureComponent(StructureStrongholdPieces.Stairs2.class,
|
||||||
|
StructureStrongholdPieces.Stairs2::new, "SHStart");
|
||||||
|
MapGenStructureIO.registerStructureComponent(StructureStrongholdPieces.Straight.class,
|
||||||
|
StructureStrongholdPieces.Straight::new, "SHS");
|
||||||
|
MapGenStructureIO.registerStructureComponent(StructureStrongholdPieces.StairsStraight.class,
|
||||||
|
StructureStrongholdPieces.StairsStraight::new, "SHSSD");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**+
|
/**+
|
||||||
|
|
|
@ -48,19 +48,32 @@ import net.minecraft.world.biome.WorldChunkManager;
|
||||||
*/
|
*/
|
||||||
public class StructureVillagePieces {
|
public class StructureVillagePieces {
|
||||||
public static void registerVillagePieces() {
|
public static void registerVillagePieces() {
|
||||||
MapGenStructureIO.registerStructureComponent(StructureVillagePieces.House1.class, "ViBH");
|
MapGenStructureIO.registerStructureComponent(StructureVillagePieces.House1.class,
|
||||||
MapGenStructureIO.registerStructureComponent(StructureVillagePieces.Field1.class, "ViDF");
|
StructureVillagePieces.House1::new, "ViBH");
|
||||||
MapGenStructureIO.registerStructureComponent(StructureVillagePieces.Field2.class, "ViF");
|
MapGenStructureIO.registerStructureComponent(StructureVillagePieces.Field1.class,
|
||||||
MapGenStructureIO.registerStructureComponent(StructureVillagePieces.Torch.class, "ViL");
|
StructureVillagePieces.Field1::new, "ViDF");
|
||||||
MapGenStructureIO.registerStructureComponent(StructureVillagePieces.Hall.class, "ViPH");
|
MapGenStructureIO.registerStructureComponent(StructureVillagePieces.Field2.class,
|
||||||
MapGenStructureIO.registerStructureComponent(StructureVillagePieces.House4Garden.class, "ViSH");
|
StructureVillagePieces.Field2::new, "ViF");
|
||||||
MapGenStructureIO.registerStructureComponent(StructureVillagePieces.WoodHut.class, "ViSmH");
|
MapGenStructureIO.registerStructureComponent(StructureVillagePieces.Torch.class,
|
||||||
MapGenStructureIO.registerStructureComponent(StructureVillagePieces.Church.class, "ViST");
|
StructureVillagePieces.Torch::new, "ViL");
|
||||||
MapGenStructureIO.registerStructureComponent(StructureVillagePieces.House2.class, "ViS");
|
MapGenStructureIO.registerStructureComponent(StructureVillagePieces.Hall.class,
|
||||||
MapGenStructureIO.registerStructureComponent(StructureVillagePieces.Start.class, "ViStart");
|
StructureVillagePieces.Hall::new, "ViPH");
|
||||||
MapGenStructureIO.registerStructureComponent(StructureVillagePieces.Path.class, "ViSR");
|
MapGenStructureIO.registerStructureComponent(StructureVillagePieces.House4Garden.class,
|
||||||
MapGenStructureIO.registerStructureComponent(StructureVillagePieces.House3.class, "ViTRH");
|
StructureVillagePieces.House4Garden::new, "ViSH");
|
||||||
MapGenStructureIO.registerStructureComponent(StructureVillagePieces.Well.class, "ViW");
|
MapGenStructureIO.registerStructureComponent(StructureVillagePieces.WoodHut.class,
|
||||||
|
StructureVillagePieces.WoodHut::new, "ViSmH");
|
||||||
|
MapGenStructureIO.registerStructureComponent(StructureVillagePieces.Church.class,
|
||||||
|
StructureVillagePieces.Church::new, "ViST");
|
||||||
|
MapGenStructureIO.registerStructureComponent(StructureVillagePieces.House2.class,
|
||||||
|
StructureVillagePieces.House2::new, "ViS");
|
||||||
|
MapGenStructureIO.registerStructureComponent(StructureVillagePieces.Start.class,
|
||||||
|
StructureVillagePieces.Start::new, "ViStart");
|
||||||
|
MapGenStructureIO.registerStructureComponent(StructureVillagePieces.Path.class,
|
||||||
|
StructureVillagePieces.Path::new, "ViSR");
|
||||||
|
MapGenStructureIO.registerStructureComponent(StructureVillagePieces.House3.class,
|
||||||
|
StructureVillagePieces.House3::new, "ViTRH");
|
||||||
|
MapGenStructureIO.registerStructureComponent(StructureVillagePieces.Well.class,
|
||||||
|
StructureVillagePieces.Well::new, "ViW");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<StructureVillagePieces.PieceWeight> getStructureVillageWeightedPieceList(
|
public static List<StructureVillagePieces.PieceWeight> getStructureVillageWeightedPieceList(
|
||||||
|
|
|
@ -11,6 +11,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.lax1dude.eaglercraft.v1_8.sp.server.EaglerIntegratedServerWorker;
|
import net.lax1dude.eaglercraft.v1_8.sp.server.EaglerIntegratedServerWorker;
|
||||||
import net.lax1dude.eaglercraft.v1_8.sp.server.WorldsDB;
|
import net.lax1dude.eaglercraft.v1_8.sp.server.WorldsDB;
|
||||||
import net.minecraft.util.IProgressUpdate;
|
import net.minecraft.util.IProgressUpdate;
|
||||||
|
import net.lax1dude.eaglercraft.v1_8.EagUtils;
|
||||||
import net.lax1dude.eaglercraft.v1_8.internal.vfs2.VFile2;
|
import net.lax1dude.eaglercraft.v1_8.internal.vfs2.VFile2;
|
||||||
import net.lax1dude.eaglercraft.v1_8.log4j.LogManager;
|
import net.lax1dude.eaglercraft.v1_8.log4j.LogManager;
|
||||||
import net.lax1dude.eaglercraft.v1_8.log4j.Logger;
|
import net.lax1dude.eaglercraft.v1_8.log4j.Logger;
|
||||||
|
@ -160,11 +161,7 @@ public class SaveFormatOld implements ISaveFormat {
|
||||||
|
|
||||||
logger.warn("Unsuccessful in deleting contents.");
|
logger.warn("Unsuccessful in deleting contents.");
|
||||||
if (i < 5) {
|
if (i < 5) {
|
||||||
try {
|
EagUtils.sleep(500);
|
||||||
Thread.sleep(500L);
|
|
||||||
} catch (InterruptedException var5) {
|
|
||||||
;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,6 +43,7 @@ public class PlatformAudio {
|
||||||
|
|
||||||
protected final String sourceName;
|
protected final String sourceName;
|
||||||
protected long stall;
|
protected long stall;
|
||||||
|
protected boolean paused = false;
|
||||||
|
|
||||||
protected PaulscodeAudioHandle(String sourceName) {
|
protected PaulscodeAudioHandle(String sourceName) {
|
||||||
this.sourceName = sourceName;
|
this.sourceName = sourceName;
|
||||||
|
@ -55,10 +56,12 @@ public class PlatformAudio {
|
||||||
if(sndSystem.playing(sourceName)) {
|
if(sndSystem.playing(sourceName)) {
|
||||||
sndSystem.pause(sourceName);
|
sndSystem.pause(sourceName);
|
||||||
}
|
}
|
||||||
|
paused = true;
|
||||||
}else {
|
}else {
|
||||||
if(!sndSystem.playing(sourceName)) {
|
if(!sndSystem.playing(sourceName)) {
|
||||||
sndSystem.play(sourceName);
|
sndSystem.play(sourceName);
|
||||||
}
|
}
|
||||||
|
paused = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,6 +70,7 @@ public class PlatformAudio {
|
||||||
this.stall = PlatformRuntime.steadyTimeMillis();
|
this.stall = PlatformRuntime.steadyTimeMillis();
|
||||||
sndSystem.rewind(sourceName);
|
sndSystem.rewind(sourceName);
|
||||||
sndSystem.play(sourceName);
|
sndSystem.play(sourceName);
|
||||||
|
paused = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -87,11 +91,12 @@ public class PlatformAudio {
|
||||||
@Override
|
@Override
|
||||||
public void end() {
|
public void end() {
|
||||||
sndSystem.stop(sourceName);
|
sndSystem.stop(sourceName);
|
||||||
|
paused = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean shouldFree() {
|
public boolean shouldFree() {
|
||||||
return !sndSystem.playing(sourceName) && PlatformRuntime.steadyTimeMillis() - this.stall > 250l; //TODO: I hate this hack
|
return !paused && !sndSystem.playing(sourceName) && PlatformRuntime.steadyTimeMillis() - this.stall > 250l; //TODO: I hate this hack
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -113,10 +118,6 @@ public class PlatformAudio {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static interface IAudioCacheLoader {
|
|
||||||
byte[] loadFile(String filename);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static IAudioResource loadAudioDataNew(String filename, boolean holdInCache, IAudioCacheLoader loader) {
|
public static IAudioResource loadAudioDataNew(String filename, boolean holdInCache, IAudioCacheLoader loader) {
|
||||||
throw new UnsupportedOperationException("Browser only!");
|
throw new UnsupportedOperationException("Browser only!");
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,8 @@ import org.lwjgl.glfw.GLFWGamepadState;
|
||||||
import org.lwjgl.glfw.GLFWVidMode;
|
import org.lwjgl.glfw.GLFWVidMode;
|
||||||
import org.lwjgl.system.MemoryStack;
|
import org.lwjgl.system.MemoryStack;
|
||||||
|
|
||||||
|
import net.lax1dude.eaglercraft.v1_8.Display;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copyright (c) 2022-2024 lax1dude, ayunami2000. All Rights Reserved.
|
* Copyright (c) 2022-2024 lax1dude, ayunami2000. All Rights Reserved.
|
||||||
*
|
*
|
||||||
|
@ -60,7 +62,6 @@ public class PlatformInput {
|
||||||
private static boolean enableRepeatEvents = false;
|
private static boolean enableRepeatEvents = false;
|
||||||
private static int functionKeyModifier = GLFW_KEY_F;
|
private static int functionKeyModifier = GLFW_KEY_F;
|
||||||
|
|
||||||
public static boolean lockKeys = false;
|
|
||||||
|
|
||||||
private static final List<Character> keyboardCharList = new LinkedList<>();
|
private static final List<Character> keyboardCharList = new LinkedList<>();
|
||||||
|
|
||||||
|
@ -298,12 +299,23 @@ public class PlatformInput {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void update() {
|
public static void update() {
|
||||||
|
update(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final long[] syncTimer = new long[1];
|
||||||
|
|
||||||
|
public static void update(int limitFps) {
|
||||||
glfwPollEvents();
|
glfwPollEvents();
|
||||||
if(vsync != glfwVSyncState) {
|
if(vsync != glfwVSyncState) {
|
||||||
glfwSwapInterval(vsync ? 1 : 0);
|
glfwSwapInterval(vsync ? 1 : 0);
|
||||||
glfwVSyncState = vsync;
|
glfwVSyncState = vsync;
|
||||||
}
|
}
|
||||||
glfwSwapBuffers(win);
|
glfwSwapBuffers(win);
|
||||||
|
if(limitFps > 0 && !vsync) {
|
||||||
|
Display.sync(limitFps, syncTimer);
|
||||||
|
}else {
|
||||||
|
syncTimer[0] = 0l;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isVSyncSupported() {
|
public static boolean isVSyncSupported() {
|
||||||
|
@ -415,6 +427,10 @@ public class PlatformInput {
|
||||||
enableRepeatEvents = b;
|
enableRepeatEvents = b;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean keyboardAreKeysLocked() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean mouseNext() {
|
public static boolean mouseNext() {
|
||||||
if(mouseEventList.size() > 0) {
|
if(mouseEventList.size() > 0) {
|
||||||
currentMouseEvent = mouseEventList.remove(0);
|
currentMouseEvent = mouseEventList.remove(0);
|
||||||
|
|
|
@ -432,7 +432,7 @@ public class PlatformOpenGL {
|
||||||
data == null ? 0l : EaglerLWJGLAllocator.getAddress(data));
|
data == null ? 0l : EaglerLWJGLAllocator.getAddress(data));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final void _wglTexImage2D(int target, int level, int internalFormat, int width, int height,
|
public static final void _wglTexImage2Df32(int target, int level, int internalFormat, int width, int height,
|
||||||
int border, int format, int type, FloatBuffer data) {
|
int border, int format, int type, FloatBuffer data) {
|
||||||
nglTexImage2D(target, level, internalFormat, width, height, border, format, type,
|
nglTexImage2D(target, level, internalFormat, width, height, border, format, type,
|
||||||
data == null ? 0l : EaglerLWJGLAllocator.getAddress(data));
|
data == null ? 0l : EaglerLWJGLAllocator.getAddress(data));
|
||||||
|
@ -462,7 +462,7 @@ public class PlatformOpenGL {
|
||||||
data == null ? 0l : EaglerLWJGLAllocator.getAddress(data));
|
data == null ? 0l : EaglerLWJGLAllocator.getAddress(data));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final void _wglTexSubImage2D(int target, int level, int xoffset, int yoffset, int width, int height,
|
public static final void _wglTexSubImage2Df32(int target, int level, int xoffset, int yoffset, int width, int height,
|
||||||
int format, int type, FloatBuffer data) {
|
int format, int type, FloatBuffer data) {
|
||||||
nglTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type,
|
nglTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type,
|
||||||
data == null ? 0l : EaglerLWJGLAllocator.getAddress(data));
|
data == null ? 0l : EaglerLWJGLAllocator.getAddress(data));
|
||||||
|
|
|
@ -618,6 +618,13 @@ public class PlatformRuntime {
|
||||||
return System.nanoTime();
|
return System.nanoTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void sleep(int millis) {
|
||||||
|
try {
|
||||||
|
Thread.sleep(millis);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static void postCreate() {
|
public static void postCreate() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,9 +78,14 @@ public class DesktopClientConfigAdapter implements IClientConfigAdapter {
|
||||||
return relays;
|
return relays;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isCheckGLErrors() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isCheckShaderGLErrors() {
|
public boolean isCheckShaderGLErrors() {
|
||||||
return true;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -54,7 +54,7 @@ public class LWJGLEntryPoint {
|
||||||
lr.setVisible(true);
|
lr.setVisible(true);
|
||||||
|
|
||||||
while(lr.isVisible()) {
|
while(lr.isVisible()) {
|
||||||
EagUtils.sleep(100l);
|
EagUtils.sleep(100);
|
||||||
}
|
}
|
||||||
|
|
||||||
lr.dispose();
|
lr.dispose();
|
||||||
|
@ -71,7 +71,7 @@ public class LWJGLEntryPoint {
|
||||||
|
|
||||||
EagRuntime.create();
|
EagRuntime.create();
|
||||||
|
|
||||||
Main.appMain(new String[0]);
|
Main.appMain();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,8 @@ import java.lang.ref.WeakReference;
|
||||||
|
|
||||||
import com.google.common.annotations.GwtCompatible;
|
import com.google.common.annotations.GwtCompatible;
|
||||||
|
|
||||||
|
import net.lax1dude.eaglercraft.v1_8.EagRuntime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Methods factored out so that they can be emulated differently in GWT.
|
* Methods factored out so that they can be emulated differently in GWT.
|
||||||
*
|
*
|
||||||
|
@ -32,7 +34,7 @@ final class Platform {
|
||||||
|
|
||||||
/** Calls {@link System#nanoTime()}. */
|
/** Calls {@link System#nanoTime()}. */
|
||||||
static long systemNanoTime() {
|
static long systemNanoTime() {
|
||||||
return System.nanoTime();
|
return EagRuntime.nanoTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
static CharMatcher precomputeCharMatcher(CharMatcher matcher) {
|
static CharMatcher precomputeCharMatcher(CharMatcher matcher) {
|
||||||
|
|
|
@ -75,18 +75,43 @@ public class Display {
|
||||||
PlatformInput.update();
|
PlatformInput.update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void update(int limitFramerate) {
|
||||||
|
PlatformInput.update(limitFramerate);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final long[] defaultSyncPtr = new long[1];
|
||||||
|
|
||||||
public static void sync(int limitFramerate) {
|
public static void sync(int limitFramerate) {
|
||||||
|
sync(limitFramerate, defaultSyncPtr);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean sync(int limitFramerate, long[] timerPtr) {
|
||||||
boolean limitFPS = limitFramerate > 0 && limitFramerate < 1000;
|
boolean limitFPS = limitFramerate > 0 && limitFramerate < 1000;
|
||||||
|
boolean blocked = false;
|
||||||
|
|
||||||
if(limitFPS) {
|
if(limitFPS) {
|
||||||
long millis = EagRuntime.steadyTimeMillis();
|
if(timerPtr[0] == 0l) {
|
||||||
long frameMillis = (1000l / limitFramerate) - (millis - lastSwap);
|
timerPtr[0] = EagRuntime.steadyTimeMillis();
|
||||||
if(frameMillis > 0l) {
|
}else {
|
||||||
EagUtils.sleep(frameMillis);
|
long millis = EagRuntime.steadyTimeMillis();
|
||||||
|
long frameMillis = (1000l / limitFramerate);
|
||||||
|
long frameTime = millis - timerPtr[0];
|
||||||
|
if(frameTime > 2000l || frameTime < 0l) {
|
||||||
|
frameTime = frameMillis;
|
||||||
|
timerPtr[0] = millis;
|
||||||
|
}else {
|
||||||
|
timerPtr[0] += frameMillis;
|
||||||
|
}
|
||||||
|
if(frameTime >= 0l && frameTime < frameMillis) {
|
||||||
|
EagUtils.sleep(frameMillis - frameTime);
|
||||||
|
blocked = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
}else {
|
||||||
|
timerPtr[0] = 0l;
|
||||||
}
|
}
|
||||||
|
|
||||||
lastSwap = EagRuntime.steadyTimeMillis();
|
return blocked;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean contextLost() {
|
public static boolean contextLost() {
|
||||||
|
|
|
@ -5,6 +5,8 @@ import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
import net.lax1dude.eaglercraft.v1_8.internal.PlatformRuntime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copyright (c) 2022-2023 lax1dude, ayunami2000. All Rights Reserved.
|
* Copyright (c) 2022-2023 lax1dude, ayunami2000. All Rights Reserved.
|
||||||
*
|
*
|
||||||
|
@ -57,11 +59,14 @@ public class EagUtils {
|
||||||
return str.length() < off + 2 ? decodeHex(str.subSequence(off, 2)) : 0;
|
return str.length() < off + 2 ? decodeHex(str.subSequence(off, 2)) : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void sleep(int millis) {
|
||||||
|
PlatformRuntime.sleep(millis);
|
||||||
|
}
|
||||||
|
|
||||||
public static void sleep(long millis) {
|
public static void sleep(long millis) {
|
||||||
try {
|
int reduced = (int)millis;
|
||||||
Thread.sleep(millis);
|
if(reduced != millis) throw new IllegalArgumentException();
|
||||||
}catch(InterruptedException ex) {
|
PlatformRuntime.sleep(reduced);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String toASCIIEagler(String str) {
|
public static String toASCIIEagler(String str) {
|
||||||
|
|
|
@ -5,6 +5,7 @@ import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import net.lax1dude.eaglercraft.v1_8.internal.EnumPlatformType;
|
import net.lax1dude.eaglercraft.v1_8.internal.EnumPlatformType;
|
||||||
|
import net.lax1dude.eaglercraft.v1_8.internal.IAudioCacheLoader;
|
||||||
import net.lax1dude.eaglercraft.v1_8.internal.IAudioHandle;
|
import net.lax1dude.eaglercraft.v1_8.internal.IAudioHandle;
|
||||||
import net.lax1dude.eaglercraft.v1_8.internal.IAudioResource;
|
import net.lax1dude.eaglercraft.v1_8.internal.IAudioResource;
|
||||||
import net.lax1dude.eaglercraft.v1_8.internal.PlatformAudio;
|
import net.lax1dude.eaglercraft.v1_8.internal.PlatformAudio;
|
||||||
|
@ -286,7 +287,7 @@ public class EaglercraftSoundManager {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private final PlatformAudio.IAudioCacheLoader browserResourcePackLoader = filename -> {
|
private final IAudioCacheLoader browserResourcePackLoader = filename -> {
|
||||||
try {
|
try {
|
||||||
return EaglerInputStream.inputStreamToBytesQuiet(Minecraft.getMinecraft().getResourceManager()
|
return EaglerInputStream.inputStreamToBytesQuiet(Minecraft.getMinecraft().getResourceManager()
|
||||||
.getResource(new ResourceLocation(filename)).getInputStream());
|
.getResource(new ResourceLocation(filename)).getInputStream());
|
||||||
|
|
|
@ -10,7 +10,7 @@ public class EaglercraftVersion {
|
||||||
/// Customize these to fit your fork:
|
/// Customize these to fit your fork:
|
||||||
|
|
||||||
public static final String projectForkName = "EaglercraftX";
|
public static final String projectForkName = "EaglercraftX";
|
||||||
public static final String projectForkVersion = "u39";
|
public static final String projectForkVersion = "u40";
|
||||||
public static final String projectForkVendor = "lax1dude";
|
public static final String projectForkVendor = "lax1dude";
|
||||||
|
|
||||||
public static final String projectForkURL = "https://gitlab.com/lax1dude/eaglercraftx-1.8";
|
public static final String projectForkURL = "https://gitlab.com/lax1dude/eaglercraftx-1.8";
|
||||||
|
@ -20,20 +20,20 @@ public class EaglercraftVersion {
|
||||||
public static final String projectOriginName = "EaglercraftX";
|
public static final String projectOriginName = "EaglercraftX";
|
||||||
public static final String projectOriginAuthor = "lax1dude";
|
public static final String projectOriginAuthor = "lax1dude";
|
||||||
public static final String projectOriginRevision = "1.8";
|
public static final String projectOriginRevision = "1.8";
|
||||||
public static final String projectOriginVersion = "u39";
|
public static final String projectOriginVersion = "u40";
|
||||||
|
|
||||||
public static final String projectOriginURL = "https://gitlab.com/lax1dude/eaglercraftx-1.8"; // rest in peace
|
public static final String projectOriginURL = "https://gitlab.com/lax1dude/eaglercraftx-1.8"; // rest in peace
|
||||||
|
|
||||||
// EPK Version Identifier
|
// EPK Version Identifier
|
||||||
|
|
||||||
public static final String EPKVersionIdentifier = "u39"; // Set to null to disable EPK version check
|
public static final String EPKVersionIdentifier = "u40"; // Set to null to disable EPK version check
|
||||||
|
|
||||||
// Updating configuration
|
// Updating configuration
|
||||||
|
|
||||||
public static final boolean enableUpdateService = true;
|
public static final boolean enableUpdateService = true;
|
||||||
|
|
||||||
public static final String updateBundlePackageName = "net.lax1dude.eaglercraft.v1_8.client";
|
public static final String updateBundlePackageName = "net.lax1dude.eaglercraft.v1_8.client";
|
||||||
public static final int updateBundlePackageVersionInt = 39;
|
public static final int updateBundlePackageVersionInt = 40;
|
||||||
|
|
||||||
public static final String updateLatestLocalStorageKey = "latestUpdate_" + updateBundlePackageName;
|
public static final String updateLatestLocalStorageKey = "latestUpdate_" + updateBundlePackageName;
|
||||||
|
|
||||||
|
|
|
@ -65,4 +65,8 @@ public class Keyboard {
|
||||||
PlatformInput.keyboardFireEvent(eventType, eagKey, keyChar);
|
PlatformInput.keyboardFireEvent(eventType, eagKey, keyChar);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean areKeysLocked() {
|
||||||
|
return PlatformInput.keyboardAreKeysLocked();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
22
src/main/java/net/lax1dude/eaglercraft/v1_8/internal/IAudioCacheLoader.java
Executable file
22
src/main/java/net/lax1dude/eaglercraft/v1_8/internal/IAudioCacheLoader.java
Executable file
|
@ -0,0 +1,22 @@
|
||||||
|
package net.lax1dude.eaglercraft.v1_8.internal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copyright (c) 2024 lax1dude. All Rights Reserved.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||||
|
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||||
|
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||||
|
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
|
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||||
|
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public interface IAudioCacheLoader {
|
||||||
|
|
||||||
|
byte[] loadFile(String filename);
|
||||||
|
|
||||||
|
}
|
|
@ -50,6 +50,8 @@ public interface IClientConfigAdapter {
|
||||||
|
|
||||||
List<RelayEntry> getRelays();
|
List<RelayEntry> getRelays();
|
||||||
|
|
||||||
|
boolean isCheckGLErrors();
|
||||||
|
|
||||||
boolean isCheckShaderGLErrors();
|
boolean isCheckShaderGLErrors();
|
||||||
|
|
||||||
boolean isDemo();
|
boolean isDemo();
|
||||||
|
|
|
@ -3,6 +3,7 @@ package net.lax1dude.eaglercraft.v1_8.internal;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
|
||||||
import net.lax1dude.eaglercraft.v1_8.EagRuntime;
|
import net.lax1dude.eaglercraft.v1_8.EagRuntime;
|
||||||
|
import net.lax1dude.eaglercraft.v1_8.EagUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copyright (c) 2022 lax1dude. All Rights Reserved.
|
* Copyright (c) 2022 lax1dude. All Rights Reserved.
|
||||||
|
@ -79,10 +80,7 @@ public interface IServerQuery {
|
||||||
default boolean awaitResponseAvailable(long timeout) {
|
default boolean awaitResponseAvailable(long timeout) {
|
||||||
long start = EagRuntime.steadyTimeMillis();
|
long start = EagRuntime.steadyTimeMillis();
|
||||||
while(isOpen() && responsesAvailable() <= 0 && (timeout <= 0l || EagRuntime.steadyTimeMillis() - start < timeout)) {
|
while(isOpen() && responsesAvailable() <= 0 && (timeout <= 0l || EagRuntime.steadyTimeMillis() - start < timeout)) {
|
||||||
try {
|
EagUtils.sleep(5);
|
||||||
Thread.sleep(0l, 250000);
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return responsesAvailable() > 0;
|
return responsesAvailable() > 0;
|
||||||
}
|
}
|
||||||
|
@ -94,10 +92,7 @@ public interface IServerQuery {
|
||||||
default boolean awaitResponseBinaryAvailable(long timeout) {
|
default boolean awaitResponseBinaryAvailable(long timeout) {
|
||||||
long start = EagRuntime.steadyTimeMillis();
|
long start = EagRuntime.steadyTimeMillis();
|
||||||
while(isOpen() && binaryResponsesAvailable() <= 0 && (timeout <= 0l || EagRuntime.steadyTimeMillis() - start < timeout)) {
|
while(isOpen() && binaryResponsesAvailable() <= 0 && (timeout <= 0l || EagRuntime.steadyTimeMillis() - start < timeout)) {
|
||||||
try {
|
EagUtils.sleep(5);
|
||||||
Thread.sleep(0l, 250000);
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return binaryResponsesAvailable() > 0;
|
return binaryResponsesAvailable() > 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4065,6 +4065,6 @@ public class EaglerDeferredPipeline {
|
||||||
GlStateManager.popMatrix();
|
GlStateManager.popMatrix();
|
||||||
GlStateManager.matrixMode(GL_MODELVIEW);
|
GlStateManager.matrixMode(GL_MODELVIEW);
|
||||||
GlStateManager.popMatrix();
|
GlStateManager.popMatrix();
|
||||||
EagUtils.sleep(10l);
|
EagUtils.sleep(10);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,7 +55,7 @@ public class GuiScreenImportExportProfile extends GuiScreen {
|
||||||
waitingForFile = false;
|
waitingForFile = false;
|
||||||
FileChooserResult result = EagRuntime.getFileChooserResult();
|
FileChooserResult result = EagRuntime.getFileChooserResult();
|
||||||
if(result != null) {
|
if(result != null) {
|
||||||
mc.loadingScreen.eaglerShow(I18n.format("settingsBackup.importing.1"), "settingsBackup.importing.2");
|
mc.loadingScreen.eaglerShow(I18n.format("settingsBackup.importing.1"), I18n.format("settingsBackup.importing.2"));
|
||||||
ProfileImporter importer = new ProfileImporter(result.fileData);
|
ProfileImporter importer = new ProfileImporter(result.fileData);
|
||||||
try {
|
try {
|
||||||
importer.readHeader();
|
importer.readHeader();
|
||||||
|
|
|
@ -12,6 +12,7 @@ import java.util.Map.Entry;
|
||||||
|
|
||||||
import net.lax1dude.eaglercraft.v1_8.ArrayUtils;
|
import net.lax1dude.eaglercraft.v1_8.ArrayUtils;
|
||||||
import net.lax1dude.eaglercraft.v1_8.EagRuntime;
|
import net.lax1dude.eaglercraft.v1_8.EagRuntime;
|
||||||
|
import net.lax1dude.eaglercraft.v1_8.EagUtils;
|
||||||
import net.lax1dude.eaglercraft.v1_8.EaglerInputStream;
|
import net.lax1dude.eaglercraft.v1_8.EaglerInputStream;
|
||||||
import net.lax1dude.eaglercraft.v1_8.EaglerOutputStream;
|
import net.lax1dude.eaglercraft.v1_8.EaglerOutputStream;
|
||||||
import net.lax1dude.eaglercraft.v1_8.EaglercraftUUID;
|
import net.lax1dude.eaglercraft.v1_8.EaglercraftUUID;
|
||||||
|
@ -441,10 +442,7 @@ public class ConnectionHandshake {
|
||||||
if(client.getState().isClosed()) {
|
if(client.getState().isClosed()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
try {
|
EagUtils.sleep(50);
|
||||||
Thread.sleep(50l);
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
}
|
|
||||||
if(EagRuntime.steadyTimeMillis() - millis > timeout) {
|
if(EagRuntime.steadyTimeMillis() - millis > timeout) {
|
||||||
client.close();
|
client.close();
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -144,9 +144,11 @@ public class GameProtocolMessageController {
|
||||||
pkt = sendQueueV4.remove(0);
|
pkt = sendQueueV4.remove(0);
|
||||||
sendFunction.sendPluginMessage(GamePluginMessageConstants.V4_CHANNEL, pkt);
|
sendFunction.sendPluginMessage(GamePluginMessageConstants.V4_CHANNEL, pkt);
|
||||||
}else {
|
}else {
|
||||||
int i, j, sendCount = 0, totalLen = 0;
|
int i, j, sendCount, totalLen;
|
||||||
PacketBuffer sendBuffer;
|
PacketBuffer sendBuffer;
|
||||||
while(sendQueueV4.size() > 0) {
|
while(sendQueueV4.size() > 0) {
|
||||||
|
sendCount = 0;
|
||||||
|
totalLen = 0;
|
||||||
do {
|
do {
|
||||||
i = sendQueueV4.get(sendCount++).readableBytes();
|
i = sendQueueV4.get(sendCount++).readableBytes();
|
||||||
totalLen += GamePacketOutputBuffer.getVarIntSize(i) + i;
|
totalLen += GamePacketOutputBuffer.getVarIntSize(i) + i;
|
||||||
|
|
|
@ -126,7 +126,7 @@ public class LANClientNetworkManager extends EaglercraftNetworkManager {
|
||||||
connectState = SENT_DESCRIPTION;
|
connectState = SENT_DESCRIPTION;
|
||||||
continue mainLoop;
|
continue mainLoop;
|
||||||
}
|
}
|
||||||
EagUtils.sleep(20l);
|
EagUtils.sleep(20);
|
||||||
}while(EagRuntime.steadyTimeMillis() - lm < 5000l);
|
}while(EagRuntime.steadyTimeMillis() - lm < 5000l);
|
||||||
|
|
||||||
// no description was sent
|
// no description was sent
|
||||||
|
@ -163,7 +163,7 @@ public class LANClientNetworkManager extends EaglercraftNetworkManager {
|
||||||
return new LANClientNetworkManager(displayCode, displayRelay);
|
return new LANClientNetworkManager(displayCode, displayRelay);
|
||||||
|
|
||||||
}
|
}
|
||||||
EagUtils.sleep(20l);
|
EagUtils.sleep(20);
|
||||||
}while(EagRuntime.steadyTimeMillis() - lm < 5000l);
|
}while(EagRuntime.steadyTimeMillis() - lm < 5000l);
|
||||||
|
|
||||||
// no channel was opened
|
// no channel was opened
|
||||||
|
@ -202,7 +202,7 @@ public class LANClientNetworkManager extends EaglercraftNetworkManager {
|
||||||
connectState = SENT_ICE_CANDIDATE;
|
connectState = SENT_ICE_CANDIDATE;
|
||||||
continue mainLoop;
|
continue mainLoop;
|
||||||
}
|
}
|
||||||
EagUtils.sleep(20l);
|
EagUtils.sleep(20);
|
||||||
}while(EagRuntime.steadyTimeMillis() - lm < 5000l);
|
}while(EagRuntime.steadyTimeMillis() - lm < 5000l);
|
||||||
|
|
||||||
// no ice candidates were sent
|
// no ice candidates were sent
|
||||||
|
@ -237,7 +237,7 @@ public class LANClientNetworkManager extends EaglercraftNetworkManager {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
EagUtils.sleep(20l);
|
EagUtils.sleep(20);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,7 +64,7 @@ class LANClientPeer {
|
||||||
disconnect();
|
disconnect();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
EagUtils.sleep(20l);
|
EagUtils.sleep(20);
|
||||||
}while(EagRuntime.steadyTimeMillis() - millis < 5000l);
|
}while(EagRuntime.steadyTimeMillis() - millis < 5000l);
|
||||||
logger.error("Getting server ICE candidates for '{}' timed out!", clientId);
|
logger.error("Getting server ICE candidates for '{}' timed out!", clientId);
|
||||||
disconnect();
|
disconnect();
|
||||||
|
@ -92,7 +92,7 @@ class LANClientPeer {
|
||||||
disconnect();
|
disconnect();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
EagUtils.sleep(20l);
|
EagUtils.sleep(20);
|
||||||
}while(EagRuntime.steadyTimeMillis() - millis < 5000l);
|
}while(EagRuntime.steadyTimeMillis() - millis < 5000l);
|
||||||
logger.error("Getting server description for '{}' timed out!", clientId);
|
logger.error("Getting server description for '{}' timed out!", clientId);
|
||||||
disconnect();
|
disconnect();
|
||||||
|
@ -122,7 +122,7 @@ class LANClientPeer {
|
||||||
disconnect();
|
disconnect();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
EagUtils.sleep(20l);
|
EagUtils.sleep(20);
|
||||||
}while(EagRuntime.steadyTimeMillis() - millis < 5000l);
|
}while(EagRuntime.steadyTimeMillis() - millis < 5000l);
|
||||||
logger.error("Getting server description for '{}' timed out!", clientId);
|
logger.error("Getting server description for '{}' timed out!", clientId);
|
||||||
disconnect();
|
disconnect();
|
||||||
|
|
|
@ -81,7 +81,7 @@ public class LANServerController {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
EagUtils.sleep(50l);
|
EagUtils.sleep(50);
|
||||||
}while(EagRuntime.steadyTimeMillis() - millis < 1000l);
|
}while(EagRuntime.steadyTimeMillis() - millis < 1000l);
|
||||||
logger.info("Relay [{}] relay provide ICE servers timeout", sock.getURI());
|
logger.info("Relay [{}] relay provide ICE servers timeout", sock.getURI());
|
||||||
closeLAN();
|
closeLAN();
|
||||||
|
|
|
@ -298,10 +298,10 @@ public class RelayManager {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
EagUtils.sleep(20l);
|
EagUtils.sleep(20);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
EagUtils.sleep(20l);
|
EagUtils.sleep(20);
|
||||||
}
|
}
|
||||||
logger.error("Relay [{}] connection failed!", relay.address);
|
logger.error("Relay [{}] connection failed!", relay.address);
|
||||||
Throwable t;
|
Throwable t;
|
||||||
|
|
|
@ -81,7 +81,7 @@ public class RelayServer {
|
||||||
public void pingBlocking() {
|
public void pingBlocking() {
|
||||||
ping();
|
ping();
|
||||||
while(getPing() < 0l) {
|
while(getPing() < 0l) {
|
||||||
EagUtils.sleep(250l);
|
EagUtils.sleep(250);
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -468,7 +468,7 @@ public class EaglerIntegratedServerWorker {
|
||||||
}
|
}
|
||||||
}else {
|
}else {
|
||||||
if(!singleThreadMode) {
|
if(!singleThreadMode) {
|
||||||
EagUtils.sleep(50l);
|
EagUtils.sleep(50);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@ import net.minecraft.util.ResourceLocation;
|
||||||
* POSSIBILITY OF SUCH DAMAGE.
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class GuiScreenPhishingWaring extends GuiScreen {
|
public class GuiScreenPhishingWarning extends GuiScreen {
|
||||||
|
|
||||||
public static boolean hasShownMessage = false;
|
public static boolean hasShownMessage = false;
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ public class GuiScreenPhishingWaring extends GuiScreen {
|
||||||
private boolean mouseOverCheck;
|
private boolean mouseOverCheck;
|
||||||
private boolean hasCheckedBox;
|
private boolean hasCheckedBox;
|
||||||
|
|
||||||
public GuiScreenPhishingWaring(GuiScreen cont) {
|
public GuiScreenPhishingWarning(GuiScreen cont) {
|
||||||
this.cont = cont;
|
this.cont = cont;
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,8 @@ import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
|
import net.lax1dude.eaglercraft.v1_8.EagRuntime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* {@code StopWatch} provides a convenient API for timings.
|
* {@code StopWatch} provides a convenient API for timings.
|
||||||
|
@ -314,7 +316,7 @@ public class StopWatch {
|
||||||
} else if (this.runningState == State.UNSTARTED) {
|
} else if (this.runningState == State.UNSTARTED) {
|
||||||
return 0;
|
return 0;
|
||||||
} else if (this.runningState == State.RUNNING) {
|
} else if (this.runningState == State.RUNNING) {
|
||||||
return System.nanoTime() - this.startTimeNanos;
|
return EagRuntime.nanoTime() - this.startTimeNanos;
|
||||||
}
|
}
|
||||||
throw new IllegalStateException("Illegal running state has occurred.");
|
throw new IllegalStateException("Illegal running state has occurred.");
|
||||||
}
|
}
|
||||||
|
@ -497,7 +499,7 @@ public class StopWatch {
|
||||||
if (this.runningState != State.SUSPENDED) {
|
if (this.runningState != State.SUSPENDED) {
|
||||||
throw new IllegalStateException("Stopwatch must be suspended to resume. ");
|
throw new IllegalStateException("Stopwatch must be suspended to resume. ");
|
||||||
}
|
}
|
||||||
this.startTimeNanos += System.nanoTime() - this.stopTimeNanos;
|
this.startTimeNanos += EagRuntime.nanoTime() - this.stopTimeNanos;
|
||||||
this.runningState = State.RUNNING;
|
this.runningState = State.RUNNING;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -518,7 +520,7 @@ public class StopWatch {
|
||||||
if (this.runningState != State.RUNNING) {
|
if (this.runningState != State.RUNNING) {
|
||||||
throw new IllegalStateException("Stopwatch is not running. ");
|
throw new IllegalStateException("Stopwatch is not running. ");
|
||||||
}
|
}
|
||||||
this.stopTimeNanos = System.nanoTime();
|
this.stopTimeNanos = EagRuntime.nanoTime();
|
||||||
this.splitState = SplitState.SPLIT;
|
this.splitState = SplitState.SPLIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -540,7 +542,7 @@ public class StopWatch {
|
||||||
if (this.runningState != State.UNSTARTED) {
|
if (this.runningState != State.UNSTARTED) {
|
||||||
throw new IllegalStateException("Stopwatch already started. ");
|
throw new IllegalStateException("Stopwatch already started. ");
|
||||||
}
|
}
|
||||||
this.startTimeNanos = System.nanoTime();
|
this.startTimeNanos = EagRuntime.nanoTime();
|
||||||
this.startTimeMillis = System.currentTimeMillis();
|
this.startTimeMillis = System.currentTimeMillis();
|
||||||
this.runningState = State.RUNNING;
|
this.runningState = State.RUNNING;
|
||||||
}
|
}
|
||||||
|
@ -561,7 +563,7 @@ public class StopWatch {
|
||||||
throw new IllegalStateException("Stopwatch is not running. ");
|
throw new IllegalStateException("Stopwatch is not running. ");
|
||||||
}
|
}
|
||||||
if (this.runningState == State.RUNNING) {
|
if (this.runningState == State.RUNNING) {
|
||||||
this.stopTimeNanos = System.nanoTime();
|
this.stopTimeNanos = EagRuntime.nanoTime();
|
||||||
this.stopTimeMillis = System.currentTimeMillis();
|
this.stopTimeMillis = System.currentTimeMillis();
|
||||||
}
|
}
|
||||||
this.runningState = State.STOPPED;
|
this.runningState = State.STOPPED;
|
||||||
|
@ -583,7 +585,7 @@ public class StopWatch {
|
||||||
if (this.runningState != State.RUNNING) {
|
if (this.runningState != State.RUNNING) {
|
||||||
throw new IllegalStateException("Stopwatch must be running to suspend. ");
|
throw new IllegalStateException("Stopwatch must be running to suspend. ");
|
||||||
}
|
}
|
||||||
this.stopTimeNanos = System.nanoTime();
|
this.stopTimeNanos = EagRuntime.nanoTime();
|
||||||
this.stopTimeMillis = System.currentTimeMillis();
|
this.stopTimeMillis = System.currentTimeMillis();
|
||||||
this.runningState = State.SUSPENDED;
|
this.runningState = State.SUSPENDED;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,22 +4,17 @@ package org.json;
|
||||||
Public Domain.
|
Public Domain.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.io.Closeable;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.StringWriter;
|
import java.io.StringWriter;
|
||||||
import java.io.Writer;
|
import java.io.Writer;
|
||||||
import java.lang.annotation.Annotation;
|
import java.lang.annotation.Annotation;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.lang.reflect.Modifier;
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.Enumeration;
|
import java.util.Enumeration;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.IdentityHashMap;
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -378,15 +373,15 @@ public class JSONObject {
|
||||||
* @throws JSONException
|
* @throws JSONException
|
||||||
* If a getter returned a non-finite number.
|
* If a getter returned a non-finite number.
|
||||||
*/
|
*/
|
||||||
public JSONObject(Object bean) {
|
// public JSONObject(Object bean) {
|
||||||
this();
|
// this();
|
||||||
this.populateMap(bean);
|
// this.populateMap(bean);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
private JSONObject(Object bean, Set<Object> objectsRecord) {
|
// private JSONObject(Object bean, Set<Object> objectsRecord) {
|
||||||
this();
|
// this();
|
||||||
this.populateMap(bean, objectsRecord);
|
// this.populateMap(bean, objectsRecord);
|
||||||
}
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct a JSONObject from an Object, using reflection to find the
|
* Construct a JSONObject from an Object, using reflection to find the
|
||||||
|
@ -1725,104 +1720,104 @@ public class JSONObject {
|
||||||
* @throws JSONException
|
* @throws JSONException
|
||||||
* If a getter returned a non-finite number.
|
* If a getter returned a non-finite number.
|
||||||
*/
|
*/
|
||||||
private void populateMap(Object bean) {
|
// private void populateMap(Object bean) {
|
||||||
populateMap(bean, Collections.newSetFromMap(new IdentityHashMap<Object, Boolean>()));
|
// populateMap(bean, Collections.newSetFromMap(new IdentityHashMap<Object, Boolean>()));
|
||||||
}
|
// }
|
||||||
|
|
||||||
private void populateMap(Object bean, Set<Object> objectsRecord) {
|
// private void populateMap(Object bean, Set<Object> objectsRecord) {
|
||||||
Class<?> klass = bean.getClass();
|
// Class<?> klass = bean.getClass();
|
||||||
|
//
|
||||||
// If klass is a System class then set includeSuperClass to false.
|
// // If klass is a System class then set includeSuperClass to false.
|
||||||
|
//
|
||||||
boolean includeSuperClass = klass.getClassLoader() != null;
|
// boolean includeSuperClass = klass.getClassLoader() != null;
|
||||||
|
//
|
||||||
Method[] methods = includeSuperClass ? klass.getMethods() : klass.getDeclaredMethods();
|
// Method[] methods = includeSuperClass ? klass.getMethods() : klass.getDeclaredMethods();
|
||||||
for (final Method method : methods) {
|
// for (final Method method : methods) {
|
||||||
final int modifiers = method.getModifiers();
|
// final int modifiers = method.getModifiers();
|
||||||
if (Modifier.isPublic(modifiers)
|
// if (Modifier.isPublic(modifiers)
|
||||||
&& !Modifier.isStatic(modifiers)
|
// && !Modifier.isStatic(modifiers)
|
||||||
&& method.getParameterTypes().length == 0
|
// && method.getParameterTypes().length == 0
|
||||||
&& !method.isBridge()
|
// && !method.isBridge()
|
||||||
&& method.getReturnType() != Void.TYPE
|
// && method.getReturnType() != Void.TYPE
|
||||||
&& isValidMethodName(method.getName())) {
|
// && isValidMethodName(method.getName())) {
|
||||||
final String key = getKeyNameFromMethod(method);
|
// final String key = getKeyNameFromMethod(method);
|
||||||
if (key != null && !key.isEmpty()) {
|
// if (key != null && !key.isEmpty()) {
|
||||||
try {
|
// try {
|
||||||
final Object result = method.invoke(bean);
|
// final Object result = method.invoke(bean);
|
||||||
if (result != null) {
|
// if (result != null) {
|
||||||
// check cyclic dependency and throw error if needed
|
// // check cyclic dependency and throw error if needed
|
||||||
// the wrap and populateMap combination method is
|
// // the wrap and populateMap combination method is
|
||||||
// itself DFS recursive
|
// // itself DFS recursive
|
||||||
if (objectsRecord.contains(result)) {
|
// if (objectsRecord.contains(result)) {
|
||||||
throw recursivelyDefinedObjectException(key);
|
// throw recursivelyDefinedObjectException(key);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
objectsRecord.add(result);
|
// objectsRecord.add(result);
|
||||||
|
//
|
||||||
testValidity(result);
|
// testValidity(result);
|
||||||
this.map.put(key, wrap(result, objectsRecord));
|
// this.map.put(key, wrap(result, objectsRecord));
|
||||||
|
//
|
||||||
objectsRecord.remove(result);
|
// objectsRecord.remove(result);
|
||||||
|
//
|
||||||
// we don't use the result anywhere outside of wrap
|
// // we don't use the result anywhere outside of wrap
|
||||||
// if it's a resource we should be sure to close it
|
// // if it's a resource we should be sure to close it
|
||||||
// after calling toString
|
// // after calling toString
|
||||||
if (result instanceof Closeable) {
|
// if (result instanceof Closeable) {
|
||||||
try {
|
// try {
|
||||||
((Closeable) result).close();
|
// ((Closeable) result).close();
|
||||||
} catch (IOException ignore) {
|
// } catch (IOException ignore) {
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
} catch (IllegalAccessException ignore) {
|
// } catch (IllegalAccessException ignore) {
|
||||||
} catch (IllegalArgumentException ignore) {
|
// } catch (IllegalArgumentException ignore) {
|
||||||
} catch (InvocationTargetException ignore) {
|
// } catch (InvocationTargetException ignore) {
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
private static boolean isValidMethodName(String name) {
|
// private static boolean isValidMethodName(String name) {
|
||||||
return !"getClass".equals(name) && !"getDeclaringClass".equals(name);
|
// return !"getClass".equals(name) && !"getDeclaringClass".equals(name);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
private static String getKeyNameFromMethod(Method method) {
|
// private static String getKeyNameFromMethod(Method method) {
|
||||||
final int ignoreDepth = getAnnotationDepth(method, JSONPropertyIgnore.class);
|
// final int ignoreDepth = getAnnotationDepth(method, JSONPropertyIgnore.class);
|
||||||
if (ignoreDepth > 0) {
|
// if (ignoreDepth > 0) {
|
||||||
final int forcedNameDepth = getAnnotationDepth(method, JSONPropertyName.class);
|
// final int forcedNameDepth = getAnnotationDepth(method, JSONPropertyName.class);
|
||||||
if (forcedNameDepth < 0 || ignoreDepth <= forcedNameDepth) {
|
// if (forcedNameDepth < 0 || ignoreDepth <= forcedNameDepth) {
|
||||||
// the hierarchy asked to ignore, and the nearest name override
|
// // the hierarchy asked to ignore, and the nearest name override
|
||||||
// was higher or non-existent
|
// // was higher or non-existent
|
||||||
return null;
|
// return null;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
JSONPropertyName annotation = getAnnotation(method, JSONPropertyName.class);
|
// JSONPropertyName annotation = getAnnotation(method, JSONPropertyName.class);
|
||||||
if (annotation != null && annotation.value() != null && !annotation.value().isEmpty()) {
|
// if (annotation != null && annotation.value() != null && !annotation.value().isEmpty()) {
|
||||||
return annotation.value();
|
// return annotation.value();
|
||||||
}
|
// }
|
||||||
String key;
|
// String key;
|
||||||
final String name = method.getName();
|
// final String name = method.getName();
|
||||||
if (name.startsWith("get") && name.length() > 3) {
|
// if (name.startsWith("get") && name.length() > 3) {
|
||||||
key = name.substring(3);
|
// key = name.substring(3);
|
||||||
} else if (name.startsWith("is") && name.length() > 2) {
|
// } else if (name.startsWith("is") && name.length() > 2) {
|
||||||
key = name.substring(2);
|
// key = name.substring(2);
|
||||||
} else {
|
// } else {
|
||||||
return null;
|
// return null;
|
||||||
}
|
// }
|
||||||
// if the first letter in the key is not uppercase, then skip.
|
// // if the first letter in the key is not uppercase, then skip.
|
||||||
// This is to maintain backwards compatibility before PR406
|
// // This is to maintain backwards compatibility before PR406
|
||||||
// (https://github.com/stleary/JSON-java/pull/406/)
|
// // (https://github.com/stleary/JSON-java/pull/406/)
|
||||||
if (key.length() == 0 || Character.isLowerCase(key.charAt(0))) {
|
// if (key.length() == 0 || Character.isLowerCase(key.charAt(0))) {
|
||||||
return null;
|
// return null;
|
||||||
}
|
// }
|
||||||
if (key.length() == 1) {
|
// if (key.length() == 1) {
|
||||||
key = key.toLowerCase(Locale.ROOT);
|
// key = key.toLowerCase(Locale.ROOT);
|
||||||
} else if (!Character.isUpperCase(key.charAt(1))) {
|
// } else if (!Character.isUpperCase(key.charAt(1))) {
|
||||||
key = key.substring(0, 1).toLowerCase(Locale.ROOT) + key.substring(1);
|
// key = key.substring(0, 1).toLowerCase(Locale.ROOT) + key.substring(1);
|
||||||
}
|
// }
|
||||||
return key;
|
// return key;
|
||||||
}
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Searches the class hierarchy to see if the method or it's super
|
* Searches the class hierarchy to see if the method or it's super
|
||||||
|
@ -2734,10 +2729,11 @@ public class JSONObject {
|
||||||
|| object.getClass().getClassLoader() == null) {
|
|| object.getClass().getClassLoader() == null) {
|
||||||
return object.toString();
|
return object.toString();
|
||||||
}
|
}
|
||||||
if (objectsRecord != null) {
|
// if (objectsRecord != null) {
|
||||||
return new JSONObject(object, objectsRecord);
|
// return new JSONObject(object, objectsRecord);
|
||||||
}
|
// }
|
||||||
return new JSONObject(object);
|
// return new JSONObject(object);
|
||||||
|
throw new UnsupportedOperationException("Unsupported type: " + object.getClass().getSimpleName());
|
||||||
}
|
}
|
||||||
catch (JSONException exception) {
|
catch (JSONException exception) {
|
||||||
throw exception;
|
throw exception;
|
||||||
|
|
|
@ -14,6 +14,7 @@ import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copyright (c) 2024 lax1dude. All Rights Reserved.
|
* Copyright (c) 2024 lax1dude. All Rights Reserved.
|
||||||
|
@ -32,71 +33,71 @@ import java.util.Set;
|
||||||
*/
|
*/
|
||||||
public enum GamePluginMessageProtocol {
|
public enum GamePluginMessageProtocol {
|
||||||
V3(3,
|
V3(3,
|
||||||
define(V3_SKIN_CHANNEL, 0x03, CLIENT_TO_SERVER, CPacketGetOtherSkinEAG.class),
|
define(V3_SKIN_CHANNEL, 0x03, CLIENT_TO_SERVER, CPacketGetOtherSkinEAG.class, CPacketGetOtherSkinEAG::new),
|
||||||
define(V3_SKIN_CHANNEL, 0x04, SERVER_TO_CLIENT, SPacketOtherSkinPresetEAG.class),
|
define(V3_SKIN_CHANNEL, 0x04, SERVER_TO_CLIENT, SPacketOtherSkinPresetEAG.class, SPacketOtherSkinPresetEAG::new),
|
||||||
define(V3_SKIN_CHANNEL, 0x05, SERVER_TO_CLIENT, SPacketOtherSkinCustomV3EAG.class),
|
define(V3_SKIN_CHANNEL, 0x05, SERVER_TO_CLIENT, SPacketOtherSkinCustomV3EAG.class, SPacketOtherSkinCustomV3EAG::new),
|
||||||
define(V3_SKIN_CHANNEL, 0x06, CLIENT_TO_SERVER, CPacketGetSkinByURLEAG.class),
|
define(V3_SKIN_CHANNEL, 0x06, CLIENT_TO_SERVER, CPacketGetSkinByURLEAG.class, CPacketGetSkinByURLEAG::new),
|
||||||
define(V3_SKIN_CHANNEL, 0x07, CLIENT_TO_SERVER, CPacketInstallSkinSPEAG.class),
|
define(V3_SKIN_CHANNEL, 0x07, CLIENT_TO_SERVER, CPacketInstallSkinSPEAG.class, CPacketInstallSkinSPEAG::new),
|
||||||
define(V3_CAPE_CHANNEL, 0x03, CLIENT_TO_SERVER, CPacketGetOtherCapeEAG.class),
|
define(V3_CAPE_CHANNEL, 0x03, CLIENT_TO_SERVER, CPacketGetOtherCapeEAG.class, CPacketGetOtherCapeEAG::new),
|
||||||
define(V3_CAPE_CHANNEL, 0x04, SERVER_TO_CLIENT, SPacketOtherCapePresetEAG.class),
|
define(V3_CAPE_CHANNEL, 0x04, SERVER_TO_CLIENT, SPacketOtherCapePresetEAG.class, SPacketOtherCapePresetEAG::new),
|
||||||
define(V3_CAPE_CHANNEL, 0x05, SERVER_TO_CLIENT, SPacketOtherCapeCustomEAG.class),
|
define(V3_CAPE_CHANNEL, 0x05, SERVER_TO_CLIENT, SPacketOtherCapeCustomEAG.class, SPacketOtherCapeCustomEAG::new),
|
||||||
define(V3_VOICE_CHANNEL, 0x00, SERVER_TO_CLIENT, SPacketVoiceSignalAllowedEAG.class),
|
define(V3_VOICE_CHANNEL, 0x00, SERVER_TO_CLIENT, SPacketVoiceSignalAllowedEAG.class, SPacketVoiceSignalAllowedEAG::new),
|
||||||
define(V3_VOICE_CHANNEL, 0x00, CLIENT_TO_SERVER, CPacketVoiceSignalRequestEAG.class),
|
define(V3_VOICE_CHANNEL, 0x00, CLIENT_TO_SERVER, CPacketVoiceSignalRequestEAG.class, CPacketVoiceSignalRequestEAG::new),
|
||||||
define(V3_VOICE_CHANNEL, 0x01, CLIENT_TO_SERVER, CPacketVoiceSignalConnectEAG.class),
|
define(V3_VOICE_CHANNEL, 0x01, CLIENT_TO_SERVER, CPacketVoiceSignalConnectEAG.class, CPacketVoiceSignalConnectEAG::new),
|
||||||
define(V3_VOICE_CHANNEL, 0x01, SERVER_TO_CLIENT, SPacketVoiceSignalConnectV3EAG.class),
|
define(V3_VOICE_CHANNEL, 0x01, SERVER_TO_CLIENT, SPacketVoiceSignalConnectV3EAG.class, SPacketVoiceSignalConnectV3EAG::new),
|
||||||
define(V3_VOICE_CHANNEL, 0x02, CLIENT_TO_SERVER, CPacketVoiceSignalDisconnectV3EAG.class),
|
define(V3_VOICE_CHANNEL, 0x02, CLIENT_TO_SERVER, CPacketVoiceSignalDisconnectV3EAG.class, CPacketVoiceSignalDisconnectV3EAG::new),
|
||||||
define(V3_VOICE_CHANNEL, 0x02, SERVER_TO_CLIENT, SPacketVoiceSignalDisconnectPeerEAG.class),
|
define(V3_VOICE_CHANNEL, 0x02, SERVER_TO_CLIENT, SPacketVoiceSignalDisconnectPeerEAG.class, SPacketVoiceSignalDisconnectPeerEAG::new),
|
||||||
define(V3_VOICE_CHANNEL, 0x03, CLIENT_TO_SERVER, CPacketVoiceSignalICEEAG.class),
|
define(V3_VOICE_CHANNEL, 0x03, CLIENT_TO_SERVER, CPacketVoiceSignalICEEAG.class, CPacketVoiceSignalICEEAG::new),
|
||||||
define(V3_VOICE_CHANNEL, 0x03, SERVER_TO_CLIENT, SPacketVoiceSignalICEEAG.class),
|
define(V3_VOICE_CHANNEL, 0x03, SERVER_TO_CLIENT, SPacketVoiceSignalICEEAG.class, SPacketVoiceSignalICEEAG::new),
|
||||||
define(V3_VOICE_CHANNEL, 0x04, CLIENT_TO_SERVER, CPacketVoiceSignalDescEAG.class),
|
define(V3_VOICE_CHANNEL, 0x04, CLIENT_TO_SERVER, CPacketVoiceSignalDescEAG.class, CPacketVoiceSignalDescEAG::new),
|
||||||
define(V3_VOICE_CHANNEL, 0x04, SERVER_TO_CLIENT, SPacketVoiceSignalDescEAG.class),
|
define(V3_VOICE_CHANNEL, 0x04, SERVER_TO_CLIENT, SPacketVoiceSignalDescEAG.class, SPacketVoiceSignalDescEAG::new),
|
||||||
define(V3_VOICE_CHANNEL, 0x05, SERVER_TO_CLIENT, SPacketVoiceSignalGlobalEAG.class),
|
define(V3_VOICE_CHANNEL, 0x05, SERVER_TO_CLIENT, SPacketVoiceSignalGlobalEAG.class, SPacketVoiceSignalGlobalEAG::new),
|
||||||
define(V3_UPDATE_CHANNEL, -1, SERVER_TO_CLIENT, SPacketUpdateCertEAG.class),
|
define(V3_UPDATE_CHANNEL, -1, SERVER_TO_CLIENT, SPacketUpdateCertEAG.class, SPacketUpdateCertEAG::new),
|
||||||
define(V3_FNAW_EN_CHANNEL, -1, SERVER_TO_CLIENT, SPacketEnableFNAWSkinsEAG.class)
|
define(V3_FNAW_EN_CHANNEL, -1, SERVER_TO_CLIENT, SPacketEnableFNAWSkinsEAG.class, SPacketEnableFNAWSkinsEAG::new)
|
||||||
), V4(4,
|
), V4(4,
|
||||||
define(V4_CHANNEL, 0x01, CLIENT_TO_SERVER, CPacketGetOtherSkinEAG.class),
|
define(V4_CHANNEL, 0x01, CLIENT_TO_SERVER, CPacketGetOtherSkinEAG.class, CPacketGetOtherSkinEAG::new),
|
||||||
define(V4_CHANNEL, 0x02, SERVER_TO_CLIENT, SPacketOtherSkinPresetEAG.class),
|
define(V4_CHANNEL, 0x02, SERVER_TO_CLIENT, SPacketOtherSkinPresetEAG.class, SPacketOtherSkinPresetEAG::new),
|
||||||
define(V4_CHANNEL, 0x03, SERVER_TO_CLIENT, SPacketOtherSkinCustomV4EAG.class),
|
define(V4_CHANNEL, 0x03, SERVER_TO_CLIENT, SPacketOtherSkinCustomV4EAG.class, SPacketOtherSkinCustomV4EAG::new),
|
||||||
define(V4_CHANNEL, 0x04, CLIENT_TO_SERVER, CPacketGetSkinByURLEAG.class),
|
define(V4_CHANNEL, 0x04, CLIENT_TO_SERVER, CPacketGetSkinByURLEAG.class, CPacketGetSkinByURLEAG::new),
|
||||||
define(V4_CHANNEL, 0x05, CLIENT_TO_SERVER, CPacketInstallSkinSPEAG.class),
|
define(V4_CHANNEL, 0x05, CLIENT_TO_SERVER, CPacketInstallSkinSPEAG.class, CPacketInstallSkinSPEAG::new),
|
||||||
define(V4_CHANNEL, 0x06, CLIENT_TO_SERVER, CPacketGetOtherCapeEAG.class),
|
define(V4_CHANNEL, 0x06, CLIENT_TO_SERVER, CPacketGetOtherCapeEAG.class, CPacketGetOtherCapeEAG::new),
|
||||||
define(V4_CHANNEL, 0x07, SERVER_TO_CLIENT, SPacketOtherCapePresetEAG.class),
|
define(V4_CHANNEL, 0x07, SERVER_TO_CLIENT, SPacketOtherCapePresetEAG.class, SPacketOtherCapePresetEAG::new),
|
||||||
define(V4_CHANNEL, 0x08, SERVER_TO_CLIENT, SPacketOtherCapeCustomEAG.class),
|
define(V4_CHANNEL, 0x08, SERVER_TO_CLIENT, SPacketOtherCapeCustomEAG.class, SPacketOtherCapeCustomEAG::new),
|
||||||
define(V4_CHANNEL, 0x09, SERVER_TO_CLIENT, SPacketVoiceSignalAllowedEAG.class),
|
define(V4_CHANNEL, 0x09, SERVER_TO_CLIENT, SPacketVoiceSignalAllowedEAG.class, SPacketVoiceSignalAllowedEAG::new),
|
||||||
define(V4_CHANNEL, 0x0A, CLIENT_TO_SERVER, CPacketVoiceSignalRequestEAG.class),
|
define(V4_CHANNEL, 0x0A, CLIENT_TO_SERVER, CPacketVoiceSignalRequestEAG.class, CPacketVoiceSignalRequestEAG::new),
|
||||||
define(V4_CHANNEL, 0x0B, CLIENT_TO_SERVER, CPacketVoiceSignalConnectEAG.class),
|
define(V4_CHANNEL, 0x0B, CLIENT_TO_SERVER, CPacketVoiceSignalConnectEAG.class, CPacketVoiceSignalConnectEAG::new),
|
||||||
define(V4_CHANNEL, 0x0C, SERVER_TO_CLIENT, SPacketVoiceSignalConnectV4EAG.class),
|
define(V4_CHANNEL, 0x0C, SERVER_TO_CLIENT, SPacketVoiceSignalConnectV4EAG.class, SPacketVoiceSignalConnectV4EAG::new),
|
||||||
define(V4_CHANNEL, 0x0D, SERVER_TO_CLIENT, SPacketVoiceSignalConnectAnnounceV4EAG.class),
|
define(V4_CHANNEL, 0x0D, SERVER_TO_CLIENT, SPacketVoiceSignalConnectAnnounceV4EAG.class, SPacketVoiceSignalConnectAnnounceV4EAG::new),
|
||||||
define(V4_CHANNEL, 0x0E, CLIENT_TO_SERVER, CPacketVoiceSignalDisconnectV4EAG.class),
|
define(V4_CHANNEL, 0x0E, CLIENT_TO_SERVER, CPacketVoiceSignalDisconnectV4EAG.class, CPacketVoiceSignalDisconnectV4EAG::new),
|
||||||
define(V4_CHANNEL, 0x0F, CLIENT_TO_SERVER, CPacketVoiceSignalDisconnectPeerV4EAG.class),
|
define(V4_CHANNEL, 0x0F, CLIENT_TO_SERVER, CPacketVoiceSignalDisconnectPeerV4EAG.class, CPacketVoiceSignalDisconnectPeerV4EAG::new),
|
||||||
define(V4_CHANNEL, 0x10, SERVER_TO_CLIENT, SPacketVoiceSignalDisconnectPeerEAG.class),
|
define(V4_CHANNEL, 0x10, SERVER_TO_CLIENT, SPacketVoiceSignalDisconnectPeerEAG.class, SPacketVoiceSignalDisconnectPeerEAG::new),
|
||||||
define(V4_CHANNEL, 0x11, CLIENT_TO_SERVER, CPacketVoiceSignalICEEAG.class),
|
define(V4_CHANNEL, 0x11, CLIENT_TO_SERVER, CPacketVoiceSignalICEEAG.class, CPacketVoiceSignalICEEAG::new),
|
||||||
define(V4_CHANNEL, 0x12, SERVER_TO_CLIENT, SPacketVoiceSignalICEEAG.class),
|
define(V4_CHANNEL, 0x12, SERVER_TO_CLIENT, SPacketVoiceSignalICEEAG.class, SPacketVoiceSignalICEEAG::new),
|
||||||
define(V4_CHANNEL, 0x13, CLIENT_TO_SERVER, CPacketVoiceSignalDescEAG.class),
|
define(V4_CHANNEL, 0x13, CLIENT_TO_SERVER, CPacketVoiceSignalDescEAG.class, CPacketVoiceSignalDescEAG::new),
|
||||||
define(V4_CHANNEL, 0x14, SERVER_TO_CLIENT, SPacketVoiceSignalDescEAG.class),
|
define(V4_CHANNEL, 0x14, SERVER_TO_CLIENT, SPacketVoiceSignalDescEAG.class, SPacketVoiceSignalDescEAG::new),
|
||||||
define(V4_CHANNEL, 0x15, SERVER_TO_CLIENT, SPacketVoiceSignalGlobalEAG.class),
|
define(V4_CHANNEL, 0x15, SERVER_TO_CLIENT, SPacketVoiceSignalGlobalEAG.class, SPacketVoiceSignalGlobalEAG::new),
|
||||||
define(V4_CHANNEL, 0x16, SERVER_TO_CLIENT, SPacketUpdateCertEAG.class),
|
define(V4_CHANNEL, 0x16, SERVER_TO_CLIENT, SPacketUpdateCertEAG.class, SPacketUpdateCertEAG::new),
|
||||||
define(V4_CHANNEL, 0x17, SERVER_TO_CLIENT, SPacketEnableFNAWSkinsEAG.class),
|
define(V4_CHANNEL, 0x17, SERVER_TO_CLIENT, SPacketEnableFNAWSkinsEAG.class, SPacketEnableFNAWSkinsEAG::new),
|
||||||
define(V4_CHANNEL, 0x18, SERVER_TO_CLIENT, SPacketForceClientSkinPresetV4EAG.class),
|
define(V4_CHANNEL, 0x18, SERVER_TO_CLIENT, SPacketForceClientSkinPresetV4EAG.class, SPacketForceClientSkinPresetV4EAG::new),
|
||||||
define(V4_CHANNEL, 0x19, SERVER_TO_CLIENT, SPacketForceClientSkinCustomV4EAG.class),
|
define(V4_CHANNEL, 0x19, SERVER_TO_CLIENT, SPacketForceClientSkinCustomV4EAG.class, SPacketForceClientSkinCustomV4EAG::new),
|
||||||
define(V4_CHANNEL, 0x1A, SERVER_TO_CLIENT, SPacketSetServerCookieV4EAG.class),
|
define(V4_CHANNEL, 0x1A, SERVER_TO_CLIENT, SPacketSetServerCookieV4EAG.class, SPacketSetServerCookieV4EAG::new),
|
||||||
define(V4_CHANNEL, 0x1B, SERVER_TO_CLIENT, SPacketRedirectClientV4EAG.class),
|
define(V4_CHANNEL, 0x1B, SERVER_TO_CLIENT, SPacketRedirectClientV4EAG.class, SPacketRedirectClientV4EAG::new),
|
||||||
define(V4_CHANNEL, 0x1C, CLIENT_TO_SERVER, CPacketGetOtherClientUUIDV4EAG.class),
|
define(V4_CHANNEL, 0x1C, CLIENT_TO_SERVER, CPacketGetOtherClientUUIDV4EAG.class, CPacketGetOtherClientUUIDV4EAG::new),
|
||||||
define(V4_CHANNEL, 0x1D, SERVER_TO_CLIENT, SPacketOtherPlayerClientUUIDV4EAG.class),
|
define(V4_CHANNEL, 0x1D, SERVER_TO_CLIENT, SPacketOtherPlayerClientUUIDV4EAG.class, SPacketOtherPlayerClientUUIDV4EAG::new),
|
||||||
define(V4_CHANNEL, 0x1E, SERVER_TO_CLIENT, SPacketForceClientCapePresetV4EAG.class),
|
define(V4_CHANNEL, 0x1E, SERVER_TO_CLIENT, SPacketForceClientCapePresetV4EAG.class, SPacketForceClientCapePresetV4EAG::new),
|
||||||
define(V4_CHANNEL, 0x1F, SERVER_TO_CLIENT, SPacketForceClientCapeCustomV4EAG.class),
|
define(V4_CHANNEL, 0x1F, SERVER_TO_CLIENT, SPacketForceClientCapeCustomV4EAG.class, SPacketForceClientCapeCustomV4EAG::new),
|
||||||
define(V4_CHANNEL, 0x20, SERVER_TO_CLIENT, SPacketInvalidatePlayerCacheV4EAG.class),
|
define(V4_CHANNEL, 0x20, SERVER_TO_CLIENT, SPacketInvalidatePlayerCacheV4EAG.class, SPacketInvalidatePlayerCacheV4EAG::new),
|
||||||
define(V4_CHANNEL, 0x21, SERVER_TO_CLIENT, SPacketUnforceClientV4EAG.class),
|
define(V4_CHANNEL, 0x21, SERVER_TO_CLIENT, SPacketUnforceClientV4EAG.class, SPacketUnforceClientV4EAG::new),
|
||||||
define(V4_CHANNEL, 0x22, SERVER_TO_CLIENT, SPacketCustomizePauseMenuV4EAG.class),
|
define(V4_CHANNEL, 0x22, SERVER_TO_CLIENT, SPacketCustomizePauseMenuV4EAG.class, SPacketCustomizePauseMenuV4EAG::new),
|
||||||
define(V4_CHANNEL, 0x23, CLIENT_TO_SERVER, CPacketRequestServerInfoV4EAG.class),
|
define(V4_CHANNEL, 0x23, CLIENT_TO_SERVER, CPacketRequestServerInfoV4EAG.class, CPacketRequestServerInfoV4EAG::new),
|
||||||
define(V4_CHANNEL, 0x24, SERVER_TO_CLIENT, SPacketServerInfoDataChunkV4EAG.class),
|
define(V4_CHANNEL, 0x24, SERVER_TO_CLIENT, SPacketServerInfoDataChunkV4EAG.class, SPacketServerInfoDataChunkV4EAG::new),
|
||||||
define(V4_CHANNEL, 0x25, CLIENT_TO_SERVER, CPacketWebViewMessageEnV4EAG.class),
|
define(V4_CHANNEL, 0x25, CLIENT_TO_SERVER, CPacketWebViewMessageEnV4EAG.class, CPacketWebViewMessageEnV4EAG::new),
|
||||||
define(V4_CHANNEL, 0x26, CLIENT_TO_SERVER, CPacketWebViewMessageV4EAG.class),
|
define(V4_CHANNEL, 0x26, CLIENT_TO_SERVER, CPacketWebViewMessageV4EAG.class, CPacketWebViewMessageV4EAG::new),
|
||||||
define(V4_CHANNEL, 0x27, SERVER_TO_CLIENT, SPacketWebViewMessageV4EAG.class),
|
define(V4_CHANNEL, 0x27, SERVER_TO_CLIENT, SPacketWebViewMessageV4EAG.class, SPacketWebViewMessageV4EAG::new),
|
||||||
define(V4_CHANNEL, 0x28, SERVER_TO_CLIENT, SPacketNotifIconsRegisterV4EAG.class),
|
define(V4_CHANNEL, 0x28, SERVER_TO_CLIENT, SPacketNotifIconsRegisterV4EAG.class, SPacketNotifIconsRegisterV4EAG::new),
|
||||||
define(V4_CHANNEL, 0x29, SERVER_TO_CLIENT, SPacketNotifIconsReleaseV4EAG.class),
|
define(V4_CHANNEL, 0x29, SERVER_TO_CLIENT, SPacketNotifIconsReleaseV4EAG.class, SPacketNotifIconsReleaseV4EAG::new),
|
||||||
define(V4_CHANNEL, 0x2A, SERVER_TO_CLIENT, SPacketNotifBadgeShowV4EAG.class),
|
define(V4_CHANNEL, 0x2A, SERVER_TO_CLIENT, SPacketNotifBadgeShowV4EAG.class, SPacketNotifBadgeShowV4EAG::new),
|
||||||
define(V4_CHANNEL, 0x2B, SERVER_TO_CLIENT, SPacketNotifBadgeHideV4EAG.class)
|
define(V4_CHANNEL, 0x2B, SERVER_TO_CLIENT, SPacketNotifBadgeHideV4EAG.class, SPacketNotifBadgeHideV4EAG::new)
|
||||||
);
|
);
|
||||||
|
|
||||||
public final int ver;
|
public final int ver;
|
||||||
|
@ -132,8 +133,8 @@ public enum GamePluginMessageProtocol {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static PacketDef define(String channel, int id, int dir, Class<? extends GameMessagePacket> clazz) {
|
private static PacketDef define(String channel, int id, int dir, Class<? extends GameMessagePacket> clazz, Supplier<? extends GameMessagePacket> ctor) {
|
||||||
return new PacketDef(channel, id, dir, clazz);
|
return new PacketDef(channel, id, dir, clazz, ctor);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class PacketDef {
|
private static class PacketDef {
|
||||||
|
@ -142,12 +143,14 @@ public enum GamePluginMessageProtocol {
|
||||||
private final int id;
|
private final int id;
|
||||||
private final int dir;
|
private final int dir;
|
||||||
private final Class<? extends GameMessagePacket> clazz;
|
private final Class<? extends GameMessagePacket> clazz;
|
||||||
|
private final Supplier<? extends GameMessagePacket> ctor;
|
||||||
|
|
||||||
private PacketDef(String channel, int id, int dir, Class<? extends GameMessagePacket> clazz) {
|
private PacketDef(String channel, int id, int dir, Class<? extends GameMessagePacket> clazz, Supplier<? extends GameMessagePacket> ctor) {
|
||||||
this.channel = channel;
|
this.channel = channel;
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.dir = dir;
|
this.dir = dir;
|
||||||
this.clazz = clazz;
|
this.clazz = clazz;
|
||||||
|
this.ctor = ctor;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -167,12 +170,7 @@ public enum GamePluginMessageProtocol {
|
||||||
throw new IOException("[" + channel + "] Unknown packet ID: " + pktId);
|
throw new IOException("[" + channel + "] Unknown packet ID: " + pktId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
GameMessagePacket ret;
|
GameMessagePacket ret = toRead.ctor.get();
|
||||||
try {
|
|
||||||
ret = toRead.clazz.newInstance();
|
|
||||||
}catch(Throwable t) {
|
|
||||||
throw new RuntimeException("Reflection failed to call packet constructor! (Is it defined?)", t);
|
|
||||||
}
|
|
||||||
ret.readPacket(buffer);
|
ret.readPacket(buffer);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@ import java.io.InputStream;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copyright (c) 2022-2024 lax1dude. All Rights Reserved.
|
* Copyright (c) 2022-2024 lax1dude. All Rights Reserved.
|
||||||
|
@ -28,47 +29,43 @@ import java.util.Map;
|
||||||
public class RelayPacket {
|
public class RelayPacket {
|
||||||
|
|
||||||
private static final Map<Integer,Class<? extends RelayPacket>> definedPacketClasses = new HashMap<>();
|
private static final Map<Integer,Class<? extends RelayPacket>> definedPacketClasses = new HashMap<>();
|
||||||
|
private static final Map<Integer,Supplier<? extends RelayPacket>> definedPacketCtors = new HashMap<>();
|
||||||
private static final Map<Class<? extends RelayPacket>,Integer> definedPacketIds = new HashMap<>();
|
private static final Map<Class<? extends RelayPacket>,Integer> definedPacketIds = new HashMap<>();
|
||||||
|
|
||||||
private static void register(int id, Class<? extends RelayPacket> clazz) {
|
private static void register(int id, Class<? extends RelayPacket> clazz, Supplier<? extends RelayPacket> ctor) {
|
||||||
definedPacketClasses.put(id, clazz);
|
definedPacketClasses.put(id, clazz);
|
||||||
|
definedPacketCtors.put(id, ctor);
|
||||||
definedPacketIds.put(clazz, id);
|
definedPacketIds.put(clazz, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
static {
|
static {
|
||||||
register(0x00, RelayPacket00Handshake.class);
|
register(0x00, RelayPacket00Handshake.class, RelayPacket00Handshake::new);
|
||||||
register(0x01, RelayPacket01ICEServers.class);
|
register(0x01, RelayPacket01ICEServers.class, RelayPacket01ICEServers::new);
|
||||||
register(0x02, RelayPacket02NewClient.class);
|
register(0x02, RelayPacket02NewClient.class, RelayPacket02NewClient::new);
|
||||||
register(0x03, RelayPacket03ICECandidate.class);
|
register(0x03, RelayPacket03ICECandidate.class, RelayPacket03ICECandidate::new);
|
||||||
register(0x04, RelayPacket04Description.class);
|
register(0x04, RelayPacket04Description.class, RelayPacket04Description::new);
|
||||||
register(0x05, RelayPacket05ClientSuccess.class);
|
register(0x05, RelayPacket05ClientSuccess.class, RelayPacket05ClientSuccess::new);
|
||||||
register(0x06, RelayPacket06ClientFailure.class);
|
register(0x06, RelayPacket06ClientFailure.class, RelayPacket06ClientFailure::new);
|
||||||
register(0x07, RelayPacket07LocalWorlds.class);
|
register(0x07, RelayPacket07LocalWorlds.class, RelayPacket07LocalWorlds::new);
|
||||||
register(0x69, RelayPacket69Pong.class);
|
register(0x69, RelayPacket69Pong.class, RelayPacket69Pong::new);
|
||||||
register(0x70, RelayPacket70SpecialUpdate.class);
|
register(0x70, RelayPacket70SpecialUpdate.class, RelayPacket70SpecialUpdate::new);
|
||||||
register(0xFE, RelayPacketFEDisconnectClient.class);
|
register(0xFE, RelayPacketFEDisconnectClient.class, RelayPacketFEDisconnectClient::new);
|
||||||
register(0xFF, RelayPacketFFErrorCode.class);
|
register(0xFF, RelayPacketFFErrorCode.class, RelayPacketFFErrorCode::new);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static RelayPacket readPacket(DataInputStream input, IRelayLogger logger) throws IOException {
|
public static RelayPacket readPacket(DataInputStream input, IRelayLogger logger) throws IOException {
|
||||||
int i = input.read();
|
int i = input.read();
|
||||||
try {
|
Supplier<? extends RelayPacket> ctor = definedPacketCtors.get(i);
|
||||||
Class<? extends RelayPacket> clazz = definedPacketClasses.get(i);
|
if(ctor == null) {
|
||||||
if(clazz == null) {
|
|
||||||
throw new IOException("Unknown packet type: " + i);
|
|
||||||
}
|
|
||||||
RelayPacket pkt = clazz.newInstance();
|
|
||||||
pkt.read(input);
|
|
||||||
int j = input.available();
|
|
||||||
if(j > 0) {
|
|
||||||
throw new IOException("Packet type " + i + " had " + j + " remaining bytes");
|
|
||||||
}
|
|
||||||
return pkt;
|
|
||||||
} catch (InstantiationException | IllegalAccessException e) {
|
|
||||||
logger.error("Could not instanciate packet {}", i);
|
|
||||||
logger.error(e);
|
|
||||||
throw new IOException("Unknown packet type: " + i);
|
throw new IOException("Unknown packet type: " + i);
|
||||||
}
|
}
|
||||||
|
RelayPacket pkt = ctor.get();
|
||||||
|
pkt.read(input);
|
||||||
|
int j = input.available();
|
||||||
|
if(j > 0) {
|
||||||
|
throw new IOException("Packet type " + i + " had " + j + " remaining bytes");
|
||||||
|
}
|
||||||
|
return pkt;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static byte[] writePacket(RelayPacket packet, IRelayLogger logger) throws IOException {
|
public static byte[] writePacket(RelayPacket packet, IRelayLogger logger) throws IOException {
|
||||||
|
|
|
@ -171,7 +171,7 @@ public class BootMenuMain {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
EagUtils.sleep(50l);
|
EagUtils.sleep(50);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -242,7 +242,7 @@ public class ClientBootFactory {
|
||||||
BootMenuMain.runLater(() -> {
|
BootMenuMain.runLater(() -> {
|
||||||
while(!isMainReady("main")) {
|
while(!isMainReady("main")) {
|
||||||
logger.error("main function is not available yet! waiting 250ms...");
|
logger.error("main function is not available yet! waiting 250ms...");
|
||||||
EagUtils.sleep(250l);
|
EagUtils.sleep(250);
|
||||||
}
|
}
|
||||||
BootMenuMain.stopEventLoop();
|
BootMenuMain.stopEventLoop();
|
||||||
callMain("eaglercraftXOpts", launchOptsStr, "main", blockUnsigned);
|
callMain("eaglercraftXOpts", launchOptsStr, "main", blockUnsigned);
|
||||||
|
@ -409,7 +409,7 @@ public class ClientBootFactory {
|
||||||
BootMenuMain.runLater(() -> {
|
BootMenuMain.runLater(() -> {
|
||||||
while(!isMainReady("main")) {
|
while(!isMainReady("main")) {
|
||||||
logger.error("main function is not available yet! waiting 250ms...");
|
logger.error("main function is not available yet! waiting 250ms...");
|
||||||
EagUtils.sleep(250l);
|
EagUtils.sleep(250);
|
||||||
}
|
}
|
||||||
BootMenuMain.stopEventLoop();
|
BootMenuMain.stopEventLoop();
|
||||||
callMain("eaglercraftOpts", launchOptsStr, "main", blockUnsigned);
|
callMain("eaglercraftOpts", launchOptsStr, "main", blockUnsigned);
|
||||||
|
@ -464,7 +464,7 @@ public class ClientBootFactory {
|
||||||
BootMenuMain.runLater(() -> {
|
BootMenuMain.runLater(() -> {
|
||||||
while(!isMainReady("main")) {
|
while(!isMainReady("main")) {
|
||||||
logger.error("main function is not available yet! waiting 250ms...");
|
logger.error("main function is not available yet! waiting 250ms...");
|
||||||
EagUtils.sleep(250l);
|
EagUtils.sleep(250);
|
||||||
}
|
}
|
||||||
BootMenuMain.stopEventLoop();
|
BootMenuMain.stopEventLoop();
|
||||||
callMainOld15("minecraftOpts", container, assetsEPKURL.toExternalForm(), b64Opts, launchConf.joinServer, "main", blockUnsigned);
|
callMainOld15("minecraftOpts", container, assetsEPKURL.toExternalForm(), b64Opts, launchConf.joinServer, "main", blockUnsigned);
|
||||||
|
@ -538,7 +538,7 @@ public class ClientBootFactory {
|
||||||
BootMenuMain.runLater(() -> {
|
BootMenuMain.runLater(() -> {
|
||||||
while(!isMainReady("main")) {
|
while(!isMainReady("main")) {
|
||||||
logger.error("main function is not available yet! waiting 250ms...");
|
logger.error("main function is not available yet! waiting 250ms...");
|
||||||
EagUtils.sleep(250l);
|
EagUtils.sleep(250);
|
||||||
}
|
}
|
||||||
BootMenuMain.stopEventLoop();
|
BootMenuMain.stopEventLoop();
|
||||||
callMainOldB13("minecraftOpts", container, assetsEPKURL.toExternalForm(), launchConf.joinServer, "main", blockUnsigned);
|
callMainOldB13("minecraftOpts", container, assetsEPKURL.toExternalForm(), launchConf.joinServer, "main", blockUnsigned);
|
||||||
|
@ -595,7 +595,7 @@ public class ClientBootFactory {
|
||||||
BootMenuMain.runLater(() -> {
|
BootMenuMain.runLater(() -> {
|
||||||
while(!isMainReady("main")) {
|
while(!isMainReady("main")) {
|
||||||
logger.error("main function is not available yet! waiting 250ms...");
|
logger.error("main function is not available yet! waiting 250ms...");
|
||||||
EagUtils.sleep(250l);
|
EagUtils.sleep(250);
|
||||||
}
|
}
|
||||||
BootMenuMain.stopEventLoop();
|
BootMenuMain.stopEventLoop();
|
||||||
callMain("config", launchOptsStr, "main", blockUnsigned);
|
callMain("config", launchOptsStr, "main", blockUnsigned);
|
||||||
|
@ -649,7 +649,7 @@ public class ClientBootFactory {
|
||||||
BootMenuMain.runLater(() -> {
|
BootMenuMain.runLater(() -> {
|
||||||
while(!isMainReady("main")) {
|
while(!isMainReady("main")) {
|
||||||
logger.error("main function is not available yet! waiting 250ms...");
|
logger.error("main function is not available yet! waiting 250ms...");
|
||||||
EagUtils.sleep(250l);
|
EagUtils.sleep(250);
|
||||||
}
|
}
|
||||||
BootMenuMain.stopEventLoop();
|
BootMenuMain.stopEventLoop();
|
||||||
callMainOldB13("classicConfig", container, assetsEPKURL.toExternalForm(), "", "main", blockUnsigned);
|
callMainOldB13("classicConfig", container, assetsEPKURL.toExternalForm(), "", "main", blockUnsigned);
|
||||||
|
@ -710,7 +710,7 @@ public class ClientBootFactory {
|
||||||
BootMenuMain.runLater(() -> {
|
BootMenuMain.runLater(() -> {
|
||||||
while(!isMainReady("main")) {
|
while(!isMainReady("main")) {
|
||||||
logger.error("main function is not available yet! waiting 250ms...");
|
logger.error("main function is not available yet! waiting 250ms...");
|
||||||
EagUtils.sleep(250l);
|
EagUtils.sleep(250);
|
||||||
}
|
}
|
||||||
BootMenuMain.stopEventLoop();
|
BootMenuMain.stopEventLoop();
|
||||||
callMain(launchConf.launchOptsVar, launchOptsStr, launchConf.mainFunction, blockUnsigned);
|
callMain(launchConf.launchOptsVar, launchOptsStr, launchConf.mainFunction, blockUnsigned);
|
||||||
|
|
|
@ -87,7 +87,7 @@ public class MenuPopupStateLoading extends MenuState implements IProgressMsgCall
|
||||||
public void updateMessage(String msg) {
|
public void updateMessage(String msg) {
|
||||||
this.msg = msg;
|
this.msg = msg;
|
||||||
BootMenuMain.bootMenuDOM.popup_confirm_title.setInnerText(!StringUtils.isAllEmpty(msg) ? (text + "\n\n" + msg) : text);
|
BootMenuMain.bootMenuDOM.popup_confirm_title.setInnerText(!StringUtils.isAllEmpty(msg) ? (text + "\n\n" + msg) : text);
|
||||||
EagUtils.sleep(50l);
|
EagUtils.sleep(50);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -279,7 +279,7 @@ public class MenuStateBoot extends MenuState {
|
||||||
if(res != null) {
|
if(res != null) {
|
||||||
MenuPopupStateLoading loadingScreen = new MenuPopupStateLoading("Importing client...");
|
MenuPopupStateLoading loadingScreen = new MenuPopupStateLoading("Importing client...");
|
||||||
MenuStateBoot.this.changePopupState(loadingScreen);
|
MenuStateBoot.this.changePopupState(loadingScreen);
|
||||||
EagUtils.sleep(50l);
|
EagUtils.sleep(50);
|
||||||
String offlineData = new String(res.fileData, StandardCharsets.UTF_8).replace("\r\n", "\n");
|
String offlineData = new String(res.fileData, StandardCharsets.UTF_8).replace("\r\n", "\n");
|
||||||
EnumOfflineParseType parseType2 = parseTypeF;
|
EnumOfflineParseType parseType2 = parseTypeF;
|
||||||
if(parseType2 == null) {
|
if(parseType2 == null) {
|
||||||
|
|
|
@ -117,7 +117,7 @@ public class PlatformApplication {
|
||||||
@JSBody(params = { "cb" }, script = "if(!navigator.clipboard) { cb(prompt(\"Please enter the text to paste:\") || \"\"); } else if (!navigator.clipboard.readText) cb(\"\"); else navigator.clipboard.readText().then(function(s) { cb(s); }, function(s) { cb(\"\"); });")
|
@JSBody(params = { "cb" }, script = "if(!navigator.clipboard) { cb(prompt(\"Please enter the text to paste:\") || \"\"); } else if (!navigator.clipboard.readText) cb(\"\"); else navigator.clipboard.readText().then(function(s) { cb(s); }, function(s) { cb(\"\"); });")
|
||||||
private static native void getClipboard1(StupidFunctionResolveString cb);
|
private static native void getClipboard1(StupidFunctionResolveString cb);
|
||||||
|
|
||||||
@JSBody(params = { "str" }, script = "if(navigator.clipboard) clipboard.writeText(str);")
|
@JSBody(params = { "str" }, script = "if(navigator.clipboard) navigator.clipboard.writeText(str);")
|
||||||
private static native void setClipboard0(String str);
|
private static native void setClipboard0(String str);
|
||||||
|
|
||||||
public static void setLocalStorage(String name, byte[] data) {
|
public static void setLocalStorage(String name, byte[] data) {
|
||||||
|
|
|
@ -119,6 +119,7 @@ public class PlatformAudio {
|
||||||
public void restart() {
|
public void restart() {
|
||||||
if(isEnded) {
|
if(isEnded) {
|
||||||
isEnded = false;
|
isEnded = false;
|
||||||
|
isPaused = false;
|
||||||
AudioBufferSourceNode src = audioctx.createBufferSource();
|
AudioBufferSourceNode src = audioctx.createBufferSource();
|
||||||
resource.cacheHit = PlatformRuntime.steadyTimeMillis();
|
resource.cacheHit = PlatformRuntime.steadyTimeMillis();
|
||||||
src.setBuffer(resource.buffer);
|
src.setBuffer(resource.buffer);
|
||||||
|
@ -302,13 +303,11 @@ public class PlatformAudio {
|
||||||
}
|
}
|
||||||
gameRecGain = audioctx.createGain();
|
gameRecGain = audioctx.createGain();
|
||||||
gameRecGain.getGain().setValue(gameVol);
|
gameRecGain.getGain().setValue(gameVol);
|
||||||
synchronized(activeSounds) {
|
for(BrowserAudioHandle handle : activeSounds) {
|
||||||
for(BrowserAudioHandle handle : activeSounds) {
|
if(handle.panner != null) {
|
||||||
if(handle.panner != null) {
|
handle.panner.connect(gameRecGain);
|
||||||
handle.panner.connect(gameRecGain);
|
}else {
|
||||||
}else {
|
handle.gain.connect(gameRecGain);
|
||||||
handle.gain.connect(gameRecGain);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PlatformVoiceClient.addRecordingDest(gameRecGain);
|
PlatformVoiceClient.addRecordingDest(gameRecGain);
|
||||||
|
@ -341,16 +340,14 @@ public class PlatformAudio {
|
||||||
gameRecGain.disconnect();
|
gameRecGain.disconnect();
|
||||||
}catch(Throwable t) {
|
}catch(Throwable t) {
|
||||||
}
|
}
|
||||||
synchronized(activeSounds) {
|
for(BrowserAudioHandle handle : activeSounds) {
|
||||||
for(BrowserAudioHandle handle : activeSounds) {
|
try {
|
||||||
try {
|
if(handle.panner != null) {
|
||||||
if(handle.panner != null) {
|
handle.panner.disconnect(gameRecGain);
|
||||||
handle.panner.disconnect(gameRecGain);
|
}else {
|
||||||
}else {
|
handle.gain.disconnect(gameRecGain);
|
||||||
handle.gain.disconnect(gameRecGain);
|
|
||||||
}
|
|
||||||
}catch(Throwable t) {
|
|
||||||
}
|
}
|
||||||
|
}catch(Throwable t) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PlatformVoiceClient.removeRecordingDest(gameRecGain);
|
PlatformVoiceClient.removeRecordingDest(gameRecGain);
|
||||||
|
@ -361,18 +358,13 @@ public class PlatformAudio {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IAudioResource loadAudioData(String filename, boolean holdInCache) {
|
public static IAudioResource loadAudioData(String filename, boolean holdInCache) {
|
||||||
BrowserAudioResource buffer;
|
BrowserAudioResource buffer = soundCache.get(filename);
|
||||||
synchronized(soundCache) {
|
|
||||||
buffer = soundCache.get(filename);
|
|
||||||
}
|
|
||||||
if(buffer == null) {
|
if(buffer == null) {
|
||||||
byte[] file = PlatformAssets.getResourceBytes(filename);
|
byte[] file = PlatformAssets.getResourceBytes(filename);
|
||||||
if(file == null) return null;
|
if(file == null) return null;
|
||||||
buffer = new BrowserAudioResource(decodeAudioData(file, filename));
|
buffer = new BrowserAudioResource(decodeAudioData(file, filename));
|
||||||
if(holdInCache) {
|
if(holdInCache) {
|
||||||
synchronized(soundCache) {
|
soundCache.put(filename, buffer);
|
||||||
soundCache.put(filename, buffer);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(buffer.buffer != null) {
|
if(buffer.buffer != null) {
|
||||||
|
@ -383,23 +375,14 @@ public class PlatformAudio {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static interface IAudioCacheLoader {
|
|
||||||
byte[] loadFile(String filename);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static IAudioResource loadAudioDataNew(String filename, boolean holdInCache, IAudioCacheLoader loader) {
|
public static IAudioResource loadAudioDataNew(String filename, boolean holdInCache, IAudioCacheLoader loader) {
|
||||||
BrowserAudioResource buffer;
|
BrowserAudioResource buffer = soundCache.get(filename);
|
||||||
synchronized(soundCache) {
|
|
||||||
buffer = soundCache.get(filename);
|
|
||||||
}
|
|
||||||
if(buffer == null) {
|
if(buffer == null) {
|
||||||
byte[] file = loader.loadFile(filename);
|
byte[] file = loader.loadFile(filename);
|
||||||
if(file == null) return null;
|
if(file == null) return null;
|
||||||
buffer = new BrowserAudioResource(decodeAudioData(file, filename));
|
buffer = new BrowserAudioResource(decodeAudioData(file, filename));
|
||||||
if(holdInCache) {
|
if(holdInCache) {
|
||||||
synchronized(soundCache) {
|
soundCache.put(filename, buffer);
|
||||||
soundCache.put(filename, buffer);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(buffer.buffer != null) {
|
if(buffer.buffer != null) {
|
||||||
|
@ -457,35 +440,27 @@ public class PlatformAudio {
|
||||||
long millis = PlatformRuntime.steadyTimeMillis();
|
long millis = PlatformRuntime.steadyTimeMillis();
|
||||||
if(millis - cacheFreeTimer > 30000l) {
|
if(millis - cacheFreeTimer > 30000l) {
|
||||||
cacheFreeTimer = millis;
|
cacheFreeTimer = millis;
|
||||||
synchronized(soundCache) {
|
Iterator<BrowserAudioResource> itr = soundCache.values().iterator();
|
||||||
Iterator<BrowserAudioResource> itr = soundCache.values().iterator();
|
while(itr.hasNext()) {
|
||||||
while(itr.hasNext()) {
|
if(millis - itr.next().cacheHit > 600000l) { // 10 minutes
|
||||||
if(millis - itr.next().cacheHit > 600000l) { // 10 minutes
|
itr.remove();
|
||||||
itr.remove();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(millis - activeFreeTimer > 700l) {
|
if(millis - activeFreeTimer > 700l) {
|
||||||
activeFreeTimer = millis;
|
activeFreeTimer = millis;
|
||||||
synchronized(activeSounds) {
|
Iterator<BrowserAudioHandle> itr = activeSounds.iterator();
|
||||||
Iterator<BrowserAudioHandle> itr = activeSounds.iterator();
|
while(itr.hasNext()) {
|
||||||
while(itr.hasNext()) {
|
if(itr.next().shouldFree()) {
|
||||||
if(itr.next().shouldFree()) {
|
itr.remove();
|
||||||
itr.remove();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void flushAudioCache() {
|
public static void flushAudioCache() {
|
||||||
synchronized(soundCache) {
|
soundCache.clear();
|
||||||
soundCache.clear();
|
activeSounds.clear();
|
||||||
}
|
|
||||||
synchronized(activeSounds) {
|
|
||||||
activeSounds.clear();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean available() {
|
public static boolean available() {
|
||||||
|
@ -529,9 +504,7 @@ public class PlatformAudio {
|
||||||
src.start();
|
src.start();
|
||||||
|
|
||||||
BrowserAudioHandle ret = new BrowserAudioHandle(internalTrack, src, panner, gain, pitch);
|
BrowserAudioHandle ret = new BrowserAudioHandle(internalTrack, src, panner, gain, pitch);
|
||||||
synchronized(activeSounds) {
|
activeSounds.add(ret);
|
||||||
activeSounds.add(ret);
|
|
||||||
}
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -557,9 +530,7 @@ public class PlatformAudio {
|
||||||
src.start();
|
src.start();
|
||||||
|
|
||||||
BrowserAudioHandle ret = new BrowserAudioHandle(internalTrack, src, null, gain, pitch);
|
BrowserAudioHandle ret = new BrowserAudioHandle(internalTrack, src, null, gain, pitch);
|
||||||
synchronized(activeSounds) {
|
activeSounds.add(ret);
|
||||||
activeSounds.add(ret);
|
|
||||||
}
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -574,7 +545,7 @@ public class PlatformAudio {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void destroy() {
|
static void destroy() {
|
||||||
soundCache.clear();
|
flushAudioCache();
|
||||||
if(audioctx != null) {
|
if(audioctx != null) {
|
||||||
audioctx.close();
|
audioctx.close();
|
||||||
audioctx = null;
|
audioctx = null;
|
||||||
|
|
|
@ -37,6 +37,7 @@ import org.teavm.jso.gamepad.Gamepad;
|
||||||
import org.teavm.jso.gamepad.GamepadButton;
|
import org.teavm.jso.gamepad.GamepadButton;
|
||||||
import org.teavm.jso.gamepad.GamepadEvent;
|
import org.teavm.jso.gamepad.GamepadEvent;
|
||||||
|
|
||||||
|
import net.lax1dude.eaglercraft.v1_8.Display;
|
||||||
import net.lax1dude.eaglercraft.v1_8.EagUtils;
|
import net.lax1dude.eaglercraft.v1_8.EagUtils;
|
||||||
import net.lax1dude.eaglercraft.v1_8.internal.teavm.ClientMain;
|
import net.lax1dude.eaglercraft.v1_8.internal.teavm.ClientMain;
|
||||||
import net.lax1dude.eaglercraft.v1_8.internal.teavm.EarlyLoadScreen;
|
import net.lax1dude.eaglercraft.v1_8.internal.teavm.EarlyLoadScreen;
|
||||||
|
@ -883,6 +884,12 @@ public class PlatformInput {
|
||||||
static native double getDevicePixelRatio(Window win);
|
static native double getDevicePixelRatio(Window win);
|
||||||
|
|
||||||
public static void update() {
|
public static void update() {
|
||||||
|
update(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final long[] syncTimer = new long[1];
|
||||||
|
|
||||||
|
public static void update(int fpsLimit) {
|
||||||
double r = getDevicePixelRatio(win);
|
double r = getDevicePixelRatio(win);
|
||||||
if(r < 0.01) r = 1.0;
|
if(r < 0.01) r = 1.0;
|
||||||
windowDPI = (float)r;
|
windowDPI = (float)r;
|
||||||
|
@ -934,12 +941,21 @@ public class PlatformInput {
|
||||||
PlatformScreenRecord.captureFrameHook();
|
PlatformScreenRecord.captureFrameHook();
|
||||||
if(getVisibilityState(win.getDocument())) {
|
if(getVisibilityState(win.getDocument())) {
|
||||||
if(vsyncSupport && vsync) {
|
if(vsyncSupport && vsync) {
|
||||||
|
syncTimer[0] = 0l;
|
||||||
asyncRequestAnimationFrame();
|
asyncRequestAnimationFrame();
|
||||||
}else {
|
}else {
|
||||||
PlatformRuntime.swapDelayTeaVM();
|
if(fpsLimit <= 0) {
|
||||||
|
syncTimer[0] = 0l;
|
||||||
|
PlatformRuntime.swapDelayTeaVM();
|
||||||
|
}else {
|
||||||
|
if(!Display.sync(fpsLimit, syncTimer)) {
|
||||||
|
PlatformRuntime.swapDelayTeaVM();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}else {
|
}else {
|
||||||
EagUtils.sleep(50l);
|
syncTimer[0] = 0l;
|
||||||
|
EagUtils.sleep(50);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1177,6 +1193,10 @@ public class PlatformInput {
|
||||||
enableRepeatEvents = b;
|
enableRepeatEvents = b;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean keyboardAreKeysLocked() {
|
||||||
|
return lockKeys;
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean mouseNext() {
|
public static boolean mouseNext() {
|
||||||
currentEvent = null;
|
currentEvent = null;
|
||||||
synchronized(mouseEvents) {
|
synchronized(mouseEvents) {
|
||||||
|
@ -1262,7 +1282,7 @@ public class PlatformInput {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean mouseIsButtonDown(int i) {
|
public static boolean mouseIsButtonDown(int i) {
|
||||||
return buttonStates[i];
|
return (i < 0 || i >= buttonStates.length) ? false : buttonStates[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int mouseGetDWheel() {
|
public static int mouseGetDWheel() {
|
||||||
|
@ -1553,7 +1573,7 @@ public class PlatformInput {
|
||||||
EarlyLoadScreen.paintEnable(PlatformOpenGL.checkVAOCapable(), allowBootMenu);
|
EarlyLoadScreen.paintEnable(PlatformOpenGL.checkVAOCapable(), allowBootMenu);
|
||||||
|
|
||||||
while(mouseEvents.isEmpty() && keyEvents.isEmpty() && touchEvents.isEmpty()) {
|
while(mouseEvents.isEmpty() && keyEvents.isEmpty() && touchEvents.isEmpty()) {
|
||||||
EagUtils.sleep(100l);
|
EagUtils.sleep(100);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1720,13 +1740,13 @@ public class PlatformInput {
|
||||||
}
|
}
|
||||||
|
|
||||||
@JSBody(params = { "doc" }, script = "doc.exitFullscreen();")
|
@JSBody(params = { "doc" }, script = "doc.exitFullscreen();")
|
||||||
private static native void exitFullscreen(HTMLDocument doc);
|
private static native void exitFullscreen(HTMLDocument doc);
|
||||||
|
|
||||||
@JSBody(params = { "doc" }, script = "doc.webkitExitFullscreen();")
|
@JSBody(params = { "doc" }, script = "doc.webkitExitFullscreen();")
|
||||||
private static native void webkitExitFullscreen(HTMLDocument doc);
|
private static native void webkitExitFullscreen(HTMLDocument doc);
|
||||||
|
|
||||||
@JSBody(params = { "doc" }, script = "doc.mozCancelFullscreen();")
|
@JSBody(params = { "doc" }, script = "doc.mozCancelFullscreen();")
|
||||||
private static native void mozCancelFullscreen(HTMLDocument doc);
|
private static native void mozCancelFullscreen(HTMLDocument doc);
|
||||||
|
|
||||||
public static void showCursor(EnumCursorType cursor) {
|
public static void showCursor(EnumCursorType cursor) {
|
||||||
switch(cursor) {
|
switch(cursor) {
|
||||||
|
@ -1843,20 +1863,13 @@ public class PlatformInput {
|
||||||
return ret != null ? ret.intValue() : -1;
|
return ret != null ? ret.intValue() : -1;
|
||||||
};
|
};
|
||||||
|
|
||||||
public static void touchBufferFlush() {
|
|
||||||
pointerLockSupported = 0;
|
|
||||||
pointerLockFlag = true;
|
|
||||||
currentTouchState = null;
|
|
||||||
touchEvents.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Note: this can't be called from the main loop, don't try
|
// Note: this can't be called from the main loop, don't try
|
||||||
private static void touchOpenDeviceKeyboard() {
|
private static void touchOpenDeviceKeyboard() {
|
||||||
if(!touchIsDeviceKeyboardOpenMAYBE()) {
|
if(!touchIsDeviceKeyboardOpenMAYBE()) {
|
||||||
if(touchKeyboardField != null) {
|
if(touchKeyboardField != null) {
|
||||||
touchKeyboardField.blur();
|
touchKeyboardField.blur();
|
||||||
touchKeyboardField.setValue("");
|
touchKeyboardField.setValue("");
|
||||||
EagUtils.sleep(10l);
|
EagUtils.sleep(10);
|
||||||
if(touchKeyboardForm != null) {
|
if(touchKeyboardForm != null) {
|
||||||
touchKeyboardForm.removeChild(touchKeyboardField);
|
touchKeyboardForm.removeChild(touchKeyboardField);
|
||||||
}else {
|
}else {
|
||||||
|
@ -2127,7 +2140,7 @@ public class PlatformInput {
|
||||||
touchKeyboardField.blur();
|
touchKeyboardField.blur();
|
||||||
touchKeyboardField.setValue("");
|
touchKeyboardField.setValue("");
|
||||||
if(sync) {
|
if(sync) {
|
||||||
EagUtils.sleep(10l);
|
EagUtils.sleep(10);
|
||||||
if(touchKeyboardForm != null) {
|
if(touchKeyboardForm != null) {
|
||||||
touchKeyboardForm.removeChild(touchKeyboardField);
|
touchKeyboardForm.removeChild(touchKeyboardField);
|
||||||
}else {
|
}else {
|
||||||
|
|
|
@ -469,10 +469,10 @@ public class PlatformOpenGL {
|
||||||
data == null ? null : EaglerArrayBufferAllocator.getDataView8Unsigned(data));
|
data == null ? null : EaglerArrayBufferAllocator.getDataView8Unsigned(data));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final void _wglTexImage2D(int target, int level, int internalFormat, int width,
|
public static final void _wglTexImage2Df32(int target, int level, int internalFormat, int width,
|
||||||
int height, int border, int format, int type, FloatBuffer data) {
|
int height, int border, int format, int type, FloatBuffer data) {
|
||||||
ctx.texImage2D(target, level, internalFormat, width, height, border, format, type,
|
ctx.texImage2D(target, level, internalFormat, width, height, border, format, type,
|
||||||
data == null ? null : EaglerArrayBufferAllocator.getDataView8Unsigned(data));
|
data == null ? null : EaglerArrayBufferAllocator.getDataView32F(data));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final void _wglTexSubImage2D(int target, int level, int xoffset, int yoffset,
|
public static final void _wglTexSubImage2D(int target, int level, int xoffset, int yoffset,
|
||||||
|
@ -493,10 +493,10 @@ public class PlatformOpenGL {
|
||||||
data == null ? null : EaglerArrayBufferAllocator.getDataView8Unsigned(data));
|
data == null ? null : EaglerArrayBufferAllocator.getDataView8Unsigned(data));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final void _wglTexSubImage2D(int target, int level, int xoffset, int yoffset,
|
public static final void _wglTexSubImage2Df32(int target, int level, int xoffset, int yoffset,
|
||||||
int width, int height, int format, int type, FloatBuffer data) {
|
int width, int height, int format, int type, FloatBuffer data) {
|
||||||
ctx.texSubImage2D(target, level, xoffset, yoffset, width, height, format, type,
|
ctx.texSubImage2D(target, level, xoffset, yoffset, width, height, format, type,
|
||||||
data == null ? null : EaglerArrayBufferAllocator.getDataView8Unsigned(data));
|
data == null ? null : EaglerArrayBufferAllocator.getDataView32F(data));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final void _wglCopyTexSubImage2D(int target, int level, int xoffset, int yoffset,
|
public static final void _wglCopyTexSubImage2D(int target, int level, int xoffset, int yoffset,
|
||||||
|
@ -517,19 +517,19 @@ public class PlatformOpenGL {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final void _wglShaderSource(IShaderGL obj, String source) {
|
public static final void _wglShaderSource(IShaderGL obj, String source) {
|
||||||
ctx.shaderSource(obj == null ? null : ((OpenGLObjects.ShaderGL)obj).ptr, source);
|
ctx.shaderSource(((OpenGLObjects.ShaderGL)obj).ptr, source);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final void _wglCompileShader(IShaderGL obj) {
|
public static final void _wglCompileShader(IShaderGL obj) {
|
||||||
ctx.compileShader(obj == null ? null : ((OpenGLObjects.ShaderGL)obj).ptr);
|
ctx.compileShader(((OpenGLObjects.ShaderGL)obj).ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final int _wglGetShaderi(IShaderGL obj, int param) {
|
public static final int _wglGetShaderi(IShaderGL obj, int param) {
|
||||||
return ctx.getShaderParameteri(obj == null ? null : ((OpenGLObjects.ShaderGL)obj).ptr, param);
|
return ctx.getShaderParameteri(((OpenGLObjects.ShaderGL)obj).ptr, param);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final String _wglGetShaderInfoLog(IShaderGL obj) {
|
public static final String _wglGetShaderInfoLog(IShaderGL obj) {
|
||||||
return ctx.getShaderInfoLog(obj == null ? null : ((OpenGLObjects.ShaderGL)obj).ptr);
|
return ctx.getShaderInfoLog(((OpenGLObjects.ShaderGL)obj).ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final void _wglUseProgram(IProgramGL obj) {
|
public static final void _wglUseProgram(IProgramGL obj) {
|
||||||
|
@ -537,33 +537,31 @@ public class PlatformOpenGL {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final void _wglAttachShader(IProgramGL obj, IShaderGL shader) {
|
public static final void _wglAttachShader(IProgramGL obj, IShaderGL shader) {
|
||||||
ctx.attachShader(obj == null ? null : ((OpenGLObjects.ProgramGL)obj).ptr,
|
ctx.attachShader(((OpenGLObjects.ProgramGL)obj).ptr, ((OpenGLObjects.ShaderGL)shader).ptr);
|
||||||
shader == null ? null : ((OpenGLObjects.ShaderGL)shader).ptr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final void _wglDetachShader(IProgramGL obj, IShaderGL shader) {
|
public static final void _wglDetachShader(IProgramGL obj, IShaderGL shader) {
|
||||||
ctx.detachShader(obj == null ? null : ((OpenGLObjects.ProgramGL)obj).ptr,
|
ctx.detachShader(((OpenGLObjects.ProgramGL)obj).ptr, ((OpenGLObjects.ShaderGL)shader).ptr);
|
||||||
shader == null ? null : ((OpenGLObjects.ShaderGL)shader).ptr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final void _wglLinkProgram(IProgramGL obj) {
|
public static final void _wglLinkProgram(IProgramGL obj) {
|
||||||
ctx.linkProgram(obj == null ? null : ((OpenGLObjects.ProgramGL)obj).ptr);
|
ctx.linkProgram(((OpenGLObjects.ProgramGL)obj).ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final int _wglGetProgrami(IProgramGL obj, int param) {
|
public static final int _wglGetProgrami(IProgramGL obj, int param) {
|
||||||
return ctx.getProgramParameteri(obj == null ? null : ((OpenGLObjects.ProgramGL)obj).ptr, param);
|
return ctx.getProgramParameteri(((OpenGLObjects.ProgramGL)obj).ptr, param);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final String _wglGetProgramInfoLog(IProgramGL obj) {
|
public static final String _wglGetProgramInfoLog(IProgramGL obj) {
|
||||||
return ctx.getProgramInfoLog(obj == null ? null : ((OpenGLObjects.ProgramGL)obj).ptr);
|
return ctx.getProgramInfoLog(((OpenGLObjects.ProgramGL)obj).ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final void _wglBindAttribLocation(IProgramGL obj, int index, String name) {
|
public static final void _wglBindAttribLocation(IProgramGL obj, int index, String name) {
|
||||||
ctx.bindAttribLocation(obj == null ? null : ((OpenGLObjects.ProgramGL)obj).ptr, index, name);
|
ctx.bindAttribLocation(((OpenGLObjects.ProgramGL)obj).ptr, index, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final int _wglGetAttribLocation(IProgramGL obj, String name) {
|
public static final int _wglGetAttribLocation(IProgramGL obj, String name) {
|
||||||
return ctx.getAttribLocation(obj == null ? null : ((OpenGLObjects.ProgramGL)obj).ptr, name);
|
return ctx.getAttribLocation(((OpenGLObjects.ProgramGL)obj).ptr, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final void _wglDrawArrays(int mode, int first, int count) {
|
public static final void _wglDrawArrays(int mode, int first, int count) {
|
||||||
|
@ -571,13 +569,13 @@ public class PlatformOpenGL {
|
||||||
//checkErr("_wglDrawArrays(" + mode + ", " + first + ", " + count + ");");
|
//checkErr("_wglDrawArrays(" + mode + ", " + first + ", " + count + ");");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final void _wglDrawArraysInstanced(int mode, int first, int count, int instanced) {
|
public static final void _wglDrawArraysInstanced(int mode, int first, int count, int instances) {
|
||||||
switch(instancingImpl) {
|
switch(instancingImpl) {
|
||||||
case INSTANCE_IMPL_CORE:
|
case INSTANCE_IMPL_CORE:
|
||||||
ctx.drawArraysInstanced(mode, first, count, instanced);
|
ctx.drawArraysInstanced(mode, first, count, instances);
|
||||||
break;
|
break;
|
||||||
case INSTANCE_IMPL_ANGLE:
|
case INSTANCE_IMPL_ANGLE:
|
||||||
ANGLEInstancedArrays.drawArraysInstancedANGLE(mode, first, count, instanced);
|
ANGLEInstancedArrays.drawArraysInstancedANGLE(mode, first, count, instances);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
|
@ -590,13 +588,13 @@ public class PlatformOpenGL {
|
||||||
//checkErr("_wglDrawElements(" + mode + ", " + count + ", " + type + ", " + offset + ");");
|
//checkErr("_wglDrawElements(" + mode + ", " + count + ", " + type + ", " + offset + ");");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final void _wglDrawElementsInstanced(int mode, int count, int type, int offset, int instanced) {
|
public static final void _wglDrawElementsInstanced(int mode, int count, int type, int offset, int instances) {
|
||||||
switch(instancingImpl) {
|
switch(instancingImpl) {
|
||||||
case INSTANCE_IMPL_CORE:
|
case INSTANCE_IMPL_CORE:
|
||||||
ctx.drawElementsInstanced(mode, count, type, offset, instanced);
|
ctx.drawElementsInstanced(mode, count, type, offset, instances);
|
||||||
break;
|
break;
|
||||||
case INSTANCE_IMPL_ANGLE:
|
case INSTANCE_IMPL_ANGLE:
|
||||||
ANGLEInstancedArrays.drawElementsInstancedANGLE(mode, count, type, offset, instanced);
|
ANGLEInstancedArrays.drawElementsInstancedANGLE(mode, count, type, offset, instances);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
|
@ -708,13 +706,11 @@ public class PlatformOpenGL {
|
||||||
|
|
||||||
public static final void _wglFramebufferTexture2D(int target, int attachment, int texTarget,
|
public static final void _wglFramebufferTexture2D(int target, int attachment, int texTarget,
|
||||||
ITextureGL texture, int level) {
|
ITextureGL texture, int level) {
|
||||||
ctx.framebufferTexture2D(target, attachment, texTarget,
|
ctx.framebufferTexture2D(target, attachment, texTarget, ((OpenGLObjects.TextureGL)texture).ptr, level);
|
||||||
texture == null ? null : ((OpenGLObjects.TextureGL)texture).ptr, level);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final void _wglFramebufferTextureLayer(int target, int attachment, ITextureGL texture, int level, int layer) {
|
public static final void _wglFramebufferTextureLayer(int target, int attachment, ITextureGL texture, int level, int layer) {
|
||||||
ctx.framebufferTextureLayer(target, attachment,
|
ctx.framebufferTextureLayer(target, attachment, ((OpenGLObjects.TextureGL) texture).ptr, level, layer);
|
||||||
texture == null ? null : ((OpenGLObjects.TextureGL) texture).ptr, level, layer);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final void _wglBlitFramebuffer(int srcX0, int srcY0, int srcX1, int srcY1,
|
public static final void _wglBlitFramebuffer(int srcX0, int srcY0, int srcX1, int srcY1,
|
||||||
|
|
|
@ -12,7 +12,6 @@ import java.util.Set;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
import net.lax1dude.eaglercraft.v1_8.EagRuntime;
|
import net.lax1dude.eaglercraft.v1_8.EagRuntime;
|
||||||
import net.lax1dude.eaglercraft.v1_8.EagUtils;
|
|
||||||
import net.lax1dude.eaglercraft.v1_8.EaglercraftUUID;
|
import net.lax1dude.eaglercraft.v1_8.EaglercraftUUID;
|
||||||
import net.lax1dude.eaglercraft.v1_8.EaglercraftVersion;
|
import net.lax1dude.eaglercraft.v1_8.EaglercraftVersion;
|
||||||
import net.lax1dude.eaglercraft.v1_8.Filesystem;
|
import net.lax1dude.eaglercraft.v1_8.Filesystem;
|
||||||
|
@ -37,6 +36,8 @@ import org.teavm.jso.dom.xml.Node;
|
||||||
import org.teavm.jso.dom.xml.NodeList;
|
import org.teavm.jso.dom.xml.NodeList;
|
||||||
import org.teavm.jso.typedarrays.ArrayBuffer;
|
import org.teavm.jso.typedarrays.ArrayBuffer;
|
||||||
import org.teavm.jso.webgl.WebGLFramebuffer;
|
import org.teavm.jso.webgl.WebGLFramebuffer;
|
||||||
|
import org.teavm.platform.Platform;
|
||||||
|
import org.teavm.platform.PlatformRunnable;
|
||||||
|
|
||||||
import com.google.common.collect.Collections2;
|
import com.google.common.collect.Collections2;
|
||||||
import com.google.common.collect.Iterators;
|
import com.google.common.collect.Iterators;
|
||||||
|
@ -172,11 +173,12 @@ public class PlatformRuntime {
|
||||||
logger.info("Creating main game canvas");
|
logger.info("Creating main game canvas");
|
||||||
|
|
||||||
root = doc.getElementById(ClientMain.configRootElementId);
|
root = doc.getElementById(ClientMain.configRootElementId);
|
||||||
root.getClassList().add("_eaglercraftX_root_element");
|
|
||||||
if(root == null) {
|
if(root == null) {
|
||||||
throw new RuntimeInitializationFailureException("Root element \"" + ClientMain.configRootElementId + "\" was not found in this document!");
|
throw new RuntimeInitializationFailureException("Root element \"" + ClientMain.configRootElementId + "\" was not found in this document!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
root.getClassList().add("_eaglercraftX_root_element");
|
||||||
|
|
||||||
Node nodeler;
|
Node nodeler;
|
||||||
while((nodeler = root.getLastChild()) != null && TeaVMUtils.isTruthy(nodeler)) {
|
while((nodeler = root.getLastChild()) != null && TeaVMUtils.isTruthy(nodeler)) {
|
||||||
root.removeChild(nodeler);
|
root.removeChild(nodeler);
|
||||||
|
@ -748,7 +750,7 @@ public class PlatformRuntime {
|
||||||
if(!useDelayOnSwap && immediateContinueSupport) {
|
if(!useDelayOnSwap && immediateContinueSupport) {
|
||||||
immediateContinueTeaVM0();
|
immediateContinueTeaVM0();
|
||||||
}else {
|
}else {
|
||||||
EagUtils.sleep(0l);
|
sleep(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -756,7 +758,7 @@ public class PlatformRuntime {
|
||||||
if(immediateContinueSupport) {
|
if(immediateContinueSupport) {
|
||||||
immediateContinueTeaVM0();
|
immediateContinueTeaVM0();
|
||||||
}else {
|
}else {
|
||||||
EagUtils.sleep(0l);
|
sleep(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -890,7 +892,7 @@ public class PlatformRuntime {
|
||||||
immediateContinueChannel = null;
|
immediateContinueChannel = null;
|
||||||
return IMMEDIATE_CONT_FAILED_NOT_ASYNC;
|
return IMMEDIATE_CONT_FAILED_NOT_ASYNC;
|
||||||
}
|
}
|
||||||
EagUtils.sleep(10l);
|
sleep(10);
|
||||||
currentMsgChannelContinueHack = null;
|
currentMsgChannelContinueHack = null;
|
||||||
if(!checkMe[0]) {
|
if(!checkMe[0]) {
|
||||||
if(immediateContinueChannel != null) {
|
if(immediateContinueChannel != null) {
|
||||||
|
@ -945,7 +947,7 @@ public class PlatformRuntime {
|
||||||
currentLegacyContinueHack = null;
|
currentLegacyContinueHack = null;
|
||||||
return IMMEDIATE_CONT_FAILED_NOT_ASYNC;
|
return IMMEDIATE_CONT_FAILED_NOT_ASYNC;
|
||||||
}
|
}
|
||||||
EagUtils.sleep(10l);
|
sleep(10);
|
||||||
currentLegacyContinueHack = null;
|
currentLegacyContinueHack = null;
|
||||||
if(!checkMe[0]) {
|
if(!checkMe[0]) {
|
||||||
return IMMEDIATE_CONT_FAILED_NOT_CONT;
|
return IMMEDIATE_CONT_FAILED_NOT_CONT;
|
||||||
|
@ -1103,6 +1105,24 @@ public class PlatformRuntime {
|
||||||
return (long)(steadyTimeMillis0(steadyTimeFunc) * 1000000.0);
|
return (long)(steadyTimeMillis0(steadyTimeFunc) * 1000000.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Async
|
||||||
|
public static native void sleep(int millis);
|
||||||
|
|
||||||
|
private static void sleep(int millis, final AsyncCallback<Void> callback) {
|
||||||
|
Platform.schedule(new DumbSleepHandler(callback), millis);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class DumbSleepHandler implements PlatformRunnable {
|
||||||
|
private final AsyncCallback<Void> callback;
|
||||||
|
private DumbSleepHandler(AsyncCallback<Void> callback) {
|
||||||
|
this.callback = callback;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
callback.complete(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void checkBootMenu() {
|
static void checkBootMenu() {
|
||||||
while(PlatformInput.keyboardNext()) {
|
while(PlatformInput.keyboardNext()) {
|
||||||
if(PlatformInput.keyboardGetEventKeyState()) {
|
if(PlatformInput.keyboardGetEventKeyState()) {
|
||||||
|
|
|
@ -2,6 +2,7 @@ package net.lax1dude.eaglercraft.v1_8.internal;
|
||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.EnumSet;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
@ -49,7 +50,7 @@ public class PlatformScreenRecord {
|
||||||
static Window win;
|
static Window win;
|
||||||
static HTMLCanvasElement canvas;
|
static HTMLCanvasElement canvas;
|
||||||
static boolean support;
|
static boolean support;
|
||||||
static final Set<EnumScreenRecordingCodec> supportedCodecs = new HashSet<>();
|
static final Set<EnumScreenRecordingCodec> supportedCodecs = EnumSet.noneOf(EnumScreenRecordingCodec.class);
|
||||||
static float currentGameVolume = 1.0f;
|
static float currentGameVolume = 1.0f;
|
||||||
static float currentMicVolume = 0.0f;
|
static float currentMicVolume = 0.0f;
|
||||||
static MediaStream recStream = null;
|
static MediaStream recStream = null;
|
||||||
|
|
|
@ -218,7 +218,7 @@ public class ClientMain {
|
||||||
systemOut.println("ClientMain: [INFO] launching eaglercraftx main thread");
|
systemOut.println("ClientMain: [INFO] launching eaglercraftx main thread");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Main.appMain(new String[0]);
|
Main.appMain();
|
||||||
}catch(Throwable t) {
|
}catch(Throwable t) {
|
||||||
systemErr.println("ClientMain: [ERROR] unhandled exception caused main thread to exit");
|
systemErr.println("ClientMain: [ERROR] unhandled exception caused main thread to exit");
|
||||||
EagRuntime.debugPrintStackTraceToSTDERR(t);
|
EagRuntime.debugPrintStackTraceToSTDERR(t);
|
||||||
|
|
|
@ -199,7 +199,7 @@ public class EarlyLoadScreen {
|
||||||
_wglDisableVertexAttribArray(0);
|
_wglDisableVertexAttribArray(0);
|
||||||
|
|
||||||
PlatformInput.update();
|
PlatformInput.update();
|
||||||
EagUtils.sleep(50l); // allow webgl to flush
|
EagUtils.sleep(50); // allow webgl to flush
|
||||||
|
|
||||||
_wglUseProgram(null);
|
_wglUseProgram(null);
|
||||||
_wglBindBuffer(GL_ARRAY_BUFFER, null);
|
_wglBindBuffer(GL_ARRAY_BUFFER, null);
|
||||||
|
@ -266,7 +266,7 @@ public class EarlyLoadScreen {
|
||||||
_wglDisableVertexAttribArray(0);
|
_wglDisableVertexAttribArray(0);
|
||||||
|
|
||||||
PlatformInput.update();
|
PlatformInput.update();
|
||||||
EagUtils.sleep(50l); // allow webgl to flush
|
EagUtils.sleep(50); // allow webgl to flush
|
||||||
|
|
||||||
_wglUseProgram(null);
|
_wglUseProgram(null);
|
||||||
_wglBindBuffer(GL_ARRAY_BUFFER, null);
|
_wglBindBuffer(GL_ARRAY_BUFFER, null);
|
||||||
|
@ -351,7 +351,7 @@ public class EarlyLoadScreen {
|
||||||
}
|
}
|
||||||
|
|
||||||
PlatformInput.update();
|
PlatformInput.update();
|
||||||
EagUtils.sleep(50l); // allow webgl to flush
|
EagUtils.sleep(50); // allow webgl to flush
|
||||||
|
|
||||||
_wglUseProgram(null);
|
_wglUseProgram(null);
|
||||||
if(!(vaos && softVAOs)) {
|
if(!(vaos && softVAOs)) {
|
||||||
|
|
|
@ -90,8 +90,8 @@ public class JOrbisAudioBufferDecoder {
|
||||||
logger.warn("[{}]: Number of channels in header does not match the stream", errorString);
|
logger.warn("[{}]: Number of channels in header does not match the stream", errorString);
|
||||||
}
|
}
|
||||||
if(ch == -1 || len == 0) {
|
if(ch == -1 || len == 0) {
|
||||||
logger.warn("[{}]: Empty file", errorString);
|
logger.error("[{}]: Empty file", errorString);
|
||||||
return ctx.createBuffer(ch, 0, dec.jorbisInfo.rate);
|
return null;
|
||||||
}
|
}
|
||||||
switch(loadVia) {
|
switch(loadVia) {
|
||||||
case LOAD_VIA_AUDIOBUFFER: {
|
case LOAD_VIA_AUDIOBUFFER: {
|
||||||
|
|
|
@ -47,6 +47,7 @@ public class TeaVMClientConfigAdapter implements IClientConfigAdapter, IBootMenu
|
||||||
private String worldsDB = "worlds";
|
private String worldsDB = "worlds";
|
||||||
private String resourcePacksDB = "resourcePacks";
|
private String resourcePacksDB = "resourcePacks";
|
||||||
private JSONObject integratedServerOpts;
|
private JSONObject integratedServerOpts;
|
||||||
|
private boolean checkGLErrors = false;
|
||||||
private boolean checkShaderGLErrors = false;
|
private boolean checkShaderGLErrors = false;
|
||||||
private boolean demoMode = EaglercraftVersion.forceDemoMode;
|
private boolean demoMode = EaglercraftVersion.forceDemoMode;
|
||||||
private boolean isAllowUpdateSvc = EaglercraftVersion.enableUpdateService;
|
private boolean isAllowUpdateSvc = EaglercraftVersion.enableUpdateService;
|
||||||
|
@ -97,6 +98,7 @@ public class TeaVMClientConfigAdapter implements IClientConfigAdapter, IBootMenu
|
||||||
serverToJoin = eaglercraftXOpts.getJoinServer(null);
|
serverToJoin = eaglercraftXOpts.getJoinServer(null);
|
||||||
worldsDB = eaglercraftXOpts.getWorldsDB("worlds");
|
worldsDB = eaglercraftXOpts.getWorldsDB("worlds");
|
||||||
resourcePacksDB = eaglercraftXOpts.getResourcePacksDB("resourcePacks");
|
resourcePacksDB = eaglercraftXOpts.getResourcePacksDB("resourcePacks");
|
||||||
|
checkGLErrors = eaglercraftXOpts.getCheckGLErrors(false);
|
||||||
checkShaderGLErrors = eaglercraftXOpts.getCheckShaderGLErrors(false);
|
checkShaderGLErrors = eaglercraftXOpts.getCheckShaderGLErrors(false);
|
||||||
demoMode = EaglercraftVersion.forceDemoMode || eaglercraftXOpts.getDemoMode(false);
|
demoMode = EaglercraftVersion.forceDemoMode || eaglercraftXOpts.getDemoMode(false);
|
||||||
isAllowUpdateSvc = EaglercraftVersion.enableUpdateService && !demoMode && eaglercraftXOpts.getAllowUpdateSvc(true);
|
isAllowUpdateSvc = EaglercraftVersion.enableUpdateService && !demoMode && eaglercraftXOpts.getAllowUpdateSvc(true);
|
||||||
|
@ -224,6 +226,7 @@ public class TeaVMClientConfigAdapter implements IClientConfigAdapter, IBootMenu
|
||||||
serverToJoin = eaglercraftOpts.optString("joinServer", null);
|
serverToJoin = eaglercraftOpts.optString("joinServer", null);
|
||||||
worldsDB = eaglercraftOpts.optString("worldsDB", "worlds");
|
worldsDB = eaglercraftOpts.optString("worldsDB", "worlds");
|
||||||
resourcePacksDB = eaglercraftOpts.optString("resourcePacksDB", "resourcePacks");
|
resourcePacksDB = eaglercraftOpts.optString("resourcePacksDB", "resourcePacks");
|
||||||
|
checkGLErrors = eaglercraftOpts.optBoolean("checkGLErrors", false);
|
||||||
checkShaderGLErrors = eaglercraftOpts.optBoolean("checkShaderGLErrors", false);
|
checkShaderGLErrors = eaglercraftOpts.optBoolean("checkShaderGLErrors", false);
|
||||||
if(EaglercraftVersion.forceDemoMode) {
|
if(EaglercraftVersion.forceDemoMode) {
|
||||||
eaglercraftOpts.put("demoMode", true);
|
eaglercraftOpts.put("demoMode", true);
|
||||||
|
@ -361,6 +364,11 @@ public class TeaVMClientConfigAdapter implements IClientConfigAdapter, IBootMenu
|
||||||
return relays;
|
return relays;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isCheckGLErrors() {
|
||||||
|
return checkGLErrors;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isCheckShaderGLErrors() {
|
public boolean isCheckShaderGLErrors() {
|
||||||
return checkShaderGLErrors;
|
return checkShaderGLErrors;
|
||||||
|
@ -553,6 +561,7 @@ public class TeaVMClientConfigAdapter implements IClientConfigAdapter, IBootMenu
|
||||||
jsonObject.put("joinServer", serverToJoin);
|
jsonObject.put("joinServer", serverToJoin);
|
||||||
jsonObject.put("worldsDB", worldsDB);
|
jsonObject.put("worldsDB", worldsDB);
|
||||||
jsonObject.put("resourcePacksDB", resourcePacksDB);
|
jsonObject.put("resourcePacksDB", resourcePacksDB);
|
||||||
|
jsonObject.put("checkGLErrors", checkGLErrors);
|
||||||
jsonObject.put("checkShaderGLErrors", checkShaderGLErrors);
|
jsonObject.put("checkShaderGLErrors", checkShaderGLErrors);
|
||||||
jsonObject.put("demoMode", demoMode);
|
jsonObject.put("demoMode", demoMode);
|
||||||
jsonObject.put("allowUpdateSvc", isAllowUpdateSvc);
|
jsonObject.put("allowUpdateSvc", isAllowUpdateSvc);
|
||||||
|
|
|
@ -139,7 +139,7 @@ public class TeaVMUpdateThread implements Runnable {
|
||||||
if(b == null) {
|
if(b == null) {
|
||||||
updateProg.progressBar = 1.0f;
|
updateProg.progressBar = 1.0f;
|
||||||
updateProg.statusString3 = "FAILED!";
|
updateProg.statusString3 = "FAILED!";
|
||||||
EagUtils.sleep(300l);
|
EagUtils.sleep(300);
|
||||||
updateProg.progressBar = -1.0f;
|
updateProg.progressBar = -1.0f;
|
||||||
updateProg.statusString3 = null;
|
updateProg.statusString3 = null;
|
||||||
continue;
|
continue;
|
||||||
|
@ -155,7 +155,7 @@ public class TeaVMUpdateThread implements Runnable {
|
||||||
}
|
}
|
||||||
updateProg.statusString2 = "Signature Invalid!";
|
updateProg.statusString2 = "Signature Invalid!";
|
||||||
logger.error("File signature is invalid: {}", url);
|
logger.error("File signature is invalid: {}", url);
|
||||||
EagUtils.sleep(1000l);
|
EagUtils.sleep(1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
updateProg.progressBar = -1.0f;
|
updateProg.progressBar = -1.0f;
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
package net.lax1dude.eaglercraft.v1_8.internal.teavm;
|
package net.lax1dude.eaglercraft.v1_8.internal.teavm;
|
||||||
|
|
||||||
import org.teavm.jso.JSBody;
|
|
||||||
import org.teavm.jso.dom.events.Event;
|
import org.teavm.jso.dom.events.Event;
|
||||||
import org.teavm.jso.dom.events.EventListener;
|
import org.teavm.jso.dom.events.EventListener;
|
||||||
import org.teavm.jso.dom.events.MessageEvent;
|
import org.teavm.jso.dom.events.MessageEvent;
|
||||||
import org.teavm.jso.typedarrays.ArrayBuffer;
|
|
||||||
import org.teavm.jso.websocket.WebSocket;
|
import org.teavm.jso.websocket.WebSocket;
|
||||||
|
|
||||||
import net.lax1dude.eaglercraft.v1_8.EagUtils;
|
import net.lax1dude.eaglercraft.v1_8.EagUtils;
|
||||||
|
@ -73,7 +71,7 @@ public class TeaVMWebSocketClient extends AbstractWebSocketClient {
|
||||||
public boolean connectBlocking(int timeoutMS) {
|
public boolean connectBlocking(int timeoutMS) {
|
||||||
long startTime = PlatformRuntime.steadyTimeMillis();
|
long startTime = PlatformRuntime.steadyTimeMillis();
|
||||||
while(!sockIsConnected && !sockIsFailed) {
|
while(!sockIsConnected && !sockIsFailed) {
|
||||||
EagUtils.sleep(50l);
|
EagUtils.sleep(50);
|
||||||
if(PlatformRuntime.steadyTimeMillis() - startTime > timeoutMS * 1000) {
|
if(PlatformRuntime.steadyTimeMillis() - startTime > timeoutMS * 1000) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -112,13 +110,10 @@ public class TeaVMWebSocketClient extends AbstractWebSocketClient {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@JSBody(params = { "sock", "buffer" }, script = "sock.send(buffer);")
|
|
||||||
protected static native void nativeBinarySend(WebSocket sock, ArrayBuffer buffer);
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void send(byte[] bytes) {
|
public void send(byte[] bytes) {
|
||||||
if(sockIsConnected) {
|
if(sockIsConnected) {
|
||||||
nativeBinarySend(sock, TeaVMUtils.unwrapArrayBuffer(bytes));
|
sock.send(TeaVMUtils.unwrapArrayBuffer(bytes));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -54,6 +54,9 @@ public abstract class JSEaglercraftXOptsRoot implements JSObject {
|
||||||
@JSBody(script = "return (typeof this.relays === \"object\") ? this.relays : null;")
|
@JSBody(script = "return (typeof this.relays === \"object\") ? this.relays : null;")
|
||||||
public native JSArrayReader<JSEaglercraftXOptsRelay> getRelays();
|
public native JSArrayReader<JSEaglercraftXOptsRelay> getRelays();
|
||||||
|
|
||||||
|
@JSBody(params = { "def" }, script = "return (typeof this.checkGLErrors === \"boolean\") ? this.checkGLErrors : def;")
|
||||||
|
public native boolean getCheckGLErrors(boolean defaultValue);
|
||||||
|
|
||||||
@JSBody(params = { "def" }, script = "return (typeof this.checkShaderGLErrors === \"boolean\") ? this.checkShaderGLErrors : def;")
|
@JSBody(params = { "def" }, script = "return (typeof this.checkShaderGLErrors === \"boolean\") ? this.checkShaderGLErrors : def;")
|
||||||
public native boolean getCheckShaderGLErrors(boolean defaultValue);
|
public native boolean getCheckShaderGLErrors(boolean defaultValue);
|
||||||
|
|
||||||
|
|
|
@ -216,7 +216,7 @@ public class ServerPlatformSingleplayer {
|
||||||
logger.error("Fast immediate continue will be disabled for server context due to actually continuing immediately");
|
logger.error("Fast immediate continue will be disabled for server context due to actually continuing immediately");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
EagUtils.sleep(10l);
|
EagUtils.sleep(10);
|
||||||
currentContinueHack = null;
|
currentContinueHack = null;
|
||||||
if(!checkMe[0]) {
|
if(!checkMe[0]) {
|
||||||
if(immediateContinueChannel != null) {
|
if(immediateContinueChannel != null) {
|
||||||
|
@ -255,7 +255,7 @@ public class ServerPlatformSingleplayer {
|
||||||
if(immediateContinueSupport) {
|
if(immediateContinueSupport) {
|
||||||
immediateContinueTeaVM();
|
immediateContinueTeaVM();
|
||||||
}else {
|
}else {
|
||||||
EagUtils.sleep(0l);
|
EagUtils.sleep(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user