本文整理汇总了Java中net.minecraft.nbt.CompressedStreamTools.readCompressed方法的典型用法代码示例。如果您正苦于以下问题:Java CompressedStreamTools.readCompressed方法的具体用法?Java CompressedStreamTools.readCompressed怎么用?Java CompressedStreamTools.readCompressed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.nbt.CompressedStreamTools
的用法示例。
在下文中一共展示了CompressedStreamTools.readCompressed方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getPlayerNBT
import net.minecraft.nbt.CompressedStreamTools; //导入方法依赖的package包/类
public NBTTagCompound getPlayerNBT(net.minecraft.entity.player.EntityPlayerMP player)
{
try
{
File file1 = new File(this.playersDirectory, player.getUniqueID().toString() + ".dat");
if (file1.exists() && file1.isFile())
{
return CompressedStreamTools.readCompressed(new FileInputStream(file1));
}
}
catch (Exception exception)
{
LOGGER.warn("Failed to load player data for " + player.getName());
}
return null;
}
示例2: readPlayerData
import net.minecraft.nbt.CompressedStreamTools; //导入方法依赖的package包/类
/**
* Reads the player data from disk into the specified PlayerEntityMP.
*/
public NBTTagCompound readPlayerData(EntityPlayer player)
{
NBTTagCompound nbttagcompound = null;
try
{
File file1 = new File(this.playersDirectory, player.getUniqueID().toString() + ".dat");
if (file1.exists() && file1.isFile())
{
nbttagcompound = CompressedStreamTools.readCompressed(new FileInputStream(file1));
}
}
catch (Exception var4)
{
logger.warn("Failed to load player data for " + player.getName());
}
if (nbttagcompound != null)
{
player.readFromNBT(nbttagcompound);
}
return nbttagcompound;
}
示例3: renameWorld
import net.minecraft.nbt.CompressedStreamTools; //导入方法依赖的package包/类
/**
* Renames the world by storing the new name in level.dat. It does *not* rename the directory containing the world
* data.
*/
public void renameWorld(String dirName, String newName)
{
File file1 = new File(this.savesDirectory, dirName);
if (file1.exists())
{
File file2 = new File(file1, "level.dat");
if (file2.exists())
{
try
{
NBTTagCompound nbttagcompound = CompressedStreamTools.readCompressed(new FileInputStream(file2));
NBTTagCompound nbttagcompound1 = nbttagcompound.getCompoundTag("Data");
nbttagcompound1.setString("LevelName", newName);
CompressedStreamTools.writeCompressed(nbttagcompound, new FileOutputStream(file2));
}
catch (Exception exception)
{
exception.printStackTrace();
}
}
}
}
示例4: deletePlayerTag
import net.minecraft.nbt.CompressedStreamTools; //导入方法依赖的package包/类
public static void deletePlayerTag(File p_deletePlayerTag_0_)
{
if (p_deletePlayerTag_0_.exists())
{
try
{
NBTTagCompound nbttagcompound = CompressedStreamTools.readCompressed(new FileInputStream(p_deletePlayerTag_0_));
NBTTagCompound nbttagcompound1 = nbttagcompound.getCompoundTag("Data");
nbttagcompound1.removeTag("Player");
CompressedStreamTools.writeCompressed(nbttagcompound, new FileOutputStream(p_deletePlayerTag_0_));
}
catch (Exception exception)
{
exception.printStackTrace();
}
}
}
示例5: renameWorld
import net.minecraft.nbt.CompressedStreamTools; //导入方法依赖的package包/类
/**
* Renames the world by storing the new name in level.dat. It does *not* rename the directory containing the world
* data.
*/
@SideOnly(Side.CLIENT)
public void renameWorld(String dirName, String newName)
{
File file1 = new File(this.savesDirectory, dirName);
if (file1.exists())
{
File file2 = new File(file1, "level.dat");
if (file2.exists())
{
try
{
NBTTagCompound nbttagcompound = CompressedStreamTools.readCompressed(new FileInputStream(file2));
NBTTagCompound nbttagcompound1 = nbttagcompound.getCompoundTag("Data");
nbttagcompound1.setString("LevelName", newName);
CompressedStreamTools.writeCompressed(nbttagcompound, new FileOutputStream(file2));
}
catch (Exception exception)
{
exception.printStackTrace();
}
}
}
}
示例6: readTemplateFromStream
import net.minecraft.nbt.CompressedStreamTools; //导入方法依赖的package包/类
/**
* reads a template from an inputstream
*/
private void readTemplateFromStream(String id, InputStream stream) throws IOException
{
NBTTagCompound nbttagcompound = CompressedStreamTools.readCompressed(stream);
if (!nbttagcompound.hasKey("DataVersion", 99))
{
nbttagcompound.setInteger("DataVersion", 500);
}
Template template = new Template();
template.read(this.field_191154_c.process(FixTypes.STRUCTURE, nbttagcompound));
this.templates.put(id, template);
}
示例7: readPlayerData
import net.minecraft.nbt.CompressedStreamTools; //导入方法依赖的package包/类
@Nullable
/**
* Reads the player data from disk into the specified PlayerEntityMP.
*/
public NBTTagCompound readPlayerData(EntityPlayer player)
{
NBTTagCompound nbttagcompound = null;
try
{
File file1 = new File(this.playersDirectory, player.getCachedUniqueIdString() + ".dat");
if (file1.exists() && file1.isFile())
{
nbttagcompound = CompressedStreamTools.readCompressed(new FileInputStream(file1));
}
}
catch (Exception var4)
{
LOGGER.warn("Failed to load player data for {}", new Object[] {player.getName()});
}
if (nbttagcompound != null)
{
player.readFromNBT(this.dataFixer.process(FixTypes.PLAYER, nbttagcompound));
}
return nbttagcompound;
}
示例8: readTemplateFromStream
import net.minecraft.nbt.CompressedStreamTools; //导入方法依赖的package包/类
/**
* reads a template from an inputstream
*/
private void readTemplateFromStream(String id, InputStream stream) throws IOException
{
NBTTagCompound nbttagcompound = CompressedStreamTools.readCompressed(stream);
Template template = new Template();
template.read(nbttagcompound);
this.templates.put(id, template);
}
示例9: getWorldData
import net.minecraft.nbt.CompressedStreamTools; //导入方法依赖的package包/类
@Nullable
public static WorldInfo getWorldData(File p_186353_0_, DataFixer dataFixerIn)
{
try
{
NBTTagCompound nbttagcompound = CompressedStreamTools.readCompressed(new FileInputStream(p_186353_0_));
NBTTagCompound nbttagcompound1 = nbttagcompound.getCompoundTag("Data");
return new WorldInfo(dataFixerIn.process(FixTypes.LEVEL, nbttagcompound1));
}
catch (Exception exception)
{
LOGGER.error("Exception reading {}", new Object[] {p_186353_0_, exception});
return null;
}
}
示例10: readPlayerData
import net.minecraft.nbt.CompressedStreamTools; //导入方法依赖的package包/类
/**
* Reads the player data from disk into the specified PlayerEntityMP.
*/
public NBTTagCompound readPlayerData(EntityPlayer player)
{
NBTTagCompound nbttagcompound = null;
try
{
File file1 = new File(this.playersDirectory, player.getCachedUniqueIdString() + ".dat");
if (file1.exists() && file1.isFile())
{
nbttagcompound = CompressedStreamTools.readCompressed(new FileInputStream(file1));
}
}
catch (Exception var4)
{
LOGGER.warn("Failed to load player data for {}", new Object[] {player.getName()});
}
if (nbttagcompound != null)
{
player.readFromNBT(this.dataFixer.process(FixTypes.PLAYER, nbttagcompound));
}
net.minecraftforge.event.ForgeEventFactory.firePlayerLoadingEvent(player, playersDirectory, player.getUniqueID().toString());
return nbttagcompound;
}
示例11: loadAnimation
import net.minecraft.nbt.CompressedStreamTools; //导入方法依赖的package包/类
public static AnimationSequence loadAnimation(ResourceLocation resource) throws IOException
{
return new AnimationSequence(CompressedStreamTools.readCompressed(getResourceStream(resource)));
}
示例12: readTags
import net.minecraft.nbt.CompressedStreamTools; //导入方法依赖的package包/类
/**
* Load map tag from file
* @param file File to read
* @return NBT tag from file
* @throws IOException If reading failed
*/
public static NBTTagCompound readTags(File file) throws IOException {
try (FileInputStream fis = new FileInputStream(file)) {
return CompressedStreamTools.readCompressed(fis);
}
}