mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/LegacyNetherFork.git
synced 2026-06-08 14:15:11 +00:00
65 lines
1.5 KiB
C++
65 lines
1.5 KiB
C++
#include "stdafx.h"
|
|
#include "NetherLeavesTile.h"
|
|
#include "net.minecraft.world.item.h"
|
|
#include "net.minecraft.world.level.h"
|
|
|
|
NetherLeavesTile::NetherLeavesTile(int id) : TransparentTile(id, Material::leaves, true)
|
|
{
|
|
}
|
|
|
|
int NetherLeavesTile::getResource(int data, Random *random, int playerBonusLevel)
|
|
{
|
|
return Item::stick->id;
|
|
}
|
|
|
|
int NetherLeavesTile::getResourceCountForLootBonus(int bonusLevel, Random *random)
|
|
{
|
|
return getResourceCount(random) + random->nextInt(bonusLevel + 1);
|
|
}
|
|
|
|
int NetherLeavesTile::getResourceCount(Random *random)
|
|
{
|
|
return 1 + random->nextInt(2);
|
|
}
|
|
|
|
shared_ptr<ItemInstance> NetherLeavesTile::getSilkTouchItemInstance(int data)
|
|
{
|
|
return shared_ptr<ItemInstance>(new ItemInstance(Tile::netherLeaves));
|
|
}
|
|
|
|
void NetherLeavesTile::spawnResources(Level *level, int x, int y, int z, int data, float odds, int playerBonusLevel)
|
|
{
|
|
if (!level->isClientSide)
|
|
{
|
|
int chance = 5;
|
|
|
|
chance = 5;
|
|
if (playerBonusLevel > 0)
|
|
{
|
|
chance -= 1 << playerBonusLevel;
|
|
if (chance < 2)
|
|
{
|
|
chance = 2;
|
|
}
|
|
}
|
|
if (level->random->nextInt(chance) == 0)
|
|
{
|
|
popResource(level, x, y, z, std::make_shared<ItemInstance>(Tile::netherSapling_Id, 1, 0));
|
|
}
|
|
|
|
chance = 5;
|
|
if (playerBonusLevel > 0)
|
|
{
|
|
chance -= 1 << playerBonusLevel;
|
|
if (chance < 2)
|
|
{
|
|
chance = 2;
|
|
}
|
|
}
|
|
if (level->random->nextInt(chance) == 0)
|
|
{
|
|
popResource(level, x, y, z, std::make_shared<ItemInstance>(Item::stick_Id, 1, 0));
|
|
}
|
|
}
|
|
}
|