Skip to content

Commit

Permalink
backport laser shoots even when you miss
Browse files Browse the repository at this point in the history
  • Loading branch information
Lothrazar committed Nov 10, 2024
1 parent a3dabfc commit 3c99568
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/main/java/com/lothrazar/cyclic/event/EventRender.java
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand All @@ -250,6 +247,10 @@ else if (!stHere.isAir()) {
}
}
}
else {
//we missed
RenderMiningLaser.renderLaser(event, player, mc.getFrameTime(), stack, InteractionHand.MAIN_HAND);
}
}
}
}
Expand Down

0 comments on commit 3c99568

Please sign in to comment.