feat: achievements, minecraft store, languages, auto lb sendStats, more Language Strings

This commit is contained in:
Byte
2026-06-23 20:40:27 +02:00
parent 658849b427
commit 028dcdce41
58 changed files with 1649 additions and 375 deletions
+86 -7
View File
@@ -71,11 +71,14 @@
#endif
#include "Common/UI/IUIScene_CreativeMenu.h"
#include "Common/UI/UIFontData.h"
#include "Common/UI/UIComponent_PressStartToPlay.h"
#include "DLCTexturePack.h"
#ifdef __ORBIS__
#include "Orbis/Network/PsPlusUpsellWrapper_Orbis.h"
#endif
// Leaderboards inclusion for the ticker thing
#include "Common/Leaderboards/LeaderboardManager.h"
// #define DISABLE_SPU_CODE
// 4J Turning this on will change the graph at the bottom of the debug overlay to show the number of packets of each type added per fram
@@ -1438,6 +1441,7 @@ void Minecraft::run_middle()
if(InputManager.ButtonPressed(i, MINECRAFT_ACTION_USE)) localplayers[i]->ullButtonsPressed|=1LL<<MINECRAFT_ACTION_USE;
if(InputManager.ButtonPressed(i, MINECRAFT_ACTION_INVENTORY)) localplayers[i]->ullButtonsPressed|=1LL<<MINECRAFT_ACTION_INVENTORY;
if(InputManager.ButtonDown(i, MINECRAFT_ACTION_INVENTORY)) localplayers[i]->ullButtonsDown|=1LL<<MINECRAFT_ACTION_INVENTORY;
if(InputManager.ButtonPressed(i, MINECRAFT_ACTION_ACTION)) localplayers[i]->ullButtonsPressed|=1LL<<MINECRAFT_ACTION_ACTION;
if(InputManager.ButtonPressed(i, MINECRAFT_ACTION_CRAFTING)) localplayers[i]->ullButtonsPressed|=1LL<<MINECRAFT_ACTION_CRAFTING;
if(InputManager.ButtonPressed(i, MINECRAFT_ACTION_PAUSEMENU))
@@ -2293,6 +2297,8 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
//4J-PB - only tick this player's stats
stats[iPad]->tick(iPad);
if (iPad == ProfileManager.GetPrimaryPad())
LeaderboardManager::Instance()->Tick();
// Tick the opacity timer (to display the interface at default opacity for a certain time if the user has been navigating it)
app.TickOpacityTimer(iPad);
@@ -3621,16 +3627,17 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
#else
bool useHeld = InputManager.ButtonDown(iPad, MINECRAFT_ACTION_USE);
#endif
bool achHeld;
if( player->isUsingItem() )
{
if(!useHeld) gameMode->releaseUsingItem(player);
}
else if( gameMode->isInputAllowed(MINECRAFT_ACTION_USE) )
else if (gameMode->isInputAllowed(MINECRAFT_ACTION_USE))
{
if( player->abilities.instabuild )
{
// 4J - attempt to handle click in special creative mode fashion if possible (used for placing blocks at regular intervals)
bool didClick = player->creativeModeHandleMouseClick(1, useHeld );
bool didClick = player->creativeModeHandleMouseClick(1, useHeld);
// If this handler has put us in lastClick_oldRepeat mode then it is because we aren't placing blocks - behave largely as the code used to
if( player->lastClickState == LocalPlayer::lastClick_oldRepeat )
{
@@ -3678,6 +3685,64 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
player->lastClickTick[1] = 0;
}
}
achHeld = InputManager.ButtonDown(iPad, MINECRAFT_ACTION_INVENTORY) ||
(iPad == 0 && g_KBMInput.IsKBMActive() &&
g_KBMInput.IsKeyDown(KeyboardMouseInput::KEY_INVENTORY));
if (ui.toastOn) {
if (achHeld) {
// Record when the hold started
if (player->lastClickTick[2] == 0) {
player->lastClickTick[2] = ticks;
}
// Check if held for 1 second
bool heldLongEnough = (ticks - player->lastClickTick[2]) >= (timer->ticksPerSecond);
if (heldLongEnough) {
ui.PlayUISFX(eSFX_Press);
ui.NavigateToScene(iPad, eUIScene_AchievementsMenu);
ui.getGroups()[static_cast<int>(eUIGroup_Fullscreen)]->getPressStartToPlay()->handleTimerComplete(1);
}
}
else {
// If let go during period, open inventory
if (player->lastClickTick[2] != 0) {
shared_ptr<MultiplayerLocalPlayer> player = Minecraft::GetInstance()->player;
if (!player->isRiding())
{
ui.PlayUISFX(eSFX_Press);
}
if (gameMode->isServerControlledInventory())
{
player->sendOpenInventory();
}
else
{
app.LoadInventoryMenu(iPad, player);
}
}
// Reset when button is released
player->lastClickTick[2] = 0;
}
}
else {
//Just open inventory if the toast is not open
if ((player->ullButtonsPressed & (1LL << MINECRAFT_ACTION_INVENTORY)) && gameMode->isInputAllowed(MINECRAFT_ACTION_INVENTORY))
{
shared_ptr<MultiplayerLocalPlayer> player = Minecraft::GetInstance()->player;
if (!player->isRiding())
{
ui.PlayUISFX(eSFX_Press);
}
if (gameMode->isServerControlledInventory())
{
player->sendOpenInventory();
}
else
{
app.LoadInventoryMenu(iPad, player);
}
}
player->lastClickTick[2] = 0;
}
}
if(app.DebugSettingsOn())
@@ -3750,19 +3815,33 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
if((player->ullButtonsPressed&(1LL<<MINECRAFT_ACTION_INVENTORY)) && gameMode->isInputAllowed(MINECRAFT_ACTION_INVENTORY))
{
shared_ptr<MultiplayerLocalPlayer> player = Minecraft::GetInstance()->player;
if (!player->isRiding())
{
ui.PlayUISFX(eSFX_Press);
if (achHeld) {
//ui.PlayUISFX(eSFX_Press);
//ui.NavigateToScene(iPad, eUIScene_AchievementsMenu);
}
else {
/*shared_ptr<MultiplayerLocalPlayer> player = Minecraft::GetInstance()->player;
if (!player->isRiding())
{
ui.PlayUISFX(eSFX_Press);
}
if(gameMode->isServerControlledInventory())
if(gameMode->isServerControlledInventory())
{
player->sendOpenInventory();
}
else
{
app.LoadInventoryMenu(iPad,player);
if (gameMode->isServerControlledInventory())
{
player->sendOpenInventory();
}
else
{
app.LoadInventoryMenu(iPad, player);
}*/
}
}