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

Java IntTag类代码示例

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

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



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

示例1: getTag

import org.jnbt.IntTag; //导入依赖的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


示例2: getTag

import org.jnbt.IntTag; //导入依赖的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


示例3: getInt

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


示例4: getInt

import org.jnbt.IntTag; //导入依赖的package包/类
private int getInt(Map<String, Tag> map, String name) {
    return map.containsKey(name) ? ((IntTag) map.get(name)).getValue() : 0;
}
 
开发者ID:BurnGames,项目名称:BGDCore,代码行数:4,代码来源:SchematicFormat.java


示例5: save

import org.jnbt.IntTag; //导入依赖的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: getInt

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


示例7: setInt

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



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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