Example #1
0
 public override void WriteToNBT(net.minecraft.src.NBTTagCompound nbttagcompound)
 {
     base.WriteToNBT(nbttagcompound);
     nbttagcompound.SetInteger("blockId", storedBlockID);
     nbttagcompound.SetInteger("blockData", storedMetadata);
     nbttagcompound.SetInteger("facing", storedOrientation);
     nbttagcompound.SetFloat("progress", lastProgress);
     nbttagcompound.SetBoolean("extending", isExtending);
 }
Example #2
0
 protected internal override void WriteEntityToNBT(net.minecraft.src.NBTTagCompound
                                                   nbttagcompound)
 {
     nbttagcompound.SetByte("Dir", unchecked ((byte)direction));
     nbttagcompound.SetString("Motive", art.title);
     nbttagcompound.SetInteger("TileX", xPosition);
     nbttagcompound.SetInteger("TileY", yPosition);
     nbttagcompound.SetInteger("TileZ", zPosition);
 }
Example #3
0
 public override void Func_28147_b(net.minecraft.src.NBTTagCompound nbttagcompound
                                   )
 {
     nbttagcompound.SetByte("dimension", field_28162_d);
     nbttagcompound.SetInteger("xCenter", field_28164_b);
     nbttagcompound.SetInteger("zCenter", field_28163_c);
     nbttagcompound.SetByte("scale", field_28161_e);
     nbttagcompound.SetShort("width", (short)128);
     nbttagcompound.SetShort("height", (short)128);
     nbttagcompound.SetByteArray("colors", field_28160_f);
 }
Example #4
0
        /// <exception cref="System.IO.IOException"/>
        public virtual net.minecraft.src.Chunk LoadChunk(net.minecraft.src.World world, int
                                                         i, int j)
        {
            string file = ChunkFileForXZ(i, j);

            if (file != null && System.IO.File.Exists(file))
            {
                try
                {
                    net.minecraft.src.NBTTagCompound nbttagcompound = null;
                    //java.io.FileInputStream fileinputstream = new java.io.FileInputStream(file);
                    using (System.IO.FileStream fileinputstream = System.IO.File.OpenRead(file))
                        nbttagcompound = net.minecraft.src.CompressedStreamTools.ReadCompoundFromStream(fileinputstream);

                    if (!nbttagcompound.HasKey("Level"))
                    {
                        System.Console.Out.WriteLine((new java.lang.StringBuilder()).Append("Chunk file at "
                                                                                            ).Append(i).Append(",").Append(j).Append(" is missing level data, skipping").ToString
                                                         ());
                        return(null);
                    }
                    if (!nbttagcompound.GetCompoundTag("Level").HasKey("Blocks"))
                    {
                        System.Console.Out.WriteLine((new java.lang.StringBuilder()).Append("Chunk file at "
                                                                                            ).Append(i).Append(",").Append(j).Append(" is missing block data, skipping").ToString
                                                         ());
                        return(null);
                    }
                    net.minecraft.src.Chunk chunk = LoadChunkIntoWorldFromCompound(world, nbttagcompound
                                                                                   .GetCompoundTag("Level"));
                    if (!chunk.IsAtLocation(i, j))
                    {
                        System.Console.Out.WriteLine((new java.lang.StringBuilder()).Append("Chunk file at "
                                                                                            ).Append(i).Append(",").Append(j).Append(" is in the wrong location; relocating. (Expected "
                                                                                                                                     ).Append(i).Append(", ").Append(j).Append(", got ").Append(chunk.xPosition).Append
                                                         (", ").Append(chunk.zPosition).Append(")").ToString());
                        nbttagcompound.SetInteger("xPos", i);
                        nbttagcompound.SetInteger("zPos", j);
                        chunk = LoadChunkIntoWorldFromCompound(world, nbttagcompound.GetCompoundTag("Level"
                                                                                                    ));
                    }
                    chunk.Func_25083_h();
                    return(chunk);
                }
                catch (System.Exception exception)
                {
                    Sharpen.Runtime.PrintStackTrace(exception);
                }
            }
            return(null);
        }
Example #5
0
 public static void StoreChunkInCompound(net.minecraft.src.Chunk chunk, net.minecraft.src.World
                                         world, net.minecraft.src.NBTTagCompound nbttagcompound)
 {
     world.CheckSessionLock();
     nbttagcompound.SetInteger("xPos", chunk.xPosition);
     nbttagcompound.SetInteger("zPos", chunk.zPosition);
     nbttagcompound.SetLong("LastUpdate", world.GetWorldTime());
     nbttagcompound.SetByteArray("Blocks", chunk.blocks);
     nbttagcompound.SetByteArray("Data", chunk.data.data);
     nbttagcompound.SetByteArray("SkyLight", chunk.skylightMap.data);
     nbttagcompound.SetByteArray("BlockLight", chunk.blocklightMap.data);
     nbttagcompound.SetByteArray("HeightMap", chunk.heightMap);
     nbttagcompound.SetBoolean("TerrainPopulated", chunk.isTerrainPopulated);
     chunk.hasEntities = false;
     net.minecraft.src.NBTTagList nbttaglist = new net.minecraft.src.NBTTagList();
     for (int i = 0; i < chunk.entities.Length; i++)
     {
         System.Collections.IEnumerator iterator = chunk.entities[i].GetEnumerator();
         do
         {
             if (!iterator.MoveNext())
             {
                 goto label0_continue;
             }
             net.minecraft.src.Entity entity = (net.minecraft.src.Entity)iterator.Current;
             chunk.hasEntities = true;
             net.minecraft.src.NBTTagCompound nbttagcompound1 = new net.minecraft.src.NBTTagCompound
                                                                    ();
             if (entity.AddEntityID(nbttagcompound1))
             {
                 nbttaglist.SetTag(nbttagcompound1);
             }
         }while (true);
         label0_continue :;
     }
     label0_break :;
     nbttagcompound.SetTag("Entities", nbttaglist);
     net.minecraft.src.NBTTagList     nbttaglist1 = new net.minecraft.src.NBTTagList();
     net.minecraft.src.NBTTagCompound nbttagcompound2;
     for (System.Collections.IEnumerator iterator1 = chunk.chunkTileEntityMap.Values.GetEnumerator
                                                         (); iterator1.MoveNext(); nbttaglist1.SetTag(nbttagcompound2))
     {
         net.minecraft.src.TileEntity tileentity = (net.minecraft.src.TileEntity)iterator1
                                                   .Current;
         nbttagcompound2 = new net.minecraft.src.NBTTagCompound();
         tileentity.WriteToNBT(nbttagcompound2);
     }
     nbttagcompound.SetTag("TileEntities", nbttaglist1);
 }
Example #6
0
 protected internal override void WriteEntityToNBT(net.minecraft.src.NBTTagCompound
                                                   nbttagcompound)
 {
     nbttagcompound.SetInteger("Type", minecartType);
     if (minecartType == 2)
     {
         nbttagcompound.SetDouble("PushX", pushX);
         nbttagcompound.SetDouble("PushZ", pushZ);
         nbttagcompound.SetShort("Fuel", (short)fuel);
     }
     else
     {
         if (minecartType == 1)
         {
             net.minecraft.src.NBTTagList nbttaglist = new net.minecraft.src.NBTTagList();
             for (int i = 0; i < cargoItems.Length; i++)
             {
                 if (cargoItems[i] != null)
                 {
                     net.minecraft.src.NBTTagCompound nbttagcompound1 = new net.minecraft.src.NBTTagCompound
                                                                            ();
                     nbttagcompound1.SetByte("Slot", unchecked ((byte)i));
                     cargoItems[i].WriteToNBT(nbttagcompound1);
                     nbttaglist.SetTag(nbttagcompound1);
                 }
             }
             nbttagcompound.SetTag("Items", nbttaglist);
         }
     }
 }
Example #7
0
 protected internal override void WriteEntityToNBT(net.minecraft.src.NBTTagCompound
                                                   nbttagcompound)
 {
     base.WriteEntityToNBT(nbttagcompound);
     nbttagcompound.SetTag("Inventory", inventory.WriteToNBT(new net.minecraft.src.NBTTagList
                                                                 ()));
     nbttagcompound.SetInteger("Dimension", dimension);
     nbttagcompound.SetBoolean("Sleeping", sleeping);
     nbttagcompound.SetShort("SleepTimer", (short)sleepTimer);
     if (spawnChunk != null)
     {
         nbttagcompound.SetInteger("SpawnX", spawnChunk.posX);
         nbttagcompound.SetInteger("SpawnY", spawnChunk.posY);
         nbttagcompound.SetInteger("SpawnZ", spawnChunk.posZ);
     }
 }
Example #8
0
        public virtual void WriteToNBT(net.minecraft.src.NBTTagCompound nbttagcompound)
        {
            string s = (string)classToNameMap[this.GetType()];

            if (s == null)
            {
                throw new System.Exception((new java.lang.StringBuilder()).Append(this.GetType()).Append(" is missing a mapping! This is a bug!").ToString());
            }
            else
            {
                nbttagcompound.SetString("id", s);
                nbttagcompound.SetInteger("x", xCoord);
                nbttagcompound.SetInteger("y", yCoord);
                nbttagcompound.SetInteger("z", zCoord);
                return;
            }
        }
Example #9
0
 public override void WriteToNBT(net.minecraft.src.NBTTagCompound nbttagcompound)
 {
     base.WriteToNBT(nbttagcompound);
     if (field_28009_a > 0)
     {
         nbttagcompound.SetInteger("Record", field_28009_a);
     }
 }
Example #10
0
 private void SaveNBTTag(net.minecraft.src.NBTTagCompound nbttagcompound, net.minecraft.src.NBTTagCompound
                         nbttagcompound1)
 {
     nbttagcompound.SetLong("RandomSeed", randomSeed);
     nbttagcompound.SetInteger("SpawnX", spawnX);
     nbttagcompound.SetInteger("SpawnY", spawnY);
     nbttagcompound.SetInteger("SpawnZ", spawnZ);
     nbttagcompound.SetLong("Time", worldTime);
     nbttagcompound.SetLong("SizeOnDisk", sizeOnDisk);
     nbttagcompound.SetLong("LastPlayed", Sharpen.Runtime.CurrentTimeMillis());
     nbttagcompound.SetString("LevelName", levelName);
     nbttagcompound.SetInteger("version", saveVersion);
     nbttagcompound.SetInteger("rainTime", rainTime);
     nbttagcompound.SetBoolean("raining", isRaining);
     nbttagcompound.SetInteger("thunderTime", thunderTime);
     nbttagcompound.SetBoolean("thundering", isThundering);
     if (nbttagcompound1 != null)
     {
         nbttagcompound.SetCompoundTag("Player", nbttagcompound1);
     }
 }
Example #11
0
 protected internal override void WriteEntityToNBT(net.minecraft.src.NBTTagCompound
                                                   nbttagcompound)
 {
     base.WriteEntityToNBT(nbttagcompound);
     nbttagcompound.SetInteger("Size", Func_25027_m() - 1);
 }