Fix TargetHitEvent#getSignalStrength() post-hard-fork (#11897)

This commit is contained in:
Pedro 2025-01-04 17:30:41 -03:00 committed by GitHub
parent 6ab13521b7
commit 33a590bca6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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
@ -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