MCPcopy Create free account
hub / github.com/cabaletta/baritone / Selection

Class Selection

src/main/java/baritone/selection/Selection.java:9–130  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7import net.minecraft.world.phys.AABB;
8
9public class Selection implements ISelection {
10
11 private final BetterBlockPos pos1;
12 private final BetterBlockPos pos2;
13 private final BetterBlockPos min;
14 private final BetterBlockPos max;
15 private final Vec3i size;
16 private final AABB aabb;
17
18 public Selection(BetterBlockPos pos1, BetterBlockPos pos2) {
19 this.pos1 = pos1;
20 this.pos2 = pos2;
21
22 this.min = new BetterBlockPos(
23 Math.min(pos1.x, pos2.x),
24 Math.min(pos1.y, pos2.y),
25 Math.min(pos1.z, pos2.z)
26 );
27
28 this.max = new BetterBlockPos(
29 Math.max(pos1.x, pos2.x),
30 Math.max(pos1.y, pos2.y),
31 Math.max(pos1.z, pos2.z)
32 );
33
34 this.size = new Vec3i(
35 max.x - min.x + 1,
36 max.y - min.y + 1,
37 max.z - min.z + 1
38 );
39
40 this.aabb = new AABB(min.x, min.y, min.z, max.x + 1, max.y + 1, max.z + 1);
41 }
42
43 @Override
44 public BetterBlockPos pos1() {
45 return pos1;
46 }
47
48 @Override
49 public BetterBlockPos pos2() {
50 return pos2;
51 }
52
53 @Override
54 public BetterBlockPos min() {
55 return min;
56 }
57
58 @Override
59 public BetterBlockPos max() {
60 return max;
61 }
62
63 @Override
64 public Vec3i size() {
65 return size;
66 }

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected