the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
at main 129 lines 2.9 kB view raw
1#include "stdafx.h" 2 3#include "IUIScene_FireworksMenu.h" 4#include "..\..\..\Minecraft.World\net.minecraft.world.inventory.h" 5 6IUIScene_AbstractContainerMenu::ESceneSection IUIScene_FireworksMenu::GetSectionAndSlotInDirection( ESceneSection eSection, ETapState eTapDirection, int *piTargetX, int *piTargetY ) 7{ 8 ESceneSection newSection = eSection; 9 int xOffset = 0; 10 int yOffset = 0; 11 12 // Find the new section if there is one 13 switch( eSection ) 14 { 15 case eSectionFireworksIngredients: 16 if(eTapDirection == eTapStateDown) 17 { 18 newSection = eSectionFireworksInventory; 19 xOffset = -1; 20 } 21 else if(eTapDirection == eTapStateUp) 22 { 23 newSection = eSectionFireworksUsing; 24 xOffset = -1; 25 } 26 else if(eTapDirection == eTapStateLeft) 27 { 28 newSection = eSectionFireworksResult; 29 } 30 else if(eTapDirection == eTapStateRight) 31 { 32 newSection = eSectionFireworksResult; 33 } 34 break; 35 case eSectionFireworksResult: 36 if(eTapDirection == eTapStateDown) 37 { 38 newSection = eSectionFireworksInventory; 39 xOffset = -7; 40 } 41 else if(eTapDirection == eTapStateUp) 42 { 43 newSection = eSectionFireworksUsing; 44 xOffset = -7; 45 } 46 else if(eTapDirection == eTapStateLeft) 47 { 48 newSection = eSectionFireworksIngredients; 49 yOffset = -1; 50 *piTargetX = getSectionColumns(eSectionFireworksIngredients); 51 } 52 else if(eTapDirection == eTapStateRight) 53 { 54 newSection = eSectionFireworksIngredients; 55 yOffset = -1; 56 *piTargetX = 0; 57 } 58 break; 59 case eSectionFireworksInventory: 60 if(eTapDirection == eTapStateDown) 61 { 62 newSection = eSectionFireworksUsing; 63 } 64 else if(eTapDirection == eTapStateUp) 65 { 66 if(*piTargetX < 6) 67 { 68 newSection = eSectionFireworksIngredients; 69 xOffset = 1; 70 } 71 else 72 { 73 newSection = eSectionFireworksResult; 74 } 75 } 76 break; 77 case eSectionFireworksUsing: 78 if(eTapDirection == eTapStateDown) 79 { 80 if(*piTargetX < 6) 81 { 82 newSection = eSectionFireworksIngredients; 83 xOffset = 1; 84 } 85 else 86 { 87 newSection = eSectionFireworksResult; 88 } 89 } 90 else if(eTapDirection == eTapStateUp) 91 { 92 newSection = eSectionFireworksInventory; 93 } 94 break; 95 default: 96 assert( false ); 97 break; 98 } 99 100 updateSlotPosition(eSection, newSection, eTapDirection, piTargetX, piTargetY, xOffset, yOffset); 101 102 return newSection; 103} 104 105int IUIScene_FireworksMenu::getSectionStartOffset(ESceneSection eSection) 106{ 107 int offset = 0; 108 switch( eSection ) 109 { 110 111 case eSectionFireworksIngredients: 112 offset = FireworksMenu::CRAFT_SLOT_START; 113 break; 114 115 case eSectionFireworksResult: 116 offset = FireworksMenu::RESULT_SLOT; 117 break; 118 case eSectionFireworksInventory: 119 offset = FireworksMenu::INV_SLOT_START; 120 break; 121 case eSectionFireworksUsing: 122 offset = FireworksMenu::INV_SLOT_START + 27; 123 break; 124 default: 125 assert( false ); 126 break; 127 } 128 return offset; 129}