promotional bannermobile promotional banner
premium banner
Non-blocking prefab loading and batched async pasting for Hytale. Paste millions of blocks without freezing the server or crashing clients.

Description

AsyncPrefab

AsyncPrefab is a server-side Hytale plugin that makes large prefab loading and pasting fully non-blocking.

Paste millions of blocks without freezing your server or crashing clients.


The Problem

Hytale’s built-in prefab system runs entirely on the world thread.

For large prefabs (4M+ blocks), this can cause:

  • 7+ second server freezes when selecting a prefab
  • Client crashes from oversized EditorBlocksChange packets
  • Complete server hangs while placing millions of blocks
  • Memory staying allocated long after the paste finishes

Large-scale world editing becomes unstable and risky.


The Solution

AsyncPrefab intercepts the prefab pipeline and makes everything asynchronous and batched.

Background Prefab Loading

When selecting a .prefab.json, the file loads on a background thread instead of the world thread.

  • No server freeze
  • Menu closes immediately
  • Live progress updates in chat

Oversized Packet Protection

Prefabs over ~4M blocks can generate packets too large for the client.

AsyncPrefab safely blocks these packets to prevent crashes.

Async Batched Pasting

Block placement is split into configurable batches (default: 50,000 blocks every 200ms).

  • Server remains responsive
  • No world-thread lockups
  • No multi-second freezes

Async Undo / Redo

Every async paste captures the original blocks.

  • /asyncundo
  • /asyncredo

Undo and redo are also processed in batches — no freezing.

Automatic Memory Cleanup

After a paste completes, cached prefab data and selections are cleared to free memory.


Commands

Command Description Permission
/paste Async replacement for the built-in paste hytale.editor.selection.clipboard
/asyncpaste <prefab> [x y z] [batchSize] [batchDelay] Load and paste a prefab asynchronously asyncprefab.paste
/asyncundo Undo last async paste asyncprefab.undo
/asyncredo Redo last undone async paste asyncprefab.redo

All commands require Creative mode.


Paste Tool Integration

AsyncPrefab automatically intercepts the built-in Paste Tool.

Click to paste as normal — placement is automatically redirected to async batched processing.

No configuration required.


Installation

  1. Drop the .jar into your server’s mods/ folder
  2. Restart the server
  3. Done

Works out of the box.


Requirements

  • None

Performance Example

Tested with an 8.2 million block prefab:

Operation Vanilla AsyncPrefab
Prefab selection 8+ second freeze 0 second freeze
Block paste Server hang / client crash Batched & non-blocking
Memory retention Cached indefinitely Automatically cleaned

For Developers

AsyncPrefab exposes a service API for other plugins.

Example:

AsyncPrefabService service = Asyncprefab.getService();
service.paste(world, "my_prefab.prefab.json", position, PasteOptions.defaults());

Custom batch sizes and delays are configurable via PasteOptions.


🆘 Support

Discord:
https://discord.gg/KPzSCm83Km


License

MIT


Author: IPv5