Class ReplacingWorldFeature

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

public abstract class ReplacingWorldFeature extends Object implements WorldFeature, BlockFilter
Provides helper methods for other WorldFeature to quickly check if a block can be replaced.
Author:
DaPorkchop_
  • Field Summary

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

    AIR, REPLACEABLE
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    allNeighborsMatch​(org.cloudburstmc.api.level.ChunkManager level, int x, int y, int z, BlockFilter filter)
    Checks whether all the blocks that horizontally neighbor the given coordinates match the given BlockFilter.
    boolean
    allNeighborsMatch​(org.cloudburstmc.api.level.ChunkManager level, int x, int y, int z, BlockFilter filter, org.cloudburstmc.api.util.Direction except)
    Checks whether all the blocks that horizontally neighbor the given coordinates match the given BlockFilter.
    void
    replaceGrassWithDirt​(org.cloudburstmc.api.level.ChunkManager level, int x, int y, int z)
    Replaces the block at the given coordinates with dirt if it is a grassy block type.
    boolean
    test​(org.cloudburstmc.api.block.BlockState state)
     
    boolean
    testOrLiquid​(int runtimeId)
     
    boolean
    testOrLiquid​(org.cloudburstmc.api.block.BlockState state)
     

    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

    Methods inherited from interface org.cloudburstmc.server.level.feature.WorldFeature

    place
  • Constructor Details

    • ReplacingWorldFeature

      public ReplacingWorldFeature()
  • Method Details

    • test

      public boolean test(org.cloudburstmc.api.block.BlockState state)
      Specified by:
      test in interface BlockFilter
      Specified by:
      test in interface Predicate<org.cloudburstmc.api.block.BlockState>
    • testOrLiquid

      public boolean testOrLiquid(org.cloudburstmc.api.block.BlockState state)
    • testOrLiquid

      public boolean testOrLiquid(int runtimeId)
    • replaceGrassWithDirt

      public void replaceGrassWithDirt(org.cloudburstmc.api.level.ChunkManager level, int x, int y, int z)
      Replaces the block at the given coordinates with dirt if it is a grassy block type.

      The following blocks are considered "grassy": - BlockIds.GRASS - BlockIds.MYCELIUM - BlockIds.PODZOL

    • allNeighborsMatch

      public boolean allNeighborsMatch(org.cloudburstmc.api.level.ChunkManager level, int x, int y, int z, BlockFilter filter)
      Checks whether all the blocks that horizontally neighbor the given coordinates match the given BlockFilter.
    • allNeighborsMatch

      public boolean allNeighborsMatch(org.cloudburstmc.api.level.ChunkManager level, int x, int y, int z, BlockFilter filter, org.cloudburstmc.api.util.Direction except)
      Checks whether all the blocks that horizontally neighbor the given coordinates match the given BlockFilter.