本文整理汇总了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);
}
}
示例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);
}
}
示例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);
}
}