use of net.minecraft.world.phys.BlockHitResult in project AlexsMobs by Alex-the-666.
the class EntityVoidWormShot method onImpact.
/**
* Called when this EntityFireball hits a block or entity.
*/
protected void onImpact(HitResult result) {
HitResult.Type raytraceresult$type = result.getType();
if (raytraceresult$type == HitResult.Type.ENTITY) {
this.onEntityHit((EntityHitResult) result);
} else if (raytraceresult$type == HitResult.Type.BLOCK) {
this.onHitBlock((BlockHitResult) result);
}
this.playSound(SoundEvents.GLASS_BREAK, 1F, 0.5F);
Entity entity = this.getShooter();
}
use of net.minecraft.world.phys.BlockHitResult in project AlexsMobs by Alex-the-666.
the class AnimalAILeapRandomly method hasLineOfSightBlock.
private boolean hasLineOfSightBlock(Vec3 blockVec) {
Vec3 Vector3d = new Vec3(mob.getX(), mob.getEyeY(), mob.getZ());
BlockHitResult result = mob.level.clip(new ClipContext(Vector3d, blockVec, ClipContext.Block.COLLIDER, ClipContext.Fluid.NONE, mob));
return blockVec.distanceTo(result.getLocation()) < 1.2F;
}
use of net.minecraft.world.phys.BlockHitResult in project AlexsMobs by Alex-the-666.
the class EntityMungus method hasLineOfSightMushroom.
private boolean hasLineOfSightMushroom(BlockPos destinationBlock) {
Vec3 Vector3d = new Vec3(this.getX(), this.getEyeY(), this.getZ());
Vec3 blockVec = net.minecraft.world.phys.Vec3.atCenterOf(destinationBlock);
BlockHitResult result = this.level.clip(new ClipContext(Vector3d, blockVec, ClipContext.Block.COLLIDER, ClipContext.Fluid.NONE, this));
return result.getBlockPos().equals(destinationBlock);
}
use of net.minecraft.world.phys.BlockHitResult in project AlexsMobs by Alex-the-666.
the class EntityToucan method hasLineOfSightSapling.
private boolean hasLineOfSightSapling(BlockPos destinationBlock) {
Vec3 Vector3d = new Vec3(this.getX(), this.getEyeY(), this.getZ());
Vec3 blockVec = net.minecraft.world.phys.Vec3.atCenterOf(destinationBlock);
BlockHitResult result = this.level.clip(new ClipContext(Vector3d, blockVec, ClipContext.Block.COLLIDER, ClipContext.Fluid.NONE, this));
return result.getBlockPos().equals(destinationBlock);
}
use of net.minecraft.world.phys.BlockHitResult in project AlexsMobs by Alex-the-666.
the class MantisShrimpAIBreakBlocks method hasLineOfSightBlock.
private boolean hasLineOfSightBlock(BlockPos destinationBlock) {
Vec3 Vector3d = new Vec3(mantisShrimp.getX(), mantisShrimp.getEyeY(), mantisShrimp.getZ());
Vec3 blockVec = net.minecraft.world.phys.Vec3.atCenterOf(destinationBlock);
BlockHitResult result = mantisShrimp.level.clip(new ClipContext(Vector3d, blockVec, ClipContext.Block.COLLIDER, ClipContext.Fluid.NONE, mantisShrimp));
return result.getBlockPos().equals(destinationBlock);
}
Aggregations