diff --git a/client/net/minecraftforge/client/ForgeHooksClient.java b/client/net/minecraftforge/client/ForgeHooksClient.java index 9eed41fd64..982bb0d320 100644 --- a/client/net/minecraftforge/client/ForgeHooksClient.java +++ b/client/net/minecraftforge/client/ForgeHooksClient.java @@ -243,4 +243,10 @@ public class ForgeHooksClient } } } + + static int renderPass = -1; + public static void setRenderPass(int pass) + { + renderPass = pass; + } } diff --git a/client/net/minecraftforge/client/MinecraftForgeClient.java b/client/net/minecraftforge/client/MinecraftForgeClient.java index 2b7f1b0463..21deada6b1 100644 --- a/client/net/minecraftforge/client/MinecraftForgeClient.java +++ b/client/net/minecraftforge/client/MinecraftForgeClient.java @@ -51,4 +51,9 @@ public class MinecraftForgeClient } return null; } + + public int getRenderPass() + { + return ForgeHooksClient.renderPass; + } } diff --git a/patches/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch index 592abdcdd3..b86635459b 100644 --- a/patches/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch @@ -56,7 +56,17 @@ GL11.glRotatef(entityliving.prevRotationYaw + (entityliving.rotationYaw - entityliving.prevRotationYaw) * par1 + 180.0F, 0.0F, -1.0F, 0.0F); GL11.glRotatef(entityliving.prevRotationPitch + (entityliving.rotationPitch - entityliving.prevRotationPitch) * par1, -1.0F, 0.0F, 0.0F); } -@@ -1146,8 +1150,11 @@ +@@ -1131,7 +1135,9 @@ + { + RenderHelper.enableStandardItemLighting(); + this.mc.mcProfiler.endStartSection("entities"); ++ ForgeHooksClient.setRenderPass(0); + renderglobal.renderEntities(entityliving.getPosition(par1), frustrum, par1); ++ ForgeHooksClient.setRenderPass(-1); + this.enableLightmap((double)par1); + this.mc.mcProfiler.endStartSection("litParticles"); + effectrenderer.renderLitParticles(entityliving, par1); +@@ -1146,8 +1152,11 @@ entityplayer = (EntityPlayer)entityliving; GL11.glDisable(GL11.GL_ALPHA_TEST); this.mc.mcProfiler.endStartSection("outline"); @@ -70,7 +80,21 @@ GL11.glEnable(GL11.GL_ALPHA_TEST); } } -@@ -1211,15 +1218,18 @@ +@@ -1202,6 +1211,13 @@ + renderglobal.sortAndRender(entityliving, 1, (double)par1); + } + ++ RenderHelper.enableStandardItemLighting(); ++ this.mc.mcProfiler.endStartSection("entities"); ++ ForgeHooksClient.setRenderPass(1); ++ renderglobal.renderEntities(entityliving.getPosition(par1), frustrum, par1); ++ ForgeHooksClient.setRenderPass(-1); ++ RenderHelper.disableStandardItemLighting(); ++ + GL11.glDepthMask(true); + GL11.glEnable(GL11.GL_CULL_FACE); + GL11.glDisable(GL11.GL_BLEND); +@@ -1211,15 +1227,18 @@ entityplayer = (EntityPlayer)entityliving; GL11.glDisable(GL11.GL_ALPHA_TEST); this.mc.mcProfiler.endStartSection("outline"); @@ -92,7 +116,7 @@ GL11.glDisable(GL11.GL_BLEND); this.mc.mcProfiler.endStartSection("weather"); this.renderRainSnow(par1); -@@ -1232,6 +1242,9 @@ +@@ -1232,6 +1251,9 @@ GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT); this.renderHand(par1, j); } diff --git a/patches/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch b/patches/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch index 67d17bda6b..c4764253dc 100644 --- a/patches/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch @@ -1,15 +1,98 @@ --- ../src_base/minecraft/net/minecraft/client/renderer/RenderGlobal.java +++ ../src_work/minecraft/net/minecraft/client/renderer/RenderGlobal.java -@@ -65,6 +65,8 @@ +@@ -65,6 +65,9 @@ import org.lwjgl.opengl.ARBOcclusionQuery; import org.lwjgl.opengl.GL11; +import net.minecraftforge.client.IRenderHandler; ++import net.minecraftforge.client.MinecraftForgeClient; + @SideOnly(Side.CLIENT) public class RenderGlobal implements IWorldAccess { -@@ -933,6 +935,12 @@ +@@ -443,35 +446,47 @@ + */ + public void renderEntities(Vec3 par1Vec3, ICamera par2ICamera, float par3) + { ++ int pass = MinecraftForgeClient.getRenderPass(); + if (this.renderEntitiesStartupCounter > 0) + { ++ if (pass > 0) ++ { ++ return; ++ } + --this.renderEntitiesStartupCounter; + } + else + { + this.theWorld.theProfiler.startSection("prepare"); +- TileEntityRenderer.instance.cacheActiveRenderInfo(this.theWorld, this.renderEngine, this.mc.fontRenderer, this.mc.renderViewEntity, par3); +- RenderManager.instance.cacheActiveRenderInfo(this.theWorld, this.renderEngine, this.mc.fontRenderer, this.mc.renderViewEntity, this.mc.field_96291_i, this.mc.gameSettings, par3); +- this.countEntitiesTotal = 0; +- this.countEntitiesRendered = 0; +- this.countEntitiesHidden = 0; +- EntityLiving entityliving = this.mc.renderViewEntity; +- RenderManager.renderPosX = entityliving.lastTickPosX + (entityliving.posX - entityliving.lastTickPosX) * (double)par3; +- RenderManager.renderPosY = entityliving.lastTickPosY + (entityliving.posY - entityliving.lastTickPosY) * (double)par3; +- RenderManager.renderPosZ = entityliving.lastTickPosZ + (entityliving.posZ - entityliving.lastTickPosZ) * (double)par3; +- TileEntityRenderer.staticPlayerX = entityliving.lastTickPosX + (entityliving.posX - entityliving.lastTickPosX) * (double)par3; +- TileEntityRenderer.staticPlayerY = entityliving.lastTickPosY + (entityliving.posY - entityliving.lastTickPosY) * (double)par3; +- TileEntityRenderer.staticPlayerZ = entityliving.lastTickPosZ + (entityliving.posZ - entityliving.lastTickPosZ) * (double)par3; ++ if (pass == 0) ++ { ++ TileEntityRenderer.instance.cacheActiveRenderInfo(this.theWorld, this.renderEngine, this.mc.fontRenderer, this.mc.renderViewEntity, par3); ++ RenderManager.instance.cacheActiveRenderInfo(this.theWorld, this.renderEngine, this.mc.fontRenderer, this.mc.renderViewEntity, this.mc.field_96291_i, this.mc.gameSettings, par3); ++ this.countEntitiesTotal = 0; ++ this.countEntitiesRendered = 0; ++ this.countEntitiesHidden = 0; ++ EntityLiving entityliving = this.mc.renderViewEntity; ++ RenderManager.renderPosX = entityliving.lastTickPosX + (entityliving.posX - entityliving.lastTickPosX) * (double)par3; ++ RenderManager.renderPosY = entityliving.lastTickPosY + (entityliving.posY - entityliving.lastTickPosY) * (double)par3; ++ RenderManager.renderPosZ = entityliving.lastTickPosZ + (entityliving.posZ - entityliving.lastTickPosZ) * (double)par3; ++ TileEntityRenderer.staticPlayerX = entityliving.lastTickPosX + (entityliving.posX - entityliving.lastTickPosX) * (double)par3; ++ TileEntityRenderer.staticPlayerY = entityliving.lastTickPosY + (entityliving.posY - entityliving.lastTickPosY) * (double)par3; ++ TileEntityRenderer.staticPlayerZ = entityliving.lastTickPosZ + (entityliving.posZ - entityliving.lastTickPosZ) * (double)par3; ++ } + this.mc.entityRenderer.enableLightmap((double)par3); + this.theWorld.theProfiler.endStartSection("global"); + List list = this.theWorld.getLoadedEntityList(); +- this.countEntitiesTotal = list.size(); ++ if (pass == 0) ++ { ++ this.countEntitiesTotal = list.size(); ++ } + int i; + Entity entity; + + for (i = 0; i < this.theWorld.weatherEffects.size(); ++i) + { + entity = (Entity)this.theWorld.weatherEffects.get(i); ++ if (!entity.shouldRenderInPass(pass)) continue; + ++this.countEntitiesRendered; + + if (entity.isInRangeToRenderVec3D(par1Vec3)) +@@ -485,6 +500,7 @@ + for (i = 0; i < list.size(); ++i) + { + entity = (Entity)list.get(i); ++ if (!entity.shouldRenderInPass(pass)) continue; + + if (entity.isInRangeToRenderVec3D(par1Vec3) && (entity.ignoreFrustumCheck || par2ICamera.isBoundingBoxInFrustum(entity.boundingBox) || entity.riddenByEntity == this.mc.thePlayer) && (entity != this.mc.renderViewEntity || this.mc.gameSettings.thirdPersonView != 0 || this.mc.renderViewEntity.isPlayerSleeping()) && this.theWorld.blockExists(MathHelper.floor_double(entity.posX), 0, MathHelper.floor_double(entity.posZ))) + { +@@ -498,7 +514,11 @@ + + for (i = 0; i < this.tileEntities.size(); ++i) + { +- TileEntityRenderer.instance.renderTileEntity((TileEntity)this.tileEntities.get(i), par3); ++ TileEntity tile = (TileEntity)tileEntities.get(i); ++ if (tile.shouldRenderInPass(pass) && par2ICamera.isBoundingBoxInFrustum(tile.getRenderBoundingBox())) ++ { ++ TileEntityRenderer.instance.renderTileEntity(tile, par3); ++ } + } + + this.mc.entityRenderer.disableLightmap((double)par3); +@@ -933,6 +953,12 @@ */ public void renderSky(float par1) { @@ -22,7 +105,7 @@ if (this.mc.theWorld.provider.dimensionId == 1) { GL11.glDisable(GL11.GL_FOG); -@@ -1171,6 +1179,13 @@ +@@ -1171,6 +1197,13 @@ public void renderClouds(float par1) { @@ -36,7 +119,7 @@ if (this.mc.theWorld.provider.isSurfaceWorld()) { if (this.mc.gameSettings.fancyGraphics) -@@ -1599,6 +1614,11 @@ +@@ -1599,6 +1632,11 @@ } public void drawBlockDamageTexture(Tessellator par1Tessellator, EntityPlayer par2EntityPlayer, float par3) diff --git a/patches/minecraft/net/minecraft/entity/Entity.java.patch b/patches/minecraft/net/minecraft/entity/Entity.java.patch index 3f55d2fc77..dd22304818 100644 --- a/patches/minecraft/net/minecraft/entity/Entity.java.patch +++ b/patches/minecraft/net/minecraft/entity/Entity.java.patch @@ -112,7 +112,7 @@ } public boolean func_96091_a(Explosion par1Explosion, World par2World, int par3, int par4, int par5, int par6, float par7) -@@ -2448,4 +2480,84 @@ +@@ -2448,4 +2480,89 @@ { return this.getEntityName(); } @@ -195,5 +195,10 @@ + public final void resetEntityId() + { + this.entityId = nextEntityID++; ++ } ++ ++ public boolean shouldRenderInPass(int pass) ++ { ++ return pass == 0; + } }