Guest User

Untitled

a guest
Aug 28th, 2015
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 6.06 KB | None | 0 0
  1. package com.halestormxv.worldALT.biomes;
  2.  
  3. import java.util.Random;
  4.  
  5. import com.halestormxv.blocks.CelestialCraft_blocks;
  6. import com.halestormxv.worldALT.biomes.decorators.BiomeDecoratorMod;
  7.  
  8. import net.minecraft.block.Block;
  9. import net.minecraft.block.material.Material;
  10. import net.minecraft.init.Blocks;
  11. import net.minecraft.world.World;
  12. import net.minecraft.world.biome.BiomeGenBase;
  13. import net.minecraft.world.gen.feature.WorldGenTallGrass;
  14. import net.minecraft.world.gen.feature.WorldGenerator;
  15. import net.minecraftforge.common.BiomeDictionary;
  16. import net.minecraftforge.common.BiomeDictionary.Type;
  17.  
  18. /**
  19.  * TutorialBiomes.class Holds and loads all Tutorial Biomes.
  20.  *
  21.  * @author Jimmy04Creeper
  22.  */
  23. public class ModBiomes extends BiomeGenBase {
  24.  
  25.     /** The biome height */
  26.     public static final BiomeGenBase.Height biomeHeight = new BiomeGenBase.Height(0.3F, 0.6F);
  27.  
  28.     public static BiomeGenBase forestLight;
  29.     public static BiomeGenBase forestDark;
  30.  
  31.     public ModBiomes(int biomeId) {
  32.         super(biomeId);
  33.         this.theBiomeDecorator = new BiomeDecoratorMod();
  34.     }
  35.  
  36.     static {
  37.         forestLight = (new BiomeLightForest(BiomeIDs.LIGHT).setColor(5470985).setTemperatureRainfall(0.95F, 0.9F).setHeight(biomeHeight).setBiomeName("Celestial Forest"));
  38.         //forestDark = (new BiomeDarkForest(BiomeIDs.DARK).setColor(34049320).setTemperatureRainfall(0.8F, 0.4F).setHeight(biomeHeight).setBiomeName("Darkness Forest"));
  39.     }
  40.  
  41.     public WorldGenerator getRandomWorldGenForGrass(Random random)
  42.     {
  43.         if (random.nextInt(4) == 0)
  44.             return new WorldGenTallGrass(Blocks.tallgrass, 2);
  45.         else
  46.             return new WorldGenTallGrass(Blocks.tallgrass, 1);
  47.     }
  48.  
  49.     public static void registerWithBiomeDictionary()
  50.     {
  51.         BiomeDictionary.registerBiomeType(forestLight, Type.FOREST);
  52.         BiomeDictionary.registerBiomeType(forestDark, Type.FOREST);
  53.         BiomeDictionary.registerAllBiomes();
  54.     }
  55.    
  56.     @Override
  57.     public void genTerrainBlocks(World p_150573_1_, Random p_150573_2_, Block[] p_150573_3_, byte[] p_150573_4_, int p_150573_5_, int p_150573_6_, double p_150573_7_) {
  58.         genBiomeModdedTerrain(p_150573_1_, p_150573_2_, p_150573_3_, p_150573_4_, p_150573_5_, p_150573_6_, p_150573_7_);
  59.     }
  60.  
  61.     /**
  62.      * Replaces custom Stone to allow top/filler blocks to work in dimension.
  63.      *
  64.      * @param world
  65.      * @param random
  66.      * @param replacableBlock
  67.      * @param aByte
  68.      * @param x
  69.      * @param y
  70.      * @param z
  71.      */
  72.     public void genBiomeModdedTerrain(World world, Random random, Block[] replacableBlock, byte[] aByte, int x, int y, double z)
  73.     {
  74.         Block block = this.topBlock;
  75.         byte b0 = (byte) (this.field_150604_aj & 255);
  76.         Block block1 = this.fillerBlock;
  77.         int k = -1;
  78.         int l = (int) (z / 3.0D + 3.0D + random.nextDouble() * 0.25D);
  79.         int i1 = x & 15;
  80.         int j1 = y & 15;
  81.         int k1 = replacableBlock.length / 256;
  82.         for (int l1 = 255; l1 >= 0; --l1)
  83.         {
  84.             int i2 = (j1 * 16 + i1) * k1 + l1;
  85.  
  86.             if (l1 <= 0 + random.nextInt(5))
  87.             {
  88.                 replacableBlock[i2] = Blocks.bedrock;
  89.             }
  90.             else
  91.             {
  92.                 Block block2 = replacableBlock[i2];
  93.  
  94.                 if (block2 != null && block2.getMaterial() != Material.air)
  95.                 {
  96.                     if (block2 == CelestialCraft_blocks.CelFillStone)
  97.                     {
  98.                         if (k == -1)
  99.                         {
  100.                             if (l <= 0)
  101.                             {
  102.                                 block = null;
  103.                                 b0 = 0;
  104.                                 block1 = CelestialCraft_blocks.CelFillStone;
  105.                             }
  106.                             else if (l1 >= 59 && l1 <= 64)
  107.                             {
  108.                                 block = this.topBlock;
  109.                                 b0 = (byte) (this.field_150604_aj & 255);
  110.                                 block1 = this.fillerBlock;
  111.                             }
  112.  
  113.                             if (l1 < 63 && (block == null || block.getMaterial() == Material.air))
  114.                             {
  115.                                 if (this.getFloatTemperature(x, l1, y) < 0.15F)
  116.                                 {
  117.                                     block = Blocks.ice;
  118.                                     b0 = 0;
  119.                                 }
  120.                                 else
  121.                                 {
  122.                                     block = Blocks.water;
  123.                                     b0 = 0;
  124.                                 }
  125.                             }
  126.  
  127.                             k = l;
  128.  
  129.                             if (l1 >= 62)
  130.                             {
  131.                                 replacableBlock[i2] = block;
  132.                                 aByte[i2] = b0;
  133.                             }
  134.                             else if (l1 < 56 - l)
  135.                             {
  136.                                 block = null;
  137.                                 block1 = CelestialCraft_blocks.CelFillStone;
  138.                                 replacableBlock[i2] = Blocks.gravel;
  139.                             }
  140.                             else
  141.                             {
  142.                                 replacableBlock[i2] = block1;
  143.                             }
  144.                         }
  145.                         else if (k > 0)
  146.                         {
  147.                             --k;
  148.                             replacableBlock[i2] = block1;
  149.  
  150.                             if (k == 0 && block1 == Blocks.sand)
  151.                             {
  152.                                 k = random.nextInt(4) + Math.max(0, l1 - 63);
  153.                                 block1 = Blocks.sandstone;
  154.                             }
  155.                         }
  156.                     }
  157.                 }
  158.                 else
  159.                 {
  160.                     k = -1;
  161.                 }
  162.             }
  163.         }
  164.     }
  165.  
  166. }
Advertisement
Add Comment
Please, Sign In to add comment