Skip to content

[release-v1.2.2] 酿造台、药水外观、附魔与附魔书、铁砧、移除网页管理台 - #5

Merged
hekuo5310 merged 137 commits into
mainfrom
claude/magical-dijkstra-nro58t
Nov 21, 2026
Merged

hekuo5310 merged 137 commits into
mainfrom
claude/magical-dijkstra-nro58t

Conversation

@hekuo5310

Copy link
Copy Markdown
Member

概要

接在已合并的 #4(1.2.1)之后的内容,作为 1.2.2 发布。

发布方式:本 PR 标题含 [release-v1.2.2]。合并后,工作流会给合并提交打 v1.2.2 tag 并发布正式版(如果 tag 已经存在,只发预发布)。发布说明取 CHANGELOG.md 的 1.2.2 小节。

酿造台

  • 5 格容器和界面;漏斗按原版分面规则投放和取出。
  • 烈焰粉提供 20 单位燃料,每次酿造 400 刻、消耗一个原料;药水瓶状态随内容更新;进度随存档保存。
  • 常见的基础药水转换:水瓶 + 地狱疣、粗制药水加材料(治疗、速度、跳跃、力量等)、萤石粉增强、红石粉延长、发酵蛛眼转化、火药变喷溅、龙息变滞留。

药水外观

  • 药水按 1.21.1 原版药水注册表的 id 发给客户端(potion_contents 组件)。
  • id 来自注册表的注册顺序;仓库里 world/data/potions.json 只保存名字和顺序。

附魔与附魔书

  • 附魔数据来自 1.21.1 原版注册表(tools/gen_enchantment_data.py 生成 world/data/enchantments.json)。
  • 附魔信息随物品发给客户端,客户端回传的附魔物品能正确解析。
  • 附魔台:三个选项按原版费用计算,书架增加选项,点击后扣青金石和等级,书会变成附魔书。
  • 铁砧:合并附魔书或同类物品;结果在输出格;取走时扣材料和等级;互斥附魔不能合并;同级合并升一级。
  • 关闭附魔台或铁砧时,物品退还背包。

铁砧

  • 先前工作惩罚:结果的惩罚为 max(左, 右) * 2 + 1,合并时两边的惩罚计入费用(与原版一致)。
  • 新配置项 anvil-too-expensive-limit(默认 true,即原版行为)。设为 false 后,费用达到 40 级也能取出,只要等级足够。

移除

  • 删除网页管理台(admin/web.py、其测试和 web-admin-* 配置项)。终端控制台、RCON 和权限系统不受影响。

测试

  • pytest:265 个通过,1 个跳过(只检查 Python 引擎内部状态)。
  • tests/test_enchanting.py:附魔和药水的编码往返;附魔台和铁砧的全部交互;先前工作惩罚;费用上限开关(开和关,创造模式);配置文件读取。
  • tests/test_native_engine.py:酿造台、漏斗、堆肥桶、矿车、探测铁轨等在 C++ 引擎和 Python 引擎上的一致性。

已知限制

  • 药效未实现:药水外观已正确显示,但速度、治疗、再生等效果不作用于玩家。
  • 附魔还不支持:铁砧改名、修复耐久、附魔的随机掉落。
  • 酿造配方只覆盖常见的基础药水。
  • 普通矿车不会自动载上生物(这里没有实现)。
  • 刷线机、刷钩机和常见 TNT 复制机还需在真实客户端上实测。

Generated by Claude Code

hekuo5310 and others added 30 commits April 18, 2026 17:22
CI: Add a macOS build job to the GitHub Actions workflow and include world/blocks.json as a data file in Windows/Linux/macOS packaging. build.sh: check/install zstandard, verify g++ presence, compile native/terrain_gen, and pass native dir + blocks.json into Nuitka.

Code: handlers/configuration.py introduces _build_damage_type_registry() and uses it to send a full set of vanilla damage_type entries (prevents client crashes when keys are missing). world/terrain_native.py improves native binary discovery (cross-platform names, multiple search roots, executable checks) and updates log messages. Overall: enable macOS builds, bundle required data, and harden native terrain generator handling.
Introduce centralized server command handling and system chat utilities.

- Add execute_server_command in handlers/play.py to parse and run commands (help, list, say, tp, gamemode, stop) for both players and console callers; returns a bool indicating whether the command was handled.
- Add build_system_message_payload and send_system_message helpers for composing/sending system chat packets.
- Make player / command handling send replies to the correct source and broadcast server messages when appropriate. Improve tp and gamemode logic to support console-targeted usage and better validation.
- Call execute_server_command when a player issues a chat command.
- Add MinecraftServer.find_player and broadcast_system_message in network/server.py to find players by name and broadcast system messages.
- Add console_input_loop in main.py and start it alongside the server to accept console commands; ensure the console task is cancelled on shutdown.

Also wire up logging for console actions and ensure server.stop() is scheduled on stop command.
Introduce a permissions and web admin subsystem and integrate it into the server.

- Add admin module: PermissionManager (admin/permissions.py) with default groups, ops, bans, whitelist, file-backed permissions.json and helpers for group/user/ban/whitelist management.
- Add lightweight WebAdminServer (admin/web.py) providing an HTML UI and JSON API to view server status, run commands, manage permissions and edit allowed files.
- Hook permissions and web admin into server startup (network/server.py): load permissions, expose web admin, autosave toggle, world_time, weather and spawn_position state.
- Enforce login bans/whitelist in handlers/login.py and permission checks, many server commands and utilities in handlers/play.py (command aliases, recognized-but-unsupported list, spawn/position fixes, many command implementations and permission checks).
- Add default permissions.json and expose server.properties / config options (config.py + server.properties) for enabling/configuring the web admin and permissions file location.

These changes add administrative controls, web-based management and permission enforcement to the project.
Add native C++ terrain generator build and integration, and migrate chunk storage to vanilla Chunk NBT while keeping legacy PyMC cache compatibility.

Key changes:
- build.bat: compile native/terrain_gen.cpp with cl or g++, fail gracefully, and include native/ dir in PyInstaller data.
- handlers/play.py: move terrain init to server._initialize_terrain_generator(), simplify spawn height/center chunk logic, set chunk cache radius packet, use load_generated_chunk/save_generated_chunk for cached/generated chunks, and fix teleport packet to use ubyte flags and increment/send teleport_id.
- network/connection.py: add teleport_id field to Connection.
- network/server.py: initialize terrain generator at startup, pregenerate spawn-area chunks into Linear V2 storage, and store generator state (_use_native_terrain).
- world/chunk_io.py: large rewrite to encode/decode vanilla Chunk NBT (1.21.1-compatible) with palette/bitpacking, while retaining legacy PyMC binary format support and helper fast serialization from flat arrays.
- world/storage.py: add load_generated_chunk() and save_generated_chunk() helpers that work with the new Chunk NBT encoding.
- world/terrain_native.py: improve native binary lookup to consider compiled containing_dir and skip None roots.

Why: enable optional high-performance native terrain generation, switch world persistence to standard Chunk NBT for better compatibility, and pregenerate spawn chunks to reduce runtime stalls.
Introduce configurable multithreaded chunk generation and change join flow to send nearby chunks immediately while deferring distant ones.

- Add new config option `chunk-generation-multithreading` and map its type.
- Expose `chunk_generation_multithreading` and worker count in MinecraftServer; lazily create a ThreadPoolExecutor and provide `should_use_multithreaded_generation` and `generate_chunk_results` to load/generate/save chunks, using the executor when enabled.
- Refactor spawn-area pregeneration to reuse the new generation API and flush storage after generated chunks.
- In handlers.play, implement staged join: sort chunks by proximity, send an immediate radius of chunks synchronously, resolve spawn height from actual chunk data, and dispatch the remaining chunks asynchronously in the background.
- Add helper utilities in handlers.play (_sorted_chunk_coords, _resolve_spawn_height, _send_chunk_batch, _send_deferred_chunks) and minor logging updates.
- Ensure executor is shutdown on server stop and add `chunk-generation-multithreading` to server.properties.

These changes speed up player join by prioritizing nearby chunks and allow optional parallel chunk generation on multi-core systems while preserving existing native generator behavior.
Add configurable spawn coords, chunk generation and join-preload settings and persist runtime changes to server.properties. README and default config include level-spawn-x/y/z, chunk-generation-workers and join-immediate-radius; server.properties updated with defaults. MinecraftServer now accepts a config_path, reads spawn position and join_immediate_radius from config, computes chunk_generation_workers (honoring configured value or auto-picking based on CPU), and exposes save_runtime_config() which writes difficulty, gamemode, spawn and related settings back to disk. send_join_game now uses server.join_immediate_radius to determine immediate chunk preload, and command handlers call save_runtime_config() when relevant settings change.
Refactor spawn resolution and enhance terrain surface placement.

- handlers/play.py: replace _resolve_spawn_height with _resolve_spawn_location that searches a radius (8) around the configured spawn and picks a safer, flatter landing spot. Imports block constants and evaluates columns to ensure headroom (two air blocks), prefers natural surface blocks (grass, dirt, sand, etc.), penalizes stone and low-altitude spots, and scores by distance+slope. Updates server.spawn_position to a full (x,y,z) integer tuple and adjusts join logging.

- world/terrain.py: compute local slope from neighbor heightmap values and use it to influence surface block selection and filler depth. Steep or high-altitude areas now get thicker/coarser top/filler blocks (coarse_dirt) to reduce exposed stone cliffs and improve visual transitions.

- Added compiled __pycache__ artifacts for updated modules.
Add _build_chunk_light_data to construct simplified sky/block light info for 26 sections (24 world sections + top/bottom boundaries). Sky light is set to full brightness for open columns until the first non-air/non-fluid block; top boundary is full bright and bottom is empty. Integrate this into _send_prebuilt_chunk: emit sky/block masks, empty masks and the actual light arrays instead of sending all-full/all-empty placeholders. Propagate chunk_blocks through chunk batch handling and server result tuples so prebuilt chunk sender can compute lighting.
Introduce a new biome system (world/biomes.py) providing a biome registry and BiomeSampler using octave noise to sample surface and underground biomes. Integrate biome registry into handlers/configuration so biome entries are sent via the registry packet. Wire BiomeSampler into the server: generate per-section biome data for chunks and propagate chunk_biomes through chunk generation and saving. Update chunk building and serialization to support per-section biome palettes and paletted biome containers (world/chunk.py, world/chunk_io.py, world/storage.py, network/server.py). This enables clients to receive accurate biome data and ensures biome information is persisted with generated chunks.
Introduce basic player survival mechanics and richer terrain decoration:

- Connection: add fall_start_y, health, food, saturation, gamemode fields.
- Handlers/play: initialize gamemode and fall_start_y on join; send health and time on join; adjust spawn resolution logic (remove special-case STONE scoring); add _damage_player, _update_player_motion_state, _send_update_health, _send_time_update; invoke motion updates in position/rotation handlers and apply fall damage/respawn logic.
- Server: advance world_time each tick and add _tick_players to apply void damage and periodic time sync (every 40 ticks).
- Terrain: integrate BiomeSampler and add _place_decorations to spawn trees, surface plants, seagrass/kelp and coral with biome-aware rules.

These changes add foundational survival features (fall/void damage, health/respawn, hunger/saturation tracking, time sync) and improve world visuals with biome-driven decorations.
Track and stream chunks around moving players and harden native terrain generator startup.

- network/connection.py: add connection state for chunk management (loaded_chunks, chunk_center, chunk_stream_task).
- handlers/play.py: set chunk_center on join, mark initial and deferred chunks as loaded, and add _stream_chunks_around_player to dynamically generate/send missing chunks when the player moves between chunk centers. Add _schedule_chunk_stream_update to serialise streaming tasks and hook it into player position/rotation handlers.
- world/terrain_native.py: import time, log a warning when no native binary is found, add a short delay after starting the native terrain subprocess and detect immediate exits to log stderr and avoid keeping a dead process.

These changes ensure players receive newly visible chunks as they move and improve diagnostics/reliability for the native terrain generator startup.
Add persistent per-player JSON save/load and restore logic, plus safety checks and server hooks.

- README: expanded Chinese documentation and usage notes, added features, config, packaging and status sections.
- handlers/play.py: load player data on join and restore position, orientation, health, food, saturation, gamemode and on_ground; introduce _get_block_at, _is_safe_player_location and _resolve_initial_player_location to prefer saved positions and fall back to a safe spawn resolved from world data; update logging and position sync.
- network/server.py: add save_player_state and save_all_player_states methods; call saves on player disconnect, during autosave, and on server shutdown.
- world/storage.py: add playerdata directory management and JSON-based load_player_data / save_player_data methods; ensure playerdata dir is created and add json import.

Overall intent: provide durable player state between sessions and avoid spawning players into unsafe locations, while wiring saves into existing lifecycle (disconnects, autosave, shutdown).
Include the native terrain generator in CI and local builds and improve runtime discovery.

- CI/build scripts (.github/workflows/build.yml, build.bat, build.sh): add --include-data-files entries to bundle terrain_gen for Windows, Linux and macOS builds.
- handlers/play.py: use math.floor for restored player coordinates to avoid fractional position issues when resolving spawn/saved locations.
- network/server.py: add Path-based search for explicit terrain_gen binary across likely runtime roots and pass found path into NativeTerrainGenerator.
- world/terrain_native.py: expand _find_native_binary to walk ancestor directories, glob additional candidate locations, and allow passing an explicit binary_path to NativeTerrainGenerator.

These changes make packaging and locating the native terrain generator more robust across platforms and packaging methods (Nuitka/PyInstaller) and improve saved-position handling.
Add batched streaming for sending many chunk results to clients: introduce CHUNK_STREAM_BATCH_SIZE and a new helper _send_chunk_results_streamed that slices chunk_results into small batches, sends each via _send_chunk_batch, yields to the event loop (asyncio.sleep(0)), and exits early if the connection dies. Replace direct _send_chunk_batch calls in _send_deferred_chunks and _stream_chunks_around_player with the streaming helper to reduce client packet load.
Introduce a basic entity system and expand player environmental/damage handling.

- Add world/entities.py: Entity, ItemEntity, MobEntity classes and an EntityManager to create, tick, list and remove entities (item/mob spawning, simple physics and AI placeholders).
- Integrate EntityManager into server: instantiate in MinecraftServer, call tick() each server tick, and expose get_block_at and online player state serialization.
- Extend Connection with new state fields: air_supply, fire_ticks, freeze_ticks, damage_cooldown_ticks, last_damage_reason.
- Add environmental/damage logic in handlers/play.py: passable block set, suffocation checks, player block position helpers, _tick_damage_effects to handle drowning, fire/lava, cactus/berries, powder snow freezing, hunger healing/damage, and damage cooldowns; ensure respawn resets states.
- Add server commands: entities (counts), summon (items and a few mobs), kill (single ID or @e), and damage (apply damage to player), and update help/console messages and gamemode normalization.
- Minor fixes: prevent repeated damage via cooldown, send additional player state when joining, and small refactors for block lookups.

These changes add foundational entity support and more realistic environmental interactions for players and entities.
Introduce ExperienceOrbEntity and support for spawning, syncing, teleporting and removing experience orb entities. Added create_experience_orb in EntityManager, entity tick physics/aging, and metadata for orb count. Handlers: new helpers to send orb spawn, entity teleport, and entity removals; send visible entities to player on join; broadcast spawn/remove utilities; and a tracking range helper. Server: fixed remove-entities packet id to 0x47, added periodic _tick_entity_sync to push orb teleports and removals every 10 ticks, and integrated entity sync into the game loop. Commands: extend summon to accept "orb" and handle orb spawning, and ensure entity removals (@e and single id) broadcast removal packets. Also import write_angle where needed.
Terrain: rewrite native/terrain_gen as a port of the vanilla 1.21.1
overworld generator driven by the vanilla worldgen JSON (noise router
and density functions, Xoroshiro/legacy random, Perlin/Normal/Blended
noise, aquifers, ore veins, multi-noise biome lookup, surface rules,
Climate.findSpawnPosition), plus biome-aware feature decoration
(trees, plants, ores, disks) that spans chunk borders. The server
auto-builds the generator when no current binary is found.

Saving: store regions as vanilla Anvil .mca (Linear worlds are
converted on startup), write vanilla playerdata/<uuid>.dat NBT, and
fix the block state property order (legacy chunks are detected and
migrated).

Spawning: vanilla world spawn search and spawnRadius fudging so new
and respawning players land on safe ground, never in water, lava,
tree tops or inside blocks. Respawn resolves off the event loop and
sends position/health before streaming chunks.

Also: cache encoded chunks and packets so joins/respawns don't
re-encode unchanged chunks, and let block placement replace clicked
replaceable blocks (grass, ferns, single snow layers) like vanilla.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MqNsCYYKLCUPjt3r1MFKgu
windows.h defined min/max macros that broke every std::min/std::max in
the worldgen headers; define NOMINMAX (and WIN32_LEAN_AND_MEAN) before
it and pass /DNOMINMAX from CMake, build.bat and the auto-builder.
Drop /fp:contract-, which MSVC does not know: /fp:precise already
keeps a*b+c unfused, so terrain stays bit-identical to Java.

Pushing a v* tag now builds and tests all three platforms and publishes
a release (PyMC-linux / PyMC-macos / PyMC-windows.exe plus the native
helpers) with notes taken from the new CHANGELOG.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MqNsCYYKLCUPjt3r1MFKgu
Nuitka's --include-data-dir silently skips .exe/.dll/.so/.dylib files,
so the packaged servers never contained terrain_gen/mob_ai and fell
back to the Python generator (~8 s per chunk). List the native files
explicitly with --include-data-files and fail the build if they are
missing or report the wrong worldgen version.

While the spawn area is prepared, /stop (console), Ctrl+C and SIGTERM
now take effect after the current chunk instead of after startup; a
world stopped before its spawn was chosen is saved with
initialized=0 so the next start searches again. Without the native
generator only 3x3 spawn chunks are prepared, with per-chunk progress.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MqNsCYYKLCUPjt3r1MFKgu
Chunks: section/heightmap/NBT encoding now works on whole lists
(world/fastpack.py, output byte-identical to before) and the native
generator output is read without quadratic concatenation, ~150 ms ->
~35 ms per new chunk. Chunks beyond the join radius are generated and
sent nearest first in pipelined batches of 32, so the view fills in
within seconds instead of everything arriving after ~1 minute.

Crafting: the 2x2 inventory grid and the crafting table now work, with
all vanilla 1.21.1 shaped/shapeless recipes (tags resolved, mirrored
shapes, crafting remainders; tools/gen_recipe_data.py builds
world/data/recipes.json). Result slot clicks, shift-crafting, number
keys and dropping behave like vanilla; grids empty back into the
inventory on close or logout. Clicks are answered like vanilla with
only the slots the client predicted wrong (one state id per answer)
instead of a full window each time, which raced with fast clicking.

Leaves drop by the vanilla loot table (saplings 1/20, jungle 1/40,
sticks 1/50, apples 1/200, Fortune-scaled; shears/Silk Touch keep the
leaves) instead of always dropping a sapling or the leaves themselves.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MqNsCYYKLCUPjt3r1MFKgu
Mobs treated grass, flowers, torches and every other block without a
collision box as walls, so on vanilla terrain they got stuck within a
block and hostile mobs never got close enough to hurt anyone. Mob
physics now uses the collision data from blocks.json.

Damage follows vanilla: weapon damage/attack speed tables, attack
strength scaling instead of dropping clicks within 0.4 s, critical
hits, armor + toughness, protection enchantments, difficulty scaling of
mob damage, the 10-tick invulnerability window (for players and mobs)
and 3 s spawn invulnerability on join/respawn.

Region files were written concurrently by the event loop and chunk
worker threads, racing on the same .tmp file ("Failed to save region");
all region access is now serialized.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MqNsCYYKLCUPjt3r1MFKgu
Block and entity drops now come from the vanilla 1.21.1 loot tables
(tools/gen_loot_data.py -> world/data/loot_tables.json): Fortune and
Looting formulas, Silk Touch, shears, random chances, crop ages,
killed-by-player drops, explosion decay, sheep wool by colour.
Blocks drop with bare hands unless vanilla requires the correct tool
(blocks.json harvestTools); before, dirt, logs, sand etc. dropped
nothing without a tool.

TNT is primed into a TNT entity with an 80-tick fuse (flint and steel,
redstone) instead of exploding instantly. Explosions use the vanilla
ray algorithm with block blast resistance, chain-prime TNT, drop blocks
through their loot tables, damage and push entities by exposure, and
send the 1.21.1 Explosion packet (the old packet layout would make
clients disconnect).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MqNsCYYKLCUPjt3r1MFKgu
Replace the approximate redstone engine (full recompute of a component
registry every other tick) with a port of the vanilla 1.21.1 update model
in world/rs: setBlock with update flags, onPlace/onRemove, block updates
in W,E,D,U,N,S order, shape updates, scheduled ticks ordered by
(tick, priority, sub-tick), block events and moving-piston block entities,
run every game tick in vanilla phase order.

Components follow the vanilla classes: redstone wire (connection shapes,
weak/strong power via shouldSignal, update order from Java HashSet
iteration), torches with burnout, repeaters (delay, locking, priorities),
comparators (compare/subtract, container/cauldron/composter/cake
readings), observers, levers, buttons, pressure plates, redstone lamps,
TNT, note blocks, doors/trapdoors/fence gates, dispensers/droppers,
hoppers, powered/activator rails and pistons (structure resolver with
slime/honey, push limit 12, push reactions, moving pistons, finalTick,
fast retraction). Quasi-connectivity, BUD pistons and 0-tick behaviour
emerge from this instead of being special-cased; scheduled ticks survive
restarts. Clients get Block Action packets for piston animations.

Placing blocks now uses vanilla getStateForPlacement rules (piston,
observer, repeater, comparator, hopper facing; lever/button faces; wall
torches; slab/stair halves; log axes; trapdoors; doors and beds with both
halves; signs; waterlogging) and items whose block has another name
(redstone -> redstone_wire, string, seeds, ...) can be placed at all.
Every edit through world.editing (placing, breaking, /setblock, /fill,
/clone, explosions) notifies the engine; /setblock accepts name[prop=val].

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MqNsCYYKLCUPjt3r1MFKgu
TripWireHookBlock.calculateState (cached line states written back,
10-tick recheck when the line changes), tripwire connections, update
sources and entity detection, as in vanilla, so string/hook behaviour
under pistons follows the same code path as the vanilla server.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MqNsCYYKLCUPjt3r1MFKgu
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MqNsCYYKLCUPjt3r1MFKgu
TNT dupers work again: pistons capture the pushed states before moving
them, so a budded TNT primed by an update inside that window is still
placed by the moving piston. The missing pieces were vanilla details:
coral fans are pushable (MC-133541) and pop without support, rails are
pushable, and powered/detector/activator rails update their
surroundings when removed (BaseRailBlock). A layout search found
duplicating layouts; one is kept as a regression test.

Explosions are computed (rays, exposure, loot rolls) on a dedicated
explosion thread pool regardless of the multithreading setting, and
applied back on the server thread (damage, knockback, block changes,
redstone updates, drops, packets), skipping blocks that changed in the
meantime. Queued explosions run as background tasks in order, so the
game tick no longer waits for them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MqNsCYYKLCUPjt3r1MFKgu
native/vanilla is a line-by-line port of world/rs (setBlock, block and shape
updates, scheduled ticks, block events, moving pistons; BUD, quasi-connectivity,
0-tick and TNT duplication emerge the same way), loaded in-process through
ctypes. Adds the vanilla hopper block entity (cooldowns, push then pull,
locking, sided furnace slots, item pickup) and computes explosion rays and
exposure in C++ on the explosion thread.

The Python engine stays as fallback and reference: every redstone test is
rerun on the native engine and 300 random circuits are compared tick by tick.
CMake, build scripts and CI build and package the library.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MqNsCYYKLCUPjt3r1MFKgu
Double chests: vanilla placement joins a single chest beside the new one,
ChestBlock shape updates join and split the halves (both engines), a 54-slot
window opens, and hoppers and comparators see one compound container with
the right half first.

Hopper minecarts: minecart entities follow straight, curved and sloped rails
with powered-rail boost and braking; a hopper minecart sucks one item per
tick from the container above (or picks up items) unless it stands on a
powered activator rail; hoppers push into and pull from minecarts next to
them; players open and break them; they are saved with the world.

Composters: hoppers fill them with the vanilla compost chances, level 7
becomes ready after 20 ticks, hoppers below take the bone meal; players
compost and empty them by hand.

The native hopper code now tags every slot with the inventory that owns it
(block container, entity, composter), so all views stay consistent.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MqNsCYYKLCUPjt3r1MFKgu
… release from PR title

Minecarts: players ride plain minecarts (interact to get in, W pushes the cart,
sneak gets out; Set Passengers and Player Input), walking into a minecart
pushes it, minecarts push each other apart (AbstractMinecart.push), moving
minecarts are synced every tick. Detector rails power while a minecart is on
them and comparators read a container minecart (both engines).

Brewing stands get their 5-slot container and window, and hoppers follow the
vanilla faces: ingredients from above, bottles and blaze powder from the side,
potions out of the bottom.

CI: merging a pull request whose title contains [release-vX.Y.Z] tags the
merge commit vX.Y.Z and publishes the stable release in the same workflow.
CHANGELOG gets a 1.2.1 section for everything after v1.2.0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MqNsCYYKLCUPjt3r1MFKgu
A blaze powder gives 20 fuel; a brew starts with ingredient and fuel and
takes 400 ticks, consuming one ingredient. The bottle state follows the
slots (has_bottle_0..2) and brewing progress is saved with the world.
Common base-potion mixes are covered: water + nether wart, awkward + the
ingredient table, glowstone (strong), redstone (long), fermented spider eye,
gunpowder (splash) and dragon breath (lingering).

Potion appearance and effects are not sent to clients yet: that needs the
potion and mob effect registry ids, which the server does not send.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MqNsCYYKLCUPjt3r1MFKgu
Enchantment data is generated from the 1.21.1 registry (tools/gen_enchantment_data.py)
into world/data/enchantments.json: max levels, cost formulas, weights, anvil cost,
accepted items, exclusive sets, treasure and curse flags.

Enchantments are sent to clients (enchantments and stored_enchantments components)
and read back from their echoes, so enchanted items show their glint and tooltip.

The enchanting table offers three enchantments from the vanilla cost roll, with the
power from bookshelves; the enchant button spends lapis and levels and rerolls the
seed. The anvil merges an enchanted book (or a matching item) into the left item,
with the result slot taken only (levels and inputs are spent on take). Closing
either window returns its inputs.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MqNsCYYKLCUPjt3r1MFKgu
…nsive switch; potion appearance

The web admin console (admin/web.py, its tests and the web-admin-* settings) is removed.
Terminal console, RCON and permissions are unchanged.

Anvils charge the prior work penalty of both items and give the result max(left, right) * 2 + 1
(vanilla). The new anvil-too-expensive-limit setting (default true, vanilla) can be switched off:
results costing 40 levels or more are then no longer refused.

Potions show their appearance: the potion_contents component carries the potion's registry id.
The ids are the registration order of the 1.21.1 potion registry; world/data/potions.json keeps
only the names and their order. Potion effects are not applied yet.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MqNsCYYKLCUPjt3r1MFKgu
…s, web console removal)

Everything after the merged 1.2.1 pull request moves to a 1.2.2 section.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MqNsCYYKLCUPjt3r1MFKgu
main and this branch share the same history from PR #4 onward only through
the squashed merge; the conflicts were the same files written in both
histories. Resolved in favour of this branch. main still referred to
pumpkin-ref/, which is gone; those references are removed here.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MqNsCYYKLCUPjt3r1MFKgu
…caches, smaller block tables

- Native mob AI: one 'B' request per tick for all mobs (players sent once); the single
  'T' request is unchanged. MobEntity.tick is split into tick_begin / tick_finish so the
  batch can run between them. 300 mobs + 200 items: ~17 ms -> ~3.6 ms per tick.
- Minecarts: EntityManager.of_kind index instead of scanning every entity, and a
  2-block grid for collisions (pairwise test removed). 200 carts: ~13.6 ms -> ~3.2 ms.
- Memory: block state tables share keys and property pairs; the legacy table is built
  only when an old chunk is read (module import ~32 MB -> ~14 MB; idle RSS ~115 -> ~89 MB).
- Decoded chunk cache 192 -> 64 (configurable: chunk-decode-cache).
- Native redstone mirror: bounded (redstone-chunk-cache, default 256), evicted each tick;
  the periodic full invalidation is gone.
- mob_ai: buffered pipes.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MqNsCYYKLCUPjt3r1MFKgu
…n-version

Tests pass on 3.14 with the same results as 3.13 (267 passed, 1 skipped with cryptography
installed). Nuitka 4.3.5 installs and runs on 3.14.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MqNsCYYKLCUPjt3r1MFKgu
…ed in

native/vanilla/lighting.h reproduces world/lighting.py, which is an approximation
(per chunk column, no light across chunk borders), not vanilla lighting. It is not
used by the server yet and will be replaced by a vanilla-accurate engine or dropped.
blocktable.h now reads blocks.json filterLight / emitLight. The library keeps
vrs_version 4 (the additions are compatible).

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MqNsCYYKLCUPjt3r1MFKgu
Dead code removed:
- old redstone implementation, block table generator, watchdog health
  check and restart handler, Python worldgen client
- early C++ server, lighting, physics, plugin and mod sources that
  nothing built or loaded
- command modules core/server/gamerule that were never called, and the
  unregistered commands/vanilla/scoreboard.py
- command registrations that were overridden by a later one

Fixes:
- execute store / execute if score used a different scoreboard manager
  than /scoreboard and /trigger; they now share one
- closing an enchanting table or anvil with items that do not fit in the
  inventory raised NameError (missing import)

Deduplication:
- tree, plant and underwater decoration methods shared by the two Python
  terrain generators moved to world/terrain_decor.py (DecorationMixin)
- chunk packet builder for 1.17/1.19/1.20 kept once in VersionHandler
- /xp uses the same experience curve as the player experience code

CMake builds only terrain_gen, mob_ai and pymc_vanilla. README and
CHANGELOG updated.

Session: https://claude.ai/code/session_01MqNsCYYKLCUPjt3r1MFKgu
Advancements:
- world/advancements.py: story-branch tree, per-player progress saved
  to world/advancements/<uuid>.json, 1.21.1 update packet (tree and
  progress on join, increments on change), inventory-based criteria
  checked every 20 ticks, grant/revoke modes for /advancement
- /advancement now changes real progress instead of an in-memory dict

Light:
- native/vanilla/light.h: port of world/lighting.py's per-chunk light,
  exported as vrs_light_compute (ABI version 5)
- compute_light_flat takes a flat array and uses the native engine;
  the nested-list path stays in Python (faster until the chunk pipeline
  passes flat arrays)
- tests check native and Python output match byte for byte

Session: https://claude.ai/code/session_01MqNsCYYKLCUPjt3r1MFKgu
- story tree: iron pickaxe, lava bucket, diamond and diamond armour
  (9 story advancements in total, all triggered by inventory contents)
- compute_light uses Python for nested lists again; the previous commit
  sent them to the native engine, which was slower because of the
  conversion. The native path is used by compute_light_flat only.

Session: https://claude.ai/code/session_01MqNsCYYKLCUPjt3r1MFKgu
- trigger(): an event grants a criterion from synchronous game code;
  flush() sends the change on the next tick and announces completions
- on_mob_killed(): any kill grants adventure/root, a hostile kill also
  grants adventure/kill_a_mob (hooked into damage_mob)
- enchanting table success grants adventure/enchant_item
- adventure tab added to the tree (12 advancements in total)

Session: https://claude.ai/code/session_01MqNsCYYKLCUPjt3r1MFKgu
Biomes:
- native/vanilla/biome.h: the biome rules and octave noise, exported as
  vrs_biome_create / vrs_biome_sections (ABI version 6). Noise tables are
  still built in Python with the same generator; results match the Python
  sampler exactly (tests/test_biome_native.py). Library built with
  -ffp-contract=off (and /fp:precise on MSVC).
- ~118 ms -> ~2 ms per chunk.

Spawning:
- world/spawning.py replaces the old trickle (2 mobs per 200 ticks).
  Hostile mobs need brightness <= 7 (sky darkness 11 at night), passive
  mobs need grass and brightness >= 9, nothing within 24 blocks of a player,
  caps of 70 hostile and 10 passive per player, despawn beyond 128 blocks
  and a chance beyond 32 for hostile mobs.
- Light comes from world.lighting per chunk, cached for 200 ticks.

Session: https://claude.ai/code/session_01MqNsCYYKLCUPjt3r1MFKgu
@hekuo5310
hekuo5310 merged commit 5042356 into main Nov 21, 2026
6 checks passed
@hekuo5310
hekuo5310 deleted the claude/magical-dijkstra-nro58t branch November 21, 2026 12:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants