Collision API

This commit is contained in:
Owen1212055
2021-10-06 20:10:44 -04:00
parent dede55eaad
commit 19d28ade48
2 changed files with 23 additions and 0 deletions

View File

@@ -1189,4 +1189,20 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
return this.getHandle().noPhysics;
}
// Paper end - missing entity api
// Paper start - Collision API
@Override
public boolean collidesAt(@org.jetbrains.annotations.NotNull Location location) {
net.minecraft.world.phys.AABB aabb = this.getHandle().getBoundingBoxAt(location.getX(), location.getY(), location.getZ());
return !this.getHandle().level().noCollision(this.getHandle(), aabb);
}
@Override
public boolean wouldCollideUsing(@org.jetbrains.annotations.NotNull BoundingBox boundingBox) {
net.minecraft.world.phys.AABB aabb = new AABB(boundingBox.getMinX(), boundingBox.getMinY(), boundingBox.getMinZ(), boundingBox.getMaxX(), boundingBox.getMaxY(), boundingBox.getMaxZ());
return !this.getHandle().level().noCollision(this.getHandle(), aabb);
}
// Paper end - Collision API
}