the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
1#include "stdafx.h"
2#include "net.minecraft.world.entity.animal.h"
3#include "net.minecraft.world.item.h"
4#include "net.minecraft.world.entity.h"
5#include "SaddleItem.h"
6
7SaddleItem::SaddleItem(int id) : Item(id)
8{
9 maxStackSize = 1;
10}
11
12bool SaddleItem::interactEnemy(shared_ptr<ItemInstance> itemInstance, shared_ptr<Player> player, shared_ptr<LivingEntity> mob)
13{
14 if ( (mob != NULL) && mob->instanceof(eTYPE_PIG) )
15 {
16 shared_ptr<Pig> pig = dynamic_pointer_cast<Pig>(mob);
17 if (!pig->hasSaddle() && !pig->isBaby())
18 {
19 pig->setSaddle(true);
20 itemInstance->count--;
21 }
22 return true;
23 }
24 return false;
25}
26
27bool SaddleItem::hurtEnemy(shared_ptr<ItemInstance> itemInstance, shared_ptr<LivingEntity> mob, shared_ptr<LivingEntity> attacker)
28{
29 interactEnemy(itemInstance, nullptr, mob);
30 return true;
31}