summaryrefslogtreecommitdiffstats
path: root/src/WorldStorage
diff options
context:
space:
mode:
author12xx12 <44411062+12xx12@users.noreply.github.com>2020-10-29 21:47:20 +0100
committerGitHub <noreply@github.com>2020-10-29 21:47:20 +0100
commit961d5eb420182add0b6cb4d92f260b885563389c (patch)
treec63fb7b3905d2ae59c539cca44845984128c27bb /src/WorldStorage
parentRemove BLOCKENTITY_PROTODEF (diff)
downloadcuberite-961d5eb420182add0b6cb4d92f260b885563389c.tar
cuberite-961d5eb420182add0b6cb4d92f260b885563389c.tar.gz
cuberite-961d5eb420182add0b6cb4d92f260b885563389c.tar.bz2
cuberite-961d5eb420182add0b6cb4d92f260b885563389c.tar.lz
cuberite-961d5eb420182add0b6cb4d92f260b885563389c.tar.xz
cuberite-961d5eb420182add0b6cb4d92f260b885563389c.tar.zst
cuberite-961d5eb420182add0b6cb4d92f260b885563389c.zip
Diffstat (limited to 'src/WorldStorage')
-rw-r--r--src/WorldStorage/NBTChunkSerializer.cpp10
-rwxr-xr-xsrc/WorldStorage/WSSAnvil.cpp33
2 files changed, 42 insertions, 1 deletions
diff --git a/src/WorldStorage/NBTChunkSerializer.cpp b/src/WorldStorage/NBTChunkSerializer.cpp
index f78f7029f..d159f6e49 100644
--- a/src/WorldStorage/NBTChunkSerializer.cpp
+++ b/src/WorldStorage/NBTChunkSerializer.cpp
@@ -683,6 +683,16 @@ public:
{
mWriter.BeginCompound("");
AddBasicEntity(a_EnderCrystal, "EnderCrystal");
+ mWriter.AddByte("ShowBottom", a_EnderCrystal->ShowsBottom() ? 1 : 0);
+ if (a_EnderCrystal->DisplaysBeam())
+ {
+ mWriter.BeginCompound("BeamTarget");
+ const auto & BeamTarget = a_EnderCrystal->GetBeamTarget();
+ mWriter.AddInt("X", BeamTarget.x);
+ mWriter.AddInt("Y", BeamTarget.y);
+ mWriter.AddInt("Z", BeamTarget.z);
+ mWriter.EndCompound();
+ }
mWriter.EndCompound();
}
diff --git a/src/WorldStorage/WSSAnvil.cpp b/src/WorldStorage/WSSAnvil.cpp
index 03e60bb26..c7b4c7e1f 100755
--- a/src/WorldStorage/WSSAnvil.cpp
+++ b/src/WorldStorage/WSSAnvil.cpp
@@ -1718,11 +1718,42 @@ void cWSSAnvil::LoadBoatFromNBT(cEntityList & a_Entities, const cParsedNBT & a_N
void cWSSAnvil::LoadEnderCrystalFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx)
{
- auto EnderCrystal = std::make_unique<cEnderCrystal>(Vector3d());
+ auto EnderCrystal = std::make_unique<cEnderCrystal>(Vector3d(), false);
if (!LoadEntityBaseFromNBT(*EnderCrystal.get(), a_NBT, a_TagIdx))
{
return;
}
+
+ int CurrentLine = a_NBT.FindChildByName(a_TagIdx, "BeamTarget");
+ if (CurrentLine > 0)
+ {
+ EnderCrystal->SetDisplayBeam(true);
+ if (a_NBT.GetType(CurrentLine) == TAG_Compound)
+ {
+ Vector3d BeamTarget = {0, 0, 0};
+ int CoordinateLine = a_NBT.FindChildByName(CurrentLine, "X");
+ if (CoordinateLine > 0)
+ {
+ BeamTarget.x = a_NBT.GetInt(CoordinateLine);
+ }
+ CoordinateLine = a_NBT.FindChildByName(CurrentLine, "Y");
+ if (CoordinateLine > 0)
+ {
+ BeamTarget.y = a_NBT.GetInt(CoordinateLine);
+ }
+ CoordinateLine = a_NBT.FindChildByName(CurrentLine, "Z");
+ if (CoordinateLine > 0)
+ {
+ BeamTarget.z = a_NBT.GetInt(CoordinateLine);
+ }
+ }
+ }
+ CurrentLine = a_NBT.FindChildByName(a_TagIdx, "ShowBottom");
+ if (CurrentLine > 0)
+ {
+ EnderCrystal->SetShowBottom(a_NBT.GetByte(CurrentLine) == 1);
+ }
+
a_Entities.emplace_back(std::move(EnderCrystal));
}