当前位置: 首页>>代码示例>>Java>>正文


Java DimensionManager.getCurrentSaveRootDirectory方法代码示例

本文整理汇总了Java中net.minecraftforge.common.DimensionManager.getCurrentSaveRootDirectory方法的典型用法代码示例。如果您正苦于以下问题:Java DimensionManager.getCurrentSaveRootDirectory方法的具体用法?Java DimensionManager.getCurrentSaveRootDirectory怎么用?Java DimensionManager.getCurrentSaveRootDirectory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraftforge.common.DimensionManager的用法示例。


在下文中一共展示了DimensionManager.getCurrentSaveRootDirectory方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: readFromFile

import net.minecraftforge.common.DimensionManager; //导入方法依赖的package包/类
private static void readFromFile() {
	if (saveDir == null)
		saveDir = DimensionManager.getCurrentSaveRootDirectory();
	if (saveDir == null) {
		Overlord.logError("Could not get save directory. Either you are connected to a server or Squads will not load properly.");
		instance = new Squads();
		return;
	}
	File f = new File(saveDir, dataFileName);
	if (f.exists()) {
		try {
			ObjectInputStream stream = new ObjectInputStream(new FileInputStream(f));
			instance = (Squads) stream.readObject();
			stream.close();
		} catch (IOException | ClassNotFoundException e) {
			e.printStackTrace();
			instance = new Squads();
			f.delete();
		}
	}
	if (instance == null)
		instance = new Squads();
}
 
开发者ID:The-Fireplace-Minecraft-Mods,项目名称:Overlord,代码行数:24,代码来源:Squads.java

示例2: readFromFile

import net.minecraftforge.common.DimensionManager; //导入方法依赖的package包/类
private static void readFromFile() {
	if (saveDir == null)
		saveDir = DimensionManager.getCurrentSaveRootDirectory();
	if (saveDir == null) {
		Overlord.logError("Could not get save directory. Alliances will not load properly.");
		instance = new Alliances();
		return;
	}
	File f = new File(saveDir, dataFileName);
	if (f.exists()) {
		try {
			ObjectInputStream stream = new ObjectInputStream(new FileInputStream(f));
			instance = (Alliances) stream.readObject();
			stream.close();
		} catch (IOException | ClassNotFoundException e) {
			e.printStackTrace();
			instance = new Alliances();
			f.delete();
		}
	}
	if (instance == null)
		instance = new Alliances();
}
 
开发者ID:The-Fireplace-Minecraft-Mods,项目名称:Overlord,代码行数:24,代码来源:Alliances.java

示例3: writeToDisk

import net.minecraftforge.common.DimensionManager; //导入方法依赖的package包/类
private void writeToDisk(EntityPlayerMP player, NBTTagCompound nbt)
  {
try
      {
          File saveDir = DimensionManager.getCurrentSaveRootDirectory();

          if (saveDir != null)
          {
              File file = new File(new File(saveDir, Reference.MOD_ID), player.getUniqueID() + ".dat");
          	
              // write player inventory file
              FileOutputStream out = new FileOutputStream(file);
              CompressedStreamTools.writeCompressed(nbt, out);
              out.close();
          }
      }
      catch (Exception e)
      {
      	JustEnoughDimensions.logger.warn("Failed to write GamemodeInventory for player " + player.getName());
      }
  }
 
开发者ID:maruohon,项目名称:justenoughdimensions,代码行数:22,代码来源:GamemodeInventory.java

示例4: onWorldSave

import net.minecraftforge.common.DimensionManager; //导入方法依赖的package包/类
@SubscribeEvent
public void onWorldSave(WorldEvent.Save event)
{
	if(event.getWorld().provider.getDimension() != 0) return;
	File file = new File(DimensionManager.getCurrentSaveRootDirectory(), "data/torchmaster_"+this.name+"_reg.dat");

	NBTTagList tagList = new NBTTagList();
	for(TorchLocation loc : this.torches)
		tagList.appendTag(loc.toNbt());
	NBTTagCompound nbt = new NBTTagCompound();
	nbt.setTag("list", tagList);

	try
	{
		CompressedStreamTools.write(nbt, file);
		TorchMasterMod.Log.debug("Saved " + this.torches.size() + " entries for " + this.name + " to disk");
	}
	catch (IOException e)
	{
		e.printStackTrace();
	}
}
 
开发者ID:Xalcon,项目名称:TorchMaster,代码行数:23,代码来源:TorchRegistry.java

示例5: getReplays

import net.minecraftforge.common.DimensionManager; //导入方法依赖的package包/类
/**
 * Get list of all available replays
 */
public static List<String> getReplays()
{
    List<String> list = new ArrayList<String>();
    File replays = new File(DimensionManager.getCurrentSaveRootDirectory() + "/blockbuster/records");

    for (File file : replays.listFiles())
    {
        String name = file.getName();

        if (file.isFile() && name.endsWith(".dat"))
        {
            int index = name.indexOf(".");

            list.add(name.substring(0, index));
        }
    }

    return list;
}
 
开发者ID:mchorse,项目名称:blockbuster,代码行数:23,代码来源:Utils.java

示例6: getSaveFolder

import net.minecraftforge.common.DimensionManager; //导入方法依赖的package包/类
public File getSaveFolder()
{
    MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance();
    if (server != null && !server.isSinglePlayer())
        return server.getFile("");
    return DimensionManager.getCurrentSaveRootDirectory();
}
 
开发者ID:CreeperHost,项目名称:CreeperHostGui,代码行数:8,代码来源:CreeperHostServer.java

示例7: WorldFileData

import net.minecraftforge.common.DimensionManager; //导入方法依赖的package包/类
/** Creates a region file handler for a given world and requester */
public WorldFileData(World world, ICommandSender requester)
{
    this.requester = requester;

    // TODO: Move this to "getRootDir" of new Worlds class
    File rootDir = (world.provider.getDimension() == 0)
        ? DimensionManager.getCurrentSaveRootDirectory()
        : new File(
            DimensionManager.getCurrentSaveRootDirectory(),
            world.provider.getSaveFolder()
        );

    File regionFolder = new File(rootDir, "region");
    if ( !regionFolder.exists() || !regionFolder.isDirectory() )
        throw new RuntimeException(
            "Could not validate folder for world's region files. Tried to use "
            + regionFolder.getPath() + " as valid region folder."
        );

    this.regionFiles = regionFolder.listFiles(MCA_FILTER);
    if (this.regionFiles == null || this.regionFiles.length == 0)
        throw new RuntimeException(
            "Could not find any region files. Looked in: " + regionFolder.getPath()
        );

    Log.debug(
        "Using path '%s' for world '%s'",
        regionFolder.getAbsolutePath(),
        Worlds.getWorldName(world)
    );
}
 
开发者ID:abused,项目名称:World-Border,代码行数:33,代码来源:WorldFileData.java

示例8: saveToFile

import net.minecraftforge.common.DimensionManager; //导入方法依赖的package包/类
private static void saveToFile() {
	try {
		if (saveDir == null)
			saveDir = DimensionManager.getCurrentSaveRootDirectory();
		if (saveDir == null)
			Overlord.logError("Could not get save directory. Either you are connected to a server or Squads will not save properly.");
		ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream(new File(saveDir, dataFileName)));
		out.writeObject(instance);
		out.close();
	} catch (IOException e) {
		e.printStackTrace();
	}
}
 
开发者ID:The-Fireplace-Minecraft-Mods,项目名称:Overlord,代码行数:14,代码来源:Squads.java

示例9: load

import net.minecraftforge.common.DimensionManager; //导入方法依赖的package包/类
public static void load(WorldServer world) {
    if (loaded) {
        return;
    }

    loaded = true;

    ReviveChange.load();

    IOrganiserStorage storage = OrganiserStorage.getStorage(world);
    ILoginTracker tracker = PlayerLoginTracker.getTracker(world);
    //TODO 1.12 Remove this, as no more LegacyConversion
    try {
        File saveDir = new File(DimensionManager.getCurrentSaveRootDirectory(), "chickenchunks");
        if (saveDir.exists()) {
            storage.loadLegacyData(saveDir);
            tracker.loadLegacyData(saveDir);

            File[] list = saveDir.listFiles();
            if (list == null || list.length == 0) {
                saveDir.delete();
                logger.info("Old ChickenChunks conversion completed! Removing old folder..");
            } else {
                logger.warn("After conversion {} files still exist in {}, Wot..", list.length, saveDir.getAbsolutePath());
            }
        }

    } catch (Exception e) {
        logger.warn("Exception thrown whilst converting old ChickenChunks data!", e);
    }
    storage.load(world);
}
 
开发者ID:TheCBProject,项目名称:ChickenChunks,代码行数:33,代码来源:ChunkLoaderManager.java

示例10: saveToFile

import net.minecraftforge.common.DimensionManager; //导入方法依赖的package包/类
private static void saveToFile() {
	try {
		if (saveDir == null)
			saveDir = DimensionManager.getCurrentSaveRootDirectory();
		if (saveDir == null) {
			Overlord.logError("Could not get save directory. Enemies will not save properly.");
			return;
		}
		ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream(new File(saveDir, dataFileName)));
		out.writeObject(instance);
		out.close();
	} catch (IOException e) {
		e.printStackTrace();
	}
}
 
开发者ID:The-Fireplace-Minecraft-Mods,项目名称:Overlord,代码行数:16,代码来源:Enemies.java

示例11: load

import net.minecraftforge.common.DimensionManager; //导入方法依赖的package包/类
public static void load(World world) {
    if (ServerUtils.mc() != server) {
        LogHelper.debug("Loading NEI Server");
        server = ServerUtils.mc();
        saveDir = new File(DimensionManager.getCurrentSaveRootDirectory(), "NEI");

        dimTags.clear();
        loadConfig();
        loadBannedItems();
    }
    loadWorld(world);
}
 
开发者ID:TheCBProject,项目名称:NotEnoughItems,代码行数:13,代码来源:NEIServerConfig.java

示例12: getSaveLocation

import net.minecraftforge.common.DimensionManager; //导入方法依赖的package包/类
public static File getSaveLocation(int dim) {
    File basesave = DimensionManager.getCurrentSaveRootDirectory();
    if (dim != 0)
        return new File(basesave, DimensionManager.getWorld(dim).provider.getSaveFolder());

    return basesave;
}
 
开发者ID:4Space,项目名称:4Space-5,代码行数:8,代码来源:CommonUtils.java

示例13: WorldFileData

import net.minecraftforge.common.DimensionManager; //导入方法依赖的package包/类
/** Creates a region file handler for a given world and requester */
public WorldFileData(World world, ICommandSender requester)
{
    this.requester = requester;

    // TODO: Move this to "getRootDir" of new Worlds class
    File rootDir = (world.provider.dimensionId == 0)
        ? DimensionManager.getCurrentSaveRootDirectory()
        : new File(
            DimensionManager.getCurrentSaveRootDirectory(),
            world.provider.getSaveFolder()
        );

    File regionFolder = new File(rootDir, "region");
    if ( !regionFolder.exists() || !regionFolder.isDirectory() )
        throw new RuntimeException(
            "Could not validate folder for world's region files. Tried to use "
            + regionFolder.getPath() + " as valid region folder."
        );

    this.regionFiles = regionFolder.listFiles(MCA_FILTER);
    if (this.regionFiles == null || this.regionFiles.length == 0)
        throw new RuntimeException(
            "Could not find any region files. Looked in: " + regionFolder.getPath()
        );

    Log.debug(
        "Using path '%s' for world '%s'",
        regionFolder.getAbsolutePath(),
        Worlds.getWorldName(world)
    );
}
 
开发者ID:RoyCurtis,项目名称:WorldBorder-Forge,代码行数:33,代码来源:WorldFileData.java

示例14: load

import net.minecraftforge.common.DimensionManager; //导入方法依赖的package包/类
public static void load(World world) {
    if (MinecraftServer.getServer() != server) {
        logger.debug("Loading NEI Server");
        server = MinecraftServer.getServer();
        saveDir = new File(DimensionManager.getCurrentSaveRootDirectory(), "NEI");

        dimTags.clear();
        loadConfig();
        loadBannedItems();
    }
    loadWorld(world);
}
 
开发者ID:SneakyTactician,项目名称:BIGB,代码行数:13,代码来源:NEIServerConfig.java

示例15: load

import net.minecraftforge.common.DimensionManager; //导入方法依赖的package包/类
private void load() {
    saveDir = new File(DimensionManager.getCurrentSaveRootDirectory(), "EnderStorage");
    try {
        if (!saveDir.exists()) {
            saveDir.mkdirs();
        }
        //TODO, Ok so, This looks like cancer, but is actually quite smart, data1, and data2 are essentially backups, lock holds the current data and lock is only ever written to after a successful write to data1/2.
        //TODO, Maybe this isnt needed anymore? Maybe it should be stored via WorldSavedData..
        saveFiles = new File[] { new File(saveDir, "data1.dat"), new File(saveDir, "data2.dat"), new File(saveDir, "lock.dat") };
        if (saveFiles[2].exists() && saveFiles[2].length() > 0) {
            FileInputStream fin = new FileInputStream(saveFiles[2]);
            saveTo = fin.read() ^ 1;
            fin.close();

            if (saveFiles[saveTo ^ 1].exists()) {
                FileInputStream in = new FileInputStream(saveFiles[saveTo ^ 1]);
                saveTag = CompressedStreamTools.readCompressed(in);
                in.close();
            } else {
                saveTag = new NBTTagCompound();
            }
        } else {
            saveTag = new NBTTagCompound();
        }
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
 
开发者ID:TheCBProject,项目名称:EnderStorage,代码行数:29,代码来源:EnderStorageManager.java


注:本文中的net.minecraftforge.common.DimensionManager.getCurrentSaveRootDirectory方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。