[CSM] Don't Load the package library (#6944)
[oweals/minetest.git] / src / itemdef.h
index 01ec4fa2fed37623c606cc472b0553043bc7add7..45cff582a218096028f28689c04695bfe66bdee4 100644 (file)
@@ -18,8 +18,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */
 
-#ifndef ITEMDEF_HEADER
-#define ITEMDEF_HEADER
+#pragma once
 
 #include "irrlichttypes_extrabloated.h"
 #include <string>
@@ -30,6 +29,11 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 class IGameDef;
 class Client;
 struct ToolCapabilities;
+#ifndef SERVER
+#include "client/tile.h"
+struct ItemMesh;
+struct ItemStack;
+#endif
 
 /*
        Base item definition
@@ -56,7 +60,11 @@ struct ItemDefinition
                Visual properties
        */
        std::string inventory_image; // Optional for nodes, mandatory for tools/craftitems
+       std::string inventory_overlay; // Overlay of inventory_image.
        std::string wield_image; // If empty, inventory_image or mesh (only nodes) is used
+       std::string wield_overlay; // Overlay of wield_image.
+       std::string palette_image; // If specified, the item will be colorized based on this
+       video::SColor color; // The fallback color of the node.
        v3f wield_scale;
 
        /*
@@ -94,8 +102,9 @@ private:
 class IItemDefManager
 {
 public:
-       IItemDefManager(){}
-       virtual ~IItemDefManager(){}
+       IItemDefManager() = default;
+
+       virtual ~IItemDefManager() = default;
 
        // Get item definition
        virtual const ItemDefinition& get(const std::string &name) const=0;
@@ -110,8 +119,15 @@ public:
        virtual video::ITexture* getInventoryTexture(const std::string &name,
                        Client *client) const=0;
        // Get item wield mesh
-       virtual scene::IMesh* getWieldMesh(const std::string &name,
+       virtual ItemMesh* getWieldMesh(const std::string &name,
                Client *client) const=0;
+       // Get item palette
+       virtual Palette* getPalette(const std::string &name,
+               Client *client) const = 0;
+       // Returns the base color of an item stack: the color of all
+       // tiles that do not define their own color.
+       virtual video::SColor getItemstackColor(const ItemStack &stack,
+               Client *client) const = 0;
 #endif
 
        virtual void serialize(std::ostream &os, u16 protocol_version)=0;
@@ -120,8 +136,9 @@ public:
 class IWritableItemDefManager : public IItemDefManager
 {
 public:
-       IWritableItemDefManager(){}
-       virtual ~IWritableItemDefManager(){}
+       IWritableItemDefManager() = default;
+
+       virtual ~IWritableItemDefManager() = default;
 
        // Get item definition
        virtual const ItemDefinition& get(const std::string &name) const=0;
@@ -136,7 +153,7 @@ public:
        virtual video::ITexture* getInventoryTexture(const std::string &name,
                        Client *client) const=0;
        // Get item wield mesh
-       virtual scene::IMesh* getWieldMesh(const std::string &name,
+       virtual ItemMesh* getWieldMesh(const std::string &name,
                Client *client) const=0;
 #endif
 
@@ -160,5 +177,3 @@ public:
 };
 
 IWritableItemDefManager* createItemDefManager();
-
-#endif