예제 #1
0
        private void AssertNbtBigFile(NbtFile file)
        {
            // NbtList enities;
            //NbtList tileenities;

            // See TestFiles/bigtest.nbt.txt to see the expected format


            NbtCompound root = file.RootTag;

            if (root.Name == "Schematic")
            {
                redBmp = new redstoneBmp();
                // I don't know why but I keep getting cofused with the height, width, length stuff
                // maybe its because I deal with to many 2d objects.
                rYmax      = root.Query <NbtShort>("/Schematic/Width").Value;
                rZmax      = root.Query <NbtShort>("/Schematic/Height").Value;
                rXmax      = root.Query <NbtShort>("/Schematic/Length").Value;
                rMaterials = root.Query <NbtString>("/Schematic/Materials").Value;
                rBlocks    = root.Query <NbtByteArray>("/Schematic/Blocks").Value;
                rData      = root.Query <NbtByteArray>("/Schematic/Data").Value;
                rGrid      = new gBlockTypeStruct[rBlocks.Length];

                // Ok, lets get this link list a starting
                for (int i = 0; i < rBlocks.Length; i++)
                {
                    // Put the normal code here to fill the data for the blocks, and data
                    // skipping for now as its more important to get the link list working
                }

                // Just so I can get a good visual on it going to precaculate the numbers
                int xStride = rXmax;
                int zStride = xStride * rYmax;

                // Precaculate the last line in a floor and the last floor
                int zLast = rData.Length - zStride;
                int yLast = zStride - xStride;

                // Lets try something diffrent and do all bounds checking

                for (int i = 0; i < rBlocks.Length; i++)
                {
                    int z = i / zStride;
                    int y = (i - z * zStride) / xStride;
                    int x = i - (y * xStride) - (z * zStride);
                    rGrid[i]   = redBmp.getSet(rBlocks[i]);
                    rGrid[i].X = x; rGrid[i].Y = y; rGrid[i].Z = z;
                }
            }
        }
예제 #2
0
		 private void AssertNbtBigFile(NbtFile file)
        {
           // NbtList enities;
            //NbtList tileenities;
            
            // See TestFiles/bigtest.nbt.txt to see the expected format
  

            NbtCompound root = file.RootTag;
            if (root.Name == "Schematic")
            {
                redBmp = new redstoneBmp();
                // I don't know why but I keep getting cofused with the height, width, length stuff
                // maybe its because I deal with to many 2d objects.
                rYmax = root.Query<NbtShort>("/Schematic/Width").Value;
                rZmax = root.Query<NbtShort>("/Schematic/Height").Value;
                rXmax = root.Query<NbtShort>("/Schematic/Length").Value;
                rMaterials = root.Query<NbtString>("/Schematic/Materials").Value;
                rBlocks = root.Query<NbtByteArray>("/Schematic/Blocks").Value;
                rData = root.Query<NbtByteArray>("/Schematic/Data").Value;
                rGrid = new redstoneObj[rBlocks.Length]; 

                _block = new gBlockStruct[rBlocks.Length];
				
				int xStride = rXmax;
                int zStride = xStride * rYmax;
				int zLast = rData.Length - zStride;
                int yLast = zStride - xStride;
				
                for (int i = 0; i < rBlocks.Length; i++)
                {
					_blocks[i] = new gBlockStruct(rBlocks[i],rData[i]);
					_blocks[i].Z = i % (rZmax * rYmax);
					_blocks[i].Y = (i % rYmax) + (_blocks[i].Z * rZmax * rYmax);
					_blocks[i].X = 0;
					
					
					
                   int z =  i/zStride;
                    int y = (i - z * zStride)/xStride;
                    int x = i - (y * xStride) - (z * zStride);
                    rGrid[i] = new redstoneObj(redBmp.getSet(rBlocks[i]));
                    rGrid[i].X = x; rGrid[i].Y = y; rGrid[i].Z = z;
                }

                
            }

        }