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/PotatoTile.cpp | |
| parent | def8cb415354ac390b7e89052a50605285f1aca9 (diff) | |
Initial commit
Diffstat (limited to 'Minecraft.World/PotatoTile.cpp')
| -rw-r--r-- | Minecraft.World/PotatoTile.cpp | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/Minecraft.World/PotatoTile.cpp b/Minecraft.World/PotatoTile.cpp new file mode 100644 index 00000000..27ca1984 --- /dev/null +++ b/Minecraft.World/PotatoTile.cpp @@ -0,0 +1,60 @@ +#include "stdafx.h" +#include "net.minecraft.world.item.h" +#include "net.minecraft.world.level.h" +#include "net.minecraft.world.h" +#include "PotatoTile.h" + +PotatoTile::PotatoTile(int id) : CropTile(id) +{ +} + +Icon *PotatoTile::getTexture(int face, int data) +{ + if (data < 7) + { + if (data == 6) + { + data = 5; + } + return icons[data >> 1]; + } + else + { + return icons[3]; + } +} + +int PotatoTile::getBaseSeedId() +{ + return Item::potato_Id; +} + +int PotatoTile::getBasePlantId() +{ + return Item::potato_Id; +} + +void PotatoTile::spawnResources(Level *level, int x, int y, int z, int data, float odds, int playerBonus) +{ + CropTile::spawnResources(level, x, y, z, data, odds, playerBonus); + + if (level->isClientSide) + { + return; + } + if (data >= 7) + { + if (level->random->nextInt(50) == 0) + { + popResource(level, x, y, z, shared_ptr<ItemInstance>(new ItemInstance(Item::potatoPoisonous))); + } + } +} + +void PotatoTile::registerIcons(IconRegister *iconRegister) +{ + for (int i = 0; i < 4; i++) + { + icons[i] = iconRegister->registerIcon(L"potatoes_" + _toString(i)); + } +}
\ No newline at end of file |
