** 注意:此功能在 1.4+ 版本中已失效,且 /destroyAndRegenerateArea 命令自 1.2+ 起已损坏。我可能会在未来重写此插件,但不保证会实现。欢迎提交补丁!详见 GitHub。 **
WorldGenerationControl 2.6
原名 ForceGenChunks
这个名字太蠢了,所以我改了它
这是一个非常简单的插件,允许你预生成世界的一个区域。它不会影响已经生成的区域。从 2.0 版本开始,它还可以修复现有区域的光照。
功能
- 通过坐标生成任意区域
- 队列化多个生成任务
- 多种速度设置以控制卡顿与生成时间的平衡
- 适用于在线服务器
- 不会锁定服务器(除非使用 /allAtOnce 选项)
- 内存占用低,在仅有 1GB 内存的服务器上也能正常运行。
- 生成树木和矿石,而不仅仅是地形
- 可以生成有效的光照数据
- 可以对已有区块强制重新生成光照,以修复光照问题。
缺陷/特性
- 生成地形非常消耗 CPU —— 这是插件无法避免的!如果你不想让在线服务器卡顿,请使用 /slow 或 /veryslow 模式。
- 设计用于分配至少 1GB 内存的服务器(-Xmx1024M)。内存限制较低的服务器可能会遇到堆异常。如果你的内存少于 1GB,请尝试使用 /slow 或 /veryslow 模式。
命令
/genregion(或 /generateregion)命令可由任何服务器管理员、服务器控制台或拥有适当权限的人输入(见下文)。
语法如下:
/genregion WorldName StartX StartZ EndX EndZ
对于圆形区域(/generatecircularregion 或 /gencircle):
/gencircle Radius [WorldName xCenter zCenter]
如果你是玩家(而非控制台),则世界名称和圆心坐标为可选参数。它将默认使用你当前的位置/所在世界。
所有坐标均为游戏内的常规坐标——但会自动调整到最近的区块边界(包含边界本身)。
选项
所有命令都可以附加选项,用法如下:
/gencircle 1600 MyWorld 0 0 /fast /lighting
选项不区分大小写。可用的选项有:
- /allAtOnce - 不在步骤之间暂停,一次性生成所有请求的内容。这会导致服务器在生成完成前基本不可用,但能最快完成任务。非常适合与 /onlyWhenEmpty 配合使用
- /veryFast, /fast, /slow, /verySlow - 调整速度。如果指定了 /allAtOnce,则此选项无效。通常插件在生成时会引起轻微卡顿,平均每三秒执行约 700ms 的工作量(具体取决于服务器 CPU)。提高速度(fast 或 veryfast)会增加卡顿但加快生成速度;降低速度(slow 或 veryslow)会减少卡顿但增加生成时间。Veryfast 会引起大量卡顿。Veryslow 几乎不会引起卡顿,但耗时可能是原来的 10 倍左右。
- /forceKeepUp - 强制服务器“跟上”垃圾回收和区块保存的速度。特别是 1.9 引入了新的异步区块保存器,其似乎受到速率限制,可能无法跟上快速生成的节奏。此选项强制立即保存区块,而不是在单独的线程上保存。如果你注意到插件花费大量时间“等待服务器赶上进度”,且不介意因强制跟上而产生的微小 CPU 开销,请使用此选项。/allAtOnce 模式将始终使用此选项。
- /lighting:none - 跳过为已加载的区块生成光照数据。请参阅下方的 光照说明。
- /lighting:force - 重置并重新生成我们经过的所有区块的光照,即使它们已经有光照数据。这对于修复光照损坏的区域很有用。
- /verbose - 生成时打印详细的计时信息。会使插件输出的日志数量翻倍!
- /quitAfter - 在此任务(及任何其他待处理的生成任务)完成后关闭服务器。请参阅下方的脚本中使用部分。
- /onlyWhenEmpty - 仅在服务器为空时进行生成。插件会暂停生成并等待玩家离开,这样你就可以在不担心额外 CPU 负载的情况下生成大量地形。你可以将其与 /allAtOnce 结合使用,以便在服务器空闲时利用 100% 的资源生成地形,而在玩家在线时不会造成任何卡顿。
- /destroyAndRegenerateArea - 顾名思义,这将删除并销毁给定区域内的所有土地,转而生成新的土地。我必须强调这会删除你的世界(至少是指定区域的世界),所以请务必理解你在做什么并做出备份!
权限
权限是可选的。服务器管理员和服务器控制台始终可以使用生成命令。但是,如果你安装了权限插件,则使用以下权限:
- worldgenerationcontrol.generate - 允许用户排队生成任务。隐式授予 worldgenerationcontrol.statusupdates 权限
- worldgenerationcontrol.statusupdates - 允许用户查看生成进度消息。这些消息可能会非常刷屏,显式移除该权限将导致只有服务器控制台能看到这些消息。
示例
/genregion OurBeautifulWorld -50 -50 50 50
将在游戏坐标 -50,-50 到 50,50 之间生成地形。简单易懂!
/genregion "Bob and Sam's \"Awesome\" World" -50 -50 50 50
针对世界 Bob 和 Sam 的 "Awesome" World 的相同命令。可以在带有空格的世界名称周围加上引号,对于本身包含引号的世界名称,可以使用反斜杠进行转义。
/gencircle 1000 /fast /verbose /lighting
将以执行命令的玩家为中心,生成一个半径为 1000 格圆的区域,使用 /fast 速度设置,输出详细信息,并启用光照!
/gencircle 1000 MyWorld 100 100 /veryslow
将在 MyWorld 世界的 x=100, z=100 处中心点生成一个半径为 1000 格的圆,使用 veryslow 速度设置,以避免造成卡顿。
/gencircle 10000 MyWorld 100 100 /allAtOnce /onlyWhenEmpty
将在 MyWorld 世界的 100,100 处中心点生成一个 HEUG 圆,以最大可能速度运行,但在玩家加入时暂停生成。如果你希望服务器在空闲时能 100% 利用资源进行生成,这非常有用。
关于光照的说明
默认情况下,Minecraft 仅在玩家首次接近某个区块时才生成该区块的光照信息。这通常没问题,但如果你想使用 Minecraft Overviewer 之类的工具生成外部地图,那么玩家未访问过的区域将只有“快速”光照,导致阴影呈纯黑色。
为解决此问题,WorldGenerationControl 默认会强制新生成的区块拥有光照信息,就像有玩家在附近一样。这应该不会引起任何问题,但会多占用约 8% 的 CPU 时间。你可以使用 /lighting:none 跳过此步骤——当玩家路过时区块仍会被照亮,因此上述问题仅影响如前文所述的外部工具。
此外还有 /lighting:force 选项,它会强制为经过的所有区块生成光照(包括已生成且光照正常的区块),这对于让 Minecraft 重新计算出现阴影故障区域的光照很有用。
在脚本中使用
/quitAfter 选项允许将此插件作为脚本的一部分使用。例如,有些用户喜欢为大量随机种子生成地图,以便与社区分享或在 /r/minecraft 上发布以获得大量的 karma。由于 Bukkit/Java 在输入中遇到 EOF(文件末尾)时会报错,正确的方法类似如下:
echo "gencircle 1000 TestWorld 0 0 /allatonce /quitafter" | cat - /dev/full | java -jar craftbukkit-0.0.1-SNAPSHOT.jar --nojline
下载
源代码
更新日志
-
2.6
-
2.5
- /forceKeepUp 现在也会跟进垃圾回收。
- 将 /forceSave 重命名为 /forceKeepUp,以反映它同时也跟进垃圾回收。
- 当服务器内存占用持续超过 80% 过久时,尝试触发 GC。这解决了默认 Java GC 选项会导致内存一直浮在 80% 而无法回落的问题,除非有其他操作强制其追赶。
- 略微清理了 /verbose 的输出。
- 除了检查剩余内存是否低于 20% 外,还检查是否少于 200MB,防止在 512MB 内存的服务器上出现内存溢出错误(尽管本插件技术上并不支持此类低配服务器)。
-
2.4
- 添加 /forceSave 作为对 1.9 版本 AsyncChunkLoader 问题的变通方案。
- /allAtOnce 现在隐含 /forceSave。
- 使内存限制更加保守,以确保我们在低内存服务器上不会触发 GC 开销错误。
- 一旦达到内存限制,等待内存降至限制以下至少 10% 后再恢复。
- 调整 NextTickList bug 的变通方案——不再刷新列表,而是确保其保持在阈值以下。应能修复因该变通方案引起的轻微卡顿尖峰。
- 次要优化。
-
2.3 - 告别内存问题版
- 包含对 CraftBukkit 糟糕的 NextTickList 处理的修复,允许在低内存服务器上实现高速生成。
- 当运行接近内存限制时直接调用 GC,以防止 GC Overhead 错误。
- 如果内存使用量变得不可接受的高,则暂停工作,让服务器赶上进度。
-
2.2
- 光照现在直接与 CraftBukkit 交互,速度提高了约 115 倍。是的。
- 由于光照处理时间从占 92% 的处理时间降为微不足道的一小部分,插件不再将光照/生成/保存分为单独的步骤。
- 由于光照现在非常快,/lighting 现在是默认设置。仍可通过 /lighting:none 禁用。
- /lighting:extreme 现更名为 /lighting:force,且仅消耗少量额外的 CPU 资源。
- 添加了 /destroyAndRegenerateArea —— 用于重新生成区域内所有区块。小心使用!
- 移除了 /lightExisting,光照现在按需进行,并且可以使用 /lighting:force 尝试修复损坏的光照区域。
- 修复了由玩家在没有指定坐标的情况下调用 /gencircle 时中心点定位不正确的问题。
- 改进了某些模糊数学逻辑的准确性,以确保仅生成请求的区域。
- 添加了 /onlyWhenEmpty —— 这会导致插件仅在服务器为空时工作,在玩家加入/离开时根据需要暂停和恢复。
- 次要的速度/开销改进。
-
2.1
- 修复了 /allAtOnce 在光照方面过于激进,导致低内存服务器出现内存问题的情况。
- allAtOnce 模式现在会在每个 tick 之间短暂返回到服务器,允许运行其他命令(如 /cancelgen)。
-
2.0
- 名称从 ForceGenChunks 更改为 WorldGenerationControl
- 大规模重写
- 支持 Minecraft 1.8 的光照方法
- 新增选项:lighting(光照)、speed(速度)、verbose(详细输出)、quitafter
- 新增权限支持
- 正常模式下卡顿大幅减少。速度选项可控制生成过程中的卡顿情况。
- 不再信任服务器清理区块,而是通过光照步骤管理流程并直接清理区块。
因此移除了 maxLoadedChunks 选项,即使在高速度设置下,插件也不会将超过 1024 个区块加载到内存中。
- 优化并改进了状态消息。
- 使用方块坐标替代区块坐标
- 支持排队进行多次生成
- 为其他插件提供了更好的插件内 API 以与此插件交互。
- 其他一些我可能遗漏的改动
-
1.4
-
1.3
- 通过引号和转义序列,新增了世界名称中支持引号和空格的功能。
- 例如生成地图:Bob's "Wonderful" Funland
- /forcegen "Bob's \"Wonderful\" Funland" -10 -10 10 10
- 修复了 /forcegencircle 命令报错“无效的世界名称”时显示错误世界名称的问题。
- 分离了生成和清理阶段——插件现在会在生成完成时打印一条消息,并在稍后清理完成时打印另一条消息。
- 即使清理尚未完成,也可以开始新的生成任务;剩余的清理工作将与新任务的清理合并执行。
- 移除了关于玩家身处世界内的警告,鉴于上述更改,玩家在场并无害处。
- 为插件消息添加了一些颜色。更美观。
- 插件消息现在会显示操作者及其行为。
- 已在推荐构建版本 1000 和 1060 上测试通过。
-
1.2
- 新增 /forcegencircle 命令
- 使用该命令的玩家现在可以看到进度,而不仅仅是“生成已开始”的消息。
- 进行了几处微小的文本调整。
-
1.1
- 等待区块卸载,而不是假设卸载请求成功。修复了在大型生成过程中已加载区块的“泄漏”问题(这些区块直到重启才会卸载)。
- 为 /forcegen 命令添加了可选参数 maxLoadedChunks,提高此值可减少等待旧区块卸载的时间,但会导致更多区块驻留于内存中,从而增加内存占用。
- 新增 /cancelforcegen 命令,用于取消正在进行的生成任务。
-
1.0
Contact
john@pointysoftware.net
** NOTE: This no longer works as of 1.4+, and /destroyAndRegenerateArea is broken as of 1.2+. I may get around to rewriting this at some point, but no promises. Patches are welcome! See GitHub. **
WorldGenerationControl 2.6
Formerly ForceGenChunks
Which is a dumb name so I changed it
This is a very simple plugin to allow you to pre-generate a region of your world. It does not affect already generated
regions. As of 2.0, it can also repair lighting of existing regions.
Features
- Generate arbitrary regions by coordinates
- Queue multiple generations
- Various speed settings to control lag vs generation time
- Works on a live server
- Doesn't lock up the server (unless you use the /allAtOnce option)
- Low ram usage, works fine on servers with 1gig of memory.
- Generates trees & ore, not just land
- Can generate valid lighting
- Can force regenerate lighting on existing chunks, to fix light issues.
Bugs/Quirks
- Generating land takes a lot of CPU - nothing the plugin can do to prevent that! If you don't want to lag a
live server, use the /slow or /veryslow modes.
- Designed for servers with at least 1gig of memory allocated to them (-Xmx1024M). Servers with lower memory limits
may encounter heap exceptions. If you have less than 1gig of memory, try using /slow or /veryslow modes.
Commands
The /genregion (or /generateregion) command can be entered by any server op, the server console, or anyone with the
appropriate permission (see below).
The syntax is:
/genregion WorldName StartX StartZ EndX EndZ
For circles (/generatecircularregion or /gencircle):
/gencircle Radius [WorldName xCenter zCenter]
The world and center coordinates for the circle command are [optional] if you are a player (not the console). It will
default to your current/world position.
All coordinates are in normal, in-game coordinates - but will be adjusted to the nearest chunk boundary (inclusive).
Options
All commands can have options applied to them like so:
/gencircle 1600 MyWorld 0 0 /fast /lighting
Options are not case sensitive. The available options are:
- /allAtOnce - Don't pause between steps, generate everything requested all at once. This will make the server basically
unusable until the generation completes, but get the job done fastest. Very useful in conjunction with /onlyWhenEmpty
- /veryFast, /fast, /slow, /verySlow - Adjust speed. Has no effect if /allAtOnce specified. Normally the plugin will
cause mild lag while generating usually doing around 700ms of work per three seconds (depending on the server CPU).
Raising the speed with fast or veryfast will cause more lag but speed up the generation, slow or veryslow will reduce
lag while increasing generation times. Veryfast will cause a lot of lag. Veryslow will cause almost no lag, but will
take something like 10x longer.
- /forceKeepUp - Force the server to 'keep up' with garbage collection and chunk saving.
In particular, 1.9 Has a new async chunk saver, which appears to be rate limited, meaning it may not keep up with
fast generations. This option forces the chunks to be saved immediately, rather than on a separate thread.
You should use this option if you notice the plugin spending a lot of time "waiting for the server to catch up" and
don't mind the minor increase in CPU usage caused by forcing it to keep up. /allAtOnce mode will always use this
option.
- /lighting:none - Skip generating light data for loaded chunks. See Notes on Lighting below.
- /lighting:force - Reset and regenerate lighting for all chunks we pass over, even if they already have lighting data.
Useful for fixing areas with corrupt lighting.
- /verbose - Print detailed timing info while generating. Doubles the amount of spam the plugin prints!
- /quitAfter - Shutdown the server once this (and any other pending generations) are complete. See the Using in a Script
section below.
- /onlyWhenEmpty - Only do generating when the server is empty. The plugin will pause generation and wait until players
leave, allowing you to generate lots of land without worrying at all about the extra CPU. You can use this in
conjunction with /allAtOnce to have the server use 100% when it is empty towards generating land, without causing any
lag when players are online.
- /destroyAndRegenerateArea - As the name says, this will delete and destroy all land in the area given, generating
new land instead. I cannot stress enough how this will delete your world (or the specified area of it at least),
so please understand what you're doing and make backups!
Permissions
Permissions are optional. Server ops and the server console can always use generation commands. However, if you have
permissions installed, the following permissions are used:
- worldgenerationcontrol.generate - Allows user to queue generations. Implicitly grants
worldgenerationcontrol.statusupdates
- worldgenerationcontrol.statusupdates - Allows user to see generation progress messages. These can be quite spammy,
explicitly removing this permission will cause only the server console to see these messages.
Examples
/genregion OurBeautifulWorld -50 -50 50 50
Would generate from -50,-50 to 50,50 in game coordinates. Simple!
/genregion "Bob and Sam's \"Awesome\" World" -50 -50 50 50
The same command for world: Bob and Sam's "Awesome" World. Quotes can be placed around world names with spaces, world
names with actual quotes in them can be escaped with backlashes.
/gencircle 1000 /fast /verbose /lighting
Would generate a 1000 block radius circle around the issuing player, using the /fast speed setting, with verbose output,
with lighting!
/gencircle 1000 MyWorld 100 100 /veryslow
Would generate a 1000 block radius centered in MyWorld at 100x, 100z, using the veryslow speed setting so as not to
cause lag.
/gencircle 10000 MyWorld 100 100 /allAtOnce /onlyWhenEmpty
Would generate a HEUG circle centered at MyWorld 100,100 at max possible speed, but pause the generation when players
join. Useful if you want your server to use 100% on generating when it would otherwise be idle.
Notes on Lighting
By default, minecraft only generates lighting info for a chunk when it is first approached by a player. This is fine,
but if you want to generate an external map with something like Minecraft Overviewer, it means the areas players haven't
visited will only have 'fast' lighting, with pitch black shadows.
To fix this, by default, WorldGenerationControl forces new chunks to have lighting info, as if a player were nearby.
This shouldn't cause any problems, but takes about 8% more CPU-time. You can skip this step with /lighting:none -- the
chunks will still be lit when a player wanders by, so this is only an issue for external tools as mentioned above.
There is also /lighting:force, which will force-generate lighting for all chunks it passes over (even those already
generated and with proper lighting), which is useful for making Minecraft recalculate the lighting in areas with
glitched shadows.
Using in a Script
The /quitAfter option lets this plugin be used as part of a script. For example, some users like to generate maps for a
lot of random seeds to share with the community or post on /r/minecraft for delicious karma. Because Bukkit/java freaks
out when EOF is encountered in input, the proper way to do this would be something like:
echo "gencircle 1000 TestWorld 0 0 /allatonce /quitafter" | cat - /dev/full | java -jar craftbukkit-0.0.1-SNAPSHOT.jar --nojline
Download
Source
ChangeLog
-
2.6
- Updated to work with 1.0.1 / 1.1 builds.
-
2.5
- /forceKeepUp now keeps up on garbage collection as well
- Renamed /forceSave to /forceKeepUp to reflect that it also keeps up on garbage collection.
- When the server is floating at >80% memory for too long, try invoking a GC. This fixes the issue where the default
Java GC options would have it float at 80% memory forever as long as nothing forced it to catch up.
- Cleaned up /verbose output a little.
- Check if we have <200Megs free in addition to <20% free, prevents out of memory errors on 512Meg ram servers
(which this plugin doesn't technically support)
-
2.4
- Add /forceSave workaround for 1.9's AsyncChunkLoader silliness.
- /allAtOnce now implies /forceSave
- Make the memory limit a little more conservative to ensure we don't hit GC overhead errors on low memory servers
- Once the memory limit has been hit, wait for ram to decrease below the limit by at least 10% before resuming
- Tweak the NextTickList bug workaround - instead of flushing the list, just ensure it stays below a threshold.
Should fix the minor lag spikes from the fix.
- Minor optimizations
-
2.3 - Death to Memory Issues edition
- Includes a fix for CraftBukkit's poor NextTickList handling, allowing high generation speeds on low memory
servers
- Invokes the GC directly when running close to memory limits to prevent GC Overhead errors
- Takes a break if memory usage gets unacceptably high to let the server catch up.
-
2.2
- Lighting now talks directly to CraftBukkit and is now approximately 115 times faster. Yep.
- Because lighting has gone from taking up 92% of processing time to a trivial amount, the plugin no longer
splits lighting/generating/saving into separate steps.
- Because lighting is now very fast, /lighting is now the default. It can still be disabled with /lighting:none
- /lighting:extreme is now named /lighting:force, and only eats a little bit more CPU.
- Added /destroyAndRegenerateArea - which regenerates all chunks in the region. Beware!
- Removed /lightExisting, lighting is now only done as-needed either way, and /lighting:force can be used
to try and fix corrupt light areas.
- Fixed /gencircle being centered incorrectly when called by a player without coordinates
- Improved accuracy of some fuzzy math logic to ensure only requested areas are generated
- Added /onlyWhenEmpty - this causes the plugin to only do its work when the server is empty, pausing and resuming
as needed when players join/leave.
- Minor speed/overhead improvements
-
2.1
- Fixed issue with /allAtOnce being too aggressive on lighting, causing memory issues on low-memory servers.
- allAtOnce mode now returns into the server briefly between ticks, allowing other commands (such as /cancelgen) to
be run.
-
2.0
- Name changed to WorldGenerationControl from ForceGenChunks
- Large rewrite
- Supports Minecraft 1.8's lighting methods
- Added options: lighting, speed, verbose, quitafter
- Added permissions support
- Normal speed is much, much less laggy. Speed options provide control over lag during generation.
- No longer trusts server to cleanup chunks, manages process through lighting step and cleans up chunks directly.
maxLoadedChunks removed as a result, even on high speed settings the plugin will never load more than 1024 chunks
into memory.
- Cleaned up and improved status messages.
- Use block coordinates instead of chunk coordinates
- Support queueing multiple generations
- Better in-plugin API for other plugins to interact with this one.
- Other things I likely forgot
-
1.4
- Added progress % to generating status messages.
-
1.3
- Added support for quotes and spaces in worldnames via quotes and escape sequences.
- To generate for map: Bob's "Wonderful" Funland
- /forcegen "Bob's \"Wonderful\" Funland" -10 -10 10 10
- Fixed the "Invalid world name" error message giving the wrong world name for /forcegencircle commands.
- Separated generation and cleanup phases - plugin now prints a message when generation is complete, and a second
message later when cleanup is complete.
- New generations can be started even if cleanup isn't done, the remaining cleanup will just be merged with the new
task's cleanup.
- Removed warnings about players being in the world, with above changes there is no harm in them being there.
- Added some colors to plugin messages. Pretty.
- Plugin messages now show who did what.
- Tested with recommended builds 1000 and 1060.
-
1.2
- Added /forcegencircle
- Players who use the command now see the progress, not just the 'generation started' message.
- A few minor text tweaks.
-
1.1
- Wait for chunks to unload, instead of assuming our unload requests succeed. Fixes a 'leak' of loaded chunks in
large generations, chunks that never unload until a reboot.
- Add a optional maxLoadedChunks argument to /forcegen, setting this higher reduces the time spent waiting for old
chunks to unload, but causes more chunks to reside in ram, increasing memory usage.
- Added /cancelforcegen, to cancel generation in progress.
-
1.0
Contact
john@pointysoftware.net
评论 0
登录后参与评分
还没有评论,来抢沙发吧