Fix: Lapis Slot for Enchanting takes and consumes any item

This commit is contained in:
SevenToaster509 2026-04-12 18:42:59 +01:00
parent 48ce29a28e
commit e0cc846be5
3 changed files with 12 additions and 8 deletions

View file

@ -18,10 +18,6 @@ UIScene_EnchantingMenu::UIScene_EnchantingMenu(int iPad, void *_initData, UILaye
m_enchantButton[1].init(1);
m_enchantButton[2].init(2);
EnchantingScreenInput *initData = static_cast<EnchantingScreenInput *>(_initData);
m_labelEnchant.init( initData->name.empty() ? app.GetString(IDS_ENCHANT) : initData->name );

View file

@ -106,7 +106,6 @@ void EnchantmentMenu::slotsChanged(int a) // 4J used to take a shared_ptr<Contai
}
m_costsChanged = true;
alreadyRan = false;
}
else
{

View file

@ -2,7 +2,7 @@
// 4J Stu Added
// In EnchantmentMenu.java they create an anoymous class while creating some slot. I have moved the content
// of that anonymous class to here
#include "Item.h"
#include "Slot.h"
class Container;
@ -10,7 +10,16 @@ class Container;
class EnchantmentSlot : public Slot
{
public:
EnchantmentSlot(shared_ptr<Container> container, int id, int x, int y) : Slot(container,id, x, y) {}
virtual bool mayPlace(shared_ptr<ItemInstance> item) {return true;}
int slotNum;
//stack->getItem()->id == 351 && stack->getItem()->getMaterial() == 11
EnchantmentSlot(shared_ptr<Container> container, int id, int x, int y) : Slot(container, id, x, y) { slotNum = id; }
virtual bool mayPlace(shared_ptr<ItemInstance> item) {
if (slotNum == 0 || (item->id == 351 && Item::items[item->id]->getMaterial() == 11)) {
return true;
}
else {
return false;
}
}
virtual bool mayCombine(shared_ptr<ItemInstance> item) {return false;} // 4J Added
};