Minor item refactor
This commit is contained in:
parent
b5739c678f
commit
c9576f1fc4
@ -106,6 +106,10 @@ Content* ContentBuilder::build() {
|
|||||||
def->rt.pickingItem = content->requireItem(def->pickingItem)->rt.id;
|
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();
|
return content.release();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -4,7 +4,6 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <glm/glm.hpp>
|
#include <glm/glm.hpp>
|
||||||
|
|
||||||
#include "../graphics/UVRegion.h"
|
|
||||||
#include "../typedefs.h"
|
#include "../typedefs.h"
|
||||||
|
|
||||||
struct item_funcs_set {
|
struct item_funcs_set {
|
||||||
@ -26,12 +25,12 @@ public:
|
|||||||
item_icon_type iconType = item_icon_type::sprite;
|
item_icon_type iconType = item_icon_type::sprite;
|
||||||
std::string icon = "block:notfound";
|
std::string icon = "block:notfound";
|
||||||
|
|
||||||
std::string placingBlock = "none";
|
std::string placingBlock = "core:air";
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
itemid_t id;
|
itemid_t id;
|
||||||
item_funcs_set funcsset {};
|
item_funcs_set funcsset {};
|
||||||
UVRegion iconRegion {0, 0, 1, 1};
|
blockid_t placingBlock;
|
||||||
} rt;
|
} rt;
|
||||||
|
|
||||||
ItemDef(std::string name);
|
ItemDef(std::string name);
|
||||||
|
|||||||
@ -241,7 +241,7 @@ void PlayerController::updateInteraction(){
|
|||||||
|
|
||||||
ItemDef* item = contentIds->getItemDef(player->chosenItem);
|
ItemDef* item = contentIds->getItemDef(player->chosenItem);
|
||||||
|
|
||||||
Block* def = level->content->findBlock(item->placingBlock);
|
Block* def = contentIds->getBlockDef(item->rt.placingBlock);
|
||||||
if (def && def->rotatable){
|
if (def && def->rotatable){
|
||||||
const std::string& name = def->rotations.name;
|
const std::string& name = def->rotations.name;
|
||||||
if (name == "pipe") {
|
if (name == "pipe") {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user