Skip to content
Permalink
Browse files

Fix level custom blocks not showing up when doing /wunload then /wloa…

…d again
  • Loading branch information...
UnknownShadow200 committed Nov 13, 2017
1 parent 9dccfe1 commit 0f98250731a9aeee1cc83dd1eb469816fa9d14b6
Showing with 17 additions and 24 deletions.
  1. +17 −24 fCraft/World/WorldManager.cs
@@ -230,17 +230,6 @@ static void LoadWorldListEntry([NotNull] XElement el)
if (blockEl != null) {
world.BlockDB.LoadSettings(blockEl);
}

// Load CustomBlock settings
string blockDefPath = Path.Combine(Paths.BlockDefsDirectory, world.Name + ".txt");
if (File.Exists(blockDefPath)) {
int count;
BlockDefinition[] defs = BlockDefinition.Load(blockDefPath, out count);
for (int i = 0; i < defs.Length; i++) {
if (defs[i] == null) defs[i] = BlockDefinition.GlobalDefs[i];
}
world.BlockDefs = defs;
}

// load environment settings
XElement envEl = el.Element(EnvironmentXmlTagName);
@@ -732,6 +721,7 @@ static void LoadWorldListEntry([NotNull] XElement el)
throw new WorldOpException( name, WorldOpExceptionCode.InvalidWorldName );
}

World newWorld;
lock( SyncRoot ) {
if( WorldIndex.ContainsKey( name.ToLower() ) ) {
throw new WorldOpException( name, WorldOpExceptionCode.DuplicateWorldName );
@@ -741,25 +731,28 @@ static void LoadWorldListEntry([NotNull] XElement el)
throw new WorldOpException( name, WorldOpExceptionCode.Cancelled );
}

World newWorld = new World( name ) {
Map = map
};

if( preload ) {
newWorld.Preload = true;
}

if( map != null ) {
newWorld.SaveMap();
}
newWorld = new World( name ) { Map = map };
if( preload ) newWorld.Preload = true;
if( map != null ) newWorld.SaveMap();

WorldIndex.Add( name.ToLower(), newWorld );
UpdateWorldList();

RaiseWorldCreatedEvent( player, newWorld );

return newWorld;
}

// Load CustomBlock settings
string blockDefPath = Path.Combine(Paths.BlockDefsDirectory, name + ".txt");
if (File.Exists(blockDefPath)) {
int count;
BlockDefinition[] defs = BlockDefinition.Load(blockDefPath, out count);
for (int i = 0; i < defs.Length; i++) {
if (defs[i] == null) defs[i] = BlockDefinition.GlobalDefs[i];
}
newWorld.BlockDefs = defs;
}

return newWorld;
}


0 comments on commit 0f98250

Please sign in to comment.
You can’t perform that action at this time.