mirror of
https://github.com/4jcraft/4jcraft.git
synced 2026-04-25 17:24:19 +00:00
29 lines
871 B
C++
29 lines
871 B
C++
#include "SaplingTileItem.h"
|
|
|
|
#include <memory>
|
|
|
|
#include "TileItem.h"
|
|
#include "minecraft/world/item/ItemInstance.h"
|
|
#include "minecraft/world/level/tile/SaplingPlantTile.h"
|
|
#include "minecraft/world/level/tile/Tile.h"
|
|
|
|
SaplingTileItem::SaplingTileItem(int id) : TileItem(id) {
|
|
setMaxDamage(0);
|
|
setStackedByData(true);
|
|
}
|
|
|
|
int SaplingTileItem::getLevelDataForAuxValue(int auxValue) { return auxValue; }
|
|
|
|
Icon* SaplingTileItem::getIcon(int itemAuxValue) {
|
|
return Tile::sapling->getTexture(0, itemAuxValue);
|
|
}
|
|
|
|
// 4J brought forward to have unique names for different sapling types
|
|
unsigned int SaplingTileItem::getDescriptionId(
|
|
std::shared_ptr<ItemInstance> instance) {
|
|
int auxValue = instance->getAuxValue();
|
|
if (auxValue < 0 || auxValue >= Sapling::SAPLING_NAMES_SIZE) {
|
|
auxValue = 0;
|
|
}
|
|
return Sapling::SAPLING_NAMES[auxValue];
|
|
} |