summaryrefslogtreecommitdiffstats
path: root/src/Items/ItemItemFrame.h
diff options
context:
space:
mode:
authorEthan Jones <ethan@yasfu.net>2021-10-03 22:29:45 +0200
committerGitHub <noreply@github.com>2021-10-03 22:29:45 +0200
commitafe07fe0900e5e03f439656558a953acf16f35b8 (patch)
tree1946a7980c5799bc4e028e78c6747102e4b92fba /src/Items/ItemItemFrame.h
parentAuthenticator: avoid move assignments to self (#5315) (diff)
downloadcuberite-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 'src/Items/ItemItemFrame.h')
-rw-r--r--src/Items/ItemItemFrame.h10
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))
{