feat: complete gameplay systems - weather, visibility, combat, durability, fluids, ores, lightning - #2
Merged
hekuo5310 merged 9 commits intoAug 31, 2026
Conversation
added 9 commits
August 31, 2026 12:36
Weather sync (new): - handlers/play/weather.py: Game Event payloads (begin/end raining, rain/thunder strength) with per-version packet IDs - broadcast weather changes to all clients from the server tick - send current weather state to players on join - server.set_weather() as the unified entry point (TimeManager + broadcast + plugin hook) Fixes: - /weather duration argument was computed but discarded; it now applies via TimeManager and broadcasts immediately - doWeatherCycle gamerule now freezes weather countdown when false - _tick_entity_sync hardcoded remove_entities packet ID 0x42 (1.21.1 only); now uses version-mapped _send_entity_remove Tests: 76 passed (14 new in tests/test_weather_sync.py).
Players can now see each other in-game: - handlers/play/players.py: Spawn Entity (type 128) + Set Entity Data (skin parts 0x7F) on join, bidirectional for existing players - movement packets relay position via Entity Teleport + Rotate Head to in-range observers, rate-limited through the network optimizer (network-movement-rate-hz) -- first real wiring of movement limiting - leave path cleans tracked_players alongside existing remove broadcast Fix: ENTITY_TYPE_IDS used wrong registry values (item 71->58, cow 30->22, pig 100->77, sheep 111->87, zombie 150->124), verified against PrismarineJS/minecraft-data pc/1.20.5 (registry shared by 1.21/1.21.1). Mob/item spawns previously rendered as wrong entities client-side. Limitation: player spawn only on the native 1.21.1 path; older clients need per-version Spawn Player packets (skipped, documented). Tests: 87 passed (11 new in tests/test_player_visibility.py).
- MinecraftServer.queue_or_send(): route high-frequency packets through the network optimizer's batch queue (single TCP write per tick), falling back to direct send when batching is disabled - _tick_entity_sync teleports now use queue_or_send; extracted build_entity_teleport_payload() for reuse - movement rate limiting was wired in 835af3f via relay_player_movement Tests: 90 passed (3 new in tests/test_network_optimizer_wiring.py).
- handlers/play/combat.py: Interact (0x14) attack handling with per-player attack cooldown, weapon damage table (swords/axes/trident), damage_mob() with death drops + XP orb spawning - MOB_PROFILES gains drops/xp for all mobs; skeleton marked ranged (damage reason distinguishes arrows from melee) - wire interact packet dispatch (was a TODO stub) Note: simple pathfinding (1-block step-up when chasing) already existed in MobEntity._apply_physics; full A* pathfinding remains future work. Tests: 98 passed (8 new in tests/test_combat.py).
- world/item_properties.py: max durability table (tools/weapons/armor, Java values), damage_item() with unbreaking enchant support, damage_held_item() with break handling (clear slot + inventory sync) - sharpness enchant adds attack damage (0.5*level + 0.5) - durability consumed on block break and mob attacks in survival/adventure mode - fix /enchant: used dict-style access on ItemStack (__slots__) and a nonexistent get_item_in_slot(); now stores in ItemStack.nbt and syncs Tests: 106 passed (7 new in tests/test_item_properties.py).
- falling water/lava (level 8-15) no longer dries itself up mid-column: a falling block directly above now counts as a valid feeder - falling fluid spreads horizontally at level 1 when it lands (previously level>=8 never passed the spread check, so waterfalls pooled nothing at the bottom) - infinite water sources: flow into a position with >=2 adjacent water sources and a solid/source block below now forms a source block Tests: 112 passed (6 new in tests/test_fluid_rules.py).
Rewrote OreVeinGenerator configs to match vanilla worldgen batches: - coal: 30x triangle(136..320) + 20x triangle(0..192, peak 96), size 17 - iron: triangle(-24..56) + triangle(80..384) + uniform(-64..72) batches - copper/gold/redstone/lapis: vanilla counts, ranges, vein sizes - redstone lower batch uses a proper trapezoid height provider - diamond: small/medium/buried batches + 1-per-9-chunks large vein (was a single 2-attempt batch -- far too rare) - implement discard_chance_on_air_exposure (0.5/0.7/1.0 by batch): veins touching air are discarded, buried batches never exposed - emerald kept rare pending biome gating (vanilla: mountains only) Note: parameters now match vanilla configs, but same-seed identical terrain still requires the full vanilla noise router -- out of scope. Tests: 117 passed (5 new in tests/test_ore_distribution.py).
…epo hygiene Lightning (new): - LightningBoltEntity (type 64, verified) spawns near a random player every ~5s during thunderstorms, despawns after 4 ticks - strike damages players and mobs within 3 blocks (5.0 damage) Watchdog: - tests/test_watchdog_e2e.py: real UDP roundtrip tests (PYMC_PING -> PYMC_HEALTH, PYMC_HB -> partner state update) -- the previously missing end-to-end coverage for the heartbeat protocol Repo hygiene: - untrack native build artifacts (.exe/.so/Linux ELF); they caused the macOS CI ELF mix-up fixed in 3fcab6f. Files stay on disk locally and are now gitignored; CI builds them via CMake. Vendored Java bridge jars remain tracked (runtime dependencies, not build outputs) Tests: 123 passed (6 new).
…, durability, lightning)
Member
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Completes the remaining gameplay systems to bring the server closer to vanilla 1.21.1 behavior. 9 commits, 34 files changed (+1847 / -76).
Features
/weatherduration fix,doWeatherCyclegamerule, properremove_entitiespacket handlingplayers.py— players see each other, movement relayed, entity type ID table correctedcombat.py— attacks, weapon damage, death drops, XP orbs, ranged mobsitem_properties.pyTesting
python -m pytest tests -q→ 123 passedNotes
origin/main(1c84fdd)ZerexaNet/PYMC, so this PR comes from forkPatrick130306/PYMC