Exemplo n.º 1
0
 public MCMapRoom(MCRoomFill room, int x, int y, int z)
 {
     this.room     = room;
     mapX          = x; mapY = y; mapZ = z;
     defaultFacing = MCRenderFacing.North;
     pitch         = 0;
 }
Exemplo n.º 2
0
 public MCMapRoom()
 {
     room          = new MCRoomFill(new MCFill(6, 6, 6, 0, 0, 1, "minecraft:air"));
     mapX          = 0;
     mapY          = 0;
     mapZ          = 0;
     defaultFacing = MCRenderFacing.North;
     pitch         = 0;
 }
Exemplo n.º 3
0
        public string[] Render(MCRenderFacing Facing, int Pitch, bool IsAbsolute, params int[] Offset)
        {
            string[] render = new string[this.Count];
            for (int x = 0; x < this.Count; x++)
            {
                render[x] = this[x].Render(Facing, Pitch, IsAbsolute, Offset);
            }

            return(render);
        }
Exemplo n.º 4
0
        public string[] RenderMapAbsolute(MCRenderFacing Facing, int Pitch, int x, int y, int z)
        {
            List <string> cmds = new List <string>();

            foreach (MCMapRoom room in this)
            {
                cmds.AddRange(room.RenderAbsolute(Facing, Pitch, x, y, z));
            }

            return(cmds.ToArray());
        }
Exemplo n.º 5
0
        public string[] RenderMap(MCRenderFacing Facing, int Pitch)
        {
            List <string> cmds = new List <string>();

            foreach (MCMapRoom room in this)
            {
                cmds.AddRange(room.Render(Facing, Pitch));
            }

            return(cmds.ToArray());
        }
Exemplo n.º 6
0
        /// <summary>
        /// Render the cube, using relative coodinates of the player executing the command.
        /// </summary>
        /// <param name="Facing">Compass direction to render centered on player location.</param>
        /// <param name="Pitch">Render the cube level (0), looking up (1), looking down (-1)</param>
        /// <param name="IsAbsolute">The coordinates stored for the cube are either relative to the player or
        /// absolute world coordinates.</param>
        /// <param name="offset">If there should be an offset computed first, does not change the orginal cube.</param>
        /// <returns></returns>
        public string Render(MCRenderFacing Facing, int Pitch, bool IsAbsolute, params int[] offset)
        {
            int rx = 0, ry = 1, rz = 0;
            int sx = 0, sy = 0, sz = 0;

            int[] r1 = new int[3];
            int[] r2 = new int[3];

            switch (Facing)
            {
            case MCRenderFacing.North:

                switch (Pitch)
                {
                case -1:

                    rx = 0; ry = 2; rz = 1;
                    sx = 1; sy = -1; sz = -1;

                    break;

                case 1:

                    rx = 0; ry = 2; rz = 1;
                    sx = -1; sy = 1; sz = 1;
                    break;

                default:
                    rx = 0; ry = 1; rz = 2;
                    sx = 1; sy = 1; sz = -1;
                    break;
                }
                break;

            case MCRenderFacing.South:
                switch (Pitch)
                {
                case -1:
                    rx = 0; ry = 2; rz = 1;
                    sx = -1; sy = 1; sz = -1;
                    break;

                case 1:
                    rx = 0; ry = 2; rz = 1;
                    sx = 1; sy = -1; sz = 1;
                    break;

                default:
                    rx = 0; ry = 1; rz = 2;
                    sx = -1; sy = 1; sz = 1;
                    break;
                }
                break;

            case MCRenderFacing.East:
                switch (Pitch)
                {
                case -1:
                    rx = 2; ry = 0; rz = 1;
                    sx = 1; sy = 1; sz = -1;
                    break;

                case 1:
                    rx = 2; ry = 0; rz = 1;
                    sx = -1; sy = -1; sz = 1;
                    break;

                default:
                    rx = 2; ry = 1; rz = 0;
                    sx = 1; sy = 1; sz = 1;
                    break;
                }
                break;

            case MCRenderFacing.West:
                switch (Pitch)
                {
                case -1:
                    rx = 2; ry = 0; rz = 1;
                    sx = -1; sy = -1; sz = -1;
                    break;

                case 1:
                    rx = 2; ry = 0; rz = 1;
                    sx = 1; sy = 1; sz = 1;
                    break;

                default:
                    rx = 2; ry = 1; rz = 0;
                    sx = -1; sy = 1; sz = -1;
                    break;
                }
                break;
            }

            r1[0] = sx * (offset[rx] + p1[rx]);
            r1[1] = sy * (offset[ry] + p1[ry]);
            r1[2] = sz * (offset[rz] + p1[rz]);
            r2[0] = sx * (offset[rx] + p2[rx]);
            r2[1] = sy * (offset[ry] + p2[ry]);
            r2[2] = sz * (offset[rz] + p2[rz]);

            if (IsAbsolute == true)
            {
                return(string.Format(@"fill {1} {2} {3} {4} {5} {6} {0}", BlockType, r1[0], r1[1], r1[2], r2[0], r2[1], r2[2]));
            }
            else
            {
                return(string.Format(@"fill ~{1} ~{2} ~{3} ~{4} ~{5} ~{6} {0}", BlockType, r1[0], r1[1], r1[2], r2[0], r2[1], r2[2]));
            }
        }
Exemplo n.º 7
0
 /// <summary>
 /// Render the cube, using relative coodinates of the player executing the command.
 /// </summary>
 /// <param name="Facing">Which compass facing to render the cube, from the player location, level to ground.</param>
 /// <returns></returns>
 public string Render(MCRenderFacing Facing)
 {
     return(Render(Facing, 0, false, 0, 0, 0));
 }
Exemplo n.º 8
0
 public MCMap(MCRenderFacing Facing, int Pitch) : base()
 {
     facing = Facing; pitch = Pitch;
 }
Exemplo n.º 9
0
 public MCMap() : base()
 {
     facing = MCRenderFacing.North; pitch = 0;
 }
Exemplo n.º 10
0
 public string[] RenderAbsolute(MCRenderFacing Facing, int Pitch, int x, int y, int z)
 {
     return(room.Render(Facing, Pitch, true, x + (mapX * 6), y + (mapY * 6), z + (mapZ * 6)));
 }
Exemplo n.º 11
0
 public string[] Render(MCRenderFacing Facing, int Pitch)
 {
     return(room.Render(Facing, Pitch, false, mapX * 6, mapY * 6, mapZ * 6));
 }
Exemplo n.º 12
0
 public MCMapRoom(MCRoomFill room, int x, int y, int z, MCRenderFacing Facing, int Pitch)
     : this(room, x, y, z)
 {
     defaultFacing = Facing;
     pitch         = Pitch;
 }