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/MelonTile.cpp | |
| parent | def8cb415354ac390b7e89052a50605285f1aca9 (diff) | |
Initial commit
Diffstat (limited to 'Minecraft.World/MelonTile.cpp')
| -rw-r--r-- | Minecraft.World/MelonTile.cpp | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/Minecraft.World/MelonTile.cpp b/Minecraft.World/MelonTile.cpp new file mode 100644 index 00000000..881eadc2 --- /dev/null +++ b/Minecraft.World/MelonTile.cpp @@ -0,0 +1,45 @@ +#include "stdafx.h" +#include "MelonTile.h" +#include "net.minecraft.world.item.h" +#include "net.minecraft.world.h" +#include "Facing.h" + +const wstring MelonTile::TEX = L"melon_side"; +const wstring MelonTile::TEX_TOP = L"melon_top"; + +MelonTile::MelonTile(int id) : Tile(id, Material::vegetable) +{ + iconTop = NULL; +} + +Icon *MelonTile::getTexture(int face, int data) +{ + if (face == Facing::UP || face == Facing::DOWN) return iconTop; + return icon; +} + +int MelonTile::getResource(int data, Random *random, int playerBonusLevel) +{ + return Item::melon->id; +} + +int MelonTile::getResourceCount(Random *random) +{ + return 3 + random->nextInt(5); +} + +int MelonTile::getResourceCountForLootBonus(int bonusLevel, Random *random) +{ + int total = getResourceCount(random) + random->nextInt(1 + bonusLevel); + if (total > 9) + { + total = 9; + } + return total; +} + +void MelonTile::registerIcons(IconRegister *iconRegister) +{ + icon = iconRegister->registerIcon(TEX); + iconTop = iconRegister->registerIcon(TEX_TOP); +}
\ No newline at end of file |
