private void ReadConfig(string fileName) { var spawnLoc = new Vector3S(); _serverVersion = _configFile.Read("Server_Version", 0); MapSize.X = short.Parse(_configFile.Read("Size_X", "0")); MapSize.Y = short.Parse(_configFile.Read("Size_Y", "0")); MapSize.Z = short.Parse(_configFile.Read("Size_Z", "0")); _UUID = _configFile.Read("Unique_ID", GenerateUuid()); Name = _configFile.Read("Name", "Map_Name_Here"); _buildRank = _configFile.Read("Rank_Build", 0); _showRank = _configFile.Read("Rank_Show", 0); _joinRank = _configFile.Read("Rank_Join", 0); _physics = _configFile.Read("Physic_Stopped", 0) == 1; _motd = _configFile.Read("MOTD_Override", ""); _saveInterval = _configFile.Read("Save_Intervall", 10); _overviewType = (D3OverviewType)_configFile.Read("Overview_Type", 2); spawnLoc.X = (short)(double.Parse(_configFile.Read("Spawn_X", "0")) * 32); spawnLoc.Y = (short)(double.Parse(_configFile.Read("Spawn_Y", "0")) * 32); spawnLoc.Z = (short)(double.Parse(_configFile.Read("Spawn_Z", "0")) * 32); MapSpawn.Rotation = (byte)_configFile.Read("Spawn_Rot", 0); MapSpawn.Look = (byte)_configFile.Read("Spawn_Look", 0); MapSpawn.SetAsPlayerCoords(spawnLoc); }
public D3Map(string folder) { _mapPath = folder; MapSize = new Vector3S(); MapSpawn = new MinecraftLocation(); _configFile = new PreferenceLoader(ConfigName, null, folder); Load(); }
public void Resize(int x, int y, int z) { if (x < 16 || y < 16 || z < 16 || x > 32767 || y > 32767 || z > 32767) { return; } var mem1 = new byte[(x * y * z) * 4]; int copyX = Math.Min(MapSize.X, x); int copyY = Math.Min(MapSize.Y, y); int copyZ = Math.Min(MapSize.Z, z); // -- Copy in existing blocks as much as we can for (var ix = 0; ix < copyX - 1; ix++) { for (var iy = 0; iy < copyY - 1; iy++) { for (var iz = 0; iz < copyZ - 1; iz++) { int oldIndex = GetBlockIndex(ix, iy, iz); int newIndex = GetBlockIndex(ix, iy, iz, x, y); mem1[newIndex] = MapData[oldIndex]; // -- Copy existing block into new array. } } } // -- Adjust spawn location Vector3S current = MapSpawn.GetAsBlockCoords(); short newX = current.X; short newY = current.Y; if (current.X > x - 1) { newX = (short)(x - 1); } if (current.Y > y - 1) { newY = (short)(y - 1); } MapSpawn.SetAsBlockCoords(new Vector3S(newX, newY, current.Z)); MapSize = new Vector3S(x, y, z); MapData = mem1; }
public D3Map(string folder, string name, short sizeX, short sizeY, short sizeZ) { _mapPath = folder; _configFile = new PreferenceLoader(ConfigName, null, folder); _UUID = GenerateUuid(); _saveInterval = 10; _serverVersion = 1004; _overviewType = D3OverviewType.Iso; Name = name; MapSize = new Vector3S(sizeX, sizeY, sizeZ); MapSpawn = new MinecraftLocation(); MapSpawn.SetAsBlockCoords(new Vector3S(sizeX / 2, sizeY / 2, sizeZ / 2)); MapData = new byte[(sizeX * sizeY * sizeZ) * 4]; }
public abstract void Invoke(Client client, Vector3S location, byte mode, Block block);