This commit is contained in:
radmanplays 2024-06-05 21:14:45 +03:30
parent cdc2ca0d3c
commit 0719ea1eba
25 changed files with 37768 additions and 1542 deletions

View File

@ -16,12 +16,15 @@
~ import net.lax1dude.eaglercraft.v1_8.EaglercraftRandom;
~ import net.lax1dude.eaglercraft.v1_8.HString;
> INSERT 1 : 28 @ 1
> INSERT 1 : 31 @ 1
+
+ import com.google.common.base.Predicate;
+ import com.google.common.base.Predicates;
+
+ import net.eaglerforge.api.BaseData;
+ import net.eaglerforge.api.ModAPI;
+ import net.eaglerforge.api.ModData;
+ import net.lax1dude.eaglercraft.v1_8.Display;
+ import net.lax1dude.eaglercraft.v1_8.Mouse;
+ import net.lax1dude.eaglercraft.v1_8.log4j.LogManager;
@ -144,7 +147,11 @@
~ f = this.mc.isZoomKey ? this.mc.adjustedZoomValue : this.mc.gameSettings.fovSetting;
> CHANGE 169 : 173 @ 169 : 172
> CHANGE 155 : 156 @ 155 : 156
~ public void setupCameraTransform(float partialTicks, int pass) {
> CHANGE 13 : 17 @ 13 : 16
~ float farPlane = this.farPlaneDistance * 2.0f * MathHelper.SQRT_2;
~ GlStateManager.gluPerspective(currentProjMatrixFOV = this.getFOVModifier(partialTicks, true),
@ -339,7 +346,14 @@
~ effectrenderer.renderParticles(entity, partialTicks, 2);
> CHANGE 44 : 45 @ 44 : 45
> INSERT 30 : 34 @ 30
+ BaseData eventData = new ModData();
+ eventData.set("partialTicks", partialTicks);
+ ModAPI.callEvent("render", eventData);
+
> CHANGE 14 : 15 @ 14 : 15
~ GlStateManager.gluPerspective(this.getFOVModifier(partialTicks, true),

View File

@ -14,7 +14,11 @@
+ import net.lax1dude.eaglercraft.v1_8.opengl.EaglercraftGPU;
+
> CHANGE 8 : 16 @ 8 : 10
> INSERT 6 : 7 @ 6
+ protected boolean hasAllocated;
> CHANGE 2 : 10 @ 2 : 4
~ if (blur != parFlag || mipmap != parFlag2) {
~ this.blur = parFlag;
@ -30,4 +34,25 @@
~ EaglercraftGPU.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, i);
~ EaglercraftGPU.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, short1);
> INSERT 15 : 16 @ 15
+ hasAllocated = false;
> INSERT 12 : 26 @ 12
+
+ /**
+ * This function is needed due to EaglercraftX's use of glTexStorage2D to
+ * allocate memory for textures, some OpenGL implementations don't like it when
+ * you call glTexStorage2D on the same texture object more than once
+ */
+ protected void regenerateIfNotAllocated() {
+ if (this.glTextureId != -1) {
+ if (hasAllocated) {
+ EaglercraftGPU.regenerateTexture(glTextureId);
+ }
+ hasAllocated = true;
+ }
+ }
> EOF

View File

@ -18,4 +18,8 @@
~ this(bufferedImage.width, bufferedImage.height);
~ System.arraycopy(bufferedImage.pixels, 0, dynamicTextureData, 0, bufferedImage.pixels.length);
> INSERT 7 : 8 @ 7
+ this.hasAllocated = true;
> EOF

View File

@ -54,4 +54,8 @@
~ bufferedimage.drawLayer(bufferedimage2, 0, 0, bufferedimage2.width, bufferedimage2.height, 0, 0,
~ bufferedimage2.width, bufferedimage2.height);
> INSERT 8 : 9 @ 8
+ regenerateIfNotAllocated();
> EOF

View File

@ -40,4 +40,8 @@
~ bufferedimage.drawLayer(bufferedimage1, 0, 0, bufferedimage1.width, bufferedimage1.height, 0, 0,
~ bufferedimage1.width, bufferedimage1.height);
> INSERT 7 : 8 @ 7
+ regenerateIfNotAllocated();
> EOF

View File

@ -20,4 +20,8 @@
~ ImageData bufferedimage = TextureUtil.readBufferedImage(inputstream);
> INSERT 15 : 16 @ 15
+ regenerateIfNotAllocated();
> EOF

View File

@ -43,7 +43,7 @@
~ private final Map<String, EaglerTextureAtlasSprite> mapRegisteredSprites;
~ private final Map<String, EaglerTextureAtlasSprite> mapUploadedSprites;
> CHANGE 3 : 9 @ 3 : 4
> CHANGE 3 : 10 @ 3 : 4
~ private final EaglerTextureAtlasSprite missingImage;
~ private final EaglerTextureAtlasSpritePBR missingImagePBR;
@ -51,6 +51,7 @@
~ private int height;
~ private boolean isEaglerPBRMode = false;
~ public int eaglerPBRMaterialTexture = -1;
~ private boolean hasAllocatedEaglerPBRMaterialTexture = false;
> INSERT 1 : 7 @ 1
@ -114,7 +115,7 @@
+ }
+
> INSERT 8 : 43 @ 8
> INSERT 8 : 44 @ 8
+ if (copyColorFramebuffer != null) {
+ for (int l = 0; l < copyColorFramebuffer.length; ++l) {
@ -126,6 +127,7 @@
+ if (isEaglerPBRMode) {
+ if (eaglerPBRMaterialTexture == -1) {
+ eaglerPBRMaterialTexture = GlStateManager.generateTexture();
+ hasAllocatedEaglerPBRMaterialTexture = false;
+ }
+ if (copyMaterialFramebuffer == null) {
+ GlStateManager.bindTexture(eaglerPBRMaterialTexture);
@ -302,9 +304,17 @@
~ stitcher.addSprite(this.missingImage);
~ }
> INSERT 11 : 28 @ 11
> INSERT 9 : 10 @ 9
+ regenerateIfNotAllocated();
> INSERT 2 : 23 @ 2
+ if (isEaglerPBRMode) {
+ if (hasAllocatedEaglerPBRMaterialTexture) {
+ EaglercraftGPU.regenerateTexture(eaglerPBRMaterialTexture);
+ }
+ hasAllocatedEaglerPBRMaterialTexture = true;
+ TextureUtil.allocateTextureImpl(eaglerPBRMaterialTexture, this.mipmapLevels, stitcher.getCurrentWidth(),
+ stitcher.getCurrentHeight() * 2);
+ }

View File

@ -111,7 +111,7 @@
+ public static int[] convertComponentOrder(int[] arr) {
+ for (int i = 0; i < arr.length; ++i) {
+ int j = arr[i];
+ arr[i] = (j & 0xFF000000) | ((j >> 16) & 0xFF) | (j & 0xFF00) | ((j << 16) & 0xFF0000);
+ arr[i] = ((j >> 16) & 0xFF) | (j & 0xFF00FF00) | ((j << 16) & 0xFF0000);
+ }
+ return arr;
+ }

View File

@ -15,7 +15,12 @@
> DELETE 6 @ 6 : 8
> INSERT 128 : 158 @ 128
> INSERT 104 : 106 @ 104
+ protected abstract String getEaglerFolderName();
+
> INSERT 24 : 54 @ 24
+ private void proceedWithBs(int l, boolean deleteInstead) {
+ if (!deleteInstead && l != 1) {
@ -40,7 +45,7 @@
+ if (deleteInstead) {
+ this.mc.loadingScreen.eaglerShow(I18n.format("resourcePack.load.deleting"), this.func_148312_b());
+ EaglerFolderResourcePack.deleteResourcePack(EaglerFolderResourcePack.RESOURCE_PACKS,
+ this.func_148312_b());
+ this.getEaglerFolderName());
+ } else {
+ this.resourcePacksGUI.getSelectedResourcePacks().add(0, this);
+ }

View File

@ -23,4 +23,12 @@
~ } catch (JSONException jsonparseexception) {
> INSERT 35 : 40 @ 35
+
+ @Override
+ protected String getEaglerFolderName() {
+ return null;
+ }
> EOF

View File

@ -11,4 +11,12 @@
~ return this.field_148319_c.getResourcePackEaglerDisplayName();
> INSERT 5 : 10 @ 5
+
+ @Override
+ protected String getEaglerFolderName() {
+ return field_148319_c.getResourcePackName();
+ }
> EOF

View File

@ -95,6 +95,7 @@ public class ModAPI {
newEvent("sendchatmessage");
newEvent("update");
newEvent("frame");
newEvent("render");
/*newEvent("packetjoingame");
newEvent("packetspawnobject");

File diff suppressed because it is too large Load Diff

View File

@ -23,7 +23,7 @@ public class EaglercraftVersion {
public static final String projectOriginName = "EaglercraftX";
public static final String projectOriginAuthor = "lax1dude";
public static final String projectOriginRevision = "1.8";
public static final String projectOriginVersion = "u31";
public static final String projectOriginVersion = "u32";
public static final String projectOriginURL = "https://gitlab.com/lax1dude/eaglercraftx-1.8"; // rest in peace

View File

@ -60,6 +60,10 @@ public class GLObjectMap<T> {
return (T) values[obj];
}
public void set(int obj, T val) {
values[obj] = val;
}
private void resize() {
int oldSize = size;
size += size / 2;

View File

@ -153,11 +153,12 @@ public class EaglerFolderResourcePack extends AbstractResourcePack {
List<String> fileNames = Lists.newArrayList();
logger.info("Counting files...");
ZipInputStream ziss = new ZipInputStream(new EaglerInputStream(file));
ZipEntry zipEntry;
while ((zipEntry = ziss.getNextEntry()) != null) {
if (!zipEntry.isDirectory()) {
fileNames.add(zipEntry.getName());
try(ZipInputStream ziss = new ZipInputStream(new EaglerInputStream(file))) {
while ((zipEntry = ziss.getNextEntry()) != null) {
if (!zipEntry.isDirectory()) {
fileNames.add(zipEntry.getName());
}
}
}
@ -195,22 +196,30 @@ public class EaglerFolderResourcePack extends AbstractResourcePack {
int totalSize = 0;
int totalFiles = 0;
int lastProg = 0;
ziss = new ZipInputStream(new EaglerInputStream(file));
while ((zipEntry = ziss.getNextEntry()) != null) {
if (!zipEntry.isDirectory()) {
fn = zipEntry.getName();
if(fn.length() > prefixLen) {
byte[] buffer = new byte[(int)zipEntry.getSize()];
int i = 0, j;
while(i < buffer.length && (j = ziss.read(buffer, i, buffer.length - i)) != -1) {
i += j;
}
(new VFile2(prefix, folderName, fn.substring(prefixLen))).setAllBytes(buffer);
totalSize += buffer.length;
++totalFiles;
if(totalSize - lastProg > 25000) {
lastProg = totalSize;
logger.info("Extracted {} files, {} bytes from ZIP file...", totalFiles, totalSize);
try(ZipInputStream ziss = new ZipInputStream(new EaglerInputStream(file))) {
int sz;
while ((zipEntry = ziss.getNextEntry()) != null) {
if (!zipEntry.isDirectory()) {
fn = zipEntry.getName();
if(fn.length() > prefixLen) {
byte[] buffer;
sz = (int)zipEntry.getSize();
if(sz >= 0) {
buffer = new byte[sz];
int i = 0, j;
while(i < buffer.length && (j = ziss.read(buffer, i, buffer.length - i)) != -1) {
i += j;
}
}else {
buffer = EaglerInputStream.inputStreamToBytes(ziss);
}
(new VFile2(prefix, folderName, fn.substring(prefixLen))).setAllBytes(buffer);
totalSize += buffer.length;
++totalFiles;
if(totalSize - lastProg > 25000) {
lastProg = totalSize;
logger.info("Extracted {} files, {} bytes from ZIP file...", totalFiles, totalSize);
}
}
}
}

View File

@ -488,6 +488,17 @@ public class EaglercraftGPU {
return mapTexturesGL.get(tex);
}
public static final void regenerateTexture(int tex) {
ITextureGL webglTex = mapTexturesGL.get(tex);
if(webglTex != null) {
GlStateManager.unbindTextureIfCached(tex);
_wglDeleteTextures(webglTex);
mapTexturesGL.set(tex, _wglGenTextures());
}else {
logger.error("Tried to regenerate a missing texture!");
}
}
public static final void drawHighPoly(HighPolyMesh mesh) {
if(mesh.vertexCount == 0 || mesh.indexCount == 0 || mesh.vertexArray == null) {
return;

View File

@ -591,18 +591,25 @@ public class GlStateManager extends ModData {
}
public static final void deleteTexture(int texture) {
unbindTextureIfCached(texture);
_wglDeleteTextures(EaglercraftGPU.mapTexturesGL.free(texture));
boolean f = false;
}
static final void unbindTextureIfCached(int texture) {
boolean f1, f2 = false;
for(int i = 0; i < boundTexture.length; ++i) {
if(boundTexture[i] == texture) {
_wglActiveTexture(GL_TEXTURE0 + i);
f1 = i != activeTexture;
if(f2 || f1) {
_wglActiveTexture(GL_TEXTURE0 + i);
f2 = f1;
}
_wglBindTexture(GL_TEXTURE_2D, null);
_wglBindTexture(GL_TEXTURE_3D, null);
boundTexture[i] = -1;
f = true;
}
}
if(f) {
if(f2) {
_wglActiveTexture(GL_TEXTURE0 + activeTexture);
}
}

View File

@ -2058,7 +2058,7 @@ public class EaglerDeferredPipeline {
GlStateManager.disableBlend();
if(reprojectionEngineEnable || config.realisticWater) {
if(reprojectionEngineEnable || config.is_rendering_realisticWater) {
// =========== SAVE REPROJECTION DATA FOR NEXT FRAME ============= //

View File

@ -74,13 +74,17 @@ public class WorldConverterMCA {
if (f.isDirectory()) continue;
String lowerName = f.getName().toLowerCase();
if (!(lowerName.endsWith(".dat") || lowerName.endsWith(".dat_old") || lowerName.endsWith(".mca") || lowerName.endsWith(".mcr") || lowerName.endsWith(".bmp"))) continue;
EaglerOutputStream baos = new EaglerOutputStream();
int len;
while ((len = zis.read(bb)) != -1) {
baos.write(bb, 0, len);
byte[] b;
int sz = (int)f.getSize();
if(sz >= 0) {
b = new byte[sz];
int j = 0, k;
while(j < b.length && (k = zis.read(b, j, b.length - j)) != -1) {
j += k;
}
}else {
b = EaglerInputStream.inputStreamToBytes(zis);
}
baos.close();
byte[] b = baos.toByteArray();
String fileName = f.getName().substring(folderPrefixOffset);
if (fileName.equals("level.dat") || fileName.equals("level.dat_old")) {
NBTTagCompound worldDatNBT = CompressedStreamTools.readCompressed(new EaglerInputStream(b));

View File

@ -44,6 +44,27 @@ window.eaglercraftXOptsHints = {
<script type="text/javascript">
"use strict";
(function(){
function fetchB64PayloadSafe() {
const dataURL = window.eaglercraftXClientBundle;
if(!dataURL.startsWith("data:application/octet-stream;base64,")) {
return fetch(dataURL, { cache: "force-cache" }).then((response) => response.blob());
}
return new Promise((resolve) => {
fetch(dataURL)
.then((response) => response.blob())
.then((blob) => { resolve(blob); })
.catch((err) => {
console.error("Caught an error decoding base64 via fetch, doing it the slow way instead...");
// MIT License - https://github.com/beatgammit/base64-js
const base64js = (function(){return function(){function b(d,e,g){function a(j,i){if(!e[j]){if(!d[j]){var f="function"==typeof require&&require;if(!i&&f)return f(j,!0);if(h)return h(j,!0);var c=new Error("Cannot find module '"+j+"'");throw c.code="MODULE_NOT_FOUND",c}var k=e[j]={exports:{}};d[j][0].call(k.exports,function(b){var c=d[j][1][b];return a(c||b)},k,k.exports,b,d,e,g)}return e[j].exports}for(var h="function"==typeof require&&require,c=0;c<g.length;c++)a(g[c]);return a}return b}()({"/":[function(a,b,c){"use strict";function d(a){var b=a.length;if(0<b%4)throw new Error("Invalid string. Length must be a multiple of 4");var c=a.indexOf("=");-1===c&&(c=b);var d=c===b?0:4-c%4;return[c,d]}function e(a,b,c){return 3*(b+c)/4-c}function f(a){var b,c,f=d(a),g=f[0],j=f[1],k=new Uint8Array(e(a,g,j)),l=0,m=0<j?g-4:g;for(c=0;c<m;c+=4)b=h[a.charCodeAt(c)]<<18|h[a.charCodeAt(c+1)]<<12|h[a.charCodeAt(c+2)]<<6|h[a.charCodeAt(c+3)],k[l++]=255&b>>16,k[l++]=255&b>>8,k[l++]=255&b;return 2===j&&(b=h[a.charCodeAt(c)]<<2|h[a.charCodeAt(c+1)]>>4,k[l++]=255&b),1===j&&(b=h[a.charCodeAt(c)]<<10|h[a.charCodeAt(c+1)]<<4|h[a.charCodeAt(c+2)]>>2,k[l++]=255&b>>8,k[l++]=255&b),k}c.byteLength=function b(a){var c=d(a),e=c[0],f=c[1];return 3*(e+f)/4-f},c.toByteArray=f;for(var g=[],h=[],j="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",k=0,l=j.length;k<l;++k)g[k]=j[k],h[j.charCodeAt(k)]=k;h[45]=62,h[95]=63},{}]},{},[])("/")})();
const bytesDec = base64js.toByteArray(dataURL.substring(37)).buffer;
const bytesBlob = new Blob([bytesDec], { type: "application/octet-stream" });
window.eaglercraftXClientBundle = URL.createObjectURL(bytesBlob);
console.error("Created " + bytesDec.byteLength + " byte object URL: " + window.eaglercraftXClientBundle);
resolve(bytesBlob);
});
});
}
var ds = new DecompressionStream("gzip");
var result = [];
function fetchStream(reader) {
@ -58,9 +79,7 @@ window.eaglercraftXOptsHints = {
return reader.read().then(processData);
});
}
fetch(window.eaglercraftXClientBundle, { cache: "force-cache" })
.then((response) => response.blob())
.then((blob) => fetchStream(blob.stream().pipeThrough(ds).getReader()));
fetchB64PayloadSafe().then((blob) => fetchStream(blob.stream().pipeThrough(ds).getReader()));
})();
</script>
<script type="text/javascript">

View File

@ -11,6 +11,7 @@
- Made the integrated PBR resource pack
- Wrote all desktop emulation code
- Wrote EaglercraftXBungee
- Wrote EaglercraftXVelocity
- Wrote WebRTC relay server
- Wrote voice chat server
- Wrote the patch and build system
@ -20,6 +21,7 @@
- Many bug fixes
- WebRTC LAN worlds
- WebRTC voice chat
- Made velocity plugin work
- Added resource packs
- Added screen recording
- Added seamless fullscreen
@ -584,6 +586,44 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Project Name: BungeeCord
Project Author: md_5
Project URL: https://www.spigotmc.org/go/bungeecord/
Used For: parsing YAML config files in EaglercraftXVelocity
* Copyright (c) 2012, md_5. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* The name of the author may not be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* You may not use the software for commercial software hosting services without
* written permission from the author.
*
* 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 OWNER 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.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Project Name: 3D Sound System
Project Author: Paul Lamb
Project URL: http://www.paulscode.com/forum/index.php?topic=4.0

View File

@ -1 +1 @@
{"pluginName":"EaglercraftXBungee","pluginVersion":"1.2.1","pluginButton":"Download \"EaglerXBungee-1.2.1.jar\"","pluginFilename":"EaglerXBungee.zip"}
{"pluginName":"EaglercraftXBungee","pluginVersion":"1.2.3","pluginButton":"Download \"EaglerXBungee-1.2.3.jar\"","pluginFilename":"EaglerXBungee.zip"}

View File

@ -7,6 +7,7 @@ import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.function.Consumer;
import net.lax1dude.eaglercraft.v1_8.Base64;
import net.lax1dude.eaglercraft.v1_8.EagRuntime;
import net.lax1dude.eaglercraft.v1_8.EaglercraftVersion;
import net.lax1dude.eaglercraft.v1_8.profile.EaglerProfile;
@ -377,10 +378,26 @@ public class PlatformRuntime {
}
@Async
public static native ArrayBuffer downloadRemoteURI(String assetPackageURI, boolean forceCache);
public static native ArrayBuffer downloadRemoteURI(final String assetPackageURI, final boolean forceCache);
private static void downloadRemoteURI(String assetPackageURI, boolean useCache, final AsyncCallback<ArrayBuffer> cb) {
doFetchDownload(assetPackageURI, useCache ? "force-cache" : "no-store", cb::complete);
private static void downloadRemoteURI(final String assetPackageURI, final boolean useCache, final AsyncCallback<ArrayBuffer> cb) {
doFetchDownload(assetPackageURI, useCache ? "force-cache" : "no-store",
assetPackageURI.startsWith("data:application/octet-stream;base64,") ? (data) -> {
if(data != null) {
cb.complete(data);
}else {
logger.error("Caught an error decoding base64 via fetch, doing it the slow way instead...");
byte[] b = null;
try {
b = Base64.decodeBase64(assetPackageURI.substring(37));
}catch(Throwable t) {
logger.error("Failed to manually decode base64!", t);
cb.complete(null);
return;
}
cb.complete(TeaVMUtils.unwrapArrayBuffer(b));
}
} : cb::complete);
}
public static boolean isDebugRuntime() {