Quick Equipment

This commit is contained in:
GabsPuNs
2026-04-01 20:15:32 -04:00
parent 489e19435c
commit 385c1c711a
7 changed files with 100 additions and 9 deletions

View File

@@ -55,7 +55,7 @@ void IUIScene_HUD::updateFrameTick()
int iPad = getPad();
Minecraft *pMinecraft = Minecraft::GetInstance();
int iGuiScale;
int iGuiScale;
if(pMinecraft->localplayers[iPad]->m_iScreenSection == C4JRender::VIEWPORT_TYPE_FULLSCREEN)
{

View File

@@ -30,6 +30,10 @@ protected:
bool m_bRegenEffectEnabled;
int m_iFoodSaturation;
//TODO TU25
bool m_showQuickSelect;
bool m_showCrosshair;
unsigned int m_uiSelectedItemOpacityCountDown;
wstring m_displayName;
@@ -79,6 +83,11 @@ protected:
virtual void SetSelectedLabel(const wstring &label) = 0;
virtual void ShowDisplayName(bool show) = 0;
//TODO TU25
virtual void ShowQuickSelect(bool show) = 0;
virtual void ShowCrosshair(bool show) = 0;
virtual void ShowGameModePlayers(bool show) = 0;
virtual void SetGameModePlayerState(bool bEnabled) = 0;
public:
void updateFrameTick();
void renderPlayerHealth();

View File

@@ -612,7 +612,6 @@ void UIScene_HUD::HideSelectedLabel()
IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcHideSelectedLabel , 0 , nullptr );
}
void UIScene_HUD::SetRidingHorse(bool ridingHorse, bool bIsJumpable, int maxHorseHealth)
{
if(m_bRidingHorse != ridingHorse || maxHorseHealth != m_iHorseMaxHealth)
@@ -866,10 +865,6 @@ void UIScene_HUD::SetDisplayName(const wstring &displayName)
}
}
//TODO TU25
void UIScene_HUD::ShowGameModePlayers(bool show) {}
void UIScene_HUD::SetGameModePlayerState(bool show) {}
void UIScene_HUD::SetTooltipsEnabled(bool bEnabled)
{
if(m_bToolTipsVisible != bEnabled)
@@ -898,4 +893,38 @@ void UIScene_HUD::handleGameTick()
updateFrameTick();
}
}
}
//TODO TU25
void UIScene_HUD::ShowGameModePlayers(bool show) {}
void UIScene_HUD::SetGameModePlayerState(bool bEnabled) {}
void UIScene_HUD::ShowQuickSelect(bool show)
{
if(show != m_showQuickSelect)
{
app.DebugPrintf("ShowQuickSelect to %s\n", show?"TRUE":"FALSE");
m_showQuickSelect = show;
IggyDataValue result;
IggyDataValue value[1];
value[0].type = IGGY_DATATYPE_boolean;
value[0].boolval = show;
IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcShowQuickSelect , 1 , value );
}
}
void UIScene_HUD::ShowCrosshair(bool show)
{
if(show != m_showCrosshair)
{
app.DebugPrintf("ShowCrosshair to %s\n", show?"TRUE":"FALSE");
m_showCrosshair = show;
IggyDataValue result;
IggyDataValue value[1];
value[0].type = IGGY_DATATYPE_boolean;
value[0].boolval = show;
IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcShowCrosshair , 1 , value );
}
}
//void UIScene_HUD::ShowPulser(bool show) {}
//void UIScene_HUD::SetPulserText(bool bEnabled) {}

View File

@@ -26,6 +26,9 @@ protected:
IggyName m_funcRepositionHud, m_funcSetDisplayName, m_funcSetTooltipsEnabled;
IggyName m_funcSetRidingHorse, m_funcSetHorseHealth, m_funcSetHorseJumpBarProgress;
IggyName m_funcSetHealthAbsorb;
IggyName m_funcSetGamemodePlayerState, m_funcShowGamemodePlayers;
IggyName m_funcShowQuickSelect;
IggyName m_funcShowCrosshair;
UI_BEGIN_MAP_ELEMENTS_AND_NAMES(UIScene)
UI_MAP_ELEMENT(m_labelChatText[0],"Label1")
UI_MAP_ELEMENT(m_labelChatText[1],"Label2")
@@ -92,6 +95,12 @@ protected:
UI_MAP_NAME(m_funcSetHorseJumpBarProgress, L"SetHorseJumpBarProgress")
UI_MAP_NAME(m_funcSetHealthAbsorb, L"SetHealthAbsorb")
//TU 25
UI_MAP_NAME(m_funcSetGamemodePlayerState, L"ShowGameModePlayers")
UI_MAP_NAME(m_funcShowGamemodePlayers, L"SetGameModePlayerState")
UI_MAP_NAME(m_funcShowQuickSelect, L"ShowQuickSelect")
UI_MAP_NAME(m_funcShowCrosshair, L"ShowCrosshair")
UI_END_MAP_ELEMENTS_AND_NAMES()
public:
@@ -162,11 +171,15 @@ private:
void SetHealthAbsorb(int healthAbsorb);
//TODO TU25
void ShowQuickSelect(bool show);
void ShowCrosshair(bool show);
public:
void SetSelectedLabel(const wstring &label);
void ShowDisplayName(bool show);
void ShowGameModePlayers(bool show); // TODO TU25
void SetGameModePlayerState(bool show); // TODO TU25
//TODO TU25
void ShowGameModePlayers(bool show);
void SetGameModePlayerState(bool bEnabled);
void handleGameTick();

View File

@@ -2529,6 +2529,30 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
switch (itemInstance->getItem()->id)
{
// Equip
case Item::helmet_leather_Id:
case Item::chestplate_leather_Id:
case Item::leggings_leather_Id:
case Item::boots_leather_Id:
case Item::helmet_chain_Id:
case Item::chestplate_chain_Id:
case Item::leggings_chain_Id:
case Item::boots_chain_Id:
case Item::helmet_iron_Id:
case Item::chestplate_iron_Id:
case Item::leggings_iron_Id:
case Item::boots_iron_Id:
case Item::helmet_gold_Id:
case Item::chestplate_gold_Id:
case Item::leggings_gold_Id:
case Item::boots_gold_Id:
case Item::helmet_diamond_Id:
case Item::chestplate_diamond_Id:
case Item::leggings_diamond_Id:
case Item::boots_diamond_Id:
*piUse=IDS_TOOLTIPS_EQUIP;
break;
// food
case Item::potatoBaked_Id:
case Item::potato_Id:

View File

@@ -263,4 +263,18 @@ Icon *ArmorItem::getEmptyIcon(int slot)
}
return nullptr;
}
shared_ptr<ItemInstance> ArmorItem::use(shared_ptr<ItemInstance> item, Level *level, shared_ptr<Player> player)
{
//TODO Play Equip Sound
if ((player->getArmor(Mob::getEquipmentSlotForItem(item) - 1)) == nullptr)
{
shared_ptr<ItemInstance> equip = item->copy();
equip->count = 1;
player->setEquippedSlot(Mob::getEquipmentSlotForItem(item) - 1, equip);
item->count--;
}
return item;
}

View File

@@ -88,4 +88,6 @@ public:
virtual void registerIcons(IconRegister *iconRegister);
static Icon *getEmptyIcon(int slot);
virtual shared_ptr<ItemInstance> use(shared_ptr<ItemInstance> itemInstance, Level *level, shared_ptr<Player> player);
};