From 3c9956874d4ae40b272a389b999087bbea5d543b Mon Sep 17 00:00:00 2001 From: lothrazar Date: Sat, 9 Nov 2024 19:39:04 -0800 Subject: [PATCH] backport laser shoots even when you miss --- .../com/lothrazar/cyclic/event/EventRender.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/lothrazar/cyclic/event/EventRender.java b/src/main/java/com/lothrazar/cyclic/event/EventRender.java index 311edee04..00dc8e11a 100644 --- a/src/main/java/com/lothrazar/cyclic/event/EventRender.java +++ b/src/main/java/com/lothrazar/cyclic/event/EventRender.java @@ -236,12 +236,9 @@ else if (!stHere.isAir()) { if (distance < LaserItem.RANGE_MAX) { //first vector is FROM, second is TO BlockHitResult miss = mc.level.clip(new ClipContext(cameraEyePosition, entityHitResultLocation, ClipContext.Block.VISUAL, ClipContext.Fluid.NONE, mc.player)); - // BlockHitResult miss = BlockHitResult.miss(entityHitResultLocation, Direction.getNearest(cameraViewVector.x, cameraViewVector.y, cameraViewVector.z), new BlockPos(entityHitResultLocation)); - if (miss.getType() == HitResult.Type.BLOCK) { - //we hit a wall, dont shoot thru walls - } - else { - //Render and Shoot + //Render and Shoot + if (miss.getType() != HitResult.Type.BLOCK) { + //dont shoot thru walls RenderMiningLaser.renderLaser(event, player, mc.getFrameTime(), stack, InteractionHand.MAIN_HAND); if (world.getGameTime() % 4 == 0) { PacketRegistry.INSTANCE.sendToServer(new PacketEntityLaser(ehr.getEntity().getId(), false)); @@ -250,6 +247,10 @@ else if (!stHere.isAir()) { } } } + else { + //we missed + RenderMiningLaser.renderLaser(event, player, mc.getFrameTime(), stack, InteractionHand.MAIN_HAND); + } } } }