mirror of
https://github.com/4jcraft/4jcraft.git
synced 2026-05-24 16:52:52 +00:00
feat(Linux): Add Linux interface
This commit is contained in:
parent
5280c491e0
commit
81b10b245a
|
|
@ -2453,6 +2453,7 @@ set(ALL_FILES
|
|||
${net__minecraft__server__network}
|
||||
${net__minecraft__stats}
|
||||
Linux/Linux_UIController.cpp
|
||||
Linux/Linux_Minecraft.cpp
|
||||
)
|
||||
|
||||
################################################################################
|
||||
|
|
|
|||
136
Minecraft.Client/Linux/Linux_App.cpp
Normal file
136
Minecraft.Client/Linux/Linux_App.cpp
Normal file
|
|
@ -0,0 +1,136 @@
|
|||
#include "../../Minecraft.World/stdafx.h"
|
||||
#include "../Common/Consoles_App.h"
|
||||
#include "../User.h"
|
||||
#include "../../Minecraft.Client/Minecraft.h"
|
||||
#include "../../Minecraft.Client/MinecraftServer.h"
|
||||
#include "../../Minecraft.Client/PlayerList.h"
|
||||
#include "../../Minecraft.Client/ServerPlayer.h"
|
||||
#include "../../Minecraft.World/Level.h"
|
||||
#include "../../Minecraft.World/LevelSettings.h"
|
||||
#include "../../Minecraft.World/BiomeSource.h"
|
||||
#include "../../Minecraft.World/LevelType.h"
|
||||
#include "Linux_App.h"
|
||||
|
||||
CConsoleMinecraftApp app;
|
||||
|
||||
#define CONTEXT_GAME_STATE 0
|
||||
|
||||
CConsoleMinecraftApp::CConsoleMinecraftApp() : CMinecraftApp()
|
||||
{
|
||||
}
|
||||
|
||||
void CConsoleMinecraftApp::SetRichPresenceContext(int iPad, int contextId)
|
||||
{
|
||||
ProfileManager.SetRichPresenceContextValue(iPad,CONTEXT_GAME_STATE,contextId);
|
||||
}
|
||||
|
||||
void CConsoleMinecraftApp::StoreLaunchData()
|
||||
{
|
||||
}
|
||||
void CConsoleMinecraftApp::ExitGame()
|
||||
{
|
||||
}
|
||||
void CConsoleMinecraftApp::FatalLoadError()
|
||||
{
|
||||
}
|
||||
|
||||
void CConsoleMinecraftApp::CaptureSaveThumbnail()
|
||||
{
|
||||
}
|
||||
void CConsoleMinecraftApp::GetSaveThumbnail(PBYTE *pbData,DWORD *pdwSize)
|
||||
{
|
||||
}
|
||||
void CConsoleMinecraftApp::ReleaseSaveThumbnail()
|
||||
{
|
||||
}
|
||||
|
||||
void CConsoleMinecraftApp::GetScreenshot(int iPad,PBYTE *pbData,DWORD *pdwSize)
|
||||
{
|
||||
}
|
||||
|
||||
void CConsoleMinecraftApp::TemporaryCreateGameStart()
|
||||
{
|
||||
////////////////////////////////////////////////////////////////////////////////////////////// From CScene_Main::OnInit
|
||||
|
||||
app.setLevelGenerationOptions(NULL);
|
||||
|
||||
// From CScene_Main::RunPlayGame
|
||||
Minecraft *pMinecraft=Minecraft::GetInstance();
|
||||
app.ReleaseSaveThumbnail();
|
||||
ProfileManager.SetLockedProfile(0);
|
||||
pMinecraft->user->name = L"Windows";
|
||||
app.ApplyGameSettingsChanged(0);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////// From CScene_MultiGameJoinLoad::OnInit
|
||||
MinecraftServer::resetFlags();
|
||||
|
||||
// From CScene_MultiGameJoinLoad::OnNotifyPressEx
|
||||
app.SetTutorialMode( false );
|
||||
app.SetCorruptSaveDeleted(false);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////// From CScene_MultiGameCreate::CreateGame
|
||||
|
||||
app.ClearTerrainFeaturePosition();
|
||||
wstring wWorldName = L"TestWorld";
|
||||
|
||||
StorageManager.ResetSaveData();
|
||||
StorageManager.SetSaveTitle(wWorldName.c_str());
|
||||
|
||||
bool isFlat = false;
|
||||
__int64 seedValue = 0; // BiomeSource::findSeed(isFlat?LevelType::lvl_flat:LevelType::lvl_normal); // 4J - was (new Random())->nextLong() - now trying to actually find a seed to suit our requirements
|
||||
|
||||
NetworkGameInitData *param = new NetworkGameInitData();
|
||||
param->seed = seedValue;
|
||||
param->saveData = NULL;
|
||||
|
||||
app.SetGameHostOption(eGameHostOption_Difficulty,0);
|
||||
app.SetGameHostOption(eGameHostOption_FriendsOfFriends,0);
|
||||
app.SetGameHostOption(eGameHostOption_Gamertags,1);
|
||||
app.SetGameHostOption(eGameHostOption_BedrockFog,1);
|
||||
|
||||
app.SetGameHostOption(eGameHostOption_GameType,GameType::CREATIVE->getId() ); // LevelSettings::GAMETYPE_SURVIVAL
|
||||
app.SetGameHostOption(eGameHostOption_LevelType, 0 );
|
||||
app.SetGameHostOption(eGameHostOption_Structures, 1 );
|
||||
app.SetGameHostOption(eGameHostOption_BonusChest, 0 );
|
||||
|
||||
app.SetGameHostOption(eGameHostOption_PvP, 1);
|
||||
app.SetGameHostOption(eGameHostOption_TrustPlayers, 1 );
|
||||
app.SetGameHostOption(eGameHostOption_FireSpreads, 1 );
|
||||
app.SetGameHostOption(eGameHostOption_TNT, 1 );
|
||||
app.SetGameHostOption(eGameHostOption_HostCanFly, 1);
|
||||
app.SetGameHostOption(eGameHostOption_HostCanChangeHunger, 1);
|
||||
app.SetGameHostOption(eGameHostOption_HostCanBeInvisible, 1 );
|
||||
|
||||
param->settings = app.GetGameHostOption( eGameHostOption_All );
|
||||
|
||||
g_NetworkManager.FakeLocalPlayerJoined();
|
||||
|
||||
LoadingInputParams *loadingParams = new LoadingInputParams();
|
||||
loadingParams->func = &CGameNetworkManager::RunNetworkGameThreadProc;
|
||||
loadingParams->lpParam = (LPVOID)param;
|
||||
|
||||
// Reset the autosave time
|
||||
app.SetAutosaveTimerTime();
|
||||
|
||||
C4JThread* thread = new C4JThread(loadingParams->func, loadingParams->lpParam, "RunNetworkGame");
|
||||
thread->Run();
|
||||
}
|
||||
|
||||
int CConsoleMinecraftApp::GetLocalTMSFileIndex(WCHAR *wchTMSFile,bool bFilenameIncludesExtension,eFileExtensionType eEXT)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
int CConsoleMinecraftApp::LoadLocalTMSFile(WCHAR *wchTMSFile)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
int CConsoleMinecraftApp::LoadLocalTMSFile(WCHAR *wchTMSFile, eFileExtensionType eExt)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
void CConsoleMinecraftApp::FreeLocalTMSFiles(eTMSFileType eType)
|
||||
{
|
||||
}
|
||||
34
Minecraft.Client/Linux/Linux_App.h
Normal file
34
Minecraft.Client/Linux/Linux_App.h
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
#pragma once
|
||||
|
||||
class CConsoleMinecraftApp : public CMinecraftApp
|
||||
{
|
||||
public:
|
||||
CConsoleMinecraftApp();
|
||||
|
||||
virtual void SetRichPresenceContext(int iPad, int contextId);
|
||||
|
||||
virtual void StoreLaunchData();
|
||||
virtual void ExitGame();
|
||||
virtual void FatalLoadError();
|
||||
|
||||
virtual void CaptureSaveThumbnail();
|
||||
virtual void GetSaveThumbnail(PBYTE*,DWORD*);
|
||||
virtual void ReleaseSaveThumbnail();
|
||||
virtual void GetScreenshot(int iPad,PBYTE *pbData,DWORD *pdwSize);
|
||||
|
||||
virtual int LoadLocalTMSFile(WCHAR *wchTMSFile);
|
||||
virtual int LoadLocalTMSFile(WCHAR *wchTMSFile, eFileExtensionType eExt);
|
||||
|
||||
virtual void FreeLocalTMSFiles(eTMSFileType eType);
|
||||
virtual int GetLocalTMSFileIndex(WCHAR *wchTMSFile,bool bFilenameIncludesExtension,eFileExtensionType eEXT=eFileExtensionType_PNG);
|
||||
|
||||
// BANNED LEVEL LIST
|
||||
virtual void ReadBannedList(int iPad, eTMSAction action=(eTMSAction)0, bool bCallback=false) {}
|
||||
|
||||
C4JStringTable *GetStringTable() { return NULL;}
|
||||
|
||||
// original code
|
||||
virtual void TemporaryCreateGameStart();
|
||||
};
|
||||
|
||||
extern CConsoleMinecraftApp app;
|
||||
1155
Minecraft.Client/Linux/Linux_Minecraft.cpp
Normal file
1155
Minecraft.Client/Linux/Linux_Minecraft.cpp
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue