totos51

WorldProviderDark

Mar 24th, 2014
70
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package Gallad.Mineald.world;
  2.  
  3. import Gallad.Mineald.Import;
  4. import net.minecraft.client.main.Main;
  5. import net.minecraft.entity.Entity;
  6. import net.minecraft.util.ChunkCoordinates;
  7. import net.minecraft.util.MathHelper;
  8. import net.minecraft.util.Vec3;
  9. import net.minecraft.world.World;
  10. import net.minecraft.world.WorldProvider;
  11. import net.minecraft.world.biome.WorldChunkManagerHell;
  12. import net.minecraft.world.chunk.IChunkProvider;
  13. import cpw.mods.fml.relauncher.Side;
  14. import cpw.mods.fml.relauncher.SideOnly;
  15.  
  16. public class WorldProviderDark extends WorldProvider {
  17.  
  18. private float[] colorsSunriseSunset = new float[4];
  19.  
  20. public void registerWorldChunkManager() {
  21. this.worldChunkMgr = new WorldChunkManagerHell(Import.DarkBiome,
  22. this.dimensionId, this.dimensionId);
  23. this.dimensionId = Import.DimensionID;
  24. this.hasNoSky = false;
  25. }
  26.  
  27. public IChunkProvider createChunkGenerator()
  28. {
  29. return new ChunkProviderDark(this.worldObj, this.worldObj.getSeed(),
  30. false);
  31. }
  32.  
  33. public int getAverageGroundLevel() {
  34. return 0;
  35. }
  36.  
  37. @SideOnly(Side.CLIENT)
  38. public boolean doesXZShowFog(int par1, int par2) {
  39. return false;
  40. }
  41.  
  42. public String getDimensionName() {
  43. return "DarkWorld";
  44. }
  45.  
  46. public boolean renderStars() {
  47. return false;
  48. }
  49.  
  50. public float getStarBrightness(World world, float f) {
  51. return 0.0F;
  52. }
  53.  
  54. public boolean renderClouds() {
  55. return true;
  56. }
  57.  
  58. public boolean renderVoidFog() {
  59. return true;
  60. }
  61.  
  62. public boolean renderEndSky() {
  63. return false;
  64. }
  65.  
  66. public float setSunSize() {
  67. return 10.0F;
  68. }
  69.  
  70. public float setMoonSize() {
  71. return 8.0F;
  72. }
  73.  
  74. @SideOnly(Side.CLIENT)
  75. public boolean isSkyColored() {
  76. return true;
  77. }
  78.  
  79. public boolean canRespawnHere() {
  80. return true;
  81. }
  82.  
  83. public boolean isSurfaceWorld() {
  84. return true;
  85. }
  86.  
  87. @SideOnly(Side.CLIENT)
  88. public float getCloudHeight() {
  89. return 200.0F;
  90. }
  91.  
  92. @SideOnly(Side.CLIENT)
  93. public String getSunTexture() {
  94. return "/Main:TwinSuns.png";
  95. }
  96.  
  97. protected void generateLightBrightnessTable() {
  98. float f = 0.0F;
  99.  
  100. for (int i = 0; i <= 15; ++i)
  101. {
  102. float f1 = 1.0F - (float)i / 15.0F;
  103. this.lightBrightnessTable[i] = (1.0F - f1) / (f1 * 3.0F + 1.0F) * (1.0F - f) + f;
  104. }
  105. }
  106.  
  107. @SideOnly(Side.CLIENT)
  108. public String getWelcomeMessage() {
  109. if ((this instanceof WorldProviderDark)) {
  110. return "Entering Dark Dimension";
  111. }
  112. return null;
  113. }
  114.  
  115. @SideOnly(Side.CLIENT)
  116. public float[] calcSunriseSunsetColors(float par1, float par2) {
  117. float f2 = 0.4F;
  118. float f3 = MathHelper.cos(par1 * 3.141593F * 2.0F) - 0.0F;
  119. float f4 = -0.0F;
  120. if ((f3 >= f4 - f2) && (f3 <= f4 + f2)) {
  121. float f5 = (f3 - f4) / f2 * 0.5F + 0.5F;
  122. float f6 = 1.0F - (1.0F - MathHelper.sin(f5 * 3.141593F)) * 0.99F;
  123. f6 *= f6;
  124. this.colorsSunriseSunset[0] = (f5 * 0.3F + 0.7F);
  125. this.colorsSunriseSunset[1] = (f5 * f5 * 0.7F + 0.2F);
  126. this.colorsSunriseSunset[2] = (f5 * f5 * 0.0F + 0.2F);
  127. this.colorsSunriseSunset[3] = f6;
  128. return this.colorsSunriseSunset;
  129. }
  130. return null;
  131. }
  132.  
  133. public float calculateCelestialAngle(long par1, float par3) {
  134. int j = (int) (par1 % 24000L);
  135. float f1 = (j + par3) / 24000.0F - 0.25F;
  136. if (f1 < 0.0F) {
  137. f1 += 1.0F;
  138. }
  139. if (f1 > 1.0F) {
  140. f1 -= 1.0F;
  141. }
  142. float f2 = f1;
  143. f1 = 1.0F - (float) ((Math.cos(f1 * 3.141592653589793D) + 1.0D) / 2.0D);
  144. f1 = f2 + (f1 - f2) / 3.0F;
  145. return f1;
  146. }
  147.  
  148. @SideOnly(Side.CLIENT)
  149. public Vec3 getFogColor(float par1, float par2) {
  150. int i = 10518688;
  151. float f2 = MathHelper.cos(par1 * 3.141593F * 2.0F) * 2.0F + 0.5F;
  152. if (f2 < 0.0F) {
  153. f2 = 0.0F;
  154. }
  155. if (f2 > 1.0F) {
  156. f2 = 1.0F;
  157. }
  158. float f3 = (i >> 16 & 0xFF) / 255.0F;
  159. float f4 = (i >> 8 & 0xFF) / 255.0F;
  160. float f5 = (i & 0xFF) / 255.0F;
  161. f3 *= (f2 * 0.0F + 0.15F);
  162. f4 *= (f2 * 0.0F + 0.15F);
  163. f5 *= (f2 * 0.0F + 0.15F);
  164. return this.worldObj.getWorldVec3Pool().getVecFromPool(f3, f4, f5);
  165. }
  166.  
  167. @Override
  168. public Vec3 getSkyColor(Entity cameraEntity, float partialTicks)
  169. {
  170. return this.worldObj.getWorldVec3Pool().getVecFromPool(0, 0, 1);
  171. }
  172.  
  173. }
RAW Paste Data