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