Search in sources :

Example 1 with VeinBufferPopulator

use of gregtech.api.worldgen.populator.VeinBufferPopulator in project GregTech by GregTechCE.

the class CachedGridEntry method doGenerateVein.

private void doGenerateVein(OreDepositDefinition definition) {
    this.currentOreVein = definition;
    int topHeightOffset = currentOreVein.getShapeGenerator().getMaxSize().getY() / 2 + 4;
    int maximumHeight = Math.min(masterEntry.getMaxBottomHeight(), currentOreVein.getHeightLimit()[1] - topHeightOffset);
    int minimumHeight = Math.max(3, currentOreVein.getHeightLimit()[0]);
    if (minimumHeight >= maximumHeight) {
        return;
    }
    this.veinCenterX = calculateVeinCenterX();
    this.veinCenterY = minimumHeight + gridRandom.nextInt(maximumHeight - minimumHeight);
    this.veinCenterZ = calculateVeinCenterZ();
    this.currentOreVein.getShapeGenerator().generate(gridRandom, this);
    this.veinGeneratedMap.put(definition, new BlockPos(veinCenterX, veinCenterY, veinCenterZ));
    IVeinPopulator veinPopulator = currentOreVein.getVeinPopulator();
    if (veinPopulator instanceof VeinBufferPopulator) {
        ((VeinBufferPopulator) veinPopulator).populateBlockBuffer(gridRandom, this, this, currentOreVein);
    }
    this.currentOreVein = null;
}
Also used : MutableBlockPos(net.minecraft.util.math.BlockPos.MutableBlockPos) BlockPos(net.minecraft.util.math.BlockPos) IVeinPopulator(gregtech.api.worldgen.populator.IVeinPopulator) VeinBufferPopulator(gregtech.api.worldgen.populator.VeinBufferPopulator)

Aggregations

IVeinPopulator (gregtech.api.worldgen.populator.IVeinPopulator)1 VeinBufferPopulator (gregtech.api.worldgen.populator.VeinBufferPopulator)1 BlockPos (net.minecraft.util.math.BlockPos)1 MutableBlockPos (net.minecraft.util.math.BlockPos.MutableBlockPos)1