diff options
author | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2013-06-16 22:24:07 +0200 |
---|---|---|
committer | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2013-06-16 22:24:07 +0200 |
commit | 97eda34a9437abe732cf6b60711828bbe4f0cb2e (patch) | |
tree | f06f2a5bb2ad7efd0d09d9cba0b2f8fe586a53e0 /source/WorldStorage | |
parent | Core: fixed a warning message when using the /item command (diff) | |
download | cuberite-97eda34a9437abe732cf6b60711828bbe4f0cb2e.tar cuberite-97eda34a9437abe732cf6b60711828bbe4f0cb2e.tar.gz cuberite-97eda34a9437abe732cf6b60711828bbe4f0cb2e.tar.bz2 cuberite-97eda34a9437abe732cf6b60711828bbe4f0cb2e.tar.lz cuberite-97eda34a9437abe732cf6b60711828bbe4f0cb2e.tar.xz cuberite-97eda34a9437abe732cf6b60711828bbe4f0cb2e.tar.zst cuberite-97eda34a9437abe732cf6b60711828bbe4f0cb2e.zip |
Diffstat (limited to 'source/WorldStorage')
-rw-r--r-- | source/WorldStorage/NBTChunkSerializer.cpp | 14 | ||||
-rw-r--r-- | source/WorldStorage/NBTChunkSerializer.h | 2 | ||||
-rw-r--r-- | source/WorldStorage/WSSAnvil.cpp | 6 |
3 files changed, 10 insertions, 12 deletions
diff --git a/source/WorldStorage/NBTChunkSerializer.cpp b/source/WorldStorage/NBTChunkSerializer.cpp index 9c4f8a2ae..d391325c9 100644 --- a/source/WorldStorage/NBTChunkSerializer.cpp +++ b/source/WorldStorage/NBTChunkSerializer.cpp @@ -161,14 +161,12 @@ void cNBTChunkSerializer::AddDropperEntity(cDropperEntity * a_Entity) void cNBTChunkSerializer::AddFurnaceEntity(cFurnaceEntity * a_Furnace)
{
m_Writer.BeginCompound("");
- AddBasicTileEntity(a_Furnace, "Furnace");
- m_Writer.BeginList("Items", TAG_Compound);
- AddItem(*(a_Furnace->GetSlot(0)), 0);
- AddItem(*(a_Furnace->GetSlot(1)), 1);
- AddItem(*(a_Furnace->GetSlot(2)), 2);
- m_Writer.EndList();
- m_Writer.AddShort("BurnTime", (Int16)(a_Furnace->GetTimeToBurn() / 50.0));
- m_Writer.AddShort("CookTime", (Int16)(a_Furnace->GetTimeCooked() / 50.0));
+ AddBasicTileEntity(a_Furnace, "Furnace");
+ m_Writer.BeginList("Items", TAG_Compound);
+ AddItemGrid(a_Furnace->GetContents());
+ m_Writer.EndList();
+ m_Writer.AddShort("BurnTime", a_Furnace->GetFuelBurnTimeLeft());
+ m_Writer.AddShort("CookTime", a_Furnace->GetTimeCooked());
m_Writer.EndCompound();
}
diff --git a/source/WorldStorage/NBTChunkSerializer.h b/source/WorldStorage/NBTChunkSerializer.h index 14c31be01..c71286797 100644 --- a/source/WorldStorage/NBTChunkSerializer.h +++ b/source/WorldStorage/NBTChunkSerializer.h @@ -75,7 +75,7 @@ protected: /// Writes an item into the writer, if slot >= 0, adds the Slot tag. The compound is named as requested.
void AddItem(const cItem & a_Item, int a_Slot, const AString & a_CompoundName = "");
- /// Writes an item grid into the writer; begins the stored slot numbers with a_BeginSlotNum
+ /// Writes an item grid into the writer; begins the stored slot numbers with a_BeginSlotNum. Note that it doesn't begin nor end the list tag
void AddItemGrid(const cItemGrid & a_Grid, int a_BeginSlotNum = 0);
// Block entities:
diff --git a/source/WorldStorage/WSSAnvil.cpp b/source/WorldStorage/WSSAnvil.cpp index 43e6dce05..f0b0113da 100644 --- a/source/WorldStorage/WSSAnvil.cpp +++ b/source/WorldStorage/WSSAnvil.cpp @@ -769,14 +769,14 @@ void cWSSAnvil::LoadFurnaceFromNBT(cBlockEntityList & a_BlockEntities, const cPa { Int16 bt = a_NBT.GetShort(BurnTime); // Anvil doesn't store the time that the fuel can burn. We simply "reset" the current value to be the 100% - Furnace->SetBurnTimes((float)(bt * 50.0), (float)(bt * 50.0)); + Furnace->SetBurnTimes(bt, 0); } int CookTime = a_NBT.FindChildByName(a_TagIdx, "CookTime"); if (CookTime >= 0) { Int16 ct = a_NBT.GetShort(CookTime); - // Anvil doesn't store the time that an item takes to cook. We simply use the default - 10 seconds - Furnace->SetCookTimes(10000.0, (float)(ct * 50.0)); + // Anvil doesn't store the time that an item takes to cook. We simply use the default - 10 seconds (200 ticks) + Furnace->SetCookTimes(200, ct); } Furnace->ContinueCooking(); a_BlockEntities.push_back(Furnace.release()); |