• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java ByteTag类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.jnbt.ByteTag的典型用法代码示例。如果您正苦于以下问题:Java ByteTag类的具体用法?Java ByteTag怎么用?Java ByteTag使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ByteTag类属于org.jnbt包,在下文中一共展示了ByteTag类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getTag

import org.jnbt.ByteTag; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public Tag getTag() {
	// Create tag
	CompoundTagFactory factory = new CompoundTagFactory("");
	factory.set(new ByteArrayTag("Blocks", blockIds));
	factory.set(new ByteArrayTag("Data", blockData.getBytes()));
	factory.set(new ByteArrayTag("BlockLight", new NibbleArray(BLOCKS_PER_SECTION).getBytes()));
	factory.set(new ByteArrayTag("SkyLight", skyLight.getBytes()));
	factory.set(new ByteTag("Y", (byte)y));
	return factory.getTag();
}
 
开发者ID:r-ralph,项目名称:Transcendens,代码行数:15,代码来源:Section.java


示例2: getTag

import org.jnbt.ByteTag; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public Tag getTag() {
	// Get section tags
	ListTagFactory factory = new ListTagFactory("Sections", CompoundTag.class);
	for(Section section : sections) {
		if(section != null && section.getBlockCount() > 0) {
			factory.add(section.getTag());
		}
	}
	
	// Make level tags
	CompoundTagFactory factory2 = new CompoundTagFactory("Level");
	factory2.set(factory.getTag());
	factory2.set(new IntTag("xPos", xPos));
	factory2.set(new IntTag("zPos", zPos));
	factory2.set(new LongTag("LastUpdate", System.currentTimeMillis()));
	factory2.set(new ByteTag("V", (byte)1));
	factory2.set(new ByteTag("LightPopulated", (byte)1));
	factory2.set(new ByteTag("TerrainPopulated", (byte)1));
	
	// Make height map
	int[] heightMapAry = new int[BLOCKS_PER_CHUNK_SIDE * BLOCKS_PER_CHUNK_SIDE];
	int i = 0;
	for(int z = 0; z < BLOCKS_PER_CHUNK_SIDE; z++) {
		for(int x = 0; x < BLOCKS_PER_CHUNK_SIDE; x++) {
			heightMapAry[i] = heightMap[x][z];
			i++;
		}
	}
	factory2.set(new IntArrayTag("HeightMap", heightMapAry));
	
	// Make chunk tag
	CompoundTagFactory factory3 = new CompoundTagFactory("");
	factory3.set(factory2.getTag());
	return factory3.getTag();
}
 
开发者ID:r-ralph,项目名称:Transcendens,代码行数:40,代码来源:Chunk.java


示例3: getTag

import org.jnbt.ByteTag; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public Tag getTag() {
	// Set level tags
	CompoundTagFactory factory = new CompoundTagFactory("Data");
	factory.set(new ByteTag("allowCommands", allowCommands ? (byte)1 : (byte)0));
	factory.set(new IntTag("GameType", gameType.getValue()));
	factory.set(new StringTag("generatorName", generator.getGeneratorName()));
	factory.set(new LongTag("LastPlayed", System.currentTimeMillis()));
	factory.set(new StringTag("LevelName", levelName));
	factory.set(new ByteTag("MapFeatures", mapFeatures ? (byte)1 : (byte)0));
	factory.set(new LongTag("RandomSeed", randomSeed));
	factory.set(new IntTag("SpawnX", spawnX));
	factory.set(new IntTag("SpawnY", spawnY));
	factory.set(new IntTag("SpawnZ", spawnZ));
	factory.set(new IntTag("version", 19133));
	
	// Generator options
	String options = generator.getGeneratorOptions();
	if(options != null) {
		factory.set(new StringTag("generatorOptions", options));
	}
	
	// Make root tag
	CompoundTagFactory factory2 = new CompoundTagFactory("");
	factory2.set(factory.getTag());
	return factory2.getTag();
}
 
开发者ID:r-ralph,项目名称:Transcendens,代码行数:31,代码来源:Level.java


示例4: getByte

import org.jnbt.ByteTag; //导入依赖的package包/类
public static byte getByte(CompoundTag parent, String name, final byte defaultValue)
{
	ByteTag tag = getChild(parent, name, ByteTag.class);
	if (tag != null)
		return tag.getValue();
	else
		return defaultValue;
}
 
开发者ID:tectonicus,项目名称:tectonicus,代码行数:9,代码来源:NbtUtil.java


示例5: save

import org.jnbt.ByteTag; //导入依赖的package包/类
/**
 * Saves the level.dat to the disk.
 * @throws IOException
 */
public void save() throws IOException {
	
	//Create a NBT output stream.
	FileOutputStream fos = new FileOutputStream(file);
	GZIPOutputStream gzipOs = new GZIPOutputStream(fos);
	NBTOutputStream nbtOs = new NBTOutputStream(gzipOs);
	
	//Create new tags. Sorted like in level.dat.
	ByteTag 	tagThundering 	= new ByteTag("thundering", thundering);
	LongTag 	tagLastPlayed 	= new LongTag("LastPlayed", lastPlayed);
	LongTag 	tagRandomSeed 	= new LongTag("RandomSeed", randomSeed);
	IntTag 		tagVersion 		= new IntTag("version", version);
	LongTag 	tagTime 		= new LongTag("Time", time);
	ByteTag 	tagRaining 		= new ByteTag("raining", raining);
	IntTag 		tagSpawnX 		= new IntTag("SpawnX", spawnX);
	IntTag 		tagThunderTime 	= new IntTag("thunderTime", thunderTime);
	IntTag 		tagSpawnY 		= new IntTag("SpawnY", spawnY);
	IntTag 		tagSpawnZ 		= new IntTag("SpawnZ", spawnZ);
	StringTag 	tagLevelName 	= new StringTag("LevelName", levelName);
	LongTag 	tagSizeOnDisk 	= new LongTag("SizeOnDisk", sizeOnDisk);
	IntTag 		tagRainTime 	= new IntTag("rainTime", rainTime);
	
	Map<String, Tag> dataMap = new HashMap<String, Tag>();
	dataMap.put("thundering", tagThundering);
	dataMap.put("LastPlayed", tagLastPlayed);
	dataMap.put("RandomSeed", tagRandomSeed);
	dataMap.put("version", tagVersion);
	dataMap.put("Time", tagTime);
	dataMap.put("raining", tagRaining);
	dataMap.put("SpawnX", tagSpawnX);
	dataMap.put("thunderTime", tagThunderTime);
	dataMap.put("SpawnY", tagSpawnY);
	dataMap.put("SpawnZ", tagSpawnZ);
	dataMap.put("LevelName", tagLevelName);
	dataMap.put("SizeOnDisk", tagSizeOnDisk);
	dataMap.put("rainTime", tagRainTime);
	
	//Find through the compound clutter.
	CompoundTag dataTag = new CompoundTag("Data", dataMap);
	Map<String, Tag> rootMap = new HashMap<String, Tag>();
	rootMap.put("Data", dataTag);
	CompoundTag rootTag = new CompoundTag("", rootMap);
	
	nbtOs.writeTag(rootTag);
	
	//Flush and close the output streams.
	nbtOs.close();
	fos.close();
	
}
 
开发者ID:sd5,项目名称:mcBetaTerrainGenerator,代码行数:55,代码来源:LevelFile.java


示例6: getByte

import org.jnbt.ByteTag; //导入依赖的package包/类
protected final byte getByte(String name, byte defaultValue) {
    ByteTag byteTag = (ByteTag) tag.getTag(name);
    return (byteTag != null) ? byteTag.getValue() : defaultValue;
}
 
开发者ID:Captain-Chaos,项目名称:WorldPainter,代码行数:5,代码来源:AbstractNBTItem.java


示例7: setByte

import org.jnbt.ByteTag; //导入依赖的package包/类
protected final void setByte(String name, byte value) {
    tag.setTag(name, new ByteTag(name, value));
}
 
开发者ID:Captain-Chaos,项目名称:WorldPainter,代码行数:4,代码来源:AbstractNBTItem.java


示例8: getBoolean

import org.jnbt.ByteTag; //导入依赖的package包/类
protected final boolean getBoolean(String name, boolean defaultValue) {
    ByteTag byteTag = (ByteTag) tag.getTag(name);
    return (byteTag != null) ? (byteTag.getValue() != 0) : defaultValue;
}
 
开发者ID:Captain-Chaos,项目名称:WorldPainter,代码行数:5,代码来源:AbstractNBTItem.java


示例9: setBoolean

import org.jnbt.ByteTag; //导入依赖的package包/类
protected final void setBoolean(String name, boolean value) {
    tag.setTag(name, new ByteTag(name, value ? (byte) 1 : (byte) 0));
}
 
开发者ID:Captain-Chaos,项目名称:WorldPainter,代码行数:4,代码来源:AbstractNBTItem.java


示例10: getIntFromTag

import org.jnbt.ByteTag; //导入依赖的package包/类
/**
 * Extracts an integer from an NBT compound tag, where the child
 * element is assumed to be a {@link org.jnbt.ByteTag}.
 *
 * @param tag the tag instance
 * @param key the key for the byte array attribute
 * @return the byte array
 */
static int getIntFromTag(CompoundTag tag, String key) {
    return ((ByteTag) tag.getValue().get(key)).getValue().intValue();
}
 
开发者ID:sdhunt,项目名称:McQuad,代码行数:12,代码来源:NbtUtils.java



注:本文中的org.jnbt.ByteTag类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ProtocolStringList类代码示例发布时间:2022-05-22
下一篇:
Java DrawableUtils类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap