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