CubeVoxelShape .java

net.minecraft.world.phys.shapes.CubeVoxelShape (class, 23 lines): extends VoxelShape. members: findIndex, getCoords. imports: DoubleList, Direction, Mth.

net.minecraft.world.phys.shapesclass23 linescommonextends VoxelShape606 B

API Surface (2)

DoubleList getCoords(final Direction.Axis axis)
int findIndex(final Direction.Axis axis, final double coord)

Code Graph: Dependencies (4)

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

Full Source

CubeVoxelShape.java23 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
import net.minecraft.util.Mth;
6
7
public final class CubeVoxelShape extends VoxelShape {
8
	public CubeVoxelShape(final DiscreteVoxelShape shape) {
9
		super(shape);
10
	}
11
12
	@Override
13
	public DoubleList getCoords(final Direction.Axis axis) {
14
		return new CubePointRange(this.shape.getSize(axis));
15
	}
16
17
	@Override
18
	protected int findIndex(final Direction.Axis axis, final double coord) {
19
		int size = this.shape.getSize(axis);
20
		return Mth.floor(Mth.clamp(coord * size, -1.0, size));
21
	}
22
}
23

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