本文整理汇总了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();
}
示例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();
}
示例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;
}
示例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;
}
示例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();
}
示例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;
}
示例7: setInt
import org.jnbt.IntTag; //导入依赖的package包/类
protected final void setInt(String name, int value) {
tag.setTag(name, new IntTag(name, value));
}