HitResult .java

net.minecraft.world.phys.HitResult (class, 31 lines): members: getLocation, distanceTo, location, Type, getType. imports: Entity.

net.minecraft.world.physclass31 linescommon606 B

API Surface (2)

double distanceTo(final Entity entity)
Vec3 getLocation()

Fields & Constants (1)

location

Code Graph: Dependencies (2)

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

Full Source

HitResult.java31 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.world.phys;
2
3
import net.minecraft.world.entity.Entity;
4
5
public abstract class HitResult {
6
	protected final Vec3 location;
7
8
	protected HitResult(final Vec3 location) {
9
		this.location = location;
10
	}
11
12
	public double distanceTo(final Entity entity) {
13
		double xd = this.location.x - entity.getX();
14
		double yd = this.location.y - entity.getY();
15
		double zd = this.location.z - entity.getZ();
16
		return xd * xd + yd * yd + zd * zd;
17
	}
18
19
	public abstract HitResult.Type getType();
20
21
	public Vec3 getLocation() {
22
		return this.location;
23
	}
24
25
	public enum Type {
26
		MISS,
27
		BLOCK,
28
		ENTITY;
29
	}
30
}
31

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