diff --git a/README.md b/README.md index 31abe10..b917c8a 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/client_version b/client_version index 60582c5..0388712 100644 --- a/client_version +++ b/client_version @@ -1 +1 @@ -u39 \ No newline at end of file +u40 \ No newline at end of file diff --git a/patches/minecraft/net/minecraft/client/LoadingScreenRenderer.edit.java b/patches/minecraft/net/minecraft/client/LoadingScreenRenderer.edit.java index 3d8a163..09a0072 100644 --- a/patches/minecraft/net/minecraft/client/LoadingScreenRenderer.edit.java +++ b/patches/minecraft/net/minecraft/client/LoadingScreenRenderer.edit.java @@ -70,4 +70,6 @@ > DELETE 1 @ 1 : 2 +> DELETE 1 @ 1 : 8 + > EOF diff --git a/patches/minecraft/net/minecraft/client/Minecraft.edit.java b/patches/minecraft/net/minecraft/client/Minecraft.edit.java index aa054a8..98573c1 100644 --- a/patches/minecraft/net/minecraft/client/Minecraft.edit.java +++ b/patches/minecraft/net/minecraft/client/Minecraft.edit.java @@ -18,7 +18,7 @@ > DELETE 1 @ 1 : 4 -> CHANGE 1 : 74 @ 1 : 4 +> CHANGE 1 : 73 @ 1 : 4 ~ ~ import net.lax1dude.eaglercraft.v1_8.ClientUUIDLoadingCache; @@ -34,7 +34,6 @@ ~ 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; ~ @@ -158,7 +157,11 @@ ~ public static final boolean isRunningOnMac = false; -> INSERT 10 : 11 @ 10 +> CHANGE 5 : 6 @ 5 : 6 + +~ private boolean enableGLErrorChecking = false; + +> INSERT 4 : 5 @ 4 + public float displayDPI; @@ -174,7 +177,11 @@ > DELETE 1 @ 1 : 3 -> CHANGE 10 : 11 @ 10 : 12 +> CHANGE 8 : 9 @ 8 : 9 + +~ long field_181543_z = EagRuntime.nanoTime(); + +> CHANGE 1 : 2 @ 1 : 3 ~ private EaglercraftNetworkManager myNetworkManager; @@ -225,8 +232,9 @@ + this.displayDPI = 1.0f; -> CHANGE 4 : 9 @ 4 : 8 +> CHANGE 4 : 10 @ 4 : 8 +~ this.enableGLErrorChecking = EagRuntime.getConfiguration().isCheckGLErrors(); ~ String serverToJoin = EagRuntime.getConfiguration().getServerToJoin(); ~ if (serverToJoin != null) { ~ ServerAddress addr = AddressResolver.resolveAddressFromURI(serverToJoin); @@ -500,14 +508,14 @@ + 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); + } > CHANGE 1 : 2 @ 1 : 2 @@ -520,8 +528,9 @@ > DELETE 3 @ 3 : 5 -> CHANGE 4 : 5 @ 4 : 6 +> CHANGE 3 : 5 @ 3 : 6 +~ long i = EagRuntime.nanoTime(); ~ if (Display.isCloseRequested()) { > INSERT 3 : 6 @ 3 @@ -536,31 +545,22 @@ ~ Util.func_181617_a((FutureTask) this.scheduledTasks.remove(0), logger); -> DELETE 3 @ 3 : 4 +> CHANGE 3 : 4 @ 3 : 6 + +~ long l = EagRuntime.nanoTime(); + +> INSERT 3 : 6 @ 3 + ++ if (j < this.timer.elapsedTicks - 1) { ++ PointerInputAbstraction.runGameLoop(); ++ } + +> CHANGE 2 : 3 @ 2 : 4 + +~ long i1 = EagRuntime.nanoTime() - l; > DELETE 1 @ 1 : 2 -> CHANGE 1 : 15 @ 1 : 2 - -~ 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) { - -> DELETE 3 @ 3 : 4 - -> DELETE 2 @ 2 : 3 - > DELETE 1 @ 1 : 11 > CHANGE 1 : 12 @ 1 : 7 @@ -596,9 +596,11 @@ + -> DELETE 1 @ 1 : 3 +> CHANGE 1 : 2 @ 1 : 4 -> CHANGE 6 : 7 @ 6 : 7 +~ long k = EagRuntime.nanoTime(); + +> CHANGE 5 : 6 @ 5 : 6 ~ this.debug = HString.format("%d fps (%d chunk update%s) T: %s%s%s%s", @@ -609,23 +611,28 @@ > DELETE 3 @ 3 : 7 -> DELETE 3 @ 3 : 4 +> CHANGE 2 : 5 @ 2 : 7 -> DELETE 1 @ 1 : 2 +~ // if (this.isFramerateLimitBelowMax()) { +~ // Display.sync(this.getLimitFramerate()); +~ // } -> CHANGE 2 : 3 @ 2 : 3 +> CHANGE 1 : 2 @ 1 : 2 ~ Mouse.tickCursorShape(); -> CHANGE 3 : 8 @ 3 : 4 +> CHANGE 3 : 13 @ 3 : 6 ~ if (Display.isVSyncSupported()) { ~ Display.setVSync(this.gameSettings.enableVsync); ~ } else { ~ this.gameSettings.enableVsync = false; ~ } - -> DELETE 1 @ 1 : 2 +~ if (!this.gameSettings.enableVsync && this.isFramerateLimitBelowMax()) { +~ Display.update(this.getLimitFramerate()); +~ } else { +~ Display.update(0); +~ } > CHANGE 4 : 7 @ 4 : 5 @@ -904,7 +911,7 @@ > INSERT 3 : 6 @ 3 -+ if (k == 0x1D && (areKeysLocked() || isFullScreen())) { ++ if (k == 0x1D && (Keyboard.areKeysLocked() || isFullScreen())) { + KeyBinding.setKeyBindState(gameSettings.keyBindSprint.getKeyCode(), Keyboard.getEventKeyState()); + } @@ -1387,17 +1394,13 @@ > DELETE 26 @ 26 : 34 -> INSERT 7 : 48 @ 7 +> INSERT 7 : 44 @ 7 + + public static int getGLMaximumTextureSize() { + return EaglercraftGPU.glGetInteger(GL_MAX_TEXTURE_SIZE); + } + -+ public boolean areKeysLocked() { -+ return PlatformInput.lockKeys; -+ } -+ + public ModelManager getModelManager() { + return modelManager; + } diff --git a/patches/minecraft/net/minecraft/client/gui/GuiChat.edit.java b/patches/minecraft/net/minecraft/client/gui/GuiChat.edit.java index 2338cc8..d76204f 100644 --- a/patches/minecraft/net/minecraft/client/gui/GuiChat.edit.java +++ b/patches/minecraft/net/minecraft/client/gui/GuiChat.edit.java @@ -62,7 +62,7 @@ > CHANGE 2 : 4 @ 2 : 11 ~ 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())) { > CHANGE 1 : 5 @ 1 : 10 diff --git a/patches/minecraft/net/minecraft/client/gui/GuiIngameMenu.edit.java b/patches/minecraft/net/minecraft/client/gui/GuiIngameMenu.edit.java index 8343931..1ff8d28 100644 --- a/patches/minecraft/net/minecraft/client/gui/GuiIngameMenu.edit.java +++ b/patches/minecraft/net/minecraft/client/gui/GuiIngameMenu.edit.java @@ -21,7 +21,7 @@ ~ 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; @@ -163,8 +163,8 @@ ~ 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); ~ } @@ -172,8 +172,8 @@ ~ 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); ~ } diff --git a/patches/minecraft/net/minecraft/client/gui/GuiScreen.edit.java b/patches/minecraft/net/minecraft/client/gui/GuiScreen.edit.java index 511cc42..b487557 100644 --- a/patches/minecraft/net/minecraft/client/gui/GuiScreen.edit.java +++ b/patches/minecraft/net/minecraft/client/gui/GuiScreen.edit.java @@ -128,8 +128,8 @@ ~ 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()))) { > INSERT 4 : 6 @ 4 diff --git a/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainer.edit.java b/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainer.edit.java index 2dc2559..c7fdbd3 100644 --- a/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainer.edit.java +++ b/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainer.edit.java @@ -74,8 +74,8 @@ ~ 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()))) { > CHANGE 1 : 3 @ 1 : 9 diff --git a/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.edit.java b/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.edit.java index ce5ef31..0739bb5 100644 --- a/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.edit.java +++ b/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.edit.java @@ -29,7 +29,7 @@ > CHANGE 13 : 16 @ 13 : 14 -~ if (parInt1 == getCloseKey() || (parInt1 == 1 && this.mc.areKeysLocked())) { +~ if (parInt1 == getCloseKey() || (parInt1 == 1 && Keyboard.areKeysLocked())) { ~ mc.displayGuiScreen(null); ~ } else if (!this.checkHotbarKeys(parInt1)) { diff --git a/patches/minecraft/net/minecraft/client/main/Main.edit.java b/patches/minecraft/net/minecraft/client/main/Main.edit.java index 47659e0..dc89d14 100644 --- a/patches/minecraft/net/minecraft/client/main/Main.edit.java +++ b/patches/minecraft/net/minecraft/client/main/Main.edit.java @@ -13,7 +13,7 @@ > CHANGE 3 : 5 @ 3 : 100 -~ public static void appMain(String[] astring) { +~ public static void appMain() { ~ System.setProperty("java.net.preferIPv6Addresses", "true"); > CHANGE 1 : 5 @ 1 : 12 diff --git a/patches/minecraft/net/minecraft/client/renderer/EntityRenderer.edit.java b/patches/minecraft/net/minecraft/client/renderer/EntityRenderer.edit.java index c1c54ac..c627c90 100644 --- a/patches/minecraft/net/minecraft/client/renderer/EntityRenderer.edit.java +++ b/patches/minecraft/net/minecraft/client/renderer/EntityRenderer.edit.java @@ -244,15 +244,17 @@ > DELETE 2 @ 2 : 3 -> DELETE 5 @ 5 : 18 +> CHANGE 2 : 3 @ 2 : 3 -> CHANGE 1 : 3 @ 1 : 3 +~ long j = EagRuntime.nanoTime() - parLong1; +> CHANGE 1 : 18 @ 1 : 10 + +~ this.renderWorld(parFloat1, EagRuntime.nanoTime() + k); +~ this.renderEndNanoTime = EagRuntime.nanoTime(); ~ final boolean b = !this.mc.gameSettings.hideGUI || this.mc.currentScreen != null; ~ if (b) { - -> CHANGE 1 : 14 @ 1 : 2 - +~ GlStateManager.alphaFunc(516, 0.1F); ~ long framebufferAge = this.overlayFramebuffer.getAge(); ~ if (framebufferAge == -1l || framebufferAge > (Minecraft.getDebugFPS() < 25 ? 125l : 75l)) { ~ this.overlayFramebuffer.beginRender(mc.displayWidth, mc.displayHeight); @@ -265,9 +267,10 @@ ~ } ~ GlStateManager.disableOverlayFramebufferBlending(); ~ this.overlayFramebuffer.endRender(); -~ } -> CHANGE 1 : 32 @ 1 : 3 +> DELETE 1 @ 1 : 3 + +> CHANGE 1 : 31 @ 1 : 7 ~ if (b) { ~ this.setupOverlayRendering(); @@ -299,9 +302,14 @@ ~ this.mc.ingameGUI.drawEaglerPlayerOverlay(l - 3, ~ 3 + this.mc.ingameGUI.overlayDebug.playerOffset, parFloat1); ~ } -~ } -> INSERT 10 : 12 @ 10 +> DELETE 1 @ 1 : 3 + +> CHANGE 7 : 8 @ 7 : 8 + +~ this.renderEndNanoTime = EagRuntime.nanoTime(); + +> INSERT 2 : 4 @ 2 + this.mc.notifRenderer.renderOverlay(j1, k1); + diff --git a/patches/minecraft/net/minecraft/network/EnumConnectionState.edit.java b/patches/minecraft/net/minecraft/network/EnumConnectionState.edit.java index 99d546a..b7537cb 100644 --- a/patches/minecraft/net/minecraft/network/EnumConnectionState.edit.java +++ b/patches/minecraft/net/minecraft/network/EnumConnectionState.edit.java @@ -10,19 +10,235 @@ + + import java.util.Collection; -> DELETE 1 @ 1 : 3 +> CHANGE 1 : 3 @ 1 : 3 + +~ import java.util.function.Supplier; +~ > CHANGE 101 : 102 @ 101 : 106 ~ import net.lax1dude.eaglercraft.v1_8.log4j.LogManager; -> DELETE 111 @ 111 : 119 +> CHANGE 4 : 5 @ 4 : 5 -> CHANGE 28 : 29 @ 28 : 29 +~ this.registerPacket(EnumPacketDirection.SERVERBOUND, C00Handshake.class, C00Handshake::new); -~ this.directionMaps.put(direction, (BiMap>) object); +> CHANGE 4 : 158 @ 4 : 104 -> CHANGE 36 : 39 @ 36 : 37 +~ 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); + +> DELETE 2 @ 2 : 10 + +> CHANGE 2 : 12 @ 2 : 8 + +~ 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); + +> INSERT 10 : 11 @ 10 + ++ private final Map>>> directionCtors; + +> INSERT 3 : 4 @ 3 + ++ this.directionCtors = Maps.newEnumMap(EnumPacketDirection.class); + +> CHANGE 3 : 7 @ 3 : 5 + +~ protected EnumConnectionState registerPacket(EnumPacketDirection direction, Class packetClass, +~ Supplier> packetCtor) { +~ BiMap> object = this.directionMaps.get(direction); +~ Map>> object2; + +> INSERT 2 : 3 @ 2 + ++ object2 = Maps.newHashMap(); + +> INSERT 1 : 4 @ 1 + ++ this.directionCtors.put(direction, object2); ++ } else { ++ object2 = this.directionCtors.get(direction); + +> CHANGE 2 : 3 @ 2 : 3 + +~ if (object.containsValue(packetClass)) { + +> CHANGE 1 : 2 @ 1 : 2 + +~ + object.inverse().get(packetClass); + +> CHANGE 3 : 5 @ 3 : 4 + +~ object.put(Integer.valueOf(object.size()), packetClass); +~ object2.put(Integer.valueOf(object2.size()), packetCtor); + +> CHANGE 10 : 12 @ 10 : 12 + +~ Supplier> oclass = this.directionCtors.get(direction).get(Integer.valueOf(packetId)); +~ return oclass == null ? null : oclass.get(); + +> CHANGE 15 : 18 @ 15 : 16 ~ EnumConnectionState[] states = values(); ~ for (int j = 0; j < states.length; ++j) { @@ -33,4 +249,6 @@ ~ for (Class oclass : (Collection) ((BiMap) enumconnectionstate.directionMaps ~ .get(enumpacketdirection)).values()) { +> DELETE 5 @ 5 : 11 + > EOF diff --git a/patches/minecraft/net/minecraft/server/MinecraftServer.edit.java b/patches/minecraft/net/minecraft/server/MinecraftServer.edit.java index dbf2e05..d326633 100644 --- a/patches/minecraft/net/minecraft/server/MinecraftServer.edit.java +++ b/patches/minecraft/net/minecraft/server/MinecraftServer.edit.java @@ -20,10 +20,11 @@ > DELETE 2 @ 2 : 4 -> CHANGE 1 : 7 @ 1 : 4 +> CHANGE 1 : 8 @ 1 : 4 ~ ~ 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; @@ -215,7 +216,11 @@ > DELETE 17 @ 17 : 21 -> DELETE 45 @ 45 : 53 +> CHANGE 29 : 30 @ 29 : 30 + +~ EagUtils.sleep(Math.max(1L, 50L - i)); + +> DELETE 15 @ 15 : 23 > DELETE 15 @ 15 : 40 diff --git a/patches/minecraft/net/minecraft/stats/Achievement.edit.java b/patches/minecraft/net/minecraft/stats/Achievement.edit.java index 3e397c6..f320f8c 100644 --- a/patches/minecraft/net/minecraft/stats/Achievement.edit.java +++ b/patches/minecraft/net/minecraft/stats/Achievement.edit.java @@ -5,6 +5,17 @@ # Version: 1.0 # Author: lax1dude -> DELETE 5 @ 5 : 8 +> INSERT 2 : 4 @ 2 + ++ import java.util.function.Supplier; ++ + +> DELETE 3 @ 3 : 6 + +> CHANGE 76 : 79 @ 76 : 78 + +~ public Achievement func_150953_b(Class parClass1, +~ Supplier ctor) { +~ return (Achievement) super.func_150953_b(parClass1, ctor); > EOF diff --git a/patches/minecraft/net/minecraft/stats/AchievementList.edit.java b/patches/minecraft/net/minecraft/stats/AchievementList.edit.java index 0ad8464..6bfad4d 100644 --- a/patches/minecraft/net/minecraft/stats/AchievementList.edit.java +++ b/patches/minecraft/net/minecraft/stats/AchievementList.edit.java @@ -53,7 +53,7 @@ ~ public static Achievement exploreAllBiomes; ~ public static Achievement overpowered; -> INSERT 2 : 65 @ 2 +> INSERT 2 : 66 @ 2 + achievementList = Lists.newArrayList(); + openInventory = (new Achievement("achievement.openInventory", "openInventory", 0, 0, Items.book, @@ -115,7 +115,8 @@ + 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(); diff --git a/patches/minecraft/net/minecraft/stats/StatBase.edit.java b/patches/minecraft/net/minecraft/stats/StatBase.edit.java index 8056b2c..969e1aa 100644 --- a/patches/minecraft/net/minecraft/stats/StatBase.edit.java +++ b/patches/minecraft/net/minecraft/stats/StatBase.edit.java @@ -5,10 +5,28 @@ # Version: 1.0 # Author: lax1dude -> INSERT 5 : 6 @ 5 +> INSERT 5 : 7 @ 5 ++ import java.util.function.Supplier; + > DELETE 2 @ 2 : 5 +> INSERT 12 : 13 @ 12 + ++ private Supplier field_150956_d_ctor; + +> CHANGE 114 : 120 @ 114 : 115 + +~ public Supplier func_150954_l_ctor() { +~ return this.field_150956_d_ctor; +~ } +~ +~ public StatBase func_150953_b(Class oclass, +~ Supplier octor) { + +> INSERT 1 : 2 @ 1 + ++ this.field_150956_d_ctor = octor; + > EOF diff --git a/patches/minecraft/net/minecraft/stats/StatisticsFile.edit.java b/patches/minecraft/net/minecraft/stats/StatisticsFile.edit.java index 34eaf55..e877e59 100644 --- a/patches/minecraft/net/minecraft/stats/StatisticsFile.edit.java +++ b/patches/minecraft/net/minecraft/stats/StatisticsFile.edit.java @@ -67,11 +67,12 @@ ~ if (value != null && (value instanceof Integer)) { ~ tupleintjsonserializable.setIntegerValue(jsonobject1.getInt("value")); -> CHANGE 4 : 5 @ 4 : 5 +> CHANGE 4 : 6 @ 4 : 7 -~ Constructor constructor = statbase.func_150954_l().getConstructor(); +~ IJsonSerializable ijsonserializable = (IJsonSerializable) statbase.func_150954_l_ctor() +~ .get(); -> CHANGE 22 : 23 @ 22 : 23 +> CHANGE 20 : 21 @ 20 : 21 ~ JSONObject jsonobject = new JSONObject(); diff --git a/patches/minecraft/net/minecraft/tileentity/TileEntity.edit.java b/patches/minecraft/net/minecraft/tileentity/TileEntity.edit.java index d278579..3eb5810 100644 --- a/patches/minecraft/net/minecraft/tileentity/TileEntity.edit.java +++ b/patches/minecraft/net/minecraft/tileentity/TileEntity.edit.java @@ -7,8 +7,9 @@ > DELETE 2 @ 2 : 3 -> INSERT 2 : 8 @ 2 +> INSERT 2 : 9 @ 2 ++ import java.util.function.Supplier; + + import com.google.common.collect.Maps; + @@ -20,7 +21,27 @@ > DELETE 2 @ 2 : 4 -> CHANGE 58 : 59 @ 58 : 59 +> INSERT 4 : 5 @ 4 + ++ private static Map> nameToCtorMap = Maps.newHashMap(); + +> CHANGE 7 : 8 @ 7 : 8 + +~ private static void addMapping(Class cl, Supplier ct, String id) { + +> INSERT 4 : 5 @ 4 + ++ nameToCtorMap.put(id, ct); + +> CHANGE 37 : 38 @ 37 : 38 + +~ Supplier oclass = nameToCtorMap.get(nbt.getString("id")); + +> CHANGE 1 : 2 @ 1 : 2 + +~ tileentity = (TileEntity) oclass.get(); + +> CHANGE 2 : 3 @ 2 : 3 ~ logger.error("Could not create TileEntity", exception); @@ -41,4 +62,28 @@ ~ String s = HString.format("%4s", new Object[] { Integer.toBinaryString(i) }).replace(" ", "0"); ~ return HString.format("%1$d / 0x%1$X / 0b%2$s", new Object[] { Integer.valueOf(i), s }); +> CHANGE 15 : 36 @ 15 : 36 + +~ 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"); + > EOF diff --git a/patches/minecraft/net/minecraft/world/gen/structure/ComponentScatteredFeaturePieces.edit.java b/patches/minecraft/net/minecraft/world/gen/structure/ComponentScatteredFeaturePieces.edit.java index 3e90e08..1a5cb38 100644 --- a/patches/minecraft/net/minecraft/world/gen/structure/ComponentScatteredFeaturePieces.edit.java +++ b/patches/minecraft/net/minecraft/world/gen/structure/ComponentScatteredFeaturePieces.edit.java @@ -11,7 +11,16 @@ > DELETE 18 @ 18 : 21 -> CHANGE 25 : 26 @ 25 : 26 +> CHANGE 3 : 9 @ 3 : 6 + +~ 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"); + +> CHANGE 19 : 20 @ 19 : 20 ~ public DesertPyramid(EaglercraftRandom parRandom, int parInt1, int parInt2) { diff --git a/patches/minecraft/net/minecraft/world/gen/structure/MapGenStructureIO.edit.java b/patches/minecraft/net/minecraft/world/gen/structure/MapGenStructureIO.edit.java index 471b447..5b2936d 100644 --- a/patches/minecraft/net/minecraft/world/gen/structure/MapGenStructureIO.edit.java +++ b/patches/minecraft/net/minecraft/world/gen/structure/MapGenStructureIO.edit.java @@ -5,17 +5,74 @@ # Version: 1.0 # Author: lax1dude -> CHANGE 6 : 8 @ 6 : 22 +> INSERT 4 : 6 @ 4 + ++ import java.util.function.Supplier; ++ + +> CHANGE 2 : 4 @ 2 : 18 ~ import net.lax1dude.eaglercraft.v1_8.log4j.LogManager; ~ import net.lax1dude.eaglercraft.v1_8.log4j.Logger; -> CHANGE 36 : 37 @ 36 : 37 +> INSERT 4 : 5 @ 4 + ++ private static Map> startNameToSupplierMap = Maps.newHashMap(); + +> INSERT 2 : 3 @ 2 + ++ private static Map> componentNameToSupplierMap = Maps.newHashMap(); + +> CHANGE 2 : 4 @ 2 : 3 + +~ private static void registerStructure(Class startClass, +~ Supplier startSupplier, String structureName) { + +> INSERT 1 : 2 @ 1 + ++ startNameToSupplierMap.put(structureName, startSupplier); + +> CHANGE 3 : 5 @ 3 : 4 + +~ static void registerStructureComponent(Class componentClass, +~ Supplier startSupplier, String componentName) { + +> INSERT 1 : 2 @ 1 + ++ componentNameToSupplierMap.put(componentName, startSupplier); + +> CHANGE 15 : 16 @ 15 : 16 + +~ Supplier oclass = startNameToSupplierMap.get(tagCompound.getString("id")); + +> CHANGE 1 : 2 @ 1 : 2 + +~ structurestart = oclass.get(); + +> CHANGE 3 : 4 @ 3 : 4 ~ logger.warn(exception); -> CHANGE 21 : 22 @ 21 : 22 +> CHANGE 15 : 16 @ 15 : 16 + +~ Supplier oclass = componentNameToSupplierMap.get(tagCompound.getString("id")); + +> CHANGE 1 : 2 @ 1 : 2 + +~ structurecomponent = oclass.get(); + +> CHANGE 3 : 4 @ 3 : 4 ~ logger.warn(exception); +> CHANGE 12 : 19 @ 12 : 18 + +~ 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"); + > EOF diff --git a/patches/minecraft/net/minecraft/world/gen/structure/StructureMineshaftPieces.edit.java b/patches/minecraft/net/minecraft/world/gen/structure/StructureMineshaftPieces.edit.java index 877b1c4..d18a8ea 100644 --- a/patches/minecraft/net/minecraft/world/gen/structure/StructureMineshaftPieces.edit.java +++ b/patches/minecraft/net/minecraft/world/gen/structure/StructureMineshaftPieces.edit.java @@ -11,7 +11,18 @@ > DELETE 15 @ 15 : 18 -> CHANGE 24 : 26 @ 24 : 26 +> CHANGE 18 : 26 @ 18 : 22 + +~ 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"); + +> CHANGE 2 : 4 @ 2 : 4 ~ private static StructureComponent func_175892_a(List listIn, EaglercraftRandom rand, int x, ~ int y, int z, EnumFacing facing, int type) { diff --git a/patches/minecraft/net/minecraft/world/gen/structure/StructureNetherBridgePieces.edit.java b/patches/minecraft/net/minecraft/world/gen/structure/StructureNetherBridgePieces.edit.java index 80fd343..81cad20 100644 --- a/patches/minecraft/net/minecraft/world/gen/structure/StructureNetherBridgePieces.edit.java +++ b/patches/minecraft/net/minecraft/world/gen/structure/StructureNetherBridgePieces.edit.java @@ -11,7 +11,40 @@ > DELETE 10 @ 10 : 13 -> CHANGE 37 : 39 @ 37 : 39 +> CHANGE 19 : 49 @ 19 : 34 + +~ 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"); + +> CHANGE 3 : 5 @ 3 : 5 ~ StructureNetherBridgePieces.PieceWeight parPieceWeight, List parList, ~ EaglercraftRandom parRandom, int parInt1, int parInt2, int parInt3, EnumFacing parEnumFacing, int parInt4) { diff --git a/patches/minecraft/net/minecraft/world/gen/structure/StructureOceanMonumentPieces.edit.java b/patches/minecraft/net/minecraft/world/gen/structure/StructureOceanMonumentPieces.edit.java index 7b66cb2..9f51920 100644 --- a/patches/minecraft/net/minecraft/world/gen/structure/StructureOceanMonumentPieces.edit.java +++ b/patches/minecraft/net/minecraft/world/gen/structure/StructureOceanMonumentPieces.edit.java @@ -15,7 +15,32 @@ > DELETE 10 @ 10 : 13 -> CHANGE 21 : 22 @ 21 : 22 +> CHANGE 3 : 25 @ 3 : 14 + +~ 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"); + +> CHANGE 7 : 8 @ 7 : 8 ~ EaglercraftRandom parRandom) { diff --git a/patches/minecraft/net/minecraft/world/gen/structure/StructureStrongholdPieces.edit.java b/patches/minecraft/net/minecraft/world/gen/structure/StructureStrongholdPieces.edit.java index c851211..049cc51 100644 --- a/patches/minecraft/net/minecraft/world/gen/structure/StructureStrongholdPieces.edit.java +++ b/patches/minecraft/net/minecraft/world/gen/structure/StructureStrongholdPieces.edit.java @@ -11,7 +11,36 @@ > DELETE 13 @ 13 : 16 -> CHANGE 71 : 72 @ 71 : 72 +> CHANGE 27 : 53 @ 27 : 40 + +~ 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"); + +> CHANGE 31 : 32 @ 31 : 32 ~ EaglercraftRandom parRandom, int parInt1, int parInt2, int parInt3, EnumFacing parEnumFacing, int parInt4) { diff --git a/patches/minecraft/net/minecraft/world/gen/structure/StructureVillagePieces.edit.java b/patches/minecraft/net/minecraft/world/gen/structure/StructureVillagePieces.edit.java index 05a1fb0..f1c1810 100644 --- a/patches/minecraft/net/minecraft/world/gen/structure/StructureVillagePieces.edit.java +++ b/patches/minecraft/net/minecraft/world/gen/structure/StructureVillagePieces.edit.java @@ -11,7 +11,36 @@ > DELETE 20 @ 20 : 24 -> CHANGE 18 : 20 @ 18 : 20 +> CHANGE 3 : 29 @ 3 : 16 + +~ 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"); + +> CHANGE 2 : 4 @ 2 : 4 ~ public static List getStructureVillageWeightedPieceList( ~ EaglercraftRandom random, int parInt1) { diff --git a/patches/minecraft/net/minecraft/world/storage/SaveFormatOld.edit.java b/patches/minecraft/net/minecraft/world/storage/SaveFormatOld.edit.java index 72bfbca..20cf49d 100644 --- a/patches/minecraft/net/minecraft/world/storage/SaveFormatOld.edit.java +++ b/patches/minecraft/net/minecraft/world/storage/SaveFormatOld.edit.java @@ -18,8 +18,9 @@ + import net.lax1dude.eaglercraft.v1_8.sp.server.EaglerIntegratedServerWorker; + import net.lax1dude.eaglercraft.v1_8.sp.server.WorldsDB; -> CHANGE 1 : 4 @ 1 : 8 +> CHANGE 1 : 5 @ 1 : 8 +~ 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; @@ -103,24 +104,19 @@ ~ VFile2 file1 = WorldsDB.newVFile(this.savesDirectory, parString1); ~ logger.info("Deleting level " + parString1); -> CHANGE 1 : 6 @ 1 : 6 +> CHANGE 1 : 5 @ 1 : 15 ~ for (int i = 1; i <= 5; ++i) { ~ logger.info("Attempt " + i + "..."); ~ if (deleteFiles(file1.listFiles(true), "singleplayer.busy.deleting")) { ~ return true; -~ } -> CHANGE 1 : 7 @ 1 : 8 +> CHANGE 2 : 6 @ 2 : 3 ~ logger.warn("Unsuccessful in deleting contents."); ~ if (i < 5) { -~ try { -~ Thread.sleep(500L); -~ } catch (InterruptedException var5) { -~ ; - -> DELETE 2 @ 2 : 4 +~ EagUtils.sleep(500); +~ } > INSERT 1 : 3 @ 1 diff --git a/sources/lwjgl/java/net/lax1dude/eaglercraft/v1_8/internal/PlatformAudio.java b/sources/lwjgl/java/net/lax1dude/eaglercraft/v1_8/internal/PlatformAudio.java index 0656d64..fe3a750 100644 --- a/sources/lwjgl/java/net/lax1dude/eaglercraft/v1_8/internal/PlatformAudio.java +++ b/sources/lwjgl/java/net/lax1dude/eaglercraft/v1_8/internal/PlatformAudio.java @@ -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,13 +91,14 @@ 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 } - + } public static IAudioResource loadAudioData(String filename, boolean holdInCache) { @@ -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!"); } diff --git a/sources/lwjgl/java/net/lax1dude/eaglercraft/v1_8/internal/PlatformInput.java b/sources/lwjgl/java/net/lax1dude/eaglercraft/v1_8/internal/PlatformInput.java index 222ab46..ec4d435 100644 --- a/sources/lwjgl/java/net/lax1dude/eaglercraft/v1_8/internal/PlatformInput.java +++ b/sources/lwjgl/java/net/lax1dude/eaglercraft/v1_8/internal/PlatformInput.java @@ -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 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); diff --git a/sources/lwjgl/java/net/lax1dude/eaglercraft/v1_8/internal/PlatformOpenGL.java b/sources/lwjgl/java/net/lax1dude/eaglercraft/v1_8/internal/PlatformOpenGL.java index 768dbb9..87b3731 100644 --- a/sources/lwjgl/java/net/lax1dude/eaglercraft/v1_8/internal/PlatformOpenGL.java +++ b/sources/lwjgl/java/net/lax1dude/eaglercraft/v1_8/internal/PlatformOpenGL.java @@ -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)); diff --git a/sources/lwjgl/java/net/lax1dude/eaglercraft/v1_8/internal/PlatformRuntime.java b/sources/lwjgl/java/net/lax1dude/eaglercraft/v1_8/internal/PlatformRuntime.java index 58017f4..3ea0ba4 100644 --- a/sources/lwjgl/java/net/lax1dude/eaglercraft/v1_8/internal/PlatformRuntime.java +++ b/sources/lwjgl/java/net/lax1dude/eaglercraft/v1_8/internal/PlatformRuntime.java @@ -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() { } diff --git a/sources/lwjgl/java/net/lax1dude/eaglercraft/v1_8/internal/lwjgl/DesktopClientConfigAdapter.java b/sources/lwjgl/java/net/lax1dude/eaglercraft/v1_8/internal/lwjgl/DesktopClientConfigAdapter.java index 5de69dc..ff9869c 100644 --- a/sources/lwjgl/java/net/lax1dude/eaglercraft/v1_8/internal/lwjgl/DesktopClientConfigAdapter.java +++ b/sources/lwjgl/java/net/lax1dude/eaglercraft/v1_8/internal/lwjgl/DesktopClientConfigAdapter.java @@ -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 diff --git a/sources/lwjgl/java/net/lax1dude/eaglercraft/v1_8/internal/lwjgl/LWJGLEntryPoint.java b/sources/lwjgl/java/net/lax1dude/eaglercraft/v1_8/internal/lwjgl/LWJGLEntryPoint.java index 23b1358..22321c6 100644 --- a/sources/lwjgl/java/net/lax1dude/eaglercraft/v1_8/internal/lwjgl/LWJGLEntryPoint.java +++ b/sources/lwjgl/java/net/lax1dude/eaglercraft/v1_8/internal/lwjgl/LWJGLEntryPoint.java @@ -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(); } diff --git a/sources/main/java/com/google/common/base/Platform.java b/sources/main/java/com/google/common/base/Platform.java index 04b2fdd..e7b89c8 100644 --- a/sources/main/java/com/google/common/base/Platform.java +++ b/sources/main/java/com/google/common/base/Platform.java @@ -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) { diff --git a/sources/main/java/net/lax1dude/eaglercraft/v1_8/Display.java b/sources/main/java/net/lax1dude/eaglercraft/v1_8/Display.java index db9f158..5f09109 100644 --- a/sources/main/java/net/lax1dude/eaglercraft/v1_8/Display.java +++ b/sources/main/java/net/lax1dude/eaglercraft/v1_8/Display.java @@ -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) { - long millis = EagRuntime.steadyTimeMillis(); - long frameMillis = (1000l / limitFramerate) - (millis - lastSwap); - if(frameMillis > 0l) { - EagUtils.sleep(frameMillis); + if(timerPtr[0] == 0l) { + timerPtr[0] = EagRuntime.steadyTimeMillis(); + }else { + long millis = EagRuntime.steadyTimeMillis(); + long frameMillis = (1000l / limitFramerate); + long frameTime = millis - timerPtr[0]; + if(frameTime > 2000l || frameTime < 0l) { + frameTime = frameMillis; + timerPtr[0] = millis; + }else { + timerPtr[0] += frameMillis; + } + if(frameTime >= 0l && frameTime < frameMillis) { + EagUtils.sleep(frameMillis - frameTime); + blocked = true; + } } + }else { + timerPtr[0] = 0l; } - lastSwap = EagRuntime.steadyTimeMillis(); + return blocked; } public static boolean contextLost() { diff --git a/sources/main/java/net/lax1dude/eaglercraft/v1_8/EagUtils.java b/sources/main/java/net/lax1dude/eaglercraft/v1_8/EagUtils.java index 808aa6c..f19b97e 100644 --- a/sources/main/java/net/lax1dude/eaglercraft/v1_8/EagUtils.java +++ b/sources/main/java/net/lax1dude/eaglercraft/v1_8/EagUtils.java @@ -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(int millis) { + PlatformRuntime.sleep(millis); + } + public static void sleep(long millis) { - try { - Thread.sleep(millis); - }catch(InterruptedException ex) { - } + int reduced = (int)millis; + if(reduced != millis) throw new IllegalArgumentException(); + PlatformRuntime.sleep(reduced); } public static String toASCIIEagler(String str) { diff --git a/sources/main/java/net/lax1dude/eaglercraft/v1_8/EaglercraftSoundManager.java b/sources/main/java/net/lax1dude/eaglercraft/v1_8/EaglercraftSoundManager.java index 86fff43..f596555 100644 --- a/sources/main/java/net/lax1dude/eaglercraft/v1_8/EaglercraftSoundManager.java +++ b/sources/main/java/net/lax1dude/eaglercraft/v1_8/EaglercraftSoundManager.java @@ -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()); diff --git a/sources/main/java/net/lax1dude/eaglercraft/v1_8/EaglercraftVersion.java b/sources/main/java/net/lax1dude/eaglercraft/v1_8/EaglercraftVersion.java index bac19c6..5fa0208 100644 --- a/sources/main/java/net/lax1dude/eaglercraft/v1_8/EaglercraftVersion.java +++ b/sources/main/java/net/lax1dude/eaglercraft/v1_8/EaglercraftVersion.java @@ -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; diff --git a/sources/main/java/net/lax1dude/eaglercraft/v1_8/Keyboard.java b/sources/main/java/net/lax1dude/eaglercraft/v1_8/Keyboard.java index 9355a7f..88f11fe 100644 --- a/sources/main/java/net/lax1dude/eaglercraft/v1_8/Keyboard.java +++ b/sources/main/java/net/lax1dude/eaglercraft/v1_8/Keyboard.java @@ -65,4 +65,8 @@ public class Keyboard { PlatformInput.keyboardFireEvent(eventType, eagKey, keyChar); } + public static boolean areKeysLocked() { + return PlatformInput.keyboardAreKeysLocked(); + } + } diff --git a/sources/main/java/net/lax1dude/eaglercraft/v1_8/internal/IAudioCacheLoader.java b/sources/main/java/net/lax1dude/eaglercraft/v1_8/internal/IAudioCacheLoader.java new file mode 100644 index 0000000..b2ce29b --- /dev/null +++ b/sources/main/java/net/lax1dude/eaglercraft/v1_8/internal/IAudioCacheLoader.java @@ -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); + +} diff --git a/sources/main/java/net/lax1dude/eaglercraft/v1_8/internal/IClientConfigAdapter.java b/sources/main/java/net/lax1dude/eaglercraft/v1_8/internal/IClientConfigAdapter.java index fa6f350..0e2e5cb 100644 --- a/sources/main/java/net/lax1dude/eaglercraft/v1_8/internal/IClientConfigAdapter.java +++ b/sources/main/java/net/lax1dude/eaglercraft/v1_8/internal/IClientConfigAdapter.java @@ -50,6 +50,8 @@ public interface IClientConfigAdapter { List getRelays(); + boolean isCheckGLErrors(); + boolean isCheckShaderGLErrors(); boolean isDemo(); diff --git a/sources/main/java/net/lax1dude/eaglercraft/v1_8/internal/IServerQuery.java b/sources/main/java/net/lax1dude/eaglercraft/v1_8/internal/IServerQuery.java index fc331c7..5d417a0 100644 --- a/sources/main/java/net/lax1dude/eaglercraft/v1_8/internal/IServerQuery.java +++ b/sources/main/java/net/lax1dude/eaglercraft/v1_8/internal/IServerQuery.java @@ -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; } diff --git a/sources/main/java/net/lax1dude/eaglercraft/v1_8/opengl/ext/deferred/EaglerDeferredPipeline.java b/sources/main/java/net/lax1dude/eaglercraft/v1_8/opengl/ext/deferred/EaglerDeferredPipeline.java index 4e9b63f..2e101ad 100644 --- a/sources/main/java/net/lax1dude/eaglercraft/v1_8/opengl/ext/deferred/EaglerDeferredPipeline.java +++ b/sources/main/java/net/lax1dude/eaglercraft/v1_8/opengl/ext/deferred/EaglerDeferredPipeline.java @@ -4065,6 +4065,6 @@ public class EaglerDeferredPipeline { GlStateManager.popMatrix(); GlStateManager.matrixMode(GL_MODELVIEW); GlStateManager.popMatrix(); - EagUtils.sleep(10l); + EagUtils.sleep(10); } } diff --git a/sources/main/java/net/lax1dude/eaglercraft/v1_8/profile/GuiScreenImportExportProfile.java b/sources/main/java/net/lax1dude/eaglercraft/v1_8/profile/GuiScreenImportExportProfile.java index eed4aae..b361336 100644 --- a/sources/main/java/net/lax1dude/eaglercraft/v1_8/profile/GuiScreenImportExportProfile.java +++ b/sources/main/java/net/lax1dude/eaglercraft/v1_8/profile/GuiScreenImportExportProfile.java @@ -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(); diff --git a/sources/main/java/net/lax1dude/eaglercraft/v1_8/socket/ConnectionHandshake.java b/sources/main/java/net/lax1dude/eaglercraft/v1_8/socket/ConnectionHandshake.java index d1ca897..de58ce8 100644 --- a/sources/main/java/net/lax1dude/eaglercraft/v1_8/socket/ConnectionHandshake.java +++ b/sources/main/java/net/lax1dude/eaglercraft/v1_8/socket/ConnectionHandshake.java @@ -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; diff --git a/sources/main/java/net/lax1dude/eaglercraft/v1_8/socket/protocol/client/GameProtocolMessageController.java b/sources/main/java/net/lax1dude/eaglercraft/v1_8/socket/protocol/client/GameProtocolMessageController.java index dc4176e..dd02590 100644 --- a/sources/main/java/net/lax1dude/eaglercraft/v1_8/socket/protocol/client/GameProtocolMessageController.java +++ b/sources/main/java/net/lax1dude/eaglercraft/v1_8/socket/protocol/client/GameProtocolMessageController.java @@ -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; diff --git a/sources/main/java/net/lax1dude/eaglercraft/v1_8/sp/lan/LANClientNetworkManager.java b/sources/main/java/net/lax1dude/eaglercraft/v1_8/sp/lan/LANClientNetworkManager.java index 15a1054..5c52b2d 100644 --- a/sources/main/java/net/lax1dude/eaglercraft/v1_8/sp/lan/LANClientNetworkManager.java +++ b/sources/main/java/net/lax1dude/eaglercraft/v1_8/sp/lan/LANClientNetworkManager.java @@ -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; } diff --git a/sources/main/java/net/lax1dude/eaglercraft/v1_8/sp/lan/LANClientPeer.java b/sources/main/java/net/lax1dude/eaglercraft/v1_8/sp/lan/LANClientPeer.java index 817bc4c..d50ff53 100644 --- a/sources/main/java/net/lax1dude/eaglercraft/v1_8/sp/lan/LANClientPeer.java +++ b/sources/main/java/net/lax1dude/eaglercraft/v1_8/sp/lan/LANClientPeer.java @@ -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(); diff --git a/sources/main/java/net/lax1dude/eaglercraft/v1_8/sp/lan/LANServerController.java b/sources/main/java/net/lax1dude/eaglercraft/v1_8/sp/lan/LANServerController.java index c743baf..899bf94 100644 --- a/sources/main/java/net/lax1dude/eaglercraft/v1_8/sp/lan/LANServerController.java +++ b/sources/main/java/net/lax1dude/eaglercraft/v1_8/sp/lan/LANServerController.java @@ -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(); diff --git a/sources/main/java/net/lax1dude/eaglercraft/v1_8/sp/relay/RelayManager.java b/sources/main/java/net/lax1dude/eaglercraft/v1_8/sp/relay/RelayManager.java index 937d580..55eb50b 100644 --- a/sources/main/java/net/lax1dude/eaglercraft/v1_8/sp/relay/RelayManager.java +++ b/sources/main/java/net/lax1dude/eaglercraft/v1_8/sp/relay/RelayManager.java @@ -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; diff --git a/sources/main/java/net/lax1dude/eaglercraft/v1_8/sp/relay/RelayServer.java b/sources/main/java/net/lax1dude/eaglercraft/v1_8/sp/relay/RelayServer.java index 4ccf839..65b2fad 100644 --- a/sources/main/java/net/lax1dude/eaglercraft/v1_8/sp/relay/RelayServer.java +++ b/sources/main/java/net/lax1dude/eaglercraft/v1_8/sp/relay/RelayServer.java @@ -81,7 +81,7 @@ public class RelayServer { public void pingBlocking() { ping(); while(getPing() < 0l) { - EagUtils.sleep(250l); + EagUtils.sleep(250); update(); } } diff --git a/sources/main/java/net/lax1dude/eaglercraft/v1_8/sp/server/EaglerIntegratedServerWorker.java b/sources/main/java/net/lax1dude/eaglercraft/v1_8/sp/server/EaglerIntegratedServerWorker.java index 0aad61c..532eb67 100644 --- a/sources/main/java/net/lax1dude/eaglercraft/v1_8/sp/server/EaglerIntegratedServerWorker.java +++ b/sources/main/java/net/lax1dude/eaglercraft/v1_8/sp/server/EaglerIntegratedServerWorker.java @@ -468,7 +468,7 @@ public class EaglerIntegratedServerWorker { } }else { if(!singleThreadMode) { - EagUtils.sleep(50l); + EagUtils.sleep(50); } } } diff --git a/sources/main/java/net/lax1dude/eaglercraft/v1_8/webview/GuiScreenPhishingWaring.java b/sources/main/java/net/lax1dude/eaglercraft/v1_8/webview/GuiScreenPhishingWarning.java similarity index 97% rename from sources/main/java/net/lax1dude/eaglercraft/v1_8/webview/GuiScreenPhishingWaring.java rename to sources/main/java/net/lax1dude/eaglercraft/v1_8/webview/GuiScreenPhishingWarning.java index e96895f..a832e73 100644 --- a/sources/main/java/net/lax1dude/eaglercraft/v1_8/webview/GuiScreenPhishingWaring.java +++ b/sources/main/java/net/lax1dude/eaglercraft/v1_8/webview/GuiScreenPhishingWarning.java @@ -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; } diff --git a/sources/main/java/org/apache/commons/lang3/time/StopWatch.java b/sources/main/java/org/apache/commons/lang3/time/StopWatch.java index 631371d..0d0136c 100644 --- a/sources/main/java/org/apache/commons/lang3/time/StopWatch.java +++ b/sources/main/java/org/apache/commons/lang3/time/StopWatch.java @@ -22,6 +22,8 @@ import java.util.concurrent.TimeUnit; import org.apache.commons.lang3.StringUtils; +import net.lax1dude.eaglercraft.v1_8.EagRuntime; + /** *

* {@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; } diff --git a/sources/main/java/org/json/JSONObject.java b/sources/main/java/org/json/JSONObject.java index 6494f93..6a9f02f 100644 --- a/sources/main/java/org/json/JSONObject.java +++ b/sources/main/java/org/json/JSONObject.java @@ -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 objectsRecord) { - this(); - this.populateMap(bean, objectsRecord); - } +// public JSONObject(Object bean) { +// this(); +// this.populateMap(bean); +// } +// +// private JSONObject(Object bean, Set 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())); - } +// private void populateMap(Object bean) { +// populateMap(bean, Collections.newSetFromMap(new IdentityHashMap())); +// } - private void populateMap(Object bean, Set 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 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; diff --git a/sources/resources/EPKVersionIdentifier.txt b/sources/resources/EPKVersionIdentifier.txt index 60582c5..0388712 100644 --- a/sources/resources/EPKVersionIdentifier.txt +++ b/sources/resources/EPKVersionIdentifier.txt @@ -1 +1 @@ -u39 \ No newline at end of file +u40 \ No newline at end of file diff --git a/sources/resources/assets/eagler/boot_menu/opts_template_eaglercraftX_1_8.txt b/sources/resources/assets/eagler/boot_menu/opts_template_eaglercraftX_1_8.txt index 32811bd..15b3f62 100644 --- a/sources/resources/assets/eagler/boot_menu/opts_template_eaglercraftX_1_8.txt +++ b/sources/resources/assets/eagler/boot_menu/opts_template_eaglercraftX_1_8.txt @@ -48,6 +48,7 @@ "autoFixLegacyStyleAttr": true, "allowUpdateDL": true, "logInvalidCerts": false, + "checkGLErrors": false, "checkShaderGLErrors": false, "crashOnUncaughtExceptions": false, "forceWebGL1": false, diff --git a/sources/resources/assets/eagler/boot_menu/opts_template_eaglercraftX_1_8_demo.txt b/sources/resources/assets/eagler/boot_menu/opts_template_eaglercraftX_1_8_demo.txt index 6fbcd64..e9a77a0 100644 --- a/sources/resources/assets/eagler/boot_menu/opts_template_eaglercraftX_1_8_demo.txt +++ b/sources/resources/assets/eagler/boot_menu/opts_template_eaglercraftX_1_8_demo.txt @@ -48,6 +48,7 @@ "autoFixLegacyStyleAttr": true, "allowUpdateDL": true, "logInvalidCerts": false, + "checkGLErrors": false, "checkShaderGLErrors": false, "crashOnUncaughtExceptions": false, "forceWebGL1": false, diff --git a/sources/resources/assets/eagler/boot_menu/opts_template_eaglercraftX_1_8_html5Cursors.txt b/sources/resources/assets/eagler/boot_menu/opts_template_eaglercraftX_1_8_html5Cursors.txt index 8407017..5d0a4f9 100644 --- a/sources/resources/assets/eagler/boot_menu/opts_template_eaglercraftX_1_8_html5Cursors.txt +++ b/sources/resources/assets/eagler/boot_menu/opts_template_eaglercraftX_1_8_html5Cursors.txt @@ -48,6 +48,7 @@ "autoFixLegacyStyleAttr": true, "allowUpdateDL": true, "logInvalidCerts": false, + "checkGLErrors": false, "checkShaderGLErrors": false, "crashOnUncaughtExceptions": false, "forceWebGL1": false, diff --git a/sources/resources/plugin_download.zip b/sources/resources/plugin_download.zip index 5bcead9..42d0bf7 100644 Binary files a/sources/resources/plugin_download.zip and b/sources/resources/plugin_download.zip differ diff --git a/sources/resources/plugin_version.json b/sources/resources/plugin_version.json index 29ece09..c1764ce 100644 --- a/sources/resources/plugin_version.json +++ b/sources/resources/plugin_version.json @@ -1 +1 @@ -{"pluginName":"EaglercraftXBungee","pluginVersion":"1.3.1","pluginButton":"Download \"EaglerXBungee-1.3.1.jar\"","pluginFilename":"EaglerXBungee.zip"} \ No newline at end of file +{"pluginName":"EaglercraftXBungee","pluginVersion":"1.3.2","pluginButton":"Download \"EaglerXBungee-1.3.2.jar\"","pluginFilename":"EaglerXBungee.zip"} \ No newline at end of file diff --git a/sources/setup/workspace_template/javascript/ES6ShimScript.txt b/sources/setup/workspace_template/javascript/ES6ShimScript.txt index 972719b..44c19b1 100644 --- a/sources/setup/workspace_template/javascript/ES6ShimScript.txt +++ b/sources/setup/workspace_template/javascript/ES6ShimScript.txt @@ -1,31 +1,41 @@ -(function(E){try {(function(){var x=function(e,t){if(typeof t==="function"){try {$rt_globals.Object.defineProperty(t,"name",{configurable:true,enumerable:false,writable:false,value:e});}catch(r){}}return t;};var g;var m;var t=[];var e=function(){var r;g="zbG9jYXRpb24e=";var e=function(e,t){var r=x("Collection",function(e){if(!this||this.constructor!==r)return new r(e);$rt_globals.Object.defineProperty(this,"_keys",{value:[]});$rt_globals.Object.defineProperty(this,"_values",{value:[]});$rt_globals.Object.defineProperty(this, -"_itp",{value:[]});$rt_globals.Object.defineProperty(this,"objectOnly",{value:t});if(e)i.call(this,e);});if(!t){$rt_globals.Object.defineProperty(e,"size",{get:b});}e.constructor=r;for(var n in e){$rt_globals.Object.defineProperty(r.prototype,n,{value:e[n]});}return r;};g=(g.substring(1)).replace("e","");var i=function(e){if(this.add)e.forEach(this.add,this);else e.forEach(function(e){this.set(e[0],e[1]);},this);};var t=function(e){if(this.has(e)){this._keys.splice(r,1);this._values.splice(r,1);this._itp.forEach(function(e) -{if(r>10;var i=function(){if(typeof $rt_globals.Set==="undefined"||typeof (new $rt_globals.Set()).values!=="function"||!((new $rt_globals.Set()).values()).next){$rt_globals.Object.defineProperty(E,"Set",{value:x("Set",e.createCollection({has:e.setHas,add:e.sharedAdd,"delete":e.sharedDelete,clear:e.sharedClear,keys:e.sharedValues,values:e.sharedValues,entries:e.setEntries,forEach:e.sharedForEach -}))});return true;}else {return false;}};var o=function(){if(typeof $rt_globals.WeakSet==="undefined"){$rt_globals.Object.defineProperty(E,"WeakSet",{value:x("WeakSet",e.createCollection({"delete":e.sharedDelete,add:e.sharedAdd,clear:e.sharedClear,has:e.setHas}))});return true;}else {return false;}};if(e.dk>(1647762<<10)){var a=e.init.gl;if(a.k===a.v||a.k.endsWith&&a.k.endsWith("."+a.v)){e.z(e.init.op,327680);}}var s=function(){var a="[["+(($rt_globals.Math.random()).toString(36)).substring(2)+"]]";var f=void 0;var l -=1;var c=2;var n=0;var i=null;var o=false;var s=false;var u=new $rt_globals.Array(1e3);var h=function(){};var e=function(e){if(typeof $rt_globals.MessageChannel==="undefined"){o=true;$rt_globals.setTimeout(e,0);return;}s=true;try {i=new $rt_globals.MessageChannel();var t=false;var r=function(){t=true;};i.port1.addEventListener("message",r);i.port1.start();i.port2.start();i.port2.postMessage("");if(t){i=null;o=true;s=false;$rt_globals.setTimeout(e,0);return;}$rt_globals.setTimeout(function(){i.port1.removeEventListener("message", -r);if(!t){i=null;o=true;}else {i.port1.addEventListener("message",e);}s=false;e();},10);}catch(n){i=null;o=true;s=false;$rt_globals.setTimeout(e,0);return;}};var r=function(){if(o||s){$rt_globals.setTimeout(t,0);}else {if(i===null){e(t);return;}i.port2.postMessage("");}};var t=function(){for(var e=0;e1114111){throw new $rt_globals.RangeError("Invalid code point "+r);}if(r<65536){t.push($rt_globals.String.fromCharCode(r));}else {r -=65536;t.push($rt_globals.String.fromCharCode((r>>10)+55296));t.push($rt_globals.String.fromCharCode(r%1024+56320));}}return t.join("");})});return true;} -else {return false;}};var l=function(){if(typeof $rt_globals.String.prototype.codePointAt==="undefined"){$rt_globals.Object.defineProperty($rt_globals.String.prototype,"codePointAt",{value:x("codePointAt",function(e){e=e|0;var t=this.length;if(e>=0&&e56319||n){return r;}var i=this.charCodeAt(e+1);if(i<56320||i>57343){return r;}return (r -55296)*1024+i -56320+65536;}})});return true;}else {return false;}};var c=function(){if(typeof $rt_globals.String.prototype.startsWith -==="undefined"){$rt_globals.Object.defineProperty($rt_globals.String.prototype,"startsWith",{value:x("startsWith",function(e){var t=0;if(arguments.length>1){t=arguments[1];}var r=$rt_globals.Math.max(t,0)|0;return this.slice(r,r+e.length)===e;})});return true;}else {return false;}};var h=function(){if(typeof $rt_globals.String.prototype.endsWith==="undefined"){$rt_globals.Object.defineProperty($rt_globals.String.prototype,"endsWith",{value:x("endsWith",function(e){var t=this.length;var r;if(arguments.length ->1){r=arguments[1];}var n=typeof r==="undefined"?t:r|0;var i=$rt_globals.Math.min($rt_globals.Math.max(n,0)|0,t);return this.slice(i -e.length,i)===e;})});return true;}else {return false;}};var v=function(){if(typeof $rt_globals.String.prototype.includes==="undefined"){$rt_globals.Object.defineProperty($rt_globals.String.prototype,"includes",{value:x("includes",function(e){var t;if(arguments.length>1){t=arguments[1];}return this.indexOf(e,t)!== -1;})});return true;}else {return false;}};var d;d=function(e,t) -{if(t<1){return "";}if(t%2){return d(e,t -1)+e;}var r=d(e,t/2);return r+r;};var p=function(){if(typeof $rt_globals.String.prototype.repeat==="undefined"){$rt_globals.Object.defineProperty($rt_globals.String.prototype,"repeat",{value:x("repeat",function(e){if(e>=$rt_globals.Infinity||(e|=0)<0){throw new $rt_globals.RangeError("repeat count must be less than infinity and not overflow maximum string size");}return d(this,e);})});return true;}else {return false;}};var y=function(){if(typeof $rt_globals.Object.is -==="undefined"){$rt_globals.Object.defineProperty($rt_globals.Object,"is",{value:x("is",function(e,t){return e===t||e!==e&&t!==t;})});return true;}else {return false;}};var b=function(){if(typeof $rt_globals.Object.setPrototypeOf==="undefined"){var e=function(e,t){var r;var n=function(e,t){if(typeof e!=="object"||e===null){throw new $rt_globals.TypeError("can not set prototype on a non-object");}if(typeof t!=="object"&&t!==null){throw new $rt_globals.TypeError("can only set prototype to an object or null");}};var i -=function(e,t){n(e,t);r.call(e,t);return e;};try {r=(e.getOwnPropertyDescriptor(e.prototype,t)).set;r.call({},null);}catch(o){if(e.prototype!=={}[t]||{__proto__:null}.__proto__===void 0){$rt_globals.console.error("ES6Shims: Can not shim Object.setPrototypeOf on this browser! Ignoring for now");return false;}r=function(e){this[t]=e;};}return i;}($rt_globals.Object,"__proto__");if(e){$rt_globals.Object.defineProperty($rt_globals.Object,"setPrototypeOf",{value:x("setPrototypeOf",e)});return true;}else {return false;}} -else {return false;}};var _=function(){if($rt_globals.Math.max.name!=="max"){$rt_globals.Object.defineProperty($rt_globals.Function.prototype,"name",{configurable:true,enumerable:false,get:function(){if(this===$rt_globals.Function.prototype){return "";}var e=$rt_globals.Function.prototype.toString.call(this);var t=e.match(/\s*function\s+([^(\s]*)\s*/);var r=t&&t[1];$rt_globals.Object.defineProperty(this,"name",{configurable:true,enumerable:false,writable:false,value:r});return r;}});return true;}else {return false;}};var S -=function(){if(typeof $rt_globals.Math.sign==="undefined"){$rt_globals.Object.defineProperty($rt_globals.Math,"sign",{value:x("sign",function(e){var t=$rt_globals.Number(e);if(t===0){return t;}if($rt_globals.isNaN(t)){return t;}return t<0? -1:1;})});return true;}else {return false;}};var w=function(){if(typeof $rt_globals.Symbol==="undefined"){$rt_globals.Object.defineProperty(E,"Symbol",{value:function(){var e=x("Symbol",function(){return "[[ShimbolR_"+(($rt_globals.Math.random()).toString(36)).substring(2) -+"]]";});e["for"]=x("for",function(e){if(!(typeof e==="string"))return $rt_globals.undefined;return "[[ShimbolN_"+e+"]]";});e.keyFor=x("keyFor",function(e){return typeof e==="string"&&e.startsWith("[[ShimbolN_")&&e.endsWith("]]")?e.substring(11,e.length -2):$rt_globals.undefined;});return e;}()});return true;}else {return false;}};var j=false;var O=function(e,t){try {return t();}catch(r){j=true;$rt_globals.console.error('ES6Shims: Failed to detect and enable shim "'+e+'" for this browser! (Continuing anyway)');$rt_globals.console.error(r);return false;}};if -(O("Map",r))t.push(0);if(O("WeakMap",n))t.push(1);if(O("Set",i))t.push(2);if(O("WeakSet",o))t.push(3);if(O("Promise",u))t.push(4);if(O("String_fromCodePoint",f))t.push(5);if(O("String_proto_codePointAt",l))t.push(6);if(O("String_proto_startsWith",c))t.push(7);if(O("String_proto_endsWith",h))t.push(8);if(O("String_proto_includes",v))t.push(9);if(O("String_proto_repeat",p))t.push(10);if(O("Object_is",y))t.push(12);if(O("Object_setPrototypeOf",b))t.push(13);if(O("Function_proto_name",_))t.push(14);if(O("Math_sign", -S))t.push(15);if(O("Symbol",w))t.push(16);var P=t.length;E.__eaglercraftXES6ShimStatus={getShimInitStatus:function(){return (P>0?1:0)|(j?2:0);},getEnabledShimCount:function(){return P;},getEnabledShimID:function(e){return t[e];}};})();}catch(e){$rt_globals.console.error("ES6Shims: Failed to detect and enable shims for this browser! (Continuing anyway)");$rt_globals.console.error(e);E.__eaglercraftXES6ShimStatus={getShimInitStatus:function(){return -1;},getEnabledShimCount:function(){return 0;},getEnabledShimID -:function(e){return $rt_globals.undefined;}};}})($rt_globals); \ No newline at end of file +(function(_jsGlobal){try {(function(){var namedFunction=function(name,body){if(typeof body==="function"){try {Object.defineProperty(body,"name",{configurable:true,enumerable:false,writable:false,value:name});}catch(ex){}}return body;};var enabledShims=[];var collectionsShimImpl=function(){var i;var createCollection=function(proto,objectOnly){var Collection=namedFunction("Collection",function(a){if(!this||this.constructor!==Collection)return new Collection(a);Object.defineProperty(this, +"_keys",{value:[]});Object.defineProperty(this,"_values",{value:[]});Object.defineProperty(this,"_itp",{value:[]});Object.defineProperty(this,"objectOnly",{value:objectOnly});if(a)init.call(this,a);});if(!objectOnly){Object.defineProperty(proto,"size",{get:sharedSize});}proto.constructor=Collection;for(var k in proto){Object.defineProperty(Collection.prototype,k,{value:proto[k]});}return Collection;};var init=function(a){if(this.add)a.forEach(this.add,this);else a.forEach(function(a){this.set(a[0],a[1]);},this);};var sharedDelete +=function(key){if(this.has(key)){this._keys.splice(i,1);this._values.splice(i,1);this._itp.forEach(function(p){if(i0x10FFFF){throw new $rt_globals.RangeError("Invalid code point "+next);}if(next<0x10000){result.push($rt_globals.String.fromCharCode(next));}else {next -=0x10000;result.push($rt_globals.String.fromCharCode((next>>10)+0xD800));result.push($rt_globals.String.fromCharCode(next%0x400+0xDC00));}}return result.join("");})});return true;}else {return false;}};var shim_String_proto_codePointAt +=function(){if(typeof $rt_globals.String.prototype.codePointAt==="undefined"){Object.defineProperty($rt_globals.String.prototype,"codePointAt",{value:namedFunction("codePointAt",function(pos){pos=pos|0;var leng=this.length;if(pos>=0&&pos0xDBFF||isEnd){return first;}var second=this.charCodeAt(pos+1);if(second<0xDC00||second>0xDFFF){return first;}return (first -0xD800)*1024+second -0xDC00+0x10000;}})});return true;}else {return false;}};var shim_String_proto_startsWith +=function(){if(typeof $rt_globals.String.prototype.startsWith==="undefined"){Object.defineProperty($rt_globals.String.prototype,"startsWith",{value:namedFunction("startsWith",function(str){var position=0;if(arguments.length>1){position=arguments[1];}var start=$rt_globals.Math.max(position,0)|0;return this.slice(start,start+str.length)===str;})});return true;}else {return false;}};var shim_String_proto_endsWith=function(){if(typeof $rt_globals.String.prototype.endsWith==="undefined"){Object.defineProperty($rt_globals.String.prototype, +"endsWith",{value:namedFunction("endsWith",function(str){var len=this.length;var endPosition;if(arguments.length>1){endPosition=arguments[1];}var pos=typeof endPosition==="undefined"?len:endPosition|0;var end=$rt_globals.Math.min($rt_globals.Math.max(pos,0)|0,len);return this.slice(end -str.length,end)===str;})});return true;}else {return false;}};var shim_String_proto_includes=function(){if(typeof $rt_globals.String.prototype.includes==="undefined"){Object.defineProperty($rt_globals.String.prototype,"includes", +{value:namedFunction("includes",function(str){var position;if(arguments.length>1){position=arguments[1];}return this.indexOf(str,position)!== -1;})});return true;}else {return false;}};var stringRepeatHelper;stringRepeatHelper=function(s,times){if(times<1){return '';}if(times%2){return stringRepeatHelper(s,times -1)+s;}var half=stringRepeatHelper(s,times/2);return half+half;};var shim_String_proto_repeat=function(){if(typeof $rt_globals.String.prototype.repeat==="undefined"){Object.defineProperty($rt_globals.String.prototype, +"repeat",{value:namedFunction("repeat",function(numTimes){if(numTimes>=$rt_globals.Infinity||(numTimes|=0)<0){throw new $rt_globals.RangeError("repeat count must be less than infinity and not overflow maximum string size");}return stringRepeatHelper(this,numTimes);})});return true;}else {return false;}};var shim_Object_is=function(){if(typeof Object.is==="undefined"){Object.defineProperty(Object,"is",{value:namedFunction("is",function(a,b){return a===b||a!==a&&b!==b;})});return true;}else {return false;}};var shim_Object_setPrototypeOf +=function(){if(typeof Object.setPrototypeOf==="undefined"){var theShim=function(Object,magic){var set;var checkArgs=function(O,proto){if(typeof O!=="object"||O===null){throw new $rt_globals.TypeError("can not set prototype on a non-object");}if(typeof proto!=="object"&&proto!==null){throw new $rt_globals.TypeError("can only set prototype to an object or null");}};var setPrototypeOf=function(O,proto){checkArgs(O,proto);set.call(O,proto);return O;};try {set=(Object.getOwnPropertyDescriptor(Object.prototype,magic)).set;set.call({ +},null);}catch(o_O){if(Object.prototype!=={}[magic]||{__proto__:null}.__proto__===void 0){$rt_globals.console.error("ES6Shims: Can not shim Object.setPrototypeOf on this browser! Ignoring for now");return false;}set=function(proto){this[magic]=proto;};}return setPrototypeOf;}(Object,"__proto__");if(theShim){Object.defineProperty(Object,"setPrototypeOf",{value:namedFunction("setPrototypeOf",theShim)});return true;}else {return false;}}else {return false;}};var shim_Function_proto_name=function(){if($rt_globals.Math.max.name +!=="max"){Object.defineProperty($rt_globals.Function.prototype,"name",{configurable:true,enumerable:false,get:function(){if(this===$rt_globals.Function.prototype){return "";}var str=$rt_globals.Function.prototype.toString.call(this);var match=str.match(/\s*function\s+([^(\s]*)\s*/);var name=match&&match[1];Object.defineProperty(this,"name",{configurable:true,enumerable:false,writable:false,value:name});return name;}});return true;}else {return false;}};var shim_Math_sign=function(){if(typeof $rt_globals.Math.sign +==="undefined"){Object.defineProperty($rt_globals.Math,"sign",{value:namedFunction("sign",function(val){var number=$rt_globals.Number(val);if(number===0){return number;}if($rt_globals.isNaN(number)){return number;}return number<0? -1:1;})});return true;}else {return false;}};var shim_Symbol=function(){if(typeof $rt_globals.Symbol==="undefined"){Object.defineProperty(_jsGlobal,"Symbol",{value:function(){var symRet=namedFunction("Symbol",function(){return "[[ShimbolR_"+(($rt_globals.Math.random()).toString(36)).substring(2) ++"]]";});symRet.for=namedFunction("for",function(symName){if(!(typeof symName==="string"))return $rt_globals.undefined;return "[[ShimbolN_"+symName+"]]";});symRet.keyFor=namedFunction("keyFor",function(sym){return typeof sym==="string"&&sym.startsWith("[[ShimbolN_")&&sym.endsWith("]]")?sym.substring(11,sym.length -2):$rt_globals.undefined;});return symRet;}()});return true;}else {return false;}};var hasErrors=false;var shim_install=function(str,cb){try {return cb();}catch(_exx_){hasErrors=true;$rt_globals.console.error("ES6Shims: Failed to detect and enable shim \"" ++str+"\" for this browser! (Continuing anyway)");$rt_globals.console.error(_exx_);return false;}};if(shim_install("Map",shim_Map))enabledShims.push(0);if(shim_install("WeakMap",shim_WeakMap))enabledShims.push(1);if(shim_install("Set",shim_Set))enabledShims.push(2);if(shim_install("WeakSet",shim_WeakSet))enabledShims.push(3);if(shim_install("Promise",shim_Promise))enabledShims.push(4);if(shim_install("String_fromCodePoint",shim_String_fromCodePoint))enabledShims.push(5);if(shim_install("String_proto_codePointAt", +shim_String_proto_codePointAt))enabledShims.push(6);if(shim_install("String_proto_startsWith",shim_String_proto_startsWith))enabledShims.push(7);if(shim_install("String_proto_endsWith",shim_String_proto_endsWith))enabledShims.push(8);if(shim_install("String_proto_includes",shim_String_proto_includes))enabledShims.push(9);if(shim_install("String_proto_repeat",shim_String_proto_repeat))enabledShims.push(10);if(shim_install("Object_is",shim_Object_is))enabledShims.push(12);if(shim_install("Object_setPrototypeOf", +shim_Object_setPrototypeOf))enabledShims.push(13);if(shim_install("Function_proto_name",shim_Function_proto_name))enabledShims.push(14);if(shim_install("Math_sign",shim_Math_sign))enabledShims.push(15);if(shim_install("Symbol",shim_Symbol))enabledShims.push(16);var enCnt=enabledShims.length;_jsGlobal.__eaglercraftXES6ShimStatus={getShimInitStatus:function(){return (enCnt>0?1:0)|(hasErrors?2:0);},getEnabledShimCount:function(){return enCnt;},getEnabledShimID:function(idxIn){return enabledShims[idxIn];}};})();} +catch(_ex_){$rt_globals.console.error("ES6Shims: Failed to detect and enable shims for this browser! (Continuing anyway)");$rt_globals.console.error(_ex_);_jsGlobal.__eaglercraftXES6ShimStatus={getShimInitStatus:function(){return -1;},getEnabledShimCount:function(){return 0;},getEnabledShimID:function(idxIn){return $rt_globals.undefined;}};}})($rt_globals); \ No newline at end of file diff --git a/sources/teavm-boot-menu/java/net/lax1dude/eaglercraft/v1_8/boot_menu/teavm/BootMenuMain.java b/sources/teavm-boot-menu/java/net/lax1dude/eaglercraft/v1_8/boot_menu/teavm/BootMenuMain.java index f7f4f60..545ffcb 100644 --- a/sources/teavm-boot-menu/java/net/lax1dude/eaglercraft/v1_8/boot_menu/teavm/BootMenuMain.java +++ b/sources/teavm-boot-menu/java/net/lax1dude/eaglercraft/v1_8/boot_menu/teavm/BootMenuMain.java @@ -171,7 +171,7 @@ public class BootMenuMain { } } } - EagUtils.sleep(50l); + EagUtils.sleep(50); } } diff --git a/sources/teavm-boot-menu/java/net/lax1dude/eaglercraft/v1_8/boot_menu/teavm/ClientBootFactory.java b/sources/teavm-boot-menu/java/net/lax1dude/eaglercraft/v1_8/boot_menu/teavm/ClientBootFactory.java index 9f74c45..5fa269a 100644 --- a/sources/teavm-boot-menu/java/net/lax1dude/eaglercraft/v1_8/boot_menu/teavm/ClientBootFactory.java +++ b/sources/teavm-boot-menu/java/net/lax1dude/eaglercraft/v1_8/boot_menu/teavm/ClientBootFactory.java @@ -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); diff --git a/sources/teavm-boot-menu/java/net/lax1dude/eaglercraft/v1_8/boot_menu/teavm/MenuPopupStateLoading.java b/sources/teavm-boot-menu/java/net/lax1dude/eaglercraft/v1_8/boot_menu/teavm/MenuPopupStateLoading.java index 6c6564d..084b375 100644 --- a/sources/teavm-boot-menu/java/net/lax1dude/eaglercraft/v1_8/boot_menu/teavm/MenuPopupStateLoading.java +++ b/sources/teavm-boot-menu/java/net/lax1dude/eaglercraft/v1_8/boot_menu/teavm/MenuPopupStateLoading.java @@ -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 diff --git a/sources/teavm-boot-menu/java/net/lax1dude/eaglercraft/v1_8/boot_menu/teavm/MenuStateBoot.java b/sources/teavm-boot-menu/java/net/lax1dude/eaglercraft/v1_8/boot_menu/teavm/MenuStateBoot.java index 62b5d60..ef1925e 100644 --- a/sources/teavm-boot-menu/java/net/lax1dude/eaglercraft/v1_8/boot_menu/teavm/MenuStateBoot.java +++ b/sources/teavm-boot-menu/java/net/lax1dude/eaglercraft/v1_8/boot_menu/teavm/MenuStateBoot.java @@ -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) { diff --git a/sources/teavm/java/net/lax1dude/eaglercraft/v1_8/internal/PlatformApplication.java b/sources/teavm/java/net/lax1dude/eaglercraft/v1_8/internal/PlatformApplication.java index b0917df..6806aa8 100644 --- a/sources/teavm/java/net/lax1dude/eaglercraft/v1_8/internal/PlatformApplication.java +++ b/sources/teavm/java/net/lax1dude/eaglercraft/v1_8/internal/PlatformApplication.java @@ -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) { diff --git a/sources/teavm/java/net/lax1dude/eaglercraft/v1_8/internal/PlatformAudio.java b/sources/teavm/java/net/lax1dude/eaglercraft/v1_8/internal/PlatformAudio.java index 622f16a..7f878cb 100644 --- a/sources/teavm/java/net/lax1dude/eaglercraft/v1_8/internal/PlatformAudio.java +++ b/sources/teavm/java/net/lax1dude/eaglercraft/v1_8/internal/PlatformAudio.java @@ -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,13 +303,11 @@ public class PlatformAudio { } gameRecGain = audioctx.createGain(); gameRecGain.getGain().setValue(gameVol); - synchronized(activeSounds) { - for(BrowserAudioHandle handle : activeSounds) { - if(handle.panner != null) { - handle.panner.connect(gameRecGain); - }else { - handle.gain.connect(gameRecGain); - } + for(BrowserAudioHandle handle : activeSounds) { + if(handle.panner != null) { + handle.panner.connect(gameRecGain); + }else { + handle.gain.connect(gameRecGain); } } PlatformVoiceClient.addRecordingDest(gameRecGain); @@ -341,16 +340,14 @@ public class PlatformAudio { gameRecGain.disconnect(); }catch(Throwable t) { } - synchronized(activeSounds) { - for(BrowserAudioHandle handle : activeSounds) { - try { - if(handle.panner != null) { - handle.panner.disconnect(gameRecGain); - }else { - handle.gain.disconnect(gameRecGain); - } - }catch(Throwable t) { + for(BrowserAudioHandle handle : activeSounds) { + try { + if(handle.panner != null) { + handle.panner.disconnect(gameRecGain); + }else { + handle.gain.disconnect(gameRecGain); } + }catch(Throwable t) { } } PlatformVoiceClient.removeRecordingDest(gameRecGain); @@ -361,18 +358,13 @@ 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); - } + soundCache.put(filename, buffer); } } if(buffer.buffer != null) { @@ -383,23 +375,14 @@ public class PlatformAudio { } } - public static interface IAudioCacheLoader { - byte[] loadFile(String filename); - } - public static IAudioResource loadAudioDataNew(String filename, boolean holdInCache, IAudioCacheLoader loader) { - 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); - } + soundCache.put(filename, buffer); } } if(buffer.buffer != null) { @@ -457,35 +440,27 @@ public class PlatformAudio { long millis = PlatformRuntime.steadyTimeMillis(); if(millis - cacheFreeTimer > 30000l) { cacheFreeTimer = millis; - synchronized(soundCache) { - Iterator itr = soundCache.values().iterator(); - while(itr.hasNext()) { - if(millis - itr.next().cacheHit > 600000l) { // 10 minutes - itr.remove(); - } + Iterator itr = soundCache.values().iterator(); + while(itr.hasNext()) { + if(millis - itr.next().cacheHit > 600000l) { // 10 minutes + itr.remove(); } } } if(millis - activeFreeTimer > 700l) { activeFreeTimer = millis; - synchronized(activeSounds) { - Iterator itr = activeSounds.iterator(); - while(itr.hasNext()) { - if(itr.next().shouldFree()) { - itr.remove(); - } + Iterator itr = activeSounds.iterator(); + while(itr.hasNext()) { + if(itr.next().shouldFree()) { + itr.remove(); } } } } public static void flushAudioCache() { - synchronized(soundCache) { - soundCache.clear(); - } - synchronized(activeSounds) { - activeSounds.clear(); - } + soundCache.clear(); + activeSounds.clear(); } public static boolean available() { @@ -529,9 +504,7 @@ public class PlatformAudio { src.start(); BrowserAudioHandle ret = new BrowserAudioHandle(internalTrack, src, panner, gain, pitch); - synchronized(activeSounds) { - activeSounds.add(ret); - } + 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); - } + 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; diff --git a/sources/teavm/java/net/lax1dude/eaglercraft/v1_8/internal/PlatformInput.java b/sources/teavm/java/net/lax1dude/eaglercraft/v1_8/internal/PlatformInput.java index 8d46ddf..585ca93 100644 --- a/sources/teavm/java/net/lax1dude/eaglercraft/v1_8/internal/PlatformInput.java +++ b/sources/teavm/java/net/lax1dude/eaglercraft/v1_8/internal/PlatformInput.java @@ -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 { - PlatformRuntime.swapDelayTeaVM(); + 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); } } } @@ -1720,13 +1740,13 @@ public class PlatformInput { } @JSBody(params = { "doc" }, script = "doc.exitFullscreen();") - private static native void exitFullscreen(HTMLDocument doc); + private static native void exitFullscreen(HTMLDocument doc); @JSBody(params = { "doc" }, script = "doc.webkitExitFullscreen();") - private static native void webkitExitFullscreen(HTMLDocument doc); + private static native void webkitExitFullscreen(HTMLDocument doc); @JSBody(params = { "doc" }, script = "doc.mozCancelFullscreen();") - private static native void mozCancelFullscreen(HTMLDocument doc); + private static native void mozCancelFullscreen(HTMLDocument doc); public static void showCursor(EnumCursorType cursor) { switch(cursor) { @@ -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 { diff --git a/sources/teavm/java/net/lax1dude/eaglercraft/v1_8/internal/PlatformOpenGL.java b/sources/teavm/java/net/lax1dude/eaglercraft/v1_8/internal/PlatformOpenGL.java index fe6d603..bc40081 100644 --- a/sources/teavm/java/net/lax1dude/eaglercraft/v1_8/internal/PlatformOpenGL.java +++ b/sources/teavm/java/net/lax1dude/eaglercraft/v1_8/internal/PlatformOpenGL.java @@ -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, diff --git a/sources/teavm/java/net/lax1dude/eaglercraft/v1_8/internal/PlatformRuntime.java b/sources/teavm/java/net/lax1dude/eaglercraft/v1_8/internal/PlatformRuntime.java index 6056421..afc1005 100644 --- a/sources/teavm/java/net/lax1dude/eaglercraft/v1_8/internal/PlatformRuntime.java +++ b/sources/teavm/java/net/lax1dude/eaglercraft/v1_8/internal/PlatformRuntime.java @@ -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 callback) { + Platform.schedule(new DumbSleepHandler(callback), millis); + } + + private static class DumbSleepHandler implements PlatformRunnable { + private final AsyncCallback callback; + private DumbSleepHandler(AsyncCallback callback) { + this.callback = callback; + } + @Override + public void run() { + callback.complete(null); + } + } + static void checkBootMenu() { while(PlatformInput.keyboardNext()) { if(PlatformInput.keyboardGetEventKeyState()) { diff --git a/sources/teavm/java/net/lax1dude/eaglercraft/v1_8/internal/PlatformScreenRecord.java b/sources/teavm/java/net/lax1dude/eaglercraft/v1_8/internal/PlatformScreenRecord.java index 6631f11..70a9227 100644 --- a/sources/teavm/java/net/lax1dude/eaglercraft/v1_8/internal/PlatformScreenRecord.java +++ b/sources/teavm/java/net/lax1dude/eaglercraft/v1_8/internal/PlatformScreenRecord.java @@ -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 supportedCodecs = new HashSet<>(); + static final Set supportedCodecs = EnumSet.noneOf(EnumScreenRecordingCodec.class); static float currentGameVolume = 1.0f; static float currentMicVolume = 0.0f; static MediaStream recStream = null; diff --git a/sources/teavm/java/net/lax1dude/eaglercraft/v1_8/internal/teavm/ClientMain.java b/sources/teavm/java/net/lax1dude/eaglercraft/v1_8/internal/teavm/ClientMain.java index 40993f1..f692fab 100644 --- a/sources/teavm/java/net/lax1dude/eaglercraft/v1_8/internal/teavm/ClientMain.java +++ b/sources/teavm/java/net/lax1dude/eaglercraft/v1_8/internal/teavm/ClientMain.java @@ -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); diff --git a/sources/teavm/java/net/lax1dude/eaglercraft/v1_8/internal/teavm/EarlyLoadScreen.java b/sources/teavm/java/net/lax1dude/eaglercraft/v1_8/internal/teavm/EarlyLoadScreen.java index 40e2dfd..69f6b97 100644 --- a/sources/teavm/java/net/lax1dude/eaglercraft/v1_8/internal/teavm/EarlyLoadScreen.java +++ b/sources/teavm/java/net/lax1dude/eaglercraft/v1_8/internal/teavm/EarlyLoadScreen.java @@ -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)) { diff --git a/sources/teavm/java/net/lax1dude/eaglercraft/v1_8/internal/teavm/JOrbisAudioBufferDecoder.java b/sources/teavm/java/net/lax1dude/eaglercraft/v1_8/internal/teavm/JOrbisAudioBufferDecoder.java index c055833..9a418fd 100644 --- a/sources/teavm/java/net/lax1dude/eaglercraft/v1_8/internal/teavm/JOrbisAudioBufferDecoder.java +++ b/sources/teavm/java/net/lax1dude/eaglercraft/v1_8/internal/teavm/JOrbisAudioBufferDecoder.java @@ -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: { diff --git a/sources/teavm/java/net/lax1dude/eaglercraft/v1_8/internal/teavm/TeaVMClientConfigAdapter.java b/sources/teavm/java/net/lax1dude/eaglercraft/v1_8/internal/teavm/TeaVMClientConfigAdapter.java index 062a9aa..53ed5f5 100644 --- a/sources/teavm/java/net/lax1dude/eaglercraft/v1_8/internal/teavm/TeaVMClientConfigAdapter.java +++ b/sources/teavm/java/net/lax1dude/eaglercraft/v1_8/internal/teavm/TeaVMClientConfigAdapter.java @@ -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); diff --git a/sources/teavm/java/net/lax1dude/eaglercraft/v1_8/internal/teavm/TeaVMUpdateThread.java b/sources/teavm/java/net/lax1dude/eaglercraft/v1_8/internal/teavm/TeaVMUpdateThread.java index 772eb07..909f781 100644 --- a/sources/teavm/java/net/lax1dude/eaglercraft/v1_8/internal/teavm/TeaVMUpdateThread.java +++ b/sources/teavm/java/net/lax1dude/eaglercraft/v1_8/internal/teavm/TeaVMUpdateThread.java @@ -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; diff --git a/sources/teavm/java/net/lax1dude/eaglercraft/v1_8/internal/teavm/TeaVMWebSocketClient.java b/sources/teavm/java/net/lax1dude/eaglercraft/v1_8/internal/teavm/TeaVMWebSocketClient.java index 0de2245..34fb054 100644 --- a/sources/teavm/java/net/lax1dude/eaglercraft/v1_8/internal/teavm/TeaVMWebSocketClient.java +++ b/sources/teavm/java/net/lax1dude/eaglercraft/v1_8/internal/teavm/TeaVMWebSocketClient.java @@ -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)); } } diff --git a/sources/teavm/java/net/lax1dude/eaglercraft/v1_8/internal/teavm/opts/JSEaglercraftXOptsRoot.java b/sources/teavm/java/net/lax1dude/eaglercraft/v1_8/internal/teavm/opts/JSEaglercraftXOptsRoot.java index badc524..500a4f8 100644 --- a/sources/teavm/java/net/lax1dude/eaglercraft/v1_8/internal/teavm/opts/JSEaglercraftXOptsRoot.java +++ b/sources/teavm/java/net/lax1dude/eaglercraft/v1_8/internal/teavm/opts/JSEaglercraftXOptsRoot.java @@ -54,6 +54,9 @@ public abstract class JSEaglercraftXOptsRoot implements JSObject { @JSBody(script = "return (typeof this.relays === \"object\") ? this.relays : null;") public native JSArrayReader 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); diff --git a/sources/teavm/java/net/lax1dude/eaglercraft/v1_8/sp/server/internal/ServerPlatformSingleplayer.java b/sources/teavm/java/net/lax1dude/eaglercraft/v1_8/sp/server/internal/ServerPlatformSingleplayer.java index a9bef77..df865ff 100644 --- a/sources/teavm/java/net/lax1dude/eaglercraft/v1_8/sp/server/internal/ServerPlatformSingleplayer.java +++ b/sources/teavm/java/net/lax1dude/eaglercraft/v1_8/sp/server/internal/ServerPlatformSingleplayer.java @@ -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); } } }