You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I expect structures to generate when I return true for shouldGenerateStructures()
Observed/Actual behavior
I noticed when doing some generator stuff, that structures aren't placed into the world when ChunkGenerator#shouldGenerateDecorations() return false.
I did some digging and came to the realization why this happens.
Structures are broken up into 2 parts:
StructureStarts = This is an early stage in the generation steps. Minecraft decides which types of structures will go where.
When using shouldGenerateStructures returned as true... this stage decides it will place a structure there.
StructurePlacements = Later on in the chunk generation steps, in the same stage that decorations (features) are placed, the structure pieces are also placed.
After seeing this in the code I realized if shouldGenerateDecorations returns false (thus preventing features from being placed), the structure piece placements are also skipped.
When this happens, the game will assume a structure is placed in a specific spot, this can be seen using the locate command (see steps below), where it'll find a structure, but nothing actually got placed.
Steps/models to reproduce
Simple code to replicate:
publicvoidtestGenerator() {
WorldCreatorworldCreator = newWorldCreator("world_test_for_paper");
worldCreator.generator(newChunkGenerator() {
@OverridepublicbooleanshouldGenerateNoise() {
returntrue; // Vanilla noise
}
@OverridepublicbooleanshouldGenerateSurface() {
returntrue; // Vanilla surface
}
@OverridepublicbooleanshouldGenerateStructures() {
returntrue; // Yes we want structures
}
@OverridepublicbooleanshouldGenerateDecorations() {
returnfalse; // No we dont want your trees
}
@OverridepublicLocationgetFixedSpawnLocation(@NotNullWorldworld, @NotNullRandomrandom) {
returnnewLocation(world,1,1,1); // Speed up the process
}
});
WorldtestWorld = worldCreator.createWorld();
}
start up server
join server and teleport to new world
run command /locate structure minecraft:village_plains
Once the game finds the village, click the TP thing to TP to it.
Behold, no village.
Plugin and Datapack List
[14:29:19 INFO]: ℹ Server Plugins (1):
[14:29:19 INFO]: Paper Plugins (1):
[14:29:19 INFO]: - CorePlugin #(my plugin for testing)
Paper version
Currently using the 1.21.5 update branch:
[14:24:04 INFO]: This server is running Paper version 1.21.5-DEV-update/1.21.5@ce91a8c (1970-01-01T00:00:00Z) (Implementing API version 1.21.5-R0.1-SNAPSHOT)
You are running the latest version
Previous version: 1.21.5-DEV-b6d70a9 (MC: 1.21.5)
I believe this would also happen on previous versions.
I'm pretty sure this happened to me in 1.21.4 and just forgot to report it.
Other
I'm open to doing a PR for this.
Looking thru the code I feel like this could potentially be a simple fix.
I wanted to wait til after 1.21.5 was released, as I'm sure you guys have too much on your plate as it is.
The text was updated successfully, but these errors were encountered:
Expected behavior
I expect structures to generate when I return true for
shouldGenerateStructures()
Observed/Actual behavior
I noticed when doing some generator stuff, that structures aren't placed into the world when
ChunkGenerator#shouldGenerateDecorations()
return false.I did some digging and came to the realization why this happens.
Structures are broken up into 2 parts:
StructureStarts = This is an early stage in the generation steps. Minecraft decides which types of structures will go where.
When using
shouldGenerateStructures
returned as true... this stage decides it will place a structure there.StructurePlacements = Later on in the chunk generation steps, in the same stage that decorations (features) are placed, the structure pieces are also placed.
After seeing this in the code I realized if
shouldGenerateDecorations
returns false (thus preventing features from being placed), the structure piece placements are also skipped.When this happens, the game will assume a structure is placed in a specific spot, this can be seen using the locate command (see steps below), where it'll find a structure, but nothing actually got placed.
Steps/models to reproduce
Simple code to replicate:
/locate structure minecraft:village_plains
Plugin and Datapack List
Paper version
Currently using the 1.21.5 update branch:
I believe this would also happen on previous versions.
I'm pretty sure this happened to me in 1.21.4 and just forgot to report it.
Other
I'm open to doing a PR for this.
Looking thru the code I feel like this could potentially be a simple fix.
I wanted to wait til after 1.21.5 was released, as I'm sure you guys have too much on your plate as it is.
The text was updated successfully, but these errors were encountered: