public virtual NbtCompound writeToNbt(NbtCompound tag) { NbtHelper.writeDirectVector3(tag, this.structureBoundingBox.center, "sbbc"); NbtHelper.writeDirectVector3(tag, this.structureBoundingBox.size, "sbbs"); return(tag); }
public void readFromNbt(NbtCompound tag) { this.seed = tag.Get <NbtInt>("seed").IntValue; this.spawnPos = NbtHelper.readDirectVector3(tag, "spawn"); this.worldType = tag.Get <NbtInt>("worldType").IntValue; this.lastLoaded = DateTime.FromBinary(tag.Get <NbtLong>("lastLoaded").LongValue); }
public virtual void readFromNbt(NbtCompound tag) { this.transform.position = NbtHelper.readVector3(tag.Get <NbtCompound>("position")); this.transform.eulerAngles = NbtHelper.readVector3(tag.Get <NbtCompound>("rotation")); this.rBody.velocity = NbtHelper.readVector3(tag.Get <NbtCompound>("velocity")); this.rBody.angularVelocity = NbtHelper.readVector3(tag.Get <NbtCompound>("angularVelocity")); }
public void readFromNbt(NbtCompound tag) { this.chunkPos = new ChunkPos(tag.getInt("chunkX"), tag.getInt("chunkZ")); NbtHelper.readList(tag, "staticObjects", this.map); NbtHelper.readList(tag, "mapObjects", this.map); }
public NbtCompound writeToNbt() { NbtCompound tag = new NbtCompound(); tag.Add(new NbtFloat("timeUntil", this.timeUntil)); NbtHelper.writeDirectBlockPos(tag, this.pos, "pos"); return(tag); }
public override NbtCompound writeToNbt(NbtCompound tag) { base.writeToNbt(tag); NbtHelper.writeDirectBlockPos(tag, this.end, "end"); tag.Add(new NbtInt("pointing", this.pointing.index - 1)); tag.Add(new NbtByte("3High", (byte)(this.is3High ? 1 : 0))); return(tag); }
public NbtCompound writeToNbt() { NbtCompound tag = new NbtCompound("world"); tag.Add(new NbtInt("seed", this.seed)); NbtHelper.writeDirectVector3(tag, this.spawnPos, "spawn"); tag.Add(new NbtInt("worldType", this.worldType)); tag.Add(new NbtLong("lastLoaded", this.lastLoaded.ToBinary())); return(tag); }
public override NbtCompound writeToNbt(NbtCompound tag) { base.writeToNbt(tag); NbtHelper.writeDirectBlockPos(tag, this.orgin, "center"); tag.Add(new NbtInt("topFloor", this.topFloor)); tag.Add(new NbtInt("bottomFloor", this.bottomFloor)); tag.Add(new NbtByte("useFarEntrance", this.useFartherEntrance ? (byte)1 : (byte)0)); tag.Add(new NbtByte("isTall", this.isTall ? (byte)1 : (byte)0)); return(tag); }
public virtual NbtCompound writeToNbt(NbtCompound tag) { tag.Add(new NbtInt("id", EntityRegistry.getIdFromEntity(this))); tag.Add(NbtHelper.writeVector3("position", this.transform.position)); tag.Add(NbtHelper.writeVector3("rotation", this.transform.eulerAngles)); tag.Add(NbtHelper.writeVector3("velocity", this.rBody.velocity)); tag.Add(NbtHelper.writeVector3("angularVelocity", this.rBody.angularVelocity)); return(tag); }
public override void readFromNbt(NbtCompound tag) { base.readFromNbt(tag); this.setTile( Block.getBlockFromId(tag.Get <NbtInt>("blockId").Value), tag.Get <NbtInt>("meta").Value); tag.TryGet <NbtCompound>("blockNbt", out this.blockNbt); this.startPos = NbtHelper.readDirectBlockPos(tag, "start"); }
public override NbtCompound writeToNbt(NbtCompound tag) { NbtHelper.writeDirectBlockPos(tag, this.shaftOrgin, "orgin"); NbtList nbtList = new NbtList("pieces", NbtTagType.Compound); foreach (PieceBase p in this.pieces) { nbtList.Add(p.writeToNbt(new NbtCompound())); } tag.Add(nbtList); return(base.writeToNbt(tag)); }
public override NbtCompound writeToNbt(NbtCompound tag) { base.writeToNbt(tag); tag.Add(new NbtInt("blockId", this.block.id)); tag.Add(new NbtInt("meta", this.meta)); if (this.blockNbt != null) { tag.Add(new NbtCompound("blockNbt", this.blockNbt)); } NbtHelper.writeDirectBlockPos(tag, this.startPos, "start"); return(tag); }
public override void readFromNbt(NbtCompound tag) { this.shaftOrgin = NbtHelper.readDirectBlockPos(tag, "orgin"); foreach (NbtCompound compound in tag.Get <NbtList>("pieces")) { byte id = compound.Get <NbtByte>("id").ByteValue; PieceBase p = this.getPieceFromId(id, compound); if (p != null) { p.shaft = this; p.calculateBounds(); this.pieces.Add(p); } } }
public void writeToNbt(NbtCompound tag, bool deleteEntities) { tag.setTag("chunkX", this.chunkPos.x); tag.setTag("chunkZ", this.chunkPos.z); NbtHelper.writeList(tag, "staticObjects", this.mapObjects); // Entites. MapObject entity; List <MapObject> entitiesInChunk = new List <MapObject>(); int i, x, y, z; for (i = this.map.mapObjects.Count - 1; i >= 0; i--) { entity = this.map.mapObjects[i]; //if (!(entity is EntityPlayer)) { x = MathHelper.floor((int)entity.transform.position.x / Chunk.SIZEf); y = MathHelper.floor((int)entity.transform.position.y / Chunk.SIZEf); z = MathHelper.floor((int)entity.transform.position.z / Chunk.SIZEf); if (x == this.chunkPos.x && z == this.chunkPos.z) { this.map.mapObjects.Remove(entity); entitiesInChunk.Add(entity); } //} } NbtList nbtMapObjList = new NbtList("mapObjects", NbtTagType.Compound); for (i = 0; i < entitiesInChunk.Count; i++) { entity = entitiesInChunk[i]; NbtCompound tagCompound = new NbtCompound(); entity.writeToNbt(tagCompound); nbtMapObjList.Add(tagCompound); if (deleteEntities) { GameObject.Destroy(entity.gameObject); } } tag.Add(nbtMapObjList); }
public PieceHallway(NbtCompound tag) : base(tag) { this.end = NbtHelper.readDirectBlockPos(tag, "end"); this.pointing = Direction.all[tag.Get <NbtInt>("pointing").IntValue]; this.is3High = tag.Get <NbtByte>("3High").Value == 1; }
public CaveSegment(NbtCompound tag) { this.point1 = NbtHelper.readDirectVector3(tag, "start"); this.point2 = NbtHelper.readDirectVector3(tag, "end"); this.radius = tag.Get <NbtFloat>("r").FloatValue; }
public void writeToNbt(NbtCompound tag) { NbtHelper.writeDirectVector3(tag, this.point1, "start"); NbtHelper.writeDirectVector3(tag, this.point2, "end"); tag.Add(new NbtFloat("r", this.radius)); }
public virtual void readFromNbt(NbtCompound tag) { this.structureBoundingBox = new Bounds( NbtHelper.readDirectVector3(tag, "sbbc"), NbtHelper.readDirectVector3(tag, "sbbs")); }
public ScheduledTick(NbtCompound tag) { this.timeUntil = tag.Get <NbtFloat>("timeUntil").Value; this.pos = NbtHelper.readDirectBlockPos(tag, "pos"); }
/// <summary> /// Constrcutor when loading a piece from the save. /// </summary> public PieceBase(NbtCompound tag) { this.orgin = NbtHelper.readDirectBlockPos(tag, "orgin"); }
/// <summary> /// Called to save the piece to disk. /// </summary> public virtual NbtCompound writeToNbt(NbtCompound tag) { tag.Add(new NbtByte("id", this.getPieceId())); NbtHelper.writeDirectBlockPos(tag, this.orgin, "orgin"); return(tag); }