Skip to content

Bottom Fill Implementations

Ryandw11 edited this page Jun 11, 2022 · 1 revision

Note: This should only be done by private plugins to prevent users from experiencing unexpected behavior.


With CustomStructures 1.8.0, it is possible to define custom implementations of the bottom fill property that will override the default behavior. This is used by the official CSFastFill addon to improve the speed of the bottom fill property.

To make a custom behavior, create a class that implements the BottomFillImpl interface.

public class CustomBottomFill implements BottomFillImpl {
    @Override
    public void performFill(Structure structure, Location spawnLocation, Location minLoc, Location maxLoc) {
        // Usually you want to check if the biome even has a spawn block specified (this includes a default option).
        if (structure.getBottomSpaceFill().getFillMaterial(spawnLocation.getBlock().getBiome()).isEmpty())
            return;
    }

CustomStructures performs no configuration checks for you, so it is up to you implement the expected behavior (or the behavior you desire).
You also cannot have any fields (not meant to be shared) within the class since only one object is ever created.

Then you register the implementation with the BottomFillProvider:

BottomFillProvider.addProvider(new CustomBottomFill());

Currently, only the first custom provider registered is used; however, this behavior may be changed in a future update.

Clone this wiki locally