static void OnPropsChanged(BlockProps[] scope, Level level, byte id) { scope[id].Changed = true; if (scope == Block.Props) { BlockBehaviour.SetupCoreHandlers(); BlockProps.Save("core", scope); } else if (scope == BlockDefinition.GlobalProps) { Level[] loaded = LevelInfo.Loaded.Items; foreach (Level lvl in loaded) { if (lvl.CustomBlockDefs[id] != BlockDefinition.GlobalDefs[id]) { continue; } lvl.CustomBlockProps[id] = BlockDefinition.GlobalProps[id]; } BlockProps.Save("global", scope); } else { BlockProps.Save("lvl_" + level.name, scope); } }
public static void SetBlocks() { SetCoreProperties(); BlockBehaviour.SetupCorePhysicsHandlers(); InitDefaults(); BlockProps.Load("core", Block.Props); BlockBehaviour.SetupCoreHandlers(); // Custom permissions set by the user. if (File.Exists("properties/block.properties")) { string[] lines = File.ReadAllLines("properties/block.properties"); if (lines.Length > 0 && lines[0] == "#Version 2") { LoadVersion2(lines); } else { LoadVersion1(lines); } } SaveBlocks(BlockList); }