diff options
author | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2013-06-20 13:41:44 +0200 |
---|---|---|
committer | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2013-06-20 13:41:44 +0200 |
commit | 8dd5fe507083dd390742d782325ef3754f32fd59 (patch) | |
tree | 1918df5fedd7f3ec21a72dcc85d1e898fb18801e /source | |
parent | Implemented hopper output (diff) | |
download | cuberite-8dd5fe507083dd390742d782325ef3754f32fd59.tar cuberite-8dd5fe507083dd390742d782325ef3754f32fd59.tar.gz cuberite-8dd5fe507083dd390742d782325ef3754f32fd59.tar.bz2 cuberite-8dd5fe507083dd390742d782325ef3754f32fd59.tar.lz cuberite-8dd5fe507083dd390742d782325ef3754f32fd59.tar.xz cuberite-8dd5fe507083dd390742d782325ef3754f32fd59.tar.zst cuberite-8dd5fe507083dd390742d782325ef3754f32fd59.zip |
Diffstat (limited to '')
-rw-r--r-- | source/Bindings.cpp | 18 | ||||
-rw-r--r-- | source/Bindings.h | 2 | ||||
-rw-r--r-- | source/BlockEntities/FurnaceEntity.cpp | 44 | ||||
-rw-r--r-- | source/BlockEntities/FurnaceEntity.h | 13 | ||||
-rw-r--r-- | source/BlockEntities/HopperEntity.cpp | 18 | ||||
-rw-r--r-- | source/Chunk.cpp | 7 | ||||
-rw-r--r-- | source/WorldStorage/WSSAnvil.cpp | 28 | ||||
-rw-r--r-- | source/WorldStorage/WSSAnvil.h | 4 | ||||
-rw-r--r-- | source/WorldStorage/WSSCompact.cpp | 7 |
9 files changed, 102 insertions, 39 deletions
diff --git a/source/Bindings.cpp b/source/Bindings.cpp index c863d34cb..f8c2f6c66 100644 --- a/source/Bindings.cpp +++ b/source/Bindings.cpp @@ -1,6 +1,6 @@ /* ** Lua binding: AllToLua -** Generated automatically by tolua++-1.0.92 on 06/18/13 21:08:59. +** Generated automatically by tolua++-1.0.92 on 06/20/13 13:33:05. */ #ifndef __cplusplus @@ -17118,7 +17118,9 @@ static int tolua_AllToLua_cFurnaceEntity_new00(lua_State* tolua_S) !tolua_isnumber(tolua_S,2,0,&tolua_err) || !tolua_isnumber(tolua_S,3,0,&tolua_err) || !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnoobj(tolua_S,5,&tolua_err) + !tolua_isnumber(tolua_S,5,0,&tolua_err) || + !tolua_isnumber(tolua_S,6,0,&tolua_err) || + !tolua_isnoobj(tolua_S,7,&tolua_err) ) goto tolua_lerror; else @@ -17127,8 +17129,10 @@ static int tolua_AllToLua_cFurnaceEntity_new00(lua_State* tolua_S) int a_BlockX = ((int) tolua_tonumber(tolua_S,2,0)); int a_BlockY = ((int) tolua_tonumber(tolua_S,3,0)); int a_BlockZ = ((int) tolua_tonumber(tolua_S,4,0)); + unsigned char a_BlockType = (( unsigned char) tolua_tonumber(tolua_S,5,0)); + unsigned char a_BlockMeta = (( unsigned char) tolua_tonumber(tolua_S,6,0)); { - cFurnaceEntity* tolua_ret = (cFurnaceEntity*) Mtolua_new((cFurnaceEntity)(a_BlockX,a_BlockY,a_BlockZ)); + cFurnaceEntity* tolua_ret = (cFurnaceEntity*) Mtolua_new((cFurnaceEntity)(a_BlockX,a_BlockY,a_BlockZ,a_BlockType,a_BlockMeta)); tolua_pushusertype(tolua_S,(void*)tolua_ret,"cFurnaceEntity"); } } @@ -17152,7 +17156,9 @@ static int tolua_AllToLua_cFurnaceEntity_new00_local(lua_State* tolua_S) !tolua_isnumber(tolua_S,2,0,&tolua_err) || !tolua_isnumber(tolua_S,3,0,&tolua_err) || !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnoobj(tolua_S,5,&tolua_err) + !tolua_isnumber(tolua_S,5,0,&tolua_err) || + !tolua_isnumber(tolua_S,6,0,&tolua_err) || + !tolua_isnoobj(tolua_S,7,&tolua_err) ) goto tolua_lerror; else @@ -17161,8 +17167,10 @@ static int tolua_AllToLua_cFurnaceEntity_new00_local(lua_State* tolua_S) int a_BlockX = ((int) tolua_tonumber(tolua_S,2,0)); int a_BlockY = ((int) tolua_tonumber(tolua_S,3,0)); int a_BlockZ = ((int) tolua_tonumber(tolua_S,4,0)); + unsigned char a_BlockType = (( unsigned char) tolua_tonumber(tolua_S,5,0)); + unsigned char a_BlockMeta = (( unsigned char) tolua_tonumber(tolua_S,6,0)); { - cFurnaceEntity* tolua_ret = (cFurnaceEntity*) Mtolua_new((cFurnaceEntity)(a_BlockX,a_BlockY,a_BlockZ)); + cFurnaceEntity* tolua_ret = (cFurnaceEntity*) Mtolua_new((cFurnaceEntity)(a_BlockX,a_BlockY,a_BlockZ,a_BlockType,a_BlockMeta)); tolua_pushusertype(tolua_S,(void*)tolua_ret,"cFurnaceEntity"); tolua_register_gc(tolua_S,lua_gettop(tolua_S)); } diff --git a/source/Bindings.h b/source/Bindings.h index 899ee0601..f7331b277 100644 --- a/source/Bindings.h +++ b/source/Bindings.h @@ -1,6 +1,6 @@ /* ** Lua binding: AllToLua -** Generated automatically by tolua++-1.0.92 on 06/18/13 21:09:00. +** Generated automatically by tolua++-1.0.92 on 06/20/13 13:33:06. */ /* Exported function */ diff --git a/source/BlockEntities/FurnaceEntity.cpp b/source/BlockEntities/FurnaceEntity.cpp index d4dddfd89..d90746c55 100644 --- a/source/BlockEntities/FurnaceEntity.cpp +++ b/source/BlockEntities/FurnaceEntity.cpp @@ -5,6 +5,7 @@ #include "../UI/Window.h" #include "../Player.h" #include "../Root.h" +#include "../Chunk.h" #include <json/json.h> @@ -22,8 +23,10 @@ enum -cFurnaceEntity::cFurnaceEntity(int a_BlockX, int a_BlockY, int a_BlockZ) : +cFurnaceEntity::cFurnaceEntity(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) : super(E_BLOCK_FURNACE, a_BlockX, a_BlockY, a_BlockZ, ContentsWidth, ContentsHeight, NULL), + m_BlockType(a_BlockType), + m_BlockMeta(a_BlockMeta), m_CurrentRecipe(NULL), m_IsCooking(false), m_NeedCookTime(0), @@ -41,10 +44,12 @@ cFurnaceEntity::cFurnaceEntity(int a_BlockX, int a_BlockY, int a_BlockZ) : -cFurnaceEntity::cFurnaceEntity(int a_BlockX, int a_BlockY, int a_BlockZ, cWorld * a_World) : +cFurnaceEntity::cFurnaceEntity(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, cWorld * a_World) : super(E_BLOCK_FURNACE, a_BlockX, a_BlockY, a_BlockZ, ContentsWidth, ContentsHeight, a_World), + m_BlockType(a_BlockType), + m_BlockMeta(a_BlockMeta), m_CurrentRecipe(NULL), - m_IsCooking(false), + m_IsCooking((a_World->GetBlock(a_BlockX, a_BlockY, a_BlockZ) == E_BLOCK_LIT_FURNACE)), m_NeedCookTime(0), m_TimeCooked(0), m_FuelBurnTime(0), @@ -252,7 +257,7 @@ void cFurnaceEntity::BurnNewFuel(void) // The item in the fuel slot is not suitable m_FuelBurnTime = 0; m_TimeBurned = 0; - m_IsCooking = false; + SetIsCooking(false); return; } @@ -265,7 +270,7 @@ void cFurnaceEntity::BurnNewFuel(void) // Burn one new fuel: m_FuelBurnTime = NewTime; m_TimeBurned = 0; - m_IsCooking = true; + SetIsCooking(true); if (m_Contents.GetSlot(fsFuel).m_ItemType == E_ITEM_LAVA_BUCKET) { m_Contents.SetSlot(fsFuel, cItem(E_ITEM_BUCKET)); @@ -334,12 +339,12 @@ void cFurnaceEntity::UpdateInput(void) { // This input cannot be cooked m_NeedCookTime = 0; - m_IsCooking = false; + SetIsCooking(false); } else { m_NeedCookTime = m_CurrentRecipe->CookTime; - m_IsCooking = true; + SetIsCooking(true); // Start burning new fuel if there's no flame now: if (GetFuelBurnTimeLeft() <= 0) @@ -378,7 +383,7 @@ void cFurnaceEntity::UpdateOutput(void) // Cannot cook anymore: m_TimeCooked = 0; m_NeedCookTime = 0; - m_IsCooking = false; + SetIsCooking(false); return; } @@ -386,7 +391,7 @@ void cFurnaceEntity::UpdateOutput(void) // Can cook, start cooking if not already underway: m_NeedCookTime = m_CurrentRecipe->CookTime; - m_IsCooking = true; + SetIsCooking(m_FuelBurnTime > 0); } @@ -403,13 +408,13 @@ void cFurnaceEntity::UpdateIsCooking(void) ) { // Reset everything - m_IsCooking = false; + SetIsCooking(false); m_TimeCooked = 0; m_NeedCookTime = 0; return; } - m_IsCooking = true; + SetIsCooking(true); } @@ -474,3 +479,20 @@ void cFurnaceEntity::UpdateProgressBars(void) + +void cFurnaceEntity::SetIsCooking(bool a_IsCooking) +{ + if (a_IsCooking == m_IsCooking) + { + return; + } + + m_IsCooking = a_IsCooking; + + // Light or extinguish the furnace: + m_World->FastSetBlock(m_PosX, m_PosY, m_PosZ, m_IsCooking ? E_BLOCK_LIT_FURNACE : E_BLOCK_FURNACE, m_BlockMeta); +} + + + + diff --git a/source/BlockEntities/FurnaceEntity.h b/source/BlockEntities/FurnaceEntity.h index 037ed75db..ed6a7588f 100644 --- a/source/BlockEntities/FurnaceEntity.h +++ b/source/BlockEntities/FurnaceEntity.h @@ -40,12 +40,12 @@ public: }; /// Constructor used while generating a chunk; sets m_World to NULL - cFurnaceEntity(int a_BlockX, int a_BlockY, int a_BlockZ); + cFurnaceEntity(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta); // tolua_end /// Constructor used for normal operation - cFurnaceEntity(int a_BlockX, int a_BlockY, int a_BlockZ, cWorld * a_World); + cFurnaceEntity(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, cWorld * a_World); virtual ~cFurnaceEntity(); @@ -103,6 +103,12 @@ public: protected: + /// Block type of the block currently represented by this entity (changes when furnace lights up) + BLOCKTYPE m_BlockType; + + /// Block meta of the block currently represented by this entity + NIBBLETYPE m_BlockMeta; + /// The recipe for the current input slot const cFurnaceRecipe::Recipe * m_CurrentRecipe; @@ -146,6 +152,9 @@ protected: /// Broadcasts progressbar updates, if needed void UpdateProgressBars(void); + /// Sets the m_IsCooking variable, updates the furnace block type based on the value + void SetIsCooking(bool a_IsCooking); + // cItemGrid::cListener overrides: virtual void OnSlotChanged(cItemGrid * a_ItemGrid, int a_SlotNum) override; diff --git a/source/BlockEntities/HopperEntity.cpp b/source/BlockEntities/HopperEntity.cpp index 2a3813ed2..3fadf727c 100644 --- a/source/BlockEntities/HopperEntity.cpp +++ b/source/BlockEntities/HopperEntity.cpp @@ -162,11 +162,12 @@ bool cHopperEntity::MoveItemsIn(cChunk & a_Chunk, Int64 a_CurrentTick) bool res = false;
switch (a_Chunk.GetBlock(m_RelX, m_PosY + 1, m_RelZ))
{
- case E_BLOCK_CHEST: res = MoveItemsFromChest(a_Chunk); break;
- case E_BLOCK_FURNACE: res = MoveItemsFromFurnace(a_Chunk); break;
+ case E_BLOCK_CHEST: res = MoveItemsFromChest(a_Chunk); break;
+ case E_BLOCK_FURNACE: res = MoveItemsFromFurnace(a_Chunk); break;
case E_BLOCK_DISPENSER:
- case E_BLOCK_DROPPER: res = MoveItemsFromGrid(((cDropSpenserEntity *)a_Chunk.GetBlockEntity(m_PosX, m_PosY + 1, m_PosZ))->GetContents()); break;
- case E_BLOCK_HOPPER: res = MoveItemsFromGrid(((cHopperEntity *) a_Chunk.GetBlockEntity(m_PosX, m_PosY + 1, m_PosZ))->GetContents()); break;
+ case E_BLOCK_DROPPER: res = MoveItemsFromGrid(((cDropSpenserEntity *)a_Chunk.GetBlockEntity(m_PosX, m_PosY + 1, m_PosZ))->GetContents()); break;
+ case E_BLOCK_HOPPER: res = MoveItemsFromGrid(((cHopperEntity *) a_Chunk.GetBlockEntity(m_PosX, m_PosY + 1, m_PosZ))->GetContents()); break;
+ case E_BLOCK_LIT_FURNACE: res = MoveItemsFromFurnace(a_Chunk); break;
}
// If the item has been moved, reset the last tick:
@@ -229,11 +230,12 @@ bool cHopperEntity::MoveItemsOut(cChunk & a_Chunk, Int64 a_CurrentTick) bool res = false;
switch (DestChunk->GetBlock(rx, by, rz))
{
- case E_BLOCK_CHEST: res = MoveItemsToChest(*DestChunk, bx, by, bz); break;
- case E_BLOCK_FURNACE: res = MoveItemsToFurnace(*DestChunk, bx, by, bz, Meta); break;
+ case E_BLOCK_CHEST: res = MoveItemsToChest(*DestChunk, bx, by, bz); break;
+ case E_BLOCK_FURNACE: res = MoveItemsToFurnace(*DestChunk, bx, by, bz, Meta); break;
case E_BLOCK_DISPENSER:
- case E_BLOCK_DROPPER: res = MoveItemsToGrid(((cDropSpenserEntity *)DestChunk->GetBlockEntity(bx, by, bz))->GetContents()); break;
- case E_BLOCK_HOPPER: res = MoveItemsToGrid(((cHopperEntity *) DestChunk->GetBlockEntity(bx, by, bz))->GetContents()); break;
+ case E_BLOCK_DROPPER: res = MoveItemsToGrid(((cDropSpenserEntity *)DestChunk->GetBlockEntity(bx, by, bz))->GetContents()); break;
+ case E_BLOCK_HOPPER: res = MoveItemsToGrid(((cHopperEntity *) DestChunk->GetBlockEntity(bx, by, bz))->GetContents()); break;
+ case E_BLOCK_LIT_FURNACE: res = MoveItemsToFurnace(*DestChunk, bx, by, bz, Meta); break;
}
// If the item has been moved, reset the last tick:
diff --git a/source/Chunk.cpp b/source/Chunk.cpp index 78074a7af..7816f2adc 100644 --- a/source/Chunk.cpp +++ b/source/Chunk.cpp @@ -1246,11 +1246,13 @@ void cChunk::CreateBlockEntities(void) break; } + case E_BLOCK_LIT_FURNACE: case E_BLOCK_FURNACE: { if (!HasBlockEntityAt(x + m_PosX * Width, y + m_PosY * Height, z + m_PosZ * Width)) { - m_BlockEntities.push_back(new cFurnaceEntity(x + m_PosX * Width, y + m_PosY * Height, z + m_PosZ * Width, m_World)); + NIBBLETYPE BlockMeta = cChunkDef::GetNibble(m_BlockMeta, x, y, z); + m_BlockEntities.push_back(new cFurnaceEntity(x + m_PosX * Width, y + m_PosY * Height, z + m_PosZ * Width, BlockType, BlockMeta, m_World)); } break; } @@ -1456,9 +1458,10 @@ void cChunk::SetBlock( int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE a_BlockType AddBlockEntity(new cDropperEntity( WorldPos.x, WorldPos.y, WorldPos.z, m_World)); break; } + case E_BLOCK_LIT_FURNACE: case E_BLOCK_FURNACE: { - AddBlockEntity(new cFurnaceEntity( WorldPos.x, WorldPos.y, WorldPos.z, m_World)); + AddBlockEntity(new cFurnaceEntity( WorldPos.x, WorldPos.y, WorldPos.z, a_BlockType, a_BlockMeta, m_World)); break; } case E_BLOCK_HOPPER: diff --git a/source/WorldStorage/WSSAnvil.cpp b/source/WorldStorage/WSSAnvil.cpp index f0b0113da..8f23cc773 100644 --- a/source/WorldStorage/WSSAnvil.cpp +++ b/source/WorldStorage/WSSAnvil.cpp @@ -331,7 +331,7 @@ bool cWSSAnvil::LoadChunkFromNBT(const cChunkCoords & a_Chunk, const cParsedNBT cEntityList Entities; cBlockEntityList BlockEntities; LoadEntitiesFromNBT (Entities, a_NBT, a_NBT.FindChildByName(Level, "Entities")); - LoadBlockEntitiesFromNBT(BlockEntities, a_NBT, a_NBT.FindChildByName(Level, "TileEntities")); + LoadBlockEntitiesFromNBT(BlockEntities, a_NBT, a_NBT.FindChildByName(Level, "TileEntities"), BlockTypes, MetaData); bool IsLightValid = (a_NBT.FindChildByName(Level, "MCSIsLightValid") > 0); @@ -539,7 +539,7 @@ void cWSSAnvil::LoadEntitiesFromNBT(cEntityList & a_Entities, const cParsedNBT & -void cWSSAnvil::LoadBlockEntitiesFromNBT(cBlockEntityList & a_BlockEntities, const cParsedNBT & a_NBT, int a_TagIdx) +void cWSSAnvil::LoadBlockEntitiesFromNBT(cBlockEntityList & a_BlockEntities, const cParsedNBT & a_NBT, int a_TagIdx, BLOCKTYPE * a_BlockTypes, NIBBLETYPE * a_BlockMetas) { if ((a_TagIdx < 0) || (a_NBT.GetType(a_TagIdx) != TAG_List)) { @@ -567,7 +567,7 @@ void cWSSAnvil::LoadBlockEntitiesFromNBT(cBlockEntityList & a_BlockEntities, con } else if (strncmp(a_NBT.GetData(sID), "Furnace", a_NBT.GetDataLength(sID)) == 0) { - LoadFurnaceFromNBT(a_BlockEntities, a_NBT, Child); + LoadFurnaceFromNBT(a_BlockEntities, a_NBT, Child, a_BlockTypes, a_BlockMetas); } else if (strncmp(a_NBT.GetData(sID), "Hopper", a_NBT.GetDataLength(sID)) == 0) { @@ -737,7 +737,7 @@ void cWSSAnvil::LoadDropperFromNBT(cBlockEntityList & a_BlockEntities, const cPa -void cWSSAnvil::LoadFurnaceFromNBT(cBlockEntityList & a_BlockEntities, const cParsedNBT & a_NBT, int a_TagIdx) +void cWSSAnvil::LoadFurnaceFromNBT(cBlockEntityList & a_BlockEntities, const cParsedNBT & a_NBT, int a_TagIdx, BLOCKTYPE * a_BlockTypes, NIBBLETYPE * a_BlockMetas) { ASSERT(a_NBT.GetType(a_TagIdx) == TAG_Compound); int x, y, z; @@ -750,7 +750,19 @@ void cWSSAnvil::LoadFurnaceFromNBT(cBlockEntityList & a_BlockEntities, const cPa { return; // Make it an empty furnace - the chunk loader will provide an empty cFurnaceEntity for this } - std::auto_ptr<cFurnaceEntity> Furnace(new cFurnaceEntity(x, y, z, m_World)); + + // Convert coords to relative: + int RelX = x; + int RelZ = z; + int ChunkX, ChunkZ; + cChunkDef::AbsoluteToRelative(RelX, y, RelZ, ChunkX, ChunkZ); + + // Create the furnace entity, with proper BlockType and BlockMeta info: + BLOCKTYPE BlockType = cChunkDef::GetBlock(a_BlockTypes, RelX, y, RelZ); + NIBBLETYPE BlockMeta = cChunkDef::GetNibble(a_BlockMetas, RelX, y, RelZ); + std::auto_ptr<cFurnaceEntity> Furnace(new cFurnaceEntity(x, y, z, BlockType, BlockMeta, m_World)); + + // Load slots: for (int Child = a_NBT.GetFirstChild(Items); Child != -1; Child = a_NBT.GetNextSibling(Child)) { int Slot = a_NBT.FindChildByName(Child, "Slot"); @@ -764,6 +776,8 @@ void cWSSAnvil::LoadFurnaceFromNBT(cBlockEntityList & a_BlockEntities, const cPa Furnace->SetSlot(a_NBT.GetByte(Slot), Item); } } // for itr - ItemDefs[] + + // Load burn time: int BurnTime = a_NBT.FindChildByName(a_TagIdx, "BurnTime"); if (BurnTime >= 0) { @@ -771,6 +785,8 @@ void cWSSAnvil::LoadFurnaceFromNBT(cBlockEntityList & a_BlockEntities, const cPa // Anvil doesn't store the time that the fuel can burn. We simply "reset" the current value to be the 100% Furnace->SetBurnTimes(bt, 0); } + + // Load cook time: int CookTime = a_NBT.FindChildByName(a_TagIdx, "CookTime"); if (CookTime >= 0) { @@ -778,6 +794,8 @@ void cWSSAnvil::LoadFurnaceFromNBT(cBlockEntityList & a_BlockEntities, const cPa // 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); } + + // Restart cooking: Furnace->ContinueCooking(); a_BlockEntities.push_back(Furnace.release()); } diff --git a/source/WorldStorage/WSSAnvil.h b/source/WorldStorage/WSSAnvil.h index 2dc17d2e9..bd2108b30 100644 --- a/source/WorldStorage/WSSAnvil.h +++ b/source/WorldStorage/WSSAnvil.h @@ -116,7 +116,7 @@ protected: void LoadEntitiesFromNBT(cEntityList & a_Entitites, const cParsedNBT & a_NBT, int a_Tag); /// Loads the chunk's BlockEntities from NBT data (a_Tag is the Level\\TileEntities list tag; may be -1) - void LoadBlockEntitiesFromNBT(cBlockEntityList & a_BlockEntitites, const cParsedNBT & a_NBT, int a_Tag); + void LoadBlockEntitiesFromNBT(cBlockEntityList & a_BlockEntitites, const cParsedNBT & a_NBT, int a_Tag, BLOCKTYPE * a_BlockTypes, NIBBLETYPE * a_BlockMetas); /// Loads a cItem contents from the specified NBT tag; returns true if successful. Doesn't load the Slot tag bool LoadItemFromNBT(cItem & a_Item, const cParsedNBT & a_NBT, int a_TagIdx); @@ -130,7 +130,7 @@ protected: void LoadChestFromNBT (cBlockEntityList & a_BlockEntities, const cParsedNBT & a_NBT, int a_TagIdx); void LoadDispenserFromNBT (cBlockEntityList & a_BlockEntities, const cParsedNBT & a_NBT, int a_TagIdx); void LoadDropperFromNBT (cBlockEntityList & a_BlockEntities, const cParsedNBT & a_NBT, int a_TagIdx); - void LoadFurnaceFromNBT (cBlockEntityList & a_BlockEntities, const cParsedNBT & a_NBT, int a_TagIdx); + void LoadFurnaceFromNBT (cBlockEntityList & a_BlockEntities, const cParsedNBT & a_NBT, int a_TagIdx, BLOCKTYPE * a_BlockTypes, NIBBLETYPE * a_BlockMetas); void LoadHopperFromNBT (cBlockEntityList & a_BlockEntities, const cParsedNBT & a_NBT, int a_TagIdx); void LoadJukeboxFromNBT (cBlockEntityList & a_BlockEntities, const cParsedNBT & a_NBT, int a_TagIdx); void LoadNoteFromNBT (cBlockEntityList & a_BlockEntities, const cParsedNBT & a_NBT, int a_TagIdx); diff --git a/source/WorldStorage/WSSCompact.cpp b/source/WorldStorage/WSSCompact.cpp index 973cb22e5..694f3ed1d 100644 --- a/source/WorldStorage/WSSCompact.cpp +++ b/source/WorldStorage/WSSCompact.cpp @@ -310,15 +310,16 @@ void cWSSCompact::LoadEntitiesFromJson(Json::Value & a_Value, cEntityList & a_En for( Json::Value::iterator itr = AllFurnaces.begin(); itr != AllFurnaces.end(); ++itr ) { Json::Value & Furnace = *itr; - cFurnaceEntity * FurnaceEntity = new cFurnaceEntity(0,0,0, a_World); - if( !FurnaceEntity->LoadFromJson( Furnace ) ) + // TODO: The block type and meta aren't correct, there's no way to get them here + cFurnaceEntity * FurnaceEntity = new cFurnaceEntity(0, 0, 0, E_BLOCK_FURNACE, 0, a_World); + if (!FurnaceEntity->LoadFromJson(Furnace)) { LOGERROR("ERROR READING FURNACE FROM JSON!" ); delete FurnaceEntity; } else { - a_BlockEntities.push_back( FurnaceEntity ); + a_BlockEntities.push_back(FurnaceEntity); } } // for itr - AllFurnaces[] } |