From f3fb4ec7312cf21d3efc7315d66d4d3a3d3115cd Mon Sep 17 00:00:00 2001 From: enbrain <69905075+enbrain@users.noreply.github.com> Date: Mon, 22 Nov 2021 20:52:25 +0900 Subject: [PATCH] Document placement modifier (#2863) * Document placement modifier * Update position calculation javadoc --- .../world/gen/decorator/PlacementModifier.mapping | 6 ++++++ .../world/gen/feature/ConfiguredFeature.mapping | 12 ++++++++++++ .../world/gen/feature/PlacedFeature.mapping | 6 ++++++ 3 files changed, 24 insertions(+) diff --git a/mappings/net/minecraft/world/gen/decorator/PlacementModifier.mapping b/mappings/net/minecraft/world/gen/decorator/PlacementModifier.mapping index 6dbd928c14..a58080f838 100644 --- a/mappings/net/minecraft/world/gen/decorator/PlacementModifier.mapping +++ b/mappings/net/minecraft/world/gen/decorator/PlacementModifier.mapping @@ -1,6 +1,12 @@ CLASS net/minecraft/class_6797 net/minecraft/world/gen/decorator/PlacementModifier + COMMENT A placement modifier is a one-to-many position transformation, which + COMMENT takes a position with some context and returns zero or more positions. + COMMENT It's used to determine where to generate configured features. + COMMENT + COMMENT @see net.minecraft.world.gen.feature.ConfiguredFeature#withPlacement FIELD field_35736 CODEC Lcom/mojang/serialization/Codec; METHOD method_14452 getPositions (Lnet/minecraft/class_5444;Ljava/util/Random;Lnet/minecraft/class_2338;)Ljava/util/stream/Stream; + COMMENT Applies this placement modifier to the given position. ARG 1 context ARG 2 random ARG 3 pos diff --git a/mappings/net/minecraft/world/gen/feature/ConfiguredFeature.mapping b/mappings/net/minecraft/world/gen/feature/ConfiguredFeature.mapping index 5591a6f86f..536ec3b146 100644 --- a/mappings/net/minecraft/world/gen/feature/ConfiguredFeature.mapping +++ b/mappings/net/minecraft/world/gen/feature/ConfiguredFeature.mapping @@ -21,7 +21,19 @@ CLASS net/minecraft/class_2975 net/minecraft/world/gen/feature/ConfiguredFeature METHOD method_39592 withBlockPredicateFilter (Lnet/minecraft/class_6646;)Lnet/minecraft/class_6796; ARG 1 predicate METHOD method_39593 withPlacement (Ljava/util/List;)Lnet/minecraft/class_6796; + COMMENT Attaches placement modifiers to this configured feature. Attached + COMMENT placement modifiers will be applied before this configured feature is + COMMENT generated. + COMMENT + COMMENT @see #withPlacement(PlacementModifier...) + COMMENT @see PlacedFeature#generate(StructureWorldAccess, ChunkGenerator, Random, BlockPos) ARG 1 modifiers METHOD method_39594 withPlacement ([Lnet/minecraft/class_6797;)Lnet/minecraft/class_6796; + COMMENT Attaches placement modifiers to this configured feature. Attached + COMMENT placement modifiers will be applied before this configured feature is + COMMENT generated. + COMMENT + COMMENT @see #withPlacement(List) + COMMENT @see PlacedFeature#generate(StructureWorldAccess, ChunkGenerator, Random, BlockPos) ARG 1 modifiers METHOD method_39595 withInAirFilter ()Lnet/minecraft/class_6796; diff --git a/mappings/net/minecraft/world/gen/feature/PlacedFeature.mapping b/mappings/net/minecraft/world/gen/feature/PlacedFeature.mapping index 37b42dc93c..428db99137 100644 --- a/mappings/net/minecraft/world/gen/feature/PlacedFeature.mapping +++ b/mappings/net/minecraft/world/gen/feature/PlacedFeature.mapping @@ -18,6 +18,12 @@ CLASS net/minecraft/class_6796 net/minecraft/world/gen/feature/PlacedFeature ARG 2 random ARG 3 pos METHOD method_39650 generate (Lnet/minecraft/class_5281;Lnet/minecraft/class_2794;Ljava/util/Random;Lnet/minecraft/class_2338;)Z + COMMENT Generates a configured feature at the positions obtained by applying + COMMENT placement modifiers to the given position. + COMMENT + COMMENT

To calculate positions, it first creates a singleton stream of the + COMMENT given position, then it applies placement modifiers with {@linkplain + COMMENT Stream#flatMap flatMap} in order they appear in the list. ARG 1 world ARG 2 generator ARG 3 random