SliceShape .java

net.minecraft.world.phys.shapes.SliceShape (class, 34 lines): members: SLICE_COORDS, getCoords, delegate, axis. imports: DoubleList, Direction.

net.minecraft.world.phys.shapesclass34 linescommonextends VoxelShape1.1 KB

API Surface (1)

DoubleList getCoords(final Direction.Axis axis)

Fields & Constants (3)

SLICE_COORDS
delegate
axis

Code Graph: Dependencies (3)

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

Full Source

SliceShape.java34 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.world.phys.shapes;
2
3
import it.unimi.dsi.fastutil.doubles.DoubleList;
4
import net.minecraft.core.Direction;
5
6
public class SliceShape extends VoxelShape {
7
	private final VoxelShape delegate;
8
	private final Direction.Axis axis;
9
	private static final DoubleList SLICE_COORDS = new CubePointRange(1);
10
11
	public SliceShape(final VoxelShape delegate, final Direction.Axis axis, final int point) {
12
		super(makeSlice(delegate.shape, axis, point));
13
		this.delegate = delegate;
14
		this.axis = axis;
15
	}
16
17
	private static DiscreteVoxelShape makeSlice(final DiscreteVoxelShape delegate, final Direction.Axis axis, final int point) {
18
		return new SubShape(
19
			delegate,
20
			axis.choose(point, 0, 0),
21
			axis.choose(0, point, 0),
22
			axis.choose(0, 0, point),
23
			axis.choose(point + 1, delegate.xSize, delegate.xSize),
24
			axis.choose(delegate.ySize, point + 1, delegate.ySize),
25
			axis.choose(delegate.zSize, delegate.zSize, point + 1)
26
		);
27
	}
28
29
	@Override
30
	public DoubleList getCoords(final Direction.Axis axis) {
31
		return axis == this.axis ? SLICE_COORDS : this.delegate.getCoords(axis);
32
	}
33
}
34

Decompiled Minecraft 26.3 source of SliceShape (net/minecraft/world/phys/shapes/SliceShape.java) with Mojang official mappings, stored verbatim on the site.