Structure Placement (#1552)

* Structure placement

* Enhanced structure mappings

* Added docs to structure start

* Update mappings/net/minecraft/world/gen/chunk/ChunkGenerator.mapping

Co-authored-by: liach <7806504+liach@users.noreply.github.com>

* Update mappings/net/minecraft/structure/StructureStart.mapping

Co-authored-by: Gegy <gegy1000@gmail.com>

Co-authored-by: liach <7806504+liach@users.noreply.github.com>
Co-authored-by: Gegy <gegy1000@gmail.com>
This commit is contained in:
shartte 2020-07-09 19:44:24 +02:00 committed by GitHub
parent 79511e488a
commit 099c461aff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 165 additions and 4 deletions

View File

@ -1,6 +1,16 @@
CLASS net/minecraft/class_3449 net/minecraft/structure/StructureStart
COMMENT A structure start is created to describe a structure that will be generated by
COMMENT chunk generation. It contains a definition of its pieces and is associated
COMMENT with the chunk that the structure originates from.
FIELD field_15325 children Ljava/util/List;
FIELD field_15326 references I
COMMENT The number of chunks that intersect the structures bounding box,
COMMENT and have stored references to its starting chunk.
COMMENT <p>
COMMENT This number can be lower than the number of <em>potential</em>
COMMENT intersecting chunks, since it is only updated when an actual reference
COMMENT is created in such chunks (when they enter the corresponding chunk generation
COMMENT phase).
FIELD field_15327 chunkZ I
FIELD field_15329 chunkX I
FIELD field_15330 boundingBox Lnet/minecraft/class_3341;
@ -28,7 +38,8 @@ CLASS net/minecraft/class_3449 net/minecraft/structure/StructureStart
METHOD method_14974 generateStructure (Lnet/minecraft/class_5281;Lnet/minecraft/class_5138;Lnet/minecraft/class_2794;Ljava/util/Random;Lnet/minecraft/class_3341;Lnet/minecraft/class_1923;)V
METHOD method_14979 isInExistingChunk ()Z
METHOD method_16655 init (Lnet/minecraft/class_5455;Lnet/minecraft/class_2794;Lnet/minecraft/class_3485;IILnet/minecraft/class_1959;Lnet/minecraft/class_3037;)V
ARG 4 z
ARG 4 chunkX
ARG 5 chunkZ
METHOD method_16656 getFeature ()Lnet/minecraft/class_3195;
METHOD method_16657 hasChildren ()Z
METHOD method_23676 getReferences ()I

View File

@ -19,6 +19,8 @@ CLASS net/minecraft/class_2852 net/minecraft/world/ChunkSerializer
METHOD method_12391 (Lnet/minecraft/class_3611;)Z
ARG 0 fluid
METHOD method_12392 readStructureStarts (Lnet/minecraft/class_3485;Lnet/minecraft/class_2487;J)Ljava/util/Map;
ARG 1 tag
ARG 2 worldSeed
METHOD method_12393 toNbt ([Lit/unimi/dsi/fastutil/shorts/ShortList;)Lnet/minecraft/class_2499;
ARG 0 lists
METHOD method_12395 deserialize (Lnet/minecraft/class_3218;Lnet/minecraft/class_3485;Lnet/minecraft/class_4153;Lnet/minecraft/class_1923;Lnet/minecraft/class_2487;)Lnet/minecraft/class_2839;

View File

@ -2,7 +2,7 @@ CLASS net/minecraft/class_1959 net/minecraft/world/biome/Biome
FIELD field_20335 temperatureCache Ljava/lang/ThreadLocal;
FIELD field_21806 skyColor I
FIELD field_22039 effects Lnet/minecraft/class_4763;
FIELD field_22040 noisePoints Ljava/util/List;
FIELD field_22040 structureFeatures Ljava/util/List;
FIELD field_24406 spawnDensities Ljava/util/Map;
FIELD field_9323 BIOMES Ljava/util/Set;
FIELD field_9324 FOLIAGE_NOISE Lnet/minecraft/class_3543;
@ -37,6 +37,12 @@ CLASS net/minecraft/class_1959 net/minecraft/world/biome/Biome
ARG 1 type
ARG 2 maxMass
ARG 4 mass
METHOD method_28413 getStructureFeatures ()Ljava/lang/Iterable;
METHOD method_30350 addFeature (ILjava/util/function/Supplier;)V
ARG 1 stepIndex
METHOD method_30357 getFeatures ()Ljava/util/List;
COMMENT @return The lists of features configured for each {@link net.minecraft.world.gen.GenerationStep.Feature feature generation step}, up to the highest step that has a configured feature.
COMMENT Entries are guaranteed to not be null, but may be empty lists if an earlier step has no features, but a later step does.
METHOD method_8684 hasStructureFeature (Lnet/minecraft/class_3195;)Z
ARG 1 structureFeature
METHOD method_8685 canSetIce (Lnet/minecraft/class_4538;Lnet/minecraft/class_2338;Z)Z
@ -61,6 +67,7 @@ CLASS net/minecraft/class_1959 net/minecraft/world/biome/Biome
METHOD method_8700 getEntitySpawnList (Lnet/minecraft/class_1311;)Ljava/util/List;
ARG 1 group
METHOD method_8702 generateFeatureStep (Lnet/minecraft/class_5138;Lnet/minecraft/class_2794;Lnet/minecraft/class_3233;JLnet/minecraft/class_2919;Lnet/minecraft/class_2338;)V
ARG 4 populationSeed
METHOD method_8703 buildSurface (Ljava/util/Random;Lnet/minecraft/class_2791;IIIDLnet/minecraft/class_2680;Lnet/minecraft/class_2680;IJ)V
ARG 1 random
ARG 2 chunk

View File

@ -4,6 +4,10 @@ CLASS net/minecraft/class_2794 net/minecraft/world/gen/chunk/ChunkGenerator
COMMENT Biome placement starts here, however all vanilla and most modded chunk generators delegate this to a {@linkplain net.minecraft.world.biome.source.BiomeSource biome source}.
FIELD field_12761 biomeSource Lnet/minecraft/class_1966;
FIELD field_16567 config Lnet/minecraft/class_5311;
FIELD field_24748 worldSeed J
FIELD field_24749 strongholds Ljava/util/List;
METHOD <init> (Lnet/minecraft/class_1966;Lnet/minecraft/class_1966;Lnet/minecraft/class_5311;J)V
ARG 4 worldSeed
METHOD method_12088 populateNoise (Lnet/minecraft/class_1936;Lnet/minecraft/class_5138;Lnet/minecraft/class_2791;)V
COMMENT Generates the base shape of the chunk out of the basic block states as decided by this chunk generator's config.
ARG 1 world
@ -15,11 +19,20 @@ CLASS net/minecraft/class_2794 net/minecraft/world/gen/chunk/ChunkGenerator
ARG 1 region
ARG 2 accessor
METHOD method_12103 locateStructure (Lnet/minecraft/class_3218;Lnet/minecraft/class_3195;Lnet/minecraft/class_2338;IZ)Lnet/minecraft/class_2338;
COMMENT Tries to find the closest structure of a given type near a given block.
COMMENT <p>
COMMENT New chunks will only be generated up to the {@link net.minecraft.world.chunk.ChunkStatus#STRUCTURE_STARTS} phase by this method.
COMMENT
COMMENT @return null if no structure could be found within the given search radius.
ARG 1 world
ARG 2 feature
ARG 3 center
ARG 4 radius
COMMENT The search radius in chunks around the chunk the given block position is in. A radius of 0 will only search in the given chunk.
COMMENT This is ignored for strongholds.
ARG 5 skipExistingChunks
COMMENT Don't return structures that are aleady referenced by generated chunks (chunks past the STRUCTURE_STARTS stage).
COMMENT This is ignored for strongholds.
METHOD method_12104 getMaxY ()I
METHOD method_12106 populateBiomes (Lnet/minecraft/class_2378;Lnet/minecraft/class_2791;)V
METHOD method_12107 populateEntities (Lnet/minecraft/class_3233;)V
@ -39,7 +52,11 @@ CLASS net/minecraft/class_2794 net/minecraft/world/gen/chunk/ChunkGenerator
ARG 3 group
ARG 4 pos
METHOD method_16129 setStructureStarts (Lnet/minecraft/class_5455;Lnet/minecraft/class_5138;Lnet/minecraft/class_2791;Lnet/minecraft/class_3485;J)V
COMMENT Determines which structures should start in the given chunk and creates their starting points.
ARG 5 worldSeed
METHOD method_16130 addStructureReferences (Lnet/minecraft/class_5281;Lnet/minecraft/class_5138;Lnet/minecraft/class_2791;)V
COMMENT Finds all structures that the given chunk intersects, and adds references to their starting chunks to it.
COMMENT A radius of 8 chunks around the given chunk will be searched for structure starts.
ARG 2 accessor
ARG 3 chunk
METHOD method_16397 getHeight (IILnet/minecraft/class_2902$class_2903;)I
@ -60,3 +77,7 @@ CLASS net/minecraft/class_2794 net/minecraft/world/gen/chunk/ChunkGenerator
ARG 2 z
METHOD method_27997 withSeed (J)Lnet/minecraft/class_2794;
ARG 1 seed
METHOD method_28507 isStrongholdStartingChunk (Lnet/minecraft/class_1923;)Z
METHOD method_28508 setStructureStart (Lnet/minecraft/class_5312;Lnet/minecraft/class_5455;Lnet/minecraft/class_5138;Lnet/minecraft/class_2791;Lnet/minecraft/class_3485;JLnet/minecraft/class_1923;Lnet/minecraft/class_1959;)V
ARG 6 worldSeed
METHOD method_28509 generateStrongholdPositions ()V

View File

@ -1,12 +1,46 @@
CLASS net/minecraft/class_5314 net/minecraft/world/gen/chunk/StructureConfig
COMMENT Contains parameters for placement of a single type of {@link net.minecraft.world.gen.feature.StructureFeature} during chunk
COMMENT generation.
FIELD field_24917 CODEC Lcom/mojang/serialization/Codec;
FIELD field_24918 spacing I
COMMENT Defines the width and height of a cell in the structure placement grid in chunks.
COMMENT <p>
COMMENT For each cell in the grid, the chunk generator will attept to place the start of a structure.
COMMENT <p>
COMMENT Minimum is 1, which means the structure will potentially be placed in every chunk.
COMMENT 2 leads to one structure per 2x2 chunks, and so on.
FIELD field_24919 separation I
COMMENT Defines the margin of each cell in the placement grid, which leads to guaranteeing
COMMENT a certain minimum distance between each placed structure.
COMMENT <p>
COMMENT The margin is effectively subtracted from the width and height of a cell when
COMMENT trying to determine the actual starting chunk within the cell.
COMMENT <p>
COMMENT A value of 0 means that the structure can be placed in any chunk within a grid cell,
COMMENT which also means two structures from adjacent grid cells could be placed directly
COMMENT next to each other.
COMMENT <p>
COMMENT A value that equals {@link #spacing} - 1 will restrict placement of the structure to the
COMMENT chunk at 0,0 of the grid cell.
COMMENT <p>
COMMENT This value must be between 0 and {@link #spacing} - 1, and is expressed in chunks.
FIELD field_24920 salt I
COMMENT Used together with the world seed and a grid cell's x,y coordinates to seed the RNG when deciding
COMMENT whether a structure should really be placed in a grid cell or not.
COMMENT This is used to avoid that two types of structures that have the same spacing always occur
COMMENT in the same chunks of their placement grid, and thus in the same world chunk.
METHOD <init> (III)V
ARG 1 spacing
ARG 2 separation
ARG 3 salt
METHOD method_28803 getSpacing ()I
METHOD method_28804 (Lnet/minecraft/class_5314;)Ljava/lang/Integer;
ARG 0 config
METHOD method_28806 getSeparation ()I
METHOD method_28807 (Lnet/minecraft/class_5314;)Ljava/lang/Integer;
ARG 0 config
METHOD method_28808 getSalt ()I
METHOD method_28809 (Lnet/minecraft/class_5314;)Ljava/lang/Integer;
ARG 0 config
METHOD method_29298 (Lnet/minecraft/class_5314;)Lcom/mojang/serialization/DataResult;
ARG 0 config

View File

@ -1,11 +1,32 @@
CLASS net/minecraft/class_5311 net/minecraft/world/gen/chunk/StructuresConfig
COMMENT Contains the configuration for placement of each structure type during chunk generation.
FIELD field_24821 CODEC Lcom/mojang/serialization/Codec;
FIELD field_24822 DEFAULT_STRUCTURES Lcom/google/common/collect/ImmutableMap;
COMMENT Default placement settings for each known structure type.
COMMENT At startup, Minecraft validates that each registered structure has a default
COMMENT configuration in this map. If mods register structures after this class
COMMENT has been initialized, the check will already have been made and a
COMMENT bad default configuration will be used instead (see below).
FIELD field_24823 DEFAULT_STRONGHOLD Lnet/minecraft/class_5313;
COMMENT Default placement settings for the Stronghold.
FIELD field_24824 structures Ljava/util/Map;
FIELD field_24825 stronghold Lnet/minecraft/class_5313;
COMMENT Placement settings for the stronghold for this particular combination of settings,
COMMENT may be null to disable placement of strongholds.
METHOD <init> (Ljava/util/Optional;Ljava/util/Map;)V
ARG 1 stronghold
ARG 2 structures
METHOD <init> (Z)V
COMMENT Creates a new structure placement configuration with default values.
ARG 1 withStronghold
COMMENT Determines if the default stronghold configuration should be included.
METHOD method_28598 getStructures ()Ljava/util/Map;
METHOD method_28599 (Lnet/minecraft/class_5311;)Ljava/util/Map;
ARG 0 config
METHOD method_28600 getForType (Lnet/minecraft/class_3195;)Lnet/minecraft/class_5314;
COMMENT Gets the placement configuration for a specific structure type, or
COMMENT a default placement if placement for the structure was not explicitly configured.
ARG 1 structureType
METHOD method_28602 getStronghold ()Lnet/minecraft/class_5313;
METHOD method_28603 (Lnet/minecraft/class_5311;)Ljava/util/Optional;
ARG 0 config

View File

@ -13,6 +13,9 @@ CLASS net/minecraft/class_3754 net/minecraft/world/gen/chunk/SurfaceChunkGenerat
FIELD field_16581 upperInterpolatedNoise Lnet/minecraft/class_3537;
FIELD field_16648 AIR Lnet/minecraft/class_2680;
FIELD field_24773 CODEC Lcom/mojang/serialization/Codec;
FIELD field_24778 worldSeed J
METHOD <init> (Lnet/minecraft/class_1966;Lnet/minecraft/class_1966;JLnet/minecraft/class_5284;)V
ARG 3 worldSeed
METHOD method_16405 sampleNoiseColumn ([DII)V
ARG 1 buffer
ARG 2 x

View File

@ -2,3 +2,7 @@ CLASS net/minecraft/class_5312 net/minecraft/world/gen/feature/ConfiguredStructu
FIELD field_24834 TYPE_CODEC Lcom/mojang/serialization/Codec;
FIELD field_24835 feature Lnet/minecraft/class_3195;
FIELD field_24836 config Lnet/minecraft/class_3037;
METHOD method_28622 tryPlaceStart (Lnet/minecraft/class_5455;Lnet/minecraft/class_2794;Lnet/minecraft/class_1966;Lnet/minecraft/class_3485;JLnet/minecraft/class_1923;Lnet/minecraft/class_1959;ILnet/minecraft/class_5314;)Lnet/minecraft/class_3449;
COMMENT @see StructureFeature#tryPlaceStart
ARG 5 worldSeed
ARG 9 referenceCount

View File

@ -6,21 +6,79 @@ CLASS net/minecraft/class_3195 net/minecraft/world/gen/feature/StructureFeature
FIELD field_24863 codec Lcom/mojang/serialization/Codec;
METHOD method_13149 getMonsterSpawns ()Ljava/util/List;
METHOD method_14015 locateStructure (Lnet/minecraft/class_4538;Lnet/minecraft/class_5138;Lnet/minecraft/class_2338;IZJLnet/minecraft/class_5314;)Lnet/minecraft/class_2338;
COMMENT Tries to find the closest structure of this type near a given block.
COMMENT <p>
COMMENT This method relies on the given world generation settings (seed and placement configuration)
COMMENT to match the time at which the structure was generated, otherwise it will not be found.
COMMENT <p>
COMMENT New chunks will only be generated up to the {@link net.minecraft.world.chunk.ChunkStatus#STRUCTURE_STARTS} phase by this method.
COMMENT
COMMENT @return null if no structure could be found within the given search radius.
ARG 3 searchStartPos
ARG 4 searchRadius
COMMENT The search radius in chunks around the chunk the given block position is in. A radius of 0 will only search in the given chunk.
ARG 5 skipExistingChunks
ARG 6 worldSeed
ARG 8 config
METHOD method_14016 getStructureStartFactory ()Lnet/minecraft/class_3195$class_3774;
METHOD method_14019 getName ()Ljava/lang/String;
METHOD method_14026 shouldStartAt (Lnet/minecraft/class_2794;Lnet/minecraft/class_1966;JLnet/minecraft/class_2919;IILnet/minecraft/class_1959;Lnet/minecraft/class_1923;Lnet/minecraft/class_3037;)Z
COMMENT Checks if this structure can <em>actually</em> be placed at a potential structure position determined via
COMMENT {@link #getStartChunk}. Specific structures override this method to reduce the spawn propability or
COMMENT restrict the spawn in some other way.
ARG 3 worldSeed
ARG 6 chunkX
ARG 7 chunkZ
ARG 9 chunkPos
METHOD method_16140 getCreatureSpawns ()Ljava/util/List;
METHOD method_27218 getStartChunk (Lnet/minecraft/class_5314;JLnet/minecraft/class_2919;II)Lnet/minecraft/class_1923;
COMMENT Determines the cell of the structure placement grid a chunk belongs to, and
COMMENT returns the chunk within that cell, that this structure will actually be placed at.
COMMENT <p>
COMMENT If the {@link StructureConfig} uses a separation setting greater than 0, the
COMMENT placement will be constrained to [0, spacing - separation] within the grid cell.
COMMENT If a non-uniform distribution is used for placement {@see #isUniformDistribution()},
COMMENT then this also moves the center towards the origin.
ARG 1 config
ARG 2 worldSeed
ARG 4 placementRandom
ARG 5 chunkX
ARG 6 chunkY
METHOD method_27219 isUniformDistribution ()Z
COMMENT If true, this structure's start position will be uniformy distributed within
COMMENT a placement grid cell. If false, the structure's starting point will be biased
COMMENT towards the center of the cell.
METHOD method_28656 createStart (IILnet/minecraft/class_3341;IJ)Lnet/minecraft/class_3449;
ARG 1 chunkX
ARG 2 chunkZ
ARG 3 boundingBox
ARG 4 referenceCount
ARG 5 worldSeed
METHOD method_28657 tryPlaceStart (Lnet/minecraft/class_5455;Lnet/minecraft/class_2794;Lnet/minecraft/class_1966;Lnet/minecraft/class_3485;JLnet/minecraft/class_1923;Lnet/minecraft/class_1959;ILnet/minecraft/class_2919;Lnet/minecraft/class_5314;Lnet/minecraft/class_3037;)Lnet/minecraft/class_3449;
COMMENT Tries to place a starting point for this type of structure in the given chunk.
COMMENT <p>
COMMENT If this structure doesn't have a starting point in the chunk, {@link StructureStart.DEFAULT}
COMMENT will be returned.
ARG 5 worldSeed
ARG 9 referenceCount
METHOD method_28659 configure (Lnet/minecraft/class_3037;)Lnet/minecraft/class_5312;
ARG 1 config
METHOD method_28660 readStructureStart (Lnet/minecraft/class_3485;Lnet/minecraft/class_2487;J)Lnet/minecraft/class_3449;
ARG 1 tag
ARG 2 worldSeed
METHOD method_28661 register (Ljava/lang/String;Lnet/minecraft/class_3195;Lnet/minecraft/class_2893$class_2895;)Lnet/minecraft/class_3195;
ARG 0 name
ARG 1 structureFeature
ARG 2 step
METHOD method_28663 getGenerationStep ()Lnet/minecraft/class_2893$class_2895;
COMMENT Gets the step during which this structure will participate in world generation.
COMMENT Structures will generate before other features in the same generation step.
METHOD method_28665 getCodec ()Lcom/mojang/serialization/Codec;
CLASS class_3774 StructureStartFactory
METHOD create (Lnet/minecraft/class_3195;IILnet/minecraft/class_3341;IJ)Lnet/minecraft/class_3449;
ARG 1 feature
ARG 2 x
ARG 3 z
ARG 2 chunkX
ARG 3 chunkZ
ARG 4 box
ARG 5 referenceCount
ARG 6 worldSeed