protected internal override void ReadEntityFromNBT(net.minecraft.src.NBTTagCompound nbttagcompound) { minecartType = nbttagcompound.GetInteger("Type"); if (minecartType == 2) { pushX = nbttagcompound.GetDouble("PushX"); pushZ = nbttagcompound.GetDouble("PushZ"); fuel = nbttagcompound.GetShort("Fuel"); } else { if (minecartType == 1) { net.minecraft.src.NBTTagList nbttaglist = nbttagcompound.GetTagList("Items"); cargoItems = new net.minecraft.src.ItemStack[GetSizeInventory()]; for (int i = 0; i < nbttaglist.TagCount(); i++) { net.minecraft.src.NBTTagCompound nbttagcompound1 = (net.minecraft.src.NBTTagCompound )nbttaglist.TagAt(i); int j = nbttagcompound1.GetByte("Slot"); if (j >= 0 && j < cargoItems.Length) { cargoItems[j] = new net.minecraft.src.ItemStack(nbttagcompound1); } } } } }
public virtual void ReadFromNBT(net.minecraft.src.NBTTagList nbttaglist) { mainInventory = new net.minecraft.src.ItemStack[36]; armorInventory = new net.minecraft.src.ItemStack[4]; for (int i = 0; i < nbttaglist.TagCount(); i++) { net.minecraft.src.NBTTagCompound nbttagcompound = (net.minecraft.src.NBTTagCompound )nbttaglist.TagAt(i); int j = nbttagcompound.GetByte("Slot"); net.minecraft.src.ItemStack itemstack = new net.minecraft.src.ItemStack(nbttagcompound ); if (itemstack.GetItem() == null) { continue; } if (j >= 0 && j < mainInventory.Length) { mainInventory[j] = itemstack; } if (j >= 100 && j < armorInventory.Length + 100) { armorInventory[j - 100] = itemstack; } } }
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); } } }
public virtual net.minecraft.src.NBTTagList WriteToNBT(net.minecraft.src.NBTTagList nbttaglist) { for (int i = 0; i < mainInventory.Length; i++) { if (mainInventory[i] != null) { net.minecraft.src.NBTTagCompound nbttagcompound = new net.minecraft.src.NBTTagCompound (); nbttagcompound.SetByte("Slot", unchecked ((byte)i)); mainInventory[i].WriteToNBT(nbttagcompound); nbttaglist.SetTag(nbttagcompound); } } for (int j = 0; j < armorInventory.Length; j++) { if (armorInventory[j] != null) { net.minecraft.src.NBTTagCompound nbttagcompound1 = new net.minecraft.src.NBTTagCompound (); nbttagcompound1.SetByte("Slot", unchecked ((byte)(j + 100))); armorInventory[j].WriteToNBT(nbttagcompound1); nbttaglist.SetTag(nbttagcompound1); } } return(nbttaglist); }
protected internal virtual net.minecraft.src.NBTTagList NewFloatNBTList(float[] af ) { net.minecraft.src.NBTTagList nbttaglist = new net.minecraft.src.NBTTagList(); float[] af1 = af; int i = af1.Length; for (int j = 0; j < i; j++) { float f = af1[j]; nbttaglist.SetTag(new net.minecraft.src.NBTTagFloat(f)); } return(nbttaglist); }
protected internal virtual net.minecraft.src.NBTTagList NewDoubleNBTList(double[] ad) { net.minecraft.src.NBTTagList nbttaglist = new net.minecraft.src.NBTTagList(); double[] ad1 = ad; int i = ad1.Length; for (int j = 0; j < i; j++) { double d = ad1[j]; nbttaglist.SetTag(new net.minecraft.src.NBTTagDouble(d)); } return(nbttaglist); }
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); }
public override void ReadFromNBT(net.minecraft.src.NBTTagCompound nbttagcompound) { base.ReadFromNBT(nbttagcompound); net.minecraft.src.NBTTagList nbttaglist = nbttagcompound.GetTagList("Items"); items = new net.minecraft.src.ItemStack[GetSizeInventory()]; for (int i = 0; i < nbttaglist.TagCount(); i++) { net.minecraft.src.NBTTagCompound nbttagcompound1 = (net.minecraft.src.NBTTagCompound )nbttaglist.TagAt(i); int j = nbttagcompound1.GetByte("Slot"); if (j >= 0 && j < items.Length) { items[j] = new net.minecraft.src.ItemStack(nbttagcompound1); } } }
public override void WriteToNBT(net.minecraft.src.NBTTagCompound nbttagcompound) { base.WriteToNBT(nbttagcompound); net.minecraft.src.NBTTagList nbttaglist = new net.minecraft.src.NBTTagList(); for (int i = 0; i < items.Length; i++) { if (items[i] != null) { net.minecraft.src.NBTTagCompound nbttagcompound1 = new net.minecraft.src.NBTTagCompound (); nbttagcompound1.SetByte("Slot", unchecked ((byte)i)); items[i].WriteToNBT(nbttagcompound1); nbttaglist.SetTag(nbttagcompound1); } } nbttagcompound.SetTag("Items", nbttaglist); }
public override void WriteToNBT(net.minecraft.src.NBTTagCompound nbttagcompound) { base.WriteToNBT(nbttagcompound); nbttagcompound.SetShort("BurnTime", (short)furnaceBurnTime); nbttagcompound.SetShort("CookTime", (short)furnaceCookTime); net.minecraft.src.NBTTagList nbttaglist = new net.minecraft.src.NBTTagList(); for (int i = 0; i < furnaceItemStacks.Length; i++) { if (furnaceItemStacks[i] != null) { net.minecraft.src.NBTTagCompound nbttagcompound1 = new net.minecraft.src.NBTTagCompound (); nbttagcompound1.SetByte("Slot", unchecked ((byte)i)); furnaceItemStacks[i].WriteToNBT(nbttagcompound1); nbttaglist.SetTag(nbttagcompound1); } } nbttagcompound.SetTag("Items", nbttaglist); }
public override void ReadFromNBT(net.minecraft.src.NBTTagCompound nbttagcompound) { base.ReadFromNBT(nbttagcompound); net.minecraft.src.NBTTagList nbttaglist = nbttagcompound.GetTagList("Items"); furnaceItemStacks = new net.minecraft.src.ItemStack[GetSizeInventory()]; for (int i = 0; i < nbttaglist.TagCount(); i++) { net.minecraft.src.NBTTagCompound nbttagcompound1 = (net.minecraft.src.NBTTagCompound )nbttaglist.TagAt(i); byte byte0 = nbttagcompound1.GetByte("Slot"); if (byte0 >= 0 && ((sbyte)byte0) < furnaceItemStacks.Length) { furnaceItemStacks[byte0] = new net.minecraft.src.ItemStack(nbttagcompound1); } } furnaceBurnTime = nbttagcompound.GetShort("BurnTime"); furnaceCookTime = nbttagcompound.GetShort("CookTime"); currentItemBurnTime = GetItemBurnTime(furnaceItemStacks[1]); }
public virtual void ReadFromNBT(net.minecraft.src.NBTTagCompound nbttagcompound) { //TODO: Bukkit stuff??? net.minecraft.src.NBTTagList nbttaglist = nbttagcompound.GetTagList("Pos"); net.minecraft.src.NBTTagList nbttaglist1 = nbttagcompound.GetTagList("Motion"); net.minecraft.src.NBTTagList nbttaglist2 = nbttagcompound.GetTagList("Rotation"); motionX = ((net.minecraft.src.NBTTagDouble)nbttaglist1.TagAt(0)).doubleValue; motionY = ((net.minecraft.src.NBTTagDouble)nbttaglist1.TagAt(1)).doubleValue; motionZ = ((net.minecraft.src.NBTTagDouble)nbttaglist1.TagAt(2)).doubleValue; if (System.Math.Abs(motionX) > 10D) { motionX = 0.0D; } if (System.Math.Abs(motionY) > 10D) { motionY = 0.0D; } if (System.Math.Abs(motionZ) > 10D) { motionZ = 0.0D; } prevPosX = lastTickPosX = posX = ((net.minecraft.src.NBTTagDouble)nbttaglist.TagAt (0)).doubleValue; prevPosY = lastTickPosY = posY = ((net.minecraft.src.NBTTagDouble)nbttaglist.TagAt (1)).doubleValue; prevPosZ = lastTickPosZ = posZ = ((net.minecraft.src.NBTTagDouble)nbttaglist.TagAt (2)).doubleValue; prevRotationYaw = rotationYaw = ((net.minecraft.src.NBTTagFloat)nbttaglist2.TagAt (0)).floatValue; prevRotationPitch = rotationPitch = ((net.minecraft.src.NBTTagFloat)nbttaglist2.TagAt (1)).floatValue; fallDistance = nbttagcompound.GetFloat("FallDistance"); fire = nbttagcompound.GetShort("Fire"); air = nbttagcompound.GetShort("Air"); onGround = nbttagcompound.GetBoolean("OnGround"); SetPosition(posX, posY, posZ); SetRotation(rotationYaw, rotationPitch); ReadEntityFromNBT(nbttagcompound); }
protected internal override void ReadEntityFromNBT(net.minecraft.src.NBTTagCompound nbttagcompound) { base.ReadEntityFromNBT(nbttagcompound); net.minecraft.src.NBTTagList nbttaglist = nbttagcompound.GetTagList("Inventory"); inventory.ReadFromNBT(nbttaglist); dimension = nbttagcompound.GetInteger("Dimension"); sleeping = nbttagcompound.GetBoolean("Sleeping"); sleepTimer = nbttagcompound.GetShort("SleepTimer"); if (sleeping) { playerLocation = new net.minecraft.src.ChunkCoordinates(net.minecraft.src.MathHelper .Floor_double(posX), net.minecraft.src.MathHelper.Floor_double(posY), net.minecraft.src.MathHelper .Floor_double(posZ)); WakeUpPlayer(true, true, false); } if (nbttagcompound.HasKey("SpawnX") && nbttagcompound.HasKey("SpawnY") && nbttagcompound .HasKey("SpawnZ")) { spawnChunk = new net.minecraft.src.ChunkCoordinates(nbttagcompound.GetInteger("SpawnX" ), nbttagcompound.GetInteger("SpawnY"), nbttagcompound.GetInteger("SpawnZ")); } }
public static net.minecraft.src.Chunk LoadChunkIntoWorldFromCompound(net.minecraft.src.World world, net.minecraft.src.NBTTagCompound nbttagcompound) { int i = nbttagcompound.GetInteger("xPos"); int j = nbttagcompound.GetInteger("zPos"); net.minecraft.src.Chunk chunk = new net.minecraft.src.Chunk(world, i, j); chunk.blocks = nbttagcompound.GetByteArray("Blocks"); chunk.data = new net.minecraft.src.NibbleArray(nbttagcompound.GetByteArray("Data" )); chunk.skylightMap = new net.minecraft.src.NibbleArray(nbttagcompound.GetByteArray ("SkyLight")); chunk.blocklightMap = new net.minecraft.src.NibbleArray(nbttagcompound.GetByteArray ("BlockLight")); chunk.heightMap = nbttagcompound.GetByteArray("HeightMap"); chunk.isTerrainPopulated = nbttagcompound.GetBoolean("TerrainPopulated"); if (!chunk.data.IsValid()) { chunk.data = new net.minecraft.src.NibbleArray(chunk.blocks.Length); } if (chunk.heightMap == null || !chunk.skylightMap.IsValid()) { chunk.heightMap = new byte[256]; chunk.skylightMap = new net.minecraft.src.NibbleArray(chunk.blocks.Length); chunk.Func_353_b(); } if (!chunk.blocklightMap.IsValid()) { chunk.blocklightMap = new net.minecraft.src.NibbleArray(chunk.blocks.Length); chunk.Func_348_a(); } net.minecraft.src.NBTTagList nbttaglist = nbttagcompound.GetTagList("Entities"); if (nbttaglist != null) { for (int k = 0; k < nbttaglist.TagCount(); k++) { net.minecraft.src.NBTTagCompound nbttagcompound1 = (net.minecraft.src.NBTTagCompound )nbttaglist.TagAt(k); net.minecraft.src.Entity entity = net.minecraft.src.EntityList.CreateEntityFromNBT (nbttagcompound1, world); chunk.hasEntities = true; if (entity != null) { chunk.AddEntity(entity); } } } net.minecraft.src.NBTTagList nbttaglist1 = nbttagcompound.GetTagList("TileEntities" ); if (nbttaglist1 != null) { for (int l = 0; l < nbttaglist1.TagCount(); l++) { net.minecraft.src.NBTTagCompound nbttagcompound2 = (net.minecraft.src.NBTTagCompound )nbttaglist1.TagAt(l); net.minecraft.src.TileEntity tileentity = net.minecraft.src.TileEntity.CreateAndLoadEntity (nbttagcompound2); if (tileentity != null) { chunk.AddTileEntity(tileentity); } } } return(chunk); }