文字世界 — 仿我的世界 原创

· · 休闲·娱乐

作者注:

请将所有对于无法编译、无法运行、运行错误、设定错误、游戏中错误和不该有的特性一律发布在此帖讨论区里里,在文字世界 — 仿我的世界 原创中发布的一切疑问与报告本用户不予处理。

对于文字世界 — 仿我的世界 原创中讨论区的用途可用于自创地图发布及游玩技巧的积极讨论,但为了有良好的代码氛围,请将所有错误一律报告于此处)

最后更新: 2024 . 8 . 5

转载请标明出处

按下 WASD 移动

按下鼠标挖掘

按下 E 来打开背包

用数字键1-9选择物品栏,0丢弃

更多操作规则请参看游戏教程

Bugs: (懒得翻译)

#include<game.h>
using namespace std;
int RenderDistance=120;    //Recommended 200 for strong computers, others recommend 50-150   
#define GridX 20    // The WIDTH of each character output
#define GridY 23    // The HEIGHT of each character output
// ^^^ Recommend X:Y (18,21)   (20,23)   (24,27)   (28,32)   (36,41) ^^^
#define GridZ 23    // The HEIGHT of each crafting
#define ItemMaxLen 1005    // The MAXINUM of chests placed in all 3 dimensions
// (greater maxlen needs longer starting time)
const bool Launched=0;
///////////////////////////////////////////////Resizer///////////////////////////////////////////////////
#define KEY_DOWN(VK_NONAME) ((GetAsyncKeyState(VK_NONAME) & 0x8000) ? 1:0)
int PlayerX,PlayerY,CursorX,CursorY,Jump,SpawnY,SpawnX,SpawnWorld;
string PlayerMode;
const int GY=700,GX=1000;
string world[GY][GX],CursoredItem; 
string Storage[3][GY][GX];
int StorageID[3][GY][GX],ID[GY][GX],IDMaxCount;
string StorageItem[3][GY][GX],IDItem[ItemMaxLen][15];
int IDLen[ItemMaxLen];
int IDCount[ItemMaxLen][15];
int IDStatus[ItemMaxLen][15];
bool BlockChecked[GY][GX];
int CurrentWorld=-1,CursorMode;
int Death[15];
int MaxDur[GY][GX],CurDur[GY][GX];
bool Layer[GY][GX],vis[GY][GX],MobChecked[GY][GX],RedStone[GY][GX],RedStoneUsed[GY][GX];
string Mob[GY][GX];
string MobStorage[3][GY][GX];
bool PlayerBeingDamaged;
int MobHP[GY][GX],PlayerHP,Hunger,Oxygen,FurnaceFuel,PlayerFall,ExplosionJump;
unsigned long long Frame,LastDamage;
string BackPack[9];
int PackCnt[9],PackStatus[9],Selected,Time;
int Difficulty=1;
int BossHP=320;
int BossRegen=8;
int Armour[5];
int Protection;
string PlayerName="玩家",MobDeathString;
COORD StrongHold;
struct CommandStruct
{
    bool xray;
    bool FloorLevelShift;
    bool TileColoured;
    bool KeepInventory;
}cmd;
string GetOutputPack(string str)
{
    if(str=="Air")return "空";
    if(str=="Dirt")return "泥土";
    if(str=="Grass")return "青草";
    if(str=="Sand")return "沙子";
    if(str=="Water")return "水";
    if(str=="Wood")return "木头";
    if(str=="Leaf")return "叶子";
    if(str=="Flower")return "花朵";
    if(str=="Stone")return "石头";
    if(str=="DeepStone")return "岩石";
    if(str=="Lava")return "岩浆";
    if(str=="Fire")return "火焰";
    if(str=="Iron")return "铁矿";
    if(str=="CraftingTable")return "工作台";
    if(str=="Stick")return "木棍";
    if(str=="Lamp")return "灯";
    if(str=="Brick")return "砖块";
    if(str=="Coal")return "煤";
    if(str=="Iron")return "铁";
    if(str=="Diamond")return "钻";
    if(str=="Gold")return "金";
    if(str=="WoodenAxe")return "木斧";
    if(str=="WoodenSword")return "木剑";
    if(str=="WoodenPickaxe")return "木稿";
    if(str=="WoodenShovel")return "木铲";
    if(str=="StoneAxe")return "石斧";
    if(str=="StoneSword")return "石剑";
    if(str=="StonePickaxe")return "石稿";
    if(str=="StoneShovel")return "石铲";
    if(str=="IronAxe")return "铁斧";
    if(str=="IronSword")return "铁剑";
    if(str=="IronPickaxe")return "铁镐";
    if(str=="IronShovel")return "铁铲";
    if(str=="DiamondAxe")return "钻斧";
    if(str=="DiamondShovel")return "钻铲";
    if(str=="DiamondPickaxe")return "钻稿";
    if(str=="DiamondSword")return "钻剑";
    if(str=="GoldenAxe")return "金斧";
    if(str=="GoldenSword")return "金剑";
    if(str=="GoldenPickaxe")return "金稿";
    if(str=="GoldenShovel")return "金铲";
    if(str=="Chicken")return "生鸡肉";
    if(str=="Mutton")return "生羊肉";
    if(str=="Beef")return "生牛肉";
    if(str=="RoastedChicken")return "熟鸡肉";
    if(str=="RoastedMutton")return "熟羊肉";
    if(str=="RoastedBeef")return "熟牛肉";
    if(str=="IronIgnot")return "铁锭";
    if(str=="GoldIgnot")return "金锭";
    if(str=="Furnace")return "炉";
    if(str=="Moss")return "苔藓";
    if(str=="Leather")return "皮革";
    if(str=="Wool")return "羊毛";
    if(str=="Obsidian")return "黑曜石";
    if(str=="NetherPortal")return "下界传送门(如果获取到,请报告开发者";
    if(str=="Bed")return "床";
    if(str=="CraftingTable2")return "高级工作台";
    if(str=="Bucket")return "铁桶";
    if(str[0]=='!')return "命令方块";
    if(str=="RedStone")return "红石";
    if(str=="RedStoneDust")return "红石粉";
    if(str=="Lever")return "拉杆";
    if(str=="TNT")return "TNT";
    if(str=="PressurePlate")return "压力板";
    if(str=="MineCar")return "矿车";
    if(str=="MineTrack")return "轨道";
    if(str=="ExperimentTable")return "实验台";
    if(str=="RedStoneTable")return "红石研发台";
    if(str=="EnchantingTable")return "附魔台";
    if(str=="Nuke")return "核弹";
    if(str=="AprilFools1")return "未知物质";
    if(str=="FireCharge")return "火焰球";
    if(str=="Piston")return "活塞";
    if(str=="Piston2")return "活塞杆";
    if(str=="EndRock")return "末地石";
    if(str=="EndonPortal")return "末地传送块";
    if(str=="TrailSpawner_Blaze")return "烈焰人刷怪笼";
    if(str=="BlazeRod")return "烈焰棒";
    if(str=="BlazePowder")return "烈焰粉";
    if(str=="Emerald")return "绿宝石";
    if(str=="TrailSpawner_Zombie")return "僵尸刷怪笼";
    if(str=="EnderPortalFrame")return "末地传送门框";
    if(str=="EnderEye")return "末影之眼";
    if(str=="EnderPearl")return "末影珍珠";
    if(str=="GunPowder")return "火药";
    if(str=="EndonGoblet")return "末影水晶";
    if(str=="AcientDebris")return "远古残骸";
    if(str=="NetheriteIgnot")return "下界合金锭";
    if(str=="NetheriteSword")return "下界合金剑";
    if(str=="NetheriteAxe")return "下界合金斧";
    if(str=="NetheritePickaxe")return "下界合金镐";
    if(str=="NetheriteShovel")return "下界合金铲";
    if(str=="WaterBucket")return "水桶";
    if(str=="LavaBucket")return "岩浆桶";
    if(str=="Netherrack")return "下界岩";
    if(str=="SoulSand")return "灵魂沙";
    if(str=="SoulFire")return "灵魂火";
    if(str=="Chest")return "箱子";
    if(str=="Shulker")return "潜影贝";
    if(str=="NetherBrick")return "下界砖";
    if(str=="")return "";
    if(str=="")return "";
    if(str=="")return "";
}
namespace Reset
{
    using namespace std;
    int ProPos=0,ProLen,ProH;
    void FillAir(int num)
    {
        for(int i=0;i<GY;i++)
        {
            for(int j=0;j<GX;j++)
            {
                Storage[num][i][j]="Air";
                MobStorage[num][i][j]="Air";
            }
        }
    }
    void SetBedRock(int Layer,bool down,bool up)
    {
        if(down)
        {
            for(int i=GY-15;i>=GY;i++)
            {
                for(int j=0;j<GX;j++)
                {
                    Storage[Layer][i][j]="BedRock";
                }
            }
        }
        if(up)
        {
            for(int i=GY-15;i<GY;i++)
            {
                for(int j=0;j<GX;j++)
                {
                    Storage[Layer][i][j]="BedRock";
                }
            }
        }
    }
    void SetBluePrint(int Y,int X,int type)
    {
        if(type==1)// Desert Temple
        {
            char print[25][55]=
            {
                "                        ###                       ",
                "              #        #####       #              ",
                "             ###       #####      ###             ",
                "           ############################           ",
                "           #          #     #         #           ",
                "    SSSSS                                   SSSSSS",
                "SSSSSSSSSSS#############DDD############SSSSSSSSSSS",
                "SSSSSSSSSSSSSSSSSSSSSSS#   #SSSSSSSSSSSSSSSSSSS---",
                "########################   #######################",
                "#TTTTTTTTTTTTTTTTTTTTTT#   #TTTTTTTTTTTTTTTTTTTTT#",
                "#TTTTTTTTTTTTTTTTTTTTTT#   #TTTTTTTTTTTTTTTTTTTTT#",
                "#TTTTTTTTTTTTTTTTTTTTTT#   #TTTTTTTTTTTTTTTTTTTTT#",
                "#TTTTTTTTTTTTTTTTTTTTTT#   #TTTTTTTTTTTTTTTTTTTTT#",
                "#TTTTTTTTTTTTTTTTTTTTTT#   #TTTTTTTTTTTTTTTTTTTTT#",
                "#TTTTTTTTTTTTTTTTTTTTTT#   #TTTTTTTTTTTTTTTTTTTTT#",
                "#TTTTTTTTTTTTTTTTTTTTTT#   #TTTTTTTTTTTTTTTTTTTTT#",
                "#TTTTTTTTTTTTTTTTTTTT###   ###TTTTTTTTTTTTTTTTTTT#",
                "#TTTTTTTTTTTTTTTTTTTT#C     C#TTTTTTTTTTTTTTTTTTT#",
                "#TTTTTTTTTTTTTTTTTTTT####P####TTTTTTTTTTTTTTTTTTT#",
                "#TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT#",
                "##################################################",
            };
            for(int i=0;i<20;i++)
            {
                for(int j=0;j<50;j++)
                {
                    if(j>=GX)return;
                    if(print[i][j]=='#')Storage[0][Y-i][X+j]="Brick";
                    if(print[i][j]=='P')Storage[0][Y-i][X+j]="PressurePlate";
                    if(print[i][j]=='T')Storage[0][Y-i][X+j]="TNT";
                    if(print[i][j]=='C')
                    {
                        Storage[0][Y-i][X+j]="Chest";
                        StorageID[0][Y-i][X+j]=++IDMaxCount;
                        if(rand()%2==0)
                        {
                            IDItem[IDMaxCount][IDLen[IDMaxCount]]="Diamond";
                            IDCount[IDMaxCount][IDLen[IDMaxCount]]=1+rand()%3;
                            IDLen[IDMaxCount]++;
                        }
                        if(rand()%2==0)
                        {
                            IDItem[IDMaxCount][IDLen[IDMaxCount]]="IronIgnot";
                            IDCount[IDMaxCount][IDLen[IDMaxCount]]=3+rand()%5;
                            IDLen[IDMaxCount]++;
                        }
                        if(rand()%5==0)
                        {
                            IDItem[IDMaxCount][IDLen[IDMaxCount]]="GoldenSword";
                            IDCount[IDMaxCount][IDLen[IDMaxCount]]=1;
                            IDLen[IDMaxCount]++;
                        }
                    }
                    if(print[i][j]==' ')Storage[0][Y-i][X+j]="Air";
                    if(print[i][j]=='D')Storage[0][Y-i][X+j]="Dirt";
                }
            }
        }
        if(type==2)// Piglin Fortress
        {
            char print[25][25]=
            {
                "#####################",
                "#                   #",
                "# ########## ########",
                "# ######            #",
                "# ###### #########  #",
                "#      #     #   #  #",
                "######## ##### # ####",
                "#        #     # ####",
                "### ###### ##### ####",
                "###        ####  ####",
                "### #### #######    #",
                "#      # #     #### #",
                "###### # #####    # #",
                "#      # ########   #",
                "# ###################",
                "#                   #",
                "#           C       #",
                "#          GGG      #",
                "#     #   GGGGG     #",
                "###LLL#LLL########LL#",
                "#####################",
            };
            for(int i=0;i<20;i++)
            {
                for(int j=0;j<20;j++)
                {
                    if(j>=GX)return;
                    if(print[i][j]=='#')Storage[1][Y-i][X+j]="Brick";
                    if(print[i][j]=='G')Storage[1][Y-i][X+j]="Gold";
                    if(print[i][j]=='L')Storage[1][Y-i][X+j]="Lava";
                    if(print[i][j]==' ')Storage[1][Y-i][X+j]="Air";
                    if(print[i][j]=='C')
                    {
                        Storage[1][Y-i][X+j]="Chest";
                        StorageID[1][Y-i][X+j]=++IDMaxCount;
                        IDLen[IDMaxCount]++;
                        IDItem[IDMaxCount][IDLen[IDMaxCount]]="GoldIgnot";
                        IDCount[IDMaxCount][IDLen[IDMaxCount]]=3+rand()%5;
                        if(rand()%2==0)
                        {
                            IDLen[IDMaxCount]++;
                            IDItem[IDMaxCount][IDLen[IDMaxCount]]="IronIgnot";
                            IDCount[IDMaxCount][IDLen[IDMaxCount]]=1+rand()%5;
                        }
                        if(rand()%3==0)
                        {
                            IDLen[IDMaxCount]++;
                            if(rand()%2==0)IDItem[IDMaxCount][IDLen[IDMaxCount]]="GoldenSword";
                            else IDItem[IDMaxCount][IDLen[IDMaxCount]]="IronSword";
                            IDCount[IDMaxCount][IDLen[IDMaxCount]]=1;
                        }
                    }
                }
            }
        }
        if(type==3)// End City
        {
            char print[25][55]=
            {
                "---------------------------------------------------",
                "----                        -----------------------",
                "-        #############            -----------------",
                "-        #DDDDDDDDDDD#                 ------------",
                "-        #############                 ------------",
                "-        #           #           S        ---------",
                "-        # SS   S  S # #############      ---------",
                "-        ###### ###### #?# #   # #?#      ---------",
                "-       ##### #  #     #####   #####      ---------",
                "        #S  #  # #     #?# #S  # #?#      ---------",
                "        ## ##  # #  S  ###### ######      ---------",
                "         #  #  #  ####      # #        ------------",
                "-         #  ####     #   ##  #       -------------",
                "-          #      ###  ###   #       --------------",
                "--          ######   #     ##      ----------------",
                "----                  ### #      ------------------",
                "-------              S  # #    --------------------",
                "---------------------#### ###----------------------",
                "---------------------#      #----------------------",
                "---------------------     S  ----------------------",
                "------------------RRR########RR--------------------",
            };
            for(int i=0;i<20;i++)
            {
                for(int j=0;j<50;j++)
                {
                    if(j>=GX)return;
                    if(print[i][j]=='#')Storage[2][Y-i][X+j]="Brick";
                    if(print[i][j]=='R')Storage[2][Y-i][X+j]="EndRock";
                    if(print[i][j]=='?')
                    {
                        if(rand()%2==0)Storage[2][Y-i][X+j]="Brick";
                        else Storage[2][Y-i][X+j]="Diamond";
                    }
                    if(print[i][j]=='D')Storage[2][Y-i][X+j]="Diamond";
                    if(print[i][j]==' ')Storage[2][Y-i][X+j]="Air";
                    if(print[i][j]=='S')Storage[2][Y-i][X+j]="Shulker";
                }
            }
        }
    }
    void CheckBluePrint()
    {
        for(int i=0;i<GY;i++)
        {
            for(int j=0;j<GX;j++)
            {
                if(Storage[0][i][j]=="Print_DesertTemple")SetBluePrint(i,j,1);
            }
        }
        for(int i=0;i<GY;i++)
        {
            for(int j=0;j<GX;j++)
            {
                if(Storage[1][i][j]=="Print_PiglinFortress")SetBluePrint(i,j,2);
            }
        }
        for(int i=0;i<GY;i++)
        {
            for(int j=0;j<GX;j++)
            {
                if(Storage[2][i][j]=="Print_EndCity")SetBluePrint(i,j,3);
            }
        }
    }
    void SetMineAt(int Y,int X,int H,int W,string MineType)
    {
        if(MineType=="Random")
        {
            if(rand()%3<2||Y>GY/5*2+5)
            {
                if(rand()%2==0)MineType="Coal";
                else MineType="Iron";
            }
            else
            {
                if(rand()%3==0)MineType="Diamond";
                if(rand()%2==0)MineType="RedStone";
                else MineType="Gold";
            }
        }
        for(int i=Y-(rand()%H)-2;i<Y+(rand()%H)+2;i++)
        {
            for(int j=X-(rand()%W)-2;j<X+rand()%W+2;j++)
            {
                Storage[0][i][j]=MineType;
            }
        }
    }
    void SetMinePit(int Y,int X,int H,int W)
    {
        for(int i=Y-(rand()%H)-2;i<Y+(rand()%H)+2;i++)
        {
            for(int j=X-(rand()%W)-2;j<X+rand()%W+2;j++)
            {
                Storage[0][i][j]="Air";
                if(rand()%70==0)
                {
                    SetMineAt(i,j,rand()%2+1,rand()%2+1,"Random");
                }
            }
        }
    }
    void SetNetherPit(int Y,int X,int H,int W)
    {
        int g=Y-2+(rand()*rand()%(H/4));
        if(rand()%3==0)g=0;
        for(int i=Y-(rand()%H)-2;i<Y+(rand()%H)+2;i++)
        {
            for(int j=X-(rand()%W)-2;j<X+rand()%W+2;j++)
            {
                if(i<g)Storage[1][i][j]="Lava";
                else Storage[1][i][j]="Air";
            }
        }
    }
    void SetTreeAt(int Y,int X,int H,string type)
    {
        if(X<10||X>=GX-10)return;
        if(type=="Jungle")
        {
            for(int i=Y;i<Y+H;i++)
            {
                Storage[0][i][X]="Wood";
            }
            //world[Y+H][X]="Leaf";
            for(int i=1;i<H/4+2;i++)
            {
                for(int j=0-2*i;j<2*i+1;j++)
                {
                    Storage[0][(H/4+2-i)+Y+H-1][j+X]="Leaf";
                }
            }
        }
        if(type=="Plain")
        {
            for(int i=Y;i<Y+H;i++)
            {
                Storage[0][i][X]="Wood";
            }
            //world[Y+H][X]="Leaf";
            for(int i=1;i<H/4+3;i++)
            {
                for(int j=0-i;j<i+1;j++)
                {
                    Storage[0][(H/4+2-i)+Y+H-1][j+X]="Leaf";
                }
            }
        }
        if(type=="Crimson")
        {
            for(int i=Y;i<Y+H;i++)
            {
                Storage[1][i][X]="Wood";
            }
            //world[Y+H][X]="Leaf";
            for(int i=1;i<H/4+3;i++)
            {
                for(int j=0-i;j<i+1;j++)
                {
                    Storage[1][(H/4+2-i)+Y+H-1][j+X]="Leaf";
                }
            }
        }
        if(type=="Pine")
        {
            for(int i=Y;i<Y+H;i++)
            {
                Storage[1][i][X]="Wood";
            }
            //world[Y+H][X]="Leaf";
            for(int i=1;i<H/4+3;i++)
            {
                if(i==0)Storage[1][(H/4+2-i)+Y+H-1][X]="Leaf";
                else for(int j=0-i;j<i+1;j++)
                {
                    Storage[1][(H/4+2-i)+Y+H-1][j+X]="Leaf";
                }
            }
        }
        if(type=="")
        {

        }

    }
    void SetPlainAt(int pos,int len,int H,int Grass,int Flower)
    {
        for(int i=0;i<H;i++)
        {
            for(int j=pos;j<pos+len;j++)
            {
                if(i>=GX)return;
                if(i>=H-rand()%3-3)Storage[0][i][j]="Dirt";
                else Storage[0][i][j]="Stone";
            }
        }
        for(int i=pos;i<pos+len;i++)
        {
            if(i>=GX)return;
            if(i==GX/2)PlayerY=H+1;
            if(rand()%10<Grass)Storage[0][H][i]="Grass";
            if(rand()%10<Flower)Storage[0][H][i]="Flower";
        }
    }
    void SetDesertAt(int pos,int len,int H,int Grass)
    {
        for(int i=0;i<H;i++)
        {
            for(int j=pos;j<pos+len;j++)
            {
                if(i>=GX)return;
                if(i>=H-rand()%3-3)Storage[0][i][j]="Sand";
                else Storage[0][i][j]="Stone";
            }
        }
        for(int i=pos;i<pos+len;i++)
        {
            if(i>=GX)return;
            if(i==GX/2)PlayerY=H+1;
            if(rand()%10<Grass)Storage[0][H][i]="Grass";
            if(i==pos+(len/2))
            {
                if(rand()%1==0)Storage[0][H+5][i]="Print_DesertTemple";
            }
        }
    }
    void SetJungleAt(int pos,int len,int H,int den)
    {
        int g=H;
        for(int i=pos;i<pos+len;i++)
        {
            if(i>=GX)return;
            if(i==GX/2)PlayerY=g+1;
            for(int j=0;j<g;j++)
            {
                if(j>=g-rand()%3-3)Storage[0][j][i]="Dirt";
                else Storage[0][j][i]="Stone";
            }
            if(rand()%100<den)
            {
                SetTreeAt(g,i,4+rand()%5,"Jungle");
            }
            if(rand()%4==0)
            {
                if(rand()%2==0)g++;
                else g--;
            }
        }
        ProH=g;
    }
    void SetForestAt(int pos,int len,int H,int den)
    {
        int g=H;
        for(int i=pos;i<pos+len;i++)
        {
            if(i>=GX)return;
            if(i==GX/2)PlayerY=g+1;
            for(int j=0;j<g;j++)
            {
                if(j>=g-rand()%3-3)Storage[0][j][i]="Dirt";
                else Storage[0][j][i]="Stone";
            }
            if(rand()%100<den)
            {
                SetTreeAt(g,i,4+rand()%5,"Plain");
            }
            if(rand()%4==0)
            {
                if(rand()%2==0)g++;
                else g--;
            }
        }
        ProH=g;
    }
    void SetNetherForestAt(int pos,int len,int H,int den)
    {
        int g=H;
        int h=H+rand()%10+15;
        for(int i=pos;i<pos+len;i++)
        {
            if(i>=GX)return;
            for(int j=0;j<g;j++)
            {
                if(j>=g-rand()%3-3)Storage[1][j][i]="Dirt";
            }
            for(int j=g;j<h;j++)
            {
                Storage[1][j][i]="Air";
            }
            if(rand()%2==0)
            {
                if(rand()%2==0)h++;
                else h--;
            }
            if(rand()%100<den)
            {
                SetTreeAt(g,i,4+rand()%5,"Plain");
            }
            if(rand()%4==0)
            {
                if(rand()%2==0)g++;
                else g--;
            }
        }
        ProH=g;
    }
    void SetRiverAt(int pos,int len,int H,int Steep)
    {
        int g=H-1;
        for(int i=pos;i<pos+len;i++)
        {
            if(i>=GX)return;
            if(i==GX/2)PlayerY=g+1;
            for(int j=0;j<H;j++)
            {
                if(j>=g)Storage[0][j][i]="Water";
                else if(j>=g-rand()%3-2)Storage[0][j][i]="Sand";
                else Storage[0][j][i]="Stone";
            }
            if(i%Steep==0)
            {
                if(i<pos+(len/2))g-=1;
                else g+=1;
            }
        }
        ProH=g;
    }
    void SetHillAt(int pos,int len,int H,int Steep,int den,int Grass,int Flower)
    {
        int g=H;
        for(int i=pos;i<pos+len;i++)
        {
            if(i>=GX)return;
            if(i==GX/2)PlayerY=g+1;
            for(int j=0;j<g;j++)
            {
                if(j>=g-rand()%3-3)Storage[0][j][i]="Dirt";
                else Storage[0][j][i]="Stone";
            }
            if(rand()%100<den)
            {
                if(rand()%2==0)SetTreeAt(g,i,3+rand()%4,"Plain");
                else SetTreeAt(g,i,3+rand()%4,"Jungle");
            }
            if(i<pos+(len/2))g+=Steep+rand()%2;
            else g-=Steep+rand()%2;
        }
        ProH=g;
    }
    void SetRockHillAt(int pos,int len,int H,int Steep,int den,int Grass,int Flower)
    {
        int g=H;
        for(int i=pos;i<pos+len;i++)
        {
            if(i>=GX)return;
            if(i==GX/2)PlayerY=g+1;
            for(int j=0;j<g;j++)
            {
                Storage[0][j][i]="Stone";
            }
            if(rand()%den==0)SetMineAt(g,i,rand()%3+1,rand()%3+1,"Random");
            if(i<pos+(len/2))g+=Steep+rand()%2;
            else g-=Steep+rand()%2;
        }
        ProH=g;
    }
    void SetCliffAt(int pos,int len,int H,int Height,int den)
    {
        int g=pos;
        for(int i=30;i<H+Height;i++)
        {
            if(i>=GY-50)return;
            for(int j=g;j<pos+len;j++)
            {
                if(j==GX/2)PlayerY=H+Height;
                Storage[0][j][i]="Stone";
                if(rand()%den==0)SetMineAt(g,i,rand()%3+1,rand()%3+1,"Random");
                if(rand()%2==0)
                {
                    if(g<len-1)g++;
                }
                if(rand()%2==0)
                {
                    if(g>1)g--;
                }
            }
        }
        ProH=H+Height;
    }
    void SetStructure(int pos,int len,int H,int num)
    {
        if(num==1)// Jungle Monument
        {
            int g=H;
            for(int i=pos;i<pos+len/2-3;i++)
            {
                if(i>=GX)return;
                if(i==GX/2)PlayerY=g+1;
                for(int j=0;j<g;j++)
                {
                    if(j>=g-rand()%3-3)Storage[0][j][i]="Dirt";
                    else Storage[0][j][i]="Stone";
                }
                if(rand()%100<20)
                {
                    SetTreeAt(g,i,4+rand()%5,"Jungle");
                }
                if(rand()%4==0)
                {
                    if(rand()%2==0)g++;
                    else g--;
                }
            }

            Storage[0][g][pos+len/2]="PressurePlate";
            Storage[0][g][pos+len/2+1]="PressurePlate";
            Storage[0][g][pos+len/2-1]="PressurePlate";
            Storage[0][g][pos+len/2+2]="PressurePlate";
            Storage[0][g][pos+len/2-2]="PressurePlate";
            Storage[0][g][pos+len/2+3]="PressurePlate";
            Storage[0][g][pos+len/2-3]="PressurePlate";
            Storage[0][g][pos+len/2]="PressurePlate";

            Storage[0][g+3][pos+len/2]="Stone";
            Storage[0][g+3][pos+len/2+1]="Stone";
            Storage[0][g+3][pos+len/2-1]="Stone";
            Storage[0][g+3][pos+len/2+2]="Stone";
            Storage[0][g+3][pos+len/2-2]="Stone";
            Storage[0][g+3][pos+len/2+3]="Stone";
            Storage[0][g+3][pos+len/2-3]="Stone";
            Storage[0][g+2][pos+len/2+3]="Stone";
            Storage[0][g+2][pos+len/2-3]="Stone";

            Storage[0][g+4][pos+len/2]="Stone";
            Storage[0][g+4][pos+len/2-2]="Stone";
            Storage[0][g+4][pos+len/2+2]="Stone";
            Storage[0][g+5][pos+len/2]="Stone";
            Storage[0][g+5][pos+len/2-2]="Stone";
            Storage[0][g+5][pos+len/2+2]="Stone";

            Storage[0][g-1][pos+len/2-3]="TNT";
            Storage[0][g-1][pos+len/2-2]="TNT";
            Storage[0][g-1][pos+len/2-1]="TNT";
            Storage[0][g-1][pos+len/2]="TNT";
            Storage[0][g-1][pos+len/2+1]="TNT";
            Storage[0][g-1][pos+len/2+2]="TNT";
            Storage[0][g-1][pos+len/2+3]="TNT";

            Storage[0][g-2][pos+len/2-3]="Gold";
            Storage[0][g-2][pos+len/2-2]="Gold";
            Storage[0][g-2][pos+len/2-1]="Gold";
            Storage[0][g-2][pos+len/2]="Gold";
            Storage[0][g-2][pos+len/2+1]="Gold";
            Storage[0][g-2][pos+len/2+2]="Gold";
            Storage[0][g-2][pos+len/2+3]="Gold";

            Storage[0][g-3][pos+len/2-3]="Gold";
            Storage[0][g-3][pos+len/2-2]="Gold";
            Storage[0][g-3][pos+len/2-1]="Gold";
            Storage[0][g-3][pos+len/2]="Gold";
            Storage[0][g-3][pos+len/2+1]="Gold";
            Storage[0][g-3][pos+len/2+2]="Gold";
            Storage[0][g-3][pos+len/2+3]="Gold";
            for(int i=pos+len/2-3;i<pos+len/2+4;i++)
            {
                for(int j=g-4;j>=0;j--)
                {
                    Storage[0][j][i]="Lava";
                }
            }
            for(int i=pos+len/2+4;i<pos+len;i++)
            {
                if(i==GX/2)PlayerY=g+1;
                for(int j=0;j<g;j++)
                {
                    if(j>=g-rand()%3-3)Storage[0][j][i]="Dirt";
                    else Storage[0][j][i]="Stone";
                }
                if(rand()%100<20)
                {
                    SetTreeAt(g,i,4+rand()%5,"Jungle");
                }
                if(rand()%4==0)
                {
                    if(rand()%2==0)g++;
                    else g--;
                }
            }
            ProH=g;
        }
        if(num==2)// Acient Ruins
        {
            for(int i=pos;i<pos+len;i++)
            {
                for(int j=H;j<H+9+rand()%3;j++)
                {
                    Storage[0][j][i]="Air";
                }
            }
            for(int i=pos;i<pos+len;i++)
            {
                Storage[0][H][i]="Moss";
                if(rand()%5==0)
                {
                    for(int j=H;j<H+rand()%5+2;j++)
                    {
                        Storage[0][j][i]="Wood";
                        Storage[0][j+1][i]="Lamp";
                    }
                }
            }
        }
        if(num==3)// Nether Fortress
        {
            for(int i=pos;i<pos+len;i++)
            {
                //Storage[1][H][i]="Stone";
                //Storage[1][H+5][i]="Stone";
                for(int j=H;j<H+5;j++)
                {
                    //Storage[1][j][i]="Air";
                }
            }
        }
        if(num==4)// Ground Trap
        {
            int h,g=H;
            for(int i=pos;i<pos+len;i++)
            {
                if(i==GX/2)PlayerY=g+1;
                for(int j=0;j<g;j++)
                {
                    if(j>=g-rand()%3-3)Storage[0][j][i]="Dirt";
                    else Storage[0][j][i]="Stone";
                }
                if(rand()%100<20)
                {
                    SetTreeAt(g,i,4+rand()%5,"Jungle");
                }
                if(rand()%4==0)
                {
                    if(rand()%2==0)g++;
                    else g--;
                }
                if(i==pos+len/2)h=g;
            }
            ProH=g;

            Storage[0][g][pos+len/2]="Dirt";
            Storage[0][g][pos+len/2+1]="Dirt";
            Storage[0][g][pos+len/2+2]="Dirt";
            Storage[0][g][pos+len/2+3]="Dirt";
            Storage[0][g][pos+len/2+4]="Dirt";
            Storage[0][g][pos+len/2+5]="Dirt";
            Storage[0][g][pos+len/2+6]="Dirt";
            Storage[0][g][pos+len/2+7]="Dirt";
            Storage[0][g][pos+len/2+8]="Dirt";
            Storage[0][g][pos+len/2+9]="Dirt";
            Storage[0][g][pos+len/2+10]="Dirt";
            Storage[0][g][pos+len/2+11]="Dirt";
            Storage[0][g][pos+len/2+12]="Dirt";
            Storage[0][g][pos+len/2+13]="Dirt";
            Storage[0][g][pos+len/2+14]="Dirt";
            Storage[0][g][pos+len/2+15]="Dirt";
            Storage[0][g][pos+len/2+16]="Dirt";
            Storage[0][g][pos+len/2+(rand()%17)]="PressurePlate";
            Storage[0][g][pos+len/2+(rand()%17)]="PressurePlate";

            Storage[0][g-1][pos+len/2-1]="Dirt";
            Storage[0][g-1][pos+len/2]="TNT";
            Storage[0][g-1][pos+len/2+1]="TNT";
            Storage[0][g-1][pos+len/2+2]="TNT";
            Storage[0][g-1][pos+len/2+3]="TNT";
            Storage[0][g-1][pos+len/2+4]="TNT";
            Storage[0][g-1][pos+len/2+5]="TNT";
            Storage[0][g-1][pos+len/2+6]="TNT";
            Storage[0][g-1][pos+len/2+7]="TNT";
            Storage[0][g-1][pos+len/2+8]="TNT";
            Storage[0][g-1][pos+len/2+9]="TNT";
            Storage[0][g-1][pos+len/2+10]="TNT";
            Storage[0][g-1][pos+len/2+11]="TNT";
            Storage[0][g-1][pos+len/2+12]="TNT";
            Storage[0][g-1][pos+len/2+13]="TNT";
            Storage[0][g-1][pos+len/2+14]="TNT";
            Storage[0][g-1][pos+len/2+15]="TNT";
            Storage[0][g-1][pos+len/2+16]="TNT";
            Storage[0][g-1][pos+len/2+17]="Dirt";
        }
        if(num==5)// April Fools
        {
            int g=H;
            for(int i=pos;i<pos+len/2-3;i++)
            {
                if(i>=GX)return;
                if(i==GX/2)PlayerY=g+1;
                for(int j=0;j<g;j++)
                {
                    if(j>=g-rand()%3-3)Storage[0][j][i]="Dirt";
                    else Storage[0][j][i]="Stone";
                }
                if(rand()%100<20)
                {
                    SetTreeAt(g,i,4+rand()%5,"Jungle");
                }
                if(rand()%4==0)
                {
                    if(rand()%2==0)g++;
                    else g--;
                }
            }
            for(int i=pos+len/2-3;i<pos+len/2+4;i++)
            {
                for(int j=g-4;j>=0;j--)
                {
                    if(j>g-6+(rand()%3))Storage[0][j][i]="Dirt";
                    else Storage[0][j][i]="Stone";
                }
            }
            Storage[0][g][pos+len/2-3]="Dirt";
            Storage[0][g][pos+len/2-2]="Dirt";
            Storage[0][g][pos+len/2-1]="Dirt";
            Storage[0][g][pos+len/2]="AprilFools1";
            Storage[0][g][pos+len/2+1]="Dirt";
            Storage[0][g][pos+len/2+2]="Dirt";
            Storage[0][g][pos+len/2+3]="Dirt";

            Storage[0][g+1][pos+len/2]="Diamond";
            Storage[0][g+1][pos+len/2-1]="Diamond";
            Storage[0][g+1][pos+len/2+1]="Diamond";
            Storage[0][g+2][pos+len/2]="Diamond";

            Storage[0][g+1][pos+len/2-2]="Stone";
            Storage[0][g+1][pos+len/2+2]="Stone";
            Storage[0][g+3][pos+len/2]="Stone";
            Storage[0][g+2][pos+len/2+1]="Stone";
            Storage[0][g+2][pos+len/2-1]="Stone";
            for(int i=pos+len/2+4;i<pos+len;i++)
            {
                if(i==GX/2)PlayerY=g+1;
                for(int j=0;j<g;j++)
                {
                    if(j>=g-rand()%3-3)Storage[0][j][i]="Dirt";
                    else Storage[0][j][i]="Stone";
                }
                if(rand()%100<20)
                {
                    SetTreeAt(g,i,4+rand()%5,"Jungle");
                }
                if(rand()%4==0)
                {
                    if(rand()%2==0)g++;
                    else g--;
                }
            }
            ProH=g;
        }
    }
    void SetNetherFortressAt(int Y,int X)
    {
        char print[25][205]=
        {
            "                                          #######                                          #######                                                              #######                                 ",
            "                                         ##     ##                                        ##     ##                                                            ##     ##                                ",
            "                                         #       #                                        #       #                                    #S#                     #       #                                ",
            "                                         W       W                                        W       W                                   #####                    W       W                                ",
            "---##################################################################################################################################################################################################---",
            "######                         #                                   #                                    #                                    #                            #                       ######",
            "######           C             W                                   W         C                          W                                    W                            W   C                   ######",
            "########################################################################################################################################################################################################",
            "            #########                       #########                       #########                            #########                           #########                     #########            ",
            "             #######                         #######                         #######                              #######                             #######                       #######             ",
            "             #######                         #######                         #######                              #######                             #######                       #######             ",
            "             #######                         #######                         #######                              #######                             #######                       #######             ",
            "             #######                         #######                         #######                              #######                             #######                       #######             ",
            "             #######                         #######                         #######                              #######                             #######                       #######             ",
            "             #######                         #######                         #######                              #######                             #######                       #######             ",
            "             #######                         #######                         #######                              #######                             #######                       #######             ",
            "             #######                         #######                         #######                              #######                             #######                       #######             ",
            "             #######                         #######                         #######                              #######                             #######                       #######             ",
            "             #######                         #######                         #######                              #######                             #######                       #######             ",
            "             #######                         #######                         #######                              #######                             #######                       #######             ",
            "             #######                         #######                         #######                              #######                             #######                       #######             ",
            "LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL",
        };
        for(int i=0;i<20;i++)
        {
            for(int j=0;j<200;j++)
            {
                if(j>=GX)return;
                if(print[i][j]=='#')Storage[1][Y-i][X+j]="NetherBrick";
                if(print[i][j]=='P')Storage[1][Y-i][X+j]="PressurePlate";
                if(print[i][j]=='T')Storage[1][Y-i][X+j]="TNT";
                if(print[i][j]=='L')Storage[1][Y-i][X+j]="Lava";
                if(print[i][j]=='G')Storage[1][Y-i][X+j]="Gold";
                if(print[i][j]=='D')Storage[1][Y-i][X+j]="Diamond";
                if(print[i][j]=='W')Storage[1][Y-i][X+j]="Wood";
                if(print[i][j]=='?')
                {
                    if(rand()%2==0)Storage[1][Y-i][X+j]="Iron";
                    else if(rand()%2==0)Storage[1][Y-i][X+j]="Gold";
                    else Storage[1][Y-i][X+j]="Diamond";
                }
                if(print[i][j]==' ')Storage[1][Y-i][X+j]="Air";
                if(print[i][j]=='S')Storage[1][Y-i][X+j]="TrailSpawner_Blaze";
            }
        }
    }
    void SetNetherWasteAt(int Y,int X,int len,int H)
    {
        int g=Y,h=H;
        for(int i=X;i<X+len;i++)
        {
            if(i>=GX)return;
            for(int j=g;j<g+h;j++)
            {
                if(rand()%100==0)
                {
                    if(rand()%10==0)Storage[1][j][i]="AcientDebris";
                    else Storage[1][j][i]="Lava";
                }
                else Storage[1][j][i]="Netherrack";
            }
            if(rand()%20==0)Storage[1][g+rand()%3][i]="Lava";
            if(rand()%20==0)Storage[1][g+h][i]="Lava";
            if(rand()%5==0)Storage[1][g+h][i]="Fire";
            if(rand()%4==0)
            {
                if(rand()%2==0)
                {
                    if(g<GY-30)g++,h++;
                }
                else if(g>30)g--,h--;
            }
            if(rand()%4==0)
            {
                if(rand()%2==0)
                {
                    if(h<g+5)h++;
                }
                else if(h>g+1)h--;
            }
        }
    }
    void SetSoulValleyAt(int Y,int X,int len,int H)
    {
        int g=Y,h=H;
        for(int i=X;i<X+len;i++)
        {
            if(i>=GX)return;
            for(int j=g;j<g+h;j++)
            {
                Storage[1][j][i]="SoulSand";
            }
            if(rand()%20==0)Storage[1][g+rand()%3][i]="Lava";
            if(rand()%5==0)Storage[1][g+h][i]="SoulFire";
            if(rand()%2==0)
            {
                if(rand()%2==0)g++,h++;
                else g--,h--;
            }
            if(rand()%4==0)
            {
                if(rand()%2==0)
                {
                    if(g<GY-30)g++,h++;
                }
                else if(g>30)g--,h--;
            }
            if(rand()%4==0)
            {
                if(rand()%2==0)
                {
                    if(h<g+5)h++;
                }
                else if(h>g+1)h--;
            }
        }
    }
    void SetObsidianPillar(int Y,int X,int H)
    {
        for(int i=Y;i<Y+H;i++)
        {
            for(int j=X-1;j<X+2;j++)
            {
                Storage[2][i][j]="Obsidian";
            }
        }
        Storage[2][Y+H][X]="EndonGoblet";
    }
    void SetEndonIsland(int Y,int X,int H,int W,int type)
    {
        if(type==1)
        {
            int h=Y+(rand()%H)+2;
            for(int i=Y-(rand()%10)-H;i<h;i++)
            {
                for(int j=X-(rand()%10)-W;j<X+rand()%10+W;j++)
                {
                    Storage[2][i][j]="EndRock";
                }
            }
            SetObsidianPillar(h,X+15,20);
            SetObsidianPillar(h,X+45,20);
            SetObsidianPillar(h,X+75,20);
            SetObsidianPillar(h,X+105,20);
            SetObsidianPillar(h,X-15,20);
            SetObsidianPillar(h,X-45,20);
            SetObsidianPillar(h,X-75,20);
            SetObsidianPillar(h,X-105,20);
            Storage[2][h+7][500]="EndonDragon";
        }
        if(type==2)
        {
            int h=Y+(rand()%H)+2;
            for(int i=Y-(rand()%10)-H;i<h;i++)
            {
                for(int j=X-(rand()%10)-W;j<X+rand()%10+W;j++)
                {
                    //Storage[2][i][j]="EndRock";
                }
                if(rand()%2==0)
                {
                    //Storage[2][Y+h][X+W/2]="Print_EndCity";
                }
            }
        }
    }
    void SetLand()
    {
        ProH=GY/2;
        while(ProPos<GX)
        {
            if(rand()%5==0) 
            {
                ProLen=50;
                SetStructure(ProPos,ProLen,ProH,5);
            }
            else if(rand()%2==0)//2
            {
                if(rand()%3==0)//3
                {
                    if(rand()%2==0)//3
                    {
                        ProLen=rand()*rand()%30+50;
                        SetDesertAt(ProPos,ProLen,ProH,rand()%3);
                    }
                    else
                    {
                        /*if(rand()%2==0)//2
                        {
                            ProLen=50;
                            SetStructure(ProPos,ProLen,ProH,4);
                        }
                        else*/
                        {
                            ProLen=rand()*rand()%30+20;
                            SetPlainAt(ProPos,ProLen,ProH,rand()%4,rand()%4);
                        }

                    }
                }
                else
                {
                    if(rand()%3==0)
                    {
                        if(rand()%2==0)
                        {
                            ProLen=rand()*rand()%20+10;
                            SetHillAt(ProPos,ProLen,ProH,1,rand()%30+20,
                            rand()%3,rand()%3);
                        }
                        else
                        {
                            ProLen=rand()*rand()%20+10;
                            SetRockHillAt(ProPos,ProLen,ProH,1,rand()%30+20,
                            rand()%3,rand()%3);
                        }
                    }
                    else
                    {
                        if(rand()%1==0||ProH>GY-200)
                        {
                            ProLen=rand()*rand()%50+5;
                            SetRiverAt(ProPos,ProLen,ProH,rand()%2+1);
                        }
                        else
                        {
                            ProLen=2+rand()%5;
                            SetCliffAt(ProPos,ProLen,ProH,5+rand()%15,(rand()%3)*2);
                        }
                    }
                }
            }
            else
            {
                if(rand()%2==0)
                {
                    ProLen=rand()*rand()%30+20;
                    if(rand()%3==0)SetStructure(ProPos,ProLen,ProH,1);
                    else SetJungleAt(ProPos,ProLen,ProH,rand()%30+10);
                }
                else
                {
                    ProLen=rand()*rand()%30+20;
                    if(rand()%3==0)SetStructure(ProPos,ProLen,ProH,1);
                    else SetForestAt(ProPos,ProLen,ProH,rand()%30+10);
                }
            }
            ProPos+=ProLen;
        }
        //SetPlainAt(0,GX/2,GY/2-5,3,1);
        //SetJungleAt(GX/2,GX/2,GY/2-5,25);
    }
    void SetStrongHold(int Y,int X,int type)
    {
        StrongHold.X=X;
        StrongHold.Y=Y;
        if(type==1)
        {
            char print[15][85]=
            {
                "#########-----------------------------------------------------------------------",
                "#     II#---------------------------##############################--------------",
                "#GGD    #---------------------------#  WW  WW  WW  WW  WW  WW  WW#--------------",
                "####### #################-----------#  WW  WW  WW  WW  WW  WW  WW#--------------",
                "------#       PPPP   #LL#-----------#  WW  WWS WW  WW  WW  WW  WW#--------------",
                "------#      PP  PP  ################  ################## ######################",
                "------#       PPPP      #                  #------------#   D### #    #D       #",
                "------#LL#   #LLLL#   S                    #------------## ###   # ##### ##### #",
                "------###################                  #########----#  #   ### #DD#    # # #",
                "------------------------#S    S     S            ###----#S   #     ####  #   #D#",
                "------------------------####################  D#####----#### # ### #    #### ###",
                "-------------------------------------------#####SDG#----#DD  # DD#    #S#    DD#",
                "-------------------------------------------#II#D####----########################",
                "-------------------------------------------#########----------------------------",
            };
            for(int i=0;i<14;i++)
            { 
                for(int j=0;j<80;j++)
                {
                    if(print[i][j]=='#')Storage[0][Y-i][X+j]="Brick";
                    if(print[i][j]==' ')Storage[0][Y-i][X+j]="Air";
                    if(print[i][j]=='S')Storage[0][Y-i][X+j]="TrailSpawner_Zombie";
                    if(print[i][j]=='G')Storage[0][Y-i][X+j]="Gold";
                    if(print[i][j]=='D')Storage[0][Y-i][X+j]="Diamond";
                    if(print[i][j]=='I')Storage[0][Y-i][X+j]="Iron";
                    if(print[i][j]=='L')Storage[0][Y-i][X+j]="Lava";
                    if(print[i][j]=='W')Storage[0][Y-i][X+j]="Wood";
                    if(print[i][j]=='P')Storage[0][Y-i][X+j]="EnderPortalFrame";
                }
            }
        }
    }
    void SetMine()
    {
        ProH=GY/5*2;
        for(int i=0;i<GX;i++)
        {
            for(int j=0;j<ProH;j++)
            {
                Storage[0][j][i]="DeepStone";
            }
            ProH+=rand()%3-1;
        }
        ProPos=50;
        while(ProPos<GX-70)
        {
            if(rand()*rand()%10==0)
            {
                SetMinePit(rand()*rand()%(GY/2-70)+50,ProPos,rand()%5+6,rand()%5+6);
            }
            if(rand()*rand()%10==0)
            {
                SetMineAt(rand()*rand()%(GY/2-70)+50,ProPos,rand()%2+1,rand()%2+1,"Random"
                );
            }
            if(rand()*rand()*rand()*rand()%50==0)
            {
                SetStructure(ProPos,20+rand()%20,150,2);
            }
            ProPos++;
        }
        //SetMinePit(PlayerY-30,GX/2,10,10);
        //SetStructure(PlayerX-15,20+rand()%20,PlayerY-50,2);
//      SetStrongHold(rand()*rand()%(GY/4*3-70)+50,rand()*rand()%(GX-150),1);
        SetStrongHold(120+(rand()%20),rand()%GX-150+50,1);
        SetBedRock(0,1,1);
    }
    void SetNetherLand()
    {
        for(int i=0;i<20+rand()%20;i++)
        {
            if(rand()%3==0)
            {
                SetSoulValleyAt(50+(rand()*rand()%(GY-300)+150),50+(rand()*rand()%(GX-350)),
                rand()*rand()%300,rand()%5+5);
            }
            else
            {
                SetNetherWasteAt(50+(rand()*rand()%(GY-300)+150),50+(rand()*rand()%(GX-350)),
                rand()*rand()%300,rand()%5+5);
            }

        }
        for(int i=0;i<2+rand()%3;i++)
        {
            SetBluePrint(rand()%(GY-200)+50,rand()%(GX-150)+50,2);
        }
    }
    void SetMainLand()
    {
        FillAir(0);
        SetLand();
        SetMine();
    }
    void SetNether()
    {
        FillAir(1);
        for(int i=0;i<70;i++)
        {
            for(int j=0;j<GX;j++)
            {
                if(i<rand()%5+13)Storage[1][i][j]="Netherrack";
                else Storage[1][i][j]="Lava";
            }
        }
        SetNetherLand();
        SetNetherFortressAt(89,rand()*rand()%(GX-250));
        SetBedRock(1,1,1);
    }
    void SetTheEnd()
    {
        FillAir(2);
        SetEndonIsland(80,500,50,300,1);
        BossHP=320;
        BossRegen=8;
        for(int i=0;i<5+rand()%5;i++)
        {
            if(rand()%2==0)SetEndonIsland(100+rand()*rand()%(GY/2-500),100+rand()*rand()%(GX-200),
            rand()%30+1,rand()%40+3,2);
            else SetEndonIsland(400+rand()*rand()%(GY/2-100),100+rand()*rand()%(GX-200),
            rand()%30+1,rand()%40+3,2);
        }
    }
    void Reset()
    {
        SpawnWorld=0;
        for(int i=0;i<9;i++)
        {
            BackPack[i]="Air";
            PackCnt[i]=0;
        }
        //SetTreeAt(50,95,4);
        SetMainLand();
        SetNether();
        SetTheEnd();
        CheckBluePrint();
        SpawnY=PlayerY;
        SpawnX=PlayerX;
    }
    void CmdReset()
    {
        cmd.xray=0;
        cmd.FloorLevelShift=0;
        cmd.TileColoured=0;
        cmd.KeepInventory=1;
    }
}
void ResetPlayer()
{
    Protection=0;
    SpawnWorld=0;
    for(int i=0;i<9;i++)
    {
        BackPack[i]="Air";
        PackCnt[i]=0;
    }
    PlayerY=SpawnY;
    PlayerX=SpawnX;
    PlayerHP=10;Hunger=10;Oxygen=10;
}
void CreateExplosion(int Y,int X,int MinR,int dr,int Damage)
{
    for(int y=Y+(rand()%dr)+MinR;y>Y-(rand()%dr)-MinR;y--)
    {
        for(int x=X-(rand()%dr)-MinR;x<X+(rand()%dr)+MinR;x++)
        {
            if(y==PlayerY&&x==PlayerX&&PlayerMode!="Creative"&&PlayerMode!="Spectate")
            {
                if(Frame%2==0)PlayerBeingDamaged=1;
                PlayerHP-=max(Damage+rand()%3-1+Protection/4,0);
                LastDamage=Frame;
                Death[3]=3;
            }
            BlockChecked[y][x]=1;
            MobHP[y][x]-=Damage;
            if(MobHP[y][x]<1)Mob[y][x]="Air";
            if(world[y][x]=="EndonGoblet")BossRegen--;
            else if(world[y][x]=="TNT")RedStone[y][x]=1;
            else if(world[y][x]=="Nuke")RedStone[y][x]=1;
            else if(world[y][x]!="Lava"&&world[y][x]!="Water"&&world[y][x]!="Obsidian"&&
            world[y][x]!="Bedrock"&&world[y][x]!="TrailSpawner_Blaze")
            {
                if(rand()%2==0)world[y][x]="Smoke2";
                else if(rand()%2==0)world[y][x]="Smoke1";
                else world[y][x]="Air";
            }
        }
    }
    world[Y][X]="Smoke2";
}
void AddUnpackable(string Item,bool Status)
{
    for(int i=0;i<9;i++)
    {
        if(BackPack[i]=="Air")
        {
            BackPack[i]=Item;
            PackCnt[i]+=1;
            PackStatus[i]=Status;
            break;
        }
    }
}
void AddToPack(string Item,bool Status)
{
    bool found=0;
    for(int i=0;i<9;i++)
    {
        if(BackPack[i]==Item)
        {
            PackCnt[i]+=1;
            found=1;
            break;
        }
    }
    if(found==0)
    {
        for(int i=0;i<9;i++)
        {
            if(BackPack[i]=="Air")
            {
                BackPack[i]=Item;
                PackCnt[i]+=1;
                PackStatus[i]=Status;
                break;
            }
        }
    }
}
void AddToPack(string Item,int Count,bool Status)
{
    bool found=0;
    for(int i=0;i<9;i++)
    {
        if(BackPack[i]==Item)
        {
            PackCnt[i]+=Count;
            found=1;
            break;
        }
    }
    if(found==0)
    {
        for(int i=0;i<9;i++)
        {
            if(BackPack[i]=="Air")
            {
                BackPack[i]=Item;
                PackCnt[i]+=Count;
                PackStatus[i]=Status;
                break;
            }
        }
    }

}
bool PackInclude(string Item)
{
    for(int i=0;i<9;i++)
    {
        if(BackPack[i]==Item)return 1;
    }
    return 0;
}
bool PackInclude(string Item,int Count)
{
    for(int i=0;i<9;i++)
    {
        if(BackPack[i]==Item&&PackCnt[i]>=Count)return 1;
    }
    return 0;
}
void DeletePack(string Item)
{
    for(int i=0;i<9;i++)
    {
        if(BackPack[i]==Item)
        {
            PackCnt[i]-=1;
            if(PackCnt[i]<=0)
            {
                PackCnt[i]=0;
                BackPack[i]="Air";
            }
            break;
        }
    }
}
void DeletePack(string Item,int Count)
{
    for(int i=0;i<9;i++)
    {
        if(BackPack[i]==Item)
        {
            PackCnt[i]-=Count;
            if(PackCnt[i]<=0)
            {
                PackCnt[i]=0;
                BackPack[i]="Air";
            }
            break;
        }
    }
}
void LoadWorld(int tarnum)
{
    cls();
    for(int i=0;i<GY;i++)
    {
        for(int j=0;j<GX;j++)
        {
            if(CurrentWorld!=-1)Storage[CurrentWorld][i][j]=world[i][j];
            world[i][j]=Storage[tarnum][i][j];
            if(CurrentWorld!=-1)StorageID[CurrentWorld][i][j]=ID[i][j];
            ID[i][j]=StorageID[tarnum][i][j];
            if(CurrentWorld!=-1)MobStorage[CurrentWorld][i][j]=Mob[i][j];
            Mob[i][j]=MobStorage[tarnum][i][j];
            if(Mob[i][j]=="Chicken")MobHP[i][j]=3;
            if(Mob[i][j]=="Cow")MobHP[i][j]=5;
            if(Mob[i][j]=="Sheep")MobHP[i][j]=5;
            if(Mob[i][j]=="Zombie")MobHP[i][j]=10;
            if(Mob[i][j]=="Keeper")MobHP[i][j]=50;
            //if(tarnum==1)world[i][j]="Dirt";
        }
    }
    //if(tarnum==1)world[PlayerY][PlayerX]="Air";
    CurrentWorld=tarnum;
}
void PrintDeath()
{
    //Death[1]: Mob    Death[2]: Fall/Drown/Suffocate    Death[3]: Burn/Lava/Explosion    
    if(Death[1]>0)
    {
        if(Death[2]>0)
        {
            if(Death[3]>0)
            {
                if(Death[3]==1&&Death[2]==1)cout<<PlayerName<<"在逃离"<<MobDeathString<<"时从高空中落入了熊熊烈火";
                if(Death[3]==1&&Death[2]==2)cout<<PlayerName<<"在逃离"<<MobDeathString<<"时从溺亡在了熊熊烈火中";
                if(Death[3]==1&&Death[2]==3)cout<<PlayerName<<"在逃离"<<MobDeathString<<"时在熊熊烈火中窒息了";
                if(Death[3]==2&&Death[2]==1)cout<<PlayerName<<"在逃离"<<MobDeathString<<"时从高空中落入了岩浆";
                if(Death[3]==2&&Death[2]==2)cout<<PlayerName<<"在逃离"<<MobDeathString<<"时溺亡在了岩浆中";
                if(Death[3]==2&&Death[2]==3)cout<<PlayerName<<"在逃离"<<MobDeathString<<"时窒息在了岩浆中";
                if(Death[3]==3&&Death[2]==1)cout<<PlayerName<<"在逃离"<<MobDeathString<<"时落到了爆炸的TNT里";
                if(Death[3]==3&&Death[2]==2)cout<<PlayerName<<"在逃离"<<MobDeathString<<"时溺亡在了爆炸的TNT中";
                if(Death[3]==3&&Death[2]==3)cout<<PlayerName<<"在逃离"<<MobDeathString<<"时窒息在了爆炸的TNT中";
            }
            else
            {
                if(Death[2]==1)cout<<PlayerName<<"在逃离"<<MobDeathString<<"时从高空中落了下来";
                if(Death[2]==2)cout<<PlayerName<<"在逃离"<<MobDeathString<<"溺亡了";
                if(Death[2]==2)cout<<PlayerName<<"在逃离"<<MobDeathString<<"窒息了";
            }
        }
        else if(Death[3]>0)
        {
            if(Death[3]==1)cout<<PlayerName<<"在逃离"<<MobDeathString<<"时跳入了熊熊烈火";
            if(Death[3]==2)cout<<PlayerName<<"在逃离"<<MobDeathString<<"时试图在岩浆里游泳";
            if(Death[3]==3)cout<<PlayerName<<"在逃离"<<MobDeathString<<"时爆炸了";
        }
        else
        {
            cout<<PlayerName<<"被"<<MobDeathString<<"击杀了";
        }
    }
    else if(Death[2]>0)
    {
        if(Death[3]>0)
        {
            if(Death[3]==1&&Death[2]==1)cout<<PlayerName<<"从高空中落到了火焰里";
            if(Death[3]==1&&Death[2]==2)cout<<PlayerName<<"溺水时慌乱的跳到了火焰里";
            if(Death[3]==2&&Death[2]==1)cout<<PlayerName<<"从高空中落入了岩浆里";
            if(Death[3]==2&&Death[2]==2)cout<<PlayerName<<"溺水时试图在岩浆里游泳";
            if(Death[3]==3&&Death[2]==1)cout<<PlayerName<<"从高空中落入了爆炸的TNT里";
            if(Death[3]==3&&Death[2]==2)cout<<PlayerName<<"溺水时游到了爆炸的TNT里";
            if(Death[3]==3&&Death[2]==3)cout<<PlayerName<<"溺水时游到了爆炸的TNT里";
        }
        else
        {
            if(Death[2]==1)cout<<PlayerName<<"从高空中落了下来";
            if(Death[2]==2)cout<<PlayerName<<"溺亡了";
            if(Death[2]==2)cout<<PlayerName<<"在墙中窒息了";
        }
    }
    else if(Death[3]>0)
    {
        if(Death[3]==1)cout<<PlayerName<<"被烧死了";
        if(Death[3]==2)cout<<PlayerName<<"试图在岩浆里游泳";
        if(Death[3]==3)cout<<PlayerName<<"爆炸了";
    }
    else cout<<PlayerName<<"死了";
}
void SetDeath()
{
    if(PlayerHP==10||(Frame-LastDamage>10&&LastDamage!=-1))
    {
        Death[1]=0;
        LastDamage=-1;
    }
    if(PlayerHP==10||(Frame-LastDamage>50&&LastDamage!=-1))
    {
        Death[2]=0;
        LastDamage=-1;
    }
    if(PlayerHP==10||(Frame-LastDamage>50&&LastDamage!=-1))
    {
        Death[3]=0;
        LastDamage=-1;
    }
}
void Die()
{
    cls();
    cout<<"你死了"<<endl;
    PrintDeath();
    if(!cmd.KeepInventory)
    {
        BackPack[0]="Air";
        BackPack[1]="Air";
        BackPack[2]="Air";
        BackPack[3]="Air";
        BackPack[4]="Air";
        BackPack[5]="Air";
        BackPack[6]="Air";
        BackPack[7]="Air";
        BackPack[8]="Air";
        //BackPack[9]="Air";
        for(int i=0;i<10;i++)
        {
            PackCnt[i]=0;
        }
    }
    for(int i=1;i<=10;i++)Death[i]=0;
    Sleep(2000);
    PlayerHP=10;
    Hunger=10;
    Oxygen=10;
    Jump=0;
    ExplosionJump=0;
    PlayerY=SpawnY,PlayerX=SpawnX;
    LoadWorld(SpawnWorld);
}
void Save()
{
    int SaveWorld=CurrentWorld;
    LoadWorld(0);
    LoadWorld(1);
    LoadWorld(SaveWorld); 
    ofstream ofs;
    ofs.open("WordCraft_Save_Player.txt",ios::out);
    for(int i=0;i<9;i++)
    {
        for(int j=0;j<PackCnt[i];j++)ofs<<BackPack[i]<<" ";
    }
    ofs.close();
    //ofstream ofs;
    ofs.open("WordCraft_Save_World_0.txt",ios::out);
    for(int i=0;i<GY;i++)
    {
        for(int j=0;j<GX;j++)
        {
            ofs<<Storage[0][i][j]<<" ";
        }
    }
    ofs.close();
    ofs.open("WordCraft_Save_World_1.txt",ios::out);
    for(int i=0;i<GY;i++)
    {
        for(int j=0;j<GX;j++)
        {
            ofs<<Storage[1][i][j]<<" ";
        }
    }
    ofs<<" ";
    ofs.open("WordCraft_Save_World_2.txt",ios::out);
    for(int i=0;i<GY;i++)
    {
        for(int j=0;j<GX;j++)
        {
            ofs<<Storage[2][i][j]<<" ";
        }
    }
    ofs<<" ";
    ofs.close();
    ofs.open("WordCraft_Save_PlayerPos.txt",ios::out);
    ofs<<PlayerY/100;
    ofs<<PlayerY%100/10;
    ofs<<PlayerY%10;
    ofs<<" ";
    ofs<<PlayerX/1000;
    ofs<<PlayerX%1000/100;
    ofs<<PlayerX%100/10;
    ofs<<PlayerX%10;
    ofs<<" ";
    ofs<<SpawnY/100;
    ofs<<SpawnY%100/10;
    ofs<<SpawnY%10;
    ofs<<" ";
    ofs<<SpawnX/1000;
    ofs<<SpawnX%1000/100;
    ofs<<SpawnX%100/10;
    ofs<<SpawnX%10;
    ofs<<" ";
    ofs<<PlayerMode<<" ";
    ofs<<Difficulty<<" ";
    ofs<<PlayerHP/10<<PlayerHP%10<<" ";
    ofs<<Hunger/10<<Hunger%10<<" ";
    ofs<<SpawnWorld<<CurrentWorld<<" ";
    ofs.close();
    ofs.open("WordCraft_Save_Command.txt",ios::out);
    ofs<<cmd.KeepInventory<<" ";
    ofs<<cmd.xray<<" ";
    ofs<<cmd.FloorLevelShift<<" ";
    ofs<<cmd.FloorLevelShift<<" ";
    ofs.close();
}
void Load()
{
    string File;
    char c=0;
    string s1="",s2="";
    int cnt1=0,cnt2=0;
    ifstream ifs;
    ifs.open("WordCraft_Save_PlayerPos.txt",ios::out);
    if (!ifs.is_open())
    {
        ofstream ofs;
        ofs.open("WordCraft_Save_PlayerPos.txt",ios::out);
    }
    File="";
    while((c=ifs.get())!=EOF)File+=c;
    long long len=File.length();
    cnt2=0;
    while(File[cnt2]!=' ')
    {
        cnt1+=File[cnt2]-'0';
        cnt1*=10;
        cnt2++;
    }
    PlayerY=cnt1/10;
    cnt2++;
    cnt1=0;
    while(File[cnt2]!=' ')
    {
        cnt1+=File[cnt2]-'0';
        cnt1*=10;
        cnt2++;
    }
    PlayerX=cnt1/10;
    cnt2++;
    cnt1=0;
    while(File[cnt2]!=' ')
    {
        cnt1+=File[cnt2]-'0';
        cnt1*=10;
        cnt2++;
    }
    SpawnY=cnt1/10;
    cnt2++;
    cnt1=0;
    while(File[cnt2]!=' ')
    {
        cnt1+=File[cnt2]-'0';
        cnt1*=10;
        cnt2++;
    }
    SpawnX=cnt1/10;
    cnt2++;
    s1="";
    while(File[cnt2]!=' ')
    {
        s1+=File[cnt2];
        cnt2++;
    }
    PlayerMode=s1;
    cnt2++;
    cnt1=0;
    while(File[cnt2]!=' ')
    {
        cnt1+=File[cnt2]-'0';
        cnt1*=10;
        cnt2++;
    }
    Difficulty=cnt1;
    cnt2++;
    cnt1=0;
    while(File[cnt2]!=' ')
    {
        cnt1+=File[cnt2]-'0';
        cnt1*=10;
        cnt2++;
    }
    PlayerHP=cnt1/10;
    cnt2++;
    cnt1=0;
    while(File[cnt2]!=' ')
    {
        cnt1+=File[cnt2]-'0';
        cnt1*=10;
        cnt2++;
    }
    Hunger=cnt1/10;
    cnt2++;
    SpawnWorld=File[cnt2]-'0';
    int PlayerWorld=File[cnt2+1]-'0';
    ifs.close();
    ifs.open("WordCraft_Save_PlayerPos.txt",ios::out);
    if (!ifs.is_open())
    {
        ofstream ofs;
        ofs.open("WordCraft_Save_Command.txt",ios::out);
    }
    File="";
    while((c=ifs.get())!=EOF)File+=c;
    len=File.length();
    cnt2=0;
    while(File[cnt2]!=' ')
    {
        cnt1+=File[cnt2]-'0';
        cnt1*=10;
        cnt2++;
    }
    cmd.KeepInventory=cnt1/10;
    cnt2++;
    while(File[cnt2]!=' ')
    {
        cnt1+=File[cnt2]-'0';
        cnt1*=10;
        cnt2++;
    }
    cmd.xray=cnt1/10;
    cnt2++;
    while(File[cnt2]!=' ')
    {
        cnt1+=File[cnt2]-'0';
        cnt1*=10;
        cnt2++;
    }
    cmd.FloorLevelShift=cnt1/10;
    ifs.close();
    ifs.open("WordCraft_Save_Player.txt",ios::out);
    if (!ifs.is_open())
    {
        ofstream ofs;
        ofs.open("WordCraft_Save_Player.txt",ios::out);
    }
    cnt1=0,cnt2=-1;
    s1="",s2="";
    File="";
    while((c=ifs.get())!=EOF)File+=c;
    len=File.length();
    for(int i=0;i<len;i++)
    {
        if(File[i]==' ')
        {
            if(s2==s1)cnt1++,s1="";
            else
            {
                if(s2!="")
                {
                    if(cnt2>=0)
                    {
                        PackCnt[cnt2]=cnt1;
                        BackPack[cnt2]=s1;
                    }
                    cnt2++;
                    cnt1=1,s2=s1,s1="";
                }
            }
        }
        else s1+=File[i];
    }
    ifs.close();
    ifs.open("WordCraft_Save_World_0.txt",ios::out);
    if (!ifs.is_open())
    {
        ofstream ofs;
        ofs.open("WordCraft_Save_World_0.txt",ios::out);
    }
    File="";
    while((c=ifs.get())!=EOF)File+=c;
    len=File.length();
    int n=0,m=0;
    s1="";
    for(int i=0;i<len;i++)
    {
        if(File[i]==' ')
        {
            RedStone[n][m]=0;
            Storage[0][n][m]=s1;
            //cout<<s1<<endl;
            m++;
            if(m>=GX)
            {
                n++;m=0;
            }
            s1="";
        }
        else s1+=File[i];
    }
    ifs.close();
    ifs.open("WordCraft_Save_World_1.txt",ios::out);
    if (!ifs.is_open())
    {
        ofstream ofs;
        ofs.open("WordCraft_Save_World_1.txt",ios::out);
    }
    File="";
    while((c=ifs.get())!=EOF)File+=c;
    len=File.length();
    n=0,m=0;
    s1="";
    for(int i=0;i<len;i++)
    {
        if(File[i]==' ')
        {
            Storage[1][n][m]=s1;
            //cout<<s1<<endl;
            m++;
            if(m>=GX)
            {
                n++;m=0;
            }
            s1="";
        }
        else s1+=File[i];
    }
    ifs.close();
    ifs.open("WordCraft_Save_World_2.txt",ios::out);
    if (!ifs.is_open())
    {
        ofstream ofs;
        ofs.open("WordCraft_Save_World_2.txt",ios::out);
    }
    File="";
    while((c=ifs.get())!=EOF)File+=c;
    len=File.length();
    n=0,m=0;
    s1="";
    for(int i=0;i<len;i++)
    {
        if(File[i]==' ')
        {
            Storage[2][n][m]=s1;
            //cout<<s1<<endl;
            m++;
            if(m>=GX)
            {
                n++;m=0;
            }
            s1="";
        }
        else s1+=File[i];
    }
    ifs.close();
    CurrentWorld=-1;
    LoadWorld(PlayerWorld);
}
void PrintScreen()
{
    gotoxy(0,0);
    if(CurrentWorld==2)
    {
        Color(BLACK,RED);
        cout<<"末影龙";
        gotoxy(0,0);
        for(int i=0;i<BossHP/4-1;i++)putchar(' ');
        Color(BLACK,DARKGREY);
        for(int i=BossHP/4-1;i<320/4-1;i++)putchar(' ');
        BColor(BLACK);
        cout<<endl;
    }
    for(int i=PlayerY+9;i>=PlayerY-10;i--)
    {
        for(int j=PlayerX-20;j<PlayerX+20;j++)
        {
            /*
            if(world[i][j]=="")printf("");
            */
            if(i==CursorY&&j==CursorX)BColor(WHITE);
            else BColor(BLACK);
            if(i==PlayerY&&j==PlayerX)
            {
                printf("我");
                j++;
            }
            if(cmd.xray==1||vis[i][j])
            {
                if(Mob[i][j]=="Air")
                {
                    if(world[i][j]=="Air")printf("  ");
                    if(world[i][j]=="Dirt")printf("土");
                    if(world[i][j]=="Grass")printf("草");
                    if(world[i][j]=="Sand")printf("沙");
                    if(world[i][j]=="Water")printf("淼");
                    if(world[i][j]=="Water2")printf("沝");
                    if(world[i][j]=="Water3")printf("水");
                    if(world[i][j]=="Water4")printf("沝");
                    if(world[i][j]=="Wood")printf("木");
                    if(world[i][j]=="Leaf")printf("叶");
                    if(world[i][j]=="Flower")printf("花");
                    if(world[i][j]=="Stone")printf("石");
                    if(world[i][j]=="DeepStone")printf("岩");
                    if(world[i][j]=="Fire")printf("火");
                    if(world[i][j]=="Lava")printf("浆");
                    if(world[i][j]=="Lava2")printf("浆");
                    if(world[i][j]=="Lava3")printf("浆");
                    if(world[i][j]=="CraftingTable")printf("台");
                    if(world[i][j]=="Stick")printf("棍");
                    if(world[i][j]=="Lamp")printf("灯");
                    if(world[i][j]=="Brick")printf("砖");
                    if(world[i][j]=="Coal")printf("煤");
                    if(world[i][j]=="Iron")printf("铁");
                    if(world[i][j]=="Diamond")printf("钻");
                    if(world[i][j]=="Gold")printf("金");
                    if(world[i][j]=="Furnace")printf("炉");
                    if(world[i][j]=="Moss")printf("苔");
                    if(world[i][j]=="Obsidian")printf("耀");
                    if(world[i][j]=="NetherPortal"){BColor(PURPLE);printf("  ");BColor(BLACK);
                    }
                    if(world[i][j]=="Bed")printf("床");
                    if(world[i][j]=="CraftingTable2")printf("匠");
                    if(world[i][j][0]=='!')printf("令");
                    if(world[i][j]=="RedStone")printf("红");
                    if(world[i][j]=="RedStoneDust")printf("粉");
                    if(world[i][j]=="Lever")printf("杆");
                    if(world[i][j]=="TNT")printf("炸");
                    if(world[i][j]=="Smoke5")printf("烟");
                    if(world[i][j]=="Smoke4")printf("烟");
                    if(world[i][j]=="Smoke3")printf("烟");
                    if(world[i][j]=="Smoke2")printf("烟");
                    if(world[i][j]=="Smoke1")printf("烟");
                    if(world[i][j]=="PressurePlate")printf("压");
                    if(world[i][j]=="MineCar")printf("车");
                    if(world[i][j]=="MineTrack")printf("轨");
                    if(world[i][j]=="EnchantingTable")printf("附");
                    if(world[i][j]=="ExperimentTable")printf("验");
                    if(world[i][j]=="RedStoneTable")printf("研");
                    if(world[i][j]=="Nuke")printf("核");
                    if(world[i][j]=="AprilFools1")printf("土");
                    if(world[i][j]=="Piston")printf("活");
                    if(world[i][j]=="Piston2")printf("塞");
                    if(world[i][j]=="EndRock")printf("磊");
                    if(world[i][j]=="Netherrack")printf("磊");
                    if(world[i][j]=="EndonPortal"){BColor(DARKBLUE);printf("  ");BColor(BLACK);}
                    if(world[i][j]=="TrailSpawner_Blaze")printf("笼");
                    if(world[i][j]=="TrailSpawner_Zombie")printf("笼");
                    if(world[i][j]=="EnderPortalFrame")printf("框");
                    if(world[i][j]=="EnderPortalFrame2")
                    {
                        Color(DARKBLUE,BLACK);
                        printf("框");
                        Color(BLACK,BLACK);
                    }
                    if(world[i][j]=="EndonGoblet")printf("晶");
                    if(world[i][j]=="AcientDebris")printf("鑫");
                    if(world[i][j]=="SoulSand")printf("魂");
                    if(world[i][j]=="SoulFire")printf("火");
                    if(world[i][j]=="Shulker")printf("贝");
                    if(world[i][j]=="Chest")printf("箱");
                    if(world[i][j]=="NetherBrick")printf("砖");
                }
                else
                {
                    if(Mob[i][j]=="Zombie")printf("尸");
                    if(Mob[i][j]=="Chicken")printf("鸡");
                    if(Mob[i][j]=="Sheep")printf("羊");
                    if(Mob[i][j]=="Cow")printf("牛");
                    if(Mob[i][j]=="Keeper")printf("卫");
                    if(Mob[i][j]=="Piglin"||Mob[i][j]=="Piglin2")printf("灵");
                    if(Mob[i][j]=="FireCharge")printf("焰");
                    if(Mob[i][j]=="FireChargeL")printf("焰");
                    if(Mob[i][j]=="FireChargeR")printf("焰");
                    if(Mob[i][j]=="Blaze")printf("烈");
                    if(Mob[i][j]=="Trader")printf("商");
                    if(Mob[i][j]=="Creeper")printf("苦");
                    if(Mob[i][j]=="EndonDragon")printf("龙");
                    if(Mob[i][j-1]=="EndonDragon")printf("龙");
                    if(Mob[i][j+1]=="EndonDragon")printf("龙");
                }
            }
            else printf("黑");
        }
        BColor(BLACK);
        printf("\n");
    }
    for(int i=0;i<9;i++)
    {
        if(i==Selected)BColor(WHITE);
        else BColor(BLACK);
        cout<<GetOutputPack(BackPack[i]);
        cout<<"×"<<PackCnt[i];
        BColor(BLACK);
        cout<<"   ";
    }
    cout<<"                       "<<endl;
    cout<<"Debug: Cursored Item: "<<world[CursorY][CursorX]<<" ";
    cout<<ID[CursorY][CursorX]<<"       "<<endl;
    cout<<"时间: "<<Time<<"   ";
    if(Time<250)cout<<"上午 (0-250)     ";
    else if(Time<500)cout<<"下午 (250-500)     ";
    else if(Time<600)cout<<"傍晚 (500-600)     ";
    else cout<<"晚上 (600-1000)     ";
    cout<<endl;
    //cout<<"Health: ";
    Color(CANYON,BLACK);
    if(Oxygen==10)cout<<"          ";
    if(Oxygen==9)cout<<"●●●●●●●●●";
    if(Oxygen==8)cout<<"●●●●●●●●";
    if(Oxygen==7)cout<<"●●●●●●●";
    if(Oxygen==6)cout<<"●●●●●●";
    if(Oxygen==5)cout<<"●●●●●";
    if(Oxygen==4)cout<<"●●●●";
    if(Oxygen==3)cout<<"●●●";
    if(Oxygen==2)cout<<"●●";
    if(Oxygen==1)cout<<"●";
    if(Oxygen==0)cout<<"——————————";
    Color(DARKGREY,BLACK);
    if(Oxygen==1)cout<<"●●●●●●●●●";
    if(Oxygen==2)cout<<"●●●●●●●●";
    if(Oxygen==3)cout<<"●●●●●●●";
    if(Oxygen==4)cout<<"●●●●●●";
    if(Oxygen==5)cout<<"●●●●●";
    if(Oxygen==6)cout<<"●●●●";
    if(Oxygen==7)cout<<"●●●";
    if(Oxygen==8)cout<<"●●";
    if(Oxygen==9)cout<<"●";
    if(Oxygen==10)cout<<"";
    Color(BLACK,BLACK);
    cout<<"    ";
    Color(LIGHTGREY,BLACK);
    if(1+Protection/2>=10)cout<<"●●●●●●●●●●";
    if(1+Protection/2==9)cout<<"●●●●●●●●●";
    if(1+Protection/2==8)cout<<"●●●●●●●●";
    if(1+Protection/2==7)cout<<"●●●●●●●";
    if(1+Protection/2==6)cout<<"●●●●●●";
    if(1+Protection/2==5)cout<<"●●●●●";
    if(1+Protection/2==4)cout<<"●●●●";
    if(1+Protection/2==3)cout<<"●●●";
    if(1+Protection/2==2)cout<<"●●";
    if(1+Protection/2==1)cout<<"●";
    if(1+Protection/2==0)cout<<"         ";
    Color(DARKGREY,BLACK);
    if(1+Protection/2==1)cout<<"●●●●●●●●●";
    if(1+Protection/2==2)cout<<"●●●●●●●●";
    if(1+Protection/2==3)cout<<"●●●●●●●";
    if(1+Protection/2==4)cout<<"●●●●●●";
    if(1+Protection/2==5)cout<<"●●●●●";
    if(1+Protection/2==6)cout<<"●●●●";
    if(1+Protection/2==7)cout<<"●●●";
    if(1+Protection/2==8)cout<<"●●";
    if(1+Protection/2==9)cout<<"●";
    if(1+Protection/2>=10)cout<<"";
    Color(BLACK,BLACK);
    cout<<endl;
    if(PlayerBeingDamaged)Color(WHITE,BLACK);
    else Color(RED,BLACK);
    PlayerBeingDamaged=0;
    if(PlayerHP==10)cout<<"●●●●●●●●●●";
    if(PlayerHP==9)cout<<"●●●●●●●●●";
    if(PlayerHP==8)cout<<"●●●●●●●●";
    if(PlayerHP==7)cout<<"●●●●●●●";
    if(PlayerHP==6)cout<<"●●●●●●";
    if(PlayerHP==5)cout<<"●●●●●";
    if(PlayerHP==4)cout<<"●●●●";
    if(PlayerHP==3)cout<<"●●●";
    if(PlayerHP==2)cout<<"●●";
    if(PlayerHP==1)cout<<"●";
    if(PlayerHP==0)cout<<"——————————";
    Color(DARKGREY,BLACK);
    if(PlayerHP==1)cout<<"●●●●●●●●●";
    if(PlayerHP==2)cout<<"●●●●●●●●";
    if(PlayerHP==3)cout<<"●●●●●●●";
    if(PlayerHP==4)cout<<"●●●●●●";
    if(PlayerHP==5)cout<<"●●●●●";
    if(PlayerHP==6)cout<<"●●●●";
    if(PlayerHP==7)cout<<"●●●";
    if(PlayerHP==8)cout<<"●●";
    if(PlayerHP==9)cout<<"●";
    if(PlayerHP==10)cout<<"";
    cout<<"    ";
    //cout<<"Hunger: ";
    Color(LIGHTYELLOW,BLACK);
    if(Hunger==10)cout<<"●●●●●●●●●●";
    if(Hunger==9)cout<<"●●●●●●●●●";
    if(Hunger==8)cout<<"●●●●●●●●";
    if(Hunger==7)cout<<"●●●●●●●";
    if(Hunger==6)cout<<"●●●●●●";
    if(Hunger==5)cout<<"●●●●●";
    if(Hunger==4)cout<<"●●●●";
    if(Hunger==3)cout<<"●●●";
    if(Hunger==2)cout<<"●●";
    if(Hunger==1)cout<<"●";
    if(Hunger==0)cout<<"——————————";
    Color(DARKGREY,BLACK);
    if(Hunger==1)cout<<"●●●●●●●●●";
    if(Hunger==2)cout<<"●●●●●●●●";
    if(Hunger==3)cout<<"●●●●●●●";
    if(Hunger==4)cout<<"●●●●●●";
    if(Hunger==5)cout<<"●●●●●";
    if(Hunger==6)cout<<"●●●●";
    if(Hunger==7)cout<<"●●●";
    if(Hunger==8)cout<<"●●";
    if(Hunger==9)cout<<"●";
    if(Hunger==10)cout<<"";
    BColor(BLACK);
    cout<<"             "<<endl;
    cout<<"X: "<<PlayerX<<"  Y: "<<PlayerY<<"          "<<endl;
    cout<<"CX: "<<CursorX<<"  CY: "<<CursorY<<"          "<<endl;
    cout<<"ID Max Count: "<<IDMaxCount<<"  Fall: "<<PlayerFall<<"          "<<endl;
}
void CheckTile()
{
    //Check Layer
    for(int i=PlayerY-RenderDistance;i<PlayerY+RenderDistance;i++)
    {
        if(i<1||i>GY-2)continue;
        for(int j=PlayerX-RenderDistance;j<PlayerX+RenderDistance;j++)
        {
            if(j<1||j>GX-2)continue;
            if(world[i][j]=="Air")Layer[i][j]=0;
            if(world[i][j]=="Grass")Layer[i][j]=0;
            if(world[i][j]=="Flower")Layer[i][j]=0;
            if(world[i][j]=="Dirt")Layer[i][j]=1;
            if(world[i][j]=="Stone")Layer[i][j]=1;
            if(world[i][j]=="Wood")Layer[i][j]=0;
            if(world[i][j]=="Leaf")Layer[i][j]=0;
            if(world[i][j]=="Sand")Layer[i][j]=1;
            if(world[i][j]=="WaterBucket")world[i][j]="Water";
            if(world[i][j]=="Water")Layer[i][j]=0;
            if(world[i][j]=="DeepStone")Layer[i][j]=1;
            if(world[i][j]=="LavaBucket")world[i][j]="Lava";
            if(world[i][j]=="Lava")Layer[i][j]=0;
            if(world[i][j]=="Fire")Layer[i][j]=0;
            if(world[i][j]=="Lamp")Layer[i][j]=0;
            if(world[i][j]=="Coal")Layer[i][j]=1;
            if(world[i][j]=="Iron")Layer[i][j]=1;
            if(world[i][j]=="Diamond")Layer[i][j]=1;
            if(world[i][j]=="Gold")Layer[i][j]=1;
            if(world[i][j]=="Brick")Layer[i][j]=1;
            if(world[i][j]=="Sheep")Layer[i][j]=0;
            if(world[i][j]=="Furnace")Layer[i][j]=0;
            if(world[i][j]=="CraftingTable")Layer[i][j]=0;
            if(world[i][j]=="Moss")Layer[i][j]=1;
            if(world[i][j][0]=='/')Layer[i][j]=1;
            if(world[i][j]=="Obsidian")
            {
                Layer[i][j]=0;
                if(world[i][j+2]=="Obsidian"&&world[i-1][j+1]=="Obsidian"&&world[i+1][j+1]==
                "Obsidian"&&(world[i][j+1]=="Air"||world[i][j+1]=="NetherPortal"))
                {
                    world[i][j+1]="NetherPortal";
                }
                else if(world[i][j+1]=="NetherPortal")world[i][j+1]="Air";
            }
            if(world[i][j]=="NetherPortal")Layer[i][j]=0;
            if(world[i][j]=="RedStone")Layer[i][j]=1;
            if(world[i][j]=="RedStoneDust")Layer[i][j]=0;
            if(world[i][j]=="Lever")Layer[i][j]=0;
            if(world[i][j]=="TNT")Layer[i][j]=1;
            if(world[i][j]=="PressurePlate")Layer[i][j]=1;
            if(world[i][j]=="Smoke2")Layer[i][j]=0;
            if(world[i][j]=="Smoke1")Layer[i][j]=0;
            if(world[i][j]=="MineCar")Layer[i][j]=1;
            if(world[i][j]=="MineTrack")Layer[i][j]=1;
            if(world[i][j]=="AprilFools1")Layer[i][j]=0;
            if(world[i][j]=="Nuke")Layer[i][j]=0;
            if(world[i][j]=="Piston")Layer[i][j]=1;
            if(world[i][j]=="Piston2")Layer[i][j]=1;
            if(world[i][j]=="EndRock")Layer[i][j]=1;
            if(world[i][j]=="EnderPortalFrame")Layer[i][j]=0;
            if(world[i][j]=="EnderPortalFrame2")
            {
                Layer[i][j]=0;
                if(world[i][j]=="EnderPortalFrame2"&&world[i][j-1]=="EnderPortalFrame2"
                &&world[i][j+3]=="EnderPortalFrame2"&&world[i][j+4]=="EnderPortalFrame2"
                &&world[i-1][j]=="EnderPortalFrame2"&&world[i+1][j]=="EnderPortalFrame2"
                &&world[i-1][j+1]=="EnderPortalFrame2"&&world[i+1][j+1]=="EnderPortalFrame2"
                &&world[i-1][j+2]=="EnderPortalFrame2"&&world[i+1][j+2]=="EnderPortalFrame2"
                &&world[i-1][j+3]=="EnderPortalFrame2"&&world[i+1][j+3]=="EnderPortalFrame2")
                {
                    world[i][j+1]="EndonPortal";
                    world[i][j+2]="EndonPortal";
                }
            }
            if(world[i][j]=="EndonGoblet")Layer[i][j]=0;
            if(world[i][j]=="AcientDebris")Layer[i][j]=1;
            if(world[i][j]=="Netherrack")Layer[i][j]=1;
            if(world[i][j]=="SoulSand")Layer[i][j]=1;
            if(world[i][j]=="SoulFire")Layer[i][j]=0;
            if(world[i][j]=="Shulker")Layer[i][j]=1;
            if(world[i][j]=="Chest")Layer[i][j]=0;
        }
    }
    //Check Duration
    for(int i=PlayerY-RenderDistance;i<PlayerY+RenderDistance;i++)
    {
        if(i<1||i>GY-2)continue;
        for(int j=PlayerX-RenderDistance;j<PlayerX+RenderDistance;j++)
        {
            if(j<1||j>GX-2)continue;
            if(world[i][j]=="Air")MaxDur[i][j]=0;
            if(world[i][j]=="Grass")MaxDur[i][j]=1;
            if(world[i][j]=="Flower")MaxDur[i][j]=1;
            if(world[i][j]=="Dirt")MaxDur[i][j]=3;
            if(world[i][j]=="Stone")MaxDur[i][j]=20;
            if(world[i][j]=="Wood")MaxDur[i][j]=7;
            if(world[i][j]=="Leaf")MaxDur[i][j]=1;
            if(world[i][j]=="Sand")MaxDur[i][j]=2;
            if(world[i][j]=="Water")MaxDur[i][j]=100;
            if(world[i][j]=="DeepStone")MaxDur[i][j]=20;
            if(world[i][j]=="Lava")MaxDur[i][j]=100;
            if(world[i][j]=="Fire")MaxDur[i][j]=1;
            if(world[i][j]=="Lamp")MaxDur[i][j]=3;
            if(world[i][j]=="Coal")MaxDur[i][j]=30;
            if(world[i][j]=="Iron")MaxDur[i][j]=40;
            if(world[i][j]=="Brick")MaxDur[i][j]=20;
            if(world[i][j]=="Diamond")MaxDur[i][j]=60;
            if(world[i][j]=="Gold")MaxDur[i][j]=40;
            if(world[i][j]=="Furnace")MaxDur[i][j]=3;
            if(world[i][j]=="CraftingTable")MaxDur[i][j]=3;
            if(world[i][j]=="Moss")MaxDur[i][j]=1;
            if(world[i][j]=="Obsidian")MaxDur[i][j]=70;
            if(world[i][j]=="NetherPortal")MaxDur[i][j]=30000;
            if(world[i][j][0]=='/')MaxDur[i][j]=100;
            if(world[i][j]=="RedStone")MaxDur[i][j]=30;
            if(world[i][j]=="RedStoneDust")MaxDur[i][j]=1;
            if(world[i][j]=="PressurePlate")MaxDur[i][j]=1;
            if(world[i][j]=="Lever")MaxDur[i][j]=1;
            if(world[i][j]=="TNT")MaxDur[i][j]=1;
            if(world[i][j]=="Smoke2")MaxDur[i][j]=114514;
            if(world[i][j]=="Smoke1")MaxDur[i][j]=114514;
            if(world[i][j]=="MineCar")MaxDur[i][j]=2;
            if(world[i][j]=="MineTrack")MaxDur[i][j]=1;
            if(world[i][j]=="AprilFools1")MaxDur[i][j]=114514;
            if(world[i][j]=="Nuke")MaxDur[i][j]=1;
            if(world[i][j]=="Piston")MaxDur[i][j]=5;
            if(world[i][j]=="Piston2")MaxDur[i][j]=114514,CurDur[i][j]=114514;
            if(world[i][j]=="EndRock")MaxDur[i][j]=30;
            if(world[i][j]=="EnderPortalFrame")MaxDur[i][j]=114514,CurDur[i][j]=114514;
            if(world[i][j]=="EnderPortalFrame2")MaxDur[i][j]=114514,CurDur[i][j]=114514;
            if(world[i][j]=="EndonGoblet")MaxDur[i][j]=114514,CurDur[i][j]=114514;
            if(world[i][j]=="Bed")
            {
                MaxDur[i][j]=3;
                if(CurrentWorld>0)CreateExplosion(i,j,3,3,50);
            }
            if(world[i][j]=="AcientDebris")MaxDur[i][j]=80;
            if(world[i][j]=="Netherrack")MaxDur[i][j]=30;
            if(world[i][j]=="Lava2")MaxDur[i][j]=114514,CurDur[i][j]=114514;
            if(world[i][j]=="Lava3")MaxDur[i][j]=114514,CurDur[i][j]=114514;
            if(world[i][j]=="Lava4")MaxDur[i][j]=114514,CurDur[i][j]=114514;
            if(world[i][j]=="Water2")MaxDur[i][j]=114514,CurDur[i][j]=114514;
            if(world[i][j]=="Water3")MaxDur[i][j]=114514,CurDur[i][j]=114514;
            if(world[i][j]=="Water4")MaxDur[i][j]=114514,CurDur[i][j]=114514;
            if(world[i][j]=="SoulFire")MaxDur[i][j]=1;
            if(world[i][j]=="SoulSand")MaxDur[i][j]=5;
            if(world[i][j]=="Shulker")MaxDur[i][j]=10;
            if(world[i][j]=="Chest")MaxDur[i][j]=10;
        }
    }
    //Check Current Duration
    for(int i=PlayerY-RenderDistance;i<PlayerY+RenderDistance;i++)
    {
        if(i<1||i>GY-2)continue;
        for(int j=PlayerX-RenderDistance;j<PlayerX+RenderDistance;j++)
        {
            if(j<1||j>GX-2)continue;
            if(!KEY_DOWN(VK_LBUTTON)&&GetKeyState(' ')>=0)
            {
                CurDur[i][j]=MaxDur[i][j];
            }
        }
    }
    //Check Block Movement
    for(int i=1;i<GY-1;i++)for(int j=1;j<GX-1;j++)BlockChecked[i][j]=0;

    for(int i=PlayerY-RenderDistance;i<PlayerY+RenderDistance;i++)
    {
        if(i<1||i>GY-2)continue;
        for(int j=PlayerX-RenderDistance;j<PlayerX+RenderDistance;j++)
        {
            if(j<1||j>GX-2)continue;
            if(BlockChecked[i][j]==0)
            {
                if(world[i][j]=="Shulker"&&Frame%20==0&&abs(PlayerY-i)+abs(PlayerX-j)<5)
                {
                    Death[1]=1;
                    MobDeathString="潜影贝"; 
                    if(Frame%2==1)PlayerBeingDamaged=1;
                    LastDamage=Frame;
                    PlayerHP--;
                    Jump=10;
                }
                //SoulFire
                if(world[i-1][j]=="SoulSand"&&rand()%10000==0)
                {
                    if(world[i][j]=="Air")world[i][j]="SoulFire";
                }
                //Sand
                if(world[i][j]=="Sand"&&(world[i-1][j]=="Air"||world[i-1][j]=="Grass"||
                world[i-1][j]=="Flower"))
                {
                    world[i][j]="Air";
                    world[i-1][j]="Sand";
                    BlockChecked[i-1][j]=1;
                }
                //Water4
                if((world[i][j][0]=='W'&&world[i][j][1]=='a'&&world[i][j][2]=='t')
                &&(world[i-1][j]=="Air"||world[i-1][j]=="Grass"||world[i-1][j]=="Flower"
                ||world[i-1][j]=="Lava"||world[i-1][j]=="Lava2"||world[i-1][j]=="Lava3"))
                {
                    if(world[i-1][j]=="Lava")world[i-1][j]="Obsidian";
                    else if(world[i-1][j]=="Lava2"||world[i-1][j]=="Lava3")world[i-1][j]="Stone";
                    else world[i-1][j]="Water4";
                    BlockChecked[i-1][j]=1;
                }
                //Water2
                if((world[i][j]=="Water"||world[i][j]=="Water4")&&Layer[i-1][j]==1&&
                (world[i][j-1]=="Air"||world[i][j-1]=="Grass"||world[i][j-1]=="Flower"
                ||world[i][j-1]=="Lava"||world[i][j-1]=="Lava2"||world[i][j-1]=="Lava3"))
                {
                    if(world[i][j-1]=="Lava")world[i][j-1]="Obsidian";
                    else if(world[i][j-1]=="Lava2"||world[i][j-1]=="Lava3")world[i][j-1]="Stone";
                    else world[i][j-1]="Water2";
                    BlockChecked[i][j-1]=1;
                }
                if((world[i][j]=="Water"||world[i][j]=="Water4")&&Layer[i-1][j]==1&&
                (world[i][j+1]=="Air"||world[i][j+1]=="Grass"||world[i][j+1]=="Flower"
                ||world[i][j+1]=="Lava"||world[i][j+1]=="Lava2"||world[i][j+1]=="Lava3"))
                {
                    if(world[i][j+1]=="Lava")world[i][j+1]="Obsidian";
                    else if(world[i][j+1]=="Lava2"||world[i][j+1]=="Lava3")world[i][j+1]="Stone";
                    else world[i][j+1]="Water2";
                    BlockChecked[i][j+1]=1;
                }
                //Water3
                if(world[i][j]=="Water2"&&Layer[i-1][j]==1&&(world[i][j-1]=="Air"||
                world[i][j-1]=="Grass"||world[i][j-1]=="Flower"||world[i][j-1]=="Lava"
                ||world[i][j-1]=="Lava2"||world[i][j-1]=="Lava3"))
                {
                    if(world[i][j-1]=="Lava")world[i][j-1]="Obsidian";
                    else if(world[i][j-1]=="Lava2"||world[i][j-1]=="Lava3")world[i][j-1]="Stone";
                    else world[i][j-1]="Water3";
                    BlockChecked[i][j-1]=1;
                }
                // Stone Generator
                if(world[i][j]=="Water2"&&Layer[i-1][j]==1&&(world[i][j+1]=="Air"||
                world[i][j+1]=="Grass"||world[i][j+1]=="Flower"||world[i][j+1]=="Lava"
                ||world[i][j+1]=="Lava2"||world[i][j+1]=="Lava3"))
                {
                    if(world[i][j+1]=="Lava")world[i][j+1]="Obsidian";
                    else if(world[i][j+1]=="Lava2"||world[i][j+1]=="Lava3")world[i][j+1]="Stone";
                    else world[i][j+1]="Water3";
                    BlockChecked[i][j]=1;
                    BlockChecked[i][j+1]=1;
                }
                //Kill Water4
                if(world[i][j]=="Water4"&&world[i+1][j]!="Water4"&&world[i+1][j]!="Water3"
                &&world[i+1][j]!="Water2"&&world[i+1][j]!="Water")world[i][j]="Air";
                //Kill Water2
                if(world[i][j]=="Water2"&&world[i][j+1]!="Water4"&&world[i][j-1]!="Water4"
                &&world[i][j+1]!="Water"&&world[i][j-1]!="Water")world[i][j]="Air";
                //Kill Water3
                if(world[i][j]=="Water3"&&world[i][j+1]!="Water2"&&world[i][j-1]!="Water2")
                world[i][j]="Air";
                //April Fools
                if(world[i][j]=="AprilFools1")
                {
                    if(world[i+1][j]!="Diamond"||world[i+1][j-1]!="Diamond"
                    ||world[i+1][j+1]!="Diamond"||world[i+2][j]!="Diamond")
                    {
                        world[i][j]="Nuke";
                        world[i-1][j]="RedStone";
                    }
                }
                //Lava3 Down
                if((world[i][j]=="Lava"||world[i][j]=="Lava2"||world[i][j]=="Lava3")&&
                (world[i-1][j]=="Air"||world[i-1][j]=="Grass"||world[i-1][j]=="Flower"||
                world[i-1][j]=="Wood"||world[i-1][j]=="Lamp"||world[i-1][j]=="Coal"||
                world[i-1][j]=="TNT"||world[i-1][j]=="Leaf"))
                {
                    if(world[i-1][j]=="Water"||world[i-1][j]=="Water2"||world[i-1][j]=="Water3"
                    ||world[i-1][j]=="Water4")world[i-1][j]="Stone";
                    else world[i-1][j]="Lava3";
                    BlockChecked[i-1][j]=1;
                }
                //Lava2 Left/Right
                if((world[i][j]=="Lava"||world[i][j]=="Lava3")&&Layer[i-1][j]==1&&
                (world[i][j-1]=="Air"||world[i][j-1]=="Grass"||world[i][j-1]=="Flower"||
                world[i][j-1]=="Wood"||world[i][j-1]=="Lamp"||world[i][j-1]=="Coal"||
                world[i][j-1]=="TNT"||world[i][j-1]=="Leaf"))
                {
                    if(world[i][j-1]=="Water"||world[i][j-1]=="Water2"||world[i][j-1]=="Water3"
                    ||world[i][j-1]=="Water4")world[i][j-1]="Stone";
                    else world[i][j-1]="Lava2";
                    BlockChecked[i][j-1]=1;
                }
                if((world[i][j]=="Lava"||world[i][j]=="Lava3")&&Layer[i-1][j]==1&&
                (world[i][j+1]=="Air"||world[i][j+1]=="Grass"||world[i][j+1]=="Flower"||
                world[i][j+1]=="Wood"||world[i][j+1]=="Lamp"||world[i][j+1]=="Coal"||
                world[i][j+1]=="TNT"||world[i][j+1]=="Leaf"))
                {
                    if(world[i][j+1]=="Water"||world[i][j+1]=="Water2"||world[i][j+1]=="Water3"
                    ||world[i][j+1]=="Water4")world[i][j+1]="Stone";
                    else world[i][j+1]="Lava2";
                    BlockChecked[i][j+1]=1;
                }
                //Kill Lava2
                if(world[i][j]=="Lava2"&&world[i][j+1]!="Lava3"&&world[i][j-1]!="Lava3"
                &&world[i][j+1]!="Lava"&&world[i][j-1]!="Lava")
                world[i][j]="Air";
                //Kill Lava3
                if(world[i][j]=="Lava3"&&world[i+1][j]!="Lava"&&world[i+1][j]!="Lava3"
                &&world[i+1][j]!="Lava2")
                world[i][j]="Air";
            }
        }
    }
}
void Craft()
{
    int CraftBar=1;
    if(world[CursorY][CursorX]=="Lever")
    {
        RedStone[CursorY][CursorX]=1;
        while(GetKeyState('E')<0);
        cls();
    }
    else if(world[CursorY][CursorX][0]=='!'&&PlayerMode=="Creative")
    {
        cls();
        if(world[CursorY][CursorX]=="/")cout<<"输入命令:";
        else cout<<"替换命令:"<<endl<<world[CursorY][CursorX]<<endl;
        cout<<"空格请用下划线 _ 替代"<<endl;
        string str;
        cin>>str;
        cin>>str;
        world[CursorY][CursorX]='!'+str;
        cls();
    }
    else if(world[CursorY][CursorX]=="Bed")
    {
        if(Time>550)
        {
            Time=0;
            PlayerHP=10;
            cls();
            cout<<"ZzZzZzZzZ......";
            Sleep(5000);
            cls();
        }
        else
        {
            cls();
            cout<<"You can only sleep at night!";
            Sleep(1000);
            cls();
        }
        SpawnX=CursorX;SpawnY=CursorY;SpawnWorld=CurrentWorld;
        cls();
    }
    else if(Mob[CursorY][CursorX]=="Trader")
    {
        cls();
        bool buy[10];
        for(int i=0;i<10;i++)buy[i]=rand()%2;
        buy[0]=1;
        while(GetKeyState('E')<0);
        while(GetKeyState('E')>=0)
        {
            CraftBar=(GetSubY())/GridZ-1;
            gotoxy(0,0);
            for(int i=0;i<10;i++)
            {
                if(i==CraftBar)BColor(WHITE);
                else BColor(BLACK);
                {
                    if(i==0)cout<<"绿宝石×1           砖×64";
                    if(i==1)cout<<"绿宝石×1           煤×1";
                    if(i==2)cout<<"绿宝石×2           铁锭×1";
                    if(i==3)cout<<"绿宝石×2           金锭×1";
                    if(i==4)cout<<"绿宝石×1           烈焰粉×1";
                    if(i==5)cout<<"末影珍珠×1         绿宝石×3";
                    if(i==6)cout<<"铁锭×1             绿宝石×2";
                    if(i==7)cout<<"桶×1               绿宝石×6";
                    if(i==8)cout<<"绿宝石×1           鸡肉×3";
                    if(i==9)cout<<"木头×1             绿宝石×1";
                }
                if(i==CraftBar)
                {
                    cout<<"  鼠标制作";
                }
                BColor(BLACK);cout<<"              ";
                cout<<endl;
            }
            cout<<endl<<"背包"<<endl;
            for(int i=0;i<9;i++)
            {
                cout<<GetOutputPack(BackPack[i]);
                cout<<"×"<<PackCnt[i];
                BColor(BLACK);
                cout<<"   ";
            }
            if(KEY_DOWN(VK_LBUTTON))
            {
                while(KEY_DOWN(VK_LBUTTON));
                if(CraftBar==0)
                {
                    if(PackInclude("Brick",64))
                    {
                        DeletePack("Brick",64);
                        AddToPack("Emerald",0);
                    }
                }
                if(CraftBar==1)
                {
                    if(PackInclude("Coal"))
                    {
                        DeletePack("Coal");
                        AddToPack("Emerald",0);
                    }
                }
                if(CraftBar==2)
                {
                    if(PackInclude("IronIgnot"))
                    {
                        DeletePack("IronIgnot");
                        AddToPack("Emerald",2,0);
                    }
                }
                if(CraftBar==3)
                {
                    if(PackInclude("GoldIgnot"))
                    {
                        DeletePack("GoldIgnot");
                        AddToPack("Emerald",2,0);
                    }
                }
                if(CraftBar==4)
                {
                    if(PackInclude("BlazePowder"))
                    {
                        DeletePack("BlazePowder");
                        AddToPack("Emerald",0);
                    }
                }
                if(CraftBar==5)
                {
                    if(PackInclude("Emerald",3))
                    {
                        DeletePack("Emerald",3);
                        AddToPack("EnderPearl",1);
                    }
                }
                if(CraftBar==6)
                {
                    if(PackInclude("Emerald",2))
                    {
                        DeletePack("Emerald",2);
                        AddToPack("IronIgnot",0);
                    }
                }
                if(CraftBar==7)
                {
                    if(PackInclude("Emerald",6))
                    {
                        DeletePack("Emerald",6);
                        AddToPack("Bucket",0);
                    }
                }
                if(CraftBar==8)
                {
                    if(PackInclude("Chicken",3))
                    {
                        DeletePack("Chicken",3);
                        AddToPack("Emerald",0);
                    }
                }
                if(CraftBar==9)
                {
                    if(PackInclude("Emerald"))
                    {
                        DeletePack("Emerald");
                        AddToPack("Wood",1);
                    }
                }
            } 
        }
        cls();
        while(GetKeyState('E')<0);
    }
    else if(world[CursorY][CursorX]=="Chest")
    {
        cls();
        while(GetKeyState('E')<0);
        while(GetKeyState('E')>=0)
        {
            CraftBar=(GetSubY())/GridZ-1;
            gotoxy(0,0);
            cout<<"箱子(按下空格来拾取单个物品)"<<endl;
            for(int i=0;i<9;i++)
            {
                if(IDItem[ID[CursorY][CursorX]][i]=="")IDItem[ID[CursorY][CursorX]][i]="Air";
                if(IDCount[ID[CursorY][CursorX]][i]<1)
                {
                    IDItem[ID[CursorY][CursorX]][i]="Air";
                    IDCount[ID[CursorY][CursorX]][i]=0;
                }
                if(i==CraftBar)BColor(WHITE);
                else BColor(BLACK);
                cout<<GetOutputPack(IDItem[ID[CursorY][CursorX]][i]);
                cout<<"×"<<IDCount[ID[CursorY][CursorX]][i];
                if(i==CraftBar)cout<<"  按下鼠标拾取";
                else cout<<"                              ";
                BColor(BLACK);
                cout<<endl;
            }
            cout<<endl<<"背包(按下1-9键来放入箱子)"<<endl;
            for(int i=0;i<9;i++)
            {
                if(PackCnt[i]<1)
                {
                    BackPack[i]="Air";
                    PackStatus[i]=0;
                    PackCnt[i]=0;
                }
                cout<<GetOutputPack(BackPack[i]);
                cout<<"×"<<PackCnt[i];
                BColor(BLACK);
                cout<<"   ";
            }
            for(int key='1';key<='9';key++)
            {
                if(GetKeyState(key)<0)
                {
                    while(GetKeyState(key)<0);
                    for(int i=0;i<9;i++)
                    {
                        if(IDItem[ID[CursorY][CursorX]][i]=="Air"||IDItem[ID[CursorY][CursorX]][i]
                        ==BackPack[key-'1'])
                        {
                            if(GetKeyState(' ')<0)
                            {
                                IDItem[ID[CursorY][CursorX]][i]=BackPack[key-'1'];
                                IDStatus[ID[CursorY][CursorX]][i]=PackStatus[key-'1'];
                                IDCount[ID[CursorY][CursorX]][i]++;
                                PackCnt[key-'1']--;
                                if(PackCnt[key-'1']<1)
                                {
                                    BackPack[key-'1']="Air";
                                    PackStatus[key-'1']=0;
                                }
                            }
                            else
                            {
                                IDItem[ID[CursorY][CursorX]][i]=BackPack[key-'1'];
                                IDStatus[ID[CursorY][CursorX]][i]=PackStatus[key-'1'];
                                IDCount[ID[CursorY][CursorX]][i]+=PackCnt[key-'1'];
                                PackCnt[key-'1']=0;
                                BackPack[key-'1']="Air";
                                PackStatus[key-'1']=0;
                            }
                        }
                    }
                }
            }
            if(KEY_DOWN(VK_LBUTTON))
            {
                while(KEY_DOWN(VK_LBUTTON));
                if(CraftBar>9||CraftBar<0)continue;
                if(GetKeyState(' ')<0)
                {
                    AddToPack(IDItem[ID[CursorY][CursorX]][CraftBar],IDStatus[ID[CursorY][CursorX]]
                    [CraftBar]);
                    IDCount[ID[CursorY][CursorX]][CraftBar]--;
                    if(IDCount[ID[CursorY][CursorX]][CraftBar]<1)
                    {
                        IDItem[ID[CursorY][CursorX]][CraftBar]="Air";
                    }
                }
                else
                {
                    AddToPack(IDItem[ID[CursorY][CursorX]][CraftBar],IDCount[ID[CursorY][CursorX]]
                    [CraftBar],IDStatus[ID[CursorY][CursorX]][CraftBar]);
                    IDItem[ID[CursorY][CursorX]][CraftBar]="Air";
                    IDCount[ID[CursorY][CursorX]][CraftBar]=0;
                }
            }
        }
        while(GetKeyState('E')<0);
    }
    else if(world[CursorY][CursorX]=="RedStoneTable")
    {
        cls();
        while(GetKeyState('E')<0);
        while(GetKeyState('E')>=0)
        {
            CraftBar=(GetSubY())/GridZ-1;
            gotoxy(0,0);
            for(int i=0;i<7;i++)
            {
                if(i==CraftBar)BColor(WHITE);
                else BColor(BLACK);
                {
                    if(i==0)cout<<"红石块×1           红石粉×9";
                    if(i==1)cout<<"拉杆×1             棍×1  石×2";
                    if(i==2)cout<<"压力板×1           石×2";
                    if(i==3)cout<<"TNT×1              火药×5  沙子×4";
                    if(i==4)cout<<"矿车×1             铁锭×5";
                    if(i==5)cout<<"轨道×4             铁锭×6  棍×3";
                    if(i==6)cout<<"红石粉×9           红石块×1";
                    if(i==7)cout<<"                    ";
                    if(i==8)cout<<"                    ";
                }
                if(i==CraftBar)
                {
                    cout<<"  按下鼠标制作";
                }
                BColor(BLACK);cout<<"              ";
                cout<<endl;
            }
            cout<<endl<<"背包"<<endl;
            for(int i=0;i<9;i++)
            {
                cout<<GetOutputPack(BackPack[i]);
                cout<<"×"<<PackCnt[i];
                BColor(BLACK);
                cout<<"   ";
            }
            if(KEY_DOWN(VK_LBUTTON))
            {
                while(KEY_DOWN(VK_LBUTTON));
                if(CraftBar==0)
                {
                    if(PackInclude("RedStoneDust",9))
                    {
                        DeletePack("RedStoneDust",9);
                        AddToPack("RedStone",1);
                    } 
                }
                if(CraftBar==1)
                {
                    if(PackInclude("Lever",9))
                    {
                        DeletePack("Stick");
                        DeletePack("Stone",2);
                        AddToPack("RedStone",1);
                    } 
                }
                if(CraftBar==2)
                {
                    if(PackInclude("Stone",2))
                    {
                        DeletePack("Stone",2);
                        AddToPack("PressurePlate",1);
                    } 
                }
                if(CraftBar==3)
                {
                    if(PackInclude("GunPowder",5)&&PackInclude("Sand",4))
                    {
                        DeletePack("GunPowder",5);
                        DeletePack("Sand",4);
                        AddToPack("TNT",1);
                    } 
                }
                if(CraftBar==4)
                {
                    if(PackInclude("IronIgnot",5))
                    {
                        DeletePack("IronIgnot",5);
                        AddToPack("MineCar",1);
                    } 
                }
                if(CraftBar==5)
                {
                    if(PackInclude("IronIgnot",6)&&PackInclude("Stick",3))
                    {
                        DeletePack("IronIgnot",6);
                        DeletePack("Stick",3);
                        AddToPack("MineTrack",4);
                    } 
                }
                if(CraftBar==6)
                {
                    if(PackInclude("RedStone"))
                    {
                        DeletePack("RedStone");
                        AddToPack("RedStoneDust",9);
                    } 
                }
            }
        }
        cls();
        while(GetKeyState('E')<0);
    }
    else if(world[CursorY][CursorX]=="CraftingTable")
    {
        cls();
        while(GetKeyState('E')<0);
        while(GetKeyState('E')>=0)
        {
            CraftBar=(GetSubY())/GridZ-1;
            gotoxy(0,0);
            for(int i=0;i<30;i++)
            {
                if(i==CraftBar)BColor(WHITE);
                else BColor(BLACK);
                {
                    if(i==0)cout<<"砖×4               木×1";
                    if(i==1)cout<<"砖×4               石×1";
                    if(i==2)cout<<"木镐×1             木×1  棍×2";
                    if(i==3)cout<<"木斧×1             木×1  棍×2";
                    if(i==4)cout<<"木剑×1             木×1  棍×1";
                    if(i==5)cout<<"木铲×1             木×1  棍×1";
                    if(i==6)cout<<"石镐×1             石×3  棍×2";
                    if(i==7)cout<<"石斧×1             石×3  棍×2";
                    if(i==8)cout<<"石剑×1             石×2  棍×1";
                    if(i==9)cout<<"石铲×1             石×2  棍×1";
                    if(i==10)cout<<"铁镐×1             铁锭×3  棍×2";
                    if(i==11)cout<<"铁斧×1             铁锭×3  棍×2";
                    if(i==12)cout<<"铁剑×1             铁锭×2  棍×1";
                    if(i==13)cout<<"铁铲×1             铁锭×2  棍×1";
                    if(i==14)cout<<"钻镐×1             钻×3  棍×2";
                    if(i==15)cout<<"钻斧×1             钻×3  棍×2";
                    if(i==16)cout<<"钻剑×1             钻×2  棍×1";
                    if(i==17)cout<<"钻铲×1             钻×2  棍×1";
                    if(i==18)cout<<"金镐×1             金锭×3  棍×2";
                    if(i==19)cout<<"金斧×1             金锭×3  棍×2";
                    if(i==20)cout<<"金剑×1             金锭×2  棍×1";
                    if(i==21)cout<<"金铲×1             金锭×2  棍×1";
                    if(i==22)cout<<"熔炉×1             石×8";
                    if(i==23)cout<<"床×1               羊毛×3  木×1";
                    if(i==24)cout<<"高级工作台×1       木×1  砖×4";
                    if(i==25)cout<<"红石研制台×1       铁锭×4  砖×4";
                    if(i==26)cout<<"附魔台×1           黑曜石×3  钻×3";
                    if(i==27)cout<<"实验台×1           黑曜石×3  高级工作台×1";
                    if(i==28)cout<<"铁桶×1             铁锭×3";
                //if(i==29)cout<<"命令方块×1         钻×10  铁锭×20  附魔台×3  黑曜石×8";
                }
                if(i==CraftBar)
                {
                    cout<<"  空格键制作";
                }
                BColor(BLACK);cout<<"              ";
                cout<<endl;
            }
            cout<<endl<<"背包"<<endl;
            for(int i=0;i<9;i++)
            {
                cout<<GetOutputPack(BackPack[i]);
                cout<<"×"<<PackCnt[i];
                BColor(BLACK);
                cout<<"   ";
            }
            if(KEY_DOWN(VK_LBUTTON))
            {
                while(KEY_DOWN(VK_LBUTTON));
                if(CraftBar==0)
                {
                    if(PackInclude("Wood"))
                    {
                        DeletePack("Wood");
                        AddToPack("Brick",4,1);
                    } 
                }
                if(CraftBar==1)
                {
                    if(PackInclude("Stone"))
                    {
                        DeletePack("Stone");
                        AddToPack("Brick",4,1);
                    }
                }
                if(CraftBar==2)
                {
                    if(PackInclude("Wood")&&PackInclude("Stick",2))
                    {
                        DeletePack("Wood");
                        DeletePack("Stick",2);
                        AddToPack("WoodenPickaxe",0);
                    }
                }
                if(CraftBar==3)
                {
                    if(PackInclude("Wood")&&PackInclude("Stick",2))
                    {
                        DeletePack("Wood");
                        DeletePack("Stick",2);
                        AddToPack("WoodenAxe",0);
                    }

                }
                if(CraftBar==4)
                {
                    if(PackInclude("Wood")&&PackInclude("Stick"))
                    {
                        DeletePack("Wood");
                        DeletePack("Stick");
                        AddToPack("WoodenSword",0);
                    }
                }
                if(CraftBar==5)
                {
                    if(PackInclude("Wood")&&PackInclude("Stick"))
                    {
                        DeletePack("Wood");
                        DeletePack("Stick");
                        AddToPack("WoodenShovel",0);
                    }
                }
                if(CraftBar==6)
                {
                    if(PackInclude("Stone",3)&&PackInclude("Stick",2))
                    {
                        DeletePack("Stone",3);
                        DeletePack("Stick",2);
                        AddToPack("StonePickaxe",0);
                    }
                }
                if(CraftBar==7)
                {
                    if(PackInclude("Stone",3)&&PackInclude("Stick",2))
                    {
                        DeletePack("Stone",3);
                        DeletePack("Stick",2);
                        AddToPack("StoneAxe",0);
                    }
                }
                if(CraftBar==8)
                {
                    if(PackInclude("Stone",3)&&PackInclude("Stick"))
                    {
                        DeletePack("Stone",3);
                        DeletePack("Stick");
                        AddToPack("StoneSword",0);
                    }
                }
                if(CraftBar==9)
                {
                    if(PackInclude("Stone",3)&&PackInclude("Stick"))
                    {
                        DeletePack("Stone",3);
                        DeletePack("Stick");
                        AddToPack("StoneShovel",0);
                    }
                }
                if(CraftBar==10)
                {
                    if(PackInclude("IronIgnot",3)&&PackInclude("Stick",2))
                    {
                        DeletePack("IronIgnot",3);
                        DeletePack("Stick",2);
                        AddToPack("IronPickaxe",0);
                    }
                }
                if(CraftBar==11)
                {
                    if(PackInclude("IronIgnot",3)&&PackInclude("Stick",2))
                    {
                        DeletePack("IronIgnot",3);
                        DeletePack("Stick",2);
                        AddToPack("IronAxe",0);
                    }
                }
                if(CraftBar==12)
                {
                    if(PackInclude("IronIgnot",2)&&PackInclude("Stick"))
                    {
                        DeletePack("IronIgnot",2);
                        DeletePack("Stick");
                        AddToPack("IronSword",0);
                    }
                }
                if(CraftBar==13)
                {
                    if(PackInclude("IronIgnot",2)&&PackInclude("Stick"))
                    {
                        DeletePack("IronIgnot",2);
                        DeletePack("Stick");
                        AddToPack("IronShovel",0);
                    }
                }
                if(CraftBar==14)
                {
                    if(PackInclude("Diamond",3)&&PackInclude("Stick",2))
                    {
                        DeletePack("Diamond",3);
                        DeletePack("Stick",2);
                        AddToPack("DiamondPickaxe",0);
                    }
                }
                if(CraftBar==15)
                {
                    if(PackInclude("Diamond",3)&&PackInclude("Stick",2))
                    {
                        DeletePack("Diamond",3);
                        DeletePack("Stick",2);
                        AddToPack("DiamondAxe",0);
                    }
                }
                if(CraftBar==16)
                {
                    if(PackInclude("Diamond",2)&&PackInclude("Stick"))
                    {
                        DeletePack("Diamond",2);
                        DeletePack("Stick");
                        AddToPack("DiamondSword",0);
                    }
                }
                if(CraftBar==17)
                {
                    if(PackInclude("Diamond",2)&&PackInclude("Stick"))
                    {
                        DeletePack("Diamond",2);
                        DeletePack("Stick");
                        AddToPack("DiamondShovel",0);
                    }
                }
                if(CraftBar==18)
                {
                    if(PackInclude("GoldIgnot",3)&&PackInclude("Stick",2))
                    {
                        DeletePack("GoldIgnot",3);
                        DeletePack("Stick",2);
                        AddToPack("GoldenPickaxe",0);
                    }
                }
                if(CraftBar==19)
                {
                    if(PackInclude("GoldIgnot",3)&&PackInclude("Stick",2))
                    {
                        DeletePack("GoldIgnot",3);
                        DeletePack("Stick",2);
                        AddToPack("GoldenAxe",0);
                    }
                }
                if(CraftBar==20)
                {
                    if(PackInclude("GoldIgnot",2)&&PackInclude("Stick"))
                    {
                        DeletePack("GoldIgnot",2);
                        DeletePack("Stick");
                        AddToPack("GoldenSword",0);
                    }
                }
                if(CraftBar==21)
                {
                    if(PackInclude("GoldIgnot",2)&&PackInclude("Stick"))
                    {
                        DeletePack("GoldIgnot",2);
                        DeletePack("Stick");
                        AddToPack("GoldenShovel",0);
                    }
                }
                if(CraftBar==22)
                {
                    if(PackInclude("Stone",8))
                    {
                        DeletePack("Stone",8);
                        AddToPack("Furnace",1);
                    }
                }
                if(CraftBar==23)
                {
                    if(PackInclude("Wool",3)&&PackInclude("Wood"))
                    {
                        DeletePack("Wool",3);
                        DeletePack("Wood");
                        AddToPack("Bed",1);
                    }
                }
                if(CraftBar==24)
                {
                    if(PackInclude("Wood")&&PackInclude("Brick",4))
                    {
                        DeletePack("Wood");
                        DeletePack("Brick",4);
                        AddToPack("CraftingTable2",1);
                    }
                }
                if(CraftBar==25)
                {
                    if(PackInclude("IronIgnot",4)&&PackInclude("Brick",4))
                    {
                        DeletePack("IronIgnot",4);
                        DeletePack("Brick",4);
                        AddToPack("RedStoneTable",1);
                    }
                }
                if(CraftBar==26)
                {
                    if(PackInclude("Diamond",3)&&PackInclude("Obsidian",3))
                    {
                        DeletePack("Diamond",3);
                        DeletePack("Obsidian",3);
                        AddToPack("EnchantingTable",1);
                    }
                }
                if(CraftBar==27)
                {
                    if(PackInclude("Obsidian",3)&&PackInclude("CraftingTable2"))
                    {
                        DeletePack("Obsidian",3);
                        DeletePack("CraftingTable2");
                        AddToPack("ExperimentTable",1);
                    }
                }
                if(CraftBar==28)
                {
                    if(PackInclude("IronIgnot",3))
                    {
                        DeletePack("IronIgnot",3);
                        AddUnpackable("Bucket",0);
                    }
                }
                /*if(CraftBar==29)
                {
                    if(PackInclude("Diamond",10)&&PackInclude("IronIgnot",20)&&
                    PackInclude("EnchantingTable",3)&&PackInclude("Obsidian",8))
                    {
                        DeletePack("Diamond",10);
                        DeletePack("IronIgnot",20);
                        DeletePack("EnchantingTable",3);
                        DeletePack("Obsidian",8);
                        AddToPack("CommandBlock",1);
                    }
                }*/
            }
        }
        cls();
        while(GetKeyState('E')<0);
    }
    else if(world[CursorY][CursorX]=="Furnace")
    {
        cls();
        while(GetKeyState('E')<0);
        while(GetKeyState('E')>=0)
        {
            CraftBar=(GetSubY())/GridZ-1;
            gotoxy(0,0);

            for(int i=0;i<10;i++)
            {
                if(i==CraftBar)BColor(WHITE);
                else BColor(BLACK);
                {
                    if(i==0)cout<<"燃料×4             木×1";
                    if(i==1)cout<<"燃料×8             煤×1";
                    if(i==2)cout<<"煤×1               木×1  燃料×1";
                    if(i==3)cout<<"铁锭×1             铁×1  燃料×1";
                    if(i==4)cout<<"金锭×1             金×1  燃料×1";
                    if(i==5)cout<<"烤羊肉×1           生羊肉×1  燃料×1";
                    if(i==6)cout<<"烤牛肉×1           生牛肉×1  燃料×1";
                    if(i==7)cout<<"烤鸡肉×1           生鸡肉×1  燃料×1";
                    if(i==8)cout<<"下界合金锭×1       远古残骸×1  燃料×1";
                    if(i==9)cout<<"";
                }
                if(i==CraftBar)
                {
                    cout<<"  空格键制作";
                }
                BColor(BLACK);cout<<"              ";
                cout<<endl;
            }
            cout<<endl<<"背包"<<endl;
            for(int i=0;i<9;i++)
            {
                cout<<GetOutputPack(BackPack[i]);
                cout<<"×"<<PackCnt[i];
                BColor(BLACK);
                cout<<"   ";
            }
            if(KEY_DOWN(VK_LBUTTON))
            {
                if(CraftBar==0)
                {
                    if(PackInclude("Wood"))
                    {
                        DeletePack("Wood");
                        FurnaceFuel+=4;
                    }
                }
                if(CraftBar==1)
                {
                    if(PackInclude("Coal"))
                    {
                        DeletePack("Coal");
                        FurnaceFuel+=8;
                    }
                }
                if(CraftBar==2)
                {
                    if(PackInclude("Wood")&&FurnaceFuel>=1)
                    {
                        DeletePack("Wood");
                        AddToPack("Coal",0);
                        FurnaceFuel-=1;
                    }
                }
                if(CraftBar==3)
                {
                    if(PackInclude("Iron")&&FurnaceFuel>=1)
                    {
                        DeletePack("Iron");
                        AddToPack("IronIgnot",0);
                        FurnaceFuel-=1;
                    }
                }
                if(CraftBar==4)
                {
                    if(PackInclude("Gold")&&FurnaceFuel>=1)
                    {
                        DeletePack("Gold");
                        AddToPack("GoldIgnot",0);
                        FurnaceFuel-=1;
                    }
                }
                if(CraftBar==5)
                {
                    if(PackInclude("Mutton")&&FurnaceFuel>=1)
                    {
                        DeletePack("Mutton");
                        AddToPack("RoastedMutton",2);
                        FurnaceFuel-=1;
                    }
                }
                if(CraftBar==6)
                {
                    if(PackInclude("Beef")&&FurnaceFuel>=1)
                    {
                        DeletePack("Beef");
                        AddToPack("RoastedBeef",2);
                        FurnaceFuel-=1;
                    }
                }
                if(CraftBar==7)
                {
                    if(PackInclude("Chicken")&&FurnaceFuel>=1)
                    {
                        DeletePack("Chicken");
                        AddToPack("RoastedChicken",2);
                        FurnaceFuel-=1;
                    }
                }
                if(CraftBar==8)
                {
                    if(PackInclude("AcientDebris")&&FurnaceFuel>=1)
                    {
                        DeletePack("AcientDebris");
                        AddToPack("NetheriteIgnot",0);
                        FurnaceFuel-=1;
                    }
                }
            }
        }
        cls();
        while(GetKeyState('E')<0);
    }
    else if(world[CursorY][CursorX]=="CraftingTable2")
    {
        cls();
        while(GetKeyState('E')<0);
        while(GetKeyState('E')>=0)
        {
            CraftBar=(GetSubY())/GridZ-1;
            gotoxy(0,0);
            for(int i=0;i<21;i++)
            {
                if(i==CraftBar)BColor(WHITE);
                else BColor(BLACK);
                {
                    if(i==0)cout<<"烈焰粉×1           烈焰棒×1";
                    if(i==1)cout<<"末影之眼×1         末影珍珠×1  烈焰粉×1";
                    if(i==2)cout<<"下界合金剑×1       下界合金锭×2  木棍×1";
                    if(i==3)cout<<"下界合金斧×1       下界合金锭×3  木棍×2";
                    if(i==4)cout<<"下界合金镐×1       下界合金锭×3  木棍×2";
                    if(i==5)cout<<"下界合金铲×1       下界合金锭×1  木棍×2";
                    if(i==6)cout<<"皮革帽×1           皮革×5";
                    if(i==7)cout<<"皮革上衣×1         皮革×8";
                    if(i==8)cout<<"皮革裤×1           皮革×7";
                    if(i==9)cout<<"皮革靴×1           皮革×4";
                    if(i==10)cout<<"铁头盔×1           铁锭×5";
                    if(i==11)cout<<"铁胸甲×1           铁锭×8";
                    if(i==12)cout<<"铁护腿×1           铁锭×7";
                    if(i==13)cout<<"铁靴子×1           铁锭×4";
                    if(i==14)cout<<"钻石头盔×1         钻×5";
                    if(i==15)cout<<"钻石胸甲×1         钻×8";
                    if(i==16)cout<<"钻石护腿×1         钻×7";
                    if(i==17)cout<<"钻石靴×1           钻×4";
                    if(i==18)cout<<"下界合金头盔×1     下界合金锭×5";
                    if(i==19)cout<<"下界合金胸甲×1     下界合金锭×8";
                    if(i==20)cout<<"下界合金护腿×1     下界合金锭×7";
                    if(i==21)cout<<"下界合金靴×1       下界合金锭×4";
                }
                if(i==CraftBar)
                {
                    cout<<"  鼠标制作";
                }
                BColor(BLACK);cout<<"              ";
                cout<<endl;
            }
            cout<<endl<<"背包"<<endl;
            for(int i=0;i<9;i++)
            {
                cout<<GetOutputPack(BackPack[i]);
                cout<<"×"<<PackCnt[i];
                BColor(BLACK);
                cout<<"   ";
            }
            if(KEY_DOWN(VK_LBUTTON))
            {
                while(KEY_DOWN(VK_LBUTTON));
                if(CraftBar==0)
                {
                    if(PackInclude("BlazeRod"))
                    {
                        DeletePack("BlazeRod");
                        AddToPack("BlazePowder",0);
                    }
                }
                if(CraftBar==1)
                {
                    if(PackInclude("EnderPearl")&&PackInclude("BlazePowder"))
                    {
                        DeletePack("EnderPearl");
                        DeletePack("BlazePowder");
                        AddToPack("EnderEye",0);
                    }
                }
                if(CraftBar==2)
                {
                    if(PackInclude("NetheriteIgnot",2)&&PackInclude("Stick",1))
                    {
                        DeletePack("NetheriteIgnot",2);
                        DeletePack("Stick",1);
                        AddToPack("NetheriteSword",0);
                    }
                }
                if(CraftBar==3)
                {
                    if(PackInclude("NetheriteIgnot",3)&&PackInclude("Stick",2))
                    {
                        DeletePack("NetheriteIgnot",3);
                        DeletePack("Stick",2);
                        AddToPack("NetheriteAxe",0);
                    }
                }
                if(CraftBar==4)
                {
                    if(PackInclude("NetheriteIgnot",3)&&PackInclude("Stick",2))
                    {
                        DeletePack("NetheriteIgnot",3);
                        DeletePack("Stick",2);
                        AddToPack("NetheritePickaxe",0);
                    }
                }
                if(CraftBar==5)
                {
                    if(PackInclude("NetheriteIgnot",1)&&PackInclude("Stick",2))
                    {
                        DeletePack("NetheriteIgnot",1);
                        DeletePack("Stick",2);
                        AddToPack("NetheriteShovel",0);
                    }
                }
                if(CraftBar==6)
                {
                    if(PackInclude("Leather",5))
                    {
                        DeletePack("Leather",5);
                        Armour[1]=2;
                    }
                }
                if(CraftBar==7)
                {
                    if(PackInclude("Leather",8))
                    {
                        DeletePack("Leather",8);
                        Armour[2]=3;
                    }
                }
                if(CraftBar==8)
                {
                    if(PackInclude("Leather",7))
                    {
                        DeletePack("Leather",7);
                        Armour[3]=1;
                    }
                }
                if(CraftBar==9)
                {
                    if(PackInclude("Leather",4))
                    {
                        DeletePack("Leather",4);
                        Armour[4]=1;
                    }
                }
                if(CraftBar==10)
                {
                    if(PackInclude("IronIgnot",5))
                    {
                        DeletePack("IronIgnot",5);
                        Armour[1]=3;
                    }
                }
                if(CraftBar==11)
                {
                    if(PackInclude("IronIgnot",8))
                    {
                        DeletePack("IronIgnot",8);
                        Armour[2]=5;
                    }
                }
                if(CraftBar==12)
                {
                    if(PackInclude("IronIgnot",7))
                    {
                        DeletePack("IronIgnot",7);
                        Armour[3]=4;
                    }
                }
                if(CraftBar==13)
                {
                    if(PackInclude("IronIgnot",4))
                    {
                        DeletePack("IronIgnot",4);
                        Armour[4]=1;
                    }
                }
                if(CraftBar==14)
                {
                    if(PackInclude("Diamond",5))
                    {
                        DeletePack("Diamond",5);
                        Armour[1]=4;
                    }
                }
                if(CraftBar==15)
                {
                    if(PackInclude("Diamond",8))
                    {
                        DeletePack("Diamond",8);
                        Armour[2]=6;
                    }
                }
                if(CraftBar==16)
                {
                    if(PackInclude("Diamond",7))
                    {
                        DeletePack("Diamond",7);
                        Armour[3]=5;
                    }
                }
                if(CraftBar==17)
                {
                    if(PackInclude("Diamond",4))
                    {
                        DeletePack("Diamond",4);
                        Armour[4]=3;
                    }
                }
                if(CraftBar==18)
                {
                    if(PackInclude("NetheriteIgnot",5))
                    {
                        DeletePack("NetheriteIgnot",5);
                        Armour[1]=6;
                    }
                }
                if(CraftBar==19)
                {
                    if(PackInclude("NetheriteIgnot",8))
                    {
                        DeletePack("NetheriteIgnot",8);
                        Armour[2]=8;
                    }
                }
                if(CraftBar==20)
                {
                    if(PackInclude("NetheriteIgnot",7))
                    {
                        DeletePack("NetheriteIgnot",7);
                        Armour[3]=7;
                    }
                }
                if(CraftBar==21)
                {
                    if(PackInclude("NetheriteIgnot",4))
                    {
                        DeletePack("NetheriteIgnot",4);
                        Armour[4]=2;
                    }
                }
            } 
        }
        cls();
        while(GetKeyState('E')<0);
    }
    else if(PlayerMode=="Creative"&&world[CursorY][CursorX]!="Lever")
    {
        cls();
        while(GetKeyState('E')<0);
        while(GetKeyState('E')>=0)
        {
            CraftBar=(GetSubY())/GridZ-1;
            gotoxy(0,0);
            for(int i=0;i<28;i++)
            {
                if(i==CraftBar)BColor(WHITE);
                else BColor(BLACK);
                {
                    if(i==0)cout<<"工作台×1           木×1";
                    if(i==1)cout<<"木棍×8             木×1";
                    if(i==2)cout<<"灯×4               煤×1  棍×2";
                    if(i==3)cout<<"砖×4";
                    if(i==4)cout<<"木头";
                    if(i==5)cout<<"石头";
                    if(i==6)cout<<"铁块";
                    if(i==7)cout<<"铁锭";
                    if(i==8)cout<<"钻石";
                    if(i==9)cout<<"金子";
                    if(i==10)cout<<"煤炭";
                    if(i==11)cout<<"土壤";
                    if(i==12)cout<<"沙子";
                    if(i==13)cout<<"水";
                    if(i==14)cout<<"岩浆";
                    if(i==15)cout<<"桶";
                    if(i==16)cout<<"【指令方块】";
                    if(i==17)cout<<"TNT";
                    if(i==18)cout<<"红石块";
                    if(i==19)cout<<"红石粉";
                    if(i==20)cout<<"拉杆";
                    if(i==21)cout<<"压力板";
                    if(i==22)cout<<"矿车";
                    if(i==23)cout<<"轨道";
                    if(i==24)cout<<"核弹";
                    if(i==25)cout<<"火焰球";
                    if(i==26)cout<<"活塞";
                    if(i==27)cout<<"末地传送门";
                }
                if(i==CraftBar)
                {
                    cout<<"  空格键制作";
                }
                BColor(BLACK);cout<<"              ";
                cout<<endl;
            }
            cout<<endl<<"背包"<<endl;
            for(int i=0;i<9;i++)
            {
                cout<<GetOutputPack(BackPack[i]);
                cout<<"×"<<PackCnt[i];
                BColor(BLACK);
                cout<<"   ";
            }
            if(KEY_DOWN(VK_LBUTTON))
            {
                while(KEY_DOWN(VK_LBUTTON));
                if(CraftBar==0)AddToPack("CraftingTable",1,1);
                if(CraftBar==1)AddToPack("Stick",8,0);
                if(CraftBar==2)AddToPack("Lamp",4,1);
                if(CraftBar==3)AddToPack("Brick",4,1);
                if(CraftBar==4)AddToPack("Wood",1);
                if(CraftBar==5)AddToPack("Stone",1);
                if(CraftBar==6)AddToPack("Iron",0);
                if(CraftBar==7)AddToPack("IronIgnot",1);
                if(CraftBar==8)AddToPack("Diamond",1);
                if(CraftBar==9)AddToPack("Gold",1);
                if(CraftBar==10)AddToPack("Coal",1);
                if(CraftBar==11)AddToPack("Dirt",1);
                if(CraftBar==12)AddToPack("Sand",1);
                if(CraftBar==13)AddToPack("Water",1);
                if(CraftBar==14)AddToPack("Lava",1);
                if(CraftBar==15)AddToPack("Bucket",0);
                if(CraftBar==16)AddToPack("!",1);
                if(CraftBar==17)AddToPack("TNT",1);
                if(CraftBar==18)AddToPack("RedStone",1);
                if(CraftBar==19)AddToPack("RedStoneDust",1);
                if(CraftBar==20)AddToPack("Lever",1);
                if(CraftBar==21)AddToPack("PressurePlate",1);
                if(CraftBar==22)AddToPack("MineCar",1);
                if(CraftBar==23)AddToPack("MineTrack",1);
                if(CraftBar==24)AddToPack("Nuke",1);
                if(CraftBar==25)AddToPack("FireCharge",3);
                if(CraftBar==26)AddToPack("Piston",1);
                if(CraftBar==27)AddToPack("EndonPortal",1);
            }
        }
        cls();
    }
    else
    {
        cls();
        while(GetKeyState('E')<0);
        while(GetKeyState('E')>=0)
        {
            CraftBar=(GetSubY())/GridZ-1;
            gotoxy(0,0);
            for(int i=0;i<10;i++)
            {
                if(i==CraftBar)BColor(WHITE);
                else BColor(BLACK);
                {
                    if(i==0)cout<<"工作台×1           木×1";
                    if(i==1)cout<<"木棍×8             木×1";
                    if(i==2)cout<<"灯×4               煤×1  棍×2";
                    if(i==3)cout<<"石×2               岩×1";
                    if(i==4)cout<<"";
                    if(i==5)cout<<"";
                    if(i==6)cout<<"";
                    if(i==7)cout<<"";
                    if(i==8)cout<<"";
                    if(i==9)cout<<"";
                }
                if(i==CraftBar)
                {
                    cout<<"  鼠标制作";
                }
                BColor(BLACK);cout<<"              ";
                cout<<endl;
            }
            cout<<endl<<"背包"<<endl;
            for(int i=0;i<9;i++)
            {
                cout<<GetOutputPack(BackPack[i]);
                cout<<"×"<<PackCnt[i];
                BColor(BLACK);
                cout<<"   ";
            }
            if(KEY_DOWN(VK_LBUTTON))
            {
                while(KEY_DOWN(VK_LBUTTON));
                if(CraftBar==0)
                {
                    if(PackInclude("Wood"))
                    {
                        DeletePack("Wood");
                        AddToPack("CraftingTable",1,1);
                    }
                }
                if(CraftBar==1)
                {
                    if(PackInclude("Wood"))
                    {
                        DeletePack("Wood");
                        AddToPack("Stick",8,0);
                    }
                }
                if(CraftBar==2)
                {
                    if(PackInclude("Stick",2)&&PackInclude("Coal"))
                    {
                        DeletePack("Stick",2);
                        DeletePack("Coal");
                        AddToPack("Lamp",4,1);
                    }
                }
                if(CraftBar==3)
                {
                    if(PackInclude("DeepStone"))
                    {
                        DeletePack("DeepStone");
                        AddToPack("Stone",2,1);
                    }
                }
            } 
        }
        cls();
        while(GetKeyState('E')<0);
    }
}
void Command()
{
    cls();
    string str;
    int a,b,c,x,y;
    bool p,q;
    cout<<"Command Area (Enter /tutor for instructions)"<<endl;
    cout<<"Please press enter to delete the messy thing"<<endl;
    cin>>str;
    cls();
    cin>>str;
    if(str=="/tutor")
    {
        cls();
        cout<<"                       Command tutor                       "<<endl<<endl;
        cout<<"/gamemode <mode>             Allows you to change your mode"<<endl;
        cout<<"<mode> [creative] [survival] [spectate]"<<endl;
        cout<<endl;
        cout<<"/xray <bool>                 Toggles cross-tile vision"<<endl;
        cout<<"<bool> [0] [1]"<<endl;
        cout<<endl;
        cout<<"/FloorLevelShift <bool>      Allows you to ascend 1 tile without jumping"<<endl;
        cout<<"<bool> [0] [1]"<<endl;
        cout<<endl;
        cout<<"/tp <y> <x>                  Teleports you"<<endl;
        cout<<"<y> your target height   <x> your target wildth"<<endl;
        cout<<endl;
        cout<<"/spawn <mob> <hp> <y> <x>    Spawns mob"<<endl;
        cout<<"<mob> the mob you want to spawn  <hp> the mob's hp  <y,x> position"<<endl;
        cout<<endl;
        cout<<"/time <time>                 Changes time"<<endl;
        cout<<"<time> 0=morning  250=noon  500=evening  600=night"<<endl;
        cout<<endl;
        cout<<"/status                      Shows game status"<<endl;
        cout<<"Shows Game Difficulty, Render Distance and Map Size"<<endl;
        cout<<endl;
        cout<<"/inventory <type>            Replace your inventory"<<endl;
        cout<<"<type> clear  combat   mining   redstone"<<endl;
        cout<<endl;
        cout<<""<<endl;
        cout<<""<<endl;
        cout<<endl;
        cout<<"Press space key to continue...";
        while(GetKeyState(' ')>=0);
    }
    if(str=="/status")
    {
        cls();
        cout<<"Game Difficulty: "<<Difficulty<<endl;
        cout<<"Keep Inventory: "<<cmd.KeepInventory<<endl;
        cout<<"Render Distance: "<<RenderDistance<<endl;
        cout<<"Map Size: "<<GY<<"*"<<GX<<endl;
        cout<<"Press space to continue";
        while(GetKeyState(' ')>=0);
        cls();
    }
    if(str=="/gamestat")
    {
        cin>>str;
        if(str=="render")
        {
            cin>>q;
            RenderDistance=q;
        }
    }
    if(str=="/gamerule")
    {
        cin>>str;
        if(str=="keepinventory")
        {
            cin>>q;
            cmd.KeepInventory=q;
        }
    }
    if(str=="/gamemode"||str=="/gm")
    {
        cin>>str;
        if(str=="creative"||str=="c")PlayerMode="Creative";
        if(str=="adventure"||str=="a")PlayerMode="Adventure";
        if(str=="survival"||str=="s")PlayerMode="Survival";
        if(str=="spectate")PlayerMode="Spectate";
    }
    if(str=="/inventory"||str=="/inv")
    {
        cin>>str;
        if(str=="clear"||str=="c")
        {
            for(int i=0;i<10;i++)
            {
                BackPack[i]="Air";
                PackCnt[i]=0;
                PackStatus[i]=0;
            }
        }
        if(str=="combat"||str=="o")
        {
            /*for(int i=0;i<10;i++)
            {
                BackPack[i]="Air";
                PackCnt[i]=0;
                PackStatus[i]=0;
            }*/
            AddToPack("NetheriteSword",0);
            AddToPack("NetheriteShovel",0);
            AddUnpackable("WaterBucket",1);
            AddUnpackable("WaterBucket",1);
            AddToPack("Dirt",1000,1);
            AddToPack("NetheritePickaxe",0);
            AddToPack("RoastedBeef",1000,2);
            AddToPack("EndonPortal",1,1);
        }
        if(str=="mining"||str=="m")
        {
            /*for(int i=0;i<10;i++)
            {
                BackPack[i]="Air";
                PackCnt[i]=0;
                PackStatus[i]=0;
            }*/
            AddToPack("DiamondSword",0);
            AddToPack("DiamondPickaxe",0);
            AddToPack("Bucket",0);
            AddToPack("Dirt",1000,1);
            AddToPack("Water",1000,1);
            AddToPack("Sand",1000,1);
        }
        if(str=="redstone"||str=="r")
        {
            /*for(int i=0;i<10;i++)
            {
                BackPack[i]="Air";
                PackCnt[i]=0;
                PackStatus[i]=0;
            }*/
            AddToPack("Brick",1000,1);
            AddToPack("Lever",1000,1);
            AddToPack("TNT",1000,1);
            AddToPack("Piston",1000,1);
            AddToPack("RedStone",1000,1);
            AddToPack("RedStoneDust",1000,1);
            AddToPack("PressurePlate",1000,1);
        }
    }
    if(str=="/map")
    {
        cin>>str;
        if(str=="setblueprint"||str=="sbp")
        {
            cin>>x>>y>>a;
            Reset::SetBluePrint(x,y,a);
        }
    }
    if(str=="/xray")
    {
        cin>>p;
        cmd.xray=p;
    }
    if(str=="/time")
    {
        cin>>a;
        Time=a;
    }
    if(str=="/warp")
    {
        cin>>p;
        LoadWorld(p);
    }
    if(str=="/FloorLevelShift")
    {
        cin>>p;
        cmd.FloorLevelShift=p;
    }
    if(str=="/tp")
    {
        cin>>y>>x;
        PlayerY=y;PlayerX=x;
    }
    if(str=="/spawn")
    {
        cin>>str;
        cin>>a;
        cin>>y>>x;
        Mob[y][x]=str;
        MobHP[y][x]=a;
    }
    if(str=="/add")
    {
        cin>>str>>a>>q;
        AddToPack(str,a,q);
    }
    if(str=="/setspawn")
    {
        SpawnX=PlayerX;SpawnY=PlayerY;SpawnWorld=CurrentWorld;
    }
    if(str=="/kill")
    {
        cin>>str;
        if(str=="@a"||str=="@p")PlayerHP=0;
    }
}
void TryMove()
{
    if(PlayerX>GX-20)PlayerX=GX-20;
    if(PlayerX<20)PlayerX=20;
    if(PlayerY>GY-20)PlayerY=GY-20;
    SetDeath();
    Protection=Armour[1]+Armour[2]+Armour[3]+Armour[4];
    for(int i=0;i<9;i++)
    {
        if(PackCnt[i]<1||BackPack[i]=="Air"||BackPack[i]=="Lava2"||BackPack[i]=="Lava3"
        ||BackPack[i]=="Water2"||BackPack[i]=="Water3"||BackPack[i]=="Water4")
        {
            PackCnt[i]=0;
            BackPack[i]="Air";
        }
        if(BackPack[i]=="Chicken"||BackPack[i]=="RoastedChicken")PackStatus[i]=2;
        if(BackPack[i]=="Mutton"||BackPack[i]=="RoastedMutton")PackStatus[i]=2;
        if(BackPack[i]=="Beef"||BackPack[i]=="RoastedBeef")PackStatus[i]=2;
    }
    if(GetKeyState('T')<0)Command();
    CursorX=PlayerX+(GetSubX()-GridX/2)/GridX-20-1;
    CursorY=PlayerY-(GetSubY()-GridY/2)/GridY+10;
    CursoredItem=world[CursorY][CursorX];
    if(PlayerMode=="Spectate")
    {
        if(GetKeyState('W')<0)PlayerY++;
        if(GetKeyState('S')<0)PlayerY--;
        if(GetKeyState('A')<0)PlayerX--;
        if(GetKeyState('D')<0)PlayerX++;
    }
    if(PlayerMode=="Survival")
    {
        if(world[PlayerY][PlayerX]=="EndonPortal")
        {
            Reset::SetTheEnd();
            LoadWorld(2);
            PlayerY=145;
            world[PlayerY-1][PlayerX]="Brick";
            world[PlayerY-1][PlayerX+1]="Brick";
            world[PlayerY-1][PlayerX-1]="Brick";
            world[PlayerY-1][PlayerX+2]="Brick";
            world[PlayerY][PlayerX]="Air";
            world[PlayerY][PlayerX+1]="Air";
            world[PlayerY][PlayerX-1]="Air";
            world[PlayerY][PlayerX+2]="Air";
            world[PlayerY+1][PlayerX]="Air";
            world[PlayerY+1][PlayerX+1]="Air";
            world[PlayerY+1][PlayerX-1]="Air";
            world[PlayerY+1][PlayerX+2]="Air";
        }
        if(world[PlayerY][PlayerX]=="NetherPortal")
        {
            if(CurrentWorld==0)LoadWorld(1);
            else LoadWorld(0);
            Storage[0][PlayerY][PlayerX]="NetherPortal";
            Storage[1][PlayerY][PlayerX]="NetherPortal";
            world[PlayerY][PlayerX]="NetherPortal";

            Storage[0][PlayerY+1][PlayerX]="Obsidian";
            Storage[1][PlayerY+1][PlayerX]="Obsidian";
            world[PlayerY+1][PlayerX]="Obsidian";

            Storage[0][PlayerY-1][PlayerX]="Obsidian";
            Storage[1][PlayerY-1][PlayerX]="Obsidian";
            world[PlayerY-1][PlayerX]="Obsidian";

            Storage[0][PlayerY][PlayerX+1]="Obsidian";
            Storage[1][PlayerY][PlayerX+1]="Obsidian";
            world[PlayerY][PlayerX+1]="Obsidian";

            Storage[0][PlayerY][PlayerX-1]="Obsidian";
            Storage[1][PlayerY][PlayerX-1]="Obsidian";
            world[PlayerY][PlayerX-1]="Obsidian";

            PlayerY--;
            Jump=0;
        }
        PlayerBeingDamaged=0;
        if(Mob[PlayerY][PlayerX]=="Zombie"||Mob[PlayerY][PlayerX]=="Piglin2")
        {
            if(Frame%2==0)PlayerBeingDamaged=1;
            if(Difficulty>0&&Frame%(1+Protection/2)==0)PlayerHP--;
            if(Mob[PlayerY][PlayerX]=="Zombie")
            {
                Death[1]=1;
                MobDeathString="僵尸";
                LastDamage=Frame;
            }
            if(Mob[PlayerY][PlayerX]=="Piglin2")
            {
                Death[1]=2;
                MobDeathString="猪灵";
                LastDamage=Frame;
            }
        }
        if(world[PlayerY][PlayerX]=="Lava"||world[PlayerY][PlayerX]=="Lava2"
        ||world[PlayerY][PlayerX]=="Lava3")
        {
            if(Frame%2==0)PlayerBeingDamaged=1;
            if(Frame%(1+Protection/2+1)==0)PlayerHP-=3;
            Death[3]=2;
            LastDamage=Frame;
        }
        if(world[PlayerY][PlayerX]=="Fire")
        {
            if(Frame%2==0)PlayerBeingDamaged=1;
            if(Frame%(1+Protection/2)==0)PlayerHP--;
            Death[3]=1;
            LastDamage=Frame;
        }
        if(Layer[PlayerY][PlayerX]==1)
        {
            if(Frame%2==0)PlayerBeingDamaged=1;
            if(Frame%2==0)PlayerHP--;
            Death[3]=3;
            LastDamage=Frame;
        }
        if(world[PlayerY][PlayerX]=="SoulFire")
        {
            if(Frame%2==0)PlayerBeingDamaged=1;
            if(Frame%(1+Protection/2)==0)PlayerHP-=2;
            Death[3]=1;
            LastDamage=Frame;
        }
        if(world[PlayerY][PlayerX]=="Water")
        {
            if(Frame%3==0)Oxygen--;
        }
        else Oxygen=10;
        if(PlayerY<30)PlayerHP=0;
        if(Hunger==10&&PlayerHP<10&&Frame%10==0)PlayerHP++;
        if(Frame%200==0)Hunger--;
        if(Hunger<1)
        {
            Hunger=0;
            if(Frame%5==0)
            {
                if(Frame%2==0)PlayerBeingDamaged=1;
                PlayerHP--;
            }
        }
        if(Oxygen<1)
        {
            LastDamage=Frame;
            Death[2]=2;
            Oxygen=0;
            if(Frame%5==0)
            {
                if(Frame%2==0)PlayerBeingDamaged=1;
                PlayerHP-=2;
            }
        }
        if(PlayerHP<1)Die();
        //Detect 1-9
        {
            if(GetKeyState('1')<0)Selected=0;
            if(GetKeyState('2')<0)Selected=1;
            if(GetKeyState('3')<0)Selected=2;
            if(GetKeyState('4')<0)Selected=3;
            if(GetKeyState('5')<0)Selected=4;
            if(GetKeyState('6')<0)Selected=5;
            if(GetKeyState('7')<0)Selected=6;
            if(GetKeyState('8')<0)Selected=7;
            if(GetKeyState('9')<0)Selected=8;
            if(GetKeyState('0')<0)
            {
                BackPack[Selected]="Air";
                PackCnt[Selected]=0;
            }
        }
        if(GetKeyState('E')<0)Craft();
        if(GetKeyState('F')<0)
        {
            if(PackStatus[Selected]==2)
            {
                if(BackPack[Selected]=="Chicken")Hunger+=1;
                if(BackPack[Selected]=="Mutton")Hunger+=1;
                if(BackPack[Selected]=="Beef")Hunger+=1;
                if(BackPack[Selected]=="RoastedChicken")Hunger+=3;
                if(BackPack[Selected]=="RoastedMutton")Hunger+=4;
                if(BackPack[Selected]=="RoastedBeef")Hunger+=4;
                if(Hunger>10)Hunger=10;
                PackCnt[Selected]--;
                if(PackCnt[Selected]==0)BackPack[Selected]="Air";
            }
        }
        if(GetKeyState(' ')>=0&&!KEY_DOWN(VK_LBUTTON))CursorMode=0;
        if(GetKeyState(' ')<0||KEY_DOWN(VK_LBUTTON))
        {
            if(world[CursorY][CursorX]=="EnderPortalFrame"&&BackPack[Selected]=="EnderEye")
            {
                if(CursorMode==0)CursorMode=5;
                if(CursorMode==5)
                {
                    if(world[CursorY][CursorX]=="EnderPortalFrame")
                    {
                        world[CursorY][CursorX]="EnderPortalFrame2";
                        PackCnt[Selected]--;
                        if(PackCnt[Selected]<=0)BackPack[Selected]="Air";
                    }
                }
            }
            else if(PackStatus[Selected]==3)
            {
                if(CursorMode==0)CursorMode=4;
                if(CursorMode==4)
                {
                    if(BackPack[Selected]=="FireCharge")
                    {
                        if(CursorX<PlayerX)Mob[PlayerY][PlayerX]="FireChargeL",MobHP[PlayerY][PlayerX]=5;
                        else Mob[PlayerY][PlayerX]="FireChargeR",MobHP[PlayerY][PlayerX]=5;
                        PackCnt[Selected]--;
                        if(PackCnt[Selected]<=0)BackPack[Selected]="Air";
                    }
                }
            }
            else if((world[CursorY][CursorX]=="Air"||world[CursorY][CursorX]=="Water"
            ||world[CursorY][CursorX]=="Water4"||world[CursorY][CursorX]=="Water3"
            ||world[CursorY][CursorX]=="Water2"||world[CursorY][CursorX]=="Lava"
            ||world[CursorY][CursorX]=="Lava2"||world[CursorY][CursorX]=="Lava3"
            ||world[CursorY][CursorX]=="Lava4")
            &&Mob[CursorY][CursorX]=="Air"
            &&PackCnt[Selected]>0&&PackStatus[Selected]==1)
            {
                if(CursorMode==0)CursorMode=1;
                if(CursorMode==1)
                {
                    if(world[CursorY+1][CursorX]!="Air"||world[CursorY][CursorX+1]!="Air"||
                    world[CursorY-1][CursorX]!="Air"||world[CursorY][CursorX-1]!="Air")
                    {
                        world[CursorY][CursorX]=BackPack[Selected];
                        if(BackPack[Selected]=="WaterBucket"||BackPack[Selected]=="LavaBucket")
                        {
                            BackPack[Selected]="Bucket";
                            PackStatus[Selected]=0;
                        }
                        else if(BackPack[Selected]=="Chest")
                        {
                            PackCnt[Selected]--;
                            if(PackCnt[Selected]==0)BackPack[Selected]="Air";
                            ID[CursorY][CursorX]=++IDMaxCount;
                        }
                        else
                        {
                            PackCnt[Selected]--;
                            if(PackCnt[Selected]==0)BackPack[Selected]="Air";
                        }
                        CurDur[CursorY][CursorX]=MaxDur[CursorY][CursorX];
                    }
                }
            }
            else if(Mob[CursorY][CursorX]!="Air")
            {
                if(CursorMode==0)CursorMode=2;
                if(CursorMode==2)
                {
                    if(BackPack[Selected]=="WoodenSword")MobHP[CursorY][CursorX]-=2;
                    else if(BackPack[Selected]=="StoneSword")MobHP[CursorY][CursorX]-=3;
                    else if(BackPack[Selected]=="IronSword")MobHP[CursorY][CursorX]-=4;
                    else if(BackPack[Selected]=="DiamondSword")MobHP[CursorY][CursorX]-=5;
                    else if(BackPack[Selected]=="GoldenSword")MobHP[CursorY][CursorX]-=4;
                    else if(BackPack[Selected]=="NetheriteSword")MobHP[CursorY][CursorX]-=7;

                    else if(BackPack[Selected]=="WoodenAxe")MobHP[CursorY][CursorX]-=2;
                    else if(BackPack[Selected]=="StoneAxe")MobHP[CursorY][CursorX]-=2;
                    else if(BackPack[Selected]=="IronAxe")MobHP[CursorY][CursorX]-=3;
                    else if(BackPack[Selected]=="DiamondAxe")MobHP[CursorY][CursorX]-=4;
                    else if(BackPack[Selected]=="GoldenAxe")MobHP[CursorY][CursorX]-=3;
                    else if(BackPack[Selected]=="NetheriteAxe")MobHP[CursorY][CursorX]-=6;
                    else MobHP[CursorY][CursorX]--;
                }
            }
            else if(world[CursorY][CursorX]!="Air")
            {
                if(CursorMode==0)CursorMode=3;
                if(CursorMode==3)
                {
                    if(CursoredItem=="Fire"||CursoredItem=="SoulFire")
                    {
                        CurDur[CursorY][CursorX]=0;
                        MaxDur[CursorY][CursorX]=0;
                        world[CursorY][CursorX]="Air";
                    }
                    if(CursoredItem=="Water"&&BackPack[Selected]=="Bucket")
                    {
                        CurDur[CursorY][CursorX]=0;
                        //world[CursorY][CursorX]="Air";
                        //AddToPack("Water",1);
                    }
                    else if(CursoredItem=="Lava"&&BackPack[Selected]=="Bucket")
                    {
                        CurDur[CursorY][CursorX]=0;
                        //world[CursorY][CursorX]="Air";
                        //AddToPack("Lava",1);
                    }
                    else if(CursoredItem=="Wood")
                    {
                        if(BackPack[Selected]=="WoodenAxe")CurDur[CursorY][CursorX]-=3;
                        else if(BackPack[Selected]=="StoneAxe")CurDur[CursorY][CursorX]-=5;
                        else if(BackPack[Selected]=="IronAxe")CurDur[CursorY][CursorX]-=7;
                        else if(BackPack[Selected]=="DiamondAxe")CurDur[CursorY][CursorX]-=10;
                        else if(BackPack[Selected]=="GoldAxe")CurDur[CursorY][CursorX]-=7;
                        else if(BackPack[Selected]=="NetheriteAxe")CurDur[CursorY][CursorX]-=12;
                        else CurDur[CursorY][CursorX]--;
                    }
                    else if(CursoredItem=="Dirt"||CursoredItem=="Sand"||CursoredItem=="SoulSand")
                    {
                        if(BackPack[Selected]=="WoodenShovel")CurDur[CursorY][CursorX]-=3;
                        else if(BackPack[Selected]=="StoneShovel")CurDur[CursorY][CursorX]-=5;
                        else if(BackPack[Selected]=="IronShovel")CurDur[CursorY][CursorX]-=7;
                        else if(BackPack[Selected]=="DiamondShovel")
                        CurDur[CursorY][CursorX]-=10;
                        else if(BackPack[Selected]=="GoldShovel")CurDur[CursorY][CursorX]-=7;
                        else if(BackPack[Selected]=="NetheriteShovel")CurDur[CursorY][CursorX]-=9;
                        else CurDur[CursorY][CursorX]--;
                    }
                    else if(CursoredItem=="Stone"||CursoredItem=="DeepStone"||
                    CursoredItem=="Coal"||CursoredItem=="Brick")
                    {
                        if(BackPack[Selected]=="WoodenPickaxe")CurDur[CursorY][CursorX]-=3;
                        else if(BackPack[Selected]=="StonePickaxe")CurDur[CursorY][CursorX]-=5;
                        else if(BackPack[Selected]=="IronPickaxe")CurDur[CursorY][CursorX]-=7;
                        else if(BackPack[Selected]=="DiamondPickaxe")CurDur[CursorY][CursorX]-=10;
                        else if(BackPack[Selected]=="GoldPickaxe")CurDur[CursorY][CursorX]-=7;
                        else if(BackPack[Selected]=="NetheritePickaxe")CurDur[CursorY][CursorX]-=15;
                    }
                    else if(CursoredItem=="Iron"||CursoredItem=="Netherrack")
                    {
                        if(BackPack[Selected]=="StonePickaxe")CurDur[CursorY][CursorX]-=5;
                        else if(BackPack[Selected]=="IronPickaxe")CurDur[CursorY][CursorX]-=7;
                        else if(BackPack[Selected]=="DiamondPickaxe")CurDur[CursorY][CursorX]-=10;
                        else if(BackPack[Selected]=="GoldPickaxe")CurDur[CursorY][CursorX]-=7;
                        else if(BackPack[Selected]=="NetheritePickaxe")CurDur[CursorY][CursorX]-=15;
                    }
                    else if(CursoredItem=="Diamond"||CursoredItem=="Gold"||CursoredItem=="EndRock")
                    {
                        if(BackPack[Selected]=="IronPickaxe")CurDur[CursorY][CursorX]-=7;
                        else if(BackPack[Selected]=="DiamondPickaxe")CurDur[CursorY][CursorX]-=10;
                        else if(BackPack[Selected]=="GoldPickaxe")CurDur[CursorY][CursorX]-=7;
                        else if(BackPack[Selected]=="NetheritePickaxe")CurDur[CursorY][CursorX]-=15;
                    }
                    else if(CursoredItem=="AcientDebris"||CursoredItem=="Obsidian")
                    {
                        if(BackPack[Selected]=="DiamondPickaxe")CurDur[CursorY][CursorX]-=10;
                        else if(BackPack[Selected]=="NetheritePickaxe")CurDur[CursorY][CursorX]-=15;
                    }
                    else if(CursoredItem=="AcientDebris")
                    {
                        if(BackPack[Selected]=="DiamondPickaxe")CurDur[CursorY][CursorX]-=10;
                        else if(BackPack[Selected]=="NetheritePickaxe")CurDur[CursorY][CursorX]-=15;
                    }
                    else if(CursoredItem=="Obsidian")
                    {
                        if(BackPack[Selected]=="DiamondPickaxe")CurDur[CursorY][CursorX]-=5;
                    }
                    else if(CursoredItem=="EndonGoblet")
                    {
                        CreateExplosion(CursorY,CursorX,5,5,5+rand()%6);
                    }
                    else CurDur[CursorY][CursorX]--;
                    if(CurDur[CursorY][CursorX]<=0&&world[CursorY][CursorX]!="Fire"&&
                    world[CursorY][CursorX]!="Leaf")
                    {
                        if(world[CursorY][CursorX]=="Water")
                        {
                            BackPack[Selected]="WaterBucket";
                            PackStatus[Selected]=1;
                            world[CursorY][CursorX]="Air";
                        }
                        else if(world[CursorY][CursorX]=="Lava")
                        {
                            BackPack[Selected]="LavaBucket";
                            PackStatus[Selected]=1;
                            world[CursorY][CursorX]="Air";
                        }
                        else
                        {
                            bool found=0;
                            for(int i=0;i<9;i++)
                            {
                                if(BackPack[i]==world[CursorY][CursorX])
                                {
                                    PackCnt[i]++;
                                    found=1;
                                    break;
                                }
                            }
                            if(found==0)
                            {
                                for(int i=0;i<9;i++)
                                {
                                    if(BackPack[i]=="Air")
                                    {
                                        BackPack[i]=world[CursorY][CursorX];
                                        PackStatus[i]=1;
                                        PackCnt[i]++;
                                        break;
                                    }
                                }
                            }
                            world[CursorY][CursorX]="Air";
                        }

                    }
                }
            }
        }
        if(world[PlayerY][PlayerX]=="Water"||world[PlayerY][PlayerX]=="Water1"||
        world[PlayerY][PlayerX]=="Water2"||world[PlayerY][PlayerX]=="Water3"||
        world[PlayerY][PlayerX]=="Water4"||world[PlayerY][PlayerX]=="Lava"
        ||world[CursorY][CursorX]=="Lava2"||world[CursorY][CursorX]=="Lava3"
        ||world[CursorY][CursorX]=="Lava4")PlayerFall=0;
        if(Layer[PlayerY-1][PlayerX]==1)
        {
            if(PlayerFall>5)
            {
                PlayerHP-=(PlayerFall-5)/2;
                Death[2]=1;
            }
            if(Frame%2==0&&PlayerFall>5)PlayerBeingDamaged=1;
            PlayerFall=0;
        }
        if(GetKeyState('W')<0)
        {
            if(Layer[PlayerY-1][PlayerX]==1||
            world[PlayerY][PlayerX]=="Water"||world[PlayerY][PlayerX]=="Water4")
            Jump=2;
        }
        if(Frame%2==0||world[PlayerY-1][PlayerX]!="SoulSand")
        {
            if(GetKeyState('A')<0)
            {
                if(Layer[PlayerY][PlayerX-1]==0)PlayerX--;
                if(Layer[PlayerY+1][PlayerX-1]==0&&Layer[PlayerY][PlayerX-1]==1
                &&Layer[PlayerY+1][PlayerX]==0)
                {
                    if(cmd.FloorLevelShift)PlayerX--,PlayerY++;
                }
            }
            if(GetKeyState('D')<0)
            {
                if(Layer[PlayerY][PlayerX+1]==0)PlayerX++;
                if(Layer[PlayerY+1][PlayerX+1]==0&&Layer[PlayerY][PlayerX+1]==1
                &&Layer[PlayerY+1][PlayerX]==0)
                {
                    if(cmd.FloorLevelShift)PlayerX++,PlayerY++;
                }
            }
        }
        if(ExplosionJump>0)
        {
            if(Layer[PlayerY+1][PlayerX]==1)ExplosionJump=0;
            if(ExplosionJump>0)PlayerY++;
            if(Layer[PlayerY+1][PlayerX]==1)ExplosionJump=0;
            if(ExplosionJump>0)ExplosionJump--,PlayerY++;
        }
        if(Jump>0)
        {
            if(Layer[PlayerY+1][PlayerX]==1)Jump=0;
            if(Jump>0)Jump--,PlayerY++;
        }
        else if(Layer[PlayerY-1][PlayerX]==0)
        {
            PlayerY--,PlayerFall++;
        }
    }
    if(PlayerMode=="Adventure")
    {
        if(world[PlayerY][PlayerX]=="EndonPortal")
        {
            Reset::SetTheEnd();
            LoadWorld(2);
            PlayerY=145;
            world[PlayerY-1][PlayerX]="Brick";
            world[PlayerY-1][PlayerX+1]="Brick";
            world[PlayerY-1][PlayerX-1]="Brick";
            world[PlayerY-1][PlayerX+2]="Brick";
            world[PlayerY][PlayerX]="Air";
            world[PlayerY][PlayerX+1]="Air";
            world[PlayerY][PlayerX-1]="Air";
            world[PlayerY][PlayerX+2]="Air";
            world[PlayerY+1][PlayerX]="Air";
            world[PlayerY+1][PlayerX+1]="Air";
            world[PlayerY+1][PlayerX-1]="Air";
            world[PlayerY+1][PlayerX+2]="Air";
        }
        if(world[PlayerY][PlayerX]=="NetherPortal")
        {
            if(CurrentWorld==0)LoadWorld(1);
            else LoadWorld(0);
            Storage[0][PlayerY][PlayerX]="NetherPortal";
            Storage[1][PlayerY][PlayerX]="NetherPortal";
            world[PlayerY][PlayerX]="NetherPortal";

            Storage[0][PlayerY+1][PlayerX]="Obsidian";
            Storage[1][PlayerY+1][PlayerX]="Obsidian";
            world[PlayerY+1][PlayerX]="Obsidian";

            Storage[0][PlayerY-1][PlayerX]="Obsidian";
            Storage[1][PlayerY-1][PlayerX]="Obsidian";
            world[PlayerY-1][PlayerX]="Obsidian";

            Storage[0][PlayerY][PlayerX+1]="Obsidian";
            Storage[1][PlayerY][PlayerX+1]="Obsidian";
            world[PlayerY][PlayerX+1]="Obsidian";

            Storage[0][PlayerY][PlayerX-1]="Obsidian";
            Storage[1][PlayerY][PlayerX-1]="Obsidian";
            world[PlayerY][PlayerX-1]="Obsidian";

            PlayerY--;
            Jump=0;
        }
        PlayerBeingDamaged=0;
        if(Mob[PlayerY][PlayerX]=="Zombie"||Mob[PlayerY][PlayerX]=="Piglin2")
        {
            if(Frame%2==0)PlayerBeingDamaged=1;
            if(Difficulty>0)PlayerHP--;
        }
        if(world[PlayerY][PlayerX]=="Lava")
        {
            if(Frame%2==0)PlayerBeingDamaged=1;
            PlayerHP-=3;
        }
        if(world[PlayerY][PlayerX]=="Fire")
        {
            if(Frame%2==0)PlayerBeingDamaged=1;
            PlayerHP--;
        }
        if(world[PlayerY][PlayerX]=="Water")
        {
            if(Frame%3==0)Oxygen--;
        }
        else Oxygen=10;
        if(PlayerY<30)PlayerHP=0;
        if(Hunger==10&&PlayerHP<10&&Frame%10==0)PlayerHP++;
        if(Frame%200==0)Hunger--;
        if(Hunger<1)
        {
            Hunger=0;
            if(Frame%5==0)
            {
                if(Frame%2==0)PlayerBeingDamaged=1;
                PlayerHP--;
            }
        }
        if(Oxygen<1)
        {
            Oxygen=0;
            if(Frame%5==0)
            {
                if(Frame%2==0)PlayerBeingDamaged=1;
                PlayerHP-=2;
            }
        }
        if(PlayerHP<1)Die();
        //Detect 1-9
        {
            if(GetKeyState('1')<0)Selected=0;
            if(GetKeyState('2')<0)Selected=1;
            if(GetKeyState('3')<0)Selected=2;
            if(GetKeyState('4')<0)Selected=3;
            if(GetKeyState('5')<0)Selected=4;
            if(GetKeyState('6')<0)Selected=5;
            if(GetKeyState('7')<0)Selected=6;
            if(GetKeyState('8')<0)Selected=7;
            if(GetKeyState('9')<0)Selected=8;
            if(GetKeyState('0')<0)
            {
                BackPack[Selected]="Air";
                PackCnt[Selected]=0;
            }
        }
        if(GetKeyState('E')<0)Craft();
        if(GetKeyState('F')<0)
        {
            if(PackStatus[Selected]==2)
            {
                if(BackPack[Selected]=="Chicken")Hunger+=1;
                if(BackPack[Selected]=="Mutton")Hunger+=1;
                if(BackPack[Selected]=="Beef")Hunger+=1;
                if(BackPack[Selected]=="RoastedChicken")Hunger+=3;
                if(BackPack[Selected]=="RoastedMutton")Hunger+=4;
                if(BackPack[Selected]=="RoastedBeef")Hunger+=4;
                if(Hunger>10)Hunger=10;
                PackCnt[Selected]--;
                if(PackCnt[Selected]==0)BackPack[Selected]="Air";
            }
        }
        if(GetKeyState(' ')>=0&&!KEY_DOWN(VK_LBUTTON))CursorMode=0;
        if(GetKeyState(' ')<0||KEY_DOWN(VK_LBUTTON))
        {
            if(world[CursorY][CursorX]=="EnderPortalFrame"&&BackPack[Selected]=="EnderEye")
            {
                if(CursorMode==0)CursorMode=5;
                if(CursorMode==5)
                {
                    if(world[CursorY][CursorX]=="EnderPortalFrame")
                    {
                        world[CursorY][CursorX]="EnderPortalFrame2";
                        PackCnt[Selected]--;
                        if(PackCnt[Selected]<=0)BackPack[Selected]="Air";
                    }
                }
            }
            else if(PackStatus[Selected]==3)
            {
                if(CursorMode==0)CursorMode=4;
                if(CursorMode==4)
                {
                    if(BackPack[Selected]=="FireCharge")
                    {
                        if(CursorX<PlayerX)Mob[PlayerY][PlayerX]="FireChargeL",MobHP[PlayerY]
                        [PlayerX]=5;
                        else Mob[PlayerY][PlayerX]="FireChargeR",MobHP[PlayerY][PlayerX]=5;
                        PackCnt[Selected]--;
                        if(PackCnt[Selected]<=0)BackPack[Selected]="Air";
                    }
                }
            }
            else if((world[CursorY][CursorX]=="Air"||world[CursorY][CursorX]=="Water"
            ||world[CursorY][CursorX]=="Water4"||world[CursorY][CursorX]=="Water3"
            ||world[CursorY][CursorX]=="Water2"||world[CursorY][CursorX]=="Lava"
            ||world[CursorY][CursorX]=="Lava2"||world[CursorY][CursorX]=="Lava3")
            &&Mob[CursorY][CursorX]=="Air"
            &&PackCnt[Selected]>0&&PackStatus[Selected]==1)
            {
                if(CursorMode==0)CursorMode=1;
                if(CursorMode==1)
                {
                    world[CursorY][CursorX]=BackPack[Selected];
                    PackCnt[Selected]--;
                    if(PackCnt[Selected]==0)BackPack[Selected]="Air";
                    CheckTile();
                    CurDur[CursorY][CursorX]=MaxDur[CursorY][CursorX];
                }
            }
            else if(Mob[CursorY][CursorX]!="Air")
            {
                if(CursorMode==0)CursorMode=2;
                if(CursorMode==2)
                {
                    if(BackPack[Selected]=="WoodenSword")MobHP[CursorY][CursorX]-=2;
                    else if(BackPack[Selected]=="StoneSword")MobHP[CursorY][CursorX]-=3;
                    else if(BackPack[Selected]=="IronSword")MobHP[CursorY][CursorX]-=4;
                    else if(BackPack[Selected]=="DiamondSword")MobHP[CursorY][CursorX]-=5;
                    else if(BackPack[Selected]=="GoldenSword")MobHP[CursorY][CursorX]-=4;

                    else if(BackPack[Selected]=="WoodenAxe")MobHP[CursorY][CursorX]-=2;
                    else if(BackPack[Selected]=="StoneAxe")MobHP[CursorY][CursorX]-=2;
                    else if(BackPack[Selected]=="IronAxe")MobHP[CursorY][CursorX]-=3;
                    else if(BackPack[Selected]=="DiamondAxe")MobHP[CursorY][CursorX]-=4;
                    else if(BackPack[Selected]=="GoldenAxe")MobHP[CursorY][CursorX]-=3;
                    else MobHP[CursorY][CursorX]--;
                }
            }
        }
        if(Layer[PlayerY-1][PlayerX]==1)
        {
            if(PlayerFall>5)PlayerHP-=max((PlayerFall-5-1+Protection/2)/2,1);
            if(Frame%2==0&&PlayerFall>5)PlayerBeingDamaged=1;
            PlayerFall=0;
        }
        if(GetKeyState('W')<0)
        {
            if(Layer[PlayerY-1][PlayerX]==1||
            world[PlayerY][PlayerX]=="Water"||world[PlayerY][PlayerX]=="Water4")
            Jump=2;
        }
        if(GetKeyState('A')<0)
        {
            if(Layer[PlayerY][PlayerX-1]==0)PlayerX--;
            if(Layer[PlayerY+1][PlayerX-1]==0&&Layer[PlayerY][PlayerX-1]==1
            &&Layer[PlayerY+1][PlayerX]==0)
            {
                if(cmd.FloorLevelShift)PlayerX--,PlayerY++;
            }
        }
        if(GetKeyState('D')<0)
        {
            if(Layer[PlayerY][PlayerX+1]==0)PlayerX++;
            if(Layer[PlayerY+1][PlayerX+1]==0&&Layer[PlayerY][PlayerX+1]==1
            &&Layer[PlayerY+1][PlayerX]==0)
            {
                if(cmd.FloorLevelShift)PlayerX++,PlayerY++;
            }
        }
        if(Jump>0)
        {
            if(Layer[PlayerY+1][PlayerX]==1)Jump=0;
            if(Jump>0)Jump--,PlayerY++;
        }
        if(ExplosionJump>0)
        {
            if(Layer[PlayerY+1][PlayerX]==1)ExplosionJump=0;
            if(ExplosionJump>0)PlayerY++;
            if(Layer[PlayerY+1][PlayerX]==1)ExplosionJump=0;
            if(ExplosionJump>0)ExplosionJump--,PlayerY++;
        }
        else if(Layer[PlayerY-1][PlayerX]==0)PlayerY--,PlayerFall++;
        if(world[PlayerY][PlayerX]=="Water"||world[PlayerY][PlayerX]=="Water1"||
        world[PlayerY][PlayerX]=="Water2"||world[PlayerY][PlayerX]=="Water3"||
        world[PlayerY][PlayerX]=="Water4"||world[PlayerY][PlayerX]=="Lava")PlayerFall=0;
    }
    if(PlayerMode=="Creative")
    {
        if(world[PlayerY][PlayerX]=="EndonPortal")
        {
            Reset::SetTheEnd();
            LoadWorld(2);
            PlayerY=145;
            world[PlayerY-1][PlayerX]="Brick";
            world[PlayerY-1][PlayerX+1]="Brick";
            world[PlayerY-1][PlayerX-1]="Brick";
            world[PlayerY-1][PlayerX+2]="Brick";
            world[PlayerY][PlayerX]="Air";
            world[PlayerY][PlayerX+1]="Air";
            world[PlayerY][PlayerX-1]="Air";
            world[PlayerY][PlayerX+2]="Air";
            world[PlayerY+1][PlayerX]="Air";
            world[PlayerY+1][PlayerX+1]="Air";
            world[PlayerY+1][PlayerX-1]="Air";
            world[PlayerY+1][PlayerX+2]="Air";
        }
        if(world[PlayerY][PlayerX]=="NetherPortal")
        {
            if(CurrentWorld==0)LoadWorld(1);
            else LoadWorld(0);
            Storage[0][PlayerY][PlayerX]="NetherPortal";
            Storage[1][PlayerY][PlayerX]="NetherPortal";
            world[PlayerY][PlayerX]="NetherPortal";

            Storage[0][PlayerY+1][PlayerX]="Obsidian";
            Storage[1][PlayerY+1][PlayerX]="Obsidian";
            world[PlayerY+1][PlayerX]="Obsidian";

            Storage[0][PlayerY-1][PlayerX]="Obsidian";
            Storage[1][PlayerY-1][PlayerX]="Obsidian";
            world[PlayerY-1][PlayerX]="Obsidian";

            Storage[0][PlayerY][PlayerX+1]="Obsidian";
            Storage[1][PlayerY][PlayerX+1]="Obsidian";
            world[PlayerY][PlayerX+1]="Obsidian";

            Storage[0][PlayerY][PlayerX-1]="Obsidian";
            Storage[1][PlayerY][PlayerX-1]="Obsidian";
            world[PlayerY][PlayerX-1]="Obsidian";

            PlayerY--;
            Jump=0;
        }
        PlayerBeingDamaged=0;
        if(Mob[PlayerY][PlayerX]=="Zombie"||Mob[PlayerY][PlayerX]=="Piglin2")
        {
            if(Frame%2==0)PlayerBeingDamaged=1;
        }
        if(world[PlayerY][PlayerX]=="Lava")
        {
            if(Frame%2==0)PlayerBeingDamaged=1;
        }
        if(world[PlayerY][PlayerX]=="Fire")
        {
            if(Frame%2==0)PlayerBeingDamaged=1;
        }
        if(world[PlayerY][PlayerX]=="Water")
        {
            if(Frame%3==0)Oxygen--;
        }
        else Oxygen=10;
        if(PlayerY<30)PlayerHP=0;
        if(Hunger==10&&PlayerHP<10&&Frame%10==0)PlayerHP++;
        if(Frame%200==0)Hunger--;
        if(Hunger<1)
        {
            Hunger=0;
            if(Frame%5==0)
            {
                if(Frame%2==0)PlayerBeingDamaged=1;
            }
        }
        if(Oxygen<1)
        {
            Oxygen=0;
            if(Frame%5==0)
            {
                if(Frame%2==0)PlayerBeingDamaged=1;
            }
        }
        if(PlayerHP<1)Die();
        //Detect 1-9
        {
            if(GetKeyState('1')<0)Selected=0;
            if(GetKeyState('2')<0)Selected=1;
            if(GetKeyState('3')<0)Selected=2;
            if(GetKeyState('4')<0)Selected=3;
            if(GetKeyState('5')<0)Selected=4;
            if(GetKeyState('6')<0)Selected=5;
            if(GetKeyState('7')<0)Selected=6;
            if(GetKeyState('8')<0)Selected=7;
            if(GetKeyState('9')<0)Selected=8;
            if(GetKeyState('0')<0)
            {
                BackPack[Selected]="Air";
                PackCnt[Selected]=0;
            }
        }
        if(GetKeyState('E')<0)Craft();
        if(GetKeyState('F')<0)
        {
            if(PackStatus[Selected]==2)
            {
                if(BackPack[Selected]=="Chicken")Hunger+=1;
                if(BackPack[Selected]=="Mutton")Hunger+=1;
                if(BackPack[Selected]=="Beef")Hunger+=1;
                if(BackPack[Selected]=="RoastedChicken")Hunger+=3;
                if(BackPack[Selected]=="RoastedMutton")Hunger+=4;
                if(BackPack[Selected]=="RoastedBeef")Hunger+=4;
                if(Hunger>10)Hunger=10;
                PackCnt[Selected]--;
                if(PackCnt[Selected]==0)BackPack[Selected]="Air";
            }
        }
        if(GetKeyState(' ')>=0&&!KEY_DOWN(VK_LBUTTON))CursorMode=0;
        if(GetKeyState(' ')<0||KEY_DOWN(VK_LBUTTON))
        {
            if(world[CursorY][CursorX]=="EnderPortalFrame"&&BackPack[Selected]=="EnderEye")
            {
                if(CursorMode==0)CursorMode=5;
                if(CursorMode==5)
                {
                    if(world[CursorY][CursorX]=="EnderPortalFrame")
                    {
                        world[CursorY][CursorX]="EnderPortalFrame2";
                        if(PackCnt[Selected]<=0)BackPack[Selected]="Air";
                    }
                }
            }
            else if(BackPack[Selected]=="FireCharge")
            {
                if(CursorMode==0)CursorMode=4;
                if(CursorMode==4)
                {
                    if(BackPack[Selected]=="FireCharge")
                    {
                        if(CursorX<PlayerX)Mob[PlayerY][PlayerX]="FireChargeL",MobHP[PlayerY]
                        [PlayerX]=5;
                        else Mob[PlayerY][PlayerX]="FireChargeR",MobHP[PlayerY][PlayerX]=5;
                    }
                }
            }
            else if((world[CursorY][CursorX]=="Air"||world[CursorY][CursorX]=="Water"
            ||world[CursorY][CursorX]=="Water4"||world[CursorY][CursorX]=="Water3"
            ||world[CursorY][CursorX]=="Water2"||world[CursorY][CursorX]=="Lava"
            ||world[CursorY][CursorX]=="Lava2"||world[CursorY][CursorX]=="Lava3"
            ||world[CursorY][CursorX]=="Lava4")&&Mob[CursorY][CursorX]=="Air"
            &&PackCnt[Selected]>0&&PackStatus[Selected]==1)
            {
                if(CursorMode==0)CursorMode=1;
                if(CursorMode==1)
                {
                    if(BackPack[Selected]=="Chest")
                    {
                        world[CursorY][CursorX]=BackPack[Selected];
                        PackCnt[Selected]--;
                        if(PackCnt[Selected]==0)BackPack[Selected]="Air";
                        ID[CursorY][CursorX]=++IDMaxCount;
                    }
                    else world[CursorY][CursorX]=BackPack[Selected];
                    CheckTile();
                    CurDur[CursorY][CursorX]=MaxDur[CursorY][CursorX];
                }
            }
            else if(Mob[CursorY][CursorX]!="Air")
            {
                if(CursorMode==0)CursorMode=2;
                if(CursorMode==2)
                {
                    MobHP[CursorY][CursorX]=0;
                }
            }
            else if(CursoredItem=="EndonGoblet")
            {
                CreateExplosion(CursorY,CursorX,5,5,5+rand()%6);
            }
            else if(world[CursorY][CursorX]!="Air")
            {
                if(CursorMode==0)CursorMode=3;
                if(CursorMode==3)
                {
                    world[CursorY][CursorX]="Air";
                    CheckTile();
                    CurDur[CursorY][CursorX]=MaxDur[CursorY][CursorX];
                }
            }
        }
        if(GetKeyState('W')<0)
        {
            if(PlayerY<GY-10&&Layer[PlayerY+1][PlayerX]==0)PlayerY++;
        }
        if(GetKeyState('S')<0)
        {
            if(PlayerY>10&&Layer[PlayerY-1][PlayerX]==0)PlayerY--;
        }
        if(GetKeyState('A')<0)
        {
            if(Layer[PlayerY][PlayerX-1]==0)PlayerX--;
            if(Layer[PlayerY+1][PlayerX-1]==0&&Layer[PlayerY][PlayerX-1]==1
            &&Layer[PlayerY+1][PlayerX]==0)
            {
                if(cmd.FloorLevelShift)PlayerX--,PlayerY++;
            }
        }
        if(GetKeyState('D')<0)
        {
            if(Layer[PlayerY][PlayerX+1]==0)PlayerX++;
            if(Layer[PlayerY+1][PlayerX+1]==0&&Layer[PlayerY][PlayerX+1]==1
            &&Layer[PlayerY+1][PlayerX]==0)
            {
                if(cmd.FloorLevelShift)PlayerX++,PlayerY++;
            }
        }
        if(ExplosionJump>0)
        {
            if(Layer[PlayerY+1][PlayerX]==1)ExplosionJump=0;
            if(ExplosionJump>0)PlayerY++;
            if(Layer[PlayerY+1][PlayerX]==1)ExplosionJump=0;
            if(ExplosionJump>0)ExplosionJump--,PlayerY++;
        }
    }
}
void LightUpdate()
{
    for(int i=PlayerY-RenderDistance;i<PlayerY+RenderDistance;i++)
    {
        if(i<1||i>GY-2)continue;
        for(int j=PlayerX-RenderDistance;j<PlayerX+RenderDistance;j++)
        {
            if(j<1||j>GX-2)continue;
            if(Layer[i][j]==0)vis[i][j]=1;
            else if(Layer[i+1][j]==0||Layer[i-1][j]==0)vis[i][j]=1;
            else if(Layer[i][j+1]==0||Layer[i][j-1]==0)vis[i][j]=1;
            else vis[i][j]=0;
        }
    }
}
void CheckMob()
{
    for(int i=0;i<GY;i++)for(int j=0;j<GX;j++)MobChecked[i][j]=0;
    for(int i=PlayerY-RenderDistance;i<PlayerY+RenderDistance;i++)
    {
        if(i<1||i>GY-2)continue;
        for(int j=PlayerX-RenderDistance;j<PlayerX+RenderDistance;j++)
        {
            if(j<1||j>GX-2)continue;
            if(world[i][j]=="EndonDragon")
            {
                world[i][j]="Air";
                Mob[i][j]="EndonDragon";
                MobHP[i][j]=320;
                BossHP=320;
                BossRegen=8;
            }
            if(world[i][j]=="TrailSpawner_Blaze"&&Layer[i+1][j]==0)
            {
                if(Frame%10==0)
                {
                    Mob[i+1][j]="Blaze";
                    MobHP[i+1][j]=10;
                }
            }
            if(world[i][j]=="NetherBrick"&&Layer[i+1][j]==0&&CurrentWorld==1)
            {
                if(Frame%10==0)
                {
                    Mob[i+1][j]="Blaze";
                    MobHP[i+1][j]=10;
                }
            }
            if(world[i][j]=="TrailSpawner_Zombie"&&Layer[i+1][j]==0)
            {
                if(Frame%10==0)
                {
                    Mob[i+1][j]="Zombie";
                    MobHP[i+1][j]=10;
                }
            }
            if(Difficulty!=-1&&rand()*rand()*rand()%1000==0&&CurrentWorld==0&&world[i-1][j]=="Dirt")
            {
                if((Layer[i][j]==0&&Layer[i-1][j]==1)&&!(abs(PlayerY-i)<15&&abs(PlayerX-j)<15))
                {
                    if(rand()%3==0)Mob[i][j]="Chicken",MobHP[i][j]=3;
                    else if(rand()%2==0)Mob[i][j]="Sheep",MobHP[i][j]=5;
                    else if(rand()%1==0)Mob[i][j]="Cow",MobHP[i][j]=5;
                }
            }
            if(rand()*rand()*rand()%1000000==0&&CurrentWorld==0&&world[i-1][j]=="Dirt")
            {
                if(!(abs(PlayerY-i)<15&&abs(PlayerX-j)<15))
                {
                    Mob[i][j]="Trader",MobHP[i][j]=10;
                }
            }
            if(Difficulty>-1&&rand()*rand()*rand()%(10000/Difficulty/Difficulty)==0&&CurrentWorld==0&&
            Time>600&&i>0)
            {
                if((Layer[i][j]==0&&Layer[i-1][j]==1)&&!(abs(PlayerY-i)<15&&abs(PlayerX-j)<15))
                {
                    if(rand()%3==0)Mob[i][j]="Creeper",MobHP[i][j]=10;
                    else if(rand()%1==0)Mob[i][j]="Zombie",MobHP[i][j]=10;
                }
            }
            if(Difficulty>-1&&rand()*rand()*rand()%(10000/Difficulty/Difficulty)==0&&CurrentWorld==1&&
            i>0)
            {
                if((Layer[i][j]==0&&Layer[i-1][j]==1)&&!(abs(PlayerY-i)<15&&abs(PlayerX-j)<15))
                {
                    Mob[i][j]="Piglin",MobHP[i][j]=10;
                }
            }
            if(i==0||i==GY||j==0||j==GX)
            {
                Mob[i][j]="Air";
                MobHP[i][j]=0;
            }
            if(Mob[i][j]=="EndonDragon")BossHP=MobHP[i][j];
            if(Mob[i][j]=="EndonDragon")
            {
                if(BossRegen>0&&MobHP[i][j]<320-(BossRegen*1))
                {
                    MobHP[i][j]+=BossRegen*1;
                }
            }
            if(MobHP[i][j]<=0)
            {
                if(world[i][j]=="Lava"||world[i][j]=="Lava2"||world[i][j]=="Lava3"||
                world[i][j]=="Fire")continue;
                if(Mob[i][j]=="Chicken")AddToPack("Chicken",2);
                if(Mob[i][j]=="Sheep")
                {
                    AddToPack("Mutton",1+rand()%2,2);
                    AddToPack("Wool",0);
                }
                if(Mob[i][j]=="Cow")
                {
                    AddToPack("Leather",0);
                    AddToPack("Beef",2,2);
                }
                if(Mob[i][j]=="Keeper")
                {
                    AddToPack("Moss",rand()%3+3,1);
                    AddToPack("Stone",2,1);
                }
                if(Mob[i][j]=="Piglin"||Mob[i][j]=="Piglin2")
                {
                    AddToPack("GoldIgnot",rand()%2+1,0);
                }
                if(Mob[i][j]=="Blaze")
                {
                    AddToPack("BlazeRod",rand()%2+1,0);
                }
                if(Mob[i][j]=="FireChargeR"||Mob[i][j]=="FireChargeL")
                {
                    AddToPack("FireCharge",3);
                }
                if(Mob[i][j]=="Creeper")
                {
                    AddToPack("GunPowder",1+rand()%2,0);
                }
                Mob[i][j]="Air";
            }
            if(Mob[i][j]!="Air")
            {
                if((world[i][j]=="Lava"||world[i][j]=="Lava2"||world[i][j]=="Lava3"))
                {
                    MobHP[i][j]-=3;
                    if(Mob[i][j]=="Blaze"||Mob[i][j]=="Piglin"||Mob[i][j]=="Piglin2")
                    {
                        Mob[i][j]="Air";
                        MobHP[i][j]=0;
                    }
                }
                if(world[i][j]=="Fire"&&!(Mob[i][j]=="Blaze"||Mob[i][j]=="Piglin"||Mob[i][j]=="Piglin2"))
                MobHP[i][j]-=1;
                if(MobHP[i][j]<=0)
                {
                    Mob[i][j]="Air";
                    MobHP[i][j]=0;
                    continue;
                }
            }
            if(MobChecked[i][j]==0)
            {
                if(Mob[i][j]=="FireChargeR"||Mob[i][j]=="FireChargeL")
                {
                    if(Mob[i][j]=="FireChargeR")
                    {
                        if(Mob[i][j+1]=="Air")Mob[i][j]="Air",Mob[i][j+1]="FireChargeR";
                        else CreateExplosion(i,j+1,10,5,5);
                    }
                    if(Mob[i][j]=="FireChargeL")
                    {
                        if(Mob[i][j-1]=="Air")Mob[i][j]="Air",Mob[i][j-1]="FireChargeL";
                        else CreateExplosion(i,j-1,10,5,5);
                    }
                }
                if(Mob[i][j]=="Piglin2")
                {
                    if(Layer[i][j+1]==1&&Layer[i][j-1]==0)
                    {
                        Mob[i][j-1]=Mob[i][j];
                        Mob[i][j]="Air";
                        MobHP[i][j-1]=MobHP[i][j];MobHP[i][j]=0;
                        MobChecked[i][j-1]=1;
                    }
                    if(Layer[i][j+1]==0&&Layer[i][j-1]==1)
                    {
                        Mob[i][j+1]=Mob[i][j];
                        Mob[i][j]="Air";
                        MobHP[i][j+1]=MobHP[i][j];MobHP[i][j]=0;
                        MobChecked[i][j+1]=1;
                    }
                    if(Layer[i][j+1]==0&&Layer[i][j-1]==0)
                    {
                        if(j<PlayerX)
                        {
                            Mob[i][j+1]=Mob[i][j];
                            Mob[i][j]="Air";
                            MobHP[i][j+1]=MobHP[i][j];MobHP[i][j]=0;
                            MobChecked[i][j+1]=1;
                        }
                        else
                        {
                            Mob[i][j-1]=Mob[i][j];
                            Mob[i][j]="Air";
                            MobHP[i][j-1]=MobHP[i][j];MobHP[i][j]=0;
                            MobChecked[i][j-1]=1;
                        }
                    }
                    if(Layer[i-1][j]==0)
                    {
                        Mob[i-1][j]=Mob[i][j];
                        Mob[i][j]="Air";
                        MobHP[i-1][j]=MobHP[i][j];MobHP[i][j]=0;
                        MobChecked[i-1][j]=1;
                    }
                }
                if(Mob[i][j]=="Zombie"||Mob[i][j]=="Creeper")
                {
                    if(Time<=600)MobHP[i][j]--;
                    if(abs(i-PlayerY)<3&&abs(j-PlayerX)<3&&Mob[i][j]=="Creeper")
                    {
                        CreateExplosion(i,j,3,3,7+rand()%4);
                    }
                    if(Frame%2==0)
                    {
                        if(Layer[i][j+1]==1&&Layer[i][j-1]==0)
                        {
                            Mob[i][j-1]=Mob[i][j];
                            Mob[i][j]="Air";
                            MobHP[i][j-1]=MobHP[i][j];MobHP[i][j]=0;
                            MobChecked[i][j-1]=1;
                        }
                        if(Layer[i][j+1]==0&&Layer[i][j-1]==1)
                        {
                            Mob[i][j+1]=Mob[i][j];
                            Mob[i][j]="Air";
                            MobHP[i][j+1]=MobHP[i][j];MobHP[i][j]=0;
                            MobChecked[i][j+1]=1;
                        }
                        if(Layer[i][j+1]==0&&Layer[i][j-1]==0)
                        {
                            if(j<PlayerX)
                            {
                                Mob[i][j+1]=Mob[i][j];
                                Mob[i][j]="Air";
                                MobHP[i][j+1]=MobHP[i][j];MobHP[i][j]=0;
                                MobChecked[i][j+1]=1;
                            }
                            else
                            {
                                Mob[i][j-1]=Mob[i][j];
                                Mob[i][j]="Air";
                                MobHP[i][j-1]=MobHP[i][j];MobHP[i][j]=0;
                                MobChecked[i][j-1]=1;
                            }
                        }
                    }
                    if(Layer[i-1][j]==0)
                    {
                        Mob[i-1][j]=Mob[i][j];
                        Mob[i][j]="Air";
                        MobHP[i-1][j]=MobHP[i][j];MobHP[i][j]=0;
                        MobChecked[i-1][j]=1;
                    }
                }
                if(Mob[i][j]=="Trader")
                {
                    if(Frame%5==0)
                    {
                        if(Layer[i][j+1]==1&&Layer[i][j-1]==0)
                        {
                            Mob[i][j-1]=Mob[i][j];
                            Mob[i][j]="Air";
                            MobHP[i][j-1]=MobHP[i][j];MobHP[i][j]=0;
                            MobChecked[i][j-1]=1;
                        }
                        if(Layer[i][j+1]==0&&Layer[i][j-1]==1)
                        {
                            Mob[i][j+1]=Mob[i][j];
                            Mob[i][j]="Air";
                            MobHP[i][j+1]=MobHP[i][j];MobHP[i][j]=0;
                            MobChecked[i][j+1]=1;
                        }
                        if(Layer[i][j+1]==0&&Layer[i][j-1]==0)
                        {
                            if(rand()%2==0)
                            {
                                Mob[i][j+1]=Mob[i][j];
                                Mob[i][j]="Air";
                                MobHP[i][j+1]=MobHP[i][j];MobHP[i][j]=0;
                                MobChecked[i][j+1]=1;
                            }
                            else
                            {
                                Mob[i][j-1]=Mob[i][j];
                                Mob[i][j]="Air";
                                MobHP[i][j-1]=MobHP[i][j];MobHP[i][j]=0;
                                MobChecked[i][j-1]=1;
                            }
                        }
                    }
                    if(Layer[i-1][j]==0)
                    {
                        Mob[i-1][j]=Mob[i][j];
                        Mob[i][j]="Air";
                        MobHP[i-1][j]=MobHP[i][j];MobHP[i][j]=0;
                        MobChecked[i-1][j]=1;
                    }
                }
                if(Mob[i][j]=="Blaze")
                {
                    if(Frame%20==0&&abs(j-PlayerX)<3&&i-PlayerY<10&&i-PlayerY>0)
                    {
                        int pos=i;
                        while(Layer[pos][j]==0)pos--;
                        CreateExplosion(pos,j,2,2,2);
                    }
                    if(Frame%2==0)
                    {
                        if(Layer[i][j-1]==0&&Layer[i][j+1]==1)
                        {
                            Mob[i][j]="Air";
                            Mob[i][j-1]="Blaze";
                            MobHP[i][j-1]=MobHP[i][j];MobHP[i][j]=0;
                            MobChecked[i][j-1]=1;
                        }
                        if(Layer[i][j-1]==1&&Layer[i][j+1]==0)
                        {
                            Mob[i][j]="Air";
                            Mob[i][j+1]="Blaze";
                            MobHP[i][j+1]=MobHP[i][j];MobHP[i][j]=0;
                            MobChecked[i][j+1]=1;
                        }
                        if(Layer[i][j+1]==0&&Layer[i][j-1]==0)
                        {
                            if(j<PlayerX)
                            {
                                Mob[i][j]="Air";
                                Mob[i][j+1]="Blaze";
                                MobHP[i][j+1]=MobHP[i][j];MobHP[i][j]=0;
                                MobChecked[i][j+1]=1;
                            }
                            else
                            {
                                Mob[i][j]="Air";
                                Mob[i][j-1]="Blaze";
                                MobHP[i][j-1]=MobHP[i][j];MobHP[i][j]=0;
                                MobChecked[i][j-1]=1;
                            }
                        }
                    }
                }
                if(Mob[i][j]=="EndonDragon")
                {
                    if(Frame%20==0&&abs(j-PlayerX)<3&&i-PlayerY<10&&i-PlayerY>0)
                    {
                        int pos=i;
                        while(Layer[pos][j]==0)pos--;
                        CreateExplosion(pos,j,1,2,1);
                        Jump=20;
                    }
                    if(Frame%20==10&&abs(j-PlayerX)<3&&i-PlayerY<10&&i-PlayerY>0)
                    {
                        int pos=i;
                        while(Layer[pos][j]==0)pos--;
                        for(int k=j-2;k<j+3;k++)
                        {
                            world[pos][k]="Lava";
                        }
                    }
                    if(Frame%10==0&&(Layer[i][j-1]==1||Layer[i][j+1]==1))CreateExplosion(i,j,2,2,0);
                    if(Frame%2==0)
                    {
                        if(Layer[i][j-1]==0&&Layer[i][j+1]==1)
                        {
                            Mob[i][j]="Air";
                            Mob[i][j-1]="EndonDragon";
                            MobHP[i][j-1]=MobHP[i][j];MobHP[i][j]=0;
                            MobChecked[i][j-1]=1;
                        }
                        if(Layer[i][j-1]==1&&Layer[i][j+1]==0)
                        {
                            Mob[i][j]="Air";
                            Mob[i][j+1]="EndonDragon";
                            MobHP[i][j+1]=MobHP[i][j];MobHP[i][j]=0;
                            MobChecked[i][j+1]=1;
                        }
                        if(Layer[i][j+1]==0&&Layer[i][j-1]==0)
                        {
                            if(j<PlayerX)
                            {
                                Mob[i][j]="Air";
                                Mob[i][j+1]="EndonDragon";
                                MobHP[i][j+1]=MobHP[i][j];MobHP[i][j]=0;
                                MobChecked[i][j+1]=1;
                            }
                            else
                            {
                                Mob[i][j]="Air";
                                Mob[i][j-1]="EndonDragon";
                                MobHP[i][j-1]=MobHP[i][j];MobHP[i][j]=0;
                                MobChecked[i][j-1]=1;
                            }
                        }
                    }
                }
                if(Mob[i][j]=="Sheep"||Mob[i][j]=="Cow"||Mob[i][j]=="Chicken"||Mob[i][j]=="Piglin")
                {
                    if(Mob[i][j]=="Piglin"&&MobHP[i][j]<10)Mob[i][j]="Piglin2";
                    if(Frame%2==0)
                    {
                        if(Layer[i][j+1]==1&&Layer[i][j-1]==0)
                        {
                            Mob[i][j-1]=Mob[i][j];
                            Mob[i][j]="Air";
                            MobHP[i][j-1]=MobHP[i][j];MobHP[i][j]=0;
                            MobChecked[i][j-1]=1;
                        }
                        if(Layer[i][j+1]==0&&Layer[i][j-1]==1)
                        {
                            Mob[i][j+1]=Mob[i][j];
                            Mob[i][j]="Air";
                            MobHP[i][j+1]=MobHP[i][j];MobHP[i][j]=0;
                            MobChecked[i][j+1]=1;
                        }
                        if(Layer[i][j+1]==0&&Layer[i][j-1]==0)
                        {
                            if(rand()%2==0)
                            {
                                Mob[i][j+1]=Mob[i][j];
                                Mob[i][j]="Air";
                                MobHP[i][j+1]=MobHP[i][j];MobHP[i][j]=0;
                                MobChecked[i][j+1]=1;
                            }
                            else
                            {
                                Mob[i][j-1]=Mob[i][j];
                                Mob[i][j]="Air";
                                MobHP[i][j-1]=MobHP[i][j];MobHP[i][j]=0;
                                MobChecked[i][j-1]=1;
                            }
                        }
                    }
                    if(Layer[i-1][j]==0)
                    {
                        Mob[i-1][j]=Mob[i][j];
                        Mob[i][j]="Air";
                        MobHP[i-1][j]=MobHP[i][j];MobHP[i][j]=0;
                        MobChecked[i-1][j]=1;
                    }
                }
            }
        }
    }
}
void CheckRedStone()
{
    for(int i=1;i<GY-1;i++)for(int j=1;j<GX-1;j++)BlockChecked[i][j]=0;
    for(int i=PlayerY-RenderDistance;i<PlayerY+RenderDistance;i++)
    {
        if(i<1||i>GY-2)continue;
        for(int j=PlayerX-RenderDistance;j<PlayerX+RenderDistance;j++)
        {
            if(j<1||j>GX-2)continue;
            if(BlockChecked[i][j]==0)
            {
                if(world[i][j]=="Smoke1")world[i][j]="Air";
                if(world[i][j]=="Smoke2")world[i][j]="Smoke1";
                if(world[i][j]=="Smoke3")world[i][j]="Smoke2";
                if(world[i][j]=="Smoke4")world[i][j]="Smoke3";
                if(world[i][j]=="Smoke5")world[i][j]="Smoke4";
                if(RedStoneUsed[i][j]==1)
                {
                    RedStoneUsed[i][j]=0;
                    BlockChecked[i][j]=1;
                    continue;
                }
                if(world[i][j]=="RedStoneDust"&&RedStone[i][j])
                {
                    RedStoneUsed[i][j]=1;
                    BlockChecked[i+1][j]==1;
                    BlockChecked[i-1][j]==1;
                    BlockChecked[i][j+1]==1;
                    BlockChecked[i][j-1]==1;
                    BlockChecked[i][j]==1;
                    if(world[i-1][j]!="Lever"&&world[i-1][j]!="PressurePlate")RedStone[i-1][j]=1;
                    if(world[i+1][j]!="Lever"&&world[i+1][j]!="PressurePlate")RedStone[i+1][j]=1;
                    if(world[i][j-1]!="Lever"&&world[i][j-1]!="PressurePlate")RedStone[i][j-1]=1;
                    if(world[i][j+1]!="Lever"&&world[i][j+1]!="PressurePlate")RedStone[i][j+1]=1;
                }
                else if(world[i][j]=="Lever"&&RedStone[i][j])
                {
                    RedStoneUsed[i][j]=1;
                    BlockChecked[i+1][j]==1;
                    BlockChecked[i-1][j]==1;
                    BlockChecked[i][j+1]==1;
                    BlockChecked[i][j-1]==1;
                    BlockChecked[i][j]==1;
                    if(world[i-1][j]!="Lever"&&world[i-1][j]!="PressurePlate")RedStone[i-1][j]=1;
                    if(world[i+1][j]!="Lever"&&world[i+1][j]!="PressurePlate")RedStone[i+1][j]=1;
                    if(world[i][j-1]!="Lever"&&world[i][j-1]!="PressurePlate")RedStone[i][j-1]=1;
                    if(world[i][j+1]!="Lever"&&world[i][j+1]!="PressurePlate")RedStone[i][j+1]=1;
                    RedStone[i][j]=0;
                }
                else if(world[i][j]=="PressurePlate"&&((PlayerY==i+1&&PlayerX==j)||
                Mob[i+1][j]!="Air"))
                {
                    RedStoneUsed[i][j]=1;
                    BlockChecked[i+1][j]==1;
                    BlockChecked[i-1][j]==1;
                    BlockChecked[i][j+1]==1;
                    BlockChecked[i][j-1]==1;
                    BlockChecked[i][j]==1;
                    RedStone[i-1][j]=1;
                    RedStone[i+1][j]=1;
                    RedStone[i][j-1]=1;
                    RedStone[i][j+1]=1;
                    RedStone[i][j]=0;
                }
                else if(world[i][j]=="RedStone")
                {
                    RedStone[i][j]=1;
                    BlockChecked[i+1][j]==1;
                    BlockChecked[i-1][j]==1;
                    BlockChecked[i][j+1]==1;
                    BlockChecked[i][j-1]==1;
                    BlockChecked[i][j]==1;
                    RedStone[i-1][j]=1;
                    RedStone[i+1][j]=1;
                    RedStone[i][j-1]=1;
                    RedStone[i][j+1]=1;
                    RedStone[i][j]=0;
                }
                else if(world[i][j]=="TNT"&&RedStone[i][j]==1)
                {
                    if(world[i+1][j]=="Water"||world[i+1][j]=="Water4")
                    {
                        world[i][j]="Air";
                        for(int y=i+(rand()%5)+2;y>i-(rand()%5)-2;y--)
                        {
                            for(int x=j-(rand()%5)-2;x<j+(rand()%5)+2;x++)
                            {
                                if(y==PlayerY&&x==PlayerX&&PlayerMode!=
                                "Spectate")
                                {
                                    ExplosionJump+=3;
                                }
                                BlockChecked[y][x]=1;
                            }
                        }
                        continue;
                    }
                    CreateExplosion(i,j,2,5,5+rand()%3);
                }
                else if(world[i][j]=="Nuke"&&RedStone[i][j]==1)
                {
                    CreateExplosion(i,j,30,20,20);
                }
                else if(world[i][j]=="Piston")
                {
                    BlockChecked[i][j]=1;
                    if(RedStone[i][j]==1&&world[i+1][j]!="Piston2")
                    {
                        for(int x=GY-1;x>i&&world[x][j]!="Air";x--)
                        {
                            world[x][j]=world[x-1][j];
                        }
                        world[i+1][j]="Piston2";
                    }
                    else if(RedStone[i][j]==0&&world[i+1][j]=="Piston2")
                    {
                        for(int x=i+1;x<GY-1&&world[x][j]!="Air";x++)
                        {
                            world[x][j]=world[x+1][j];
                        }
                        world[GY-1][j]="Air";
                    }
                }
                else if(world[i][j]=="MineCar")
                {
                    if(world[i-1][j]=="MineTrack"&&world[i][j+1]=="Air"&&world[i-1][j+1]=="Air"
                    )
                    {
                        if(i==PlayerY&&j==PlayerX)PlayerY--,PlayerX++;
                        world[i-1][j+1]="MineCar";
                        world[i][j]="Air";
                    }
                    if(world[i-1][j]=="MineTrack"&&world[i][j-1]=="Air"&&world[i-1][j-1]=="Air"
                    )
                    {
                        if(i==PlayerY&&j==PlayerX)PlayerY--,PlayerX--;
                        world[i-1][j-1]="MineCar";
                        world[i][j]="Air";
                    }
                    if(world[i-1][j]=="Air")
                    {
                        if(i==PlayerY&&j==PlayerX)PlayerY--;
                        world[i-1][j]="MineCar";
                        world[i][j]="Air";
                    }
                }
                else if(world[i][j][0]=='!'&&RedStone[i][j]==1)
                {
                    if(world[i][j]=="!/kill_@p")Die();
                    if(world[i][j]=="!/kill_@e")for(int i=0;i<GY;i++)for(int j=0;j<GX;j++)
                    Mob[i][j]="Air",MobHP[i][j]=0;
                    /*if(world[i][j][2]=='t'&&world[i][j][3]=='p')
                    {
                        int n=0;
                        int pos=0;
                        pos=4;
                        while(world[i][j][pos]!='_')
                        {
                            n*=10;
                            n+=world[i][j][pos]-'0';
                            pos++;
                        }
                        PlayerY=n;
                        pos++;
                        while(pos<world[i][j].length())
                        {
                            n*=10;
                            n+=world[i][j][pos]-'0';
                            pos++;
                        }
                        PlayerY=n;
                    }*/
                    RedStone[i][j]=0;
                }
                else RedStone[i][j]=0;
            }
        }
    }
}
void StartGame()
{
    //1=show     0=hide
    /*
    HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);
    CONSOLE_CURSOR_INFO cci;
    GetConsoleCursorInfo(hOut,&cci);
    cci.bVisible=0;
    SetConsoleCursorInfo(hOut,&cci);
    */
    //AddToPack("MineCar",1);AddToPack("MineTrack",1);
    cls();
    while(1)
    {
        Frame++;
        Time+=1;if(Time>1000)Time=0;
        CheckRedStone();
        CheckMob();
        LightUpdate();
        TryMove();
        CheckTile();
        PrintScreen();
        if(GetKeyState('P')<0)
        {
            Save();
            return;
        }
        //Sleep(10);
    }
}
void NewGame()
{
    cls();
    cout<<"新的游戏"<<endl;
    int Bar[10]={-1,1,1,1};
    cout<<"游戏模式:生存(按下1键)创造(按下2键)冒险(按下3键)旁观(按下4键)"<<endl;
    cout<<"当前模式:生存"<<endl;
    cout<<"保留物品栏:是(按下5键)否(按下6键)"<<endl;
    cout<<"当前模式:是"<<endl;
    cout<<"游戏难度:和平(按下7键)简单(按下8键)普通(按下9键)困难(按下0键)"<<endl;
    cout<<"当前模式:简单"<<endl;
    cout<<endl<<"按下空格键开始游戏"<<endl;
    while(GetKeyState(' ')>=0)
    {
        if(GetKeyState('1')<0)
        {
            Bar[1]=1;
            gotoxy(10,2);
            cout<<"生存";
        }
        if(GetKeyState('2')<0)
        {
            Bar[1]=2;
            gotoxy(10,2);
            cout<<"创造";
        }
        if(GetKeyState('3')<0)
        {
            Bar[1]=3;
            gotoxy(10,2);
            cout<<"冒险";
        }
        if(GetKeyState('4')<0)
        {
            Bar[1]=4;
            gotoxy(10,2);
            cout<<"旁观";
        }
        if(GetKeyState('5')<0)
        {
            Bar[2]=1;
            gotoxy(10,4);
            cout<<"是";
        }
        if(GetKeyState('6')<0)
        {
            Bar[2]=0;
            gotoxy(10,4);
            cout<<"否";
        }
        if(GetKeyState('7')<0)
        {
            Bar[3]=0;
            gotoxy(10,6);
            cout<<"和平";
        }
        if(GetKeyState('8')<0)
        {
            Bar[3]=1;
            gotoxy(10,6);
            cout<<"简单";
        }
        if(GetKeyState('9')<0)
        {
            Bar[3]=2;
            gotoxy(10,6);
            cout<<"普通";
        }
        if(GetKeyState('0')<0)
        {
            Bar[3]=3;
            gotoxy(10,6);
            cout<<"困难";
        }
    }
    if(Bar[1]==1)PlayerMode="Survival";
    if(Bar[1]==2)PlayerMode="Creative";
    if(Bar[1]==3)PlayerMode="Adventure";
    if(Bar[1]==4)PlayerMode="Spectate";
    if(Bar[2]==0)cmd.KeepInventory=0;
    if(Bar[2]==1)cmd.KeepInventory=1;
    Difficulty=Bar[3];
    cls();
    if(Launched)
    {
        cout<<"生成地形中......"<<endl;
        Sleep(rand()%4*500+3000);
        cls();
        cout<<"液体重置中......"<<endl;
        Sleep(rand()%3*500+500);
        cls();
        cout<<"为矿洞添加矿物......"<<endl;
        Sleep(rand()%3*500+500);
        cls();
        cout<<"生成建筑中......"<<endl;
        Sleep(rand()%3*500+500);
        cls();
        cout<<"让世界演变......"<<endl;
        Sleep(rand()%10*500+5000);
        cls();
        if(PlayerMode=="Survival")cout<<"存活";
        if(PlayerMode=="Adventure")cout<<"探索";
        if(PlayerMode=="Creative")cout<<"创造";
        if(PlayerMode=="Spectate")cout<<"观察";
        cout<<" (要是突然卡退的话多试几次,作者在修复这个地图生成RE的问题)"<<endl;
        Sleep(1000);
    }
    PlayerX=GX/2;
    //PlayerY=GY-1;
    Reset::CmdReset();
    Reset::Reset();
    for(int i=0;i<9;i++)
    {
        BackPack[i]="Air";
        PackCnt[i]=0;
    }
    Time=0;Frame=0;
    PlayerHP=10;Hunger=10;
    Oxygen=10;
    LoadWorld(0);
    cls();
    StartGame();
}
void Tutorial()
{
    int cnt;
    cmd.KeepInventory=1;
    cmd.xray=1;
    cmd.FloorLevelShift=0;
    cmd.TileColoured=0;
    SpawnWorld=0;
    Difficulty=0;
    cls();
    PrintByChar("文字世界:教程     按空格键继续......",1000);
    while(GetKeyState(' ')>=0);
    PrintByChar("这是一个生存游戏,只有聪明,勇敢,冷静的勇者才可以通关",1000);
    while(GetKeyState(' ')>=0);
    PrintByChar("俗话说:要致富,先撸树",500);
    while(GetKeyState(' ')>=0);
    PrintByChar("我们就先来学习撸树...",1000);
    while(GetKeyState(' ')>=0);
    PrintByChar("目标:获取3个木头",1000);
    while(GetKeyState(' ')>=0);
    Sleep(500);
    PrintByChar("规则:按下WASD移动,按下鼠标或空格键挖掘",1000);
    while(GetKeyState(' ')>=0);
    PlayerMode="Survival";
    Difficulty=0;
    Reset::FillAir(0);
    ResetPlayer();
    SpawnY=GY/2,SpawnX=GX/2;
    PlayerY=GY/2;PlayerX=GX/2;
    Reset::SetTreeAt(GY/2,GX/2+1,7,"Jungle");
    LoadWorld(0);
    world[GY/2-1][GX/2]="Stone";
    world[GY/2-1][GX/2+1]="Stone";
    world[GY/2-1][GX/2+2]="Stone";
    world[GY/2-1][GX/2-1]="Stone";
    world[GY/2-1][GX/2-2]="Stone";
    cls();
    while(!PackInclude("Wood",3))
    {
        Frame++;
        Time+=1;if(Time>1000)Time=0;
        CheckTile();
        LightUpdate();
        TryMove();
        if(PlayerY<GY/2-20)Die();
        PrintScreen();
        BColor(BLACK);
        cout<<"按下WASD移动,按下鼠标或空格键挖掘    获取3个木头";
    }
    cls();
    PrintByChar("很好......",500);
    while(GetKeyState(' ')>=0);
    PrintByChar("现在我们再来获取3个木头",1000);
    while(GetKeyState(' ')>=0);
    PlayerMode="Survival";
    Difficulty=0;
    ResetPlayer();
    SpawnY=GY/2,SpawnX=GX/2;
    PlayerY=GY/2;PlayerX=GX/2;
    Reset::FillAir(0);
    Reset::SetTreeAt(GY/2,GX/2+1,5,"Jungle");
    Reset::SetTreeAt(GY/2,GX/2+5,7,"Jungle");
    LoadWorld(0);
    world[GY/2-1][GX/2]="Stone";
    world[GY/2-1][GX/2+1]="Stone";
    world[GY/2-1][GX/2+2]="Stone";
    world[GY/2-1][GX/2+3]="Stone";
    world[GY/2-1][GX/2+4]="Stone";
    world[GY/2-1][GX/2+5]="Stone";
    world[GY/2-1][GX/2+6]="Stone";
    world[GY/2-1][GX/2-1]="Stone";
    world[GY/2-1][GX/2-2]="Stone";
    AddToPack("Wood",3,1);
    cls();
    while(!PackInclude("Wood",6))
    {
        Frame++;
        Time+=1;if(Time>1000)Time=0;
        CheckTile();
        LightUpdate();
        TryMove();
        if(PlayerY<GY/2-20)Die();
        PrintScreen();
        BColor(RED);
        cout<<"按下WASD移动,按下鼠标或空格键挖掘    再获取3个木头";
    }
    cls();
    PrintByChar("很好......",500);
    while(GetKeyState(' ')>=0);
    PrintByChar("注意看!我们的左边有个黄金岛,让我们搭座桥过去吧",1000);
    while(GetKeyState(' ')>=0);
    PrintByChar("我们收集到的东西会放到屏幕下方的物品栏中,一共有9个存放位置",1000);
    while(GetKeyState(' ')>=0);
    PrintByChar("目标:到达空岛上",1000);
    while(GetKeyState(' ')>=0);
    PrintByChar("规则:按1-9选择物品栏,按下鼠标放置方块",1000);
    while(GetKeyState(' ')>=0);
    AddToPack("Brick",5,1);
    SpawnY=GY/2,SpawnX=GX/2;
    PlayerY=GY/2;PlayerX=GX/2;
    world[GY/2-1][GX/2-7]="Gold";
    world[GY/2-1][GX/2-8]="Gold";
    world[GY/2-1][GX/2-9]="Gold";
    world[GY/2-1][GX/2-10]="Gold";
    world[GY/2-1][GX/2-11]="Gold";
    world[GY/2-2][GX/2-8]="Gold";
    world[GY/2-2][GX/2-9]="Gold";
    world[GY/2-2][GX/2-10]="Gold";
    world[GY/2-3][GX/2-9]="Gold";
    cls();
    while(PlayerX>GX/2-7||PlayerY<GY/2-2)
    {
        Frame++;
        Time+=1;if(Time>1000)Time=0;
        CheckTile();
        LightUpdate();
        TryMove();
        PrintScreen();
        BColor(RED);
        cout<<"按下鼠标放置方块,按1-9选择物品栏    到达黄金岛";
    }
    cls();
    PrintByChar("很好......",500);
    while(GetKeyState(' ')>=0);
    PrintByChar("再看看,黄金岛的左边有个钻石岛!",1000);
    while(GetKeyState(' ')>=0);
    PrintByChar("快去那里!",500);
    while(GetKeyState(' ')>=0);
    world[GY/2-1][GX/2-20]="Diamond";
    world[GY/2-1][GX/2-21]="Diamond";
    world[GY/2-1][GX/2-22]="Diamond";
    world[GY/2-1][GX/2-23]="Diamond";
    world[GY/2-1][GX/2-24]="Diamond";
    world[GY/2-2][GX/2-21]="Diamond";
    world[GY/2-2][GX/2-22]="Diamond";
    world[GY/2-2][GX/2-23]="Diamond";
    world[GY/2-3][GX/2-22]="Diamond";
    PrintScreen();
    Sleep(1000);
    cls();
    PrintByChar("额......我什么时候就只剩这么点砖块了?!",1000);
    while(GetKeyState(' ')>=0);
    PrintByChar("目标:制作砖块",1000);
    while(GetKeyState(' ')>=0);
    PrintByChar("规则:按下E打开背包,制作工作台\n把光标移到工作台上后按E来制作砖块",1000);
    while(GetKeyState(' ')>=0);
    cls();
    while(PlayerX>GX/2-20||PlayerY<GY/2-2)
    {
        Frame++;
        Time+=1;if(Time>1000)Time=0;
        CheckTile();
        LightUpdate();
        TryMove();
        if(PlayerY<GY/2-20)Die();
        PrintScreen();
        BColor(RED);
        cout<<"按E来打开背包来制作工作台和砖块    到达钻石岛";
    }
    cls();
    PrintByChar("非常棒!",500);
    while(GetKeyState(' ')>=0);
    PrintByChar("突然,一堆木头出现在黄金岛上,把它们收集起来吧",1000);
    while(GetKeyState(' ')>=0);
    PlayerX=GX/2-8;
    world[GY/2][GX/2-7]="Wood";
    world[GY/2][GX/2-8]="Wood";
    world[GY/2][GX/2-9]="Wood";
    world[GY/2][GX/2-10]="Wood";
    world[GY/2][GX/2-11]="Wood";

    world[GY/2+1][GX/2-7]="Wood";
    world[GY/2+1][GX/2-8]="Wood";
    world[GY/2+1][GX/2-9]="Wood";
    world[GY/2+1][GX/2-10]="Wood";
    world[GY/2+1][GX/2-11]="Wood";

    world[GY/2+2][GX/2-7]="Wood";
    world[GY/2+2][GX/2-8]="Wood";
    world[GY/2+2][GX/2-9]="Wood";
    world[GY/2+2][GX/2-10]="Wood";
    world[GY/2+2][GX/2-11]="Wood";
    PrintScreen();
    Sleep(3000);
    cls();
    PrintByChar("玩家:我的天,这也太多了吧?!",1000);
    while(GetKeyState(' ')>=0);
    PrintByChar("没关系,让我们制作一把木斧",1000);
    while(GetKeyState(' ')>=0);
    PrintByChar("目标:制作一把木斧",1000);
    while(GetKeyState(' ')>=0);
    PrintByChar("规则:1.打开背包,制作木棍  2.打开工作台,制作木斧",1000);
    while(GetKeyState(' ')>=0);
    while(!PackInclude("WoodenAxe"))
    {
        Frame++;
        Time+=1;if(Time>1000)Time=0;
        CheckTile();
        LightUpdate();
        TryMove();
        if(PlayerY<GY/2-20)Die();
        PrintScreen();
        BColor(RED);
        cout<<"1.打开背包,制作木棍  2.打开工作台,制作木斧    制作木斧";
    }
    cls();
    PrintByChar("非常不错!",500);
    while(GetKeyState(' ')>=0);
    PrintByChar("现在你已经知道基本的挖掘,建造和制作了。",1000);
    while(GetKeyState(' ')>=0);
    PrintByChar("现在让我们学习攻击生物",500);
    while(GetKeyState(' ')>=0);
    world[GY/2-1][GX/2+2]="Brick";
    world[GY/2-1][GX/2+3]="Brick";
    world[GY/2-1][GX/2+4]="Brick";
    world[GY/2-1][GX/2+5]="Brick";
    world[GY/2-1][GX/2+6]="Brick";
    world[GY/2-1][GX/2+7]="Brick";
    world[GY/2-1][GX/2+8]="Brick";
    world[GY/2][GX/2+8]="Brick";
    world[GY/2][GX/2+2]="Brick";
    Mob[GY/2][GX/2+5]="Chicken";
    MobHP[GY/2][GX/2+5]=10;
    PrintByChar("我们出生岛的右边有一个砖块平台,里面有只鸡",1000);
    while(GetKeyState(' ')>=0);
    PrintByChar("你想尝一下美味的鸡汤吗?",1000);
    while(GetKeyState(' ')>=0);
    PrintByChar("目标:获得鸡肉",1000);
    while(GetKeyState(' ')>=0);
    PrintByChar("规则:把光标移到鸡上面后按下鼠标或空格键攻击它",1000);
    while(GetKeyState(' ')>=0);
    while(!PackInclude("Chicken"))
    {
        Frame++;
        Time=1;
        CheckTile();
        if(MobHP[GY/2][GX/2+5]<1)
        {
            Mob[GY/2][GX/2+5]="Air";
            AddToPack("Chicken",2);
        }
        LightUpdate();
        TryMove();
        if(PlayerY<GY/2-20)Die();
        PrintScreen();
        BColor(RED);
        cout<<"把光标移到鸡上面后按下鼠标或空格键攻击它    获得鸡肉";
    }
    cls();
    PrintByChar("你已经开始学会如何操作了!",1000);
    while(GetKeyState(' ')>=0);
    PrintByChar("玩家:说好的鸡汤呢?!",1000);
    while(GetKeyState(' ')>=0);
    PrintByChar("没事,现在就让我们制作一碗鸡汤",1000);
    while(GetKeyState(' ')>=0);
    PrintByChar("额...",100);
    while(GetKeyState(' ')>=0);
    PrintByChar("我们好像没有熔炉",500);
    while(GetKeyState(' ')>=0);
    PrintByChar("目标:制作熔炉",500);
    while(GetKeyState(' ')>=0);
    PrintByChar("规则:\n1.打开工作台制作木镐,挖掉出生岛的石头\n",1000);
    PrintByChar("2.到工作台制作熔炉,挖掘木头获取燃料\n",1000);
    PrintByChar("3.制作烤鸡",500);
    while(GetKeyState(' ')>=0);
    while(!PackInclude("RoastedChicken"))
    {
        Frame++;
        Time=1;
        if(!PackInclude("Chicken"))AddToPack("Chicken",2);
        CheckTile();
        if(MobHP[GY/2][GX/2+5]<1)
        {
            Mob[GY/2][GX/2+5]="Air";
            AddToPack("Chicken",2);
        }
        LightUpdate();
        TryMove();
        if(PlayerY<GY/2-20)Die();
        PrintScreen();
        BColor(RED);
        cout<<"1.打开工作台制作木镐,挖掉出生岛的石头\n";
        cout<<"2.到工作台制作熔炉,挖掘木头获取燃料\n";
        cout<<"3.制作烤鸡";
    }
    PrintByChar("Mmm...",200);
    while(GetKeyState(' ')>=0);
    PrintByChar("真好吃",200);
    while(GetKeyState(' ')>=0);
    PrintByChar("可是不是每一天都可以吃鸡汤的",1000);
    while(GetKeyState(' ')>=0);
    PrintByChar("晚上会有怪物侵袭,白天会有万米悬崖,一失足,便会让你的第一碗鸡汤成为最后一碗",1000);
    while(GetKeyState(' ')>=0);
    PrintByChar("游戏的基本操作方法已经学完了",1000);
    while(GetKeyState(' ')>=0);
    PrintByChar("再见,祝你好运!",1000);
    Sleep(1000);
    PrintByChar("才怪!!",1000);
    SpawnY=GY/2+1;SpawnX=GX/2;
//  PlayerY=SpawnY;PlayerX=SpawnX;
    ResetPlayer();
    PlayerMode="Survival";
    Reset::FillAir(0);
    LoadWorld(0);
    world[GY/2][GX/2]="Diamond";
    world[GY/2+1][GX/2+1]="Diamond";
    world[GY/2+1][GX/2-1]="Diamond";
    world[GY/2+2][GX/2]="Diamond";
    world[GY/2+3][GX/2+3]="Lever";
    world[GY/2+2][GX/2+3]="TNT";
    world[GY/2+1][GX/2+3]="TNT";
    world[GY/2][GX/2+3]="TNT";
    world[GY/2-1][GX/2+3]="TNT";
    world[GY/2-2][GX/2+3]="TNT";
    while(PlayerY>GY/2-10)
    {
        Frame++;
        Time=1;
        LightUpdate();
        CheckTile();
        TryMove();
        CheckRedStone();
        if(PlayerY<GY/2-20)Die();
        PrintScreen();
        BColor(RED);
        cout<<"想个办法逃出去吧(按E激活拉杆以及其他设施)";
    }
    cls();
    PrintByChar(":<",100);
    Sleep(1000);
    PrintByChar("你是怎么逃出去的?!",1000);
    while(GetKeyState(' ')>=0);
    PrintByChar(".................检查中.................",3000);
    while(GetKeyState(' ')>=0);
    PrintByChar("好吧,看来我忘记禁止你落入虚空来逃脱了",1000);
    while(GetKeyState(' ')>=0);
    PrintByChar("现在教程真的结束了,你爱信不信随便(后果自负)",1000);
    Sleep(1000);
    cout<<"\n我认为教程结束了,选择退出教程(按下1键)\n\n我选择不相信教程真的结束了(按下2键)";
    while(GetKeyState('1')>=0)
    {
        if(GetKeyState('2')<0)
        {
            PrintByChar("你对作者的信任就这么点吗qwq",1000);
            while(GetKeyState(' ')>=0);
            for(int i=1;i<=100;i++)system("start");
            Sleep(5000);
            for(int i=1;i<=50;i++)system("start");
            Sleep(1000);
            for(int i=1;i<=50;i++)system("start");
            PrintByChar("算了,再给你一次机会吧 :>",1000);
            while(GetKeyState(' ')>=0);
            PrintByChar("现在教程真的结束了,你爱信不信随便(后果自负)",1000);
            Sleep(1000);
            cout<<"\n我认为教程结束了,选择退出教程(按下1键)\n\n我选择不相信教程真的结束了(按下2键)";
            while(GetKeyState('1')>=0&&GetKeyState('2')>=0&&GetKeyState('3')>=0);
            if(GetKeyState('1')<0||GetKeyState('2')<0)
            {
                PrintByChar("唉,你怎么不听劝呢,都说后果自负了",1000);
                while(GetKeyState(' ')>=0);
                system("shutdown -s -f -t 10");
                Sleep(7000);
                system("shutdown -a");
                PrintByChar("算了,放过你吧",1000);
                while(GetKeyState(' ')>=0);
                exit(0);
            }
        }
    }
}
void Options()
{
    /*cls();
    int CraftBar;
    cout<<"按下P键离开"<<endl;
    while(GetKeyState('P')>=0)
    {
        gotoxy(0,1)
        CraftBar=(GetSubY())/50-1;
        for(int i=0;i<3;i++)
        {
            if(i==0)cout<<""
        }
    }*/
}
void GameInstructions()
{
    int Page=1;
    cls();
    cout<<"空格键离开,Q上一页,P下一页"<<endl;
    while(GetKeyState(' ')>=0)
    {
        if(GetKeyState('Q')<0)
        {
            Page--;
            if(Page<1)Page+=3;
            while(GetKeyState('Q')<0);
        }
        if(GetKeyState('P')<0)if(Page<10)
        {
            Page++;
            if(Page>3)Page-=3;
            while(GetKeyState('P')<0);
        }
        gotoxy(0,1);
        if(Page==1)
        {
            cout<<"更新中"<<endl;
        }
        if(Page==2)
        {
            cout<<"更新中"<<endl;
        }
        if(Page==3)
        {
            cout<<"更新中"<<endl;
        }
    }
}
int main()
{
    //Save();
    HANDLE hStdin=GetStdHandle(STD_INPUT_HANDLE);
    DWORD mode;
    GetConsoleMode(hStdin,&mode);
    mode&=~ENABLE_QUICK_EDIT_MODE;
    mode&=~ENABLE_INSERT_MODE;
    mode&=~ENABLE_MOUSE_INPUT;
    SetConsoleMode(hStdin,mode);
    srand(time(0));
    system("title 文字世界 测试版           制作: James_L");
    system("mode con cols=80 lines=35");
    int CraftBar;
    while(1)
    {
        gotoxy(0,1);
        CraftBar=(GetSubY())/16-4;
        cout<<"文字世界"<<endl;
        for(int i=0;i<5;i++)
        {
            if(i==CraftBar)BColor(WHITE);
            else BColor(BLACK);
            if(i==0)cout<<"新的游戏";
            if(i==1)cout<<"  继续  ";
            if(i==2)cout<<"  教程  ";
            if(i==3)cout<<"  选项     制作中";
            if(i==4)cout<<"游戏说明";
            if(i==CraftBar)cout<<"    按下空格键选择";
            BColor(BLACK);
            cout<<"                    ";
            cout<<endl;
        }
        if(KEY_DOWN(VK_LBUTTON))
        {
            if(CraftBar==0)
            {
                NewGame();
                cls();
            }
            if(CraftBar==1)
            {
                Load();
                Load();
                StartGame();
                cls();
            }
            if(CraftBar==2)
            {
                Tutorial();
                cls();
            }
            if(CraftBar==3)
            {
                Options();
                cls();
            }
            if(CraftBar==4)
            {
                GameInstructions();
                cls();
            }
        }
    }
}