MiscOverworldPlacements .java

net.minecraft.data.worldgen.placement.MiscOverworldPlacements (class, 219 lines): members: LAKE_LAVA_UNDERGROUND, LAKE_LAVA_SURFACE, SPRING_LAVA, BLUE_ICE.

net.minecraft.data.worldgen.placementclass219 linescommon10.6 KB

API Surface (1)

void bootstrap(final BootstrapContext<PlacedFeature> context)

Fields & Constants (19)

ICE_SPIKE
ICE_PATCH
FOREST_ROCK
ICEBERG_PACKED
ICEBERG_BLUE
BLUE_ICE
LAKE_LAVA_UNDERGROUND
LAKE_LAVA_SURFACE
SULFUR_POOL
DISK_CLAY
DISK_GRAVEL
DISK_SAND
DISK_GRASS
FREEZE_TOP_LAYER
VOID_START_PLATFORM
DESERT_WELL
SPRING_LAVA
SPRING_LAVA_FROZEN
SPRING_WATER

String literals (19)

"ice_spike"
"ice_patch"
"forest_rock"
"iceberg_packed"
"iceberg_blue"
"blue_ice"
"lake_lava_underground"
"lake_lava_surface"
"sulfur_pool"
"disk_clay"
"disk_gravel"
"disk_sand"
"disk_grass"
"freeze_top_layer"
"void_start_platform"
"desert_well"
"spring_lava"
"spring_lava_frozen"
"spring_water"

Full Source

MiscOverworldPlacements.java219 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.data.worldgen.placement;
2
3
import net.minecraft.core.BlockPos;
4
import net.minecraft.core.Direction;
5
import net.minecraft.core.Holder;
6
import net.minecraft.core.HolderGetter;
7
import net.minecraft.core.Vec3i;
8
import net.minecraft.core.registries.Registries;
9
import net.minecraft.data.worldgen.BootstrapContext;
10
import net.minecraft.data.worldgen.features.MiscOverworldFeatures;
11
import net.minecraft.resources.ResourceKey;
12
import net.minecraft.util.valueproviders.ConstantInt;
13
import net.minecraft.util.valueproviders.UniformInt;
14
import net.minecraft.world.level.block.Blocks;
15
import net.minecraft.world.level.levelgen.Heightmap;
16
import net.minecraft.world.level.levelgen.VerticalAnchor;
17
import net.minecraft.world.level.levelgen.blockpredicates.BlockPredicate;
18
import net.minecraft.world.level.levelgen.feature.Feature;
19
import net.minecraft.world.level.levelgen.heightproviders.UniformHeight;
20
import net.minecraft.world.level.levelgen.heightproviders.VeryBiasedToBottomHeight;
21
import net.minecraft.world.level.levelgen.placement.BiomeFilter;
22
import net.minecraft.world.level.levelgen.placement.BlockPredicateFilter;
23
import net.minecraft.world.level.levelgen.placement.CountPlacement;
24
import net.minecraft.world.level.levelgen.placement.EnvironmentScanPlacement;
25
import net.minecraft.world.level.levelgen.placement.HeightRangePlacement;
26
import net.minecraft.world.level.levelgen.placement.InSquarePlacement;
27
import net.minecraft.world.level.levelgen.placement.OffsetPlacement;
28
import net.minecraft.world.level.levelgen.placement.PlacedFeature;
29
import net.minecraft.world.level.levelgen.placement.RarityFilter;
30
import net.minecraft.world.level.levelgen.placement.SurfaceRelativeThresholdFilter;
31
import net.minecraft.world.level.material.Fluids;
32
33
public class MiscOverworldPlacements {
34
	public static final ResourceKey<PlacedFeature> ICE_SPIKE = PlacementUtils.createKey("ice_spike");
35
	public static final ResourceKey<PlacedFeature> ICE_PATCH = PlacementUtils.createKey("ice_patch");
36
	public static final ResourceKey<PlacedFeature> FOREST_ROCK = PlacementUtils.createKey("forest_rock");
37
	public static final ResourceKey<PlacedFeature> ICEBERG_PACKED = PlacementUtils.createKey("iceberg_packed");
38
	public static final ResourceKey<PlacedFeature> ICEBERG_BLUE = PlacementUtils.createKey("iceberg_blue");
39
	public static final ResourceKey<PlacedFeature> BLUE_ICE = PlacementUtils.createKey("blue_ice");
40
	public static final ResourceKey<PlacedFeature> LAKE_LAVA_UNDERGROUND = PlacementUtils.createKey("lake_lava_underground");
41
	public static final ResourceKey<PlacedFeature> LAKE_LAVA_SURFACE = PlacementUtils.createKey("lake_lava_surface");
42
	public static final ResourceKey<PlacedFeature> SULFUR_POOL = PlacementUtils.createKey("sulfur_pool");
43
	public static final ResourceKey<PlacedFeature> DISK_CLAY = PlacementUtils.createKey("disk_clay");
44
	public static final ResourceKey<PlacedFeature> DISK_GRAVEL = PlacementUtils.createKey("disk_gravel");
45
	public static final ResourceKey<PlacedFeature> DISK_SAND = PlacementUtils.createKey("disk_sand");
46
	public static final ResourceKey<PlacedFeature> DISK_GRASS = PlacementUtils.createKey("disk_grass");
47
	public static final ResourceKey<PlacedFeature> FREEZE_TOP_LAYER = PlacementUtils.createKey("freeze_top_layer");
48
	public static final ResourceKey<PlacedFeature> VOID_START_PLATFORM = PlacementUtils.createKey("void_start_platform");
49
	public static final ResourceKey<PlacedFeature> DESERT_WELL = PlacementUtils.createKey("desert_well");
50
	public static final ResourceKey<PlacedFeature> SPRING_LAVA = PlacementUtils.createKey("spring_lava");
51
	public static final ResourceKey<PlacedFeature> SPRING_LAVA_FROZEN = PlacementUtils.createKey("spring_lava_frozen");
52
	public static final ResourceKey<PlacedFeature> SPRING_WATER = PlacementUtils.createKey("spring_water");
53
54
	public static void bootstrap(final BootstrapContext<PlacedFeature> context) {
55
		HolderGetter<Feature> configuredFeatures = context.lookup(Registries.FEATURE);
56
		Holder<Feature> iceSpike = configuredFeatures.getOrThrow(MiscOverworldFeatures.ICE_SPIKE);
57
		Holder<Feature> icePatch = configuredFeatures.getOrThrow(MiscOverworldFeatures.ICE_PATCH);
58
		Holder<Feature> forestRock = configuredFeatures.getOrThrow(MiscOverworldFeatures.FOREST_ROCK);
59
		Holder<Feature> icebergPacked = configuredFeatures.getOrThrow(MiscOverworldFeatures.ICEBERG_PACKED);
60
		Holder<Feature> icebergBlue = configuredFeatures.getOrThrow(MiscOverworldFeatures.ICEBERG_BLUE);
61
		Holder<Feature> blueIce = configuredFeatures.getOrThrow(MiscOverworldFeatures.BLUE_ICE);
62
		Holder<Feature> lakeLava = configuredFeatures.getOrThrow(MiscOverworldFeatures.LAKE_LAVA);
63
		Holder<Feature> sulfurPool = configuredFeatures.getOrThrow(MiscOverworldFeatures.SULFUR_POOL);
64
		Holder<Feature> diskClay = configuredFeatures.getOrThrow(MiscOverworldFeatures.DISK_CLAY);
65
		Holder<Feature> diskGravel = configuredFeatures.getOrThrow(MiscOverworldFeatures.DISK_GRAVEL);
66
		Holder<Feature> diskSand = configuredFeatures.getOrThrow(MiscOverworldFeatures.DISK_SAND);
67
		Holder<Feature> diskGrass = configuredFeatures.getOrThrow(MiscOverworldFeatures.DISK_GRASS);
68
		Holder<Feature> freezeTopLayer = configuredFeatures.getOrThrow(MiscOverworldFeatures.FREEZE_TOP_LAYER);
69
		Holder<Feature> voidStartPlatform = configuredFeatures.getOrThrow(MiscOverworldFeatures.VOID_START_PLATFORM);
70
		Holder<Feature> desertWell = configuredFeatures.getOrThrow(MiscOverworldFeatures.DESERT_WELL);
71
		Holder<Feature> springLavaOverworld = configuredFeatures.getOrThrow(MiscOverworldFeatures.SPRING_LAVA_OVERWORLD);
72
		Holder<Feature> springLavaFrozen = configuredFeatures.getOrThrow(MiscOverworldFeatures.SPRING_LAVA_FROZEN);
73
		Holder<Feature> springWater = configuredFeatures.getOrThrow(MiscOverworldFeatures.SPRING_WATER);
74
		PlacementUtils.register(context, ICE_SPIKE, iceSpike, CountPlacement.of(3), InSquarePlacement.spread(), PlacementUtils.HEIGHTMAP, BiomeFilter.biome());
75
		PlacementUtils.register(
76
			context,
77
			ICE_PATCH,
78
			icePatch,
79
			CountPlacement.of(2),
80
			InSquarePlacement.spread(),
81
			PlacementUtils.HEIGHTMAP,
82
			OffsetPlacement.vertical(ConstantInt.of(-1)),
83
			BlockPredicateFilter.forPredicate(BlockPredicate.matchesBlocks(Blocks.SNOW_BLOCK)),
84
			BiomeFilter.biome()
85
		);
86
		PlacementUtils.register(context, FOREST_ROCK, forestRock, CountPlacement.of(2), InSquarePlacement.spread(), PlacementUtils.HEIGHTMAP, BiomeFilter.biome());
87
		PlacementUtils.register(context, ICEBERG_BLUE, icebergBlue, RarityFilter.onAverageOnceEvery(200), InSquarePlacement.spread(), BiomeFilter.biome());
88
		PlacementUtils.register(context, ICEBERG_PACKED, icebergPacked, RarityFilter.onAverageOnceEvery(16), InSquarePlacement.spread(), BiomeFilter.biome());
89
		PlacementUtils.register(
90
			context,
91
			BLUE_ICE,
92
			blueIce,
93
			CountPlacement.of(UniformInt.of(0, 19)),
94
			InSquarePlacement.spread(),
95
			HeightRangePlacement.uniform(VerticalAnchor.absolute(30), VerticalAnchor.absolute(61)),
96
			BiomeFilter.biome()
97
		);
98
		PlacementUtils.register(
99
			context,
100
			LAKE_LAVA_UNDERGROUND,
101
			lakeLava,
102
			RarityFilter.onAverageOnceEvery(9),
103
			InSquarePlacement.spread(),
104
			HeightRangePlacement.of(UniformHeight.of(VerticalAnchor.absolute(0), VerticalAnchor.top())),
105
			EnvironmentScanPlacement.scanningFor(
106
				Direction.DOWN, BlockPredicate.allOf(BlockPredicate.not(BlockPredicate.ONLY_IN_AIR_PREDICATE), BlockPredicate.insideWorld(new BlockPos(0, -5, 0))), 32
107
			),
108
			SurfaceRelativeThresholdFilter.of(Heightmap.Types.OCEAN_FLOOR_WG, Integer.MIN_VALUE, -5),
109
			BiomeFilter.biome()
110
		);
111
		PlacementUtils.register(
112
			context,
113
			LAKE_LAVA_SURFACE,
114
			lakeLava,
115
			RarityFilter.onAverageOnceEvery(200),
116
			InSquarePlacement.spread(),
117
			PlacementUtils.HEIGHTMAP_WORLD_SURFACE,
118
			BiomeFilter.biome()
119
		);
120
		PlacementUtils.register(
121
			context,
122
			SULFUR_POOL,
123
			sulfurPool,
124
			CountPlacement.of(256),
125
			InSquarePlacement.spread(),
126
			PlacementUtils.RANGE_BOTTOM_TO_MAX_TERRAIN_HEIGHT,
127
			BlockPredicateFilter.forPredicate(BlockPredicate.solid()),
128
			EnvironmentScanPlacement.scanningFor(Direction.UP, BlockPredicate.ONLY_IN_AIR_PREDICATE, 32),
129
			OffsetPlacement.vertical(ConstantInt.of(-1)),
130
			BlockPredicateFilter.forPredicate(BlockPredicate.matchesBlocks(Blocks.SULFUR)),
131
			BiomeFilter.biome()
132
		);
133
		PlacementUtils.register(
134
			context,
135
			DISK_CLAY,
136
			diskClay,
137
			InSquarePlacement.spread(),
138
			PlacementUtils.HEIGHTMAP_TOP_SOLID,
139
			BlockPredicateFilter.forPredicate(BlockPredicate.matchesFluids(Fluids.WATER)),
140
			BiomeFilter.biome()
141
		);
142
		PlacementUtils.register(
143
			context,
144
			DISK_GRAVEL,
145
			diskGravel,
146
			InSquarePlacement.spread(),
147
			PlacementUtils.HEIGHTMAP_TOP_SOLID,
148
			BlockPredicateFilter.forPredicate(BlockPredicate.matchesFluids(Fluids.WATER)),
149
			BiomeFilter.biome()
150
		);
151
		PlacementUtils.register(
152
			context,
153
			DISK_SAND,
154
			diskSand,
155
			CountPlacement.of(3),
156
			InSquarePlacement.spread(),
157
			PlacementUtils.HEIGHTMAP_TOP_SOLID,
158
			BlockPredicateFilter.forPredicate(BlockPredicate.matchesFluids(Fluids.WATER)),
159
			BiomeFilter.biome()
160
		);
161
		PlacementUtils.register(
162
			context,
163
			DISK_GRASS,
164
			diskGrass,
165
			CountPlacement.of(1),
166
			InSquarePlacement.spread(),
167
			PlacementUtils.HEIGHTMAP_TOP_SOLID,
168
			OffsetPlacement.vertical(ConstantInt.of(-1)),
169
			BlockPredicateFilter.forPredicate(BlockPredicate.matchesBlocks(Blocks.MUD)),
170
			BiomeFilter.biome()
171
		);
172
		PlacementUtils.register(context, FREEZE_TOP_LAYER, freezeTopLayer, BiomeFilter.biome());
173
		PlacementUtils.register(context, VOID_START_PLATFORM, voidStartPlatform, BiomeFilter.biome());
174
		PlacementUtils.register(
175
			context,
176
			DESERT_WELL,
177
			desertWell,
178
			RarityFilter.onAverageOnceEvery(1000),
179
			InSquarePlacement.spread(),
180
			PlacementUtils.HEIGHTMAP,
181
			OffsetPlacement.of(Direction.DOWN),
182
			BlockPredicateFilter.forPredicate(
183
				BlockPredicate.allOf(
184
					BlockPredicate.matchesBlocks(Blocks.SAND),
185
					BlockPredicate.volumeMatch(new Vec3i(-2, -2, -2), new Vec3i(2, -1, 2), BlockPredicate.not(BlockPredicate.ONLY_IN_AIR_PREDICATE))
186
				)
187
			),
188
			BiomeFilter.biome()
189
		);
190
		PlacementUtils.register(
191
			context,
192
			SPRING_LAVA,
193
			springLavaOverworld,
194
			CountPlacement.of(20),
195
			InSquarePlacement.spread(),
196
			HeightRangePlacement.of(VeryBiasedToBottomHeight.of(VerticalAnchor.bottom(), VerticalAnchor.belowTop(8), 8)),
197
			BiomeFilter.biome()
198
		);
199
		PlacementUtils.register(
200
			context,
201
			SPRING_LAVA_FROZEN,
202
			springLavaFrozen,
203
			CountPlacement.of(20),
204
			InSquarePlacement.spread(),
205
			HeightRangePlacement.of(VeryBiasedToBottomHeight.of(VerticalAnchor.bottom(), VerticalAnchor.belowTop(8), 8)),
206
			BiomeFilter.biome()
207
		);
208
		PlacementUtils.register(
209
			context,
210
			SPRING_WATER,
211
			springWater,
212
			CountPlacement.of(25),
213
			InSquarePlacement.spread(),
214
			HeightRangePlacement.uniform(VerticalAnchor.bottom(), VerticalAnchor.absolute(192)),
215
			BiomeFilter.biome()
216
		);
217
	}
218
}
219

Decompiled Minecraft 26.3 source of MiscOverworldPlacements (net/minecraft/data/worldgen/placement/MiscOverworldPlacements.java) with Mojang official mappings, stored verbatim on the site.