diff --git a/src/content/Content.cpp b/src/content/Content.cpp index b8708183..ba1648cb 100644 --- a/src/content/Content.cpp +++ b/src/content/Content.cpp @@ -106,6 +106,10 @@ Content* ContentBuilder::build() { def->rt.pickingItem = content->requireItem(def->pickingItem)->rt.id; } + for (ItemDef* def : itemDefsIndices) { + def->rt.placingBlock = content->requireBlock(def->placingBlock)->rt.id; + } + return content.release(); } diff --git a/src/items/ItemDef.h b/src/items/ItemDef.h index 54f0149e..520b1099 100644 --- a/src/items/ItemDef.h +++ b/src/items/ItemDef.h @@ -4,7 +4,6 @@ #include #include -#include "../graphics/UVRegion.h" #include "../typedefs.h" struct item_funcs_set { @@ -26,12 +25,12 @@ public: item_icon_type iconType = item_icon_type::sprite; std::string icon = "block:notfound"; - std::string placingBlock = "none"; + std::string placingBlock = "core:air"; struct { itemid_t id; item_funcs_set funcsset {}; - UVRegion iconRegion {0, 0, 1, 1}; + blockid_t placingBlock; } rt; ItemDef(std::string name); diff --git a/src/logic/PlayerController.cpp b/src/logic/PlayerController.cpp index 8ef2be5d..50f5ea9d 100644 --- a/src/logic/PlayerController.cpp +++ b/src/logic/PlayerController.cpp @@ -241,7 +241,7 @@ void PlayerController::updateInteraction(){ ItemDef* item = contentIds->getItemDef(player->chosenItem); - Block* def = level->content->findBlock(item->placingBlock); + Block* def = contentIds->getBlockDef(item->rt.placingBlock); if (def && def->rotatable){ const std::string& name = def->rotations.name; if (name == "pipe") {