Skip to content

These docs were made completely by AI, so they might be right, or wrong, you'll need to test them yourself. This was made for a easier understanding of everything. So use at your own risk. If anything is wrong, please don't hurt to make a PR on the page you have a problem with. ON GITHUB

Architecture

LCE is split into two clearly separated modules. Minecraft.World is a self-contained static library with zero rendering code and zero platform dependencies. Minecraft.Client is the executable that adds rendering, input, audio, and platform-specific code on top.

LCEMP/
├── Minecraft.World/ # Game logic (static library)
│ ├── *.h / *.cpp # ~1,560 files flat in root
│ └── x64headers/ # Windows 64-bit specific headers
├── Minecraft.Client/ # Rendering, UI, platform (executable)
│ ├── *.h / *.cpp # Core client code (root level)
│ ├── Common/ # Shared cross-platform code
│ │ ├── Audio/ # Miles Sound System wrapper
│ │ ├── Colours/ # Biome colour lookup tables
│ │ ├── DLC/ # DLC pack management
│ │ ├── GameRules/ # Console game rule system
│ │ ├── Leaderboards/ # Leaderboard integration
│ │ ├── Media/ # Media archive handling
│ │ ├── Network/ # Cross-platform networking (QNet)
│ │ ├── res/ # Resources (textures, fonts, etc.)
│ │ ├── Telemetry/ # Analytics/telemetry
│ │ ├── Trial/ # Trial/demo mode logic
│ │ ├── Tutorial/ # In-game tutorial system
│ │ ├── UI/ # Iggy SWF UI framework
│ │ ├── XUI/ # Xbox-specific XUI helpers
│ │ └── zlib/ # Compression library
│ ├── Xbox/ # Xbox 360 platform layer
│ ├── Durango/ # Xbox One platform layer
│ ├── PS3/ # PlayStation 3 platform layer
│ ├── Orbis/ # PS4 platform layer
│ ├── PSVita/ # PS Vita platform layer
│ ├── Windows64/ # Windows 64-bit platform layer
│ └── Windows_Libs/ # Windows dev libraries
├── CMakeLists.txt # Build configuration
├── cmake/Sources.cmake # Source file lists
└── MinecraftConsoles.sln # Visual Studio solution

The build produces two targets:

TargetTypeDepends On
MinecraftWorldStatic library (.lib)Nothing (self-contained)
MinecraftClientWin32 executable (.exe)MinecraftWorld + all external libs

MinecraftWorld compiles first as a static .lib. Then MinecraftClient compiles and links against it, plus Direct3D 11, XInput, Iggy, Miles Sound System, and the 4J Studios platform libraries.

Both targets share these compile definitions:

DefinePurpose
_LARGE_WORLDSEnables large world support (bigger than the original 864x864 console worlds)
_WINDOWS64Selects the Windows 64-bit platform layer
_CRT_NON_CONFORMING_SWPRINTFSCompatibility for older C runtime string functions
_CRT_SECURE_NO_WARNINGSSuppresses MSVC secure CRT warnings

Debug builds add:

DefinePurpose
_DEBUG_MENUS_ENABLEDEnables in-game debug menus and debug overlay
_DEBUGGeneral debug mode flag

MinecraftWorld also gets _LIB to indicate it’s being compiled as a static library.

FlagWhat it does
/W3Warning level 3
/MPMulti-process compilation (parallel .cpp compilation)
/MT or /MTdMulti-threaded static CRT (matches 4J libs’ CRT linkage)
/EHscC++ exception handling model
MinecraftClient.exe
├── MinecraftWorld.lib (static, game logic)
├── d3d11.lib (Direct3D 11 rendering)
├── XInput9_1_0.lib (controller input)
├── iggy_w64.lib (Iggy SWF/Flash UI framework)
├── mss64.lib (Miles Sound System audio)
├── 4J_Input_r.lib / 4J_Input_d.lib (input abstraction)
├── 4J_Storage_r.lib / 4J_Storage_d.lib (file storage)
├── 4J_Profile_r.lib / 4J_Profile_d.lib (user profiles)
└── 4J_Render_PC.lib / 4J_Render_PC_d.lib (rendering)

Release libraries use the _r suffix, debug libraries use _d.

MinecraftWorld includes:

  • Minecraft.World/ (its own root)
  • Minecraft.World/x64headers/ (Windows 64-bit specific headers)

MinecraftClient includes:

  • Minecraft.Client/ (its own root)
  • Minecraft.Client/Windows64/Iggy/include/ (Iggy UI headers)
  • Minecraft.Client/Xbox/Sentient/Include/ (Sentient telemetry headers)

Note that MinecraftClient can include headers from MinecraftWorld via relative paths like ..\..\Minecraft.World\Entity.h. The dependency only goes one way: Client depends on World, never the other way around. There is one exception: Minecraft.World.cpp includes ..\..\Minecraft.Client\ServerLevel.h because the static constructor needs to call ServerLevel::staticCtor().

This is the game logic layer. No rendering code, no platform dependencies. Pure C++ game simulation.

SystemKey ClassesPurpose
BlocksTile, StoneTile, GrassTile, OreTile, etc.Block definitions, properties, behavior. 172 tile IDs registered
ItemsItem, WeaponItem, FoodItem, ArmorItem, DiggerItemItem definitions, tool tiers, food, armor, enchantability
EntitiesEntity, Mob, Player, Zombie, Skeleton, EnderDragonAll living and non-living entities with eINSTANCEOF type system
World GenBiome, BiomeSource, Layer subclasses23 biomes, layer-based biome map pipeline
StructuresStructureFeature, StructureStart, VillagePiecesVillages, strongholds, mine shafts, nether bridges, jungle temples, desert temples
AIGoal, GoalSelector, attack/move/look goalsMob behavior with prioritized goal system
NavigationPathNavigation, PathFinder, Node, BinaryHeapA* pathfinding over a node graph
CraftingRecipes, ShapedRecipy, ShapelessRecipy, FurnaceRecipes~100 shaped/shapeless recipes plus smelting
EnchantmentsEnchantment, 20 subclasses, EnchantmentHelperProtection, damage, digging, bow, thorns enchantments
EffectsMobEffect, MobEffectInstance, PotionBrewing19 status effects and potion brewing
ContainersAbstractContainerMenu, slot systemInventory UI logic: crafting, furnace, brewing, enchanting, anvil, trading
NetworkingPacket subclasses (98 packet types), ConnectionClient-server protocol for all game state sync
LevelLevel, LevelChunk, DimensionWorld state, tick loop, lighting, chunks, dimensions
StorageLevelStorage, ConsoleSaveFile, McRegionChunkStorageSave/load in console save format and McRegion format
NBTCompoundTag, ListTag, Tag hierarchyNamed Binary Tag serialization for all persistent data
CommandsCommand, GiveItemCommand, GameModeCommand, etc.10 server commands
StatsStat, Achievement, StatsCounterGameplay statistics and achievement tracking
MaterialsMaterial, MaterialColorBlock material properties (solid, liquid, flammable)
Math/PhysicsAABB, Vec3, Pos, TilePos, Mth, Random, FacingCollision boxes, vectors, positions, math utilities
VillagesVillage, Villages, VillageSiegeVillage door tracking and zombie siege events
DamageDamageSource, EntityDamageSource, IndirectEntityDamageSourceDamage type registry (fire, fall, entity, etc.)
TradingMerchantRecipe, MerchantRecipeList, ClientSideMerchantVillager trade offer system

This is the presentation layer. It depends on Minecraft.World and adds everything players see and interact with.

SystemKey ClassesPurpose
CoreMinecraftCentral class holding references to every subsystem
RenderingGameRenderer, LevelRenderer, EntityRendererPer-frame orchestration, world rendering, entity rendering
TesselatorTesselatorVertex buffer builder with thread-local storage for multi-threaded chunk rebuilds
Tile RenderingTileRenderer, TileEntityRenderDispatcherBlock rendering with AO, lighting cache, face culling
Entity RenderingEntityRenderDispatcher, MobRenderer, 40+ renderer classesEntity type to renderer mapping, all mob and entity renderers
ModelsHumanoidModel, ZombieModel, DragonModel, etc.3D model definitions built from ModelPart cubes
ParticlesParticleEngine, 25+ Particle subclassesVisual particle effects with per-layer rendering (max 200 per layer)
ScreensScreen, CreateWorldScreen, PauseScreen, ChatScreenGUI screen hierarchy
TexturesTextures, TextureMap, TexturePackRepository, StitcherTexture loading, atlas stitching, texture pack management
InputKeyboardMouseInput (PC), ConsoleInput (controller)WASD, mouse look, controller via XInput
FontFont, UIBitmapFont, UITTFFontText rendering with default and alternate character sets
GUIGui, GuiComponentHUD overlay (hotbar, chat, health, experience bar)
SettingsOptions17 game options (music, sound, sensitivity, render distance, etc.)
ServerMinecraftServer, ServerLevel, PlayerListIntegrated server for multiplayer hosting
NetworkingPlayerConnection, ServerConnection, ClientConnectionClient-side and server-side network handlers
CameraCamera, GameRendererFirst/third person camera with smooth movement
Split-ScreenPer-player arrays in Minecraft classUp to 4 local split-screen players
AudioSoundEngine, ConsoleSoundEngineMiles Sound System wrapper

The Common/ directory lives inside Minecraft.Client and contains cross-platform code shared by all platform targets:

DirectoryKey ClassesPurpose
Audio/SoundEngine, ConsoleSoundEngine, SoundNamesMiles Sound System abstraction with named sound lookups
Colours/ColourTableBiome colour lookup from colour tables
DLC/DLCManager, DLCPack, DLCFile subclassesDLC content: audio, textures, skins, capes, colour tables, game rules, localization, UI data
GameRules/GameRuleManager, GameRule, LevelGenerationOptions, ConsoleSchematicFileConsole-specific game rules, level generators, schematic system for custom structures
Leaderboards/LeaderboardManagerPlatform leaderboard integration
Media/Media archive handlingLoading bundled media archives
Network/CGameNetworkManager, PlatformNetworkManagerInterface, SessionInfoGame-level networking: hosting, joining, session discovery, player management via QNet
Telemetry/TelemetryManagerUsage analytics/telemetry
Trial/TrialModeDemo/trial version restrictions with timer
Tutorial/FullTutorial, TutorialTask subclasses, hints, constraintsFull tutorial system with area constraints, crafting tasks, pickup tasks, stat tracking
UI/UIScene, UIControl, UILayer, UIController, 50+ scene/control classesConsole UI framework built on Iggy (Flash/SWF). Scenes for every menu: HUD, inventory, crafting, settings, DLC store, etc.
XUI/XUI helpersXbox-specific XUI integration
zlib/zlib 1.2.xData compression (deflate, inflate, crc32, adler32)

4J Studios built platform abstraction libraries that LCE depends on. These come as pre-compiled .lib files:

LibraryPurpose
4J_InputCross-platform input abstraction (controller, keyboard)
4J_StorageCross-platform file storage, save management, profile data, DLC mounting
4J_ProfileUser profile management, game settings persistence
4J_RenderRendering abstraction layer (wraps D3D11, GCM, GNM, etc.)
LibraryPurpose
IggyFlash/SWF-based UI framework. All console menus and HUD elements are SWF movies controlled from C++ via IggyPlayer, IggyValuePath, and IggyName APIs
Miles Sound System (MSS)Audio middleware by RAD Game Tools. Handles sound playback, music streaming, 3D positional audio
QNetNetworking library used internally by the platform network managers for reliable UDP/TCP communication between console players
SentientTelemetry/analytics system for tracking gameplay events
Direct3D 11Windows rendering API (used only in the Windows64 platform layer)
XInputController input on Windows
zlibData compression for chunk data, save files, and network packets

Other console-specific dependencies:

  • Boost 1.53 (PS3 only)
  • libpng (for PNG image loading, save thumbnails)

LCE uses a static constructor pattern to register all game objects at startup. The entry point is MinecraftWorld_RunStaticCtors() in Minecraft.World.cpp, and the order matters:

1. Packet::staticCtor() - Register all 98 network packet types
2. MaterialColor::staticCtor() - Block material color palette
3. Material::staticCtor() - Block material types (solid, liquid, etc.)
4. Tile::staticCtor() - All 172 block types + auto-generate TileItems
5. HatchetItem/PickaxeItem/ShovelItem::staticCtor() - Tool effectiveness tables
6. BlockReplacements::staticCtor() - Block replacement mappings
7. Biome::staticCtor() - All 23 biome definitions
8. Item::staticCtor() - All items (offset by 256 from tile IDs)
9. FurnaceRecipes::staticCtor() - Smelting recipe table
10. Recipes::staticCtor() - Crafting recipe table (~100 recipes)
11. Stats::staticCtor() - Stats and achievements
12. Skeleton/PigZombie::staticCtor() - Mob-specific static data
13. TileEntity::staticCtor() - Tile entity type registry (13 types)
14. EntityIO::staticCtor() - Entity serialization registry
15. MobCategory::staticCtor() - Mob spawn categories
16. Item::staticInit() - Post-init item setup
17. LevelChunk::staticCtor() - Chunk static data
18. LevelType::staticCtor() - Level type registry (default, flat, large biomes)
19. Structure statics - Mine shaft, stronghold, village, scattered feature piece data
20. EnderMan::staticCtor() - Enderman carriable blocks list
21. PotionBrewing::staticCtor() - Potion brewing recipe chains
22. Enchantment::staticCtor() - All enchantment definitions
23. SharedConstants::staticCtor() - Global constants
24. ServerLevel::staticCtor() - Server level static data
25. Storage statics - SparseLightStorage, CompressedTileStorage, etc.
26. Villager::staticCtor() - Villager trade tables
27. GameType::staticCtor() - Game mode definitions

The comment in source says: “The ordering of these static ctors can be important. If they are within statement blocks then DO NOT CHANGE the ordering - 4J Stu”

Here’s how data moves through the system during gameplay:

Player Input (keyboard/mouse/controller)
KeyboardMouseInput / ConsoleInput
Minecraft::tick() ──────────────────────────► MinecraftServer::tick()
│ │
▼ ▼
MultiplayerLocalPlayer ServerLevel::tick()
│ │
▼ ▼
MultiPlayerGameMode Entity::tick() for all entities
│ Tile random ticks
▼ Weather, lighting, village siege
PlayerActionPacket / UseItemPacket │
│ ▼
▼ Packet serialization
WinsockNetLayer (TCP) │
│ ▼
▼ Network ── Other Players
PlayerConnection::handle()
Level state updates
LevelRenderer::setDirty() ──► Chunk rebuild (multi-threaded)
│ │
▼ ▼
GameRenderer::render() Tesselator ──► GPU vertex buffers
Direct3D 11 ──► Screen

LCEMP’s multiplayer uses a TCP-based system built on top of Winsock:

ComponentClassRole
Net LayerWinsockNetLayerLow-level TCP socket management, LAN broadcast/discovery
Game NetworkCGameNetworkManagerHigh-level session management, hosting, joining
ServerMinecraftServerIntegrated server running on the host’s machine
Server ConnectionsServerConnection, PlayerConnectionServer-side per-player connection handlers
Client ConnectionsClientConnection, PendingConnectionClient-side connection to the server
Packet SystemPacket base class, 98 subclassesSerialized game state changes (movement, block updates, container clicks, etc.)

The host runs both a MinecraftServer (game simulation) and a MinecraftClient (rendering). Clients connect over TCP and exchange Packet objects serialized through DataInputStream/DataOutputStream.

LAN discovery works by broadcasting a Win64LANBroadcast struct over UDP on port 25566 with a magic value 0x4D434C4E (“MCLN”). The struct includes the host name, game port, player count, host settings, and texture pack info. Clients listen on the same port and build a list of discovered sessions.

4J Studios added thread safety throughout the codebase for multi-threaded chunk rebuilding. Key patterns:

  • Critical sections (CRITICAL_SECTION) around entity lists (m_entitiesCS), tile entity lists (m_tileEntityListCS), lighting (m_checkLightCS), and chunk flags (m_csDirtyChunks)
  • Thread-local storage (TLS via DWORD tlsIdx) for the lighting cache, tile shapes, Tesselator instances, and Vec3 pools. Each thread that rebuilds chunks gets its own storage
  • Lock-free stack (XLockFreeStack<int>) for the dirty chunk queue in LevelRenderer
  • Per-player arrays in LevelRenderer for levels, chunks, tile renderers, and camera positions to support split-screen without locking

The multi-threaded chunk rebuild system uses up to 4 concurrent rebuild threads (MAX_CONCURRENT_CHUNK_REBUILDS = 4) on the Windows 64-bit build, with activation events and completion events to coordinate work.

All tiles and items are created through chained setter calls:

Tile::obsidian = (new ObsidianTile(49))
->setDestroyTime(50.0f)
->setExplodeable(2000)
->setSoundType(Tile::SOUND_STONE)
->setTextureName(L"obsidian")
->setDescriptionId(IDS_TILE_OBSIDIAN);

Each setter returns this, so calls chain together nicely.

Instead of C++ dynamic_cast (which is slow), 4J added a custom type enumeration. Every entity overrides GetType() to return its eINSTANCEOF value, and the codebase uses GetType() == eTYPE_ZOMBIE instead of dynamic_cast<Zombie*>(entity).

Mobs use a GoalSelector with prioritized Goal instances. Each goal has canUse(), canContinueToUse(), start(), stop(), and tick() methods. The selector runs the highest-priority goal that can currently be used. Mobs typically have two selectors: goalSelector for behavior (wander, eat, breed) and targetSelector for choosing targets (nearest attackable player, hurt-by retaliation).

Level broadcasts events to LevelListener instances. LevelRenderer implements this interface to receive notifications about tile changes, entity additions/removals, sounds, particles, and level events, which trigger chunk rebuilds and visual updates.

The codebase follows Minecraft’s original Java naming conventions, translated to C++:

  • Tiles (blocks): *Tile.h/.cpp (e.g., GrassTile, OreTile, FurnaceTile)
  • Items: *Item.h/.cpp (e.g., BowItem, ArmorItem, FoodItem)
  • Tile entities: *TileEntity.h/.cpp (e.g., ChestTileEntity, FurnaceTileEntity)
  • Tile items: *TileItem.h/.cpp (e.g., LeafTileItem, ClothTileItem)
  • Entities: Direct names (e.g., Zombie.h, Skeleton.h, Pig.h)
  • Packets: *Packet.h/.cpp (e.g., MovePlayerPacket, TileUpdatePacket)
  • Goals (AI): *Goal.h/.cpp (e.g., MeleeAttackGoal, FollowParentGoal)
  • Enchantments: *Enchantment.h/.cpp (e.g., DamageEnchantment, ProtectionEnchantment)
  • Biomes: *Biome.h/.cpp (e.g., DesertBiome, JungleBiome)
  • Features (world gen): *Feature.h/.cpp (e.g., OreFeature, TreeFeature)
  • Layers (biome gen): *Layer.h/.cpp (e.g., ZoomLayer, RiverLayer)
  • Screens: *Screen.h/.cpp (e.g., CreateWorldScreen, PauseScreen)
  • Models: *Model.h/.cpp (e.g., ZombieModel, DragonModel)
  • Renderers: *Renderer.h/.cpp (e.g., EntityRenderer, BoatRenderer)
  • Recipes: *Recip*.h/.cpp (note inconsistent spelling: Recipy, Recipies, Recipes)
  • Aggregate headers: net.minecraft.*.h files that bundle related headers (e.g., net.minecraft.world.level.tile.h includes all tile headers)

The project targets C++11 and uses:

  • shared_ptr heavily for entity/item/tile entity management
  • enable_shared_from_this so entities can get shared pointers to themselves
  • weak_ptr for the rider/riding relationship to avoid circular references
  • wstring for all text throughout (wide strings)
  • unordered_map and unordered_set for fast lookups
  • Traditional class inheritance (no templates or generics for game logic)
  • Virtual functions for polymorphism (entities, tiles, items, packets, goals)
  • Static arrays indexed by ID for tiles (Tile::tiles[4096]) and items (Item::items[32000])