MinecraftConsoles/Minecraft.World/CompassItem.cpp
Riley M. c0da06e4ee
major: Switch to forward slashes(+more) to fix compilation on Linux (#1403)
Notably also adds some metadata files for NixOS 

* add support for linux clang cross compiles

* add linux clang instructions

* un-capitalize Mob.horse.*

* update the description in flake.nix

---------

Co-authored-by: Loki <lokirautio@gmail.com>
2026-04-14 16:47:37 -05:00

43 lines
1.1 KiB
C++

#include "stdafx.h"
#include "CompassItem.h"
#include "../Minecraft.Client/Minecraft.h"
#include "../Minecraft.Client/MultiPlayerLocalPlayer.h"
#include "net.minecraft.world.h"
#ifdef __PSVITA__
const wstring CompassItem::TEXTURE_PLAYER_ICON[XUSER_MAX_COUNT] = {L"compassP0"};
#else
const wstring CompassItem::TEXTURE_PLAYER_ICON[XUSER_MAX_COUNT] = {L"compassP0",L"compassP1",L"compassP2",L"compassP3"};
#endif
CompassItem::CompassItem(int id) : Item(id)
{
icons = nullptr;
}
// 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 != nullptr && 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]);
}
}