mirror of
https://git.neolegacy.dev/neoStudiosLCE/neoLegacy.git
synced 2026-11-19 03:53:03 +01:00
Co-authored-by: DrPerkyLegit <116128211+DrPerkyLegit@users.noreply.github.com> Co-authored-by: github-actions <github-actions@github.com> Co-authored-by: Anaël <60509176+Bakoubak@users.noreply.github.com> Reviewed-on: https://git.neolegacy.dev/neoStudiosLCE/neoLegacy/pulls/4205
185 lines
4.3 KiB
C++
185 lines
4.3 KiB
C++
#include "stdafx.h"
|
|
|
|
#include "IUIScene_BrewingMenu.h"
|
|
#include "../../../Minecraft.World/net.minecraft.world.inventory.h"
|
|
|
|
IUIScene_AbstractContainerMenu::ESceneSection IUIScene_BrewingMenu::GetSectionAndSlotInDirection( ESceneSection eSection, ETapState eTapDirection, int *piTargetX, int *piTargetY )
|
|
{
|
|
ESceneSection newSection = eSection;
|
|
int xOffset = 0;
|
|
|
|
// Find the new section if there is one
|
|
switch( eSection )
|
|
{
|
|
case eSectionBrewingBottle1:
|
|
if(eTapDirection == eTapStateUp)
|
|
{
|
|
newSection = eSectionBrewingIngredient;
|
|
}
|
|
else if(eTapDirection == eTapStateDown)
|
|
{
|
|
newSection = eSectionBrewingInventory;
|
|
xOffset = BREWING_SCENE_BOTTLE1_SLOT_DOWN_OFFSET;
|
|
}
|
|
else if(eTapDirection == eTapStateLeft)
|
|
{
|
|
newSection = eSectionBrewingBottle3;
|
|
}
|
|
else if(eTapDirection == eTapStateRight)
|
|
{
|
|
newSection = eSectionBrewingBottle2;
|
|
}
|
|
break;
|
|
case eSectionBrewingBottle2:
|
|
if(eTapDirection == eTapStateUp)
|
|
{
|
|
newSection = eSectionBrewingIngredient;
|
|
}
|
|
else if(eTapDirection == eTapStateDown)
|
|
{
|
|
newSection = eSectionBrewingInventory;
|
|
xOffset = BREWING_SCENE_BOTTLE2_SLOT_DOWN_OFFSET;
|
|
}
|
|
else if(eTapDirection == eTapStateLeft)
|
|
{
|
|
newSection = eSectionBrewingBottle1;
|
|
}
|
|
else if(eTapDirection == eTapStateRight)
|
|
{
|
|
newSection = eSectionBrewingBottle3;
|
|
}
|
|
break;
|
|
case eSectionBrewingBottle3:
|
|
if(eTapDirection == eTapStateUp)
|
|
{
|
|
newSection = eSectionBrewingIngredient;
|
|
}
|
|
else if(eTapDirection == eTapStateDown)
|
|
{
|
|
newSection = eSectionBrewingInventory;
|
|
xOffset = BREWING_SCENE_BOTTLE3_SLOT_DOWN_OFFSET;
|
|
}
|
|
else if(eTapDirection == eTapStateLeft)
|
|
{
|
|
newSection = eSectionBrewingBottle2;
|
|
}
|
|
else if(eTapDirection == eTapStateRight)
|
|
{
|
|
newSection = eSectionBrewingBottle1;
|
|
}
|
|
break;
|
|
case eSectionBrewingPlate:
|
|
if (eTapDirection == eTapStateRight)
|
|
{
|
|
newSection = eSectionBrewingIngredient;
|
|
}
|
|
else if (eTapDirection == eTapStateDown)
|
|
{
|
|
newSection = eSectionBrewingBottle1;
|
|
}
|
|
else if (eTapDirection == eTapStateUp)
|
|
{
|
|
newSection = eSectionBrewingUsing;
|
|
xOffset = BREWING_SCENE_PLATE_SLOT_UP_OFFSET;
|
|
}
|
|
break;
|
|
|
|
case eSectionBrewingIngredient:
|
|
if(eTapDirection == eTapStateUp)
|
|
{
|
|
newSection = eSectionBrewingUsing;
|
|
xOffset = BREWING_SCENE_INGREDIENT_SLOT_DOWN_OFFSET;
|
|
}
|
|
else if(eTapDirection == eTapStateDown)
|
|
{
|
|
newSection = eSectionBrewingBottle2;
|
|
}
|
|
else if (eTapDirection == eTapStateLeft)
|
|
{
|
|
newSection = eSectionBrewingPlate;
|
|
}
|
|
break;
|
|
case eSectionBrewingInventory:
|
|
if(eTapDirection == eTapStateDown)
|
|
{
|
|
newSection = eSectionBrewingUsing;
|
|
}
|
|
else if(eTapDirection == eTapStateUp)
|
|
{
|
|
if (*piTargetX <= BREWING_SCENE_PLATE_SLOT_UP_THRESHOLD)
|
|
{
|
|
newSection = eSectionBrewingPlate;
|
|
}
|
|
else if( *piTargetX <= BREWING_SCENE_BOTTLE1_SLOT_UP_OFFSET)
|
|
{
|
|
newSection = eSectionBrewingBottle1;
|
|
}
|
|
else if( *piTargetX <= BREWING_SCENE_BOTTLE2_SLOT_UP_OFFSET)
|
|
{
|
|
newSection = eSectionBrewingBottle2;
|
|
}
|
|
else if( *piTargetX >= BREWING_SCENE_BOTTLE3_SLOT_UP_OFFSET)
|
|
{
|
|
newSection = eSectionBrewingBottle3;
|
|
}
|
|
}
|
|
break;
|
|
case eSectionBrewingUsing:
|
|
if(eTapDirection == eTapStateUp)
|
|
{
|
|
newSection = eSectionBrewingInventory;
|
|
}
|
|
else if(eTapDirection == eTapStateDown)
|
|
{
|
|
if (*piTargetX <= BREWING_SCENE_PLATE_SLOT_UP_OFFSET)
|
|
{
|
|
newSection = eSectionBrewingPlate;
|
|
}
|
|
else
|
|
{
|
|
newSection = eSectionBrewingIngredient;
|
|
}
|
|
}
|
|
break;
|
|
default:
|
|
assert( false );
|
|
break;
|
|
}
|
|
|
|
updateSlotPosition(eSection, newSection, eTapDirection, piTargetX, piTargetY, xOffset);
|
|
|
|
return newSection;
|
|
}
|
|
|
|
int IUIScene_BrewingMenu::getSectionStartOffset(ESceneSection eSection)
|
|
{
|
|
int offset = 0;
|
|
switch( eSection )
|
|
{
|
|
case eSectionBrewingBottle1:
|
|
offset = BrewingStandMenu::BOTTLE_SLOT_START;
|
|
break;
|
|
case eSectionBrewingBottle2:
|
|
offset = BrewingStandMenu::BOTTLE_SLOT_START + 1;
|
|
break;
|
|
case eSectionBrewingBottle3:
|
|
offset = BrewingStandMenu::BOTTLE_SLOT_START + 2;
|
|
break;
|
|
case eSectionBrewingPlate:
|
|
offset = BrewingStandMenu::FUEL_SLOT;
|
|
break;
|
|
case eSectionBrewingIngredient:
|
|
offset = BrewingStandMenu::INGREDIENT_SLOT;
|
|
break;
|
|
case eSectionBrewingInventory:
|
|
offset = BrewingStandMenu::INV_SLOT_START;
|
|
break;
|
|
case eSectionBrewingUsing:
|
|
offset = BrewingStandMenu::INV_SLOT_START + 27;
|
|
break;
|
|
default:
|
|
assert( false );
|
|
break;
|
|
}
|
|
return offset;
|
|
} |