the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
at main 47 lines 1.1 kB view raw
1#include "stdafx.h" 2#include "net.minecraft.world.entity.animal.h" 3#include "net.minecraft.world.entity.player.h" 4#include "net.minecraft.world.entity.ai.goal.h" 5#include "net.minecraft.world.item.h" 6#include "CarrotOnAStickItem.h" 7 8CarrotOnAStickItem::CarrotOnAStickItem(int id) : Item(id) 9{ 10 setMaxStackSize(1); 11 setMaxDamage(25); 12} 13 14bool CarrotOnAStickItem::isHandEquipped() 15{ 16 return true; 17} 18 19bool CarrotOnAStickItem::isMirroredArt() 20{ 21 return true; 22} 23 24shared_ptr<ItemInstance> CarrotOnAStickItem::use(shared_ptr<ItemInstance> itemInstance, Level *level, shared_ptr<Player> player) 25{ 26 if (player->isRiding()) 27 { 28 shared_ptr<Pig> pig = dynamic_pointer_cast<Pig>(player->riding); 29 if(pig) 30 { 31 if (pig->getControlGoal()->canBoost() && itemInstance->getMaxDamage() - itemInstance->getAuxValue() >= 7) 32 { 33 pig->getControlGoal()->boost(); 34 itemInstance->hurtAndBreak(7, player); 35 36 if (itemInstance->count == 0) 37 { 38 shared_ptr<ItemInstance> replacement = shared_ptr<ItemInstance>(new ItemInstance(Item::fishingRod)); 39 replacement->setTag(itemInstance->tag); 40 return replacement; 41 } 42 } 43 } 44 } 45 46 return itemInstance; 47}