当前位置: 首页>>代码示例>>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;未经允许,请勿转载。