Class FoliagePlacer

java.lang.Object
net.minecraft.world.gen.foliage.FoliagePlacer
Direct Known Subclasses:
AcaciaFoliagePlacer, BlobFoliagePlacer, DarkOakFoliagePlacer, JungleFoliagePlacer, MegaPineFoliagePlacer, PineFoliagePlacer, RandomSpreadFoliagePlacer, SpruceFoliagePlacer

public abstract class FoliagePlacer extends Object
Mappings:
Namespace Name
official cxa
intermediary net/minecraft/class_4647
named net/minecraft/world/gen/foliage/FoliagePlacer
  • Field Details

    • TYPE_CODEC

      public static final com.mojang.serialization.Codec<FoliagePlacer> TYPE_CODEC
      Mappings:
      Namespace Name Mixin selector
      official d Lcxa;d:Lcom/mojang/serialization/Codec;
      intermediary field_24931 Lnet/minecraft/class_4647;field_24931:Lcom/mojang/serialization/Codec;
      named TYPE_CODEC Lnet/minecraft/world/gen/foliage/FoliagePlacer;TYPE_CODEC:Lcom/mojang/serialization/Codec;
    • radius

      protected final IntProvider radius
      Mappings:
      Namespace Name Mixin selector
      official e Lcxa;e:Lari;
      intermediary field_21296 Lnet/minecraft/class_4647;field_21296:Lnet/minecraft/class_6017;
      named radius Lnet/minecraft/world/gen/foliage/FoliagePlacer;radius:Lnet/minecraft/util/math/intprovider/IntProvider;
    • offset

      protected final IntProvider offset
      Mappings:
      Namespace Name Mixin selector
      official f Lcxa;f:Lari;
      intermediary field_23753 Lnet/minecraft/class_4647;field_23753:Lnet/minecraft/class_6017;
      named offset Lnet/minecraft/world/gen/foliage/FoliagePlacer;offset:Lnet/minecraft/util/math/intprovider/IntProvider;
  • Constructor Details

    • FoliagePlacer

      public FoliagePlacer(IntProvider radius, IntProvider offset)
      Mappings:
      Namespace Name Mixin selector
      official <init> Lcxa;<init>(Lari;Lari;)V
      intermediary <init> Lnet/minecraft/class_4647;<init>(Lnet/minecraft/class_6017;Lnet/minecraft/class_6017;)V
      named <init> Lnet/minecraft/world/gen/foliage/FoliagePlacer;<init>(Lnet/minecraft/util/math/intprovider/IntProvider;Lnet/minecraft/util/math/intprovider/IntProvider;)V
  • Method Details

    • fillFoliagePlacerFields

      protected static <P extends FoliagePlacer> com.mojang.datafixers.Products.P2<com.mojang.serialization.codecs.RecordCodecBuilder.Mu<P>,​IntProvider,​IntProvider> fillFoliagePlacerFields(com.mojang.serialization.codecs.RecordCodecBuilder.Instance<P> instance)
      Mappings:
      Namespace Name Mixin selector
      official b Lcxa;b(Lcom/mojang/serialization/codecs/RecordCodecBuilder$Instance;)Lcom/mojang/datafixers/Products$P2;
      intermediary method_30411 Lnet/minecraft/class_4647;method_30411(Lcom/mojang/serialization/codecs/RecordCodecBuilder$Instance;)Lcom/mojang/datafixers/Products$P2;
      named fillFoliagePlacerFields Lnet/minecraft/world/gen/foliage/FoliagePlacer;fillFoliagePlacerFields(Lcom/mojang/serialization/codecs/RecordCodecBuilder$Instance;)Lcom/mojang/datafixers/Products$P2;
    • getType

      protected abstract FoliagePlacerType<?> getType()
      Mappings:
      Namespace Name Mixin selector
      official a Lcxa;a()Lcxb;
      intermediary method_28843 Lnet/minecraft/class_4647;method_28843()Lnet/minecraft/class_4648;
      named getType Lnet/minecraft/world/gen/foliage/FoliagePlacer;getType()Lnet/minecraft/world/gen/foliage/FoliagePlacerType;
    • generate

      public void generate(TestableWorld world, BiConsumer<BlockPos,​BlockState> replacer, Random random, TreeFeatureConfig config, int trunkHeight, FoliagePlacer.TreeNode treeNode, int foliageHeight, int radius)
      Mappings:
      Namespace Name Mixin selector
      official a Lcxa;a(Lbwv;Ljava/util/function/BiConsumer;Ljava/util/Random;Lcwm;ILcxa$a;II)V
      intermediary method_27385 Lnet/minecraft/class_4647;method_27385(Lnet/minecraft/class_3746;Ljava/util/function/BiConsumer;Ljava/util/Random;Lnet/minecraft/class_4643;ILnet/minecraft/class_4647$class_5208;II)V
      named generate Lnet/minecraft/world/gen/foliage/FoliagePlacer;generate(Lnet/minecraft/world/TestableWorld;Ljava/util/function/BiConsumer;Ljava/util/Random;Lnet/minecraft/world/gen/feature/TreeFeatureConfig;ILnet/minecraft/world/gen/foliage/FoliagePlacer$TreeNode;II)V
    • generate

      protected abstract void generate(TestableWorld world, BiConsumer<BlockPos,​BlockState> replacer, Random random, TreeFeatureConfig config, int trunkHeight, FoliagePlacer.TreeNode treeNode, int foliageHeight, int radius, int offset)
      This is the main method used to generate foliage.
      Mappings:
      Namespace Name Mixin selector
      official a Lcxa;a(Lbwv;Ljava/util/function/BiConsumer;Ljava/util/Random;Lcwm;ILcxa$a;III)V
      intermediary method_23448 Lnet/minecraft/class_4647;method_23448(Lnet/minecraft/class_3746;Ljava/util/function/BiConsumer;Ljava/util/Random;Lnet/minecraft/class_4643;ILnet/minecraft/class_4647$class_5208;III)V
      named generate Lnet/minecraft/world/gen/foliage/FoliagePlacer;generate(Lnet/minecraft/world/TestableWorld;Ljava/util/function/BiConsumer;Ljava/util/Random;Lnet/minecraft/world/gen/feature/TreeFeatureConfig;ILnet/minecraft/world/gen/foliage/FoliagePlacer$TreeNode;III)V
    • getRandomHeight

      public abstract int getRandomHeight(Random random, int trunkHeight, TreeFeatureConfig config)
      Mappings:
      Namespace Name Mixin selector
      official a Lcxa;a(Ljava/util/Random;ILcwm;)I
      intermediary method_26989 Lnet/minecraft/class_4647;method_26989(Ljava/util/Random;ILnet/minecraft/class_4643;)I
      named getRandomHeight Lnet/minecraft/world/gen/foliage/FoliagePlacer;getRandomHeight(Ljava/util/Random;ILnet/minecraft/world/gen/feature/TreeFeatureConfig;)I
    • getRandomRadius

      public int getRandomRadius(Random random, int baseHeight)
      Mappings:
      Namespace Name Mixin selector
      official a Lcxa;a(Ljava/util/Random;I)I
      intermediary method_23452 Lnet/minecraft/class_4647;method_23452(Ljava/util/Random;I)I
      named getRandomRadius Lnet/minecraft/world/gen/foliage/FoliagePlacer;getRandomRadius(Ljava/util/Random;I)I
    • getRandomOffset

      private int getRandomOffset(Random random)
      Mappings:
      Namespace Name Mixin selector
      official a Lcxa;a(Ljava/util/Random;)I
      intermediary method_27386 Lnet/minecraft/class_4647;method_27386(Ljava/util/Random;)I
      named getRandomOffset Lnet/minecraft/world/gen/foliage/FoliagePlacer;getRandomOffset(Ljava/util/Random;)I
    • isInvalidForLeaves

      protected abstract boolean isInvalidForLeaves(Random random, int dx, int y, int dz, int radius, boolean giantTrunk)
      Used to exclude certain positions such as corners when creating a square of leaves.
      Mappings:
      Namespace Name Mixin selector
      official a Lcxa;a(Ljava/util/Random;IIIIZ)Z
      intermediary method_23451 Lnet/minecraft/class_4647;method_23451(Ljava/util/Random;IIIIZ)Z
      named isInvalidForLeaves Lnet/minecraft/world/gen/foliage/FoliagePlacer;isInvalidForLeaves(Ljava/util/Random;IIIIZ)Z
    • isPositionInvalid

      protected boolean isPositionInvalid(Random random, int dx, int y, int dz, int radius, boolean giantTrunk)
      Normalizes x and z coords before checking if they are invalid.
      Mappings:
      Namespace Name Mixin selector
      official b Lcxa;b(Ljava/util/Random;IIIIZ)Z
      intermediary method_27387 Lnet/minecraft/class_4647;method_27387(Ljava/util/Random;IIIIZ)Z
      named isPositionInvalid Lnet/minecraft/world/gen/foliage/FoliagePlacer;isPositionInvalid(Ljava/util/Random;IIIIZ)Z
    • generateSquare

      protected void generateSquare(TestableWorld world, BiConsumer<BlockPos,​BlockState> replacer, Random random, TreeFeatureConfig config, BlockPos centerPos, int radius, int y, boolean giantTrunk)
      Generates a square of leaves with the given radius. Sub-classes can use the method isInvalidForLeaves to exclude certain positions, such as corners.
      Mappings:
      Namespace Name Mixin selector
      official a Lcxa;a(Lbwv;Ljava/util/function/BiConsumer;Ljava/util/Random;Lcwm;Lgg;IIZ)V
      intermediary method_23449 Lnet/minecraft/class_4647;method_23449(Lnet/minecraft/class_3746;Ljava/util/function/BiConsumer;Ljava/util/Random;Lnet/minecraft/class_4643;Lnet/minecraft/class_2338;IIZ)V
      named generateSquare Lnet/minecraft/world/gen/foliage/FoliagePlacer;generateSquare(Lnet/minecraft/world/TestableWorld;Ljava/util/function/BiConsumer;Ljava/util/Random;Lnet/minecraft/world/gen/feature/TreeFeatureConfig;Lnet/minecraft/util/math/BlockPos;IIZ)V
    • placeFoliageBlock

      protected static void placeFoliageBlock(TestableWorld world, BiConsumer<BlockPos,​BlockState> replacer, Random random, TreeFeatureConfig config, BlockPos pos)
      Mappings:
      Namespace Name Mixin selector
      official a Lcxa;a(Lbwv;Ljava/util/function/BiConsumer;Ljava/util/Random;Lcwm;Lgg;)V
      intermediary method_34359 Lnet/minecraft/class_4647;method_34359(Lnet/minecraft/class_3746;Ljava/util/function/BiConsumer;Ljava/util/Random;Lnet/minecraft/class_4643;Lnet/minecraft/class_2338;)V
      named placeFoliageBlock Lnet/minecraft/world/gen/foliage/FoliagePlacer;placeFoliageBlock(Lnet/minecraft/world/TestableWorld;Ljava/util/function/BiConsumer;Ljava/util/Random;Lnet/minecraft/world/gen/feature/TreeFeatureConfig;Lnet/minecraft/util/math/BlockPos;)V