server compilable

This commit is contained in:
Kolyah35
2026-03-26 03:48:08 +03:00
parent cbd81b47ce
commit a45c01d013
96 changed files with 3344 additions and 7975 deletions

View File

@@ -22,7 +22,7 @@
//static NinePatchLayer* guiPaneFrame = NULL;
static __inline void setIfNotSet(bool& ref, bool condition) {
static inline void setIfNotSet(bool& ref, bool condition) {
ref = (ref || condition);
}

View File

@@ -9,7 +9,7 @@
#include "../Gui.h"
#include "../../renderer/Textures.h"
#include "../../gamemode/GameMode.h"
#include <gamemode/GameMode.h>
#include "ArmorScreen.h"
#include "../components/Button.h"

View File

@@ -1,55 +0,0 @@
#include "RenameMPLevelScreen.h"
#include "StartMenuScreen.h"
#include "DialogDefinitions.h"
#include "../Gui.h"
#include "../../Minecraft.h"
#include "../../../AppPlatform.h"
#include "../../../platform/log.h"
#include "../../../world/level/storage/LevelStorageSource.h"
static char ILLEGAL_FILE_CHARACTERS[] = {
'/', '\n', '\r', '\t', '\0', '\f', '`', '?', '*', '\\', '<', '>', '|', '\"', ':'
};
RenameMPLevelScreen::RenameMPLevelScreen( const std::string& levelId )
: _levelId(levelId)
{
}
void RenameMPLevelScreen::init() {
minecraft->platform()->createUserInput(DialogDefinitions::DIALOG_RENAME_MP_WORLD);
}
void RenameMPLevelScreen::render(int xm, int ym, float a)
{
renderBackground();
#ifdef WIN32
minecraft->getLevelSource()->renameLevel(_levelId, "Save?Level");
minecraft->screenChooser.setScreen(SCREEN_STARTMENU);
#else
int status = minecraft->platform()->getUserInputStatus();
if (status > -1) {
if (status == 1) {
std::vector<std::string> v = minecraft->platform()->getUserInput();
if (!v.empty()) {
// Read the level name.
// 1) Trim name 2) Remove all bad chars -) We don't have to getUniqueLevelName, since renameLevel will do that
std::string levelId = v[0];
for (int i = 0; i < sizeof(ILLEGAL_FILE_CHARACTERS) / sizeof(char); ++i)
levelId = Util::stringReplace(levelId, std::string(1, ILLEGAL_FILE_CHARACTERS[i]), "");
if ((int)levelId.length() == 0) {
levelId = "saved_world";
}
minecraft->getLevelSource()->renameLevel(_levelId, levelId);
}
}
minecraft->screenChooser.setScreen(SCREEN_STARTMENU);
}
#endif
}

View File

@@ -1,18 +0,0 @@
#ifndef NET_MINECRAFT_CLIENT_GUI_SCREENS__RenameMPLevelScreen_H__
#define NET_MINECRAFT_CLIENT_GUI_SCREENS__RenameMPLevelScreen_H__
#include "../Screen.h"
class RenameMPLevelScreen: public Screen
{
public:
RenameMPLevelScreen(const std::string& levelId);
virtual void init();
virtual void render(int xm, int ym, float a);
private:
std::string _levelId;
};
#endif /*NET_MINECRAFT_CLIENT_GUI_SCREENS__RenameMPLevelScreen_H__*/

View File

@@ -1,5 +1,6 @@
#include "ScreenChooser.h"
#include "StartMenuScreen.h"
#include "MinecraftClient.h"
#include "SelectWorldScreen.h"
#include "JoinGameScreen.h"
#include "PauseScreen.h"
@@ -58,6 +59,6 @@ Screen* ScreenChooser::createScreen( ScreenId id )
Screen* ScreenChooser::setScreen(ScreenId id)
{
Screen* screen = createScreen(id);
_mc->setScreen(screen);
_mc.setScreen(screen);
return screen;
}

View File

@@ -14,19 +14,17 @@ enum ScreenId {
};
class Screen;
class Minecraft;
class MinecraftClient;
class ScreenChooser
{
public:
ScreenChooser(Minecraft* mc)
: _mc(mc)
{}
ScreenChooser(MinecraftClient& mc) : _mc(mc) {}
Screen* createScreen(ScreenId id);
Screen* setScreen(ScreenId id);
private:
Minecraft* _mc;
MinecraftClient& _mc;
};
#endif /*NET_MINECRAFT_CLIENT_GUI_SCREENS__ScreenChooser_H__*/

View File

@@ -1,4 +1,5 @@
#include "SelectWorldScreen.h"
#include "MinecraftClient.h"
#include "StartMenuScreen.h"
#include "ProgressScreen.h"
#include "DialogDefinitions.h"
@@ -22,7 +23,7 @@ static float Max(float a, float b) {
//
// World Selection List
//
WorldSelectionList::WorldSelectionList( Minecraft* minecraft, int width, int height )
WorldSelectionList::WorldSelectionList( MinecraftClient& minecraft, int width, int height )
: _height(height),
hasPickedLevel(false),
currentTick(0),

View File

@@ -5,11 +5,11 @@
#include "../TweenData.h"
#include "../components/Button.h"
#include "../components/RolledSelectionListH.h"
#include "../../Minecraft.h"
#include "../../../world/level/storage/LevelStorageSource.h"
class SelectWorldScreen;
class MinecraftClient;
//
// Scrolling World selection list
@@ -17,7 +17,7 @@ class SelectWorldScreen;
class WorldSelectionList : public RolledSelectionListH
{
public:
WorldSelectionList(Minecraft* _minecraft, int _width, int _height);
WorldSelectionList(MinecraftClient& _minecraft, int _width, int _height);
virtual void tick();
void stepLeft();
void stepRight();

View File

@@ -3,7 +3,7 @@
#include "../../Screen.h"
#include "../../components/ImageButton.h"
#include "../../components/InventoryPane.h"
#include "../../../gamemode/GameMode.h"
#include <gamemode/GameMode.h>
#include "../../../renderer/TileRenderer.h"
#include "../../../player/LocalPlayer.h"
#include "../../../renderer/gles.h"
@@ -91,8 +91,7 @@ void IngameBlockSelectionScreen::init()
//for (int i = 0; i < inventory->getContainerSize(); ++i)
//LOGI("> %d - %s\n", i, inventory->getItem(i)? inventory->getItem(i)->getDescriptionId().c_str() : "<-->\n");
// Grid indices are 0..N-1 for main inventory only; slots 0..MAX_SELECTION_SIZE-1 are hotbar links.
InventorySize = inventory->getContainerSize() - Inventory::MAX_SELECTION_SIZE;
InventorySize = inventory->getContainerSize();
InventoryRows = 1 + (InventorySize-1) / InventoryColumns;
//
@@ -266,8 +265,7 @@ void IngameBlockSelectionScreen::buttonClicked(Button* button) {
bool IngameBlockSelectionScreen::isAllowed( int slot )
{
const int gridCount = minecraft->player->inventory->getContainerSize() - Inventory::MAX_SELECTION_SIZE;
if (slot < 0 || slot >= gridCount)
if (slot < 0 || slot >= minecraft->player->inventory->getContainerSize())
return false;
#ifdef DEMO_MODE