var username = "Player";//<== Change username
/************************************************************
*I know this is not a puzzle game, but still, it's
*MINECRAFT, SO UPVOTE FOR THE SAKE OF MOJANG :)
*
*Bennimus Studios
*
*Play with me! Server: < skyblock.cube-mc.com >
*
*HOW TO PLAY:
*A to move left, D to move right, Space to jump.
*Left click a block to destroy it.
*Right click to place a block.
*Use the numbers to pick which block you have selected.
*Numbers follow according to the hotbar at the bottom of
*the screen.
*Press E to open your inventory. Once open, aim your cursor
*over the block you want to select, then press the number
*according to the slot on the hotbar you want to place it
*in.
*Give me your feedback :)
*Report bugs in Tips & Feedback
*Press F2 to save your world.
*
*Version 1.10
* +Added Zombie Pigmen to the Nether
* +Added Torches (to keep the monsters away)
* +Added Sugar cane
* +Added Paper
* +Added Fireworks (Thx for 1000 votes!)
* +TNT can now kill you
* *Smelting TNT will now yield a diamond block
* *Fixed swimming
* *Fixed 1-block player height
* *Chests are no longer presents
* -Removed Herobrine
*
* DATA VALUES:
* (those marked with * are unobtainable except through
* inventory hacking)
* (those marked with ** are generated in the map but
* otherwise unobtainable)
* 0:Air
* 1:Stone
* 2:Grass
* 3:Dirt
* 4:Cobblestone
* 5:Wooden Planks
* 6:Bricks
* 7:Log
* 8:Obsidian
* 9:Leaves
* 10:Bedrock*
* 11:Water
* 12:Flowing Water*
* 13:Lava
* 14:Flowing Lava*
* 15:TNT
* 16:Sapling
* 17:Fire
* 18:Nether Portal*
* 19:Netherrack
* 20:Sand
* 21:Gravel
* 22:Coal ore*
* 23:Iron ore
* 24:Gold ore
* 25:Lapis ore*
* 26:DIAMOND OREZ*
* 27:Crafting table
* 28:Door
* 29:Upper door
* 30:Ladder
* 31:Cactus
* 32:Ice
* 33:Furnace
* 34:Chest
* 35:Mossy Cobblestone
* 36:Monster spawner
* 37:Block of Iron
* 38:Block of Gold
* 39:Block of Diamond
* 40:Torch
* 41:Sugar cane
* 300:Stick
* 301:Coal
* 302:Iron ingot
* 303:Gold ingot
* 304:Lapis Lazuli
* 305:DIAMONDZ
* 306:Flint
* 307-311:Picks
* 312-316:Swords
* 317:Raw Porkchop
* 318:Gunpowder
* 319:Cooked Porkchop
* 320-335: Leather-Diamond Armor
* 336:Leather
* 337:Bucket
* 338:Milk bucket
* 339:Paper
* 340:Firework
************************************************************/
var blocks = 41;//Number of blocks
var items = 340;//Number of items + 299
var madPigmen = false;
var pigmanTimer = 0;
var minJump = 0;
var optionsScreen = false;
var regenTix = 0;
var options = {
clouds: true,
fireAnimation: true,
peaceful: false
};
var functions = [];
var button = function(x, y, l, w, f, t, txt){
if(mouseX>x&&mouseX<x+l&&mouseY>y&&mouseY<y+w&&t){
if(mouseIsPressed){
functions[f]=true;
fill(117, 117, 117);
mouseIsPressed=false;
}else{
functions[f]=false;
fill(216, 216, 240);
}
}else{
functions[f]=false;
fill(t?200:117);
}
rect(x, y, l, w);
textAlign(CENTER, CENTER);
fill(0);
text(txt, x+l/2, y+w/2);
textAlign(LEFT, TOP);
};
//All inventory objects with values >= 300 are
//considered ITEMS. Things that cannot be placed
items++;blocks++;
//Variable declaration
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];
solidBlocks[undefined]=true;
var damageTimer = 0;
var maxStacks = [];
for(var i = 0; i < items; i++){
switch(i){
case 11:
maxStacks[i]=1;
break;
case 13:
maxStacks[i]=1;
break;
case 17:
maxStacks[i]=1;
break;
case 307:
maxStacks[i]=1;
break;
case 308:
maxStacks[i]=1;
break;
case 309:
maxStacks[i]=1;
break;
case 310:
maxStacks[i]=1;
break;
case 311:
maxStacks[i]=1;
break;
case 312:
maxStacks[i]=1;
break;
case 313:
maxStacks[i]=1;
break;
case 314:
maxStacks[i]=1;
break;
case 315:
maxStacks[i]=1;
break;
case 316:
maxStacks[i]=1;
break;
case 320:
maxStacks[i]=1;
break;
case 321:
maxStacks[i]=1;
break;
case 322:
maxStacks[i]=1;
break;
case 323:
maxStacks[i]=1;
break;
case 324:
maxStacks[i]=1;
break;
case 325:
maxStacks[i]=1;
break;
case 326:
maxStacks[i]=1;
break;
case 327:
maxStacks[i]=1;
break;
case 328:
maxStacks[i]=1;
break;
case 329:
maxStacks[i]=1;
break;
case 330:
maxStacks[i]=1;
break;
case 331:
maxStacks[i]=1;
break;
case 332:
maxStacks[i]=1;
break;
case 333:
maxStacks[i]=1;
break;
case 334:
maxStacks[i]=1;
break;
case 335:
maxStacks[i]=1;
break;
case 337:
maxStacks[i]=16;
break;
case 338:
maxStacks[i]=1;
break;
default:
maxStacks[i]=64;
}
}
var tileNames = [
"",
"Stone",
"Grass",
"Dirt",
"Cobblestone",
"Wooden Planks",
"Bricks",
"Wood",
"Obsidian",
"Leaves",
"Bedrock",
"Water bucket",
"Hacked water",
"Lava bucket",
"Hacked lava",
"TNT",
"Sapling",
"Flint and Steel",
"Hacked Portal",
"Netherrack",
"Sand",
"Gravel",
"Coal ore",
"Iron ore",
"Gold ore",
"Lapis lazuli ore",
"Diamond ore",
"Crafting table",
"Wooden Door",
"Hacked Door",
"Ladder",
"Cactus",
"Ice",
"Furnace",
"Chest",
"Moss stone",
"Monster spawner",
"Block of Iron",
"Block of Gold",
"Block of Diamond",
"Torch",
"Sugar cane"
];
var itemNames = [
"Stick",
"Coal",
"Iron ingot",
"Gold ingot",
"Lapis lazuli",
"Diamond",
"Flint",
"Wooden pickaxe",
"Stone pickaxe",
"Iron pickaxe",
"Golden pickaxe",
"Diamond pickaxe",
"Wooden sword",
"Stone sword",
"Iron sword",
"Golden sword",
"Diamond sword",
"Raw porkchop",
"Gunpowder",
"Cooked porkchop",
"Iron helmet",
"Iron chestplate",
"Iron leggings",
"Iron boots",
"Golden helmet",
"Golden chestplate",
"Golden leggings",
"Golden boots",
"Diamond helmet",
"Diamond chestplate",
"Diamond leggings",
"Diamond boots",
"Leather cap",
"Leather tunic",
"Leather trousers",
"Leather boots",
"Leather",
"Bucket",
"Milk bucket",
"Paper",
"Firework"
];
if(username==="SkythekidRS"){
tileNames[24]="Budder ore";
tileNames[38]="Block of Budder";
itemNames[3]="Budder ingot";
itemNames[10]="Budder pickaxe";
itemNames[15]="Budder sword";
itemNames[24]="Budder helmet";
itemNames[25]="Budder chestplate";
itemNames[26]="Budder leggings";
itemNames[27]="Budder boots";
}
var direction = RIGHT;
var armPos = 0;
var armTimer = 0;
var legPos = 0;
var NBTtag = null;
var setTag = function(x){
if(x===0||NBTtag === ""){
NBTtag = null;
}else{
if(x>=300){
NBTtag = itemNames[x-300];
}else{
NBTtag = tileNames[x];
}
}
};
var cloudX = 0;
var itemDurabilities = [];
for(var i = 0; i <= items; i++){
switch(i){
case 17:
itemDurabilities[i] = 65;
break;
case 307:
itemDurabilities[i] = 60;
break;
case 308:
itemDurabilities[i] = 132;
break;
case 309:
itemDurabilities[i] = 251;
break;
case 310:
itemDurabilities[i] = 33;
break;
case 311:
itemDurabilities[i] = 1562;
break;
case 312:
itemDurabilities[i] = 60;
break;
case 313:
itemDurabilities[i] = 132;
break;
case 314:
itemDurabilities[i] = 251;
break;
case 315:
itemDurabilities[i] = 33;
break;
case 316:
itemDurabilities[i] = 1562;
break;
case 320:
itemDurabilities[i] = 166;
break;
case 321:
itemDurabilities[i] = 241;
break;
case 322:
itemDurabilities[i] = 226;
break;
case 323:
itemDurabilities[i] = 196;
break;
case 324:
itemDurabilities[i] = 78;
break;
case 325:
itemDurabilities[i] = 113;
break;
case 326:
itemDurabilities[i] = 106;
break;
case 327:
itemDurabilities[i] = 92;
break;
case 328:
itemDurabilities[i] = 364;
break;
case 329:
itemDurabilities[i] = 529;
break;
case 330:
itemDurabilities[i] = 496;
break;
case 331:
itemDurabilities[i] = 430;
break;
case 332:
itemDurabilities[i] = 56;
break;
case 333:
itemDurabilities[i] = 81;
break;
case 334:
itemDurabilities[i] = 76;
break;
case 335:
itemDurabilities[i] = 66;
break;
default:
itemDurabilities[i] = null;
}
}
var onTitleScreen = false;
var curBiome = 0;
var biomes = [];
for(var i = 0; i < 20; i++){
biomes[i] = curBiome;
}
var splashes = [
"This message will never appear on the splash screen, isn't that weird?",
"As seen on TV!",
"Awesome!",
"100% pure!",
"May contain nuts!",
"Better than Prey!",
"More polygons!",
"Sexy!",
"Limited edition!",
"Flashing letters!",
"Made by Bennimus!",
"It's here!",
"Best in class!",
"It's kinda finished!",
"Absolutely dragon free!",
"Excitement!",
"More than 500 sold!",
"One of a kind!",
"Heaps of hits on YouTube!",
"Indev!",
"Spiders everywhere!",
"Check it out!",
"Holy cow, man!",
"It's a game!",
"Made in Sweden!",
"Uses LWJGL!",
"Reticulating splines!",
"Minecraft!",
"Yaaay!",
"Singleplayer!",
"Keyboard compatible!",
"Undocumented!",
"Ingots!",
"Exploding creepers!",
"That's no moon!",
"l33t!",
"Create!",
"Survive!",
"Dungeon!",
"Exclusive!",
"The bee's knees!",
"Down with O.P.P.!",
"Closed source!",
"Classy!",
"Wow!",
"Not on steam!",
"Oh man!",
"Awesome community!",
"Pixels!",
"Teetsuuuuoooo!",
"Kaaneeeedaaaa!",
"Now with difficulty!",
"Enhanced!",
"90% bug free!",
"Pretty!",
"12 herbs and spices!",
"Fat free!",
"Absolutely no memes!",
"Free dental!",
"Ask your doctor!",
"Minors welcome!",
"Cloud computing!",
"Legal in Finland!",
"Hard to label!",
"Technically good!",
"Bringing home the bacon!",
"Indie!",
"GOTY!",
"Ceci n'est pas une title screen!",
"Euclidian!",
"Now in 2D!",
"Inspirational!",
"Herregud!",
"Complex cellular automata!",
"Yes, sir!",
"Played by cowboys!",
"OpenGL 1.2!",
"Thousands of colors!",
"Try it!",
"Age of Wonders is better!",
"Try the mushroom stew!",
"Sensational!",
"Hot tamale, hot hot tamale!",
"Play him off, keyboard cat!",
"Guaranteed!",
"Macroscopic!",
"Bring it on!",
"Random splash!",
"Call your mother!",
"Monster infighting!",
"Loved by millions!",
"Ultimate edition!",
"Freaky!",
"You've got a brand new key!",
"Water proof!",
"Uninflammable!",
"Whoa, dude!",
"All inclusive!",
"Tell your friends!",
"NP is not in P!",
"Notch <3 ez!",
"Music by C418!",
"Livestreamed!",
"Haunted!",
"Polynomial!",
"Terrestrial!",
"All is full of love!",
"Full of stars!",
"Scientific!",
"Cooler than Spock!",
"Collaborate and listen!",
"Never dig down!",
"Take frequent breaks!",
"Not linear!",
"Han shot first!",
"Nice to meet you!",
"Buckets of lava!",
"Ride the pig!",
"Larger than Earth!",
"sqrt(-1) love you!",
"Phobos anomaly!",
"Punching wood!",
"Falling off cliffs!",
"0% sugar!",
"150% hyperbole!",
"Synecdoche!",
"Let's danec!",
"Seecret Friday update!",
"Reference implementation!",
"Lewd with two dudes with food!",
"Kiss the sky!",
"20 GOTO 10!",
"Verlet intregration!",
"Peter Griffin!",
"Do not distribute!",
"Cogito ergo sum!",
"4815162342 lines of code!",
"A skeleton popped out!",
"The Work of Bennimus!",
"The sum of its parts!",
"BTAF used to be good!",
"I miss ADOM!",
"umop-apisdn!",
"OICU812!",
"Bring me Ray Cokes!",
"Finger-licking!",
"Thematic!",
"Pneumatic!",
"Sublime!",
"Octagonal!",
"Une baguette!",
"Gargamel plays it!",
"Rita is the new top dog!",
"SWM forever!",
"Representing Edsbyn!",
"Matt Damon!",
"Supercalifragilisticexpialidocious!",
"Consummate V's!",
"Cow Tools!",
"Double buffered!",
"Fan fiction!",
"Flaxkikare!",
"Jason! Jason! Jason!",
"Hotter than the sun!",
"Soon to be Internet enabled!",
"Autonomous!",
"Engage!",
"Fantasy!",
"DRR! DRR! DRR!",
"Kick it root down!",
"Regional resources!",
"Woo, facepunch!",
"Woo, somethingawful!",
"Woo, /v/!",
"Woo, tigsource!",
"Woo, minecraftforum!",
"Woo, worldofminecraft!",
"Woo, reddit!",
"Woo, 2pp!",
"Woo, Khan Academy!",
"Google anlyticsed!",
"Now supports åäö!",
"Give us Gordon!",
"Tip your waiter!",
"Very fun!",
"12345 is a bad password!",
"Vote for net neutrality!",
"Lives in a pineapple under the sea!",
"MAP11 has two names!",
"Omnipotent!",
"Gasp!",
"...!",
"Bees, bees, bees, bees!",
"Jag känner en bot!",
"Haha, LOL!",
"Hampsterdance!",
"Switches and ores!",
"Menger sponge!",
"idspispopd!",
"Eple (original edit)!",
"So fresh, so clean!",
"Slow acting portals!",
"Try the Nether!",
"Don't look directly at the bugs!",
"Oh, ok, Pigmen!",
"Finally with ladders!",
"Scary!",
"Play Minecraft, Watch Topgear, Get Pig!",
"Twittered about!",
"Jump up, jump up, and get down!",
"Joel is neat!",
"A riddle, wrapped in a mystery!",
"Huge tracts of land!",
"Welcome to your Doom!",
"Stay a while, stay forever!",
"Stay a while and listen!",
"Treatment for your rash!",
"'Autological' is!",
"Information wants to be free!",
"'Almost never' is an interesting concept!",
"Lots of truthiness!",
"The creeper is a spy!",
"Turing complete!",
"It's groundbreaking!",
"Let our battle's begin!",
"The sky is the limit!",
"Jeb has amazing hair!",
"Casual gaming!",
"Undefeated!",
"Kinda like Lemmings!",
"Follow the train, CJ!",
"Leveraging synergy!",
"DungeonQuest is unfair!",
"110813!",
"90210!",
"Check out the far lands!",
"Tyrion would love it!",
"Also try VVVVVV!",
"Also try Super Meat Boy!",
"Also try Terraria!",
"Also try Mount And Blade!",
"Also try Project Zomboid!",
"Also try World of Goo!",
"Also try Limbo!",
"Also try Pixeljunk Shooter!",
"Also try Braid!",
"That's super!",
"Bread is pain!",
"Read more books!",
"Khaaaaaaaaan!",
"Less addictive than TV Tropes!",
"More addictive than lemonade!",
"Bigger than a bread box!",
"Millions of peaches!",
"Fnord!",
"This is my true form!",
"Totally forgot about Dre!",
"Don't bother with the clones!",
"Pumpkinhead!",
"Hobo humping slobo babe!",
"Made by Jeb!",
"Has an ending!",
"Finally complete!",
"Feature packed!",
"Boots with the fur!",
"Stop, hammertime!",
"Testificates!",
"Conventional!",
"Homeomorphic to a 3-sphere!",
"Doesn't avoid double negatives!",
"Place ALL the blocks!",
"Does barrel rolls!",
"Meeting expectations!",
"PC gaming since 1873!",
"Ghoughpteighbteau tchoghs!",
"Déjà vu!",
"Got your nose!",
"Haley loves Elan!",
"Afraid of the big, black bat!",
"Doesn't use the U-word!",
"Child's play!",
"See you next Friday or so!",
"From the streets of Södermalm!",
"150 bpm for 400000 minutes!",
"Technologic!",
"Funk soul brother!",
"Pumpa kungen!",
"日本ハロー!",
"한국 안녕하세요!",
"Helo Cymru!",
"Cześć Polsko!",
"你好中国!",
"Привет Россия!",
"Γεια σου Ελλάδα!",
"My life for Aiur!",
"Lennart lennart = new Lennart();",
"I see your vocabulary has improved!",
"Who put it there?",
"You can't explain that!",
"if not ok then return end",
"Colormatic!",
"FUNKY LOL",
"SOPA means LOSER in Swedish!",
"Big Pointy Teeth!",
"Bekarton guards the gate!",
"Mmmph, mmph!",
"Don't feed avocados to parrots!",
"Swords for everyone!",
"Plz reply to my tweet!",
".party()!",
"Take her pillow!",
"Put that cookie down!",
"Pretty scary!",
"I have a suggestion.",
"Now with extra hugs!",
"Now javascript!",
"Woah.",
"HURNERJSGER?",
"What's up, Doc?",
"Now contains 32 random daily cats!"];
var curSplash = round(random(1, splashes.length));
var furnaceRecipes = [];
var burnValues = [];
for(var i = 0; i < items; i++){
switch(i){
case 4:
furnaceRecipes[i]=1;
break;
case 5:
burnValues[i]=1.5;
break;
case 7:
furnaceRecipes[i]=301;
break;
case 13:
burnValues[i]=2000;
break;
case 15:
furnaceRecipes[i]=39;
break;
case 16:
burnValues[i]=0.5;
break;
case 23:
furnaceRecipes[i]=302;
break;
case 24:
furnaceRecipes[i]=303;
break;
case 27:
burnValues[i]=1;
break;
case 300:
burnValues[i]=0.5;
break;
case 301:
burnValues[i]=8;
break;
case 307:
burnValues[i]=1;
break;
case 312:
burnValues[i]=1;
break;
case 317:
furnaceRecipes[i]=319;
break;
default:
burnValues[i]=null;
furnaceRecipes[i]=null;
}
}
var onInputBox = false;
var input = "";
var inputTimer = 25;
var messages = [];
var msgTimers = [];
var broadcast = function(msg){
append(messages, msg);
append(msgTimers, 150);
};
var bennimusStudios = true;
var craftingGrid = [0,0,0,0,0,0,0,0,0];
var recipes = [];
var recipeAmounts = [];
for(var i = 0; i < items; i++){
recipes[i] = [];
recipes[i][0] = [];
switch(i){
case 5:
for(var j = 0; j < 9; j++){
recipes[i][j] = [];
for(var k = 0; k < 9; k++){
if(k===j){
recipes[i][j][k] = 7;
}else{
recipes[i][j][k] = 0;
}
}
}
recipeAmounts[5] = 4;
break;
case 15:
recipes[i][0] =[318,20,318,20,318,20,318,20,318];
break;
case 17:
for(var j = 0; j < 4; j++){
recipes[i][j] = [];
for(var k = 0; k < 9; k++){
if(recipes[i][j][k]===0||recipes[i][j][k]===undefined){
if(k===j){
recipes[i][j][k] = 302;
recipes[i][j][k+4] = 306;
}else{
recipes[i][j][k] = 0;
}
}
}
}
recipeAmounts[17]=1;
break;
case 27:
for(var j = 0; j < 4; j++){
recipes[i][j] = [];
for(var k = 0; k < 9; k++){
if(recipes[i][j][k]===0||recipes[i][j][k]===undefined){
if(k===j){
recipes[i][j][k] = 5;
recipes[i][j][k+1] = 5;
recipes[i][j][k+3] = 5;
recipes[i][j][k+4] = 5;
}else{
recipes[i][j][k]=0;
}
}
}
}
recipeAmounts[27] = 1;
break;
case 28:
for(var j = 0; j < 2; j++){
recipes[i][j] = [];
for(var k = 0; k < 9; k++){
if(recipes[i][j][k]===0||recipes[i][j][k]===undefined){
if(k===j){
recipes[i][j][k] = 5;
recipes[i][j][k+1] = 5;
recipes[i][j][k+3] = 5;
recipes[i][j][k+4] = 5;
recipes[i][j][k+6] = 5;
recipes[i][j][k+7] = 5;
}else{
recipes[i][j][k] = 0;
}
}
}
}recipeAmounts[28]=1;
break;
case 30:
recipes[i][0] = [300, 0, 300, 300, 300, 300, 300, 0, 300];
recipeAmounts[30]=3;
break;
case 33:
recipes[i][0] = [4,4,4,4,0,4,4,4,4];
break;
case 34:
recipes[i][0] = [5,5,5,5,0,5,5,5,5];
break;
case 37:
recipes[i][0] = [302,302,302,302,302,302,302,302,302];
break;
case 38:
recipes[i][0] = [303,303,303,303,303,303,303,303,303];
break;
case 39:
recipes[i][0] = [305,305,305,305,305,305,305,305,305];
break;
case 40:
for(var j = 0; j < 6; j++){
recipes[i][j] = [];
for(var k = 0; k < 9; k++){
if(recipes[i][j][k]===0||recipes[i][j][k]===undefined){
if(k===j){
recipes[i][j][k] = 301;
recipes[i][j][k+3] = 300;
}else{
recipes[i][j][k] = 0;
}
}
}
}
recipeAmounts[40] = 4;
break;
case 300:
for(var j = 0; j < 6; j++){
recipes[i][j] = [];
for(var k = 0; k < 9; k++){
if(recipes[i][j][k]===0||recipes[i][j][k]===undefined){
if(k===j){
recipes[i][j][k] = 5;
recipes[i][j][k+3] = 5;
}else{
recipes[i][j][k] = 0;
}
}
}
}
recipeAmounts[300] = 4;
break;
case 302:
for(var j = 0; j < 9; j++){
recipes[i][j] = [];
for(var k = 0; k < 9; k++){
if(k===j){
recipes[i][j][k] = 37;
}else{
recipes[i][j][k] = 0;
}
}
}recipeAmounts[i]=9;
break;
case 303:
for(var j = 0; j < 9; j++){
recipes[i][j] = [];
for(var k = 0; k < 9; k++){
if(k===j){
recipes[i][j][k] = 38;
}else{
recipes[i][j][k] = 0;
}
}
}recipeAmounts[i]=9;
break;
case 305:
for(var j = 0; j < 9; j++){
recipes[i][j] = [];
for(var k = 0; k < 9; k++){
if(k===j){
recipes[i][j][k] = 39;
}else{
recipes[i][j][k] = 0;
}
}
}
recipeAmounts[i]=9;
break;
case 307:
recipes[i][0] = [5, 5, 5, 0, 300, 0, 0, 300, 0];
recipeAmounts[307] = 1;
break;
case 308:
recipes[i][0] = [4, 4, 4, 0, 300, 0, 0, 300, 0];
recipeAmounts[308] = 1;
break;
case 309:
recipes[i][0] = [302,302,302,0,300,0,0,300,0];
recipeAmounts[309] = 1;
break;
case 310:
recipes[i][0] = [303,303,303,0,300,0,0,300,0];
recipeAmounts[310] = 1;
break;
case 311:
recipes[i][0] = [305,305,305,0,300,0,0,300,0];
recipeAmounts[311] = 1;
break;
case 312:
recipes[i][0] = [5,0,0,5,0,0,300,0,0];
recipes[i][1] = [0,5,0,0,5,0,0,300,0];
recipes[i][2] = [0,0,5,0,0,5,0,0,300];
recipeAmounts[312] = 1;
break;
case 313:
recipes[i][0] = [4,0,0,4,0,0,300,0,0];
recipes[i][1] = [0,4,0,0,4,0,0,300,0];
recipes[i][2] = [0,0,4,0,0,4,0,0,300];
recipeAmounts[313] = 1;
break;
case 314:
recipes[i][0] = [302,0,0,302,0,0,300,0,0];
recipes[i][1] = [0,302,0,0,302,0,0,300,0];
recipes[i][2] = [0,0,302,0,0,302,0,0,300];
recipeAmounts[314] = 1;
break;
case 315:
recipes[i][0] = [303,0,0,303,0,0,300,0,0];
recipes[i][1] = [0,303,0,0,303,0,0,300,0];
recipes[i][2] = [0,0,303,0,0,303,0,0,300];
recipeAmounts[315] = 1;
break;
case 316:
recipes[i][0] = [305,0,0,305,0,0,300,0,0];
recipes[i][1] = [0,305,0,0,305,0,0,300,0];
recipes[i][2] = [0,0,305,0,0,305,0,0,300];
recipeAmounts[316] = 1;
break;
case 320:
recipes[i][0] = [302,302,302,302,0,302,0,0,0];
recipes[i][1] = [0,0,0,302,302,302,302,0,302];
break;
case 321:
recipes[i][0] = [302,0,302,302,302,302,302,302,302];
break;
case 322:
recipes[i][0] = [302,302,302,302,0,302,302,0,302];
break;
case 323:
recipes[i][0] = [302,0,302,302,0,302,0,0,0];
recipes[i][1] = [0,0,0,302,0,302,302,0,302];
break;
case 324:
recipes[i][0] = [303,303,303,303,0,303,0,0,0];
recipes[i][1] = [0,0,0,303,303,303,303,0,303];
break;
case 325:
recipes[i][0] = [303,0,303,303,303,303,303,303,303];
break;
case 326:
recipes[i][0] = [303,303,303,303,0,303,303,0,303];
break;
case 327:
recipes[i][0] = [303,0,303,303,0,303,0,0,0];
recipes[i][1] = [0,0,0,303,0,303,303,0,303];
break;
case 328:
recipes[i][0] = [305,305,305,305,0,305,0,0,0];
recipes[i][1] = [0,0,0,305,305,305,305,0,305];
break;
case 329:
recipes[i][0] = [305,0,305,305,305,305,305,305,305];
break;
case 330:
recipes[i][0] = [305,305,305,305,0,305,305,0,305];
break;
case 331:
recipes[i][0] = [305,0,305,305,0,305,0,0,0];
recipes[i][1] = [0,0,0,305,0,305,305,0,305];
break;
case 332:
recipes[i][0] = [336,336,336,336,0,336,0,0,0];
recipes[i][1] = [0,0,0,336,336,336,336,0,336];
break;
case 333:
recipes[i][0] = [336,0,336,336,336,336,336,336,336];
break;
case 334:
recipes[i][0] = [336,336,336,336,0,336,336,0,336];
break;
case 335:
recipes[i][0] = [336,0,336,336,0,336,0,0,0];
recipes[i][1] = [0,0,0,336,0,336,336,0,336];
break;
case 337:
recipes[i][0]=[302,0,302,0,302,0,0,0,0];
recipes[i][1]=[0,0,0,302,0,302,0,302,0];
break;
case 339:
recipes[i][0]=[41,41,41,0,0,0,0,0,0];
recipes[i][1]=[0,0,0,41,41,41,0,0,0];
recipes[i][2]=[0,0,0,0,0,0,41,41,41];
recipeAmounts[339]=3;
break;
case 340:
for(var j = 0; j < 6; j++){
recipes[i][j] = [];
for(var k = 0; k < 9; k++){
if(recipes[i][j][k]===0||recipes[i][j][k]===undefined){
if(k===j){
recipes[i][j][k] = 339;
recipes[i][j][k+3] = 318;
}else{
recipes[i][j][k] = 0;
}
}
}
}
break;
}
if(recipeAmounts[i] === undefined){
recipeAmounts[i] = 1;
}
}
var holdingBlock = 0;
var holdingStacks = 0;
var holdingSpecs = 0;
var logoTix = 0;
var time = 0;
var night = 0;
var posX = -40;
var posY = -340;
var posA = 10;
var posB = 10;
var posB2;
var posA2;
// V V CHANGE YOUR SKIN V V
var skin = getImage("cute/CharacterBoy");
var blocksFallen = 0;
var fallTix = 0;
var scrollX = posX;
var scrollY = posY;
var playerSpeed = 8;
var isSitting = true;
var fireTix = 0;
var onFire = false;
var inLava = false;
var inWater = false;
var isDrowning = false;
var armorSlots = [0, 0, 0, 0];
var armorSpecs = [0, 0, 0, 0];
var keyTimer = 50;
var isSprinting = false;
var health = 20;
var heart = getImage("cute/Heart");
var heartsShowing = false;
var shake = 2;
var shaken = false;
var armor = 0;
var oldHealth = health;
var drownCount = 0;
var oxygen = 10;
var shield = getImage("cute/RampSouth");
var shieldsShowing = false;
var isDead = false;
var jumpHeight = 0;
var blockSelected = 0;
var craftedItem = 0;
var craftedStacks = 4;
var entity = {
x: [],
y: [],
type: [],
type2: [],
length: 0
};
var hide = false;
var e2open = true;
var nether = false;
var debugMenu = false;
var inventory = false;
var mobs = {
type: [],
x: [],
y: [],
health: [],
inWater: [],
inLava: [],
onFire: [],
fireTix: [],
legPos: [],
headPos: [],
length: 0,
state: [],
direction: [],
nether: []
};
var version = "1.10";
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!";
var news = false;
var MainArticle = "1.11 Pre-release!";
var newWorld = [
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,9,9,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,9,9,9,9,9,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,9,9,7,9,9,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,9,9,7,9,9,0,0,41,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,7,0,0,0,0,41,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,7,0,0,0,0,41,0,0,0,0,0,0,0,0,0,0],
[2,2,2,2,3,2,2,2,2,2,11,11,11,11,11,11,2,2,2,2],
[3,3,3,3,3,3,3,3,3,3,3,3,11,11,11,3,3,3,3,3],
[3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3],
[3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3],
[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],
[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],
[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],
[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],
[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],
[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],
[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],
[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],
[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],
[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],
[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],
[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],
[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],
[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],
[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],
[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],
[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],
[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],
[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],
[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],
[10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10],
[10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10]];
var specs = [
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]];
specs[13][9]=[];
specs[13][10]=[];
specs[13][13]=[];
specs[13][14]=[];
for(var i = 0; i < 3; i++){
specs[13][9][i]=[
[0,0,0,0],
[0,0,0,0],
[0,0,0,0],
[0,0,0,0],
[0,0,0,0],
[0,0,0,0]];
specs[13][10][i]=[
[0,0,0,0],
[0,0,0,0],
[0,0,0,0],
[0,0,0,0],
[0,0,0,0],
[0,0,0,0]];
specs[13][13][i]=[
[0,0,0,0],
[0,0,0,0],
[0,0,0,0],
[0,0,0,0],
[0,0,0,0],
[0,0,0,0]];
specs[13][14][i]=[
[0,0,0,0],
[0,0,0,0],
[0,0,0,0],
[0,0,0,0],
[0,0,0,0],
[0,0,0,0]];
}
for(var x = 9; x <= 14; x++){
if(x<11||x>12){
for(var i = 0; i < 6; i++){
for(var j = 0; j < 4; j++){
var c = random(0, 100);
if(c<50){
specs[13][x][0][i][j]=301;
}else if(c<75){
specs[13][x][0][i][j]=302;
}else if(c<85){
specs[13][x][0][i][j]=303;
}else if(c<95){
specs[13][x][0][i][j]=305;
}else{
specs[13][x][0][i][j]=319;
}
specs[13][x][1][i][j]=round(random(1,64));
}
}
}
}
var netherWorld = [
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[]];
var invContents = [
[0, 0, 0, 0],
[0, 0, 0, 0],
[0, 0, 0, 0],
[0, 0, 0, 0],
[0, 0, 0, 0],
[0, 0, 0, 0]];
var invStacks = [
[0, 0, 0, 0],
[0, 0, 0, 0],
[0, 0, 0, 0],
[0, 0, 0, 0],
[0, 0, 0, 0],
[0, 0, 0, 0]];
var invSpecs = [
[0, 0, 0, 0],
[0, 0, 0, 0],
[0, 0, 0, 0],
[0, 0, 0, 0],
[0, 0, 0, 0],
[0, 0, 0, 0]];
var hotbar = [0, 0, 0, 0, 0, 0, 0, 0, 0];
var hotbarStacks = [0, 0, 0, 0, 0, 0, 0, 0, 0];
var hotbarSpecs = [0, 0, 0, 0, 0, 0, 0, 0, 0];
var overWorld = newWorld;
var blockTargeted = [0, 0];
var blockDurability = [];
var specDurabilities = [];
blockDurability[0]=0;
blockDurability[1]=65;
blockDurability[2]=10;
blockDurability[3]=10;
blockDurability[4]=70;
blockDurability[5]=35;
blockDurability[6]=50;
blockDurability[7]=30;
blockDurability[8]=2000;
blockDurability[9]=5;
blockDurability[15]=0;
blockDurability[16]=0;
blockDurability[17]=0;
blockDurability[19]=15;
blockDurability[20]=10;
blockDurability[21]=10;
blockDurability[22]=80;
blockDurability[23]=85;
blockDurability[24]=80;
blockDurability[25]=90;
blockDurability[26]=100;
blockDurability[27]=40;
blockDurability[28]=30;
blockDurability[29]=30;
blockDurability[30]=15;
blockDurability[31]=5;
blockDurability[32]=30;
blockDurability[33]=90;
blockDurability[34]=40;
blockDurability[35]=70;
blockDurability[36]=100;
blockDurability[37]=90;
blockDurability[38]=95;
blockDurability[39]=115;
blockDurability[40]=0;
blockDurability[41]=0;
var blockStrength = null;
var selDurability = null;
var isCrafting = false;
var isSmelting = false;
var onChest = false;
noCursor();
var c = 0;
var place = 0;
var jump = 0;
var fall = 10;
var a = 0;
var b = 0;
var g;
var h;
var pickedUp = false;
//pick up items
var
world = newWorld;
var flameX = [];
var flameY = [];
var flameSpeed = [];
for(var i = 0; i < 80; i++){
flameX[i] = random(3,17);
flameY[i] = random(5,15);
flameSpeed[i] = random(1,2);
}
var s;
var drawFlame = function(x, y, size){
noStroke();
for(var i = 0; i < 80; i++){
s = dist(flameX[i], flameY[i], 10, 15);
fill(255, 255-s*10, 0);
ellipse(x+flameX[i]*size, y+flameY[i]*size, 1.5*size, 2.5*size);
}
};
var getItem = function(itemID, amount){
for(var g = 0; g < amount; g++){
for(var h = 0; h < 9; h++){
if((hotbarStacks[h]===0||hotbar[h]===itemID)&&!pickedUp&&hotbarStacks[h]<maxStacks[itemID]){
hotbar[h]=itemID;
if(hotbar[h]!==0){
hotbarSpecs[h] = itemDurabilities[itemID];
hotbarStacks[h]++;
}
pickedUp=true;
}
}
for(var i = 0; i < 4; i++){
for(var j = 0; j < 6; j++){
if((invStacks[j][i]===0||invContents[j][i]===itemID)&&!pickedUp&&invStacks[j][i]<maxStacks[itemID]){
invContents[j][i]=itemID;
invSpecs[j][i]=itemDurabilities[itemID];
if(invContents[j][i]!==0){
invStacks[j][i]++;
}
pickedUp = true;
}
}
}
pickedUp=false;
}
};
//spawn mobs
var spawnMobs = function(x, y, type){
var canSpawn = true;
for(var i = 0; i < world.length; i++){
for(var j = 0; j < world[0].length; j++){
if(world[i][j]===40&&dist(j*40,i*40,x,y)<250){
canSpawn = false;
}
}
}
if(dist(x,y,posA*40,posB*40)<150){
canSpawn=false;
}
if(canSpawn){
append(mobs.type, type);
append(mobs.x, x);
append(mobs.y, y);
switch(type){
case 0:
append(mobs.health, 10);
break;
case 1:
append(mobs.health, 20);
break;
case 2:
append(mobs.health, 20);
break;
case 3:
append(mobs.health, 10);
break;
case 4:
append(mobs.health, 30);
}
append(mobs.inWater, false);
append(mobs.inLava, false);
append(mobs.onFire, false);
append(mobs.fireTix, false);
append(mobs.state, 0);
append(mobs.legPos, 0);
append(mobs.nether, nether);
mobs.length++;
}
};
//This function makes the world truly infinite
var genWorld = function(){
if(!nether){
if(round(random(0, 10))){}else{
curBiome = round(random(0, 3));
}
append(biomes, curBiome);
}
for(var d = 0; d < world.length; d++){
if(nether){
if(d < 14){
if(d>3){
append(world[d], 0);
}else if(d>1){
append(world[d], 19);
}else{
append(world[d], 10);
}
}else if(d >= 14){
if(d>38){
append(world[d], 10);
}else{
append(world[d], 19);
}
}
if(!round(random(0, 6))&&d===13){
world[d][world[d].length]=17;
}
if(!round(random(0, 10))&&d===9){
for(var i = 0; i < 5; i++){
for(var j = 0; j < 4; j++){
world[d+i][world[0].length-j]=8;
}
}
for(var i = 1; i < 4; i++){
for(var j = 1; j < 3; j++){
world[d+i][world[0].length-j]=18;
}
}
}
if(d === 3 && !round(random(0, 12))){
world[d][world[d].length-round(random(2,4))]=13;
if(!world[14][world[14].length]){
for(var i = world[14].length; i < world[d].length; i++){
world[14][i]=19;
}
}
world[14][world[0].length-5]=13;
world[14][world[0].length-4]=13;
world[14][world[0].length-3]=13;
world[14][world[0].length-2]=13;
world[14][world[0].length-1]=13;
world[14+1][world[0].length-3]=13;
world[14+1][world[0].length-2]=13;
}
}else{
if(round(random(0, 750))){}else{
if(d>18&&d<30){
var l = world[0].length;
var dungeonCenter = round(random(2, 4));
var dungeonLength = dungeonCenter*2+1;
var dungeonHeight = round(random(4, 6));
for(var i = l-dungeonLength; i < l; i++){
for(var j = d; j < d+dungeonHeight; j++){
world[j][i]=0;
if(i===l-dungeonLength||i===l-1){
world[j][i]=4;
}
if(i===l-dungeonLength-1||i===l-2){
if(round(random(0, 0))){}else{
var durr = i;
var hurr = d+dungeonHeight-1;
world[d+dungeonHeight-1][i]=34;
specs[d+dungeonHeight-1][i]=[
[[0,0,0,0],
[0,0,0,0],
[0,0,0,0],
[0,0,0,0],
[0,0,0,0],
[0,0,0,0]],
[[0,0,0,0],
[0,0,0,0],
[0,0,0,0],
[0,0,0,0],
[0,0,0,0],
[0,0,0,0]],
[[0,0,0,0],
[0,0,0,0],
[0,0,0,0],
[0,0,0,0],
[0,0,0,0],
[0,0,0,0]]];
for(var g = 0; g < 6; g++){
for(var h = 0; h < 4; h++){
if(!round(random(0,5))){
var item;
var itemStacks;
var itemSeed = random(0, 100);
if(itemSeed<=100){
item=0;itemStacks=0;
if(itemSeed<25){
item=302;itemStacks=round(random(1, 4));
}else if(itemSeed<50){
item=303;itemStacks=round(random(1, 4));
}else if(itemSeed<75){
if(itemSeed<63){
item=309;itemStacks=1;
}else{
item=314;itemStacks=1;
}
}else{
itemStacks=1;
if(itemSeed<80){
item=320;
}else if(itemSeed<85){
item=321;
}else if(itemSeed<90){
item=322;
}else if(itemSeed<95){
item=323;
}else{
item=305;itemStacks=round(random(1,5));
}
}
}
specs[hurr][durr][0][g][h]=item;
specs[hurr][durr][1][g][h]=itemStacks;
if(itemDurabilities[item]){
specs[hurr][durr][2][g][h]=itemDurabilities[item];
}
}
}
}
}
}
}
if(round(random(0,1))){
world[d+dungeonHeight][i]=4;
}else{
world[d+dungeonHeight][i]=35;
}
}world[d+dungeonHeight-1][l-dungeonCenter-1]=36;
}
}
if(d < 14){
append(world[d], 0);
}else if(d === 14&&curBiome!==1){
append(world[d], 2);
}else if(d > 14 && d < 18&&curBiome!==1){
append(world[d], 3);
}else if(d > 17 && d < 38){
append(world[d], 1);
}else if(d > 37){
append(world[d], 10);
}
if(d > 13 && d < 18 && curBiome===1){
append(world[d], 20);
}
if(round(random(0,10))){}else if(curBiome===2){
if(d === 14){
world[d][world[0].length-5]=11;
world[d][world[0].length-4]=11;
world[d][world[0].length-3]=11;
world[d][world[0].length-2]=11;
world[d][world[0].length-1]=11;
world[d+1][world[0].length-3]=11;
world[d+1][world[0].length-2]=11;
if(!round(random(0,5))){
for(var i = 0; i < round(random(2,4)); i++){
world[d-1-i][world[0].length-6]=41;
}
}
}
}
if(round(random(0, 5))){}else{
if(d === 13&&curBiome === 1){
world[d][world[0].length]=31;
world[d-1][world[0].length]=31;
world[d-2][world[0].length]=31;
}
}
if(round(random(0,4))){}else if(curBiome!==1&&world[14][world[0].length]!==11){
if(d === 13&&world[d+1][world[0].length]!==11){
world[d][world[0].length]=7;
world[d-1][world[0].length]=7;
world[d-2][world[0].length]=7;
world[d-3][world[0].length]=7;
world[d-2][world[0].length-2]=9;
world[d-2][world[0].length-1]=9;
world[d-2][world[0].length+1]=9;
world[d-2][world[0].length+2]=9;
world[d-3][world[0].length-2]=9;
world[d-3][world[0].length-1]=9;
world[d-3][world[0].length+1]=9;
world[d-3][world[0].length+2]=9;
world[d-4][world[0].length-2]=9;
world[d-4][world[0].length-1]=9;
world[d-4][world[0].length]=9;
world[d-4][world[0].length+1]=9;
world[d-4][world[0].length+2]=9;
world[d-5][world[0].length-1]=9;
world[d-5][world[0].length]=9;
world[d-5][world[0].length+1]=9;
}
}
if(d<37&&d>30 && !round(random(0,50))){
for(var i = 0; i < 6; i++){
world[d][world[d].length-i-1]=13;
}
for(var i = round(random(1,2)); i < random(3,5); i++){
world[d+1][world[d].length-i-1]=13;
}
}
if(round(random(0, 4))){}else{
//generate ores
//coal
if(round(random(0, 3))){}else{
if(d > 18 && d < 38){
c = round(random(0, 5));
switch(c){
case 1:
world[d][world[0].length]=22;
break;
case 2:
world[d][world[0].length]=22;
world[d][world[0].length-1]=22;
break;
case 3:
world[d][world[0].length]=22;
world[d][world[0].length-1]=22;
world[d+1][world[0].length]=22;
world[d+1][world[0].length-1]=1;
break;
case 4:
world[d][world[0].length]=22;
world[d][world[0].length-1]=22;
world[d+1][world[0].length]=22;
world[d+1][world[0].length-1]=22;
}
}
}
if(round(random(0, 8))){}else{
if(d > 18 && d < 38){
c = round(random(0, 9));
switch(c){
case 1:
world[d][world[0].length]=23;
break;
case 2:
world[d][world[0].length]=23;
world[d][world[0].length-1]=23;
break;
case 3:
world[d][world[0].length]=23;
world[d][world[0].length-1]=23;
world[d+1][world[0].length]=23;
world[d+1][world[0].length-1]=1;
break;
case 4:
world[d][world[0].length]=23;
world[d][world[0].length-1]=23;
world[d+1][world[0].length]=23;
world[d+1][world[0].length-1]=23;
}
}
}
if(round(random(0, 8))){}else{
if(d > 28 && d < 38){
c = round(random(0, 1));
switch(c){
case 1:
world[d][world[0].length]=24;
break;
case 2:
world[d][world[0].length]=24;
world[d][world[0].length-1]=24;
break;
case 3:
world[d][world[0].length]=24;
world[d][world[0].length-1]=24;
world[d+1][world[0].length]=24;
world[d+1][world[0].length-1]=1;
break;
case 4:
world[d][world[0].length]=24;
world[d][world[0].length-1]=24;
world[d+1][world[0].length]=24;
world[d+1][world[0].length-1]=24;
}
}
}
if(round(random(0, 8))){}else{
if(d > 18 && d < 38){
c = round(random(0, 5));
switch(c){
case 1:
world[d][world[0].length]=23;
break;
case 2:
world[d][world[0].length]=23;
world[d][world[0].length-1]=23;
break;
case 3:
world[d][world[0].length]=23;
world[d][world[0].length-1]=23;
world[d+1][world[0].length]=23;
world[d+1][world[0].length-1]=1;
break;
case 4:
world[d][world[0].length]=23;
world[d][world[0].length-1]=23;
world[d+1][world[0].length]=23;
world[d+1][world[0].length-1]=23;
}
}
}
if(round(random(0, 12))){}else{
if(d > 33 && d < 38){
c = round(random(0, 5));
switch(c){
case 1:
world[d][world[0].length]=25;
break;
case 2:
world[d][world[0].length]=25;
world[d][world[0].length-1]=25;
break;
case 3:
world[d][world[0].length]=25;
world[d][world[0].length-1]=25;
world[d+1][world[0].length]=25;
world[d+1][world[0].length-1]=1;
break;
case 4:
world[d][world[0].length]=25;
world[d][world[0].length-1]=25;
world[d+1][world[0].length]=25;
world[d+1][world[0].length-1]=25;
}
}
}
//DIAMONDZ
if(round(random(0, 20))){}else{
if(d > 33 && d < 38){
c = round(random(0, 5));
switch(c){
case 1:
world[d][world[0].length]=26;
break;
case 2:
world[d][world[0].length]=26;
world[d][world[0].length-1]=26;
break;
case 3:
world[d][world[0].length]=26;
world[d][world[0].length-1]=26;
world[d+1][world[0].length]=26;
world[d+1][world[0].length-1]=1;
break;
case 4:
world[d][world[0].length]=26;
world[d][world[0].length-1]=26;
world[d+1][world[0].length]=26;
world[d+1][world[0].length-1]=26;
}
}
}
if(d>20&&d<36){
if(round(random(0, 13))){}else{
world[d-2][world[0].length-1]=3;
world[d-2][world[0].length]=3;
world[d-2][world[0].length+1]=3;
world[d-1][world[0].length-2]=3;
world[d-1][world[0].length-1]=3;
world[d-1][world[0].length]=3;
world[d-1][world[0].length+1]=3;
world[d-1][world[0].length+2]=3;
world[d][world[0].length-2]=3;
world[d][world[0].length-1]=3;
world[d][world[0].length]=3;
world[d][world[0].length+1]=3;
world[d][world[0].length+2]=3;
world[d+1][world[0].length-2]=3;
world[d+1][world[0].length-1]=3;
world[d+1][world[0].length]=3;
world[d+1][world[0].length+1]=3;
world[d+1][world[0].length+2]=3;
world[d+2][world[0].length-1]=3;
world[d+2][world[0].length]=3;
world[d+2][world[0].length+1]=3;
}
}
if(d>20&&d<36){
if(round(random(0, 13))){}else{
world[d-2][world[0].length-1]=21;
world[d-2][world[0].length]=21;
world[d-2][world[0].length+1]=21;
world[d-1][world[0].length-2]=21;
world[d-1][world[0].length-1]=21;
world[d-1][world[0].length]=21;
world[d-1][world[0].length+1]=21;
world[d-1][world[0].length+2]=21;
world[d][world[0].length-2]=21;
world[d][world[0].length-1]=21;
world[d][world[0].length]=21;
world[d][world[0].length+1]=21;
world[d][world[0].length+2]=21;
world[d+1][world[0].length-2]=21;
world[d+1][world[0].length-1]=21;
world[d+1][world[0].length]=21;
world[d+1][world[0].length+1]=21;
world[d+1][world[0].length+2]=21;
world[d+2][world[0].length-1]=21;
world[d+2][world[0].length]=21;
world[d+2][world[0].length+1]=21;
}
}
}}
}
};
var spawnEntity = function(x, y, t, t2){
append(entity.x, x);
append(entity.y, y);
append(entity.type, t);
append(entity.type2, t2);
entity.length++;
};
var drawBlocks = function(x, g, h){
noStroke();
strokeWeight(2);
switch(x){
case 1:
fill(122, 122, 122);
rect(g, h, 20, 20);
break;
case 2:
fill(130, 56, 0);
rect(g, h, 20, 20);
rect(g, h, 20, 5);
break;
case 3:
fill(130, 56, 0);
rect(g, h, 20, 20);
break;
case 4:
fill(122, 122, 122);
strokeWeight(2);
stroke(71, 71, 71);
rect(g, h, 10, 10);
rect(g+10, h+10, 10, 10);
rect(g, h+10, 10, 10);
rect(g+10, h, 10, 10);
noStroke();
break;
case 5:
fill(201, 153, 80);
rect(g, h, 20, 20);
stroke(120, 83, 44);
strokeWeight(2);
line(g, h, g+20, h);
line(g, h+5, g+20, h+5);
line(g, h+10, g+20, h+10);
line(g, h+15, g+20, h+15);
noStroke();
break;
case 6:
fill(181, 97, 58);
rect(g, h, 20, 20);
stroke(237, 209, 176);
line(g, h, g+20, h);
line(g+5, h, g+5, h+3);
line(g+15, h, g+15, h+3);
line(g, h+5, g+20, h+5);
line(g+10, h+5, g+10, h+8);
line(g, h+10, g+20, h+10);
line(g+5, h+10, g+5, h+13);
line(g+15, h+10, g+15, h+13);
line(g, h+15, g+20, h+15);
line(g+10, h+15, g+10, h+18);
noStroke();
break;
case 7:
fill(107, 50, 0);
rect(g, h, 20, 20);
stroke(59, 32, 0);
strokeWeight(2);
line(g, h, g, h+18);
line(g+20, h, g+20, h+18);
noStroke();
break;
case 8:
fill(40, 3, 82);
rect(g, h, 20, 20);
break;
case 9:
fill(8, 168, 0);
rect(g, h, 5, 5);
rect(g+10, h, 5, 5);
rect(g+5, h+5, 5, 5);
rect(g+15, h+5, 5, 5);
rect(g, h+10, 5, 5);
rect(g+10, h+10, 5, 5);
rect(g+5, h+15, 5, 5);
rect(g+15, h+15, 5, 5);
break;
case 11:
fill(120, 120, 120);
ellipse(g+10, h+19, 15, 8);
rect(g+2, h+4, 16, 15);
ellipse(g+10, h+3, 15, 8);
fill(0, 104, 250);
ellipse(g+10, h+3, 12, 6);
break;
case 13:
fill(120, 120, 120);
ellipse(g+10, h+19, 15, 8);
rect(g+2, h+4, 16, 15);
ellipse(g+10, h+3, 15, 8);
fill(255, 149, 0);
ellipse(g+10, h+3, 12, 6);
break;
case 15:
fill(255, 0, 0);
rect(g, h, 20, 20);
fill(255, 255, 255);
rect(g, h+5, 20, 10);
break;
case 16:
fill(107, 50, 0);
rect(g+9, h+12, 2, 8);
fill(8, 168, 0);
rect(g+5, h+7, 10, 5);
rect(g+7, h+5, 5, 10);
break;
case 17:
fill(89, 89, 89);
triangle(g+8, h+20, g+20, h+8, g+20, h+20);
fill(120);
ellipse(g+6, h+5, 8, 8);
fill(this.get(g, h));
ellipse(g+8, h+6, 7, 7);
break;
case 19:
fill(99, 21, 2);
rect(g, h, 20, 20);
break;
case 20:
fill(255, 230, 166);
rect(g, h, 20, 20);
break;
case 21:
fill(136, 127, 140);
rect(g, h, 20, 20);
break;
case 22:
fill(122, 122, 122);
rect(g, h, 20, 20);
fill(0, 0, 0);
ellipse(g+5, h+5, 4, 4);
ellipse(g+14, h+6, 5, 5);
ellipse(g+10, h+9, 3, 3);
ellipse(g+5, h+12, 6, 4);
ellipse(g+14, h+15, 9, 7);
break;
case 23:
fill(122, 122, 122);
rect(g, h, 20, 20);
fill(191, 155, 82);
ellipse(g+5, h+5, 4, 4);
ellipse(g+14, h+6, 5, 5);
ellipse(g+10, h+9, 3, 3);
ellipse(g+5, h+12, 6, 4);
ellipse(g+14, h+15, 9, 7);
break;
case 24:
fill(122, 122, 122);
rect(g, h, 20, 20);
fill(255, 234, 0);
ellipse(g+5, h+5, 4, 4);
ellipse(g+14, h+6, 5, 5);
ellipse(g+10, h+9, 3, 3);
ellipse(g+5, h+12, 6, 4);
ellipse(g+14, h+15, 9, 7);
break;
case 25:
fill(122, 122, 122);
rect(g, h, 20, 20);
fill(0, 21, 255);
ellipse(g+5, h+5, 4, 4);
ellipse(g+14, h+6, 5, 5);
ellipse(g+10, h+9, 3, 3);
ellipse(g+5, h+12, 6, 4);
ellipse(g+14, h+15, 9, 7);
break;
case 26:
fill(122, 122, 122);
rect(g, h, 20, 20);
fill(0, 238, 255);
ellipse(g+5, h+5, 4, 4);
ellipse(g+14, h+6, 5, 5);
ellipse(g+10, h+9, 3, 3);
ellipse(g+5, h+12, 6, 4);
ellipse(g+14, h+15, 9, 7);
break;
case 27:
fill(201, 153, 80);
rect(g, h, 20, 20);
stroke(120, 83, 44);
strokeWeight(2);
line(g, h, g+20, h);
line(g, h+5, g+20, h+5);
line(g, h+10, g+20, h+10);
line(g, h+15, g+20, h+15);
line(g, h, g, h+20);
line(g+20, h, g+20, h+20);
fill(255, 230, 199);
triangle(g+1, h, g+10, h+8, g+19, h);
stroke(122, 122, 122);
line(g+5, h+10, g+5, h+17);
line(g+15, h+8, g+15, h+15);
noStroke();
break;
case 28:
fill(201, 153, 80);
stroke(120, 83, 44);
rect(g+3, h, 13, 20);
line(g+3, h+10, g+15, h+10);
fill(66, 66, 66);
stroke(66, 66, 66);
strokeWeight(3);
line(g+15, h+12, g+13, h+12);
strokeWeight(2);
break;
case 30:
stroke(120, 83, 44);
strokeWeight(3);
line(g, h, g, h+20);
line(g+20, h, g+20, h+20);
line(g, h+5, g+20, h+5);
line(g, h+11, g+20, h+11);
line(g, h+17, g+20, h+17);
strokeWeight(2);
break;
case 31:
stroke(0, 0, 0);
line(g+1, h+2, g+18, h+2);
line(g+1, h+6, g+18, h+6);
line(g+1, h+10, g+18, h+10);
line(g+1, h+14, g+18, h+14);
line(g+1, h+18, g+18, h+18);
fill(0, 130, 0);noStroke();
rect(g+2, h, 16, 20);
break;
case 33:
strokeWeight(2);
stroke(71, 71, 71);
fill(168, 168, 168);
rect(g, h, 20, 10);
fill(0);
ellipse(g+10, h+10, 13, 11);
fill(122, 122, 122);
rect(g, h+10, 20, 10);
fill(0);
var d = [], e = [];
for(var i = 0; i < 4; i++){
d[i] = sin(i*60+90)*6.5+g+10;
e[i] = cos(i*60+90)*6.5+h+20;
}
bezier(d[0],e[0],d[1],e[1],d[2],e[2],d[3],e[3]);
noStroke();
break;
case 34:
fill(184, 133, 57);
stroke(120, 83, 44);
rect(g+1, h, 18, 19);
line(g+1, h+5, g+18, h+5);
line(g+1, h+10, g+18, h+10);
line(g+1, h+15, g+18, h+15);
strokeWeight(1);
fill(225);
stroke(200);
rect(g+8, h+3, 3, 6);
break;
case 35:
fill(122, 122, 122);
strokeWeight(2);
stroke(45, 87, 11);
rect(g, h, 10, 10);
rect(g+10, h, 10, 10);
rect(g, h+10, 10, 10);
rect(g+10, h+10, 10, 10);
noStroke();
fill(166, 194, 134);
triangle(g+2, h, g+6, h, g+4, h+5);
triangle(g+13, h, g+17, h, g+15, h+10);
triangle(g+8, h+11, g+13, h+11, g+11, h+18);
triangle(g+2, h+13, g+7, h+13, g+4, h+19);
break;
case 36:
stroke(4, 68, 77);
noFill();
rect(g, h, 20, 20);
line(g+5, h, g+5, h+18);
line(g+15, h, g+15, h+18);
line(g, h+5, g+18, h+5);
line(g, h+15, g+18, h+15);
break;
case 37:
fill(230);
stroke(140);
rect(g, h, 20, 20);
break;
case 38:
fill(255, 234, 0);
stroke(209, 157, 0);
rect(g, h, 20, 20);
break;
case 39:
stroke(0, 148, 148);
fill(0, 255, 255);
rect(g, h, 20, 20);
break;
case 40:
strokeWeight(4);
stroke(120, 83, 44);
line(g+10, h+8, g+10, h+17);
stroke(255, 251, 181);
point(g+10, h+6);
break;
case 41:
fill(139, 235, 115);
quad(g+1, h+13, g+6, h+17, g+20, h+3, g+12, h-3);
fill(167, 255, 145);
quad(g+3, h+15, g+6, h+20, g+20, h+5, g+14, h+0);
break;
case 300:
stroke(120, 83, 44);
strokeWeight(3);
line(g+1, h+19, g+19, h+1);
break;
case 301:
stroke(0, 0, 0);
fill(59, 54, 59);
ellipse(g+10, h+10, 15, 17);
break;
case 302:
stroke(163, 163, 163);
fill(209, 209, 209);
rect(g, h+10, 20, 10);
quad(g, h+9, g+5, h+6, g+15, h+6, g+19, h+9);
break;
case 303:
stroke(189, 151, 0);
fill(255, 200, 0);
rect(g, h+10, 20, 10);
quad(g, h+9, g+5, h+6, g+15, h+6, g+19, h+9);
break;
case 304:
stroke(0, 0, 117);
fill(0, 21, 255);
ellipse(g+10, h+10, 15, 17);
break;
case 305:
stroke(0, 148, 148);
fill(0, 255, 255);
quad(g+10, h, g+20, h+10, g+10, h+20, g, h+10);
rect(g+5, h+5, 10, 10);
break;
case 306:
fill(89, 89, 89);
triangle(g+1, h+20, g+20, h+1, g+20, h+20);
break;
case 307:
fill(207, 147, 44);
stroke(120, 83, 44);
ellipse(g+10, h+10, 20, 20);
noStroke();
fill(this.get(g, h));
ellipse(g+7, h+13, 22, 22);
stroke(120, 83, 44);
strokeWeight(3);
line(g+1, h+19, g+15, h+5);
strokeWeight(2);
break;
case 308:
fill(150);
stroke(120);
ellipse(g+10, h+10, 20, 20);
noStroke();
fill(this.get(g, h));
ellipse(g+7, h+13, 22, 22);
stroke(120, 83, 44);
strokeWeight(3);
line(g+1, h+19, g+15, h+5);
strokeWeight(2);
break;
case 309:
fill(230);
stroke(140);
ellipse(g+10, h+10, 20, 20);
noStroke();
fill(this.get(g, h));
ellipse(g+7, h+13, 22, 22);
stroke(120, 83, 44);
strokeWeight(3);
line(g+1, h+19, g+15, h+5);
strokeWeight(2);
break;
case 310:
fill(255, 234, 0);
stroke(209, 157, 0);
ellipse(g+10, h+10, 20, 20);
noStroke();
fill(this.get(g, h));
ellipse(g+7, h+13, 22, 22);
stroke(120, 83, 44);
strokeWeight(3);
line(g+1, h+19, g+15, h+5);
strokeWeight(2);
break;
case 311:
stroke(0, 148, 148);
fill(0, 255, 255);
ellipse(g+10, h+10, 20, 20);
noStroke();
fill(this.get(g, h));
ellipse(g+7, h+13, 22, 22);
stroke(120, 83, 44);
strokeWeight(3);
line(g+1, h+19, g+15, h+5);
strokeWeight(2);
break;
case 312:
fill(207, 147, 44);
stroke(120, 83, 44);
quad(g+3, h+13, g+7, h+17, g+20, h+5, g+15, h);
triangle(g+20, h+4, g+20, h, g+16, h);
noStroke();
quad(g+5, h+15, g+5, h+15, g+19, h+4, g+16, h+1);
triangle(g+16, h+1, g+19, h+4, g+19, h+1);
stroke(120, 83, 44);
strokeWeight(3);
line(g, h+20, g+5, h+15);
line(g+1, h+11, g+9, h+19);
strokeWeight(2);
break;
case 313:
fill(150);
stroke(120);
quad(g+3, h+13, g+7, h+17, g+20, h+5, g+15, h);
triangle(g+20, h+4, g+20, h, g+16, h);
noStroke();
quad(g+5, h+15, g+5, h+15, g+19, h+4, g+16, h+1);
triangle(g+16, h+1, g+19, h+4, g+19, h+1);
stroke(120, 83, 44);
strokeWeight(3);
line(g, h+20, g+5, h+15);
line(g+1, h+11, g+9, h+19);
strokeWeight(2);
break;
case 314:
fill(230);
stroke(140);
quad(g+3, h+13, g+7, h+17, g+20, h+5, g+15, h);
triangle(g+20, h+4, g+20, h, g+16, h);
noStroke();
quad(g+5, h+15, g+5, h+15, g+19, h+4, g+16, h+1);
triangle(g+16, h+1, g+19, h+4, g+19, h+1);
stroke(120, 83, 44);
strokeWeight(3);
line(g, h+20, g+5, h+15);
line(g+1, h+11, g+9, h+19);
strokeWeight(2);
break;
case 315:
fill(255, 234, 0);
stroke(209, 157, 0);
quad(g+3, h+13, g+7, h+17, g+20, h+5, g+15, h);
triangle(g+20, h+4, g+20, h, g+16, h);
noStroke();
quad(g+5, h+15, g+5, h+15, g+19, h+4, g+16, h+1);
triangle(g+16, h+1, g+19, h+4, g+19, h+1);
stroke(120, 83, 44);
strokeWeight(3);
line(g, h+20, g+5, h+15);
line(g+1, h+11, g+9, h+19);
strokeWeight(2);
break;
case 316:
stroke(0, 148, 148);
fill(0, 255, 255);
quad(g+3, h+13, g+7, h+17, g+20, h+5, g+15, h);
triangle(g+20, h+4, g+20, h, g+16, h);
noStroke();
quad(g+5, h+15, g+5, h+15, g+19, h+4, g+16, h+1);
triangle(g+16, h+1, g+19, h+4, g+19, h+1);
stroke(120, 83, 44);
strokeWeight(3);
line(g, h+20, g+5, h+15);
line(g+1, h+11, g+9, h+19);
strokeWeight(2);
break;
case 317:
noFill();
stroke(191, 103, 103);
strokeWeight(14);
bezier(g+3, h+15, g+8, h+13, g+13, h+8, g+15, h+3);
stroke(255, 171, 171);
strokeWeight(10);
bezier(g+3, h+15, g+8, h+13, g+13, h+8, g+15, h+3);
break;
case 318:
stroke(100);
fill(150);
triangle(g+10, h+5, g+20, h+15, g, h+15);
break;
case 319:
noFill();
stroke(148, 113, 61);
strokeWeight(14);
bezier(g+3, h+15, g+8, h+13, g+13, h+8, g+15, h+3);
stroke(207, 175, 95);
strokeWeight(10);
bezier(g+3, h+15, g+8, h+13, g+13, h+8, g+15, h+3);
break;
case 320:
fill(230);
stroke(140);
rect(g, h, 20, 20, 10);
noStroke();
fill(this.get(g, h));
rect(g+5, h+8, 11, 15, 5);
break;
case 321:
fill(230);
stroke(140);
rect(g, h, 20, 5, 10);
rect(g, h, 20, 20, 10);
break;
case 322:
fill(230);
stroke(140);
rect(g, h, 8, 20, 10);
rect(g+12, h, 8, 20, 10);
rect(g, h, 20, 10, 10);
break;
case 323:
fill(230);
stroke(140);
rect(g, h+10, 8, 10, 10);
rect(g+12, h+10, 8, 10, 10);
break;
case 324:
fill(255, 234, 0);
stroke(209, 157, 0);
rect(g, h, 20, 20, 10);
noStroke();
fill(this.get(g, h));
rect(g+5, h+8, 11, 15, 5);
break;
case 325:
fill(255, 234, 0);
stroke(209, 157, 0);
rect(g, h, 20, 5, 10);
rect(g, h, 20, 20, 10);
break;
case 326:
fill(255, 234, 0);
stroke(209, 157, 0);
rect(g, h, 8, 20, 10);
rect(g+12, h, 8, 20, 10);
rect(g, h, 20, 10, 10);
break;
case 327:
fill(255, 234, 0);
stroke(209, 157, 0);
rect(g, h+10, 8, 10, 10);
rect(g+12, h+10, 8, 10, 10);
break;
case 328:
stroke(0, 148, 148);
fill(0, 255, 255);
rect(g, h, 20, 20, 10);
noStroke();
fill(this.get(g, h));
rect(g+5, h+8, 11, 15, 5);
break;
case 329:
stroke(0, 148, 148);
fill(0, 255, 255);
rect(g, h, 20, 5, 10);
rect(g, h, 20, 20, 10);
break;
case 330:
stroke(0, 148, 148);
fill(0, 255, 255);
rect(g, h, 8, 20, 10);
rect(g+12, h, 8, 20, 10);
rect(g, h, 20, 10, 10);
break;
case 331:
stroke(0, 148, 148);
fill(0, 255, 255);
rect(g, h+10, 8, 10, 10);
rect(g+12, h+10, 8, 10, 10);
break;
case 332:
fill(189, 120, 0);
stroke(125, 75, 0);
rect(g, h, 20, 20, 10);
noStroke();
fill(this.get(g, h));
rect(g+5, h+8, 11, 15, 5);
break;
case 333:
fill(189, 120, 0);
stroke(125, 75, 0);
rect(g, h, 20, 5, 10);
rect(g, h, 20, 20, 10);
break;
case 334:
fill(189, 120, 0);
stroke(125, 75, 0);
rect(g, h, 8, 20, 10);
rect(g+12, h, 8, 20, 10);
rect(g, h, 20, 10, 10);
break;
case 335:
fill(189, 120, 0);
stroke(125, 75, 0);
rect(g, h+10, 8, 10, 10);
rect(g+12, h+10, 8, 10, 10);
break;
case 336:
fill(125, 75, 0);
ellipse(g+10, h+10, 15, 20);
triangle(g, h+1, g+10, h+3, g+5, h+15);
triangle(g+20, h+1, g+10, h+3, g+15, h+15);
triangle(g, h+19, g+10, h+17, g+5, h+5);
triangle(g+20, h+19, g+10, h+17, g+15, h+5);
fill(189, 120, 0);
ellipse(g+10, h+10, 11, 16);
triangle(g+3, h+3.5, g+10, h+3, g+5, h+15);
triangle(g+17, h+3.5, g+10, h+3, g+15, h+15);
triangle(g+3, h+16.5, g+10, h+17, g+5, h+5);
triangle(g+17, h+16.5, g+10, h+17, g+15, h+5);
break;
case 337:
fill(120, 120, 120);
ellipse(g+10, h+19, 15, 8);
rect(g+2, h+4, 16, 15);
ellipse(g+10, h+3, 15, 8);
fill(89);
ellipse(g+10, h+3, 12, 6);
break;
case 338:
fill(120, 120, 120);
ellipse(g+10, h+19, 15, 8);
rect(g+2, h+4, 16, 15);
ellipse(g+10, h+3, 15, 8);
fill(255);
ellipse(g+10, h+3, 12, 6);
break;
case 339:
fill(255, 255, 255);
stroke(225);
quad(g, h+10, g+5, h, g+20, h+10, g+15, h+20);
break;
case 340:
fill(100);
triangle(g+5, h+5, g+10, h, g+15, h+5);
fill(255);
rect(g+7, h+5, 6, 13);
fill(255, 0, 0);
triangle(g+7, h+5, g+13, h+5, g+7, h+10);
triangle(g+13, h+10, g+13, h+15, g+7, h+15);
quad(g+7, h+15, g+13, h+15, g+10, h+18, g+7, h+18);
break;
}
strokeWeight(2);
noStroke();
};
var herp;
//draw the Inventory
var drawInventory = function(invX, invY, space){
for (var gg = 0; gg < 4; gg++){
for(var hh = 0; hh < 6; hh++){
g = gg*space+invX;
h = hh*space+invY;
noStroke();
drawBlocks(invContents[hh][gg], g, h);
fill(255, 255, 255);
textSize(15);
if(invStacks[hh][gg]!==0&&invStacks[hh][gg]!==1){
text(invStacks[hh][gg], g+20, h+23);
}
if(invContents[hh][gg]===17&&invSpecs[hh][gg]!==65){
fill(255-invSpecs[hh][gg]*4, invSpecs[hh][gg]*4, 0);
rect(g, h+22, invSpecs[hh][gg]/3.25, 3);
if(invSpecs[hh][gg]<=0){
invContents[hh][gg]=0;
}
}
textSize(12);
}
}
};
var cantExplode = false;
var explode = function(x, y){
var d;
var e;
for(e = x-2; e <= x-(-2); e++){
for(d = y-2; d <= y-(-2); d++){
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)){
cantExplode = true;
}
if(world[d][e]!==8&&world[d][e]!==10&&!cantExplode){
if(world[d][e]===15){
specs[d][e]=15;
}
world[d][e]=0;
}
cantExplode=false;
}
}
fill(196, 196, 196);
d-=2;
e-=2;
if(dist(posB, posA, e, d)<=3){
health-=10;
}
ellipse(d*40+10+scrollX, e*40+10+scrollY, 250, 250);
};
var drawWorld = function(){
for(var x=round((scrollX/40)-(scrollX/20)-1); x<round((scrollX/40)-(scrollX/20)+20)+20; x++){
for(var y=0; y<world.length; y++){
noStroke();
if(specs[y][x]===15){
explode(x, y);
}
if(world[y][x]===0){
specs[y][x]=0;
}
switch(world[y][x]){
//air (no code)
case 0:
break;
//stone
case 1:
fill(122, 122, 122);
rect(x*40+scrollX, y*40+scrollY, 40, 40);
break;
//grass
case 2:
fill(130, 56, 0);
rect(x*40+scrollX, y*40+scrollY, 40, 40);
switch(biomes[x]){
case 0:
fill(74, 184, 0);
break;
case 1:
fill(181, 194, 0);
break;
case 2:
fill(0, 80, 0);
break;
case 3:
fill(255);
break;
default:
fill(255, 0, 0);
}
rect(x*40+scrollX, y*40+scrollY, 40, 10);
c = random(1, 200);
if(solidBlocks[world[y - 1][x]] && c > 199){
world[y][x] = 3;
}
break;
//dirt
case 3:
fill(130, 56, 0);
rect(x*40+scrollX, y*40+scrollY, 40, 40);
c = random(1, 200);
if(!solidBlocks[world[y-1][x]] && c > 199){
world[y][x] = 2;
}
break;
//cobblestone
case 4:
fill(122, 122, 122);
strokeWeight(2);
stroke(71, 71, 71);
rect(x*40+scrollX, y*40+scrollY, 20, 20);
rect(x*40+20+scrollX, y*40+scrollY, 20, 20);
rect(x*40+scrollX, y*40+20+scrollY, 20, 20);
rect(x*40+20+scrollX, y*40+20+scrollY, 20, 20);
noStroke();
break;
//wooden planks
case 5:
fill(201, 153, 80);
rect(x*40+scrollX, y*40+scrollY, 40, 40);
stroke(120, 83, 44);
strokeWeight(2);
line(x*40+scrollX, y*40+scrollY, x*40+40+scrollX, y*40+scrollY);
line(x*40+scrollX, y*40+10+scrollY, x*40+40+scrollX, y*40+10+scrollY);
line(x*40+scrollX, y*40+20+scrollY, x*40+40+scrollX, y*40+20+scrollY);
line(x*40+scrollX, y*40+30+scrollY, x*40+40+scrollX, y*40+30+scrollY);
noStroke();
break;
//bricks
case 6:
fill(181, 97, 58);
rect(x*40+scrollX, y*40+scrollY, 40, 40);
stroke(237, 209, 176);
line(x*40+scrollX, y*40+scrollY, x*40+40+scrollX, y*40+scrollY);
line(x*40+10+scrollX, y*40+scrollY, x*40+10+scrollX, y*40+10+scrollY);
line(x*40+scrollX, y*40+10+scrollY, x*40+scrollX+40, y*40+scrollY+10);
line(x*40+30+scrollX, y*40+scrollY, x*40+30+scrollX, y*40+10+scrollY);
line(x*40+40+scrollX, y*40+20+scrollY, x*40+40+scrollX, y*40+20+scrollY);
line(x*40+20+scrollX, y*40+10+scrollY, x*40+20+scrollX, y*40+20+scrollY);
line(x*40+scrollX, y*40+20+scrollY, x*40+40+scrollX, y*40+20+scrollY);
line(x*40+10+scrollX, y*40+20+scrollY, x*40+10+scrollX, y*40+30+scrollY);
line(x*40+30+scrollX, y*40+20+scrollY, x*40+30+scrollX, y*40+30+scrollY);
line(x*40+scrollX, y*40+30+scrollY, x*40+40+scrollX, y*40+30+scrollY);
line(x*40+20+scrollX, y*40+30+scrollY, x*40+20+scrollX, y*40+40+scrollY);
noStroke();
break;
//log
case 7:
fill(107, 50, 0);
rect(x*40+scrollX, y*40+scrollY, 40, 40);
stroke(59, 32, 0);
strokeWeight(2);
line(x*40+scrollX, y*40+scrollY, x*40+scrollX, y*40+40+scrollY);
line(x*40+scrollX+40, y*40+scrollY, x*40+scrollX+40, y*40+40+scrollY);
break;
//obsidian
case 8:
fill(40, 3, 82);
rect(x*40+scrollX, y*40+scrollY, 40, 40);
break;
//leaves
case 9:
switch(biomes[x]){
case 0:
fill(67, 161, 0);
break;
case 1:
fill(181, 194, 0);
break;
case 2:
fill(0, 97, 0);
break;
case 3:
fill(255);
break;
default:
fill(255, 0, 0);
}
rect(x*40+scrollX, y*40+scrollY, 10, 10);
rect(x*40+20+scrollX, y*40+scrollY, 10, 10);
rect(x*40+10+scrollX, y*40+scrollY+10, 10, 10);
rect(x*40+30+scrollX, y*40+scrollY+10, 10, 10);
rect(x*40+scrollX, y*40+20+scrollY, 10, 10);
rect(x*40+20+scrollX, y*40+20+scrollY, 10, 10);
rect(x*40+10+scrollX, y*40+30+scrollY, 10, 10);
rect(x*40+30+scrollX, y*40+30+scrollY, 10, 10);
break;
//bedrock
case 10:
fill(0, 0, 0);
rect(x*40+scrollX, y*40+scrollY, 40, 40);
break;
//water
case 11:
fill(0, 104, 250);
rect(x*40+scrollX, y*40+scrollY, 40, 40);
if(world[y+1][x]===13){
world[y+1][x]=8;
}
if(biomes[x]===3&&world[y-1][x]===0){
if(!round(random(0,100))){
world[y][x]=32;
}
}
if(world[y+1][x]===0){
world[y+1][x]=12;
}else if(world[y+1][x]<11||world[y+1][x]>15){
if(world[y][x+1]===0){
world[y][x+1]=12;
}
}
break;
//flowing water
case 12:
fill(0, 104, 250);
rect(x*40+scrollX, y*40+scrollY, 40, 40);
if(world[y+1][x]===0){
world[y+1][x]=12;
}else if(world[y+1][x]<11){
if(world[y][x+1]===0){
world[y][x+1]=12;
}if(world[y][x-1]===0){
world[y][x-1]=12;
}
}
if(world[y+1][x]===13){
world[y+1][x]=8;
}else if(world[y+1][x]<11||world[y+1][x]>15){
if(world[y][x+1]===0){
world[y][x+1]=12;
}
}
if(world[y-1][x]!==12||world[y-1][x]!==11){
world[y][x]=0;
}
break;
//lava
case 13:
fill(255, 149, 0);
rect(x*40+scrollX, y*40+scrollY, 40, 40);
if(world[y+1][x]===12){
world[y+1][x]=4;
}else if(world[y+1][x]===11){
world[y+1][x]=1;
}
if(world[y+1][x]===0){
world[y+1][x]=14;
}
break;
//flowing lava
case 14:
fill(255, 149, 0);
rect(x*40+scrollX, y*40+scrollY, 40, 40);
if(world[y+1][x]===0){
world[y+1][x]=14;
}else if(world[y+1][x]<11||world[y+1][x]>15){
if(world[y][x+1]===0){
world[y][x+1]=14;
}if(world[y][x-1]===0){
world[y][x-1]=14;
}
}else if(world[y+1][x]===12){
world[y+1][x]=4;
}else if(world[y+1][x]===11){
world[y+1][x]=1;
}
if(world[y-1][x]!==14||world[y-1][x]!==13){
world[y][x]=0;
}
break;
case 15:
fill(255, 0, 0);
rect(x*40+scrollX, y*40+scrollY, 40, 40);
fill(255, 255, 255);
rect(x*40+scrollX, y*40+10+scrollY, 40, 20);
break;
case 16:
fill(107, 50, 0);
rect(x*40+9+scrollX, y*40+20+scrollY, 4, 20);
fill(8, 168, 0);
rect(x*40+5+scrollX, y*40+17+scrollY, 20, 10);
rect(x*40+7+scrollX, y*40+13+scrollY, 10, 20);
c = random(1, 500);
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){
//trunk
world[y][x]=7;
world[y-1][x]=7;
world[y-2][x]=7;
world[y-3][x]=7;
//leaves
world[y-2][x-1]=9;
world[y-2][x-2]=9;
world[y-2][x+1]=9;
world[y-2][x+2]=9;
world[y-3][x-1]=9;
world[y-3][x-2]=9;
world[y-3][x+1]=9;
world[y-3][x+2]=9;
world[y-4][x-1]=9;
world[y-4][x-2]=9;
world[y-4][x]=9;
world[y-4][x+1]=9;
world[y-4][x+2]=9;
world[y-5][x-1]=9;
world[y-5][x]=9;
world[y-5][x+1]=9;
}
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){
world[y][x]=0;
}
break;
case 17:
if(!options.fireAnimation){
fill(173, 49, 0);
triangle(x*40+scrollX, y*40+40+scrollY, x*40+10+scrollX, y*40+10+scrollY,
x*40+20+scrollX, y*40+40+scrollY);
triangle(x*40+20+scrollX, y*40+40+scrollY, x*40+30+scrollX, y*40+10+scrollY,
x*40+40+scrollX, y*40+40+scrollY);
fill(227, 170, 0);
triangle(x*40+2+scrollX, y*40+40+scrollY, x*40+10+scrollX, y*40+18+scrollY,
x*40+16+scrollX, y*40+40+scrollY);
triangle(x*40+24+scrollX, y*40+40+scrollY, x*40+30+scrollX, y*40+18+scrollY,
x*40+36+scrollX, y*40+40+scrollY);}else{
drawFlame(x*40+scrollX-5, y*40+scrollY, 2.6);
}
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){
world[y][x]=0;
}
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){
world[y][x]=18;
world[y][x+1]=18;
world[y-1][x]=18;
world[y-1][x+1]=18;
world[y-2][x]=18;
world[y-2][x+1]=18;
}
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){
world[y][x]=18;
world[y][x-1]=18;
world[y-1][x]=18;
world[y-1][x-1]=18;
world[y-2][x]=18;
world[y-2][x-1]=18;
}
c = random(0, 400);
if(c > 399&&world[y+1][x]!==19){
if(world[y+1][x]===7||world[y+1][x]===9||world[y+1][x]===5){
if(c<399.9){
world[y+1][x]=17;
}else{
world[y+1][x]=0;
}
}
world[y][x]=0;
}
break;
case 18:
fill(157, 0, 255);
rect(x*40+scrollX, y*40+scrollY, 40, 40);
if(world[y][x+1]===0||world[y][x-1]===0||world[y-1][x]===0||world[y+1][x]===0){
world[y][x]=0;
}
for(var i = 0; i < mobs.length; i++){
if(dist(mobs.x[i], mobs.y[i], x*40+20, y*40+20)<150 && !round(random(0, 2000))){
mobs.nether[i] = nether?false:true;
}
}
break;
case 19:
fill(99, 21, 2);
rect(x*40+scrollX, y*40+scrollY, 40, 40);
break;
case 20:
fill(255, 230, 166);
rect(x*40+scrollX, y*40+scrollY, 40, 40);
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){
world[y][x]=0;
world[y+1][x]=20;
}
break;
case 21:
fill(136, 127, 140);
rect(x*40+scrollX, y*40+scrollY, 40, 40);
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){
world[y][x]=0;
world[y+1][x]=21;
}
break;
case 22:
fill(122, 122, 122);
rect(x*40+scrollX, y*40+scrollY, 40, 40);
fill(0, 0, 0);
ellipse(x*40+10+scrollX, y*40+10+scrollY, 8, 8);
ellipse(x*40+28+scrollX, y*40+12+scrollY, 10, 10);
ellipse(x*40+20+scrollX, y*40+18+scrollY, 6, 6);
ellipse(x*40+10+scrollX, y*40+24+scrollY, 12, 8);
ellipse(x*40+28+scrollX, y*40+30+scrollY, 18, 14);
break;
case 23:
fill(122, 122, 122);
rect(x*40+scrollX, y*40+scrollY, 40, 40);
fill(191, 155, 82);
ellipse(x*40+10+scrollX, y*40+10+scrollY, 8, 8);
ellipse(x*40+28+scrollX, y*40+12+scrollY, 10, 10);
ellipse(x*40+20+scrollX, y*40+18+scrollY, 6, 6);
ellipse(x*40+10+scrollX, y*40+24+scrollY, 12, 8);
ellipse(x*40+28+scrollX, y*40+30+scrollY, 18, 14);
break;
case 24:
fill(122, 122, 122);
rect(x*40+scrollX, y*40+scrollY, 40, 40);
fill(255, 234, 0);
ellipse(x*40+10+scrollX, y*40+10+scrollY, 8, 8);
ellipse(x*40+28+scrollX, y*40+12+scrollY, 10, 10);
ellipse(x*40+20+scrollX, y*40+18+scrollY, 6, 6);
ellipse(x*40+10+scrollX, y*40+24+scrollY, 12, 8);
ellipse(x*40+28+scrollX, y*40+30+scrollY, 18, 14);
break;
case 25:
fill(122, 122, 122);
rect(x*40+scrollX, y*40+scrollY, 40, 40);
fill(0, 21, 255);
ellipse(x*40+10+scrollX, y*40+10+scrollY, 8, 8);
ellipse(x*40+28+scrollX, y*40+12+scrollY, 10, 10);
ellipse(x*40+20+scrollX, y*40+18+scrollY, 6, 6);
ellipse(x*40+10+scrollX, y*40+24+scrollY, 12, 8);
ellipse(x*40+28+scrollX, y*40+30+scrollY, 18, 14);
break;
case 26:
fill(122, 122, 122);
rect(x*40+scrollX, y*40+scrollY, 40, 40);
fill(0, 238, 255);
ellipse(x*40+10+scrollX, y*40+10+scrollY, 8, 8);
ellipse(x*40+28+scrollX, y*40+12+scrollY, 10, 10);
ellipse(x*40+20+scrollX, y*40+18+scrollY, 6, 6);
ellipse(x*40+10+scrollX, y*40+24+scrollY, 12, 8);
ellipse(x*40+28+scrollX, y*40+30+scrollY, 18, 14);
break;
case 27:
fill(201, 153, 80);
rect(x*40+scrollX, y*40+scrollY, 40, 40);
stroke(120, 83, 44);
strokeWeight(2);
line(x*40+scrollX, y*40+scrollY, x*40+40+scrollX, y*40+scrollY);
line(x*40+scrollX, y*40+10+scrollY, x*40+40+scrollX, y*40+10+scrollY);
line(x*40+scrollX, y*40+20+scrollY, x*40+40+scrollX, y*40+20+scrollY);
line(x*40+scrollX, y*40+30+scrollY, x*40+40+scrollX, y*40+30+scrollY);
line(x*40+scrollX, y*40+scrollY, x*40+scrollX, y*40+40+scrollY);
line(x*40+40+scrollX, y*40+scrollY, x*40+40+scrollX, y*40+40+scrollY);
fill(255, 230, 199);
triangle(x*40+2+scrollX, y*40+scrollY, x*40+20+scrollX, y*40+16+scrollY,
x*40+38+scrollX, y*40+scrollY);
stroke(122, 122, 122);
strokeWeight(4);
line(x*40+10+scrollX, y*40+20+scrollY, x*40+10+scrollX, y*40+34+scrollY);
line(x*40+30+scrollX, y*40+16+scrollY, x*40+30+scrollX, y*40+30+scrollY);
noStroke();
strokeWeight(2);
break;
case 28:
fill(201, 153, 80);
stroke(97, 58, 0);
if(specs[y][x]===0){
rect(x*40+scrollX, y*40+scrollY, 40, 40);
rect(x*40+5+scrollX, y*40+5+scrollY, 30, 30);
fill(66, 66, 66);
stroke(66, 66, 66);
ellipse(x*40+35+scrollX, y*40+scrollY, 3, 3);
strokeWeight(4);
line(x*40+35+scrollX, y*40+scrollY, x*40+30+scrollX, y*40+scrollY);
}else if(specs[y][x]===1){
rect(x*40+scrollX, y*40+scrollY, 10, 40);
}
strokeWeight(2);
break;
case 29:
fill(201, 153, 80);
stroke(97, 58, 0);
if(specs[y][x]===0){
rect(x*40+scrollX, y*40+scrollY, 40, 40);
rect(x*40+5+scrollX, y*40+5+scrollY, 30, 30);
}else if(specs[y][x]===1){
rect(x*40+scrollX, y*40+scrollY, 10, 40);
}
if(world[y+1][x]!==28){
world[y][x]=0;
}
break;
case 30:
fill(201, 153, 80);
stroke(120, 83, 44);
rect(x*40+scrollX, y*40+scrollY, 7, 40);
rect(x*40+33+scrollX, y*40+scrollY, 7, 40);
rect(x*40+scrollX, y*40+scrollY+10, 40, 7);
rect(x*40+scrollX, y*40+scrollY+30, 40, 7);
break;
case 31:
stroke(0);
line(x*40+scrollX, y*40+scrollY+5, x*40+scrollX+40, y*40+scrollY+5);
line(x*40+scrollX, y*40+scrollY+15, x*40+scrollX+40, y*40+scrollY+15);
line(x*40+scrollX, y*40+scrollY+25, x*40+scrollX+40, y*40+scrollY+25);
line(x*40+scrollX, y*40+scrollY+35, x*40+scrollX+40, y*40+scrollY+35);
fill(0, 130, 0);
noStroke();
rect(x*40+scrollX+2, y*40+scrollY, 36, 40);
if(world[y-(-1)][x]!==20&&world[y-(-1)][x]!==31){
world[y][x]=0;
spawnEntity(x*40+10, y*40+10, 0, 31);
}
break;
case 32:
fill(199, 230, 255);
rect(x*40+scrollX, y*40+scrollY, 40, 40);
stroke(255);
line(x*40+scrollX+10, y*40+scrollY+30,x*40+scrollX+20,y*40+scrollY+20);
line(x*40+scrollX+5, y*40+scrollY+15, x*40+scrollX+15, y*40+scrollY+5);
stroke(92, 171, 255);
line(x*40+scrollX+25, y*40+scrollY+35, x*40+scrollX+35, y*40+scrollY+25);
line(x*40+scrollX+20, y*40+scrollY+15, x*40+scrollX+30, y*40+scrollY+5);
break;
case 33:
fill(0);
strokeWeight(2);
stroke(71, 71, 71);
fill(120);
rect(x*40+scrollX, y*40+scrollY, 40, 20);
fill(0);
ellipse(x*40+scrollX+20,y*40+scrollY+20,30,25);
fill(168);
rect(x*40+scrollX, y*40+20+scrollY, 40, 20);
fill(0);
if(specs[y][x][3]>1){
if(specs[y][x][10]>0){
specs[y][x][3]-=0.5;
}
}else if(specs[y][x][3]>0){
if(specs[y][x][4]===15){
explode(x,y);
}
specs[y][x][7]=furnaceRecipes[specs[y][x][4]];
specs[y][x][8]++;
specs[y][x][5]--;
specs[y][x][3]-=1;
}else{
specs[y][x][3]=0;
if(furnaceRecipes[specs[y][x][4]]&&specs[y][x][10]>0){
specs[y][x][3]=50;
}
}
if(specs[y][x][1]<=0){
specs[y][x][0]=0;
}
if(specs[y][x][5]<=0){
specs[y][x][4]=0;
}
if(burnValues[specs[y][x][0]]!==null&&furnaceRecipes[specs[y][x][4]]!==null&&specs[y][x][10]===0){
specs[y][x][11]=burnValues[specs[y][x][0]];
specs[y][x][10]=burnValues[specs[y][x][0]]*5;
specs[y][x][1]--;
}
if(specs[y][x][10]>0){
fill(255, 0, 0);
specs[y][x][10]-=0.05;
}else{
fill(0);
}var d = [], e = [];
for(var i = 0; i < 4; i++){
d[i] = sin(i*60+90)*15+x*40+scrollX+20;
e[i] = cos(i*60+90)*17+y*40+scrollY+40;
}
if(!furnaceRecipes[specs[y][x][4]]){
specs[y][x][3]=50;
}
bezier(d[0],e[0],d[1],e[1],d[2],e[2],d[3],e[3]);
noStroke();
if(specs[y][x][10]<0){
specs[y][x][10]=0;
}
if(specs[y][x][10]>0){
for(var i = 3; i >= 0; i--){
fill(255, 255-i*55, 0);
for(var j = 0; j < 4; j++){
d[j] = sin(j*60+90)*(i*4-1)+x*40+scrollX+20;
e[j] = cos(j*60+90)*(i*4-1)+y*40+scrollY+40;
}
bezier(d[0],e[0],d[1],e[1],d[2],e[2],d[3],e[3]);
}}
break;
case 34:
fill(184, 133, 57);
stroke(120, 83, 44);
strokeWeight(2);
if(world[y][x-1]!==34){
if(world[y][x-(-1)]===34){
rect(x*40+scrollX+3, y*40+scrollY+5, 74, 35);
line(x*40+scrollX+5, y*40+10+scrollY+3, x*40+74+scrollX, y*40+10+scrollY+3);
line(x*40+scrollX+5, y*40+20+scrollY+3, x*40+74+scrollX, y*40+20+scrollY+3);
line(x*40+scrollX+5, y*40+30+scrollY+3, x*40+74+scrollX, y*40+30+scrollY+3);
if(onChest&&(x===blockTargeted[1]||x===blockTargeted[1]-1)&&y===blockTargeted[0]){
fill(184, 133, 57);
stroke(120, 83, 44);
rect(x*40+scrollX+3, y*40+scrollY-21, 74, 32);
fill(20);
rect(x*40+scrollX+7, y*40+scrollY-17, 66, 24);
fill(133, 73, 31);
rect(x*40+scrollX+37, y*40+scrollY+12, 6, 8);
fill(225);
stroke(200);
rect(x*40+scrollX+37, y*40+scrollY-24, 6, 4);
}else{
fill(225);
stroke(200);
rect(x*40+scrollX+37, y*40+scrollY+10, 6, 10);
}
}else{
rect(x*40+scrollX+3, y*40+scrollY+5, 34, 35);
line(x*40+scrollX+5, y*40+10+scrollY+3, x*40+34+scrollX, y*40+10+scrollY+3);
line(x*40+scrollX+5, y*40+20+scrollY+3, x*40+34+scrollX, y*40+20+scrollY+3);
line(x*40+scrollX+5, y*40+30+scrollY+3, x*40+34+scrollX, y*40+30+scrollY+3);
if(onChest&&x===blockTargeted[1]&&y===blockTargeted[0]){
rect(x*40+scrollX+3, y*40+scrollY-22, 34, 35);
fill(87, 59, 24);
rect(x*40+scrollX+6, y*40+scrollY-19, 28, 29);
fill(225);
stroke(200);
rect(x*40+scrollX+17, y*40+scrollY-24, 6, 4);
}else{
fill(225);
stroke(200);
rect(x*40+scrollX+17, y*40+scrollY+10, 6, 10);
}
}}
noStroke();
break;
case 35:
fill(122, 122, 122);
strokeWeight(2);
stroke(49, 105, 0);
rect(x*40+scrollX, y*40+scrollY, 20, 20);
rect(x*40+20+scrollX, y*40+scrollY, 20, 20);
rect(x*40+scrollX, y*40+20+scrollY, 20, 20);
rect(x*40+20+scrollX, y*40+20+scrollY, 20, 20);
noStroke();
fill(166, 194, 134);
triangle(x*40+scrollX+5, y*40+scrollY,
x*40+scrollX+13, y*40+scrollY,
x*40+scrollX+9, y*40+scrollY+15);
triangle(x*40+scrollX+25, y*40+scrollY+10,
x*40+scrollX+33, y*40+scrollY+10,
x*40+scrollX+29, y*40+scrollY+20);
triangle(x*40+scrollX+10, y*40+scrollY+25,
x*40+scrollX+20, y*40+scrollY+25,
x*40+scrollX+15, y*40+scrollY+40);
break;
case 36:
noStroke();
drawFlame(x*40+scrollX, y*40+scrollY+5, 2, 40);
fill(0, 64, 66);
rect(x*40+scrollX, y*40+scrollY, 5, 40);
rect(x*40+scrollX, y*40+scrollY, 40, 5);
rect(x*40+scrollX+35, y*40+scrollY, 5, 40);
rect(x*40+scrollX, y*40+scrollY+35, 40, 5);
stroke(0, 64, 66);
strokeWeight(3);
line(x*40+scrollX+10, y*40+scrollY+2, x*40+scrollX+10, y*40+scrollY+40);
line(x*40+scrollX+28, y*40+scrollY+2, x*40+scrollX+28, y*40+scrollY+40);
line(x*40+scrollX+2, y*40+scrollY+10, x*40+scrollX+35, y*40+scrollY+10);
line(x*40+scrollX+2, y*40+scrollY+28, x*40+scrollX+35, y*40+scrollY+28);
if(round(random(0, 100))){}else if(dist(x, y, posB, posA)<10){
spawnMobs(x*40+random(-120, 120), y*40-40, 2);
}
break;
case 37:
fill(230);
stroke(140);
rect(x*40+scrollX, y*40+scrollY, 40, 40);
break;
case 38:
fill(255, 234, 0);
stroke(209, 157, 0);
rect(x*40+scrollX, y*40+scrollY, 40, 40);
break;
case 39:
stroke(0, 148, 148);
fill(0, 255, 255);
rect(x*40+scrollX, y*40+scrollY, 40, 40);
break;
case 40:
fill(120, 83, 44);
var xx = x*40+scrollX, yy = y*40+scrollY;
if(solidBlocks[world[y+1][x]]){
rect(xx+16, yy+16, 8, 30);
fill(255, 251, 181);
rect(xx+16, yy+8, 8, 8);
}else if(solidBlocks[world[y][x-1]]){
quad(xx, yy+40, xx, yy+25, xx+5, yy+16, xx+13, yy+16);
fill(255, 251, 181);
quad(xx+13, yy+16, xx+5, yy+16, xx+9, yy+8, xx+18, yy+8);
}else if(solidBlocks[world[y][x+1]]){
quad(xx+40, yy+40, xx+40, yy+25, xx+35, yy+16, xx+27, yy+16);
fill(255, 251, 181);
quad(xx+27, yy+16, xx+35, yy+16, xx+31, yy+8, xx+22, yy+8);
}else{
world[y][x]=0;
spawnEntity(x*40+random(0,20), y*40+10, 0, 40);
}
break;
case 41:
fill(115, 255, 136);
rect(x*40+scrollX+3, y*40+scrollY, 5, 40);
rect(x*40+scrollX+13, y*40+scrollY, 5, 40);
rect(x*40+scrollX+23, y*40+scrollY, 5, 40);
rect(x*40+scrollX+33, y*40+scrollY, 5, 40);
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){
world[y][x]=0;
spawnEntity(x*40+random(0,20), y*40+10, 0, 41);
}
break;
default:
fill(234, 0, 255);
rect(x*40+scrollX, y*40+scrollY, 40, 40);
stroke(164, 0, 179);
strokeWeight(4);
line(x*40+scrollX+2, y*40+scrollY+2, x*40+scrollX+2, y*40+scrollY+37);
line(x*40+scrollX+2, y*40+scrollY+2, x*40+scrollX+37, y*40+scrollY+2);
strokeWeight(2);
}}}};
if(round(random(0, 1))){}else{
spawnMobs(2, abs(posX-200), abs(posY));
}
var keys = [];
var sunPos = 100;
//If there is one, retrieve a saved minecraft world from your browser
draw = function() {
try{
for(var i = 0; i < 80; i++){
flameY[i]-=flameSpeed[i]/3;
if(flameY[i]<random(0,5)){
flameY[i]=15;
flameX[i]=random(3,17);
}
}
//This loop can only function if you're alive
if(isDead===false&&bennimusStudios===false&&!onTitleScreen){
place = (scrollX/20) - (scrollX/10);
if(!heartsShowing){
sunPos--;
time++;
if(time > 10000){
night=true;
}else{
night=false;
}
if(time===20000){
time=0;
}
strokeWeight(2);
if(nether===false){
if(night){
background(10, 0, 56);
fill(255, 255, 255);
stroke(209, 209, 209);
strokeWeight(5);
if(time<=15000){
sunPos-=0.5;
rect(300, sunPos/70+100, 50, 50);
}else if(time>=15000){
sunPos=1000;
rect(300, (time-10800)/50-150, 50, 50);
}
}else{
if(time>0&&time<250){
background(255, 209, 94);
}else{
background(189, 206, 255);
}
fill(253, 255, 191);
stroke(255, 255, 255);
strokeWeight(5);
if(time<=5000){
sunPos-=0.5;
rect(300, sunPos/70+100, 50, 50);
}else if(time>=5000){
sunPos=1000;
rect(300, (time+3000)/50-150, 50, 50);
}
}
}else{
background(173, 43, 0);
}
}else{
background(10, 0, 56);
if(shieldsShowing===false){
shieldsShowing=1000;
}else{
shieldsShowing--;
if(shieldsShowing<0){
heartsShowing=false;
shieldsShowing=false;
onFire=true;
}
strokeWeight(5);
fill(255, 255, 255);
stroke(184, 184, 184);
rect(300, 400-(shieldsShowing/10)-200, 50, 50);
}
}
strokeWeight(2);
noStroke();
if(pigmanTimer>0){
madPigmen=true;
pigmanTimer--;
}else{
madPigmen=false;
}
if(!nether&&options.clouds){
if(cloudX>400){
cloudX=0;
}
fill(255);
if(night){
fill(38, 21, 84);
}else if(time<250){
fill(250, 232, 205);
}
cloudX+=0.25;
rect(cloudX+150, 15, 125, 15);
rect(cloudX-250, 15, 125, 15);
rect(cloudX+200, 35, 180, 30);
rect(cloudX-200, 35, 180, 30);
rect(cloudX-300, 30, 170, 20);
rect(cloudX+100, 30, 170, 20);
}
drawWorld();
var x = blockTargeted[1], y = blockTargeted[0];
if(x===blockTargeted[1]&&y===blockTargeted[0]&&blockStrength!==null){
if(blockStrength<(selDurability/7)*6){
stroke(0);strokeWeight(3);
line(x*40+scrollX+20, y*40+scrollY+20, x*40+scrollX+11, y*40+scrollY+37);
if(blockStrength<(selDurability/7)*5){
line(x*40+scrollX+20, y*40+scrollY+20, x*40+scrollX+35, y*40+scrollY+11);
if(blockStrength<(selDurability/7)*4){
line(x*40+scrollX+28, y*40+scrollY+15, x*40+scrollX+33, y*40+scrollY+34);
}
if(blockStrength<(selDurability/7)*3){
line(x*40+scrollX+6, y*40+scrollY+15, x*40+scrollX+20, y*40+scrollY+20);
}
if(blockStrength<(selDurability/7)*2){
line(x*40+scrollX+14, y*40+scrollY+17, x*40+scrollX+20, y*40+scrollY+7);
}
if(blockStrength<(selDurability/7)){
line(x*40+scrollX+25, y*40+scrollY+27, x*40+scrollX+14, y*40+scrollY+32);
}
}strokeWeight(2);
}}
var entX,entY,entA,entB;
for(var tt = 0; tt < entity.length; tt++){
entX=entity.x[tt]+scrollX;
entY=entity.y[tt]+scrollY;
entA=(entity.y[tt]/40).toFixed(0,0);
entB=(entity.x[tt]/40).toFixed(0,0);
switch(entity.type[tt]){
case 0:
var distance = dist(entB, entA, posB, posA);
drawBlocks(entity.type2[tt], entX, entY);
if(!solidBlocks[world[entA][entB]]){
entity.y[tt]+=5;
}
if(distance<2){
entity.type[tt]=null;
getItem(entity.type2[tt], 1);
}
break;
case 1:
drawBlocks(340, entX, entY);
entity.type2[tt]++;
entity.y[tt]-=entity.type2[tt];
if(entity.type2[tt]>=20){
for(var i = 0; i < 100; i++){
spawnEntity(entX, entY, 2, [random(0,360),random(1,5),500]);
}
fill(random(50,255), random(50,255), random(50,255), 50);
ellipse(entX, entY, 100, 100);
entity.type[tt]=null;
}
break;
case 2:
fill(random(50,255), random(50,255), random(50,255), entity.type2[tt][2]);
ellipse(entX-scrollX, entY-scrollY, 5, 5);
entity.x[tt]+=sin(entity.type2[tt][0])*entity.type2[tt][1];
entity.y[tt]+=cos(entity.type2[tt][0])*entity.type2[tt][1];
if(entity.type2[tt][2]>0){
entity.type2[tt][2]-=10;
}else{
entity.type[tt]=null;
}
break;
}
}
if(nether){
if(round(random(0,100))){}else if(!options.peaceful){
spawnMobs(random(0, (world[0].length-1)*40), 12*40, 4);
}
}else{
if(round(random(0,500))){}else{
spawnMobs(random(0, (world[0].length-1)*40), 12*40, 0);
}if(round(random(0,100))){}else if(night&&!options.peaceful){
spawnMobs(random(0, (world[0].length-1)*40), 12*40, 1);
}if(round(random(0,500))){}else{
spawnMobs(random(0, (world[0].length-1)*40), 12*40, 3);
}if(round(random(0,100))){}else if(night&&!options.peaceful){
spawnMobs(random(0, (world[0].length-1)*40), 440, 2);
}
}
var mobX,mobY,mobA,mobB;
for(var s = 0; s < mobs.length; s++){
mobX=mobs.x[s];
mobY=mobs.y[s];
mobA = (mobY/40).toFixed(0, 0);
mobB = (mobX/40).toFixed(0, 0);
if(mobs.nether[s]===nether&&dist(mobB,mobA,posB,posA)<10){
if(mobs.health[s]>0){
switch(mobs.type[s]){
case 0:
noStroke();
fill(255, 181, 181);
resetMatrix();
if(mobs.direction[s]===RIGHT){
translate(mobs.x[s]+scrollX+20, mobs.y[s]+scrollY+40);
if(mobs.state[s]!==0){
rotate(sin(time*30)*15);
}
fill(179, 127, 127);
rect(-5, 0, 10, 15);
resetMatrix();
translate(mobs.x[s]+scrollX-10, mobs.y[s]+scrollY+40);
if(mobs.state[s]!==0){
rotate(-sin(time*30)*15);
}
rect(-5, 0, 10, 15);
resetMatrix();
fill(255, 181, 181);
rect(mobs.x[s]+scrollX-15, mobs.y[s]+scrollY+25, 40, 20);
translate(mobs.x[s]+scrollX-10, mobs.y[s]+scrollY+40);
if(mobs.state[s]!==0){
rotate(sin(time*30)*15);
}
rect(-5, 0, 10, 15);
resetMatrix();
translate(mobs.x[s]+scrollX+20, mobs.y[s]+scrollY+40);
if(mobs.state[s]!==0){
rotate(-sin(time*30)*15);
}
rect(-5, 0, 10, 15);
}else{
translate(mobs.x[s]+scrollX+20, mobs.y[s]+scrollY+40);
if(mobs.state[s]!==0){
rotate(sin(time*30)*15);
}
fill(179, 127, 127);
rect(-5, 0, 10, 15);
resetMatrix();
translate(mobs.x[s]+scrollX-10, mobs.y[s]+scrollY+40);
if(mobs.state[s]!==0){
rotate(-sin(time*30)*15);
}
rect(-5, 0, 10, 15);
resetMatrix();
fill(255, 181, 181);
rect(mobs.x[s]+scrollX-15, mobs.y[s]+scrollY+25, 40, 20);
translate(mobs.x[s]+scrollX-10, mobs.y[s]+scrollY+40);
if(mobs.state[s]!==0){
rotate(sin(time*30)*15);
}
rect(-5, 0, 10, 15);
resetMatrix();
translate(mobs.x[s]+scrollX+20, mobs.y[s]+scrollY+40);
if(mobs.state[s]!==0){
rotate(-sin(time*30)*15);
}
rect(-5, 0, 10, 15);
}
resetMatrix();
if(dist(mobB, mobA, posB, posA)<4){
var x = posX - posX*2 + 195;
var y = posY - posY*2 + 135;
if(mobs.direction[s]===LEFT){
translate(mobX+scrollX-10, mobY+scrollY+30);
}else{
translate(mobX+scrollX+25, mobY+scrollY+30);
}
rotate(atan2(mobY-y, mobX-x));
rect(-10, -10, 20, 20);
if(posB<mobB){
rect(-14, -2, 6, 8);
fill(255);
rect(-10, -6, 5, 3);
fill(0);
rect(-8, -6, 3, 3);
if(mobs.state[s]===0){
mobs.direction[s]=LEFT;
}
}else{
rect(-14, -6, 6, 8);
fill(255);
rect(-10, 3, 5, 3);
fill(0);
rect(-8, 3, 3, 3);
if(mobs.state[s]===0){
mobs.direction[s]=RIGHT;
}
}
}else{
if(mobs.direction===LEFT){
translate(mobX+scrollX+10, mobY+scrollY+30);
}else{
translate(mobX+scrollX-10, mobY+scrollY+30);
}
if(direction===RIGHT){
scale(-1, 1);
}
mobs.headPos[s]=0;
rect(-10, -10, 20, 20);
rect(-14, -2, 6, 8);
fill(255);
rect(-10, -6, 5, 3);
fill(0);
rect(-8, -6, 3, 3);
}
resetMatrix();
if(round(random(0,100))){}else{
mobs.state[s]=round(random(0,2)+0.5);
}if(round(random(0,25))){}else{
mobs.state[s]=0;
}
if(mobs.state[s]!==0){
mobs.legPos[s] = sin(time)*10;
}
if(!solidBlocks[world[mobA-(-1)][mobB]]&&world[mobA-(-1)][mobB]!==11&&world[mobA-(-1)][mobB]!==12){
mobs.y[s]+=10;
}
break;
case 1:
if(options.peaceful){
mobs.health[s]=0;
}
noStroke();
translate(mobs.x[s]+scrollX+10, mobs.y[s]+scrollY+40);
if(mobs.state[s]!==0){
rotate(sin(time*30)*15);
}
fill(0, 100, 0);
rect(-5, 0, 10, 15);
resetMatrix();
translate(mobs.x[s]+scrollX-10, mobs.y[s]+scrollY+40);
if(mobs.state[s]!==0){
rotate(-sin(time*30)*15);
}
rect(-5, 0, 10, 15);
resetMatrix();
fill(0, 255, 0);
rect(mobs.x[s]+scrollX-7, mobs.y[s]+scrollY, 14, 40);
translate(mobs.x[s]+scrollX-10, mobs.y[s]+scrollY+40);
if(mobs.state[s]!==0){
rotate(sin(time*30)*15);
}
rect(-5, 0, 10, 15);
resetMatrix();
translate(mobs.x[s]+scrollX+10, mobs.y[s]+scrollY+40);
if(mobs.state[s]!==0){
rotate(-sin(time*30)*15);
}
rect(-5, 0, 10, 15);
resetMatrix();
if(dist(mobB, mobA, posB, posA)<10){
var x = posX - posX*2 + 195;
var y = posY - posY*2 + 135;
translate(mobX+scrollX, mobY+scrollY);
rotate(atan2(mobY-y, mobX-x));
rect(-10, -10, 20, 20);
if(posB<mobB){
fill(0);
rect(-8, -6, 5, 5);
if(mobs.state[s]===0){
mobs.direction[s]=LEFT;
}
}else{
fill(0);
rect(-10, 1, 5, 5);
if(mobs.state[s]===0){
mobs.direction[s]=RIGHT;
}
}
}else{
translate(mobX+scrollX, mobY+scrollY);
if(direction===RIGHT){
scale(-1, 1);
}
mobs.headPos[s]=0;
rect(-10, -10, 20, 20);
fill(0);
rect(-8, -6, 3, 3);
}
resetMatrix();
if(round(random(0,100))){}else{
mobs.state[s]=round(random(0,2)+0.5);
}if(round(random(0,50))){}else{
mobs.state[s]=0;
}
if(!solidBlocks[world[mobA-(-1)][mobB]]&&world[mobA-(-1)][mobB]!==11&&world[mobA-(-1)][mobB]!==12){
mobs.y[s]+=10;
}
if(dist(mobB, mobA, posB, posA)<10){
if(mobB<posB){
mobs.state[s] = 1;
}else{
mobs.state[s] = 2;
}
}
if(dist(mobB, mobA, posB, posA)<2){
explode(mobB, mobA);
mobs.health[s]=0;
}
break;
case 2:
if(!night){
mobs.health[s]-=0.1;
drawFlame(mobX+scrollX-20, mobY+scrollY-20, 3);
}
if(options.peaceful){
mobs.health[s]=0;
}
noStroke();
resetMatrix();
var playerX = scrollX+mobX, playerY = scrollY+mobY-20;
if(mouseX>playerX){
direction=LEFT;
}else{
direction=RIGHT;
}
if(mobs.state[s]!==0){
legPos = sin(time*30)*30;
}else{
legPos = 0;
}
translate(playerX+10, playerY+50);
rotate(-legPos);
fill(15, 0, 110);
rect(-6, 0, 12, 30);
resetMatrix();
fill(0, 135, 9);
translate(playerX, playerY);
if(mobs.direction[s]===LEFT){
scale(-1, 1);
translate(-20, 0);
}
rect(0, 0, 20, 20);
fill(4, 82, 0);
triangle(0, 0+5, 0+15, 0+5, 0, 0+10);
rect(0, 0, 20, 5);
fill(33, 33, 33);
rect(0+15, 0+7, 5, 3);
fill(0, 201, 201);
rect(0+4, 0+20, 12, 30);
noStroke();
resetMatrix();
translate(playerX+10, playerY+50);
rotate(legPos);
fill(23, 0, 156);
rect(-6, 0, 12, 30);
resetMatrix();
translate(playerX+10, playerY+22);
fill(0, 189, 189);
rect(-5, 0, 10, 10);
fill(0, 120, 4);
if(mobs.direction[s]===LEFT){
rect(-25, 0, 20, 10);
}else{
rect(5, 0, 20, 10);
}
resetMatrix();
if(!night){
drawFlame(mobX+scrollX-20, mobY+scrollY+5, 3);
}
if(dist(mobB, mobA, posB, posA)<10){
if(mobB<posB){
mobs.direction=RIGHT;
}else{
mobs.direction=LEFT;
}
}
if(dist(mobB, mobA, posB, posA)<10){
if(posB<mobB){
mobs.state[s]=2;
}else{
mobs.state[s]=1;
}
if(dist(mobB, mobA, posB, posA)<1){
health-=3;
}
}
if(round(random(0,100))){}else{
mobs.state[s]=round(random(0,2)+0.5);
}if(round(random(0,50))){}else{
mobs.state[s]=0;
}
if(!solidBlocks[world[mobA-(-1)][mobB]]&&world[mobA-(-1)][mobB]!==11&&world[mobA-(-1)][mobB]!==12){
mobs.y[s]+=10;
}
break;
case 3:
noStroke();
fill(255, 181, 181);
resetMatrix();
translate(mobs.x[s]+scrollX+20, mobs.y[s]+scrollY+25);
if(mobs.state[s]!==0){
rotate(sin(time*30)*15);
}
fill(48, 25, 0);
rect(-5, 0, 10, 30);
resetMatrix();
translate(mobs.x[s]+scrollX-10, mobs.y[s]+scrollY+25);
if(mobs.state[s]!==0){
rotate(-sin(time*30)*15);
}
rect(-5, 0, 10, 30);
resetMatrix();
fill(97, 50, 0);
rect(mobs.x[s]+scrollX-15, mobs.y[s]+scrollY+10, 40, 25);
fill(200);
arc(mobs.x[s]+scrollX, mobs.y[s]+scrollY+10, 20, 15, 0, 180);
arc(mobs.x[s]+scrollX+5, mobs.y[s]+scrollY+35, 15, 15, 180, 360);
fill(97, 50, 0);
translate(mobs.x[s]+scrollX-10, mobs.y[s]+scrollY+25);
if(mobs.state[s]!==0){
rotate(sin(time*30)*15);
}
rect(-5, 0, 10, 30);
resetMatrix();
translate(mobs.x[s]+scrollX+20, mobs.y[s]+scrollY+25);
if(mobs.state[s]!==0){
rotate(-sin(time*30)*15);
}
rect(-5, 0, 10, 30);
resetMatrix();
if(dist(mobB, mobA, posB, posA)<4){
var x = posX - posX*2 + 195;
var y = posY - posY*2 + 135;
if(mobs.direction[s]===LEFT){
translate(mobX+scrollX-10, mobY+scrollY+15);
}else{
translate(mobX+scrollX+25, mobY+scrollY+15);
}
rotate(atan2(mobY-y, mobX-x));
rect(-10, -10, 20, 20);
if(posB<mobB){
fill(50);
rect(-10,0,6,10);
fill(100);
rect(-6, -12, 3, 4);
fill(255);
rect(-10, -6, 5, 3);
fill(0);
rect(-8, -6, 3, 3);
if(mobs.state[s]===0){
mobs.direction[s]=LEFT;
}
}else{
fill(50);
rect(-10,-10,6,10);
fill(100);
rect(-6, 8, 3, 4);
fill(255);
rect(-10, 3, 5, 3);
fill(0);
rect(-8, 3, 3, 3);
if(mobs.state[s]===0){
mobs.direction[s]=RIGHT;
}
}
}else{
if(mobs.direction===LEFT){
translate(mobX+scrollX+10, mobY+scrollY+15);
}else{
translate(mobX+scrollX-10, mobY+scrollY+15);
}
if(direction===RIGHT){
scale(-1, 1);
}
mobs.headPos[s]=0;
rect(-10, -10, 20, 20);
fill(50);
rect(-10,0,6,10);
fill(100);
rect(-6, -12, 3, 4);
fill(255);
rect(-10, -6, 5, 3);
fill(0);
rect(-8, -6, 3, 3);
}
resetMatrix();
if(round(random(0,100))){}else{
mobs.state[s]=round(random(0,2)+0.5);
}if(round(random(0,50))){}else{
mobs.state[s]=0;
}
if(!solidBlocks[world[mobA-(-1)][mobB]]&&world[mobA-(-1)][mobB]!==11&&world[mobA-(-1)][mobB]!==12){
mobs.y[s]+=10;
}
if(dist(mobB, mobA, b, a)===0&&mouseIsPressed&&mouseButton===RIGHT&&hotbar[blockSelected]===337){
if(hotbarStacks[blockSelected]===1){
hotbar[blockSelected]=338;
}else{
hotbarStacks[blockSelected]--;
getItem(338, 1);
}
mouseIsPressed=false;
}
break;
case 4:
if(options.peaceful){
mobs.health[s]=0;
}
noStroke();
resetMatrix();
var playerX = scrollX+mobX, playerY = scrollY+mobY-20;
if(mouseX>playerX){
direction=LEFT;
}else{
direction=RIGHT;
}
if(mobs.state[s]!==0){
legPos = sin(time*30)*30;
}else{
legPos = 0;
}
translate(playerX+10, playerY+50);
rotate(-legPos);
fill(255, 107, 102);
rect(-6, 0, 12, 30);
resetMatrix();
fill(255, 127, 125);
translate(playerX, playerY);
if(mobs.direction[s]===LEFT){
scale(-1, 1);
translate(-20, 0);
}
rect(0, 0, 20, 20);
fill(33, 33, 33);
rect(15, 7, 5, 3);
fill(255, 127, 125);
rect(0+4, 0+20, 12, 30);
noStroke();
resetMatrix();
translate(playerX+10, playerY+50);
rotate(legPos);
fill(255, 127, 125);
rect(-6, 0, 12, 30);
resetMatrix();
translate(playerX+10, playerY+22);
fill(255, 127, 125);
rect(-5, 0, 10, 10);
fill(255, 127, 125);
if(mobs.direction[s]===LEFT){
rect(-25, 0, 20, 10);
translate(-35,-15);
rotate(-45);
drawBlocks(315, 0, 0);
}else{
rect(5, 0, 20, 10);
translate(10, -15);
rotate(-45);
drawBlocks(315, 0, 0);
}
resetMatrix();
if(dist(mobB, mobA, posB, posA)<10){
if(mobB<posB){
mobs.direction=RIGHT;
}else{
mobs.direction=LEFT;
}
}
if(dist(mobB, mobA, posB, posA)<10&&madPigmen){
if(posB<mobB){
mobs.state[s]=2;
}else{
mobs.state[s]=1;
}
if(dist(mobB, mobA, posB, posA)<1){
health-=9;
}
}
if(round(random(0,100))){}else{
mobs.state[s]=round(random(0,2)+0.5);
}if(round(random(0,50))){}else{
mobs.state[s]=0;
}
if(!solidBlocks[world[mobA-(-1)][mobB]]&&world[mobA-(-1)][mobB]!==11&&world[mobA-(-1)][mobB]!==12){
mobs.y[s]+=10;
}
break;
}
switch(mobs.state[s]){
case 1:
if(!solidBlocks[world[mobA][mobB]]){
mobs.x[s]+=3;
}
break;
case 2:
if(!solidBlocks[world[mobA][mobB-1]]){
mobs.x[s]-=3;
}
break;
}
if((world[mobA-(-1)][mobB]===11||world[mobA-(-1)][mobB]===12||world[mobA][mobB]===11||world[mobA][mobB]===12)){
mobs.y[s]-=2;
}
if(dist(mobB, mobA, b, a)===0&&mouseIsPressed&&mouseButton===LEFT){
if(mobs.type[s]===4){
pigmanTimer=5000;
}
mobs.health[s]--;
if(mobB<posB){
mobs.x[s]-=5;
}else{
mobs.x[s]+=5;
}
mobs.y[s]-=10;
mouseIsPressed=false;
if(hotbar[blockSelected]>311&&hotbar[blockSelected]<317){
hotbarSpecs[blockSelected]--;
mobs.health[s]-=(hotbar[blockSelected]-310)*2;
}
if(mobs.health[s]<=0){
switch(mobs.type[s]){
case 0:
for(var i = 0; i < random(0,3); i++){
spawnEntity(mobs.x[s]+random(0, 40), mobs.y[s]+20, 0, 317);
}
break;
case 1:
for(var i = 0; i < random(0,3); i++){
spawnEntity(mobs.x[s]+random(0, 40), mobs.y[s]+20, 0, 318);
}
break;
case 2:
spawnEntity(mobs.x[s]+random(0, 40), mobs.y[s]+20, 0, 319);
if(!round(random(0,40))){
if(round(random(0,5))){
spawnEntity(mobs.x[s]+random(0, 40), mobs.y[s]+20, 0, 302);
}else{
spawnEntity(mobs.x[s]+random(0, 40), mobs.y[s]+20, 0, 316);
}
}
break;
case 3:
for(var i = 0; i < random(0,3); i++){
spawnEntity(mobs.x[s]+random(0, 40), mobs.y[s]+20, 0, 336);
}
break;
case 4:
for(var i = 0; i < random(0,3); i++){
spawnEntity(mobs.x[s]+random(0, 40), mobs.y[s]+20, 0, 319);
}
for(var i = 0; i < round(random(0,1)); i++){
spawnEntity(mobs.x[s]+random(0, 40), mobs.y[s]+20, 0, 303);
}
if(!round(random(0,40))){
spawnEntity(mobs.x[s]+random(0, 40), mobs.y[s]+20, 0, 315);
}
break;
}
}
}
}}}
//You
posA = (posY/40 - posY/20 + 4).toFixed(0, 0);
posB = (posX/40 - posX/20 + 5).toFixed(0, 0);
posA2 = ((posY-30)/40 - (posY-30)/20).toFixed(0, 0);
posB2 = ((posX+30)/40 - (posX+30)/20 + 5).toFixed(0, 0);
fall = 20;
if(inWater||world[posA][posB]===11||world[posA][posB]===12||world[posA][posB2]===11||world[posA][posB2]===12){
minJump = 18;
}else if(inLava){
minJump = 19;
}else{
minJump = 0;
}
if(jump > minJump){
jump--;
}
if(jump < minJump){
jump++;
}
if (world[posA-1][posB]===11||world[posA-1][posB]===12||world[posA2][posB]===11||world[posA2][posB]===12){
inWater = true;
}else{
inWater = false;
}
playerSpeed = 8;
if (world[posA][posB]===13||world[posA][posB]===14){
onFire = true;
inLava = true;
}else{
inLava = false;
}
if(world[posA][posB]===17){
onFire = true;
}
if(!solidBlocks[world[posA-(-1)][posB]]&&!solidBlocks[world[posA-(-1)][posB2]]){
if(fallTix>10){
blocksFallen++;
}
posY -= fall - jump;
}else{
jump=20;
if(blocksFallen>5){
health-=blocksFallen*2;
}
blocksFallen=0;
fallTix=0;
}
//to prevent infinity health hax
if(health>20){
health=20;
}
if(inWater){
onFire=false;
}
noStroke();
resetMatrix();
var playerX = scrollX-posX+195, playerY = scrollY-posY+135;
if(onFire){
drawFlame(playerX-18, playerY+30, 3);
c = random(0, 400);
if(c>399.5){
onFire=false;
}
if(fireTix<10){
fireTix++;
}else{
health--;
fireTix=0;
}
}
if(mouseX>playerX){
direction=LEFT;
}else{
direction=RIGHT;
}
if(keys[65]||keys[68]){
legPos = sin(time*30)*30;
armPos = sin(time*30)*15;
}else{
legPos = 0;
if(!mouseIsPressed){
armPos=0;
}
}
if(solidBlocks[world[posA2-(-2)][posB]]||solidBlocks[world[posA2-(-2)][posB2]]){
jump = 18;
}
translate(playerX+10, playerY+50);
rotate(-legPos);
fill(15, 0, 110);
rect(-6, 0, 12, 30);
if(armorSlots[2]>0){
switch(armorSlots[2]){
case 322:
fill(225);
stroke(150);
break;
case 326:
fill(255, 213, 0);
stroke(191, 150, 0);
break;
case 330:
fill(0, 255, 255);
stroke(0, 168, 168);
break;
case 334:
fill(189, 120, 0);
stroke(125, 75, 0);
break;
}
rect(-6, 0, 11, 25, 30);
noStroke();
}
if(armorSlots[3]>0){
switch(armorSlots[3]){
case 323:
fill(225);
stroke(150);
break;
case 327:
fill(255, 213, 0);
stroke(191, 150, 0);
break;
case 331:
fill(0, 255, 255);
stroke(0, 168, 168);
break;
case 335:
fill(189, 120, 0);
stroke(125, 75, 0);
break;
}
rect(-7, 20, 14, 13, 30);
noStroke();
}
resetMatrix();
translate(playerX+10, playerY+22);
rotate(-armPos);
fill(0, 122, 122);
rect(-5, 0, 10, 10);
fill(143, 105, 43);
rect(-5, 10, 10, 20);
resetMatrix();
fill(199, 154, 77);
translate(playerX, playerY);
if(direction===RIGHT){
scale(-1, 1);
translate(-20, 0);
}
rect(0, 0, 20, 20);
fill(117, 84, 0);
triangle(0, 0+5, 0+15, 0+5, 0, 0+10);
rect(0, 0, 20, 5);
fill(255);
rect(0+15, 0+7, 5, 3);
fill(108, 0, 196);
rect(0+17, 0+7, 3, 3);
fill(0, 201, 201);
rect(0+4, 0+20, 12, 30);
if(armorSlots[1]>0){
switch(armorSlots[1]){
case 321:
fill(225);
stroke(150);
break;
case 325:
fill(255, 213, 0);
stroke(191, 150, 0);
break;
case 329:
fill(0, 255, 255);
stroke(0, 168, 168);
break;
case 333:
fill(189, 120, 0);
stroke(125, 75, 0);
break;
}
rect(2, 20, 16, 35, 15);
noStroke();
}
if(armorSlots[0]>0){
switch(armorSlots[0]){
case 320:
fill(225);
stroke(150);
break;
case 324:
fill(255, 213, 0);
stroke(191, 150, 0);
break;
case 328:
fill(0, 255, 255);
stroke(0, 168, 168);
break;
case 332:
fill(189, 120, 0);
stroke(125, 75, 0);
break;
}
rect(-2, -3, 25, 8, 30);
}noStroke();
if(mouseIsPressed&&mouseButton===LEFT&&armTimer<=0){
armTimer = 5;
}
if(armTimer>0){
armTimer--;
}
resetMatrix();
translate(playerX+10, playerY+50);
rotate(legPos);
fill(23, 0, 156);
rect(-6, 0, 12, 30);
if(armorSlots[2]>0){
switch(armorSlots[2]){
case 322:
fill(225);
stroke(150);
break;
case 326:
fill(255, 213, 0);
stroke(191, 150, 0);
break;
case 330:
fill(0, 255, 255);
stroke(0, 168, 168);
break;
case 334:
fill(189, 120, 0);
stroke(125, 75, 0);
break;
}
rect(-6, -3, 11, 28, 30);
noStroke();
}
if(armorSlots[3]>0){
switch(armorSlots[3]){
case 323:
fill(225);
stroke(150);
break;
case 327:
fill(255, 213, 0);
stroke(191, 150, 0);
break;
case 331:
fill(0, 255, 255);
stroke(0, 168, 168);
break;
case 335:
fill(189, 120, 0);
stroke(125, 75, 0);
break;
}
rect(-7, 20, 14, 13, 30);
noStroke();
}
resetMatrix();
translate(playerX+10, playerY+22);
if(armTimer>0){
if(direction===RIGHT){
rotate(armTimer*10);
}else{
rotate(-armTimer*10);
}
}else{
rotate(armPos);
}
fill(0, 189, 189);
rect(-5, 0, 10, 10);
fill(199, 154, 77);
rect(-5, 10, 10, 20);
if(armorSlots[1]>0){
switch(armorSlots[1]){
case 321:
fill(225);
stroke(150);
break;
case 325:
fill(255, 213, 0);
stroke(191, 150, 0);
break;
case 329:
fill(0, 255, 255);
stroke(0, 168, 168);
break;
case 333:
fill(189, 120, 0);
stroke(125, 75, 0);
break;
}
rect(-8, -3, 15, 15, 15);
noStroke();
}
if(direction===RIGHT){
scale(-1, 1);
}
if(hotbar[blockSelected]>300){
drawBlocks(hotbar[blockSelected], 6, 10);
}else{
scale(0.75, 0.75);
drawBlocks(hotbar[blockSelected], 6, 20);
}
resetMatrix();
if(onFire){
drawFlame(playerX-20, playerY, 3);
}
posA2 = ((posY+10)/40 - (posY+10)/20+4).toFixed(0, 0);
posA2 = ((posY-30)/40 - (posY-30)/20+4).toFixed(0, 0);
if(place+50>world[0].length){
genWorld();
}
//the hotbar
if(hide===false){
fill(199);
stroke(0, 0, 0);
rect(10, 350, 380, 50);
fill(230, 230, 230);
rect(blockSelected*43+15, 361, 30, 30);
noStroke();
for(var i=0; i<9; i++){
var j = i*43+20;
noStroke();
drawBlocks(hotbar[i], j, 366);
noStroke();
if(itemDurabilities[hotbar[i]]!==null&&hotbarSpecs[i]!==itemDurabilities[hotbar[i]]){
var filler = 255/itemDurabilities[hotbar[i]];
fill(255-hotbarSpecs[i]*filler, hotbarSpecs[i]*filler, 0);
rect(j, 388, hotbarSpecs[i]/(itemDurabilities[hotbar[i]]/20), 3);
if(hotbarSpecs[i]<=0){
hotbarSpecs[i]=0;
hotbarStacks[i]=0;
hotbar[i]=0;
}
}
fill(0);
text(i+1, j-7, 363);
fill(255);
textSize(15);
if(hotbarStacks[i]!==0&&hotbarStacks[i]!==1){
text(hotbarStacks[i], j+20, 366+23);
}
if(hotbarStacks[i]===0){
hotbar[i]=0;
}
textSize(12);
}}
//Hearts, armor, etc.
if(shake===2){
shake=-2;
}else{
shake=2;
}
if(inWater){
drownCount++;
for(var ll = 0; ll < oxygen; ll++){
noFill();
stroke(0, 196, 230, 150);
ellipse(ll*16+30, 301, 16, 16);
}
if(drownCount>50){
oxygen--;
drownCount=0;
if(oxygen<0){
health-=2;
}
}
}else{
oxygen=10;
}
for(var L = 0; L < armor/2; L++){
image(shield, 400-L*16-40, 312, 16, 24);
}
//Now to select what blocks to place.
if(inventory===false&&news===false&&isCrafting===false&&isSmelting===false){
a = (mouseY/40 + 0.5 - scrollY/40).toFixed(0, 0) - 1;
b = (mouseX/40 + 0.5 - scrollX/40).toFixed(0, 0) - 1;
if (mouseIsPressed&&mouseButton===RIGHT&&hotbar[blockSelected]<300&&hotbar[blockSelected]!==0){
if(world[a][b]===0||world[a][b]===11||world[a][b]===12||world[a][b]===13||world[a][b]===14){
world[a][b]=(hotbar[blockSelected]);
armTimer=5;
if(world[a][b]===33){
var newFurnace = [0,0,0,50,0,0,0,0,0,0,0,0];
specs[a][b]=newFurnace;
}
if(world[a][b]===34){
var newChest = [
[[0,0,0,0],
[0,0,0,0],
[0,0,0,0],
[0,0,0,0],
[0,0,0,0],
[0,0,0,0]],
[[0,0,0,0],
[0,0,0,0],
[0,0,0,0],
[0,0,0,0],
[0,0,0,0],
[0,0,0,0]],
[[0,0,0,0],
[0,0,0,0],
[0,0,0,0],
[0,0,0,0],
[0,0,0,0],
[0,0,0,0]]];
specs[a][b]=newChest;
}
if(!itemDurabilities[hotbar[blockSelected]]){
if(hotbar[blockSelected]===11||hotbar[blockSelected]===13){
hotbar[blockSelected]=337;
mouseIsPressed=false;
}else{
hotbarStacks[blockSelected]--;
}
}else{
hotbarSpecs[blockSelected]--;
}
if(world[a][b]===28){
specs[a][b]=1;
specs[a-1][b]=1;
world[a-1][b]=29;
}
}else {
if (world[a][b]===15&&hotbar[blockSelected]===17){
explode(b, a);
}
}
}
if(mouseIsPressed&&mouseButton===RIGHT){
if((world[a][b]===11||world[a][b]===13)&&hotbar[blockSelected]===337){
if(hotbarStacks[blockSelected]===1){
hotbar[blockSelected]=world[a][b];
}else{
hotbarStacks[blockSelected]--;
getItem(world[a][b], 1);
}
world[a][b]=0;
mouseIsPressed=false;
}
if(hotbar[blockSelected]===340){
spawnEntity(b*40, a*40, 1, 0);
hotbarStacks[blockSelected]--;
mouseIsPressed=false;
}
if(world[a][b]===33){
isSmelting=true;
blockTargeted=[a, b];
mouseIsPressed=false;
}
if(world[a][b]===34){
onChest=true;
blockTargeted=[a, b];
mouseIsPressed=false;
}
if(world[a][b]===27){
isCrafting=true;
}else if(world[a][b]===26&&hotbar[blockSelected]===305){
heartsShowing=true;
hotbarStacks[blockSelected]--;
if(shieldsShowing!==false){
shieldsShowing+=1000;
}
}else if(world[a][b]===28){
if(specs[a][b]===0){
specs[a][b]=1;
specs[a-1][b]=1;
}else if(specs[a][b]===1){
specs[a][b]=0;
specs[a-1][b]=0;
}
mouseButton=2;
}else if(world[a][b]===29){
if(specs[a][b]===0){
specs[a][b]=1;
specs[a-(-1)][b]=1;
}else if(specs[a][b]===1){
specs[a][b]=0;
specs[a-(-1)][b]=0;
}
mouseButton=2;
}
if(hotbar[blockSelected]===317&&health<20){
health+=3;
hotbarStacks[blockSelected]--;
mouseIsPressed=false;
}
if(hotbar[blockSelected]===319&&health<20){
health+=8;
hotbarStacks[blockSelected]--;
mouseIsPressed=false;
}
}
}else if (inventory===true){
var craftingSquares = [[],[],[]];
for(var i = 0; i < 3; i++){
for(var j = 0; j < 3; j++){
craftingSquares[i][j] = craftingGrid[i*3+j];
}
}
if(mouseY<350){
if(mouseX<220){
a = (mouseY/40+0.5).toFixed(0, 0) - 1;
b = (mouseX/40+0.75).toFixed(0, 0) - 2;
if(a<7&&b<5&&a>0&&b>0){
setTag(invContents[a-1][b-1]);
if(mouseIsPressed){
if(invContents[a-1][b-1]===holdingBlock){
while(holdingStacks<maxStacks[holdingBlock]&&invStacks[a-1][b-1]>0){
invStacks[a-1][b-1]--;
holdingStacks++;
}
}
var oldBlock = holdingBlock;
var oldStack = holdingStacks;
var oldSpec = holdingSpecs;
holdingBlock=invContents[a-1][b-1];
holdingStacks=invStacks[a-1][b-1];
holdingSpecs=invSpecs[a-1][b-1];
invContents[a-1][b-1]=oldBlock;
invStacks[a-1][b-1]=oldStack;
invSpecs[a-1][b-1]=oldSpec;
keyCode=0;
mouseIsPressed=false;
}
}}else{
a = ((mouseY)/30).toFixed(0, 0)-2;
b = ((mouseX)/30).toFixed(0, 0)-9;
if(mouseY<200&&mouseX>210&&b<2&&b>=0&&a<2&&a>=0){
setTag(craftingSquares[a][b]);
if(mouseIsPressed){
if(craftingSquares[a][b]===0){
craftingGrid[a*3+b]=holdingBlock;
holdingStacks--;
keyCode=0;
mouseIsPressed=false;
}else if(holdingBlock===0||holdingBlock===craftingSquares[a][b]){
holdingBlock=craftingGrid[a*3+b];
holdingStacks++;
craftingGrid[a*3+b]=0;
mouseIsPressed=false;
}
}
}//255, 140, 40, 40
if(mouseX>255&&mouseX<295&&mouseY>140&&mouseY<180){
setTag(craftedItem);
if(mouseIsPressed&&craftedItem!==0){
if(keys[SHIFT]){
getItem(craftedItem, craftedStacks);
craftedItem=0;
craftedStacks=0;
craftingGrid=[0,0,0,0,0,0,0,0,0];
}else if(holdingBlock===0){
holdingBlock=craftedItem;
holdingStacks=craftedStacks;
holdingSpecs=itemDurabilities[craftedItem];
craftingGrid=[0,0,0,0,0,0,0,0,0];
mouseIsPressed=false;
}
}//d*35+250, e*30+195
}else if(mouseX>240&&mouseX<310&&mouseY>185&&mouseY<255){
a = ((mouseY-175)/30).toFixed(0,0)-1;
b = ((mouseX-225)/35).toFixed(0,0)-1;
setTag(armorSlots[a*2+b]);
if(mouseIsPressed&&a>=0&&a<=1&&b>=0&&b<=1){
if(holdingBlock===0){
holdingBlock = armorSlots[a*2+b];
holdingSpecs = armorSpecs[a*2+b];
holdingStacks = 1;
armorSlots[a*2+b]=0;
armorSpecs[a*2+b]=0;
mouseIsPressed=false;
}else if(holdingBlock>=320&&holdingBlock<=335){
var data = holdingBlock;
if(data>300){
while(data>3){
data-=4;
}
}
if(data===a*2+b){
var oldBlock = holdingBlock;
var oldSpecs = holdingSpecs;
holdingBlock = armorSlots[a*2+b];
holdingSpecs = armorSpecs[a*2+b];
armorSlots[a*2+b]=oldBlock;
armorSpecs[a*2+b]=oldSpecs;
mouseIsPressed=false;
}
}
}
}
}}else {
b = (mouseX/40).toFixed(0, 0);
if(b>0&&b<=9){
setTag(hotbar[b-1]);
if(mouseIsPressed){
if(hotbar[b-1]===holdingBlock){
while(holdingStacks<maxStacks[holdingBlock]&&hotbarStacks[b-1]>0){
hotbarStacks[b-1]--;
holdingStacks++;
}
}
var oldBlock = holdingBlock;
var oldStack = holdingStacks;
var oldSpec = holdingSpecs;
holdingBlock=hotbar[b-1];
holdingStacks=hotbarStacks[b-1];
holdingSpecs=hotbarSpecs[b-1];
hotbar[b-1]=oldBlock;
hotbarStacks[b-1]=oldStack;
hotbarSpecs[b-1]=oldSpec;
keyCode=0;
mouseIsPressed=false;
}
}}
}
if (onChest){
var targetChest = specs[blockTargeted[0]][blockTargeted[1]];
if(mouseY<350){
if(mouseX<200){
a = ((mouseY-60)/40).toFixed(0,0);
b = ((mouseX-50)/40).toFixed(0,0);
if(b<1){b=0;}
if(a<1){a=0;}
if(a<6&&b<4&&a>=0&&b>=0){
setTag(invContents[a][b]);
if(mouseIsPressed){
if(invContents[a][b]===holdingBlock){
while(holdingStacks<maxStacks[holdingBlock]&&invStacks[a][b]>0){
invStacks[a][b]--;
holdingStacks++;
}
}
var oldBlock = holdingBlock;
var oldStack = holdingStacks;
var oldSpec = holdingSpecs;
holdingBlock=invContents[a][b];
holdingStacks=invStacks[a][b];
holdingSpecs=invSpecs[a][b];
invContents[a][b]=oldBlock;
invStacks[a][b]=oldStack;
invSpecs[a][b]=oldSpec;
mouseIsPressed=false;
}
}
}else{
a = ((mouseY-220)/40).toFixed(0,0)-(-4);
b = ((mouseX-60)/40).toFixed(0,0)-4;
if(a<6&&b<4&&a>=0&&b>=0){
setTag(targetChest[0][a][b]);
if(mouseIsPressed){
if(targetChest[0][a][b]===holdingBlock){
while(holdingStacks<maxStacks[holdingBlock]&&targetChest[1][a][b]>0){
targetChest[1][a][b]--;
holdingStacks++;
}
}
var oldBlock = holdingBlock;
var oldStack = holdingStacks;
var oldSpec = holdingSpecs;
holdingBlock=targetChest[0][a][b];
holdingStacks=targetChest[1][a][b];
holdingSpecs=targetChest[2][a][b];
targetChest[0][a][b]=oldBlock;
targetChest[1][a][b]=oldStack;
targetChest[2][a][b]=oldSpec;
mouseIsPressed=false;
}
}
}
}else{
b = (mouseX/40).toFixed(0, 0);
if(b>0&&b<=9){
setTag(hotbar[b-1]);
if(mouseIsPressed){
if(hotbar[b-1]===holdingBlock){
while(holdingStacks<maxStacks[holdingBlock]&&hotbarStacks[b-1]>0){
hotbarStacks[b-1]--;
holdingStacks++;
}
}
var oldBlock = holdingBlock;
var oldStack = holdingStacks;
var oldSpec = holdingSpecs;
holdingBlock=hotbar[b-1];
holdingStacks=hotbarStacks[b-1];
holdingSpecs=hotbarSpecs[b-1];
hotbar[b-1]=oldBlock;
hotbarStacks[b-1]=oldStack;
hotbarSpecs[b-1]=oldSpec;
keyCode=0;
mouseIsPressed=false;
}
}
}mouseIsPressed=false;
}
if (isCrafting===true){
var craftingSquares = [[],[],[]];
for(var i = 0; i < 3; i++){
for(var j = 0; j < 3; j++){
craftingSquares[i][j] = craftingGrid[i*3+j];
}
}
if(mouseY<350){
if(mouseX<220){
a = (mouseY/40+0.5).toFixed(0, 0) - 1;
b = (mouseX/40+0.75).toFixed(0, 0) - 2;
if(a<7&&b<5&&a>0&&b>0){
setTag(invContents[a-1][b-1]);
if(mouseIsPressed){
if(invContents[a-1][b-1]===holdingBlock){
while(holdingStacks<maxStacks[holdingBlock]&&invStacks[a-1][b-1]>0){
invStacks[a-1][b-1]--;
holdingStacks++;
}
}
var oldBlock = holdingBlock;
var oldStack = holdingStacks;
var oldSpec = holdingSpecs;
holdingBlock=invContents[a-1][b-1];
holdingStacks=invStacks[a-1][b-1];
holdingSpecs=invSpecs[a-1][b-1];
invContents[a-1][b-1]=oldBlock;
invStacks[a-1][b-1]=oldStack;
invSpecs[a-1][b-1]=oldSpec;
mouseIsPressed=false;
}
}}else{
a = ((mouseY)/30).toFixed(0, 0)-2;
b = ((mouseX)/30).toFixed(0, 0)-9;
if(mouseY<200&&mouseX>210&&b<3&&b>=0&&a<3&&a>=0){
setTag(craftingSquares[a][b]);
if(mouseIsPressed){
if(craftingSquares[a][b]===0){
craftingGrid[a*3+b]=holdingBlock;
holdingStacks--;
keyCode=0;
mouseIsPressed=false;
}else if(holdingBlock===0||holdingBlock===craftingSquares[a][b]){
holdingBlock=craftingGrid[a*3+b];
holdingStacks++;
craftingGrid[a*3+b]=0;
mouseIsPressed=false;
}
}
}
if(mouseX>270&&mouseX<315&&mouseY>225&&mouseY<270){
setTag(craftedItem);
if(mouseIsPressed){
if(keys[SHIFT]){
getItem(craftedItem, craftedStacks);
craftedItem=0;
craftedStacks=0;
craftingGrid=[0,0,0,0,0,0,0,0,0];
}else if(holdingBlock===0){
holdingBlock=craftedItem;
holdingStacks=craftedStacks;
holdingSpecs=itemDurabilities[craftedItem];
craftingGrid=[0,0,0,0,0,0,0,0,0];
mouseIsPressed=false;
}}
}}}else{
b = (mouseX/40).toFixed(0, 0);
if(b>0&&b<=9){
setTag(hotbar[b-1]);
if(mouseIsPressed){
if(hotbar[b-1]===holdingBlock){
while(holdingStacks<maxStacks[holdingBlock]&&hotbarStacks[b-1]>0){
hotbarStacks[b-1]--;
holdingStacks++;
}
}
var oldBlock = holdingBlock;
var oldStack = holdingStacks;
var oldSpec = holdingSpecs;
holdingBlock=hotbar[b-1];
holdingStacks=hotbarStacks[b-1];
holdingSpecs=hotbarSpecs[b-1];
hotbar[b-1]=oldBlock;
hotbarStacks[b-1]=oldStack;
hotbarSpecs[b-1]=oldSpec;
keyCode=0;
mouseIsPressed=false;
}
}
}}
if(isSmelting){
if(mouseY<350){
if(mouseX<220){
a = (mouseY/40+0.5).toFixed(0, 0) - 1;
b = (mouseX/40+0.75).toFixed(0, 0) - 2;
if(a<7&&b<5&&a>0&&b>0){
setTag(invContents[a-1][b-1]);
if(mouseIsPressed){
if(invContents[a-1][b-1]===holdingBlock){
while(holdingStacks<maxStacks[holdingBlock]&&invStacks[a-1][b-1]>0){
invStacks[a-1][b-1]--;
holdingStacks++;
}
}
var oldBlock = holdingBlock;
var oldStack = holdingStacks;
var oldSpec = holdingSpecs;
holdingBlock=invContents[a-1][b-1];
holdingStacks=invStacks[a-1][b-1];
holdingSpecs=invSpecs[a-1][b-1];
invContents[a-1][b-1]=oldBlock;
invStacks[a-1][b-1]=oldStack;
invSpecs[a-1][b-1]=oldSpec;
mouseIsPressed=false;
}
}}else{
var targetFurnace = specs[blockTargeted[0]][blockTargeted[1]];
for(var i = 0; i <= 10; i++){
if(specs[blockTargeted[0]][blockTargeted[1]][i]===undefined){
specs[blockTargeted[0]][blockTargeted[1]][i]=0;
}
}
var fuel = targetFurnace[0];
var fuelStacks = targetFurnace[1];
var fuelSpecs = targetFurnace[2];
var smeltingTime = targetFurnace[3];
var item = targetFurnace[4];
var itemStacks = targetFurnace[5];
var itemSpecs = targetFurnace[6];
var smeltedItem = targetFurnace[7];
var smeltedStacks = targetFurnace[8];
var smeltedSpecs = targetFurnace[9];
var burnTime = targetFurnace[10];
/*
255, 50, 40, 40
255, 130, 40, 40
255, 240, 40, 40
*/
if(mouseX>255&&mouseX<295&&mouseY>240&&mouseY<280&&mouseIsPressed){
if(keys[SHIFT]){
getItem(smeltedItem, smeltedStacks);
smeltedItem=0;
smeltedStacks=0;
}else if(holdingBlock===0){
holdingBlock=smeltedItem;
holdingStacks=smeltedStacks;
smeltedItem=0;smeltedStacks=0;
holdingSpecs=itemDurabilities[smeltedItem];
}mouseIsPressed=false;}
if(mouseX>255&&mouseX<295&&mouseY>130&&mouseY<170&&mouseIsPressed){
var oldBlock = holdingBlock;
var oldStack = holdingStacks;
var oldSpec = holdingSpecs;
holdingBlock=fuel;
holdingStacks=fuelStacks;
holdingSpecs=fuelSpecs;
fuel=oldBlock;
fuelStacks=oldStack;
fuelSpecs=oldSpec;
mouseIsPressed=false;
}
if(mouseX>255&&mouseX<295&&mouseY>50&&mouseY<90&&mouseIsPressed){
var oldBlock = holdingBlock;
var oldStack = holdingStacks;
var oldSpec = holdingSpecs;
holdingBlock=item;
holdingStacks=itemStacks;
holdingSpecs=itemSpecs;
item=oldBlock;
itemStacks=oldStack;
itemSpecs=oldSpec;
mouseIsPressed=false;
}
specs[blockTargeted[0]][blockTargeted[1]][0]=fuel;
specs[blockTargeted[0]][blockTargeted[1]][1]=fuelStacks;
specs[blockTargeted[0]][blockTargeted[1]][2]=fuelSpecs;
specs[blockTargeted[0]][blockTargeted[1]][3]=smeltingTime;
specs[blockTargeted[0]][blockTargeted[1]][4]=item;
specs[blockTargeted[0]][blockTargeted[1]][5]=itemStacks;
specs[blockTargeted[0]][blockTargeted[1]][6]=itemSpecs;
specs[blockTargeted[0]][blockTargeted[1]][7]=smeltedItem;
specs[blockTargeted[0]][blockTargeted[1]][8]=smeltedStacks;
specs[blockTargeted[0]][blockTargeted[1]][9]=smeltedSpecs;
specs[blockTargeted[0]][blockTargeted[1]][10]=burnTime;
}}else{
b = (mouseX/40).toFixed(0, 0);
if(b>0&&b<=9){
setTag(hotbar[b-1]);
if(mouseIsPressed){
if(hotbar[b-1]===holdingBlock){
while(holdingStacks<maxStacks[holdingBlock]&&hotbarStacks[b-1]>0){
hotbarStacks[b-1]--;
holdingStacks++;
}
}
var oldBlock = holdingBlock;
var oldStack = holdingStacks;
var oldSpec = holdingSpecs;
holdingBlock=hotbar[b-1];
holdingStacks=hotbarStacks[b-1];
holdingSpecs=hotbarSpecs[b-1];
hotbar[b-1]=oldBlock;
hotbarStacks[b-1]=oldStack;
hotbarSpecs[b-1]=oldSpec;
keyCode=0;
mouseIsPressed=false;
}
}
}}
if(holdingStacks===0||holdingBlock===0){
holdingBlock=0;
holdingStacks=0;
holdingSpecs=0;
}
if(keys[112]){
if(hide===false){
hide=true;
}else{
hide=false;
}
keyCode=0;
}
if(keyTimer>0&&isSprinting===false){
keyTimer--;
}
if(keys[68]){
//direction=LEFT;
posB2 = ((posX+30)/40 - (posX+30)/20 + 6).toFixed(0, 0);
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**/
if(keyTimer>0){
isSprinting=true;
playerSpeed = playerSpeed * 1.5;
}
posX-=playerSpeed;
if(isSprinting){
playerSpeed = playerSpeed / 1.5;
}
}else{
isSprinting=false;
if(world[posA2][posB2]===31||world[posA][posB2]===31){
health-=1;
}
}
posB2 = ((posX+30)/40 - (posX+30)/20 + 5).toFixed(0, 0);
}
if(keys[65]){
//direction=RIGHT;
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))){
if(keyTimer>0){
isSprinting=true;
playerSpeed = playerSpeed * 1.5;
}
posX+=playerSpeed;
if(isSprinting){
playerSpeed = playerSpeed / 1.5;
}
}else{
if(world[posA2][posB-1]===31||world[posA][posB-1]===31){
health-=1;
}
isSprinting=false;
}
}
if(keys[16]||keys[83]){
if(world[posA-(-1)][posB]===30||world[posA-(-1)][posB]===0){
posY-=playerSpeed;
}
if(isSitting){
isSitting=false;
}else{
isSitting=true;
}
keyCode=0;
}
if(keys[32]||keys[87]){
if(!solidBlocks[world[posA-2][posB]]){
if(inWater||world[posA2][posB]===11||world[posA2][posB]===12||world[posA2][posB2]===11||world[posA2][posB2]===12){
jump=23;
if(solidBlocks[world[posA-(-1)][posB]]||solidBlocks[world[posA-(-1)][posB2]]){
posY+=6;
}
}else if(inLava||world[posA2][posB]===13||world[posA2][posB]===14||world[posA2][posB2]===13||world[posA2][posB2]===14){
onFire = true;
jump=23;
if(solidBlocks[world[posA-(-1)][posB]]||solidBlocks[world[posA-(-1)][posB2]]){
posY+=6;
}
}else if(solidBlocks[world[posA-(-1)][posB]]||solidBlocks[world[posA-(-1)][posB2]]){
jump=30;
posY+=6;
}
}
if(world[posA][posB]===30){
posY+=playerSpeed;
}
}
if(keys[115]){
health-=4;
broadcast("Ouch...");
keys[115]=false;
}
if(posX<-10){
scrollX=posX;
}
if(posY<0&&posY>-1187){
scrollY=posY;
}
if(keyCode>48&&keyCode<58&&onInputBox===false){
blockSelected=keyCode-49;
}
//Now to make it so we can break blocks.
if(!mouseIsPressed){
blockStrength=null;
}
if(mouseIsPressed&&mouseButton===LEFT&&inventory===false&&news===false&&world[a][b]!==18){
if(world[a][b]<10||world[a][b]>14){
if(blockStrength===null){
selDurability = blockDurability[world[a][b]];
for(var i = 307; i <= 311; i++){
if(hotbar[blockSelected]===i){
selDurability=selDurability/(hotbar[blockSelected]-305+blockDurability[world[a][b]]/50);
}
}
/*if(world[a][b]!==0){
broadcast(selDurability);
}*/
blockTargeted = [a, b];
blockStrength=selDurability;
}
if(blockStrength<=0){
switch(world[a][b]){
case 1:
if(hotbar[blockSelected]>=307&&hotbar[blockSelected]<=311){
spawnEntity(b*40+random(0,20),a*40+10, 0, 4);
}
break;
case 2:
spawnEntity(b*40+random(0,20),a*40+10, 0, 3);
break;
case 3:
spawnEntity(b*40+random(0,20),a*40+10, 0, 3);
break;
case 4:
if(hotbar[blockSelected]>=307&&hotbar[blockSelected]<=311){
spawnEntity(b*40+random(0,20),a*40+10, 0, 4);
}
break;
case 5:
spawnEntity(b*40+random(0,20),a*40+10, 0, 5);
break;
case 6:
if(hotbar[blockSelected]>=307&&hotbar[blockSelected]<=311){
spawnEntity(b*40+random(0,20),a*40+10, 0, 6);
}
break;
case 7:
spawnEntity(b*40+random(0,20),a*40+10, 0, 7);
break;
case 8:
if(hotbar[blockSelected]===311){
spawnEntity(b*40+random(0,20),a*40+10, 0, 8);
}
break;
case 9:
c = random(0, 5);
if(c > 4.5){
spawnEntity(b*40+random(0,20),a*40+10, 0, 16);
}
break;
case 15:
spawnEntity(b*40+random(0,20),a*40+10, 0, 15);
break;
case 16:
spawnEntity(b*40+random(0,20),a*40+10, 0, 16);
break;
case 19:
if(hotbar[blockSelected]>=307&&hotbar[blockSelected]<=311){
spawnEntity(b*40+random(0,20),a*40+10, 0, 19);
}
break;
case 20:
spawnEntity(b*40+random(0,20),a*40+10, 0, 20);
break;
case 21:
c = random(0, 5);
if(c>4){
spawnEntity(b*40+random(0,20),a*40+10, 0, 306);
}else{
spawnEntity(b*40+random(0,20),a*40+10, 0, 21);
}
break;
case 22:
if(hotbar[blockSelected]>=307&&hotbar[blockSelected]<=311){
spawnEntity(b*40+random(0,20),a*40+10, 0, 301);
}
break;
case 23:
if(hotbar[blockSelected]>=308&&hotbar[blockSelected]<=311){
spawnEntity(b*40+random(0,20),a*40+10, 0, 23);
}
break;
case 24:
if(hotbar[blockSelected]>=309&&hotbar[blockSelected]<=311){
spawnEntity(b*40+random(0,20),a*40+10, 0, 24);
}
break;
case 25:
if(hotbar[blockSelected]>=309&&hotbar[blockSelected]<=311){
c = round(random(4, 5));
for(var i = 0; i < c; i++){
spawnEntity(b*40+random(0,20),a*40+10, 0, 304);
}
}
break;
case 26:
if(hotbar[blockSelected]>=309&&hotbar[blockSelected]<=311){
spawnEntity(b*40+random(0,20),a*40+10, 0, 305);
}
break;
case 27:
spawnEntity(b*40+random(0,20),a*40+10, 0, 27);
break;
case 28:
spawnEntity(b*40+random(0,20),a*40+10, 0, 28);
world[a-1][b]=0;
break;
case 29:
spawnEntity(b*40+random(0,20),a*40+10, 0, 28);
world[a-(-1)][b]=0;
break;
case 30:
spawnEntity(b*40+random(0,20),a*40+10, 0, 30);
break;
case 31:
spawnEntity(b*40+random(0,20),a*40+10, 0, 31);
break;
case 33:
spawnEntity(b*40+random(0,20),a*40+10,0,33);
for(var i = 0; i < specs[a][b][1]; i++){
spawnEntity(b*40+random(0,20),a*40+10,0,specs[a][b][0]);
}
for(var i = 0; i < specs[a][b][5]; i++){
spawnEntity(b*40+random(0,20),a*40+10,0,specs[a][b][4]);
}
for(var i = 0; i < specs[a][b][8]; i++){
spawnEntity(b*40+random(0,20),a*40+10,0,specs[a][b][7]);
}
break;
case 34:
spawnEntity(b*40+random(0,20),a*40+10,0,34);
if(specs[a][b]!==null||specs[a][b]!==0){
for(var i = 0; i < 6; i++){
for(var j = 0; j < 4; j++){
for(var k = 0; k < specs[a][b][1][i][j]; k++){
spawnEntity(b*40+random(0,20),a*40+10,0,specs[a][b][0][i][j]);
}
}
}
}
break;
case 35:
if(hotbar[blockSelected]>=307&&hotbar[blockSelected]<=311){
spawnEntity(b*40+random(0,20),a*40+10,0,35);
}
break;
case 37:
if(hotbar[blockSelected]>=308&&hotbar[blockSelected]<=311){
spawnEntity(b*40+random(0,20),a*40+10,0,37);
}
break;
case 38:
if(hotbar[blockSelected]>=309&&hotbar[blockSelected]<=311){
spawnEntity(b*40+random(0,20),a*40+10,0,38);
}
break;
case 39:
if(hotbar[blockSelected]>=307&&hotbar[blockSelected]<=311){
spawnEntity(b*40+random(0,20),a*40+10,0,39);
}
break;
case 40:
spawnEntity(b*40+random(0,20),a*40+10,0,40);
break;
case 41:
spawnEntity(b*40+random(0,20),a*40+10,0,41);
}
blockStrength=null;
if(world[a][b]!==0){
if(hotbar[blockSelected]>=307&&hotbar[blockSelected]<=311){
hotbarSpecs[blockSelected]--;
}else if(hotbar[blockSelected]>=312&&hotbar[blockSelected]<=316){
hotbarSpecs[blockSelected]-=2;
}
}
world[a][b]=0;
}else if(blockStrength!==null){
if(blockTargeted[0]===a&&blockTargeted[1]===b){
blockStrength--;
}else{
blockStrength=null;
}}
}
}else if(mouseIsPressed&&inventory===false&&news===false&&world[a][b]===18){
if(nether === false){
overWorld = world;
world = netherWorld;
nether = true;
}else if(nether === true){
netherWorld = world;
world = overWorld;
nether = false;
}
}
noStroke();
if(keys[84]){
if(!onInputBox){
onInputBox=true;
}
keys[84]=false;
}
textSize(15);
if(onInputBox){
fill(0, 0, 0, 60);
rect(0, 385, 400, 15);
if(inputTimer<=0){
inputTimer=25;
}else{
inputTimer--;
}
fill(255);
if(inputTimer>10){
text(input+"_", 5, 395);
}else{
text(input, 5, 395);
}
for(var i = messages.length-20; i < messages.length; i++){
if(messages[i]!==undefined){
fill(0, 0, 0, 60);
rect(0, i*15-messages.length*15+300, 300, 15);
fill(255);
text(messages[i], 5, i*15-messages.length*15+313);
msgTimers[i]--;
}
}
}else{
for(var i = messages.length-10; i < messages.length; i++){
if(messages[i]!==undefined&&msgTimers[i]>0){
if(msgTimers[i]>20){
fill(0, 0, 0, 60);
}else{
fill(0, 0, 0, msgTimers[i]*3);
}
rect(0, i*15-messages.length*15+300, 300, 15);
if(msgTimers[i]>10){
fill(255);
}else{
fill(255, 255, 255, msgTimers[i]*25.5);
}
text(messages[i], 5, i*15-messages.length*15+313);
msgTimers[i]--;
}
}
}
textSize(12);
if(nether===true||night===true){
fill(255, 255, 255);
}else{
fill(0, 0, 0);
}
text("SERVER: skyblock.cube-mc.com", 57, 15);
//the Debug menu
if(keyIsPressed&&keyCode===114&&debugMenu===false){
debugMenu=true;
keyCode=0;
}else if(keyIsPressed&&keyCode===114){
debugMenu=false;
keyCode=0;
}
//The Inventory
if(keyCode===69&&inventory===false&&isCrafting===false&&!onInputBox){
inventory=true;
keyCode=0;
}
if(keyCode===69&&(isCrafting||isSmelting)&&!onInputBox){
isSmelting=false;
isCrafting=false;
keyCode=0;
}
if(keyCode===69&&inventory===false&&isCrafting===false&&isSmelting===false&&!onInputBox){
inventory=true;
keyCode=0;
}
var craftingSquares = [[],[],[]];
for(var r = 0; r < 3; r++){
for(var s = 0; s < 3; s++){
craftingSquares[s][r] = craftingGrid[r+s*3];
}
}
if(onChest){
var targetChest = specs[blockTargeted[0]][blockTargeted[1]];
if(keyCode===69){
onChest=false;
keyCode=0;
}
isCrafting=false;
isSmelting=false;
e2open=false;
fill(199, 199, 199);
stroke(0, 0, 0);
strokeWeight(3);
rect(25, 10, 350, 300);
textSize(20);
fill(0, 0, 0);
text("Chest:", 30, 30);
textSize(12);
strokeWeight(2);
line(200, 30, 200, 285);
noStroke();
drawInventory(40, 50, 40, invContents);
for(var i = 0; i < 4; i++){
for(var j = 0; j < 6; j++){
drawBlocks(targetChest[0][j][i], i*40+210, j*40+50);
if(targetChest[1][j][i]>1){
textSize(15);
fill(255);
text(targetChest[1][j][i], i*40+230, j*40+73);
}textSize(12);
}
}
stroke(0, 0, 0);
strokeWeight(2);
drawBlocks(holdingBlock, mouseX-10, mouseY-10);
if(NBTtag!==null&&NBTtag!==""){
stroke(54, 0, 171);
fill(0, 0, 0);
var length = (NBTtag.split()).length;
rect(mouseX, mouseY-15, length*85, 15);
fill(255, 255, 255);
text(NBTtag, mouseX, mouseY);
}
fill(255);
if(holdingStacks>1){
textSize(15);
text(holdingStacks, mouseX+10, mouseY+13);
textSize(12);
}
}
if(inventory===true){
if(keyCode===69){
inventory=false;
keyCode=0;
}
onChest=false;
isCrafting=false;
isSmelting=false;
e2open=false;
fill(199, 199, 199);
stroke(0, 0, 0);
strokeWeight(3);
rect(50, 10, 300, 300);
textSize(20);
fill(0, 0, 0);
text("Inventory:", 60, 30);
textSize(12);
strokeWeight(2);
noStroke();
drawInventory(70, 50, 40, invContents);
for(var d = 0; d < 2; d++){
for(var e = 0; e < 2; e++){
strokeWeight(2);
stroke(0, 0, 0);
fill(222, 222, 222);
rect(d*35+240, e*35+40, 35, 35);
fill(0, 0, 0);
noStroke();
drawBlocks(craftingSquares[e][d], d*35+250, e*35+50);
}
}
stroke(0, 0, 0);
fill(100);
rect(240, 250, 70, 45);
image(skin, 250, 220, 50, 90);
fill(222, 222, 222);
for(var d = 0; d < 2; d++){
for(var e = 0; e < 2; e++){
strokeWeight(2);
rect(d*35+240, e*30+190, 35, 30);
fill(0, 0, 0);
noStroke();
drawBlocks(armorSlots[e*2+d], d*35+250, e*30+195);
if(itemDurabilities[armorSlots[e*2+d]]!==null&&armorSpecs[e*2+d]!==itemDurabilities[armorSlots[e*2+d]]){
var filler = 255/itemDurabilities[armorSlots[e*2+d]];
fill(255-armorSpecs[e*2+d]*filler, armorSpecs[e*2+d]*filler, 0);
rect(d*35+250, e*30+216, armorSpecs[e*2+d]/(itemDurabilities[armorSlots[e*2+d]]/20), 3);
if(armorSpecs[e*2+d]<=0){
armorSlots[e*2+d]=0;
armorSpecs[e*2+d]=0;
}
}
fill(222, 222, 222);
stroke(0);
}
}
rect(255, 140, 40, 40);
drawBlocks(craftedItem, 265, 150);
drawBlocks(holdingBlock, mouseX-10, mouseY-10);
if(NBTtag!==null&&NBTtag!==""&&NBTtag!==undefined){
stroke(54, 0, 171);
fill(0, 0, 0);
rect(mouseX, mouseY-15, 85, 15);
fill(255, 255, 255);
text(NBTtag, mouseX, mouseY);
}
fill(255);
if(holdingStacks>1){
textSize(15);
text(holdingStacks, mouseX+10, mouseY+13);
textSize(12);
}
textSize(15);
if(craftedStacks>1){
text(craftedStacks, 285, 177);
}
var canCraft;
var itemCrafted = false;
for(var i = 0; i < recipes.length; i++){
if(!itemCrafted){
for(var j = 0; j < recipes[i].length; j++){
if(recipes[i].length>0){
canCraft = true;
for(var k = 0; k < 9; k++){
if(craftingGrid[k]!==recipes[i][j][k]&&canCraft){
canCraft = false;
}
}
if(canCraft){
craftedItem = i;
craftedStacks = recipeAmounts[i];
itemCrafted = true;
}
}
}}
}
if(!itemCrafted){
craftedItem = 0;
craftedStacks = 0;
}
}
if(isSmelting){
var targetFurnace = specs[blockTargeted[0]][blockTargeted[1]];
var fuel = targetFurnace[0];
var fuelStacks = targetFurnace[1];
var fuelSpecs = targetFurnace[2];
var smeltingTime = targetFurnace[3];
var item = targetFurnace[4];
var itemStacks = targetFurnace[5];
var itemSpecs = targetFurnace[6];
var smeltedItem = targetFurnace[7];
var smeltedStacks = targetFurnace[8];
var smeltedSpecs = targetFurnace[9];
var burnTime = targetFurnace[10];
var setValue = targetFurnace[11];
fill(199, 199, 199);
stroke(0, 0, 0);
strokeWeight(3);
rect(50, 10, 300, 300);
textSize(20);
fill(0, 0, 0);
text("Furnace:", 60, 30);
textSize(12);
strokeWeight(2);
noStroke();
drawInventory(70, 50, 40, invContents);
noStroke();
fill(173, 49, 0);
var fireHeight = (burnTime/setValue)*5;
triangle(275, 120, 280, 120-fireHeight, 285, 120);
triangle(265, 120, 270, 120-fireHeight, 275, 120);
fill(227, 170, 0);
triangle(277, 120, 280, 122-fireHeight/1.2, 283, 120);
triangle(267, 120, 270, 122-fireHeight/1.2, 273, 120);
fill(222);
stroke(0);
if(smeltingTime>0&&smeltingTime<49){
triangle(265, 180, 285, 180, 275, 180+51-smeltingTime);
}
rect(255, 50, 40, 40);
rect(255, 130, 40, 40);
rect(255, 240, 40, 40);
drawBlocks(item, 265, 60);
drawBlocks(smeltedItem, 265, 250);
drawBlocks(fuel, 265, 140);
fill(255);
textSize(15);
if(smeltedStacks>1){
text(smeltedStacks, 285, 275);
}
if(fuelStacks>1){
text(fuelStacks, 285, 165);
}
if(itemStacks>1){
text(itemStacks, 285, 85);
}
if(fuelStacks>1){
}
drawBlocks(holdingBlock, mouseX-10, mouseY-10);
if(NBTtag!==null&&NBTtag!==""){
stroke(54, 0, 171);
fill(0, 0, 0);
rect(mouseX, mouseY-15, 85, 15);
fill(255, 255, 255);
text(NBTtag, mouseX, mouseY);
}
fill(255);
if(holdingStacks>1){
textSize(15);
text(holdingStacks, mouseX+10, mouseY+13);
textSize(12);
}
textSize(15);
specs[blockTargeted[0]][blockTargeted[1]][0]=fuel;
specs[blockTargeted[0]][blockTargeted[1]][1]=fuelStacks;
specs[blockTargeted[0]][blockTargeted[1]][2]=fuelSpecs;
specs[blockTargeted[0]][blockTargeted[1]][3]=smeltingTime;
specs[blockTargeted[0]][blockTargeted[1]][4]=item;
specs[blockTargeted[0]][blockTargeted[1]][5]=itemStacks;
specs[blockTargeted[0]][blockTargeted[1]][6]=itemSpecs;
specs[blockTargeted[0]][blockTargeted[1]][7]=smeltedItem;
specs[blockTargeted[0]][blockTargeted[1]][8]=smeltedStacks;
specs[blockTargeted[0]][blockTargeted[1]][9]=smeltedSpecs;
specs[blockTargeted[0]][blockTargeted[1]][10]=burnTime;
}
for(var e = 0; e < 2; e++){
for(var d = 0; d < 2; d++){
if(armorSpecs[e*2+d]<=0){
armorSlots[e*2+d]=0;
armorSpecs[e*2+d]=0;
}}}
if(e2open===true&&news===false){
fill(189, 189, 189);
stroke(0, 0, 0);
strokeWeight(3);
rect(100, 0, 300, 50);
textSize(20);
fill(0, 0, 0);
text("Press E to open your inventory", 110, 30);
textSize(12);
strokeWeight(2);
noStroke();
}
for(var ii = 0; ii < 4; ii++){
for(var jj = 0; jj < 6; jj++){
if(invStacks[jj][ii]===0){
invContents[jj][ii]=0;
}
if(invContents[jj][ii]===0){
invSpecs[jj][ii]=0;
}
}
}
if(health<1){
isDead=true;
}
if(news===true){
fill(189, 189, 189);
stroke(0, 0, 0);
strokeWeight(3);
rect(100, 100, 200, 200);
textSize(20);
fill(0, 0, 0);
text("News:", 110, 120);
textSize(15);
text(MainArticle, 110, 130, 180, 160);
textSize(12);
text(NEWS, 110, 180, 180, 140);
textSize(10);
text("Press Enter to close", 110, 290);
textSize(12);
strokeWeight(2);
}
if(keys[ENTER]&&news){
news=false;
}
if(isCrafting){
fill(199, 199, 199);
stroke(0, 0, 0);
strokeWeight(3);
rect(50, 10, 300, 300);
textSize(20);
fill(0, 0, 0);
text("Crafting:", 60, 30);
textSize(12);
strokeWeight(2);
noStroke();
drawInventory(70, 50, 40, invContents);
for(var d = 0; d < 3; d++){
for(var e = 0; e < 3; e++){
strokeWeight(2);
stroke(0, 0, 0);
fill(222, 222, 222);
rect(d*35+240, e*35+40, 35, 35);
fill(0, 0, 0);
noStroke();
drawBlocks(craftingSquares[e][d], d*35+250, e*35+50);
}
}
stroke(0, 0, 0);
fill(222, 222, 222);
rect(270, 225, 45, 45);
drawBlocks(craftedItem, 283, 238);
drawBlocks(holdingBlock, mouseX-10, mouseY-10);
fill(255);
if(holdingStacks>1){
textSize(15);
text(holdingStacks, mouseX+10, mouseY+13);
textSize(12);
}
if(NBTtag!==null&&NBTtag!==""){
stroke(54, 0, 171);
fill(0, 0, 0);
var length = 1;
rect(mouseX, mouseY-15, length*85, 15);
fill(255, 255, 255);
text(NBTtag, mouseX, mouseY);
}
textSize(15);
fill(255, 255, 255);
if(craftedStacks>1){
text(craftedStacks, 303, 270);
}
var canCraft;
var itemCrafted = false;
for(var i = 0; i < recipes.length; i++){
if(!itemCrafted){
for(var j = 0; j < recipes[i].length; j++){
if(recipes[i].length>0){
canCraft = true;
for(var k = 0; k < 9; k++){
if(craftingGrid[k]!==recipes[i][j][k]&&canCraft){
canCraft = false;
}
}
if(canCraft){
craftedItem = i;
craftedStacks = recipeAmounts[i];
itemCrafted = true;
}
}
}}
}
if(!itemCrafted){
craftedItem = 0;
craftedStacks = 0;
}
}
if(keyCode===113){
broadcast("World saved and printed.");
broadcast("Copy the code over var world.");
println("var world = [");
if(nether===false){
for(var m = 0; m < world.length; m++){
if(m===world.length-1){
println("["+world[m]+"]];");
}else{
println("["+world[m]+"],");
}
}
}else{
for(var n = 0; n < overWorld.length; n++){
if(n===overWorld.length-1){
println("["+overWorld[n]+"]];");
}else{
println("["+overWorld[n]+"],");
}
}
}
println("var netherWorld = [");
if(nether===false){
for(var o = 0; o < netherWorld.length; o++){
if(o===netherWorld.length-1){
println("["+netherWorld[o]+"]];");
}else{
println("["+netherWorld[o]+"],");
}
}
}else{
for(var p = 0; p < world.length; p++){
if(p===world.length-1){
println("["+world[p]+"]];");
}else{
println("["+world[p]+"],");
}
}
}
keyCode=0;
}
//the Bennimus Studios logo
scale(0.25, 0.25);
noStroke();
fill(255, 255, 255);
ellipse(1500, 100, 125, 125);
fill(255, 213, 168);
rect(1465, 91, 30, 68);
ellipse(1480, 91, 30, 30);
rect(1480, 103, 45, 15);
rect(1480, 76, 45, 15);
ellipse(1526, 83.5, 20, 14);
ellipse(1526, 110.5, 20, 14);
stroke(0, 0, 0);
strokeWeight(5);
point(1480, 87);
line(1527, 100, 1562, 100);
line(1537, 100, 1537, 91);
noStroke();
fill(255, 0, 0);
ellipse(1537, 83, 10, 10);
fill(143, 143, 143);
rect(1525, 95, 25, 15);
stroke(255, 0, 0);
noFill();
strokeWeight(12);
ellipse(1500, 100, 125, 125);
scale(4, 4);
if(debugMenu===true){
if(nether===true||night===true){
fill(255, 255, 255);
}else{
fill(0, 0, 0);
}
text("Minecraft Khan Academy edition " + version, 10, 20);
text("Bennimus Studios", 10, 30);
text("Key Code: " + keyCode, 10, 50);
text("Mouse Button: " + mouseButton, 10, 60);
text("Inventory: " + inventory, 10, 70);
text("Current block: " + world[a][b], 10, 80);
text("Time: " + time, 120, 50);
text("Sun Pos: " + sunPos.toFixed(0, 0), 120, 60);
text("Crouching: " + isSitting, 120, 70);
text("Blocks generated: " + world[0].length, 120, 80);
text("Asteroids spawned: " + mobs.length, 120, 90);
text("Position: " + place, 240, 50);
text("Jump: " + jump, 240, 60);
text("Inside block: " + world[posA][posB], 240, 70);
text("Blocks fallen: " + blocksFallen, 240, 80);
text("x: " + posB + " (cursor " + b + ")", 10, 100);
text("y: " + posA + " (cursor " + a + ")", 10, 110);
text("x2: " + posB2, 10, 120);
text("y2: " + posA2, 10, 130);
text("Key ticks: " + keyTimer, 240, 90);
text("Sprinting: " + isSprinting, 240, 100);
}
if(hide === false&&isDead===false){
noStroke();
fill(255);
rect(mouseX - 5, mouseY - 1, 10, 2);
rect(mouseX - 1, mouseY - 5, 2, 10);
}else if(hide===false){
cursor();
}}
var damage = oldHealth-health;
armor = 0;
for(var i = 0; i < 4; i++){
switch(armorSlots[i]){
case 320:
armor+=2;
break;
case 321:
armor+=6;
break;
case 322:
armor+=5;
break;
case 323:
armor+=2;
break;
case 324:
armor+=2;
break;
case 325:
armor+=5;
break;
case 326:
armor+=3;
break;
case 327:
armor++;
break;
case 328:
armor+=3;
break;
case 329:
armor+=8;
break;
case 330:
armor+=6;
break;
case 331:
armor+=3;
break;
case 332:
armor++;
break;
case 333:
armor+=3;
break;
case 334:
armor+=2;
break;
case 335:
armor++;
break;
}
}
if(damageTimer>0){
damageTimer--;
}
if(damageTimer>0&&damage>0){
health=oldHealth;
isDead=false;
if(damageTimer<=0){
health-=damage;
health+=round((damage*(armor/20))*0.8);
}
}
if(health<=0){
isDead=true;
}
if(damage>0&&damageTimer===0){
damageTimer=20;
health+=round(damage*(armor/20))*0.8;
for(var i = 0; i < 4; i++){
if(armorSpecs[i]>0){
armorSpecs[i]--;
}
}
}
oldHealth=health;
if(options.peaceful){
if(regenTix<=0){
regenTix=50;
health++;
}else{
regenTix--;
}
}
if(health>20){
health=20;
}
if(oldHealth>20){
oldHealth=20;
}
noCursor();
if(health>0){
isDead=false;
}
if(!bennimusStudios){
for(var l = 0; l < health/2; l++){
if(health<=4){
if(health < 3){
image(heart, l*16+20, 317+shake, 12, 20);
}else{
if(shaken===false){
shaken=true;
image(heart, l*16+25, 317+shake, 12, 20);
}else{
image(heart, l*16+25, 317-shake, 12, 20);
shaken=false;
}
}
}else{
image(heart, l*16+23, 317, 12, 20);
}
}
for(var l = 0; l < (health-1)/2; l++){
if(health<=4){
if(health < 3){
image(heart, l*16+20, 312+shake, 19, 28);
}else{
if(shaken===false){
shaken=true;
image(heart, l*16+20, 312+shake, 19, 28);
}else{
image(heart, l*16+20, 312-shake, 19, 28);
shaken=false;
}
}
}else{
image(heart, l*16+20, 312, 19, 28);
}
}}
if(world[posA][posB-(-5)]===undefined){
background(105, 42, 0);
textAlign(CENTER, CENTER);
fill(225);
textSize(20);
text("Building Terrain...", 200, 150);
textAlign(TOP, LEFT);
}
if(bennimusStudios===false&&isDead){
noStroke();
fill(200, 0, 0, 5);
rect(0, 0, 400, 400);
fill(255, 255, 255);
textSize(30);
text("You are dead.", 115, 100);
textSize(15);
text("Retry | |\n V V", 307, 378);
textSize(12);
}
if(bennimusStudios){
logoTix++;
if(logoTix<70){
noStroke();
fill(255, 213, 168);
rect(130, 183, 60, 137);
ellipse(160, 183, 60, 60);
rect(160, 207, 70, 30);
rect(160, 153, 70, 30);
ellipse(230, 168, 40, 29);
ellipse(230, 222, 40, 29);
stroke(0, 0, 0);
strokeWeight(10);
point(161, 175);
line(255, 200, 325, 200);
line(275, 200, 275, 175);
noStroke();
fill(255, 0, 0);
ellipse(275, 167, 20, 20);
fill(143, 143, 143);
rect(250, 190, 50, 30);
stroke(0, 0, 0);
stroke(255, 0, 0);
noFill();
strokeWeight(25);
ellipse(200, 200, 250, 250);
fill(0, 0, 0);
textSize(40);
text("BENNIMUS STUDIOS", 0, 370);
}
if(logoTix>70){
noStroke();
fill(255, 255, 255, 30);
rect(0, 0, 400, 400);
}
if(logoTix>100){
bennimusStudios=false;
onTitleScreen=true;
herp = 0;
}
}
if(herp===undefined){
herp=0;
}
if(optionsScreen){
cursor();
background(117, 64, 0);
fill(225);
textSize(50);
textAlign(CENTER, CENTER);
text("Options", 200, 50);
textSize(20);
button(100, 100, 200, 25, 10, true, "Clouds: "+options.clouds);
button(100, 130, 200, 25, 11, true, "Fire Animation: "+options.fireAnimation);
button(100, 160, 200, 25, 12, true, "Peaceful mode: "+options.peaceful);
button(150, 350, 100, 25, 2, true, "Back");
if(functions[2]){
optionsScreen=false;
}
if(functions[10]){
options.clouds=options.clouds?false:true;
}
if(functions[11]){
options.fireAnimation=options.fireAnimation?false:true;
}
if(functions[12]){
options.peaceful=options.peaceful?false:true;
}
}else if(onTitleScreen){
cursor();
background(196, 225, 255);
drawWorld();
scrollX = sin(herp)*50-200;
herp++;
fill(150);
stroke(0);
rect(50, 25, 305, 50);
fill(0, 0, 0, 100);
textAlign(CENTER, CENTER);
textSize(50);
text("MINECRAFT", 200, 55);
fill(200);
textSize(53);
text("MINECRAFT", 200, 50);
fill(125);
rect(100, 70, 200, 30);
fill(0, 0, 0, 100);
textSize(16);
text("KHAN ACADEMY EDITION", 200, 86);
fill(200);
textSize(17);
text("KHAN ACADEMY EDITION", 200, 85);
fill(163, 139, 0);
translate(300, 85);
rotate(340);
textSize((sin(herp*30)*3+20)-(splashes[curSplash].length-20)/2);
text(splashes[curSplash], 0,0);
resetMatrix();
fill(242, 210, 3);
translate(298, 84);
rotate(340);
text(splashes[curSplash], 0,0);
resetMatrix();
fill(0);
if(herp>360){
herp=0;
}
textSize(25);
button(125, 150, 150, 30, 0, true, "Singleplayer");
button(125, 185, 150, 30, 1, true, "Options");
textSize(20);
text(version, 30, 375);
fill(200);
rect(50, 250, 300, 100);
fill(0);
textAlign(CENTER, CENTER);
text("<<NEWS>>", 200, 265);
fill(0);
textAlign(LEFT, BOTTOM);
textSize(15);
text(MainArticle, 55, 290);
textSize(12);
text(NEWS, 55, 285, 290, 100);
if(functions[1]){
optionsScreen=true;
}
if(functions[0]){
onTitleScreen=false;noCursor();
broadcast("<<<( ~Bennimus Studios~ )>>>");
broadcast("Welcome to Minecraft "+version+"!");
broadcast("A & D to move left and right,");
broadcast("W or Space to jump,");
broadcast("E to open your inventory,");
broadcast("T to chat.");
broadcast("<<<( ~<><><><><><><>~ )>>>");
}
}
if(heartsShowing){
frameRate(30);
filter(INVERT);
fill(0, 255, 255);
textSize(20);
text("Time left: " + shieldsShowing, 270, 350);
textSize(12);
}else{
frameRate(60);
}
}catch(error){
background(255);
fill(0);
textAlign(CENTER, CENTER);
textSize(80);
image(getImage("creatures/OhNoes"), 75, 0);
text("OH NOES!",200,150);
textSize(20);
fill(225);
strokeWeight(10);
stroke(0);
rect(25, 200, 350, 150, 10);
fill(0);
textAlign(LEFT, TOP);
text(error, 35, 210, 300, 125);
fill(255, 0, 0);
text("Minecraft v"+version, 250, 20);
text("Please report this crash in the Tips & Thanks.\n Thank you for your support!", 5, 355);
}
};
keyPressed = function(){
if(!onInputBox||keyCode===SHIFT){
keys[keyCode]=true;
}else{
switch(keyCode){
case ENTER:
onInputBox=false;
if(input!==""){
if(input.substr(0,1)==="/"){
var commandLine = input.split(" ");
switch(commandLine[0]){
case "/help":
broadcast("==========[ HELP ]==========");
broadcast("/give [data] [amount]");
broadcast("gives you item by data and amount");
broadcast("/clear");
broadcast("clears your inventory");
broadcast("/kill");
broadcast("Ouch! that look like it hurt!");
broadcast("/killall");
broadcast("kills everything. Good for dat lag");
broadcast("==========================");
break;
case "/me":
var message = "";
for(var i = 1; i < commandLine.length; i++){
message+=commandLine[i]+" ";
}
broadcast("* "+username+" "+message);
break;
case "/clear":
var itemsCleared = 0;
for(var i = 0; i < 9; i++){
itemsCleared+=hotbarStacks[i];
hotbar[i]=0;hotbarStacks[i]=0;
}
for(var i = 0; i < 6; i++){
for(var j = 0; j < 4; j++){
itemsCleared+=invStacks[i][j];
invContents[i][j]=0;invStacks[i][j]=0;
}
}
for(var i = 0; i < 4; i++){
if(armorSlots[i]){
itemsCleared++;
armorSlots[i]=0;armorSpecs[i]=0;
}
}
if(itemsCleared){
broadcast("Cleared the inventory of "+username+", removing "+itemsCleared+" items.");
}else{
broadcast("Could not clear the inventory of "+username+", no items to remove.");
}
break;
case "/give":
if(commandLine[1]!==undefined&&(commandLine[1]>0&&commandLine[1]<blocks)||(commandLine[1]>=300&&commandLine[1]<items)){
if(commandLine[2]){
getItem(commandLine[1]-0, commandLine[2]-0);
}else{
getItem(commandLine[1]-0, 1);
commandLine[2]=1;
}
if(commandLine[1]<300){
broadcast("given "+username+" "+commandLine[2]+" of "+commandLine[1]+" ("+tileNames[commandLine[1]]+").");
}else{
broadcast("given "+username+" "+commandLine[2]+" of "+commandLine[1]+" ("+itemNames[commandLine[1]-300]+").");
}
}else{
broadcast(commandLine[1]+" is not a valid number.");
}
break;
case "/kill":
health=0;
broadcast("Ouch! That look like it hurt!");
break;
case "/killall":
var mobsKilled = 0;
for(var i = 0; i < mobs.length; i++){
if(mobs.health[i]>0){
mobsKilled++;
}
mobs.health[i]=0;
}
broadcast("An asteroid collides with the earth, obliterating "+mobsKilled+" entities.");
break;
case "/time":
if(commandLine[1]!==undefined&&commandLine[2]!==undefined){
switch(commandLine[1]){
case "set":
time=commandLine[2];
broadcast("Time set to "+time);
break;
case "add":
time+=commandLine[2]-0;
if(time>20000){
while(time>20000){
time-=20000;
}
}
broadcast("Time set to "+time);
break;
default:
broadcast("Usage: /time <set/add> <value>");
}
}else{broadcast("Usage: /time <set/add> <value>");}
break;
default:
broadcast("Unknown command. Type /help for help.");
}
}else{
broadcast("<"+username+"> "+input);
}
}input="";
break;
case 32:
input+=" ";
break;
case 48:
if(keys[SHIFT]){
input+=")";
}else{
input+="0";
}
break;
case 49:
if(keys[SHIFT]){
input+="!";
}else{
input+="1";
}
break;
case 50:
if(keys[SHIFT]){
input+="@";
}else{
input+="2";
}
break;
case 51:
if(keys[SHIFT]){
input+="#";
}else{
input+="3";
}
break;
case 52:
if(keys[SHIFT]){
input+="$";
}else{
input+="4";
}
break;
case 53:
if(keys[SHIFT]){
input+="%";
}else{
input+="5";
}
break;
case 54:
if(keys[SHIFT]){
input+="^";
}else{
input+="6";
}
break;
case 55:
if(keys[SHIFT]){
input+="&";
}else{
input+="7";
}
break;
case 56:
if(keys[SHIFT]){
input+="*";
}else{
input+="8";
}
break;
case 57:
if(keys[SHIFT]){
input+="(";
}else{
input+="9";
}
break;
case 65:
if(keys[SHIFT]){
input+="A";
}else{
input+="a";
}
break;
case 66:
if(keys[SHIFT]){
input+="B";
}else{
input+="b";
}
break;
case 67:
if(keys[SHIFT]){
input+="C";
}else{
input+="c";
}
break;
case 68:
if(keys[SHIFT]){
input+="D";
}else{
input+="d";
}
break;
case 69:
if(keys[SHIFT]){
input+="E";
}else{
input+="e";
}
break;
case 70:
if(keys[SHIFT]){
input+="F";
}else{
input+="f";
}
break;
case 71:
if(keys[SHIFT]){
input+="G";
}else{
input+="g";
}
break;
case 72:
if(keys[SHIFT]){
input+="H";
}else{
input+="h";
}
break;
case 73:
if(keys[SHIFT]){
input+="I";
}else{
input+="i";
}
break;
case 74:
if(keys[SHIFT]){
input+="J";
}else{
input+="j";
}
break;
case 75:
if(keys[SHIFT]){
input+="K";
}else{
input+="k";
}
break;
case 76:
if(keys[SHIFT]){
input+="L";
}else{
input+="l";
}
break;
case 77:
if(keys[SHIFT]){
input+="M";
}else{
input+="m";
}
break;
case 78:
if(keys[SHIFT]){
input+="N";
}else{
input+="n";
}
break;
case 79:
if(keys[SHIFT]){
input+="O";
}else{
input+="o";
}
break;
case 80:
if(keys[SHIFT]){
input+="P";
}else{
input+="p";
}
break;
case 81:
if(keys[SHIFT]){
input+="Q";
}else{
input+="q";
}
break;
case 82:
if(keys[SHIFT]){
input+="R";
}else{
input+="r";
}
break;
case 83:
if(keys[SHIFT]){
input+="S";
}else{
input+="s";
}
break;
case 84:
if(keys[SHIFT]){
input+="T";
}else{
input+="t";
}
break;
case 85:
if(keys[SHIFT]){
input+="U";
}else{
input+="u";
}
break;
case 86:
if(keys[SHIFT]){
input+="V";
}else{
input+="v";
}
break;
case 87:
if(keys[SHIFT]){
input+="W";
}else{
input+="w";
}
break;
case 88:
if(keys[SHIFT]){
input+="X";
}else{
input+="x";
}
break;
case 89:
if(keys[SHIFT]){
input+="Y";
}else{
input+="y";
}
break;
case 90:
if(keys[SHIFT]){
input+="Z";
}else{
input+="z";
}
break;
case 186:
if(keys[SHIFT]){
input+=":";
}else{
input+=";";
}
break;
case 187:
if(keys[SHIFT]){
input+="+";
}else{
input+="=";
}
break;
case 188:
if(keys[SHIFT]){
input+="<";
}else{
input+=",";
}
break;
case 189:
if(keys[SHIFT]){
input+="_";
}else{
input+="-";
}
break;
case 190:
if(keys[SHIFT]){
input+=">";
}else{
input+=".";
}
break;
case 191:
if(keys[SHIFT]){
input+="?";
}else{
input+="/";
}
break;
case 192:
if(keys[SHIFT]){
input+="~";
}else{
input+="`";
}
break;
case 219:
if(keys[SHIFT]){
input+="{";
}else{
input+="[";
}
break;
case 220:
if(keys[SHIFT]){
input+="|";
}else{
input+="\\";
}
break;
case 221:
if(keys[SHIFT]){
input+="}";
}else{
input+="]";
}
break;
case 222:
if(keys[SHIFT]){
input+='"';
}else{
input+="'";
}
break;
case CONTROL:
input=input.substr(0,input.length-1);
break;
}
}
};
keyReleased = function(){keys[keyCode]=false;
if(keyCode===68||keyCode===65){keyTimer=5;isSprinting=false;}};