-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added a per-world MapStorage feature that provides a method to store …
…data files associated with a specific world, as well as fixes the issue with villagers loosing there village. {Where villagers wouldn't go inside at night}
- Loading branch information
Showing
4 changed files
with
128 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
common/net/minecraftforge/common/WorldSpecificSaveHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package net.minecraftforge.common; | ||
|
||
import java.io.File; | ||
|
||
import net.minecraft.src.IChunkLoader; | ||
import net.minecraft.src.IPlayerFileData; | ||
import net.minecraft.src.ISaveHandler; | ||
import net.minecraft.src.MinecraftException; | ||
import net.minecraft.src.NBTTagCompound; | ||
import net.minecraft.src.WorldInfo; | ||
import net.minecraft.src.WorldProvider; | ||
import net.minecraft.src.WorldServer; | ||
|
||
//Class used internally to provide the world specific data directories. | ||
|
||
public class WorldSpecificSaveHandler implements ISaveHandler | ||
{ | ||
private WorldServer world; | ||
private ISaveHandler parent; | ||
private File dataDir; | ||
|
||
public WorldSpecificSaveHandler(WorldServer world, ISaveHandler parent) | ||
{ | ||
this.world = world; | ||
this.parent = parent; | ||
dataDir = new File(world.getChunkSaveLocation(), "data"); | ||
dataDir.mkdirs(); | ||
} | ||
|
||
@Override public WorldInfo loadWorldInfo() { return parent.loadWorldInfo(); } | ||
@Override public void checkSessionLock() throws MinecraftException { parent.checkSessionLock(); } | ||
@Override public IChunkLoader getChunkLoader(WorldProvider var1) { return parent.getChunkLoader(var1); } | ||
@Override public void saveWorldInfoWithPlayer(WorldInfo var1, NBTTagCompound var2) { parent.saveWorldInfoWithPlayer(var1, var2); } | ||
@Override public void saveWorldInfo(WorldInfo var1){ parent.saveWorldInfo(var1); } | ||
@Override public IPlayerFileData getSaveHandler() { return parent.getSaveHandler(); } | ||
@Override public void flush() { parent.flush(); } | ||
@Override public String getSaveDirectoryName() { return parent.getSaveDirectoryName(); } | ||
|
||
@Override | ||
public File getMapFileFromName(String name) | ||
{ | ||
System.out.println(new File(dataDir, name + ".dat")); | ||
return new File(dataDir, name + ".dat"); | ||
} | ||
} |
Oops, something went wrong.