This commit is contained in:
HoosierTransfer 2024-06-03 15:11:29 -04:00
parent ce0c54cabb
commit e19b260b8c
61 changed files with 47480 additions and 1441 deletions

View File

@ -1,4 +1,4 @@
@echo off
title MakeOfflineDownload
java -cp "resources/MakeOfflineDownload.jar;resources/CompileEPK.jar" net.lax1dude.eaglercraft.v1_8.buildtools.workspace.MakeOfflineDownload "javascript/OfflineDownloadTemplate.txt" "javascript/classes.js" "javascript/assets.epk" "javascript/EaglercraftL_1.9_Offline_en_US.html" "javascript/EaglercraftX_1.8_Offline_International.html" "javascript/lang"
java -cp "resources/MakeOfflineDownload.jar;resources/CompileEPK.jar" net.lax1dude.eaglercraft.v1_8.buildtools.workspace.MakeOfflineDownload "javascript/OfflineDownloadTemplate.txt" "javascript/classes.js" "javascript/assets.epk" "javascript/EaglercraftL_1.9_Offline_en_US.html" "javascript/EaglercraftL_1.9_Offline_International.html" "javascript/lang"
pause

0
New Text Document.txt Normal file
View File

File diff suppressed because one or more lines are too long

BIN
javascript/web.zip Normal file

Binary file not shown.

BIN
javascript/web1.zip Normal file

Binary file not shown.

BIN
javascript/web2.zip Normal file

Binary file not shown.

BIN
javascript/web4.zip Normal file

Binary file not shown.

View File

@ -74,6 +74,10 @@ public class PlatformApplication {
}
public static void setLocalStorage(String name, byte[] data) {
setLocalStorage(name, data, true);
}
public static void setLocalStorage(String name, byte[] data, boolean hooks) {
if (data == null) {
(new File("_eagstorage." + name + ".dat")).delete();
} else {
@ -86,6 +90,10 @@ public class PlatformApplication {
}
public static byte[] getLocalStorage(String data) {
return getLocalStorage(data, true);
}
public static byte[] getLocalStorage(String data, boolean hooks) {
File f = new File("_eagstorage." + data + ".dat");
if (!f.isFile()) {
return null;

View File

@ -238,6 +238,10 @@ public class PlatformInput {
glfwSwapBuffers(win);
}
public static boolean isVSyncSupported() {
return true;
}
public static boolean wasResized() {
boolean b = windowResized;
windowResized = false;

View File

@ -8,19 +8,27 @@ import org.json.JSONObject;
import net.lax1dude.eaglercraft.v1_8.EaglercraftRandom;
import net.lax1dude.eaglercraft.v1_8.EaglercraftVersion;
import net.lax1dude.eaglercraft.v1_8.internal.IClientConfigAdapter;
import net.lax1dude.eaglercraft.v1_8.internal.IClientConfigAdapterHooks;
import net.lax1dude.eaglercraft.v1_8.sp.relay.RelayEntry;
/**
* Copyright (c) 2022 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* 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)
* 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.
*
@ -31,6 +39,8 @@ public class DesktopClientConfigAdapter implements IClientConfigAdapter {
public final List<DefaultServer> defaultServers = new ArrayList();
private final DesktopClientConfigAdapterHooks hooks = new DesktopClientConfigAdapterHooks();
@Override
public String getDefaultLocale() {
return "en_US";
@ -128,4 +138,33 @@ public class DesktopClientConfigAdapter implements IClientConfigAdapter {
public boolean isAllowVoiceClient() {
return false;
}
@Override
public boolean isAllowFNAWSkins() {
return true;
}
@Override
public String getLocalStorageNamespace() {
return EaglercraftVersion.localStorageNamespace;
}
@Override
public IClientConfigAdapterHooks getHooks() {
return hooks;
}
private static class DesktopClientConfigAdapterHooks implements IClientConfigAdapterHooks {
@Override
public void callLocalStorageSavedHook(String key, String base64) {
}
@Override
public String callLocalStorageLoadHook(String key) {
return null;
}
}
}

View File

@ -21,10 +21,6 @@ public class Config {
return Minecraft.getMinecraft().gameSettings.disableAlpha && !Minecraft.getMinecraft().gameSettings.shaders;
}
public static boolean skipRenderUpdate() {
return Minecraft.getMinecraft().gameSettings.skipHandRender && !Minecraft.getMinecraft().gameSettings.shaders;
}
public static boolean audioEnabled() {
return Minecraft.getMinecraft().gameSettings.enableSound;
}

View File

@ -57,6 +57,10 @@ public class Display {
PlatformInput.setVSync(enable);
}
public static boolean isVSyncSupported() {
return PlatformInput.isVSyncSupported();
}
public static void update() {
PlatformInput.update();
}

View File

@ -9,8 +9,8 @@ public class EaglercraftVersion {
/// Customize these to fit your fork:
public static final String projectForkName = "Eaglercraft Lambda";
public static final String projectForkVersion = "0.3.1";
public static final String projectForkVendor = "hoosiertransfer";
public static final String projectForkVersion = "0.3.5";
public static final String projectForkVendor = "HoosierTransfer";
public static final String projectForkURL = "https://gitlab.com/lax1dude/eaglercraftx-1.8";
@ -18,8 +18,8 @@ public class EaglercraftVersion {
public static final String projectOriginName = "EaglercraftX";
public static final String projectOriginAuthor = "lax1dude";
public static final String projectOriginRevision = "1.9";
public static final String projectOriginVersion = "u29";
public static final String projectOriginRevision = "1.9.4";
public static final String projectOriginVersion = "u30";
public static final String projectOriginURL = "https://gitlab.com/lax1dude/eaglercraftx-1.8"; // rest in peace
@ -28,7 +28,7 @@ public class EaglercraftVersion {
public static final boolean enableUpdateService = false;
public static final String updateBundlePackageName = "net.lax1dude.eaglercraft.v1_8.client";
public static final int updateBundlePackageVersionInt = 29;
public static final int updateBundlePackageVersionInt = 30;
public static final String updateLatestLocalStorageKey = "latestUpdate_" + updateBundlePackageName;
@ -38,7 +38,7 @@ public class EaglercraftVersion {
// Miscellaneous variables:
public static final String mainMenuStringA = "Minecraft 1.8.8";
public static final String mainMenuStringA = "Minecraft 1.9.4";
public static final String mainMenuStringB = projectOriginName + " " +
projectOriginRevision + "-" + projectOriginVersion + " ultimate";
public static final String mainMenuStringC = "";
@ -56,4 +56,6 @@ public class EaglercraftVersion {
public static final boolean forceDemoMode = false;
public static final String localStorageNamespace = "_eaglercraftX";
}

View File

@ -8,14 +8,21 @@ import org.json.JSONObject;
/**
* Copyright (c) 2022-2024 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* 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)
* 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.
*
@ -69,4 +76,10 @@ public interface IClientConfigAdapter {
boolean isEnableSignatureBadge();
boolean isAllowVoiceClient();
boolean isAllowFNAWSkins();
String getLocalStorageNamespace();
IClientConfigAdapterHooks getHooks();
}

View File

@ -1,30 +1,31 @@
package net.lax1dude.eaglercraft.v1_8.internal.teavm.opts;
import org.teavm.jso.JSIndexer;
import org.teavm.jso.JSObject;
import org.teavm.jso.JSProperty;
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
* 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)
* 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 JSEaglercraftXOptsRelaysArray extends JSObject {
public interface IClientConfigAdapterHooks {
@JSIndexer
JSEaglercraftXOptsRelay get(int idx);
void callLocalStorageSavedHook(String key, String base64);
@JSProperty
int getLength();
String callLocalStorageLoadHook(String key);
}

View File

@ -13,6 +13,29 @@ import net.minecraft.client.resources.IResourceManager;
import net.minecraft.client.resources.IResourceManagerReloadListener;
import net.minecraft.util.ResourceLocation;
/**
* Copyright (c) 2023 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 class BlockVertexIDs implements IResourceManagerReloadListener {
private static final Logger logger = LogManager.getLogger("BlockVertexIDsCSV");

View File

@ -72,7 +72,8 @@ public class EaglerSkinTexture implements ITextureObject {
}
System.arraycopy(pixels, 0, this.pixels, 0, pixels.length);
if (textureId != -1) {
TextureUtil.uploadTextureImageAllocate(textureId, new ImageData(width, height, pixels, true), false, false);
TextureUtil.uploadTextureImageSub(textureId, new ImageData(width, height, pixels, true), 0, 0, false,
false);
}
}

View File

@ -20,8 +20,7 @@ import static net.lax1dude.eaglercraft.v1_8.opengl.RealOpenGLEnums.*;
import java.io.IOException;
/**
* Copyright (c) 2022-2023 lax1dude, hoosiertransfer, ayunami2000. All Rights
* Reserved.
* Copyright (c) 2022-2024 lax1dude, ayunami2000. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND
@ -83,14 +82,20 @@ public class GuiScreenEditProfile extends GuiScreen {
}
private void updateOptions() {
DefaultSkins[] arr = DefaultSkins.defaultSkinsMap;
if (!EagRuntime.getConfiguration().isAllowFNAWSkins()) {
DefaultSkins[] arrNoFNAW = new DefaultSkins[arr.length - 5];
System.arraycopy(arr, 0, arrNoFNAW, 0, arrNoFNAW.length);
arr = arrNoFNAW;
}
int numCustom = EaglerProfile.customSkins.size();
String[] n = new String[numCustom + DefaultSkins.defaultSkinsMap.length];
String[] n = new String[numCustom + arr.length];
for (int i = 0; i < numCustom; ++i) {
n[i] = EaglerProfile.customSkins.get(i).name;
}
int numDefault = DefaultSkins.defaultSkinsMap.length;
int numDefault = arr.length;
for (int j = 0; j < numDefault; ++j) {
n[numCustom + j] = DefaultSkins.defaultSkinsMap[j].name;
n[numCustom + j] = arr[j].name;
}
dropDownOptions = n;
}
@ -116,6 +121,10 @@ public class GuiScreenEditProfile extends GuiScreen {
GlStateManager.translate(skinX + 2, skinY - 9, 0.0f);
GlStateManager.scale(0.75f, 0.75f, 0.75f);
if (selectedSlot > dropDownOptions.length - 1) {
selectedSlot = 0;
}
int numberOfCustomSkins = EaglerProfile.customSkins.size();
int skid = selectedSlot - numberOfCustomSkins;
SkinModel selectedSkinModel = skid < 0 ? EaglerProfile.customSkins.get(selectedSlot).model

View File

@ -12,14 +12,21 @@ import net.minecraft.client.resources.I18n;
/**
* Copyright (c) 2024 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* 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)
* 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.
*
@ -34,8 +41,10 @@ public class GuiScreenImportExportProfile extends GuiScreen {
}
public void initGui() {
this.buttonList.add(new GuiButton(1, this.width / 2 - 100, this.height / 4 + 40, I18n.format("settingsBackup.importExport.import")));
this.buttonList.add(new GuiButton(2, this.width / 2 - 100, this.height / 4 + 65, I18n.format("settingsBackup.importExport.export")));
this.buttonList.add(new GuiButton(1, this.width / 2 - 100, this.height / 4 + 40,
I18n.format("settingsBackup.importExport.import")));
this.buttonList.add(new GuiButton(2, this.width / 2 - 100, this.height / 4 + 65,
I18n.format("settingsBackup.importExport.export")));
this.buttonList.add(new GuiButton(0, this.width / 2 - 100, this.height / 4 + 130, I18n.format("gui.cancel")));
}
@ -56,13 +65,18 @@ public class GuiScreenImportExportProfile extends GuiScreen {
FileChooserResult result = EagRuntime.getFileChooserResult();
if (result != null) {
mc.loadingScreen.eaglerShow(I18n.format("settingsBackup.importing.1"), "settingsBackup.importing.2");
try {
ProfileImporter importer = new ProfileImporter(result.fileData);
try {
importer.readHeader();
mc.displayGuiScreen(new GuiScreenImportProfile(importer, back));
} catch (IOException ex) {
try {
importer.close();
} catch (IOException e) {
}
EagRuntime.debugPrintStackTrace(ex);
mc.displayGuiScreen(new GuiScreenGenericErrorMessage("settingsBackup.importing.failed.1", "settingsBackup.importing.failed.2", back));
mc.displayGuiScreen(new GuiScreenGenericErrorMessage("settingsBackup.importing.failed.1",
"settingsBackup.importing.failed.2", back));
}
}
}
@ -71,7 +85,8 @@ public class GuiScreenImportExportProfile extends GuiScreen {
public void drawScreen(int par1, int par2, float par3) {
this.drawDefaultBackground();
this.drawCenteredString(this.fontRendererObj, I18n.format("settingsBackup.importExport.title"), this.width / 2, this.height / 4, 16777215);
this.drawCenteredString(this.fontRendererObj, I18n.format("settingsBackup.importExport.title"), this.width / 2,
this.height / 4, 16777215);
super.drawScreen(par1, par2, par3);
}

View File

@ -14,14 +14,21 @@ import net.minecraft.client.resources.I18n;
/**
* Copyright (c) 2024 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* 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)
* 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.
*
@ -50,29 +57,49 @@ public class GuiScreenImportProfile extends GuiScreen {
}
public void initGui() {
this.buttonList.add(importProfile = new GuiButton(2, this.width / 2 - 100, this.height / 4, I18n.format("settingsBackup.import.option.profile") + " " + I18n.format(doImportProfile ? "gui.yes" : "gui.no")));
this.buttonList.add(importProfile = new GuiButton(2, this.width / 2 - 100, this.height / 4,
I18n.format("settingsBackup.import.option.profile") + " "
+ I18n.format(doImportProfile ? "gui.yes" : "gui.no")));
importProfile.enabled = importer.hasProfile();
this.buttonList.add(importSettings = new GuiButton(3, this.width / 2 - 100, this.height / 4 + 25, I18n.format("settingsBackup.import.option.settings") + " " + I18n.format(doImportSettings ? "gui.yes" : "gui.no")));
this.buttonList.add(importSettings = new GuiButton(3, this.width / 2 - 100, this.height / 4 + 25,
I18n.format("settingsBackup.import.option.settings") + " "
+ I18n.format(doImportSettings ? "gui.yes" : "gui.no")));
importSettings.enabled = importer.hasProfile();
this.buttonList.add(importServers = new GuiButton(4, this.width / 2 - 100, this.height / 4 + 50, I18n.format("settingsBackup.import.option.servers") + " " + I18n.format(doImportServers ? "gui.yes" : "gui.no")));
this.buttonList.add(importServers = new GuiButton(4, this.width / 2 - 100, this.height / 4 + 50,
I18n.format("settingsBackup.import.option.servers") + " "
+ I18n.format(doImportServers ? "gui.yes" : "gui.no")));
importServers.enabled = importer.hasServers();
this.buttonList.add(importResourcePacks = new GuiButton(5, this.width / 2 - 100, this.height / 4 + 75, I18n.format("settingsBackup.import.option.resourcePacks") + " " + I18n.format(doImportResourcePacks ? "gui.yes" : "gui.no")));
this.buttonList.add(importResourcePacks = new GuiButton(5, this.width / 2 - 100, this.height / 4 + 75,
I18n.format("settingsBackup.import.option.resourcePacks") + " "
+ I18n.format(doImportResourcePacks ? "gui.yes" : "gui.no")));
importResourcePacks.enabled = importer.hasResourcePacks() && EaglerFolderResourcePack.isSupported();
this.buttonList.add(new GuiButton(0, this.width / 2 - 100, this.height / 4 + 115, I18n.format("settingsBackup.import.option.import")));
this.buttonList.add(new GuiButton(0, this.width / 2 - 100, this.height / 4 + 115,
I18n.format("settingsBackup.import.option.import")));
this.buttonList.add(new GuiButton(1, this.width / 2 - 100, this.height / 4 + 140, I18n.format("gui.cancel")));
}
@Override
public void onGuiClosed() {
try {
importer.close();
} catch (IOException e) {
}
}
protected void actionPerformed(GuiButton par1GuiButton) {
if (par1GuiButton.id == 0) {
if (!doImportProfile && !doImportSettings && !doImportServers && !doImportResourcePacks) {
mc.displayGuiScreen(back);
} else {
mc.loadingScreen.eaglerShow(I18n.format("settingsBackup.importing.1"), I18n.format("settingsBackup.importing.2"));
mc.loadingScreen.eaglerShow(I18n.format("settingsBackup.importing.1"),
I18n.format("settingsBackup.importing.2"));
try {
List<String> list1 = new ArrayList(mc.gameSettings.resourcePacks);
List<String> list2 = new ArrayList(mc.gameSettings.field_183018_l);
importer.importProfileAndSettings(doImportProfile, doImportSettings, doImportServers, doImportResourcePacks);
boolean resourcePacksChanged = !mc.gameSettings.resourcePacks.equals(list1) || !mc.gameSettings.field_183018_l.equals(list2);
importer.importProfileAndSettings(doImportProfile, doImportSettings, doImportServers,
doImportResourcePacks);
boolean resourcePacksChanged = !mc.gameSettings.resourcePacks.equals(list1)
|| !mc.gameSettings.field_183018_l.equals(list2);
if (resourcePacksChanged || (doImportResourcePacks && (list1.size() > 0 || list2.size() > 0))) {
mc.loadingScreen.eaglerShow(I18n.format("resourcePack.load.refreshing"),
I18n.format("resourcePack.load.pleaseWait"));
@ -82,29 +109,35 @@ public class GuiScreenImportProfile extends GuiScreen {
mc.displayGuiScreen(back);
} catch (IOException e) {
EagRuntime.debugPrintStackTrace(e);
mc.displayGuiScreen(new GuiScreenGenericErrorMessage("settingsBackup.importing.failed.1", "settingsBackup.importing.failed.2", back));
mc.displayGuiScreen(new GuiScreenGenericErrorMessage("settingsBackup.importing.failed.1",
"settingsBackup.importing.failed.2", back));
}
}
} else if (par1GuiButton.id == 1) {
mc.displayGuiScreen(back);
} else if (par1GuiButton.id == 2) {
doImportProfile = !doImportProfile;
importProfile.displayString = I18n.format("settingsBackup.import.option.profile") + " " + I18n.format(doImportProfile ? "gui.yes" : "gui.no");
importProfile.displayString = I18n.format("settingsBackup.import.option.profile") + " "
+ I18n.format(doImportProfile ? "gui.yes" : "gui.no");
} else if (par1GuiButton.id == 3) {
doImportSettings = !doImportSettings;
importSettings.displayString = I18n.format("settingsBackup.import.option.settings") + " " + I18n.format(doImportSettings ? "gui.yes" : "gui.no");
importSettings.displayString = I18n.format("settingsBackup.import.option.settings") + " "
+ I18n.format(doImportSettings ? "gui.yes" : "gui.no");
} else if (par1GuiButton.id == 4) {
doImportServers = !doImportServers;
importServers.displayString = I18n.format("settingsBackup.import.option.servers") + " " + I18n.format(doImportServers ? "gui.yes" : "gui.no");
importServers.displayString = I18n.format("settingsBackup.import.option.servers") + " "
+ I18n.format(doImportServers ? "gui.yes" : "gui.no");
} else if (par1GuiButton.id == 5) {
doImportResourcePacks = !doImportResourcePacks;
importResourcePacks.displayString = I18n.format("settingsBackup.import.option.resourcePacks") + " " + I18n.format(doImportResourcePacks ? "gui.yes" : "gui.no");
importResourcePacks.displayString = I18n.format("settingsBackup.import.option.resourcePacks") + " "
+ I18n.format(doImportResourcePacks ? "gui.yes" : "gui.no");
}
}
public void drawScreen(int par1, int par2, float par3) {
this.drawDefaultBackground();
this.drawCenteredString(this.fontRendererObj, I18n.format("settingsBackup.import.title"), this.width / 2, this.height / 4 - 25, 16777215);
this.drawCenteredString(this.fontRendererObj, I18n.format("settingsBackup.import.title"), this.width / 2,
this.height / 4 - 25, 16777215);
super.drawScreen(par1, par2, par3);
}
}

View File

@ -26,14 +26,21 @@ import static net.lax1dude.eaglercraft.v1_8.sp.server.export.EPKCompiler.*;
/**
* Copyright (c) 2024 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* 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)
* 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.
*
@ -46,8 +53,10 @@ public class ProfileExporter {
boolean doExportServers, boolean doExportResourcePacks) throws IOException {
doExportResourcePacks &= EaglerFolderResourcePack.isSupported();
EaglerOutputStream osb = new EaglerOutputStream();
osb.write(new byte[]{(byte)69,(byte)65,(byte)71,(byte)80,(byte)75,(byte)71,(byte)36,(byte)36}); // EAGPKG$$
osb.write(new byte[]{(byte)6,(byte)118,(byte)101,(byte)114,(byte)50,(byte)46,(byte)48}); // 6 + ver2.0
osb.write(
new byte[] { (byte) 69, (byte) 65, (byte) 71, (byte) 80, (byte) 75, (byte) 71, (byte) 36, (byte) 36 }); // EAGPKG$$
osb.write(new byte[] { (byte) 6, (byte) 118, (byte) 101, (byte) 114, (byte) 50, (byte) 46, (byte) 48 }); // 6 +
// ver2.0
Date d = new Date();
byte[] filename = "profile.epk".getBytes(StandardCharsets.UTF_8);
@ -66,25 +75,30 @@ public class ProfileExporter {
writeLong(d.getTime(), osb);
int lengthIntegerOffset = osb.size();
osb.write(new byte[]{(byte)255,(byte)255,(byte)255,(byte)255}); // this will be replaced with the file count
osb.write(new byte[] { (byte) 255, (byte) 255, (byte) 255, (byte) 255 }); // this will be replaced with the file
// count
osb.write('G');
OutputStream os = EaglerZLIB.newGZIPOutputStream(osb);
os.write(new byte[]{(byte)72,(byte)69,(byte)65,(byte)68}); // HEAD
os.write(new byte[]{(byte)9,(byte)102,(byte)105,(byte)108,(byte)101,(byte)45,(byte)116,(byte)121,
(byte)112,(byte)101}); // 9 + file-type
os.write(new byte[]{(byte)0,(byte)0,(byte)0,(byte)14,(byte)101,(byte)112,(byte)107,(byte)47,(byte)112,(byte)114,(byte)111,
(byte)102,(byte)105,(byte)108,(byte)101,(byte)49,(byte)56,(byte)56}); // 14 + epk/profile188
os.write('>');
os.write(new byte[]{(byte)72,(byte)69,(byte)65,(byte)68}); // HEAD
os.write(new byte[]{(byte)12,(byte)102,(byte)105,(byte)108,(byte)101,(byte)45,(byte)101,(byte)120,
(byte)112,(byte)111,(byte)114,(byte)116,(byte)115,(byte)0,(byte)0,(byte)0,(byte)1}); // 12 + file-exports + 1
os.write((doExportProfile ? 1 : 0) | (doExportSettings ? 2 : 0) | (doExportServers ? 4 : 0) | (doExportResourcePacks ? 8 : 0));
os.write('>');
int fileCount = 2;
try (OutputStream os = EaglerZLIB.newGZIPOutputStream(osb)) {
os.write(new byte[] { (byte) 72, (byte) 69, (byte) 65, (byte) 68 }); // HEAD
os.write(new byte[] { (byte) 9, (byte) 102, (byte) 105, (byte) 108, (byte) 101, (byte) 45, (byte) 116,
(byte) 121,
(byte) 112, (byte) 101 }); // 9 + file-type
os.write(new byte[] { (byte) 0, (byte) 0, (byte) 0, (byte) 14, (byte) 101, (byte) 112, (byte) 107,
(byte) 47, (byte) 112, (byte) 114, (byte) 111,
(byte) 102, (byte) 105, (byte) 108, (byte) 101, (byte) 49, (byte) 56, (byte) 56 }); // 14 +
// epk/profile188
os.write('>');
os.write(new byte[] { (byte) 72, (byte) 69, (byte) 65, (byte) 68 }); // HEAD
os.write(new byte[] { (byte) 12, (byte) 102, (byte) 105, (byte) 108, (byte) 101, (byte) 45, (byte) 101,
(byte) 120,
(byte) 112, (byte) 111, (byte) 114, (byte) 116, (byte) 115, (byte) 0, (byte) 0, (byte) 0,
(byte) 1 }); // 12 + file-exports + 1
os.write((doExportProfile ? 1 : 0) | (doExportSettings ? 2 : 0) | (doExportServers ? 4 : 0)
| (doExportResourcePacks ? 8 : 0));
os.write('>');
if (doExportProfile) {
byte[] profileData = EaglerProfile.write();
@ -137,7 +151,8 @@ public class ProfileExporter {
if (doExportResourcePacks) {
logger.info("Exporting resource packs...");
byte[] packManifest = (new VFile2(EaglerFolderResourcePack.RESOURCE_PACKS + "/manifest.json")).getAllBytes();
byte[] packManifest = (new VFile2(EaglerFolderResourcePack.RESOURCE_PACKS + "/manifest.json"))
.getAllBytes();
if (packManifest != null) {
exportFileToEPK(EaglerFolderResourcePack.RESOURCE_PACKS + "/manifest.json", packManifest, os);
++fileCount;
@ -159,9 +174,10 @@ public class ProfileExporter {
}
os.write(new byte[] { (byte) 69, (byte) 78, (byte) 68, (byte) 36 }); // END$
os.close();
}
osb.write(new byte[]{(byte)58,(byte)58,(byte)58,(byte)89,(byte)69,(byte)69,(byte)58,(byte)62}); // :::YEE:>
osb.write(
new byte[] { (byte) 58, (byte) 58, (byte) 58, (byte) 89, (byte) 69, (byte) 69, (byte) 58, (byte) 62 }); // :::YEE:>
byte[] ret = osb.toByteArray();

View File

@ -1,5 +1,6 @@
package net.lax1dude.eaglercraft.v1_8.profile;
import java.io.Closeable;
import java.io.IOException;
import net.lax1dude.eaglercraft.v1_8.EagRuntime;
@ -17,19 +18,26 @@ import net.minecraft.client.multiplayer.ServerList;
/**
* Copyright (c) 2024 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* 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)
* 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 class ProfileImporter {
public class ProfileImporter implements Closeable {
private static final Logger logger = LogManager.getLogger("ProfileImporter");
@ -128,7 +136,8 @@ public class ProfileImporter {
} else if (etr.name.startsWith(EaglerFolderResourcePack.RESOURCE_PACKS + "/")) {
if (doImportResourcePacks) {
logger.info("Deleting old resource packs...");
(new VFile2(EaglerFolderResourcePack.RESOURCE_PACKS)).listFiles(true).forEach(VFile2::delete);
(new VFile2(EaglerFolderResourcePack.RESOURCE_PACKS)).listFiles(true)
.forEach(VFile2::delete);
logger.info("Importing resource packs...");
int counter = 0;
do {
@ -148,4 +157,9 @@ public class ProfileImporter {
}
logger.info("Import complete!");
}
@Override
public void close() throws IOException {
epkDecompiler.close();
}
}

View File

@ -27,14 +27,21 @@ import net.minecraft.util.MathHelper;
/**
* Copyright (c) 2022-2024 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* 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)
* 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.
*
@ -69,14 +76,17 @@ public class RenderHighPoly extends RenderPlayer {
try {
Minecraft mc = Minecraft.getMinecraft();
float f2 = this.interpolateRotation(abstractclientplayer.prevRenderYawOffset, abstractclientplayer.renderYawOffset,
float f2 = this.interpolateRotation(abstractclientplayer.prevRenderYawOffset,
abstractclientplayer.renderYawOffset,
f1);
float f3 = this.interpolateRotation(abstractclientplayer.prevRotationYawHead, abstractclientplayer.rotationYawHead,
float f3 = this.interpolateRotation(abstractclientplayer.prevRotationYawHead,
abstractclientplayer.rotationYawHead,
f1);
float f4 = f3 - f2;
if (abstractclientplayer.isRiding() && abstractclientplayer.ridingEntity instanceof EntityLivingBase) {
EntityLivingBase entitylivingbase1 = (EntityLivingBase) abstractclientplayer.ridingEntity;
f2 = this.interpolateRotation(entitylivingbase1.prevRenderYawOffset, entitylivingbase1.renderYawOffset,
f2 = this.interpolateRotation(entitylivingbase1.prevRenderYawOffset,
entitylivingbase1.renderYawOffset,
f1);
f4 = f3 - f2;
float f5 = MathHelper.wrapAngleTo180_float(f4);
@ -100,7 +110,8 @@ public class RenderHighPoly extends RenderPlayer {
GlStateManager.enableRescaleNormal();
this.preRenderCallback(abstractclientplayer, f1);
float f6 = 0.0625F;
GlStateManager.scale(HighPolySkin.highPolyScale, HighPolySkin.highPolyScale, HighPolySkin.highPolyScale);
GlStateManager.scale(HighPolySkin.highPolyScale, HighPolySkin.highPolyScale,
HighPolySkin.highPolyScale);
mc.getTextureManager().bindTexture(highPolySkin.texture);
if (abstractclientplayer.isPlayerSleeping()) {
@ -113,7 +124,8 @@ public class RenderHighPoly extends RenderPlayer {
}
}
float var15 = abstractclientplayer.prevLimbSwingAmount + (abstractclientplayer.limbSwingAmount - abstractclientplayer.prevLimbSwingAmount) * f1;
float var15 = abstractclientplayer.prevLimbSwingAmount
+ (abstractclientplayer.limbSwingAmount - abstractclientplayer.prevLimbSwingAmount) * f1;
float var16 = abstractclientplayer.limbSwing - abstractclientplayer.limbSwingAmount * (1.0F - f1);
if (highPolySkin == HighPolySkin.LONG_ARMS) {
@ -159,9 +171,11 @@ public class RenderHighPoly extends RenderPlayer {
if (highPolySkin.headModel != null) {
if (highPolySkin == HighPolySkin.BABY_CHARLES) {
long millis = System.currentTimeMillis();
float partialTicks = (float) ((millis - abstractclientplayer.eaglerHighPolyAnimationTick) * 0.02);
float partialTicks = (float) ((millis - abstractclientplayer.eaglerHighPolyAnimationTick)
* 0.02);
// long l50 = millis / 50l * 50l;
//boolean runTick = par1EntityPlayer.eaglerHighPolyAnimationTick < l50 && millis >= l50;
// boolean runTick = par1EntityPlayer.eaglerHighPolyAnimationTick < l50 &&
// millis >= l50;
abstractclientplayer.eaglerHighPolyAnimationTick = millis;
if (partialTicks < 0.0f) {
@ -188,7 +202,8 @@ public class RenderHighPoly extends RenderPlayer {
}
jumpFac *= 10.0f;
abstractclientplayer.eaglerHighPolyAnimationFloat3 += (jumpFac / (jumpFac + 1.0f)) * 6.0f * partialTicks;
abstractclientplayer.eaglerHighPolyAnimationFloat3 += (jumpFac / (jumpFac + 1.0f)) * 6.0f
* partialTicks;
if (Float.isInfinite(abstractclientplayer.eaglerHighPolyAnimationFloat3)) {
abstractclientplayer.eaglerHighPolyAnimationFloat3 = 1.0f;
@ -198,7 +213,8 @@ public class RenderHighPoly extends RenderPlayer {
abstractclientplayer.eaglerHighPolyAnimationFloat3 = -1.0f;
}
abstractclientplayer.eaglerHighPolyAnimationFloat2 += abstractclientplayer.eaglerHighPolyAnimationFloat3 * partialTicks;
abstractclientplayer.eaglerHighPolyAnimationFloat2 += abstractclientplayer.eaglerHighPolyAnimationFloat3
* partialTicks;
abstractclientplayer.eaglerHighPolyAnimationFloat5 += partialTicks;
while (abstractclientplayer.eaglerHighPolyAnimationFloat5 > 0.05f) {
@ -207,7 +223,11 @@ public class RenderHighPoly extends RenderPlayer {
abstractclientplayer.eaglerHighPolyAnimationFloat2 *= 0.9f;
}
jumpFactor = abstractclientplayer.eaglerHighPolyAnimationFloat2; //(abstractclientplayer.eaglerHighPolyAnimationFloat1 - abstractclientplayer.eaglerHighPolyAnimationFloat2) * partialTicks + abstractclientplayer.eaglerHighPolyAnimationFloat2;
jumpFactor = abstractclientplayer.eaglerHighPolyAnimationFloat2; // (abstractclientplayer.eaglerHighPolyAnimationFloat1
// -
// abstractclientplayer.eaglerHighPolyAnimationFloat2)
// * partialTicks +
// abstractclientplayer.eaglerHighPolyAnimationFloat2;
jumpFactor -= 0.12f;
if (jumpFactor < 0.0f) {
jumpFactor = 0.0f;
@ -255,13 +275,17 @@ public class RenderHighPoly extends RenderPlayer {
if (highPolySkin == HighPolySkin.LONG_ARMS) {
if (abstractclientplayer.isSwingInProgress) {
float var17 = MathHelper.cos(-abstractclientplayer.getSwingProgress(f1) * (float)Math.PI * 2.0f - 1.2f) - 0.362f;
float var17 = MathHelper
.cos(-abstractclientplayer.getSwingProgress(f1) * (float) Math.PI * 2.0f - 1.2f)
- 0.362f;
var17 *= var17;
GlStateManager.rotate(-var17 * 20.0f, 1.0f, 0.0f, 0.0f);
}
} else if (highPolySkin == HighPolySkin.WEIRD_CLIMBER_DUDE) {
if (abstractclientplayer.isSwingInProgress) {
float var17 = MathHelper.cos(-abstractclientplayer.getSwingProgress(f1) * (float)Math.PI * 2.0f - 1.2f) - 0.362f;
float var17 = MathHelper
.cos(-abstractclientplayer.getSwingProgress(f1) * (float) Math.PI * 2.0f - 1.2f)
- 0.362f;
var17 *= var17;
GlStateManager.rotate(var17 * 60.0f, 1.0f, 0.0f, 0.0f);
}
@ -272,7 +296,9 @@ public class RenderHighPoly extends RenderPlayer {
float swing2 = (MathHelper.cos(f10 % 100000.0f) * fff * 0.5f + 0.0f) * var15;
GlStateManager.rotate(swing * 25.0f, 1.0f, 0.0f, 0.0f);
if (abstractclientplayer.isSwingInProgress) {
float var17 = MathHelper.cos(-abstractclientplayer.getSwingProgress(f1) * (float)Math.PI * 2.0f - 1.2f) - 0.362f;
float var17 = MathHelper
.cos(-abstractclientplayer.getSwingProgress(f1) * (float) Math.PI * 2.0f - 1.2f)
- 0.362f;
var17 *= var17;
GlStateManager.rotate(-var17 * 25.0f, 1.0f, 0.0f, 0.0f);
}
@ -308,7 +334,8 @@ public class RenderHighPoly extends RenderPlayer {
if (itm == Items.bow) {
GlStateManager.translate(-0.22f, 0.8f, 0.6f);
GlStateManager.rotate(-90.0f, 1.0f, 0.0f, 0.0f);
}else if(itm instanceof ItemBlock && !((ItemBlock)itm).getBlock().isNormalCube()) {
} else if (itm instanceof ItemBlock
&& !((ItemBlock) itm).getBlock().isNormalCube()) {
GlStateManager.translate(0.0f, -0.1f, 0.13f);
} else if (!itm.isFull3D()) {
GlStateManager.translate(-0.08f, -0.1f, 0.16f);
@ -320,7 +347,9 @@ public class RenderHighPoly extends RenderPlayer {
GlStateManager.rotate(-5.0f, 0.0f, 1.0f, 0.0f);
float var17 = -1.2f * var15;
if (abstractclientplayer.isSwingInProgress) {
float vvar17 = MathHelper.cos(-abstractclientplayer.getSwingProgress(f1) * (float)Math.PI * 2.0f - 1.2f) - 0.362f;
float vvar17 = MathHelper.cos(
-abstractclientplayer.getSwingProgress(f1) * (float) Math.PI * 2.0f - 1.2f)
- 0.362f;
var17 = vvar17 < var17 ? vvar17 : var17;
}
GlStateManager.translate(-0.02f * var17, 0.42f * var17, var17 * 0.35f);
@ -333,7 +362,8 @@ public class RenderHighPoly extends RenderPlayer {
if (itm == Items.bow) {
GlStateManager.translate(-0.18f, 1.0f, 0.4f);
GlStateManager.rotate(-95.0f, 1.0f, 0.0f, 0.0f);
}else if(itm instanceof ItemBlock && !((ItemBlock)itm).getBlock().isNormalCube()) {
} else if (itm instanceof ItemBlock
&& !((ItemBlock) itm).getBlock().isNormalCube()) {
GlStateManager.translate(0.0f, -0.1f, 0.13f);
} else if (!itm.isFull3D()) {
GlStateManager.translate(-0.08f, -0.1f, 0.16f);
@ -351,7 +381,8 @@ public class RenderHighPoly extends RenderPlayer {
GlStateManager.translate(-0.65f, 1.3f, -0.1f);
GlStateManager.rotate(180.0f, 0.0f, 0.0f, 1.0f);
GlStateManager.rotate(20.0f, 1.0f, 0.0f, 0.0f);
}else if(itm instanceof ItemBlock && !((ItemBlock)itm).getBlock().isNormalCube()) {
} else if (itm instanceof ItemBlock
&& !((ItemBlock) itm).getBlock().isNormalCube()) {
GlStateManager.translate(0.0f, -0.35f, 0.4f);
} else if (!itm.isFull3D()) {
GlStateManager.translate(-0.1f, -0.1f, 0.16f);
@ -374,8 +405,11 @@ public class RenderHighPoly extends RenderPlayer {
int brightness = abstractclientplayer.getBrightnessForRender(0.0f);
float blockLight = (brightness % 65536) * ff;
float skyLight = (brightness / 65536) * ff;
float sunCurve = (float)((abstractclientplayer.worldObj.getWorldTime() + 4000l) % 24000) / 24000.0f;
sunCurve = MathHelper.clamp_float(9.8f - MathHelper.abs(sunCurve * 5.0f + sunCurve * sunCurve * 45.0f - 14.3f) * 0.7f, 0.0f, 1.0f);
float sunCurve = (float) ((abstractclientplayer.worldObj.getWorldTime() + 4000l) % 24000)
/ 24000.0f;
sunCurve = MathHelper.clamp_float(
9.8f - MathHelper.abs(sunCurve * 5.0f + sunCurve * sunCurve * 45.0f - 14.3f) * 0.7f, 0.0f,
1.0f);
skyLight = skyLight * (sunCurve * 0.85f + 0.15f);
blockLight = blockLight * (sunCurve * 0.3f + 0.7f);
float eyeBrightness = blockLight;
@ -393,7 +427,8 @@ public class RenderHighPoly extends RenderPlayer {
} else {
GlStateManager.enableBlend();
GlStateManager.blendFunc(GL_ONE, GL_ONE);
GlStateManager.color(eyeBrightness * 7.0f, eyeBrightness * 7.0f, eyeBrightness * 7.0f, 1.0f);
GlStateManager.color(eyeBrightness * 7.0f, eyeBrightness * 7.0f, eyeBrightness * 7.0f,
1.0f);
if (jumpFactor > 0.0f) {
GlStateManager.pushMatrix();
GlStateManager.translate(0.0f, jumpFactor * 3.0f, 0.0f);
@ -468,4 +503,13 @@ public class RenderHighPoly extends RenderPlayer {
GlStateManager.popMatrix();
}
}
public void renderLivingAt(AbstractClientPlayer abstractclientplayer, double d0, double d1, double d2) {
if (abstractclientplayer.isEntityAlive() && abstractclientplayer.isPlayerSleeping()) {
super.renderLivingAt(abstractclientplayer, d0 - (double) abstractclientplayer.renderOffsetX,
d1 - (double) abstractclientplayer.renderOffsetY, d2 - (double) abstractclientplayer.renderOffsetZ);
} else {
super.renderLivingAt(abstractclientplayer, d0, d1, d2);
}
}
}

View File

@ -54,7 +54,7 @@ public enum SkinModel {
private SkinModel(int id, HighPolySkin highPoly) {
this.id = id;
this.width = 256;
this.height = 128;
this.height = 256;
this.profileSkinType = "eagler";
this.sanitize = true;
this.highPoly = highPoly;

View File

@ -429,11 +429,6 @@ public class ConnectionHandshake {
RateLimitTracker.registerLockOut(PlatformNetworking.getCurrentURI());
mc.displayGuiScreen(GuiDisconnected.createRateLimitKick(scr));
} else if (errorCode == HandshakePacketTypes.SERVER_ERROR_CUSTOM_MESSAGE) {
if (IChatComponent.Serializer.jsonToComponent(errStr).getUnformattedText().toLowerCase()
.contains("banned from this server")) {
EaglerProfile.updateUsernameCookies();
reloadPage();
}
if (IChatComponent.Serializer.jsonToComponent(errStr).getUnformattedText().toLowerCase()
.contains("reload page")) {
EaglerProfile.updateUsernameCookieFromLocalStorage();

View File

@ -92,10 +92,6 @@ public class EaglercraftNetworkManager {
}
clientDisconnected = true;
System.out.println("Closed channel: " + reason.getUnformattedText());
if (reason.getUnformattedText().toLowerCase().contains("banned from this server")) {
EaglerProfile.updateUsernameCookies();
reloadPage();
}
if (reason.getUnformattedText().toLowerCase().contains("reload page")) {
EaglerProfile.updateUsernameCookieFromLocalStorage();
reloadPage();

View File

@ -13,14 +13,21 @@ import net.minecraft.client.resources.I18n;
/**
* Copyright (c) 2022-2024 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* 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)
* 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.
*
@ -58,8 +65,12 @@ public class GuiScreenNameWorldImport extends GuiScreen {
}
if (definetlyTimeToImport && !isImporting) {
isImporting = true;
SingleplayerServerController.importWorld(GuiCreateWorld.func_146317_a(mc.getSaveLoader(), this.theGuiTextField.getText().trim()), world.fileData, importFormat, (byte) ((loadSpawnChunks ? 2 : 0) | (enhancedGameRules ? 1 : 0)));
mc.displayGuiScreen(new GuiScreenIntegratedServerBusy(parentGuiScreen, "singleplayer.busy.importing." + (importFormat + 1), "singleplayer.failed.importing." + (importFormat + 1), SingleplayerServerController::isReady));
SingleplayerServerController.importWorld(
GuiCreateWorld.func_146317_a(mc.getSaveLoader(), this.theGuiTextField.getText().trim()),
world.fileData, importFormat, (byte) ((loadSpawnChunks ? 2 : 0) | (enhancedGameRules ? 1 : 0)));
mc.displayGuiScreen(new GuiScreenIntegratedServerBusy(parentGuiScreen,
"singleplayer.busy.importing." + (importFormat + 1),
"singleplayer.failed.importing." + (importFormat + 1), SingleplayerServerController::isReady));
}
}
@ -70,13 +81,20 @@ public class GuiScreenNameWorldImport extends GuiScreen {
if (!timeToImport) {
Keyboard.enableRepeatEvents(true);
this.buttonList.clear();
this.buttonList.add(new GuiButton(0, this.width / 2 - 100, this.height / 4 + 96 + 12, I18n.format("singleplayer.import.continue")));
this.buttonList.add(new GuiButton(1, this.width / 2 - 100, this.height / 4 + 120 + 12, I18n.format("gui.cancel")));
this.theGuiTextField = new GuiTextField(2, this.fontRendererObj, this.width / 2 - 100, this.height / 4 + 3, 200, 20);
this.buttonList.add(new GuiButton(0, this.width / 2 - 100, this.height / 4 + 96 + 12,
I18n.format("singleplayer.import.continue")));
this.buttonList
.add(new GuiButton(1, this.width / 2 - 100, this.height / 4 + 120 + 12, I18n.format("gui.cancel")));
this.theGuiTextField = new GuiTextField(2, this.fontRendererObj, this.width / 2 - 100, this.height / 4 + 3,
200, 20);
this.theGuiTextField.setFocused(true);
this.theGuiTextField.setText(name);
this.buttonList.add(loadSpawnChunksBtn = new GuiButton(2, this.width / 2 - 100, this.height / 4 + 24 + 12, I18n.format("singleplayer.import.loadSpawnChunks", loadSpawnChunks ? I18n.format("gui.yes") : I18n.format("gui.no"))));
this.buttonList.add(enhancedGameRulesBtn = new GuiButton(3, this.width / 2 - 100, this.height / 4 + 48 + 12, I18n.format("singleplayer.import.enhancedGameRules", enhancedGameRules ? I18n.format("gui.yes") : I18n.format("gui.no"))));
this.buttonList.add(loadSpawnChunksBtn = new GuiButton(2, this.width / 2 - 100, this.height / 4 + 24 + 12,
I18n.format("singleplayer.import.loadSpawnChunks",
loadSpawnChunks ? I18n.format("gui.yes") : I18n.format("gui.no"))));
this.buttonList.add(enhancedGameRulesBtn = new GuiButton(3, this.width / 2 - 100, this.height / 4 + 48 + 12,
I18n.format("singleplayer.import.enhancedGameRules",
enhancedGameRules ? I18n.format("gui.yes") : I18n.format("gui.no"))));
}
}
@ -101,10 +119,12 @@ public class GuiScreenNameWorldImport extends GuiScreen {
timeToImport = true;
} else if (par1GuiButton.id == 2) {
loadSpawnChunks = !loadSpawnChunks;
loadSpawnChunksBtn.displayString = I18n.format("singleplayer.import.loadSpawnChunks", loadSpawnChunks ? I18n.format("gui.yes") : I18n.format("gui.no"));
loadSpawnChunksBtn.displayString = I18n.format("singleplayer.import.loadSpawnChunks",
loadSpawnChunks ? I18n.format("gui.yes") : I18n.format("gui.no"));
} else if (par1GuiButton.id == 3) {
enhancedGameRules = !enhancedGameRules;
enhancedGameRulesBtn.displayString = I18n.format("singleplayer.import.enhancedGameRules", enhancedGameRules ? I18n.format("gui.yes") : I18n.format("gui.no"));
enhancedGameRulesBtn.displayString = I18n.format("singleplayer.import.enhancedGameRules",
enhancedGameRules ? I18n.format("gui.yes") : I18n.format("gui.no"));
}
}
}
@ -138,15 +158,20 @@ public class GuiScreenNameWorldImport extends GuiScreen {
public void drawScreen(int par1, int par2, float par3) {
this.drawDefaultBackground();
if (!timeToImport) {
this.drawCenteredString(this.fontRendererObj, I18n.format("singleplayer.import.title"), this.width / 2, this.height / 4 - 60 + 20, 16777215);
this.drawString(this.fontRendererObj, I18n.format("singleplayer.import.enterName"), this.width / 2 - 100, this.height / 4 - 60 + 50, 10526880);
this.drawCenteredString(this.fontRendererObj, I18n.format("createWorld.seedNote"), this.width / 2, this.height / 4 + 90, -6250336);
this.drawCenteredString(this.fontRendererObj, I18n.format("singleplayer.import.title"), this.width / 2,
this.height / 4 - 60 + 20, 16777215);
this.drawString(this.fontRendererObj, I18n.format("singleplayer.import.enterName"), this.width / 2 - 100,
this.height / 4 - 60 + 50, 10526880);
this.drawCenteredString(this.fontRendererObj, I18n.format("createWorld.seedNote"), this.width / 2,
this.height / 4 + 90, -6250336);
this.theGuiTextField.drawTextBox();
} else {
definetlyTimeToImport = true;
long dots = (System.currentTimeMillis() / 500l) % 4l;
String str = I18n.format("singleplayer.import.reading", world.fileName);
this.drawString(fontRendererObj, str + (dots > 0 ? "." : "") + (dots > 1 ? "." : "") + (dots > 2 ? "." : ""), (this.width - this.fontRendererObj.getStringWidth(str)) / 2, this.height / 3 + 10, 0xFFFFFF);
this.drawString(fontRendererObj,
str + (dots > 0 ? "." : "") + (dots > 1 ? "." : "") + (dots > 2 ? "." : ""),
(this.width - this.fontRendererObj.getStringWidth(str)) / 2, this.height / 3 + 10, 0xFFFFFF);
}
super.drawScreen(par1, par2, par3);
}

View File

@ -165,7 +165,6 @@ public class GuiShareToLan extends GuiScreen {
this.mc.ingameGUI.getChatGUI().printChatMessage(new ChatComponentText(I18n.format("lanServer.opened")
.replace("$relay$", LANServerController.getCurrentURI()).replace("$code$", code)));
} else {
SingleplayerServerController.configureLAN(mc.theWorld.getWorldInfo().getGameType(), false);
this.mc.displayGuiScreen(new GuiScreenNoRelays(this, "noRelay.titleFail"));
}
}

View File

@ -25,8 +25,7 @@ import java.util.ArrayList;
import java.util.List;
/**
* Copyright (c) 2022-2024 lax1dude, hoosiertransfer, ayunami2000. All Rights
* Reserved.
* Copyright (c) 2022-2024 lax1dude, ayunami2000. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND
@ -358,9 +357,11 @@ public class LANClientNetworkManager extends EaglercraftNetworkManager {
}
EaglerInputStream bi = new EaglerInputStream(fullData);
int i = (bi.read() << 24) | (bi.read() << 16) | (bi.read() << 8) | bi.read();
InputStream inflaterInputStream = EaglerZLIB.newInflaterInputStream(bi);
fullData = new byte[i];
int r = IOUtils.readFully(inflaterInputStream, fullData);
int r;
try (InputStream inflaterInputStream = EaglerZLIB.newInflaterInputStream(bi)) {
r = IOUtils.readFully(inflaterInputStream, fullData);
}
if (i != r) {
logger.warn("Decompressed packet expected size {} differs from actual size {}!", i, r);
}

View File

@ -501,7 +501,7 @@ public class EaglerIntegratedServerWorker {
while (true) {
mainLoop();
EagUtils.sleep(1l);
EagUtils.sleep(0l);
}
} catch (Throwable tt) {
if (tt instanceof ReportedException) {

View File

@ -1,6 +1,7 @@
package net.lax1dude.eaglercraft.v1_8.sp.server.export;
import java.io.ByteArrayInputStream;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
@ -12,24 +13,32 @@ import net.lax1dude.eaglercraft.v1_8.IOUtils;
/**
* Copyright (c) 2022-2024 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* 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)
* 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 class EPKDecompiler {
public class EPKDecompiler implements Closeable {
public static class FileEntry {
public final String type;
public final String name;
public final byte[] data;
protected FileEntry(String type, String name, byte[] data) {
this.type = type;
this.name = name;
@ -49,7 +58,8 @@ public class EPKDecompiler {
byte[] header = new byte[8];
IOUtils.readFully(in2, header);
if(Arrays.equals(header, new byte[]{(byte)69,(byte)65,(byte)71,(byte)80,(byte)75,(byte)71,(byte)36,(byte)36})) {
if (Arrays.equals(header, new byte[] { (byte) 69, (byte) 65, (byte) 71, (byte) 80, (byte) 75, (byte) 71,
(byte) 36, (byte) 36 })) {
byte[] endCode = new byte[] { (byte) ':', (byte) ':', (byte) ':', (byte) 'Y',
(byte) 'E', (byte) 'E', (byte) ':', (byte) '>' };
for (int i = 0; i < 8; ++i) {
@ -88,7 +98,8 @@ public class EPKDecompiler {
}
crc32 = new CRC32();
}else if(Arrays.equals(header, new byte[]{(byte)69,(byte)65,(byte)71,(byte)80,(byte)75,(byte)71,(byte)33,(byte)33})) {
} else if (Arrays.equals(header, new byte[] { (byte) 69, (byte) 65, (byte) 71, (byte) 80, (byte) 75, (byte) 71,
(byte) 33, (byte) 33 })) {
throw new IOException("FILE IS AN UNSUPPORTED LEGACY FORMAT!");
} else {
throw new IOException("FILE IS NOT AN EPK FILE!");
@ -178,4 +189,9 @@ public class EPKDecompiler {
return new String(charIn);
}
@Override
public void close() throws IOException {
zis.close();
}
}

View File

@ -14,8 +14,7 @@ import net.minecraft.nbt.CompressedStreamTools;
import net.minecraft.nbt.NBTTagCompound;
/**
* Copyright (c) 2022-2024 lax1dude, hoosiertransfer, ayunami2000. All Rights
* Reserved.
* Copyright (c) 2022-2024 lax1dude, ayunami2000. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND
@ -48,7 +47,7 @@ public class WorldConverterEPK {
folderName += "_";
worldDir = EaglerIntegratedServerWorker.saveFormat.getSaveLoader(folderName, false).getWorldDirectory();
}
EPKDecompiler dc = new EPKDecompiler(archiveContents);
try (EPKDecompiler dc = new EPKDecompiler(archiveContents)) {
EPKDecompiler.FileEntry f = null;
int lastProgUpdate = 0;
int prog = 0;
@ -89,6 +88,7 @@ public class WorldConverterEPK {
}
}
}
}
logger.info("EPK was successfully extracted into directory \"{}\"", worldDir.getPath());
String[] worldsTxt = EaglerSaveFormat.worldsList.getAllLines();
if (worldsTxt == null || worldsTxt.length <= 0

View File

@ -24,8 +24,7 @@ import net.minecraft.nbt.CompressedStreamTools;
import net.minecraft.nbt.NBTTagCompound;
/**
* Copyright (c) 2022-2024 lax1dude, hoosiertransfer, ayunami2000. All Rights
* Reserved.
* Copyright (c) 2022-2024 lax1dude, ayunami2000. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND
@ -58,9 +57,9 @@ public class WorldConverterMCA {
folderName += "_";
worldDir = EaglerIntegratedServerWorker.saveFormat.getSaveLoader(folderName, false).getWorldDirectory();
}
ZipInputStream zis = new ZipInputStream(new EaglerInputStream(archiveContents));
ZipEntry folderNameFile = null;
List<char[]> fileNames = new ArrayList<>();
try (ZipInputStream zis = new ZipInputStream(new EaglerInputStream(archiveContents))) {
ZipEntry folderNameFile = null;
while ((folderNameFile = zis.getNextEntry()) != null) {
if (folderNameFile.getName().contains("__MACOSX/"))
continue;
@ -72,11 +71,12 @@ public class WorldConverterMCA {
continue;
fileNames.add(folderNameFile.getName().toCharArray());
}
}
final int[] i = new int[] { 0 };
while (fileNames.get(0).length > i[0] && fileNames.stream().allMatch(w -> w[i[0]] == fileNames.get(0)[i[0]]))
i[0]++;
int folderPrefixOffset = i[0];
zis = new ZipInputStream(new EaglerInputStream(archiveContents));
try (ZipInputStream zis = new ZipInputStream(new EaglerInputStream(archiveContents))) {
ZipEntry f = null;
int lastProgUpdate = 0;
int prog = 0;
@ -121,8 +121,8 @@ public class WorldConverterMCA {
prog += b.length;
} else if ((fileName.endsWith(".mcr") || fileName.endsWith(".mca")) && (fileName.startsWith("region/")
|| fileName.startsWith("DIM1/region/") || fileName.startsWith("DIM-1/region/"))) {
VFile2 chunkFolder = new VFile2(worldDir,
fileName.startsWith("DIM1") ? "level1" : (fileName.startsWith("DIM-1") ? "level-1" : "level0"));
VFile2 chunkFolder = new VFile2(worldDir, fileName.startsWith("DIM1") ? "level1"
: (fileName.startsWith("DIM-1") ? "level-1" : "level0"));
RegionFile mca = new RegionFile(new RandomAccessMemoryFile(b, b.length));
int loadChunksCount = 0;
for (int j = 0; j < 32; ++j) {
@ -178,6 +178,7 @@ public class WorldConverterMCA {
EaglerIntegratedServerWorker.sendProgress("singleplayer.busy.importing.2", prog);
}
}
}
logger.info("MCA was successfully extracted into directory \"{}\"", worldDir.getPath());
String[] worldsTxt = EaglerSaveFormat.worldsList.getAllLines();
if (worldsTxt == null || worldsTxt.length <= 0
@ -194,10 +195,10 @@ public class WorldConverterMCA {
public static byte[] exportWorld(String folderName) throws IOException {
EaglerOutputStream bao = new EaglerOutputStream();
ZipOutputStream zos = new ZipOutputStream(bao);
VFile2 worldFolder;
try (ZipOutputStream zos = new ZipOutputStream(bao)) {
zos.setComment("contains backup of world '" + folderName + "'");
VFile2 worldFolder = EaglerIntegratedServerWorker.saveFormat.getSaveLoader(folderName, false)
.getWorldDirectory();
worldFolder = EaglerIntegratedServerWorker.saveFormat.getSaveLoader(folderName, false).getWorldDirectory();
logger.info("Exporting world directory \"{}\" as MCA", worldFolder.getPath());
VFile2 vf = new VFile2(worldFolder, "level.dat");
byte[] b;
@ -317,7 +318,7 @@ public class WorldConverterMCA {
EaglerIntegratedServerWorker.sendProgress("singleplayer.busy.exporting.2", prog);
}
}
zos.close();
}
logger.info("World directory \"{}\" was successfully exported as MCA", worldFolder.getPath());
return bao.toByteArray();
}

View File

@ -257,9 +257,9 @@ public class IntegratedServerPlayerNetworkManager {
temporaryOutputStream.write((len >> 16) & 0xFF);
temporaryOutputStream.write((len >> 8) & 0xFF);
temporaryOutputStream.write(len & 0xFF);
OutputStream os = EaglerZLIB.newDeflaterOutputStream(temporaryOutputStream);
try (OutputStream os = EaglerZLIB.newDeflaterOutputStream(temporaryOutputStream)) {
temporaryBuffer.readBytes(os, len);
os.close();
}
compressedData = temporaryOutputStream.toByteArray();
} catch (IOException ex) {
logger.error("Failed to compress packet {}!", pkt.getClass().getSimpleName());

View File

@ -19,14 +19,21 @@ import net.minecraft.client.Minecraft;
/**
* Copyright (c) 2024 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* 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)
* 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.
*
@ -64,7 +71,7 @@ public class RelayUpdateChecker {
for (net.lax1dude.eaglercraft.v1_8.sp.relay.RelayEntry etr : EagRuntime.getConfiguration().getRelays()) {
relaysList.add(new RelayEntry(etr.address));
}
byte[] b = PlatformApplication.getLocalStorage("lastRelayUpdate");
byte[] b = PlatformApplication.getLocalStorage("lastRelayUpdate", false);
if (b != null) {
try {
lastUpdateCheck = (new DataInputStream(new EaglerInputStream(b))).readLong();
@ -79,7 +86,7 @@ public class RelayUpdateChecker {
try {
EaglerOutputStream bao = new EaglerOutputStream(8);
(new DataOutputStream(bao)).writeLong(lastUpdateCheck);
PlatformApplication.setLocalStorage("lastRelayUpdate", bao.toByteArray());
PlatformApplication.setLocalStorage("lastRelayUpdate", bao.toByteArray(), false);
} catch (IOException e) {
}
for (int i = 0, l = relaysList.size(); i < l; ++i) {
@ -125,7 +132,8 @@ public class RelayUpdateChecker {
} else if (socket.currentSocket.isOpen()) {
if (!socket.handshake) {
socket.handshake = true;
socket.currentSocket.writePacket(new IPacket00Handshake(0x02, RelayManager.preferredRelayVersion, magic));
socket.currentSocket
.writePacket(new IPacket00Handshake(0x02, RelayManager.preferredRelayVersion, magic));
} else {
// close immediately
if (socket.currentSocket.nextPacket() != null) {

View File

@ -19,14 +19,21 @@ import net.lax1dude.eaglercraft.v1_8.crypto.SHA256Digest;
/**
* Copyright (c) 2024 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* 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)
* 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.
*
@ -37,6 +44,7 @@ public class UpdateCertificate {
public final String type;
public final String addr;
private DLSource(String type, String addr) {
this.type = type;
this.addr = addr;
@ -78,9 +86,11 @@ public class UpdateCertificate {
public final DLSource[] bundleDataSources;
public static UpdateCertificate parseAndVerifyCertificate(byte[] certData) throws IOException, CertificateInvalidException {
public static UpdateCertificate parseAndVerifyCertificate(byte[] certData)
throws IOException, CertificateInvalidException {
InputStream is = new EaglerInputStream(certData);
if(is.read() != 'E' || is.read() != 'A' || is.read() != 'G' || is.read() != 'S' || is.read() != 'I' || is.read() != 'G') {
if (is.read() != 'E' || is.read() != 'A' || is.read() != 'G' || is.read() != 'S' || is.read() != 'I'
|| is.read() != 'G') {
throw new IOException("Data is not a certificate!");
}
@ -93,7 +103,8 @@ public class UpdateCertificate {
byte[] rsa2048sum = new byte[256];
IOUtils.readFully(is, rsa2048sum);
byte[] rsa2048sumDec = (new BigInteger(rsa2048sum)).modPow(new BigInteger("65537"), EaglercraftVersion.updateSignatureModulus).toByteArray();
byte[] rsa2048sumDec = (new BigInteger(rsa2048sum))
.modPow(new BigInteger("65537"), EaglercraftVersion.updateSignatureModulus).toByteArray();
if (rsa2048sumDec.length > 256) {
throw new IOException("Invalid decrypted hash length: " + rsa2048sum.length);
@ -115,7 +126,8 @@ public class UpdateCertificate {
sha256.update(new byte[] { (byte) 170, (byte) 191, (byte) 203, (byte) 188, (byte) 47, (byte) 37, (byte) 17,
(byte) 187, (byte) 169, (byte) 225, (byte) 247, (byte) 193, (byte) 100, (byte) 101, (byte) 233,
(byte) 106, (byte) 80, (byte) 204, (byte) 192, (byte) 140, (byte) 19, (byte) 18, (byte) 165, (byte) 252,
(byte) 138, (byte) 187, (byte) 229, (byte) 148, (byte) 118, (byte) 208, (byte) 179, (byte) 233 }, 0, 32);
(byte) 138, (byte) 187, (byte) 229, (byte) 148, (byte) 118, (byte) 208, (byte) 179, (byte) 233 }, 0,
32);
sha256.update(signaturePayload, 0, signaturePayload.length);
byte[] hash2048 = new byte[256];
sha256.doFinal(hash2048, 0);
@ -148,7 +160,16 @@ public class UpdateCertificate {
throw new CertificateInvalidException("SHA256 checksum of signature payload is invalid!");
}
return new UpdateCertificate(certData, EaglerZLIB.newGZIPInputStream(new EaglerInputStream(signaturePayload)), vers);
UpdateCertificate cert;
try (InputStream gis = EaglerZLIB.newGZIPInputStream(new EaglerInputStream(signaturePayload))) {
cert = new UpdateCertificate(certData, gis, vers);
}
if (System.currentTimeMillis() < cert.sigTimestamp) {
throw new CertificateInvalidException("Update certificate timestamp is from the future!?");
}
return cert;
}
private UpdateCertificate(byte[] certData, InputStream is, int sigVers) throws IOException {

View File

@ -17,14 +17,21 @@ import net.lax1dude.eaglercraft.v1_8.log4j.Logger;
/**
* Copyright (c) 2024 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* 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)
* 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.
*
@ -58,12 +65,14 @@ public class UpdateService {
}
public boolean equals(Object o) {
return o != null && (o == this || ((o instanceof RawKnownCertHolder) && Arrays.equals(((RawKnownCertHolder)o).data, data)));
return o != null && (o == this
|| ((o instanceof RawKnownCertHolder) && Arrays.equals(((RawKnownCertHolder) o).data, data)));
}
}
public static boolean supported() {
return EaglercraftVersion.enableUpdateService && EagRuntime.getConfiguration().allowUpdateSvc() && PlatformUpdateSvc.supported();
return EaglercraftVersion.enableUpdateService && EagRuntime.getConfiguration().allowUpdateSvc()
&& PlatformUpdateSvc.supported();
}
public static void initialize() {
@ -77,10 +86,12 @@ public class UpdateService {
try {
myUpdateCert = UpdateCertificate.parseAndVerifyCertificate(PlatformUpdateSvc.getClientSignatureData());
if (!EaglercraftVersion.updateBundlePackageName.equalsIgnoreCase(myUpdateCert.bundlePackageName)) {
throw new CertificateInvalidException("Certificate package name does not match current client package name!");
throw new CertificateInvalidException(
"Certificate package name does not match current client package name!");
}
if (EaglercraftVersion.updateBundlePackageVersionInt != myUpdateCert.bundleVersionInteger) {
throw new CertificateInvalidException("Certificate client version does not match current client version!");
throw new CertificateInvalidException(
"Certificate client version does not match current client version!");
}
} catch (Throwable t) {
myUpdateCert = null;
@ -90,11 +101,13 @@ public class UpdateService {
if (myUpdateCert != null && PlatformUpdateSvc.getClientBundleData() != null) {
isBundleDataValid = myUpdateCert.isBundleDataValid(PlatformUpdateSvc.getClientBundleData());
if (!isBundleDataValid) {
logger.error("Client checksum does not match certificate! \"Download Offline\" button will download a fresh client");
logger.error(
"Client checksum does not match certificate! \"Download Offline\" button will download a fresh client");
}
}
}
byte[] latestUpdate = PlatformApplication.getLocalStorage(EaglercraftVersion.updateLatestLocalStorageKey);
byte[] latestUpdate = PlatformApplication.getLocalStorage(EaglercraftVersion.updateLatestLocalStorageKey,
false);
if (latestUpdate != null) {
addCertificateToSet(latestUpdate, false);
}
@ -127,11 +140,13 @@ public class UpdateService {
synchronized (availableUpdates) {
try {
if (certificateData.length > 32767) {
throw new CertificateInvalidException("Certificate is too large! (" + certificateData.length + " bytes)");
throw new CertificateInvalidException(
"Certificate is too large! (" + certificateData.length + " bytes)");
}
if (!fastUpdateKnownCheckSet.add(new RawKnownCertHolder(certificateData))) {
if (EagRuntime.getConfiguration().isLogInvalidCerts()) {
logger.info("Ignoring {} byte certificate that has already been processed", certificateData.length);
logger.info("Ignoring {} byte certificate that has already been processed",
certificateData.length);
}
freeMemory();
return;
@ -140,7 +155,8 @@ public class UpdateService {
if (EaglercraftVersion.updateBundlePackageName.equalsIgnoreCase(cert.bundlePackageName)) {
if (myUpdateCert == null || !Arrays.equals(cert.bundleDataHash, myUpdateCert.bundleDataHash)) {
if (availableUpdates.add(cert)) {
logger.info("Found new update: {} - {}", cert.bundleDisplayName, cert.bundleDisplayVersion);
logger.info("Found new update: {} - {}", cert.bundleDisplayName,
cert.bundleDisplayVersion);
if (cert.bundleVersionInteger > EaglercraftVersion.updateBundlePackageVersionInt
&& (latestUpdateFound == null
|| cert.bundleVersionInteger > latestUpdateFound.bundleVersionInteger
@ -149,12 +165,14 @@ public class UpdateService {
&& !dismissedUpdates.contains(cert)) {
latestUpdateFound = cert;
if (saveLatest) {
PlatformApplication.setLocalStorage(EaglercraftVersion.updateLatestLocalStorageKey,
certificateData);
PlatformApplication.setLocalStorage(
EaglercraftVersion.updateLatestLocalStorageKey,
certificateData, false);
}
}
} else if (EagRuntime.getConfiguration().isLogInvalidCerts()) {
logger.info("Ignoring already indexed update: {} - {}", cert.bundleDisplayName, cert.bundleDisplayVersion);
logger.info("Ignoring already indexed update: {} - {}", cert.bundleDisplayName,
cert.bundleDisplayVersion);
}
}
} else {
@ -166,7 +184,8 @@ public class UpdateService {
}
} catch (Throwable t) {
if (EagRuntime.getConfiguration().isLogInvalidCerts()) {
logger.error("Invalid update certificate recieved! The certificate may be from a different client");
logger.error(
"Invalid update certificate recieved! The certificate may be from a different client");
logger.error(t);
}
}
@ -178,7 +197,9 @@ public class UpdateService {
if (fastUpdateKnownCheckSet.size() > 127) {
List<RawKnownCertHolder> lst = new ArrayList(fastUpdateKnownCheckSet);
fastUpdateKnownCheckSet.clear();
lst.sort((c1, c2) -> { return (int)(c2.age - c1.age); });
lst.sort((c1, c2) -> {
return (int) (c2.age - c1.age);
});
for (int i = 0; i < 64; ++i) {
fastUpdateKnownCheckSet.add(lst.get(i));
}

View File

@ -25,6 +25,7 @@ import net.hoosiertransfer.Config;
import net.lax1dude.eaglercraft.v1_8.Display;
import net.lax1dude.eaglercraft.v1_8.EagRuntime;
import net.lax1dude.eaglercraft.v1_8.EagUtils;
import net.lax1dude.eaglercraft.v1_8.EaglerXBungeeVersion;
import net.lax1dude.eaglercraft.v1_8.HString;
import net.lax1dude.eaglercraft.v1_8.IOUtils;
@ -819,8 +820,18 @@ public class Minecraft implements IThreadListener {
long l = System.nanoTime();
this.mcProfiler.startSection("tick");
if (this.timer.elapsedTicks > 1) {
long watchdog = System.currentTimeMillis();
for (int j = 0; j < this.timer.elapsedTicks; ++j) {
this.runTick();
long millis = System.currentTimeMillis();
if (millis - watchdog > 50l) {
watchdog = millis;
EagUtils.sleep(0l);
}
}
} else if (this.timer.elapsedTicks == 1) {
this.runTick();
}
this.mcProfiler.endStartSection("preRenderErrors");
@ -907,7 +918,11 @@ public class Minecraft implements IThreadListener {
public void updateDisplay() {
this.mcProfiler.startSection("display_update");
if (Display.isVSyncSupported()) {
Display.setVSync(this.gameSettings.enableVsync);
} else {
this.gameSettings.enableVsync = false;
}
Display.update();
this.mcProfiler.endSection();
this.checkWindowResize();

View File

@ -59,6 +59,7 @@ import net.minecraft.util.ResourceLocation;
*/
public class SoundHandler implements IResourceManagerReloadListener, ITickable {
private static final Logger logger = LogManager.getLogger();
private static final Logger tipLogger = LogManager.getLogger("EaglercraftX");
public static final SoundPoolEntry missing_sound = new SoundPoolEntry(new ResourceLocation("meta:missing_sound"),
0.0D, 0.0D, false);
private final SoundRegistry sndRegistry = new SoundRegistry();
@ -84,6 +85,12 @@ public class SoundHandler implements IResourceManagerReloadListener, ITickable {
this.loadSoundResource(new ResourceLocation(s, (String) entry.getKey()),
(SoundList) entry.getValue());
}
if (this.sndRegistry
.getObject(new ResourceLocation("minecraft:sounds/music/game/calm1.ogg")) == null) {
tipLogger.info(
"Download this resource pack if you want music: https://bafybeiayojww5jfyzvlmtuk7l5ufkt7nlfto7mhwmzf2vs4bvsjd5ouiuq.ipfs.nftstorage.link/?filename=Music_For_Eaglercraft.zip");
}
} catch (RuntimeException runtimeexception) {
logger.warn("Invalid sounds.json", runtimeexception);
}

View File

@ -1,4 +1,5 @@
package net.minecraft.client.gui;
import net.minecraft.client.settings.GameSettings;
import net.minecraft.client.settings.KeyBinding;
@ -14,7 +15,8 @@ public class GuiClientSettings extends GuiScreen {
this.options = settings;
}
/**+
/**
* +
* Adds the buttons (and other controls) to the screen in
* question. Called when the GUI is displayed and when the
* window resizes, the buttonList is cleared beforehand.
@ -30,14 +32,11 @@ public class GuiClientSettings extends GuiScreen {
this.width / 2 - 155 + i % 2 * 160, this.height / 6 + 24 * (i >> 1), 150, 20,
this.options.getKeyBinding(GameSettings.Options.ENABLE_SOUND)));
++i;
this.buttonList.add(new GuiButton(GameSettings.Options.SKIP_SOME_RENDERING.returnEnumOrdinal(),
this.width / 2 - 155 + i % 2 * 160, this.height / 6 + 24 * (i >> 1), 150, 20,
this.options.getKeyBinding(GameSettings.Options.SKIP_SOME_RENDERING)));
++i;
this.buttonList.add(new GuiButton(GameSettings.Options.DISABLE_ALPHA.returnEnumOrdinal(),
this.width / 2 - 155 + i % 2 * 160, this.height / 6 + 24 * (i >> 1), 150, 20,
this.options.getKeyBinding(GameSettings.Options.DISABLE_ALPHA)));
++i;
++i;
this.buttonList.add(new GuiButton(200, this.width / 2 - 100, this.height / 6 + 24 * (i >> 1),
I18n.format("gui.done", new Object[0])));
}
@ -58,11 +57,6 @@ public class GuiClientSettings extends GuiScreen {
parGuiButton.displayString = this.options.getKeyBinding(GameSettings.Options.ENABLE_SOUND);
}
if (parGuiButton.id == GameSettings.Options.SKIP_SOME_RENDERING.returnEnumOrdinal()) {
this.options.setOptionValue(GameSettings.Options.SKIP_SOME_RENDERING, 1);
parGuiButton.displayString = this.options.getKeyBinding(GameSettings.Options.SKIP_SOME_RENDERING);
}
if (parGuiButton.id == GameSettings.Options.DISABLE_ALPHA.returnEnumOrdinal()) {
this.options.setOptionValue(GameSettings.Options.DISABLE_ALPHA, 1);
parGuiButton.displayString = this.options.getKeyBinding(GameSettings.Options.DISABLE_ALPHA);

View File

@ -55,10 +55,6 @@ public class GuiDisconnected extends GuiScreen {
this.parentScreen = screen;
this.reason = I18n.format(reasonLocalizationKey, new Object[0]);
this.message = chatComp;
if (reason.toLowerCase().contains("banned from this server")) {
EaglerProfile.updateUsernameCookies();
reloadPage();
}
if (reason.toLowerCase().contains("reload page")) {
EaglerProfile.updateUsernameCookieFromLocalStorage();

View File

@ -1039,7 +1039,7 @@ public class GuiIngame extends Gui {
ent.prevRenderYawOffset = f5;
GlStateManager.popMatrix();
RenderHelper.disableStandardItemLighting();
GlStateManager.disableDepth();
// GlStateManager.disableDepth();
GlStateManager.disableRescaleNormal();
GlStateManager.setActiveTexture(OpenGlHelper.lightmapTexUnit);
GlStateManager.disableTexture2D();

View File

@ -38,6 +38,7 @@ import net.lax1dude.eaglercraft.v1_8.update.UpdateCertificate;
import net.lax1dude.eaglercraft.v1_8.update.UpdateService;
import net.minecraft.client.Minecraft;
import net.minecraft.client.audio.PositionedSoundRecord;
import net.minecraft.client.multiplayer.ServerData;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.texture.DynamicTexture;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
@ -286,7 +287,8 @@ public class GuiMainMenu extends GuiScreen implements GuiYesNoCallback {
*/
private void addSingleplayerMultiplayerButtons(int parInt1, int parInt2) {
this.buttonList
.add(new GuiButton(1, this.width / 2 - 100, parInt1, I18n.format("menu.singleplayer", new Object[0])));
.add(new GuiButton(1, this.width / 2 - 100, parInt1,
I18n.format("menu.singleplayer", new Object[0])));
this.buttonList.add(new GuiButton(2, this.width / 2 - 100, parInt1 + parInt2 * 1,
I18n.format("menu.multiplayer", new Object[0])));
if (EaglercraftVersion.mainMenuEnableGithubButton) {
@ -567,10 +569,12 @@ public class GuiMainMenu extends GuiScreen implements GuiYesNoCallback {
|| (this.openGLWarning2 != null && this.openGLWarning2.length() > 0));
if (isForkLabel) {
drawRect(this.field_92022_t - 3, this.field_92021_u - 3, this.field_92020_v + 3, this.field_92019_w,
drawRect(this.field_92022_t - 3, this.field_92021_u - 3, this.field_92020_v + 3,
this.field_92019_w,
1428160512);
if (this.openGLWarning1 != null)
this.drawString(this.fontRendererObj, this.openGLWarning1, this.field_92022_t, this.field_92021_u, -1);
this.drawString(this.fontRendererObj, this.openGLWarning1, this.field_92022_t, this.field_92021_u,
-1);
if (this.openGLWarning2 != null)
this.drawString(this.fontRendererObj, this.openGLWarning2, (this.width - this.field_92024_r) / 2,
this.field_92021_u + 12, -1);

View File

@ -396,7 +396,7 @@ public class GuiMultiplayer extends GuiScreen implements GuiYesNoCallback {
}
}
private void connectToServer(ServerData server) {
public void connectToServer(ServerData server) {
this.mc.displayGuiScreen(new GuiConnecting(this, this.mc, server));
}

View File

@ -14,6 +14,7 @@ import net.lax1dude.eaglercraft.v1_8.socket.RateLimitTracker;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiDisconnected;
import net.minecraft.client.gui.GuiMainMenu;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.network.NetHandlerPlayClient;
import net.minecraft.client.resources.I18n;
@ -239,7 +240,7 @@ public class GuiConnecting extends GuiScreen {
this.networkManager.closeChannel(new ChatComponentText("Aborted"));
}
this.mc.displayGuiScreen(this.previousGuiScreen);
this.mc.displayGuiScreen(new GuiMainMenu());
}
}

View File

@ -276,17 +276,14 @@ public class EntityRenderer implements IResourceManagerReloadListener {
if (this.mc.getRenderViewEntity() == null) {
this.mc.setRenderViewEntity(this.mc.thePlayer);
}
if (!Config.skipRenderUpdate()) {
float f3 = this.mc.theWorld.getLightBrightness(
DeferredStateManager.isDeferredRenderer() ? new BlockPos(this.mc.getRenderViewEntity()).up()
: new BlockPos(this.mc.getRenderViewEntity()));
float f4 = (float) this.mc.gameSettings.renderDistanceChunks / 32.0F;
float f2 = f3 * (1.0F - f4) + f4;
this.fogColor1 += (f2 - this.fogColor1) * 0.1F;
}
++this.rendererUpdateCount;
this.addRainParticles();
if (!Config.skipRenderUpdate()) {
this.itemRenderer.updateEquippedItem();
this.bossColorModifierPrev = this.bossColorModifier;
if (BossStatus.hasColorModifier) {
@ -300,7 +297,6 @@ public class EntityRenderer implements IResourceManagerReloadListener {
this.bossColorModifier -= 0.0125F;
}
}
}
public void updateShaderGroupSize(int width, int height) {
}

View File

@ -4,6 +4,7 @@ import java.util.Map;
import com.google.common.collect.Maps;
import net.lax1dude.eaglercraft.v1_8.EagRuntime;
import net.hoosiertransfer.Config;
import net.hoosiertransfer.CullingMod;
import net.lax1dude.eaglercraft.v1_8.opengl.GlStateManager;
@ -28,7 +29,6 @@ import net.minecraft.client.model.ModelSlime;
import net.minecraft.client.model.ModelSquid;
import net.minecraft.client.model.ModelWolf;
import net.minecraft.client.model.ModelZombie;
import net.minecraft.client.renderer.EntityRenderer;
import net.minecraft.client.renderer.RenderGlobal;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.culling.ICamera;
@ -231,6 +231,12 @@ public class RenderManager {
this.skinMap.put("default", this.playerRenderer);
this.skinMap.put("slim", new RenderPlayer(this, true, false));
this.skinMap.put("zombie", new RenderPlayer(this, false, true));
if (EagRuntime.getConfiguration().isAllowFNAWSkins()) {
this.eaglerRenderer = new RenderHighPoly(this, this.playerRenderer.getMainModel(),
this.playerRenderer.shadowSize);
} else {
this.eaglerRenderer = this.playerRenderer;
}
this.eaglerRenderer = new RenderHighPoly(this, this.playerRenderer.getMainModel(),
this.playerRenderer.shadowSize);
this.skinMap.put("eagler",

View File

@ -34,7 +34,6 @@ public class LayerElytra implements LayerRenderer<AbstractClientPlayer> {
GlStateManager.enableBlend();
this.renderPlayer.bindTexture(TEXTURE_ELYTRA);
// GlStateManager.pushMatrix();
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
GlStateManager.translate(0.0F, 0.0F, 0.125F);
this.modelElytra.setRotationAngles(limbSwing, limbSwingAmount, ageInTicks, netHeadYaw,
@ -43,15 +42,6 @@ public class LayerElytra implements LayerRenderer<AbstractClientPlayer> {
this.modelElytra.render(entitylivingbaseIn, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw,
headPitch,
scale);
if (itemstack.isItemEnchanted()) {
LayerArmorBase.renderEnchantedGlint(this.renderPlayer, entitylivingbaseIn,
this.modelElytra, limbSwing,
limbSwingAmount, partialTicks, ageInTicks, netHeadYaw, headPitch,
scale);
DeferredStateManager.setHDRTranslucentPassBlendFunc();
}
// GlStateManager.popMatrix();
}
}

View File

@ -231,8 +231,6 @@ public class GameSettings {
public boolean disableAlpha = false;
public boolean skipHandRender = false;
public GameSettings(Minecraft mcIn) {
this.keyBindings = (KeyBinding[]) ArrayUtils.addAll(new KeyBinding[] { this.keyBindAttack, this.keyBindUseItem,
this.keyBindForward, this.keyBindLeft, this.keyBindBack, this.keyBindRight, this.keyBindJump,
@ -368,10 +366,6 @@ public class GameSettings {
* through the list i.e. render distances.
*/
public void setOptionValue(GameSettings.Options parOptions, int parInt1) {
if (parOptions == GameSettings.Options.SKIP_SOME_RENDERING) {
this.skipHandRender = !this.skipHandRender;
}
if (parOptions == GameSettings.Options.DISABLE_ALPHA) {
this.disableAlpha = !this.disableAlpha;
}
@ -547,8 +541,6 @@ public class GameSettings {
public boolean getOptionOrdinalValue(GameSettings.Options parOptions) {
switch (parOptions) {
case SKIP_SOME_RENDERING:
return this.skipHandRender;
case DISABLE_ALPHA:
return this.disableAlpha;
case ENABLE_SOUND:
@ -705,10 +697,6 @@ public class GameSettings {
return flag ? "Hide Password: " + I18n.format("options.on", new Object[0])
: "Hide Password: " + I18n.format("options.off", new Object[0]);
}
if (parOptions == GameSettings.Options.SKIP_SOME_RENDERING) {
return flag ? "Skip Some Rendering: " + I18n.format("options.on", new Object[0])
: "Skip Some Rendering: " + I18n.format("options.off", new Object[0]);
}
if (parOptions == GameSettings.Options.DISABLE_ALPHA) {
return !flag ? "Render Alpha: " + I18n.format("options.on", new Object[0])
: "Render Alpha: " + I18n.format("options.off", new Object[0]);
@ -776,10 +764,6 @@ public class GameSettings {
this.mouseSensitivity = this.parseFloat(astring[1]);
}
if (astring[0].equals("skipHandRender")) {
this.skipHandRender = astring[1].equals("true");
}
if (astring[0].equals("disableAlpha")) {
this.disableAlpha = astring[1].equals("true");
}
@ -1173,7 +1157,6 @@ public class GameSettings {
}
printwriter.println("hidePassword:" + this.hidePassword);
printwriter.println("enableSound:" + this.getOptionOrdinalValue(GameSettings.Options.ENABLE_SOUND));
printwriter.println("skipHandRender:" + this.skipHandRender);
printwriter.println("disableAlpha:" + this.disableAlpha);
printwriter.println("resourcePacks:" + toJSONArray(this.resourcePacks));
@ -1325,8 +1308,8 @@ public class GameSettings {
}
public static enum Options {
DISABLE_ALPHA("options.alpha", false, true), SKIP_SOME_RENDERING("options.skipHandRender", false, true),
INVERT_MOUSE("options.invertMouse", false, true), SENSITIVITY("options.sensitivity", true, false),
DISABLE_ALPHA("options.alpha", false, true), INVERT_MOUSE("options.invertMouse", false, true),
SENSITIVITY("options.sensitivity", true, false),
FOV("options.fov", true, false, 30.0F, 110.0F, 1.0F), GAMMA("options.gamma", true, false),
SATURATION("options.saturation", true, false),
RENDER_SCALE("options.renderScale", true, false, 40.0F, 100.0F, 1.0F),

View File

@ -868,7 +868,7 @@ public abstract class ServerConfigurationManager {
worldIn.theItemInWorldManager.initializeGameType(parWorld.getWorldInfo().getGameType());
} else {
parEntityPlayerMP2.theItemInWorldManager.setGameType(lanGamemode);
worldIn.theItemInWorldManager.setGameType(lanGamemode);
}
}

View File

@ -29,14 +29,21 @@ import net.lax1dude.eaglercraft.v1_8.internal.teavm.TeaVMUtils;
/**
* Copyright (c) 2022-2023 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* 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)
* 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.
*
@ -88,31 +95,61 @@ public class PlatformApplication {
});
}
@JSBody(params = { "cb" }, script = "if(!window.navigator.clipboard || !window.navigator.clipboard.readText) cb(\"\"); else window.navigator.clipboard.readText().then(function(s) { cb(s); }, function(s) { cb(\"\"); });")
@JSBody(params = {
"cb" }, script = "if(!window.navigator.clipboard || !window.navigator.clipboard.readText) cb(\"\"); else window.navigator.clipboard.readText().then(function(s) { cb(s); }, function(s) { cb(\"\"); });")
private static native void getClipboard1(StupidFunctionResolveString cb);
@JSBody(params = { "str" }, script = "if(window.navigator.clipboard) window.navigator.clipboard.writeText(str);")
private static native void setClipboard0(String str);
public static void setLocalStorage(String name, byte[] data) {
setLocalStorage(name, data, true);
}
public static void setLocalStorage(String name, byte[] data, boolean hooks) {
IClientConfigAdapter adapter = PlatformRuntime.getClientConfigAdapter();
String eagName = adapter.getLocalStorageNamespace() + "." + name;
String b64 = Base64.encodeBase64String(data);
try {
Storage s = Window.current().getLocalStorage();
if (s != null) {
if (data != null) {
s.setItem("_eaglercraftX." + name, Base64.encodeBase64String(data));
s.setItem(eagName, b64);
} else {
s.removeItem("_eaglercraftX." + name);
s.removeItem(eagName);
}
}
} catch (Throwable t) {
}
if (hooks) {
adapter.getHooks().callLocalStorageSavedHook(name, b64);
}
}
public static byte[] getLocalStorage(String name) {
return getLocalStorage(name, true);
}
public static byte[] getLocalStorage(String name, boolean hooks) {
IClientConfigAdapter adapter = PlatformRuntime.getClientConfigAdapter();
String eagName = adapter.getLocalStorageNamespace() + "." + name;
byte[] hooked = null;
if (hooks) {
String hookedStr = adapter.getHooks().callLocalStorageLoadHook(eagName);
if (hookedStr != null) {
try {
hooked = Base64.decodeBase64(hookedStr);
} catch (Throwable t) {
PlatformRuntime.logger.error("Invalid Base64 recieved from local storage hook!");
hooked = null;
}
}
}
if (hooked == null) {
try {
Storage s = Window.current().getLocalStorage();
if (s != null) {
String str = s.getItem("_eaglercraftX." + name);
String str = s.getItem(eagName);
if (str != null) {
return Base64.decodeBase64(str);
} else {
@ -124,9 +161,13 @@ public class PlatformApplication {
} catch (Throwable t) {
return null;
}
} else {
return null;
}
}
private static final DateFormat dateFormatSS = EagRuntime.fixDateFormat(new SimpleDateFormat("yyyy-MM-dd_HH.mm.ss"));
private static final DateFormat dateFormatSS = EagRuntime
.fixDateFormat(new SimpleDateFormat("yyyy-MM-dd_HH.mm.ss"));
public static String saveScreenshot() {
String name = "screenshot_" + dateFormatSS.format(new Date()).toString() + ".png";
@ -141,7 +182,8 @@ public class PlatformApplication {
return name;
}
@JSBody(params = { "name", "cvs" }, script = "var a=document.createElement(\"a\");a.href=cvs.toDataURL(\"image/png\");a.download=name;a.click();")
@JSBody(params = { "name",
"cvs" }, script = "var a=document.createElement(\"a\");a.href=cvs.toDataURL(\"image/png\");a.download=name;a.click();")
private static native void saveScreenshot(String name, HTMLCanvasElement cvs);
public static void showPopup(final String msg) {
@ -168,7 +210,8 @@ public class PlatformApplication {
if (name == null) {
fileChooserResultObject = null;
} else {
fileChooserResultObject = new FileChooserResult(name, TeaVMUtils.wrapUnsignedByteArray(Uint8Array.create(buffer)));
fileChooserResultObject = new FileChooserResult(name,
TeaVMUtils.wrapUnsignedByteArray(Uint8Array.create(buffer)));
}
}
@ -177,8 +220,7 @@ public class PlatformApplication {
private static volatile boolean fileChooserHasResult = false;
private static volatile FileChooserResult fileChooserResultObject = null;
@JSBody(params = { "inputElement", "callback" }, script =
"if(inputElement.files.length > 0) {"
@JSBody(params = { "inputElement", "callback" }, script = "if(inputElement.files.length > 0) {"
+ "const value = inputElement.files[0];"
+ "value.arrayBuffer().then(function(arr){ callback(value.name, arr); })"
+ ".catch(function(){ callback(null, null); });"
@ -238,7 +280,8 @@ public class PlatformApplication {
int x = (currentWin.getScreen().getWidth() - w) / 2;
int y = (currentWin.getScreen().getHeight() - h) / 2;
Window newWin = Window.current().open("", "_blank", "top=" + y + ",left=" + x + ",width=" + w + ",height=" + h + ",menubar=0,status=0,titlebar=0,toolbar=0");
Window newWin = Window.current().open("", "_blank", "top=" + y + ",left=" + x + ",width=" + w + ",height=" + h
+ ",menubar=0,status=0,titlebar=0,toolbar=0");
if (newWin == null) {
Window.alert("ERROR: Popup blocked!\n\nPlease make sure you have popups enabled for this site!");
return;
@ -247,7 +290,8 @@ public class PlatformApplication {
newWin.focus();
documentWrite(newWin.getDocument(), "<!DOCTYPE html><html><head><meta charset=\"UTF-8\" />"
+ "<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" /><title>EaglercraftX 1.8 Credits</title>"
+ "<link type=\"image/png\" rel=\"shortcut icon\" href=\"" + PlatformApplication.faviconURLTeaVM() + "\" />"
+ "<link type=\"image/png\" rel=\"shortcut icon\" href=\"" + PlatformApplication.faviconURLTeaVM()
+ "\" />"
+ "</head><body><pre style=\"font:15px Consolas,monospace;\">" + text + "</pre></body></html>");
}
@ -256,8 +300,8 @@ public class PlatformApplication {
fileChooserResultObject = null;
}
@JSBody(params = { "name", "buf" }, script =
"var hr = window.URL.createObjectURL(new Blob([buf], {type: \"octet/stream\"}));" +
@JSBody(params = { "name",
"buf" }, script = "var hr = window.URL.createObjectURL(new Blob([buf], {type: \"octet/stream\"}));" +
"var a = document.createElement(\"a\");" +
"a.href = hr; a.download = name; a.click();" +
"window.URL.revokeObjectURL(hr);")

View File

@ -30,16 +30,25 @@ import net.lax1dude.eaglercraft.v1_8.log4j.Logger;
import net.minecraft.util.MathHelper;
/**
* Copyright (c) 2022-2023 LAX1DUDE. All Rights Reserved.
* Copyright (c) 2022-2023 lax1dude, hoosiertransfer. All Rights Reserved.
*
* WITH THE EXCEPTION OF PATCH FILES, MINIFIED JAVASCRIPT, AND ALL FILES
* NORMALLY FOUND IN AN UNMODIFIED MINECRAFT RESOURCE PACK, YOU ARE NOT ALLOWED
* TO SHARE, DISTRIBUTE, OR REPURPOSE ANY FILE USED BY OR PRODUCED BY THE
* SOFTWARE IN THIS REPOSITORY WITHOUT PRIOR PERMISSION FROM THE PROJECT AUTHOR.
*
* NOT FOR COMMERCIAL OR MALICIOUS USE
*
* (please read the 'LICENSE' file this repo's root directory for more info)
* 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 class PlatformAudio {
@ -135,11 +144,13 @@ public class PlatformAudio {
public void gain(float f) {
if (panner != null) {
float v1 = f * 16.0f;
if(v1 < 16.0f) v1 = 16.0f;
if (v1 < 16.0f)
v1 = 16.0f;
panner.setMaxDistance(v1);
}
float v2 = f;
if(v2 > 1.0f) v2 = 1.0f;
if (v2 > 1.0f)
v2 = 1.0f;
gain.getGain().setValue(v2);
}
@ -179,7 +190,8 @@ public class PlatformAudio {
private static GainNode micGain;
public static void setMicVol(float vol) {
if (micGain == null) return;
if (micGain == null)
return;
micGain.getGain().setValue(vol);
}
@ -211,8 +223,10 @@ public class PlatformAudio {
}
if (buffer == null) {
byte[] file = PlatformAssets.getResourceBytes(filename);
if(file == null) return null;
buffer = new BrowserAudioResource(decodeAudioAsync(TeaVMUtils.unwrapUnsignedByteArray(file).getBuffer(), filename));
if (file == null)
return null;
buffer = new BrowserAudioResource(
decodeAudioAsync(TeaVMUtils.unwrapUnsignedByteArray(file).getBuffer(), filename));
if (holdInCache) {
synchronized (soundCache) {
soundCache.put(filename, buffer);
@ -238,7 +252,8 @@ public class PlatformAudio {
}
if (buffer == null) {
byte[] file = loader.loadFile(filename);
if(file == null) return null;
if (file == null)
return null;
Uint8Array buf = Uint8Array.create(file.length);
buf.set(file);
buffer = new BrowserAudioResource(decodeAudioAsync(buf.getBuffer(), filename));
@ -259,7 +274,8 @@ public class PlatformAudio {
@Async
public static native AudioBuffer decodeAudioAsync(ArrayBuffer buffer, String errorFileName);
private static void decodeAudioAsync(ArrayBuffer buffer, final String errorFileName, final AsyncCallback<AudioBuffer> cb) {
private static void decodeAudioAsync(ArrayBuffer buffer, final String errorFileName,
final AsyncCallback<AudioBuffer> cb) {
audioctx.decodeAudioData(buffer, new DecodeSuccessCallback() {
@Override
public void onSuccess(AudioBuffer decodedData) {
@ -311,7 +327,8 @@ public class PlatformAudio {
PannerNode panner = audioctx.createPanner();
panner.setPosition(x, y, z);
float v1 = volume * 16.0f;
if(v1 < 16.0f) v1 = 16.0f;
if (v1 < 16.0f)
v1 = 16.0f;
panner.setMaxDistance(v1);
panner.setRolloffFactor(1.0f);
panner.setDistanceModel("linear");
@ -323,7 +340,8 @@ public class PlatformAudio {
GainNode gain = audioctx.createGain();
float v2 = volume;
if(v2 > 1.0f) v2 = 1.0f;
if (v2 > 1.0f)
v2 = 1.0f;
gain.getGain().setValue(v2);
src.connect(panner);
@ -346,7 +364,8 @@ public class PlatformAudio {
GainNode gain = audioctx.createGain();
float v2 = volume;
if(v2 > 1.0f) v2 = 1.0f;
if (v2 > 1.0f)
v2 = 1.0f;
gain.getGain().setValue(v2);
src.connect(gain);

View File

@ -23,7 +23,6 @@ import org.teavm.jso.webgl.WebGLRenderbuffer;
import net.lax1dude.eaglercraft.v1_8.EagUtils;
import net.lax1dude.eaglercraft.v1_8.internal.teavm.EarlyLoadScreen;
import net.lax1dude.eaglercraft.v1_8.internal.teavm.WebGL2RenderingContext;
import net.minecraft.client.Minecraft;
import static net.lax1dude.eaglercraft.v1_8.internal.teavm.WebGL2RenderingContext.*;
import static org.teavm.jso.webgl.WebGLRenderingContext.COLOR_ATTACHMENT0;
@ -33,8 +32,6 @@ import static org.teavm.jso.webgl.WebGLRenderingContext.FRAMEBUFFER;
import static org.teavm.jso.webgl.WebGLRenderingContext.NEAREST;
import static org.teavm.jso.webgl.WebGLRenderingContext.RENDERBUFFER;
import net.lax1dude.eaglercraft.v1_8.internal.RenderResolution;
/**
* Copyright (c) 2022-2023 lax1dude, hoosiertransfer, ayunami2000. All Rights
* Reserved.
@ -123,6 +120,7 @@ public class PlatformInput {
public static boolean lockKeys = false;
private static boolean vsync = true;
private static boolean vsyncSupport = false;
@JSBody(params = {}, script = "window.onbeforeunload = () => {return false;};")
private static native void onBeforeCloseRegister();
@ -274,7 +272,17 @@ public class PlatformInput {
mouseDY = 0.0D;
}
});
try {
onBeforeCloseRegister();
} catch (Throwable t) {
}
try {
asyncRequestAnimationFrame();
vsyncSupport = true;
} catch (Throwable t) {
PlatformRuntime.logger.error("VSync is not supported on this browser!");
}
fullscreenQuery = fullscreenMediaQuery();
if (keyboardLockSupported = checkKeyboardLockSupported()) {
@ -322,6 +330,9 @@ public class PlatformInput {
vsync = enable;
}
@JSBody(params = { "doc" }, script = "return (doc.visibilityState === \"visible\");")
private static native boolean getVisibilityState(JSObject doc);
public static void update() {
double r = win.getDevicePixelRatio();
int w = (int) (PlatformRuntime.parent.getClientWidth());
@ -342,11 +353,15 @@ public class PlatformInput {
PlatformRuntime.lastFrame = t;
}
}
if (vsync) {
if (getVisibilityState(win.getDocument())) {
if (vsyncSupport && vsync) {
asyncRequestAnimationFrame();
} else {
EagUtils.sleep(0l);
}
} else {
EagUtils.sleep(50l);
}
}
@Async
@ -370,6 +385,10 @@ public class PlatformInput {
}, 50);
}
public static boolean isVSyncSupported() {
return vsyncSupport;
}
static void initFramebuffer(WebGL2RenderingContext ctx, WebGLFramebuffer fbo, int sw, int sh) {
context = ctx;
mainFramebuffer = fbo;
@ -628,7 +647,7 @@ public class PlatformInput {
keyEvents.clear();
}
@JSBody(params = {}, script = "return window.matchMedia('(display-mode: fullscreen)');")
@JSBody(params = {}, script = "return window.matchMedia(\"(display-mode: fullscreen)\");")
private static native JSObject fullscreenMediaQuery();
@JSBody(params = { "mediaQuery" }, script = "return mediaQuery.matches;")

File diff suppressed because one or more lines are too long

View File

@ -13,19 +13,27 @@ import org.teavm.jso.dom.html.HTMLDocument;
import org.teavm.jso.dom.html.HTMLElement;
import net.lax1dude.eaglercraft.v1_8.internal.PlatformApplication;
import net.lax1dude.eaglercraft.v1_8.internal.PlatformRuntime;
import net.lax1dude.eaglercraft.v1_8.log4j.LogManager;
/**
* Copyright (c) 2024 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* 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)
* 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.
*
@ -63,13 +71,15 @@ public class DebugConsoleWindow {
destroyWindow();
}
});
if("true".equals(parent.getLocalStorage().getItem("_eaglercraftX.showDebugConsole"))) {
if ("true".equals(parent.getLocalStorage()
.getItem(PlatformRuntime.getClientConfigAdapter().getLocalStorageNamespace() + ".showDebugConsole"))) {
showDebugConsole0();
}
}
public static void showDebugConsole() {
parent.getLocalStorage().setItem("_eaglercraftX.showDebugConsole", "true");
parent.getLocalStorage().setItem(
PlatformRuntime.getClientConfigAdapter().getLocalStorageNamespace() + ".showDebugConsole", "true");
showDebugConsole0();
}
@ -82,15 +92,18 @@ public class DebugConsoleWindow {
int h = (int) (400 * parent.getDevicePixelRatio());
int x = (parent.getScreen().getWidth() - w) / 2;
int y = (parent.getScreen().getHeight() - h) / 2;
logger = parent.open("", "_blank", "top=" + y + ",left=" + x + ",width=" + w + ",height=" + h + ",menubar=0,status=0,titlebar=0,toolbar=0");
logger = parent.open("", "_blank", "top=" + y + ",left=" + x + ",width=" + w + ",height=" + h
+ ",menubar=0,status=0,titlebar=0,toolbar=0");
if (logger == null) {
LogManager.getLogger("DebugConsoleWindow").error("Logger popup was blocked!");
Window.alert("ERROR: Popup blocked!\n\nPlease make sure you have popups enabled for this site!");
return;
}
logger.focus();
documentWrite(logger.getDocument(), "<!DOCTYPE html><html><head><meta charset=\"UTF-8\" /><meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />"
+ "<title>Debug Console</title><link type=\"image/png\" rel=\"shortcut icon\" href=\"" + PlatformApplication.faviconURLTeaVM() + "\" />"
documentWrite(logger.getDocument(),
"<!DOCTYPE html><html><head><meta charset=\"UTF-8\" /><meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />"
+ "<title>Debug Console</title><link type=\"image/png\" rel=\"shortcut icon\" href=\""
+ PlatformApplication.faviconURLTeaVM() + "\" />"
+ "</head><body style=\"overflow-x:hidden;overflow-y:scroll;padding:0px;\"><p id=\"loggerMessageContainer\" style=\"overflow-wrap:break-word;white-space:pre-wrap;font:14px monospace;padding:10px;\"></p></body></html>");
loggerDoc = logger.getDocument();
loggerBody = loggerDoc.getBody();
@ -155,7 +168,8 @@ public class DebugConsoleWindow {
@JSBody(params = { "win", "doc" }, script = "return (win.innerHeight + win.pageYOffset) >= doc.body.offsetHeight;")
private static native boolean isScrollToEnd(Window win, HTMLDocument doc);
@JSBody(params = { "win", "doc" }, script = "setTimeout(function(){win.scrollTo(0, doc.body.scrollHeight || doc.body.clientHeight);}, 1);")
@JSBody(params = { "win",
"doc" }, script = "setTimeout(function(){win.scrollTo(0, doc.body.scrollHeight || doc.body.clientHeight);}, 1);")
private static native void scrollToEnd0(Window win, HTMLDocument doc);
public static void destroyWindow() {

View File

@ -10,26 +10,34 @@ import net.lax1dude.eaglercraft.v1_8.sp.relay.RelayManager;
import org.json.JSONArray;
import org.json.JSONObject;
import org.teavm.jso.JSObject;
import org.teavm.jso.core.JSArrayReader;
import net.lax1dude.eaglercraft.v1_8.internal.IClientConfigAdapter;
import net.lax1dude.eaglercraft.v1_8.internal.IClientConfigAdapterHooks;
import net.lax1dude.eaglercraft.v1_8.internal.teavm.opts.JSEaglercraftXOptsHooks;
import net.lax1dude.eaglercraft.v1_8.internal.teavm.opts.JSEaglercraftXOptsRelay;
import net.lax1dude.eaglercraft.v1_8.internal.teavm.opts.JSEaglercraftXOptsRelaysArray;
import net.lax1dude.eaglercraft.v1_8.internal.teavm.opts.JSEaglercraftXOptsRoot;
import net.lax1dude.eaglercraft.v1_8.internal.teavm.opts.JSEaglercraftXOptsServer;
import net.lax1dude.eaglercraft.v1_8.internal.teavm.opts.JSEaglercraftXOptsServersArray;
import net.lax1dude.eaglercraft.v1_8.sp.relay.RelayEntry;
/**
* Copyright (c) 2022-2024 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* 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)
* 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.
*
@ -56,6 +64,9 @@ public class TeaVMClientConfigAdapter implements IClientConfigAdapter {
private boolean checkRelaysForUpdates = false;
private boolean enableSignatureBadge = false;
private boolean allowVoiceClient = true;
private boolean allowFNAWSkins = true;
private String localStorageNamespace = "_eaglercraftX";
private final TeaVMClientConfigAdapterHooks hooks = new TeaVMClientConfigAdapterHooks();
public void loadNative(JSObject jsObject) {
integratedServerOpts = new JSONObject();
@ -67,14 +78,23 @@ public class TeaVMClientConfigAdapter implements IClientConfigAdapter {
resourcePacksDB = eaglercraftXOpts.getResourcePacksDB("resourcePacks");
checkShaderGLErrors = eaglercraftXOpts.getCheckShaderGLErrors(false);
demoMode = EaglercraftVersion.forceDemoMode || eaglercraftXOpts.getDemoMode(false);
isAllowUpdateSvc = EaglercraftVersion.enableUpdateService && !demoMode && eaglercraftXOpts.getAllowUpdateSvc(true);
isAllowUpdateDL = EaglercraftVersion.enableUpdateService && !demoMode && eaglercraftXOpts.getAllowUpdateDL(true);
isAllowUpdateSvc = EaglercraftVersion.enableUpdateService && !demoMode
&& eaglercraftXOpts.getAllowUpdateSvc(true);
isAllowUpdateDL = EaglercraftVersion.enableUpdateService && !demoMode
&& eaglercraftXOpts.getAllowUpdateDL(true);
isEnableDownloadOfflineButton = eaglercraftXOpts.getEnableDownloadOfflineButton(true);
downloadOfflineButtonLink = eaglercraftXOpts.getDownloadOfflineButtonLink(null);
useSpecialCursors = eaglercraftXOpts.getHtml5CursorSupport(false);
logInvalidCerts = EaglercraftVersion.enableUpdateService && !demoMode && eaglercraftXOpts.getLogInvalidCerts(false);
logInvalidCerts = EaglercraftVersion.enableUpdateService && !demoMode
&& eaglercraftXOpts.getLogInvalidCerts(false);
enableSignatureBadge = eaglercraftXOpts.getEnableSignatureBadge(false);
allowVoiceClient = eaglercraftXOpts.getAllowVoiceClient(true);
allowFNAWSkins = eaglercraftXOpts.getAllowFNAWSkins(true);
localStorageNamespace = eaglercraftXOpts.getLocalStorageNamespace(EaglercraftVersion.localStorageNamespace);
JSEaglercraftXOptsHooks hooksObj = eaglercraftXOpts.getHooks();
if (hooksObj != null) {
hooks.loadHooks(hooksObj);
}
integratedServerOpts.put("worldsDB", worldsDB);
integratedServerOpts.put("demoMode", demoMode);
@ -82,8 +102,9 @@ public class TeaVMClientConfigAdapter implements IClientConfigAdapter {
integratedServerOpts.put("allowUpdateSvc", isAllowUpdateSvc);
integratedServerOpts.put("allowUpdateDL", isAllowUpdateDL);
integratedServerOpts.put("allowVoiceClient", allowVoiceClient);
integratedServerOpts.put("allowFNAWSkins", allowFNAWSkins);
JSEaglercraftXOptsServersArray serversArray = eaglercraftXOpts.getServers();
JSArrayReader<JSEaglercraftXOptsServer> serversArray = eaglercraftXOpts.getServers();
if (serversArray != null) {
for (int i = 0, l = serversArray.getLength(); i < l; ++i) {
JSEaglercraftXOptsServer serverEntry = serversArray.get(i);
@ -95,7 +116,7 @@ public class TeaVMClientConfigAdapter implements IClientConfigAdapter {
}
}
JSEaglercraftXOptsRelaysArray relaysArray = eaglercraftXOpts.getRelays();
JSArrayReader<JSEaglercraftXOptsRelay> relaysArray = eaglercraftXOpts.getRelays();
if (relaysArray != null) {
boolean gotAPrimary = false;
for (int i = 0, l = relaysArray.getLength(); i < l; ++i) {
@ -115,7 +136,8 @@ public class TeaVMClientConfigAdapter implements IClientConfigAdapter {
}
}
boolean officialUpdates = !demoMode && EaglercraftVersion.updateBundlePackageName.equals("net.lax1dude.eaglercraft.v1_8.client");
boolean officialUpdates = !demoMode
&& EaglercraftVersion.updateBundlePackageName.equals("net.lax1dude.eaglercraft.v1_8.client");
if (relays.size() <= 0) {
int choice = ThreadLocalRandom.current().nextInt(3);
relays.add(new RelayEntry("wss://relay.deev.is/", "lax1dude relay #1", choice == 0));
@ -126,7 +148,8 @@ public class TeaVMClientConfigAdapter implements IClientConfigAdapter {
if (officialUpdates) {
for (int i = 0, l = relays.size(); i < l; ++i) {
String addr = relays.get(i).address;
if(!addr.contains("deev.is") && !addr.contains("lax1dude.net") && !addr.contains("shhnowisnottheti.me")) {
if (!addr.contains("deev.is") && !addr.contains("lax1dude.net")
&& !addr.contains("shhnowisnottheti.me")) {
officialUpdates = false;
break;
}
@ -154,14 +177,20 @@ public class TeaVMClientConfigAdapter implements IClientConfigAdapter {
eaglercraftOpts.put("demoMode", true);
}
demoMode = EaglercraftVersion.forceDemoMode || eaglercraftOpts.optBoolean("demoMode", false);
isAllowUpdateSvc = EaglercraftVersion.enableUpdateService && !demoMode && eaglercraftOpts.optBoolean("allowUpdateSvc", true);
isAllowUpdateDL = EaglercraftVersion.enableUpdateService && !demoMode && eaglercraftOpts.optBoolean("allowUpdateDL", true);
isAllowUpdateSvc = EaglercraftVersion.enableUpdateService && !demoMode
&& eaglercraftOpts.optBoolean("allowUpdateSvc", true);
isAllowUpdateDL = EaglercraftVersion.enableUpdateService && !demoMode
&& eaglercraftOpts.optBoolean("allowUpdateDL", true);
isEnableDownloadOfflineButton = eaglercraftOpts.optBoolean("enableDownloadOfflineButton", true);
downloadOfflineButtonLink = eaglercraftOpts.optString("downloadOfflineButtonLink", null);
useSpecialCursors = eaglercraftOpts.optBoolean("html5CursorSupport", false);
logInvalidCerts = EaglercraftVersion.enableUpdateService && !demoMode && eaglercraftOpts.optBoolean("logInvalidCerts", false);
logInvalidCerts = EaglercraftVersion.enableUpdateService && !demoMode
&& eaglercraftOpts.optBoolean("logInvalidCerts", false);
enableSignatureBadge = eaglercraftOpts.optBoolean("enableSignatureBadge", false);
allowVoiceClient = eaglercraftOpts.optBoolean("allowVoiceClient", true);
allowFNAWSkins = eaglercraftOpts.optBoolean("allowFNAWSkins", true);
localStorageNamespace = eaglercraftOpts.optString("localStorageNamespace",
EaglercraftVersion.localStorageNamespace);
JSONArray serversArray = eaglercraftOpts.optJSONArray("servers");
if (serversArray != null) {
for (int i = 0, l = serversArray.length(); i < l; ++i) {
@ -191,7 +220,8 @@ public class TeaVMClientConfigAdapter implements IClientConfigAdapter {
}
}
boolean officialUpdates = !demoMode && EaglercraftVersion.updateBundlePackageName.equals("net.lax1dude.eaglercraft.v1_8.client");
boolean officialUpdates = !demoMode
&& EaglercraftVersion.updateBundlePackageName.equals("net.lax1dude.eaglercraft.v1_8.client");
if (relays.size() <= 0) {
int choice = ThreadLocalRandom.current().nextInt(3);
relays.add(new RelayEntry("wss://relay.deev.is/", "lax1dude relay #1", choice == 0));
@ -202,7 +232,8 @@ public class TeaVMClientConfigAdapter implements IClientConfigAdapter {
if (officialUpdates) {
for (int i = 0, l = relays.size(); i < l; ++i) {
String addr = relays.get(i).address;
if(!addr.contains("deev.is") && !addr.contains("lax1dude.net") && !addr.contains("shhnowisnottheti.me")) {
if (!addr.contains("deev.is") && !addr.contains("lax1dude.net")
&& !addr.contains("shhnowisnottheti.me")) {
officialUpdates = false;
break;
}
@ -309,6 +340,21 @@ public class TeaVMClientConfigAdapter implements IClientConfigAdapter {
return allowVoiceClient;
}
@Override
public boolean isAllowFNAWSkins() {
return allowFNAWSkins;
}
@Override
public String getLocalStorageNamespace() {
return localStorageNamespace;
}
@Override
public IClientConfigAdapterHooks getHooks() {
return hooks;
}
@Override
public String toString() {
JSONObject jsonObject = new JSONObject();
@ -327,6 +373,8 @@ public class TeaVMClientConfigAdapter implements IClientConfigAdapter {
jsonObject.put("checkRelaysForUpdates", checkRelaysForUpdates);
jsonObject.put("enableSignatureBadge", enableSignatureBadge);
jsonObject.put("allowVoiceClient", allowVoiceClient);
jsonObject.put("allowFNAWSkins", allowFNAWSkins);
jsonObject.put("localStorageNamespace", localStorageNamespace);
JSONArray serversArr = new JSONArray();
for (int i = 0, l = defaultServers.size(); i < l; ++i) {
DefaultServer srv = defaultServers.get(i);

View File

@ -0,0 +1,108 @@
package net.lax1dude.eaglercraft.v1_8.internal.teavm;
import java.util.function.Supplier;
import org.teavm.interop.Async;
import org.teavm.interop.AsyncCallback;
import org.teavm.jso.JSFunctor;
import org.teavm.jso.JSObject;
import org.teavm.jso.browser.Window;
import net.lax1dude.eaglercraft.v1_8.internal.IClientConfigAdapterHooks;
import net.lax1dude.eaglercraft.v1_8.internal.teavm.opts.JSEaglercraftXOptsHooks;
import net.lax1dude.eaglercraft.v1_8.log4j.LogManager;
import net.lax1dude.eaglercraft.v1_8.log4j.Logger;
/**
* 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 class TeaVMClientConfigAdapterHooks implements IClientConfigAdapterHooks {
private static final Logger logger = LogManager.getLogger("TeaVMClientConfigAdapterHooks");
private LocalStorageSaveHook saveHook = null;
private LocalStorageLoadHook loadHook = null;
@JSFunctor
private static interface LocalStorageSaveHook extends JSObject {
void call(String key, String base64);
}
@Override
public void callLocalStorageSavedHook(String key, String base64) {
if (saveHook != null) {
callHookSafe("localStorageSaved", () -> {
saveHook.call(key, base64);
});
}
}
@JSFunctor
private static interface LocalStorageLoadHook extends JSObject {
String call(String key);
}
@Override
public String callLocalStorageLoadHook(String key) {
if (loadHook != null) {
return (String) callHookSafeWithReturn("localStorageLoaded", () -> {
return loadHook.call(key);
});
} else {
return null;
}
}
private static void callHookSafe(String identifer, Runnable hooker) {
Window.setTimeout(() -> {
try {
hooker.run();
} catch (Throwable t) {
logger.error("Caught exception while invoking eaglercraftXOpts \"{}\" hook!", identifer);
logger.error(t);
}
}, 0);
}
@Async
private static native Object callHookSafeWithReturn(String identifer, Supplier<Object> hooker);
private static void callHookSafeWithReturn(String identifer, Supplier<Object> hooker,
final AsyncCallback<Object> cb) {
Window.setTimeout(() -> {
Object res = null;
try {
res = hooker.get();
} catch (Throwable t) {
logger.error("Caught exception while invoking eaglercraftXOpts \"{}\" hook!", identifer);
logger.error(t);
} finally {
cb.complete(res);
}
}, 0);
}
public void loadHooks(JSEaglercraftXOptsHooks hooks) {
saveHook = (LocalStorageSaveHook) hooks.getLocalStorageSavedHook();
loadHook = (LocalStorageLoadHook) hooks.getLocalStorageLoadedHook();
}
}

View File

@ -7,14 +7,21 @@ import org.teavm.jso.JSProperty;
/**
* Copyright (c) 2024 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* 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)
* 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.
*
@ -22,7 +29,7 @@ import org.teavm.jso.JSProperty;
public interface JSEaglercraftXOptsAssetsURIsArray extends JSObject {
@JSIndexer
JSEaglercraftXOptsAssetsURI get(int idx);
JSEaglercraftXOptsHooks get(int idx);
@JSProperty
int getLength();

View File

@ -1,30 +1,36 @@
package net.lax1dude.eaglercraft.v1_8.internal.teavm.opts;
import org.teavm.jso.JSIndexer;
import org.teavm.jso.JSBody;
import org.teavm.jso.JSObject;
import org.teavm.jso.JSProperty;
/**
* Copyright (c) 2024 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* 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)
* 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 JSEaglercraftXOptsServersArray extends JSObject {
public abstract class JSEaglercraftXOptsHooks implements JSObject {
@JSIndexer
JSEaglercraftXOptsServer get(int idx);
@JSBody(script = "return (typeof this.localStorageSaved === \"function\") ? this.localStorageSaved : null;")
public native JSObject getLocalStorageSavedHook();
@JSProperty
int getLength();
@JSBody(script = "return (typeof this.localStorageLoaded === \"function\") ? this.localStorageLoaded : null;")
public native JSObject getLocalStorageLoadedHook();
}

View File

@ -2,18 +2,26 @@ package net.lax1dude.eaglercraft.v1_8.internal.teavm.opts;
import org.teavm.jso.JSBody;
import org.teavm.jso.JSObject;
import org.teavm.jso.core.JSArrayReader;
/**
* Copyright (c) 2024 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* 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)
* 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.
*
@ -27,7 +35,7 @@ public abstract class JSEaglercraftXOptsRoot implements JSObject {
public native String getAssetsURI();
@JSBody(script = "return (typeof this.assetsURI === \"object\") ? this.assetsURI : null;")
public native JSEaglercraftXOptsAssetsURIsArray getAssetsURIArray();
public native JSArrayReader<JSEaglercraftXOptsAssetsURI> getAssetsURIArray();
@JSBody(params = { "def" }, script = "return (typeof this.lang === \"string\") ? this.lang : def;")
public native String getLang(String defaultValue);
@ -41,45 +49,68 @@ public abstract class JSEaglercraftXOptsRoot implements JSObject {
@JSBody(params = { "def" }, script = "return (typeof this.worldsDB === \"string\") ? this.worldsDB : def;")
public native String getWorldsDB(String defaultValue);
@JSBody(params = { "def" }, script = "return (typeof this.resourcePacksDB === \"string\") ? this.resourcePacksDB : def;")
@JSBody(params = {
"def" }, script = "return (typeof this.resourcePacksDB === \"string\") ? this.resourcePacksDB : def;")
public native String getResourcePacksDB(String defaultValue);
@JSBody(params = { "def" }, script = "return (typeof this.demoMode === \"boolean\") ? this.demoMode : def;")
public native boolean getDemoMode(boolean defaultValue);
@JSBody(script = "return (typeof this.servers === \"object\") ? this.servers : null;")
public native JSEaglercraftXOptsServersArray getServers();
public native JSArrayReader<JSEaglercraftXOptsServer> getServers();
@JSBody(script = "return (typeof this.relays === \"object\") ? this.relays : null;")
public native JSEaglercraftXOptsRelaysArray getRelays();
public native JSArrayReader<JSEaglercraftXOptsRelay> getRelays();
@JSBody(params = { "def" }, script = "return (typeof this.checkShaderGLErrors === \"boolean\") ? this.checkShaderGLErrors : def;")
@JSBody(params = {
"def" }, script = "return (typeof this.checkShaderGLErrors === \"boolean\") ? this.checkShaderGLErrors : def;")
public native boolean getCheckShaderGLErrors(boolean defaultValue);
@JSBody(params = { "def" }, script = "return (typeof this.enableDownloadOfflineButton === \"boolean\") ? this.enableDownloadOfflineButton : def;")
@JSBody(params = {
"def" }, script = "return (typeof this.enableDownloadOfflineButton === \"boolean\") ? this.enableDownloadOfflineButton : def;")
public native boolean getEnableDownloadOfflineButton(boolean defaultValue);
@JSBody(params = { "def" }, script = "return (typeof this.downloadOfflineButtonLink === \"string\") ? this.downloadOfflineButtonLink : def;")
@JSBody(params = {
"def" }, script = "return (typeof this.downloadOfflineButtonLink === \"string\") ? this.downloadOfflineButtonLink : def;")
public native String getDownloadOfflineButtonLink(String defaultValue);
@JSBody(params = { "def" }, script = "return (typeof this.html5CursorSupport === \"boolean\") ? this.html5CursorSupport : def;")
@JSBody(params = {
"def" }, script = "return (typeof this.html5CursorSupport === \"boolean\") ? this.html5CursorSupport : def;")
public native boolean getHtml5CursorSupport(boolean defaultValue);
@JSBody(params = { "def" }, script = "return (typeof this.allowUpdateSvc === \"boolean\") ? this.allowUpdateSvc : def;")
@JSBody(params = {
"def" }, script = "return (typeof this.allowUpdateSvc === \"boolean\") ? this.allowUpdateSvc : def;")
public native boolean getAllowUpdateSvc(boolean defaultValue);
@JSBody(params = { "def" }, script = "return (typeof this.allowUpdateDL === \"boolean\") ? this.allowUpdateDL : def;")
@JSBody(params = {
"def" }, script = "return (typeof this.allowUpdateDL === \"boolean\") ? this.allowUpdateDL : def;")
public native boolean getAllowUpdateDL(boolean defaultValue);
@JSBody(params = { "def" }, script = "return (typeof this.logInvalidCerts === \"boolean\") ? this.logInvalidCerts : def;")
@JSBody(params = {
"def" }, script = "return (typeof this.logInvalidCerts === \"boolean\") ? this.logInvalidCerts : def;")
public native boolean getLogInvalidCerts(boolean defaultValue);
@JSBody(params = { "def" }, script = "return (typeof this.enableSignatureBadge === \"boolean\") ? this.enableSignatureBadge : def;")
@JSBody(params = {
"def" }, script = "return (typeof this.enableSignatureBadge === \"boolean\") ? this.enableSignatureBadge : def;")
public native boolean getEnableSignatureBadge(boolean defaultValue);
@JSBody(params = { "def" }, script = "return (typeof this.checkRelaysForUpdates === \"boolean\") ? this.checkRelaysForUpdates : def;")
@JSBody(params = {
"def" }, script = "return (typeof this.checkRelaysForUpdates === \"boolean\") ? this.checkRelaysForUpdates : def;")
public native boolean getCheckRelaysForUpdates(boolean defaultValue);
@JSBody(params = { "def" }, script = "return (typeof this.allowVoiceClient === \"boolean\") ? this.allowVoiceClient : def;")
@JSBody(params = {
"def" }, script = "return (typeof this.allowVoiceClient === \"boolean\") ? this.allowVoiceClient : def;")
public native boolean getAllowVoiceClient(boolean defaultValue);
@JSBody(params = {
"def" }, script = "return (typeof this.allowFNAWSkins === \"boolean\") ? this.allowFNAWSkins : def;")
public native boolean getAllowFNAWSkins(boolean defaultValue);
@JSBody(script = "return (typeof this.hooks === \"object\") ? this.hooks : null;")
public native JSEaglercraftXOptsHooks getHooks();
@JSBody(params = {
"def" }, script = "return (typeof this.localStorageNamespace === \"string\") ? this.localStorageNamespace : def;")
public native String getLocalStorageNamespace(String defaultValue);
}

View File

@ -18,16 +18,24 @@ import net.lax1dude.eaglercraft.v1_8.sp.server.EaglerIntegratedServerWorker;
import net.lax1dude.eaglercraft.v1_8.sp.server.internal.ServerPlatformSingleplayer;
/**
* Copyright (c) 2023-2024 lax1dude, hoosiertransfer, ayunami2000. All Rights Reserved.
* Copyright (c) 2023-2024 lax1dude, hoosiertransfer, ayunami2000. All Rights
* Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* 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)
* 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.
*
@ -57,8 +65,11 @@ public class WorkerMain {
__println(systemErr, true, "WorkerMain: [ERROR] uncaught exception thrown!");
EaglerIntegratedServerWorker.sendLogMessagePacket(EagRuntime.getStackTrace(t), true);
EagRuntime.debugPrintStackTraceToSTDERR(t);
EaglerIntegratedServerWorker.sendIPCPacket(new IPCPacket15Crashed("UNCAUGHT EXCEPTION CAUGHT IN WORKER PROCESS!\n\n" + EagRuntime.getStackTrace(t)));
EaglerIntegratedServerWorker.sendIPCPacket(new IPCPacketFFProcessKeepAlive(IPCPacketFFProcessKeepAlive.EXITED));
EaglerIntegratedServerWorker.sendIPCPacket(new IPCPacket15Crashed(
"UNCAUGHT EXCEPTION CAUGHT IN WORKER PROCESS!\n\n" + EagRuntime.getStackTrace(t)));
EaglerIntegratedServerWorker
.sendIPCPacket(new IPCPacketFFProcessKeepAlive(IPCPacketFFProcessKeepAlive.EXITED));
} finally {
__println(systemErr, true, "WorkerMain: [ERROR] eaglercraftx worker thread has exited");
}