Class FeatureAbstractTree

java.lang.Object
org.cloudburstmc.server.level.feature.ReplacingWorldFeature
org.cloudburstmc.server.level.feature.tree.FeatureAbstractTree
All Implemented Interfaces:
Predicate<org.cloudburstmc.api.block.BlockState>, WorldFeature, BlockFilter
Direct Known Subclasses:
FeatureHugeTree, FeatureMushroomBrown, FeatureNormalTree

public abstract class FeatureAbstractTree extends ReplacingWorldFeature
Common code for all tree types.
Author:
DaPorkchop_
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected IntRange
     
    protected BlockSelector
     
    protected BlockSelector
     

    Fields inherited from interface org.cloudburstmc.server.level.generator.standard.misc.filter.BlockFilter

    AIR, REPLACEABLE
  • Constructor Summary

    Constructors
    Constructor
    Description
    FeatureAbstractTree​(@NonNull IntRange height)
     
    FeatureAbstractTree​(@NonNull IntRange height, @NonNull GenerationTreeSpecies species)
     
    FeatureAbstractTree​(@NonNull IntRange height, BlockSelector log, BlockSelector leaves)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected abstract boolean
    canPlace​(org.cloudburstmc.api.level.ChunkManager level, net.daporkchop.lib.random.PRandom random, int x, int y, int z, int height)
     
    protected int
    chooseHeight​(org.cloudburstmc.api.level.ChunkManager level, net.daporkchop.lib.random.PRandom random, int x, int y, int z)
     
    protected abstract void
    finish​(org.cloudburstmc.api.level.ChunkManager level, net.daporkchop.lib.random.PRandom random, int x, int y, int z, int height, org.cloudburstmc.api.block.BlockState log, org.cloudburstmc.api.block.BlockState leaves)
     
    boolean
    place​(org.cloudburstmc.api.level.ChunkManager level, net.daporkchop.lib.random.PRandom random, int x, int y, int z)
    Tries to place this feature into the given level at the given position.
    protected abstract void
    placeLeaves​(org.cloudburstmc.api.level.ChunkManager level, net.daporkchop.lib.random.PRandom random, int x, int y, int z, int height, org.cloudburstmc.api.block.BlockState log, org.cloudburstmc.api.block.BlockState leaves)
     
    protected abstract void
    placeTrunk​(org.cloudburstmc.api.level.ChunkManager level, net.daporkchop.lib.random.PRandom random, int x, int y, int z, int height, org.cloudburstmc.api.block.BlockState log, org.cloudburstmc.api.block.BlockState leaves)
     
    protected org.cloudburstmc.api.block.BlockState
    selectLeaves​(org.cloudburstmc.api.level.ChunkManager level, net.daporkchop.lib.random.PRandom random, int x, int y, int z, int height)
     
    protected org.cloudburstmc.api.block.BlockState
    selectLog​(org.cloudburstmc.api.level.ChunkManager level, net.daporkchop.lib.random.PRandom random, int x, int y, int z, int height)
     

    Methods inherited from class org.cloudburstmc.server.level.feature.ReplacingWorldFeature

    allNeighborsMatch, allNeighborsMatch, replaceGrassWithDirt, test, testOrLiquid, testOrLiquid

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface java.util.function.Predicate

    and, negate, or
  • Field Details

  • Constructor Details

    • FeatureAbstractTree

      public FeatureAbstractTree(@NonNull @NonNull IntRange height)
    • FeatureAbstractTree

      public FeatureAbstractTree(@NonNull @NonNull IntRange height, @NonNull @NonNull GenerationTreeSpecies species)
    • FeatureAbstractTree

      public FeatureAbstractTree(@NonNull @NonNull IntRange height, BlockSelector log, BlockSelector leaves)
  • Method Details

    • place

      public boolean place(org.cloudburstmc.api.level.ChunkManager level, net.daporkchop.lib.random.PRandom random, int x, int y, int z)
      Description copied from interface: WorldFeature
      Tries to place this feature into the given level at the given position.
      Parameters:
      level - the level to place the feature into
      random - an instance of PRandom for generating random numbers
      x - the X coordinate to generate the feature at
      y - the Y coordinate to generate the feature at
      z - the Z coordinate to generate the feature at
      Returns:
      whether or not the feature could be placed
    • chooseHeight

      protected int chooseHeight(org.cloudburstmc.api.level.ChunkManager level, net.daporkchop.lib.random.PRandom random, int x, int y, int z)
    • canPlace

      protected abstract boolean canPlace(org.cloudburstmc.api.level.ChunkManager level, net.daporkchop.lib.random.PRandom random, int x, int y, int z, int height)
    • selectLog

      protected org.cloudburstmc.api.block.BlockState selectLog(org.cloudburstmc.api.level.ChunkManager level, net.daporkchop.lib.random.PRandom random, int x, int y, int z, int height)
    • selectLeaves

      protected org.cloudburstmc.api.block.BlockState selectLeaves(org.cloudburstmc.api.level.ChunkManager level, net.daporkchop.lib.random.PRandom random, int x, int y, int z, int height)
    • placeLeaves

      protected abstract void placeLeaves(org.cloudburstmc.api.level.ChunkManager level, net.daporkchop.lib.random.PRandom random, int x, int y, int z, int height, org.cloudburstmc.api.block.BlockState log, org.cloudburstmc.api.block.BlockState leaves)
    • placeTrunk

      protected abstract void placeTrunk(org.cloudburstmc.api.level.ChunkManager level, net.daporkchop.lib.random.PRandom random, int x, int y, int z, int height, org.cloudburstmc.api.block.BlockState log, org.cloudburstmc.api.block.BlockState leaves)
    • finish

      protected abstract void finish(org.cloudburstmc.api.level.ChunkManager level, net.daporkchop.lib.random.PRandom random, int x, int y, int z, int height, org.cloudburstmc.api.block.BlockState log, org.cloudburstmc.api.block.BlockState leaves)