#include "stdafx.h" #include "net.minecraft.world.h" #include "net.minecraft.world.level.h" #include "net.minecraft.world.entity.h" #include "net.minecraft.world.entity.player.h" #include "net.minecraft.world.item.h" #include "ElytraItem.h" // Internal item ID: 187 → public item ID: 443 (256 + 187) ElytraItem::ElytraItem() : Item(187) { maxStackSize = 1; setMaxDamage(432); } bool ElytraItem::isFlyEnabled(shared_ptr item) { return item->getDamageValue() < item->getMaxDamage() - 1; } bool ElytraItem::TestUse(shared_ptr instance, Level* level, shared_ptr player) { return true; } shared_ptr ElytraItem::use(shared_ptr instance, Level* level, shared_ptr player) { // Play cloth armor equip sound (range 194–199) player->playSound(194, 0.5f, 1.0f); return instance; } bool ElytraItem::isValidRepairItem(shared_ptr source, shared_ptr repairItem) { return repairItem->id == Item::leather_Id; } void ElytraItem::registerIcons(IconRegister* iconRegister) { Item::registerIcons(iconRegister); m_brokenElytraIcon = iconRegister->registerIcon(L"broken_elytra"); } Icon* ElytraItem::getLayerIcon(int auxValue, int spriteLayer) { // auxValue may be the damage value in certain render paths if (auxValue < getMaxDamage() - 1) return icon; else return m_brokenElytraIcon; } Icon* ElytraItem::getIcon(int auxValue) { if (auxValue < getMaxDamage() - 1) return icon; else return m_brokenElytraIcon; }