Guest User

Untitled

a guest
Jan 26th, 2015
274
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.49 KB | None | 0 0
  1. package com.CrystalMod.Biomes;
  2.  
  3. import java.util.ArrayList;
  4. import java.util.List;
  5.  
  6. import net.minecraft.util.WeightedRandom;
  7. import net.minecraft.world.WorldType;
  8. import net.minecraft.world.biome.BiomeGenBase;
  9. import net.minecraft.world.gen.layer.GenLayer;
  10. import net.minecraft.world.gen.layer.IntCache;
  11. import net.minecraftforge.common.BiomeManager;
  12. import net.minecraftforge.common.BiomeManager.BiomeEntry;
  13.  
  14. public class CrystalBiomeLayers extends GenLayer
  15. {
  16. private List<BiomeEntry> desertBiomes = new ArrayList<BiomeEntry>();
  17. private List<BiomeEntry> warmBiomes = new ArrayList<BiomeEntry>();
  18. private List<BiomeEntry> coolBiomes = new ArrayList<BiomeEntry>();
  19. private List<BiomeEntry> icyBiomes = new ArrayList<BiomeEntry>();
  20.  
  21. private static final String __OBFID = "CL_00000555";
  22.  
  23. public CrystalBiomeLayers(long p_i2122_1_, GenLayer p_i2122_3_, WorldType p_i2122_4_)
  24. {
  25. super(p_i2122_1_);
  26.  
  27. this.parent = p_i2122_3_;
  28.  
  29. this.desertBiomes.addAll(BiomeManager.desertBiomes);
  30. this.warmBiomes.addAll(BiomeManager.warmBiomes);
  31. this.coolBiomes.addAll(BiomeManager.coolBiomes);
  32. this.icyBiomes.addAll(BiomeManager.icyBiomes);
  33.  
  34. if (p_i2122_4_ == WorldType.DEFAULT)
  35. {
  36. desertBiomes.add(new BiomeEntry(BiomeGenBase.desert, 10));
  37. desertBiomes.add(new BiomeEntry(BiomeGenBase.forest, 10));
  38. desertBiomes.add(new BiomeEntry(BiomeGenBase.extremeHills, 10));
  39. desertBiomes.add(new BiomeEntry(BiomeGenBase.swampland, 10));
  40. desertBiomes.add(new BiomeEntry(BiomeGenBase.plains, 10));
  41. desertBiomes.add(new BiomeEntry(BiomeGenBase.taiga, 10));
  42. desertBiomes.add(new BiomeEntry(BiomeRegistry.biomeCrystal, 10));
  43. }
  44. else
  45. {
  46. desertBiomes.add(new BiomeEntry(BiomeGenBase.desert, 30));
  47. desertBiomes.add(new BiomeEntry(BiomeGenBase.savanna, 20));
  48. desertBiomes.add(new BiomeEntry(BiomeGenBase.plains, 10));
  49. desertBiomes.add(new BiomeEntry(BiomeRegistry.biomeCrystal, 10));
  50. }
  51. }
  52.  
  53. /**
  54. * Returns a list of integer values generated by this layer. These may be interpreted as temperatures, rainfall
  55. * amounts, or biomeList[] indices based on the particular GenLayer subclass.
  56. */
  57. public int[] getInts(int p_75904_1_, int p_75904_2_, int p_75904_3_, int p_75904_4_)
  58. {
  59. int[] aint = this.parent.getInts(p_75904_1_, p_75904_2_, p_75904_3_, p_75904_4_);
  60. int[] aint1 = IntCache.getIntCache(p_75904_3_ * p_75904_4_);
  61.  
  62. for (int i1 = 0; i1 < p_75904_4_; ++i1)
  63. {
  64. for (int j1 = 0; j1 < p_75904_3_; ++j1)
  65. {
  66. this.initChunkSeed((long)(j1 + p_75904_1_), (long)(i1 + p_75904_2_));
  67. int k1 = aint[j1 + i1 * p_75904_3_];
  68. int l1 = (k1 & 3840) >> 8;
  69. k1 &= -3841;
  70.  
  71. if (isBiomeOceanic(k1))
  72. {
  73. aint1[j1 + i1 * p_75904_3_] = k1;
  74. }
  75. else if (k1 == BiomeGenBase.mushroomIsland.biomeID)
  76. {
  77. aint1[j1 + i1 * p_75904_3_] = k1;
  78. }
  79. else if (k1 == 1)
  80. {
  81. if (l1 > 0)
  82. {
  83. if (this.nextInt(3) == 0)
  84. {
  85. aint1[j1 + i1 * p_75904_3_] = BiomeGenBase.mesaPlateau.biomeID;
  86. }
  87. else
  88. {
  89. aint1[j1 + i1 * p_75904_3_] = BiomeGenBase.mesaPlateau_F.biomeID;
  90. }
  91. }
  92. else
  93. {
  94. aint1[j1 + i1 * p_75904_3_] = ((BiomeEntry)WeightedRandom.getItem(this.desertBiomes, (int)(this.nextLong(WeightedRandom.getTotalWeight(this.desertBiomes) / 10) * 10))).biome.biomeID;
  95. }
  96. }
  97. else if (k1 == 2)
  98. {
  99. if (l1 > 0)
  100. {
  101. aint1[j1 + i1 * p_75904_3_] = BiomeGenBase.jungle.biomeID;
  102. }
  103. else
  104. {
  105. aint1[j1 + i1 * p_75904_3_] = ((BiomeEntry)WeightedRandom.getItem(this.warmBiomes, (int)(this.nextLong(WeightedRandom.getTotalWeight(this.warmBiomes) / 10) * 10))).biome.biomeID;
  106. }
  107. }
  108. else if (k1 == 3)
  109. {
  110. if (l1 > 0)
  111. {
  112. aint1[j1 + i1 * p_75904_3_] = BiomeGenBase.megaTaiga.biomeID;
  113. }
  114. else
  115. {
  116. aint1[j1 + i1 * p_75904_3_] = ((BiomeEntry)WeightedRandom.getItem(this.coolBiomes, (int)(this.nextLong(WeightedRandom.getTotalWeight(this.coolBiomes) / 10) * 10))).biome.biomeID;
  117. }
  118. }
  119. else if (k1 == 4)
  120. {
  121. aint1[j1 + i1 * p_75904_3_] = ((BiomeEntry)WeightedRandom.getItem(this.icyBiomes, (int)(this.nextLong(WeightedRandom.getTotalWeight(this.icyBiomes) / 10) * 10))).biome.biomeID;
  122. }
  123. else
  124. {
  125. aint1[j1 + i1 * p_75904_3_] = BiomeGenBase.mushroomIsland.biomeID;
  126. }
  127. }
  128. }
  129.  
  130. return aint1;
  131. }
  132. }
Advertisement
Add Comment
Please, Sign In to add comment