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


Java CompressedStreamTools.write方法代碼示例

本文整理匯總了Java中net.minecraft.nbt.CompressedStreamTools.write方法的典型用法代碼示例。如果您正苦於以下問題:Java CompressedStreamTools.write方法的具體用法?Java CompressedStreamTools.write怎麽用?Java CompressedStreamTools.write使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在net.minecraft.nbt.CompressedStreamTools的用法示例。


在下文中一共展示了CompressedStreamTools.write方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: saveModelDataToObsidianFile

import net.minecraft.nbt.CompressedStreamTools; //導入方法依賴的package包/類
public static void saveModelDataToObsidianFile(ModelObj model, File obsidianFile) 
{
	try 
	{
		NBTTagCompound nbt = model.createNBTTag();

		File nbtFile = new File(SETUP_NAME);
		CompressedStreamTools.write(nbt, nbtFile);

		FileUtils.addEntryToExistingZip(obsidianFile, nbtFile);
		nbtFile.delete();
	}
	catch(Exception e) 
	{
		System.err.println("Could not save model data for " + model.entityName);
		e.printStackTrace();
	}
}
 
開發者ID:ObsidianSuite,項目名稱:ObsidianSuite,代碼行數:19,代碼來源:ModelFileHandler.java

示例2: writeNBTTagCompoundToBuffer

import net.minecraft.nbt.CompressedStreamTools; //導入方法依賴的package包/類
/**
 * Writes a compressed NBTTagCompound to this buffer
 */
public PacketBuffer writeNBTTagCompoundToBuffer(@Nullable NBTTagCompound nbt)
{
    if (nbt == null)
    {
        this.writeByte(0);
    }
    else
    {
        try
        {
            CompressedStreamTools.write(nbt, new ByteBufOutputStream(this));
        }
        catch (IOException ioexception)
        {
            throw new EncoderException(ioexception);
        }
    }

    return this;
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:24,代碼來源:PacketBuffer.java

示例3: writeNBTTagCompoundToBuffer

import net.minecraft.nbt.CompressedStreamTools; //導入方法依賴的package包/類
/**
 * Writes a compressed NBTTagCompound to this buffer
 */
public void writeNBTTagCompoundToBuffer(NBTTagCompound nbt)
{
    if (nbt == null)
    {
        this.writeByte(0);
    }
    else
    {
        try
        {
            CompressedStreamTools.write(nbt, new ByteBufOutputStream(this));
        }
        catch (IOException ioexception)
        {
            throw new EncoderException(ioexception);
        }
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:22,代碼來源:PacketBuffer.java

示例4: convertChunks

import net.minecraft.nbt.CompressedStreamTools; //導入方法依賴的package包/類
/**
 * copies a 32x32 chunk set from par2File to par1File, via AnvilConverterData
 */
private void convertChunks(File p_75811_1_, File p_75811_2_, WorldChunkManager p_75811_3_, int p_75811_4_, int p_75811_5_, IProgressUpdate progressCallback)
{
    try
    {
        String s = p_75811_2_.getName();
        RegionFile regionfile = new RegionFile(p_75811_2_);
        RegionFile regionfile1 = new RegionFile(new File(p_75811_1_, s.substring(0, s.length() - ".mcr".length()) + ".mca"));

        for (int i = 0; i < 32; ++i)
        {
            for (int j = 0; j < 32; ++j)
            {
                if (regionfile.isChunkSaved(i, j) && !regionfile1.isChunkSaved(i, j))
                {
                    DataInputStream datainputstream = regionfile.getChunkDataInputStream(i, j);

                    if (datainputstream == null)
                    {
                        logger.warn("Failed to fetch input stream");
                    }
                    else
                    {
                        NBTTagCompound nbttagcompound = CompressedStreamTools.read(datainputstream);
                        datainputstream.close();
                        NBTTagCompound nbttagcompound1 = nbttagcompound.getCompoundTag("Level");
                        ChunkLoader.AnvilConverterData chunkloader$anvilconverterdata = ChunkLoader.load(nbttagcompound1);
                        NBTTagCompound nbttagcompound2 = new NBTTagCompound();
                        NBTTagCompound nbttagcompound3 = new NBTTagCompound();
                        nbttagcompound2.setTag("Level", nbttagcompound3);
                        ChunkLoader.convertToAnvilFormat(chunkloader$anvilconverterdata, nbttagcompound3, p_75811_3_);
                        DataOutputStream dataoutputstream = regionfile1.getChunkDataOutputStream(i, j);
                        CompressedStreamTools.write(nbttagcompound2, dataoutputstream);
                        dataoutputstream.close();
                    }
                }
            }

            int k = (int)Math.round(100.0D * (double)(p_75811_4_ * 1024) / (double)(p_75811_5_ * 1024));
            int l = (int)Math.round(100.0D * (double)((i + 1) * 32 + p_75811_4_ * 1024) / (double)(p_75811_5_ * 1024));

            if (l > k)
            {
                progressCallback.setLoadingProgress(l);
            }
        }

        regionfile.close();
        regionfile1.close();
    }
    catch (IOException ioexception)
    {
        ioexception.printStackTrace();
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:58,代碼來源:AnvilSaveConverter.java

示例5: getUniqueDataId

import net.minecraft.nbt.CompressedStreamTools; //導入方法依賴的package包/類
/**
 * Returns an unique new data id for the given prefix and saves the idCounts map to the 'idcounts' file.
 */
public int getUniqueDataId(String key)
{
    Short oshort = (Short)this.idCounts.get(key);

    if (oshort == null)
    {
        oshort = Short.valueOf((short)0);
    }
    else
    {
        oshort = Short.valueOf((short)(oshort.shortValue() + 1));
    }

    this.idCounts.put(key, oshort);

    if (this.saveHandler == null)
    {
        return oshort.shortValue();
    }
    else
    {
        try
        {
            File file1 = this.saveHandler.getMapFileFromName("idcounts");

            if (file1 != null)
            {
                NBTTagCompound nbttagcompound = new NBTTagCompound();

                for (String s : this.idCounts.keySet())
                {
                    short short1 = ((Short)this.idCounts.get(s)).shortValue();
                    nbttagcompound.setShort(s, short1);
                }

                DataOutputStream dataoutputstream = new DataOutputStream(new FileOutputStream(file1));
                CompressedStreamTools.write(nbttagcompound, dataoutputstream);
                dataoutputstream.close();
            }
        }
        catch (Exception exception)
        {
            exception.printStackTrace();
        }

        return oshort.shortValue();
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:52,代碼來源:MapStorage.java

示例6: func_183013_b

import net.minecraft.nbt.CompressedStreamTools; //導入方法依賴的package包/類
private void func_183013_b(ChunkCoordIntPair p_183013_1_, NBTTagCompound p_183013_2_) throws IOException
{
    DataOutputStream dataoutputstream = RegionFileCache.getChunkOutputStream(this.chunkSaveLocation, p_183013_1_.chunkXPos, p_183013_1_.chunkZPos);
    CompressedStreamTools.write(p_183013_2_, dataoutputstream);
    dataoutputstream.close();
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:7,代碼來源:AnvilChunkLoader.java

示例7: convertChunks

import net.minecraft.nbt.CompressedStreamTools; //導入方法依賴的package包/類
/**
 * copies a 32x32 chunk set from par2File to par1File, via AnvilConverterData
 */
private void convertChunks(File baseFolder, File p_75811_2_, BiomeProvider biomeSource, int p_75811_4_, int p_75811_5_, IProgressUpdate progressCallback)
{
    try
    {
        String s = p_75811_2_.getName();
        RegionFile regionfile = new RegionFile(p_75811_2_);
        RegionFile regionfile1 = new RegionFile(new File(baseFolder, s.substring(0, s.length() - ".mcr".length()) + ".mca"));

        for (int i = 0; i < 32; ++i)
        {
            for (int j = 0; j < 32; ++j)
            {
                if (regionfile.isChunkSaved(i, j) && !regionfile1.isChunkSaved(i, j))
                {
                    DataInputStream datainputstream = regionfile.getChunkDataInputStream(i, j);

                    if (datainputstream == null)
                    {
                        LOGGER.warn("Failed to fetch input stream");
                    }
                    else
                    {
                        NBTTagCompound nbttagcompound = CompressedStreamTools.read(datainputstream);
                        datainputstream.close();
                        NBTTagCompound nbttagcompound1 = nbttagcompound.getCompoundTag("Level");
                        ChunkLoader.AnvilConverterData chunkloader$anvilconverterdata = ChunkLoader.load(nbttagcompound1);
                        NBTTagCompound nbttagcompound2 = new NBTTagCompound();
                        NBTTagCompound nbttagcompound3 = new NBTTagCompound();
                        nbttagcompound2.setTag("Level", nbttagcompound3);
                        ChunkLoader.convertToAnvilFormat(chunkloader$anvilconverterdata, nbttagcompound3, biomeSource);
                        DataOutputStream dataoutputstream = regionfile1.getChunkDataOutputStream(i, j);
                        CompressedStreamTools.write(nbttagcompound2, dataoutputstream);
                        dataoutputstream.close();
                    }
                }
            }

            int k = (int)Math.round(100.0D * (double)(p_75811_4_ * 1024) / (double)(p_75811_5_ * 1024));
            int l = (int)Math.round(100.0D * (double)((i + 1) * 32 + p_75811_4_ * 1024) / (double)(p_75811_5_ * 1024));

            if (l > k)
            {
                progressCallback.setLoadingProgress(l);
            }
        }

        regionfile.close();
        regionfile1.close();
    }
    catch (IOException ioexception)
    {
        ioexception.printStackTrace();
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:58,代碼來源:AnvilSaveConverter.java

示例8: writeChunkData

import net.minecraft.nbt.CompressedStreamTools; //導入方法依賴的package包/類
private void writeChunkData(ChunkPos pos, NBTTagCompound compound) throws IOException
{
    DataOutputStream dataoutputstream = RegionFileCache.getChunkOutputStream(this.chunkSaveLocation, pos.chunkXPos, pos.chunkZPos);
    CompressedStreamTools.write(compound, dataoutputstream);
    dataoutputstream.close();
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:7,代碼來源:AnvilChunkLoader.java


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