Ejemplo n.º 1
0
 public Blocks Copy()
 {
     Blocks b = new Blocks(X, Y, Z);
     for (int i = 0; i < totalCount; i++)
         b[i] = new Block(this[i]);
     return b;
 }
Ejemplo n.º 2
0
 public Block(Block b)
     : this(b.ID, b.Place, b.Charge, b.Delay, b.Ticks)
 {
 }
Ejemplo n.º 3
0
 public Blocks(int x, int y, int z, Block[] d)
 {
     data = d; lenX = x; lenY = y; lenZ = z;
 }
Ejemplo n.º 4
0
        public static Blocks Load(string filename)
        {
            NbtFile f = new NbtFile();
            f.LoadFile(filename);
            NbtCompound root = f.RootTag;
            NbtTag nBlocks = root["Blocks"];
            NbtTag nData = root["Data"];
            NbtTag nWidth = root["Width"];
            NbtTag nLength = root["Length"];
            NbtTag nHeight = root["Height"];
            byte[] blocks = ((NbtByteArray)nBlocks).Value;
            byte[] extra = ((NbtByteArray)nData).Value;
            int X = (int)((NbtShort)nWidth).Value;
            int Y = (int)((NbtShort)nLength).Value;
            int Z = (int)((NbtShort)nHeight).Value;
            Blocks b = new Blocks(X, Y, Z);
            //bool sch = filename.EndsWith(".schematic");

            for (int i = 0; i < blocks.Length; i++)
                switch (blocks[i])
                {
                    case 0:
                    case 6:
                    case 37:
                    case 38:
                    case 39:
                    case 40:
                    case 51:
                    case 59:
                    case 63:
                    case 65:
                    case 66:
                    case 68:
                    case 78:
                    case 83:
                        b[i] = Block.AIR;
                        break;
                    case 55:
                        b[i] = Block.WIRE;
                        break;
                    case 75: // Off
                        b[i] = new Block(BlockType.TORCH, PlaceTorch(extra[i]), 0, 0, 0);

                        break;
                    case 76: // Off
                        b[i] = new Block(BlockType.TORCH, PlaceTorch(extra[i]), 16, 0, 0);

                       // System.Console.WriteLine("Loc: {2}  Torch Dir: {0}    Byte: {1}", b[i].Place.ToString(), extra[i] & 0x7,i);
                        break;
                    case 69:
                        b[i] = new Block(BlockType.LEVER,  PlaceTorch(extra[i]),(extra[i] & 0x8) == 1 ? 16 : 0, 0, 0);

                     //   System.Console.WriteLine("Lever Dir: {0}    Byte: {1}", b[i].Place.ToString(), extra[i] & 0x7);
                        break;
                    case 70:
                    case 72:
                        b[i] = Block.PREASUREPAD;
                        break;
                    case 77:
                        b[i] = Block.BUTTON;
                        b[i].Place = PlaceButton(extra[i]);
                        break;
                    case 64: // doors not working yet
                    case 71:
                        break;
                    case 93: // skip repeaters for now

                        break;
                    default:
                        b[i] = Block.BLOCK;
                        break;

                }

            return b;
        }
Ejemplo n.º 5
0
 void MakeSelectArray()
 {
     selectArray = new Block[8];
     selectArray[0] = new Block(BlockType.AIR, Direction.DOWN, 0, 0, 0);
     selectArray[1] = new Block(BlockType.BLOCK, Direction.DOWN, 0, 0, 0);
     selectArray[2] = new Block(BlockType.WIRE, Direction.DOWN, 16, 0, 0); selectArray[2].Mask = WireMask.AllDir;
     selectArray[3] = new Block(BlockType.TORCH, Direction.NORTH, 16, 0, 0);
     selectArray[4] = new Block(BlockType.LEVER, Direction.NORTH, 0, 0, 0);
     selectArray[5] = new Block(BlockType.BUTTON, Direction.NORTH, 0, 0, 0);
     selectArray[6] = new Block(BlockType.PREASUREPAD, Direction.DOWN, 0, 0, 0);
     selectArray[7] = new Block(BlockType.REPEATER, Direction.NORTH, 0, 0, 0);
 }
Ejemplo n.º 6
0
 public BlockDrawSettings(Block b, bool On)
     : this(b)
 {
     this.On = On;
 }
Ejemplo n.º 7
0
 public BlockDrawSettings(Block b)
     : this()
 {
     B = b; this.On = b.Powered ? true : false; Mask = B.Mask; Place = B.Place; ID = B.ID; Delay = B.Delay;
 }