From 243083e01a4b6b496ca4c0ed0a4a33499cd41936 Mon Sep 17 00:00:00 2001 From: 12xx12 <44411062+12xx12@users.noreply.github.com> Date: Mon, 15 Mar 2021 03:47:55 +0100 Subject: Adding basic Banner functionality (#4806) + Added item and block for banners Co-authored-by: 12xx12 <12xx12100@gmail.com> Co-authored-by: Tiger Wang --- src/WorldStorage/NBTChunkSerializer.cpp | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'src/WorldStorage/NBTChunkSerializer.cpp') diff --git a/src/WorldStorage/NBTChunkSerializer.cpp b/src/WorldStorage/NBTChunkSerializer.cpp index 30e2a7815..7ce85616c 100644 --- a/src/WorldStorage/NBTChunkSerializer.cpp +++ b/src/WorldStorage/NBTChunkSerializer.cpp @@ -12,6 +12,7 @@ #include "../UUID.h" #include "FastNBT.h" +#include "../BlockEntities/BannerEntity.h" #include "../BlockEntities/BeaconEntity.h" #include "../BlockEntities/BedEntity.h" #include "../BlockEntities/BrewingstandEntity.h" @@ -205,6 +206,11 @@ public: // Add tile-entity into NBT: switch (a_Entity->GetBlockType()) { + // Banners: + case E_BLOCK_STANDING_BANNER: + case E_BLOCK_WALL_BANNER: AddBannerEntity (static_cast (a_Entity)); break; + + // Others: case E_BLOCK_BEACON: AddBeaconEntity (static_cast (a_Entity)); break; case E_BLOCK_BED: AddBedEntity (static_cast (a_Entity)); break; case E_BLOCK_BREWING_STAND: AddBrewingstandEntity (static_cast (a_Entity)); break; @@ -226,7 +232,6 @@ public: case E_BLOCK_SIGN_POST: AddSignEntity (static_cast (a_Entity)); break; case E_BLOCK_TRAPPED_CHEST: AddChestEntity (static_cast (a_Entity), a_Entity->GetBlockType()); break; case E_BLOCK_WALLSIGN: AddSignEntity (static_cast (a_Entity)); break; - default: { ASSERT(!"Unhandled block entity saved into Anvil"); @@ -366,6 +371,18 @@ public: + void AddBannerEntity(cBannerEntity * a_Entity) + { + mWriter.BeginCompound(""); + AddBasicTileEntity(a_Entity,"Banner"); + mWriter.AddInt("Base", static_cast(a_Entity->GetBaseColor())); + mWriter.EndCompound(); + } + + + + + void AddBeaconEntity(cBeaconEntity * a_Entity) { mWriter.BeginCompound(""); -- cgit v1.2.3