StructureSpawnOverride .java

net.minecraft.world.level.levelgen.structure.StructureSpawnOverride (record): members: boundingBox, spawns, BoundingBoxType, CODEC. strings: "spawns".

net.minecraft.world.level.levelgen.structurerecord35 linescommon1.2 KB

API Surface (2)

record StructureSpawnOverride(StructureSpawnOverride.BoundingBoxType boundingBox, WeightedList<MobSpawnSettings.SpawnerData> spawns)
String getSerializedName()

Fields & Constants (1)

CODEC

String literals (4)

"bounding_box"
"spawns"
"piece"
"full"

Code Graph: Dependencies (3)

Edges (calls / imports / inherits / references) resolved by graphify from the AST. Every chip opens the class source.

Full Source

StructureSpawnOverride.java35 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.world.level.levelgen.structure;
2
3
import com.mojang.serialization.Codec;
4
import com.mojang.serialization.codecs.RecordCodecBuilder;
5
import net.minecraft.util.StringRepresentable;
6
import net.minecraft.util.random.WeightedList;
7
import net.minecraft.world.level.biome.MobSpawnSettings;
8
9
public record StructureSpawnOverride(StructureSpawnOverride.BoundingBoxType boundingBox, WeightedList<MobSpawnSettings.SpawnerData> spawns) {
10
	public static final Codec<StructureSpawnOverride> CODEC = RecordCodecBuilder.create(
11
		i -> i.group(
12
				StructureSpawnOverride.BoundingBoxType.CODEC.fieldOf("bounding_box").forGetter(StructureSpawnOverride::boundingBox),
13
				WeightedList.codec(MobSpawnSettings.SpawnerData.CODEC).fieldOf("spawns").forGetter(StructureSpawnOverride::spawns)
14
			)
15
			.apply(i, StructureSpawnOverride::new)
16
	);
17
18
	public enum BoundingBoxType implements StringRepresentable {
19
		PIECE("piece"),
20
		STRUCTURE("full");
21
22
		public static final Codec<StructureSpawnOverride.BoundingBoxType> CODEC = StringRepresentable.fromEnum(StructureSpawnOverride.BoundingBoxType::values);
23
		private final String id;
24
25
		BoundingBoxType(final String id) {
26
			this.id = id;
27
		}
28
29
		@Override
30
		public String getSerializedName() {
31
			return this.id;
32
		}
33
	}
34
}
35

Decompiled Minecraft 26.3 source of StructureSpawnOverride (net/minecraft/world/level/levelgen/structure/StructureSpawnOverride.java) with Mojang official mappings, stored verbatim on the site.