diff options
author | Mattes D <github@xoft.cz> | 2020-04-03 08:57:01 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-03 08:57:01 +0200 |
commit | 01b8ed5295875262a91b60af878bf2a18c1b7aae (patch) | |
tree | 52171974791a7529a3a69f9fe20d906158765954 /src/WorldStorage | |
parent | Update Core (diff) | |
download | cuberite-01b8ed5295875262a91b60af878bf2a18c1b7aae.tar cuberite-01b8ed5295875262a91b60af878bf2a18c1b7aae.tar.gz cuberite-01b8ed5295875262a91b60af878bf2a18c1b7aae.tar.bz2 cuberite-01b8ed5295875262a91b60af878bf2a18c1b7aae.tar.lz cuberite-01b8ed5295875262a91b60af878bf2a18c1b7aae.tar.xz cuberite-01b8ed5295875262a91b60af878bf2a18c1b7aae.tar.zst cuberite-01b8ed5295875262a91b60af878bf2a18c1b7aae.zip |
Diffstat (limited to 'src/WorldStorage')
-rw-r--r-- | src/WorldStorage/FireworksSerializer.cpp | 5 | ||||
-rw-r--r-- | src/WorldStorage/FireworksSerializer.h | 10 | ||||
-rw-r--r-- | src/WorldStorage/NBTChunkSerializer.cpp | 2 | ||||
-rwxr-xr-x | src/WorldStorage/WSSAnvil.cpp | 11 | ||||
-rwxr-xr-x | src/WorldStorage/WSSAnvil.h | 3 |
5 files changed, 20 insertions, 11 deletions
diff --git a/src/WorldStorage/FireworksSerializer.cpp b/src/WorldStorage/FireworksSerializer.cpp index 891a67e62..7cf3c3eea 100644 --- a/src/WorldStorage/FireworksSerializer.cpp +++ b/src/WorldStorage/FireworksSerializer.cpp @@ -2,12 +2,13 @@ #include "Globals.h" #include "FireworksSerializer.h" #include "../WorldStorage/FastNBT.h" +#include "../BlockType.h" -void cFireworkItem::WriteToNBTCompound(const cFireworkItem & a_FireworkItem, cFastNBTWriter & a_Writer, const ENUM_ITEM_ID a_Type) +void cFireworkItem::WriteToNBTCompound(const cFireworkItem & a_FireworkItem, cFastNBTWriter & a_Writer, const ENUM_ITEM_TYPE a_Type) { switch (a_Type) { @@ -58,7 +59,7 @@ void cFireworkItem::WriteToNBTCompound(const cFireworkItem & a_FireworkItem, cFa -void cFireworkItem::ParseFromNBT(cFireworkItem & a_FireworkItem, const cParsedNBT & a_NBT, int a_TagIdx, const ENUM_ITEM_ID a_Type) +void cFireworkItem::ParseFromNBT(cFireworkItem & a_FireworkItem, const cParsedNBT & a_NBT, int a_TagIdx, const ENUM_ITEM_TYPE a_Type) { if (a_TagIdx < 0) { diff --git a/src/WorldStorage/FireworksSerializer.h b/src/WorldStorage/FireworksSerializer.h index 9a24edadd..32264d2f3 100644 --- a/src/WorldStorage/FireworksSerializer.h +++ b/src/WorldStorage/FireworksSerializer.h @@ -10,6 +10,12 @@ #pragma once +#include "../BlockType.h" + + + + + class cFastNBTWriter; class cParsedNBT; @@ -62,10 +68,10 @@ public: } /** Writes firework NBT data to a Writer object */ - static void WriteToNBTCompound(const cFireworkItem & a_FireworkItem, cFastNBTWriter & a_Writer, const ENUM_ITEM_ID a_Type); + static void WriteToNBTCompound(const cFireworkItem & a_FireworkItem, cFastNBTWriter & a_Writer, const ENUM_ITEM_TYPE a_Type); /** Reads NBT data from a NBT object and populates a FireworkItem with it */ - static void ParseFromNBT(cFireworkItem & a_FireworkItem, const cParsedNBT & a_NBT, int a_TagIdx, const ENUM_ITEM_ID a_Type); + static void ParseFromNBT(cFireworkItem & a_FireworkItem, const cParsedNBT & a_NBT, int a_TagIdx, const ENUM_ITEM_TYPE a_Type); /** Converts the firework's vector of colours into a string of values separated by a semicolon */ static AString ColoursToString(const cFireworkItem & a_FireworkItem); diff --git a/src/WorldStorage/NBTChunkSerializer.cpp b/src/WorldStorage/NBTChunkSerializer.cpp index 0a18cb7b3..014ee2c27 100644 --- a/src/WorldStorage/NBTChunkSerializer.cpp +++ b/src/WorldStorage/NBTChunkSerializer.cpp @@ -322,7 +322,7 @@ public: if ((a_Item.m_ItemType == E_ITEM_FIREWORK_ROCKET) || (a_Item.m_ItemType == E_ITEM_FIREWORK_STAR)) { - cFireworkItem::WriteToNBTCompound(a_Item.m_FireworkItem, mWriter, static_cast<ENUM_ITEM_ID>(a_Item.m_ItemType)); + cFireworkItem::WriteToNBTCompound(a_Item.m_FireworkItem, mWriter, static_cast<ENUM_ITEM_TYPE>(a_Item.m_ItemType)); } if (!a_Item.m_Enchantments.IsEmpty()) diff --git a/src/WorldStorage/WSSAnvil.cpp b/src/WorldStorage/WSSAnvil.cpp index 4712e6ab1..0480680dd 100755 --- a/src/WorldStorage/WSSAnvil.cpp +++ b/src/WorldStorage/WSSAnvil.cpp @@ -15,6 +15,7 @@ #include "../StringCompression.h" #include "../SetChunkData.h" #include "../Root.h" +#include "../BlockType.h" #include "../BlockEntities/BeaconEntity.h" #include "../BlockEntities/BedEntity.h" @@ -363,10 +364,10 @@ bool cWSSAnvil::LoadChunkFromNBT(const cChunkCoords & a_Chunk, const cParsedNBT cChunkDef::BlockNibbles BlockLight; cChunkDef::BlockNibbles SkyLight; - memset(BlockTypes, E_BLOCK_AIR, sizeof(BlockTypes)); - memset(MetaData, 0, sizeof(MetaData)); - memset(SkyLight, 0xff, sizeof(SkyLight)); // By default, data not present in the NBT means air, which means full skylight - memset(BlockLight, 0x00, sizeof(BlockLight)); + memset(BlockTypes, 0, sizeof(BlockTypes)); + memset(MetaData, 0, sizeof(MetaData)); + memset(SkyLight, 0xff, sizeof(SkyLight)); // By default, data not present in the NBT means air, which means full skylight + memset(BlockLight, 0x00, sizeof(BlockLight)); // Load the blockdata, blocklight and skylight: int Level = a_NBT.FindChildByName(0, "Level"); @@ -779,7 +780,7 @@ bool cWSSAnvil::LoadItemFromNBT(cItem & a_Item, const cParsedNBT & a_NBT, int a_ int FireworksTag = a_NBT.FindChildByName(TagTag, ((a_Item.m_ItemType == E_ITEM_FIREWORK_STAR) ? "Explosion" : "Fireworks")); if (FireworksTag > 0) { - cFireworkItem::ParseFromNBT(a_Item.m_FireworkItem, a_NBT, FireworksTag, static_cast<ENUM_ITEM_ID>(a_Item.m_ItemType)); + cFireworkItem::ParseFromNBT(a_Item.m_FireworkItem, a_NBT, FireworksTag, static_cast<ENUM_ITEM_TYPE>(a_Item.m_ItemType)); } return true; diff --git a/src/WorldStorage/WSSAnvil.h b/src/WorldStorage/WSSAnvil.h index 166230568..96945363e 100755 --- a/src/WorldStorage/WSSAnvil.h +++ b/src/WorldStorage/WSSAnvil.h @@ -15,7 +15,8 @@ -// fwd: ItemGrid.h +// fwd: +class cItem; class cItemGrid; class cMonster; class cProjectileEntity; |