From 08c6b86787968ff11c3aeb709aeee493af320296 Mon Sep 17 00:00:00 2001 From: Waterpicker <Waterpickerenternity@gmail.com> Date: Fri, 5 Feb 2021 09:27:33 -0600 Subject: [PATCH] Fixed Raycasting with the RiftBlade. Still need to figure out how to make rifts sanely targetable. --- .../org/dimdev/dimdoors/item/RiftBladeItem.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/dimdev/dimdoors/item/RiftBladeItem.java b/src/main/java/org/dimdev/dimdoors/item/RiftBladeItem.java index 561c0e45..b7dd696d 100644 --- a/src/main/java/org/dimdev/dimdoors/item/RiftBladeItem.java +++ b/src/main/java/org/dimdev/dimdoors/item/RiftBladeItem.java @@ -39,9 +39,18 @@ public class RiftBladeItem extends SwordItem { @Override public TypedActionResult<ItemStack> use(World world, PlayerEntity player, Hand hand) { ItemStack stack = player.getStackInHand(hand); - HitResult hit = player.raycast(16, 1.0F, false); //TODO: make the range of the Rift Blade configurable + HitResult hit = RaycastHelper.raycast(player,16,0.0F, LivingEntity.class::isInstance); + + if(hit == null) { + hit = RaycastHelper.raycast(player, 16, 1.0F, LivingEntity.class::isInstance); + } + + if(hit == null) { + hit = player.raycast(16, 1.0F, false); //TODO: make the range of the Rift Blade configurable + } + if (hit == null) { - hit = player.raycast(RaycastHelper.REACH_DISTANCE, 0, false); + hit = player.raycast(16, 0, false); } if (world.isClient) {