mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-21 04:32:15 +00:00
Added IWeatherParticleRenderHandler to allow a mod to take control over weather particles and sounds. (#7522)
This commit is contained in:
1 parent
2094f99640
commit
c3e84646db
3 files changed
+74
-20
No files matched your search
@@ -12,7 +12,19 @@
|
||||
float f = this.field_72777_q.field_71441_e.func_72867_j(p_228438_2_);
|
||||
if (!(f <= 0.0F)) {
|
||||
p_228438_1_.func_205109_c();
|
||||
@@ -830,7 +835,7 @@
|
||||
@@ -347,6 +352,11 @@
|
||||
}
|
||||
|
||||
public void func_228436_a_(ActiveRenderInfo p_228436_1_) {
|
||||
+ net.minecraftforge.client.IWeatherParticleRenderHandler renderHandler = field_72769_h.func_239132_a_().getWeatherParticleRenderHandler();
|
||||
+ if (renderHandler != null) {
|
||||
+ renderHandler.render(field_72773_u, field_72769_h, field_72777_q, p_228436_1_);
|
||||
+ return;
|
||||
+ }
|
||||
float f = this.field_72777_q.field_71441_e.func_72867_j(1.0F) / (Minecraft.func_71375_t() ? 1.0F : 2.0F);
|
||||
if (!(f <= 0.0F)) {
|
||||
Random random = new Random((long)this.field_72773_u * 312987231L);
|
||||
@@ -830,7 +840,7 @@
|
||||
this.field_147595_R = true;
|
||||
BlockPos blockpos2 = chunkrenderdispatcher$chunkrender4.func_178568_j().func_177982_a(8, 8, 8);
|
||||
boolean flag1 = blockpos2.func_177951_i(blockpos) < 768.0D;
|
||||
@@ -21,7 +33,7 @@
|
||||
this.field_175009_l.add(chunkrenderdispatcher$chunkrender4);
|
||||
} else {
|
||||
this.field_72777_q.func_213239_aq().func_76320_a("build near");
|
||||
@@ -915,13 +920,13 @@
|
||||
@@ -915,13 +925,13 @@
|
||||
float f = p_228426_7_.func_205001_m();
|
||||
boolean flag1 = this.field_72777_q.field_71441_e.func_239132_a_().func_230493_a_(MathHelper.func_76128_c(d0), MathHelper.func_76128_c(d1)) || this.field_72777_q.field_71456_v.func_184046_j().func_184056_f();
|
||||
if (this.field_72777_q.field_71474_y.field_151451_c >= 4) {
|
||||
@@ -37,7 +49,7 @@
|
||||
iprofiler.func_219895_b("terrain_setup");
|
||||
this.func_228437_a_(p_228426_6_, clippinghelper, flag, this.field_228409_ai_++, this.field_72777_q.field_71439_g.func_175149_v());
|
||||
iprofiler.func_219895_b("updatechunks");
|
||||
@@ -942,7 +947,9 @@
|
||||
@@ -942,7 +952,9 @@
|
||||
this.func_174967_a(p_228426_3_ + l1);
|
||||
iprofiler.func_219895_b("terrain");
|
||||
this.func_228441_a_(RenderType.func_228639_c_(), p_228426_1_, d0, d1, d2);
|
||||
@@ -47,7 +59,7 @@
|
||||
this.func_228441_a_(RenderType.func_228643_e_(), p_228426_1_, d0, d1, d2);
|
||||
if (this.field_72769_h.func_239132_a_().func_239217_c_()) {
|
||||
RenderHelper.func_237533_a_(p_228426_1_.func_227866_c_().func_227870_a_());
|
||||
@@ -972,7 +979,7 @@
|
||||
@@ -972,7 +984,7 @@
|
||||
IRenderTypeBuffer.Impl irendertypebuffer$impl = this.field_228415_m_.func_228487_b_();
|
||||
|
||||
for(Entity entity : this.field_72769_h.func_217416_b()) {
|
||||
@@ -56,7 +68,7 @@
|
||||
++this.field_72749_I;
|
||||
if (entity.field_70173_aa == 0) {
|
||||
entity.field_70142_S = entity.func_226277_ct_();
|
||||
@@ -1010,6 +1017,7 @@
|
||||
@@ -1010,6 +1022,7 @@
|
||||
List<TileEntity> list = worldrenderer$localrenderinformationcontainer.field_178036_a.func_178571_g().func_178485_b();
|
||||
if (!list.isEmpty()) {
|
||||
for(TileEntity tileentity1 : list) {
|
||||
@@ -64,7 +76,7 @@
|
||||
BlockPos blockpos3 = tileentity1.func_174877_v();
|
||||
IRenderTypeBuffer irendertypebuffer1 = irendertypebuffer$impl;
|
||||
p_228426_1_.func_227860_a_();
|
||||
@@ -1035,6 +1043,7 @@
|
||||
@@ -1035,6 +1048,7 @@
|
||||
|
||||
synchronized(this.field_181024_n) {
|
||||
for(TileEntity tileentity : this.field_181024_n) {
|
||||
@@ -72,7 +84,7 @@
|
||||
BlockPos blockpos2 = tileentity.func_174877_v();
|
||||
p_228426_1_.func_227860_a_();
|
||||
p_228426_1_.func_227861_a_((double)blockpos2.func_177958_n() - d0, (double)blockpos2.func_177956_o() - d1, (double)blockpos2.func_177952_p() - d2);
|
||||
@@ -1084,10 +1093,13 @@
|
||||
@@ -1084,10 +1098,13 @@
|
||||
iprofiler.func_219895_b("outline");
|
||||
BlockPos blockpos = ((BlockRayTraceResult)raytraceresult).func_216350_a();
|
||||
BlockState blockstate = this.field_72769_h.func_180495_p(blockpos);
|
||||
@@ -87,7 +99,7 @@
|
||||
}
|
||||
|
||||
RenderSystem.pushMatrix();
|
||||
@@ -1119,7 +1131,7 @@
|
||||
@@ -1119,7 +1136,7 @@
|
||||
this.field_239224_H_.func_237506_a_(this.field_72777_q.func_147110_a());
|
||||
RenderState.field_239237_T_.func_228547_a_();
|
||||
iprofiler.func_219895_b("particles");
|
||||
@@ -96,7 +108,7 @@
|
||||
RenderState.field_239237_T_.func_228549_b_();
|
||||
} else {
|
||||
iprofiler.func_219895_b("translucent");
|
||||
@@ -1129,7 +1141,7 @@
|
||||
@@ -1129,7 +1146,7 @@
|
||||
iprofiler.func_219895_b("string");
|
||||
this.func_228441_a_(RenderType.func_241715_r_(), p_228426_1_, d0, d1, d2);
|
||||
iprofiler.func_219895_b("particles");
|
||||
@@ -105,7 +117,7 @@
|
||||
}
|
||||
|
||||
RenderSystem.pushMatrix();
|
||||
@@ -1481,6 +1493,11 @@
|
||||
@@ -1481,6 +1498,11 @@
|
||||
}
|
||||
|
||||
public void func_228424_a_(MatrixStack p_228424_1_, float p_228424_2_) {
|
||||
@@ -117,7 +129,7 @@
|
||||
if (this.field_72777_q.field_71441_e.func_239132_a_().func_241683_c_() == DimensionRenderInfo.FogType.END) {
|
||||
this.func_228444_b_(p_228424_1_);
|
||||
} else if (this.field_72777_q.field_71441_e.func_239132_a_().func_241683_c_() == DimensionRenderInfo.FogType.NORMAL) {
|
||||
@@ -1609,6 +1626,11 @@
|
||||
@@ -1609,6 +1631,11 @@
|
||||
}
|
||||
|
||||
public void func_228425_a_(MatrixStack p_228425_1_, float p_228425_2_, double p_228425_3_, double p_228425_5_, double p_228425_7_) {
|
||||
@@ -129,7 +141,7 @@
|
||||
float f = this.field_72769_h.func_239132_a_().func_239213_a_();
|
||||
if (!Float.isNaN(f)) {
|
||||
RenderSystem.disableCull();
|
||||
@@ -1792,7 +1814,7 @@
|
||||
@@ -1792,7 +1819,7 @@
|
||||
|
||||
while(iterator.hasNext()) {
|
||||
ChunkRenderDispatcher.ChunkRender chunkrenderdispatcher$chunkrender = iterator.next();
|
||||
@@ -138,7 +150,7 @@
|
||||
this.field_174995_M.func_228902_a_(chunkrenderdispatcher$chunkrender);
|
||||
} else {
|
||||
chunkrenderdispatcher$chunkrender.func_228929_a_(this.field_174995_M);
|
||||
@@ -2076,7 +2098,12 @@
|
||||
@@ -2076,7 +2103,12 @@
|
||||
this.field_175008_n.func_217628_a(p_215319_1_, p_215319_2_, p_215319_3_, p_215319_4_);
|
||||
}
|
||||
|
||||
@@ -151,7 +163,7 @@
|
||||
ISound isound = this.field_147593_P.get(p_184377_2_);
|
||||
if (isound != null) {
|
||||
this.field_72777_q.func_147118_V().func_147683_b(isound);
|
||||
@@ -2084,7 +2111,7 @@
|
||||
@@ -2084,7 +2116,7 @@
|
||||
}
|
||||
|
||||
if (p_184377_1_ != null) {
|
||||
@@ -160,7 +172,7 @@
|
||||
if (musicdiscitem != null) {
|
||||
this.field_72777_q.field_71456_v.func_238451_a_(musicdiscitem.func_234801_g_());
|
||||
}
|
||||
@@ -2232,7 +2259,7 @@
|
||||
@@ -2232,7 +2264,7 @@
|
||||
break;
|
||||
case 1010:
|
||||
if (Item.func_150899_d(p_180439_4_) instanceof MusicDiscItem) {
|
||||
@@ -169,7 +181,7 @@
|
||||
} else {
|
||||
this.func_184377_a((SoundEvent)null, p_180439_3_);
|
||||
}
|
||||
@@ -2382,8 +2409,8 @@
|
||||
@@ -2382,8 +2414,8 @@
|
||||
break;
|
||||
case 2001:
|
||||
BlockState blockstate = Block.func_196257_b(p_180439_4_);
|
||||
@@ -180,7 +192,7 @@
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -2531,7 +2558,7 @@
|
||||
@@ -2531,7 +2563,7 @@
|
||||
} else {
|
||||
int i = p_228420_0_.func_226658_a_(LightType.SKY, p_228420_2_);
|
||||
int j = p_228420_0_.func_226658_a_(LightType.BLOCK, p_228420_2_);
|
||||
@@ -189,7 +201,7 @@
|
||||
if (j < k) {
|
||||
j = k;
|
||||
}
|
||||
@@ -2570,6 +2597,11 @@
|
||||
@@ -2570,6 +2602,11 @@
|
||||
return this.field_239226_J_;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,22 +1,26 @@
|
||||
--- a/net/minecraft/client/world/DimensionRenderInfo.java
|
||||
+++ b/net/minecraft/client/world/DimensionRenderInfo.java
|
||||
@@ -26,6 +26,9 @@
|
||||
@@ -26,6 +26,10 @@
|
||||
private final DimensionRenderInfo.FogType field_241680_e_;
|
||||
private final boolean field_241681_f_;
|
||||
private final boolean field_239212_e_;
|
||||
+ private net.minecraftforge.client.IWeatherRenderHandler weatherRenderHandler = null;
|
||||
+ private net.minecraftforge.client.IWeatherParticleRenderHandler weatherParticleRenderHandler = null;
|
||||
+ private net.minecraftforge.client.ISkyRenderHandler skyRenderHandler = null;
|
||||
+ private net.minecraftforge.client.ICloudRenderHandler cloudRenderHandler = null;
|
||||
|
||||
public DimensionRenderInfo(float p_i241259_1_, boolean p_i241259_2_, DimensionRenderInfo.FogType p_i241259_3_, boolean p_i241259_4_, boolean p_i241259_5_) {
|
||||
this.field_239210_c_ = p_i241259_1_;
|
||||
@@ -82,6 +85,28 @@
|
||||
@@ -82,6 +86,35 @@
|
||||
return this.field_239212_e_;
|
||||
}
|
||||
|
||||
+ public void setWeatherRenderHandler(net.minecraftforge.client.IWeatherRenderHandler weatherRenderHandler) {
|
||||
+ this.weatherRenderHandler = weatherRenderHandler;
|
||||
+ }
|
||||
+ public void setWeatherParticleRenderHandler(net.minecraftforge.client.IWeatherParticleRenderHandler weatherParticleRenderHandler) {
|
||||
+ this.weatherParticleRenderHandler = weatherParticleRenderHandler;
|
||||
+ }
|
||||
+ public void setSkyRenderHandler(net.minecraftforge.client.ISkyRenderHandler skyRenderHandler) {
|
||||
+ this.skyRenderHandler = skyRenderHandler;
|
||||
+ }
|
||||
@@ -32,6 +36,10 @@
|
||||
+ return weatherRenderHandler;
|
||||
+ }
|
||||
+ @Nullable
|
||||
+ public net.minecraftforge.client.IWeatherParticleRenderHandler getWeatherParticleRenderHandler() {
|
||||
+ return weatherParticleRenderHandler;
|
||||
+ }
|
||||
+ @Nullable
|
||||
+ public net.minecraftforge.client.ISkyRenderHandler getSkyRenderHandler() {
|
||||
+ return skyRenderHandler;
|
||||
+ }
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Minecraft Forge
|
||||
* Copyright (c) 2016-2020.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation version 2.1
|
||||
* of the License.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
package net.minecraftforge.client;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.ActiveRenderInfo;
|
||||
import net.minecraft.client.world.ClientWorld;
|
||||
|
||||
/**
|
||||
* Call {@link net.minecraft.client.world.DimensionRenderInfo#setWeatherParticleRenderHandler(net.minecraftforge.client.IWeatherParticleRenderHandler)}, obtained from a {@link ClientWorld} with an implementation of this to override all weather particle rendering with your own.
|
||||
* This handles ground particles that can be seen when it's raining (splash/smoke particles).
|
||||
* This also includes playing rain sounds.
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface IWeatherParticleRenderHandler {
|
||||
void render(int ticks, ClientWorld world, Minecraft mc, ActiveRenderInfo activeRenderInfoIn);
|
||||
}
|
||||
Reference in new issue
Block a user