the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
at main 141 lines 3.3 kB view raw
1#include "stdafx.h" 2 3#include "IUIScene_FurnaceMenu.h" 4#include "..\..\..\Minecraft.World\net.minecraft.world.inventory.h" 5 6IUIScene_AbstractContainerMenu::ESceneSection IUIScene_FurnaceMenu::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 eSectionFurnaceResult: 15 if(eTapDirection == eTapStateUp) 16 { 17 newSection = eSectionFurnaceUsing; 18 xOffset = FURNACE_SCENE_RESULT_SLOT_DOWN_OFFSET; 19 } 20 else if(eTapDirection == eTapStateDown) 21 { 22 newSection = eSectionFurnaceInventory; 23 xOffset = FURNACE_SCENE_RESULT_SLOT_DOWN_OFFSET; 24 } 25 else if(eTapDirection == eTapStateLeft) 26 { 27 newSection = eSectionFurnaceIngredient; 28 } 29 else if(eTapDirection == eTapStateRight) 30 { 31 newSection = eSectionFurnaceIngredient; 32 } 33 break; 34 case eSectionFurnaceIngredient: 35 if(eTapDirection == eTapStateUp) 36 { 37 newSection = eSectionFurnaceUsing; 38 xOffset = FURNACE_SCENE_FUEL_SLOT_DOWN_OFFSET; 39 } 40 else if(eTapDirection == eTapStateDown) 41 { 42 newSection = eSectionFurnaceFuel; 43 } 44 else if(eTapDirection == eTapStateLeft) 45 { 46 newSection = eSectionFurnaceResult; 47 } 48 else if(eTapDirection == eTapStateRight) 49 { 50 newSection = eSectionFurnaceResult; 51 } 52 break; 53 case eSectionFurnaceFuel: 54 if(eTapDirection == eTapStateDown) 55 { 56 newSection = eSectionFurnaceInventory; 57 xOffset = FURNACE_SCENE_FUEL_SLOT_DOWN_OFFSET; 58 } 59 else if(eTapDirection == eTapStateUp) 60 { 61 newSection = eSectionFurnaceIngredient; 62 } 63 else if(eTapDirection == eTapStateLeft) 64 { 65 newSection = eSectionFurnaceResult; 66 } 67 else if(eTapDirection == eTapStateRight) 68 { 69 newSection = eSectionFurnaceResult; 70 } 71 break; 72 case eSectionFurnaceInventory: 73 if(eTapDirection == eTapStateDown) 74 { 75 newSection = eSectionFurnaceUsing; 76 } 77 else if(eTapDirection == eTapStateUp) 78 { 79 if( *piTargetX >= FURNACE_SCENE_RESULT_SLOT_UP_OFFSET) 80 { 81 newSection = eSectionFurnaceResult; 82 } 83 else 84 { 85 newSection = eSectionFurnaceFuel; 86 } 87 } 88 break; 89 case eSectionFurnaceUsing: 90 if(eTapDirection == eTapStateUp) 91 { 92 newSection = eSectionFurnaceInventory; 93 } 94 else if(eTapDirection == eTapStateDown) 95 { 96 if( *piTargetX >= FURNACE_SCENE_RESULT_SLOT_UP_OFFSET) 97 { 98 newSection = eSectionFurnaceResult; 99 } 100 else 101 { 102 newSection = eSectionFurnaceIngredient; 103 } 104 } 105 break; 106 default: 107 assert( false ); 108 break; 109 } 110 111 updateSlotPosition(eSection, newSection, eTapDirection, piTargetX, piTargetY, xOffset); 112 113 return newSection; 114} 115 116int IUIScene_FurnaceMenu::getSectionStartOffset(ESceneSection eSection) 117{ 118 int offset = 0; 119 switch( eSection ) 120 { 121 case eSectionFurnaceResult: 122 offset = FurnaceMenu::RESULT_SLOT; 123 break; 124 case eSectionFurnaceFuel: 125 offset = FurnaceMenu::FUEL_SLOT; 126 break; 127 case eSectionFurnaceIngredient: 128 offset = FurnaceMenu::INGREDIENT_SLOT; 129 break; 130 case eSectionFurnaceInventory: 131 offset = FurnaceMenu::INV_SLOT_START; 132 break; 133 case eSectionFurnaceUsing: 134 offset = FurnaceMenu::INV_SLOT_START + 27; 135 break; 136 default: 137 assert( false ); 138 break; 139 } 140 return offset; 141}