the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
at main 128 lines 2.4 kB view raw
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 "Tutorial.h" 6#include "TutorialHint.h" 7#include "..\..\Minecraft.h" 8#include "..\..\MultiplayerLocalPlayer.h" 9 10TutorialHint::TutorialHint(eTutorial_Hint id, Tutorial *tutorial, int descriptionId, eHintType type, bool allowFade /*= true*/) 11 : m_id( id ), m_tutorial(tutorial), m_descriptionId( descriptionId ), m_type( type ), m_counter( 0 ), 12 m_lastTile( NULL ), m_hintNeeded( true ), m_allowFade(allowFade) 13{ 14 tutorial->addMessage(descriptionId, type != e_Hint_NoIngredients); 15} 16 17int TutorialHint::startDestroyBlock(shared_ptr<ItemInstance> item, Tile *tile) 18{ 19 int returnVal = -1; 20 switch(m_type) 21 { 22 case e_Hint_HoldToMine: 23 if( tile == m_lastTile && m_hintNeeded ) 24 { 25 ++m_counter; 26 if(m_counter > TUTORIAL_HINT_MAX_MINE_REPEATS) 27 { 28 returnVal = m_descriptionId; 29 } 30 } 31 else 32 { 33 m_counter = 0; 34 } 35 m_lastTile = tile; 36 break; 37 default: 38 break; 39 } 40 41 return returnVal; 42} 43 44int TutorialHint::destroyBlock(Tile *tile) 45{ 46 int returnVal = -1; 47 switch(m_type) 48 { 49 case e_Hint_HoldToMine: 50 if(tile == m_lastTile && m_counter > 0) 51 { 52 m_hintNeeded = false; 53 } 54 break; 55 default: 56 break; 57 } 58 59 return returnVal; 60} 61 62int TutorialHint::attack(shared_ptr<ItemInstance> item, shared_ptr<Entity> entity) 63{ 64 /* 65 switch(m_type) 66 { 67 default: 68 return -1; 69 } 70 */ 71 return -1; 72} 73 74int TutorialHint::createItemSelected(shared_ptr<ItemInstance> item, bool canMake) 75{ 76 int returnVal = -1; 77 switch(m_type) 78 { 79 case e_Hint_NoIngredients: 80 if(!canMake) 81 returnVal = m_descriptionId; 82 break; 83 default: 84 break; 85 } 86 return returnVal; 87} 88 89int TutorialHint::itemDamaged(shared_ptr<ItemInstance> item) 90{ 91 int returnVal = -1; 92 switch(m_type) 93 { 94 case e_Hint_ToolDamaged: 95 returnVal = m_descriptionId; 96 break; 97 default: 98 break; 99 } 100 return returnVal; 101} 102 103bool TutorialHint::onTake( shared_ptr<ItemInstance> item ) 104{ 105 return false; 106} 107 108bool TutorialHint::onLookAt(int id, int iData) 109{ 110 return false; 111} 112 113bool TutorialHint::onLookAtEntity(eINSTANCEOF type) 114{ 115 return false; 116} 117 118int TutorialHint::tick() 119{ 120 int returnVal = -1; 121 switch(m_type) 122 { 123 case e_Hint_SwimUp: 124 if( Minecraft::GetInstance()->localplayers[m_tutorial->getPad()]->isUnderLiquid(Material::water) ) returnVal = m_descriptionId; 125 break; 126 } 127 return returnVal; 128}