StructurePlaceSettings .java

net.minecraft.world.level.levelgen.structure.templatesystem.StructurePlaceSettings (class, 156 lines): members: shouldApplyWaterlogging, setLiquidSettings.

net.minecraft.world.level.levelgen.structure.templatesystemclass156 linescommon4.3 KB

API Surface (23)

StructurePlaceSettings copy()
StructurePlaceSettings setMirror(final Mirror mirror)
StructurePlaceSettings setRotation(final Rotation rotation)
StructurePlaceSettings setRotationPivot(final BlockPos rotationPivot)
StructurePlaceSettings setIgnoreEntities(final boolean ignoreEntities)
StructurePlaceSettings setBoundingBox(final BoundingBox boundingBox)
StructurePlaceSettings setRandom(final @Nullable RandomSource random)
StructurePlaceSettings setLiquidSettings(final LiquidSettings liquidSettings)
StructurePlaceSettings setKnownShape(final boolean knownShape)
StructurePlaceSettings clearProcessors()
StructurePlaceSettings addProcessor(final StructureProcessor processor)
StructurePlaceSettings popProcessor(final StructureProcessor processor)
Mirror getMirror()
Rotation getRotation()
BlockPos getRotationPivot()
RandomSource getRandom(final @Nullable BlockPos pos)
boolean isIgnoreEntities()
boolean getKnownShape()
List<StructureProcessor> getProcessors()
boolean shouldApplyWaterlogging()
StructureTemplate.Palette getRandomPalette(final List<StructureTemplate.Palette> palettes, final @Nullable BlockPos pos)
StructurePlaceSettings setFinalizeEntities(final boolean finalizeEntities)
boolean shouldFinalizeEntities()

Fields & Constants (11)

mirror
rotation
rotationPivot
ignoreEntities
boundingBox
liquidSettings
random
palette
processors
knownShape
finalizeEntities

String literals (1)

"No palettes"

Full Source

StructurePlaceSettings.java156 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.world.level.levelgen.structure.templatesystem;
2
3
import com.google.common.collect.Lists;
4
import java.util.List;
5
import net.minecraft.core.BlockPos;
6
import net.minecraft.util.Mth;
7
import net.minecraft.util.RandomSource;
8
import net.minecraft.util.Util;
9
import net.minecraft.world.level.block.Mirror;
10
import net.minecraft.world.level.block.Rotation;
11
import net.minecraft.world.level.levelgen.structure.BoundingBox;
12
import org.jspecify.annotations.Nullable;
13
14
public class StructurePlaceSettings {
15
	private Mirror mirror = Mirror.NONE;
16
	private Rotation rotation = Rotation.NONE;
17
	private BlockPos rotationPivot = BlockPos.ZERO;
18
	private boolean ignoreEntities;
19
	private @Nullable BoundingBox boundingBox;
20
	private LiquidSettings liquidSettings = LiquidSettings.APPLY_WATERLOGGING;
21
	private @Nullable RandomSource random;
22
	private int palette;
23
	private final List<StructureProcessor> processors = Lists.newArrayList();
24
	private boolean knownShape;
25
	private boolean finalizeEntities;
26
27
	public StructurePlaceSettings copy() {
28
		StructurePlaceSettings setting = new StructurePlaceSettings();
29
		setting.mirror = this.mirror;
30
		setting.rotation = this.rotation;
31
		setting.rotationPivot = this.rotationPivot;
32
		setting.ignoreEntities = this.ignoreEntities;
33
		setting.boundingBox = this.boundingBox;
34
		setting.liquidSettings = this.liquidSettings;
35
		setting.random = this.random;
36
		setting.palette = this.palette;
37
		setting.processors.addAll(this.processors);
38
		setting.knownShape = this.knownShape;
39
		setting.finalizeEntities = this.finalizeEntities;
40
		return setting;
41
	}
42
43
	public StructurePlaceSettings setMirror(final Mirror mirror) {
44
		this.mirror = mirror;
45
		return this;
46
	}
47
48
	public StructurePlaceSettings setRotation(final Rotation rotation) {
49
		this.rotation = rotation;
50
		return this;
51
	}
52
53
	public StructurePlaceSettings setRotationPivot(final BlockPos rotationPivot) {
54
		this.rotationPivot = rotationPivot;
55
		return this;
56
	}
57
58
	public StructurePlaceSettings setIgnoreEntities(final boolean ignoreEntities) {
59
		this.ignoreEntities = ignoreEntities;
60
		return this;
61
	}
62
63
	public StructurePlaceSettings setBoundingBox(final BoundingBox boundingBox) {
64
		this.boundingBox = boundingBox;
65
		return this;
66
	}
67
68
	public StructurePlaceSettings setRandom(final @Nullable RandomSource random) {
69
		this.random = random;
70
		return this;
71
	}
72
73
	public StructurePlaceSettings setLiquidSettings(final LiquidSettings liquidSettings) {
74
		this.liquidSettings = liquidSettings;
75
		return this;
76
	}
77
78
	public StructurePlaceSettings setKnownShape(final boolean knownShape) {
79
		this.knownShape = knownShape;
80
		return this;
81
	}
82
83
	public StructurePlaceSettings clearProcessors() {
84
		this.processors.clear();
85
		return this;
86
	}
87
88
	public StructurePlaceSettings addProcessor(final StructureProcessor processor) {
89
		this.processors.add(processor);
90
		return this;
91
	}
92
93
	public StructurePlaceSettings popProcessor(final StructureProcessor processor) {
94
		this.processors.remove(processor);
95
		return this;
96
	}
97
98
	public Mirror getMirror() {
99
		return this.mirror;
100
	}
101
102
	public Rotation getRotation() {
103
		return this.rotation;
104
	}
105
106
	public BlockPos getRotationPivot() {
107
		return this.rotationPivot;
108
	}
109
110
	public RandomSource getRandom(final @Nullable BlockPos pos) {
111
		if (this.random != null) {
112
			return this.random;
113
		} else {
114
			return pos == null ? RandomSource.create(Util.getMillis()) : RandomSource.create(Mth.getSeed(pos));
115
		}
116
	}
117
118
	public boolean isIgnoreEntities() {
119
		return this.ignoreEntities;
120
	}
121
122
	public @Nullable BoundingBox getBoundingBox() {
123
		return this.boundingBox;
124
	}
125
126
	public boolean getKnownShape() {
127
		return this.knownShape;
128
	}
129
130
	public List<StructureProcessor> getProcessors() {
131
		return this.processors;
132
	}
133
134
	public boolean shouldApplyWaterlogging() {
135
		return this.liquidSettings == LiquidSettings.APPLY_WATERLOGGING;
136
	}
137
138
	public StructureTemplate.Palette getRandomPalette(final List<StructureTemplate.Palette> palettes, final @Nullable BlockPos pos) {
139
		int paletteSize = palettes.size();
140
		if (paletteSize == 0) {
141
			throw new IllegalStateException("No palettes");
142
		} else {
143
			return palettes.get(this.getRandom(pos).nextInt(paletteSize));
144
		}
145
	}
146
147
	public StructurePlaceSettings setFinalizeEntities(final boolean finalizeEntities) {
148
		this.finalizeEntities = finalizeEntities;
149
		return this;
150
	}
151
152
	public boolean shouldFinalizeEntities() {
153
		return this.finalizeEntities;
154
	}
155
}
156

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