geforkt von Mirrors/Paper
Fix PlayerInteractEvent#getClickedBlock()
returning wrong block in adventure mode (#10019)
Dieser Commit ist enthalten in:
Ursprung
a889754d39
Commit
3a2229c5f3
@ -38,7 +38,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ } else { // Paper start - Fix interact event not being called sometimes
|
+ } else { // Paper start - Fix interact event not being called sometimes
|
||||||
+ GameType gameType = this.player.gameMode.getGameModeForPlayer();
|
+ GameType gameType = this.player.gameMode.getGameModeForPlayer();
|
||||||
+ if (gameType == GameType.ADVENTURE && result.getHitBlock() != null) {
|
+ if (gameType == GameType.ADVENTURE && result.getHitBlock() != null) {
|
||||||
+ CraftEventFactory.callPlayerInteractEvent(this.player, Action.LEFT_CLICK_BLOCK, io.papermc.paper.util.MCUtil.toBlockPosition(result.getHitPosition()), org.bukkit.craftbukkit.block.CraftBlock.blockFaceToNotch(result.getHitBlockFace()), this.player.getInventory().getSelected(), InteractionHand.MAIN_HAND);
|
+ CraftEventFactory.callPlayerInteractEvent(this.player, Action.LEFT_CLICK_BLOCK, ((org.bukkit.craftbukkit.block.CraftBlock) result.getHitBlock()).getPosition(), org.bukkit.craftbukkit.block.CraftBlock.blockFaceToNotch(result.getHitBlockFace()), this.player.getInventory().getSelected(), InteractionHand.MAIN_HAND);
|
||||||
+ } else if (gameType != GameType.CREATIVE && result.getHitEntity() != null && origin.toVector().distanceSquared(result.getHitPosition()) > 3.0D * 3.0D) {
|
+ } else if (gameType != GameType.CREATIVE && result.getHitEntity() != null && origin.toVector().distanceSquared(result.getHitPosition()) > 3.0D * 3.0D) {
|
||||||
+ CraftEventFactory.callPlayerInteractEvent(this.player, Action.LEFT_CLICK_AIR, this.player.getInventory().getSelected(), InteractionHand.MAIN_HAND);
|
+ CraftEventFactory.callPlayerInteractEvent(this.player, Action.LEFT_CLICK_AIR, this.player.getInventory().getSelected(), InteractionHand.MAIN_HAND);
|
||||||
+ }
|
+ }
|
||||||
|
@ -3507,7 +3507,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+import org.bukkit.block.BlockFace;
|
+import org.bukkit.block.BlockFace;
|
||||||
+import org.bukkit.craftbukkit.CraftWorld;
|
+import org.bukkit.craftbukkit.CraftWorld;
|
||||||
+import org.bukkit.craftbukkit.util.Waitable;
|
+import org.bukkit.craftbukkit.util.Waitable;
|
||||||
+import org.bukkit.util.Vector;
|
|
||||||
+import org.spigotmc.AsyncCatcher;
|
+import org.spigotmc.AsyncCatcher;
|
||||||
+
|
+
|
||||||
+import javax.annotation.Nonnull;
|
+import javax.annotation.Nonnull;
|
||||||
@ -3960,10 +3959,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ return new BlockPos(pos.blockX(), pos.blockY(), pos.blockZ());
|
+ return new BlockPos(pos.blockX(), pos.blockY(), pos.blockZ());
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ public static BlockPos toBlockPosition(Vector vec) {
|
|
||||||
+ return new BlockPos(vec.getBlockX(), vec.getBlockY(), vec.getBlockZ());
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ public static FinePosition toPosition(Vec3 vector) {
|
+ public static FinePosition toPosition(Vec3 vector) {
|
||||||
+ return Position.fine(vector.x, vector.y, vector.z);
|
+ return Position.fine(vector.x, vector.y, vector.z);
|
||||||
+ }
|
+ }
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren