Shapes .java

net.minecraft.world.phys.shapes.Shapes (class, 451 lines): members: rotateHorizontalAxis, DoubleLineConsumer, mergedFaceOccludes, faceShapeOccludes, equal.

net.minecraft.world.phys.shapesclass451 linescommon16.5 KB

API Surface (29)

VoxelShape empty()
VoxelShape block()
VoxelShape box(final double minX, final double minY, final double minZ, final double maxX, final double maxY, final double maxZ)
VoxelShape create(final double minX, final double minY, final double minZ, final double maxX, final double maxY, final double maxZ)
VoxelShape create(final AABB aabb)
VoxelShape or(final VoxelShape first, final VoxelShape second)
VoxelShape or(final VoxelShape first, final VoxelShape... tail)
VoxelShape join(final VoxelShape first, final VoxelShape second, final BooleanOp op)
VoxelShape joinUnoptimized(final VoxelShape first, final VoxelShape second, final BooleanOp op)
boolean joinIsNotEmpty(final VoxelShape first, final VoxelShape second, final BooleanOp op)
double collide(final Direction.Axis axis, final AABB moving, final Iterable<VoxelShape> shapes, double distance)
boolean blockOccludes(final VoxelShape shape, final VoxelShape occluder, final Direction direction)
boolean mergedFaceOccludes(final VoxelShape shape, final VoxelShape occluder, final Direction direction)
boolean faceShapeOccludes(final VoxelShape shape, final VoxelShape occluder)
VoxelShape rotate(final VoxelShape shape, final OctahedralGroup rotation)
VoxelShape rotate(final VoxelShape shape, final OctahedralGroup rotation, final Vec3 rotationPoint)
boolean equal(final VoxelShape first, final VoxelShape second)
Map<Direction.Axis, VoxelShape> rotateHorizontalAxis(final VoxelShape zAxis)
Map<Direction.Axis, VoxelShape> rotateHorizontalAxis(final VoxelShape zAxis, final Vec3 rotationCenter)
Map<Direction.Axis, VoxelShape> rotateAllAxis(final VoxelShape north)
Map<Direction.Axis, VoxelShape> rotateAllAxis(final VoxelShape north, final Vec3 rotationCenter)
Map<Direction, VoxelShape> rotateHorizontal(final VoxelShape north)
Map<Direction, VoxelShape> rotateHorizontal(final VoxelShape north, final OctahedralGroup initial)
Map<Direction, VoxelShape> rotateHorizontal(final VoxelShape north, final OctahedralGroup initial, final Vec3 rotationCenter)
Map<Direction, VoxelShape> rotateAll(final VoxelShape north)
Map<Direction, VoxelShape> rotateAll(final VoxelShape north, final Vec3 rotationCenter)
Map<Direction, VoxelShape> rotateAll(final VoxelShape north, final OctahedralGroup initial, final Vec3 rotationCenter)
Map<AttachFace, Map<Direction, VoxelShape>> rotateAttachFace(final VoxelShape north)
Map<AttachFace, Map<Direction, VoxelShape>> rotateAttachFace(final VoxelShape north, final OctahedralGroup initial)

Fields & Constants (12)

EPSILON
BIG_EPSILON
BLOCK
BLOCK_CENTER
INFINITY
EMPTY
xMerger
yMerger
zMerger
first
second
firstOnlyMatters

Full Source

Shapes.java451 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.world.phys.shapes;
2
3
import com.google.common.annotations.VisibleForTesting;
4
import com.google.common.collect.Maps;
5
import com.google.common.math.DoubleMath;
6
import com.google.common.math.IntMath;
7
import com.mojang.math.OctahedralGroup;
8
import it.unimi.dsi.fastutil.doubles.DoubleArrayList;
9
import it.unimi.dsi.fastutil.doubles.DoubleList;
10
import java.util.Arrays;
11
import java.util.Map;
12
import java.util.Objects;
13
import net.minecraft.core.AxisCycle;
14
import net.minecraft.core.Direction;
15
import net.minecraft.util.Util;
16
import net.minecraft.world.level.block.state.properties.AttachFace;
17
import net.minecraft.world.phys.AABB;
18
import net.minecraft.world.phys.Vec3;
19
20
public final class Shapes {
21
	public static final double EPSILON = 1.0E-7;
22
	public static final double BIG_EPSILON = 1.0E-6;
23
	private static final VoxelShape BLOCK = Util.make(() -> {
24
		DiscreteVoxelShape shape = new BitSetDiscreteVoxelShape(1, 1, 1);
25
		shape.fill(0, 0, 0);
26
		return new CubeVoxelShape(shape);
27
	});
28
	private static final Vec3 BLOCK_CENTER = new Vec3(0.5, 0.5, 0.5);
29
	public static final VoxelShape INFINITY = box(
30
		Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY
31
	);
32
	private static final VoxelShape EMPTY = new ArrayVoxelShape(
33
		new BitSetDiscreteVoxelShape(0, 0, 0), new DoubleArrayList(new double[]{0.0}), new DoubleArrayList(new double[]{0.0}), new DoubleArrayList(new double[]{0.0})
34
	);
35
36
	public static VoxelShape empty() {
37
		return EMPTY;
38
	}
39
40
	public static VoxelShape block() {
41
		return BLOCK;
42
	}
43
44
	public static VoxelShape box(final double minX, final double minY, final double minZ, final double maxX, final double maxY, final double maxZ) {
45
		if (!(minX > maxX) && !(minY > maxY) && !(minZ > maxZ)) {
46
			return create(minX, minY, minZ, maxX, maxY, maxZ);
47
		} else {
48
			throw new IllegalArgumentException("The min values need to be smaller or equals to the max values");
49
		}
50
	}
51
52
	public static VoxelShape create(final double minX, final double minY, final double minZ, final double maxX, final double maxY, final double maxZ) {
53
		if (!(maxX - minX < 1.0E-7) && !(maxY - minY < 1.0E-7) && !(maxZ - minZ < 1.0E-7)) {
54
			int xBits = findBits(minX, maxX);
55
			int yBits = findBits(minY, maxY);
56
			int zBits = findBits(minZ, maxZ);
57
			if (xBits < 0 || yBits < 0 || zBits < 0) {
58
				return new ArrayVoxelShape(
59
					BLOCK.shape,
60
					DoubleArrayList.wrap(new double[]{minX, maxX}),
61
					DoubleArrayList.wrap(new double[]{minY, maxY}),
62
					DoubleArrayList.wrap(new double[]{minZ, maxZ})
63
				);
64
			}
65
66
			if (xBits == 0 && yBits == 0 && zBits == 0) {
67
				return block();
68
			}
69
70
			int xSize = 1 << xBits;
71
			int ySize = 1 << yBits;
72
			int zSize = 1 << zBits;
73
			BitSetDiscreteVoxelShape voxelShape = BitSetDiscreteVoxelShape.withFilledBounds(
74
				xSize,
75
				ySize,
76
				zSize,
77
				(int)Math.round(minX * xSize),
78
				(int)Math.round(minY * ySize),
79
				(int)Math.round(minZ * zSize),
80
				(int)Math.round(maxX * xSize),
81
				(int)Math.round(maxY * ySize),
82
				(int)Math.round(maxZ * zSize)
83
			);
84
			return new CubeVoxelShape(voxelShape);
85
		} else {
86
			return empty();
87
		}
88
	}
89
90
	public static VoxelShape create(final AABB aabb) {
91
		return create(aabb.minX, aabb.minY, aabb.minZ, aabb.maxX, aabb.maxY, aabb.maxZ);
92
	}
93
94
	@VisibleForTesting
95
	static int findBits(final double min, final double max) {
96
		if (!(min < -1.0E-7) && !(max > 1.0000001)) {
97
			for (int bits = 0; bits <= 3; bits++) {
98
				int intervals = 1 << bits;
99
				double shMin = min * intervals;
100
				double shMax = max * intervals;
101
				boolean foundMin = Math.abs(shMin - Math.round(shMin)) < 1.0E-7 * intervals;
102
				boolean foundMax = Math.abs(shMax - Math.round(shMax)) < 1.0E-7 * intervals;
103
				if (foundMin && foundMax) {
104
					return bits;
105
				}
106
			}
107
108
			return -1;
109
		} else {
110
			return -1;
111
		}
112
	}
113
114
	@VisibleForTesting
115
	static long lcm(final int first, final int second) {
116
		return (long)first * (second / IntMath.gcd(first, second));
117
	}
118
119
	public static VoxelShape or(final VoxelShape first, final VoxelShape second) {
120
		return join(first, second, BooleanOp.OR);
121
	}
122
123
	public static VoxelShape or(final VoxelShape first, final VoxelShape... tail) {
124
		return Arrays.stream(tail).reduce(first, Shapes::or);
125
	}
126
127
	public static VoxelShape join(final VoxelShape first, final VoxelShape second, final BooleanOp op) {
128
		return joinUnoptimized(first, second, op).optimize();
129
	}
130
131
	public static VoxelShape joinUnoptimized(final VoxelShape first, final VoxelShape second, final BooleanOp op) {
132
		if (op.apply(false, false)) {
133
			throw (IllegalArgumentException)Util.pauseInIde(new IllegalArgumentException());
134
		}
135
136
		if (first == second) {
137
			return op.apply(true, true) ? first : empty();
138
		}
139
140
		boolean firstOnlyMatters = op.apply(true, false);
141
		boolean secondOnlyMatters = op.apply(false, true);
142
		if (first.isEmpty()) {
143
			return secondOnlyMatters ? second : empty();
144
		}
145
146
		if (second.isEmpty()) {
147
			return firstOnlyMatters ? first : empty();
148
		}
149
150
		IndexMerger xMerger = createIndexMerger(1, first.getCoords(Direction.Axis.X), second.getCoords(Direction.Axis.X), firstOnlyMatters, secondOnlyMatters);
151
		IndexMerger yMerger = createIndexMerger(
152
			xMerger.size() - 1, first.getCoords(Direction.Axis.Y), second.getCoords(Direction.Axis.Y), firstOnlyMatters, secondOnlyMatters
153
		);
154
		IndexMerger zMerger = createIndexMerger(
155
			(xMerger.size() - 1) * (yMerger.size() - 1), first.getCoords(Direction.Axis.Z), second.getCoords(Direction.Axis.Z), firstOnlyMatters, secondOnlyMatters
156
		);
157
		BitSetDiscreteVoxelShape voxelShape = BitSetDiscreteVoxelShape.join(first.shape, second.shape, xMerger, yMerger, zMerger, op);
158
		return xMerger instanceof DiscreteCubeMerger && yMerger instanceof DiscreteCubeMerger && zMerger instanceof DiscreteCubeMerger
159
			? new CubeVoxelShape(voxelShape)
160
			: new ArrayVoxelShape(voxelShape, xMerger.getList(), yMerger.getList(), zMerger.getList());
161
	}
162
163
	public static boolean joinIsNotEmpty(final VoxelShape first, final VoxelShape second, final BooleanOp op) {
164
		if (op.apply(false, false)) {
165
			throw (IllegalArgumentException)Util.pauseInIde(new IllegalArgumentException());
166
		}
167
168
		boolean firstEmpty = first.isEmpty();
169
		boolean secondEmpty = second.isEmpty();
170
		if (!firstEmpty && !secondEmpty) {
171
			if (first == second) {
172
				return op.apply(true, true);
173
			}
174
175
			boolean firstOnlyMatters = op.apply(true, false);
176
			boolean secondOnlyMatters = op.apply(false, true);
177
178
			for (Direction.Axis axis : AxisCycle.AXIS_VALUES) {
179
				if (first.max(axis) < second.min(axis) - 1.0E-7) {
180
					return firstOnlyMatters || secondOnlyMatters;
181
				}
182
183
				if (second.max(axis) < first.min(axis) - 1.0E-7) {
184
					return firstOnlyMatters || secondOnlyMatters;
185
				}
186
			}
187
188
			IndexMerger xMerger = createIndexMerger(1, first.getCoords(Direction.Axis.X), second.getCoords(Direction.Axis.X), firstOnlyMatters, secondOnlyMatters);
189
			IndexMerger yMerger = createIndexMerger(
190
				xMerger.size() - 1, first.getCoords(Direction.Axis.Y), second.getCoords(Direction.Axis.Y), firstOnlyMatters, secondOnlyMatters
191
			);
192
			IndexMerger zMerger = createIndexMerger(
193
				(xMerger.size() - 1) * (yMerger.size() - 1), first.getCoords(Direction.Axis.Z), second.getCoords(Direction.Axis.Z), firstOnlyMatters, secondOnlyMatters
194
			);
195
			return joinIsNotEmpty(xMerger, yMerger, zMerger, first.shape, second.shape, op);
196
		} else {
197
			return op.apply(!firstEmpty, !secondEmpty);
198
		}
199
	}
200
201
	private static boolean joinIsNotEmpty(
202
		final IndexMerger xMerger,
203
		final IndexMerger yMerger,
204
		final IndexMerger zMerger,
205
		final DiscreteVoxelShape first,
206
		final DiscreteVoxelShape second,
207
		final BooleanOp op
208
	) {
209
		return !xMerger.forMergedIndexes(
210
			(x1, x2, xr) -> yMerger.forMergedIndexes(
211
				(y1, y2, yr) -> zMerger.forMergedIndexes((z1, z2, zr) -> !op.apply(first.isFullWide(x1, y1, z1), second.isFullWide(x2, y2, z2)))
212
			)
213
		);
214
	}
215
216
	public static double collide(final Direction.Axis axis, final AABB moving, final Iterable<VoxelShape> shapes, double distance) {
217
		for (VoxelShape shape : shapes) {
218
			if (Math.abs(distance) < 1.0E-7) {
219
				return 0.0;
220
			}
221
222
			distance = shape.collide(axis, moving, distance);
223
		}
224
225
		return distance;
226
	}
227
228
	public static boolean blockOccludes(final VoxelShape shape, final VoxelShape occluder, final Direction direction) {
229
		if (shape == block() && occluder == block()) {
230
			return true;
231
		}
232
233
		if (occluder.isEmpty()) {
234
			return false;
235
		}
236
237
		Direction.Axis axis = direction.getAxis();
238
		Direction.AxisDirection sign = direction.getAxisDirection();
239
		VoxelShape first = sign == Direction.AxisDirection.POSITIVE ? shape : occluder;
240
		VoxelShape second = sign == Direction.AxisDirection.POSITIVE ? occluder : shape;
241
		BooleanOp op = sign == Direction.AxisDirection.POSITIVE ? BooleanOp.ONLY_FIRST : BooleanOp.ONLY_SECOND;
242
		return DoubleMath.fuzzyEquals(first.max(axis), 1.0, 1.0E-7)
243
			&& DoubleMath.fuzzyEquals(second.min(axis), 0.0, 1.0E-7)
244
			&& !joinIsNotEmpty(new SliceShape(first, axis, first.shape.getSize(axis) - 1), new SliceShape(second, axis, 0), op);
245
	}
246
247
	public static boolean mergedFaceOccludes(final VoxelShape shape, final VoxelShape occluder, final Direction direction) {
248
		if (shape != block() && occluder != block()) {
249
			Direction.Axis axis = direction.getAxis();
250
			Direction.AxisDirection sign = direction.getAxisDirection();
251
			VoxelShape first = sign == Direction.AxisDirection.POSITIVE ? shape : occluder;
252
			VoxelShape second = sign == Direction.AxisDirection.POSITIVE ? occluder : shape;
253
			if (!DoubleMath.fuzzyEquals(first.max(axis), 1.0, 1.0E-7)) {
254
				first = empty();
255
			}
256
257
			if (!DoubleMath.fuzzyEquals(second.min(axis), 0.0, 1.0E-7)) {
258
				second = empty();
259
			}
260
261
			return !joinIsNotEmpty(
262
				block(), joinUnoptimized(new SliceShape(first, axis, first.shape.getSize(axis) - 1), new SliceShape(second, axis, 0), BooleanOp.OR), BooleanOp.ONLY_FIRST
263
			);
264
		} else {
265
			return true;
266
		}
267
	}
268
269
	public static boolean faceShapeOccludes(final VoxelShape shape, final VoxelShape occluder) {
270
		if (shape == block() || occluder == block()) {
271
			return true;
272
		} else {
273
			return shape.isEmpty() && occluder.isEmpty() ? false : !joinIsNotEmpty(block(), joinUnoptimized(shape, occluder, BooleanOp.OR), BooleanOp.ONLY_FIRST);
274
		}
275
	}
276
277
	@VisibleForTesting
278
	static IndexMerger createIndexMerger(
279
		final int cost, final DoubleList first, final DoubleList second, final boolean firstOnlyMatters, final boolean secondOnlyMatters
280
	) {
281
		int firstSize = first.size() - 1;
282
		int secondSize = second.size() - 1;
283
		if (first instanceof CubePointRange && second instanceof CubePointRange) {
284
			long size = lcm(firstSize, secondSize);
285
			if (cost * size <= 256L) {
286
				return new DiscreteCubeMerger(firstSize, secondSize);
287
			}
288
		}
289
290
		if (first.getDouble(firstSize) < second.getDouble(0) - 1.0E-7) {
291
			return new NonOverlappingMerger(first, second, false);
292
		} else if (second.getDouble(secondSize) < first.getDouble(0) - 1.0E-7) {
293
			return new NonOverlappingMerger(second, first, true);
294
		} else {
295
			return firstSize == secondSize && Objects.equals(first, second)
296
				? new IdenticalMerger(first)
297
				: new IndirectMerger(first, second, firstOnlyMatters, secondOnlyMatters);
298
		}
299
	}
300
301
	public static VoxelShape rotate(final VoxelShape shape, final OctahedralGroup rotation) {
302
		return rotate(shape, rotation, BLOCK_CENTER);
303
	}
304
305
	public static VoxelShape rotate(final VoxelShape shape, final OctahedralGroup rotation, final Vec3 rotationPoint) {
306
		if (rotation == OctahedralGroup.IDENTITY) {
307
			return shape;
308
		}
309
310
		DiscreteVoxelShape newDiscreteShape = shape.shape.rotate(rotation);
311
		if (shape instanceof CubeVoxelShape && BLOCK_CENTER.equals(rotationPoint)) {
312
			return new CubeVoxelShape(newDiscreteShape);
313
		}
314
315
		Direction.Axis newX = rotation.permutation().permuteAxis(Direction.Axis.X);
316
		Direction.Axis newY = rotation.permutation().permuteAxis(Direction.Axis.Y);
317
		Direction.Axis newZ = rotation.permutation().permuteAxis(Direction.Axis.Z);
318
		DoubleList newXs = shape.getCoords(newX);
319
		DoubleList newYs = shape.getCoords(newY);
320
		DoubleList newZs = shape.getCoords(newZ);
321
		boolean flipX = rotation.inverts(Direction.Axis.X);
322
		boolean flipY = rotation.inverts(Direction.Axis.Y);
323
		boolean flipZ = rotation.inverts(Direction.Axis.Z);
324
		return new ArrayVoxelShape(
325
			newDiscreteShape,
326
			flipAxisIfNeeded(newXs, flipX, rotationPoint.get(newX), rotationPoint.x),
327
			flipAxisIfNeeded(newYs, flipY, rotationPoint.get(newY), rotationPoint.y),
328
			flipAxisIfNeeded(newZs, flipZ, rotationPoint.get(newZ), rotationPoint.z)
329
		);
330
	}
331
332
	@VisibleForTesting
333
	static DoubleList flipAxisIfNeeded(final DoubleList newAxis, final boolean flip, final double newRelative, final double oldRelative) {
334
		if (!flip && newRelative == oldRelative) {
335
			return newAxis;
336
		}
337
338
		int size = newAxis.size();
339
		DoubleList newList = new DoubleArrayList(size);
340
		if (flip) {
341
			for (int i = size - 1; i >= 0; i--) {
342
				newList.add(-(newAxis.getDouble(i) - newRelative) + oldRelative);
343
			}
344
		} else {
345
			for (int i = 0; i >= 0 && i < size; i++) {
346
				newList.add(newAxis.getDouble(i) - newRelative + oldRelative);
347
			}
348
		}
349
350
		return newList;
351
	}
352
353
	public static boolean equal(final VoxelShape first, final VoxelShape second) {
354
		return !joinIsNotEmpty(first, second, BooleanOp.NOT_SAME);
355
	}
356
357
	public static Map<Direction.Axis, VoxelShape> rotateHorizontalAxis(final VoxelShape zAxis) {
358
		return rotateHorizontalAxis(zAxis, BLOCK_CENTER);
359
	}
360
361
	public static Map<Direction.Axis, VoxelShape> rotateHorizontalAxis(final VoxelShape zAxis, final Vec3 rotationCenter) {
362
		return Maps.newEnumMap(Map.of(Direction.Axis.Z, zAxis, Direction.Axis.X, rotate(zAxis, OctahedralGroup.BLOCK_ROT_Y_90, rotationCenter)));
363
	}
364
365
	public static Map<Direction.Axis, VoxelShape> rotateAllAxis(final VoxelShape north) {
366
		return rotateAllAxis(north, BLOCK_CENTER);
367
	}
368
369
	public static Map<Direction.Axis, VoxelShape> rotateAllAxis(final VoxelShape north, final Vec3 rotationCenter) {
370
		return Maps.newEnumMap(
371
			Map.of(
372
				Direction.Axis.Z,
373
				north,
374
				Direction.Axis.X,
375
				rotate(north, OctahedralGroup.BLOCK_ROT_Y_90, rotationCenter),
376
				Direction.Axis.Y,
377
				rotate(north, OctahedralGroup.BLOCK_ROT_X_90, rotationCenter)
378
			)
379
		);
380
	}
381
382
	public static Map<Direction, VoxelShape> rotateHorizontal(final VoxelShape north) {
383
		return rotateHorizontal(north, OctahedralGroup.IDENTITY, BLOCK_CENTER);
384
	}
385
386
	public static Map<Direction, VoxelShape> rotateHorizontal(final VoxelShape north, final OctahedralGroup initial) {
387
		return rotateHorizontal(north, initial, BLOCK_CENTER);
388
	}
389
390
	public static Map<Direction, VoxelShape> rotateHorizontal(final VoxelShape north, final OctahedralGroup initial, final Vec3 rotationCenter) {
391
		return Maps.newEnumMap(
392
			Map.of(
393
				Direction.NORTH,
394
				rotate(north, initial),
395
				Direction.EAST,
396
				rotate(north, OctahedralGroup.BLOCK_ROT_Y_90.compose(initial), rotationCenter),
397
				Direction.SOUTH,
398
				rotate(north, OctahedralGroup.BLOCK_ROT_Y_180.compose(initial), rotationCenter),
399
				Direction.WEST,
400
				rotate(north, OctahedralGroup.BLOCK_ROT_Y_270.compose(initial), rotationCenter)
401
			)
402
		);
403
	}
404
405
	public static Map<Direction, VoxelShape> rotateAll(final VoxelShape north) {
406
		return rotateAll(north, OctahedralGroup.IDENTITY, BLOCK_CENTER);
407
	}
408
409
	public static Map<Direction, VoxelShape> rotateAll(final VoxelShape north, final Vec3 rotationCenter) {
410
		return rotateAll(north, OctahedralGroup.IDENTITY, rotationCenter);
411
	}
412
413
	public static Map<Direction, VoxelShape> rotateAll(final VoxelShape north, final OctahedralGroup initial, final Vec3 rotationCenter) {
414
		return Maps.newEnumMap(
415
			Map.of(
416
				Direction.NORTH,
417
				rotate(north, initial),
418
				Direction.EAST,
419
				rotate(north, OctahedralGroup.BLOCK_ROT_Y_90.compose(initial), rotationCenter),
420
				Direction.SOUTH,
421
				rotate(north, OctahedralGroup.BLOCK_ROT_Y_180.compose(initial), rotationCenter),
422
				Direction.WEST,
423
				rotate(north, OctahedralGroup.BLOCK_ROT_Y_270.compose(initial), rotationCenter),
424
				Direction.UP,
425
				rotate(north, OctahedralGroup.BLOCK_ROT_X_270.compose(initial), rotationCenter),
426
				Direction.DOWN,
427
				rotate(north, OctahedralGroup.BLOCK_ROT_X_90.compose(initial), rotationCenter)
428
			)
429
		);
430
	}
431
432
	public static Map<AttachFace, Map<Direction, VoxelShape>> rotateAttachFace(final VoxelShape north) {
433
		return rotateAttachFace(north, OctahedralGroup.IDENTITY);
434
	}
435
436
	public static Map<AttachFace, Map<Direction, VoxelShape>> rotateAttachFace(final VoxelShape north, final OctahedralGroup initial) {
437
		return Map.of(
438
			AttachFace.WALL,
439
			rotateHorizontal(north, initial),
440
			AttachFace.FLOOR,
441
			rotateHorizontal(north, OctahedralGroup.BLOCK_ROT_X_270.compose(initial)),
442
			AttachFace.CEILING,
443
			rotateHorizontal(north, OctahedralGroup.BLOCK_ROT_Y_180.compose(OctahedralGroup.BLOCK_ROT_X_90).compose(initial))
444
		);
445
	}
446
447
	public interface DoubleLineConsumer {
448
		void consume(double x1, double y1, double z1, double x2, double y2, double z2);
449
	}
450
}
451

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