Guest User

Untitled

a guest
Jun 19th, 2016
38
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package fr.craftesys.craftesys.generation;
  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.  
  15. public class BiomeTestLayer extends GenLayer
  16. {
  17. private List<BiomeEntry> desertBiomes = new ArrayList<BiomeEntry>();
  18. private List<BiomeEntry> warmBiomes = new ArrayList<BiomeEntry>();
  19. private List<BiomeEntry> coolBiomes = new ArrayList<BiomeEntry>();
  20. private List<BiomeEntry> icyBiomes = new ArrayList<BiomeEntry>();
  21.  
  22. public BiomeTestLayer(long par1, GenLayer layer, WorldType worldType)
  23. {
  24. super(par1);
  25.  
  26. this.parent = layer;
  27.  
  28. this.desertBiomes.addAll(BiomeManager.desertBiomes);
  29. this.warmBiomes.addAll(BiomeManager.warmBiomes);
  30. this.coolBiomes.addAll(BiomeManager.coolBiomes);
  31. this.icyBiomes.addAll(BiomeManager.icyBiomes);
  32.  
  33. if (worldType == WorldType.DEFAULT)
  34. {
  35. desertBiomes.add(new BiomeEntry(BiomeGenBase.desert, 10));
  36. desertBiomes.add(new BiomeEntry(BiomeGenBase.forest, 10));
  37. desertBiomes.add(new BiomeEntry(BiomeGenBase.extremeHills, 10));
  38. desertBiomes.add(new BiomeEntry(BiomeGenBase.swampland, 10));
  39. desertBiomes.add(new BiomeEntry(BiomeGenBase.plains, 10));
  40. desertBiomes.add(new BiomeEntry(BiomeGenBase.taiga, 10));
  41. desertBiomes.add(new BiomeEntry(BiomeRegistry.biomeTest, 10));
  42. }
  43. else
  44. {
  45. desertBiomes.add(new BiomeEntry(BiomeGenBase.desert, 30));
  46. desertBiomes.add(new BiomeEntry(BiomeGenBase.savanna, 20));
  47. desertBiomes.add(new BiomeEntry(BiomeGenBase.plains, 10));
  48. desertBiomes.add(new BiomeEntry(BiomeRegistry.biomeTest, 10));
  49. }
  50. }
  51.  
  52. public int[] getInts(int par1, int par2, int par3, int par4)
  53. {
  54. int[] aint = this.parent.getInts(par1, par2, par3, par4);
  55. int[] aint1 = IntCache.getIntCache(par3 * par4);
  56.  
  57. for (int i1 = 0; i1 < par4; ++i1)
  58. {
  59. for (int j1 = 0; j1 < par3; ++j1)
  60. {
  61. this.initChunkSeed((long)(j1 + par1), (long)(i1 + par2));
  62. int k1 = aint[j1 + i1 * par3];
  63. int l1 = (k1 & 3840) >> 8;
  64. k1 &= -3841;
  65.  
  66. if (isBiomeOceanic(k1))
  67. {
  68. aint1[j1 + i1 * par3] = k1;
  69. }
  70. else if (k1 == BiomeGenBase.mushroomIsland.biomeID)
  71. {
  72. aint1[j1 + i1 * par3] = k1;
  73. }
  74. else if (k1 == 1)
  75. {
  76. if (l1 > 0)
  77. {
  78. if (this.nextInt(3) == 0)
  79. {
  80. aint1[j1 + i1 * par3] = BiomeGenBase.mesaPlateau.biomeID;
  81. }
  82. else
  83. {
  84. aint1[j1 + i1 * par3] = BiomeGenBase.mesaPlateau_F.biomeID;
  85. }
  86. }
  87. else
  88. {
  89. aint1[j1 + i1 * par3] = ((BiomeEntry)WeightedRandom.getItem(this.desertBiomes, (int)(this.nextLong(WeightedRandom.getTotalWeight(this.desertBiomes) / 100) * 10))).biome.biomeID;
  90. }
  91. }
  92. else if (k1 == 2)
  93. {
  94. if (l1 > 0)
  95. {
  96. aint1[j1 + i1 * par3] = BiomeGenBase.jungle.biomeID;
  97. }
  98. else
  99. {
  100. aint1[j1 + i1 * par3] = ((BiomeEntry)WeightedRandom.getItem(this.warmBiomes, (int)(this.nextLong(WeightedRandom.getTotalWeight(this.warmBiomes) / 10) * 10))).biome.biomeID;
  101. }
  102. }
  103. else if (k1 == 3)
  104. {
  105. if (l1 > 0)
  106. {
  107. aint1[j1 + i1 * par3] = BiomeGenBase.megaTaiga.biomeID;
  108. }
  109. else
  110. {
  111. aint1[j1 + i1 * par3] = ((BiomeEntry)WeightedRandom.getItem(this.coolBiomes, (int)(this.nextLong(WeightedRandom.getTotalWeight(this.coolBiomes) / 10) * 10))).biome.biomeID;
  112. }
  113. }
  114. else if (k1 == 4)
  115. {
  116. aint1[j1 + i1 * par3] = ((BiomeEntry)WeightedRandom.getItem(this.icyBiomes, (int)(this.nextLong(WeightedRandom.getTotalWeight(this.icyBiomes) / 10) * 10))).biome.biomeID;
  117. }
  118. else
  119. {
  120. aint1[j1 + i1 * par3] = BiomeGenBase.mushroomIsland.biomeID;
  121. }
  122. }
  123. }
  124.  
  125. return aint1;
  126. }
  127.  
  128. }
RAW Paste Data