diff options
| author | daoge_cmd <3523206925@qq.com> | 2026-03-01 12:16:08 +0800 |
|---|---|---|
| committer | daoge_cmd <3523206925@qq.com> | 2026-03-01 12:16:08 +0800 |
| commit | b691c43c44ff180d10e7d4a9afc83b98551ff586 (patch) | |
| tree | 3e9849222cbc6ba49f2f1fc6e5fe7179632c7390 /Minecraft.World/LeafTileItem.cpp | |
| parent | def8cb415354ac390b7e89052a50605285f1aca9 (diff) | |
Initial commit
Diffstat (limited to 'Minecraft.World/LeafTileItem.cpp')
| -rw-r--r-- | Minecraft.World/LeafTileItem.cpp | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/Minecraft.World/LeafTileItem.cpp b/Minecraft.World/LeafTileItem.cpp new file mode 100644 index 00000000..40036ca0 --- /dev/null +++ b/Minecraft.World/LeafTileItem.cpp @@ -0,0 +1,47 @@ +#include "stdafx.h" +#include "net.minecraft.world.level.tile.h" +#include "net.minecraft.world.item.h" +#include "LeafTileItem.h" +#include "FoliageColor.h" + +LeafTileItem::LeafTileItem(int id) : TileItem(id) +{ + setMaxDamage(0); + setStackedByData(true); +} + +int LeafTileItem::getLevelDataForAuxValue(int auxValue) +{ + return auxValue | LeafTile::PERSISTENT_LEAF_BIT; + +} + +Icon *LeafTileItem::getIcon(int itemAuxValue) +{ + return Tile::leaves->getTexture(0, itemAuxValue); +} + + +int LeafTileItem::getColor(shared_ptr<ItemInstance> item, int spriteLayer) +{ + int data = item->getAuxValue(); + if ((data & LeafTile::EVERGREEN_LEAF) == LeafTile::EVERGREEN_LEAF) + { + return FoliageColor::getEvergreenColor(); + } + if ((data & LeafTile::BIRCH_LEAF) == LeafTile::BIRCH_LEAF) + { + return FoliageColor::getBirchColor(); + } + return FoliageColor::getDefaultColor(); +} + +unsigned int LeafTileItem::getDescriptionId(shared_ptr<ItemInstance> instance) +{ + int auxValue = instance->getAuxValue(); + if (auxValue < 0 || auxValue >= LeafTile::LEAF_NAMES_LENGTH) + { + auxValue = 0; + } + return LeafTile::LEAF_NAMES[auxValue]; +}
\ No newline at end of file |
