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/ItemItemFrame.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/ItemItemFrame.h | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/Items/ItemItemFrame.h b/src/Items/ItemItemFrame.h index f1f687461..0f7a4ee8c 100644 --- a/src/Items/ItemItemFrame.h +++ b/src/Items/ItemItemFrame.h @@ -40,6 +40,12 @@ public: return false; } + // Make sure the support block is a valid block to place an item frame on: + if (!cHangingEntity::IsValidSupportBlock(a_World->GetBlock(a_ClickedBlockPos))) + { + return false; + } + // Make sure block that will be occupied by the item frame is free now: const auto PlacePos = AddFaceDirection(a_ClickedBlockPos, a_ClickedBlockFace); BLOCKTYPE Block = a_World->GetBlock(PlacePos); @@ -48,8 +54,8 @@ public: return false; } - // Place the item frame: - auto ItemFrame = std::make_unique<cItemFrame>(a_ClickedBlockFace, PlacePos); + // An item frame, centred so pickups spawn nicely. + auto ItemFrame = std::make_unique<cItemFrame>(a_ClickedBlockFace, Vector3d(0.5, 0.5, 0.5) + PlacePos); auto ItemFramePtr = ItemFrame.get(); if (!ItemFramePtr->Initialize(std::move(ItemFrame), *a_World)) { |