Minor item refactor

This commit is contained in:
MihailRis 2024-01-09 12:58:35 +03:00
parent b5739c678f
commit c9576f1fc4
3 changed files with 7 additions and 4 deletions

View File

@ -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();
}

View File

@ -4,7 +4,6 @@
#include <string>
#include <glm/glm.hpp>
#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);

View File

@ -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") {