1
0
Fork 0

performance improvements

This commit is contained in:
HoosierTransfer 2024-04-29 16:11:41 -04:00
parent 074bd57995
commit 68803bc304
22 changed files with 41208 additions and 41156 deletions

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +1,5 @@
# HoosierTransfer's client # HoosierTransfer's client
A fork of EaglercraftX that includes many performance improvements. A fork of EaglercraftX that includes many performance improvements and some of my own changes.
Includes Patcher, Alfheim, and a bunch of other mods that I forgot about.

View File

@ -33,8 +33,11 @@ public class Config {
return false; return false;
} }
public static boolean renderParticles() { public static boolean renderParticles() {
return false; return false;
} }
public static boolean doBatchRendering() {
return false;
}
} }

View File

@ -10,7 +10,7 @@ public class EaglercraftVersion {
/// Customize these to fit your fork: /// Customize these to fit your fork:
public static final String projectForkName = "EaglerfastX"; public static final String projectForkName = "EaglerfastX";
public static final String projectForkVersion = "u29"; public static final String projectForkVersion = "1.2.0";
public static final String projectForkVendor = "hoosiertransfer"; public static final String projectForkVendor = "hoosiertransfer";
public static final String projectForkURL = "https://gitlab.com/lax1dude/eaglercraftx-1.8"; public static final String projectForkURL = "https://gitlab.com/lax1dude/eaglercraftx-1.8";

View File

@ -46,7 +46,6 @@ public class ChunkUpdateManager {
} }
private void runGenerator(ChunkCompileTaskGenerator generator, Entity entity) { private void runGenerator(ChunkCompileTaskGenerator generator, Entity entity) {
Minecraft.getMinecraft().mcProfiler.startSection("chunkCompile");
generator.setRegionRenderCacheBuilder(renderCache); generator.setRegionRenderCacheBuilder(renderCache);
float f = (float) entity.posX; float f = (float) entity.posX;
float f1 = (float) entity.posY + entity.getEyeHeight(); float f1 = (float) entity.posY + entity.getEyeHeight();

View File

@ -515,6 +515,10 @@ public class WorldRenderer {
} }
public boolean isDrawing() {
return this.isDrawing;
}
public class State { public class State {
private final int[] stateRawBuffer; private final int[] stateRawBuffer;
private final VertexFormat stateVertexFormat; private final VertexFormat stateVertexFormat;

View File

@ -1783,6 +1783,9 @@ public class Minecraft implements IThreadListener {
* unloads the current world first * unloads the current world first
*/ */
public void loadWorld(WorldClient worldClientIn, String loadingMessage) { public void loadWorld(WorldClient worldClientIn, String loadingMessage) {
if (worldClientIn != theWorld) {
this.entityRenderer.getMapItemRenderer().clearLoadedMaps();
}
if (worldClientIn == null) { if (worldClientIn == null) {
NetHandlerPlayClient nethandlerplayclient = this.getNetHandler(); NetHandlerPlayClient nethandlerplayclient = this.getNetHandler();
if (nethandlerplayclient != null) { if (nethandlerplayclient != null) {

View File

@ -126,22 +126,6 @@ public class EntityOtherPlayerMP extends AbstractClientPlayer {
this.prevCameraYaw = this.cameraYaw; this.prevCameraYaw = this.cameraYaw;
this.updateArmSwingProgress(); this.updateArmSwingProgress();
float f1 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ);
float f = (float) Math.atan(-this.motionY * 0.20000000298023224D) * 15.0F;
if (f1 > 0.1F) {
f1 = 0.1F;
}
if (!this.onGround || this.getHealth() <= 0.0F) {
f1 = 0.0F;
}
if (this.onGround || this.getHealth() <= 0.0F) {
f = 0.0F;
}
this.cameraYaw += (f1 - this.cameraYaw) * 0.4F;
this.cameraPitch += (f - this.cameraPitch) * 0.8F;
} }
/**+ /**+

View File

@ -6,11 +6,13 @@ import java.util.List;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import net.hoosiertransfer.Config;
import net.lax1dude.eaglercraft.v1_8.opengl.EaglercraftGPU; import net.lax1dude.eaglercraft.v1_8.opengl.EaglercraftGPU;
import net.lax1dude.eaglercraft.v1_8.opengl.GlStateManager; import net.lax1dude.eaglercraft.v1_8.opengl.GlStateManager;
import net.lax1dude.eaglercraft.v1_8.opengl.WorldRenderer; import net.lax1dude.eaglercraft.v1_8.opengl.WorldRenderer;
import net.minecraft.client.renderer.GLAllocation; import net.minecraft.client.renderer.GLAllocation;
import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
/** /**
* + * +
@ -65,6 +67,8 @@ public class ModelRenderer {
public float offsetY; public float offsetY;
public float offsetZ; public float offsetZ;
private boolean compiledState;
public ModelRenderer(ModelBase model, String boxNameIn) { public ModelRenderer(ModelBase model, String boxNameIn) {
this.textureWidth = 64.0F; this.textureWidth = 64.0F;
this.textureHeight = 32.0F; this.textureHeight = 32.0F;
@ -159,6 +163,9 @@ public class ModelRenderer {
} }
public void render(float parFloat1) { public void render(float parFloat1) {
if (compiledState != Config.doBatchRendering()) {
compiled = false;
}
if (!this.isHidden && this.showModel) { if (!this.isHidden && this.showModel) {
if (!this.compiled) { if (!this.compiled) {
this.compileDisplayList(parFloat1); this.compileDisplayList(parFloat1);
@ -283,11 +290,18 @@ public class ModelRenderer {
this.displayList = GLAllocation.generateDisplayLists(); this.displayList = GLAllocation.generateDisplayLists();
EaglercraftGPU.glNewList(this.displayList, GL_COMPILE); EaglercraftGPU.glNewList(this.displayList, GL_COMPILE);
WorldRenderer worldrenderer = Tessellator.getInstance().getWorldRenderer(); WorldRenderer worldrenderer = Tessellator.getInstance().getWorldRenderer();
compiledState = Config.doBatchRendering();
if (compiledState) {
Tessellator.getInstance().getWorldRenderer().begin(7, DefaultVertexFormats.OLDMODEL_POSITION_TEX_NORMAL);
}
for (int i = 0; i < this.cubeList.size(); ++i) { for (int i = 0; i < this.cubeList.size(); ++i) {
((ModelBox) this.cubeList.get(i)).render(worldrenderer, scale); ((ModelBox) this.cubeList.get(i)).render(worldrenderer, scale);
} }
if (compiledState) {
Tessellator.getInstance().draw();
}
EaglercraftGPU.glEndList(); EaglercraftGPU.glEndList();
this.compiled = true; this.compiled = true;
} }

View File

@ -1,5 +1,6 @@
package net.minecraft.client.model; package net.minecraft.client.model;
import net.hoosiertransfer.Config;
import net.lax1dude.eaglercraft.v1_8.opengl.WorldRenderer; import net.lax1dude.eaglercraft.v1_8.opengl.WorldRenderer;
import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
@ -78,7 +79,12 @@ public class TexturedQuad {
f2 = -f2; f2 = -f2;
} }
renderer.begin(7, DefaultVertexFormats.OLDMODEL_POSITION_TEX_NORMAL); boolean drawOnSelf = renderer.isDrawing();
if (drawOnSelf || !Config.doBatchRendering()) {
renderer.begin(7, DefaultVertexFormats.OLDMODEL_POSITION_TEX_NORMAL);
}
for (int i = 0; i < 4; ++i) { for (int i = 0; i < 4; ++i) {
PositionTextureVertex positiontexturevertex = this.vertexPositions[i]; PositionTextureVertex positiontexturevertex = this.vertexPositions[i];
@ -89,7 +95,8 @@ public class TexturedQuad {
(double) positiontexturevertex.texturePositionY) (double) positiontexturevertex.texturePositionY)
.normal(f, f1, f2).endVertex(); .normal(f, f1, f2).endVertex();
} }
if (drawOnSelf || !Config.doBatchRendering()) {
Tessellator.getInstance().draw(); Tessellator.getInstance().draw();
}
} }
} }

View File

@ -304,7 +304,7 @@ public class NetHandlerPlayClient implements INetHandlerPlayClient {
this.gameController.gameSettings.difficulty = packetIn.getDifficulty(); this.gameController.gameSettings.difficulty = packetIn.getDifficulty();
this.gameController.loadWorld(this.clientWorldController); this.gameController.loadWorld(this.clientWorldController);
this.gameController.thePlayer.dimension = packetIn.getDimension(); this.gameController.thePlayer.dimension = packetIn.getDimension();
this.gameController.displayGuiScreen(new GuiDownloadTerrain(this)); // this.gameController.displayGuiScreen(new GuiDownloadTerrain(this));
this.gameController.thePlayer.setEntityId(packetIn.getEntityId()); this.gameController.thePlayer.setEntityId(packetIn.getEntityId());
this.currentServerMaxPlayers = packetIn.getMaxPlayers(); this.currentServerMaxPlayers = packetIn.getMaxPlayers();
this.gameController.thePlayer.setReducedDebug(packetIn.isReducedDebugInfo()); this.gameController.thePlayer.setReducedDebug(packetIn.isReducedDebugInfo());
@ -957,7 +957,7 @@ public class NetHandlerPlayClient implements INetHandlerPlayClient {
this.clientWorldController.setWorldScoreboard(scoreboard); this.clientWorldController.setWorldScoreboard(scoreboard);
this.gameController.loadWorld(this.clientWorldController); this.gameController.loadWorld(this.clientWorldController);
this.gameController.thePlayer.dimension = packetIn.getDimensionID(); this.gameController.thePlayer.dimension = packetIn.getDimensionID();
this.gameController.displayGuiScreen(new GuiDownloadTerrain(this)); // this.gameController.displayGuiScreen(new GuiDownloadTerrain(this));
} }
this.gameController.setDimensionAndSpawnPlayer(packetIn.getDimensionID()); this.gameController.setDimensionAndSpawnPlayer(packetIn.getDimensionID());

View File

@ -91,7 +91,9 @@ public class BlockFluidRenderer {
double d0 = (double) blockPosIn.x; double d0 = (double) blockPosIn.x;
double d1 = (double) blockPosIn.y; double d1 = (double) blockPosIn.y;
double d2 = (double) blockPosIn.z; double d2 = (double) blockPosIn.z;
float f11 = 0.001F; // float f11 = 0.001F;
// fix stitching
float f11 = 0.0F;
if (flag) { if (flag) {
flag2 = true; flag2 = true;
EaglerTextureAtlasSprite textureatlassprite = atextureatlassprite[0]; EaglerTextureAtlasSprite textureatlassprite = atextureatlassprite[0];

View File

@ -1272,7 +1272,11 @@ public class EntityRenderer implements IResourceManagerReloadListener {
this.mc.getTextureManager().bindTexture(TextureMap.locationBlocksTexture); this.mc.getTextureManager().bindTexture(TextureMap.locationBlocksTexture);
GlStateManager.shadeModel(GL_SMOOTH); GlStateManager.shadeModel(GL_SMOOTH);
this.mc.mcProfiler.endStartSection("translucent"); this.mc.mcProfiler.endStartSection("translucent");
// thing from patcher i might want to disable this because i dont know if injecting this here is right
GlStateManager.enablePolygonOffset();
GlStateManager.doPolygonOffset(-0.325F, -0.325F);
renderglobal.renderBlockLayer(EnumWorldBlockLayer.TRANSLUCENT, (double) partialTicks, pass, entity); renderglobal.renderBlockLayer(EnumWorldBlockLayer.TRANSLUCENT, (double) partialTicks, pass, entity);
GlStateManager.disablePolygonOffset();
GlStateManager.shadeModel(GL_FLAT); GlStateManager.shadeModel(GL_FLAT);
GlStateManager.depthMask(true); GlStateManager.depthMask(true);
GlStateManager.enableCull(); GlStateManager.enableCull();

View File

@ -997,6 +997,7 @@ public class RenderGlobal implements IWorldAccess, IResourceManagerReloadListene
private Set<EnumFacing> getVisibleFacings(BlockPos pos) { private Set<EnumFacing> getVisibleFacings(BlockPos pos) {
VisGraph visgraph = new VisGraph(); VisGraph visgraph = new VisGraph();
visgraph.setLimitScan(true);
BlockPos blockpos = new BlockPos(pos.getX() >> 4 << 4, pos.getY() >> 4 << 4, pos.getZ() >> 4 << 4); BlockPos blockpos = new BlockPos(pos.getX() >> 4 << 4, pos.getY() >> 4 << 4, pos.getZ() >> 4 << 4);
Chunk chunk = this.theWorld.getChunkFromBlockCoords(blockpos); Chunk chunk = this.theWorld.getChunkFromBlockCoords(blockpos);

View File

@ -39,6 +39,8 @@ public class VisGraph {
private static final int[] field_178613_e = new int[1352]; private static final int[] field_178613_e = new int[1352];
private int field_178611_f = 4096; private int field_178611_f = 4096;
private boolean limitScan;
public void func_178606_a(BlockPos pos) { public void func_178606_a(BlockPos pos) {
this.field_178612_d.set(getIndex(pos), true); this.field_178612_d.set(getIndex(pos), true);
--this.field_178611_f; --this.field_178611_f;
@ -82,6 +84,9 @@ public class VisGraph {
while (!linkedlist.isEmpty()) { while (!linkedlist.isEmpty()) {
int i = ((Integer) linkedlist.poll()).intValue(); int i = ((Integer) linkedlist.poll()).intValue();
this.func_178610_a(i, enumset); this.func_178610_a(i, enumset);
if (limitScan && enumset.size() > 1) {
return enumset;
}
EnumFacing[] facings = EnumFacing._VALUES; EnumFacing[] facings = EnumFacing._VALUES;
for (int k = 0; k < facings.length; ++k) { for (int k = 0; k < facings.length; ++k) {
@ -97,6 +102,10 @@ public class VisGraph {
return enumset; return enumset;
} }
public void setLimitScan(boolean limitScan) {
this.limitScan = limitScan;
}
private void func_178610_a(int parInt1, Set<EnumFacing> parSet) { private void func_178610_a(int parInt1, Set<EnumFacing> parSet) {
int i = parInt1 >> 0 & 15; int i = parInt1 >> 0 & 15;
if (i == 0) { if (i == 0) {

View File

@ -153,6 +153,9 @@ public abstract class Entity implements ICommandSender {
private long lastTime = 0; private long lastTime = 0;
private boolean culled = false; private boolean culled = false;
private boolean outOfCamera = false; private boolean outOfCamera = false;
private long displayNameCachedAt;
private IChatComponent cachedDisplayName;
public void setTimeout() { public void setTimeout() {
lastTime = System.currentTimeMillis() + 1000; lastTime = System.currentTimeMillis() + 1000;
@ -2216,9 +2219,15 @@ public abstract class Entity implements ICommandSender {
* sender's username in chat * sender's username in chat
*/ */
public IChatComponent getDisplayName() { public IChatComponent getDisplayName() {
if (System.currentTimeMillis() - displayNameCachedAt < 50L) {
return cachedDisplayName;
}
ChatComponentText chatcomponenttext = new ChatComponentText(this.getName()); ChatComponentText chatcomponenttext = new ChatComponentText(this.getName());
chatcomponenttext.getChatStyle().setChatHoverEvent(this.getHoverEvent()); // When is a non-player entity going to be sending a chat message?
// chatcomponenttext.getChatStyle().setChatHoverEvent(this.getHoverEvent());
chatcomponenttext.getChatStyle().setInsertion(this.getUniqueID().toString()); chatcomponenttext.getChatStyle().setInsertion(this.getUniqueID().toString());
cachedDisplayName = chatcomponenttext;
displayNameCachedAt = System.currentTimeMillis();
return chatcomponenttext; return chatcomponenttext;
} }

View File

@ -52,6 +52,7 @@ import net.minecraft.util.MathHelper;
import net.minecraft.util.Vec3; import net.minecraft.util.Vec3;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.WorldServer; import net.minecraft.world.WorldServer;
import net.minecraft.client.entity.EntityPlayerSP;
/**+ /**+
* This portion of EaglercraftX contains deobfuscated Minecraft 1.8 source code. * This portion of EaglercraftX contains deobfuscated Minecraft 1.8 source code.
@ -1790,6 +1791,9 @@ public abstract class EntityLivingBase extends Entity {
* interpolated look vector * interpolated look vector
*/ */
public Vec3 getLook(float f) { public Vec3 getLook(float f) {
if (this instanceof EntityPlayerSP) {
return super.getLook(f);
}
if (f == 1.0F) { if (f == 1.0F) {
return this.getVectorForRotation(this.rotationPitch, this.rotationYawHead); return this.getVectorForRotation(this.rotationPitch, this.rotationYawHead);
} else { } else {

View File

@ -121,7 +121,7 @@ public class EntityXPOrb extends Entity {
if (this.closestPlayer != null) { if (this.closestPlayer != null) {
double d1 = (this.closestPlayer.posX - this.posX) / d0; double d1 = (this.closestPlayer.posX - this.posX) / d0;
double d2 = (this.closestPlayer.posY + (double) this.closestPlayer.getEyeHeight() - this.posY) / d0; double d2 = (this.closestPlayer.posY + (double) this.closestPlayer.getEyeHeight() / 2.0D - this.posY) / d0;
double d3 = (this.closestPlayer.posZ - this.posZ) / d0; double d3 = (this.closestPlayer.posZ - this.posZ) / d0;
double d4 = Math.sqrt(d1 * d1 + d2 * d2 + d3 * d3); double d4 = Math.sqrt(d1 * d1 + d2 * d2 + d3 * d3);
double d5 = 1.0D - d4; double d5 = 1.0D - d4;

View File

@ -26,6 +26,7 @@ import java.io.IOException;
*/ */
public class NBTTagString extends NBTBase { public class NBTTagString extends NBTBase {
private String data; private String data;
private String dataCache;
public NBTTagString() { public NBTTagString() {
this.data = ""; this.data = "";
@ -47,6 +48,7 @@ public class NBTTagString extends NBTBase {
} }
void read(DataInput parDataInput, int parInt1, NBTSizeTracker parNBTSizeTracker) throws IOException { void read(DataInput parDataInput, int parInt1, NBTSizeTracker parNBTSizeTracker) throws IOException {
this.dataCache = null;
parNBTSizeTracker.read(288L); parNBTSizeTracker.read(288L);
this.data = parDataInput.readUTF(); this.data = parDataInput.readUTF();
parNBTSizeTracker.read((long) (16 * this.data.length())); parNBTSizeTracker.read((long) (16 * this.data.length()));
@ -60,7 +62,11 @@ public class NBTTagString extends NBTBase {
} }
public String toString() { public String toString() {
return "\"" + this.data.replace("\"", "\\\"") + "\""; if (this.dataCache == null) {
this.dataCache = "\"" + this.data.replace("\"", "\\\"") + "\"";
}
return this.dataCache;
} }
/**+ /**+

View File

@ -25,13 +25,18 @@ public abstract class LazyLoadBase<T> {
private boolean isLoaded = false; private boolean isLoaded = false;
public T getValue() { public T getValue() {
if (!this.isLoaded) { //noinspection DoubleCheckedLocking
this.isLoaded = true; if (!this.isLoaded) {
this.value = this.load(); synchronized (this) {
} if (!this.isLoaded) {
this.value = this.load();
this.isLoaded = true;
}
}
}
return this.value; return this.value;
} }
protected abstract T load(); protected abstract T load();
} }

View File

@ -1,5 +1,6 @@
package net.minecraft.world; package net.minecraft.world;
import java.util.Objects;
import java.util.Set; import java.util.Set;
import java.util.TreeMap; import java.util.TreeMap;
@ -146,6 +147,9 @@ public class GameRules {
} }
public void setValue(String value) { public void setValue(String value) {
if (Objects.equals(this.valueString, value)) {
return;
}
this.valueString = value; this.valueString = value;
this.valueBoolean = Boolean.parseBoolean(value); this.valueBoolean = Boolean.parseBoolean(value);
this.valueInteger = this.valueBoolean ? 1 : 0; this.valueInteger = this.valueBoolean ? 1 : 0;