Esempio n. 1
0
        private static Blocktype Add(string name, bool placeable, bool solid, bool opaque)
        {
            Blocktype type = new Blocktype(Count, name, placeable, solid, opaque);

            blocktypes.Add(type);
            return(type);
        }
Esempio n. 2
0
 public static void Init()
 {
     if (initialized)
     {
         throw new Exception("Blocktypes are already initialized!");
     }
     initialized      = true;
     air              = Add("Air", false, false, false);
     rock             = Add("Rock");
     grass            = Add("Grass", false);
     dirt             = Add("Dirt");
     cobblestone      = Add("Cobblestone");
     wood             = Add("Wood");
     sapling          = Add("Sapling", true);
     adminium         = Add("Adminium", false);
     water            = Add("Water", false, false);
     stillWater       = Add("StillWater", false, false);
     lava             = Add("Lava", false, false);
     stillLava        = Add("StillLava", false, false);
     sand             = Add("Sand");
     gravel           = Add("Gravel");
     goldOre          = Add("GoldOre");
     ironOre          = Add("IronOre");
     coalOre          = Add("CoalOre");
     tree             = Add("Tree");
     leaves           = Add("Leaves", true, true, false);
     sponge           = Add("Sponge");
     glass            = Add("Glass", true, true, false);
     red              = Add("Red");
     orange           = Add("Orange");
     yellow           = Add("Yellow");
     lightGreen       = Add("LightGreen");
     green            = Add("Green");
     aquaGreen        = Add("AquaGreen");
     cyan             = Add("Cyan");
     blue             = Add("Blue");
     purple           = Add("Purple");
     indigo           = Add("Indigo");
     violet           = Add("Violet");
     magenta          = Add("Magenta");
     pink             = Add("Pink");
     black            = Add("Black");
     gray             = Add("Gray");
     white            = Add("White");
     flower           = Add("Flower", true);
     rose             = Add("Rose", true);
     brownMushroom    = Add("BrownMushroom", true);
     redMushroom      = Add("RedMushroom", true);
     gold             = Add("Gold");
     iron             = Add("Iron");
     doubleStair      = Add("DoubleStair", false);
     stair            = Add("Stair", true, false, true);
     redBrick         = Add("RedBrick");
     TNT              = Add("TNT");
     bookcase         = Add("Bookcase");
     mossyCobblestone = Add("MossyCobblestone");
     obsidian         = Add("Obsidian");
 }
Esempio n. 3
0
 private static Blocktype Add(string name,bool placeable,bool solid,bool opaque)
 {
     Blocktype type = new Blocktype(Count,name,placeable,solid,opaque);
     blocktypes.Add(type);
     return type;
 }
Esempio n. 4
0
 public static void Init()
 {
     if (initialized) { throw new Exception("Blocktypes are already initialized!"); }
     initialized = true;
     air = Add("Air",false,false,false);
     rock = Add("Rock");
     grass = Add("Grass",false);
     dirt = Add("Dirt");
     cobblestone = Add("Cobblestone");
     wood = Add("Wood");
     sapling = Add("Sapling",true);
     adminium = Add("Adminium",false);
     water = Add("Water",false,false);
     stillWater = Add("StillWater",false,false);
     lava = Add("Lava",false,false);
     stillLava = Add("StillLava",false,false);
     sand = Add("Sand");
     gravel = Add("Gravel");
     goldOre = Add("GoldOre");
     ironOre = Add("IronOre");
     coalOre = Add("CoalOre");
     tree = Add("Tree");
     leaves = Add("Leaves",true,true,false);
     sponge = Add("Sponge");
     glass = Add("Glass",true,true,false);
     red = Add("Red");
     orange = Add("Orange");
     yellow = Add("Yellow");
     lightGreen = Add("LightGreen");
     green = Add("Green");
     aquaGreen = Add("AquaGreen");
     cyan = Add("Cyan");
     blue = Add("Blue");
     purple = Add("Purple");
     indigo = Add("Indigo");
     violet = Add("Violet");
     magenta = Add("Magenta");
     pink = Add("Pink");
     black = Add("Black");
     gray = Add("Gray");
     white = Add("White");
     flower = Add("Flower",true);
     rose = Add("Rose",true);
     brownMushroom = Add("BrownMushroom",true);
     redMushroom = Add("RedMushroom",true);
     gold = Add("Gold");
     iron = Add("Iron");
     doubleStair = Add("DoubleStair",false);
     stair = Add("Stair",true,false,true);
     redBrick = Add("RedBrick");
     TNT = Add("TNT");
     bookcase = Add("Bookcase");
     mossyCobblestone = Add("MossyCobblestone");
     obsidian = Add("Obsidian");
 }
Esempio n. 5
0
        private void OnBlock(short x, short y, short z, byte action, byte type)
        {
            if (status != OnlineStatus.Ready)
            {
                return;
            }
            if (!Group.CanBuild)
            {
                SendBlock(x, y, z); return;
            }
            if (action >= 2)
            {
                new Message("&eUnknown block action.").Send(this);
                SendBlock(x, y, z); return;
            }
            Blocktype blocktype = Blocktype.FindById(type);

            if (blocktype == null)
            {
                new Message("&eUnknown blocktype.").Send(this);
                SendBlock(x, y, z); return;
            }
            if (!blocktype.Placeable)
            {
                new Message("&eUnplaceable blocktype.").Send(this);
                SendBlock(x, y, z); return;
            }
            if (y == level.Depth)
            {
                return;
            }
            if (x >= level.Width || y >= level.Depth || z >= level.Height)
            {
                new Message("&eInvalid block position.").Send(this); return;
            }
            byte block = bind[type];

            if (action == 0)
            {
                block = 0x00;
            }
            byte before = level[x, y, z];

            if (before == block)
            {
                if (bind[type] != type)
                {
                    SendBlock(x, y, z);
                }
                return;
            }
            if (before == Blocktype.adminium.ID && !destroyAdminium)
            {
                Protocol.BlockPacket(x, y, z, 7).Send(this);
                return;
            }
            BlockArgs args = new BlockArgs(this, x, y, z, block);

            BlockEvent.Raise(server, this, args, type);
            if (!args.Abort)
            {
                InternalBlockEvent(this, args, (bind[type] != type));
            }
            else if (level[x, y, z] == before)
            {
                SendBlock(x, y, z);
            }
        }