diff options
author | Ethan Jones <ethan@yasfu.net> | 2021-10-03 22:29:45 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-03 22:29:45 +0200 |
commit | afe07fe0900e5e03f439656558a953acf16f35b8 (patch) | |
tree | 1946a7980c5799bc4e028e78c6747102e4b92fba /src/Items/ItemPainting.h | |
parent | Authenticator: avoid move assignments to self (#5315) (diff) | |
download | cuberite-afe07fe0900e5e03f439656558a953acf16f35b8.tar cuberite-afe07fe0900e5e03f439656558a953acf16f35b8.tar.gz cuberite-afe07fe0900e5e03f439656558a953acf16f35b8.tar.bz2 cuberite-afe07fe0900e5e03f439656558a953acf16f35b8.tar.lz cuberite-afe07fe0900e5e03f439656558a953acf16f35b8.tar.xz cuberite-afe07fe0900e5e03f439656558a953acf16f35b8.tar.zst cuberite-afe07fe0900e5e03f439656558a953acf16f35b8.zip |
Diffstat (limited to '')
-rw-r--r-- | src/Items/ItemPainting.h | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/Items/ItemPainting.h b/src/Items/ItemPainting.h index 78d9f040a..058f8d3b2 100644 --- a/src/Items/ItemPainting.h +++ b/src/Items/ItemPainting.h @@ -45,6 +45,12 @@ public: return false; } + // Make sure the support block is a valid block to place a painting on: + if (!cHangingEntity::IsValidSupportBlock(a_World->GetBlock(a_ClickedBlockPos))) + { + return false; + } + // Make sure block that will be occupied is free: auto PlacePos = AddFaceDirection(a_ClickedBlockPos, a_ClickedBlockFace); BLOCKTYPE PlaceBlockType = a_World->GetBlock(PlacePos); @@ -85,7 +91,9 @@ public: }; auto PaintingTitle = gPaintingTitlesList[a_World->GetTickRandomNumber(ARRAYCOUNT(gPaintingTitlesList) - 1)]; - auto Painting = std::make_unique<cPainting>(PaintingTitle, a_ClickedBlockFace, PlacePos); + + // A painting, centred so pickups spawn nicely. + auto Painting = std::make_unique<cPainting>(PaintingTitle, a_ClickedBlockFace, Vector3d(0.5, 0.5, 0.5) + PlacePos); auto PaintingPtr = Painting.get(); if (!PaintingPtr->Initialize(std::move(Painting), *a_World)) { |