From 6f642ba6ceb1978abdd5d63a5e4227f4cd1afa23 Mon Sep 17 00:00:00 2001 From: CreativeMD Date: Sun, 1 Apr 2018 09:40:26 +0200 Subject: [PATCH] Fixed Spectator mode particles and sounds computed from where you have been before (MC-46445) (#4728) --- .../net/minecraft/client/Minecraft.java.patch | 9 +++++++++ .../minecraft/client/audio/SoundHandler.java.patch | 12 ++++++++++++ .../minecraft/client/audio/SoundManager.java.patch | 12 ++++++++++++ .../client/renderer/ActiveRenderInfo.java.patch | 14 +++++++++++++- .../client/renderer/EntityRenderer.java.patch | 9 +++++++++ src/main/resources/forge.exc | 4 +++- 6 files changed, 58 insertions(+), 2 deletions(-) diff --git a/patches/minecraft/net/minecraft/client/Minecraft.java.patch b/patches/minecraft/net/minecraft/client/Minecraft.java.patch index 51eb32355..3f3360a08 100644 --- a/patches/minecraft/net/minecraft/client/Minecraft.java.patch +++ b/patches/minecraft/net/minecraft/client/Minecraft.java.patch @@ -143,6 +143,15 @@ if (p_147108_1_ instanceof GuiMainMenu || p_147108_1_ instanceof GuiMultiplayer) { this.field_71474_y.field_74330_P = false; +@@ -1082,7 +1100,7 @@ + long i1 = System.nanoTime() - l; + this.func_71361_d("Pre render"); + this.field_71424_I.func_76318_c("sound"); +- this.field_147127_av.func_147691_a(this.field_71439_g, this.field_71428_T.field_194147_b); ++ this.field_147127_av.setListener(this.func_175606_aa(), this.field_71428_T.field_194147_b); //Forge: MC-46445 Spectator mode particles and sounds computed from where you have been before + this.field_71424_I.func_76319_b(); + this.field_71424_I.func_76320_a("render"); + GlStateManager.func_179094_E(); @@ -1094,11 +1112,13 @@ if (!this.field_71454_w) diff --git a/patches/minecraft/net/minecraft/client/audio/SoundHandler.java.patch b/patches/minecraft/net/minecraft/client/audio/SoundHandler.java.patch index c89ee3541..95caffe21 100644 --- a/patches/minecraft/net/minecraft/client/audio/SoundHandler.java.patch +++ b/patches/minecraft/net/minecraft/client/audio/SoundHandler.java.patch @@ -38,3 +38,15 @@ for (ResourceLocation resourcelocation : this.field_147697_e.func_148742_b()) { SoundEventAccessor soundeventaccessor = (SoundEventAccessor)this.field_147697_e.func_82594_a(resourcelocation); +@@ -253,6 +268,11 @@ + this.field_147694_f.func_148615_a(p_147691_1_, p_147691_2_); + } + ++ public void setListener(net.minecraft.entity.Entity entity, float partialTicks) ++ { ++ this.field_147694_f.setListener(entity, partialTicks); ++ } ++ + public void func_147689_b() + { + this.field_147694_f.func_148610_e(); diff --git a/patches/minecraft/net/minecraft/client/audio/SoundManager.java.patch b/patches/minecraft/net/minecraft/client/audio/SoundManager.java.patch index e37e6fcec..b87a636aa 100644 --- a/patches/minecraft/net/minecraft/client/audio/SoundManager.java.patch +++ b/patches/minecraft/net/minecraft/client/audio/SoundManager.java.patch @@ -47,3 +47,15 @@ } field_148621_b.debug(field_148623_a, "Playing sound {} for event {} as channel {}", sound.func_188719_a(), resourcelocation, s); +@@ -507,6 +515,11 @@ + + public void func_148615_a(EntityPlayer p_148615_1_, float p_148615_2_) + { ++ setListener((net.minecraft.entity.Entity) p_148615_1_, p_148615_2_); ++ } ++ ++ public void setListener(net.minecraft.entity.Entity p_148615_1_, float p_148615_2_) ++ { + if (this.field_148617_f && p_148615_1_ != null) + { + float f = p_148615_1_.field_70127_C + (p_148615_1_.field_70125_A - p_148615_1_.field_70127_C) * p_148615_2_; diff --git a/patches/minecraft/net/minecraft/client/renderer/ActiveRenderInfo.java.patch b/patches/minecraft/net/minecraft/client/renderer/ActiveRenderInfo.java.patch index 970199066..00ffa6fc4 100644 --- a/patches/minecraft/net/minecraft/client/renderer/ActiveRenderInfo.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/ActiveRenderInfo.java.patch @@ -1,6 +1,18 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/ActiveRenderInfo.java +++ ../src-work/minecraft/net/minecraft/client/renderer/ActiveRenderInfo.java -@@ -108,4 +108,14 @@ +@@ -30,6 +30,11 @@ + + public static void func_74583_a(EntityPlayer p_74583_0_, boolean p_74583_1_) + { ++ updateRenderInfo((Entity) p_74583_0_, p_74583_1_); ++ } ++ ++ public static void updateRenderInfo(Entity p_74583_0_, boolean p_74583_1_) ++ { + GlStateManager.func_179111_a(2982, field_178812_b); + GlStateManager.func_179111_a(2983, field_178813_c); + GlStateManager.func_187445_a(2978, field_178814_a); +@@ -108,4 +113,14 @@ { return field_74596_h; } diff --git a/patches/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch index c56e7c5c2..571f69d2a 100644 --- a/patches/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch @@ -132,6 +132,15 @@ } else { +@@ -1262,7 +1274,7 @@ + GlStateManager.func_179086_m(16640); + this.field_78531_r.field_71424_I.func_76318_c("camera"); + this.func_78479_a(p_175068_2_, p_175068_1_); +- ActiveRenderInfo.func_74583_a(this.field_78531_r.field_71439_g, this.field_78531_r.field_71474_y.field_74320_O == 2); ++ ActiveRenderInfo.updateRenderInfo(this.field_78531_r.func_175606_aa(), this.field_78531_r.field_71474_y.field_74320_O == 2); //Forge: MC-46445 Spectator mode particles and sounds computed from where you have been before + this.field_78531_r.field_71424_I.func_76318_c("frustum"); + ClippingHelperImpl.func_78558_a(); + this.field_78531_r.field_71424_I.func_76318_c("culling"); @@ -1329,7 +1341,9 @@ GlStateManager.func_179094_E(); RenderHelper.func_74519_b(); diff --git a/src/main/resources/forge.exc b/src/main/resources/forge.exc index 6ff1b1a43..140927f13 100644 --- a/src/main/resources/forge.exc +++ b/src/main/resources/forge.exc @@ -66,4 +66,6 @@ net/minecraft/command/EntitySelector.matchEntitiesDefault(Lnet/minecraft/command net/minecraft/command/EntitySelector.matchesMultiplePlayersDefault(Ljava/lang/String;)Z=|p_82377_0_ net/minecraft/command/EntitySelector.isSelectorDefault(Ljava/lang/String;)Z=|p_82378_0_ -net/minecraft/client/util/RecipeItemHelper.accountStack(Lnet/minecraft/item/ItemStack;I)V=|p_194112_1_,forceCount \ No newline at end of file +net/minecraft/client/util/RecipeItemHelper.accountStack(Lnet/minecraft/item/ItemStack;I)V=|p_194112_1_,forceCount +net/minecraft/client/renderer/ActiveRenderInfo.updateRenderInfo(Lnet/minecraft/entity/Entity;Z)V=|p_74583_0_,p_74583_1_ +net/minecraft/client/audio/SoundManager.setListener(Lnet/minecraft/entity/Entity;F)V=|p_148615_1_,p_148615_2_