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 "..\..\..\Minecraft.World\net.minecraft.world.level.h"
3#include "..\..\..\Minecraft.World\net.minecraft.world.level.tile.h"
4#include "..\..\..\Minecraft.World\net.minecraft.world.item.h"
5#include "..\..\..\Minecraft.World\net.minecraft.world.entity.h"
6#include "Tutorial.h"
7#include "DiggerItemHint.h"
8
9
10DiggerItemHint::DiggerItemHint(eTutorial_Hint id, Tutorial *tutorial, int descriptionId, int items[], unsigned int itemsLength)
11 : TutorialHint(id, tutorial, descriptionId, e_Hint_DiggerItem)
12{
13 m_iItemsCount = itemsLength;
14
15 m_iItems= new int [m_iItemsCount];
16 for(unsigned int i=0;i<m_iItemsCount;i++)
17 {
18 m_iItems[i]=items[i];
19 }
20 tutorial->addMessage(IDS_TUTORIAL_HINT_ATTACK_WITH_TOOL, true);
21}
22
23int DiggerItemHint::startDestroyBlock(shared_ptr<ItemInstance> item, Tile *tile)
24{
25 if(item != NULL)
26 {
27 bool itemFound = false;
28 for(unsigned int i=0;i<m_iItemsCount;i++)
29 {
30 if(item->id == m_iItems[i])
31 {
32 itemFound = true;
33 break;
34 }
35 }
36 if(itemFound)
37 {
38 float speed = item->getDestroySpeed(tile);
39 if(speed == 1)
40 {
41 // Display hint
42 return m_descriptionId;
43 }
44 }
45 }
46 return -1;
47}
48
49int DiggerItemHint::attack(shared_ptr<ItemInstance> item, shared_ptr<Entity> entity)
50{
51 if(item != NULL)
52 {
53 bool itemFound = false;
54 for(unsigned int i=0;i<m_iItemsCount;i++)
55 {
56 if(item->id == m_iItems[i])
57 {
58 itemFound = true;
59 break;
60 }
61 }
62 if(itemFound)
63 {
64 // It's also possible that we could hit TileEntities (eg falling sand) so don't want to give this hint then
65 if( entity->instanceof(eTYPE_MOB) )
66 {
67 return IDS_TUTORIAL_HINT_ATTACK_WITH_TOOL;
68 }
69 else
70 {
71 return -1;
72 }
73 }
74 }
75 return -1;
76}