Compatibility
Minecraft: Java Edition
1.21.x
1.20.x
1.19.x
Platforms
Links
Tags
Creators
Details
Licensed GPL-3.0-or-later
Published 3 months ago

功能概述 | Overview
一个轻量级 Paper 插件,用于限制每个区块内的实体自然生成数量,精细化控制服务器负载。
A lightweight Paper plugin that limits natural entity spawns per chunk for fine-grained server performance control.
核心特性 | Key Features
1. 按区块精准控制 | Per-Chunk Control
- 针对每个区块单独设置实体上限
- Set individual entity limits for each chunk
2. 跨世界支持 | Multi-World Support
- 自动区分不同世界的区块设置
- Automatically separates chunk settings by world
3. 仅限制自然生成 | Natural Spawns Only
- 只拦截自然生成的实体 (
NATURALSpawnReason) - Only intercepts naturally spawned entities
- 不影响刷怪笼、命令召唤、玩家繁殖等
- Does not affect spawners, commands, breeding, etc.
4. 持久化存储 | Persistent Storage
- 区块配置保存至
chunks.yml - Chunk configurations saved to
chunks.yml - 服务器重启后自动加载
- Automatically loaded on server restart
设计原理 | Design Principles
事件驱动 | Event-Driven
插件监听 CreatureSpawnEvent,在实体生成前判断当前区块实体数量是否超过上限:
The plugin listens to CreatureSpawnEvent and checks if the current chunk entity count exceeds the limit before spawning:
实体自然生成 → 获取所在区块 → 读取区块上限 → 超限则取消生成
Entity Spawns → Get Chunk → Read Limit → Cancel if Exceeded
默认上限 | Default Limit
- 未配置的区块默认上限为 20 实体
- Unconfigured chunks default to 20 entities
性能友好 | Performance-Friendly
- 使用内存 Map 缓存配置,避免频繁文件读取
- Uses in-memory Map cache to avoid frequent file reads
- 仅在配置变更时写入文件
- Only writes to file when configuration changes
命令 | Commands
主命令 / Main Command: /LimitEntitiesInChunk (简写 / Alias: /leic)
| 子命令 Subcommand | 说明 Description |
|---|---|
set <数量> |
设置当前所在区块的实体上限 Set entity limit for current chunk |
cancel |
取消当前区块的自定义上限(恢复默认 20) Remove custom limit for current chunk (reset to default 20) |
list |
列出所有已配置区块的上限 List all configured chunk limits |
使用示例 | Usage Examples
# 将当前区块实体上限设为50
# Set current chunk entity limit to 50
/leic set 50
# 取消当前区块的限制,恢复默认
# Remove current chunk limit, reset to default
/leic cancel
# 查看所有配置
# View all configurations
/leic list
配置文件 | Configuration
插件会在 plugins/MaxEntitiesInChunk/ 目录下生成 chunks.yml:
The plugin generates chunks.yml in plugins/MaxEntitiesInChunk/:
world:
"0,0": 50
"1,-2": 30
world_nether:
"5,10": 15
格式:世界名.区块X坐标,区块Z坐标: 上限
Format: worldName.chunkX,chunkZ: limit
安装 | Installation
- 下载插件 jar 文件 / Download the plugin jar
- 放入
plugins/文件夹 / Place inplugins/folder - 重启服务器 / Restart server


