Guest User

Untitled

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