Skip to content

feat: complete gameplay systems - weather, visibility, combat, durability, fluids, ores, lightning - #2

Merged
hekuo5310 merged 9 commits into
ZerexaNet:mainfrom
Patrick130306:feat/gameplay-completion
Aug 31, 2026
Merged

hekuo5310 merged 9 commits into
ZerexaNet:mainfrom
Patrick130306:feat/gameplay-completion

Conversation

@Patrick130306

Copy link
Copy Markdown

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

  • Weather sync: client-side weather state broadcast, /weather duration fix, doWeatherCycle gamerule, proper remove_entities packet handling
  • Player visibility: new players.py — players see each other, movement relayed, entity type ID table corrected
  • Network optimization: entity sync broadcast batching + movement rate limiting
  • Combat system: new combat.py — attacks, weapon damage, death drops, XP orbs, ranged mobs
  • Item durability + basic enchanting: new item_properties.py
  • Fluid rules: falling water columns, ground spread, infinite water sources
  • Ore generation: aligned with vanilla 1.21.1 batch parameters
  • Thunderstorms: lightning strikes + watchdog UDP end-to-end tests + repo hygiene
  • Docs: README development checklist updated

Testing

  • python -m pytest tests -q123 passed
  • Server startup smoke test OK
  • ⚠️ Not yet tested with a real Minecraft client

Notes

  • Base: origin/main (1c84fdd)
  • No direct push access to ZerexaNet/PYMC, so this PR comes from fork Patrick130306/PYMC

Kimi 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).
@hekuo5310
hekuo5310 merged commit c15233a into ZerexaNet:main Aug 31, 2026
@hekuo5310

Copy link
Copy Markdown
Member

来拷打了,不知道是你还是arun的问题地形生成器启动不了反正我没review(
你肯定没调试!无论是谁的问题你肯定都没调试!
不过glm在给我修复了,调试是什么?我不知道~
图片

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.

2 participants