Skip to content

Commit

Permalink
Fix TargetHitEvent#getSignalStrength() post-hard-fork (#11897)
Browse files Browse the repository at this point in the history
  • Loading branch information
Doc94 authored Jan 4, 2025
1 parent 6ab1352 commit 33a590b
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@
+ if (projectile instanceof Projectile) {
+ final org.bukkit.craftbukkit.block.CraftBlock craftBlock = org.bukkit.craftbukkit.block.CraftBlock.at(level, hit.getBlockPos());
+ final org.bukkit.block.BlockFace blockFace = org.bukkit.craftbukkit.block.CraftBlock.notchToBlockFace(hit.getDirection());
+ final io.papermc.paper.event.block.TargetHitEvent targetHitEvent = new io.papermc.paper.event.block.TargetHitEvent((org.bukkit.entity.Projectile) projectile.getBukkitEntity(), craftBlock, blockFace, i);
+ final io.papermc.paper.event.block.TargetHitEvent targetHitEvent = new io.papermc.paper.event.block.TargetHitEvent((org.bukkit.entity.Projectile) projectile.getBukkitEntity(), craftBlock, blockFace, redstoneStrength);
+ if (targetHitEvent.callEvent()) {
+ i = targetHitEvent.getSignalStrength();
+ redstoneStrength = targetHitEvent.getSignalStrength();
+ shouldAward = true;
+ } else {
+ return i;
+ return redstoneStrength;
+ }
+ }
+ // Paper end - Add TargetHitEvent
Expand All @@ -35,7 +35,7 @@
+
+ // Paper start - Award Hit Criteria after Block Update
+ if (shouldAward) {
+ awardTargetHitCriteria((Projectile) projectile, hit, i);
+ awardTargetHitCriteria((Projectile) projectile, hit, redstoneStrength);
+ }
+ // Paper end - Award Hit Criteria after Block Update

Expand Down

0 comments on commit 33a590b

Please sign in to comment.