當前位置: 首頁>>代碼示例>>Java>>正文


Java WorldSavedData.writeToNBT方法代碼示例

本文整理匯總了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();
        }
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:29,代碼來源:MapStorage.java

示例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();
        }
    }
}
 
開發者ID:MinecraftModdedClients,項目名稱:Resilience-Client-Source,代碼行數:29,代碼來源:MapStorage.java

示例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();
        }
    }
}
 
開發者ID:xtrafrancyz,項目名稱:Cauldron,代碼行數:26,代碼來源:MapStorage.java

示例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();
        }
    }
}
 
開發者ID:HATB0T,項目名稱:RuneCraftery,代碼行數:29,代碼來源:MapStorage.java


注:本文中的net.minecraft.world.WorldSavedData.writeToNBT方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。