summaryrefslogtreecommitdiffstats
path: root/src/WorldStorage
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@outlook.com>2020-08-28 22:40:40 +0200
committerTiger Wang <ziwei.tiger@outlook.com>2020-08-28 22:40:40 +0200
commitbe121f9e80290fb3ad126a6f063784161e516fd0 (patch)
tree30c4fbf7db90e64c7df10e9b67882601dee4b355 /src/WorldStorage
parentWorldStorage: Removed unused callback parameters (diff)
downloadcuberite-be121f9e80290fb3ad126a6f063784161e516fd0.tar
cuberite-be121f9e80290fb3ad126a6f063784161e516fd0.tar.gz
cuberite-be121f9e80290fb3ad126a6f063784161e516fd0.tar.bz2
cuberite-be121f9e80290fb3ad126a6f063784161e516fd0.tar.lz
cuberite-be121f9e80290fb3ad126a6f063784161e516fd0.tar.xz
cuberite-be121f9e80290fb3ad126a6f063784161e516fd0.tar.zst
cuberite-be121f9e80290fb3ad126a6f063784161e516fd0.zip
Diffstat (limited to '')
-rw-r--r--src/WorldStorage/NBTChunkSerializer.cpp14
-rwxr-xr-xsrc/WorldStorage/WSSAnvil.cpp20
-rwxr-xr-xsrc/WorldStorage/WSSAnvil.h1
3 files changed, 31 insertions, 4 deletions
diff --git a/src/WorldStorage/NBTChunkSerializer.cpp b/src/WorldStorage/NBTChunkSerializer.cpp
index 19936add2..51ca81663 100644
--- a/src/WorldStorage/NBTChunkSerializer.cpp
+++ b/src/WorldStorage/NBTChunkSerializer.cpp
@@ -18,6 +18,7 @@
#include "../BlockEntities/CommandBlockEntity.h"
#include "../BlockEntities/DispenserEntity.h"
#include "../BlockEntities/DropperEntity.h"
+#include "../BlockEntities/EnderChestEntity.h"
#include "../BlockEntities/FurnaceEntity.h"
#include "../BlockEntities/HopperEntity.h"
#include "../BlockEntities/JukeboxEntity.h"
@@ -214,7 +215,7 @@ public:
case E_BLOCK_COMMAND_BLOCK: AddCommandBlockEntity(static_cast<cCommandBlockEntity *>(a_Entity)); break;
case E_BLOCK_DISPENSER: AddDispenserEntity (static_cast<cDispenserEntity *> (a_Entity)); break;
case E_BLOCK_DROPPER: AddDropperEntity (static_cast<cDropperEntity *> (a_Entity)); break;
- case E_BLOCK_ENDER_CHEST: /* No data to be saved */ break;
+ case E_BLOCK_ENDER_CHEST: AddEnderchestEntity (static_cast<cEnderChestEntity *> (a_Entity)); break;
case E_BLOCK_FLOWER_POT: AddFlowerPotEntity (static_cast<cFlowerPotEntity *> (a_Entity)); break;
case E_BLOCK_FURNACE: AddFurnaceEntity (static_cast<cFurnaceEntity *> (a_Entity)); break;
case E_BLOCK_HEAD: AddMobHeadEntity (static_cast<cMobHeadEntity *> (a_Entity)); break;
@@ -460,6 +461,17 @@ public:
+ void AddEnderchestEntity(cEnderChestEntity * a_Entity)
+ {
+ mWriter.BeginCompound("");
+ AddBasicTileEntity(a_Entity, "EnderChest");
+ mWriter.EndCompound();
+ }
+
+
+
+
+
void AddFurnaceEntity(cFurnaceEntity * a_Furnace)
{
mWriter.BeginCompound("");
diff --git a/src/WorldStorage/WSSAnvil.cpp b/src/WorldStorage/WSSAnvil.cpp
index 5e4d48eeb..ebeb198b1 100755
--- a/src/WorldStorage/WSSAnvil.cpp
+++ b/src/WorldStorage/WSSAnvil.cpp
@@ -25,6 +25,7 @@
#include "../BlockEntities/CommandBlockEntity.h"
#include "../BlockEntities/DispenserEntity.h"
#include "../BlockEntities/DropperEntity.h"
+#include "../BlockEntities/EnderChestEntity.h"
#include "../BlockEntities/FurnaceEntity.h"
#include "../BlockEntities/HopperEntity.h"
#include "../BlockEntities/JukeboxEntity.h"
@@ -645,6 +646,7 @@ OwnedBlockEntity cWSSAnvil::LoadBlockEntityFromNBT(const cParsedNBT & a_NBT, int
case E_BLOCK_COMMAND_BLOCK: return LoadCommandBlockFromNBT(a_NBT, a_Tag, a_BlockType, a_BlockMeta, a_Pos);
case E_BLOCK_DISPENSER: return LoadDispenserFromNBT (a_NBT, a_Tag, a_BlockType, a_BlockMeta, a_Pos);
case E_BLOCK_DROPPER: return LoadDropperFromNBT (a_NBT, a_Tag, a_BlockType, a_BlockMeta, a_Pos);
+ case E_BLOCK_ENDER_CHEST: return LoadEnderChestFromNBT (a_NBT, a_Tag, a_BlockType, a_BlockMeta, a_Pos);
case E_BLOCK_FLOWER_POT: return LoadFlowerPotFromNBT (a_NBT, a_Tag, a_BlockType, a_BlockMeta, a_Pos);
case E_BLOCK_FURNACE: return LoadFurnaceFromNBT (a_NBT, a_Tag, a_BlockType, a_BlockMeta, a_Pos);
case E_BLOCK_HEAD: return LoadMobHeadFromNBT (a_NBT, a_Tag, a_BlockType, a_BlockMeta, a_Pos);
@@ -657,9 +659,6 @@ OwnedBlockEntity cWSSAnvil::LoadBlockEntityFromNBT(const cParsedNBT & a_NBT, int
case E_BLOCK_TRAPPED_CHEST: return LoadChestFromNBT (a_NBT, a_Tag, a_BlockType, a_BlockMeta, a_Pos);
case E_BLOCK_WALLSIGN: return LoadSignFromNBT (a_NBT, a_Tag, a_BlockType, a_BlockMeta, a_Pos);
- // Blocktypes that have block entities but don't load their contents from disk:
- case E_BLOCK_ENDER_CHEST: return nullptr;
-
default:
{
// All the other blocktypes should have no entities assigned to them. Report an error:
@@ -1125,6 +1124,21 @@ OwnedBlockEntity cWSSAnvil::LoadDropperFromNBT(const cParsedNBT & a_NBT, int a_T
+OwnedBlockEntity cWSSAnvil::LoadEnderChestFromNBT(const cParsedNBT & a_NBT, int a_TagIdx, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos)
+{
+ // Check if the data has a proper type:
+ static const AStringVector expectedTypes({ "EnderChest", "minecraft:ender_chest" });
+ if (!CheckBlockEntityType(a_NBT, a_TagIdx, expectedTypes, a_Pos))
+ {
+ return nullptr;
+ }
+ return std::make_unique<cEnderChestEntity>(a_BlockType, a_BlockMeta, a_Pos, m_World);
+}
+
+
+
+
+
OwnedBlockEntity cWSSAnvil::LoadFlowerPotFromNBT(const cParsedNBT & a_NBT, int a_TagIdx, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos)
{
// Check if the data has a proper type:
diff --git a/src/WorldStorage/WSSAnvil.h b/src/WorldStorage/WSSAnvil.h
index 8c3fda2d7..7684fd81b 100755
--- a/src/WorldStorage/WSSAnvil.h
+++ b/src/WorldStorage/WSSAnvil.h
@@ -163,6 +163,7 @@ protected:
OwnedBlockEntity LoadCommandBlockFromNBT(const cParsedNBT & a_NBT, int a_TagIdx, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos);
OwnedBlockEntity LoadDispenserFromNBT (const cParsedNBT & a_NBT, int a_TagIdx, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos);
OwnedBlockEntity LoadDropperFromNBT (const cParsedNBT & a_NBT, int a_TagIdx, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos);
+ OwnedBlockEntity LoadEnderChestFromNBT (const cParsedNBT & a_NBT, int a_TagIdx, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos);
OwnedBlockEntity LoadFlowerPotFromNBT (const cParsedNBT & a_NBT, int a_TagIdx, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos);
OwnedBlockEntity LoadFurnaceFromNBT (const cParsedNBT & a_NBT, int a_TagIdx, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos);
OwnedBlockEntity LoadHopperFromNBT (const cParsedNBT & a_NBT, int a_TagIdx, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos);