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.network.packet.h"
3#include "net.minecraft.world.entity.h"
4#include "net.minecraft.world.entity.player.h"
5#include "net.minecraft.world.level.h"
6#include "net.minecraft.world.level.chunk.h"
7#include "net.minecraft.world.level.material.h"
8#include "net.minecraft.world.level.saveddata.h"
9#include "net.minecraft.world.level.tile.h"
10#include "net.minecraft.world.entity.projectile.h"
11#include "net.minecraft.world.h"
12#include "ItemInstance.h"
13#include "FishingRodItem.h"
14#include "SoundTypes.h"
15
16FishingRodItem::FishingRodItem(int id) : Item(id)
17{
18 setMaxDamage(64);
19 setMaxStackSize(1);
20 emptyIcon = NULL;
21}
22
23bool FishingRodItem::isHandEquipped()
24{
25 return true;
26}
27
28bool FishingRodItem::isMirroredArt()
29{
30 return true;
31}
32
33shared_ptr<ItemInstance> FishingRodItem::use(shared_ptr<ItemInstance> instance, Level *level, shared_ptr<Player> player)
34{
35 if (player->fishing != NULL)
36 {
37 int dmg = player->fishing->retrieve();
38 instance->hurtAndBreak(dmg, player);
39 player->swing();
40 }
41 else
42 {
43 level->playEntitySound(player, eSoundType_RANDOM_BOW, 0.5f, 0.4f / (random->nextFloat() * 0.4f + 0.8f));
44 if (!level->isClientSide)
45 {
46 // 4J Stu - Move the player->fishing out of the ctor as we cannot reference 'this'
47 shared_ptr<FishingHook> hook = shared_ptr<FishingHook>( new FishingHook(level, player) );
48 player->fishing = hook;
49 level->addEntity( shared_ptr<FishingHook>( hook ) );
50 }
51 player->swing();
52 }
53 return instance;
54}
55
56void FishingRodItem::registerIcons(IconRegister *iconRegister)
57{
58 icon = iconRegister->registerIcon(getIconName() + L"_uncast");
59 emptyIcon = iconRegister->registerIcon(getIconName() + L"_cast");
60}
61
62Icon *FishingRodItem::getEmptyIcon()
63{
64 return emptyIcon;
65}