InSquarePlacement .java

net.minecraft.world.level.levelgen.placement.InSquarePlacement (class, 28 lines): members: spread, modify, INSTANCE, codec, CODEC. imports: RandomSource.

net.minecraft.world.level.levelgen.placementclass28 linescommon878 B

Implements

API Surface (3)

InSquarePlacement spread()
void modify(final PlacementContext context, final RandomSource random, final BlockPos origin, final Consumer<BlockPos> output)
MapCodec<InSquarePlacement> codec()

Fields & Constants (2)

INSTANCE
CODEC

Code Graph: Dependencies (4)

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

Full Source

InSquarePlacement.java28 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.world.level.levelgen.placement;
2
3
import com.mojang.serialization.MapCodec;
4
import java.util.function.Consumer;
5
import net.minecraft.core.BlockPos;
6
import net.minecraft.util.RandomSource;
7
8
public class InSquarePlacement implements PlacementModifier {
9
	private static final InSquarePlacement INSTANCE = new InSquarePlacement();
10
	public static final MapCodec<InSquarePlacement> CODEC = MapCodec.unit(() -> INSTANCE);
11
12
	public static InSquarePlacement spread() {
13
		return INSTANCE;
14
	}
15
16
	@Override
17
	public void modify(final PlacementContext context, final RandomSource random, final BlockPos origin, final Consumer<BlockPos> output) {
18
		int x = random.nextInt(16) + origin.getX();
19
		int z = random.nextInt(16) + origin.getZ();
20
		output.accept(new BlockPos(x, origin.getY(), z));
21
	}
22
23
	@Override
24
	public MapCodec<InSquarePlacement> codec() {
25
		return CODEC;
26
	}
27
}
28

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