ForgePatch/patches/minecraft/net/minecraft/client/renderer/WorldRenderer.java.patch

181 lines
11 KiB
Diff

--- a/net/minecraft/client/renderer/WorldRenderer.java
+++ b/net/minecraft/client/renderer/WorldRenderer.java
@@ -507,7 +507,9 @@
}
public void func_180446_a(Entity p_180446_1_, ICamera p_180446_2_, float p_180446_3_) {
+ int pass = net.minecraftforge.client.MinecraftForgeClient.getRenderPass();
if (this.field_72740_G > 0) {
+ if (pass > 0) return;
--this.field_72740_G;
} else {
double d0 = p_180446_1_.field_70169_q + (p_180446_1_.field_70165_t - p_180446_1_.field_70169_q) * (double)p_180446_3_;
@@ -516,9 +518,11 @@
this.field_72769_h.field_72984_F.func_76320_a("prepare");
TileEntityRendererDispatcher.field_147556_a.func_190056_a(this.field_72769_h, this.field_72777_q.func_110434_K(), this.field_72777_q.field_71466_p, this.field_72777_q.func_175606_aa(), this.field_72777_q.field_71476_x, p_180446_3_);
this.field_175010_j.func_180597_a(this.field_72769_h, this.field_72777_q.field_71466_p, this.field_72777_q.func_175606_aa(), this.field_72777_q.field_147125_j, this.field_72777_q.field_71474_y, p_180446_3_);
+ if (pass == 0) {
this.field_72748_H = 0;
this.field_72749_I = 0;
this.field_72750_J = 0;
+ }
Entity entity = this.field_72777_q.func_175606_aa();
double d3 = entity.field_70142_S + (entity.field_70165_t - entity.field_70142_S) * (double)p_180446_3_;
double d4 = entity.field_70137_T + (entity.field_70163_u - entity.field_70137_T) * (double)p_180446_3_;
@@ -529,10 +533,12 @@
this.field_175010_j.func_178628_a(d3, d4, d5);
this.field_72777_q.field_71460_t.func_180436_i();
this.field_72769_h.field_72984_F.func_76318_c("global");
+ if (pass == 0) {
this.field_72748_H = this.field_72769_h.func_212419_R();
-
+ }
for(int i = 0; i < this.field_72769_h.field_73007_j.size(); ++i) {
Entity entity1 = this.field_72769_h.field_73007_j.get(i);
+ if (!entity1.shouldRenderInPass(pass)) continue;
++this.field_72749_I;
if (entity1.func_145770_h(d0, d1, d2)) {
this.field_175010_j.func_188388_a(entity1, p_180446_3_, false);
@@ -549,6 +555,7 @@
ClassInheritanceMultiMap<Entity> classinheritancemultimap = chunk.func_177429_s()[worldrenderer$containerlocalrenderinformation.field_178036_a.func_178568_j().func_177956_o() / 16];
if (!classinheritancemultimap.isEmpty()) {
for(Entity entity2 : classinheritancemultimap) {
+ if (!entity2.shouldRenderInPass(pass)) continue;
boolean flag = this.field_175010_j.func_178635_a(entity2, p_180446_2_, d0, d1, d2) || entity2.func_184215_y(this.field_72777_q.field_71439_g);
if (flag) {
boolean flag1 = this.field_72777_q.func_175606_aa() instanceof EntityLivingBase && ((EntityLivingBase)this.field_72777_q.func_175606_aa()).func_70608_bn();
@@ -575,7 +582,7 @@
}
}
- if (this.func_174985_d() && (!list.isEmpty() || this.field_184386_ad)) {
+ if (pass == 0 && this.func_174985_d() && (!list.isEmpty() || this.field_184386_ad)) {
this.field_72769_h.field_72984_F.func_76318_c("entityOutlines");
this.field_175015_z.func_147614_f();
this.field_184386_ad = !list.isEmpty();
@@ -610,10 +617,12 @@
this.field_72769_h.field_72984_F.func_76318_c("blockentities");
RenderHelper.func_74519_b();
+ TileEntityRendererDispatcher.field_147556_a.preDrawBatch();
for(WorldRenderer.ContainerLocalRenderInformation worldrenderer$containerlocalrenderinformation1 : this.field_72755_R) {
List<TileEntity> list2 = worldrenderer$containerlocalrenderinformation1.field_178036_a.func_178571_g().func_178485_b();
if (!list2.isEmpty()) {
for(TileEntity tileentity1 : list2) {
+ if (!tileentity1.shouldRenderInPass(pass) || !p_180446_2_.func_78546_a(tileentity1.getRenderBoundingBox())) continue;
TileEntityRendererDispatcher.field_147556_a.func_180546_a(tileentity1, p_180446_3_, -1);
}
}
@@ -621,16 +630,18 @@
synchronized(this.field_181024_n) {
for(TileEntity tileentity : this.field_181024_n) {
+ if (!tileentity.shouldRenderInPass(pass) || !p_180446_2_.func_78546_a(tileentity.getRenderBoundingBox())) continue;
TileEntityRendererDispatcher.field_147556_a.func_180546_a(tileentity, p_180446_3_, -1);
}
}
+ TileEntityRendererDispatcher.field_147556_a.drawBatch(pass);
this.func_180443_s();
for(DestroyBlockProgress destroyblockprogress : this.field_72738_E.values()) {
BlockPos blockpos = destroyblockprogress.func_180246_b();
IBlockState iblockstate = this.field_72769_h.func_180495_p(blockpos);
- if (iblockstate.func_177230_c().func_149716_u()) {
+ if (iblockstate.hasTileEntity()) {
TileEntity tileentity2 = this.field_72769_h.func_175625_s(blockpos);
if (tileentity2 instanceof TileEntityChest && iblockstate.func_177229_b(BlockChest.field_196314_b) == ChestType.LEFT) {
blockpos = blockpos.func_177972_a(iblockstate.func_177229_b(BlockChest.field_176459_a).func_176746_e());
@@ -766,7 +777,7 @@
for(int j = -this.field_72739_F; j <= this.field_72739_F; ++j) {
for(int k = -this.field_72739_F; k <= this.field_72739_F; ++k) {
RenderChunk renderchunk1 = this.field_175008_n.func_178161_a(new BlockPos((j << 4) + 8, i, (k << 4) + 8));
- if (renderchunk1 != null && p_195473_3_.func_78546_a(renderchunk1.field_178591_c)) {
+ if (renderchunk1 != null && p_195473_3_.func_78546_a(renderchunk1.field_178591_c.func_72321_a(0.0, blockpos1.func_177956_o() > 0 ? Double.POSITIVE_INFINITY : Double.NEGATIVE_INFINITY, 0.0))) { // Forge: fix MC-73139
renderchunk1.func_178577_a(p_195473_4_);
queue.add(new WorldRenderer.ContainerLocalRenderInformation(renderchunk1, (EnumFacing)null, 0));
}
@@ -811,7 +822,7 @@
this.field_147595_R = true;
BlockPos blockpos2 = renderchunk4.func_178568_j().func_177982_a(8, 8, 8);
boolean flag3 = blockpos2.func_177951_i(blockpos1) < 768.0D;
- if (!renderchunk4.func_188281_o() && !flag3) {
+ if (net.minecraftforge.common.ForgeMod.alwaysSetupTerrainOffThread || !renderchunk4.func_188281_o() && !flag3) {
this.field_175009_l.add(renderchunk4);
} else {
this.field_72777_q.field_71424_I.func_76320_a("build near");
@@ -1031,6 +1042,11 @@
}
public void func_195465_a(float p_195465_1_) {
+ net.minecraftforge.client.IRenderHandler renderer = this.field_72769_h.func_201675_m().getSkyRenderer();
+ if (renderer != null) {
+ renderer.render(p_195465_1_, field_72769_h, field_72777_q);
+ return;
+ }
if (this.field_72777_q.field_71441_e.field_73011_w.func_186058_p() == DimensionType.THE_END) {
this.func_180448_r();
} else if (this.field_72777_q.field_71441_e.field_73011_w.func_76569_d()) {
@@ -1175,6 +1191,7 @@
}
public void func_195466_a(float p_195466_1_, double p_195466_2_, double p_195466_4_, double p_195466_6_) {
+ if (net.minecraftforge.client.CloudRenderer.renderClouds(this.field_72773_u, p_195466_1_, this.field_72769_h, field_72777_q)) return;
if (this.field_72777_q.field_71441_e.field_73011_w.func_76569_d()) {
float f = 12.0F;
float f1 = 4.0F;
@@ -1551,7 +1568,11 @@
DestroyBlockProgress destroyblockprogress = iterator.next();
BlockPos blockpos = destroyblockprogress.func_180246_b();
Block block = this.field_72769_h.func_180495_p(blockpos).func_177230_c();
- if (!(block instanceof BlockChest) && !(block instanceof BlockEnderChest) && !(block instanceof BlockSign) && !(block instanceof BlockAbstractSkull)) {
+ TileEntity te = this.field_72769_h.func_175625_s(blockpos);
+ boolean hasBreak = block instanceof BlockChest || block instanceof BlockEnderChest || block instanceof BlockSign || block instanceof BlockAbstractSkull;
+ if (!hasBreak) hasBreak = te != null && te.canRenderBreaking();
+
+ if (!hasBreak) {
double d3 = (double)blockpos.func_177958_n() - d0;
double d4 = (double)blockpos.func_177956_o() - d1;
double d5 = (double)blockpos.func_177952_p() - d2;
@@ -1559,7 +1580,7 @@
iterator.remove();
} else {
IBlockState iblockstate = this.field_72769_h.func_180495_p(blockpos);
- if (!iblockstate.func_196958_f()) {
+ if (!iblockstate.isAir(field_72769_h, blockpos)) {
int i = destroyblockprogress.func_73106_e();
TextureAtlasSprite textureatlassprite = this.field_94141_F[i];
BlockRendererDispatcher blockrendererdispatcher = this.field_72777_q.func_175602_ab();
@@ -1580,7 +1601,7 @@
if (p_72731_3_ == 0 && p_72731_2_.field_72313_a == RayTraceResult.Type.BLOCK) {
BlockPos blockpos = p_72731_2_.func_178782_a();
IBlockState iblockstate = this.field_72769_h.func_180495_p(blockpos);
- if (!iblockstate.func_196958_f() && this.field_72769_h.func_175723_af().func_177746_a(blockpos)) {
+ if (!iblockstate.isAir(field_72769_h, blockpos) && this.field_72769_h.func_175723_af().func_177746_a(blockpos)) {
GlStateManager.func_179147_l();
GlStateManager.func_187428_a(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
GlStateManager.func_187441_d(Math.max(2.5F, (float)this.field_72777_q.field_195558_d.func_198109_k() / 1920.0F * 2.5F));
@@ -2006,8 +2027,8 @@
break;
case 2001:
IBlockState iblockstate = Block.func_196257_b(p_180439_4_);
- if (!iblockstate.func_196958_f()) {
- SoundType soundtype = iblockstate.func_177230_c().func_185467_w();
+ if (!iblockstate.isAir(field_72769_h, p_180439_3_)) {
+ SoundType soundtype = iblockstate.getSoundType(field_72769_h, p_180439_3_, null);
this.field_72769_h.func_184156_a(p_180439_3_, soundtype.func_185845_c(), SoundCategory.BLOCKS, (soundtype.func_185843_a() + 1.0F) / 2.0F, soundtype.func_185847_b() * 0.8F, false);
}
@@ -2127,6 +2148,11 @@
}
}
+ @Override
+ public net.minecraftforge.resource.IResourceType getResourceType() {
+ return net.minecraftforge.resource.VanillaResourceType.MODELS;
+ }
+
@OnlyIn(Dist.CLIENT)
class ContainerLocalRenderInformation {
private final RenderChunk field_178036_a;