internal void SendSignTexts(Chunk chunk) { foreach (var signKVP in chunk.SignsText) { int blockX = signKVP.Key >> 11; int blockY = (signKVP.Key & 0xFF) % 128; int blockZ = (signKVP.Key >> 7) & 0xF; UniversalCoords coords = UniversalCoords.FromBlock(chunk.Coords.ChunkX, chunk.Coords.ChunkZ, blockX, blockY, blockZ); string[] lines = new string[4]; int length = signKVP.Value.Length; for (int i = 0; i < 4; ++i, length -= 15) { int currentLength = length; if (currentLength > 15) { currentLength = 15; } if (length > 0) { lines[i] = signKVP.Value.Substring(i * 15, currentLength); } else { lines[i] = ""; } } SendPacket(new UpdateSignPacket { X = coords.WorldX, Y = coords.WorldY, Z = coords.WorldZ, Lines = lines }); } }
static UniversalCoords GetRandomPointInChunk(WorldManager world, int chunkX, int chunkZ) { return(UniversalCoords.FromBlock(chunkX, chunkZ, world.Server.Rand.Next(16), world.Server.Rand.Next(128), world.Server.Rand.Next(16))); }