Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
cbd8d4f
Updated CMakeLists.txt to support cross-compiling on linux host, repl…
universeindex Mar 3, 2026
0234a3d
I am suffering
universeindex Mar 3, 2026
a544e96
remove compile_commands.json
universeindex Mar 3, 2026
bdeec50
Cross compilation working, does not actually run and crashes somewher…
universeindex Mar 3, 2026
728f124
stuff
universeindex Mar 4, 2026
8434825
Fix merge conflicts
universeindex Mar 4, 2026
620181f
fix merge conflicts, build issues
universeindex Mar 4, 2026
e212021
update, merge upstream, fix conflicts (again)
universeindex Mar 4, 2026
1dbfe11
fix other stuff
universeindex Mar 4, 2026
746fe06
Merge branch 'main' into main
universeindex Mar 4, 2026
b87774a
Merge branch 'main' into main
universeindex Mar 4, 2026
bf31940
fix: auto-detect winsysroot from msbuild location & replace /winsysro…
DwifteJB Mar 4, 2026
ee78a74
fix: implement IobShim.cpp
DwifteJB Mar 4, 2026
1558de3
fix: use intel_syntax
DwifteJB Mar 4, 2026
9ffd437
fix: xor -> mov to be "identical"
DwifteJB Mar 4, 2026
e3e06bc
delete .vscode, oops.
DwifteJB Mar 4, 2026
da6c15e
Merge pull request #1 from DwifteJB/msvc-winsysroot-fix
universeindex Mar 4, 2026
8b079f4
fix linux toolchain always failing to find msvc toolchain and hardcod…
universeindex Mar 5, 2026
592bc6d
Update compile.md to reflect previous change
universeindex Mar 5, 2026
d74cd1c
fix: if WINDOWS_SDK_PATH is not defined, find via find_program
DwifteJB Mar 5, 2026
248c175
fix: remove comments that are now out-of-date
DwifteJB Mar 5, 2026
6e35674
Merge pull request #2 from DwifteJB/msvc-winsysroot-fix
universeindex Mar 5, 2026
a5b54a2
iob shim
universeindex Mar 5, 2026
263ae8d
iob shim
universeindex Mar 5, 2026
3ce54d6
attempting to add clang-cl to vs build
universeindex Mar 5, 2026
09bbff8
Fix merge conflicts
universeindex Mar 7, 2026
4405162
add linux build workflow
universeindex Mar 7, 2026
16384a0
fix linux workflow (?1)
universeindex Mar 7, 2026
8fc4d62
Fix merge conflicts, additionally clang-format'd the files I edited
universeindex Mar 7, 2026
1825f46
Remove build_linux workflow to delegate to its own PR
universeindex Mar 7, 2026
3172f4d
add linux instructions to README.md
DwifteJB Mar 12, 2026
eb64df9
fix: linux build
DwifteJB Mar 12, 2026
c8ab4b0
fix: clion dir on gitignore
DwifteJB Mar 12, 2026
d65d546
Merge branch 'main' of https://github.com/DwifteJB/MinecraftConsoles
DwifteJB Mar 12, 2026
ab28d04
test: re-add build-linux for testing
DwifteJB Mar 12, 2026
ccf0d9a
test: build-linux
DwifteJB Mar 12, 2026
d51bbc0
fix: use strategy
DwifteJB Mar 12, 2026
8363b2e
test: build 2
DwifteJB Mar 12, 2026
7b72d66
fix: linux build 3
DwifteJB Mar 12, 2026
2113e75
delete build-linux
DwifteJB Mar 12, 2026
a10067c
add .kate-swp & .vscode to .gitignore
DwifteJB Mar 12, 2026
8009240
oops, remove .vscode
DwifteJB Mar 12, 2026
794e042
Merge pull request #4 from DwifteJB/main
universeindex Mar 14, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -437,3 +437,7 @@ Minecraft.Client/Saves/
# Visual Studio Per-User Config
*.user
/out

# IDE files
.idea/
.kate-swp
20 changes: 11 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,7 @@ set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

if(NOT WIN32)
message(FATAL_ERROR "This CMake build currently supports Windows only.")
endif()

if(NOT CMAKE_SIZEOF_VOID_P EQUAL 8)
if(NOT CMAKE_SIZEOF_VOID_P EQUAL 8 AND WIN32) # triggers when cross compiling on linux
message(FATAL_ERROR "Use a 64-bit generator/toolchain (x64).")
endif()

Expand All @@ -31,9 +27,12 @@ include("${CMAKE_CURRENT_SOURCE_DIR}/cmake/ClientSources.cmake")

list(TRANSFORM MINECRAFT_WORLD_SOURCES PREPEND "${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.World/")
list(TRANSFORM MINECRAFT_CLIENT_SOURCES PREPEND "${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.Client/")
list(APPEND MINECRAFT_CLIENT_SOURCES
"${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.Client/Xbox/MinecraftWindows.rc"
)

if(NOT CMAKE_CROSSCOMPILING) # broken when cross compiling (can't include sdkddkver.h)
list(APPEND MINECRAFT_CLIENT_SOURCES
"${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.Client/Xbox/MinecraftWindows.rc"
)
endif()

add_library(MinecraftWorld STATIC ${MINECRAFT_WORLD_SOURCES})
target_include_directories(MinecraftWorld PRIVATE
Expand All @@ -43,6 +42,7 @@ target_include_directories(MinecraftWorld PRIVATE
target_compile_definitions(MinecraftWorld PRIVATE
$<$<CONFIG:Debug>:_LARGE_WORLDS;_DEBUG_MENUS_ENABLED;_DEBUG;_LIB;_CRT_NON_CONFORMING_SWPRINTFS;_CRT_SECURE_NO_WARNINGS;_WINDOWS64>
$<$<NOT:$<CONFIG:Debug>>:_LARGE_WORLDS;_DEBUG_MENUS_ENABLED;_LIB;_CRT_NON_CONFORMING_SWPRINTFS;_CRT_SECURE_NO_WARNINGS;_WINDOWS64>
$<$<BOOL:CMAKE_CROSSCOMPILING>:LCE_CROSSCOMP>
)
if(MSVC)
configure_msvc_target(MinecraftWorld)
Expand All @@ -59,6 +59,7 @@ target_include_directories(MinecraftClient PRIVATE
target_compile_definitions(MinecraftClient PRIVATE
$<$<CONFIG:Debug>:_LARGE_WORLDS;_DEBUG_MENUS_ENABLED;_DEBUG;_CRT_NON_CONFORMING_SWPRINTFS;_CRT_SECURE_NO_WARNINGS;_WINDOWS64>
$<$<NOT:$<CONFIG:Debug>>:_LARGE_WORLDS;_DEBUG_MENUS_ENABLED;_CRT_NON_CONFORMING_SWPRINTFS;_CRT_SECURE_NO_WARNINGS;_WINDOWS64>
$<$<BOOL:CMAKE_CROSSCOMPILING>:LCE_CROSSCOMP>
)
if(MSVC)
configure_msvc_target(MinecraftClient)
Expand All @@ -74,7 +75,8 @@ set_target_properties(MinecraftClient PROPERTIES
target_link_libraries(MinecraftClient PRIVATE
MinecraftWorld
d3d11
XInput9_1_0
xinput9_1_0 # Changed capitalization to fix builds on case-sensitive filesystems
shcore # ditto
wsock32
legacy_stdio_definitions
"${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.Client/Windows64/Iggy/lib/iggy_w64.lib"
Expand Down
26 changes: 24 additions & 2 deletions COMPILE.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,30 @@ cd .\build\Debug
.\MinecraftClient.exe
```

## CMake (Linux)

MinecraftConsoles does not support Linux but can cross-compile a Windows build from Linux.

You will need a Windows MSVC SDK. You can get one from [msvc-wine](https://github.com/mstorsjo/msvc-wine) or from a real Visual Studio installation.

Configure:
```
MinecraftConsoles $ mkdir build && cd build
MinecraftConsoles/build $ cmake .. -B . -G Ninja -DWINDOWS_SDK_PATH=<windows msvc sdk location> -DCMAKE_TOOLCHAIN_FILE=../cmake/LinuxCrosscompile.cmake -DCMAKE_BUILD_TYPE=<Debug or Release>
```

Build:
```
MinecraftConsoles/build $ ninja
```

Run:
```
MinecraftConsoles/build $ wine MinecraftClient.exe
```

Notes:
- The CMake build is Windows-only and x64-only.
- Contributors on macOS or Linux need a Windows machine or VM to build the project. Running the game via Wine is separate from having a supported build environment.
- The CMake build will only compile a Windows binary, and non-win32 systems will cross-compile one.
- Contributors on macOS or Linux should be able to cross-compile a windows build. Running the game via Wine is separate from having a supported build environment.
- Post-build asset copy is automatic for `MinecraftClient` in CMake (Debug and Release variants).
- The game relies on relative paths (for example `Common\Media\...`), so launching from the output directory is required.
64 changes: 35 additions & 29 deletions Minecraft.Client/AbstractContainerScreen.cpp
Original file line number Diff line number Diff line change
@@ -1,38 +1,37 @@
#include "stdafx.h"
#include "AbstractContainerScreen.h"
#include "ItemRenderer.h"
#include "MultiplayerLocalPlayer.h"
#include "Lighting.h"
#include "../Minecraft.World/net.minecraft.locale.h"
#include "../Minecraft.World/net.minecraft.world.inventory.h"
#include "../Minecraft.World/net.minecraft.world.item.h"
#include "GameMode.h"
#include "ItemRenderer.h"
#include "KeyMapping.h"
#include "Lighting.h"
#include "MultiPlayerLocalPlayer.h"
#include "Options.h"
#include "..\Minecraft.World\net.minecraft.world.inventory.h"
#include "..\Minecraft.World\net.minecraft.locale.h"
#include "..\Minecraft.World\net.minecraft.world.item.h"
#include "stdafx.h"

ItemRenderer *AbstractContainerScreen::itemRenderer = new ItemRenderer();

AbstractContainerScreen::AbstractContainerScreen(AbstractContainerMenu *menu)
{
// 4J - added initialisers
imageWidth = 176;
imageHeight = 166;
// 4J - added initialisers
imageWidth = 176;
imageHeight = 166;

this->menu = menu;
this->menu = menu;
}

void AbstractContainerScreen::init()
{
Screen::init();
minecraft->player->containerMenu = menu;
// leftPos = (width - imageWidth) / 2;
// topPos = (height - imageHeight) / 2;

// leftPos = (width - imageWidth) / 2;
// topPos = (height - imageHeight) / 2;
}

void AbstractContainerScreen::render(int xm, int ym, float a)
{
// 4J Stu - Not used
// 4J Stu - Not used
#if 0
renderBackground();
int xo = (width - imageWidth) / 2;
Expand Down Expand Up @@ -121,7 +120,7 @@ void AbstractContainerScreen::renderLabels()

void AbstractContainerScreen::renderSlot(Slot *slot)
{
// 4J Unused
// 4J Unused
#if 0
int x = slot->x;
int y = slot->y;
Expand All @@ -148,7 +147,7 @@ void AbstractContainerScreen::renderSlot(Slot *slot)
Slot *AbstractContainerScreen::findSlot(int x, int y)
{
for (Slot* slot : menu->slots )
{
{
if (isHovering(slot, x, y)) return slot;
}
return NULL;
Expand All @@ -162,55 +161,59 @@ bool AbstractContainerScreen::isHovering(Slot *slot, int xm, int ym)
ym -= yo;

return xm >= slot->x - 1 && xm < slot->x + 16 + 1 && ym >= slot->y - 1 && ym < slot->y + 16 + 1;

}

void AbstractContainerScreen::mouseClicked(int x, int y, int buttonNum)
{
Screen::mouseClicked(x, y, buttonNum);
if (buttonNum == 0 || buttonNum == 1)
{
{
Slot *slot = findSlot(x, y);

int xo = (width - imageWidth) / 2;
int yo = (height - imageHeight) / 2;
bool clickedOutside = (x < xo || y < yo || x >= xo + imageWidth || y >= yo + imageHeight);

int slotId = -1;
if (slot != NULL) slotId = slot->index;
if (slot != NULL)
{
slotId = slot->index;
}

if (clickedOutside)
{
{
slotId = AbstractContainerMenu::CLICKED_OUTSIDE;
}

if (slotId != -1)
{
{
bool quickKey = slotId != AbstractContainerMenu::CLICKED_OUTSIDE && (Keyboard::isKeyDown(Keyboard::KEY_LSHIFT) || Keyboard::isKeyDown(Keyboard::KEY_RSHIFT));
minecraft->gameMode->handleInventoryMouseClick(menu->containerId, slotId, buttonNum, quickKey, minecraft->player);
}
}

}

void AbstractContainerScreen::mouseReleased(int x, int y, int buttonNum)
{
if (buttonNum == 0)
{
{
}
}

void AbstractContainerScreen::keyPressed(wchar_t eventCharacter, int eventKey)
{
if (eventKey == Keyboard::KEY_ESCAPE || eventKey == minecraft->options->keyBuild->key)
{
{
minecraft->player->closeContainer();
}
}

void AbstractContainerScreen::removed()
{
if (minecraft->player == NULL) return;
if (minecraft->player == NULL)
{
return;
}
}

void AbstractContainerScreen::slotsChanged(shared_ptr<Container> container)
Expand All @@ -219,12 +222,15 @@ void AbstractContainerScreen::slotsChanged(shared_ptr<Container> container)

bool AbstractContainerScreen::isPauseScreen()
{
return false;
return false;
}

void AbstractContainerScreen::tick()
{
Screen::tick();
if (!minecraft->player->isAlive() || minecraft->player->removed) minecraft->player->closeContainer();
if (!minecraft->player->isAlive() || minecraft->player->removed)
{
minecraft->player->closeContainer();
}
}

}
8 changes: 4 additions & 4 deletions Minecraft.Client/AbstractProjectileDispenseBehavior.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include "stdafx.h"
#include "..\Minecraft.World\net.minecraft.core.h"
#include "..\Minecraft.World\net.minecraft.world.entity.projectile.h"
#include "..\Minecraft.World\net.minecraft.world.level.tile.h"
#include "..\Minecraft.World\net.minecraft.world.level.h"
#include "../Minecraft.World/net.minecraft.core.h"
#include "../Minecraft.World/net.minecraft.world.entity.projectile.h"
#include "../Minecraft.World/net.minecraft.world.level.tile.h"
#include "../Minecraft.World/net.minecraft.world.level.h"
#include "AbstractProjectileDispenseBehavior.h"

shared_ptr<ItemInstance> AbstractProjectileDispenseBehavior::execute(BlockSource *source, shared_ptr<ItemInstance> dispensed)
Expand Down
2 changes: 1 addition & 1 deletion Minecraft.Client/AbstractProjectileDispenseBehavior.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once

#include "..\Minecraft.World\DefaultDispenseItemBehavior.h"
#include "../Minecraft.World/DefaultDispenseItemBehavior.h"

class Projectile;

Expand Down
4 changes: 2 additions & 2 deletions Minecraft.Client/AbstractTexturePack.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include "stdafx.h"
#include "Textures.h"
#include "AbstractTexturePack.h"
#include "..\Minecraft.World\InputOutputStream.h"
#include "..\Minecraft.World\StringHelpers.h"
#include "../Minecraft.World/InputOutputStream.h"
#include "../Minecraft.World/StringHelpers.h"

AbstractTexturePack::AbstractTexturePack(DWORD id, File *file, const wstring &name, TexturePack *fallback) : id(id), name(name)
{
Expand Down
8 changes: 4 additions & 4 deletions Minecraft.Client/AchievementPopup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
#include "Font.h"
#include "Textures.h"
#include "Lighting.h"
#include "..\Minecraft.World\System.h"
#include "..\Minecraft.World\net.minecraft.locale.h"
#include "..\Minecraft.World\net.minecraft.stats.h"
#include "..\Minecraft.World\SharedConstants.h"
#include "../Minecraft.World/System.h"
#include "../Minecraft.World/net.minecraft.locale.h"
#include "../Minecraft.World/net.minecraft.stats.h"
#include "../Minecraft.World/SharedConstants.h"

AchievementPopup::AchievementPopup(Minecraft *mc)
{
Expand Down
8 changes: 4 additions & 4 deletions Minecraft.Client/AchievementScreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
#include "Textures.h"
#include "StatsCounter.h"
#include "ItemRenderer.h"
#include "..\Minecraft.World\System.h"
#include "..\Minecraft.World\net.minecraft.locale.h"
#include "..\Minecraft.World\net.minecraft.world.level.tile.h"
#include "..\Minecraft.World\JavaMath.h"
#include "../Minecraft.World/System.h"
#include "../Minecraft.World/net.minecraft.locale.h"
#include "../Minecraft.World/net.minecraft.world.level.tile.h"
#include "../Minecraft.World/JavaMath.h"



Expand Down
2 changes: 1 addition & 1 deletion Minecraft.Client/AchievementScreen.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once
#include "Screen.h"
#include "..\Minecraft.World\net.minecraft.stats.h"
#include "../Minecraft.World/net.minecraft.stats.h"
class StatsCounter;

class AchievementScreen : public Screen
Expand Down
4 changes: 2 additions & 2 deletions Minecraft.Client/ArchiveFile.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "stdafx.h"

#include "..\Minecraft.World\StringHelpers.h"
#include "..\Minecraft.World\compression.h"
#include "../Minecraft.World/StringHelpers.h"
#include "../Minecraft.World/compression.h"

#include "ArchiveFile.h"

Expand Down
4 changes: 2 additions & 2 deletions Minecraft.Client/ArchiveFile.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
#include <vector>
#include <unordered_map>

#include "..\Minecraft.World\File.h"
#include "..\Minecraft.World\ArrayWithLength.h"
#include "../Minecraft.World/File.h"
#include "../Minecraft.World/ArrayWithLength.h"

using namespace std;

Expand Down
4 changes: 2 additions & 2 deletions Minecraft.Client/ArrowRenderer.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "stdafx.h"
#include "ArrowRenderer.h"
#include "..\Minecraft.World\net.minecraft.world.entity.projectile.h"
#include "..\Minecraft.World\Mth.h"
#include "../Minecraft.World/net.minecraft.world.entity.projectile.h"
#include "../Minecraft.World/Mth.h"

ResourceLocation ArrowRenderer::ARROW_LOCATION = ResourceLocation(TN_ITEM_ARROWS);

Expand Down
2 changes: 1 addition & 1 deletion Minecraft.Client/BatModel.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "stdafx.h"
#include "..\Minecraft.World\net.minecraft.world.entity.ambient.h"
#include "../Minecraft.World/net.minecraft.world.entity.ambient.h"
#include "BatModel.h"
#include "ModelPart.h"

Expand Down
2 changes: 1 addition & 1 deletion Minecraft.Client/BatRenderer.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "stdafx.h"
#include "..\Minecraft.World\net.minecraft.world.entity.ambient.h"
#include "../Minecraft.World/net.minecraft.world.entity.ambient.h"
#include "BatRenderer.h"
#include "BatModel.h"

Expand Down
4 changes: 2 additions & 2 deletions Minecraft.Client/BeaconRenderer.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "stdafx.h"
#include "..\Minecraft.World\net.minecraft.world.level.tile.entity.h"
#include "..\Minecraft.World\net.minecraft.world.level.h"
#include "../Minecraft.World/net.minecraft.world.level.tile.entity.h"
#include "../Minecraft.World/net.minecraft.world.level.h"
#include "BeaconRenderer.h"
#include "Tesselator.h"

Expand Down
2 changes: 1 addition & 1 deletion Minecraft.Client/BlazeModel.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "stdafx.h"
#include "..\Minecraft.World\Mth.h"
#include "../Minecraft.World/Mth.h"
#include "BlazeModel.h"
#include "ModelPart.h"

Expand Down
2 changes: 1 addition & 1 deletion Minecraft.Client/BlazeRenderer.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "stdafx.h"
#include "BlazeModel.h"
#include "..\Minecraft.World\net.minecraft.world.entity.monster.h"
#include "../Minecraft.World/net.minecraft.world.entity.monster.h"
#include "BlazeRenderer.h"

ResourceLocation BlazeRenderer::BLAZE_LOCATION = ResourceLocation(TN_MOB_BLAZE);
Expand Down
Loading