public virtual NbtCompound writeToNbt(NbtCompound tag)
        {
            NbtHelper.writeDirectVector3(tag, this.structureBoundingBox.center, "sbbc");
            NbtHelper.writeDirectVector3(tag, this.structureBoundingBox.size, "sbbs");

            return(tag);
        }
Exemple #2
0
 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);
 }
Exemple #3
0
 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"));
 }
Exemple #4
0
        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);
        }
Exemple #6
0
 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);
 }
Exemple #7
0
        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);
        }
Exemple #8
0
 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);
 }
Exemple #9
0
        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);
        }
Exemple #10
0
        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");
        }
Exemple #11
0
        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));
        }
Exemple #12
0
        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);
        }
Exemple #13
0
        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);
                }
            }
        }
Exemple #14
0
        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);
        }
Exemple #15
0
 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;
 }
Exemple #16
0
 public CaveSegment(NbtCompound tag)
 {
     this.point1 = NbtHelper.readDirectVector3(tag, "start");
     this.point2 = NbtHelper.readDirectVector3(tag, "end");
     this.radius = tag.Get <NbtFloat>("r").FloatValue;
 }
Exemple #17
0
 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");
 }
Exemple #20
0
 /// <summary>
 /// Constrcutor when loading a piece from the save.
 /// </summary>
 public PieceBase(NbtCompound tag)
 {
     this.orgin = NbtHelper.readDirectBlockPos(tag, "orgin");
 }
Exemple #21
0
 /// <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);
 }