74
74
import org .lwjgl .opengl .GL11 ;
75
75
76
76
/**
77
- * These methods are called from vanilla minecraft through bytecode injection
78
- * done in MicdoodleCore
79
- *
80
- * See https://github.com/micdoodle8/MicdoodleCore
77
+ * These methods are called from vanilla minecraft through bytecode injection done in MicdoodleCore See https://github.com/micdoodle8/MicdoodleCore
81
78
*/
82
79
public class TransformerHooks
83
80
{
84
81
85
- private static List <IWorldGenerator > otherModGeneratorsWhitelist = new LinkedList <>();
86
- private static IWorldGenerator generatorTCAuraNodes = null ;
87
- private static Method generateTCAuraNodes = null ;
88
- private static boolean generatorsInitialised = false ;
89
- public static List <Block > spawnListAE2_GC = new LinkedList <>();
90
- public static ThreadLocal <BufferBuilder > renderBuilder = new ThreadLocal <>();
91
- private static int rainSoundCounter = 0 ;
92
- private static Random random = new Random ();
82
+ private static List <IWorldGenerator > otherModGeneratorsWhitelist = new LinkedList <>();
83
+ private static IWorldGenerator generatorTCAuraNodes = null ;
84
+ private static Method generateTCAuraNodes = null ;
85
+ private static boolean generatorsInitialised = false ;
86
+ public static List <Block > spawnListAE2_GC = new LinkedList <>();
87
+ public static ThreadLocal <BufferBuilder > renderBuilder = new ThreadLocal <>();
88
+ private static int rainSoundCounter = 0 ;
89
+ private static Random random = new Random ();
93
90
94
91
public static double getGravityForEntity (Entity entity )
95
92
{
@@ -299,8 +296,7 @@ private static void addWorldGenForName(String logString, String name)
299
296
}
300
297
301
298
/*
302
- * Used to supplement the hard-coded blocklist in AE2's MeteoritePlacer
303
- * class
299
+ * Used to supplement the hard-coded blocklist in AE2's MeteoritePlacer class
304
300
*/
305
301
public static boolean addAE2MeteorSpawn (Object o , Block b )
306
302
{
@@ -378,8 +374,7 @@ public static Vec3d getFogColorHook(World world)
378
374
public static Vec3d getSkyColorHook (World world )
379
375
{
380
376
EntityPlayerSP player = FMLClientHandler .instance ().getClient ().player ;
381
- if (world .provider .getSkyRenderer () instanceof SkyProviderOverworld
382
- || (player != null && player .posY > Constants .OVERWORLD_CLOUD_HEIGHT && player .getRidingEntity () instanceof EntitySpaceshipBase ))
377
+ if (world .provider .getSkyRenderer () instanceof SkyProviderOverworld || (player != null && player .posY > Constants .OVERWORLD_CLOUD_HEIGHT && player .getRidingEntity () instanceof EntitySpaceshipBase ))
383
378
{
384
379
float f1 = world .getCelestialAngle (1.0F );
385
380
float f2 = MathHelper .cos (f1 * Constants .twoPI ) * 2.0F + 0.5F ;
@@ -399,9 +394,9 @@ public static Vec3d getSkyColorHook(World world)
399
394
int k = MathHelper .floor (player .posZ );
400
395
BlockPos pos = new BlockPos (i , j , k );
401
396
int l = ForgeHooksClient .getSkyBlendColour (world , pos );
402
- float f4 = (float ) ( l >> 16 & 255 ) / 255.0F ;
403
- float f5 = (float ) ( l >> 8 & 255 ) / 255.0F ;
404
- float f6 = (float ) ( l & 255 ) / 255.0F ;
397
+ float f4 = (l >> 16 & 255 ) / 255.0F ;
398
+ float f5 = (l >> 8 & 255 ) / 255.0F ;
399
+ float f6 = (l & 255 ) / 255.0F ;
405
400
f4 *= f2 ;
406
401
f5 *= f2 ;
407
402
f6 *= f2 ;
@@ -508,13 +503,11 @@ public static void orientCamera(float partialTicks)
508
503
GL11 .glRotatef (yaw * gDir .getYawGravityY (), 0.0F , 1.0F , 0.0F );
509
504
GL11 .glRotatef (yaw * gDir .getYawGravityZ (), 0.0F , 0.0F , 1.0F );
510
505
511
-
512
506
GL11 .glTranslatef (eyeHeightChange * gDir .getEyeVecX (), eyeHeightChange * gDir .getEyeVecY (), eyeHeightChange * gDir .getEyeVecZ ());
513
507
514
508
if (stats .getGravityTurnRate () < 1.0F )
515
509
{
516
- GL11 .glRotatef (90.0F * (stats .getGravityTurnRatePrev () + (stats .getGravityTurnRate () - stats .getGravityTurnRatePrev ()) * partialTicks ), stats .getGravityTurnVecX (),
517
- stats .getGravityTurnVecY (), stats .getGravityTurnVecZ ());
510
+ GL11 .glRotatef (90.0F * (stats .getGravityTurnRatePrev () + (stats .getGravityTurnRate () - stats .getGravityTurnRatePrev ()) * partialTicks ), stats .getGravityTurnVecX (), stats .getGravityTurnVecY (), stats .getGravityTurnVecZ ());
518
511
}
519
512
}
520
513
}
@@ -633,7 +626,7 @@ public static int addRainParticles(int result, int rendererUpdateCount, float f)
633
626
}
634
627
IWeatherProvider moddedProvider = ((IWeatherProvider ) world .provider );
635
628
636
- random .setSeed (( long ) rendererUpdateCount * 312987231L );
629
+ random .setSeed (rendererUpdateCount * 312987231L );
637
630
Entity entity = mc .getRenderViewEntity ();
638
631
BlockPos blockpos = new BlockPos (entity );
639
632
int i = 10 ;
@@ -692,7 +685,15 @@ public static int addRainParticles(int result, int rendererUpdateCount, float f)
692
685
}
693
686
}
694
687
695
- if (j > 0 && random .nextInt (moddedProvider .getSoundInterval (f )) < rainSoundCounter ++)
688
+ if (moddedProvider .getSoundInterval (f ) > 0 )
689
+ {
690
+ if (j > 0 && random .nextInt (moddedProvider .getSoundInterval (f )) < rainSoundCounter ++)
691
+ {
692
+ rainSoundCounter = 0 ;
693
+
694
+ moddedProvider .weatherSounds (j , mc , world , blockpos , xx , yy , zz , random );
695
+ }
696
+ } else if (j > 0 && 0 < rainSoundCounter ++)
696
697
{
697
698
rainSoundCounter = 0 ;
698
699
0 commit comments