mirror of
https://github.com/boy0001/FastAsyncWorldedit.git
synced 2024-11-22 02:25:53 +01:00
Page:
Some tips when using the FAWE API
Pages
API
Anvil API
AsyncWorld
Brushes
Clipboard API
Commands
Configuration
Copying a region to another world.
CreateFromImage
Download Instructions: Bukkit Spigot
Fawe TaskManager
FawePlayer
FaweQueue
Home
JavaScript API
Jobs API
Light API
NBT stream API
Packet sending
Pasting a schematic
Permissions
Progress API
Recovering corrupt NBT files (MCA Schematic etc.)
Region restriction API
Registering Custom Masks, Patterns and Transforms
Registering custom brushes or commands
Rollback API
Some tips when using the FAWE API
TaskBuilder
TextureUtil block and biome coloring
Third party loggers
Transforms
Web API
WorldEdit FAWE mask list
WorldEdit EditSession
WorldEdit World Player
WorldEdit and FAWE patterns
3
Some tips when using the FAWE API
stefvanschie edited this page 2018-11-05 20:29:35 +01:00
Table of Contents
- Performance tips when using the FAWE API:
- 1. Use the EditSessionBuilder and don't enable what you won't need.
- 2. Use the in built iterators whenever possible:
- 3. Use existing functions/operations instead of setting single blocks:
- 4. Use the Sets/Collections that come with FAWE
- 5. Avoid calling a lot of the non block/biome related methods of AsyncWorld/Actor class:
Performance tips when using the FAWE API:
1. Use the EditSessionBuilder and don't enable what you won't need.
2. Use the in built iterators whenever possible:
// Naive approach:
for (Vector pt : region) {
BaseBlock block = editSession.getBlock(pt);
// Do something
}
// Good approach:
// - Performs chunk preloading
for (Vector pt : new FastIterator(region, editSession)) {
BaseBlock block = editSession.getBlock(pt);
// Do something
}
The following classes will perform chunk preloading:
- FastIterator
- Fast2DIterator
- FastChunkIterator
- BreadFirstSearch
- RegionVisitor
3. Use existing functions/operations instead of setting single blocks:
// Naive approach: single block changes
for (int x = 0; x <= 100; x++) {
for (int z = 0; z <= 100; z++) {
editSession.setBlock(x, 64, z, block);
}
}
// Good approach:
// - Does chunk preloading
// - Performs on entire chunks rather than single blocks
// - Does stuff in parallel
Region region = new CuboidRegion(new Vector(0, 64, 0), new Vector(100, 64, 100));
editSession.setBlocks(region, block);
4. Use the Sets/Collections that come with FAWE
// Naive approach: Storing individual positions
Set<Vector> positions = new HashSet<>(); // Then store some block positions here
// Good approach:
// - Faster and currently uses up to 800x less memory
positions = new BlockVectorSet();
5. Avoid calling a lot of the non block/biome related methods of AsyncWorld/Actor class:
FAWE has not optimized these at all to be used async. Consider using the TaskBuilder to break it up on the main thread instead.
This Wiki is for Legacy Versions (1.8 - 1.12.2). Check here for 1.13+ versions: https://github.com/IntellectualSites/FastAsyncWorldEdit-Documentation/