Merge branch 'smartcmd:main' into fix/gamma-slider-renderpath-178

This commit is contained in:
ModMaker101 2026-03-05 12:25:49 -05:00 committed by GitHub
commit 81ce6f330b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
42 changed files with 211 additions and 172 deletions

View file

@ -1,5 +1,20 @@
<!--
Note: IF YOUR PR CHANGES THE GAME BEHAVIOR VISIBLY, REMEMBER TO ATTACH A GAMEPLAY FOOTAGE (or at least a screenshot) OF YOU *ACTUALLY* PLAYING THE GAME WITH YOUR CHANGES. Untested PRs are *NOT* welcome. Please don't forget to describe what did you do in each commit in your PR.
⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️
IF YOUR PR CHANGES THE GAME BEHAVIOR VISIBLY, REMEMBER TO ATTACH A GAMEPLAY FOOTAGE (or at least a screenshot) OF YOU *ACTUALLY* PLAYING THE GAME WITH YOUR CHANGES. Untested PRs are *NOT* welcome. Please don't forget to describe what did you do in each commit in your PR.
⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️
We will NOT accept PRs with code authored by AI. If your code
was written by an AI, your PR will be closed. Do not submit
vibe coded PRs.
⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️
PRs that do not fulfill the informational intent of this PR template will be closed. Please do your best to use this template as written.
⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️
-->
## Description
@ -19,6 +34,9 @@ Note: IF YOUR PR CHANGES THE GAME BEHAVIOR VISIBLY, REMEMBER TO ATTACH A GAMEPLA
### Fix Implementation
<!-- Detail exactly how the issue was resolved (specific code changes, algorithms, logic flows). -->
### AI Use Disclosure
<!-- Explain, if any, AI was used to solve this problem. Note that we do not accept code written by any LLM in this repo. -->
## Related Issues
- Fixes #[issue-number]
- Related to #[issue-number]

View file

@ -36,7 +36,11 @@ jobs:
with:
tag_name: nightly
name: Nightly Release
body: Requires at least Windows 7 and DirectX 11 compatible GPU to run. Compiled with MSVC v14.44.35207 in Release mode with Whole Program Optimization, as well as `/O2 /Ot /Oi /Ob3 /GF /fp:precise`.
body: |
Requires at least Windows 7 and DirectX 11 compatible GPU to run. Compiled with MSVC v14.44.35207 in Release mode with Whole Program Optimization, as well as `/O2 /Ot /Oi /Ob3 /GF /fp:precise`.
# 🚨 First time here? 🚨
If you've never downloaded the game before, you need to download `LCEWindows64.zip` and extract it to the folder where you'd like to keep the game. The other files are included in this `.zip` file!
files: |
LCEWindows64.zip
./x64/Release/Minecraft.Client.exe

View file

@ -89,13 +89,59 @@ target_link_libraries(MinecraftClient PRIVATE
>
)
add_custom_command(TARGET MinecraftClient POST_BUILD
COMMAND "${CMAKE_COMMAND}"
-DPROJECT_SOURCE_DIR="${CMAKE_CURRENT_SOURCE_DIR}"
-DOUTPUT_DIR="$<TARGET_FILE_DIR:MinecraftClient>"
-DCONFIGURATION=$<CONFIG>
-P "${CMAKE_CURRENT_SOURCE_DIR}/cmake/CopyAssets.cmake"
VERBATIM
)
if(WIN32)
message(STATUS "Starting redist copy...")
execute_process(
COMMAND robocopy.exe
"${CMAKE_CURRENT_SOURCE_DIR}/x64/Release"
"${CMAKE_CURRENT_BINARY_DIR}"
/S /MT /R:0 /W:0 /NP
)
message(STATUS "Starting asset copy...")
execute_process(
COMMAND robocopy.exe
"${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.Client"
"${CMAKE_CURRENT_BINARY_DIR}"
/S /MT /R:0 /W:0 /NP
/XF "*.cpp" "*.c" "*.h" "*.hpp" "*.asm"
"*.xml" "*.lang" "*.vcxproj" "*.vcxproj.*" "*.sln"
"*.docx" "*.xls"
"*.bat" "*.cmd" "*.ps1" "*.py"
"*Test*"
/XD "Durango*" "Orbis*" "PS*" "Xbox"
)
message(STATUS "Patching Windows64Media...")
execute_process(
COMMAND robocopy.exe
"${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.Client/DurangoMedia"
"${CMAKE_CURRENT_BINARY_DIR}/Windows64Media"
/S /MT /R:0 /W:0 /NP
/XF "*.h" "*.xml" "*.lang" "*.bat"
)
elseif(UNIX)
message(STATUS "Starting redist copy...")
execute_process(
COMMAND rsync -av "${CMAKE_CURRENT_SOURCE_DIR}/x64/Release/" "${CMAKE_CURRENT_BINARY_DIR}/"
)
message(STATUS "Starting asset copy...")
execute_process(
COMMAND rsync -av
"--exclude=*.cpp" "--exclude=*.c" "--exclude=*.h" "--exclude=*.hpp" "--exclude=*.asm"
"--exclude=*.xml" "--exclude=*.lang" "--exclude=*.vcxproj" "--exclude=*.vcxproj.*" "--exclude=*.sln"
"--exclude=*.docx" "--exclude=*.xls"
"--exclude=*.bat" "--exclude=*.cmd" "--exclude=*.ps1" "--exclude=*.py"
"--exclude=*Test*"
"--exclude=Durango*" "--exclude=Orbis*" "--exclude=PS*" "--exclude=Xbox"
"${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.Client/" "${CMAKE_CURRENT_BINARY_DIR}/"
)
message(STATUS "Patching Windows64Media...")
execute_process(
COMMAND rsync -av
"--exclude=*.h" "--exclude=*.xml" "--exclude=*.lang" "--exclude=*.bat"
"${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.Client/DurangoMedia/" "${CMAKE_CURRENT_BINARY_DIR}/Windows64Media/"
)
else()
message(FATAL_ERROR "Redist and asset copying is only supported on Windows (Robocopy) and Unix systems (rsync).")
endif()
set_property(DIRECTORY PROPERTY VS_STARTUP_PROJECT MinecraftClient)

25
CONTRIBUTING.md Normal file
View file

@ -0,0 +1,25 @@
# Scope of Project
At the moment, this project's scope is generally limited outside of adding new content to the game (blocks, mobs, items). We are currently prioritizing stability, quality of life, and platform support over these things.
## Current Goals
- Being a robust Desktop version of LCE
- Having proper controller support across all types, brands on Desktop or Desktop-like platforms (Steam Deck)
- Improving stability as much as possible
- Fixing as many bugs as possible
- Enabling Desktop multiplayer options
- LAN P2P Multiplayer
- Splitscreen Multiplayer
- WAN Servers (IP:Port connectivity)
- Platform-based P2P Connectivity
- Steam Networking
- GameDate?
- Maybe more?
- Refining rendering settings, renderer options, as well as reaching rendering parity with true LCE
- Having workable multi-platform compilation for ARM, Consoles, Linux
- Being a good base for further expansion and modding of LCE, such as backports and "modpacks".
# Use of AI and LLMs
We currently do not accept any new code into the project that was written largely, entirely, or even noticably by an LLM. All contributions should be made by humans that understand the codebase.
# Pull Request Template
We request that all PRs made for this repo use our PR template to the fullest extent possible. Completely wiping it out to write minimal information will likely get your PR closed.

View file

@ -2694,6 +2694,10 @@ void ClientConnection::handleRespawn(shared_ptr<RespawnPacket> packet)
int oldDimension = minecraft->localplayers[m_userIndex]->dimension;
started = false;
// Stop any streaming music (e.g. jukebox) when changing dimensions
// so it doesn't leak into the new dimension
level->playStreamingMusic(L"", 0, 0, 0);
// Remove client connection from this level
level->removeClientConnection(this, false);

View file

@ -7,6 +7,7 @@
#include "..\..\Windows64\Network\WinsockNetLayer.h"
#include "..\..\Minecraft.h"
#include "..\..\User.h"
#include <iostream>
#endif
CPlatformNetworkManagerStub *g_pPlatformNetworkManager;
@ -700,6 +701,7 @@ void CPlatformNetworkManagerStub::SearchForGames()
#ifdef _WINDOWS64
std::vector<Win64LANSession> lanSessions = WinsockNetLayer::GetDiscoveredSessions();
//THEY GET DELETED HERE DAMMIT
for (size_t i = 0; i < friendsSessions[0].size(); i++)
delete friendsSessions[0][i];
friendsSessions[0].clear();
@ -730,6 +732,53 @@ void CPlatformNetworkManagerStub::SearchForGames()
friendsSessions[0].push_back(info);
}
std::FILE* file = std::fopen("servers.txt", "r");
if (file) {
wstring wline;
int phase = 0;
string ip;
wstring port;
wstring name;
char buffer[512];
while (std::fgets(buffer, sizeof(buffer), file)) {
if (phase == 0) {
ip = buffer;
phase = 1;
}
else if (phase == 1) {
wline = convStringToWstring(buffer);
port = wline;
phase = 2;
}
else if (phase == 2) {
wline = convStringToWstring(buffer);
name = wline;
phase = 0;
//THEY GET DELETED AFTER USE LIKE 30 LINES UP!!
FriendSessionInfo* info = new FriendSessionInfo();
wchar_t label[128];
wcsncpy_s(label, sizeof(label)/sizeof(wchar_t), name.c_str(), _TRUNCATE);
size_t nameLen = wcslen(label);
info->displayLabel = new wchar_t[nameLen+1];
wcscpy_s(info->displayLabel, nameLen + 1, label);
info->displayLabelLength = (unsigned char)nameLen;
info->displayLabelViewableStartIndex = 0;
info->data.isReadyToJoin = true;
info->data.isJoinable = true;
strncpy_s(info->data.hostIP, sizeof(info->data.hostIP), ip.c_str(), _TRUNCATE);
info->data.hostPort = stoi(port);
info->sessionId = (SessionID)(static_cast<uint64_t>(inet_addr(ip.c_str())) | (static_cast<uint64_t>(stoi(port)) << 32));
friendsSessions[0].push_back(info);
}
}
std::fclose(file);
}
m_searchResultsCount[0] = (int)friendsSessions[0].size();
if (m_SessionsUpdatedCallback != NULL)

View file

@ -387,8 +387,10 @@ vector<HtmlString> *IUIScene_BeaconMenu::GetSectionHoverText(ESceneSection eSect
desc = new vector<HtmlString>();
HtmlString string( app.GetString(MobEffect::effects[effectId]->getDescriptionId()), eHTMLColor_White );
desc->push_back( string );
if (effectId < MobEffect::e_MobEffectIcon_COUNT && MobEffect::effects[effectId]) {
HtmlString string( app.GetString(MobEffect::effects[effectId]->getDescriptionId()), eHTMLColor_White );
desc->push_back( string );
}
}
break;
}

View file

@ -6,35 +6,33 @@
// 4J - added
void CreeperModel::_init(float g)
{
int yo = 4;
head = new ModelPart(this, 0, 0);
head->addBox(-4, - 8, -4, 8, 8, 8, g); // Head
head->setPos(0, (float)(yo), 0);
head->setPos(0, 6, 0);
hair = new ModelPart(this, 32, 0);
hair->addBox(-4, -8, -4, 8, 8, 8, g + 0.5f); // Head
hair->setPos(0, (float)(yo), 0);
hair->setPos(0, 6, 0);
body = new ModelPart(this, 16, 16);
body->addBox(-4, 0, -2, 8, 12, 4, g); // Body
body->setPos(0, (float)(yo), 0);
body->setPos(0, 6, 0);
leg0 = new ModelPart(this, 0, 16);
leg0->addBox(-2, 0, -2, 4, 6, 4, g); // Leg0
leg0->setPos(-2, (float)(12 + yo), 4);
leg0->setPos(-2, 18, 4);
leg1 = new ModelPart(this, 0, 16);
leg1->addBox(-2, 0, -2, 4, 6, 4, g); // Leg1
leg1->setPos(2, (float)(12 + yo), 4);
leg1->setPos(2, 18, 4);
leg2 = new ModelPart(this, 0, 16);
leg2->addBox(-2, 0, -2, 4, 6, 4, g); // Leg2
leg2->setPos(-2, (float)(12 + yo), -4);
leg2->setPos(-2, 18, -4);
leg3 = new ModelPart(this, 0, 16);
leg3->addBox(-2, 0, -2, 4, 6, 4, g); // Leg3
leg3->setPos(2, (float)(12 + yo), -4);
leg3->setPos(2, 18, -4);
// 4J added - compile now to avoid random performance hit first time cubes are rendered
head->compile(1.0f/16.0f);

View file

@ -54,13 +54,13 @@ void EntityTracker::addEntity(shared_ptr<Entity> e)
else if (e->instanceof(eTYPE_THROWNEXPBOTTLE)) addEntity(e, 16 * 4, 10, true);
else if (e->instanceof(eTYPE_FIREWORKS_ROCKET)) addEntity(e, 16 * 4, 10, true);
else if (e->instanceof(eTYPE_ITEMENTITY)) addEntity(e, 16 * 4, 20, true);
else if (e->instanceof(eTYPE_MINECART)) addEntity(e, 16 * 5, 3, true);
else if (e->instanceof(eTYPE_BOAT)) addEntity(e, 16 * 5, 3, true);
else if (e->instanceof(eTYPE_SQUID)) addEntity(e, 16 * 4, 3, true);
else if (e->instanceof(eTYPE_WITHERBOSS)) addEntity(e, 16 * 5, 3, false);
else if (e->instanceof(eTYPE_BAT)) addEntity(e, 16 * 5, 3, false);
else if (dynamic_pointer_cast<Creature>(e)!=NULL) addEntity(e, 16 * 5, 3, true);
else if (e->instanceof(eTYPE_ENDERDRAGON)) addEntity(e, 16 * 10, 3, true);
else if (e->instanceof(eTYPE_MINECART)) addEntity(e, 16 * 5, 1, true);
else if (e->instanceof(eTYPE_BOAT)) addEntity(e, 16 * 5, 1, true);
else if (e->instanceof(eTYPE_SQUID)) addEntity(e, 16 * 4, 1, true);
else if (e->instanceof(eTYPE_WITHERBOSS)) addEntity(e, 16 * 5, 1, false);
else if (e->instanceof(eTYPE_BAT)) addEntity(e, 16 * 5, 1, false);
else if (dynamic_pointer_cast<Creature>(e)!=NULL) addEntity(e, 16 * 5, 1, true);
else if (e->instanceof(eTYPE_ENDERDRAGON)) addEntity(e, 16 * 10, 1, true);
else if (e->instanceof(eTYPE_PRIMEDTNT)) addEntity(e, 16 * 10, 10, true);
else if (e->instanceof(eTYPE_FALLINGTILE)) addEntity(e, 16 * 10, 20, true);
else if (e->instanceof(eTYPE_HANGING_ENTITY)) addEntity(e, 16 * 10, INT_MAX, false);
@ -245,4 +245,4 @@ shared_ptr<TrackedEntity> EntityTracker::getTracker(shared_ptr<Entity> e)
return it->second;
}
return nullptr;
}
}

View file

@ -104,8 +104,7 @@ void Input::tick(LocalPlayer *player)
}
}
// Ctrl + forward = sprint (hold to sprint)
if (!player->abilities.flying)
// Ctrl + forward = sprint (hold to sprint, including while flying)
{
bool ctrlHeld = g_KBMInput.IsKeyDown(KeyboardMouseInput::KEY_SPRINT);
bool movingForward = (kbYA > 0.0f);
@ -119,10 +118,6 @@ void Input::tick(LocalPlayer *player)
sprinting = false;
}
}
else
{
sprinting = false;
}
}
else if (iPad == 0)
{

View file

@ -1485,7 +1485,7 @@ void Minecraft::run_middle()
}
// Utility keys always work regardless of KBM active state
if(g_KBMInput.IsKeyPressed(KeyboardMouseInput::KEY_PAUSE) && !ui.IsTutorialVisible(i))
if(g_KBMInput.IsKeyPressed(KeyboardMouseInput::KEY_PAUSE) && !ui.IsTutorialVisible(i) && !ui.GetMenuDisplayed(i))
{
localplayers[i]->ullButtonsPressed|=1LL<<MINECRAFT_ACTION_PAUSEMENU;
app.DebugPrintf("PAUSE PRESSED (keyboard) - ipad = %d\n",i);
@ -1494,9 +1494,9 @@ void Minecraft::run_middle()
if(g_KBMInput.IsKeyPressed(KeyboardMouseInput::KEY_THIRD_PERSON))
localplayers[i]->ullButtonsPressed|=1LL<<MINECRAFT_ACTION_RENDER_THIRD_PERSON;
if(g_KBMInput.IsKeyPressed(KeyboardMouseInput::KEY_DEBUG_INFO))
if(g_KBMInput.IsKeyPressed(KeyboardMouseInput::KEY_DEBUG_MENU))
{
localplayers[i]->ullButtonsPressed|=1LL<<MINECRAFT_ACTION_GAME_INFO;
localplayers[i]->ullButtonsPressed|=1LL<<MINECRAFT_ACTION_RENDER_DEBUG;
}
// In flying mode, Shift held = sneak/descend

View file

@ -90,7 +90,6 @@ bool MultiPlayerGameMode::destroyBlock(int x, int y, int z, int face)
if (g_NetworkManager.IsHost())
{
level->levelEvent(LevelEvent::PARTICLES_DESTROY_BLOCK, x, y, z, oldTile->id + (level->getData(x, y, z) << Tile::TILE_NUM_SHIFT));
return true;
}
#endif

View file

@ -30,6 +30,7 @@ public:
static const int KEY_PAUSE = VK_ESCAPE;
static const int KEY_THIRD_PERSON = VK_F5;
static const int KEY_DEBUG_INFO = VK_F3;
static const int KEY_DEBUG_MENU = VK_F4;
void Init();
void Tick();

View file

@ -1569,19 +1569,6 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
}
#ifdef _DEBUG_MENUS_ENABLED
// F4 Open debug overlay
if (g_KBMInput.IsKeyPressed(VK_F4))
{
if (Minecraft *pMinecraft = Minecraft::GetInstance())
{
if (pMinecraft->options &&
app.GetGameStarted() && !ui.GetMenuDisplayed(0) && pMinecraft->screen == NULL)
{
ui.NavigateToScene(0, eUIScene_DebugOverlay, NULL, eUILayer_Debug);
}
}
}
// F6 Open debug console
if (g_KBMInput.IsKeyPressed(VK_F6))
{

Binary file not shown.

After

Width:  |  Height:  |  Size: 196 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 122 KiB

View file

@ -288,10 +288,10 @@ shared_ptr<ItemInstance> FilledBucketDispenseBehavior::execute(BlockSource *sour
return dispensed;
}
return DefaultDispenseItemBehavior::dispense(source, dispensed);
outcome = LEFT_ITEM;
return dispensed;
}
/* EmptyBucket */
shared_ptr<ItemInstance> EmptyBucketDispenseBehavior::execute(BlockSource *source, shared_ptr<ItemInstance> dispensed, eOUTCOME &outcome)
@ -454,4 +454,4 @@ shared_ptr<ItemInstance> TntDispenseBehavior::execute(BlockSource *source, share
outcome = LEFT_ITEM;
}
return dispensed;
}
}

View file

@ -10,17 +10,24 @@ PanicGoal::PanicGoal(PathfinderMob *mob, double speedModifier)
{
this->mob = mob;
this->speedModifier = speedModifier;
setRequiredControlFlags(Control::MoveControlFlag);
Goal::setRequiredControlFlags(Control::MoveControlFlag);
}
bool PanicGoal::canUse()
{
if (mob->getLastHurtByMob() == NULL && !mob->isOnFire()) return false;
Vec3 *pos = RandomPos::getPos(dynamic_pointer_cast<PathfinderMob>(mob->shared_from_this()), 5, 4);
if (pos == NULL) return false;
if (mob->getLastHurtByMob() == nullptr && !mob->isOnFire()) return false;
const int hurtTimeout = mob->getLastHurtByMobTimestamp();
if (hurtTimeout == 0) return false;
static thread_local std::mt19937 rng(std::random_device{}());
std::uniform_int_distribution<int> dist(60, 100);
const int panicDuration = dist(rng);
if (mob->tickCount - hurtTimeout > panicDuration) return false;
const Vec3* pos = RandomPos::getPos(dynamic_pointer_cast<PathfinderMob>(mob->shared_from_this()), 5, 4);
if (pos == nullptr) return false;
posX = pos->x;
posY = pos->y;
posZ = pos->z;
return true;
}
@ -31,5 +38,6 @@ void PanicGoal::start()
bool PanicGoal::canContinueToUse()
{
if (mob->getLastHurtByMob() == nullptr && !mob->isOnFire()) return false;
return !mob->getNavigation()->isDone();
}

View file

@ -1,6 +1,7 @@
#pragma once
#include "Goal.h"
#include <random>
class PathfinderMob;

View file

@ -166,9 +166,15 @@ void SignTileEntity::setChanged()
void SignTileEntity::SetMessage(int iIndex,wstring &wsText)
{
{
if (wsText.length() > MAX_LINE_LENGTH) // MAX_LINE_LENGTH == 15
{
wsText = wsText.substr(0, MAX_LINE_LENGTH);
#ifdef _DEBUG
OutputDebugStringW(L"Sign text truncated to 15 characters\n");
#endif
}
m_wsmessages[iIndex]=wsText;
}
// 4J-PB - added for string verification

View file

@ -535,7 +535,7 @@ void WitherBoss::registerAttributes()
getAttribute(SharedMonsterAttributes::MOVEMENT_SPEED)->setBaseValue(0.6f);
// 4J Stu - Don't make it so far!
//getAttribute(SharedMonsterAttributes::FOLLOW_RANGE)->setBaseValue(40);
getAttribute(SharedMonsterAttributes::FOLLOW_RANGE)->setBaseValue(40);
}
float WitherBoss::getHeadYRot(int i)
@ -581,4 +581,4 @@ MobType WitherBoss::getMobType()
void WitherBoss::ride(shared_ptr<Entity> e)
{
riding = nullptr;
}
}

View file

@ -56,7 +56,7 @@ void Zombie::registerAttributes()
Monster::registerAttributes();
// 4J Stu - Don't make it so far!
//getAttribute(SharedMonsterAttributes::FOLLOW_RANGE)->setBaseValue(40);
getAttribute(SharedMonsterAttributes::FOLLOW_RANGE)->setBaseValue(40);
getAttribute(SharedMonsterAttributes::MOVEMENT_SPEED)->setBaseValue(0.23f);
getAttribute(SharedMonsterAttributes::ATTACK_DAMAGE)->setBaseValue(3);
@ -490,4 +490,4 @@ Zombie::ZombieGroupData::ZombieGroupData(bool baby, bool villager)
{
isBaby = baby;
isVillager = villager;
}
}

View file

@ -101,6 +101,9 @@ For more information, see [COMPILE.md](COMPILE.md)
- Native builds for platforms other than Windows have not been tested and are most likely non-functional. The Windows nightly build may still run on macOS and Linux through Wine or CrossOver, but that path is unofficial and not currently supported
## Contributors
Would you like to contribute to this project? Please read our [Contributor's Guide](CONTRIBUTING.md) before doing so! This document includes our current goals, standards for inclusions, rules, and more.
## Star History
[![Star History Chart](https://api.star-history.com/svg?repos=smartcmd/MinecraftConsoles&type=date&legend=top-left)](https://www.star-history.com/?spm=a2c6h.12873639.article-detail.7.7b9d7fabjNxTRk#smartcmd/MinecraftConsoles&type=date&legend=top-left)

View file

@ -1,107 +0,0 @@
if(NOT DEFINED PROJECT_SOURCE_DIR OR NOT DEFINED OUTPUT_DIR OR NOT DEFINED CONFIGURATION)
message(FATAL_ERROR "CopyAssets.cmake requires PROJECT_SOURCE_DIR, OUTPUT_DIR, and CONFIGURATION.")
endif()
# Some generators may pass quoted values (e.g. "Debug"); normalize that.
string(REPLACE "\"" "" PROJECT_SOURCE_DIR "${PROJECT_SOURCE_DIR}")
string(REPLACE "\"" "" OUTPUT_DIR "${OUTPUT_DIR}")
string(REPLACE "\"" "" CONFIGURATION "${CONFIGURATION}")
set(_project_dir "${PROJECT_SOURCE_DIR}/Minecraft.Client")
function(copy_tree_if_exists src_rel dst_rel)
set(_src "${_project_dir}/${src_rel}")
set(_dst "${OUTPUT_DIR}/${dst_rel}")
if(EXISTS "${_src}")
file(MAKE_DIRECTORY "${_dst}")
file(GLOB_RECURSE _files RELATIVE "${_src}" "${_src}/*")
foreach(_file IN LISTS _files) # if not a source file
if(NOT _file MATCHES "\\.(cpp|c|h|hpp|xml|lang)$")
set(_full_src "${_src}/${_file}")
set(_full_dst "${_dst}/${_file}")
if(IS_DIRECTORY "${_full_src}")
file(MAKE_DIRECTORY "${_full_dst}")
else()
get_filename_component(_dst_dir "${_full_dst}" DIRECTORY)
file(MAKE_DIRECTORY "${_dst_dir}")
execute_process(
COMMAND "${CMAKE_COMMAND}" -E copy_if_different
"${_full_src}" "${_full_dst}"
)
endif()
endif()
endforeach()
endif()
endfunction()
function(ensure_dir rel_path)
file(MAKE_DIRECTORY "${OUTPUT_DIR}/${rel_path}")
endfunction()
function(copy_file_if_exists src_rel dst_rel)
set(_src "${PROJECT_SOURCE_DIR}/${src_rel}")
set(_dst "${OUTPUT_DIR}/${dst_rel}")
get_filename_component(_dst_dir "${_dst}" DIRECTORY)
file(MAKE_DIRECTORY "${_dst_dir}")
if(EXISTS "${_src}")
execute_process(
COMMAND "${CMAKE_COMMAND}" -E copy_if_different
"${_src}" "${_dst}"
)
endif()
endfunction()
function(copy_first_existing dst_rel)
set(_copied FALSE)
foreach(_candidate IN LISTS ARGN)
if(EXISTS "${PROJECT_SOURCE_DIR}/${_candidate}")
copy_file_if_exists("${_candidate}" "${dst_rel}")
set(_copied TRUE)
break()
endif()
endforeach()
if(NOT _copied)
message(WARNING "Runtime file not found for ${dst_rel}. Checked: ${ARGN}")
endif()
endfunction()
function(remove_directory_if_exists rel_path)
set(_dir "${OUTPUT_DIR}/${rel_path}")
if(EXISTS "${_dir}")
file(REMOVE_RECURSE "${_dir}")
endif()
endfunction()
copy_tree_if_exists("Durango/Sound" "Windows64/Sound")
copy_tree_if_exists("music" "music")
copy_tree_if_exists("Windows64/GameHDD" "Windows64/GameHDD")
copy_file_if_exists("Minecraft.Client/Common/Media/MediaWindows64.arc" "Common/Media/MediaWindows64.arc")
copy_tree_if_exists("Common/res" "Common/res")
copy_tree_if_exists("Common/Trial" "Common/Trial")
copy_tree_if_exists("Common/Tutorial" "Common/Tutorial")
copy_tree_if_exists("DurangoMedia" "Windows64Media")
copy_tree_if_exists("Windows64Media" "Windows64Media")
remove_directory_if_exists("Windows64Media/Layout")
# Some runtime code asserts if this directory tree is missing.
ensure_dir("Windows64/GameHDD")
# Keep legacy runtime redistributables in a familiar location.
copy_tree_if_exists("Windows64/Miles/lib/redist64" "redist64")
copy_tree_if_exists("Windows64/Iggy/lib/redist64" "redist64")
# Runtime DLLs required at launch.
copy_first_existing("iggy_w64.dll"
"Minecraft.Client/Windows64/Iggy/lib/redist64/iggy_w64.dll"
"x64/${CONFIGURATION}/iggy_w64.dll"
)
copy_first_existing("mss64.dll"
"Minecraft.Client/Windows64/Miles/lib/redist64/mss64.dll"
"x64/${CONFIGURATION}/mss64.dll"
)