This commit is contained in:
eaglercraft 2024-12-04 00:39:49 -08:00
commit c67fe4733e
211 changed files with 33946 additions and 171 deletions

View file

@ -43,6 +43,7 @@ import net.lax1dude.eaglercraft.v1_8.minecraft.EaglerFolderResourcePack;
import net.lax1dude.eaglercraft.v1_8.minecraft.EaglerFontRenderer;
import net.lax1dude.eaglercraft.v1_8.minecraft.EnumInputEvent;
import net.lax1dude.eaglercraft.v1_8.minecraft.GuiScreenGenericErrorMessage;
import net.lax1dude.eaglercraft.v1_8.minecraft.GuiScreenVSyncReEnabled;
import net.lax1dude.eaglercraft.v1_8.minecraft.GuiScreenVideoSettingsWarning;
import net.lax1dude.eaglercraft.v1_8.notifications.ServerNotificationRenderer;
import net.lax1dude.eaglercraft.v1_8.opengl.EaglerMeshLoader;
@ -524,15 +525,26 @@ public class Minecraft implements IThreadListener {
mainMenu = new GuiConnecting(mainMenu, this, this.serverName, this.serverPort);
}
mainMenu = new GuiScreenEditProfile(mainMenu);
if (!EagRuntime.getConfiguration().isForceProfanityFilter() && !gameSettings.hasShownProfanityFilter) {
mainMenu = new GuiScreenContentWarning(mainMenu);
}
boolean vsyncScreen = false;
if (EagRuntime.getConfiguration().isEnforceVSync() && Display.isVSyncSupported() && !gameSettings.enableVsync) {
gameSettings.enableVsync = true;
gameSettings.saveOptions();
vsyncScreen = true;
}
int vidIssues = gameSettings.checkBadVideoSettings();
if (vidIssues != 0) {
mainMenu = new GuiScreenVideoSettingsWarning(mainMenu, vidIssues);
}
mainMenu = new GuiScreenEditProfile(mainMenu);
if (!EagRuntime.getConfiguration().isForceProfanityFilter() && !gameSettings.hasShownProfanityFilter) {
mainMenu = new GuiScreenContentWarning(mainMenu);
if (vsyncScreen) {
mainMenu = new GuiScreenVSyncReEnabled(mainMenu);
}
this.displayGuiScreen(mainMenu);

View file

@ -430,7 +430,7 @@ public class GuiOverlayDebug extends Gui {
protected List<String> getDebugInfoRight() {
ArrayList arraylist;
if (EagRuntime.getPlatformType() != EnumPlatformType.JAVASCRIPT) {
if (EagRuntime.getPlatformType() == EnumPlatformType.DESKTOP) {
long i = EagRuntime.maxMemory();
long j = EagRuntime.totalMemory();
long k = EagRuntime.freeMemory();

View file

@ -118,7 +118,7 @@ public abstract class GuiScreen extends Gui implements GuiYesNoCallback {
long millis = EagRuntime.steadyTimeMillis();
long closeKeyTimeout = millis - showingCloseKey;
if (closeKeyTimeout < 3000l) {
if (closeKeyTimeout < 3000l && showingCloseKey != 0l) {
int alpha1 = 0xC0000000;
int alpha2 = 0xFF000000;
if (closeKeyTimeout > 2500l) {

View file

@ -374,92 +374,119 @@ public class NetHandlerPlayClient implements INetHandlerPlayClient {
double d0 = (double) packetIn.getX() / 32.0D;
double d1 = (double) packetIn.getY() / 32.0D;
double d2 = (double) packetIn.getZ() / 32.0D;
Object object = null;
if (packetIn.getType() == 10) {
Entity object = null;
boolean b = false;
switch (packetIn.getType()) {
case 10:
object = EntityMinecart.func_180458_a(this.clientWorldController, d0, d1, d2,
EntityMinecart.EnumMinecartType.byNetworkID(packetIn.func_149009_m()));
} else if (packetIn.getType() == 90) {
break;
case 90:
b = true;
Entity entity = this.clientWorldController.getEntityByID(packetIn.func_149009_m());
if (entity instanceof EntityPlayer) {
object = new EntityFishHook(this.clientWorldController, d0, d1, d2, (EntityPlayer) entity);
}
packetIn.func_149002_g(0);
} else if (packetIn.getType() == 60) {
break;
case 60:
object = new EntityArrow(this.clientWorldController, d0, d1, d2);
} else if (packetIn.getType() == 61) {
break;
case 61:
object = new EntitySnowball(this.clientWorldController, d0, d1, d2);
} else if (packetIn.getType() == 71) {
break;
case 71:
b = true;
object = new EntityItemFrame(this.clientWorldController,
new BlockPos(MathHelper.floor_double(d0), MathHelper.floor_double(d1), MathHelper.floor_double(d2)),
EnumFacing.getHorizontal(packetIn.func_149009_m()));
packetIn.func_149002_g(0);
} else if (packetIn.getType() == 77) {
break;
case 77:
b = true;
object = new EntityLeashKnot(this.clientWorldController, new BlockPos(MathHelper.floor_double(d0),
MathHelper.floor_double(d1), MathHelper.floor_double(d2)));
packetIn.func_149002_g(0);
} else if (packetIn.getType() == 65) {
break;
case 65:
object = new EntityEnderPearl(this.clientWorldController, d0, d1, d2);
} else if (packetIn.getType() == 72) {
break;
case 72:
object = new EntityEnderEye(this.clientWorldController, d0, d1, d2);
} else if (packetIn.getType() == 76) {
break;
case 76:
object = new EntityFireworkRocket(this.clientWorldController, d0, d1, d2, (ItemStack) null);
} else if (packetIn.getType() == 63) {
break;
case 63:
b = true;
object = new EntityLargeFireball(this.clientWorldController, d0, d1, d2,
(double) packetIn.getSpeedX() / 8000.0D, (double) packetIn.getSpeedY() / 8000.0D,
(double) packetIn.getSpeedZ() / 8000.0D);
packetIn.func_149002_g(0);
} else if (packetIn.getType() == 64) {
break;
case 64:
b = true;
object = new EntitySmallFireball(this.clientWorldController, d0, d1, d2,
(double) packetIn.getSpeedX() / 8000.0D, (double) packetIn.getSpeedY() / 8000.0D,
(double) packetIn.getSpeedZ() / 8000.0D);
packetIn.func_149002_g(0);
} else if (packetIn.getType() == 66) {
break;
case 66:
b = true;
object = new EntityWitherSkull(this.clientWorldController, d0, d1, d2,
(double) packetIn.getSpeedX() / 8000.0D, (double) packetIn.getSpeedY() / 8000.0D,
(double) packetIn.getSpeedZ() / 8000.0D);
packetIn.func_149002_g(0);
} else if (packetIn.getType() == 62) {
break;
case 62:
object = new EntityEgg(this.clientWorldController, d0, d1, d2);
} else if (packetIn.getType() == 73) {
break;
case 73:
b = true;
object = new EntityPotion(this.clientWorldController, d0, d1, d2, packetIn.func_149009_m());
packetIn.func_149002_g(0);
} else if (packetIn.getType() == 75) {
break;
case 75:
b = true;
object = new EntityExpBottle(this.clientWorldController, d0, d1, d2);
packetIn.func_149002_g(0);
} else if (packetIn.getType() == 1) {
break;
case 1:
object = new EntityBoat(this.clientWorldController, d0, d1, d2);
} else if (packetIn.getType() == 50) {
break;
case 50:
object = new EntityTNTPrimed(this.clientWorldController, d0, d1, d2, (EntityLivingBase) null);
} else if (packetIn.getType() == 78) {
break;
case 78:
object = new EntityArmorStand(this.clientWorldController, d0, d1, d2);
} else if (packetIn.getType() == 51) {
break;
case 51:
object = new EntityEnderCrystal(this.clientWorldController, d0, d1, d2);
} else if (packetIn.getType() == 2) {
break;
case 2:
object = new EntityItem(this.clientWorldController, d0, d1, d2);
} else if (packetIn.getType() == 70) {
break;
case 70:
b = true;
object = new EntityFallingBlock(this.clientWorldController, d0, d1, d2,
Block.getStateById(packetIn.func_149009_m() & '\uffff'));
break;
}
if (b) {
// fix for compiler bug
packetIn.func_149002_g(0);
}
if (object != null) {
((Entity) object).serverPosX = packetIn.getX();
((Entity) object).serverPosY = packetIn.getY();
((Entity) object).serverPosZ = packetIn.getZ();
((Entity) object).rotationPitch = (float) (packetIn.getPitch() * 360) / 256.0F;
((Entity) object).rotationYaw = (float) (packetIn.getYaw() * 360) / 256.0F;
Entity[] aentity = ((Entity) object).getParts();
object.serverPosX = packetIn.getX();
object.serverPosY = packetIn.getY();
object.serverPosZ = packetIn.getZ();
object.rotationPitch = (float) (packetIn.getPitch() * 360) / 256.0F;
object.rotationYaw = (float) (packetIn.getYaw() * 360) / 256.0F;
Entity[] aentity = object.getParts();
if (aentity != null) {
int i = packetIn.getEntityID() - ((Entity) object).getEntityId();
int i = packetIn.getEntityID() - object.getEntityId();
for (int j = 0; j < aentity.length; ++j) {
aentity[j].setEntityId(aentity[j].getEntityId() + i);
}
}
((Entity) object).setEntityId(packetIn.getEntityID());
this.clientWorldController.addEntityToWorld(packetIn.getEntityID(), (Entity) object);
object.setEntityId(packetIn.getEntityID());
this.clientWorldController.addEntityToWorld(packetIn.getEntityID(), object);
if (packetIn.func_149009_m() > 0) {
if (packetIn.getType() == 60) {
Entity entity1 = this.clientWorldController.getEntityByID(packetIn.func_149009_m());
@ -468,8 +495,8 @@ public class NetHandlerPlayClient implements INetHandlerPlayClient {
}
}
((Entity) object).setVelocity((double) packetIn.getSpeedX() / 8000.0D,
(double) packetIn.getSpeedY() / 8000.0D, (double) packetIn.getSpeedZ() / 8000.0D);
object.setVelocity((double) packetIn.getSpeedX() / 8000.0D, (double) packetIn.getSpeedY() / 8000.0D,
(double) packetIn.getSpeedZ() / 8000.0D);
}
}

View file

@ -69,22 +69,28 @@ public class BlockRendererDispatcher implements IResourceManagerReloadListener {
public boolean renderBlock(IBlockState state, BlockPos pos, IBlockAccess blockAccess,
WorldRenderer worldRendererIn) {
try {
boolean res;
int i = state.getBlock().getRenderType();
if (i == -1) {
return false;
res = false;
} else {
switch (i) {
case 1:
return this.fluidRenderer.renderFluid(blockAccess, state, pos, worldRendererIn);
res = this.fluidRenderer.renderFluid(blockAccess, state, pos, worldRendererIn);
break;
case 2:
return false;
res = false;
break;
case 3:
IBakedModel ibakedmodel = this.getModelFromBlockState(state, blockAccess, pos);
return this.blockModelRenderer.renderModel(blockAccess, ibakedmodel, state, pos, worldRendererIn);
res = this.blockModelRenderer.renderModel(blockAccess, ibakedmodel, state, pos, worldRendererIn);
break;
default:
return false;
res = false;
break;
}
}
return res;
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Tesselating block in world");
CrashReportCategory crashreportcategory = crashreport.makeCategory("Block being tesselated");

View file

@ -50,6 +50,9 @@ public class CrashReport {
private String[] stacktrace;
public CrashReport(String descriptionIn, Throwable causeThrowable) {
if (causeThrowable == null) {
throw new NullPointerException("Crash report created for null throwable!");
}
this.description = descriptionIn;
this.cause = causeThrowable;
this.stacktrace = EagRuntime.getStackTraceElements(causeThrowable);
@ -83,7 +86,7 @@ public class CrashReport {
+ System.getProperty("java.vm.vendor");
}
});
if (EagRuntime.getPlatformType() != EnumPlatformType.JAVASCRIPT) {
if (EagRuntime.getPlatformType() == EnumPlatformType.DESKTOP) {
this.theReportCategory.addCrashSectionCallable("Memory", new Callable<String>() {
public String call() {
long i = EagRuntime.maxMemory();

View file

@ -8,6 +8,8 @@ import java.util.Set;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import net.lax1dude.eaglercraft.v1_8.EagRuntime;
import net.lax1dude.eaglercraft.v1_8.internal.EnumPlatformType;
import net.lax1dude.eaglercraft.v1_8.log4j.LogManager;
import net.lax1dude.eaglercraft.v1_8.log4j.Logger;
import net.lax1dude.eaglercraft.v1_8.minecraft.EntityConstructor;
@ -288,11 +290,16 @@ public class EntityList {
Set<String> set = stringToClassMapping.keySet();
ArrayList arraylist = Lists.newArrayList();
for (String s : set) {
Class oclass = (Class) stringToClassMapping.get(s);
if ((oclass.getModifiers() & 1024) != 1024) {
arraylist.add(s);
// TODO: Eventually TeaVM will support getModifiers
if (EagRuntime.getPlatformType() != EnumPlatformType.WASM_GC) {
for (String s : set) {
Class oclass = (Class) stringToClassMapping.get(s);
if ((oclass.getModifiers() & 1024) != 1024) {
arraylist.add(s);
}
}
} else {
arraylist.addAll(set);
}
arraylist.add("LightningBolt");

View file

@ -37,7 +37,6 @@ import net.minecraft.util.ReportedException;
import net.minecraft.util.Util;
import net.minecraft.util.Vec3;
import net.minecraft.world.EnumDifficulty;
import net.minecraft.world.MinecraftException;
import net.minecraft.world.World;
import net.minecraft.world.WorldManager;
import net.minecraft.world.WorldServer;
@ -307,11 +306,7 @@ public abstract class MinecraftServer implements Runnable, ICommandSender, IThre
+ worldserver.provider.getDimensionName());
}
try {
worldserver.saveAllChunks(true, (IProgressUpdate) null);
} catch (MinecraftException minecraftexception) {
logger.warn(minecraftexception.getMessage());
}
worldserver.saveAllChunks(true, (IProgressUpdate) null);
}
}

View file

@ -1,27 +0,0 @@
package net.minecraft.world;
/**+
* This portion of EaglercraftX contains deobfuscated Minecraft 1.8 source code.
*
* Minecraft 1.8.8 bytecode is (c) 2015 Mojang AB. "Do not distribute!"
* Mod Coder Pack v9.18 deobfuscation configs are (c) Copyright by the MCP Team
*
* EaglercraftX 1.8 patch files (c) 2022-2024 lax1dude, ayunami2000. 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 MinecraftException extends Exception {
public MinecraftException(String msg) {
super(msg);
}
}

View file

@ -2772,14 +2772,6 @@ public abstract class World implements IBlockAccess {
public void sendQuittingDisconnectingPacket() {
}
/**+
* Checks whether the session lock file was modified by another
* process
*/
public void checkSessionLock() throws MinecraftException {
this.saveHandler.checkSessionLock();
}
public void setTotalWorldTime(long worldTime) {
this.worldInfo.setWorldTotalTime(worldTime);
}

View file

@ -765,7 +765,7 @@ public class WorldServer extends World implements IThreadListener {
/**+
* Saves all chunks to disk while updating progress bar.
*/
public void saveAllChunks(boolean progressCallback, IProgressUpdate parIProgressUpdate) throws MinecraftException {
public void saveAllChunks(boolean progressCallback, IProgressUpdate parIProgressUpdate) {
if (this.chunkProvider.canSave()) {
if (parIProgressUpdate != null) {
parIProgressUpdate.displaySavingString("Saving level");
@ -802,8 +802,7 @@ public class WorldServer extends World implements IThreadListener {
/**+
* Saves the chunks to disk.
*/
protected void saveLevel() throws MinecraftException {
this.checkSessionLock();
protected void saveLevel() {
this.worldInfo.setBorderSize(this.getWorldBorder().getDiameter());
this.worldInfo.getBorderCenterX(this.getWorldBorder().getCenterX());
this.worldInfo.getBorderCenterZ(this.getWorldBorder().getCenterZ());

View file

@ -64,12 +64,6 @@ public class WorldServerMulti extends WorldServer {
});
}
/**+
* Saves the chunks to disk.
*/
protected void saveLevel() throws MinecraftException {
}
public World init() {
this.mapStorage = this.delegate.getMapStorage();
this.worldScoreboard = this.delegate.getScoreboard();

View file

@ -1,7 +1,6 @@
package net.minecraft.world.chunk.storage;
import java.io.IOException;
import net.minecraft.world.MinecraftException;
import net.minecraft.world.World;
import net.minecraft.world.chunk.Chunk;
@ -31,7 +30,7 @@ public interface IChunkLoader {
*/
Chunk loadChunk(World var1, int var2, int var3) throws IOException;
void saveChunk(World var1, Chunk var2) throws IOException, MinecraftException;
void saveChunk(World var1, Chunk var2) throws IOException;
/**+
* Save extra data associated with this Chunk not normally saved

View file

@ -16,7 +16,6 @@ import net.minecraft.util.IProgressUpdate;
import net.minecraft.util.LongHashMap;
import net.minecraft.util.ReportedException;
import net.minecraft.world.ChunkCoordIntPair;
import net.minecraft.world.MinecraftException;
import net.minecraft.world.World;
import net.minecraft.world.WorldServer;
import net.minecraft.world.biome.BiomeGenBase;
@ -200,11 +199,7 @@ public class ChunkProviderServer implements IChunkProvider {
} catch (IOException ioexception) {
logger.error("Couldn\'t save chunk");
logger.error(ioexception);
} catch (MinecraftException minecraftexception) {
logger.error("Couldn\'t save chunk; already in use by another instance of Minecraft?");
logger.error(minecraftexception);
}
}
}

View file

@ -2,7 +2,6 @@ package net.minecraft.world.storage;
import net.minecraft.nbt.NBTTagCompound;
import net.lax1dude.eaglercraft.v1_8.internal.vfs2.VFile2;
import net.minecraft.world.MinecraftException;
import net.minecraft.world.WorldProvider;
import net.minecraft.world.chunk.storage.IChunkLoader;
@ -32,11 +31,6 @@ public interface ISaveHandler {
*/
WorldInfo loadWorldInfo();
/**+
* Checks the session lock to prevent save collisions
*/
void checkSessionLock() throws MinecraftException;
/**+
* initializes and returns the chunk loader for the specified
* world provider

View file

@ -8,7 +8,6 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.CompressedStreamTools;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.server.MinecraftServer;
import net.minecraft.world.MinecraftException;
import net.minecraft.world.WorldProvider;
import net.minecraft.world.chunk.storage.IChunkLoader;
import net.lax1dude.eaglercraft.v1_8.internal.vfs2.VFile2;
@ -64,12 +63,6 @@ public class SaveHandler implements ISaveHandler, IPlayerFileData {
return this.worldDirectory;
}
/**+
* Checks the session lock to prevent save collisions
*/
public void checkSessionLock() throws MinecraftException {
}
/**+
* initializes and returns the chunk loader for the specified
* world provider

View file

@ -2,7 +2,6 @@ package net.minecraft.world.storage;
import net.lax1dude.eaglercraft.v1_8.internal.vfs2.VFile2;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.MinecraftException;
import net.minecraft.world.WorldProvider;
import net.minecraft.world.chunk.storage.IChunkLoader;
@ -34,12 +33,6 @@ public class SaveHandlerMP implements ISaveHandler {
return null;
}
/**+
* Checks the session lock to prevent save collisions
*/
public void checkSessionLock() throws MinecraftException {
}
/**+
* Saves the given World Info with the given NBTTagCompound as
* the Player.