Exemplo n.º 1
0
        public static bool Paste(RegionFile region, int offsetX, int offsetZ)
        {
            if (currentPaste == null)
            {
                return(false);
            }

            for (int x = 0; x < currentPaste.Width; x++)
            {
                for (int z = 0; z < currentPaste.Height; z++)
                {
                    if (currentPaste.Biomes[x, z] == (byte)Biome.Unspecified)
                    {
                        continue;
                    }

                    Coord chunkOffset = new Coord(offsetX + x, offsetZ + z);
                    chunkOffset.AbsolutetoChunk();
                    if (chunkOffset.X < 0 || chunkOffset.X >= 32 || chunkOffset.Z < 0 || chunkOffset.Z >= 32)
                    {
                        continue;
                    }
                    Chunk c = region.Chunks[chunkOffset.X, chunkOffset.Z];
                    if (c == null || c.Root == null)
                    {
                        continue;
                    }

                    int pasteX = (offsetX + x) % 16;
                    int pasteZ = (offsetZ + z) % 16;

                    ((TAG_Byte_Array)c.Root["Level"]["Biomes"]).Payload[pasteX + pasteZ * 16] = currentPaste.Biomes[x, z];
                }
            }

            return(true);
        }