Guest User

Untitled

a guest
Aug 28th, 2015
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 5.10 KB | None | 0 0
  1. package com.halestormxv.worldALT;
  2.  
  3. import net.minecraft.entity.Entity;
  4. import net.minecraft.util.ChunkCoordinates;
  5. import net.minecraft.util.MathHelper;
  6. import net.minecraft.util.Vec3;
  7. import net.minecraft.world.World;
  8. import net.minecraft.world.WorldProvider;
  9. import net.minecraft.world.chunk.IChunkProvider;
  10. import net.minecraftforge.client.IRenderHandler;
  11. import net.minecraftforge.common.DimensionManager;
  12.  
  13. import com.halestormxv.world.renderers.CloudRenderer;
  14. import com.halestormxv.world.renderers.SkyRenderer;
  15. import com.halestormxv.world.renderers.WeatherRenderer;
  16.  
  17. import cpw.mods.fml.relauncher.Side;
  18. import cpw.mods.fml.relauncher.SideOnly;
  19.  
  20. public class WorldProviderForest extends WorldProvider{
  21.    
  22.     @Override
  23.     /** tells Minecraft to use our new Terrain Generator */
  24.     public IChunkProvider createChunkGenerator() {
  25.         return new ChunkProviderForest(this.worldObj, this.worldObj.getSeed(), true);
  26.     }
  27.  
  28.     @Override
  29.     /** tells Minecraft to use our new WorldChunkManager **/
  30.     public void registerWorldChunkManager() {
  31.         this.worldChunkMgr = new WorldChunkManagerForest(worldObj.getSeed(), terrainType);
  32.         this.dimensionId = DimensionIDs.LIGHTFORESTDIMENSION;
  33.     }
  34.    
  35.     /** Get Provider for Dimension **/
  36.     public static WorldProvider getProviderForDimension(int id)
  37.     {
  38.         return DimensionManager.createProviderFor(DimensionIDs.LIGHTFORESTDIMENSION);
  39.     }
  40.  
  41.     @Override
  42.     /**
  43.      * @return the name of the dimension
  44.      */
  45.     public String getDimensionName() {
  46.         return "Celestial Dimension";
  47.     }
  48.  
  49.     @Override
  50.     /** sets/creates the save folder */
  51.     public String getSaveFolder() {
  52.             return "DIM" + DimensionIDs.LIGHTFORESTDIMENSION;
  53.     }
  54.  
  55.     @SideOnly(Side.CLIENT)
  56.     /** should stars be rendered? */
  57.     public boolean renderStars() {
  58.         return true;
  59.     }
  60.  
  61.     @SideOnly(Side.CLIENT)
  62.     /** @return the player speed */
  63.     public double getMovementFactor() {
  64.         return 0.1;
  65.     }
  66.  
  67.     @SideOnly(Side.CLIENT)
  68.     /** @return the light value of the stars*/
  69.     public float getStarBrightness(World world, float f) {
  70.         return 1.0F;
  71.     }
  72.  
  73.     @SideOnly(Side.CLIENT)
  74.     /** should clouds be rendered? */
  75.     public boolean renderClouds() {
  76.         return false;
  77.     }
  78.  
  79.     @SideOnly(Side.CLIENT)
  80.     public boolean renderVoidFog() {
  81.         return false;
  82.     }
  83.  
  84.     @SideOnly(Side.CLIENT)
  85.     /** should the end sky be rendered or the overworld sky? */
  86.     public boolean renderEndSky() {
  87.         return true;
  88.     }
  89.  
  90.     @SideOnly(Side.CLIENT)
  91.     /** @return the size of the sun */
  92.     public float setSunSize() {
  93.         return 0.25F;
  94.     }
  95.  
  96.     @SideOnly(Side.CLIENT)
  97.     /** @return the size of the moon */
  98.     public float setMoonSize() {
  99.         return 4.0F;
  100.     }
  101.  
  102.     @Override
  103.     @SideOnly(Side.CLIENT)
  104.     /**
  105.      * @return the sky color
  106.      */
  107.     public Vec3 getSkyColor(Entity cameraEntity, float partialTicks) {
  108.         return worldObj.getSkyColorBody(cameraEntity, partialTicks);
  109.     }
  110.  
  111.     @SideOnly(Side.CLIENT)
  112.     /** should a color for the sky be rendered? */
  113.     public boolean isSkyColored()
  114.     {
  115.         return true;
  116.     }
  117.  
  118.     @Override
  119.     /** can the player respawn in this dimension? */
  120.     public boolean canRespawnHere()
  121.     {
  122.         return true;
  123.     }
  124.  
  125.     @Override
  126.     /** is this a surface world or an underworld */
  127.     public boolean isSurfaceWorld()
  128.     {
  129.         return true;
  130.     }
  131.  
  132.     @Override
  133.     @SideOnly(Side.CLIENT)
  134.     /** @return the high of the clouds */
  135.     public float getCloudHeight()
  136.     {
  137.         return this.terrainType.getCloudHeight();
  138.     }
  139.  
  140.     @Override
  141.     public ChunkCoordinates getEntrancePortalLocation()
  142.     {
  143.         return new ChunkCoordinates(50, 5, 0);
  144.     }
  145.  
  146.     @Override
  147.     /** the light value in this dimension */
  148.     protected void generateLightBrightnessTable()
  149.     {
  150.         float f = 0.0F;
  151.  
  152.         for (int i = 0; i <= 15; ++i)
  153.         {
  154.             float f1 = 1.0F - (float)i / 15.0F;
  155.             this.lightBrightnessTable[i] = (1.0F - f1) / (f1 * 3.0F + 1.0F) * (1.0F - f) + f;
  156.         }
  157.     }
  158.  
  159.     @Override
  160.     @SideOnly(Side.CLIENT)
  161.     /** @return the dimension join message */
  162.     public String getWelcomeMessage()
  163.     {
  164.         return "Entering the Celestial Dimension";
  165.     }
  166.  
  167.     @Override
  168.     @SideOnly(Side.CLIENT)
  169.     /** @return the dimension leave message */
  170.     public String getDepartMessage()
  171.     {
  172.         return "Leaving the Celestial Dimension";
  173.     }
  174.  
  175.     @Override
  176.     public IRenderHandler getSkyRenderer() {
  177.         return new SkyRenderer();
  178.     }
  179.  
  180.     @Override
  181.     public IRenderHandler getCloudRenderer() {
  182.         return new CloudRenderer();
  183.     }
  184.  
  185.     @Override
  186.     public IRenderHandler getWeatherRenderer() {
  187.         return new WeatherRenderer();
  188.     }
  189.  
  190.     @Override
  191.     public Vec3 drawClouds(float partialTicks) {
  192.         // TODO Auto-generated method stub
  193.         return super.drawClouds(partialTicks);
  194.     }
  195.  
  196.     @Override
  197.     @SideOnly(Side.CLIENT)
  198.     public Vec3 getFogColor(float par1, float par2)
  199.     {
  200.          float f2 = MathHelper.cos(par1 * (float)Math.PI * 2.0F) * 2.0F + 0.5F;
  201.  
  202.             if (f2 < 0.0F)
  203.             {
  204.                 f2 = 0.0F;
  205.             }
  206.  
  207.             if (f2 > 1.0F)
  208.             {
  209.                 f2 = 1.0F;
  210.             }
  211.  
  212.             float f3 = 0.7529412F;
  213.             float f4 = 0.84705883F;
  214.             float f5 = 1.0F;
  215.             f3 *= f2 * 0.94F + 0.06F;
  216.             f4 *= f2 * 0.94F + 0.06F;
  217.             f5 *= f2 * 0.91F + 0.09F;
  218.             return Vec3.createVectorHelper((double)f3, (double)f4, (double)f5);
  219.     }
  220. }
Advertisement
Add Comment
Please, Sign In to add comment