本文整理匯總了Java中net.minecraft.world.WorldSavedData.writeToNBT方法的典型用法代碼示例。如果您正苦於以下問題:Java WorldSavedData.writeToNBT方法的具體用法?Java WorldSavedData.writeToNBT怎麽用?Java WorldSavedData.writeToNBT使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類net.minecraft.world.WorldSavedData
的用法示例。
在下文中一共展示了WorldSavedData.writeToNBT方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: saveData
import net.minecraft.world.WorldSavedData; //導入方法依賴的package包/類
/**
* Saves the given MapDataBase to disk.
*/
private void saveData(WorldSavedData p_75747_1_)
{
if (this.saveHandler != null)
{
try
{
File file1 = this.saveHandler.getMapFileFromName(p_75747_1_.mapName);
if (file1 != null)
{
NBTTagCompound nbttagcompound = new NBTTagCompound();
p_75747_1_.writeToNBT(nbttagcompound);
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
nbttagcompound1.setTag("data", nbttagcompound);
FileOutputStream fileoutputstream = new FileOutputStream(file1);
CompressedStreamTools.writeCompressed(nbttagcompound1, fileoutputstream);
fileoutputstream.close();
}
}
catch (Exception exception)
{
exception.printStackTrace();
}
}
}
示例2: saveData
import net.minecraft.world.WorldSavedData; //導入方法依賴的package包/類
/**
* Saves the given MapDataBase to disk.
*/
private void saveData(WorldSavedData par1WorldSavedData)
{
if (this.saveHandler != null)
{
try
{
File var2 = this.saveHandler.getMapFileFromName(par1WorldSavedData.mapName);
if (var2 != null)
{
NBTTagCompound var3 = new NBTTagCompound();
par1WorldSavedData.writeToNBT(var3);
NBTTagCompound var4 = new NBTTagCompound();
var4.setTag("data", var3);
FileOutputStream var5 = new FileOutputStream(var2);
CompressedStreamTools.writeCompressed(var4, var5);
var5.close();
}
}
catch (Exception var6)
{
var6.printStackTrace();
}
}
}
示例3: saveData
import net.minecraft.world.WorldSavedData; //導入方法依賴的package包/類
private void saveData(WorldSavedData p_75747_1_)
{
if (this.saveHandler != null)
{
try
{
File file1 = this.saveHandler.getMapFileFromName(p_75747_1_.mapName);
if (file1 != null)
{
NBTTagCompound nbttagcompound = new NBTTagCompound();
p_75747_1_.writeToNBT(nbttagcompound);
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
nbttagcompound1.setTag("data", nbttagcompound);
FileOutputStream fileoutputstream = new FileOutputStream(file1);
CompressedStreamTools.writeCompressed(nbttagcompound1, fileoutputstream);
fileoutputstream.close();
}
}
catch (Exception exception)
{
exception.printStackTrace();
}
}
}
示例4: saveData
import net.minecraft.world.WorldSavedData; //導入方法依賴的package包/類
/**
* Saves the given MapDataBase to disk.
*/
private void saveData(WorldSavedData par1WorldSavedData)
{
if (this.saveHandler != null)
{
try
{
File file1 = this.saveHandler.getMapFileFromName(par1WorldSavedData.mapName);
if (file1 != null)
{
NBTTagCompound nbttagcompound = new NBTTagCompound();
par1WorldSavedData.writeToNBT(nbttagcompound);
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
nbttagcompound1.setCompoundTag("data", nbttagcompound);
FileOutputStream fileoutputstream = new FileOutputStream(file1);
CompressedStreamTools.writeCompressed(nbttagcompound1, fileoutputstream);
fileoutputstream.close();
}
}
catch (Exception exception)
{
exception.printStackTrace();
}
}
}