From 2263069b4e906d2c2f3302e6638e1c470ba65211 Mon Sep 17 00:00:00 2001 From: SuperCoder79 <25208576+SuperCoder7979@users.noreply.github.com> Date: Mon, 8 Feb 2021 14:46:49 -0500 Subject: [PATCH] Worldgen javadoc (#2036) * Worldgen javadoc * Apply suggestions from code review Co-authored-by: Juuxel <6596629+Juuxel@users.noreply.github.com> * Javadoc improvements Co-authored-by: Juuxel <6596629+Juuxel@users.noreply.github.com> --- .../world/gen/NoiseColumnSampler.mapping | 7 +++++++ .../world/gen/StructureWeightSampler.mapping | 5 +++++ .../world/gen/chunk/ChunkGenerator.mapping | 12 +++++++++--- .../gen/surfacebuilder/SurfaceBuilder.mapping | 15 +++++++++++++++ 4 files changed, 36 insertions(+), 3 deletions(-) diff --git a/mappings/net/minecraft/world/gen/NoiseColumnSampler.mapping b/mappings/net/minecraft/world/gen/NoiseColumnSampler.mapping index dd6ffea600..c694588c10 100644 --- a/mappings/net/minecraft/world/gen/NoiseColumnSampler.mapping +++ b/mappings/net/minecraft/world/gen/NoiseColumnSampler.mapping @@ -1,5 +1,7 @@ CLASS net/minecraft/class_5818 net/minecraft/world/gen/NoiseColumnSampler + COMMENT Samples noise values for use in chunk generation. FIELD field_28749 BIOME_WEIGHT_TABLE [F + COMMENT Table of weights used to weight faraway biomes less than nearby biomes. FIELD field_28750 biomeSource Lnet/minecraft/class_1966; FIELD field_28751 horizontalNoiseResolution I FIELD field_28752 verticalNoiseResolution I @@ -26,17 +28,22 @@ CLASS net/minecraft/class_5818 net/minecraft/world/gen/NoiseColumnSampler ARG 7 islandNoise ARG 8 densityNoise METHOD method_33645 applySlides (DI)D + COMMENT Interpolates the noise at the top and bottom of the world. ARG 1 noise ARG 3 y METHOD method_33646 getOffset (IDDD)D + COMMENT Calculates an offset for the noise. + COMMENT

For example in the overworld, this makes lower y values solid while making higher y values air.

ARG 1 y ARG 2 depth ARG 4 scale ARG 6 randomDensityOffset METHOD method_33647 getDensityNoise (II)D + COMMENT Applies a random change to the density to subtly vary the height of the terrain. ARG 1 x ARG 2 z METHOD method_33648 sampleNoiseColumn ([DIILnet/minecraft/class_5309;III)V + COMMENT Samples the noise for the given column and stores it in the buffer parameter. ARG 1 buffer ARG 2 x ARG 3 z diff --git a/mappings/net/minecraft/world/gen/StructureWeightSampler.mapping b/mappings/net/minecraft/world/gen/StructureWeightSampler.mapping index 135ba775d4..858da84366 100644 --- a/mappings/net/minecraft/world/gen/StructureWeightSampler.mapping +++ b/mappings/net/minecraft/world/gen/StructureWeightSampler.mapping @@ -1,4 +1,5 @@ CLASS net/minecraft/class_5817 net/minecraft/world/gen/StructureWeightSampler + COMMENT Applies weights to noise values if they are near structures, placing terrain under them and hollowing out the space above them. FIELD field_28740 INSTANCE Lnet/minecraft/class_5817; FIELD field_28741 STRUCTURE_WEIGHT_TABLE [F FIELD field_28742 pieces Lit/unimi/dsi/fastutil/objects/ObjectList; @@ -9,6 +10,7 @@ CLASS net/minecraft/class_5817 net/minecraft/world/gen/StructureWeightSampler ARG 1 accessor ARG 2 chunk METHOD method_33638 getWeight (III)D + COMMENT Gets the weight of the structures near the given position. ARG 1 x ARG 2 y ARG 3 z @@ -17,10 +19,13 @@ CLASS net/minecraft/class_5817 net/minecraft/world/gen/StructureWeightSampler METHOD method_33640 ([F)V ARG 0 array METHOD method_33641 getStructureWeight (III)D + COMMENT Gets the structure weight from the array from the given position, or 0 if the position is out of bounds. ARG 0 x ARG 1 y ARG 2 z METHOD method_33642 calculateStructureWeight (III)D + COMMENT Calculates the structure weight for the given position. + COMMENT

The weight increases as x and z approach {@code (0, 0)}, and positive y values make the weight negative while negative y values make the weight positive.

ARG 0 x ARG 1 y ARG 2 z diff --git a/mappings/net/minecraft/world/gen/chunk/ChunkGenerator.mapping b/mappings/net/minecraft/world/gen/chunk/ChunkGenerator.mapping index af82110041..ac00bcb6a8 100644 --- a/mappings/net/minecraft/world/gen/chunk/ChunkGenerator.mapping +++ b/mappings/net/minecraft/world/gen/chunk/ChunkGenerator.mapping @@ -50,12 +50,14 @@ CLASS net/minecraft/class_2794 net/minecraft/world/gen/chunk/ChunkGenerator METHOD method_12107 populateEntities (Lnet/minecraft/class_3233;)V ARG 1 region METHOD method_12108 carve (JLnet/minecraft/class_4543;Lnet/minecraft/class_2791;Lnet/minecraft/class_2893$class_2894;)V + COMMENT Generates caves for the given chunk. ARG 1 seed ARG 3 access ARG 4 chunk ARG 5 carver METHOD method_12109 getStructuresConfig ()Lnet/minecraft/class_5311; METHOD method_12110 buildSurface (Lnet/minecraft/class_3233;Lnet/minecraft/class_2791;)V + COMMENT Places the surface blocks of the biomes after the noise has been generated. ARG 1 region ARG 2 chunk METHOD method_12113 getEntitySpawnList (Lnet/minecraft/class_1959;Lnet/minecraft/class_5138;Lnet/minecraft/class_1311;Lnet/minecraft/class_2338;)Ljava/util/List; @@ -73,20 +75,24 @@ CLASS net/minecraft/class_2794 net/minecraft/world/gen/chunk/ChunkGenerator ARG 2 accessor ARG 3 chunk METHOD method_16397 getHeight (IILnet/minecraft/class_2902$class_2903;Lnet/minecraft/class_5539;)I + COMMENT Returns the raw noise height of a column for use in structure generation. ARG 1 x ARG 2 z - ARG 3 heightmapType + ARG 3 heightmap ARG 4 world METHOD method_16398 getSeaLevel ()I METHOD method_18028 getHeightInGround (IILnet/minecraft/class_2902$class_2903;Lnet/minecraft/class_5539;)I ARG 1 x ARG 2 z - ARG 3 heightmapType + ARG 3 heightmap + ARG 4 world METHOD method_20402 getHeightOnGround (IILnet/minecraft/class_2902$class_2903;Lnet/minecraft/class_5539;)I ARG 1 x ARG 2 z - ARG 3 heightmapType + ARG 3 heightmap + ARG 4 world METHOD method_26261 getColumnSample (IILnet/minecraft/class_5539;)Lnet/minecraft/class_4966; + COMMENT Returns a sample of all the block states in a column for use in structure generation. ARG 1 x ARG 2 z ARG 3 world diff --git a/mappings/net/minecraft/world/gen/surfacebuilder/SurfaceBuilder.mapping b/mappings/net/minecraft/world/gen/surfacebuilder/SurfaceBuilder.mapping index e8ba77659f..6fba810a05 100644 --- a/mappings/net/minecraft/world/gen/surfacebuilder/SurfaceBuilder.mapping +++ b/mappings/net/minecraft/world/gen/surfacebuilder/SurfaceBuilder.mapping @@ -1,4 +1,5 @@ CLASS net/minecraft/class_3523 net/minecraft/world/gen/surfacebuilder/SurfaceBuilder + COMMENT Places the top blocks of a biome during chunk generation. FIELD field_15667 END_STONE Lnet/minecraft/class_2680; FIELD field_15668 COARSE_DIRT Lnet/minecraft/class_2680; FIELD field_15669 PODZOL Lnet/minecraft/class_2680; @@ -39,19 +40,33 @@ CLASS net/minecraft/class_3523 net/minecraft/world/gen/surfacebuilder/SurfaceBui METHOD (Lcom/mojang/serialization/Codec;)V ARG 1 codec METHOD method_15305 generate (Ljava/util/Random;Lnet/minecraft/class_2791;Lnet/minecraft/class_1959;IIIDLnet/minecraft/class_2680;Lnet/minecraft/class_2680;IJLnet/minecraft/class_3531;)V + COMMENT Places the surface blocks for the given column. ARG 1 random + COMMENT the Random instance, seeded with a hash of the x and z coordinates ARG 2 chunk + COMMENT the current chunk being surface built ARG 3 biome + COMMENT the biome in the column that is being surface built ARG 4 x + COMMENT X coordinate of the column ARG 5 z + COMMENT Z coordinate of the column ARG 6 height + COMMENT height of the column retrieved using {@link net.minecraft.world.Heightmap.Type#WORLD_SURFACE_WG}, and will never be lower than the sea level ARG 7 noise + COMMENT noise value at this column. Has a range of {@code (-8, 8)} but follows a normal distribution so most values will be around {@code (-2, 2)} ARG 9 defaultBlock + COMMENT default block of the chunk generator, used to know which block to replace with the surface blocks ARG 10 defaultFluid + COMMENT Default fluid of the chunk generator ARG 11 seaLevel + COMMENT the sea level of the chunk generator ARG 12 seed + COMMENT the world seed ARG 14 surfaceBlocks + COMMENT the config passed to the chunk generator, stores the states used by the surface builder METHOD method_15306 initSeed (J)V + COMMENT Runs before {@link #generate} and allows for custom noise to be initialized. ARG 1 seed METHOD method_15307 register (Ljava/lang/String;Lnet/minecraft/class_3523;)Lnet/minecraft/class_3523; ARG 0 id