Guest User

Untitled

a guest
Feb 6th, 2015
318
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.35 KB | None | 0 0
  1. public class ChunkProviderArcana implements IChunkProvider{
  2.  
  3. private ArrayList Rooms;
  4. private ArrayList BossRooms;
  5. private DungeonCeiling Ceiling;
  6. private World worldObj;
  7. private Random random;
  8.  
  9.  
  10. public ChunkProviderArcana(World world, long seed){
  11.  
  12. worldObj = world;
  13. random = new Random(seed);
  14.  
  15. Rooms = new ArrayList(21);
  16. BossRooms = new ArrayList(2);
  17.  
  18. Rooms.add(new DungeonComponent());
  19. Rooms.add(new DungeonComponent1());
  20. Rooms.add(new DungeonComponent2());
  21. Rooms.add(new DungeonComponent3());
  22. Rooms.add(new DungeonComponent4());
  23. Rooms.add(new DungeonComponent5());
  24. Rooms.add(new DungeonComponent6());
  25. Rooms.add(new DungeonComponent7());
  26. Rooms.add(new DungeonComponent9());
  27. Rooms.add(new DungeonComponent10());
  28. Rooms.add(new DungeonComponent11());
  29. Rooms.add(new DungeonComponent12());
  30. Rooms.add(new DungeonComponent13());
  31. Rooms.add(new DungeonComponent14());
  32. Rooms.add(new DungeonComponent15());
  33. Rooms.add(new DungeonComponent16());
  34. Rooms.add(new DungeonComponent17());
  35. Rooms.add(new DungeonComponent22());
  36. Rooms.add(new DungeonComponenet18());
  37. Rooms.add(new DungeonComponenet19());
  38. Rooms.add(new DungeonComponent8());
  39. BossRooms.add(new DungeonComponentParasecta());
  40. BossRooms.add(new DungeonComponentDramix());
  41. Ceiling = new DungeonCeiling();
  42.  
  43. }
  44.  
  45. @Override
  46. public boolean chunkExists(int i, int j) {
  47. return false;
  48. }
  49.  
  50. @Override
  51. public Chunk provideChunk(int par1, int par2) {
  52. ArcanaChunk c = new ArcanaChunk();
  53. int l;
  54.  
  55. int roomToGenerate;
  56.  
  57. for (int i = 4; i > 0; i--) {
  58. roomToGenerate = random.nextInt(21);
  59. DungeonComponentBase room = (DungeonComponentBase)(Rooms.get(roomToGenerate));
  60.  
  61. if(room instanceof DungeonComponent8 && i >= 3) room = (DungeonComponentBase)(Rooms.get(this.random.nextInt(10)+10));
  62.  
  63. room.generate(c, random, 0, i * 8, 0);
  64. }
  65.  
  66. Ceiling.generate(c, random, 0, 40, 0);
  67.  
  68. Chunk chunk = new Chunk(this.worldObj, c.getChunkData(), c.getChunkMetadata(), par1, par2);
  69. chunk.generateSkylightMap();
  70. BiomeGenBase[] abiomegenbase = this.worldObj.getWorldChunkManager().loadBlockGeneratorData((BiomeGenBase[])null, par1 * 16, par2 * 16, 16, 16);
  71. byte[] abyte = chunk.getBiomeArray();
  72.  
  73. for (l = 0; l < abyte.length; ++l)
  74. {
  75. abyte[l] = (byte)abiomegenbase[l].biomeID;
  76. }
  77.  
  78. chunk.generateSkylightMap();
  79. return chunk;
  80. }
  81.  
  82. @Override
  83. public Chunk loadChunk(int i, int j) {
  84. return this.provideChunk(i, j);
  85. }
  86.  
  87. @Override
  88. public void populate(IChunkProvider chunkProvider, int chunkX, int chunkY) {
  89. int x = chunkX * 16;
  90. int y = chunkY * 16;
  91. BiomeGenBase biome = this.worldObj.getBiomeGenForCoords(x + 16, y + 16);
  92. boolean flag = false;
  93. this.random.setSeed(this.worldObj.getSeed());
  94. long var8 = this.random.nextLong() / 2L * 2L + 1L;
  95. long var10 = this.random.nextLong() / 2L * 2L + 1L;
  96. this.random.setSeed(chunkX * var8 + chunkY * var10 ^ this.worldObj.getSeed());
  97. int roomToGenerate;
  98.  
  99. Random rand = random;
  100. Chunk chunk = this.worldObj.getChunkFromChunkCoords(chunkX, chunkY);
  101.  
  102. for(int i = 1; i < 4; i++) {
  103. roomToGenerate = rand.nextInt(2);
  104.  
  105. if(this.random.nextInt(50) == 0){
  106. ((WorldGenerator)(BossRooms.get(roomToGenerate))).generate(this.worldObj, rand, x, i * 8, y);
  107. this.random.setSeed(chunkX * var8 + chunkY * var10 ^ this.worldObj.getSeed() * i << 2 | var10);
  108. }
  109. }
  110. }
  111.  
  112. @Override
  113. public boolean saveChunks(boolean flag, IProgressUpdate iprogressupdate) {
  114. return true;
  115. }
  116.  
  117. @Override
  118. public boolean unloadQueuedChunks() {
  119. return false;
  120. }
  121.  
  122. @Override
  123. public boolean canSave() {
  124. return true;
  125. }
  126.  
  127. @Override
  128. public String makeString() {
  129. return "Arcana";
  130. }
  131.  
  132. @Override
  133. public List getPossibleCreatures(EnumCreatureType enumcreaturetype, int i, int j, int k) {
  134. BiomeGenBase biomegenbase = this.worldObj.getBiomeGenForCoords(i, k);
  135. return biomegenbase == null ? null : biomegenbase.getSpawnableList(enumcreaturetype);
  136. }
  137.  
  138. @Override
  139. public int getLoadedChunkCount() {
  140. return 0;
  141. }
  142.  
  143. @Override
  144. public void recreateStructures(int i, int j) {}
  145.  
  146. @Override
  147. public void saveExtraData() { }
  148.  
  149. @Override
  150. public ChunkPosition func_147416_a(World var1, String var2, int var3, int var4, int var5) {
  151. return null;
  152. }
  153. }
Advertisement
Add Comment
Please, Sign In to add comment