diff options
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)) { |