4jcraft/Minecraft.World/Items/CompassItem.cpp
2026-03-13 17:06:56 -05:00

39 lines
1.2 KiB
C++

#include "../Platform/stdafx.h"
#include "CompassItem.h"
#include "../../Minecraft.Client/Minecraft.h"
#include "../../Minecraft.Client/Player/MultiPlayerLocalPlayer.h"
#include "../Headers/net.minecraft.world.h"
#ifdef __PSVITA__
const std::wstring CompassItem::TEXTURE_PLAYER_ICON[XUSER_MAX_COUNT] = {
L"compassP0"};
#else
const std::wstring CompassItem::TEXTURE_PLAYER_ICON[XUSER_MAX_COUNT] = {
L"compassP0", L"compassP1", L"compassP2", L"compassP3"};
#endif
CompassItem::CompassItem(int id) : Item(id) { icons = NULL; }
// 4J Added so that we can override the icon id used to calculate the texture
// UV's for each player
Icon* CompassItem::getIcon(int auxValue) {
Icon* icon = Item::getIcon(auxValue);
Minecraft* pMinecraft = Minecraft::GetInstance();
if (pMinecraft->player != NULL && auxValue == 0) {
icon = icons[pMinecraft->player->GetXboxPad()];
}
return icon;
}
void CompassItem::registerIcons(IconRegister* iconRegister) {
Item::registerIcons(iconRegister);
icons = new Icon*[XUSER_MAX_COUNT];
for (int i = 0; i < XUSER_MAX_COUNT; i++) {
icons[i] = iconRegister->registerIcon(TEXTURE_PLAYER_ICON[i]);
}
}