public override TagNode BuildTree() { TagNodeCompound tree = base.BuildTree() as TagNodeCompound; tree["Command"] = new TagNodeString(_command); return tree; }
public override TagNode BuildTree() { TagNodeCompound tree = base.BuildTree() as TagNodeCompound; tree["Owner"] = new TagNodeString(_owner); tree["Sitting"] = new TagNodeByte((byte)(_sitting ? 1 : 0)); tree["Angry"] = new TagNodeByte((byte)(_angry ? 1 : 0)); return tree; }
/// <summary> /// Exports the <see cref="Schematic"/> object to a schematic file. /// </summary> /// <param name="path">The path to write out the schematic file to.</param> public void Export(string path) { int xdim = _blockset.XDim; int ydim = _blockset.YDim; int zdim = _blockset.ZDim; byte[] blockData = new byte[xdim * ydim * zdim]; byte[] dataData = new byte[xdim * ydim * zdim]; YZXByteArray schemaBlocks = new YZXByteArray(_blockset.XDim, _blockset.YDim, _blockset.ZDim, blockData); YZXByteArray schemaData = new YZXByteArray(_blockset.XDim, _blockset.YDim, _blockset.ZDim, dataData); TagNodeList entities = new TagNodeList(TagType.TAG_COMPOUND); TagNodeList tileEntities = new TagNodeList(TagType.TAG_COMPOUND); for (int x = 0; x < xdim; x++) { for (int z = 0; z < zdim; z++) { for (int y = 0; y < ydim; y++) { AlphaBlock block = _blockset.GetBlock(x, y, z); schemaBlocks[x, y, z] = (byte)block.ID; schemaData[x, y, z] = (byte)block.Data; TileEntity te = block.GetTileEntity(); if (te != null) { te.X = x; te.Y = y; te.Z = z; tileEntities.Add(te.BuildTree()); } } } } foreach (TypedEntity e in _entityset) { entities.Add(e.BuildTree()); } TagNodeCompound schematic = new TagNodeCompound(); schematic["Width"] = new TagNodeShort((short)xdim); schematic["Length"] = new TagNodeShort((short)zdim); schematic["Height"] = new TagNodeShort((short)ydim); schematic["Entities"] = entities; schematic["TileEntities"] = tileEntities; schematic["Materials"] = new TagNodeString("Alpha"); schematic["Blocks"] = new TagNodeByteArray(blockData); schematic["Data"] = new TagNodeByteArray(dataData); NBTFile schematicFile = new NBTFile(path); Stream nbtStream = schematicFile.GetDataOutputStream(); if (nbtStream == null) { return; } NbtTree tree = new NbtTree(schematic, "Schematic"); tree.WriteTo(nbtStream); nbtStream.Close(); }
public override TagNode BuildTree() { TagNodeCompound tree = base.BuildTree() as TagNodeCompound; tree["Text1"] = new TagNodeString(_text1); tree["Text2"] = new TagNodeString(_text2); tree["Text3"] = new TagNodeString(_text3); tree["Text4"] = new TagNodeString(_text4); return tree; }
public override TagNode BuildTree() { TagNodeCompound tree = base.BuildTree() as TagNodeCompound; tree["EntityId"] = new TagNodeString(_entityID); tree["Delay"] = new TagNodeShort(_delay); if (_maxDelay != null) tree["MaxSpawnDelay"] = new TagNodeShort(_maxDelay ?? 0); if (_minDelay != null) tree["MinSpawnDelay"] = new TagNodeShort(_minDelay ?? 0); if (_spawnCount != null) tree["SpawnCount"] = new TagNodeShort(_spawnCount ?? 0); if (_spawnRange != null) tree["SpawnRange"] = new TagNodeShort(_spawnRange ?? 0); if (_maxNearbyEnemies != null) tree["MaxNearbyEnemies"] = new TagNodeShort(_maxNearbyEnemies ?? 0); if (_requiredPlayerRange != null) tree["RequiredPlayerRange"] = new TagNodeShort(_requiredPlayerRange ?? 0); if (_maxExperience != null) tree["MaxExperience"] = new TagNodeInt(_maxExperience ?? 0); if (_remainingExperience != null) tree["RemainingExperience"] = new TagNodeInt(_remainingExperience ?? 0); if (_experienceRegenTick != null) tree["ExperienceRegenTick"] = new TagNodeInt(_experienceRegenTick ?? 0); if (_experienceRegenRate != null) tree["ExperienceRegenRate"] = new TagNodeInt(_experienceRegenRate ?? 0); if (_experienceRegenAmount != null) tree["ExperienceRegenAmount"] = new TagNodeInt(_experienceRegenAmount ?? 0); if (_spawnData != null && _spawnData.Count > 0) tree["SpawnData"] = _spawnData; return tree; }
public override TagNode BuildTree() { TagNodeCompound tree = base.BuildTree() as TagNodeCompound; tree["Dir"] = new TagNodeByte((byte)_dir); tree["Motive"] = new TagNodeString(_motive); tree["TileX"] = new TagNodeInt(_xTile); tree["TileY"] = new TagNodeInt(_yTile); tree["TileZ"] = new TagNodeInt(_zTile); return tree; }