diff --git a/Minecraft.World/Enchantments/Enchantment.cpp b/Minecraft.World/Enchantments/Enchantment.cpp
index 8615c7546..2213c435b 100644
--- a/Minecraft.World/Enchantments/Enchantment.cpp
+++ b/Minecraft.World/Enchantments/Enchantment.cpp
@@ -136,6 +136,17 @@ Enchantment* Enchantment::setDescriptionId(int id) {
int Enchantment::getDescriptionId() { return descriptionId; }
+// 4jcraft: re-added old TU18 overload for java gui
+std::wstring Enchantment::getFullname(int level, std::wstring& unformatted) {
+ wchar_t formatted[256];
+ swprintf(formatted, 256, L"%ls %ls", app.GetString(getDescriptionId()),
+ getLevelString(level).c_str());
+ unformatted = formatted;
+ swprintf(formatted, 256, L"%ls",
+ app.GetHTMLColour(eHTMLColor_f), unformatted.c_str());
+ return formatted;
+}
+
HtmlString Enchantment::getFullname(int level) {
wchar_t formatted[256];
swprintf(formatted, 256, L"%ls %ls", app.GetString(getDescriptionId()),
diff --git a/Minecraft.World/Enchantments/Enchantment.h b/Minecraft.World/Enchantments/Enchantment.h
index bf9c69ce0..dc089d3e1 100644
--- a/Minecraft.World/Enchantments/Enchantment.h
+++ b/Minecraft.World/Enchantments/Enchantment.h
@@ -79,6 +79,9 @@ public:
virtual bool isCompatibleWith(Enchantment* other) const;
virtual Enchantment* setDescriptionId(int id);
virtual int getDescriptionId();
+ // 4jcraft: re-added old TU18 overload for java gui
+ virtual std::wstring getFullname(
+ int level, std::wstring& unformatted); // 4J Stu added unformatted
virtual HtmlString getFullname(int level);
virtual bool canEnchant(std::shared_ptr item);
diff --git a/Minecraft.World/Items/Item.cpp b/Minecraft.World/Items/Item.cpp
index 42df7d827..401aa4e1e 100644
--- a/Minecraft.World/Items/Item.cpp
+++ b/Minecraft.World/Items/Item.cpp
@@ -1558,6 +1558,12 @@ std::wstring Item::getPotionBrewingFormula() { return potionBrewingFormula; }
bool Item::hasPotionBrewingFormula() { return !potionBrewingFormula.empty(); }
+// 4jcraft: re-added old TU18 overload for java gui
+void Item::appendHoverText(std::shared_ptr itemInstance,
+ std::shared_ptr player,
+ std::vector* lines, bool advanced,
+ std::vector& unformattedStrings) {}
+
void Item::appendHoverText(std::shared_ptr itemInstance,
std::shared_ptr player,
std::vector* lines, bool advanced) {}
diff --git a/Minecraft.World/Items/Item.h b/Minecraft.World/Items/Item.h
index 062235e38..8e338264a 100644
--- a/Minecraft.World/Items/Item.h
+++ b/Minecraft.World/Items/Item.h
@@ -757,6 +757,13 @@ protected:
public:
virtual std::wstring getPotionBrewingFormula();
virtual bool hasPotionBrewingFormula();
+ // 4jcraft: re-added old TU18 overload for java gui
+ virtual void appendHoverText(
+ std::shared_ptr itemInstance,
+ std::shared_ptr player, std::vector* lines,
+ bool advanced,
+ std::vector&
+ unformattedStrings); // 4J Added unformattedStrings
virtual void appendHoverText(std::shared_ptr itemInstance,
std::shared_ptr player,
std::vector* lines, bool advanced);
diff --git a/Minecraft.World/Items/ItemInstance.cpp b/Minecraft.World/Items/ItemInstance.cpp
index 8958e2967..64703f347 100644
--- a/Minecraft.World/Items/ItemInstance.cpp
+++ b/Minecraft.World/Items/ItemInstance.cpp
@@ -455,6 +455,74 @@ bool ItemInstance::hasCustomHoverName() {
return tag->getCompound(L"display")->contains(L"Name");
}
+// 4jcraft: re-added old TU18 overload for java gui
+std::vector* ItemInstance::getHoverText(
+ std::shared_ptr player, bool advanced,
+ std::vector& unformattedStrings) {
+ std::vector* lines = new std::vector();
+ Item* item = Item::items[id];
+ std::wstring title = getHoverName();
+
+ // 4J Stu - We don't do italics, but do change colour. But handle this later
+ // in the process due to text length measuring on the Xbox360
+ // if (hasCustomHoverName())
+ //{
+ // title = L"" + title + L"";
+ //}
+
+ // 4J Stu - Don't currently have this
+ // if (advanced)
+ //{
+ // String suffix = "";
+
+ // if (title.length() > 0) {
+ // title += " (";
+ // suffix = ")";
+ // }
+
+ // if (isStackedByData())
+ // {
+ // title += String.format("#%04d/%d%s", id, auxValue, suffix);
+ // }
+ // else
+ // {
+ // title += String.format("#%04d%s", id, suffix);
+ // }
+ //}
+ // else
+ // if (!hasCustomHoverName())
+ //{
+ // if (id == Item::map_Id)
+ // {
+ // title += L" #" + _toString(auxValue);
+ // }
+ //}
+
+ lines->push_back(title);
+ unformattedStrings.push_back(title);
+ item->appendHoverText(shared_from_this(), player, lines, advanced,
+ unformattedStrings);
+
+ if (hasTag()) {
+ ListTag* list = getEnchantmentTags();
+ if (list != NULL) {
+ for (int i = 0; i < list->size(); i++) {
+ int type = list->get(i)->getShort((wchar_t*)TAG_ENCH_ID);
+ int level = list->get(i)->getShort((wchar_t*)TAG_ENCH_LEVEL);
+
+ if (Enchantment::enchantments[type] != NULL) {
+ std::wstring unformatted = L"";
+ lines->push_back(
+ Enchantment::enchantments[type]->getFullname(
+ level, unformatted));
+ unformattedStrings.push_back(unformatted);
+ }
+ }
+ }
+ }
+ return lines;
+}
+
std::vector* ItemInstance::getHoverText(
std::shared_ptr player, bool advanced) {
std::vector* lines = new std::vector();
diff --git a/Minecraft.World/Items/ItemInstance.h b/Minecraft.World/Items/ItemInstance.h
index 5ae064695..ef3c7c624 100644
--- a/Minecraft.World/Items/ItemInstance.h
+++ b/Minecraft.World/Items/ItemInstance.h
@@ -158,6 +158,10 @@ public:
void setHoverName(const std::wstring& name);
void resetHoverName();
bool hasCustomHoverName();
+ // 4jcraft: re-added old TU18 overload for java gui
+ std::vector* getHoverText(
+ std::shared_ptr player, bool advanced,
+ std::vector& unformattedStrings);
std::vector* getHoverText(std::shared_ptr player,
bool advanced);
std::vector* getHoverTextOnly(std::shared_ptr player,