This is one of the first commits in a plan to remove all `using namespace std;` lines in the entire codebase as it is considered anti-pattern today.
41 lines
1.0 KiB
C++
41 lines
1.0 KiB
C++
#include "stdafx.h"
|
|
#include "net.minecraft.world.level.h"
|
|
#include "net.minecraft.world.entity.player.h"
|
|
#include "MilkBucketItem.h"
|
|
|
|
MilkBucketItem::MilkBucketItem(int id) : Item( id )
|
|
{
|
|
setMaxStackSize(1);
|
|
}
|
|
|
|
std::shared_ptr<ItemInstance> MilkBucketItem::useTimeDepleted(std::shared_ptr<ItemInstance> instance, Level *level, std::shared_ptr<Player> player)
|
|
{
|
|
if (!player->abilities.instabuild) instance->count--;
|
|
|
|
if (!level->isClientSide)
|
|
{
|
|
player->removeAllEffects();
|
|
}
|
|
|
|
if (instance->count <= 0)
|
|
{
|
|
return std::shared_ptr<ItemInstance>( new ItemInstance(Item::bucket_empty) );
|
|
}
|
|
return instance;
|
|
}
|
|
|
|
int MilkBucketItem::getUseDuration(std::shared_ptr<ItemInstance> itemInstance)
|
|
{
|
|
return DRINK_DURATION;
|
|
}
|
|
|
|
UseAnim MilkBucketItem::getUseAnimation(std::shared_ptr<ItemInstance> itemInstance)
|
|
{
|
|
return UseAnim_drink;
|
|
}
|
|
|
|
std::shared_ptr<ItemInstance> MilkBucketItem::use(std::shared_ptr<ItemInstance> instance, Level *level, std::shared_ptr<Player> player)
|
|
{
|
|
player->startUsingItem(instance, getUseDuration(instance));
|
|
return instance;
|
|
} |