From b3feddfef372618c8a9d7a0abcaf18cfad866c18 Mon Sep 17 00:00:00 2001 From: daoge <3523206925@qq.com> Date: Tue, 3 Mar 2026 03:04:10 +0800 Subject: 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 --- Minecraft.World/ItemInstance.h | 52 +++++++++++++++++++++++------------------- 1 file changed, 29 insertions(+), 23 deletions(-) (limited to 'Minecraft.World/ItemInstance.h') 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 { 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, 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); + bool TestUse(shared_ptr itemInstance, Level *level, shared_ptr player); shared_ptr use(Level *level, shared_ptr player); shared_ptr useTimeDepleted(Level *level, shared_ptr 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 owner); - void hurtEnemy(shared_ptr mob, shared_ptr attacker); + bool hurt(int dmg, Random *random); + void hurtAndBreak(int dmg, shared_ptr owner); + void hurtEnemy(shared_ptr mob, shared_ptr attacker); void mineBlock(Level *level, int tile, int x, int y, int z, shared_ptr owner); - int getAttackDamage(shared_ptr entity); bool canDestroySpecial(Tile *tile); - bool interactEnemy(shared_ptr mob); + bool interactEnemy(shared_ptr player, shared_ptr mob); shared_ptr copy() const; ItemInstance *copy_not_shared() const; // 4J Stu - Added for use in recipes static bool tagMatches(shared_ptr a, shared_ptr 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 *getHoverText(shared_ptr player, bool advanced, vector &unformattedStrings); - vector *getHoverTextOnly(shared_ptr player, bool advanced, vector &unformattedStrings); // 4J Added + vector *getHoverText(shared_ptr player, bool advanced); + vector *getHoverTextOnly(shared_ptr 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 frame); + shared_ptr 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 frame); - shared_ptr getFrame(); - - int getBaseRepairCost(); - void setRepairCost(int cost); }; \ No newline at end of file -- cgit v1.2.3