Advertisement
ClassicPork

TestDime.java

Sep 14th, 2013
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 76.22 KB | None | 0 0
  1. package net.minecraft.src;
  2.  
  3. import cpw.*;
  4. import cpw.mods.*;
  5. import cpw.mods.fml.*;
  6. import cpw.mods.fml.client.*;
  7. import cpw.mods.fml.client.modloader.*;
  8. import cpw.mods.fml.client.registry.*;
  9. import cpw.mods.fml.common.*;
  10. import cpw.mods.fml.common.asm.*;
  11. import cpw.mods.fml.common.asm.transformers.*;
  12. import cpw.mods.fml.common.discovery.*;
  13. import cpw.mods.fml.common.discovery.asm.*;
  14. import cpw.mods.fml.common.event.*;
  15. import cpw.mods.fml.common.functions.*;
  16. import cpw.mods.fml.common.modloader.*;
  17. import cpw.mods.fml.common.network.*;
  18. import cpw.mods.fml.common.registry.*;
  19. import cpw.mods.fml.common.toposort.*;
  20. import cpw.mods.fml.common.versioning.*;
  21. import cpw.mods.fml.relauncher.*;
  22. import cpw.mods.fml.server.*;
  23. import ibxm.*;
  24. import java.util.ArrayList;
  25. import java.util.Iterator;
  26. import java.util.List;
  27. import java.util.Random;
  28. import net.minecraft.block.Block;
  29. import net.minecraft.entity.Entity;
  30. import net.minecraft.util.Direction;
  31. import net.minecraft.util.LongHashMap;
  32. import net.minecraft.util.MathHelper;
  33. import net.minecraft.world.ChunkCoordIntPair;
  34. import net.minecraft.world.PortalPosition;
  35. import net.minecraft.world.Teleporter;
  36. import net.minecraft.world.WorldServer;
  37. import net.*;
  38. import net.minecraft.*;
  39. import net.minecraft.block.*;
  40. import net.minecraft.block.material.*;
  41. import net.minecraft.client.*;
  42. import net.minecraft.client.audio.*;
  43. import net.minecraft.client.entity.*;
  44. import net.minecraft.client.gui.*;
  45. import net.minecraft.client.gui.achievement.*;
  46. import net.minecraft.client.gui.inventory.*;
  47. import net.minecraft.client.model.*;
  48. import net.minecraft.client.multiplayer.*;
  49. import net.minecraft.client.particle.*;
  50. import net.minecraft.client.renderer.*;
  51. import net.minecraft.client.renderer.culling.*;
  52. import net.minecraft.client.renderer.entity.*;
  53. import net.minecraft.client.renderer.tileentity.*;
  54. import net.minecraft.client.settings.*;
  55. import net.minecraft.command.*;
  56. import net.minecraft.crash.*;
  57. import net.minecraft.creativetab.*;
  58. import net.minecraft.dispenser.*;
  59. import net.minecraft.enchantment.*;
  60. import net.minecraft.entity.*;
  61. import net.minecraft.entity.ai.*;
  62. import net.minecraft.entity.boss.*;
  63. import net.minecraft.entity.effect.*;
  64. import net.minecraft.entity.item.*;
  65. import net.minecraft.entity.monster.*;
  66. import net.minecraft.entity.passive.*;
  67. import net.minecraft.entity.player.*;
  68. import net.minecraft.entity.projectile.*;
  69. import net.minecraft.inventory.*;
  70. import net.minecraft.item.*;
  71. import net.minecraft.item.crafting.*;
  72. import net.minecraft.nbt.*;
  73. import net.minecraft.network.*;
  74. import net.minecraft.network.packet.*;
  75. import net.minecraft.network.rcon.*;
  76. import net.minecraft.pathfinding.*;
  77. import net.minecraft.potion.*;
  78. import net.minecraft.profiler.*;
  79. import net.minecraft.server.*;
  80. import net.minecraft.server.dedicated.*;
  81. import net.minecraft.server.gui.*;
  82. import net.minecraft.server.integrated.*;
  83. import net.minecraft.server.management.*;
  84. import net.minecraft.src.*;
  85. import net.minecraft.stats.*;
  86. import net.minecraft.tileentity.*;
  87. import net.minecraft.util.*;
  88. import net.minecraft.village.*;
  89. import net.minecraft.world.*;
  90. import net.minecraft.world.biome.*;
  91. import net.minecraft.world.chunk.*;
  92. import net.minecraft.world.chunk.storage.*;
  93. import net.minecraft.world.demo.*;
  94. import net.minecraft.world.gen.*;
  95. import net.minecraft.world.gen.feature.*;
  96. import net.minecraft.world.gen.layer.*;
  97. import net.minecraft.world.gen.structure.*;
  98. import net.minecraft.world.storage.*;
  99. import net.minecraftforge.*;
  100. import net.minecraftforge.classloading.*;
  101. import net.minecraftforge.client.*;
  102. import net.minecraftforge.client.event.*;
  103. import net.minecraftforge.client.event.sound.*;
  104. import net.minecraftforge.common.*;
  105. import net.minecraftforge.event.*;
  106. import net.minecraftforge.event.entity.*;
  107. import net.minecraftforge.event.entity.item.*;
  108. import net.minecraftforge.event.entity.living.*;
  109. import net.minecraftforge.event.entity.minecart.*;
  110. import net.minecraftforge.event.entity.player.*;
  111. import net.minecraftforge.event.terraingen.*;
  112. import net.minecraftforge.event.world.*;
  113. import net.minecraftforge.oredict.*;
  114. import net.minecraftforge.transformers.*;
  115. import paulscode.*;
  116. import paulscode.sound.*;
  117. import paulscode.sound.codecs.*;
  118.  
  119. import java.util.Random;
  120. import java.util.List;
  121. import java.util.Random;
  122. import net.minecraft.block.Block;
  123. import net.minecraft.block.BlockSand;
  124. import net.minecraft.entity.EnumCreatureType;
  125. import net.minecraft.util.IProgressUpdate;
  126. import net.minecraft.world.ChunkPosition;
  127. import net.minecraft.world.World;
  128. import net.minecraft.world.biome.BiomeGenBase;
  129. import net.minecraft.world.chunk.Chunk;
  130. import net.minecraft.world.chunk.IChunkProvider;
  131. import net.minecraft.world.gen.feature.WorldGenFire;
  132. import net.minecraft.world.gen.feature.WorldGenFlowers;
  133. import net.minecraft.world.gen.feature.WorldGenGlowStone1;
  134. import net.minecraft.world.gen.feature.WorldGenGlowStone2;
  135. import net.minecraft.world.gen.feature.WorldGenHellLava;
  136. import net.minecraft.world.gen.feature.WorldGenMinable;
  137. import net.minecraft.world.gen.structure.MapGenNetherBridge;
  138. import net.minecraft.client.renderer.texture.IconRegister;
  139.  
  140. import static net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.*;
  141. import static net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.*;
  142. import static net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.*;
  143. import net.minecraftforge.common.*;
  144. import net.minecraftforge.event.Event.*;
  145. import net.minecraftforge.event.terraingen.*;
  146.  
  147. public class mcreator_testDime extends BaseMod{
  148.  
  149. public mcreator_testDime(){}
  150.  
  151. public static BlocktestDime block2 = (BlocktestDime)(new BlocktestDime(175)).setUnlocalizedName("testDime Portal");
  152. public static BlockModdedFire ModdedFire = (BlockModdedFire)new BlockModdedFire(174).setUnlocalizedName("testDime Portal Fire");
  153. public static Item block = new Itemblock(168).setUnlocalizedName("diamond").func_111206_d("diamond").setCreativeTab(CreativeTabs.tabTools);
  154.  
  155. public void load(){
  156. DimensionManager.registerProviderType(3, WorldProvidertestDime.class, false);
  157. DimensionManager.registerDimension(3, 3);
  158. ModLoader.addName(block, "Portal Egniter");
  159. ModLoader.addRecipe(new ItemStack(block, 1), new Object[]{
  160. "X1X", "X4X", "X7X", Character.valueOf('1'), new ItemStack(Item.bucketWater, 1), Character.valueOf('4'), new ItemStack(Block.ice, 1), Character.valueOf('7'), new ItemStack(Item.ingotIron, 1),
  161. });
  162.  
  163. }
  164.  
  165. public String getVersion(){
  166. return "1.0";
  167. }
  168.  
  169.  
  170. static class BlocktestDime extends Block
  171. {
  172.  
  173. int a1 = 0,a2 = 0,a3 = 0,a4 = 0,a5 = 0,a6 = 0;
  174.  
  175. Icon gor = null, dol = null, st1 = null, st2 = null, st3 = null, st4 = null;
  176.  
  177. boolean red = false;
  178.  
  179.  
  180.  
  181.  
  182.  
  183. protected BlocktestDime(int i)
  184. {
  185. super(i, Material.ground);
  186. this.setTickRandomly(true);
  187. this.setHardness(-1.0F);
  188. this.setStepSound(soundGlassFootstep);
  189. this.setLightValue(0.75F);
  190.  
  191. }
  192.  
  193. public Icon getIcon(int i, int par2){
  194.  
  195. if (i == 0)
  196. return gor;
  197.  
  198. else if (i == 1)
  199. return dol;
  200.  
  201. else if (i == 2)
  202. return st1;
  203.  
  204. else if (i == 3)
  205. return st2;
  206.  
  207. else if (i == 4)
  208. return st4;
  209.  
  210. else if (i == 5)
  211. return st3;
  212.  
  213. else
  214. return gor;
  215.  
  216. }
  217.  
  218. public void registerIcons(IconRegister par1IconRegister)
  219. {
  220. this.gor = par1IconRegister.registerIcon("mob_spawner");
  221. this.dol = par1IconRegister.registerIcon("mob_spawner");
  222. this.st1 = par1IconRegister.registerIcon("mob_spawner");
  223. this.st2 = par1IconRegister.registerIcon("mob_spawner");
  224. this.st3 = par1IconRegister.registerIcon("mob_spawner");
  225. this.st4 = par1IconRegister.registerIcon("mob_spawner");
  226. }
  227.  
  228. public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random)
  229. {
  230. super.updateTick(par1World, par2, par3, par4, par5Random);
  231. if (par1World.provider.isSurfaceWorld() && par5Random.nextInt(2000) < par1World.difficultySetting)
  232. {
  233. int l;
  234. for (l = par3; !par1World.doesBlockHaveSolidTopSurface(par2, l, par4) && l > 0; --l)
  235. {
  236. ;
  237. }
  238. if (l > 0 && !par1World.isBlockNormalCube(par2, l + 1, par4))
  239. {
  240. Entity entity = ItemMonsterPlacer.spawnCreature(par1World, 57, (double)par2 + 0.5D, (double)l + 1.1D, (double)par4 + 0.5D);
  241. if (entity != null)
  242. {
  243. entity.timeUntilPortal = entity.getPortalCooldown();
  244. }
  245. }
  246. }
  247. }
  248. /**
  249. * Returns a bounding box from the pool of bounding boxes (this means this box can change after the pool has been
  250. * cleared to be reused)
  251. */
  252. public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4)
  253. {
  254. return null;
  255. }
  256. /**
  257. * Updates the blocks bounds based on its current state. Args: world, x, y, z
  258. */
  259. public void setBlockBoundsBasedOnState(IBlockAccess par1IBlockAccess, int par2, int par3, int par4)
  260. {
  261. float f;
  262. float f1;
  263. if (par1IBlockAccess.getBlockId(par2 - 1, par3, par4) != this.blockID && par1IBlockAccess.getBlockId(par2 + 1, par3, par4) != this.blockID)
  264. {
  265. f = 0.125F;
  266. f1 = 0.5F;
  267. this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f1, 0.5F + f, 1.0F, 0.5F + f1);
  268. }
  269. else
  270. {
  271. f = 0.5F;
  272. f1 = 0.125F;
  273. this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f1, 0.5F + f, 1.0F, 0.5F + f1);
  274. }
  275. }
  276. /**
  277. * Is this block (a) opaque and (B) a full 1m cube? This determines whether or not to render the shared face of two
  278. * adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block.
  279. */
  280. public boolean isOpaqueCube()
  281. {
  282. return false;
  283. }
  284. /**
  285. * If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc)
  286. */
  287. @Override
  288. public boolean renderAsNormalBlock()
  289. {
  290. return false;
  291. }
  292. /**
  293. * Checks to see if this location is valid to create a portal and will return True if it does. Args: world, x, y, z
  294. */
  295. public boolean tryToCreatePortal(World par1World, int par2, int par3, int par4)
  296. {
  297. byte b0 = 0;
  298. byte b1 = 0;
  299. if (par1World.getBlockId(par2 - 1, par3, par4) == Block.melon.blockID || par1World.getBlockId(par2 + 1, par3, par4) == Block.melon.blockID)
  300. {
  301. b0 = 1;
  302. }
  303. if (par1World.getBlockId(par2, par3, par4 - 1) == Block.melon.blockID || par1World.getBlockId(par2, par3, par4 + 1) == Block.melon.blockID)
  304. {
  305. b1 = 1;
  306. }
  307. if (b0 == b1)
  308. {
  309. return false;
  310. }
  311. else
  312. {
  313. if (par1World.getBlockId(par2 - b0, par3, par4 - b1) == 0)
  314. {
  315. par2 -= b0;
  316. par4 -= b1;
  317. }
  318. int l;
  319. int i1;
  320. for (l = -1; l <= 2; ++l)
  321. {
  322. for (i1 = -1; i1 <= 3; ++i1)
  323. {
  324. boolean flag = l == -1 || l == 2 || i1 == -1 || i1 == 3;
  325. if (l != -1 && l != 2 || i1 != -1 && i1 != 3)
  326. {
  327. int j1 = par1World.getBlockId(par2 + b0 * l, par3 + i1, par4 + b1 * l);
  328. if (flag)
  329. {
  330. if (j1 != Block.melon.blockID)
  331. {
  332. return false;
  333. }
  334. }
  335. else if (j1 != 0 && j1 != ModdedFire.blockID)
  336. {
  337. return false;
  338. }
  339. }
  340. }
  341. }
  342. for (l = 0; l < 2; ++l)
  343. {
  344. for (i1 = 0; i1 < 3; ++i1)
  345. {
  346. par1World.setBlock(par2 + b0 * l, par3 + i1, par4 + b1 * l, block2.blockID, 0, 2);
  347. }
  348. }
  349. return true;
  350. }
  351. }
  352. /**
  353. * Lets the block know when one of its neighbor changes. Doesn't know which neighbor changed (coordinates passed are
  354. * their own) Args: x, y, z, neighbor blockID
  355. */
  356. public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, int par5)
  357. {
  358. byte b0 = 0;
  359. byte b1 = 1;
  360. if (par1World.getBlockId(par2 - 1, par3, par4) == this.blockID || par1World.getBlockId(par2 + 1, par3, par4) == this.blockID)
  361. {
  362. b0 = 1;
  363. b1 = 0;
  364. }
  365. int i1;
  366. for (i1 = par3; par1World.getBlockId(par2, i1 - 1, par4) == this.blockID; --i1)
  367. {
  368. ;
  369. }
  370. if (par1World.getBlockId(par2, i1 - 1, par4) != Block.melon.blockID)
  371. {
  372. par1World.setBlockToAir(par2, par3, par4);
  373. }
  374. else
  375. {
  376. int j1;
  377. for (j1 = 1; j1 < 4 && par1World.getBlockId(par2, i1 + j1, par4) == this.blockID; ++j1)
  378. {
  379. ;
  380. }
  381. if (j1 == 3 && par1World.getBlockId(par2, i1 + j1, par4) == Block.melon.blockID)
  382. {
  383. boolean flag = par1World.getBlockId(par2 - 1, par3, par4) == this.blockID || par1World.getBlockId(par2 + 1, par3, par4) == this.blockID;
  384. boolean flag1 = par1World.getBlockId(par2, par3, par4 - 1) == this.blockID || par1World.getBlockId(par2, par3, par4 + 1) == this.blockID;
  385. if (flag && flag1)
  386. {
  387. par1World.setBlockToAir(par2, par3, par4);
  388. }
  389. else
  390. {
  391. if ((par1World.getBlockId(par2 + b0, par3, par4 + b1) != Block.melon.blockID || par1World.getBlockId(par2 - b0, par3, par4 - b1) != this.blockID) && (par1World.getBlockId(par2 - b0, par3, par4 - b1) != Block.melon.blockID || par1World.getBlockId(par2 + b0, par3, par4 + b1) != this.blockID))
  392. {
  393. par1World.setBlockToAir(par2, par3, par4);
  394. }
  395. }
  396. }
  397. else
  398. {
  399. par1World.setBlockToAir(par2, par3, par4);
  400. }
  401. }
  402. }
  403. @SideOnly(Side.CLIENT)
  404. /**
  405. * Returns true if the given side of this block type should be rendered, if the adjacent block is at the given
  406. * coordinates. Args: blockAccess, x, y, z, side
  407. */
  408. public boolean shouldSideBeRendered(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5)
  409. {
  410. if (par1IBlockAccess.getBlockId(par2, par3, par4) == this.blockID)
  411. {
  412. return false;
  413. }
  414. else
  415. {
  416. boolean flag = par1IBlockAccess.getBlockId(par2 - 1, par3, par4) == this.blockID && par1IBlockAccess.getBlockId(par2 - 2, par3, par4) != this.blockID;
  417. boolean flag1 = par1IBlockAccess.getBlockId(par2 + 1, par3, par4) == this.blockID && par1IBlockAccess.getBlockId(par2 + 2, par3, par4) != this.blockID;
  418. boolean flag2 = par1IBlockAccess.getBlockId(par2, par3, par4 - 1) == this.blockID && par1IBlockAccess.getBlockId(par2, par3, par4 - 2) != this.blockID;
  419. boolean flag3 = par1IBlockAccess.getBlockId(par2, par3, par4 + 1) == this.blockID && par1IBlockAccess.getBlockId(par2, par3, par4 + 2) != this.blockID;
  420. boolean flag4 = flag || flag1;
  421. boolean flag5 = flag2 || flag3;
  422. return flag4 && par5 == 4 ? true : (flag4 && par5 == 5 ? true : (flag5 && par5 == 2 ? true : flag5 && par5 == 3));
  423. }
  424. }
  425. /**
  426. * Returns the quantity of items to drop on block destruction.
  427. */
  428. public int quantityDropped(Random par1Random)
  429. {
  430. return 0;
  431. }
  432. /**
  433. * Triggered whenever an entity collides with this block (enters into the block). Args: world, x, y, z, entity
  434. */
  435. public void onEntityCollidedWithBlock(World par1World, int par2, int par3, int par4, Entity par5Entity)
  436. {
  437. if ((par5Entity.ridingEntity == null) && (par5Entity.riddenByEntity == null) && ((par5Entity instanceof EntityPlayerMP)))
  438. {
  439. EntityPlayerMP thePlayer = (EntityPlayerMP)par5Entity;
  440. if (thePlayer.timeUntilPortal > 0)
  441. {
  442. thePlayer.timeUntilPortal = 10;
  443. }
  444. else if (thePlayer.dimension != 3)
  445. {
  446. thePlayer.timeUntilPortal = 10;
  447. thePlayer.mcServer.getConfigurationManager().transferPlayerToDimension(thePlayer, 3, new ModdedTeleporter(thePlayer.mcServer.worldServerForDimension(3)));
  448. }
  449. else {
  450. thePlayer.timeUntilPortal = 10;
  451. thePlayer.mcServer.getConfigurationManager().transferPlayerToDimension(thePlayer, 0, new ModdedTeleporter(thePlayer.mcServer.worldServerForDimension(0)));
  452. }
  453. }
  454. }
  455. @SideOnly(Side.CLIENT)
  456. /**
  457. * Returns which pass should this block be rendered on. 0 for solids and 1 for alpha
  458. */
  459. public int getRenderBlockPass()
  460. {
  461. return 1;
  462. }
  463. @SideOnly(Side.CLIENT)
  464. /**
  465. * A randomly called display update to be able to add particles or other items for display
  466. */
  467. public void randomDisplayTick(World par1World, int par2, int par3, int par4, Random par5Random)
  468. {
  469. if (par5Random.nextInt(100) == 0)
  470. {
  471. par1World.playSound((double)par2 + 0.5D, (double)par3 + 0.5D, (double)par4 + 0.5D, "portal.portal", 0.5F, par5Random.nextFloat() * 0.4F + 0.8F, false);
  472. }
  473. for (int l = 0; l < 4; ++l)
  474. {
  475. double d0 = (double)((float)par2 + par5Random.nextFloat());
  476. double d1 = (double)((float)par3 + par5Random.nextFloat());
  477. double d2 = (double)((float)par4 + par5Random.nextFloat());
  478. double d3 = 0.0D;
  479. double d4 = 0.0D;
  480. double d5 = 0.0D;
  481. int i1 = par5Random.nextInt(2) * 2 - 1;
  482. d3 = ((double)par5Random.nextFloat() - 0.5D) * 0.5D;
  483. d4 = ((double)par5Random.nextFloat() - 0.5D) * 0.5D;
  484. d5 = ((double)par5Random.nextFloat() - 0.5D) * 0.5D;
  485. if (par1World.getBlockId(par2 - 1, par3, par4) != this.blockID && par1World.getBlockId(par2 + 1, par3, par4) != this.blockID)
  486. {
  487. d0 = (double)par2 + 0.5D + 0.25D * (double)i1;
  488. d3 = (double)(par5Random.nextFloat() * 2.0F * (float)i1);
  489. }
  490. else
  491. {
  492. d2 = (double)par4 + 0.5D + 0.25D * (double)i1;
  493. d5 = (double)(par5Random.nextFloat() * 2.0F * (float)i1);
  494. }
  495. par1World.spawnParticle("magicCrit", d0, d1, d2, d3, d4, d5);
  496. }
  497. }
  498. @SideOnly(Side.CLIENT)
  499. /**
  500. * only called by clickMiddleMouseButton , and passed to inventory.setCurrentItem (along with isCreative)
  501. */
  502. public int idPicked(World par1World, int par2, int par3, int par4)
  503. {
  504. return 0;
  505. }
  506.  
  507. }
  508.  
  509.  
  510. public static class ModdedTeleporter extends Teleporter
  511. {
  512. private final WorldServer worldServerInstance;
  513. /** A private Random() function in Teleporter */
  514. private final Random random;
  515. /** Stores successful portal placement locations for rapid lookup. */
  516. private final LongHashMap destinationCoordinateCache = new LongHashMap();
  517. /**
  518. * A list of valid keys for the destinationCoordainteCache. These are based on the X & Z of the players initial
  519. * location.
  520. */
  521. private final List destinationCoordinateKeys = new ArrayList();
  522. public ModdedTeleporter(WorldServer par1WorldServer)
  523. {
  524. super(par1WorldServer);
  525. this.worldServerInstance = par1WorldServer;
  526. this.random = new Random(par1WorldServer.getSeed());
  527. }
  528. /**
  529. * Place an entity in a nearby portal, creating one if necessary.
  530. */
  531. public void placeInPortal(Entity par1Entity, double par2, double par4, double par6, float par8)
  532. {
  533. if (this.worldServerInstance.provider.dimensionId != 1)
  534. {
  535. if (!this.placeInExistingPortal(par1Entity, par2, par4, par6, par8))
  536. {
  537. this.makePortal(par1Entity);
  538. this.placeInExistingPortal(par1Entity, par2, par4, par6, par8);
  539. }
  540. }
  541. else
  542. {
  543. int i = MathHelper.floor_double(par1Entity.posX);
  544. int j = MathHelper.floor_double(par1Entity.posY) - 1;
  545. int k = MathHelper.floor_double(par1Entity.posZ);
  546. byte b0 = 1;
  547. byte b1 = 0;
  548. for (int l = -2; l <= 2; ++l)
  549. {
  550. for (int i1 = -2; i1 <= 2; ++i1)
  551. {
  552. for (int j1 = -1; j1 < 3; ++j1)
  553. {
  554. int k1 = i + i1 * b0 + l * b1;
  555. int l1 = j + j1;
  556. int i2 = k + i1 * b1 - l * b0;
  557. boolean flag = j1 < 0;
  558.  
  559. /** change this block **/
  560. this.worldServerInstance.setBlock(k1, l1, i2, flag ? Block.melon.blockID : 0);
  561. }
  562. }
  563. }
  564. par1Entity.setLocationAndAngles((double)i, (double)j, (double)k, par1Entity.rotationYaw, 0.0F);
  565. par1Entity.motionX = par1Entity.motionY = par1Entity.motionZ = 0.0D;
  566. }
  567. }
  568. /**
  569. * Place an entity in a nearby portal which already exists.
  570. */
  571. public boolean placeInExistingPortal(Entity par1Entity, double par2, double par4, double par6, float par8)
  572. {
  573. short short1 = 128;
  574. double d3 = -1.0D;
  575. int i = 0;
  576. int j = 0;
  577. int k = 0;
  578. int l = MathHelper.floor_double(par1Entity.posX);
  579. int i1 = MathHelper.floor_double(par1Entity.posZ);
  580. long j1 = ChunkCoordIntPair.chunkXZ2Int(l, i1);
  581. boolean flag = true;
  582. double d4;
  583. int k1;
  584. if (this.destinationCoordinateCache.containsItem(j1))
  585. {
  586. PortalPosition portalposition = (PortalPosition)this.destinationCoordinateCache.getValueByKey(j1);
  587. d3 = 0.0D;
  588. i = portalposition.posX;
  589. j = portalposition.posY;
  590. k = portalposition.posZ;
  591. portalposition.lastUpdateTime = this.worldServerInstance.getTotalWorldTime();
  592. flag = false;
  593. }
  594. else
  595. {
  596. for (k1 = l - short1; k1 <= l + short1; ++k1)
  597. {
  598. double d5 = (double)k1 + 0.5D - par1Entity.posX;
  599. for (int l1 = i1 - short1; l1 <= i1 + short1; ++l1)
  600. {
  601. double d6 = (double)l1 + 0.5D - par1Entity.posZ;
  602. for (int i2 = this.worldServerInstance.getActualHeight() - 1; i2 >= 0; --i2)
  603. {
  604. /** change this block **/
  605. if (this.worldServerInstance.getBlockId(k1, i2, l1) == block2.blockID)
  606. {
  607. /** change this block **/
  608. while (this.worldServerInstance.getBlockId(k1, i2 - 1, l1) == block2.blockID)
  609. {
  610. --i2;
  611. }
  612. d4 = (double)i2 + 0.5D - par1Entity.posY;
  613. double d7 = d5 * d5 + d4 * d4 + d6 * d6;
  614. if (d3 < 0.0D || d7 < d3)
  615. {
  616. d3 = d7;
  617. i = k1;
  618. j = i2;
  619. k = l1;
  620. }
  621. }
  622. }
  623. }
  624. }
  625. }
  626. if (d3 >= 0.0D)
  627. {
  628. if (flag)
  629. {
  630. this.destinationCoordinateCache.add(j1, new ModdedPortalPosition(this, i, j, k, this.worldServerInstance.getTotalWorldTime()));
  631. this.destinationCoordinateKeys.add(Long.valueOf(j1));
  632. }
  633. double d8 = (double)i + 0.5D;
  634. double d9 = (double)j + 0.5D;
  635. d4 = (double)k + 0.5D;
  636. int j2 = -1;
  637. /** change this block **/
  638. if (this.worldServerInstance.getBlockId(i - 1, j, k) == block2.blockID)
  639. {
  640. j2 = 2;
  641. }
  642. /** change this block **/
  643. if (this.worldServerInstance.getBlockId(i + 1, j, k) == block2.blockID)
  644. {
  645. j2 = 0;
  646. }
  647. /** change this block **/
  648. if (this.worldServerInstance.getBlockId(i, j, k - 1) == block2.blockID)
  649. {
  650. j2 = 3;
  651. }
  652. /** change this block **/
  653. if (this.worldServerInstance.getBlockId(i, j, k + 1) == block2.blockID)
  654. {
  655. j2 = 1;
  656. }
  657. int k2 = par1Entity.getTeleportDirection();
  658. if (j2 > -1)
  659. {
  660. int l2 = Direction.rotateLeft[j2];
  661. int i3 = Direction.offsetX[j2];
  662. int j3 = Direction.offsetZ[j2];
  663. int k3 = Direction.offsetX[l2];
  664. int l3 = Direction.offsetZ[l2];
  665. boolean flag1 = !this.worldServerInstance.isAirBlock(i + i3 + k3, j, k + j3 + l3) || !this.worldServerInstance.isAirBlock(i + i3 + k3, j + 1, k + j3 + l3);
  666. boolean flag2 = !this.worldServerInstance.isAirBlock(i + i3, j, k + j3) || !this.worldServerInstance.isAirBlock(i + i3, j + 1, k + j3);
  667. if (flag1 && flag2)
  668. {
  669. j2 = Direction.rotateOpposite[j2];
  670. l2 = Direction.rotateOpposite[l2];
  671. i3 = Direction.offsetX[j2];
  672. j3 = Direction.offsetZ[j2];
  673. k3 = Direction.offsetX[l2];
  674. l3 = Direction.offsetZ[l2];
  675. k1 = i - k3;
  676. d8 -= (double)k3;
  677. int i4 = k - l3;
  678. d4 -= (double)l3;
  679. flag1 = !this.worldServerInstance.isAirBlock(k1 + i3 + k3, j, i4 + j3 + l3) || !this.worldServerInstance.isAirBlock(k1 + i3 + k3, j + 1, i4 + j3 + l3);
  680. flag2 = !this.worldServerInstance.isAirBlock(k1 + i3, j, i4 + j3) || !this.worldServerInstance.isAirBlock(k1 + i3, j + 1, i4 + j3);
  681. }
  682. float f1 = 0.5F;
  683. float f2 = 0.5F;
  684. if (!flag1 && flag2)
  685. {
  686. f1 = 1.0F;
  687. }
  688. else if (flag1 && !flag2)
  689. {
  690. f1 = 0.0F;
  691. }
  692. else if (flag1 && flag2)
  693. {
  694. f2 = 0.0F;
  695. }
  696. d8 += (double)((float)k3 * f1 + f2 * (float)i3);
  697. d4 += (double)((float)l3 * f1 + f2 * (float)j3);
  698. float f3 = 0.0F;
  699. float f4 = 0.0F;
  700. float f5 = 0.0F;
  701. float f6 = 0.0F;
  702. if (j2 == k2)
  703. {
  704. f3 = 1.0F;
  705. f4 = 1.0F;
  706. }
  707. else if (j2 == Direction.rotateOpposite[k2])
  708. {
  709. f3 = -1.0F;
  710. f4 = -1.0F;
  711. }
  712. else if (j2 == Direction.rotateRight[k2])
  713. {
  714. f5 = 1.0F;
  715. f6 = -1.0F;
  716. }
  717. else
  718. {
  719. f5 = -1.0F;
  720. f6 = 1.0F;
  721. }
  722. double d10 = par1Entity.motionX;
  723. double d11 = par1Entity.motionZ;
  724. par1Entity.motionX = d10 * (double)f3 + d11 * (double)f6;
  725. par1Entity.motionZ = d10 * (double)f5 + d11 * (double)f4;
  726. par1Entity.rotationYaw = par8 - (float)(k2 * 90) + (float)(j2 * 90);
  727. }
  728. else
  729. {
  730. par1Entity.motionX = par1Entity.motionY = par1Entity.motionZ = 0.0D;
  731. }
  732. par1Entity.setLocationAndAngles(d8, d9, d4, par1Entity.rotationYaw, par1Entity.rotationPitch);
  733. return true;
  734. }
  735. else
  736. {
  737. return false;
  738. }
  739. }
  740. public boolean makePortal(Entity par1Entity)
  741. {
  742. byte b0 = 16;
  743. double d0 = -1.0D;
  744. int i = MathHelper.floor_double(par1Entity.posX);
  745. int j = MathHelper.floor_double(par1Entity.posY);
  746. int k = MathHelper.floor_double(par1Entity.posZ);
  747. int l = i;
  748. int i1 = j;
  749. int j1 = k;
  750. int k1 = 0;
  751. int l1 = this.random.nextInt(4);
  752. int i2;
  753. double d1;
  754. double d2;
  755. int j2;
  756. int k2;
  757. int l2;
  758. int i3;
  759. int j3;
  760. int k3;
  761. int l3;
  762. int i4;
  763. int j4;
  764. int k4;
  765. double d3;
  766. double d4;
  767. for (i2 = i - b0; i2 <= i + b0; ++i2)
  768. {
  769. d1 = (double)i2 + 0.5D - par1Entity.posX;
  770. for (j2 = k - b0; j2 <= k + b0; ++j2)
  771. {
  772. d2 = (double)j2 + 0.5D - par1Entity.posZ;
  773. label274:
  774. for (k2 = this.worldServerInstance.getActualHeight() - 1; k2 >= 0; --k2)
  775. {
  776. if (this.worldServerInstance.isAirBlock(i2, k2, j2))
  777. {
  778. while (k2 > 0 && this.worldServerInstance.isAirBlock(i2, k2 - 1, j2))
  779. {
  780. --k2;
  781. }
  782. for (i3 = l1; i3 < l1 + 4; ++i3)
  783. {
  784. l2 = i3 % 2;
  785. k3 = 1 - l2;
  786. if (i3 % 4 >= 2)
  787. {
  788. l2 = -l2;
  789. k3 = -k3;
  790. }
  791. for (j3 = 0; j3 < 3; ++j3)
  792. {
  793. for (i4 = 0; i4 < 4; ++i4)
  794. {
  795. for (l3 = -1; l3 < 4; ++l3)
  796. {
  797. k4 = i2 + (i4 - 1) * l2 + j3 * k3;
  798. j4 = k2 + l3;
  799. int l4 = j2 + (i4 - 1) * k3 - j3 * l2;
  800. if (l3 < 0 && !this.worldServerInstance.getBlockMaterial(k4, j4, l4).isSolid() || l3 >= 0 && !this.worldServerInstance.isAirBlock(k4, j4, l4))
  801. {
  802. continue label274;
  803. }
  804. }
  805. }
  806. }
  807. d4 = (double)k2 + 0.5D - par1Entity.posY;
  808. d3 = d1 * d1 + d4 * d4 + d2 * d2;
  809. if (d0 < 0.0D || d3 < d0)
  810. {
  811. d0 = d3;
  812. l = i2;
  813. i1 = k2;
  814. j1 = j2;
  815. k1 = i3 % 4;
  816. }
  817. }
  818. }
  819. }
  820. }
  821. }
  822. if (d0 < 0.0D)
  823. {
  824. for (i2 = i - b0; i2 <= i + b0; ++i2)
  825. {
  826. d1 = (double)i2 + 0.5D - par1Entity.posX;
  827. for (j2 = k - b0; j2 <= k + b0; ++j2)
  828. {
  829. d2 = (double)j2 + 0.5D - par1Entity.posZ;
  830. label222:
  831. for (k2 = this.worldServerInstance.getActualHeight() - 1; k2 >= 0; --k2)
  832. {
  833. if (this.worldServerInstance.isAirBlock(i2, k2, j2))
  834. {
  835. while (k2 > 0 && this.worldServerInstance.isAirBlock(i2, k2 - 1, j2))
  836. {
  837. --k2;
  838. }
  839. for (i3 = l1; i3 < l1 + 2; ++i3)
  840. {
  841. l2 = i3 % 2;
  842. k3 = 1 - l2;
  843. for (j3 = 0; j3 < 4; ++j3)
  844. {
  845. for (i4 = -1; i4 < 4; ++i4)
  846. {
  847. l3 = i2 + (j3 - 1) * l2;
  848. k4 = k2 + i4;
  849. j4 = j2 + (j3 - 1) * k3;
  850. if (i4 < 0 && !this.worldServerInstance.getBlockMaterial(l3, k4, j4).isSolid() || i4 >= 0 && !this.worldServerInstance.isAirBlock(l3, k4, j4))
  851. {
  852. continue label222;
  853. }
  854. }
  855. }
  856. d4 = (double)k2 + 0.5D - par1Entity.posY;
  857. d3 = d1 * d1 + d4 * d4 + d2 * d2;
  858. if (d0 < 0.0D || d3 < d0)
  859. {
  860. d0 = d3;
  861. l = i2;
  862. i1 = k2;
  863. j1 = j2;
  864. k1 = i3 % 2;
  865. }
  866. }
  867. }
  868. }
  869. }
  870. }
  871. }
  872. int i5 = l;
  873. int j5 = i1;
  874. j2 = j1;
  875. int k5 = k1 % 2;
  876. int l5 = 1 - k5;
  877. if (k1 % 4 >= 2)
  878. {
  879. k5 = -k5;
  880. l5 = -l5;
  881. }
  882. boolean flag;
  883. if (d0 < 0.0D)
  884. {
  885. if (i1 < 70)
  886. {
  887. i1 = 70;
  888. }
  889. if (i1 > this.worldServerInstance.getActualHeight() - 10)
  890. {
  891. i1 = this.worldServerInstance.getActualHeight() - 10;
  892. }
  893. j5 = i1;
  894. for (k2 = -1; k2 <= 1; ++k2)
  895. {
  896. for (i3 = 1; i3 < 3; ++i3)
  897. {
  898. for (l2 = -1; l2 < 3; ++l2)
  899. {
  900. k3 = i5 + (i3 - 1) * k5 + k2 * l5;
  901. j3 = j5 + l2;
  902. i4 = j2 + (i3 - 1) * l5 - k2 * k5;
  903. flag = l2 < 0;
  904.  
  905. /** change this block **/
  906. this.worldServerInstance.setBlock(k3, j3, i4, flag ? Block.melon.blockID : 0);
  907. }
  908. }
  909. }
  910. }
  911. for (k2 = 0; k2 < 4; ++k2)
  912. {
  913. for (i3 = 0; i3 < 4; ++i3)
  914. {
  915. for (l2 = -1; l2 < 4; ++l2)
  916. {
  917. k3 = i5 + (i3 - 1) * k5;
  918. j3 = j5 + l2;
  919. i4 = j2 + (i3 - 1) * l5;
  920. flag = i3 == 0 || i3 == 3 || l2 == -1 || l2 == 3;
  921.  
  922. /** change these blocks **/
  923. this.worldServerInstance.setBlock(k3, j3, i4, flag ? Block.melon.blockID : block2.blockID, 0, 2);
  924. }
  925. }
  926. for (i3 = 0; i3 < 4; ++i3)
  927. {
  928. for (l2 = -1; l2 < 4; ++l2)
  929. {
  930. k3 = i5 + (i3 - 1) * k5;
  931. j3 = j5 + l2;
  932. i4 = j2 + (i3 - 1) * l5;
  933. this.worldServerInstance.notifyBlocksOfNeighborChange(k3, j3, i4, this.worldServerInstance.getBlockId(k3, j3, i4));
  934. }
  935. }
  936. }
  937. return true;
  938. }
  939. /**
  940. * called periodically to remove out-of-date portal locations from the cache list. Argument par1 is a
  941. * WorldServer.getTotalWorldTime() value.
  942. */
  943. public void removeStalePortalLocations(long par1)
  944. {
  945. if (par1 % 100L == 0L)
  946. {
  947. Iterator iterator = this.destinationCoordinateKeys.iterator();
  948. long j = par1 - 600L;
  949. while (iterator.hasNext())
  950. {
  951. Long olong = (Long)iterator.next();
  952. PortalPosition portalposition = (PortalPosition)this.destinationCoordinateCache.getValueByKey(olong.longValue());
  953. if (portalposition == null || portalposition.lastUpdateTime < j)
  954. {
  955. iterator.remove();
  956. this.destinationCoordinateCache.remove(olong.longValue());
  957. }
  958. }
  959. }
  960. }
  961. }
  962.  
  963. public static class ModdedPortalPosition extends ChunkCoordinates
  964. {
  965. public long field_85087_d;
  966. final ModdedTeleporter field_85088_e;
  967. public ModdedPortalPosition(ModdedTeleporter tutorialTeleporter, int par2, int par3, int par4, long par5)
  968. {
  969. super(par2, par3, par4);
  970. this.field_85088_e = tutorialTeleporter;
  971. this.field_85087_d = par5;
  972. }
  973. }
  974.  
  975. public static class WorldProvidertestDime extends WorldProvider
  976. {
  977. /**
  978. * creates a new world chunk manager for WorldProvider
  979. */
  980. public void registerWorldChunkManager()
  981. {
  982. /*this.worldChunkMgr = new WorldChunkManager(this.worldObj.getSeed(), WorldType.DEFAULT){
  983.  
  984. public BiomeGenBase getBiomeGenAt(int par1, int par2)
  985. {
  986. return BiomeGenBase.jungle;
  987. }
  988.  
  989. };*/
  990. this.worldChunkMgr = new WorldChunkManagerHell(BiomeGenBase.plains, 0.5F, 0.0F);
  991. this.dimensionId = 3;
  992. }
  993.  
  994. public IChunkProvider createChunkGenerator()
  995. {
  996. return new ChunkProviderModded(this.worldObj, this.worldObj.getSeed()-3854, false);
  997. }
  998.  
  999. @SideOnly(Side.CLIENT)
  1000.  
  1001. /**
  1002. * Return Vec3D with biome specific fog color
  1003. */
  1004. public Vec3 getFogColor(float par1, float par2)
  1005. {
  1006. return this.worldObj.getWorldVec3Pool().getVecFromPool(0.0D,1.0D,1.0D);
  1007. }
  1008.  
  1009. /**
  1010. * Creates the light to brightness table
  1011. */
  1012. protected void generateLightBrightnessTable()
  1013. {
  1014. float f = 0.1F;
  1015.  
  1016. for (int i = 0; i <= 15; ++i)
  1017. {
  1018. float f1 = 1.0F - (float)i / 15.0F;
  1019. this.lightBrightnessTable[i] = (1.0F - f1) / (f1 * 3.0F + 1.0F) * (1.0F - f) + f;
  1020. }
  1021. }
  1022.  
  1023.  
  1024.  
  1025. /**
  1026. * True if the player can respawn in this dimension (true = overworld, false = nether).
  1027. */
  1028. public boolean canRespawnHere()
  1029. {
  1030. return true;
  1031. }
  1032.  
  1033. @SideOnly(Side.CLIENT)
  1034.  
  1035. /**
  1036. * Returns true if the given X,Z coordinate should show environmental fog.
  1037. */
  1038. public boolean doesXZShowFog(int par1, int par2)
  1039. {
  1040. return false;
  1041. }
  1042.  
  1043. public boolean isSurfaceWorld()
  1044. {
  1045. return false;
  1046. }
  1047.  
  1048. /**
  1049. * Returns the dimension's name, e.g. "The End", "Nether", or "Overworld".
  1050. */
  1051. public String getDimensionName()
  1052. {
  1053. return "testDime";
  1054. }
  1055.  
  1056. //bananana
  1057. public float calculateCelestialAngle(long par1, float par3){return 0.5F;}
  1058. }
  1059.  
  1060. static class BlockModdedFire extends BlockFire
  1061. {
  1062. private int[] chanceToEncourageFire = new int[256];
  1063. private int[] abilityToCatchFire = new int[256];
  1064. @SideOnly(Side.CLIENT)
  1065. private Icon[] iconArray;
  1066. public BlockModdedFire(int par1)
  1067. {
  1068. super(par1);
  1069. setTickRandomly(true);
  1070. }
  1071. public Icon getIcon(int par1, int par2)
  1072. {
  1073. return this.blockIcon;
  1074. }
  1075. public void initializeBlock()
  1076. {
  1077. this.abilityToCatchFire = Block.blockFlammability;
  1078. this.chanceToEncourageFire = Block.blockFireSpreadSpeed;
  1079. setBurnRate(Block.planks.blockID, 5, 20);
  1080. setBurnRate(Block.woodDoubleSlab.blockID, 5, 20);
  1081. setBurnRate(Block.woodSingleSlab.blockID, 5, 20);
  1082. setBurnRate(Block.fence.blockID, 5, 20);
  1083. setBurnRate(Block.stairsWoodOak.blockID, 5, 20);
  1084. setBurnRate(Block.stairsWoodBirch.blockID, 5, 20);
  1085. setBurnRate(Block.stairsWoodSpruce.blockID, 5, 20);
  1086. setBurnRate(Block.stairsWoodJungle.blockID, 5, 20);
  1087. setBurnRate(Block.wood.blockID, 5, 5);
  1088. setBurnRate(Block.leaves.blockID, 30, 60);
  1089. setBurnRate(Block.bookShelf.blockID, 30, 20);
  1090. setBurnRate(Block.tnt.blockID, 15, 100);
  1091. setBurnRate(Block.tallGrass.blockID, 60, 100);
  1092. setBurnRate(Block.cloth.blockID, 30, 60);
  1093. setBurnRate(Block.vine.blockID, 15, 100);
  1094. }
  1095. private void setBurnRate(int par1, int par2, int par3)
  1096. {
  1097. Block.setBurnProperties(par1, par2, par3);
  1098. }
  1099. public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4)
  1100. {
  1101. return null;
  1102. }
  1103. public boolean isOpaqueCube()
  1104. {
  1105. return false;
  1106. }
  1107. public boolean renderAsNormalBlock()
  1108. {
  1109. return false;
  1110. }
  1111. public int getRenderType()
  1112. {
  1113. return 3;
  1114. }
  1115. public int quantityDropped(Random par1Random)
  1116. {
  1117. return 0;
  1118. }
  1119. public int tickRate(World par1World)
  1120. {
  1121. return 30;
  1122. }
  1123. public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random)
  1124. {
  1125. if (par1World.getGameRules().getGameRuleBooleanValue("doFireTick"))
  1126. {
  1127. Block base = Block.blocksList[par1World.getBlockId(par2, par3 - 1, par4)];
  1128. boolean flag = (base != null) && (base.isFireSource(par1World, par2, par3 - 1, par4, par1World.getBlockMetadata(par2, par3 - 1, par4), ForgeDirection.UP));
  1129. if (!canPlaceBlockAt(par1World, par2, par3, par4))
  1130. {
  1131. par1World.setBlockToAir(par2, par3, par4);
  1132. }
  1133. if ((!flag) && (par1World.isRaining()) && ((par1World.canLightningStrikeAt(par2, par3, par4)) || (par1World.canLightningStrikeAt(par2 - 1, par3, par4)) || (par1World.canLightningStrikeAt(par2 + 1, par3, par4)) || (par1World.canLightningStrikeAt(par2, par3, par4 - 1)) || (par1World.canLightningStrikeAt(par2, par3, par4 + 1))))
  1134. {
  1135. par1World.setBlockToAir(par2, par3, par4);
  1136. }
  1137. else
  1138. {
  1139. int l = par1World.getBlockMetadata(par2, par3, par4);
  1140. if (l < 15)
  1141. {
  1142. par1World.setBlockMetadataWithNotify(par2, par3, par4, l + par5Random.nextInt(3) / 2, 4);
  1143. }
  1144. par1World.scheduleBlockUpdate(par2, par3, par4, this.blockID, tickRate(par1World) + par5Random.nextInt(10));
  1145. if ((!flag) && (!canNeighborBurn(par1World, par2, par3, par4)))
  1146. {
  1147. if ((!par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4)) || (l > 3))
  1148. {
  1149. par1World.setBlockToAir(par2, par3, par4);
  1150. }
  1151. }
  1152. else if ((!flag) && (!canBlockCatchFire(par1World, par2, par3 - 1, par4, ForgeDirection.UP)) && (l == 15) && (par5Random.nextInt(4) == 0))
  1153. {
  1154. par1World.setBlockToAir(par2, par3, par4);
  1155. }
  1156. else
  1157. {
  1158. boolean flag1 = par1World.isBlockHighHumidity(par2, par3, par4);
  1159. byte b0 = 0;
  1160. if (flag1)
  1161. {
  1162. b0 = -50;
  1163. }
  1164. tryToCatchBlockOnFire(par1World, par2 + 1, par3, par4, 300 + b0, par5Random, l, ForgeDirection.WEST);
  1165. tryToCatchBlockOnFire(par1World, par2 - 1, par3, par4, 300 + b0, par5Random, l, ForgeDirection.EAST);
  1166. tryToCatchBlockOnFire(par1World, par2, par3 - 1, par4, 250 + b0, par5Random, l, ForgeDirection.UP);
  1167. tryToCatchBlockOnFire(par1World, par2, par3 + 1, par4, 250 + b0, par5Random, l, ForgeDirection.DOWN);
  1168. tryToCatchBlockOnFire(par1World, par2, par3, par4 - 1, 300 + b0, par5Random, l, ForgeDirection.SOUTH);
  1169. tryToCatchBlockOnFire(par1World, par2, par3, par4 + 1, 300 + b0, par5Random, l, ForgeDirection.NORTH);
  1170. for (int i1 = par2 - 1; i1 <= par2 + 1; i1++)
  1171. {
  1172. for (int j1 = par4 - 1; j1 <= par4 + 1; j1++)
  1173. {
  1174. for (int k1 = par3 - 1; k1 <= par3 + 4; k1++)
  1175. {
  1176. if ((i1 != par2) || (k1 != par3) || (j1 != par4))
  1177. {
  1178. int l1 = 100;
  1179. if (k1 > par3 + 1)
  1180. {
  1181. l1 += (k1 - (par3 + 1)) * 100;
  1182. }
  1183. int i2 = getChanceOfNeighborsEncouragingFire(par1World, i1, k1, j1);
  1184. if (i2 > 0)
  1185. {
  1186. int j2 = (i2 + 40 + par1World.difficultySetting * 7) / (l + 30);
  1187. if (flag1)
  1188. {
  1189. j2 /= 2;
  1190. }
  1191. if ((j2 > 0) && (par5Random.nextInt(l1) <= j2) && ((!par1World.isRaining()) || (!par1World.canLightningStrikeAt(i1, k1, j1))) && (!par1World.canLightningStrikeAt(i1 - 1, k1, par4)) && (!par1World.canLightningStrikeAt(i1 + 1, k1, j1)) && (!par1World.canLightningStrikeAt(i1, k1, j1 - 1)) && (!par1World.canLightningStrikeAt(i1, k1, j1 + 1)))
  1192. {
  1193. int k2 = l + par5Random.nextInt(5) / 4;
  1194. if (k2 > 15)
  1195. {
  1196. k2 = 15;
  1197. }
  1198. par1World.setBlock(i1, k1, j1, this.blockID, k2, 3);
  1199. }
  1200. }
  1201. }
  1202. }
  1203. }
  1204. }
  1205. }
  1206. }
  1207. }
  1208. }
  1209. public boolean func_82506_l() {
  1210. return true;
  1211. }
  1212. @Deprecated
  1213. private void tryToCatchBlockOnFire(World par1World, int par2, int par3, int par4, int par5, Random par6Random, int par7) {
  1214. tryToCatchBlockOnFire(par1World, par2, par3, par4, par5, par6Random, par7, ForgeDirection.UP);
  1215. }
  1216. private void tryToCatchBlockOnFire(World par1World, int par2, int par3, int par4, int par5, Random par6Random, int par7, ForgeDirection face) {
  1217. int j1 = 0;
  1218. Block block = Block.blocksList[par1World.getBlockId(par2, par3, par4)];
  1219. if (block != null)
  1220. {
  1221. j1 = block.getFlammability(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), face);
  1222. }
  1223. if (par6Random.nextInt(par5) < j1)
  1224. {
  1225. boolean flag = par1World.getBlockId(par2, par3, par4) == Block.tnt.blockID;
  1226. if ((par6Random.nextInt(par7 + 10) < 5) && (!par1World.canLightningStrikeAt(par2, par3, par4)))
  1227. {
  1228. int k1 = par7 + par6Random.nextInt(5) / 4;
  1229. if (k1 > 15)
  1230. {
  1231. k1 = 15;
  1232. }
  1233. par1World.setBlock(par2, par3, par4, this.blockID, k1, 3);
  1234. }
  1235. else
  1236. {
  1237. par1World.setBlockToAir(par2, par3, par4);
  1238. }
  1239. if (flag)
  1240. {
  1241. Block.tnt.onBlockDestroyedByPlayer(par1World, par2, par3, par4, 1);
  1242. }
  1243. }
  1244. }
  1245. private boolean canNeighborBurn(World par1World, int par2, int par3, int par4)
  1246. {
  1247. return (canBlockCatchFire(par1World, par2 + 1, par3, par4, ForgeDirection.WEST)) ||
  1248. (canBlockCatchFire(par1World, par2 - 1, par3, par4, ForgeDirection.EAST)) ||
  1249. (canBlockCatchFire(par1World, par2, par3 - 1, par4, ForgeDirection.UP)) ||
  1250. (canBlockCatchFire(par1World, par2, par3 + 1, par4, ForgeDirection.DOWN)) ||
  1251. (canBlockCatchFire(par1World, par2, par3, par4 - 1, ForgeDirection.SOUTH)) ||
  1252. (canBlockCatchFire(par1World, par2, par3, par4 + 1, ForgeDirection.NORTH));
  1253. }
  1254. private int getChanceOfNeighborsEncouragingFire(World par1World, int par2, int par3, int par4)
  1255. {
  1256. byte b0 = 0;
  1257. if (!par1World.isAirBlock(par2, par3, par4))
  1258. {
  1259. return 0;
  1260. }
  1261. int l = getChanceToEncourageFire(par1World, par2 + 1, par3, par4, b0, ForgeDirection.WEST);
  1262. l = getChanceToEncourageFire(par1World, par2 - 1, par3, par4, l, ForgeDirection.EAST);
  1263. l = getChanceToEncourageFire(par1World, par2, par3 - 1, par4, l, ForgeDirection.UP);
  1264. l = getChanceToEncourageFire(par1World, par2, par3 + 1, par4, l, ForgeDirection.DOWN);
  1265. l = getChanceToEncourageFire(par1World, par2, par3, par4 - 1, l, ForgeDirection.SOUTH);
  1266. l = getChanceToEncourageFire(par1World, par2, par3, par4 + 1, l, ForgeDirection.NORTH);
  1267. return l;
  1268. }
  1269. public boolean isCollidable()
  1270. {
  1271. return false;
  1272. }
  1273. @Deprecated
  1274. public boolean canBlockCatchFire(IBlockAccess par1IBlockAccess, int par2, int par3, int par4)
  1275. {
  1276. return canBlockCatchFire(par1IBlockAccess, par2, par3, par4, ForgeDirection.UP);
  1277. }
  1278. @Deprecated
  1279. public int getChanceToEncourageFire(World par1World, int par2, int par3, int par4, int par5)
  1280. {
  1281. return getChanceToEncourageFire(par1World, par2, par3, par4, par5, ForgeDirection.UP);
  1282. }
  1283. public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4)
  1284. {
  1285. return (par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4)) || (canNeighborBurn(par1World, par2, par3, par4));
  1286. }
  1287. public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, int par5)
  1288. {
  1289. if ((!par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4)) && (!canNeighborBurn(par1World, par2, par3, par4)))
  1290. {
  1291. par1World.setBlockToAir(par2, par3, par4);
  1292. }
  1293. }
  1294. public void onBlockAdded(World par1World, int par2, int par3, int par4)
  1295. {
  1296. /** Change these to your portal frame and Portal block **/
  1297. if ((par1World.getBlockId(par2, par3 - 1, par4) != Block.melon.blockID) || (!block2.tryToCreatePortal(par1World, par2, par3, par4)))
  1298. {
  1299. if ((!par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4)) && (!canNeighborBurn(par1World, par2, par3, par4)))
  1300. {
  1301. par1World.setBlockToAir(par2, par3, par4);
  1302. }
  1303. else
  1304. {
  1305. par1World.scheduleBlockUpdate(par2, par3, par4, this.blockID, tickRate(par1World) + par1World.rand.nextInt(10));
  1306. par1World.setBlockToAir(par2, par3, par4);
  1307. }
  1308. }
  1309. }
  1310. @SideOnly(Side.CLIENT)
  1311. public void randomDisplayTick(World par1World, int par2, int par3, int par4, Random par5Random)
  1312. {
  1313. if (par5Random.nextInt(24) == 0)
  1314. {
  1315. par1World.playSound(par2 + 0.5F, par3 + 0.5F, par4 + 0.5F, "fire.fire", 1.0F + par5Random.nextFloat(), par5Random.nextFloat() * 0.7F + 0.3F, false);
  1316. }
  1317. if ((!par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4)) && (!ModdedFire.canBlockCatchFire(par1World, par2, par3 - 1, par4, ForgeDirection.UP)))
  1318. {
  1319. if (ModdedFire.canBlockCatchFire(par1World, par2 - 1, par3, par4, ForgeDirection.EAST))
  1320. {
  1321. for (int l = 0; l < 2; l++)
  1322. {
  1323. float f = par2 + par5Random.nextFloat() * 0.1F;
  1324. float f1 = par3 + par5Random.nextFloat();
  1325. float f2 = par4 + par5Random.nextFloat();
  1326. par1World.spawnParticle("largesmoke", f, f1, f2, 0.0D, 0.0D, 0.0D);
  1327. }
  1328. }
  1329. if (ModdedFire.canBlockCatchFire(par1World, par2 + 1, par3, par4, ForgeDirection.WEST))
  1330. {
  1331. for (int l = 0; l < 2; l++)
  1332. {
  1333. float f = par2 + 1 - par5Random.nextFloat() * 0.1F;
  1334. float f1 = par3 + par5Random.nextFloat();
  1335. float f2 = par4 + par5Random.nextFloat();
  1336. par1World.spawnParticle("largesmoke", f, f1, f2, 0.0D, 0.0D, 0.0D);
  1337. }
  1338. }
  1339. if (ModdedFire.canBlockCatchFire(par1World, par2, par3, par4 - 1, ForgeDirection.SOUTH))
  1340. {
  1341. for (int l = 0; l < 2; l++)
  1342. {
  1343. float f = par2 + par5Random.nextFloat();
  1344. float f1 = par3 + par5Random.nextFloat();
  1345. float f2 = par4 + par5Random.nextFloat() * 0.1F;
  1346. par1World.spawnParticle("largesmoke", f, f1, f2, 0.0D, 0.0D, 0.0D);
  1347. }
  1348. }
  1349. if (ModdedFire.canBlockCatchFire(par1World, par2, par3, par4 + 1, ForgeDirection.NORTH))
  1350. {
  1351. for (int l = 0; l < 2; l++)
  1352. {
  1353. float f = par2 + par5Random.nextFloat();
  1354. float f1 = par3 + par5Random.nextFloat();
  1355. float f2 = par4 + 1 - par5Random.nextFloat() * 0.1F;
  1356. par1World.spawnParticle("largesmoke", f, f1, f2, 0.0D, 0.0D, 0.0D);
  1357. }
  1358. }
  1359. if (ModdedFire.canBlockCatchFire(par1World, par2, par3 + 1, par4, ForgeDirection.DOWN))
  1360. {
  1361. for (int l = 0; l < 2; l++)
  1362. {
  1363. float f = par2 + par5Random.nextFloat();
  1364. float f1 = par3 + 1 - par5Random.nextFloat() * 0.1F;
  1365. float f2 = par4 + par5Random.nextFloat();
  1366. par1World.spawnParticle("largesmoke", f, f1, f2, 0.0D, 0.0D, 0.0D);
  1367. }
  1368. }
  1369. }
  1370. else
  1371. {
  1372. for (int l = 0; l < 3; l++)
  1373. {
  1374. float f = par2 + par5Random.nextFloat();
  1375. float f1 = par3 + par5Random.nextFloat() * 0.5F + 0.5F;
  1376. float f2 = par4 + par5Random.nextFloat();
  1377. par1World.spawnParticle("largesmoke", f, f1, f2, 0.0D, 0.0D, 0.0D);
  1378. }
  1379. }
  1380. }
  1381. public boolean canBlockCatchFire(IBlockAccess world, int x, int y, int z, ForgeDirection face)
  1382. {
  1383. Block block = Block.blocksList[world.getBlockId(x, y, z)];
  1384. if (block != null)
  1385. {
  1386. return block.isFlammable(world, x, y, z, world.getBlockMetadata(x, y, z), face);
  1387. }
  1388. return false;
  1389. }
  1390. public int getChanceToEncourageFire(World world, int x, int y, int z, int oldChance, ForgeDirection face)
  1391. {
  1392. int newChance = 0;
  1393. Block block = Block.blocksList[world.getBlockId(x, y, z)];
  1394. if (block != null)
  1395. {
  1396. newChance = block.getFireSpreadSpeed(world, x, y, z, world.getBlockMetadata(x, y, z), face);
  1397. }
  1398. return newChance > oldChance ? newChance : oldChance;
  1399. }
  1400. /** registers Icons, set textures here **/
  1401. @SideOnly(Side.CLIENT)
  1402. public void registerIcons(IconRegister par1IconRegister)
  1403. {
  1404. this.iconArray = new Icon[] { par1IconRegister.registerIcon("mob_spawner"), par1IconRegister.registerIcon("mob_spawner") };
  1405. }
  1406. @SideOnly(Side.CLIENT)
  1407. public Icon func_94438_c(int par1) {
  1408. return this.iconArray[par1];
  1409. }
  1410. @SideOnly(Side.CLIENT)
  1411. public Icon getBlockTextureFromSideAndMetadata(int par1, int par2)
  1412. {
  1413. return this.iconArray[0];
  1414. }
  1415. }
  1416.  
  1417.  
  1418. static class Itemblock extends Item
  1419. {
  1420. public Itemblock(int par1)
  1421. {
  1422. super(par1);
  1423. this.maxStackSize = 1;
  1424. setMaxDamage(64);
  1425. setCreativeTab(CreativeTabs.tabTools);
  1426. }
  1427. public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10)
  1428. {
  1429. if (par7 == 0)
  1430. {
  1431. par5--;
  1432. }
  1433. if (par7 == 1)
  1434. {
  1435. par5++;
  1436. }
  1437. if (par7 == 2)
  1438. {
  1439. par6--;
  1440. }
  1441. if (par7 == 3)
  1442. {
  1443. par6++;
  1444. }
  1445. if (par7 == 4)
  1446. {
  1447. par4--;
  1448. }
  1449. if (par7 == 5)
  1450. {
  1451. par4++;
  1452. }
  1453. if (!par2EntityPlayer.canPlayerEdit(par4, par5, par6, par7, par1ItemStack))
  1454. {
  1455. return false;
  1456. }
  1457. int i1 = par3World.getBlockId(par4, par5, par6);
  1458. if (i1 == 0)
  1459. {
  1460. par3World.playSoundEffect(par4 + 0.5D, par5 + 0.5D, par6 + 0.5D, "fire.ignite", 1.0F, itemRand.nextFloat() * 0.4F + 0.8F);
  1461. /** replace with your fire block **/
  1462. par3World.setBlock(par4, par5, par6, ModdedFire.blockID);
  1463. }
  1464. par1ItemStack.damageItem(1, par2EntityPlayer);
  1465. return true;
  1466. }
  1467. }
  1468.  
  1469.  
  1470.  
  1471. //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  1472. //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  1473. //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  1474. //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  1475.  
  1476.  
  1477.  
  1478. public static class ChunkProviderModded implements IChunkProvider
  1479. {
  1480. private Random hellRNG;
  1481. private Random rand;
  1482.  
  1483. /** A NoiseGeneratorOctaves used in generating nether terrain */
  1484. private NoiseGeneratorOctaves netherNoiseGen1;
  1485. private NoiseGeneratorOctaves netherNoiseGen2;
  1486. private NoiseGeneratorOctaves netherNoiseGen3;
  1487.  
  1488. /** Determines whether slowsand or gravel can be generated at a location */
  1489. private NoiseGeneratorOctaves slowsandGravelNoiseGen;
  1490.  
  1491. /**
  1492. * Determines whether something other than nettherack can be generated at a location
  1493. */
  1494. private NoiseGeneratorOctaves netherrackExculsivityNoiseGen;
  1495. public NoiseGeneratorOctaves netherNoiseGen6;
  1496. public NoiseGeneratorOctaves netherNoiseGen7;
  1497.  
  1498. /** Is the world that the nether is getting generated. */
  1499. private World worldObj;
  1500. private double[] noiseField;
  1501. public MapGenNetherBridge genNetherBridge = new MapGenNetherBridge();
  1502.  
  1503. /**
  1504. * Holds the noise used to determine whether slowsand can be generated at a location
  1505. */
  1506. private double[] slowsandNoise = new double[256];
  1507. private double[] gravelNoise = new double[256];
  1508.  
  1509. /**
  1510. * Holds the noise used to determine whether something other than netherrack can be generated at a location
  1511. */
  1512. private double[] netherrackExclusivityNoise = new double[256];
  1513. private MapGenBase netherCaveGenerator = new MapGenCavesHell();
  1514. double[] noiseData1;
  1515. double[] noiseData2;
  1516. double[] noiseData3;
  1517. double[] noiseData4;
  1518. double[] noiseData5;
  1519.  
  1520. //drek
  1521. {
  1522. netherCaveGenerator = TerrainGen.getModdedMapGen(netherCaveGenerator, NETHER_CAVE);
  1523. }
  1524.  
  1525. public ChunkProviderModded(World par1World, long par2, boolean kruh)
  1526. {
  1527. this.worldObj = par1World;
  1528. this.hellRNG = new Random(par2);
  1529. this.rand = new Random(par2);
  1530. this.netherNoiseGen1 = new NoiseGeneratorOctaves(this.hellRNG, 16);
  1531. this.netherNoiseGen2 = new NoiseGeneratorOctaves(this.hellRNG, 16);
  1532. this.netherNoiseGen3 = new NoiseGeneratorOctaves(this.hellRNG, 8);
  1533. this.slowsandGravelNoiseGen = new NoiseGeneratorOctaves(this.hellRNG, 4);
  1534. this.netherrackExculsivityNoiseGen = new NoiseGeneratorOctaves(this.hellRNG, 4);
  1535. this.netherNoiseGen6 = new NoiseGeneratorOctaves(this.hellRNG, 10);
  1536. this.netherNoiseGen7 = new NoiseGeneratorOctaves(this.hellRNG, 16);
  1537.  
  1538. NoiseGeneratorOctaves[] noiseGens = {netherNoiseGen1, netherNoiseGen2, netherNoiseGen3, slowsandGravelNoiseGen, netherrackExculsivityNoiseGen, netherNoiseGen6, netherNoiseGen7};
  1539. noiseGens = TerrainGen.getModdedNoiseGenerators(par1World, this.hellRNG, noiseGens);
  1540. this.netherNoiseGen1 = noiseGens[0];
  1541. this.netherNoiseGen2 = noiseGens[1];
  1542. this.netherNoiseGen3 = noiseGens[2];
  1543. this.slowsandGravelNoiseGen = noiseGens[3];
  1544. this.netherrackExculsivityNoiseGen = noiseGens[4];
  1545. this.netherNoiseGen6 = noiseGens[5];
  1546. this.netherNoiseGen7 = noiseGens[6];
  1547. }
  1548.  
  1549. /**
  1550. * Generates the shape of the terrain in the nether.
  1551. */
  1552. public void generateNetherTerrain(int par1, int par2, byte[] par3ArrayOfByte)
  1553. {
  1554. byte b0 = 4;
  1555. byte b1 = 32;
  1556. int k = b0 + 1;
  1557. byte b2 = 17;
  1558. int l = b0 + 1;
  1559. this.noiseField = this.initializeNoiseField(this.noiseField, par1 * b0, 0, par2 * b0, k, b2, l);
  1560.  
  1561. for (int i1 = 0; i1 < b0; ++i1)
  1562. {
  1563. for (int j1 = 0; j1 < b0; ++j1)
  1564. {
  1565. for (int k1 = 0; k1 < 16; ++k1)
  1566. {
  1567. double d0 = 0.125D;
  1568. double d1 = this.noiseField[((i1 + 0) * l + j1 + 0) * b2 + k1 + 0];
  1569. double d2 = this.noiseField[((i1 + 0) * l + j1 + 1) * b2 + k1 + 0];
  1570. double d3 = this.noiseField[((i1 + 1) * l + j1 + 0) * b2 + k1 + 0];
  1571. double d4 = this.noiseField[((i1 + 1) * l + j1 + 1) * b2 + k1 + 0];
  1572. double d5 = (this.noiseField[((i1 + 0) * l + j1 + 0) * b2 + k1 + 1] - d1) * d0;
  1573. double d6 = (this.noiseField[((i1 + 0) * l + j1 + 1) * b2 + k1 + 1] - d2) * d0;
  1574. double d7 = (this.noiseField[((i1 + 1) * l + j1 + 0) * b2 + k1 + 1] - d3) * d0;
  1575. double d8 = (this.noiseField[((i1 + 1) * l + j1 + 1) * b2 + k1 + 1] - d4) * d0;
  1576.  
  1577. for (int l1 = 0; l1 < 8; ++l1)
  1578. {
  1579. double d9 = 0.25D;
  1580. double d10 = d1;
  1581. double d11 = d2;
  1582. double d12 = (d3 - d1) * d9;
  1583. double d13 = (d4 - d2) * d9;
  1584.  
  1585. for (int i2 = 0; i2 < 4; ++i2)
  1586. {
  1587. int j2 = i2 + i1 * 4 << 11 | 0 + j1 * 4 << 7 | k1 * 8 + l1;
  1588. short short1 = 128;
  1589. double d14 = 0.25D;
  1590. double d15 = d10;
  1591. double d16 = (d11 - d10) * d14;
  1592.  
  1593. for (int k2 = 0; k2 < 4; ++k2)
  1594. {
  1595. int l2 = 0;
  1596.  
  1597. if (k1 * 8 + l1 < b1)
  1598. {
  1599. l2 = Block.waterStill.blockID;
  1600. }
  1601.  
  1602. if (d15 > 0.0D)
  1603. {
  1604. l2 = Block.ice.blockID;
  1605. }
  1606.  
  1607. par3ArrayOfByte[j2] = (byte)l2;
  1608. j2 += short1;
  1609. d15 += d16;
  1610. }
  1611.  
  1612. d10 += d12;
  1613. d11 += d13;
  1614. }
  1615.  
  1616. d1 += d5;
  1617. d2 += d6;
  1618. d3 += d7;
  1619. d4 += d8;
  1620. }
  1621. }
  1622. }
  1623. }
  1624. }
  1625.  
  1626. /**
  1627. * name based on ChunkProviderGenerate
  1628. */
  1629. public void replaceBlocksForBiome(int par1, int par2, byte[] par3ArrayOfByte)
  1630. {
  1631. ChunkProviderEvent.ReplaceBiomeBlocks event = new ChunkProviderEvent.ReplaceBiomeBlocks(this, par1, par2, par3ArrayOfByte, null);
  1632. MinecraftForge.EVENT_BUS.post(event);
  1633. if (event.getResult() == Result.DENY) return;
  1634.  
  1635. byte b0 = 64;
  1636. double d0 = 0.03125D;
  1637. this.slowsandNoise = this.slowsandGravelNoiseGen.generateNoiseOctaves(this.slowsandNoise, par1 * 16, par2 * 16, 0, 16, 16, 1, d0, d0, 1.0D);
  1638. this.gravelNoise = this.slowsandGravelNoiseGen.generateNoiseOctaves(this.gravelNoise, par1 * 16, 109, par2 * 16, 16, 1, 16, d0, 1.0D, d0);
  1639. this.netherrackExclusivityNoise = this.netherrackExculsivityNoiseGen.generateNoiseOctaves(this.netherrackExclusivityNoise, par1 * 16, par2 * 16, 0, 16, 16, 1, d0 * 2.0D, d0 * 2.0D, d0 * 2.0D);
  1640.  
  1641. for (int k = 0; k < 16; ++k)
  1642. {
  1643. for (int l = 0; l < 16; ++l)
  1644. {
  1645. boolean flag = this.slowsandNoise[k + l * 16] + this.hellRNG.nextDouble() * 0.2D > 0.0D;
  1646. boolean flag1 = this.gravelNoise[k + l * 16] + this.hellRNG.nextDouble() * 0.2D > 0.0D;
  1647. int i1 = (int)(this.netherrackExclusivityNoise[k + l * 16] / 3.0D + 3.0D + this.hellRNG.nextDouble() * 0.25D);
  1648. int j1 = -1;
  1649. byte b1 = (byte)Block.ice.blockID;
  1650. byte b2 = (byte)Block.ice.blockID;
  1651.  
  1652. for (int k1 = 127; k1 >= 0; --k1)
  1653. {
  1654. int l1 = (l * 16 + k) * 128 + k1;
  1655.  
  1656. if (k1 < 127 - this.hellRNG.nextInt(5) && k1 > 0 + this.hellRNG.nextInt(5))
  1657. {
  1658. byte b3 = par3ArrayOfByte[l1];
  1659.  
  1660. if (b3 == 0)
  1661. {
  1662. j1 = -1;
  1663. }
  1664. else if (b3 == Block.ice.blockID)
  1665. {
  1666. if (j1 == -1)
  1667. {
  1668. if (i1 <= 0)
  1669. {
  1670. b1 = 0;
  1671. b2 = (byte)Block.ice.blockID;
  1672. }
  1673. else if (k1 >= b0 - 4 && k1 <= b0 + 1)
  1674. {
  1675. b1 = (byte)Block.ice.blockID;
  1676. b2 = (byte)Block.ice.blockID;
  1677.  
  1678. if (flag1)
  1679. {
  1680. b1 = (byte)Block.glass.blockID;
  1681. }
  1682.  
  1683. if (flag1)
  1684. {
  1685. b2 = (byte)Block.ice.blockID;
  1686. }
  1687.  
  1688. if (flag)
  1689. {
  1690. b1 = (byte).blockID;
  1691. }
  1692.  
  1693. if (flag)
  1694. {
  1695. b2 = (byte).blockID;
  1696. }
  1697. }
  1698.  
  1699. if (k1 < b0 && b1 == 0)
  1700. {
  1701. b1 = (byte)Block.waterStill.blockID;
  1702. }
  1703.  
  1704. j1 = i1;
  1705.  
  1706. if (k1 >= b0 - 1)
  1707. {
  1708. par3ArrayOfByte[l1] = b1;
  1709. }
  1710. else
  1711. {
  1712. par3ArrayOfByte[l1] = b2;
  1713. }
  1714. }
  1715. else if (j1 > 0)
  1716. {
  1717. --j1;
  1718. par3ArrayOfByte[l1] = b2;
  1719. }
  1720. }
  1721. }
  1722. else
  1723. {
  1724. par3ArrayOfByte[l1] = (byte)Block.bedrock.blockID;
  1725. }
  1726. }
  1727. }
  1728. }
  1729. }
  1730.  
  1731. /**
  1732. * loads or generates the chunk at the chunk location specified
  1733. */
  1734. public Chunk loadChunk(int par1, int par2)
  1735. {
  1736. return this.provideChunk(par1, par2);
  1737. }
  1738.  
  1739. /**
  1740. * Will return back a chunk, if it doesn't exist and its not a MP client it will generates all the blocks for the
  1741. * specified chunk from the map seed and chunk seed
  1742. */
  1743. public Chunk provideChunk(int par1, int par2)
  1744. {
  1745. this.hellRNG.setSeed((long)par1 * 341873128712L + (long)par2 * 132897987541L);
  1746. byte[] abyte = new byte[32768];
  1747. this.generateNetherTerrain(par1, par2, abyte);
  1748. this.replaceBlocksForBiome(par1, par2, abyte);
  1749. Chunk chunk = new Chunk(this.worldObj, abyte, par1, par2);
  1750. BiomeGenBase[] abiomegenbase = this.worldObj.getWorldChunkManager().loadBlockGeneratorData((BiomeGenBase[])null, par1 * 16, par2 * 16, 16, 16);
  1751. byte[] abyte1 = chunk.getBiomeArray();
  1752.  
  1753. for (int k = 0; k < abyte1.length; ++k)
  1754. {
  1755. abyte1[k] = (byte)abiomegenbase[k].biomeID;
  1756. }
  1757. chunk.resetRelightChecks();
  1758. return chunk;
  1759. }
  1760.  
  1761. /**
  1762. * generates a subset of the level's terrain data. Takes 7 arguments: the [empty] noise array, the position, and the
  1763. * size.
  1764. */
  1765. private double[] initializeNoiseField(double[] par1ArrayOfDouble, int par2, int par3, int par4, int par5, int par6, int par7)
  1766. {
  1767. ChunkProviderEvent.InitNoiseField event = new ChunkProviderEvent.InitNoiseField(this, par1ArrayOfDouble, par2, par3, par4, par5, par6, par7);
  1768. MinecraftForge.EVENT_BUS.post(event);
  1769. if (event.getResult() == Result.DENY) return event.noisefield;
  1770. if (par1ArrayOfDouble == null)
  1771. {
  1772. par1ArrayOfDouble = new double[par5 * par6 * par7];
  1773. }
  1774.  
  1775. double d0 = 684.412D;
  1776. double d1 = 2053.236D;
  1777. this.noiseData4 = this.netherNoiseGen6.generateNoiseOctaves(this.noiseData4, par2, par3, par4, par5, 1, par7, 1.0D, 0.0D, 1.0D);
  1778. this.noiseData5 = this.netherNoiseGen7.generateNoiseOctaves(this.noiseData5, par2, par3, par4, par5, 1, par7, 100.0D, 0.0D, 100.0D);
  1779. this.noiseData1 = this.netherNoiseGen3.generateNoiseOctaves(this.noiseData1, par2, par3, par4, par5, par6, par7, d0 / 80.0D, d1 / 60.0D, d0 / 80.0D);
  1780. this.noiseData2 = this.netherNoiseGen1.generateNoiseOctaves(this.noiseData2, par2, par3, par4, par5, par6, par7, d0, d1, d0);
  1781. this.noiseData3 = this.netherNoiseGen2.generateNoiseOctaves(this.noiseData3, par2, par3, par4, par5, par6, par7, d0, d1, d0);
  1782. int k1 = 0;
  1783. int l1 = 0;
  1784. double[] adouble1 = new double[par6];
  1785. int i2;
  1786.  
  1787. for (i2 = 0; i2 < par6; ++i2)
  1788. {
  1789. adouble1[i2] = Math.cos((double)i2 * Math.PI * 6.0D / (double)par6) * 2.0D;
  1790. double d2 = (double)i2;
  1791.  
  1792. if (i2 > par6 / 2)
  1793. {
  1794. d2 = (double)(par6 - 1 - i2);
  1795. }
  1796.  
  1797. if (d2 < 4.0D)
  1798. {
  1799. d2 = 4.0D - d2;
  1800. adouble1[i2] -= d2 * d2 * d2 * 10.0D;
  1801. }
  1802. }
  1803.  
  1804. for (i2 = 0; i2 < par5; ++i2)
  1805. {
  1806. for (int j2 = 0; j2 < par7; ++j2)
  1807. {
  1808. double d3 = (this.noiseData4[l1] + 256.0D) / 512.0D;
  1809.  
  1810. if (d3 > 1.0D)
  1811. {
  1812. d3 = 1.0D;
  1813. }
  1814.  
  1815. double d4 = 0.0D;
  1816. double d5 = this.noiseData5[l1] / 8000.0D;
  1817.  
  1818. if (d5 < 0.0D)
  1819. {
  1820. d5 = -d5;
  1821. }
  1822.  
  1823. d5 = d5 * 3.0D - 3.0D;
  1824.  
  1825. if (d5 < 0.0D)
  1826. {
  1827. d5 /= 2.0D;
  1828.  
  1829. if (d5 < -1.0D)
  1830. {
  1831. d5 = -1.0D;
  1832. }
  1833.  
  1834. d5 /= 1.4D;
  1835. d5 /= 2.0D;
  1836. d3 = 0.0D;
  1837. }
  1838. else
  1839. {
  1840. if (d5 > 1.0D)
  1841. {
  1842. d5 = 1.0D;
  1843. }
  1844.  
  1845. d5 /= 6.0D;
  1846. }
  1847.  
  1848. d3 += 0.5D;
  1849. d5 = d5 * (double)par6 / 16.0D;
  1850. ++l1;
  1851.  
  1852. for (int k2 = 0; k2 < par6; ++k2)
  1853. {
  1854. double d6 = 0.0D;
  1855. double d7 = adouble1[k2];
  1856. double d8 = this.noiseData2[k1] / 512.0D;
  1857. double d9 = this.noiseData3[k1] / 512.0D;
  1858. double d10 = (this.noiseData1[k1] / 10.0D + 1.0D) / 2.0D;
  1859.  
  1860. if (d10 < 0.0D)
  1861. {
  1862. d6 = d8;
  1863. }
  1864. else if (d10 > 1.0D)
  1865. {
  1866. d6 = d9;
  1867. }
  1868. else
  1869. {
  1870. d6 = d8 + (d9 - d8) * d10;
  1871. }
  1872.  
  1873. d6 -= d7;
  1874. double d11;
  1875.  
  1876. if (k2 > par6 - 4)
  1877. {
  1878. d11 = (double)((float)(k2 - (par6 - 4)) / 3.0F);
  1879. d6 = d6 * (1.0D - d11) + -10.0D * d11;
  1880. }
  1881.  
  1882. if ((double)k2 < d4)
  1883. {
  1884. d11 = (d4 - (double)k2) / 4.0D;
  1885.  
  1886. if (d11 < 0.0D)
  1887. {
  1888. d11 = 0.0D;
  1889. }
  1890.  
  1891. if (d11 > 1.0D)
  1892. {
  1893. d11 = 1.0D;
  1894. }
  1895.  
  1896. d6 = d6 * (1.0D - d11) + -10.0D * d11;
  1897. }
  1898.  
  1899. par1ArrayOfDouble[k1] = d6;
  1900. ++k1;
  1901. }
  1902. }
  1903. }
  1904.  
  1905. return par1ArrayOfDouble;
  1906. }
  1907.  
  1908. /**
  1909. * Checks to see if a chunk exists at x, y
  1910. */
  1911. public boolean chunkExists(int par1, int par2)
  1912. {
  1913. return true;
  1914. }
  1915.  
  1916. /**
  1917. * Populates chunk with ores etc etc
  1918. */
  1919. public void populate(IChunkProvider par1IChunkProvider, int par2, int par3)
  1920. {
  1921. BlockSand.fallInstantly = true;
  1922.  
  1923. MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Pre(par1IChunkProvider, worldObj, hellRNG, par2, par3, false));
  1924.  
  1925. int k = par2 * 16;
  1926. int l = par3 * 16;
  1927. int i1;
  1928. int j1;
  1929. int k1;
  1930. int l1;
  1931.  
  1932. boolean doGen = TerrainGen.populate(par1IChunkProvider, worldObj, hellRNG, par2, par3, false, NETHER_LAVA);
  1933. for (i1 = 0; doGen && i1 < 8; ++i1)
  1934. {
  1935. j1 = k + this.hellRNG.nextInt(16) + 8;
  1936. k1 = this.hellRNG.nextInt(120) + 4;
  1937. l1 = l + this.hellRNG.nextInt(16) + 8;
  1938. (new WorldGenHellLava(Block.lavaMoving.blockID, false)).generate(this.worldObj, this.hellRNG, j1, k1, l1);
  1939. }
  1940.  
  1941. i1 = this.hellRNG.nextInt(this.hellRNG.nextInt(10) + 1) + 1;
  1942. int i2;
  1943.  
  1944. doGen = TerrainGen.populate(par1IChunkProvider, worldObj, hellRNG, par2, par3, false, FIRE);
  1945. for (j1 = 0; doGen && j1 < i1; ++j1)
  1946. {
  1947. k1 = k + this.hellRNG.nextInt(16) + 8;
  1948. l1 = this.hellRNG.nextInt(120) + 4;
  1949. i2 = l + this.hellRNG.nextInt(16) + 8;
  1950. (new WorldGenFire()).generate(this.worldObj, this.hellRNG, k1, l1, i2);
  1951. }
  1952.  
  1953. i1 = this.hellRNG.nextInt(this.hellRNG.nextInt(10) + 1);
  1954.  
  1955. doGen = TerrainGen.populate(par1IChunkProvider, worldObj, hellRNG, par2, par3, false, GLOWSTONE);
  1956. for (j1 = 0; doGen && j1 < i1; ++j1)
  1957. {
  1958. k1 = k + this.hellRNG.nextInt(16) + 8;
  1959. l1 = this.hellRNG.nextInt(120) + 4;
  1960. i2 = l + this.hellRNG.nextInt(16) + 8;
  1961. (new WorldGenGlowStone1()).generate(this.worldObj, this.hellRNG, k1, l1, i2);
  1962. }
  1963.  
  1964. for (j1 = 0; doGen && j1 < 10; ++j1)
  1965. {
  1966. k1 = k + this.hellRNG.nextInt(16) + 8;
  1967. l1 = this.hellRNG.nextInt(128);
  1968. i2 = l + this.hellRNG.nextInt(16) + 8;
  1969. (new WorldGenGlowStone2()).generate(this.worldObj, this.hellRNG, k1, l1, i2);
  1970. }
  1971.  
  1972. int var4 = par2 * 16;
  1973. int var5 = par3 * 16;
  1974.  
  1975.  
  1976.  
  1977. MinecraftForge.EVENT_BUS.post(new DecorateBiomeEvent.Pre(worldObj, hellRNG, k, l));
  1978.  
  1979. doGen = TerrainGen.decorate(worldObj, hellRNG, k, l, SHROOM);
  1980.  
  1981. WorldGenMinable worldgenminable = new WorldGenMinable(Block.slowSand.blockID, 13, Block.ice.blockID);
  1982. int j2;
  1983.  
  1984. for (k1 = 0; k1 < 16; ++k1)
  1985. {
  1986. l1 = k + this.hellRNG.nextInt(16);
  1987. i2 = this.hellRNG.nextInt(108) + 10;
  1988. j2 = l + this.hellRNG.nextInt(16);
  1989. worldgenminable.generate(this.worldObj, this.hellRNG, l1, i2, j2);
  1990. }
  1991.  
  1992. for (k1 = 0; k1 < 16; ++k1)
  1993. {
  1994. l1 = k + this.hellRNG.nextInt(16);
  1995. i2 = this.hellRNG.nextInt(108) + 10;
  1996. j2 = l + this.hellRNG.nextInt(16);
  1997. (new WorldGenHellLava(Block.waterStill.blockID, true)).generate(this.worldObj, this.hellRNG, l1, i2, j2);
  1998. }
  1999.  
  2000. MinecraftForge.EVENT_BUS.post(new DecorateBiomeEvent.Post(worldObj, hellRNG, k, l));
  2001. MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Post(par1IChunkProvider, worldObj, hellRNG, par2, par3, false));
  2002.  
  2003. BlockSand.fallInstantly = false;
  2004. }
  2005.  
  2006. /**
  2007. * Two modes of operation: if passed true, save all Chunks in one go. If passed false, save up to two chunks.
  2008. * Return true if all chunks have been saved.
  2009. */
  2010. public boolean saveChunks(boolean par1, IProgressUpdate par2IProgressUpdate)
  2011. {
  2012. return true;
  2013. }
  2014.  
  2015. public void func_104112_b() {}
  2016.  
  2017. /**
  2018. * Unloads chunks that are marked to be unloaded. This is not guaranteed to unload every such chunk.
  2019. */
  2020. public boolean unloadQueuedChunks()
  2021. {
  2022. return false;
  2023. }
  2024.  
  2025. /**
  2026. * Returns if the IChunkProvider supports saving.
  2027. */
  2028. public boolean canSave()
  2029. {
  2030. return true;
  2031. }
  2032.  
  2033. /**
  2034. * Converts the instance data to a readable string.
  2035. */
  2036. public String makeString()
  2037. {
  2038. return "HellRandomLevelSource";
  2039. }
  2040.  
  2041. /**
  2042. * Returns a list of creatures of the specified type that can spawn at the given location.
  2043. */
  2044. //kaj se lahko spawna!!! pozorno
  2045. public List getPossibleCreatures(EnumCreatureType par1EnumCreatureType, int par2, int par3, int par4)
  2046. {
  2047. BiomeGenBase biomegenbase = this.worldObj.getBiomeGenForCoords(par2, par4);
  2048. return biomegenbase == null ? null : biomegenbase.getSpawnableList(par1EnumCreatureType);
  2049. }
  2050.  
  2051. /**
  2052. * Returns the location of the closest structure of the specified type. If not found returns null.
  2053. */
  2054. public ChunkPosition findClosestStructure(World par1World, String par2Str, int par3, int par4, int par5)
  2055. {
  2056. return null;
  2057. }
  2058.  
  2059. public int getLoadedChunkCount()
  2060. {
  2061. return 0;
  2062. }
  2063.  
  2064. public void recreateStructures(int par1, int par2)
  2065. {
  2066. }
  2067. }
  2068.  
  2069.  
  2070. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement