minecraft


SUBMITTED BY: Guest

DATE: March 24, 2014, 12:59 p.m.

FORMAT: Text only

SIZE: 249.5 kB

HITS: 1058

  1. var username = "Player";//<== Change username
  2. /************************************************************
  3. *I know this is not a puzzle game, but still, it's
  4. *MINECRAFT, SO UPVOTE FOR THE SAKE OF MOJANG :)
  5. *
  6. *Bennimus Studios
  7. *
  8. *Play with me! Server: < skyblock.cube-mc.com >
  9. *
  10. *HOW TO PLAY:
  11. *A to move left, D to move right, Space to jump.
  12. *Left click a block to destroy it.
  13. *Right click to place a block.
  14. *Use the numbers to pick which block you have selected.
  15. *Numbers follow according to the hotbar at the bottom of
  16. *the screen.
  17. *Press E to open your inventory. Once open, aim your cursor
  18. *over the block you want to select, then press the number
  19. *according to the slot on the hotbar you want to place it
  20. *in.
  21. *Give me your feedback :)
  22. *Report bugs in Tips & Feedback
  23. *Press F2 to save your world.
  24. *
  25. *Version 1.10
  26. * +Added Zombie Pigmen to the Nether
  27. * +Added Torches (to keep the monsters away)
  28. * +Added Sugar cane
  29. * +Added Paper
  30. * +Added Fireworks (Thx for 1000 votes!)
  31. * +TNT can now kill you
  32. * *Smelting TNT will now yield a diamond block
  33. * *Fixed swimming
  34. * *Fixed 1-block player height
  35. * *Chests are no longer presents
  36. * -Removed Herobrine
  37. *
  38. * DATA VALUES:
  39. * (those marked with * are unobtainable except through
  40. * inventory hacking)
  41. * (those marked with ** are generated in the map but
  42. * otherwise unobtainable)
  43. * 0:Air
  44. * 1:Stone
  45. * 2:Grass
  46. * 3:Dirt
  47. * 4:Cobblestone
  48. * 5:Wooden Planks
  49. * 6:Bricks
  50. * 7:Log
  51. * 8:Obsidian
  52. * 9:Leaves
  53. * 10:Bedrock*
  54. * 11:Water
  55. * 12:Flowing Water*
  56. * 13:Lava
  57. * 14:Flowing Lava*
  58. * 15:TNT
  59. * 16:Sapling
  60. * 17:Fire
  61. * 18:Nether Portal*
  62. * 19:Netherrack
  63. * 20:Sand
  64. * 21:Gravel
  65. * 22:Coal ore*
  66. * 23:Iron ore
  67. * 24:Gold ore
  68. * 25:Lapis ore*
  69. * 26:DIAMOND OREZ*
  70. * 27:Crafting table
  71. * 28:Door
  72. * 29:Upper door
  73. * 30:Ladder
  74. * 31:Cactus
  75. * 32:Ice
  76. * 33:Furnace
  77. * 34:Chest
  78. * 35:Mossy Cobblestone
  79. * 36:Monster spawner
  80. * 37:Block of Iron
  81. * 38:Block of Gold
  82. * 39:Block of Diamond
  83. * 40:Torch
  84. * 41:Sugar cane
  85. * 300:Stick
  86. * 301:Coal
  87. * 302:Iron ingot
  88. * 303:Gold ingot
  89. * 304:Lapis Lazuli
  90. * 305:DIAMONDZ
  91. * 306:Flint
  92. * 307-311:Picks
  93. * 312-316:Swords
  94. * 317:Raw Porkchop
  95. * 318:Gunpowder
  96. * 319:Cooked Porkchop
  97. * 320-335: Leather-Diamond Armor
  98. * 336:Leather
  99. * 337:Bucket
  100. * 338:Milk bucket
  101. * 339:Paper
  102. * 340:Firework
  103. ************************************************************/
  104. var blocks = 41;//Number of blocks
  105. var items = 340;//Number of items + 299
  106. var madPigmen = false;
  107. var pigmanTimer = 0;
  108. var minJump = 0;
  109. var optionsScreen = false;
  110. var regenTix = 0;
  111. var options = {
  112. clouds: true,
  113. fireAnimation: true,
  114. peaceful: false
  115. };
  116. var functions = [];
  117. var button = function(x, y, l, w, f, t, txt){
  118. if(mouseX>x&&mouseX<x+l&&mouseY>y&&mouseY<y+w&&t){
  119. if(mouseIsPressed){
  120. functions[f]=true;
  121. fill(117, 117, 117);
  122. mouseIsPressed=false;
  123. }else{
  124. functions[f]=false;
  125. fill(216, 216, 240);
  126. }
  127. }else{
  128. functions[f]=false;
  129. fill(t?200:117);
  130. }
  131. rect(x, y, l, w);
  132. textAlign(CENTER, CENTER);
  133. fill(0);
  134. text(txt, x+l/2, y+w/2);
  135. textAlign(LEFT, TOP);
  136. };
  137. //All inventory objects with values >= 300 are
  138. //considered ITEMS. Things that cannot be placed
  139. items++;blocks++;
  140. //Variable declaration
  141. var solidBlocks = [false,true,true,true,true,true,true,true,true,true,true,false,false,false,false,true,false,false,false,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,false,false];
  142. solidBlocks[undefined]=true;
  143. var damageTimer = 0;
  144. var maxStacks = [];
  145. for(var i = 0; i < items; i++){
  146. switch(i){
  147. case 11:
  148. maxStacks[i]=1;
  149. break;
  150. case 13:
  151. maxStacks[i]=1;
  152. break;
  153. case 17:
  154. maxStacks[i]=1;
  155. break;
  156. case 307:
  157. maxStacks[i]=1;
  158. break;
  159. case 308:
  160. maxStacks[i]=1;
  161. break;
  162. case 309:
  163. maxStacks[i]=1;
  164. break;
  165. case 310:
  166. maxStacks[i]=1;
  167. break;
  168. case 311:
  169. maxStacks[i]=1;
  170. break;
  171. case 312:
  172. maxStacks[i]=1;
  173. break;
  174. case 313:
  175. maxStacks[i]=1;
  176. break;
  177. case 314:
  178. maxStacks[i]=1;
  179. break;
  180. case 315:
  181. maxStacks[i]=1;
  182. break;
  183. case 316:
  184. maxStacks[i]=1;
  185. break;
  186. case 320:
  187. maxStacks[i]=1;
  188. break;
  189. case 321:
  190. maxStacks[i]=1;
  191. break;
  192. case 322:
  193. maxStacks[i]=1;
  194. break;
  195. case 323:
  196. maxStacks[i]=1;
  197. break;
  198. case 324:
  199. maxStacks[i]=1;
  200. break;
  201. case 325:
  202. maxStacks[i]=1;
  203. break;
  204. case 326:
  205. maxStacks[i]=1;
  206. break;
  207. case 327:
  208. maxStacks[i]=1;
  209. break;
  210. case 328:
  211. maxStacks[i]=1;
  212. break;
  213. case 329:
  214. maxStacks[i]=1;
  215. break;
  216. case 330:
  217. maxStacks[i]=1;
  218. break;
  219. case 331:
  220. maxStacks[i]=1;
  221. break;
  222. case 332:
  223. maxStacks[i]=1;
  224. break;
  225. case 333:
  226. maxStacks[i]=1;
  227. break;
  228. case 334:
  229. maxStacks[i]=1;
  230. break;
  231. case 335:
  232. maxStacks[i]=1;
  233. break;
  234. case 337:
  235. maxStacks[i]=16;
  236. break;
  237. case 338:
  238. maxStacks[i]=1;
  239. break;
  240. default:
  241. maxStacks[i]=64;
  242. }
  243. }
  244. var tileNames = [
  245. "",
  246. "Stone",
  247. "Grass",
  248. "Dirt",
  249. "Cobblestone",
  250. "Wooden Planks",
  251. "Bricks",
  252. "Wood",
  253. "Obsidian",
  254. "Leaves",
  255. "Bedrock",
  256. "Water bucket",
  257. "Hacked water",
  258. "Lava bucket",
  259. "Hacked lava",
  260. "TNT",
  261. "Sapling",
  262. "Flint and Steel",
  263. "Hacked Portal",
  264. "Netherrack",
  265. "Sand",
  266. "Gravel",
  267. "Coal ore",
  268. "Iron ore",
  269. "Gold ore",
  270. "Lapis lazuli ore",
  271. "Diamond ore",
  272. "Crafting table",
  273. "Wooden Door",
  274. "Hacked Door",
  275. "Ladder",
  276. "Cactus",
  277. "Ice",
  278. "Furnace",
  279. "Chest",
  280. "Moss stone",
  281. "Monster spawner",
  282. "Block of Iron",
  283. "Block of Gold",
  284. "Block of Diamond",
  285. "Torch",
  286. "Sugar cane"
  287. ];
  288. var itemNames = [
  289. "Stick",
  290. "Coal",
  291. "Iron ingot",
  292. "Gold ingot",
  293. "Lapis lazuli",
  294. "Diamond",
  295. "Flint",
  296. "Wooden pickaxe",
  297. "Stone pickaxe",
  298. "Iron pickaxe",
  299. "Golden pickaxe",
  300. "Diamond pickaxe",
  301. "Wooden sword",
  302. "Stone sword",
  303. "Iron sword",
  304. "Golden sword",
  305. "Diamond sword",
  306. "Raw porkchop",
  307. "Gunpowder",
  308. "Cooked porkchop",
  309. "Iron helmet",
  310. "Iron chestplate",
  311. "Iron leggings",
  312. "Iron boots",
  313. "Golden helmet",
  314. "Golden chestplate",
  315. "Golden leggings",
  316. "Golden boots",
  317. "Diamond helmet",
  318. "Diamond chestplate",
  319. "Diamond leggings",
  320. "Diamond boots",
  321. "Leather cap",
  322. "Leather tunic",
  323. "Leather trousers",
  324. "Leather boots",
  325. "Leather",
  326. "Bucket",
  327. "Milk bucket",
  328. "Paper",
  329. "Firework"
  330. ];
  331. if(username==="SkythekidRS"){
  332. tileNames[24]="Budder ore";
  333. tileNames[38]="Block of Budder";
  334. itemNames[3]="Budder ingot";
  335. itemNames[10]="Budder pickaxe";
  336. itemNames[15]="Budder sword";
  337. itemNames[24]="Budder helmet";
  338. itemNames[25]="Budder chestplate";
  339. itemNames[26]="Budder leggings";
  340. itemNames[27]="Budder boots";
  341. }
  342. var direction = RIGHT;
  343. var armPos = 0;
  344. var armTimer = 0;
  345. var legPos = 0;
  346. var NBTtag = null;
  347. var setTag = function(x){
  348. if(x===0||NBTtag === ""){
  349. NBTtag = null;
  350. }else{
  351. if(x>=300){
  352. NBTtag = itemNames[x-300];
  353. }else{
  354. NBTtag = tileNames[x];
  355. }
  356. }
  357. };
  358. var cloudX = 0;
  359. var itemDurabilities = [];
  360. for(var i = 0; i <= items; i++){
  361. switch(i){
  362. case 17:
  363. itemDurabilities[i] = 65;
  364. break;
  365. case 307:
  366. itemDurabilities[i] = 60;
  367. break;
  368. case 308:
  369. itemDurabilities[i] = 132;
  370. break;
  371. case 309:
  372. itemDurabilities[i] = 251;
  373. break;
  374. case 310:
  375. itemDurabilities[i] = 33;
  376. break;
  377. case 311:
  378. itemDurabilities[i] = 1562;
  379. break;
  380. case 312:
  381. itemDurabilities[i] = 60;
  382. break;
  383. case 313:
  384. itemDurabilities[i] = 132;
  385. break;
  386. case 314:
  387. itemDurabilities[i] = 251;
  388. break;
  389. case 315:
  390. itemDurabilities[i] = 33;
  391. break;
  392. case 316:
  393. itemDurabilities[i] = 1562;
  394. break;
  395. case 320:
  396. itemDurabilities[i] = 166;
  397. break;
  398. case 321:
  399. itemDurabilities[i] = 241;
  400. break;
  401. case 322:
  402. itemDurabilities[i] = 226;
  403. break;
  404. case 323:
  405. itemDurabilities[i] = 196;
  406. break;
  407. case 324:
  408. itemDurabilities[i] = 78;
  409. break;
  410. case 325:
  411. itemDurabilities[i] = 113;
  412. break;
  413. case 326:
  414. itemDurabilities[i] = 106;
  415. break;
  416. case 327:
  417. itemDurabilities[i] = 92;
  418. break;
  419. case 328:
  420. itemDurabilities[i] = 364;
  421. break;
  422. case 329:
  423. itemDurabilities[i] = 529;
  424. break;
  425. case 330:
  426. itemDurabilities[i] = 496;
  427. break;
  428. case 331:
  429. itemDurabilities[i] = 430;
  430. break;
  431. case 332:
  432. itemDurabilities[i] = 56;
  433. break;
  434. case 333:
  435. itemDurabilities[i] = 81;
  436. break;
  437. case 334:
  438. itemDurabilities[i] = 76;
  439. break;
  440. case 335:
  441. itemDurabilities[i] = 66;
  442. break;
  443. default:
  444. itemDurabilities[i] = null;
  445. }
  446. }
  447. var onTitleScreen = false;
  448. var curBiome = 0;
  449. var biomes = [];
  450. for(var i = 0; i < 20; i++){
  451. biomes[i] = curBiome;
  452. }
  453. var splashes = [
  454. "This message will never appear on the splash screen, isn't that weird?",
  455. "As seen on TV!",
  456. "Awesome!",
  457. "100% pure!",
  458. "May contain nuts!",
  459. "Better than Prey!",
  460. "More polygons!",
  461. "Sexy!",
  462. "Limited edition!",
  463. "Flashing letters!",
  464. "Made by Bennimus!",
  465. "It's here!",
  466. "Best in class!",
  467. "It's kinda finished!",
  468. "Absolutely dragon free!",
  469. "Excitement!",
  470. "More than 500 sold!",
  471. "One of a kind!",
  472. "Heaps of hits on YouTube!",
  473. "Indev!",
  474. "Spiders everywhere!",
  475. "Check it out!",
  476. "Holy cow, man!",
  477. "It's a game!",
  478. "Made in Sweden!",
  479. "Uses LWJGL!",
  480. "Reticulating splines!",
  481. "Minecraft!",
  482. "Yaaay!",
  483. "Singleplayer!",
  484. "Keyboard compatible!",
  485. "Undocumented!",
  486. "Ingots!",
  487. "Exploding creepers!",
  488. "That's no moon!",
  489. "l33t!",
  490. "Create!",
  491. "Survive!",
  492. "Dungeon!",
  493. "Exclusive!",
  494. "The bee's knees!",
  495. "Down with O.P.P.!",
  496. "Closed source!",
  497. "Classy!",
  498. "Wow!",
  499. "Not on steam!",
  500. "Oh man!",
  501. "Awesome community!",
  502. "Pixels!",
  503. "Teetsuuuuoooo!",
  504. "Kaaneeeedaaaa!",
  505. "Now with difficulty!",
  506. "Enhanced!",
  507. "90% bug free!",
  508. "Pretty!",
  509. "12 herbs and spices!",
  510. "Fat free!",
  511. "Absolutely no memes!",
  512. "Free dental!",
  513. "Ask your doctor!",
  514. "Minors welcome!",
  515. "Cloud computing!",
  516. "Legal in Finland!",
  517. "Hard to label!",
  518. "Technically good!",
  519. "Bringing home the bacon!",
  520. "Indie!",
  521. "GOTY!",
  522. "Ceci n'est pas une title screen!",
  523. "Euclidian!",
  524. "Now in 2D!",
  525. "Inspirational!",
  526. "Herregud!",
  527. "Complex cellular automata!",
  528. "Yes, sir!",
  529. "Played by cowboys!",
  530. "OpenGL 1.2!",
  531. "Thousands of colors!",
  532. "Try it!",
  533. "Age of Wonders is better!",
  534. "Try the mushroom stew!",
  535. "Sensational!",
  536. "Hot tamale, hot hot tamale!",
  537. "Play him off, keyboard cat!",
  538. "Guaranteed!",
  539. "Macroscopic!",
  540. "Bring it on!",
  541. "Random splash!",
  542. "Call your mother!",
  543. "Monster infighting!",
  544. "Loved by millions!",
  545. "Ultimate edition!",
  546. "Freaky!",
  547. "You've got a brand new key!",
  548. "Water proof!",
  549. "Uninflammable!",
  550. "Whoa, dude!",
  551. "All inclusive!",
  552. "Tell your friends!",
  553. "NP is not in P!",
  554. "Notch <3 ez!",
  555. "Music by C418!",
  556. "Livestreamed!",
  557. "Haunted!",
  558. "Polynomial!",
  559. "Terrestrial!",
  560. "All is full of love!",
  561. "Full of stars!",
  562. "Scientific!",
  563. "Cooler than Spock!",
  564. "Collaborate and listen!",
  565. "Never dig down!",
  566. "Take frequent breaks!",
  567. "Not linear!",
  568. "Han shot first!",
  569. "Nice to meet you!",
  570. "Buckets of lava!",
  571. "Ride the pig!",
  572. "Larger than Earth!",
  573. "sqrt(-1) love you!",
  574. "Phobos anomaly!",
  575. "Punching wood!",
  576. "Falling off cliffs!",
  577. "0% sugar!",
  578. "150% hyperbole!",
  579. "Synecdoche!",
  580. "Let's danec!",
  581. "Seecret Friday update!",
  582. "Reference implementation!",
  583. "Lewd with two dudes with food!",
  584. "Kiss the sky!",
  585. "20 GOTO 10!",
  586. "Verlet intregration!",
  587. "Peter Griffin!",
  588. "Do not distribute!",
  589. "Cogito ergo sum!",
  590. "4815162342 lines of code!",
  591. "A skeleton popped out!",
  592. "The Work of Bennimus!",
  593. "The sum of its parts!",
  594. "BTAF used to be good!",
  595. "I miss ADOM!",
  596. "umop-apisdn!",
  597. "OICU812!",
  598. "Bring me Ray Cokes!",
  599. "Finger-licking!",
  600. "Thematic!",
  601. "Pneumatic!",
  602. "Sublime!",
  603. "Octagonal!",
  604. "Une baguette!",
  605. "Gargamel plays it!",
  606. "Rita is the new top dog!",
  607. "SWM forever!",
  608. "Representing Edsbyn!",
  609. "Matt Damon!",
  610. "Supercalifragilisticexpialidocious!",
  611. "Consummate V's!",
  612. "Cow Tools!",
  613. "Double buffered!",
  614. "Fan fiction!",
  615. "Flaxkikare!",
  616. "Jason! Jason! Jason!",
  617. "Hotter than the sun!",
  618. "Soon to be Internet enabled!",
  619. "Autonomous!",
  620. "Engage!",
  621. "Fantasy!",
  622. "DRR! DRR! DRR!",
  623. "Kick it root down!",
  624. "Regional resources!",
  625. "Woo, facepunch!",
  626. "Woo, somethingawful!",
  627. "Woo, /v/!",
  628. "Woo, tigsource!",
  629. "Woo, minecraftforum!",
  630. "Woo, worldofminecraft!",
  631. "Woo, reddit!",
  632. "Woo, 2pp!",
  633. "Woo, Khan Academy!",
  634. "Google anlyticsed!",
  635. "Now supports åäö!",
  636. "Give us Gordon!",
  637. "Tip your waiter!",
  638. "Very fun!",
  639. "12345 is a bad password!",
  640. "Vote for net neutrality!",
  641. "Lives in a pineapple under the sea!",
  642. "MAP11 has two names!",
  643. "Omnipotent!",
  644. "Gasp!",
  645. "...!",
  646. "Bees, bees, bees, bees!",
  647. "Jag känner en bot!",
  648. "Haha, LOL!",
  649. "Hampsterdance!",
  650. "Switches and ores!",
  651. "Menger sponge!",
  652. "idspispopd!",
  653. "Eple (original edit)!",
  654. "So fresh, so clean!",
  655. "Slow acting portals!",
  656. "Try the Nether!",
  657. "Don't look directly at the bugs!",
  658. "Oh, ok, Pigmen!",
  659. "Finally with ladders!",
  660. "Scary!",
  661. "Play Minecraft, Watch Topgear, Get Pig!",
  662. "Twittered about!",
  663. "Jump up, jump up, and get down!",
  664. "Joel is neat!",
  665. "A riddle, wrapped in a mystery!",
  666. "Huge tracts of land!",
  667. "Welcome to your Doom!",
  668. "Stay a while, stay forever!",
  669. "Stay a while and listen!",
  670. "Treatment for your rash!",
  671. "'Autological' is!",
  672. "Information wants to be free!",
  673. "'Almost never' is an interesting concept!",
  674. "Lots of truthiness!",
  675. "The creeper is a spy!",
  676. "Turing complete!",
  677. "It's groundbreaking!",
  678. "Let our battle's begin!",
  679. "The sky is the limit!",
  680. "Jeb has amazing hair!",
  681. "Casual gaming!",
  682. "Undefeated!",
  683. "Kinda like Lemmings!",
  684. "Follow the train, CJ!",
  685. "Leveraging synergy!",
  686. "DungeonQuest is unfair!",
  687. "110813!",
  688. "90210!",
  689. "Check out the far lands!",
  690. "Tyrion would love it!",
  691. "Also try VVVVVV!",
  692. "Also try Super Meat Boy!",
  693. "Also try Terraria!",
  694. "Also try Mount And Blade!",
  695. "Also try Project Zomboid!",
  696. "Also try World of Goo!",
  697. "Also try Limbo!",
  698. "Also try Pixeljunk Shooter!",
  699. "Also try Braid!",
  700. "That's super!",
  701. "Bread is pain!",
  702. "Read more books!",
  703. "Khaaaaaaaaan!",
  704. "Less addictive than TV Tropes!",
  705. "More addictive than lemonade!",
  706. "Bigger than a bread box!",
  707. "Millions of peaches!",
  708. "Fnord!",
  709. "This is my true form!",
  710. "Totally forgot about Dre!",
  711. "Don't bother with the clones!",
  712. "Pumpkinhead!",
  713. "Hobo humping slobo babe!",
  714. "Made by Jeb!",
  715. "Has an ending!",
  716. "Finally complete!",
  717. "Feature packed!",
  718. "Boots with the fur!",
  719. "Stop, hammertime!",
  720. "Testificates!",
  721. "Conventional!",
  722. "Homeomorphic to a 3-sphere!",
  723. "Doesn't avoid double negatives!",
  724. "Place ALL the blocks!",
  725. "Does barrel rolls!",
  726. "Meeting expectations!",
  727. "PC gaming since 1873!",
  728. "Ghoughpteighbteau tchoghs!",
  729. "Déjà vu!",
  730. "Got your nose!",
  731. "Haley loves Elan!",
  732. "Afraid of the big, black bat!",
  733. "Doesn't use the U-word!",
  734. "Child's play!",
  735. "See you next Friday or so!",
  736. "From the streets of Södermalm!",
  737. "150 bpm for 400000 minutes!",
  738. "Technologic!",
  739. "Funk soul brother!",
  740. "Pumpa kungen!",
  741. "日本ハロー!",
  742. "한국 안녕하세요!",
  743. "Helo Cymru!",
  744. "Cześć Polsko!",
  745. "你好中国!",
  746. "Привет Россия!",
  747. "Γεια σου Ελλάδα!",
  748. "My life for Aiur!",
  749. "Lennart lennart = new Lennart();",
  750. "I see your vocabulary has improved!",
  751. "Who put it there?",
  752. "You can't explain that!",
  753. "if not ok then return end",
  754. "Colormatic!",
  755. "FUNKY LOL",
  756. "SOPA means LOSER in Swedish!",
  757. "Big Pointy Teeth!",
  758. "Bekarton guards the gate!",
  759. "Mmmph, mmph!",
  760. "Don't feed avocados to parrots!",
  761. "Swords for everyone!",
  762. "Plz reply to my tweet!",
  763. ".party()!",
  764. "Take her pillow!",
  765. "Put that cookie down!",
  766. "Pretty scary!",
  767. "I have a suggestion.",
  768. "Now with extra hugs!",
  769. "Now javascript!",
  770. "Woah.",
  771. "HURNERJSGER?",
  772. "What's up, Doc?",
  773. "Now contains 32 random daily cats!"];
  774. var curSplash = round(random(1, splashes.length));
  775. var furnaceRecipes = [];
  776. var burnValues = [];
  777. for(var i = 0; i < items; i++){
  778. switch(i){
  779. case 4:
  780. furnaceRecipes[i]=1;
  781. break;
  782. case 5:
  783. burnValues[i]=1.5;
  784. break;
  785. case 7:
  786. furnaceRecipes[i]=301;
  787. break;
  788. case 13:
  789. burnValues[i]=2000;
  790. break;
  791. case 15:
  792. furnaceRecipes[i]=39;
  793. break;
  794. case 16:
  795. burnValues[i]=0.5;
  796. break;
  797. case 23:
  798. furnaceRecipes[i]=302;
  799. break;
  800. case 24:
  801. furnaceRecipes[i]=303;
  802. break;
  803. case 27:
  804. burnValues[i]=1;
  805. break;
  806. case 300:
  807. burnValues[i]=0.5;
  808. break;
  809. case 301:
  810. burnValues[i]=8;
  811. break;
  812. case 307:
  813. burnValues[i]=1;
  814. break;
  815. case 312:
  816. burnValues[i]=1;
  817. break;
  818. case 317:
  819. furnaceRecipes[i]=319;
  820. break;
  821. default:
  822. burnValues[i]=null;
  823. furnaceRecipes[i]=null;
  824. }
  825. }
  826. var onInputBox = false;
  827. var input = "";
  828. var inputTimer = 25;
  829. var messages = [];
  830. var msgTimers = [];
  831. var broadcast = function(msg){
  832. append(messages, msg);
  833. append(msgTimers, 150);
  834. };
  835. var bennimusStudios = true;
  836. var craftingGrid = [0,0,0,0,0,0,0,0,0];
  837. var recipes = [];
  838. var recipeAmounts = [];
  839. for(var i = 0; i < items; i++){
  840. recipes[i] = [];
  841. recipes[i][0] = [];
  842. switch(i){
  843. case 5:
  844. for(var j = 0; j < 9; j++){
  845. recipes[i][j] = [];
  846. for(var k = 0; k < 9; k++){
  847. if(k===j){
  848. recipes[i][j][k] = 7;
  849. }else{
  850. recipes[i][j][k] = 0;
  851. }
  852. }
  853. }
  854. recipeAmounts[5] = 4;
  855. break;
  856. case 15:
  857. recipes[i][0] =[318,20,318,20,318,20,318,20,318];
  858. break;
  859. case 17:
  860. for(var j = 0; j < 4; j++){
  861. recipes[i][j] = [];
  862. for(var k = 0; k < 9; k++){
  863. if(recipes[i][j][k]===0||recipes[i][j][k]===undefined){
  864. if(k===j){
  865. recipes[i][j][k] = 302;
  866. recipes[i][j][k+4] = 306;
  867. }else{
  868. recipes[i][j][k] = 0;
  869. }
  870. }
  871. }
  872. }
  873. recipeAmounts[17]=1;
  874. break;
  875. case 27:
  876. for(var j = 0; j < 4; j++){
  877. recipes[i][j] = [];
  878. for(var k = 0; k < 9; k++){
  879. if(recipes[i][j][k]===0||recipes[i][j][k]===undefined){
  880. if(k===j){
  881. recipes[i][j][k] = 5;
  882. recipes[i][j][k+1] = 5;
  883. recipes[i][j][k+3] = 5;
  884. recipes[i][j][k+4] = 5;
  885. }else{
  886. recipes[i][j][k]=0;
  887. }
  888. }
  889. }
  890. }
  891. recipeAmounts[27] = 1;
  892. break;
  893. case 28:
  894. for(var j = 0; j < 2; j++){
  895. recipes[i][j] = [];
  896. for(var k = 0; k < 9; k++){
  897. if(recipes[i][j][k]===0||recipes[i][j][k]===undefined){
  898. if(k===j){
  899. recipes[i][j][k] = 5;
  900. recipes[i][j][k+1] = 5;
  901. recipes[i][j][k+3] = 5;
  902. recipes[i][j][k+4] = 5;
  903. recipes[i][j][k+6] = 5;
  904. recipes[i][j][k+7] = 5;
  905. }else{
  906. recipes[i][j][k] = 0;
  907. }
  908. }
  909. }
  910. }recipeAmounts[28]=1;
  911. break;
  912. case 30:
  913. recipes[i][0] = [300, 0, 300, 300, 300, 300, 300, 0, 300];
  914. recipeAmounts[30]=3;
  915. break;
  916. case 33:
  917. recipes[i][0] = [4,4,4,4,0,4,4,4,4];
  918. break;
  919. case 34:
  920. recipes[i][0] = [5,5,5,5,0,5,5,5,5];
  921. break;
  922. case 37:
  923. recipes[i][0] = [302,302,302,302,302,302,302,302,302];
  924. break;
  925. case 38:
  926. recipes[i][0] = [303,303,303,303,303,303,303,303,303];
  927. break;
  928. case 39:
  929. recipes[i][0] = [305,305,305,305,305,305,305,305,305];
  930. break;
  931. case 40:
  932. for(var j = 0; j < 6; j++){
  933. recipes[i][j] = [];
  934. for(var k = 0; k < 9; k++){
  935. if(recipes[i][j][k]===0||recipes[i][j][k]===undefined){
  936. if(k===j){
  937. recipes[i][j][k] = 301;
  938. recipes[i][j][k+3] = 300;
  939. }else{
  940. recipes[i][j][k] = 0;
  941. }
  942. }
  943. }
  944. }
  945. recipeAmounts[40] = 4;
  946. break;
  947. case 300:
  948. for(var j = 0; j < 6; j++){
  949. recipes[i][j] = [];
  950. for(var k = 0; k < 9; k++){
  951. if(recipes[i][j][k]===0||recipes[i][j][k]===undefined){
  952. if(k===j){
  953. recipes[i][j][k] = 5;
  954. recipes[i][j][k+3] = 5;
  955. }else{
  956. recipes[i][j][k] = 0;
  957. }
  958. }
  959. }
  960. }
  961. recipeAmounts[300] = 4;
  962. break;
  963. case 302:
  964. for(var j = 0; j < 9; j++){
  965. recipes[i][j] = [];
  966. for(var k = 0; k < 9; k++){
  967. if(k===j){
  968. recipes[i][j][k] = 37;
  969. }else{
  970. recipes[i][j][k] = 0;
  971. }
  972. }
  973. }recipeAmounts[i]=9;
  974. break;
  975. case 303:
  976. for(var j = 0; j < 9; j++){
  977. recipes[i][j] = [];
  978. for(var k = 0; k < 9; k++){
  979. if(k===j){
  980. recipes[i][j][k] = 38;
  981. }else{
  982. recipes[i][j][k] = 0;
  983. }
  984. }
  985. }recipeAmounts[i]=9;
  986. break;
  987. case 305:
  988. for(var j = 0; j < 9; j++){
  989. recipes[i][j] = [];
  990. for(var k = 0; k < 9; k++){
  991. if(k===j){
  992. recipes[i][j][k] = 39;
  993. }else{
  994. recipes[i][j][k] = 0;
  995. }
  996. }
  997. }
  998. recipeAmounts[i]=9;
  999. break;
  1000. case 307:
  1001. recipes[i][0] = [5, 5, 5, 0, 300, 0, 0, 300, 0];
  1002. recipeAmounts[307] = 1;
  1003. break;
  1004. case 308:
  1005. recipes[i][0] = [4, 4, 4, 0, 300, 0, 0, 300, 0];
  1006. recipeAmounts[308] = 1;
  1007. break;
  1008. case 309:
  1009. recipes[i][0] = [302,302,302,0,300,0,0,300,0];
  1010. recipeAmounts[309] = 1;
  1011. break;
  1012. case 310:
  1013. recipes[i][0] = [303,303,303,0,300,0,0,300,0];
  1014. recipeAmounts[310] = 1;
  1015. break;
  1016. case 311:
  1017. recipes[i][0] = [305,305,305,0,300,0,0,300,0];
  1018. recipeAmounts[311] = 1;
  1019. break;
  1020. case 312:
  1021. recipes[i][0] = [5,0,0,5,0,0,300,0,0];
  1022. recipes[i][1] = [0,5,0,0,5,0,0,300,0];
  1023. recipes[i][2] = [0,0,5,0,0,5,0,0,300];
  1024. recipeAmounts[312] = 1;
  1025. break;
  1026. case 313:
  1027. recipes[i][0] = [4,0,0,4,0,0,300,0,0];
  1028. recipes[i][1] = [0,4,0,0,4,0,0,300,0];
  1029. recipes[i][2] = [0,0,4,0,0,4,0,0,300];
  1030. recipeAmounts[313] = 1;
  1031. break;
  1032. case 314:
  1033. recipes[i][0] = [302,0,0,302,0,0,300,0,0];
  1034. recipes[i][1] = [0,302,0,0,302,0,0,300,0];
  1035. recipes[i][2] = [0,0,302,0,0,302,0,0,300];
  1036. recipeAmounts[314] = 1;
  1037. break;
  1038. case 315:
  1039. recipes[i][0] = [303,0,0,303,0,0,300,0,0];
  1040. recipes[i][1] = [0,303,0,0,303,0,0,300,0];
  1041. recipes[i][2] = [0,0,303,0,0,303,0,0,300];
  1042. recipeAmounts[315] = 1;
  1043. break;
  1044. case 316:
  1045. recipes[i][0] = [305,0,0,305,0,0,300,0,0];
  1046. recipes[i][1] = [0,305,0,0,305,0,0,300,0];
  1047. recipes[i][2] = [0,0,305,0,0,305,0,0,300];
  1048. recipeAmounts[316] = 1;
  1049. break;
  1050. case 320:
  1051. recipes[i][0] = [302,302,302,302,0,302,0,0,0];
  1052. recipes[i][1] = [0,0,0,302,302,302,302,0,302];
  1053. break;
  1054. case 321:
  1055. recipes[i][0] = [302,0,302,302,302,302,302,302,302];
  1056. break;
  1057. case 322:
  1058. recipes[i][0] = [302,302,302,302,0,302,302,0,302];
  1059. break;
  1060. case 323:
  1061. recipes[i][0] = [302,0,302,302,0,302,0,0,0];
  1062. recipes[i][1] = [0,0,0,302,0,302,302,0,302];
  1063. break;
  1064. case 324:
  1065. recipes[i][0] = [303,303,303,303,0,303,0,0,0];
  1066. recipes[i][1] = [0,0,0,303,303,303,303,0,303];
  1067. break;
  1068. case 325:
  1069. recipes[i][0] = [303,0,303,303,303,303,303,303,303];
  1070. break;
  1071. case 326:
  1072. recipes[i][0] = [303,303,303,303,0,303,303,0,303];
  1073. break;
  1074. case 327:
  1075. recipes[i][0] = [303,0,303,303,0,303,0,0,0];
  1076. recipes[i][1] = [0,0,0,303,0,303,303,0,303];
  1077. break;
  1078. case 328:
  1079. recipes[i][0] = [305,305,305,305,0,305,0,0,0];
  1080. recipes[i][1] = [0,0,0,305,305,305,305,0,305];
  1081. break;
  1082. case 329:
  1083. recipes[i][0] = [305,0,305,305,305,305,305,305,305];
  1084. break;
  1085. case 330:
  1086. recipes[i][0] = [305,305,305,305,0,305,305,0,305];
  1087. break;
  1088. case 331:
  1089. recipes[i][0] = [305,0,305,305,0,305,0,0,0];
  1090. recipes[i][1] = [0,0,0,305,0,305,305,0,305];
  1091. break;
  1092. case 332:
  1093. recipes[i][0] = [336,336,336,336,0,336,0,0,0];
  1094. recipes[i][1] = [0,0,0,336,336,336,336,0,336];
  1095. break;
  1096. case 333:
  1097. recipes[i][0] = [336,0,336,336,336,336,336,336,336];
  1098. break;
  1099. case 334:
  1100. recipes[i][0] = [336,336,336,336,0,336,336,0,336];
  1101. break;
  1102. case 335:
  1103. recipes[i][0] = [336,0,336,336,0,336,0,0,0];
  1104. recipes[i][1] = [0,0,0,336,0,336,336,0,336];
  1105. break;
  1106. case 337:
  1107. recipes[i][0]=[302,0,302,0,302,0,0,0,0];
  1108. recipes[i][1]=[0,0,0,302,0,302,0,302,0];
  1109. break;
  1110. case 339:
  1111. recipes[i][0]=[41,41,41,0,0,0,0,0,0];
  1112. recipes[i][1]=[0,0,0,41,41,41,0,0,0];
  1113. recipes[i][2]=[0,0,0,0,0,0,41,41,41];
  1114. recipeAmounts[339]=3;
  1115. break;
  1116. case 340:
  1117. for(var j = 0; j < 6; j++){
  1118. recipes[i][j] = [];
  1119. for(var k = 0; k < 9; k++){
  1120. if(recipes[i][j][k]===0||recipes[i][j][k]===undefined){
  1121. if(k===j){
  1122. recipes[i][j][k] = 339;
  1123. recipes[i][j][k+3] = 318;
  1124. }else{
  1125. recipes[i][j][k] = 0;
  1126. }
  1127. }
  1128. }
  1129. }
  1130. break;
  1131. }
  1132. if(recipeAmounts[i] === undefined){
  1133. recipeAmounts[i] = 1;
  1134. }
  1135. }
  1136. var holdingBlock = 0;
  1137. var holdingStacks = 0;
  1138. var holdingSpecs = 0;
  1139. var logoTix = 0;
  1140. var time = 0;
  1141. var night = 0;
  1142. var posX = -40;
  1143. var posY = -340;
  1144. var posA = 10;
  1145. var posB = 10;
  1146. var posB2;
  1147. var posA2;
  1148. // V V CHANGE YOUR SKIN V V
  1149. var skin = getImage("cute/CharacterBoy");
  1150. var blocksFallen = 0;
  1151. var fallTix = 0;
  1152. var scrollX = posX;
  1153. var scrollY = posY;
  1154. var playerSpeed = 8;
  1155. var isSitting = true;
  1156. var fireTix = 0;
  1157. var onFire = false;
  1158. var inLava = false;
  1159. var inWater = false;
  1160. var isDrowning = false;
  1161. var armorSlots = [0, 0, 0, 0];
  1162. var armorSpecs = [0, 0, 0, 0];
  1163. var keyTimer = 50;
  1164. var isSprinting = false;
  1165. var health = 20;
  1166. var heart = getImage("cute/Heart");
  1167. var heartsShowing = false;
  1168. var shake = 2;
  1169. var shaken = false;
  1170. var armor = 0;
  1171. var oldHealth = health;
  1172. var drownCount = 0;
  1173. var oxygen = 10;
  1174. var shield = getImage("cute/RampSouth");
  1175. var shieldsShowing = false;
  1176. var isDead = false;
  1177. var jumpHeight = 0;
  1178. var blockSelected = 0;
  1179. var craftedItem = 0;
  1180. var craftedStacks = 4;
  1181. var entity = {
  1182. x: [],
  1183. y: [],
  1184. type: [],
  1185. type2: [],
  1186. length: 0
  1187. };
  1188. var hide = false;
  1189. var e2open = true;
  1190. var nether = false;
  1191. var debugMenu = false;
  1192. var inventory = false;
  1193. var mobs = {
  1194. type: [],
  1195. x: [],
  1196. y: [],
  1197. health: [],
  1198. inWater: [],
  1199. inLava: [],
  1200. onFire: [],
  1201. fireTix: [],
  1202. legPos: [],
  1203. headPos: [],
  1204. length: 0,
  1205. state: [],
  1206. direction: [],
  1207. nether: []
  1208. };
  1209. var version = "1.10";
  1210. var NEWS = "Replacing the outdated 1.8 Pre-release comes the biggest graphical change to this program since I put blocks into it. Also some more little surprises! Everything you've all wanted, check the spin-offs!";
  1211. var news = false;
  1212. var MainArticle = "1.11 Pre-release!";
  1213. var newWorld = [
  1214. [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
  1215. [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
  1216. [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
  1217. [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
  1218. [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
  1219. [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
  1220. [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
  1221. [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
  1222. [0,0,0,9,9,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
  1223. [0,0,9,9,9,9,9,0,0,0,0,0,0,0,0,0,0,0,0,0],
  1224. [0,0,9,9,7,9,9,0,0,0,0,0,0,0,0,0,0,0,0,0],
  1225. [0,0,9,9,7,9,9,0,0,41,0,0,0,0,0,0,0,0,0,0],
  1226. [0,0,0,0,7,0,0,0,0,41,0,0,0,0,0,0,0,0,0,0],
  1227. [0,0,0,0,7,0,0,0,0,41,0,0,0,0,0,0,0,0,0,0],
  1228. [2,2,2,2,3,2,2,2,2,2,11,11,11,11,11,11,2,2,2,2],
  1229. [3,3,3,3,3,3,3,3,3,3,3,3,11,11,11,3,3,3,3,3],
  1230. [3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3],
  1231. [3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3],
  1232. [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],
  1233. [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],
  1234. [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],
  1235. [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],
  1236. [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],
  1237. [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],
  1238. [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],
  1239. [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],
  1240. [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],
  1241. [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],
  1242. [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],
  1243. [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],
  1244. [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],
  1245. [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],
  1246. [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],
  1247. [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],
  1248. [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],
  1249. [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],
  1250. [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],
  1251. [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],
  1252. [10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10],
  1253. [10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10]];
  1254. var specs = [
  1255. [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
  1256. [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
  1257. [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
  1258. [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
  1259. [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
  1260. [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
  1261. [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
  1262. [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
  1263. [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
  1264. [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
  1265. [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
  1266. [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
  1267. [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
  1268. [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
  1269. [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
  1270. [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
  1271. [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
  1272. [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
  1273. [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
  1274. [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
  1275. [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
  1276. [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
  1277. [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
  1278. [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
  1279. [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
  1280. [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
  1281. [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
  1282. [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
  1283. [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
  1284. [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
  1285. [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
  1286. [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
  1287. [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
  1288. [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
  1289. [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
  1290. [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
  1291. [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
  1292. [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
  1293. [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
  1294. [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]];
  1295. specs[13][9]=[];
  1296. specs[13][10]=[];
  1297. specs[13][13]=[];
  1298. specs[13][14]=[];
  1299. for(var i = 0; i < 3; i++){
  1300. specs[13][9][i]=[
  1301. [0,0,0,0],
  1302. [0,0,0,0],
  1303. [0,0,0,0],
  1304. [0,0,0,0],
  1305. [0,0,0,0],
  1306. [0,0,0,0]];
  1307. specs[13][10][i]=[
  1308. [0,0,0,0],
  1309. [0,0,0,0],
  1310. [0,0,0,0],
  1311. [0,0,0,0],
  1312. [0,0,0,0],
  1313. [0,0,0,0]];
  1314. specs[13][13][i]=[
  1315. [0,0,0,0],
  1316. [0,0,0,0],
  1317. [0,0,0,0],
  1318. [0,0,0,0],
  1319. [0,0,0,0],
  1320. [0,0,0,0]];
  1321. specs[13][14][i]=[
  1322. [0,0,0,0],
  1323. [0,0,0,0],
  1324. [0,0,0,0],
  1325. [0,0,0,0],
  1326. [0,0,0,0],
  1327. [0,0,0,0]];
  1328. }
  1329. for(var x = 9; x <= 14; x++){
  1330. if(x<11||x>12){
  1331. for(var i = 0; i < 6; i++){
  1332. for(var j = 0; j < 4; j++){
  1333. var c = random(0, 100);
  1334. if(c<50){
  1335. specs[13][x][0][i][j]=301;
  1336. }else if(c<75){
  1337. specs[13][x][0][i][j]=302;
  1338. }else if(c<85){
  1339. specs[13][x][0][i][j]=303;
  1340. }else if(c<95){
  1341. specs[13][x][0][i][j]=305;
  1342. }else{
  1343. specs[13][x][0][i][j]=319;
  1344. }
  1345. specs[13][x][1][i][j]=round(random(1,64));
  1346. }
  1347. }
  1348. }
  1349. }
  1350. var netherWorld = [
  1351. [],
  1352. [],
  1353. [],
  1354. [],
  1355. [],
  1356. [],
  1357. [],
  1358. [],
  1359. [],
  1360. [],
  1361. [],
  1362. [],
  1363. [],
  1364. [],
  1365. [],
  1366. [],
  1367. [],
  1368. [],
  1369. [],
  1370. [],
  1371. [],
  1372. [],
  1373. [],
  1374. [],
  1375. [],
  1376. [],
  1377. [],
  1378. [],
  1379. [],
  1380. [],
  1381. [],
  1382. [],
  1383. [],
  1384. [],
  1385. [],
  1386. [],
  1387. [],
  1388. [],
  1389. [],
  1390. []];
  1391. var invContents = [
  1392. [0, 0, 0, 0],
  1393. [0, 0, 0, 0],
  1394. [0, 0, 0, 0],
  1395. [0, 0, 0, 0],
  1396. [0, 0, 0, 0],
  1397. [0, 0, 0, 0]];
  1398. var invStacks = [
  1399. [0, 0, 0, 0],
  1400. [0, 0, 0, 0],
  1401. [0, 0, 0, 0],
  1402. [0, 0, 0, 0],
  1403. [0, 0, 0, 0],
  1404. [0, 0, 0, 0]];
  1405. var invSpecs = [
  1406. [0, 0, 0, 0],
  1407. [0, 0, 0, 0],
  1408. [0, 0, 0, 0],
  1409. [0, 0, 0, 0],
  1410. [0, 0, 0, 0],
  1411. [0, 0, 0, 0]];
  1412. var hotbar = [0, 0, 0, 0, 0, 0, 0, 0, 0];
  1413. var hotbarStacks = [0, 0, 0, 0, 0, 0, 0, 0, 0];
  1414. var hotbarSpecs = [0, 0, 0, 0, 0, 0, 0, 0, 0];
  1415. var overWorld = newWorld;
  1416. var blockTargeted = [0, 0];
  1417. var blockDurability = [];
  1418. var specDurabilities = [];
  1419. blockDurability[0]=0;
  1420. blockDurability[1]=65;
  1421. blockDurability[2]=10;
  1422. blockDurability[3]=10;
  1423. blockDurability[4]=70;
  1424. blockDurability[5]=35;
  1425. blockDurability[6]=50;
  1426. blockDurability[7]=30;
  1427. blockDurability[8]=2000;
  1428. blockDurability[9]=5;
  1429. blockDurability[15]=0;
  1430. blockDurability[16]=0;
  1431. blockDurability[17]=0;
  1432. blockDurability[19]=15;
  1433. blockDurability[20]=10;
  1434. blockDurability[21]=10;
  1435. blockDurability[22]=80;
  1436. blockDurability[23]=85;
  1437. blockDurability[24]=80;
  1438. blockDurability[25]=90;
  1439. blockDurability[26]=100;
  1440. blockDurability[27]=40;
  1441. blockDurability[28]=30;
  1442. blockDurability[29]=30;
  1443. blockDurability[30]=15;
  1444. blockDurability[31]=5;
  1445. blockDurability[32]=30;
  1446. blockDurability[33]=90;
  1447. blockDurability[34]=40;
  1448. blockDurability[35]=70;
  1449. blockDurability[36]=100;
  1450. blockDurability[37]=90;
  1451. blockDurability[38]=95;
  1452. blockDurability[39]=115;
  1453. blockDurability[40]=0;
  1454. blockDurability[41]=0;
  1455. var blockStrength = null;
  1456. var selDurability = null;
  1457. var isCrafting = false;
  1458. var isSmelting = false;
  1459. var onChest = false;
  1460. noCursor();
  1461. var c = 0;
  1462. var place = 0;
  1463. var jump = 0;
  1464. var fall = 10;
  1465. var a = 0;
  1466. var b = 0;
  1467. var g;
  1468. var h;
  1469. var pickedUp = false;
  1470. //pick up items
  1471. var
  1472. world = newWorld;
  1473. var flameX = [];
  1474. var flameY = [];
  1475. var flameSpeed = [];
  1476. for(var i = 0; i < 80; i++){
  1477. flameX[i] = random(3,17);
  1478. flameY[i] = random(5,15);
  1479. flameSpeed[i] = random(1,2);
  1480. }
  1481. var s;
  1482. var drawFlame = function(x, y, size){
  1483. noStroke();
  1484. for(var i = 0; i < 80; i++){
  1485. s = dist(flameX[i], flameY[i], 10, 15);
  1486. fill(255, 255-s*10, 0);
  1487. ellipse(x+flameX[i]*size, y+flameY[i]*size, 1.5*size, 2.5*size);
  1488. }
  1489. };
  1490. var getItem = function(itemID, amount){
  1491. for(var g = 0; g < amount; g++){
  1492. for(var h = 0; h < 9; h++){
  1493. if((hotbarStacks[h]===0||hotbar[h]===itemID)&&!pickedUp&&hotbarStacks[h]<maxStacks[itemID]){
  1494. hotbar[h]=itemID;
  1495. if(hotbar[h]!==0){
  1496. hotbarSpecs[h] = itemDurabilities[itemID];
  1497. hotbarStacks[h]++;
  1498. }
  1499. pickedUp=true;
  1500. }
  1501. }
  1502. for(var i = 0; i < 4; i++){
  1503. for(var j = 0; j < 6; j++){
  1504. if((invStacks[j][i]===0||invContents[j][i]===itemID)&&!pickedUp&&invStacks[j][i]<maxStacks[itemID]){
  1505. invContents[j][i]=itemID;
  1506. invSpecs[j][i]=itemDurabilities[itemID];
  1507. if(invContents[j][i]!==0){
  1508. invStacks[j][i]++;
  1509. }
  1510. pickedUp = true;
  1511. }
  1512. }
  1513. }
  1514. pickedUp=false;
  1515. }
  1516. };
  1517. //spawn mobs
  1518. var spawnMobs = function(x, y, type){
  1519. var canSpawn = true;
  1520. for(var i = 0; i < world.length; i++){
  1521. for(var j = 0; j < world[0].length; j++){
  1522. if(world[i][j]===40&&dist(j*40,i*40,x,y)<250){
  1523. canSpawn = false;
  1524. }
  1525. }
  1526. }
  1527. if(dist(x,y,posA*40,posB*40)<150){
  1528. canSpawn=false;
  1529. }
  1530. if(canSpawn){
  1531. append(mobs.type, type);
  1532. append(mobs.x, x);
  1533. append(mobs.y, y);
  1534. switch(type){
  1535. case 0:
  1536. append(mobs.health, 10);
  1537. break;
  1538. case 1:
  1539. append(mobs.health, 20);
  1540. break;
  1541. case 2:
  1542. append(mobs.health, 20);
  1543. break;
  1544. case 3:
  1545. append(mobs.health, 10);
  1546. break;
  1547. case 4:
  1548. append(mobs.health, 30);
  1549. }
  1550. append(mobs.inWater, false);
  1551. append(mobs.inLava, false);
  1552. append(mobs.onFire, false);
  1553. append(mobs.fireTix, false);
  1554. append(mobs.state, 0);
  1555. append(mobs.legPos, 0);
  1556. append(mobs.nether, nether);
  1557. mobs.length++;
  1558. }
  1559. };
  1560. //This function makes the world truly infinite
  1561. var genWorld = function(){
  1562. if(!nether){
  1563. if(round(random(0, 10))){}else{
  1564. curBiome = round(random(0, 3));
  1565. }
  1566. append(biomes, curBiome);
  1567. }
  1568. for(var d = 0; d < world.length; d++){
  1569. if(nether){
  1570. if(d < 14){
  1571. if(d>3){
  1572. append(world[d], 0);
  1573. }else if(d>1){
  1574. append(world[d], 19);
  1575. }else{
  1576. append(world[d], 10);
  1577. }
  1578. }else if(d >= 14){
  1579. if(d>38){
  1580. append(world[d], 10);
  1581. }else{
  1582. append(world[d], 19);
  1583. }
  1584. }
  1585. if(!round(random(0, 6))&&d===13){
  1586. world[d][world[d].length]=17;
  1587. }
  1588. if(!round(random(0, 10))&&d===9){
  1589. for(var i = 0; i < 5; i++){
  1590. for(var j = 0; j < 4; j++){
  1591. world[d+i][world[0].length-j]=8;
  1592. }
  1593. }
  1594. for(var i = 1; i < 4; i++){
  1595. for(var j = 1; j < 3; j++){
  1596. world[d+i][world[0].length-j]=18;
  1597. }
  1598. }
  1599. }
  1600. if(d === 3 && !round(random(0, 12))){
  1601. world[d][world[d].length-round(random(2,4))]=13;
  1602. if(!world[14][world[14].length]){
  1603. for(var i = world[14].length; i < world[d].length; i++){
  1604. world[14][i]=19;
  1605. }
  1606. }
  1607. world[14][world[0].length-5]=13;
  1608. world[14][world[0].length-4]=13;
  1609. world[14][world[0].length-3]=13;
  1610. world[14][world[0].length-2]=13;
  1611. world[14][world[0].length-1]=13;
  1612. world[14+1][world[0].length-3]=13;
  1613. world[14+1][world[0].length-2]=13;
  1614. }
  1615. }else{
  1616. if(round(random(0, 750))){}else{
  1617. if(d>18&&d<30){
  1618. var l = world[0].length;
  1619. var dungeonCenter = round(random(2, 4));
  1620. var dungeonLength = dungeonCenter*2+1;
  1621. var dungeonHeight = round(random(4, 6));
  1622. for(var i = l-dungeonLength; i < l; i++){
  1623. for(var j = d; j < d+dungeonHeight; j++){
  1624. world[j][i]=0;
  1625. if(i===l-dungeonLength||i===l-1){
  1626. world[j][i]=4;
  1627. }
  1628. if(i===l-dungeonLength-1||i===l-2){
  1629. if(round(random(0, 0))){}else{
  1630. var durr = i;
  1631. var hurr = d+dungeonHeight-1;
  1632. world[d+dungeonHeight-1][i]=34;
  1633. specs[d+dungeonHeight-1][i]=[
  1634. [[0,0,0,0],
  1635. [0,0,0,0],
  1636. [0,0,0,0],
  1637. [0,0,0,0],
  1638. [0,0,0,0],
  1639. [0,0,0,0]],
  1640. [[0,0,0,0],
  1641. [0,0,0,0],
  1642. [0,0,0,0],
  1643. [0,0,0,0],
  1644. [0,0,0,0],
  1645. [0,0,0,0]],
  1646. [[0,0,0,0],
  1647. [0,0,0,0],
  1648. [0,0,0,0],
  1649. [0,0,0,0],
  1650. [0,0,0,0],
  1651. [0,0,0,0]]];
  1652. for(var g = 0; g < 6; g++){
  1653. for(var h = 0; h < 4; h++){
  1654. if(!round(random(0,5))){
  1655. var item;
  1656. var itemStacks;
  1657. var itemSeed = random(0, 100);
  1658. if(itemSeed<=100){
  1659. item=0;itemStacks=0;
  1660. if(itemSeed<25){
  1661. item=302;itemStacks=round(random(1, 4));
  1662. }else if(itemSeed<50){
  1663. item=303;itemStacks=round(random(1, 4));
  1664. }else if(itemSeed<75){
  1665. if(itemSeed<63){
  1666. item=309;itemStacks=1;
  1667. }else{
  1668. item=314;itemStacks=1;
  1669. }
  1670. }else{
  1671. itemStacks=1;
  1672. if(itemSeed<80){
  1673. item=320;
  1674. }else if(itemSeed<85){
  1675. item=321;
  1676. }else if(itemSeed<90){
  1677. item=322;
  1678. }else if(itemSeed<95){
  1679. item=323;
  1680. }else{
  1681. item=305;itemStacks=round(random(1,5));
  1682. }
  1683. }
  1684. }
  1685. specs[hurr][durr][0][g][h]=item;
  1686. specs[hurr][durr][1][g][h]=itemStacks;
  1687. if(itemDurabilities[item]){
  1688. specs[hurr][durr][2][g][h]=itemDurabilities[item];
  1689. }
  1690. }
  1691. }
  1692. }
  1693. }
  1694. }
  1695. }
  1696. if(round(random(0,1))){
  1697. world[d+dungeonHeight][i]=4;
  1698. }else{
  1699. world[d+dungeonHeight][i]=35;
  1700. }
  1701. }world[d+dungeonHeight-1][l-dungeonCenter-1]=36;
  1702. }
  1703. }
  1704. if(d < 14){
  1705. append(world[d], 0);
  1706. }else if(d === 14&&curBiome!==1){
  1707. append(world[d], 2);
  1708. }else if(d > 14 && d < 18&&curBiome!==1){
  1709. append(world[d], 3);
  1710. }else if(d > 17 && d < 38){
  1711. append(world[d], 1);
  1712. }else if(d > 37){
  1713. append(world[d], 10);
  1714. }
  1715. if(d > 13 && d < 18 && curBiome===1){
  1716. append(world[d], 20);
  1717. }
  1718. if(round(random(0,10))){}else if(curBiome===2){
  1719. if(d === 14){
  1720. world[d][world[0].length-5]=11;
  1721. world[d][world[0].length-4]=11;
  1722. world[d][world[0].length-3]=11;
  1723. world[d][world[0].length-2]=11;
  1724. world[d][world[0].length-1]=11;
  1725. world[d+1][world[0].length-3]=11;
  1726. world[d+1][world[0].length-2]=11;
  1727. if(!round(random(0,5))){
  1728. for(var i = 0; i < round(random(2,4)); i++){
  1729. world[d-1-i][world[0].length-6]=41;
  1730. }
  1731. }
  1732. }
  1733. }
  1734. if(round(random(0, 5))){}else{
  1735. if(d === 13&&curBiome === 1){
  1736. world[d][world[0].length]=31;
  1737. world[d-1][world[0].length]=31;
  1738. world[d-2][world[0].length]=31;
  1739. }
  1740. }
  1741. if(round(random(0,4))){}else if(curBiome!==1&&world[14][world[0].length]!==11){
  1742. if(d === 13&&world[d+1][world[0].length]!==11){
  1743. world[d][world[0].length]=7;
  1744. world[d-1][world[0].length]=7;
  1745. world[d-2][world[0].length]=7;
  1746. world[d-3][world[0].length]=7;
  1747. world[d-2][world[0].length-2]=9;
  1748. world[d-2][world[0].length-1]=9;
  1749. world[d-2][world[0].length+1]=9;
  1750. world[d-2][world[0].length+2]=9;
  1751. world[d-3][world[0].length-2]=9;
  1752. world[d-3][world[0].length-1]=9;
  1753. world[d-3][world[0].length+1]=9;
  1754. world[d-3][world[0].length+2]=9;
  1755. world[d-4][world[0].length-2]=9;
  1756. world[d-4][world[0].length-1]=9;
  1757. world[d-4][world[0].length]=9;
  1758. world[d-4][world[0].length+1]=9;
  1759. world[d-4][world[0].length+2]=9;
  1760. world[d-5][world[0].length-1]=9;
  1761. world[d-5][world[0].length]=9;
  1762. world[d-5][world[0].length+1]=9;
  1763. }
  1764. }
  1765. if(d<37&&d>30 && !round(random(0,50))){
  1766. for(var i = 0; i < 6; i++){
  1767. world[d][world[d].length-i-1]=13;
  1768. }
  1769. for(var i = round(random(1,2)); i < random(3,5); i++){
  1770. world[d+1][world[d].length-i-1]=13;
  1771. }
  1772. }
  1773. if(round(random(0, 4))){}else{
  1774. //generate ores
  1775. //coal
  1776. if(round(random(0, 3))){}else{
  1777. if(d > 18 && d < 38){
  1778. c = round(random(0, 5));
  1779. switch(c){
  1780. case 1:
  1781. world[d][world[0].length]=22;
  1782. break;
  1783. case 2:
  1784. world[d][world[0].length]=22;
  1785. world[d][world[0].length-1]=22;
  1786. break;
  1787. case 3:
  1788. world[d][world[0].length]=22;
  1789. world[d][world[0].length-1]=22;
  1790. world[d+1][world[0].length]=22;
  1791. world[d+1][world[0].length-1]=1;
  1792. break;
  1793. case 4:
  1794. world[d][world[0].length]=22;
  1795. world[d][world[0].length-1]=22;
  1796. world[d+1][world[0].length]=22;
  1797. world[d+1][world[0].length-1]=22;
  1798. }
  1799. }
  1800. }
  1801. if(round(random(0, 8))){}else{
  1802. if(d > 18 && d < 38){
  1803. c = round(random(0, 9));
  1804. switch(c){
  1805. case 1:
  1806. world[d][world[0].length]=23;
  1807. break;
  1808. case 2:
  1809. world[d][world[0].length]=23;
  1810. world[d][world[0].length-1]=23;
  1811. break;
  1812. case 3:
  1813. world[d][world[0].length]=23;
  1814. world[d][world[0].length-1]=23;
  1815. world[d+1][world[0].length]=23;
  1816. world[d+1][world[0].length-1]=1;
  1817. break;
  1818. case 4:
  1819. world[d][world[0].length]=23;
  1820. world[d][world[0].length-1]=23;
  1821. world[d+1][world[0].length]=23;
  1822. world[d+1][world[0].length-1]=23;
  1823. }
  1824. }
  1825. }
  1826. if(round(random(0, 8))){}else{
  1827. if(d > 28 && d < 38){
  1828. c = round(random(0, 1));
  1829. switch(c){
  1830. case 1:
  1831. world[d][world[0].length]=24;
  1832. break;
  1833. case 2:
  1834. world[d][world[0].length]=24;
  1835. world[d][world[0].length-1]=24;
  1836. break;
  1837. case 3:
  1838. world[d][world[0].length]=24;
  1839. world[d][world[0].length-1]=24;
  1840. world[d+1][world[0].length]=24;
  1841. world[d+1][world[0].length-1]=1;
  1842. break;
  1843. case 4:
  1844. world[d][world[0].length]=24;
  1845. world[d][world[0].length-1]=24;
  1846. world[d+1][world[0].length]=24;
  1847. world[d+1][world[0].length-1]=24;
  1848. }
  1849. }
  1850. }
  1851. if(round(random(0, 8))){}else{
  1852. if(d > 18 && d < 38){
  1853. c = round(random(0, 5));
  1854. switch(c){
  1855. case 1:
  1856. world[d][world[0].length]=23;
  1857. break;
  1858. case 2:
  1859. world[d][world[0].length]=23;
  1860. world[d][world[0].length-1]=23;
  1861. break;
  1862. case 3:
  1863. world[d][world[0].length]=23;
  1864. world[d][world[0].length-1]=23;
  1865. world[d+1][world[0].length]=23;
  1866. world[d+1][world[0].length-1]=1;
  1867. break;
  1868. case 4:
  1869. world[d][world[0].length]=23;
  1870. world[d][world[0].length-1]=23;
  1871. world[d+1][world[0].length]=23;
  1872. world[d+1][world[0].length-1]=23;
  1873. }
  1874. }
  1875. }
  1876. if(round(random(0, 12))){}else{
  1877. if(d > 33 && d < 38){
  1878. c = round(random(0, 5));
  1879. switch(c){
  1880. case 1:
  1881. world[d][world[0].length]=25;
  1882. break;
  1883. case 2:
  1884. world[d][world[0].length]=25;
  1885. world[d][world[0].length-1]=25;
  1886. break;
  1887. case 3:
  1888. world[d][world[0].length]=25;
  1889. world[d][world[0].length-1]=25;
  1890. world[d+1][world[0].length]=25;
  1891. world[d+1][world[0].length-1]=1;
  1892. break;
  1893. case 4:
  1894. world[d][world[0].length]=25;
  1895. world[d][world[0].length-1]=25;
  1896. world[d+1][world[0].length]=25;
  1897. world[d+1][world[0].length-1]=25;
  1898. }
  1899. }
  1900. }
  1901. //DIAMONDZ
  1902. if(round(random(0, 20))){}else{
  1903. if(d > 33 && d < 38){
  1904. c = round(random(0, 5));
  1905. switch(c){
  1906. case 1:
  1907. world[d][world[0].length]=26;
  1908. break;
  1909. case 2:
  1910. world[d][world[0].length]=26;
  1911. world[d][world[0].length-1]=26;
  1912. break;
  1913. case 3:
  1914. world[d][world[0].length]=26;
  1915. world[d][world[0].length-1]=26;
  1916. world[d+1][world[0].length]=26;
  1917. world[d+1][world[0].length-1]=1;
  1918. break;
  1919. case 4:
  1920. world[d][world[0].length]=26;
  1921. world[d][world[0].length-1]=26;
  1922. world[d+1][world[0].length]=26;
  1923. world[d+1][world[0].length-1]=26;
  1924. }
  1925. }
  1926. }
  1927. if(d>20&&d<36){
  1928. if(round(random(0, 13))){}else{
  1929. world[d-2][world[0].length-1]=3;
  1930. world[d-2][world[0].length]=3;
  1931. world[d-2][world[0].length+1]=3;
  1932. world[d-1][world[0].length-2]=3;
  1933. world[d-1][world[0].length-1]=3;
  1934. world[d-1][world[0].length]=3;
  1935. world[d-1][world[0].length+1]=3;
  1936. world[d-1][world[0].length+2]=3;
  1937. world[d][world[0].length-2]=3;
  1938. world[d][world[0].length-1]=3;
  1939. world[d][world[0].length]=3;
  1940. world[d][world[0].length+1]=3;
  1941. world[d][world[0].length+2]=3;
  1942. world[d+1][world[0].length-2]=3;
  1943. world[d+1][world[0].length-1]=3;
  1944. world[d+1][world[0].length]=3;
  1945. world[d+1][world[0].length+1]=3;
  1946. world[d+1][world[0].length+2]=3;
  1947. world[d+2][world[0].length-1]=3;
  1948. world[d+2][world[0].length]=3;
  1949. world[d+2][world[0].length+1]=3;
  1950. }
  1951. }
  1952. if(d>20&&d<36){
  1953. if(round(random(0, 13))){}else{
  1954. world[d-2][world[0].length-1]=21;
  1955. world[d-2][world[0].length]=21;
  1956. world[d-2][world[0].length+1]=21;
  1957. world[d-1][world[0].length-2]=21;
  1958. world[d-1][world[0].length-1]=21;
  1959. world[d-1][world[0].length]=21;
  1960. world[d-1][world[0].length+1]=21;
  1961. world[d-1][world[0].length+2]=21;
  1962. world[d][world[0].length-2]=21;
  1963. world[d][world[0].length-1]=21;
  1964. world[d][world[0].length]=21;
  1965. world[d][world[0].length+1]=21;
  1966. world[d][world[0].length+2]=21;
  1967. world[d+1][world[0].length-2]=21;
  1968. world[d+1][world[0].length-1]=21;
  1969. world[d+1][world[0].length]=21;
  1970. world[d+1][world[0].length+1]=21;
  1971. world[d+1][world[0].length+2]=21;
  1972. world[d+2][world[0].length-1]=21;
  1973. world[d+2][world[0].length]=21;
  1974. world[d+2][world[0].length+1]=21;
  1975. }
  1976. }
  1977. }}
  1978. }
  1979. };
  1980. var spawnEntity = function(x, y, t, t2){
  1981. append(entity.x, x);
  1982. append(entity.y, y);
  1983. append(entity.type, t);
  1984. append(entity.type2, t2);
  1985. entity.length++;
  1986. };
  1987. var drawBlocks = function(x, g, h){
  1988. noStroke();
  1989. strokeWeight(2);
  1990. switch(x){
  1991. case 1:
  1992. fill(122, 122, 122);
  1993. rect(g, h, 20, 20);
  1994. break;
  1995. case 2:
  1996. fill(130, 56, 0);
  1997. rect(g, h, 20, 20);
  1998. rect(g, h, 20, 5);
  1999. break;
  2000. case 3:
  2001. fill(130, 56, 0);
  2002. rect(g, h, 20, 20);
  2003. break;
  2004. case 4:
  2005. fill(122, 122, 122);
  2006. strokeWeight(2);
  2007. stroke(71, 71, 71);
  2008. rect(g, h, 10, 10);
  2009. rect(g+10, h+10, 10, 10);
  2010. rect(g, h+10, 10, 10);
  2011. rect(g+10, h, 10, 10);
  2012. noStroke();
  2013. break;
  2014. case 5:
  2015. fill(201, 153, 80);
  2016. rect(g, h, 20, 20);
  2017. stroke(120, 83, 44);
  2018. strokeWeight(2);
  2019. line(g, h, g+20, h);
  2020. line(g, h+5, g+20, h+5);
  2021. line(g, h+10, g+20, h+10);
  2022. line(g, h+15, g+20, h+15);
  2023. noStroke();
  2024. break;
  2025. case 6:
  2026. fill(181, 97, 58);
  2027. rect(g, h, 20, 20);
  2028. stroke(237, 209, 176);
  2029. line(g, h, g+20, h);
  2030. line(g+5, h, g+5, h+3);
  2031. line(g+15, h, g+15, h+3);
  2032. line(g, h+5, g+20, h+5);
  2033. line(g+10, h+5, g+10, h+8);
  2034. line(g, h+10, g+20, h+10);
  2035. line(g+5, h+10, g+5, h+13);
  2036. line(g+15, h+10, g+15, h+13);
  2037. line(g, h+15, g+20, h+15);
  2038. line(g+10, h+15, g+10, h+18);
  2039. noStroke();
  2040. break;
  2041. case 7:
  2042. fill(107, 50, 0);
  2043. rect(g, h, 20, 20);
  2044. stroke(59, 32, 0);
  2045. strokeWeight(2);
  2046. line(g, h, g, h+18);
  2047. line(g+20, h, g+20, h+18);
  2048. noStroke();
  2049. break;
  2050. case 8:
  2051. fill(40, 3, 82);
  2052. rect(g, h, 20, 20);
  2053. break;
  2054. case 9:
  2055. fill(8, 168, 0);
  2056. rect(g, h, 5, 5);
  2057. rect(g+10, h, 5, 5);
  2058. rect(g+5, h+5, 5, 5);
  2059. rect(g+15, h+5, 5, 5);
  2060. rect(g, h+10, 5, 5);
  2061. rect(g+10, h+10, 5, 5);
  2062. rect(g+5, h+15, 5, 5);
  2063. rect(g+15, h+15, 5, 5);
  2064. break;
  2065. case 11:
  2066. fill(120, 120, 120);
  2067. ellipse(g+10, h+19, 15, 8);
  2068. rect(g+2, h+4, 16, 15);
  2069. ellipse(g+10, h+3, 15, 8);
  2070. fill(0, 104, 250);
  2071. ellipse(g+10, h+3, 12, 6);
  2072. break;
  2073. case 13:
  2074. fill(120, 120, 120);
  2075. ellipse(g+10, h+19, 15, 8);
  2076. rect(g+2, h+4, 16, 15);
  2077. ellipse(g+10, h+3, 15, 8);
  2078. fill(255, 149, 0);
  2079. ellipse(g+10, h+3, 12, 6);
  2080. break;
  2081. case 15:
  2082. fill(255, 0, 0);
  2083. rect(g, h, 20, 20);
  2084. fill(255, 255, 255);
  2085. rect(g, h+5, 20, 10);
  2086. break;
  2087. case 16:
  2088. fill(107, 50, 0);
  2089. rect(g+9, h+12, 2, 8);
  2090. fill(8, 168, 0);
  2091. rect(g+5, h+7, 10, 5);
  2092. rect(g+7, h+5, 5, 10);
  2093. break;
  2094. case 17:
  2095. fill(89, 89, 89);
  2096. triangle(g+8, h+20, g+20, h+8, g+20, h+20);
  2097. fill(120);
  2098. ellipse(g+6, h+5, 8, 8);
  2099. fill(this.get(g, h));
  2100. ellipse(g+8, h+6, 7, 7);
  2101. break;
  2102. case 19:
  2103. fill(99, 21, 2);
  2104. rect(g, h, 20, 20);
  2105. break;
  2106. case 20:
  2107. fill(255, 230, 166);
  2108. rect(g, h, 20, 20);
  2109. break;
  2110. case 21:
  2111. fill(136, 127, 140);
  2112. rect(g, h, 20, 20);
  2113. break;
  2114. case 22:
  2115. fill(122, 122, 122);
  2116. rect(g, h, 20, 20);
  2117. fill(0, 0, 0);
  2118. ellipse(g+5, h+5, 4, 4);
  2119. ellipse(g+14, h+6, 5, 5);
  2120. ellipse(g+10, h+9, 3, 3);
  2121. ellipse(g+5, h+12, 6, 4);
  2122. ellipse(g+14, h+15, 9, 7);
  2123. break;
  2124. case 23:
  2125. fill(122, 122, 122);
  2126. rect(g, h, 20, 20);
  2127. fill(191, 155, 82);
  2128. ellipse(g+5, h+5, 4, 4);
  2129. ellipse(g+14, h+6, 5, 5);
  2130. ellipse(g+10, h+9, 3, 3);
  2131. ellipse(g+5, h+12, 6, 4);
  2132. ellipse(g+14, h+15, 9, 7);
  2133. break;
  2134. case 24:
  2135. fill(122, 122, 122);
  2136. rect(g, h, 20, 20);
  2137. fill(255, 234, 0);
  2138. ellipse(g+5, h+5, 4, 4);
  2139. ellipse(g+14, h+6, 5, 5);
  2140. ellipse(g+10, h+9, 3, 3);
  2141. ellipse(g+5, h+12, 6, 4);
  2142. ellipse(g+14, h+15, 9, 7);
  2143. break;
  2144. case 25:
  2145. fill(122, 122, 122);
  2146. rect(g, h, 20, 20);
  2147. fill(0, 21, 255);
  2148. ellipse(g+5, h+5, 4, 4);
  2149. ellipse(g+14, h+6, 5, 5);
  2150. ellipse(g+10, h+9, 3, 3);
  2151. ellipse(g+5, h+12, 6, 4);
  2152. ellipse(g+14, h+15, 9, 7);
  2153. break;
  2154. case 26:
  2155. fill(122, 122, 122);
  2156. rect(g, h, 20, 20);
  2157. fill(0, 238, 255);
  2158. ellipse(g+5, h+5, 4, 4);
  2159. ellipse(g+14, h+6, 5, 5);
  2160. ellipse(g+10, h+9, 3, 3);
  2161. ellipse(g+5, h+12, 6, 4);
  2162. ellipse(g+14, h+15, 9, 7);
  2163. break;
  2164. case 27:
  2165. fill(201, 153, 80);
  2166. rect(g, h, 20, 20);
  2167. stroke(120, 83, 44);
  2168. strokeWeight(2);
  2169. line(g, h, g+20, h);
  2170. line(g, h+5, g+20, h+5);
  2171. line(g, h+10, g+20, h+10);
  2172. line(g, h+15, g+20, h+15);
  2173. line(g, h, g, h+20);
  2174. line(g+20, h, g+20, h+20);
  2175. fill(255, 230, 199);
  2176. triangle(g+1, h, g+10, h+8, g+19, h);
  2177. stroke(122, 122, 122);
  2178. line(g+5, h+10, g+5, h+17);
  2179. line(g+15, h+8, g+15, h+15);
  2180. noStroke();
  2181. break;
  2182. case 28:
  2183. fill(201, 153, 80);
  2184. stroke(120, 83, 44);
  2185. rect(g+3, h, 13, 20);
  2186. line(g+3, h+10, g+15, h+10);
  2187. fill(66, 66, 66);
  2188. stroke(66, 66, 66);
  2189. strokeWeight(3);
  2190. line(g+15, h+12, g+13, h+12);
  2191. strokeWeight(2);
  2192. break;
  2193. case 30:
  2194. stroke(120, 83, 44);
  2195. strokeWeight(3);
  2196. line(g, h, g, h+20);
  2197. line(g+20, h, g+20, h+20);
  2198. line(g, h+5, g+20, h+5);
  2199. line(g, h+11, g+20, h+11);
  2200. line(g, h+17, g+20, h+17);
  2201. strokeWeight(2);
  2202. break;
  2203. case 31:
  2204. stroke(0, 0, 0);
  2205. line(g+1, h+2, g+18, h+2);
  2206. line(g+1, h+6, g+18, h+6);
  2207. line(g+1, h+10, g+18, h+10);
  2208. line(g+1, h+14, g+18, h+14);
  2209. line(g+1, h+18, g+18, h+18);
  2210. fill(0, 130, 0);noStroke();
  2211. rect(g+2, h, 16, 20);
  2212. break;
  2213. case 33:
  2214. strokeWeight(2);
  2215. stroke(71, 71, 71);
  2216. fill(168, 168, 168);
  2217. rect(g, h, 20, 10);
  2218. fill(0);
  2219. ellipse(g+10, h+10, 13, 11);
  2220. fill(122, 122, 122);
  2221. rect(g, h+10, 20, 10);
  2222. fill(0);
  2223. var d = [], e = [];
  2224. for(var i = 0; i < 4; i++){
  2225. d[i] = sin(i*60+90)*6.5+g+10;
  2226. e[i] = cos(i*60+90)*6.5+h+20;
  2227. }
  2228. bezier(d[0],e[0],d[1],e[1],d[2],e[2],d[3],e[3]);
  2229. noStroke();
  2230. break;
  2231. case 34:
  2232. fill(184, 133, 57);
  2233. stroke(120, 83, 44);
  2234. rect(g+1, h, 18, 19);
  2235. line(g+1, h+5, g+18, h+5);
  2236. line(g+1, h+10, g+18, h+10);
  2237. line(g+1, h+15, g+18, h+15);
  2238. strokeWeight(1);
  2239. fill(225);
  2240. stroke(200);
  2241. rect(g+8, h+3, 3, 6);
  2242. break;
  2243. case 35:
  2244. fill(122, 122, 122);
  2245. strokeWeight(2);
  2246. stroke(45, 87, 11);
  2247. rect(g, h, 10, 10);
  2248. rect(g+10, h, 10, 10);
  2249. rect(g, h+10, 10, 10);
  2250. rect(g+10, h+10, 10, 10);
  2251. noStroke();
  2252. fill(166, 194, 134);
  2253. triangle(g+2, h, g+6, h, g+4, h+5);
  2254. triangle(g+13, h, g+17, h, g+15, h+10);
  2255. triangle(g+8, h+11, g+13, h+11, g+11, h+18);
  2256. triangle(g+2, h+13, g+7, h+13, g+4, h+19);
  2257. break;
  2258. case 36:
  2259. stroke(4, 68, 77);
  2260. noFill();
  2261. rect(g, h, 20, 20);
  2262. line(g+5, h, g+5, h+18);
  2263. line(g+15, h, g+15, h+18);
  2264. line(g, h+5, g+18, h+5);
  2265. line(g, h+15, g+18, h+15);
  2266. break;
  2267. case 37:
  2268. fill(230);
  2269. stroke(140);
  2270. rect(g, h, 20, 20);
  2271. break;
  2272. case 38:
  2273. fill(255, 234, 0);
  2274. stroke(209, 157, 0);
  2275. rect(g, h, 20, 20);
  2276. break;
  2277. case 39:
  2278. stroke(0, 148, 148);
  2279. fill(0, 255, 255);
  2280. rect(g, h, 20, 20);
  2281. break;
  2282. case 40:
  2283. strokeWeight(4);
  2284. stroke(120, 83, 44);
  2285. line(g+10, h+8, g+10, h+17);
  2286. stroke(255, 251, 181);
  2287. point(g+10, h+6);
  2288. break;
  2289. case 41:
  2290. fill(139, 235, 115);
  2291. quad(g+1, h+13, g+6, h+17, g+20, h+3, g+12, h-3);
  2292. fill(167, 255, 145);
  2293. quad(g+3, h+15, g+6, h+20, g+20, h+5, g+14, h+0);
  2294. break;
  2295. case 300:
  2296. stroke(120, 83, 44);
  2297. strokeWeight(3);
  2298. line(g+1, h+19, g+19, h+1);
  2299. break;
  2300. case 301:
  2301. stroke(0, 0, 0);
  2302. fill(59, 54, 59);
  2303. ellipse(g+10, h+10, 15, 17);
  2304. break;
  2305. case 302:
  2306. stroke(163, 163, 163);
  2307. fill(209, 209, 209);
  2308. rect(g, h+10, 20, 10);
  2309. quad(g, h+9, g+5, h+6, g+15, h+6, g+19, h+9);
  2310. break;
  2311. case 303:
  2312. stroke(189, 151, 0);
  2313. fill(255, 200, 0);
  2314. rect(g, h+10, 20, 10);
  2315. quad(g, h+9, g+5, h+6, g+15, h+6, g+19, h+9);
  2316. break;
  2317. case 304:
  2318. stroke(0, 0, 117);
  2319. fill(0, 21, 255);
  2320. ellipse(g+10, h+10, 15, 17);
  2321. break;
  2322. case 305:
  2323. stroke(0, 148, 148);
  2324. fill(0, 255, 255);
  2325. quad(g+10, h, g+20, h+10, g+10, h+20, g, h+10);
  2326. rect(g+5, h+5, 10, 10);
  2327. break;
  2328. case 306:
  2329. fill(89, 89, 89);
  2330. triangle(g+1, h+20, g+20, h+1, g+20, h+20);
  2331. break;
  2332. case 307:
  2333. fill(207, 147, 44);
  2334. stroke(120, 83, 44);
  2335. ellipse(g+10, h+10, 20, 20);
  2336. noStroke();
  2337. fill(this.get(g, h));
  2338. ellipse(g+7, h+13, 22, 22);
  2339. stroke(120, 83, 44);
  2340. strokeWeight(3);
  2341. line(g+1, h+19, g+15, h+5);
  2342. strokeWeight(2);
  2343. break;
  2344. case 308:
  2345. fill(150);
  2346. stroke(120);
  2347. ellipse(g+10, h+10, 20, 20);
  2348. noStroke();
  2349. fill(this.get(g, h));
  2350. ellipse(g+7, h+13, 22, 22);
  2351. stroke(120, 83, 44);
  2352. strokeWeight(3);
  2353. line(g+1, h+19, g+15, h+5);
  2354. strokeWeight(2);
  2355. break;
  2356. case 309:
  2357. fill(230);
  2358. stroke(140);
  2359. ellipse(g+10, h+10, 20, 20);
  2360. noStroke();
  2361. fill(this.get(g, h));
  2362. ellipse(g+7, h+13, 22, 22);
  2363. stroke(120, 83, 44);
  2364. strokeWeight(3);
  2365. line(g+1, h+19, g+15, h+5);
  2366. strokeWeight(2);
  2367. break;
  2368. case 310:
  2369. fill(255, 234, 0);
  2370. stroke(209, 157, 0);
  2371. ellipse(g+10, h+10, 20, 20);
  2372. noStroke();
  2373. fill(this.get(g, h));
  2374. ellipse(g+7, h+13, 22, 22);
  2375. stroke(120, 83, 44);
  2376. strokeWeight(3);
  2377. line(g+1, h+19, g+15, h+5);
  2378. strokeWeight(2);
  2379. break;
  2380. case 311:
  2381. stroke(0, 148, 148);
  2382. fill(0, 255, 255);
  2383. ellipse(g+10, h+10, 20, 20);
  2384. noStroke();
  2385. fill(this.get(g, h));
  2386. ellipse(g+7, h+13, 22, 22);
  2387. stroke(120, 83, 44);
  2388. strokeWeight(3);
  2389. line(g+1, h+19, g+15, h+5);
  2390. strokeWeight(2);
  2391. break;
  2392. case 312:
  2393. fill(207, 147, 44);
  2394. stroke(120, 83, 44);
  2395. quad(g+3, h+13, g+7, h+17, g+20, h+5, g+15, h);
  2396. triangle(g+20, h+4, g+20, h, g+16, h);
  2397. noStroke();
  2398. quad(g+5, h+15, g+5, h+15, g+19, h+4, g+16, h+1);
  2399. triangle(g+16, h+1, g+19, h+4, g+19, h+1);
  2400. stroke(120, 83, 44);
  2401. strokeWeight(3);
  2402. line(g, h+20, g+5, h+15);
  2403. line(g+1, h+11, g+9, h+19);
  2404. strokeWeight(2);
  2405. break;
  2406. case 313:
  2407. fill(150);
  2408. stroke(120);
  2409. quad(g+3, h+13, g+7, h+17, g+20, h+5, g+15, h);
  2410. triangle(g+20, h+4, g+20, h, g+16, h);
  2411. noStroke();
  2412. quad(g+5, h+15, g+5, h+15, g+19, h+4, g+16, h+1);
  2413. triangle(g+16, h+1, g+19, h+4, g+19, h+1);
  2414. stroke(120, 83, 44);
  2415. strokeWeight(3);
  2416. line(g, h+20, g+5, h+15);
  2417. line(g+1, h+11, g+9, h+19);
  2418. strokeWeight(2);
  2419. break;
  2420. case 314:
  2421. fill(230);
  2422. stroke(140);
  2423. quad(g+3, h+13, g+7, h+17, g+20, h+5, g+15, h);
  2424. triangle(g+20, h+4, g+20, h, g+16, h);
  2425. noStroke();
  2426. quad(g+5, h+15, g+5, h+15, g+19, h+4, g+16, h+1);
  2427. triangle(g+16, h+1, g+19, h+4, g+19, h+1);
  2428. stroke(120, 83, 44);
  2429. strokeWeight(3);
  2430. line(g, h+20, g+5, h+15);
  2431. line(g+1, h+11, g+9, h+19);
  2432. strokeWeight(2);
  2433. break;
  2434. case 315:
  2435. fill(255, 234, 0);
  2436. stroke(209, 157, 0);
  2437. quad(g+3, h+13, g+7, h+17, g+20, h+5, g+15, h);
  2438. triangle(g+20, h+4, g+20, h, g+16, h);
  2439. noStroke();
  2440. quad(g+5, h+15, g+5, h+15, g+19, h+4, g+16, h+1);
  2441. triangle(g+16, h+1, g+19, h+4, g+19, h+1);
  2442. stroke(120, 83, 44);
  2443. strokeWeight(3);
  2444. line(g, h+20, g+5, h+15);
  2445. line(g+1, h+11, g+9, h+19);
  2446. strokeWeight(2);
  2447. break;
  2448. case 316:
  2449. stroke(0, 148, 148);
  2450. fill(0, 255, 255);
  2451. quad(g+3, h+13, g+7, h+17, g+20, h+5, g+15, h);
  2452. triangle(g+20, h+4, g+20, h, g+16, h);
  2453. noStroke();
  2454. quad(g+5, h+15, g+5, h+15, g+19, h+4, g+16, h+1);
  2455. triangle(g+16, h+1, g+19, h+4, g+19, h+1);
  2456. stroke(120, 83, 44);
  2457. strokeWeight(3);
  2458. line(g, h+20, g+5, h+15);
  2459. line(g+1, h+11, g+9, h+19);
  2460. strokeWeight(2);
  2461. break;
  2462. case 317:
  2463. noFill();
  2464. stroke(191, 103, 103);
  2465. strokeWeight(14);
  2466. bezier(g+3, h+15, g+8, h+13, g+13, h+8, g+15, h+3);
  2467. stroke(255, 171, 171);
  2468. strokeWeight(10);
  2469. bezier(g+3, h+15, g+8, h+13, g+13, h+8, g+15, h+3);
  2470. break;
  2471. case 318:
  2472. stroke(100);
  2473. fill(150);
  2474. triangle(g+10, h+5, g+20, h+15, g, h+15);
  2475. break;
  2476. case 319:
  2477. noFill();
  2478. stroke(148, 113, 61);
  2479. strokeWeight(14);
  2480. bezier(g+3, h+15, g+8, h+13, g+13, h+8, g+15, h+3);
  2481. stroke(207, 175, 95);
  2482. strokeWeight(10);
  2483. bezier(g+3, h+15, g+8, h+13, g+13, h+8, g+15, h+3);
  2484. break;
  2485. case 320:
  2486. fill(230);
  2487. stroke(140);
  2488. rect(g, h, 20, 20, 10);
  2489. noStroke();
  2490. fill(this.get(g, h));
  2491. rect(g+5, h+8, 11, 15, 5);
  2492. break;
  2493. case 321:
  2494. fill(230);
  2495. stroke(140);
  2496. rect(g, h, 20, 5, 10);
  2497. rect(g, h, 20, 20, 10);
  2498. break;
  2499. case 322:
  2500. fill(230);
  2501. stroke(140);
  2502. rect(g, h, 8, 20, 10);
  2503. rect(g+12, h, 8, 20, 10);
  2504. rect(g, h, 20, 10, 10);
  2505. break;
  2506. case 323:
  2507. fill(230);
  2508. stroke(140);
  2509. rect(g, h+10, 8, 10, 10);
  2510. rect(g+12, h+10, 8, 10, 10);
  2511. break;
  2512. case 324:
  2513. fill(255, 234, 0);
  2514. stroke(209, 157, 0);
  2515. rect(g, h, 20, 20, 10);
  2516. noStroke();
  2517. fill(this.get(g, h));
  2518. rect(g+5, h+8, 11, 15, 5);
  2519. break;
  2520. case 325:
  2521. fill(255, 234, 0);
  2522. stroke(209, 157, 0);
  2523. rect(g, h, 20, 5, 10);
  2524. rect(g, h, 20, 20, 10);
  2525. break;
  2526. case 326:
  2527. fill(255, 234, 0);
  2528. stroke(209, 157, 0);
  2529. rect(g, h, 8, 20, 10);
  2530. rect(g+12, h, 8, 20, 10);
  2531. rect(g, h, 20, 10, 10);
  2532. break;
  2533. case 327:
  2534. fill(255, 234, 0);
  2535. stroke(209, 157, 0);
  2536. rect(g, h+10, 8, 10, 10);
  2537. rect(g+12, h+10, 8, 10, 10);
  2538. break;
  2539. case 328:
  2540. stroke(0, 148, 148);
  2541. fill(0, 255, 255);
  2542. rect(g, h, 20, 20, 10);
  2543. noStroke();
  2544. fill(this.get(g, h));
  2545. rect(g+5, h+8, 11, 15, 5);
  2546. break;
  2547. case 329:
  2548. stroke(0, 148, 148);
  2549. fill(0, 255, 255);
  2550. rect(g, h, 20, 5, 10);
  2551. rect(g, h, 20, 20, 10);
  2552. break;
  2553. case 330:
  2554. stroke(0, 148, 148);
  2555. fill(0, 255, 255);
  2556. rect(g, h, 8, 20, 10);
  2557. rect(g+12, h, 8, 20, 10);
  2558. rect(g, h, 20, 10, 10);
  2559. break;
  2560. case 331:
  2561. stroke(0, 148, 148);
  2562. fill(0, 255, 255);
  2563. rect(g, h+10, 8, 10, 10);
  2564. rect(g+12, h+10, 8, 10, 10);
  2565. break;
  2566. case 332:
  2567. fill(189, 120, 0);
  2568. stroke(125, 75, 0);
  2569. rect(g, h, 20, 20, 10);
  2570. noStroke();
  2571. fill(this.get(g, h));
  2572. rect(g+5, h+8, 11, 15, 5);
  2573. break;
  2574. case 333:
  2575. fill(189, 120, 0);
  2576. stroke(125, 75, 0);
  2577. rect(g, h, 20, 5, 10);
  2578. rect(g, h, 20, 20, 10);
  2579. break;
  2580. case 334:
  2581. fill(189, 120, 0);
  2582. stroke(125, 75, 0);
  2583. rect(g, h, 8, 20, 10);
  2584. rect(g+12, h, 8, 20, 10);
  2585. rect(g, h, 20, 10, 10);
  2586. break;
  2587. case 335:
  2588. fill(189, 120, 0);
  2589. stroke(125, 75, 0);
  2590. rect(g, h+10, 8, 10, 10);
  2591. rect(g+12, h+10, 8, 10, 10);
  2592. break;
  2593. case 336:
  2594. fill(125, 75, 0);
  2595. ellipse(g+10, h+10, 15, 20);
  2596. triangle(g, h+1, g+10, h+3, g+5, h+15);
  2597. triangle(g+20, h+1, g+10, h+3, g+15, h+15);
  2598. triangle(g, h+19, g+10, h+17, g+5, h+5);
  2599. triangle(g+20, h+19, g+10, h+17, g+15, h+5);
  2600. fill(189, 120, 0);
  2601. ellipse(g+10, h+10, 11, 16);
  2602. triangle(g+3, h+3.5, g+10, h+3, g+5, h+15);
  2603. triangle(g+17, h+3.5, g+10, h+3, g+15, h+15);
  2604. triangle(g+3, h+16.5, g+10, h+17, g+5, h+5);
  2605. triangle(g+17, h+16.5, g+10, h+17, g+15, h+5);
  2606. break;
  2607. case 337:
  2608. fill(120, 120, 120);
  2609. ellipse(g+10, h+19, 15, 8);
  2610. rect(g+2, h+4, 16, 15);
  2611. ellipse(g+10, h+3, 15, 8);
  2612. fill(89);
  2613. ellipse(g+10, h+3, 12, 6);
  2614. break;
  2615. case 338:
  2616. fill(120, 120, 120);
  2617. ellipse(g+10, h+19, 15, 8);
  2618. rect(g+2, h+4, 16, 15);
  2619. ellipse(g+10, h+3, 15, 8);
  2620. fill(255);
  2621. ellipse(g+10, h+3, 12, 6);
  2622. break;
  2623. case 339:
  2624. fill(255, 255, 255);
  2625. stroke(225);
  2626. quad(g, h+10, g+5, h, g+20, h+10, g+15, h+20);
  2627. break;
  2628. case 340:
  2629. fill(100);
  2630. triangle(g+5, h+5, g+10, h, g+15, h+5);
  2631. fill(255);
  2632. rect(g+7, h+5, 6, 13);
  2633. fill(255, 0, 0);
  2634. triangle(g+7, h+5, g+13, h+5, g+7, h+10);
  2635. triangle(g+13, h+10, g+13, h+15, g+7, h+15);
  2636. quad(g+7, h+15, g+13, h+15, g+10, h+18, g+7, h+18);
  2637. break;
  2638. }
  2639. strokeWeight(2);
  2640. noStroke();
  2641. };
  2642. var herp;
  2643. //draw the Inventory
  2644. var drawInventory = function(invX, invY, space){
  2645. for (var gg = 0; gg < 4; gg++){
  2646. for(var hh = 0; hh < 6; hh++){
  2647. g = gg*space+invX;
  2648. h = hh*space+invY;
  2649. noStroke();
  2650. drawBlocks(invContents[hh][gg], g, h);
  2651. fill(255, 255, 255);
  2652. textSize(15);
  2653. if(invStacks[hh][gg]!==0&&invStacks[hh][gg]!==1){
  2654. text(invStacks[hh][gg], g+20, h+23);
  2655. }
  2656. if(invContents[hh][gg]===17&&invSpecs[hh][gg]!==65){
  2657. fill(255-invSpecs[hh][gg]*4, invSpecs[hh][gg]*4, 0);
  2658. rect(g, h+22, invSpecs[hh][gg]/3.25, 3);
  2659. if(invSpecs[hh][gg]<=0){
  2660. invContents[hh][gg]=0;
  2661. }
  2662. }
  2663. textSize(12);
  2664. }
  2665. }
  2666. };
  2667. var cantExplode = false;
  2668. var explode = function(x, y){
  2669. var d;
  2670. var e;
  2671. for(e = x-2; e <= x-(-2); e++){
  2672. for(d = y-2; d <= y-(-2); d++){
  2673. if((d===y-2&&e===x-2)||(d===y-2&&e===x+2)||(d===y+2&&e===x-2)||(d===y+2&&e===x+2)){
  2674. cantExplode = true;
  2675. }
  2676. if(world[d][e]!==8&&world[d][e]!==10&&!cantExplode){
  2677. if(world[d][e]===15){
  2678. specs[d][e]=15;
  2679. }
  2680. world[d][e]=0;
  2681. }
  2682. cantExplode=false;
  2683. }
  2684. }
  2685. fill(196, 196, 196);
  2686. d-=2;
  2687. e-=2;
  2688. if(dist(posB, posA, e, d)<=3){
  2689. health-=10;
  2690. }
  2691. ellipse(d*40+10+scrollX, e*40+10+scrollY, 250, 250);
  2692. };
  2693. var drawWorld = function(){
  2694. for(var x=round((scrollX/40)-(scrollX/20)-1); x<round((scrollX/40)-(scrollX/20)+20)+20; x++){
  2695. for(var y=0; y<world.length; y++){
  2696. noStroke();
  2697. if(specs[y][x]===15){
  2698. explode(x, y);
  2699. }
  2700. if(world[y][x]===0){
  2701. specs[y][x]=0;
  2702. }
  2703. switch(world[y][x]){
  2704. //air (no code)
  2705. case 0:
  2706. break;
  2707. //stone
  2708. case 1:
  2709. fill(122, 122, 122);
  2710. rect(x*40+scrollX, y*40+scrollY, 40, 40);
  2711. break;
  2712. //grass
  2713. case 2:
  2714. fill(130, 56, 0);
  2715. rect(x*40+scrollX, y*40+scrollY, 40, 40);
  2716. switch(biomes[x]){
  2717. case 0:
  2718. fill(74, 184, 0);
  2719. break;
  2720. case 1:
  2721. fill(181, 194, 0);
  2722. break;
  2723. case 2:
  2724. fill(0, 80, 0);
  2725. break;
  2726. case 3:
  2727. fill(255);
  2728. break;
  2729. default:
  2730. fill(255, 0, 0);
  2731. }
  2732. rect(x*40+scrollX, y*40+scrollY, 40, 10);
  2733. c = random(1, 200);
  2734. if(solidBlocks[world[y - 1][x]] && c > 199){
  2735. world[y][x] = 3;
  2736. }
  2737. break;
  2738. //dirt
  2739. case 3:
  2740. fill(130, 56, 0);
  2741. rect(x*40+scrollX, y*40+scrollY, 40, 40);
  2742. c = random(1, 200);
  2743. if(!solidBlocks[world[y-1][x]] && c > 199){
  2744. world[y][x] = 2;
  2745. }
  2746. break;
  2747. //cobblestone
  2748. case 4:
  2749. fill(122, 122, 122);
  2750. strokeWeight(2);
  2751. stroke(71, 71, 71);
  2752. rect(x*40+scrollX, y*40+scrollY, 20, 20);
  2753. rect(x*40+20+scrollX, y*40+scrollY, 20, 20);
  2754. rect(x*40+scrollX, y*40+20+scrollY, 20, 20);
  2755. rect(x*40+20+scrollX, y*40+20+scrollY, 20, 20);
  2756. noStroke();
  2757. break;
  2758. //wooden planks
  2759. case 5:
  2760. fill(201, 153, 80);
  2761. rect(x*40+scrollX, y*40+scrollY, 40, 40);
  2762. stroke(120, 83, 44);
  2763. strokeWeight(2);
  2764. line(x*40+scrollX, y*40+scrollY, x*40+40+scrollX, y*40+scrollY);
  2765. line(x*40+scrollX, y*40+10+scrollY, x*40+40+scrollX, y*40+10+scrollY);
  2766. line(x*40+scrollX, y*40+20+scrollY, x*40+40+scrollX, y*40+20+scrollY);
  2767. line(x*40+scrollX, y*40+30+scrollY, x*40+40+scrollX, y*40+30+scrollY);
  2768. noStroke();
  2769. break;
  2770. //bricks
  2771. case 6:
  2772. fill(181, 97, 58);
  2773. rect(x*40+scrollX, y*40+scrollY, 40, 40);
  2774. stroke(237, 209, 176);
  2775. line(x*40+scrollX, y*40+scrollY, x*40+40+scrollX, y*40+scrollY);
  2776. line(x*40+10+scrollX, y*40+scrollY, x*40+10+scrollX, y*40+10+scrollY);
  2777. line(x*40+scrollX, y*40+10+scrollY, x*40+scrollX+40, y*40+scrollY+10);
  2778. line(x*40+30+scrollX, y*40+scrollY, x*40+30+scrollX, y*40+10+scrollY);
  2779. line(x*40+40+scrollX, y*40+20+scrollY, x*40+40+scrollX, y*40+20+scrollY);
  2780. line(x*40+20+scrollX, y*40+10+scrollY, x*40+20+scrollX, y*40+20+scrollY);
  2781. line(x*40+scrollX, y*40+20+scrollY, x*40+40+scrollX, y*40+20+scrollY);
  2782. line(x*40+10+scrollX, y*40+20+scrollY, x*40+10+scrollX, y*40+30+scrollY);
  2783. line(x*40+30+scrollX, y*40+20+scrollY, x*40+30+scrollX, y*40+30+scrollY);
  2784. line(x*40+scrollX, y*40+30+scrollY, x*40+40+scrollX, y*40+30+scrollY);
  2785. line(x*40+20+scrollX, y*40+30+scrollY, x*40+20+scrollX, y*40+40+scrollY);
  2786. noStroke();
  2787. break;
  2788. //log
  2789. case 7:
  2790. fill(107, 50, 0);
  2791. rect(x*40+scrollX, y*40+scrollY, 40, 40);
  2792. stroke(59, 32, 0);
  2793. strokeWeight(2);
  2794. line(x*40+scrollX, y*40+scrollY, x*40+scrollX, y*40+40+scrollY);
  2795. line(x*40+scrollX+40, y*40+scrollY, x*40+scrollX+40, y*40+40+scrollY);
  2796. break;
  2797. //obsidian
  2798. case 8:
  2799. fill(40, 3, 82);
  2800. rect(x*40+scrollX, y*40+scrollY, 40, 40);
  2801. break;
  2802. //leaves
  2803. case 9:
  2804. switch(biomes[x]){
  2805. case 0:
  2806. fill(67, 161, 0);
  2807. break;
  2808. case 1:
  2809. fill(181, 194, 0);
  2810. break;
  2811. case 2:
  2812. fill(0, 97, 0);
  2813. break;
  2814. case 3:
  2815. fill(255);
  2816. break;
  2817. default:
  2818. fill(255, 0, 0);
  2819. }
  2820. rect(x*40+scrollX, y*40+scrollY, 10, 10);
  2821. rect(x*40+20+scrollX, y*40+scrollY, 10, 10);
  2822. rect(x*40+10+scrollX, y*40+scrollY+10, 10, 10);
  2823. rect(x*40+30+scrollX, y*40+scrollY+10, 10, 10);
  2824. rect(x*40+scrollX, y*40+20+scrollY, 10, 10);
  2825. rect(x*40+20+scrollX, y*40+20+scrollY, 10, 10);
  2826. rect(x*40+10+scrollX, y*40+30+scrollY, 10, 10);
  2827. rect(x*40+30+scrollX, y*40+30+scrollY, 10, 10);
  2828. break;
  2829. //bedrock
  2830. case 10:
  2831. fill(0, 0, 0);
  2832. rect(x*40+scrollX, y*40+scrollY, 40, 40);
  2833. break;
  2834. //water
  2835. case 11:
  2836. fill(0, 104, 250);
  2837. rect(x*40+scrollX, y*40+scrollY, 40, 40);
  2838. if(world[y+1][x]===13){
  2839. world[y+1][x]=8;
  2840. }
  2841. if(biomes[x]===3&&world[y-1][x]===0){
  2842. if(!round(random(0,100))){
  2843. world[y][x]=32;
  2844. }
  2845. }
  2846. if(world[y+1][x]===0){
  2847. world[y+1][x]=12;
  2848. }else if(world[y+1][x]<11||world[y+1][x]>15){
  2849. if(world[y][x+1]===0){
  2850. world[y][x+1]=12;
  2851. }
  2852. }
  2853. break;
  2854. //flowing water
  2855. case 12:
  2856. fill(0, 104, 250);
  2857. rect(x*40+scrollX, y*40+scrollY, 40, 40);
  2858. if(world[y+1][x]===0){
  2859. world[y+1][x]=12;
  2860. }else if(world[y+1][x]<11){
  2861. if(world[y][x+1]===0){
  2862. world[y][x+1]=12;
  2863. }if(world[y][x-1]===0){
  2864. world[y][x-1]=12;
  2865. }
  2866. }
  2867. if(world[y+1][x]===13){
  2868. world[y+1][x]=8;
  2869. }else if(world[y+1][x]<11||world[y+1][x]>15){
  2870. if(world[y][x+1]===0){
  2871. world[y][x+1]=12;
  2872. }
  2873. }
  2874. if(world[y-1][x]!==12||world[y-1][x]!==11){
  2875. world[y][x]=0;
  2876. }
  2877. break;
  2878. //lava
  2879. case 13:
  2880. fill(255, 149, 0);
  2881. rect(x*40+scrollX, y*40+scrollY, 40, 40);
  2882. if(world[y+1][x]===12){
  2883. world[y+1][x]=4;
  2884. }else if(world[y+1][x]===11){
  2885. world[y+1][x]=1;
  2886. }
  2887. if(world[y+1][x]===0){
  2888. world[y+1][x]=14;
  2889. }
  2890. break;
  2891. //flowing lava
  2892. case 14:
  2893. fill(255, 149, 0);
  2894. rect(x*40+scrollX, y*40+scrollY, 40, 40);
  2895. if(world[y+1][x]===0){
  2896. world[y+1][x]=14;
  2897. }else if(world[y+1][x]<11||world[y+1][x]>15){
  2898. if(world[y][x+1]===0){
  2899. world[y][x+1]=14;
  2900. }if(world[y][x-1]===0){
  2901. world[y][x-1]=14;
  2902. }
  2903. }else if(world[y+1][x]===12){
  2904. world[y+1][x]=4;
  2905. }else if(world[y+1][x]===11){
  2906. world[y+1][x]=1;
  2907. }
  2908. if(world[y-1][x]!==14||world[y-1][x]!==13){
  2909. world[y][x]=0;
  2910. }
  2911. break;
  2912. case 15:
  2913. fill(255, 0, 0);
  2914. rect(x*40+scrollX, y*40+scrollY, 40, 40);
  2915. fill(255, 255, 255);
  2916. rect(x*40+scrollX, y*40+10+scrollY, 40, 20);
  2917. break;
  2918. case 16:
  2919. fill(107, 50, 0);
  2920. rect(x*40+9+scrollX, y*40+20+scrollY, 4, 20);
  2921. fill(8, 168, 0);
  2922. rect(x*40+5+scrollX, y*40+17+scrollY, 20, 10);
  2923. rect(x*40+7+scrollX, y*40+13+scrollY, 10, 20);
  2924. c = random(1, 500);
  2925. if(c>499&&world[y-1][x]===0&&world[y-2][x]===0&&world[y-3][x]===0&&world[y-2][x-1]===0&&world[y-2][x-2]===0&&world[y-2][x+2]===0&&world[y-2][x+1]===0&&world[y-3][x-2]===0&&world[y-3][x-1]===0&&world[y-3][x+1]===0&&world[y-3][x+2]===0&&world[y-4][x-2]===0&&world[y-4][x-1]===0&&world[y-4][x]===0&&world[y-4][x+1]===0&&world[y-4][x+2]===0&&world[y-5][x-1]===0&&world[y-5][x]===0&&world[y-5][x+1]===0){
  2926. //trunk
  2927. world[y][x]=7;
  2928. world[y-1][x]=7;
  2929. world[y-2][x]=7;
  2930. world[y-3][x]=7;
  2931. //leaves
  2932. world[y-2][x-1]=9;
  2933. world[y-2][x-2]=9;
  2934. world[y-2][x+1]=9;
  2935. world[y-2][x+2]=9;
  2936. world[y-3][x-1]=9;
  2937. world[y-3][x-2]=9;
  2938. world[y-3][x+1]=9;
  2939. world[y-3][x+2]=9;
  2940. world[y-4][x-1]=9;
  2941. world[y-4][x-2]=9;
  2942. world[y-4][x]=9;
  2943. world[y-4][x+1]=9;
  2944. world[y-4][x+2]=9;
  2945. world[y-5][x-1]=9;
  2946. world[y-5][x]=9;
  2947. world[y-5][x+1]=9;
  2948. }
  2949. if(world[y+1][x]===0||world[y+1][x]===11||world[y+1][x]===12||world[y+1][x]===13||world[y+1][x]===14||world[y+1][x]===16||world[y+1][x]===17){
  2950. world[y][x]=0;
  2951. }
  2952. break;
  2953. case 17:
  2954. if(!options.fireAnimation){
  2955. fill(173, 49, 0);
  2956. triangle(x*40+scrollX, y*40+40+scrollY, x*40+10+scrollX, y*40+10+scrollY,
  2957. x*40+20+scrollX, y*40+40+scrollY);
  2958. triangle(x*40+20+scrollX, y*40+40+scrollY, x*40+30+scrollX, y*40+10+scrollY,
  2959. x*40+40+scrollX, y*40+40+scrollY);
  2960. fill(227, 170, 0);
  2961. triangle(x*40+2+scrollX, y*40+40+scrollY, x*40+10+scrollX, y*40+18+scrollY,
  2962. x*40+16+scrollX, y*40+40+scrollY);
  2963. triangle(x*40+24+scrollX, y*40+40+scrollY, x*40+30+scrollX, y*40+18+scrollY,
  2964. x*40+36+scrollX, y*40+40+scrollY);}else{
  2965. drawFlame(x*40+scrollX-5, y*40+scrollY, 2.6);
  2966. }
  2967. if(world[y+1][x]===0||world[y+1][x]===11||world[y+1][x]===12||world[y+1][x]===13||world[y+1][x]===14||world[y+1][x]===16||world[y+1][x]===17){
  2968. world[y][x]=0;
  2969. }
  2970. if(world[y+1][x]===8&&world[y+1][x+1]===8&&world[y][x-1]===8&&world[y][x+2]===8&&world[y-1][x-1]===8&&world[y-1][x+2]===8&&world[y-2][x-1]===8&&world[y-2][x+2]===8&&world[y-3][x]===8&&world[y-3][x+1]===8){
  2971. world[y][x]=18;
  2972. world[y][x+1]=18;
  2973. world[y-1][x]=18;
  2974. world[y-1][x+1]=18;
  2975. world[y-2][x]=18;
  2976. world[y-2][x+1]=18;
  2977. }
  2978. if(world[y+1][x]===8&&world[y+1][x-1]===8&&world[y][x+1]===8&&world[y][x-2]===8&&world[y-1][x+1]===8&&world[y-1][x-2]===8&&world[y-2][x+1]===8&&world[y-2][x-2]===8&&world[y-3][x]===8&&world[y-3][x-1]===8){
  2979. world[y][x]=18;
  2980. world[y][x-1]=18;
  2981. world[y-1][x]=18;
  2982. world[y-1][x-1]=18;
  2983. world[y-2][x]=18;
  2984. world[y-2][x-1]=18;
  2985. }
  2986. c = random(0, 400);
  2987. if(c > 399&&world[y+1][x]!==19){
  2988. if(world[y+1][x]===7||world[y+1][x]===9||world[y+1][x]===5){
  2989. if(c<399.9){
  2990. world[y+1][x]=17;
  2991. }else{
  2992. world[y+1][x]=0;
  2993. }
  2994. }
  2995. world[y][x]=0;
  2996. }
  2997. break;
  2998. case 18:
  2999. fill(157, 0, 255);
  3000. rect(x*40+scrollX, y*40+scrollY, 40, 40);
  3001. if(world[y][x+1]===0||world[y][x-1]===0||world[y-1][x]===0||world[y+1][x]===0){
  3002. world[y][x]=0;
  3003. }
  3004. for(var i = 0; i < mobs.length; i++){
  3005. if(dist(mobs.x[i], mobs.y[i], x*40+20, y*40+20)<150 && !round(random(0, 2000))){
  3006. mobs.nether[i] = nether?false:true;
  3007. }
  3008. }
  3009. break;
  3010. case 19:
  3011. fill(99, 21, 2);
  3012. rect(x*40+scrollX, y*40+scrollY, 40, 40);
  3013. break;
  3014. case 20:
  3015. fill(255, 230, 166);
  3016. rect(x*40+scrollX, y*40+scrollY, 40, 40);
  3017. if(world[y+1][x]===0||world[y+1][x]===11||world[y+1][x]===12||world[y+1][x]===13||world[y+1][x]===14||world[y+1][x]===16||world[y+1][x]===17){
  3018. world[y][x]=0;
  3019. world[y+1][x]=20;
  3020. }
  3021. break;
  3022. case 21:
  3023. fill(136, 127, 140);
  3024. rect(x*40+scrollX, y*40+scrollY, 40, 40);
  3025. if(world[y+1][x]===0||world[y+1][x]===11||world[y+1][x]===12||world[y+1][x]===13||world[y+1][x]===14||world[y+1][x]===16||world[y+1][x]===17){
  3026. world[y][x]=0;
  3027. world[y+1][x]=21;
  3028. }
  3029. break;
  3030. case 22:
  3031. fill(122, 122, 122);
  3032. rect(x*40+scrollX, y*40+scrollY, 40, 40);
  3033. fill(0, 0, 0);
  3034. ellipse(x*40+10+scrollX, y*40+10+scrollY, 8, 8);
  3035. ellipse(x*40+28+scrollX, y*40+12+scrollY, 10, 10);
  3036. ellipse(x*40+20+scrollX, y*40+18+scrollY, 6, 6);
  3037. ellipse(x*40+10+scrollX, y*40+24+scrollY, 12, 8);
  3038. ellipse(x*40+28+scrollX, y*40+30+scrollY, 18, 14);
  3039. break;
  3040. case 23:
  3041. fill(122, 122, 122);
  3042. rect(x*40+scrollX, y*40+scrollY, 40, 40);
  3043. fill(191, 155, 82);
  3044. ellipse(x*40+10+scrollX, y*40+10+scrollY, 8, 8);
  3045. ellipse(x*40+28+scrollX, y*40+12+scrollY, 10, 10);
  3046. ellipse(x*40+20+scrollX, y*40+18+scrollY, 6, 6);
  3047. ellipse(x*40+10+scrollX, y*40+24+scrollY, 12, 8);
  3048. ellipse(x*40+28+scrollX, y*40+30+scrollY, 18, 14);
  3049. break;
  3050. case 24:
  3051. fill(122, 122, 122);
  3052. rect(x*40+scrollX, y*40+scrollY, 40, 40);
  3053. fill(255, 234, 0);
  3054. ellipse(x*40+10+scrollX, y*40+10+scrollY, 8, 8);
  3055. ellipse(x*40+28+scrollX, y*40+12+scrollY, 10, 10);
  3056. ellipse(x*40+20+scrollX, y*40+18+scrollY, 6, 6);
  3057. ellipse(x*40+10+scrollX, y*40+24+scrollY, 12, 8);
  3058. ellipse(x*40+28+scrollX, y*40+30+scrollY, 18, 14);
  3059. break;
  3060. case 25:
  3061. fill(122, 122, 122);
  3062. rect(x*40+scrollX, y*40+scrollY, 40, 40);
  3063. fill(0, 21, 255);
  3064. ellipse(x*40+10+scrollX, y*40+10+scrollY, 8, 8);
  3065. ellipse(x*40+28+scrollX, y*40+12+scrollY, 10, 10);
  3066. ellipse(x*40+20+scrollX, y*40+18+scrollY, 6, 6);
  3067. ellipse(x*40+10+scrollX, y*40+24+scrollY, 12, 8);
  3068. ellipse(x*40+28+scrollX, y*40+30+scrollY, 18, 14);
  3069. break;
  3070. case 26:
  3071. fill(122, 122, 122);
  3072. rect(x*40+scrollX, y*40+scrollY, 40, 40);
  3073. fill(0, 238, 255);
  3074. ellipse(x*40+10+scrollX, y*40+10+scrollY, 8, 8);
  3075. ellipse(x*40+28+scrollX, y*40+12+scrollY, 10, 10);
  3076. ellipse(x*40+20+scrollX, y*40+18+scrollY, 6, 6);
  3077. ellipse(x*40+10+scrollX, y*40+24+scrollY, 12, 8);
  3078. ellipse(x*40+28+scrollX, y*40+30+scrollY, 18, 14);
  3079. break;
  3080. case 27:
  3081. fill(201, 153, 80);
  3082. rect(x*40+scrollX, y*40+scrollY, 40, 40);
  3083. stroke(120, 83, 44);
  3084. strokeWeight(2);
  3085. line(x*40+scrollX, y*40+scrollY, x*40+40+scrollX, y*40+scrollY);
  3086. line(x*40+scrollX, y*40+10+scrollY, x*40+40+scrollX, y*40+10+scrollY);
  3087. line(x*40+scrollX, y*40+20+scrollY, x*40+40+scrollX, y*40+20+scrollY);
  3088. line(x*40+scrollX, y*40+30+scrollY, x*40+40+scrollX, y*40+30+scrollY);
  3089. line(x*40+scrollX, y*40+scrollY, x*40+scrollX, y*40+40+scrollY);
  3090. line(x*40+40+scrollX, y*40+scrollY, x*40+40+scrollX, y*40+40+scrollY);
  3091. fill(255, 230, 199);
  3092. triangle(x*40+2+scrollX, y*40+scrollY, x*40+20+scrollX, y*40+16+scrollY,
  3093. x*40+38+scrollX, y*40+scrollY);
  3094. stroke(122, 122, 122);
  3095. strokeWeight(4);
  3096. line(x*40+10+scrollX, y*40+20+scrollY, x*40+10+scrollX, y*40+34+scrollY);
  3097. line(x*40+30+scrollX, y*40+16+scrollY, x*40+30+scrollX, y*40+30+scrollY);
  3098. noStroke();
  3099. strokeWeight(2);
  3100. break;
  3101. case 28:
  3102. fill(201, 153, 80);
  3103. stroke(97, 58, 0);
  3104. if(specs[y][x]===0){
  3105. rect(x*40+scrollX, y*40+scrollY, 40, 40);
  3106. rect(x*40+5+scrollX, y*40+5+scrollY, 30, 30);
  3107. fill(66, 66, 66);
  3108. stroke(66, 66, 66);
  3109. ellipse(x*40+35+scrollX, y*40+scrollY, 3, 3);
  3110. strokeWeight(4);
  3111. line(x*40+35+scrollX, y*40+scrollY, x*40+30+scrollX, y*40+scrollY);
  3112. }else if(specs[y][x]===1){
  3113. rect(x*40+scrollX, y*40+scrollY, 10, 40);
  3114. }
  3115. strokeWeight(2);
  3116. break;
  3117. case 29:
  3118. fill(201, 153, 80);
  3119. stroke(97, 58, 0);
  3120. if(specs[y][x]===0){
  3121. rect(x*40+scrollX, y*40+scrollY, 40, 40);
  3122. rect(x*40+5+scrollX, y*40+5+scrollY, 30, 30);
  3123. }else if(specs[y][x]===1){
  3124. rect(x*40+scrollX, y*40+scrollY, 10, 40);
  3125. }
  3126. if(world[y+1][x]!==28){
  3127. world[y][x]=0;
  3128. }
  3129. break;
  3130. case 30:
  3131. fill(201, 153, 80);
  3132. stroke(120, 83, 44);
  3133. rect(x*40+scrollX, y*40+scrollY, 7, 40);
  3134. rect(x*40+33+scrollX, y*40+scrollY, 7, 40);
  3135. rect(x*40+scrollX, y*40+scrollY+10, 40, 7);
  3136. rect(x*40+scrollX, y*40+scrollY+30, 40, 7);
  3137. break;
  3138. case 31:
  3139. stroke(0);
  3140. line(x*40+scrollX, y*40+scrollY+5, x*40+scrollX+40, y*40+scrollY+5);
  3141. line(x*40+scrollX, y*40+scrollY+15, x*40+scrollX+40, y*40+scrollY+15);
  3142. line(x*40+scrollX, y*40+scrollY+25, x*40+scrollX+40, y*40+scrollY+25);
  3143. line(x*40+scrollX, y*40+scrollY+35, x*40+scrollX+40, y*40+scrollY+35);
  3144. fill(0, 130, 0);
  3145. noStroke();
  3146. rect(x*40+scrollX+2, y*40+scrollY, 36, 40);
  3147. if(world[y-(-1)][x]!==20&&world[y-(-1)][x]!==31){
  3148. world[y][x]=0;
  3149. spawnEntity(x*40+10, y*40+10, 0, 31);
  3150. }
  3151. break;
  3152. case 32:
  3153. fill(199, 230, 255);
  3154. rect(x*40+scrollX, y*40+scrollY, 40, 40);
  3155. stroke(255);
  3156. line(x*40+scrollX+10, y*40+scrollY+30,x*40+scrollX+20,y*40+scrollY+20);
  3157. line(x*40+scrollX+5, y*40+scrollY+15, x*40+scrollX+15, y*40+scrollY+5);
  3158. stroke(92, 171, 255);
  3159. line(x*40+scrollX+25, y*40+scrollY+35, x*40+scrollX+35, y*40+scrollY+25);
  3160. line(x*40+scrollX+20, y*40+scrollY+15, x*40+scrollX+30, y*40+scrollY+5);
  3161. break;
  3162. case 33:
  3163. fill(0);
  3164. strokeWeight(2);
  3165. stroke(71, 71, 71);
  3166. fill(120);
  3167. rect(x*40+scrollX, y*40+scrollY, 40, 20);
  3168. fill(0);
  3169. ellipse(x*40+scrollX+20,y*40+scrollY+20,30,25);
  3170. fill(168);
  3171. rect(x*40+scrollX, y*40+20+scrollY, 40, 20);
  3172. fill(0);
  3173. if(specs[y][x][3]>1){
  3174. if(specs[y][x][10]>0){
  3175. specs[y][x][3]-=0.5;
  3176. }
  3177. }else if(specs[y][x][3]>0){
  3178. if(specs[y][x][4]===15){
  3179. explode(x,y);
  3180. }
  3181. specs[y][x][7]=furnaceRecipes[specs[y][x][4]];
  3182. specs[y][x][8]++;
  3183. specs[y][x][5]--;
  3184. specs[y][x][3]-=1;
  3185. }else{
  3186. specs[y][x][3]=0;
  3187. if(furnaceRecipes[specs[y][x][4]]&&specs[y][x][10]>0){
  3188. specs[y][x][3]=50;
  3189. }
  3190. }
  3191. if(specs[y][x][1]<=0){
  3192. specs[y][x][0]=0;
  3193. }
  3194. if(specs[y][x][5]<=0){
  3195. specs[y][x][4]=0;
  3196. }
  3197. if(burnValues[specs[y][x][0]]!==null&&furnaceRecipes[specs[y][x][4]]!==null&&specs[y][x][10]===0){
  3198. specs[y][x][11]=burnValues[specs[y][x][0]];
  3199. specs[y][x][10]=burnValues[specs[y][x][0]]*5;
  3200. specs[y][x][1]--;
  3201. }
  3202. if(specs[y][x][10]>0){
  3203. fill(255, 0, 0);
  3204. specs[y][x][10]-=0.05;
  3205. }else{
  3206. fill(0);
  3207. }var d = [], e = [];
  3208. for(var i = 0; i < 4; i++){
  3209. d[i] = sin(i*60+90)*15+x*40+scrollX+20;
  3210. e[i] = cos(i*60+90)*17+y*40+scrollY+40;
  3211. }
  3212. if(!furnaceRecipes[specs[y][x][4]]){
  3213. specs[y][x][3]=50;
  3214. }
  3215. bezier(d[0],e[0],d[1],e[1],d[2],e[2],d[3],e[3]);
  3216. noStroke();
  3217. if(specs[y][x][10]<0){
  3218. specs[y][x][10]=0;
  3219. }
  3220. if(specs[y][x][10]>0){
  3221. for(var i = 3; i >= 0; i--){
  3222. fill(255, 255-i*55, 0);
  3223. for(var j = 0; j < 4; j++){
  3224. d[j] = sin(j*60+90)*(i*4-1)+x*40+scrollX+20;
  3225. e[j] = cos(j*60+90)*(i*4-1)+y*40+scrollY+40;
  3226. }
  3227. bezier(d[0],e[0],d[1],e[1],d[2],e[2],d[3],e[3]);
  3228. }}
  3229. break;
  3230. case 34:
  3231. fill(184, 133, 57);
  3232. stroke(120, 83, 44);
  3233. strokeWeight(2);
  3234. if(world[y][x-1]!==34){
  3235. if(world[y][x-(-1)]===34){
  3236. rect(x*40+scrollX+3, y*40+scrollY+5, 74, 35);
  3237. line(x*40+scrollX+5, y*40+10+scrollY+3, x*40+74+scrollX, y*40+10+scrollY+3);
  3238. line(x*40+scrollX+5, y*40+20+scrollY+3, x*40+74+scrollX, y*40+20+scrollY+3);
  3239. line(x*40+scrollX+5, y*40+30+scrollY+3, x*40+74+scrollX, y*40+30+scrollY+3);
  3240. if(onChest&&(x===blockTargeted[1]||x===blockTargeted[1]-1)&&y===blockTargeted[0]){
  3241. fill(184, 133, 57);
  3242. stroke(120, 83, 44);
  3243. rect(x*40+scrollX+3, y*40+scrollY-21, 74, 32);
  3244. fill(20);
  3245. rect(x*40+scrollX+7, y*40+scrollY-17, 66, 24);
  3246. fill(133, 73, 31);
  3247. rect(x*40+scrollX+37, y*40+scrollY+12, 6, 8);
  3248. fill(225);
  3249. stroke(200);
  3250. rect(x*40+scrollX+37, y*40+scrollY-24, 6, 4);
  3251. }else{
  3252. fill(225);
  3253. stroke(200);
  3254. rect(x*40+scrollX+37, y*40+scrollY+10, 6, 10);
  3255. }
  3256. }else{
  3257. rect(x*40+scrollX+3, y*40+scrollY+5, 34, 35);
  3258. line(x*40+scrollX+5, y*40+10+scrollY+3, x*40+34+scrollX, y*40+10+scrollY+3);
  3259. line(x*40+scrollX+5, y*40+20+scrollY+3, x*40+34+scrollX, y*40+20+scrollY+3);
  3260. line(x*40+scrollX+5, y*40+30+scrollY+3, x*40+34+scrollX, y*40+30+scrollY+3);
  3261. if(onChest&&x===blockTargeted[1]&&y===blockTargeted[0]){
  3262. rect(x*40+scrollX+3, y*40+scrollY-22, 34, 35);
  3263. fill(87, 59, 24);
  3264. rect(x*40+scrollX+6, y*40+scrollY-19, 28, 29);
  3265. fill(225);
  3266. stroke(200);
  3267. rect(x*40+scrollX+17, y*40+scrollY-24, 6, 4);
  3268. }else{
  3269. fill(225);
  3270. stroke(200);
  3271. rect(x*40+scrollX+17, y*40+scrollY+10, 6, 10);
  3272. }
  3273. }}
  3274. noStroke();
  3275. break;
  3276. case 35:
  3277. fill(122, 122, 122);
  3278. strokeWeight(2);
  3279. stroke(49, 105, 0);
  3280. rect(x*40+scrollX, y*40+scrollY, 20, 20);
  3281. rect(x*40+20+scrollX, y*40+scrollY, 20, 20);
  3282. rect(x*40+scrollX, y*40+20+scrollY, 20, 20);
  3283. rect(x*40+20+scrollX, y*40+20+scrollY, 20, 20);
  3284. noStroke();
  3285. fill(166, 194, 134);
  3286. triangle(x*40+scrollX+5, y*40+scrollY,
  3287. x*40+scrollX+13, y*40+scrollY,
  3288. x*40+scrollX+9, y*40+scrollY+15);
  3289. triangle(x*40+scrollX+25, y*40+scrollY+10,
  3290. x*40+scrollX+33, y*40+scrollY+10,
  3291. x*40+scrollX+29, y*40+scrollY+20);
  3292. triangle(x*40+scrollX+10, y*40+scrollY+25,
  3293. x*40+scrollX+20, y*40+scrollY+25,
  3294. x*40+scrollX+15, y*40+scrollY+40);
  3295. break;
  3296. case 36:
  3297. noStroke();
  3298. drawFlame(x*40+scrollX, y*40+scrollY+5, 2, 40);
  3299. fill(0, 64, 66);
  3300. rect(x*40+scrollX, y*40+scrollY, 5, 40);
  3301. rect(x*40+scrollX, y*40+scrollY, 40, 5);
  3302. rect(x*40+scrollX+35, y*40+scrollY, 5, 40);
  3303. rect(x*40+scrollX, y*40+scrollY+35, 40, 5);
  3304. stroke(0, 64, 66);
  3305. strokeWeight(3);
  3306. line(x*40+scrollX+10, y*40+scrollY+2, x*40+scrollX+10, y*40+scrollY+40);
  3307. line(x*40+scrollX+28, y*40+scrollY+2, x*40+scrollX+28, y*40+scrollY+40);
  3308. line(x*40+scrollX+2, y*40+scrollY+10, x*40+scrollX+35, y*40+scrollY+10);
  3309. line(x*40+scrollX+2, y*40+scrollY+28, x*40+scrollX+35, y*40+scrollY+28);
  3310. if(round(random(0, 100))){}else if(dist(x, y, posB, posA)<10){
  3311. spawnMobs(x*40+random(-120, 120), y*40-40, 2);
  3312. }
  3313. break;
  3314. case 37:
  3315. fill(230);
  3316. stroke(140);
  3317. rect(x*40+scrollX, y*40+scrollY, 40, 40);
  3318. break;
  3319. case 38:
  3320. fill(255, 234, 0);
  3321. stroke(209, 157, 0);
  3322. rect(x*40+scrollX, y*40+scrollY, 40, 40);
  3323. break;
  3324. case 39:
  3325. stroke(0, 148, 148);
  3326. fill(0, 255, 255);
  3327. rect(x*40+scrollX, y*40+scrollY, 40, 40);
  3328. break;
  3329. case 40:
  3330. fill(120, 83, 44);
  3331. var xx = x*40+scrollX, yy = y*40+scrollY;
  3332. if(solidBlocks[world[y+1][x]]){
  3333. rect(xx+16, yy+16, 8, 30);
  3334. fill(255, 251, 181);
  3335. rect(xx+16, yy+8, 8, 8);
  3336. }else if(solidBlocks[world[y][x-1]]){
  3337. quad(xx, yy+40, xx, yy+25, xx+5, yy+16, xx+13, yy+16);
  3338. fill(255, 251, 181);
  3339. quad(xx+13, yy+16, xx+5, yy+16, xx+9, yy+8, xx+18, yy+8);
  3340. }else if(solidBlocks[world[y][x+1]]){
  3341. quad(xx+40, yy+40, xx+40, yy+25, xx+35, yy+16, xx+27, yy+16);
  3342. fill(255, 251, 181);
  3343. quad(xx+27, yy+16, xx+35, yy+16, xx+31, yy+8, xx+22, yy+8);
  3344. }else{
  3345. world[y][x]=0;
  3346. spawnEntity(x*40+random(0,20), y*40+10, 0, 40);
  3347. }
  3348. break;
  3349. case 41:
  3350. fill(115, 255, 136);
  3351. rect(x*40+scrollX+3, y*40+scrollY, 5, 40);
  3352. rect(x*40+scrollX+13, y*40+scrollY, 5, 40);
  3353. rect(x*40+scrollX+23, y*40+scrollY, 5, 40);
  3354. rect(x*40+scrollX+33, y*40+scrollY, 5, 40);
  3355. if(((world[y-(-1)][x]!==20&&world[y-(-1)][x]!==2&&world[y-(-1)][x]!==3)||(world[y-(-1)][x-1]!==11&&world[y-(-1)][x-1]!==12&&world[y-(-1)][x-(-1)]!==11&&world[y-(-1)][x-(-1)]!==12))&&world[y-(-1)][x]!==41){
  3356. world[y][x]=0;
  3357. spawnEntity(x*40+random(0,20), y*40+10, 0, 41);
  3358. }
  3359. break;
  3360. default:
  3361. fill(234, 0, 255);
  3362. rect(x*40+scrollX, y*40+scrollY, 40, 40);
  3363. stroke(164, 0, 179);
  3364. strokeWeight(4);
  3365. line(x*40+scrollX+2, y*40+scrollY+2, x*40+scrollX+2, y*40+scrollY+37);
  3366. line(x*40+scrollX+2, y*40+scrollY+2, x*40+scrollX+37, y*40+scrollY+2);
  3367. strokeWeight(2);
  3368. }}}};
  3369. if(round(random(0, 1))){}else{
  3370. spawnMobs(2, abs(posX-200), abs(posY));
  3371. }
  3372. var keys = [];
  3373. var sunPos = 100;
  3374. //If there is one, retrieve a saved minecraft world from your browser
  3375. draw = function() {
  3376. try{
  3377. for(var i = 0; i < 80; i++){
  3378. flameY[i]-=flameSpeed[i]/3;
  3379. if(flameY[i]<random(0,5)){
  3380. flameY[i]=15;
  3381. flameX[i]=random(3,17);
  3382. }
  3383. }
  3384. //This loop can only function if you're alive
  3385. if(isDead===false&&bennimusStudios===false&&!onTitleScreen){
  3386. place = (scrollX/20) - (scrollX/10);
  3387. if(!heartsShowing){
  3388. sunPos--;
  3389. time++;
  3390. if(time > 10000){
  3391. night=true;
  3392. }else{
  3393. night=false;
  3394. }
  3395. if(time===20000){
  3396. time=0;
  3397. }
  3398. strokeWeight(2);
  3399. if(nether===false){
  3400. if(night){
  3401. background(10, 0, 56);
  3402. fill(255, 255, 255);
  3403. stroke(209, 209, 209);
  3404. strokeWeight(5);
  3405. if(time<=15000){
  3406. sunPos-=0.5;
  3407. rect(300, sunPos/70+100, 50, 50);
  3408. }else if(time>=15000){
  3409. sunPos=1000;
  3410. rect(300, (time-10800)/50-150, 50, 50);
  3411. }
  3412. }else{
  3413. if(time>0&&time<250){
  3414. background(255, 209, 94);
  3415. }else{
  3416. background(189, 206, 255);
  3417. }
  3418. fill(253, 255, 191);
  3419. stroke(255, 255, 255);
  3420. strokeWeight(5);
  3421. if(time<=5000){
  3422. sunPos-=0.5;
  3423. rect(300, sunPos/70+100, 50, 50);
  3424. }else if(time>=5000){
  3425. sunPos=1000;
  3426. rect(300, (time+3000)/50-150, 50, 50);
  3427. }
  3428. }
  3429. }else{
  3430. background(173, 43, 0);
  3431. }
  3432. }else{
  3433. background(10, 0, 56);
  3434. if(shieldsShowing===false){
  3435. shieldsShowing=1000;
  3436. }else{
  3437. shieldsShowing--;
  3438. if(shieldsShowing<0){
  3439. heartsShowing=false;
  3440. shieldsShowing=false;
  3441. onFire=true;
  3442. }
  3443. strokeWeight(5);
  3444. fill(255, 255, 255);
  3445. stroke(184, 184, 184);
  3446. rect(300, 400-(shieldsShowing/10)-200, 50, 50);
  3447. }
  3448. }
  3449. strokeWeight(2);
  3450. noStroke();
  3451. if(pigmanTimer>0){
  3452. madPigmen=true;
  3453. pigmanTimer--;
  3454. }else{
  3455. madPigmen=false;
  3456. }
  3457. if(!nether&&options.clouds){
  3458. if(cloudX>400){
  3459. cloudX=0;
  3460. }
  3461. fill(255);
  3462. if(night){
  3463. fill(38, 21, 84);
  3464. }else if(time<250){
  3465. fill(250, 232, 205);
  3466. }
  3467. cloudX+=0.25;
  3468. rect(cloudX+150, 15, 125, 15);
  3469. rect(cloudX-250, 15, 125, 15);
  3470. rect(cloudX+200, 35, 180, 30);
  3471. rect(cloudX-200, 35, 180, 30);
  3472. rect(cloudX-300, 30, 170, 20);
  3473. rect(cloudX+100, 30, 170, 20);
  3474. }
  3475. drawWorld();
  3476. var x = blockTargeted[1], y = blockTargeted[0];
  3477. if(x===blockTargeted[1]&&y===blockTargeted[0]&&blockStrength!==null){
  3478. if(blockStrength<(selDurability/7)*6){
  3479. stroke(0);strokeWeight(3);
  3480. line(x*40+scrollX+20, y*40+scrollY+20, x*40+scrollX+11, y*40+scrollY+37);
  3481. if(blockStrength<(selDurability/7)*5){
  3482. line(x*40+scrollX+20, y*40+scrollY+20, x*40+scrollX+35, y*40+scrollY+11);
  3483. if(blockStrength<(selDurability/7)*4){
  3484. line(x*40+scrollX+28, y*40+scrollY+15, x*40+scrollX+33, y*40+scrollY+34);
  3485. }
  3486. if(blockStrength<(selDurability/7)*3){
  3487. line(x*40+scrollX+6, y*40+scrollY+15, x*40+scrollX+20, y*40+scrollY+20);
  3488. }
  3489. if(blockStrength<(selDurability/7)*2){
  3490. line(x*40+scrollX+14, y*40+scrollY+17, x*40+scrollX+20, y*40+scrollY+7);
  3491. }
  3492. if(blockStrength<(selDurability/7)){
  3493. line(x*40+scrollX+25, y*40+scrollY+27, x*40+scrollX+14, y*40+scrollY+32);
  3494. }
  3495. }strokeWeight(2);
  3496. }}
  3497. var entX,entY,entA,entB;
  3498. for(var tt = 0; tt < entity.length; tt++){
  3499. entX=entity.x[tt]+scrollX;
  3500. entY=entity.y[tt]+scrollY;
  3501. entA=(entity.y[tt]/40).toFixed(0,0);
  3502. entB=(entity.x[tt]/40).toFixed(0,0);
  3503. switch(entity.type[tt]){
  3504. case 0:
  3505. var distance = dist(entB, entA, posB, posA);
  3506. drawBlocks(entity.type2[tt], entX, entY);
  3507. if(!solidBlocks[world[entA][entB]]){
  3508. entity.y[tt]+=5;
  3509. }
  3510. if(distance<2){
  3511. entity.type[tt]=null;
  3512. getItem(entity.type2[tt], 1);
  3513. }
  3514. break;
  3515. case 1:
  3516. drawBlocks(340, entX, entY);
  3517. entity.type2[tt]++;
  3518. entity.y[tt]-=entity.type2[tt];
  3519. if(entity.type2[tt]>=20){
  3520. for(var i = 0; i < 100; i++){
  3521. spawnEntity(entX, entY, 2, [random(0,360),random(1,5),500]);
  3522. }
  3523. fill(random(50,255), random(50,255), random(50,255), 50);
  3524. ellipse(entX, entY, 100, 100);
  3525. entity.type[tt]=null;
  3526. }
  3527. break;
  3528. case 2:
  3529. fill(random(50,255), random(50,255), random(50,255), entity.type2[tt][2]);
  3530. ellipse(entX-scrollX, entY-scrollY, 5, 5);
  3531. entity.x[tt]+=sin(entity.type2[tt][0])*entity.type2[tt][1];
  3532. entity.y[tt]+=cos(entity.type2[tt][0])*entity.type2[tt][1];
  3533. if(entity.type2[tt][2]>0){
  3534. entity.type2[tt][2]-=10;
  3535. }else{
  3536. entity.type[tt]=null;
  3537. }
  3538. break;
  3539. }
  3540. }
  3541. if(nether){
  3542. if(round(random(0,100))){}else if(!options.peaceful){
  3543. spawnMobs(random(0, (world[0].length-1)*40), 12*40, 4);
  3544. }
  3545. }else{
  3546. if(round(random(0,500))){}else{
  3547. spawnMobs(random(0, (world[0].length-1)*40), 12*40, 0);
  3548. }if(round(random(0,100))){}else if(night&&!options.peaceful){
  3549. spawnMobs(random(0, (world[0].length-1)*40), 12*40, 1);
  3550. }if(round(random(0,500))){}else{
  3551. spawnMobs(random(0, (world[0].length-1)*40), 12*40, 3);
  3552. }if(round(random(0,100))){}else if(night&&!options.peaceful){
  3553. spawnMobs(random(0, (world[0].length-1)*40), 440, 2);
  3554. }
  3555. }
  3556. var mobX,mobY,mobA,mobB;
  3557. for(var s = 0; s < mobs.length; s++){
  3558. mobX=mobs.x[s];
  3559. mobY=mobs.y[s];
  3560. mobA = (mobY/40).toFixed(0, 0);
  3561. mobB = (mobX/40).toFixed(0, 0);
  3562. if(mobs.nether[s]===nether&&dist(mobB,mobA,posB,posA)<10){
  3563. if(mobs.health[s]>0){
  3564. switch(mobs.type[s]){
  3565. case 0:
  3566. noStroke();
  3567. fill(255, 181, 181);
  3568. resetMatrix();
  3569. if(mobs.direction[s]===RIGHT){
  3570. translate(mobs.x[s]+scrollX+20, mobs.y[s]+scrollY+40);
  3571. if(mobs.state[s]!==0){
  3572. rotate(sin(time*30)*15);
  3573. }
  3574. fill(179, 127, 127);
  3575. rect(-5, 0, 10, 15);
  3576. resetMatrix();
  3577. translate(mobs.x[s]+scrollX-10, mobs.y[s]+scrollY+40);
  3578. if(mobs.state[s]!==0){
  3579. rotate(-sin(time*30)*15);
  3580. }
  3581. rect(-5, 0, 10, 15);
  3582. resetMatrix();
  3583. fill(255, 181, 181);
  3584. rect(mobs.x[s]+scrollX-15, mobs.y[s]+scrollY+25, 40, 20);
  3585. translate(mobs.x[s]+scrollX-10, mobs.y[s]+scrollY+40);
  3586. if(mobs.state[s]!==0){
  3587. rotate(sin(time*30)*15);
  3588. }
  3589. rect(-5, 0, 10, 15);
  3590. resetMatrix();
  3591. translate(mobs.x[s]+scrollX+20, mobs.y[s]+scrollY+40);
  3592. if(mobs.state[s]!==0){
  3593. rotate(-sin(time*30)*15);
  3594. }
  3595. rect(-5, 0, 10, 15);
  3596. }else{
  3597. translate(mobs.x[s]+scrollX+20, mobs.y[s]+scrollY+40);
  3598. if(mobs.state[s]!==0){
  3599. rotate(sin(time*30)*15);
  3600. }
  3601. fill(179, 127, 127);
  3602. rect(-5, 0, 10, 15);
  3603. resetMatrix();
  3604. translate(mobs.x[s]+scrollX-10, mobs.y[s]+scrollY+40);
  3605. if(mobs.state[s]!==0){
  3606. rotate(-sin(time*30)*15);
  3607. }
  3608. rect(-5, 0, 10, 15);
  3609. resetMatrix();
  3610. fill(255, 181, 181);
  3611. rect(mobs.x[s]+scrollX-15, mobs.y[s]+scrollY+25, 40, 20);
  3612. translate(mobs.x[s]+scrollX-10, mobs.y[s]+scrollY+40);
  3613. if(mobs.state[s]!==0){
  3614. rotate(sin(time*30)*15);
  3615. }
  3616. rect(-5, 0, 10, 15);
  3617. resetMatrix();
  3618. translate(mobs.x[s]+scrollX+20, mobs.y[s]+scrollY+40);
  3619. if(mobs.state[s]!==0){
  3620. rotate(-sin(time*30)*15);
  3621. }
  3622. rect(-5, 0, 10, 15);
  3623. }
  3624. resetMatrix();
  3625. if(dist(mobB, mobA, posB, posA)<4){
  3626. var x = posX - posX*2 + 195;
  3627. var y = posY - posY*2 + 135;
  3628. if(mobs.direction[s]===LEFT){
  3629. translate(mobX+scrollX-10, mobY+scrollY+30);
  3630. }else{
  3631. translate(mobX+scrollX+25, mobY+scrollY+30);
  3632. }
  3633. rotate(atan2(mobY-y, mobX-x));
  3634. rect(-10, -10, 20, 20);
  3635. if(posB<mobB){
  3636. rect(-14, -2, 6, 8);
  3637. fill(255);
  3638. rect(-10, -6, 5, 3);
  3639. fill(0);
  3640. rect(-8, -6, 3, 3);
  3641. if(mobs.state[s]===0){
  3642. mobs.direction[s]=LEFT;
  3643. }
  3644. }else{
  3645. rect(-14, -6, 6, 8);
  3646. fill(255);
  3647. rect(-10, 3, 5, 3);
  3648. fill(0);
  3649. rect(-8, 3, 3, 3);
  3650. if(mobs.state[s]===0){
  3651. mobs.direction[s]=RIGHT;
  3652. }
  3653. }
  3654. }else{
  3655. if(mobs.direction===LEFT){
  3656. translate(mobX+scrollX+10, mobY+scrollY+30);
  3657. }else{
  3658. translate(mobX+scrollX-10, mobY+scrollY+30);
  3659. }
  3660. if(direction===RIGHT){
  3661. scale(-1, 1);
  3662. }
  3663. mobs.headPos[s]=0;
  3664. rect(-10, -10, 20, 20);
  3665. rect(-14, -2, 6, 8);
  3666. fill(255);
  3667. rect(-10, -6, 5, 3);
  3668. fill(0);
  3669. rect(-8, -6, 3, 3);
  3670. }
  3671. resetMatrix();
  3672. if(round(random(0,100))){}else{
  3673. mobs.state[s]=round(random(0,2)+0.5);
  3674. }if(round(random(0,25))){}else{
  3675. mobs.state[s]=0;
  3676. }
  3677. if(mobs.state[s]!==0){
  3678. mobs.legPos[s] = sin(time)*10;
  3679. }
  3680. if(!solidBlocks[world[mobA-(-1)][mobB]]&&world[mobA-(-1)][mobB]!==11&&world[mobA-(-1)][mobB]!==12){
  3681. mobs.y[s]+=10;
  3682. }
  3683. break;
  3684. case 1:
  3685. if(options.peaceful){
  3686. mobs.health[s]=0;
  3687. }
  3688. noStroke();
  3689. translate(mobs.x[s]+scrollX+10, mobs.y[s]+scrollY+40);
  3690. if(mobs.state[s]!==0){
  3691. rotate(sin(time*30)*15);
  3692. }
  3693. fill(0, 100, 0);
  3694. rect(-5, 0, 10, 15);
  3695. resetMatrix();
  3696. translate(mobs.x[s]+scrollX-10, mobs.y[s]+scrollY+40);
  3697. if(mobs.state[s]!==0){
  3698. rotate(-sin(time*30)*15);
  3699. }
  3700. rect(-5, 0, 10, 15);
  3701. resetMatrix();
  3702. fill(0, 255, 0);
  3703. rect(mobs.x[s]+scrollX-7, mobs.y[s]+scrollY, 14, 40);
  3704. translate(mobs.x[s]+scrollX-10, mobs.y[s]+scrollY+40);
  3705. if(mobs.state[s]!==0){
  3706. rotate(sin(time*30)*15);
  3707. }
  3708. rect(-5, 0, 10, 15);
  3709. resetMatrix();
  3710. translate(mobs.x[s]+scrollX+10, mobs.y[s]+scrollY+40);
  3711. if(mobs.state[s]!==0){
  3712. rotate(-sin(time*30)*15);
  3713. }
  3714. rect(-5, 0, 10, 15);
  3715. resetMatrix();
  3716. if(dist(mobB, mobA, posB, posA)<10){
  3717. var x = posX - posX*2 + 195;
  3718. var y = posY - posY*2 + 135;
  3719. translate(mobX+scrollX, mobY+scrollY);
  3720. rotate(atan2(mobY-y, mobX-x));
  3721. rect(-10, -10, 20, 20);
  3722. if(posB<mobB){
  3723. fill(0);
  3724. rect(-8, -6, 5, 5);
  3725. if(mobs.state[s]===0){
  3726. mobs.direction[s]=LEFT;
  3727. }
  3728. }else{
  3729. fill(0);
  3730. rect(-10, 1, 5, 5);
  3731. if(mobs.state[s]===0){
  3732. mobs.direction[s]=RIGHT;
  3733. }
  3734. }
  3735. }else{
  3736. translate(mobX+scrollX, mobY+scrollY);
  3737. if(direction===RIGHT){
  3738. scale(-1, 1);
  3739. }
  3740. mobs.headPos[s]=0;
  3741. rect(-10, -10, 20, 20);
  3742. fill(0);
  3743. rect(-8, -6, 3, 3);
  3744. }
  3745. resetMatrix();
  3746. if(round(random(0,100))){}else{
  3747. mobs.state[s]=round(random(0,2)+0.5);
  3748. }if(round(random(0,50))){}else{
  3749. mobs.state[s]=0;
  3750. }
  3751. if(!solidBlocks[world[mobA-(-1)][mobB]]&&world[mobA-(-1)][mobB]!==11&&world[mobA-(-1)][mobB]!==12){
  3752. mobs.y[s]+=10;
  3753. }
  3754. if(dist(mobB, mobA, posB, posA)<10){
  3755. if(mobB<posB){
  3756. mobs.state[s] = 1;
  3757. }else{
  3758. mobs.state[s] = 2;
  3759. }
  3760. }
  3761. if(dist(mobB, mobA, posB, posA)<2){
  3762. explode(mobB, mobA);
  3763. mobs.health[s]=0;
  3764. }
  3765. break;
  3766. case 2:
  3767. if(!night){
  3768. mobs.health[s]-=0.1;
  3769. drawFlame(mobX+scrollX-20, mobY+scrollY-20, 3);
  3770. }
  3771. if(options.peaceful){
  3772. mobs.health[s]=0;
  3773. }
  3774. noStroke();
  3775. resetMatrix();
  3776. var playerX = scrollX+mobX, playerY = scrollY+mobY-20;
  3777. if(mouseX>playerX){
  3778. direction=LEFT;
  3779. }else{
  3780. direction=RIGHT;
  3781. }
  3782. if(mobs.state[s]!==0){
  3783. legPos = sin(time*30)*30;
  3784. }else{
  3785. legPos = 0;
  3786. }
  3787. translate(playerX+10, playerY+50);
  3788. rotate(-legPos);
  3789. fill(15, 0, 110);
  3790. rect(-6, 0, 12, 30);
  3791. resetMatrix();
  3792. fill(0, 135, 9);
  3793. translate(playerX, playerY);
  3794. if(mobs.direction[s]===LEFT){
  3795. scale(-1, 1);
  3796. translate(-20, 0);
  3797. }
  3798. rect(0, 0, 20, 20);
  3799. fill(4, 82, 0);
  3800. triangle(0, 0+5, 0+15, 0+5, 0, 0+10);
  3801. rect(0, 0, 20, 5);
  3802. fill(33, 33, 33);
  3803. rect(0+15, 0+7, 5, 3);
  3804. fill(0, 201, 201);
  3805. rect(0+4, 0+20, 12, 30);
  3806. noStroke();
  3807. resetMatrix();
  3808. translate(playerX+10, playerY+50);
  3809. rotate(legPos);
  3810. fill(23, 0, 156);
  3811. rect(-6, 0, 12, 30);
  3812. resetMatrix();
  3813. translate(playerX+10, playerY+22);
  3814. fill(0, 189, 189);
  3815. rect(-5, 0, 10, 10);
  3816. fill(0, 120, 4);
  3817. if(mobs.direction[s]===LEFT){
  3818. rect(-25, 0, 20, 10);
  3819. }else{
  3820. rect(5, 0, 20, 10);
  3821. }
  3822. resetMatrix();
  3823. if(!night){
  3824. drawFlame(mobX+scrollX-20, mobY+scrollY+5, 3);
  3825. }
  3826. if(dist(mobB, mobA, posB, posA)<10){
  3827. if(mobB<posB){
  3828. mobs.direction=RIGHT;
  3829. }else{
  3830. mobs.direction=LEFT;
  3831. }
  3832. }
  3833. if(dist(mobB, mobA, posB, posA)<10){
  3834. if(posB<mobB){
  3835. mobs.state[s]=2;
  3836. }else{
  3837. mobs.state[s]=1;
  3838. }
  3839. if(dist(mobB, mobA, posB, posA)<1){
  3840. health-=3;
  3841. }
  3842. }
  3843. if(round(random(0,100))){}else{
  3844. mobs.state[s]=round(random(0,2)+0.5);
  3845. }if(round(random(0,50))){}else{
  3846. mobs.state[s]=0;
  3847. }
  3848. if(!solidBlocks[world[mobA-(-1)][mobB]]&&world[mobA-(-1)][mobB]!==11&&world[mobA-(-1)][mobB]!==12){
  3849. mobs.y[s]+=10;
  3850. }
  3851. break;
  3852. case 3:
  3853. noStroke();
  3854. fill(255, 181, 181);
  3855. resetMatrix();
  3856. translate(mobs.x[s]+scrollX+20, mobs.y[s]+scrollY+25);
  3857. if(mobs.state[s]!==0){
  3858. rotate(sin(time*30)*15);
  3859. }
  3860. fill(48, 25, 0);
  3861. rect(-5, 0, 10, 30);
  3862. resetMatrix();
  3863. translate(mobs.x[s]+scrollX-10, mobs.y[s]+scrollY+25);
  3864. if(mobs.state[s]!==0){
  3865. rotate(-sin(time*30)*15);
  3866. }
  3867. rect(-5, 0, 10, 30);
  3868. resetMatrix();
  3869. fill(97, 50, 0);
  3870. rect(mobs.x[s]+scrollX-15, mobs.y[s]+scrollY+10, 40, 25);
  3871. fill(200);
  3872. arc(mobs.x[s]+scrollX, mobs.y[s]+scrollY+10, 20, 15, 0, 180);
  3873. arc(mobs.x[s]+scrollX+5, mobs.y[s]+scrollY+35, 15, 15, 180, 360);
  3874. fill(97, 50, 0);
  3875. translate(mobs.x[s]+scrollX-10, mobs.y[s]+scrollY+25);
  3876. if(mobs.state[s]!==0){
  3877. rotate(sin(time*30)*15);
  3878. }
  3879. rect(-5, 0, 10, 30);
  3880. resetMatrix();
  3881. translate(mobs.x[s]+scrollX+20, mobs.y[s]+scrollY+25);
  3882. if(mobs.state[s]!==0){
  3883. rotate(-sin(time*30)*15);
  3884. }
  3885. rect(-5, 0, 10, 30);
  3886. resetMatrix();
  3887. if(dist(mobB, mobA, posB, posA)<4){
  3888. var x = posX - posX*2 + 195;
  3889. var y = posY - posY*2 + 135;
  3890. if(mobs.direction[s]===LEFT){
  3891. translate(mobX+scrollX-10, mobY+scrollY+15);
  3892. }else{
  3893. translate(mobX+scrollX+25, mobY+scrollY+15);
  3894. }
  3895. rotate(atan2(mobY-y, mobX-x));
  3896. rect(-10, -10, 20, 20);
  3897. if(posB<mobB){
  3898. fill(50);
  3899. rect(-10,0,6,10);
  3900. fill(100);
  3901. rect(-6, -12, 3, 4);
  3902. fill(255);
  3903. rect(-10, -6, 5, 3);
  3904. fill(0);
  3905. rect(-8, -6, 3, 3);
  3906. if(mobs.state[s]===0){
  3907. mobs.direction[s]=LEFT;
  3908. }
  3909. }else{
  3910. fill(50);
  3911. rect(-10,-10,6,10);
  3912. fill(100);
  3913. rect(-6, 8, 3, 4);
  3914. fill(255);
  3915. rect(-10, 3, 5, 3);
  3916. fill(0);
  3917. rect(-8, 3, 3, 3);
  3918. if(mobs.state[s]===0){
  3919. mobs.direction[s]=RIGHT;
  3920. }
  3921. }
  3922. }else{
  3923. if(mobs.direction===LEFT){
  3924. translate(mobX+scrollX+10, mobY+scrollY+15);
  3925. }else{
  3926. translate(mobX+scrollX-10, mobY+scrollY+15);
  3927. }
  3928. if(direction===RIGHT){
  3929. scale(-1, 1);
  3930. }
  3931. mobs.headPos[s]=0;
  3932. rect(-10, -10, 20, 20);
  3933. fill(50);
  3934. rect(-10,0,6,10);
  3935. fill(100);
  3936. rect(-6, -12, 3, 4);
  3937. fill(255);
  3938. rect(-10, -6, 5, 3);
  3939. fill(0);
  3940. rect(-8, -6, 3, 3);
  3941. }
  3942. resetMatrix();
  3943. if(round(random(0,100))){}else{
  3944. mobs.state[s]=round(random(0,2)+0.5);
  3945. }if(round(random(0,50))){}else{
  3946. mobs.state[s]=0;
  3947. }
  3948. if(!solidBlocks[world[mobA-(-1)][mobB]]&&world[mobA-(-1)][mobB]!==11&&world[mobA-(-1)][mobB]!==12){
  3949. mobs.y[s]+=10;
  3950. }
  3951. if(dist(mobB, mobA, b, a)===0&&mouseIsPressed&&mouseButton===RIGHT&&hotbar[blockSelected]===337){
  3952. if(hotbarStacks[blockSelected]===1){
  3953. hotbar[blockSelected]=338;
  3954. }else{
  3955. hotbarStacks[blockSelected]--;
  3956. getItem(338, 1);
  3957. }
  3958. mouseIsPressed=false;
  3959. }
  3960. break;
  3961. case 4:
  3962. if(options.peaceful){
  3963. mobs.health[s]=0;
  3964. }
  3965. noStroke();
  3966. resetMatrix();
  3967. var playerX = scrollX+mobX, playerY = scrollY+mobY-20;
  3968. if(mouseX>playerX){
  3969. direction=LEFT;
  3970. }else{
  3971. direction=RIGHT;
  3972. }
  3973. if(mobs.state[s]!==0){
  3974. legPos = sin(time*30)*30;
  3975. }else{
  3976. legPos = 0;
  3977. }
  3978. translate(playerX+10, playerY+50);
  3979. rotate(-legPos);
  3980. fill(255, 107, 102);
  3981. rect(-6, 0, 12, 30);
  3982. resetMatrix();
  3983. fill(255, 127, 125);
  3984. translate(playerX, playerY);
  3985. if(mobs.direction[s]===LEFT){
  3986. scale(-1, 1);
  3987. translate(-20, 0);
  3988. }
  3989. rect(0, 0, 20, 20);
  3990. fill(33, 33, 33);
  3991. rect(15, 7, 5, 3);
  3992. fill(255, 127, 125);
  3993. rect(0+4, 0+20, 12, 30);
  3994. noStroke();
  3995. resetMatrix();
  3996. translate(playerX+10, playerY+50);
  3997. rotate(legPos);
  3998. fill(255, 127, 125);
  3999. rect(-6, 0, 12, 30);
  4000. resetMatrix();
  4001. translate(playerX+10, playerY+22);
  4002. fill(255, 127, 125);
  4003. rect(-5, 0, 10, 10);
  4004. fill(255, 127, 125);
  4005. if(mobs.direction[s]===LEFT){
  4006. rect(-25, 0, 20, 10);
  4007. translate(-35,-15);
  4008. rotate(-45);
  4009. drawBlocks(315, 0, 0);
  4010. }else{
  4011. rect(5, 0, 20, 10);
  4012. translate(10, -15);
  4013. rotate(-45);
  4014. drawBlocks(315, 0, 0);
  4015. }
  4016. resetMatrix();
  4017. if(dist(mobB, mobA, posB, posA)<10){
  4018. if(mobB<posB){
  4019. mobs.direction=RIGHT;
  4020. }else{
  4021. mobs.direction=LEFT;
  4022. }
  4023. }
  4024. if(dist(mobB, mobA, posB, posA)<10&&madPigmen){
  4025. if(posB<mobB){
  4026. mobs.state[s]=2;
  4027. }else{
  4028. mobs.state[s]=1;
  4029. }
  4030. if(dist(mobB, mobA, posB, posA)<1){
  4031. health-=9;
  4032. }
  4033. }
  4034. if(round(random(0,100))){}else{
  4035. mobs.state[s]=round(random(0,2)+0.5);
  4036. }if(round(random(0,50))){}else{
  4037. mobs.state[s]=0;
  4038. }
  4039. if(!solidBlocks[world[mobA-(-1)][mobB]]&&world[mobA-(-1)][mobB]!==11&&world[mobA-(-1)][mobB]!==12){
  4040. mobs.y[s]+=10;
  4041. }
  4042. break;
  4043. }
  4044. switch(mobs.state[s]){
  4045. case 1:
  4046. if(!solidBlocks[world[mobA][mobB]]){
  4047. mobs.x[s]+=3;
  4048. }
  4049. break;
  4050. case 2:
  4051. if(!solidBlocks[world[mobA][mobB-1]]){
  4052. mobs.x[s]-=3;
  4053. }
  4054. break;
  4055. }
  4056. if((world[mobA-(-1)][mobB]===11||world[mobA-(-1)][mobB]===12||world[mobA][mobB]===11||world[mobA][mobB]===12)){
  4057. mobs.y[s]-=2;
  4058. }
  4059. if(dist(mobB, mobA, b, a)===0&&mouseIsPressed&&mouseButton===LEFT){
  4060. if(mobs.type[s]===4){
  4061. pigmanTimer=5000;
  4062. }
  4063. mobs.health[s]--;
  4064. if(mobB<posB){
  4065. mobs.x[s]-=5;
  4066. }else{
  4067. mobs.x[s]+=5;
  4068. }
  4069. mobs.y[s]-=10;
  4070. mouseIsPressed=false;
  4071. if(hotbar[blockSelected]>311&&hotbar[blockSelected]<317){
  4072. hotbarSpecs[blockSelected]--;
  4073. mobs.health[s]-=(hotbar[blockSelected]-310)*2;
  4074. }
  4075. if(mobs.health[s]<=0){
  4076. switch(mobs.type[s]){
  4077. case 0:
  4078. for(var i = 0; i < random(0,3); i++){
  4079. spawnEntity(mobs.x[s]+random(0, 40), mobs.y[s]+20, 0, 317);
  4080. }
  4081. break;
  4082. case 1:
  4083. for(var i = 0; i < random(0,3); i++){
  4084. spawnEntity(mobs.x[s]+random(0, 40), mobs.y[s]+20, 0, 318);
  4085. }
  4086. break;
  4087. case 2:
  4088. spawnEntity(mobs.x[s]+random(0, 40), mobs.y[s]+20, 0, 319);
  4089. if(!round(random(0,40))){
  4090. if(round(random(0,5))){
  4091. spawnEntity(mobs.x[s]+random(0, 40), mobs.y[s]+20, 0, 302);
  4092. }else{
  4093. spawnEntity(mobs.x[s]+random(0, 40), mobs.y[s]+20, 0, 316);
  4094. }
  4095. }
  4096. break;
  4097. case 3:
  4098. for(var i = 0; i < random(0,3); i++){
  4099. spawnEntity(mobs.x[s]+random(0, 40), mobs.y[s]+20, 0, 336);
  4100. }
  4101. break;
  4102. case 4:
  4103. for(var i = 0; i < random(0,3); i++){
  4104. spawnEntity(mobs.x[s]+random(0, 40), mobs.y[s]+20, 0, 319);
  4105. }
  4106. for(var i = 0; i < round(random(0,1)); i++){
  4107. spawnEntity(mobs.x[s]+random(0, 40), mobs.y[s]+20, 0, 303);
  4108. }
  4109. if(!round(random(0,40))){
  4110. spawnEntity(mobs.x[s]+random(0, 40), mobs.y[s]+20, 0, 315);
  4111. }
  4112. break;
  4113. }
  4114. }
  4115. }
  4116. }}}
  4117. //You
  4118. posA = (posY/40 - posY/20 + 4).toFixed(0, 0);
  4119. posB = (posX/40 - posX/20 + 5).toFixed(0, 0);
  4120. posA2 = ((posY-30)/40 - (posY-30)/20).toFixed(0, 0);
  4121. posB2 = ((posX+30)/40 - (posX+30)/20 + 5).toFixed(0, 0);
  4122. fall = 20;
  4123. if(inWater||world[posA][posB]===11||world[posA][posB]===12||world[posA][posB2]===11||world[posA][posB2]===12){
  4124. minJump = 18;
  4125. }else if(inLava){
  4126. minJump = 19;
  4127. }else{
  4128. minJump = 0;
  4129. }
  4130. if(jump > minJump){
  4131. jump--;
  4132. }
  4133. if(jump < minJump){
  4134. jump++;
  4135. }
  4136. if (world[posA-1][posB]===11||world[posA-1][posB]===12||world[posA2][posB]===11||world[posA2][posB]===12){
  4137. inWater = true;
  4138. }else{
  4139. inWater = false;
  4140. }
  4141. playerSpeed = 8;
  4142. if (world[posA][posB]===13||world[posA][posB]===14){
  4143. onFire = true;
  4144. inLava = true;
  4145. }else{
  4146. inLava = false;
  4147. }
  4148. if(world[posA][posB]===17){
  4149. onFire = true;
  4150. }
  4151. if(!solidBlocks[world[posA-(-1)][posB]]&&!solidBlocks[world[posA-(-1)][posB2]]){
  4152. if(fallTix>10){
  4153. blocksFallen++;
  4154. }
  4155. posY -= fall - jump;
  4156. }else{
  4157. jump=20;
  4158. if(blocksFallen>5){
  4159. health-=blocksFallen*2;
  4160. }
  4161. blocksFallen=0;
  4162. fallTix=0;
  4163. }
  4164. //to prevent infinity health hax
  4165. if(health>20){
  4166. health=20;
  4167. }
  4168. if(inWater){
  4169. onFire=false;
  4170. }
  4171. noStroke();
  4172. resetMatrix();
  4173. var playerX = scrollX-posX+195, playerY = scrollY-posY+135;
  4174. if(onFire){
  4175. drawFlame(playerX-18, playerY+30, 3);
  4176. c = random(0, 400);
  4177. if(c>399.5){
  4178. onFire=false;
  4179. }
  4180. if(fireTix<10){
  4181. fireTix++;
  4182. }else{
  4183. health--;
  4184. fireTix=0;
  4185. }
  4186. }
  4187. if(mouseX>playerX){
  4188. direction=LEFT;
  4189. }else{
  4190. direction=RIGHT;
  4191. }
  4192. if(keys[65]||keys[68]){
  4193. legPos = sin(time*30)*30;
  4194. armPos = sin(time*30)*15;
  4195. }else{
  4196. legPos = 0;
  4197. if(!mouseIsPressed){
  4198. armPos=0;
  4199. }
  4200. }
  4201. if(solidBlocks[world[posA2-(-2)][posB]]||solidBlocks[world[posA2-(-2)][posB2]]){
  4202. jump = 18;
  4203. }
  4204. translate(playerX+10, playerY+50);
  4205. rotate(-legPos);
  4206. fill(15, 0, 110);
  4207. rect(-6, 0, 12, 30);
  4208. if(armorSlots[2]>0){
  4209. switch(armorSlots[2]){
  4210. case 322:
  4211. fill(225);
  4212. stroke(150);
  4213. break;
  4214. case 326:
  4215. fill(255, 213, 0);
  4216. stroke(191, 150, 0);
  4217. break;
  4218. case 330:
  4219. fill(0, 255, 255);
  4220. stroke(0, 168, 168);
  4221. break;
  4222. case 334:
  4223. fill(189, 120, 0);
  4224. stroke(125, 75, 0);
  4225. break;
  4226. }
  4227. rect(-6, 0, 11, 25, 30);
  4228. noStroke();
  4229. }
  4230. if(armorSlots[3]>0){
  4231. switch(armorSlots[3]){
  4232. case 323:
  4233. fill(225);
  4234. stroke(150);
  4235. break;
  4236. case 327:
  4237. fill(255, 213, 0);
  4238. stroke(191, 150, 0);
  4239. break;
  4240. case 331:
  4241. fill(0, 255, 255);
  4242. stroke(0, 168, 168);
  4243. break;
  4244. case 335:
  4245. fill(189, 120, 0);
  4246. stroke(125, 75, 0);
  4247. break;
  4248. }
  4249. rect(-7, 20, 14, 13, 30);
  4250. noStroke();
  4251. }
  4252. resetMatrix();
  4253. translate(playerX+10, playerY+22);
  4254. rotate(-armPos);
  4255. fill(0, 122, 122);
  4256. rect(-5, 0, 10, 10);
  4257. fill(143, 105, 43);
  4258. rect(-5, 10, 10, 20);
  4259. resetMatrix();
  4260. fill(199, 154, 77);
  4261. translate(playerX, playerY);
  4262. if(direction===RIGHT){
  4263. scale(-1, 1);
  4264. translate(-20, 0);
  4265. }
  4266. rect(0, 0, 20, 20);
  4267. fill(117, 84, 0);
  4268. triangle(0, 0+5, 0+15, 0+5, 0, 0+10);
  4269. rect(0, 0, 20, 5);
  4270. fill(255);
  4271. rect(0+15, 0+7, 5, 3);
  4272. fill(108, 0, 196);
  4273. rect(0+17, 0+7, 3, 3);
  4274. fill(0, 201, 201);
  4275. rect(0+4, 0+20, 12, 30);
  4276. if(armorSlots[1]>0){
  4277. switch(armorSlots[1]){
  4278. case 321:
  4279. fill(225);
  4280. stroke(150);
  4281. break;
  4282. case 325:
  4283. fill(255, 213, 0);
  4284. stroke(191, 150, 0);
  4285. break;
  4286. case 329:
  4287. fill(0, 255, 255);
  4288. stroke(0, 168, 168);
  4289. break;
  4290. case 333:
  4291. fill(189, 120, 0);
  4292. stroke(125, 75, 0);
  4293. break;
  4294. }
  4295. rect(2, 20, 16, 35, 15);
  4296. noStroke();
  4297. }
  4298. if(armorSlots[0]>0){
  4299. switch(armorSlots[0]){
  4300. case 320:
  4301. fill(225);
  4302. stroke(150);
  4303. break;
  4304. case 324:
  4305. fill(255, 213, 0);
  4306. stroke(191, 150, 0);
  4307. break;
  4308. case 328:
  4309. fill(0, 255, 255);
  4310. stroke(0, 168, 168);
  4311. break;
  4312. case 332:
  4313. fill(189, 120, 0);
  4314. stroke(125, 75, 0);
  4315. break;
  4316. }
  4317. rect(-2, -3, 25, 8, 30);
  4318. }noStroke();
  4319. if(mouseIsPressed&&mouseButton===LEFT&&armTimer<=0){
  4320. armTimer = 5;
  4321. }
  4322. if(armTimer>0){
  4323. armTimer--;
  4324. }
  4325. resetMatrix();
  4326. translate(playerX+10, playerY+50);
  4327. rotate(legPos);
  4328. fill(23, 0, 156);
  4329. rect(-6, 0, 12, 30);
  4330. if(armorSlots[2]>0){
  4331. switch(armorSlots[2]){
  4332. case 322:
  4333. fill(225);
  4334. stroke(150);
  4335. break;
  4336. case 326:
  4337. fill(255, 213, 0);
  4338. stroke(191, 150, 0);
  4339. break;
  4340. case 330:
  4341. fill(0, 255, 255);
  4342. stroke(0, 168, 168);
  4343. break;
  4344. case 334:
  4345. fill(189, 120, 0);
  4346. stroke(125, 75, 0);
  4347. break;
  4348. }
  4349. rect(-6, -3, 11, 28, 30);
  4350. noStroke();
  4351. }
  4352. if(armorSlots[3]>0){
  4353. switch(armorSlots[3]){
  4354. case 323:
  4355. fill(225);
  4356. stroke(150);
  4357. break;
  4358. case 327:
  4359. fill(255, 213, 0);
  4360. stroke(191, 150, 0);
  4361. break;
  4362. case 331:
  4363. fill(0, 255, 255);
  4364. stroke(0, 168, 168);
  4365. break;
  4366. case 335:
  4367. fill(189, 120, 0);
  4368. stroke(125, 75, 0);
  4369. break;
  4370. }
  4371. rect(-7, 20, 14, 13, 30);
  4372. noStroke();
  4373. }
  4374. resetMatrix();
  4375. translate(playerX+10, playerY+22);
  4376. if(armTimer>0){
  4377. if(direction===RIGHT){
  4378. rotate(armTimer*10);
  4379. }else{
  4380. rotate(-armTimer*10);
  4381. }
  4382. }else{
  4383. rotate(armPos);
  4384. }
  4385. fill(0, 189, 189);
  4386. rect(-5, 0, 10, 10);
  4387. fill(199, 154, 77);
  4388. rect(-5, 10, 10, 20);
  4389. if(armorSlots[1]>0){
  4390. switch(armorSlots[1]){
  4391. case 321:
  4392. fill(225);
  4393. stroke(150);
  4394. break;
  4395. case 325:
  4396. fill(255, 213, 0);
  4397. stroke(191, 150, 0);
  4398. break;
  4399. case 329:
  4400. fill(0, 255, 255);
  4401. stroke(0, 168, 168);
  4402. break;
  4403. case 333:
  4404. fill(189, 120, 0);
  4405. stroke(125, 75, 0);
  4406. break;
  4407. }
  4408. rect(-8, -3, 15, 15, 15);
  4409. noStroke();
  4410. }
  4411. if(direction===RIGHT){
  4412. scale(-1, 1);
  4413. }
  4414. if(hotbar[blockSelected]>300){
  4415. drawBlocks(hotbar[blockSelected], 6, 10);
  4416. }else{
  4417. scale(0.75, 0.75);
  4418. drawBlocks(hotbar[blockSelected], 6, 20);
  4419. }
  4420. resetMatrix();
  4421. if(onFire){
  4422. drawFlame(playerX-20, playerY, 3);
  4423. }
  4424. posA2 = ((posY+10)/40 - (posY+10)/20+4).toFixed(0, 0);
  4425. posA2 = ((posY-30)/40 - (posY-30)/20+4).toFixed(0, 0);
  4426. if(place+50>world[0].length){
  4427. genWorld();
  4428. }
  4429. //the hotbar
  4430. if(hide===false){
  4431. fill(199);
  4432. stroke(0, 0, 0);
  4433. rect(10, 350, 380, 50);
  4434. fill(230, 230, 230);
  4435. rect(blockSelected*43+15, 361, 30, 30);
  4436. noStroke();
  4437. for(var i=0; i<9; i++){
  4438. var j = i*43+20;
  4439. noStroke();
  4440. drawBlocks(hotbar[i], j, 366);
  4441. noStroke();
  4442. if(itemDurabilities[hotbar[i]]!==null&&hotbarSpecs[i]!==itemDurabilities[hotbar[i]]){
  4443. var filler = 255/itemDurabilities[hotbar[i]];
  4444. fill(255-hotbarSpecs[i]*filler, hotbarSpecs[i]*filler, 0);
  4445. rect(j, 388, hotbarSpecs[i]/(itemDurabilities[hotbar[i]]/20), 3);
  4446. if(hotbarSpecs[i]<=0){
  4447. hotbarSpecs[i]=0;
  4448. hotbarStacks[i]=0;
  4449. hotbar[i]=0;
  4450. }
  4451. }
  4452. fill(0);
  4453. text(i+1, j-7, 363);
  4454. fill(255);
  4455. textSize(15);
  4456. if(hotbarStacks[i]!==0&&hotbarStacks[i]!==1){
  4457. text(hotbarStacks[i], j+20, 366+23);
  4458. }
  4459. if(hotbarStacks[i]===0){
  4460. hotbar[i]=0;
  4461. }
  4462. textSize(12);
  4463. }}
  4464. //Hearts, armor, etc.
  4465. if(shake===2){
  4466. shake=-2;
  4467. }else{
  4468. shake=2;
  4469. }
  4470. if(inWater){
  4471. drownCount++;
  4472. for(var ll = 0; ll < oxygen; ll++){
  4473. noFill();
  4474. stroke(0, 196, 230, 150);
  4475. ellipse(ll*16+30, 301, 16, 16);
  4476. }
  4477. if(drownCount>50){
  4478. oxygen--;
  4479. drownCount=0;
  4480. if(oxygen<0){
  4481. health-=2;
  4482. }
  4483. }
  4484. }else{
  4485. oxygen=10;
  4486. }
  4487. for(var L = 0; L < armor/2; L++){
  4488. image(shield, 400-L*16-40, 312, 16, 24);
  4489. }
  4490. //Now to select what blocks to place.
  4491. if(inventory===false&&news===false&&isCrafting===false&&isSmelting===false){
  4492. a = (mouseY/40 + 0.5 - scrollY/40).toFixed(0, 0) - 1;
  4493. b = (mouseX/40 + 0.5 - scrollX/40).toFixed(0, 0) - 1;
  4494. if (mouseIsPressed&&mouseButton===RIGHT&&hotbar[blockSelected]<300&&hotbar[blockSelected]!==0){
  4495. if(world[a][b]===0||world[a][b]===11||world[a][b]===12||world[a][b]===13||world[a][b]===14){
  4496. world[a][b]=(hotbar[blockSelected]);
  4497. armTimer=5;
  4498. if(world[a][b]===33){
  4499. var newFurnace = [0,0,0,50,0,0,0,0,0,0,0,0];
  4500. specs[a][b]=newFurnace;
  4501. }
  4502. if(world[a][b]===34){
  4503. var newChest = [
  4504. [[0,0,0,0],
  4505. [0,0,0,0],
  4506. [0,0,0,0],
  4507. [0,0,0,0],
  4508. [0,0,0,0],
  4509. [0,0,0,0]],
  4510. [[0,0,0,0],
  4511. [0,0,0,0],
  4512. [0,0,0,0],
  4513. [0,0,0,0],
  4514. [0,0,0,0],
  4515. [0,0,0,0]],
  4516. [[0,0,0,0],
  4517. [0,0,0,0],
  4518. [0,0,0,0],
  4519. [0,0,0,0],
  4520. [0,0,0,0],
  4521. [0,0,0,0]]];
  4522. specs[a][b]=newChest;
  4523. }
  4524. if(!itemDurabilities[hotbar[blockSelected]]){
  4525. if(hotbar[blockSelected]===11||hotbar[blockSelected]===13){
  4526. hotbar[blockSelected]=337;
  4527. mouseIsPressed=false;
  4528. }else{
  4529. hotbarStacks[blockSelected]--;
  4530. }
  4531. }else{
  4532. hotbarSpecs[blockSelected]--;
  4533. }
  4534. if(world[a][b]===28){
  4535. specs[a][b]=1;
  4536. specs[a-1][b]=1;
  4537. world[a-1][b]=29;
  4538. }
  4539. }else {
  4540. if (world[a][b]===15&&hotbar[blockSelected]===17){
  4541. explode(b, a);
  4542. }
  4543. }
  4544. }
  4545. if(mouseIsPressed&&mouseButton===RIGHT){
  4546. if((world[a][b]===11||world[a][b]===13)&&hotbar[blockSelected]===337){
  4547. if(hotbarStacks[blockSelected]===1){
  4548. hotbar[blockSelected]=world[a][b];
  4549. }else{
  4550. hotbarStacks[blockSelected]--;
  4551. getItem(world[a][b], 1);
  4552. }
  4553. world[a][b]=0;
  4554. mouseIsPressed=false;
  4555. }
  4556. if(hotbar[blockSelected]===340){
  4557. spawnEntity(b*40, a*40, 1, 0);
  4558. hotbarStacks[blockSelected]--;
  4559. mouseIsPressed=false;
  4560. }
  4561. if(world[a][b]===33){
  4562. isSmelting=true;
  4563. blockTargeted=[a, b];
  4564. mouseIsPressed=false;
  4565. }
  4566. if(world[a][b]===34){
  4567. onChest=true;
  4568. blockTargeted=[a, b];
  4569. mouseIsPressed=false;
  4570. }
  4571. if(world[a][b]===27){
  4572. isCrafting=true;
  4573. }else if(world[a][b]===26&&hotbar[blockSelected]===305){
  4574. heartsShowing=true;
  4575. hotbarStacks[blockSelected]--;
  4576. if(shieldsShowing!==false){
  4577. shieldsShowing+=1000;
  4578. }
  4579. }else if(world[a][b]===28){
  4580. if(specs[a][b]===0){
  4581. specs[a][b]=1;
  4582. specs[a-1][b]=1;
  4583. }else if(specs[a][b]===1){
  4584. specs[a][b]=0;
  4585. specs[a-1][b]=0;
  4586. }
  4587. mouseButton=2;
  4588. }else if(world[a][b]===29){
  4589. if(specs[a][b]===0){
  4590. specs[a][b]=1;
  4591. specs[a-(-1)][b]=1;
  4592. }else if(specs[a][b]===1){
  4593. specs[a][b]=0;
  4594. specs[a-(-1)][b]=0;
  4595. }
  4596. mouseButton=2;
  4597. }
  4598. if(hotbar[blockSelected]===317&&health<20){
  4599. health+=3;
  4600. hotbarStacks[blockSelected]--;
  4601. mouseIsPressed=false;
  4602. }
  4603. if(hotbar[blockSelected]===319&&health<20){
  4604. health+=8;
  4605. hotbarStacks[blockSelected]--;
  4606. mouseIsPressed=false;
  4607. }
  4608. }
  4609. }else if (inventory===true){
  4610. var craftingSquares = [[],[],[]];
  4611. for(var i = 0; i < 3; i++){
  4612. for(var j = 0; j < 3; j++){
  4613. craftingSquares[i][j] = craftingGrid[i*3+j];
  4614. }
  4615. }
  4616. if(mouseY<350){
  4617. if(mouseX<220){
  4618. a = (mouseY/40+0.5).toFixed(0, 0) - 1;
  4619. b = (mouseX/40+0.75).toFixed(0, 0) - 2;
  4620. if(a<7&&b<5&&a>0&&b>0){
  4621. setTag(invContents[a-1][b-1]);
  4622. if(mouseIsPressed){
  4623. if(invContents[a-1][b-1]===holdingBlock){
  4624. while(holdingStacks<maxStacks[holdingBlock]&&invStacks[a-1][b-1]>0){
  4625. invStacks[a-1][b-1]--;
  4626. holdingStacks++;
  4627. }
  4628. }
  4629. var oldBlock = holdingBlock;
  4630. var oldStack = holdingStacks;
  4631. var oldSpec = holdingSpecs;
  4632. holdingBlock=invContents[a-1][b-1];
  4633. holdingStacks=invStacks[a-1][b-1];
  4634. holdingSpecs=invSpecs[a-1][b-1];
  4635. invContents[a-1][b-1]=oldBlock;
  4636. invStacks[a-1][b-1]=oldStack;
  4637. invSpecs[a-1][b-1]=oldSpec;
  4638. keyCode=0;
  4639. mouseIsPressed=false;
  4640. }
  4641. }}else{
  4642. a = ((mouseY)/30).toFixed(0, 0)-2;
  4643. b = ((mouseX)/30).toFixed(0, 0)-9;
  4644. if(mouseY<200&&mouseX>210&&b<2&&b>=0&&a<2&&a>=0){
  4645. setTag(craftingSquares[a][b]);
  4646. if(mouseIsPressed){
  4647. if(craftingSquares[a][b]===0){
  4648. craftingGrid[a*3+b]=holdingBlock;
  4649. holdingStacks--;
  4650. keyCode=0;
  4651. mouseIsPressed=false;
  4652. }else if(holdingBlock===0||holdingBlock===craftingSquares[a][b]){
  4653. holdingBlock=craftingGrid[a*3+b];
  4654. holdingStacks++;
  4655. craftingGrid[a*3+b]=0;
  4656. mouseIsPressed=false;
  4657. }
  4658. }
  4659. }//255, 140, 40, 40
  4660. if(mouseX>255&&mouseX<295&&mouseY>140&&mouseY<180){
  4661. setTag(craftedItem);
  4662. if(mouseIsPressed&&craftedItem!==0){
  4663. if(keys[SHIFT]){
  4664. getItem(craftedItem, craftedStacks);
  4665. craftedItem=0;
  4666. craftedStacks=0;
  4667. craftingGrid=[0,0,0,0,0,0,0,0,0];
  4668. }else if(holdingBlock===0){
  4669. holdingBlock=craftedItem;
  4670. holdingStacks=craftedStacks;
  4671. holdingSpecs=itemDurabilities[craftedItem];
  4672. craftingGrid=[0,0,0,0,0,0,0,0,0];
  4673. mouseIsPressed=false;
  4674. }
  4675. }//d*35+250, e*30+195
  4676. }else if(mouseX>240&&mouseX<310&&mouseY>185&&mouseY<255){
  4677. a = ((mouseY-175)/30).toFixed(0,0)-1;
  4678. b = ((mouseX-225)/35).toFixed(0,0)-1;
  4679. setTag(armorSlots[a*2+b]);
  4680. if(mouseIsPressed&&a>=0&&a<=1&&b>=0&&b<=1){
  4681. if(holdingBlock===0){
  4682. holdingBlock = armorSlots[a*2+b];
  4683. holdingSpecs = armorSpecs[a*2+b];
  4684. holdingStacks = 1;
  4685. armorSlots[a*2+b]=0;
  4686. armorSpecs[a*2+b]=0;
  4687. mouseIsPressed=false;
  4688. }else if(holdingBlock>=320&&holdingBlock<=335){
  4689. var data = holdingBlock;
  4690. if(data>300){
  4691. while(data>3){
  4692. data-=4;
  4693. }
  4694. }
  4695. if(data===a*2+b){
  4696. var oldBlock = holdingBlock;
  4697. var oldSpecs = holdingSpecs;
  4698. holdingBlock = armorSlots[a*2+b];
  4699. holdingSpecs = armorSpecs[a*2+b];
  4700. armorSlots[a*2+b]=oldBlock;
  4701. armorSpecs[a*2+b]=oldSpecs;
  4702. mouseIsPressed=false;
  4703. }
  4704. }
  4705. }
  4706. }
  4707. }}else {
  4708. b = (mouseX/40).toFixed(0, 0);
  4709. if(b>0&&b<=9){
  4710. setTag(hotbar[b-1]);
  4711. if(mouseIsPressed){
  4712. if(hotbar[b-1]===holdingBlock){
  4713. while(holdingStacks<maxStacks[holdingBlock]&&hotbarStacks[b-1]>0){
  4714. hotbarStacks[b-1]--;
  4715. holdingStacks++;
  4716. }
  4717. }
  4718. var oldBlock = holdingBlock;
  4719. var oldStack = holdingStacks;
  4720. var oldSpec = holdingSpecs;
  4721. holdingBlock=hotbar[b-1];
  4722. holdingStacks=hotbarStacks[b-1];
  4723. holdingSpecs=hotbarSpecs[b-1];
  4724. hotbar[b-1]=oldBlock;
  4725. hotbarStacks[b-1]=oldStack;
  4726. hotbarSpecs[b-1]=oldSpec;
  4727. keyCode=0;
  4728. mouseIsPressed=false;
  4729. }
  4730. }}
  4731. }
  4732. if (onChest){
  4733. var targetChest = specs[blockTargeted[0]][blockTargeted[1]];
  4734. if(mouseY<350){
  4735. if(mouseX<200){
  4736. a = ((mouseY-60)/40).toFixed(0,0);
  4737. b = ((mouseX-50)/40).toFixed(0,0);
  4738. if(b<1){b=0;}
  4739. if(a<1){a=0;}
  4740. if(a<6&&b<4&&a>=0&&b>=0){
  4741. setTag(invContents[a][b]);
  4742. if(mouseIsPressed){
  4743. if(invContents[a][b]===holdingBlock){
  4744. while(holdingStacks<maxStacks[holdingBlock]&&invStacks[a][b]>0){
  4745. invStacks[a][b]--;
  4746. holdingStacks++;
  4747. }
  4748. }
  4749. var oldBlock = holdingBlock;
  4750. var oldStack = holdingStacks;
  4751. var oldSpec = holdingSpecs;
  4752. holdingBlock=invContents[a][b];
  4753. holdingStacks=invStacks[a][b];
  4754. holdingSpecs=invSpecs[a][b];
  4755. invContents[a][b]=oldBlock;
  4756. invStacks[a][b]=oldStack;
  4757. invSpecs[a][b]=oldSpec;
  4758. mouseIsPressed=false;
  4759. }
  4760. }
  4761. }else{
  4762. a = ((mouseY-220)/40).toFixed(0,0)-(-4);
  4763. b = ((mouseX-60)/40).toFixed(0,0)-4;
  4764. if(a<6&&b<4&&a>=0&&b>=0){
  4765. setTag(targetChest[0][a][b]);
  4766. if(mouseIsPressed){
  4767. if(targetChest[0][a][b]===holdingBlock){
  4768. while(holdingStacks<maxStacks[holdingBlock]&&targetChest[1][a][b]>0){
  4769. targetChest[1][a][b]--;
  4770. holdingStacks++;
  4771. }
  4772. }
  4773. var oldBlock = holdingBlock;
  4774. var oldStack = holdingStacks;
  4775. var oldSpec = holdingSpecs;
  4776. holdingBlock=targetChest[0][a][b];
  4777. holdingStacks=targetChest[1][a][b];
  4778. holdingSpecs=targetChest[2][a][b];
  4779. targetChest[0][a][b]=oldBlock;
  4780. targetChest[1][a][b]=oldStack;
  4781. targetChest[2][a][b]=oldSpec;
  4782. mouseIsPressed=false;
  4783. }
  4784. }
  4785. }
  4786. }else{
  4787. b = (mouseX/40).toFixed(0, 0);
  4788. if(b>0&&b<=9){
  4789. setTag(hotbar[b-1]);
  4790. if(mouseIsPressed){
  4791. if(hotbar[b-1]===holdingBlock){
  4792. while(holdingStacks<maxStacks[holdingBlock]&&hotbarStacks[b-1]>0){
  4793. hotbarStacks[b-1]--;
  4794. holdingStacks++;
  4795. }
  4796. }
  4797. var oldBlock = holdingBlock;
  4798. var oldStack = holdingStacks;
  4799. var oldSpec = holdingSpecs;
  4800. holdingBlock=hotbar[b-1];
  4801. holdingStacks=hotbarStacks[b-1];
  4802. holdingSpecs=hotbarSpecs[b-1];
  4803. hotbar[b-1]=oldBlock;
  4804. hotbarStacks[b-1]=oldStack;
  4805. hotbarSpecs[b-1]=oldSpec;
  4806. keyCode=0;
  4807. mouseIsPressed=false;
  4808. }
  4809. }
  4810. }mouseIsPressed=false;
  4811. }
  4812. if (isCrafting===true){
  4813. var craftingSquares = [[],[],[]];
  4814. for(var i = 0; i < 3; i++){
  4815. for(var j = 0; j < 3; j++){
  4816. craftingSquares[i][j] = craftingGrid[i*3+j];
  4817. }
  4818. }
  4819. if(mouseY<350){
  4820. if(mouseX<220){
  4821. a = (mouseY/40+0.5).toFixed(0, 0) - 1;
  4822. b = (mouseX/40+0.75).toFixed(0, 0) - 2;
  4823. if(a<7&&b<5&&a>0&&b>0){
  4824. setTag(invContents[a-1][b-1]);
  4825. if(mouseIsPressed){
  4826. if(invContents[a-1][b-1]===holdingBlock){
  4827. while(holdingStacks<maxStacks[holdingBlock]&&invStacks[a-1][b-1]>0){
  4828. invStacks[a-1][b-1]--;
  4829. holdingStacks++;
  4830. }
  4831. }
  4832. var oldBlock = holdingBlock;
  4833. var oldStack = holdingStacks;
  4834. var oldSpec = holdingSpecs;
  4835. holdingBlock=invContents[a-1][b-1];
  4836. holdingStacks=invStacks[a-1][b-1];
  4837. holdingSpecs=invSpecs[a-1][b-1];
  4838. invContents[a-1][b-1]=oldBlock;
  4839. invStacks[a-1][b-1]=oldStack;
  4840. invSpecs[a-1][b-1]=oldSpec;
  4841. mouseIsPressed=false;
  4842. }
  4843. }}else{
  4844. a = ((mouseY)/30).toFixed(0, 0)-2;
  4845. b = ((mouseX)/30).toFixed(0, 0)-9;
  4846. if(mouseY<200&&mouseX>210&&b<3&&b>=0&&a<3&&a>=0){
  4847. setTag(craftingSquares[a][b]);
  4848. if(mouseIsPressed){
  4849. if(craftingSquares[a][b]===0){
  4850. craftingGrid[a*3+b]=holdingBlock;
  4851. holdingStacks--;
  4852. keyCode=0;
  4853. mouseIsPressed=false;
  4854. }else if(holdingBlock===0||holdingBlock===craftingSquares[a][b]){
  4855. holdingBlock=craftingGrid[a*3+b];
  4856. holdingStacks++;
  4857. craftingGrid[a*3+b]=0;
  4858. mouseIsPressed=false;
  4859. }
  4860. }
  4861. }
  4862. if(mouseX>270&&mouseX<315&&mouseY>225&&mouseY<270){
  4863. setTag(craftedItem);
  4864. if(mouseIsPressed){
  4865. if(keys[SHIFT]){
  4866. getItem(craftedItem, craftedStacks);
  4867. craftedItem=0;
  4868. craftedStacks=0;
  4869. craftingGrid=[0,0,0,0,0,0,0,0,0];
  4870. }else if(holdingBlock===0){
  4871. holdingBlock=craftedItem;
  4872. holdingStacks=craftedStacks;
  4873. holdingSpecs=itemDurabilities[craftedItem];
  4874. craftingGrid=[0,0,0,0,0,0,0,0,0];
  4875. mouseIsPressed=false;
  4876. }}
  4877. }}}else{
  4878. b = (mouseX/40).toFixed(0, 0);
  4879. if(b>0&&b<=9){
  4880. setTag(hotbar[b-1]);
  4881. if(mouseIsPressed){
  4882. if(hotbar[b-1]===holdingBlock){
  4883. while(holdingStacks<maxStacks[holdingBlock]&&hotbarStacks[b-1]>0){
  4884. hotbarStacks[b-1]--;
  4885. holdingStacks++;
  4886. }
  4887. }
  4888. var oldBlock = holdingBlock;
  4889. var oldStack = holdingStacks;
  4890. var oldSpec = holdingSpecs;
  4891. holdingBlock=hotbar[b-1];
  4892. holdingStacks=hotbarStacks[b-1];
  4893. holdingSpecs=hotbarSpecs[b-1];
  4894. hotbar[b-1]=oldBlock;
  4895. hotbarStacks[b-1]=oldStack;
  4896. hotbarSpecs[b-1]=oldSpec;
  4897. keyCode=0;
  4898. mouseIsPressed=false;
  4899. }
  4900. }
  4901. }}
  4902. if(isSmelting){
  4903. if(mouseY<350){
  4904. if(mouseX<220){
  4905. a = (mouseY/40+0.5).toFixed(0, 0) - 1;
  4906. b = (mouseX/40+0.75).toFixed(0, 0) - 2;
  4907. if(a<7&&b<5&&a>0&&b>0){
  4908. setTag(invContents[a-1][b-1]);
  4909. if(mouseIsPressed){
  4910. if(invContents[a-1][b-1]===holdingBlock){
  4911. while(holdingStacks<maxStacks[holdingBlock]&&invStacks[a-1][b-1]>0){
  4912. invStacks[a-1][b-1]--;
  4913. holdingStacks++;
  4914. }
  4915. }
  4916. var oldBlock = holdingBlock;
  4917. var oldStack = holdingStacks;
  4918. var oldSpec = holdingSpecs;
  4919. holdingBlock=invContents[a-1][b-1];
  4920. holdingStacks=invStacks[a-1][b-1];
  4921. holdingSpecs=invSpecs[a-1][b-1];
  4922. invContents[a-1][b-1]=oldBlock;
  4923. invStacks[a-1][b-1]=oldStack;
  4924. invSpecs[a-1][b-1]=oldSpec;
  4925. mouseIsPressed=false;
  4926. }
  4927. }}else{
  4928. var targetFurnace = specs[blockTargeted[0]][blockTargeted[1]];
  4929. for(var i = 0; i <= 10; i++){
  4930. if(specs[blockTargeted[0]][blockTargeted[1]][i]===undefined){
  4931. specs[blockTargeted[0]][blockTargeted[1]][i]=0;
  4932. }
  4933. }
  4934. var fuel = targetFurnace[0];
  4935. var fuelStacks = targetFurnace[1];
  4936. var fuelSpecs = targetFurnace[2];
  4937. var smeltingTime = targetFurnace[3];
  4938. var item = targetFurnace[4];
  4939. var itemStacks = targetFurnace[5];
  4940. var itemSpecs = targetFurnace[6];
  4941. var smeltedItem = targetFurnace[7];
  4942. var smeltedStacks = targetFurnace[8];
  4943. var smeltedSpecs = targetFurnace[9];
  4944. var burnTime = targetFurnace[10];
  4945. /*
  4946. 255, 50, 40, 40
  4947. 255, 130, 40, 40
  4948. 255, 240, 40, 40
  4949. */
  4950. if(mouseX>255&&mouseX<295&&mouseY>240&&mouseY<280&&mouseIsPressed){
  4951. if(keys[SHIFT]){
  4952. getItem(smeltedItem, smeltedStacks);
  4953. smeltedItem=0;
  4954. smeltedStacks=0;
  4955. }else if(holdingBlock===0){
  4956. holdingBlock=smeltedItem;
  4957. holdingStacks=smeltedStacks;
  4958. smeltedItem=0;smeltedStacks=0;
  4959. holdingSpecs=itemDurabilities[smeltedItem];
  4960. }mouseIsPressed=false;}
  4961. if(mouseX>255&&mouseX<295&&mouseY>130&&mouseY<170&&mouseIsPressed){
  4962. var oldBlock = holdingBlock;
  4963. var oldStack = holdingStacks;
  4964. var oldSpec = holdingSpecs;
  4965. holdingBlock=fuel;
  4966. holdingStacks=fuelStacks;
  4967. holdingSpecs=fuelSpecs;
  4968. fuel=oldBlock;
  4969. fuelStacks=oldStack;
  4970. fuelSpecs=oldSpec;
  4971. mouseIsPressed=false;
  4972. }
  4973. if(mouseX>255&&mouseX<295&&mouseY>50&&mouseY<90&&mouseIsPressed){
  4974. var oldBlock = holdingBlock;
  4975. var oldStack = holdingStacks;
  4976. var oldSpec = holdingSpecs;
  4977. holdingBlock=item;
  4978. holdingStacks=itemStacks;
  4979. holdingSpecs=itemSpecs;
  4980. item=oldBlock;
  4981. itemStacks=oldStack;
  4982. itemSpecs=oldSpec;
  4983. mouseIsPressed=false;
  4984. }
  4985. specs[blockTargeted[0]][blockTargeted[1]][0]=fuel;
  4986. specs[blockTargeted[0]][blockTargeted[1]][1]=fuelStacks;
  4987. specs[blockTargeted[0]][blockTargeted[1]][2]=fuelSpecs;
  4988. specs[blockTargeted[0]][blockTargeted[1]][3]=smeltingTime;
  4989. specs[blockTargeted[0]][blockTargeted[1]][4]=item;
  4990. specs[blockTargeted[0]][blockTargeted[1]][5]=itemStacks;
  4991. specs[blockTargeted[0]][blockTargeted[1]][6]=itemSpecs;
  4992. specs[blockTargeted[0]][blockTargeted[1]][7]=smeltedItem;
  4993. specs[blockTargeted[0]][blockTargeted[1]][8]=smeltedStacks;
  4994. specs[blockTargeted[0]][blockTargeted[1]][9]=smeltedSpecs;
  4995. specs[blockTargeted[0]][blockTargeted[1]][10]=burnTime;
  4996. }}else{
  4997. b = (mouseX/40).toFixed(0, 0);
  4998. if(b>0&&b<=9){
  4999. setTag(hotbar[b-1]);
  5000. if(mouseIsPressed){
  5001. if(hotbar[b-1]===holdingBlock){
  5002. while(holdingStacks<maxStacks[holdingBlock]&&hotbarStacks[b-1]>0){
  5003. hotbarStacks[b-1]--;
  5004. holdingStacks++;
  5005. }
  5006. }
  5007. var oldBlock = holdingBlock;
  5008. var oldStack = holdingStacks;
  5009. var oldSpec = holdingSpecs;
  5010. holdingBlock=hotbar[b-1];
  5011. holdingStacks=hotbarStacks[b-1];
  5012. holdingSpecs=hotbarSpecs[b-1];
  5013. hotbar[b-1]=oldBlock;
  5014. hotbarStacks[b-1]=oldStack;
  5015. hotbarSpecs[b-1]=oldSpec;
  5016. keyCode=0;
  5017. mouseIsPressed=false;
  5018. }
  5019. }
  5020. }}
  5021. if(holdingStacks===0||holdingBlock===0){
  5022. holdingBlock=0;
  5023. holdingStacks=0;
  5024. holdingSpecs=0;
  5025. }
  5026. if(keys[112]){
  5027. if(hide===false){
  5028. hide=true;
  5029. }else{
  5030. hide=false;
  5031. }
  5032. keyCode=0;
  5033. }
  5034. if(keyTimer>0&&isSprinting===false){
  5035. keyTimer--;
  5036. }
  5037. if(keys[68]){
  5038. //direction=LEFT;
  5039. posB2 = ((posX+30)/40 - (posX+30)/20 + 6).toFixed(0, 0);
  5040. if((!solidBlocks[world[posA][posB2]]||(world[posA][posB2]===28&&specs[posA][posB2]===0)||(world[posA][posB2]===29&&specs[posA][posB2]===0))&&(!solidBlocks[world[posA2][posB2]]||(world[posA2][posB2]===28&&specs[posA2][posB2]===0)&&(world[posA2][posB2]===29&&specs[posA2][posB2]===0))&&(!solidBlocks[world[posA2-1][posB2]]||(world[posA2-1][posB2]===28&&specs[posA2-1][posB2]===0)||(world[posA2-1][posB2]===29&&specs[posA][posB2]===0))){/**RANDOM BLUE TEXT**/
  5041. if(keyTimer>0){
  5042. isSprinting=true;
  5043. playerSpeed = playerSpeed * 1.5;
  5044. }
  5045. posX-=playerSpeed;
  5046. if(isSprinting){
  5047. playerSpeed = playerSpeed / 1.5;
  5048. }
  5049. }else{
  5050. isSprinting=false;
  5051. if(world[posA2][posB2]===31||world[posA][posB2]===31){
  5052. health-=1;
  5053. }
  5054. }
  5055. posB2 = ((posX+30)/40 - (posX+30)/20 + 5).toFixed(0, 0);
  5056. }
  5057. if(keys[65]){
  5058. //direction=RIGHT;
  5059. if((!solidBlocks[world[posA][posB-1]]||(world[posA][posB-1]===28&&specs[posA][posB-1]===0)||(world[posA][posB-1]===29&&specs[posA][posB-1]===0))&&(!solidBlocks[world[posA2][posB-1]]||(world[posA2][posB-1]===28&&specs[posA2][posB-1]===0)||(world[posA2][posB-1]===29&&specs[posA2][posB-1]===0))&&(!solidBlocks[world[posA2-1][posB-1]]||(world[posA2-1][posB-1]===28&&specs[posA2-1][posB-1]===0)||(world[posA2-1][posB-1]===29&&specs[posA2-1][posB-1]===0))){
  5060. if(keyTimer>0){
  5061. isSprinting=true;
  5062. playerSpeed = playerSpeed * 1.5;
  5063. }
  5064. posX+=playerSpeed;
  5065. if(isSprinting){
  5066. playerSpeed = playerSpeed / 1.5;
  5067. }
  5068. }else{
  5069. if(world[posA2][posB-1]===31||world[posA][posB-1]===31){
  5070. health-=1;
  5071. }
  5072. isSprinting=false;
  5073. }
  5074. }
  5075. if(keys[16]||keys[83]){
  5076. if(world[posA-(-1)][posB]===30||world[posA-(-1)][posB]===0){
  5077. posY-=playerSpeed;
  5078. }
  5079. if(isSitting){
  5080. isSitting=false;
  5081. }else{
  5082. isSitting=true;
  5083. }
  5084. keyCode=0;
  5085. }
  5086. if(keys[32]||keys[87]){
  5087. if(!solidBlocks[world[posA-2][posB]]){
  5088. if(inWater||world[posA2][posB]===11||world[posA2][posB]===12||world[posA2][posB2]===11||world[posA2][posB2]===12){
  5089. jump=23;
  5090. if(solidBlocks[world[posA-(-1)][posB]]||solidBlocks[world[posA-(-1)][posB2]]){
  5091. posY+=6;
  5092. }
  5093. }else if(inLava||world[posA2][posB]===13||world[posA2][posB]===14||world[posA2][posB2]===13||world[posA2][posB2]===14){
  5094. onFire = true;
  5095. jump=23;
  5096. if(solidBlocks[world[posA-(-1)][posB]]||solidBlocks[world[posA-(-1)][posB2]]){
  5097. posY+=6;
  5098. }
  5099. }else if(solidBlocks[world[posA-(-1)][posB]]||solidBlocks[world[posA-(-1)][posB2]]){
  5100. jump=30;
  5101. posY+=6;
  5102. }
  5103. }
  5104. if(world[posA][posB]===30){
  5105. posY+=playerSpeed;
  5106. }
  5107. }
  5108. if(keys[115]){
  5109. health-=4;
  5110. broadcast("Ouch...");
  5111. keys[115]=false;
  5112. }
  5113. if(posX<-10){
  5114. scrollX=posX;
  5115. }
  5116. if(posY<0&&posY>-1187){
  5117. scrollY=posY;
  5118. }
  5119. if(keyCode>48&&keyCode<58&&onInputBox===false){
  5120. blockSelected=keyCode-49;
  5121. }
  5122. //Now to make it so we can break blocks.
  5123. if(!mouseIsPressed){
  5124. blockStrength=null;
  5125. }
  5126. if(mouseIsPressed&&mouseButton===LEFT&&inventory===false&&news===false&&world[a][b]!==18){
  5127. if(world[a][b]<10||world[a][b]>14){
  5128. if(blockStrength===null){
  5129. selDurability = blockDurability[world[a][b]];
  5130. for(var i = 307; i <= 311; i++){
  5131. if(hotbar[blockSelected]===i){
  5132. selDurability=selDurability/(hotbar[blockSelected]-305+blockDurability[world[a][b]]/50);
  5133. }
  5134. }
  5135. /*if(world[a][b]!==0){
  5136. broadcast(selDurability);
  5137. }*/
  5138. blockTargeted = [a, b];
  5139. blockStrength=selDurability;
  5140. }
  5141. if(blockStrength<=0){
  5142. switch(world[a][b]){
  5143. case 1:
  5144. if(hotbar[blockSelected]>=307&&hotbar[blockSelected]<=311){
  5145. spawnEntity(b*40+random(0,20),a*40+10, 0, 4);
  5146. }
  5147. break;
  5148. case 2:
  5149. spawnEntity(b*40+random(0,20),a*40+10, 0, 3);
  5150. break;
  5151. case 3:
  5152. spawnEntity(b*40+random(0,20),a*40+10, 0, 3);
  5153. break;
  5154. case 4:
  5155. if(hotbar[blockSelected]>=307&&hotbar[blockSelected]<=311){
  5156. spawnEntity(b*40+random(0,20),a*40+10, 0, 4);
  5157. }
  5158. break;
  5159. case 5:
  5160. spawnEntity(b*40+random(0,20),a*40+10, 0, 5);
  5161. break;
  5162. case 6:
  5163. if(hotbar[blockSelected]>=307&&hotbar[blockSelected]<=311){
  5164. spawnEntity(b*40+random(0,20),a*40+10, 0, 6);
  5165. }
  5166. break;
  5167. case 7:
  5168. spawnEntity(b*40+random(0,20),a*40+10, 0, 7);
  5169. break;
  5170. case 8:
  5171. if(hotbar[blockSelected]===311){
  5172. spawnEntity(b*40+random(0,20),a*40+10, 0, 8);
  5173. }
  5174. break;
  5175. case 9:
  5176. c = random(0, 5);
  5177. if(c > 4.5){
  5178. spawnEntity(b*40+random(0,20),a*40+10, 0, 16);
  5179. }
  5180. break;
  5181. case 15:
  5182. spawnEntity(b*40+random(0,20),a*40+10, 0, 15);
  5183. break;
  5184. case 16:
  5185. spawnEntity(b*40+random(0,20),a*40+10, 0, 16);
  5186. break;
  5187. case 19:
  5188. if(hotbar[blockSelected]>=307&&hotbar[blockSelected]<=311){
  5189. spawnEntity(b*40+random(0,20),a*40+10, 0, 19);
  5190. }
  5191. break;
  5192. case 20:
  5193. spawnEntity(b*40+random(0,20),a*40+10, 0, 20);
  5194. break;
  5195. case 21:
  5196. c = random(0, 5);
  5197. if(c>4){
  5198. spawnEntity(b*40+random(0,20),a*40+10, 0, 306);
  5199. }else{
  5200. spawnEntity(b*40+random(0,20),a*40+10, 0, 21);
  5201. }
  5202. break;
  5203. case 22:
  5204. if(hotbar[blockSelected]>=307&&hotbar[blockSelected]<=311){
  5205. spawnEntity(b*40+random(0,20),a*40+10, 0, 301);
  5206. }
  5207. break;
  5208. case 23:
  5209. if(hotbar[blockSelected]>=308&&hotbar[blockSelected]<=311){
  5210. spawnEntity(b*40+random(0,20),a*40+10, 0, 23);
  5211. }
  5212. break;
  5213. case 24:
  5214. if(hotbar[blockSelected]>=309&&hotbar[blockSelected]<=311){
  5215. spawnEntity(b*40+random(0,20),a*40+10, 0, 24);
  5216. }
  5217. break;
  5218. case 25:
  5219. if(hotbar[blockSelected]>=309&&hotbar[blockSelected]<=311){
  5220. c = round(random(4, 5));
  5221. for(var i = 0; i < c; i++){
  5222. spawnEntity(b*40+random(0,20),a*40+10, 0, 304);
  5223. }
  5224. }
  5225. break;
  5226. case 26:
  5227. if(hotbar[blockSelected]>=309&&hotbar[blockSelected]<=311){
  5228. spawnEntity(b*40+random(0,20),a*40+10, 0, 305);
  5229. }
  5230. break;
  5231. case 27:
  5232. spawnEntity(b*40+random(0,20),a*40+10, 0, 27);
  5233. break;
  5234. case 28:
  5235. spawnEntity(b*40+random(0,20),a*40+10, 0, 28);
  5236. world[a-1][b]=0;
  5237. break;
  5238. case 29:
  5239. spawnEntity(b*40+random(0,20),a*40+10, 0, 28);
  5240. world[a-(-1)][b]=0;
  5241. break;
  5242. case 30:
  5243. spawnEntity(b*40+random(0,20),a*40+10, 0, 30);
  5244. break;
  5245. case 31:
  5246. spawnEntity(b*40+random(0,20),a*40+10, 0, 31);
  5247. break;
  5248. case 33:
  5249. spawnEntity(b*40+random(0,20),a*40+10,0,33);
  5250. for(var i = 0; i < specs[a][b][1]; i++){
  5251. spawnEntity(b*40+random(0,20),a*40+10,0,specs[a][b][0]);
  5252. }
  5253. for(var i = 0; i < specs[a][b][5]; i++){
  5254. spawnEntity(b*40+random(0,20),a*40+10,0,specs[a][b][4]);
  5255. }
  5256. for(var i = 0; i < specs[a][b][8]; i++){
  5257. spawnEntity(b*40+random(0,20),a*40+10,0,specs[a][b][7]);
  5258. }
  5259. break;
  5260. case 34:
  5261. spawnEntity(b*40+random(0,20),a*40+10,0,34);
  5262. if(specs[a][b]!==null||specs[a][b]!==0){
  5263. for(var i = 0; i < 6; i++){
  5264. for(var j = 0; j < 4; j++){
  5265. for(var k = 0; k < specs[a][b][1][i][j]; k++){
  5266. spawnEntity(b*40+random(0,20),a*40+10,0,specs[a][b][0][i][j]);
  5267. }
  5268. }
  5269. }
  5270. }
  5271. break;
  5272. case 35:
  5273. if(hotbar[blockSelected]>=307&&hotbar[blockSelected]<=311){
  5274. spawnEntity(b*40+random(0,20),a*40+10,0,35);
  5275. }
  5276. break;
  5277. case 37:
  5278. if(hotbar[blockSelected]>=308&&hotbar[blockSelected]<=311){
  5279. spawnEntity(b*40+random(0,20),a*40+10,0,37);
  5280. }
  5281. break;
  5282. case 38:
  5283. if(hotbar[blockSelected]>=309&&hotbar[blockSelected]<=311){
  5284. spawnEntity(b*40+random(0,20),a*40+10,0,38);
  5285. }
  5286. break;
  5287. case 39:
  5288. if(hotbar[blockSelected]>=307&&hotbar[blockSelected]<=311){
  5289. spawnEntity(b*40+random(0,20),a*40+10,0,39);
  5290. }
  5291. break;
  5292. case 40:
  5293. spawnEntity(b*40+random(0,20),a*40+10,0,40);
  5294. break;
  5295. case 41:
  5296. spawnEntity(b*40+random(0,20),a*40+10,0,41);
  5297. }
  5298. blockStrength=null;
  5299. if(world[a][b]!==0){
  5300. if(hotbar[blockSelected]>=307&&hotbar[blockSelected]<=311){
  5301. hotbarSpecs[blockSelected]--;
  5302. }else if(hotbar[blockSelected]>=312&&hotbar[blockSelected]<=316){
  5303. hotbarSpecs[blockSelected]-=2;
  5304. }
  5305. }
  5306. world[a][b]=0;
  5307. }else if(blockStrength!==null){
  5308. if(blockTargeted[0]===a&&blockTargeted[1]===b){
  5309. blockStrength--;
  5310. }else{
  5311. blockStrength=null;
  5312. }}
  5313. }
  5314. }else if(mouseIsPressed&&inventory===false&&news===false&&world[a][b]===18){
  5315. if(nether === false){
  5316. overWorld = world;
  5317. world = netherWorld;
  5318. nether = true;
  5319. }else if(nether === true){
  5320. netherWorld = world;
  5321. world = overWorld;
  5322. nether = false;
  5323. }
  5324. }
  5325. noStroke();
  5326. if(keys[84]){
  5327. if(!onInputBox){
  5328. onInputBox=true;
  5329. }
  5330. keys[84]=false;
  5331. }
  5332. textSize(15);
  5333. if(onInputBox){
  5334. fill(0, 0, 0, 60);
  5335. rect(0, 385, 400, 15);
  5336. if(inputTimer<=0){
  5337. inputTimer=25;
  5338. }else{
  5339. inputTimer--;
  5340. }
  5341. fill(255);
  5342. if(inputTimer>10){
  5343. text(input+"_", 5, 395);
  5344. }else{
  5345. text(input, 5, 395);
  5346. }
  5347. for(var i = messages.length-20; i < messages.length; i++){
  5348. if(messages[i]!==undefined){
  5349. fill(0, 0, 0, 60);
  5350. rect(0, i*15-messages.length*15+300, 300, 15);
  5351. fill(255);
  5352. text(messages[i], 5, i*15-messages.length*15+313);
  5353. msgTimers[i]--;
  5354. }
  5355. }
  5356. }else{
  5357. for(var i = messages.length-10; i < messages.length; i++){
  5358. if(messages[i]!==undefined&&msgTimers[i]>0){
  5359. if(msgTimers[i]>20){
  5360. fill(0, 0, 0, 60);
  5361. }else{
  5362. fill(0, 0, 0, msgTimers[i]*3);
  5363. }
  5364. rect(0, i*15-messages.length*15+300, 300, 15);
  5365. if(msgTimers[i]>10){
  5366. fill(255);
  5367. }else{
  5368. fill(255, 255, 255, msgTimers[i]*25.5);
  5369. }
  5370. text(messages[i], 5, i*15-messages.length*15+313);
  5371. msgTimers[i]--;
  5372. }
  5373. }
  5374. }
  5375. textSize(12);
  5376. if(nether===true||night===true){
  5377. fill(255, 255, 255);
  5378. }else{
  5379. fill(0, 0, 0);
  5380. }
  5381. text("SERVER: skyblock.cube-mc.com", 57, 15);
  5382. //the Debug menu
  5383. if(keyIsPressed&&keyCode===114&&debugMenu===false){
  5384. debugMenu=true;
  5385. keyCode=0;
  5386. }else if(keyIsPressed&&keyCode===114){
  5387. debugMenu=false;
  5388. keyCode=0;
  5389. }
  5390. //The Inventory
  5391. if(keyCode===69&&inventory===false&&isCrafting===false&&!onInputBox){
  5392. inventory=true;
  5393. keyCode=0;
  5394. }
  5395. if(keyCode===69&&(isCrafting||isSmelting)&&!onInputBox){
  5396. isSmelting=false;
  5397. isCrafting=false;
  5398. keyCode=0;
  5399. }
  5400. if(keyCode===69&&inventory===false&&isCrafting===false&&isSmelting===false&&!onInputBox){
  5401. inventory=true;
  5402. keyCode=0;
  5403. }
  5404. var craftingSquares = [[],[],[]];
  5405. for(var r = 0; r < 3; r++){
  5406. for(var s = 0; s < 3; s++){
  5407. craftingSquares[s][r] = craftingGrid[r+s*3];
  5408. }
  5409. }
  5410. if(onChest){
  5411. var targetChest = specs[blockTargeted[0]][blockTargeted[1]];
  5412. if(keyCode===69){
  5413. onChest=false;
  5414. keyCode=0;
  5415. }
  5416. isCrafting=false;
  5417. isSmelting=false;
  5418. e2open=false;
  5419. fill(199, 199, 199);
  5420. stroke(0, 0, 0);
  5421. strokeWeight(3);
  5422. rect(25, 10, 350, 300);
  5423. textSize(20);
  5424. fill(0, 0, 0);
  5425. text("Chest:", 30, 30);
  5426. textSize(12);
  5427. strokeWeight(2);
  5428. line(200, 30, 200, 285);
  5429. noStroke();
  5430. drawInventory(40, 50, 40, invContents);
  5431. for(var i = 0; i < 4; i++){
  5432. for(var j = 0; j < 6; j++){
  5433. drawBlocks(targetChest[0][j][i], i*40+210, j*40+50);
  5434. if(targetChest[1][j][i]>1){
  5435. textSize(15);
  5436. fill(255);
  5437. text(targetChest[1][j][i], i*40+230, j*40+73);
  5438. }textSize(12);
  5439. }
  5440. }
  5441. stroke(0, 0, 0);
  5442. strokeWeight(2);
  5443. drawBlocks(holdingBlock, mouseX-10, mouseY-10);
  5444. if(NBTtag!==null&&NBTtag!==""){
  5445. stroke(54, 0, 171);
  5446. fill(0, 0, 0);
  5447. var length = (NBTtag.split()).length;
  5448. rect(mouseX, mouseY-15, length*85, 15);
  5449. fill(255, 255, 255);
  5450. text(NBTtag, mouseX, mouseY);
  5451. }
  5452. fill(255);
  5453. if(holdingStacks>1){
  5454. textSize(15);
  5455. text(holdingStacks, mouseX+10, mouseY+13);
  5456. textSize(12);
  5457. }
  5458. }
  5459. if(inventory===true){
  5460. if(keyCode===69){
  5461. inventory=false;
  5462. keyCode=0;
  5463. }
  5464. onChest=false;
  5465. isCrafting=false;
  5466. isSmelting=false;
  5467. e2open=false;
  5468. fill(199, 199, 199);
  5469. stroke(0, 0, 0);
  5470. strokeWeight(3);
  5471. rect(50, 10, 300, 300);
  5472. textSize(20);
  5473. fill(0, 0, 0);
  5474. text("Inventory:", 60, 30);
  5475. textSize(12);
  5476. strokeWeight(2);
  5477. noStroke();
  5478. drawInventory(70, 50, 40, invContents);
  5479. for(var d = 0; d < 2; d++){
  5480. for(var e = 0; e < 2; e++){
  5481. strokeWeight(2);
  5482. stroke(0, 0, 0);
  5483. fill(222, 222, 222);
  5484. rect(d*35+240, e*35+40, 35, 35);
  5485. fill(0, 0, 0);
  5486. noStroke();
  5487. drawBlocks(craftingSquares[e][d], d*35+250, e*35+50);
  5488. }
  5489. }
  5490. stroke(0, 0, 0);
  5491. fill(100);
  5492. rect(240, 250, 70, 45);
  5493. image(skin, 250, 220, 50, 90);
  5494. fill(222, 222, 222);
  5495. for(var d = 0; d < 2; d++){
  5496. for(var e = 0; e < 2; e++){
  5497. strokeWeight(2);
  5498. rect(d*35+240, e*30+190, 35, 30);
  5499. fill(0, 0, 0);
  5500. noStroke();
  5501. drawBlocks(armorSlots[e*2+d], d*35+250, e*30+195);
  5502. if(itemDurabilities[armorSlots[e*2+d]]!==null&&armorSpecs[e*2+d]!==itemDurabilities[armorSlots[e*2+d]]){
  5503. var filler = 255/itemDurabilities[armorSlots[e*2+d]];
  5504. fill(255-armorSpecs[e*2+d]*filler, armorSpecs[e*2+d]*filler, 0);
  5505. rect(d*35+250, e*30+216, armorSpecs[e*2+d]/(itemDurabilities[armorSlots[e*2+d]]/20), 3);
  5506. if(armorSpecs[e*2+d]<=0){
  5507. armorSlots[e*2+d]=0;
  5508. armorSpecs[e*2+d]=0;
  5509. }
  5510. }
  5511. fill(222, 222, 222);
  5512. stroke(0);
  5513. }
  5514. }
  5515. rect(255, 140, 40, 40);
  5516. drawBlocks(craftedItem, 265, 150);
  5517. drawBlocks(holdingBlock, mouseX-10, mouseY-10);
  5518. if(NBTtag!==null&&NBTtag!==""&&NBTtag!==undefined){
  5519. stroke(54, 0, 171);
  5520. fill(0, 0, 0);
  5521. rect(mouseX, mouseY-15, 85, 15);
  5522. fill(255, 255, 255);
  5523. text(NBTtag, mouseX, mouseY);
  5524. }
  5525. fill(255);
  5526. if(holdingStacks>1){
  5527. textSize(15);
  5528. text(holdingStacks, mouseX+10, mouseY+13);
  5529. textSize(12);
  5530. }
  5531. textSize(15);
  5532. if(craftedStacks>1){
  5533. text(craftedStacks, 285, 177);
  5534. }
  5535. var canCraft;
  5536. var itemCrafted = false;
  5537. for(var i = 0; i < recipes.length; i++){
  5538. if(!itemCrafted){
  5539. for(var j = 0; j < recipes[i].length; j++){
  5540. if(recipes[i].length>0){
  5541. canCraft = true;
  5542. for(var k = 0; k < 9; k++){
  5543. if(craftingGrid[k]!==recipes[i][j][k]&&canCraft){
  5544. canCraft = false;
  5545. }
  5546. }
  5547. if(canCraft){
  5548. craftedItem = i;
  5549. craftedStacks = recipeAmounts[i];
  5550. itemCrafted = true;
  5551. }
  5552. }
  5553. }}
  5554. }
  5555. if(!itemCrafted){
  5556. craftedItem = 0;
  5557. craftedStacks = 0;
  5558. }
  5559. }
  5560. if(isSmelting){
  5561. var targetFurnace = specs[blockTargeted[0]][blockTargeted[1]];
  5562. var fuel = targetFurnace[0];
  5563. var fuelStacks = targetFurnace[1];
  5564. var fuelSpecs = targetFurnace[2];
  5565. var smeltingTime = targetFurnace[3];
  5566. var item = targetFurnace[4];
  5567. var itemStacks = targetFurnace[5];
  5568. var itemSpecs = targetFurnace[6];
  5569. var smeltedItem = targetFurnace[7];
  5570. var smeltedStacks = targetFurnace[8];
  5571. var smeltedSpecs = targetFurnace[9];
  5572. var burnTime = targetFurnace[10];
  5573. var setValue = targetFurnace[11];
  5574. fill(199, 199, 199);
  5575. stroke(0, 0, 0);
  5576. strokeWeight(3);
  5577. rect(50, 10, 300, 300);
  5578. textSize(20);
  5579. fill(0, 0, 0);
  5580. text("Furnace:", 60, 30);
  5581. textSize(12);
  5582. strokeWeight(2);
  5583. noStroke();
  5584. drawInventory(70, 50, 40, invContents);
  5585. noStroke();
  5586. fill(173, 49, 0);
  5587. var fireHeight = (burnTime/setValue)*5;
  5588. triangle(275, 120, 280, 120-fireHeight, 285, 120);
  5589. triangle(265, 120, 270, 120-fireHeight, 275, 120);
  5590. fill(227, 170, 0);
  5591. triangle(277, 120, 280, 122-fireHeight/1.2, 283, 120);
  5592. triangle(267, 120, 270, 122-fireHeight/1.2, 273, 120);
  5593. fill(222);
  5594. stroke(0);
  5595. if(smeltingTime>0&&smeltingTime<49){
  5596. triangle(265, 180, 285, 180, 275, 180+51-smeltingTime);
  5597. }
  5598. rect(255, 50, 40, 40);
  5599. rect(255, 130, 40, 40);
  5600. rect(255, 240, 40, 40);
  5601. drawBlocks(item, 265, 60);
  5602. drawBlocks(smeltedItem, 265, 250);
  5603. drawBlocks(fuel, 265, 140);
  5604. fill(255);
  5605. textSize(15);
  5606. if(smeltedStacks>1){
  5607. text(smeltedStacks, 285, 275);
  5608. }
  5609. if(fuelStacks>1){
  5610. text(fuelStacks, 285, 165);
  5611. }
  5612. if(itemStacks>1){
  5613. text(itemStacks, 285, 85);
  5614. }
  5615. if(fuelStacks>1){
  5616. }
  5617. drawBlocks(holdingBlock, mouseX-10, mouseY-10);
  5618. if(NBTtag!==null&&NBTtag!==""){
  5619. stroke(54, 0, 171);
  5620. fill(0, 0, 0);
  5621. rect(mouseX, mouseY-15, 85, 15);
  5622. fill(255, 255, 255);
  5623. text(NBTtag, mouseX, mouseY);
  5624. }
  5625. fill(255);
  5626. if(holdingStacks>1){
  5627. textSize(15);
  5628. text(holdingStacks, mouseX+10, mouseY+13);
  5629. textSize(12);
  5630. }
  5631. textSize(15);
  5632. specs[blockTargeted[0]][blockTargeted[1]][0]=fuel;
  5633. specs[blockTargeted[0]][blockTargeted[1]][1]=fuelStacks;
  5634. specs[blockTargeted[0]][blockTargeted[1]][2]=fuelSpecs;
  5635. specs[blockTargeted[0]][blockTargeted[1]][3]=smeltingTime;
  5636. specs[blockTargeted[0]][blockTargeted[1]][4]=item;
  5637. specs[blockTargeted[0]][blockTargeted[1]][5]=itemStacks;
  5638. specs[blockTargeted[0]][blockTargeted[1]][6]=itemSpecs;
  5639. specs[blockTargeted[0]][blockTargeted[1]][7]=smeltedItem;
  5640. specs[blockTargeted[0]][blockTargeted[1]][8]=smeltedStacks;
  5641. specs[blockTargeted[0]][blockTargeted[1]][9]=smeltedSpecs;
  5642. specs[blockTargeted[0]][blockTargeted[1]][10]=burnTime;
  5643. }
  5644. for(var e = 0; e < 2; e++){
  5645. for(var d = 0; d < 2; d++){
  5646. if(armorSpecs[e*2+d]<=0){
  5647. armorSlots[e*2+d]=0;
  5648. armorSpecs[e*2+d]=0;
  5649. }}}
  5650. if(e2open===true&&news===false){
  5651. fill(189, 189, 189);
  5652. stroke(0, 0, 0);
  5653. strokeWeight(3);
  5654. rect(100, 0, 300, 50);
  5655. textSize(20);
  5656. fill(0, 0, 0);
  5657. text("Press E to open your inventory", 110, 30);
  5658. textSize(12);
  5659. strokeWeight(2);
  5660. noStroke();
  5661. }
  5662. for(var ii = 0; ii < 4; ii++){
  5663. for(var jj = 0; jj < 6; jj++){
  5664. if(invStacks[jj][ii]===0){
  5665. invContents[jj][ii]=0;
  5666. }
  5667. if(invContents[jj][ii]===0){
  5668. invSpecs[jj][ii]=0;
  5669. }
  5670. }
  5671. }
  5672. if(health<1){
  5673. isDead=true;
  5674. }
  5675. if(news===true){
  5676. fill(189, 189, 189);
  5677. stroke(0, 0, 0);
  5678. strokeWeight(3);
  5679. rect(100, 100, 200, 200);
  5680. textSize(20);
  5681. fill(0, 0, 0);
  5682. text("News:", 110, 120);
  5683. textSize(15);
  5684. text(MainArticle, 110, 130, 180, 160);
  5685. textSize(12);
  5686. text(NEWS, 110, 180, 180, 140);
  5687. textSize(10);
  5688. text("Press Enter to close", 110, 290);
  5689. textSize(12);
  5690. strokeWeight(2);
  5691. }
  5692. if(keys[ENTER]&&news){
  5693. news=false;
  5694. }
  5695. if(isCrafting){
  5696. fill(199, 199, 199);
  5697. stroke(0, 0, 0);
  5698. strokeWeight(3);
  5699. rect(50, 10, 300, 300);
  5700. textSize(20);
  5701. fill(0, 0, 0);
  5702. text("Crafting:", 60, 30);
  5703. textSize(12);
  5704. strokeWeight(2);
  5705. noStroke();
  5706. drawInventory(70, 50, 40, invContents);
  5707. for(var d = 0; d < 3; d++){
  5708. for(var e = 0; e < 3; e++){
  5709. strokeWeight(2);
  5710. stroke(0, 0, 0);
  5711. fill(222, 222, 222);
  5712. rect(d*35+240, e*35+40, 35, 35);
  5713. fill(0, 0, 0);
  5714. noStroke();
  5715. drawBlocks(craftingSquares[e][d], d*35+250, e*35+50);
  5716. }
  5717. }
  5718. stroke(0, 0, 0);
  5719. fill(222, 222, 222);
  5720. rect(270, 225, 45, 45);
  5721. drawBlocks(craftedItem, 283, 238);
  5722. drawBlocks(holdingBlock, mouseX-10, mouseY-10);
  5723. fill(255);
  5724. if(holdingStacks>1){
  5725. textSize(15);
  5726. text(holdingStacks, mouseX+10, mouseY+13);
  5727. textSize(12);
  5728. }
  5729. if(NBTtag!==null&&NBTtag!==""){
  5730. stroke(54, 0, 171);
  5731. fill(0, 0, 0);
  5732. var length = 1;
  5733. rect(mouseX, mouseY-15, length*85, 15);
  5734. fill(255, 255, 255);
  5735. text(NBTtag, mouseX, mouseY);
  5736. }
  5737. textSize(15);
  5738. fill(255, 255, 255);
  5739. if(craftedStacks>1){
  5740. text(craftedStacks, 303, 270);
  5741. }
  5742. var canCraft;
  5743. var itemCrafted = false;
  5744. for(var i = 0; i < recipes.length; i++){
  5745. if(!itemCrafted){
  5746. for(var j = 0; j < recipes[i].length; j++){
  5747. if(recipes[i].length>0){
  5748. canCraft = true;
  5749. for(var k = 0; k < 9; k++){
  5750. if(craftingGrid[k]!==recipes[i][j][k]&&canCraft){
  5751. canCraft = false;
  5752. }
  5753. }
  5754. if(canCraft){
  5755. craftedItem = i;
  5756. craftedStacks = recipeAmounts[i];
  5757. itemCrafted = true;
  5758. }
  5759. }
  5760. }}
  5761. }
  5762. if(!itemCrafted){
  5763. craftedItem = 0;
  5764. craftedStacks = 0;
  5765. }
  5766. }
  5767. if(keyCode===113){
  5768. broadcast("World saved and printed.");
  5769. broadcast("Copy the code over var world.");
  5770. println("var world = [");
  5771. if(nether===false){
  5772. for(var m = 0; m < world.length; m++){
  5773. if(m===world.length-1){
  5774. println("["+world[m]+"]];");
  5775. }else{
  5776. println("["+world[m]+"],");
  5777. }
  5778. }
  5779. }else{
  5780. for(var n = 0; n < overWorld.length; n++){
  5781. if(n===overWorld.length-1){
  5782. println("["+overWorld[n]+"]];");
  5783. }else{
  5784. println("["+overWorld[n]+"],");
  5785. }
  5786. }
  5787. }
  5788. println("var netherWorld = [");
  5789. if(nether===false){
  5790. for(var o = 0; o < netherWorld.length; o++){
  5791. if(o===netherWorld.length-1){
  5792. println("["+netherWorld[o]+"]];");
  5793. }else{
  5794. println("["+netherWorld[o]+"],");
  5795. }
  5796. }
  5797. }else{
  5798. for(var p = 0; p < world.length; p++){
  5799. if(p===world.length-1){
  5800. println("["+world[p]+"]];");
  5801. }else{
  5802. println("["+world[p]+"],");
  5803. }
  5804. }
  5805. }
  5806. keyCode=0;
  5807. }
  5808. //the Bennimus Studios logo
  5809. scale(0.25, 0.25);
  5810. noStroke();
  5811. fill(255, 255, 255);
  5812. ellipse(1500, 100, 125, 125);
  5813. fill(255, 213, 168);
  5814. rect(1465, 91, 30, 68);
  5815. ellipse(1480, 91, 30, 30);
  5816. rect(1480, 103, 45, 15);
  5817. rect(1480, 76, 45, 15);
  5818. ellipse(1526, 83.5, 20, 14);
  5819. ellipse(1526, 110.5, 20, 14);
  5820. stroke(0, 0, 0);
  5821. strokeWeight(5);
  5822. point(1480, 87);
  5823. line(1527, 100, 1562, 100);
  5824. line(1537, 100, 1537, 91);
  5825. noStroke();
  5826. fill(255, 0, 0);
  5827. ellipse(1537, 83, 10, 10);
  5828. fill(143, 143, 143);
  5829. rect(1525, 95, 25, 15);
  5830. stroke(255, 0, 0);
  5831. noFill();
  5832. strokeWeight(12);
  5833. ellipse(1500, 100, 125, 125);
  5834. scale(4, 4);
  5835. if(debugMenu===true){
  5836. if(nether===true||night===true){
  5837. fill(255, 255, 255);
  5838. }else{
  5839. fill(0, 0, 0);
  5840. }
  5841. text("Minecraft Khan Academy edition " + version, 10, 20);
  5842. text("Bennimus Studios", 10, 30);
  5843. text("Key Code: " + keyCode, 10, 50);
  5844. text("Mouse Button: " + mouseButton, 10, 60);
  5845. text("Inventory: " + inventory, 10, 70);
  5846. text("Current block: " + world[a][b], 10, 80);
  5847. text("Time: " + time, 120, 50);
  5848. text("Sun Pos: " + sunPos.toFixed(0, 0), 120, 60);
  5849. text("Crouching: " + isSitting, 120, 70);
  5850. text("Blocks generated: " + world[0].length, 120, 80);
  5851. text("Asteroids spawned: " + mobs.length, 120, 90);
  5852. text("Position: " + place, 240, 50);
  5853. text("Jump: " + jump, 240, 60);
  5854. text("Inside block: " + world[posA][posB], 240, 70);
  5855. text("Blocks fallen: " + blocksFallen, 240, 80);
  5856. text("x: " + posB + " (cursor " + b + ")", 10, 100);
  5857. text("y: " + posA + " (cursor " + a + ")", 10, 110);
  5858. text("x2: " + posB2, 10, 120);
  5859. text("y2: " + posA2, 10, 130);
  5860. text("Key ticks: " + keyTimer, 240, 90);
  5861. text("Sprinting: " + isSprinting, 240, 100);
  5862. }
  5863. if(hide === false&&isDead===false){
  5864. noStroke();
  5865. fill(255);
  5866. rect(mouseX - 5, mouseY - 1, 10, 2);
  5867. rect(mouseX - 1, mouseY - 5, 2, 10);
  5868. }else if(hide===false){
  5869. cursor();
  5870. }}
  5871. var damage = oldHealth-health;
  5872. armor = 0;
  5873. for(var i = 0; i < 4; i++){
  5874. switch(armorSlots[i]){
  5875. case 320:
  5876. armor+=2;
  5877. break;
  5878. case 321:
  5879. armor+=6;
  5880. break;
  5881. case 322:
  5882. armor+=5;
  5883. break;
  5884. case 323:
  5885. armor+=2;
  5886. break;
  5887. case 324:
  5888. armor+=2;
  5889. break;
  5890. case 325:
  5891. armor+=5;
  5892. break;
  5893. case 326:
  5894. armor+=3;
  5895. break;
  5896. case 327:
  5897. armor++;
  5898. break;
  5899. case 328:
  5900. armor+=3;
  5901. break;
  5902. case 329:
  5903. armor+=8;
  5904. break;
  5905. case 330:
  5906. armor+=6;
  5907. break;
  5908. case 331:
  5909. armor+=3;
  5910. break;
  5911. case 332:
  5912. armor++;
  5913. break;
  5914. case 333:
  5915. armor+=3;
  5916. break;
  5917. case 334:
  5918. armor+=2;
  5919. break;
  5920. case 335:
  5921. armor++;
  5922. break;
  5923. }
  5924. }
  5925. if(damageTimer>0){
  5926. damageTimer--;
  5927. }
  5928. if(damageTimer>0&&damage>0){
  5929. health=oldHealth;
  5930. isDead=false;
  5931. if(damageTimer<=0){
  5932. health-=damage;
  5933. health+=round((damage*(armor/20))*0.8);
  5934. }
  5935. }
  5936. if(health<=0){
  5937. isDead=true;
  5938. }
  5939. if(damage>0&&damageTimer===0){
  5940. damageTimer=20;
  5941. health+=round(damage*(armor/20))*0.8;
  5942. for(var i = 0; i < 4; i++){
  5943. if(armorSpecs[i]>0){
  5944. armorSpecs[i]--;
  5945. }
  5946. }
  5947. }
  5948. oldHealth=health;
  5949. if(options.peaceful){
  5950. if(regenTix<=0){
  5951. regenTix=50;
  5952. health++;
  5953. }else{
  5954. regenTix--;
  5955. }
  5956. }
  5957. if(health>20){
  5958. health=20;
  5959. }
  5960. if(oldHealth>20){
  5961. oldHealth=20;
  5962. }
  5963. noCursor();
  5964. if(health>0){
  5965. isDead=false;
  5966. }
  5967. if(!bennimusStudios){
  5968. for(var l = 0; l < health/2; l++){
  5969. if(health<=4){
  5970. if(health < 3){
  5971. image(heart, l*16+20, 317+shake, 12, 20);
  5972. }else{
  5973. if(shaken===false){
  5974. shaken=true;
  5975. image(heart, l*16+25, 317+shake, 12, 20);
  5976. }else{
  5977. image(heart, l*16+25, 317-shake, 12, 20);
  5978. shaken=false;
  5979. }
  5980. }
  5981. }else{
  5982. image(heart, l*16+23, 317, 12, 20);
  5983. }
  5984. }
  5985. for(var l = 0; l < (health-1)/2; l++){
  5986. if(health<=4){
  5987. if(health < 3){
  5988. image(heart, l*16+20, 312+shake, 19, 28);
  5989. }else{
  5990. if(shaken===false){
  5991. shaken=true;
  5992. image(heart, l*16+20, 312+shake, 19, 28);
  5993. }else{
  5994. image(heart, l*16+20, 312-shake, 19, 28);
  5995. shaken=false;
  5996. }
  5997. }
  5998. }else{
  5999. image(heart, l*16+20, 312, 19, 28);
  6000. }
  6001. }}
  6002. if(world[posA][posB-(-5)]===undefined){
  6003. background(105, 42, 0);
  6004. textAlign(CENTER, CENTER);
  6005. fill(225);
  6006. textSize(20);
  6007. text("Building Terrain...", 200, 150);
  6008. textAlign(TOP, LEFT);
  6009. }
  6010. if(bennimusStudios===false&&isDead){
  6011. noStroke();
  6012. fill(200, 0, 0, 5);
  6013. rect(0, 0, 400, 400);
  6014. fill(255, 255, 255);
  6015. textSize(30);
  6016. text("You are dead.", 115, 100);
  6017. textSize(15);
  6018. text("Retry | |\n V V", 307, 378);
  6019. textSize(12);
  6020. }
  6021. if(bennimusStudios){
  6022. logoTix++;
  6023. if(logoTix<70){
  6024. noStroke();
  6025. fill(255, 213, 168);
  6026. rect(130, 183, 60, 137);
  6027. ellipse(160, 183, 60, 60);
  6028. rect(160, 207, 70, 30);
  6029. rect(160, 153, 70, 30);
  6030. ellipse(230, 168, 40, 29);
  6031. ellipse(230, 222, 40, 29);
  6032. stroke(0, 0, 0);
  6033. strokeWeight(10);
  6034. point(161, 175);
  6035. line(255, 200, 325, 200);
  6036. line(275, 200, 275, 175);
  6037. noStroke();
  6038. fill(255, 0, 0);
  6039. ellipse(275, 167, 20, 20);
  6040. fill(143, 143, 143);
  6041. rect(250, 190, 50, 30);
  6042. stroke(0, 0, 0);
  6043. stroke(255, 0, 0);
  6044. noFill();
  6045. strokeWeight(25);
  6046. ellipse(200, 200, 250, 250);
  6047. fill(0, 0, 0);
  6048. textSize(40);
  6049. text("BENNIMUS STUDIOS", 0, 370);
  6050. }
  6051. if(logoTix>70){
  6052. noStroke();
  6053. fill(255, 255, 255, 30);
  6054. rect(0, 0, 400, 400);
  6055. }
  6056. if(logoTix>100){
  6057. bennimusStudios=false;
  6058. onTitleScreen=true;
  6059. herp = 0;
  6060. }
  6061. }
  6062. if(herp===undefined){
  6063. herp=0;
  6064. }
  6065. if(optionsScreen){
  6066. cursor();
  6067. background(117, 64, 0);
  6068. fill(225);
  6069. textSize(50);
  6070. textAlign(CENTER, CENTER);
  6071. text("Options", 200, 50);
  6072. textSize(20);
  6073. button(100, 100, 200, 25, 10, true, "Clouds: "+options.clouds);
  6074. button(100, 130, 200, 25, 11, true, "Fire Animation: "+options.fireAnimation);
  6075. button(100, 160, 200, 25, 12, true, "Peaceful mode: "+options.peaceful);
  6076. button(150, 350, 100, 25, 2, true, "Back");
  6077. if(functions[2]){
  6078. optionsScreen=false;
  6079. }
  6080. if(functions[10]){
  6081. options.clouds=options.clouds?false:true;
  6082. }
  6083. if(functions[11]){
  6084. options.fireAnimation=options.fireAnimation?false:true;
  6085. }
  6086. if(functions[12]){
  6087. options.peaceful=options.peaceful?false:true;
  6088. }
  6089. }else if(onTitleScreen){
  6090. cursor();
  6091. background(196, 225, 255);
  6092. drawWorld();
  6093. scrollX = sin(herp)*50-200;
  6094. herp++;
  6095. fill(150);
  6096. stroke(0);
  6097. rect(50, 25, 305, 50);
  6098. fill(0, 0, 0, 100);
  6099. textAlign(CENTER, CENTER);
  6100. textSize(50);
  6101. text("MINECRAFT", 200, 55);
  6102. fill(200);
  6103. textSize(53);
  6104. text("MINECRAFT", 200, 50);
  6105. fill(125);
  6106. rect(100, 70, 200, 30);
  6107. fill(0, 0, 0, 100);
  6108. textSize(16);
  6109. text("KHAN ACADEMY EDITION", 200, 86);
  6110. fill(200);
  6111. textSize(17);
  6112. text("KHAN ACADEMY EDITION", 200, 85);
  6113. fill(163, 139, 0);
  6114. translate(300, 85);
  6115. rotate(340);
  6116. textSize((sin(herp*30)*3+20)-(splashes[curSplash].length-20)/2);
  6117. text(splashes[curSplash], 0,0);
  6118. resetMatrix();
  6119. fill(242, 210, 3);
  6120. translate(298, 84);
  6121. rotate(340);
  6122. text(splashes[curSplash], 0,0);
  6123. resetMatrix();
  6124. fill(0);
  6125. if(herp>360){
  6126. herp=0;
  6127. }
  6128. textSize(25);
  6129. button(125, 150, 150, 30, 0, true, "Singleplayer");
  6130. button(125, 185, 150, 30, 1, true, "Options");
  6131. textSize(20);
  6132. text(version, 30, 375);
  6133. fill(200);
  6134. rect(50, 250, 300, 100);
  6135. fill(0);
  6136. textAlign(CENTER, CENTER);
  6137. text("<<NEWS>>", 200, 265);
  6138. fill(0);
  6139. textAlign(LEFT, BOTTOM);
  6140. textSize(15);
  6141. text(MainArticle, 55, 290);
  6142. textSize(12);
  6143. text(NEWS, 55, 285, 290, 100);
  6144. if(functions[1]){
  6145. optionsScreen=true;
  6146. }
  6147. if(functions[0]){
  6148. onTitleScreen=false;noCursor();
  6149. broadcast("<<<( ~Bennimus Studios~ )>>>");
  6150. broadcast("Welcome to Minecraft "+version+"!");
  6151. broadcast("A & D to move left and right,");
  6152. broadcast("W or Space to jump,");
  6153. broadcast("E to open your inventory,");
  6154. broadcast("T to chat.");
  6155. broadcast("<<<( ~<><><><><><><>~ )>>>");
  6156. }
  6157. }
  6158. if(heartsShowing){
  6159. frameRate(30);
  6160. filter(INVERT);
  6161. fill(0, 255, 255);
  6162. textSize(20);
  6163. text("Time left: " + shieldsShowing, 270, 350);
  6164. textSize(12);
  6165. }else{
  6166. frameRate(60);
  6167. }
  6168. }catch(error){
  6169. background(255);
  6170. fill(0);
  6171. textAlign(CENTER, CENTER);
  6172. textSize(80);
  6173. image(getImage("creatures/OhNoes"), 75, 0);
  6174. text("OH NOES!",200,150);
  6175. textSize(20);
  6176. fill(225);
  6177. strokeWeight(10);
  6178. stroke(0);
  6179. rect(25, 200, 350, 150, 10);
  6180. fill(0);
  6181. textAlign(LEFT, TOP);
  6182. text(error, 35, 210, 300, 125);
  6183. fill(255, 0, 0);
  6184. text("Minecraft v"+version, 250, 20);
  6185. text("Please report this crash in the Tips & Thanks.\n Thank you for your support!", 5, 355);
  6186. }
  6187. };
  6188. keyPressed = function(){
  6189. if(!onInputBox||keyCode===SHIFT){
  6190. keys[keyCode]=true;
  6191. }else{
  6192. switch(keyCode){
  6193. case ENTER:
  6194. onInputBox=false;
  6195. if(input!==""){
  6196. if(input.substr(0,1)==="/"){
  6197. var commandLine = input.split(" ");
  6198. switch(commandLine[0]){
  6199. case "/help":
  6200. broadcast("==========[ HELP ]==========");
  6201. broadcast("/give [data] [amount]");
  6202. broadcast("gives you item by data and amount");
  6203. broadcast("/clear");
  6204. broadcast("clears your inventory");
  6205. broadcast("/kill");
  6206. broadcast("Ouch! that look like it hurt!");
  6207. broadcast("/killall");
  6208. broadcast("kills everything. Good for dat lag");
  6209. broadcast("==========================");
  6210. break;
  6211. case "/me":
  6212. var message = "";
  6213. for(var i = 1; i < commandLine.length; i++){
  6214. message+=commandLine[i]+" ";
  6215. }
  6216. broadcast("* "+username+" "+message);
  6217. break;
  6218. case "/clear":
  6219. var itemsCleared = 0;
  6220. for(var i = 0; i < 9; i++){
  6221. itemsCleared+=hotbarStacks[i];
  6222. hotbar[i]=0;hotbarStacks[i]=0;
  6223. }
  6224. for(var i = 0; i < 6; i++){
  6225. for(var j = 0; j < 4; j++){
  6226. itemsCleared+=invStacks[i][j];
  6227. invContents[i][j]=0;invStacks[i][j]=0;
  6228. }
  6229. }
  6230. for(var i = 0; i < 4; i++){
  6231. if(armorSlots[i]){
  6232. itemsCleared++;
  6233. armorSlots[i]=0;armorSpecs[i]=0;
  6234. }
  6235. }
  6236. if(itemsCleared){
  6237. broadcast("Cleared the inventory of "+username+", removing "+itemsCleared+" items.");
  6238. }else{
  6239. broadcast("Could not clear the inventory of "+username+", no items to remove.");
  6240. }
  6241. break;
  6242. case "/give":
  6243. if(commandLine[1]!==undefined&&(commandLine[1]>0&&commandLine[1]<blocks)||(commandLine[1]>=300&&commandLine[1]<items)){
  6244. if(commandLine[2]){
  6245. getItem(commandLine[1]-0, commandLine[2]-0);
  6246. }else{
  6247. getItem(commandLine[1]-0, 1);
  6248. commandLine[2]=1;
  6249. }
  6250. if(commandLine[1]<300){
  6251. broadcast("given "+username+" "+commandLine[2]+" of "+commandLine[1]+" ("+tileNames[commandLine[1]]+").");
  6252. }else{
  6253. broadcast("given "+username+" "+commandLine[2]+" of "+commandLine[1]+" ("+itemNames[commandLine[1]-300]+").");
  6254. }
  6255. }else{
  6256. broadcast(commandLine[1]+" is not a valid number.");
  6257. }
  6258. break;
  6259. case "/kill":
  6260. health=0;
  6261. broadcast("Ouch! That look like it hurt!");
  6262. break;
  6263. case "/killall":
  6264. var mobsKilled = 0;
  6265. for(var i = 0; i < mobs.length; i++){
  6266. if(mobs.health[i]>0){
  6267. mobsKilled++;
  6268. }
  6269. mobs.health[i]=0;
  6270. }
  6271. broadcast("An asteroid collides with the earth, obliterating "+mobsKilled+" entities.");
  6272. break;
  6273. case "/time":
  6274. if(commandLine[1]!==undefined&&commandLine[2]!==undefined){
  6275. switch(commandLine[1]){
  6276. case "set":
  6277. time=commandLine[2];
  6278. broadcast("Time set to "+time);
  6279. break;
  6280. case "add":
  6281. time+=commandLine[2]-0;
  6282. if(time>20000){
  6283. while(time>20000){
  6284. time-=20000;
  6285. }
  6286. }
  6287. broadcast("Time set to "+time);
  6288. break;
  6289. default:
  6290. broadcast("Usage: /time <set/add> <value>");
  6291. }
  6292. }else{broadcast("Usage: /time <set/add> <value>");}
  6293. break;
  6294. default:
  6295. broadcast("Unknown command. Type /help for help.");
  6296. }
  6297. }else{
  6298. broadcast("<"+username+"> "+input);
  6299. }
  6300. }input="";
  6301. break;
  6302. case 32:
  6303. input+=" ";
  6304. break;
  6305. case 48:
  6306. if(keys[SHIFT]){
  6307. input+=")";
  6308. }else{
  6309. input+="0";
  6310. }
  6311. break;
  6312. case 49:
  6313. if(keys[SHIFT]){
  6314. input+="!";
  6315. }else{
  6316. input+="1";
  6317. }
  6318. break;
  6319. case 50:
  6320. if(keys[SHIFT]){
  6321. input+="@";
  6322. }else{
  6323. input+="2";
  6324. }
  6325. break;
  6326. case 51:
  6327. if(keys[SHIFT]){
  6328. input+="#";
  6329. }else{
  6330. input+="3";
  6331. }
  6332. break;
  6333. case 52:
  6334. if(keys[SHIFT]){
  6335. input+="$";
  6336. }else{
  6337. input+="4";
  6338. }
  6339. break;
  6340. case 53:
  6341. if(keys[SHIFT]){
  6342. input+="%";
  6343. }else{
  6344. input+="5";
  6345. }
  6346. break;
  6347. case 54:
  6348. if(keys[SHIFT]){
  6349. input+="^";
  6350. }else{
  6351. input+="6";
  6352. }
  6353. break;
  6354. case 55:
  6355. if(keys[SHIFT]){
  6356. input+="&";
  6357. }else{
  6358. input+="7";
  6359. }
  6360. break;
  6361. case 56:
  6362. if(keys[SHIFT]){
  6363. input+="*";
  6364. }else{
  6365. input+="8";
  6366. }
  6367. break;
  6368. case 57:
  6369. if(keys[SHIFT]){
  6370. input+="(";
  6371. }else{
  6372. input+="9";
  6373. }
  6374. break;
  6375. case 65:
  6376. if(keys[SHIFT]){
  6377. input+="A";
  6378. }else{
  6379. input+="a";
  6380. }
  6381. break;
  6382. case 66:
  6383. if(keys[SHIFT]){
  6384. input+="B";
  6385. }else{
  6386. input+="b";
  6387. }
  6388. break;
  6389. case 67:
  6390. if(keys[SHIFT]){
  6391. input+="C";
  6392. }else{
  6393. input+="c";
  6394. }
  6395. break;
  6396. case 68:
  6397. if(keys[SHIFT]){
  6398. input+="D";
  6399. }else{
  6400. input+="d";
  6401. }
  6402. break;
  6403. case 69:
  6404. if(keys[SHIFT]){
  6405. input+="E";
  6406. }else{
  6407. input+="e";
  6408. }
  6409. break;
  6410. case 70:
  6411. if(keys[SHIFT]){
  6412. input+="F";
  6413. }else{
  6414. input+="f";
  6415. }
  6416. break;
  6417. case 71:
  6418. if(keys[SHIFT]){
  6419. input+="G";
  6420. }else{
  6421. input+="g";
  6422. }
  6423. break;
  6424. case 72:
  6425. if(keys[SHIFT]){
  6426. input+="H";
  6427. }else{
  6428. input+="h";
  6429. }
  6430. break;
  6431. case 73:
  6432. if(keys[SHIFT]){
  6433. input+="I";
  6434. }else{
  6435. input+="i";
  6436. }
  6437. break;
  6438. case 74:
  6439. if(keys[SHIFT]){
  6440. input+="J";
  6441. }else{
  6442. input+="j";
  6443. }
  6444. break;
  6445. case 75:
  6446. if(keys[SHIFT]){
  6447. input+="K";
  6448. }else{
  6449. input+="k";
  6450. }
  6451. break;
  6452. case 76:
  6453. if(keys[SHIFT]){
  6454. input+="L";
  6455. }else{
  6456. input+="l";
  6457. }
  6458. break;
  6459. case 77:
  6460. if(keys[SHIFT]){
  6461. input+="M";
  6462. }else{
  6463. input+="m";
  6464. }
  6465. break;
  6466. case 78:
  6467. if(keys[SHIFT]){
  6468. input+="N";
  6469. }else{
  6470. input+="n";
  6471. }
  6472. break;
  6473. case 79:
  6474. if(keys[SHIFT]){
  6475. input+="O";
  6476. }else{
  6477. input+="o";
  6478. }
  6479. break;
  6480. case 80:
  6481. if(keys[SHIFT]){
  6482. input+="P";
  6483. }else{
  6484. input+="p";
  6485. }
  6486. break;
  6487. case 81:
  6488. if(keys[SHIFT]){
  6489. input+="Q";
  6490. }else{
  6491. input+="q";
  6492. }
  6493. break;
  6494. case 82:
  6495. if(keys[SHIFT]){
  6496. input+="R";
  6497. }else{
  6498. input+="r";
  6499. }
  6500. break;
  6501. case 83:
  6502. if(keys[SHIFT]){
  6503. input+="S";
  6504. }else{
  6505. input+="s";
  6506. }
  6507. break;
  6508. case 84:
  6509. if(keys[SHIFT]){
  6510. input+="T";
  6511. }else{
  6512. input+="t";
  6513. }
  6514. break;
  6515. case 85:
  6516. if(keys[SHIFT]){
  6517. input+="U";
  6518. }else{
  6519. input+="u";
  6520. }
  6521. break;
  6522. case 86:
  6523. if(keys[SHIFT]){
  6524. input+="V";
  6525. }else{
  6526. input+="v";
  6527. }
  6528. break;
  6529. case 87:
  6530. if(keys[SHIFT]){
  6531. input+="W";
  6532. }else{
  6533. input+="w";
  6534. }
  6535. break;
  6536. case 88:
  6537. if(keys[SHIFT]){
  6538. input+="X";
  6539. }else{
  6540. input+="x";
  6541. }
  6542. break;
  6543. case 89:
  6544. if(keys[SHIFT]){
  6545. input+="Y";
  6546. }else{
  6547. input+="y";
  6548. }
  6549. break;
  6550. case 90:
  6551. if(keys[SHIFT]){
  6552. input+="Z";
  6553. }else{
  6554. input+="z";
  6555. }
  6556. break;
  6557. case 186:
  6558. if(keys[SHIFT]){
  6559. input+=":";
  6560. }else{
  6561. input+=";";
  6562. }
  6563. break;
  6564. case 187:
  6565. if(keys[SHIFT]){
  6566. input+="+";
  6567. }else{
  6568. input+="=";
  6569. }
  6570. break;
  6571. case 188:
  6572. if(keys[SHIFT]){
  6573. input+="<";
  6574. }else{
  6575. input+=",";
  6576. }
  6577. break;
  6578. case 189:
  6579. if(keys[SHIFT]){
  6580. input+="_";
  6581. }else{
  6582. input+="-";
  6583. }
  6584. break;
  6585. case 190:
  6586. if(keys[SHIFT]){
  6587. input+=">";
  6588. }else{
  6589. input+=".";
  6590. }
  6591. break;
  6592. case 191:
  6593. if(keys[SHIFT]){
  6594. input+="?";
  6595. }else{
  6596. input+="/";
  6597. }
  6598. break;
  6599. case 192:
  6600. if(keys[SHIFT]){
  6601. input+="~";
  6602. }else{
  6603. input+="`";
  6604. }
  6605. break;
  6606. case 219:
  6607. if(keys[SHIFT]){
  6608. input+="{";
  6609. }else{
  6610. input+="[";
  6611. }
  6612. break;
  6613. case 220:
  6614. if(keys[SHIFT]){
  6615. input+="|";
  6616. }else{
  6617. input+="\\";
  6618. }
  6619. break;
  6620. case 221:
  6621. if(keys[SHIFT]){
  6622. input+="}";
  6623. }else{
  6624. input+="]";
  6625. }
  6626. break;
  6627. case 222:
  6628. if(keys[SHIFT]){
  6629. input+='"';
  6630. }else{
  6631. input+="'";
  6632. }
  6633. break;
  6634. case CONTROL:
  6635. input=input.substr(0,input.length-1);
  6636. break;
  6637. }
  6638. }
  6639. };
  6640. keyReleased = function(){keys[keyCode]=false;
  6641. if(keyCode===68||keyCode===65){keyTimer=5;isSprinting=false;}};

comments powered by Disqus