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


Java CompressedStreamTools.safeWrite方法代码示例

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


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

示例1: saveServerList

import net.minecraft.nbt.CompressedStreamTools; //导入方法依赖的package包/类
@Override
public void saveServerList()
{
    prepare();
    super.saveServerList();
    int numOfServers = countServers();
    byte[] serverBytes = new byte[numOfServers];

    for (int i = 0; i < numOfServers; i++)
    {
        boolean editStatus = i < servers.size() && servers.get(i);
        serverBytes[i] = editStatus ? (byte) 1 : (byte) 0;
    }

    try
    {
        NBTTagCompound nbttagcompound = new NBTTagCompound();
        nbttagcompound.setByteArray("servers", serverBytes);
        CompressedStreamTools.safeWrite(nbttagcompound, new File(this.mc.mcDataDir, "mtservers.dat"));
    }
    catch (Exception exception)
    {
        //logger.error("Couldn\'t save server list", exception);
    }
}
 
开发者ID:CreeperHost,项目名称:CreeperHostGui,代码行数:26,代码来源:ServerListNoEdit.java

示例2: saveServerList

import net.minecraft.nbt.CompressedStreamTools; //导入方法依赖的package包/类
/**
 * Runs getNBTCompound on each ServerData instance, puts everything into a "servers" NBT list and writes it to
 * servers.dat.
 */
public void saveServerList()
{
    try
    {
        NBTTagList nbttaglist = new NBTTagList();

        for (ServerData serverdata : this.servers)
        {
            nbttaglist.appendTag(serverdata.getNBTCompound());
        }

        NBTTagCompound nbttagcompound = new NBTTagCompound();
        nbttagcompound.setTag("servers", nbttaglist);
        CompressedStreamTools.safeWrite(nbttagcompound, new File(this.mc.mcDataDir, "servers.dat"));
    }
    catch (Exception exception)
    {
        logger.error((String)"Couldn\'t save server list", (Throwable)exception);
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:25,代码来源:ServerList.java

示例3: saveServerList

import net.minecraft.nbt.CompressedStreamTools; //导入方法依赖的package包/类
/**
 * Runs getNBTCompound on each ServerData instance, puts everything into a "servers" NBT list and writes it to
 * servers.dat.
 */
public void saveServerList()
{
    try
    {
        NBTTagList nbttaglist = new NBTTagList();

        for (ServerData serverdata : this.servers)
        {
            nbttaglist.appendTag(serverdata.getNBTCompound());
        }

        NBTTagCompound nbttagcompound = new NBTTagCompound();
        nbttagcompound.setTag("servers", nbttaglist);
        CompressedStreamTools.safeWrite(nbttagcompound, new File(this.mc.mcDataDir, "servers.dat"));
    }
    catch (Exception exception)
    {
        LOGGER.error((String)"Couldn\'t save server list", (Throwable)exception);
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:25,代码来源:ServerList.java


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