blob: 8c8ea674caf06a2f5c050f42511ab5e267913fbf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
#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);
}
shared_ptr<ItemInstance> MilkBucketItem::useTimeDepleted(shared_ptr<ItemInstance> instance, Level *level, shared_ptr<Player> player)
{
if (!player->abilities.instabuild) instance->count--;
if (!level->isClientSide)
{
player->removeAllEffects();
}
if (instance->count <= 0)
{
return std::make_shared<ItemInstance>(Item::bucket_empty);
}
return instance;
}
int MilkBucketItem::getUseDuration(shared_ptr<ItemInstance> itemInstance)
{
return DRINK_DURATION;
}
UseAnim MilkBucketItem::getUseAnimation(shared_ptr<ItemInstance> itemInstance)
{
return UseAnim_drink;
}
shared_ptr<ItemInstance> MilkBucketItem::use(shared_ptr<ItemInstance> instance, Level *level, shared_ptr<Player> player)
{
player->startUsingItem(instance, getUseDuration(instance));
return instance;
}
|