aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.World/ItemInstance.h
diff options
context:
space:
mode:
authordaoge <3523206925@qq.com>2026-03-03 03:04:10 +0800
committerGitHub <noreply@github.com>2026-03-03 03:04:10 +0800
commitb3feddfef372618c8a9d7a0abcaf18cfad866c18 (patch)
tree267761c3bb39241ba5c347bfbe2254d06686e287 /Minecraft.World/ItemInstance.h
parent84c31a2331f7a0ec85b9d438992e244f60e5020f (diff)
feat: TU19 (Dec 2014) Features & Content (#155)
* try to resolve merge conflict * feat: TU19 (Dec 2014) Features & Content (#32) * December 2014 files * Working release build * Fix compilation issues * Add sound to Windows64Media * Add DLC content and force Tutorial DLC * Revert "Add DLC content and force Tutorial DLC" This reverts commit 97a43994725008e35fceb984d5549df9c8cea470. * Disable broken light packing * Disable breakpoint during DLC texture map load Allows DLC loading but the DLC textures are still broken * Fix post build not working * ... * fix vs2022 build * fix cmake build --------- Co-authored-by: Loki <lokirautio@gmail.com>
Diffstat (limited to 'Minecraft.World/ItemInstance.h')
-rw-r--r--Minecraft.World/ItemInstance.h52
1 files changed, 29 insertions, 23 deletions
diff --git a/Minecraft.World/ItemInstance.h b/Minecraft.World/ItemInstance.h
index c1e52177..034c72f8 100644
--- a/Minecraft.World/ItemInstance.h
+++ b/Minecraft.World/ItemInstance.h
@@ -3,39 +3,45 @@ using namespace std;
#include "UseAnim.h"
#include "com.mojang.nbt.h"
+#include "Attribute.h"
class Entity;
class Level;
class Player;
class Mob;
+class LivingEntity;
class CompoundTag;
class Enchantment;
class Rarity;
+class AttributeModifier;
+class Random;
// 4J-PB - added
class MapItem;
class ItemFrame;
class Icon;
+class HtmlString;
// 4J Stu - While this is not really an abstract class, we don't want to make new instances of it,
// mainly because there are too many ctors and that doesn't fit well into out macroisation setup
class ItemInstance: public enable_shared_from_this<ItemInstance>
{
public:
+ static const wstring ATTRIBUTE_MODIFIER_FORMAT;
static const wchar_t *TAG_ENCH_ID;
- static const wchar_t *TAG_ENCH_LEVEL;
+ static const wchar_t *TAG_ENCH_LEVEL;
int count;
- int popTime;
- int id;
+ int popTime;
+ int id;
// 4J Stu - Brought forward for enchanting/game rules
CompoundTag *tag;
- /**
- * This was previously the damage value, but is now used for different stuff
- * depending on item / tile. Use the getter methods to make sure the value
- * is interpreted correctly.
- */
+ /**
+ * This was previously the damage value, but is now used for different stuff
+ * depending on item / tile. Use the getter methods to make sure the value
+ * is interpreted correctly.
+ */
private:
int auxValue;
// 4J-PB - added for trading menu
@@ -71,7 +77,7 @@ public:
int getIconType();
bool useOn(shared_ptr<Player> player, Level *level, int x, int y, int z, int face, float clickX, float clickY, float clickZ, bool bTestUseOnOnly=false);
float getDestroySpeed(Tile *tile);
- bool TestUse(Level *level, shared_ptr<Player> player);
+ bool TestUse(shared_ptr<ItemInstance> itemInstance, Level *level, shared_ptr<Player> player);
shared_ptr<ItemInstance> use(Level *level, shared_ptr<Player> player);
shared_ptr<ItemInstance> useTimeDepleted(Level *level, shared_ptr<Player> player);
CompoundTag *save(CompoundTag *compoundTag);
@@ -85,12 +91,12 @@ public:
int getAuxValue() const;
void setAuxValue(int value);
int getMaxDamage();
- void hurt(int i, shared_ptr<Mob> owner);
- void hurtEnemy(shared_ptr<Mob> mob, shared_ptr<Player> attacker);
+ bool hurt(int dmg, Random *random);
+ void hurtAndBreak(int dmg, shared_ptr<LivingEntity> owner);
+ void hurtEnemy(shared_ptr<LivingEntity> mob, shared_ptr<Player> attacker);
void mineBlock(Level *level, int tile, int x, int y, int z, shared_ptr<Player> owner);
- int getAttackDamage(shared_ptr<Entity> entity);
bool canDestroySpecial(Tile *tile);
- bool interactEnemy(shared_ptr<Mob> mob);
+ bool interactEnemy(shared_ptr<Player> player, shared_ptr<LivingEntity> mob);
shared_ptr<ItemInstance> copy() const;
ItemInstance *copy_not_shared() const; // 4J Stu - Added for use in recipes
static bool tagMatches(shared_ptr<ItemInstance> a, shared_ptr<ItemInstance> b); // 4J Brought forward from 1.2
@@ -128,27 +134,27 @@ public:
void setTag(CompoundTag *tag);
wstring getHoverName();
void setHoverName(const wstring &name);
+ void resetHoverName();
bool hasCustomHoverName();
- vector<wstring> *getHoverText(shared_ptr<Player> player, bool advanced, vector<wstring> &unformattedStrings);
- vector<wstring> *getHoverTextOnly(shared_ptr<Player> player, bool advanced, vector<wstring> &unformattedStrings); // 4J Added
+ vector<HtmlString> *getHoverText(shared_ptr<Player> player, bool advanced);
+ vector<HtmlString> *getHoverTextOnly(shared_ptr<Player> player, bool advanced); // 4J Added
bool isFoil();
const Rarity *getRarity();
bool isEnchantable();
void enchant(const Enchantment *enchantment, int level);
bool isEnchanted();
void addTagElement(wstring name, Tag *tag);
+ bool mayBePlacedInAdventureMode();
+ bool isFramed();
+ void setFramed(shared_ptr<ItemFrame> frame);
+ shared_ptr<ItemFrame> getFrame();
+ int getBaseRepairCost();
+ void setRepairCost(int cost);
+ attrAttrModMap *getAttributeModifiers();
// 4J Added
void set4JData(int data);
int get4JData();
bool hasPotionStrengthBar();
int GetPotionStrength();
-
- // TU9
- bool isFramed();
- void setFramed(shared_ptr<ItemFrame> frame);
- shared_ptr<ItemFrame> getFrame();
-
- int getBaseRepairCost();
- void setRepairCost(int cost);
}; \ No newline at end of file