static void CopyBlockDefs(string src, string dst) { string path = null; path = Path.Combine(oldServer, BlockDefinition.GlobalPath); BlockDefinition[] defs = BlockDefinition.Load(path); path = Path.Combine(oldServer, Paths.MapBlockDefs(src)); // Local/Level custom blocks override global ones if (File.Exists(path)) { BlockDefinition[] localDefs = BlockDefinition.Load(path); for (int i = 0; i < localDefs.Length; i++) { if (localDefs[i] == null || string.IsNullOrEmpty(localDefs[i].Name)) { continue; } defs[i] = localDefs[i]; } } // If block was original classic/CPE block on old server, but is now a custom block on new server // then make a block definition to prevent textures looking wrong (e.g. for Glass) for (int i = 0; i < Block.CpeCount; i++) { if (defs[i] == null && BlockDefinition.GlobalDefs[i] != null) { defs[i] = DefaultSet.MakeCustomBlock((BlockID)i); } } defs[0] = null; BlockDefinition.Save(false, defs, Paths.MapBlockDefs(dst)); }