Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-11-15 12:30:06 +01:00
4e958e229f
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com> Co-authored-by: zml <zml@stellardrift.ca> Co-authored-by: Mariell Hoversholm <proximyst@proximyst.com>
36 Zeilen
2.6 KiB
Diff
36 Zeilen
2.6 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Spottedleaf <Spottedleaf@users.noreply.github.com>
|
|
Date: Wed, 15 Jul 2020 19:34:11 -0700
|
|
Subject: [PATCH] Move range check for block placing up
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
|
|
index bbfd4db220a4f95c473093ad4fb6cc2072af0082..c7543b0f4172384210dde152b56908414e68ddda 100644
|
|
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
|
|
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
|
|
@@ -1512,15 +1512,19 @@ public class PlayerConnection implements PacketListenerPlayIn {
|
|
BlockPosition blockposition = movingobjectpositionblock.getBlockPosition();
|
|
EnumDirection enumdirection = movingobjectpositionblock.getDirection();
|
|
|
|
+ // Paper start - move check up
|
|
+ Location eyeLoc = this.getPlayer().getEyeLocation();
|
|
+ double reachDistance = NumberConversions.square(eyeLoc.getX() - blockposition.getX()) + NumberConversions.square(eyeLoc.getY() - blockposition.getY()) + NumberConversions.square(eyeLoc.getZ() - blockposition.getZ());
|
|
+ if (reachDistance > (this.getPlayer().getGameMode() == org.bukkit.GameMode.CREATIVE ? CREATIVE_PLACE_DISTANCE_SQUARED : SURVIVAL_PLACE_DISTANCE_SQUARED)) {
|
|
+ return;
|
|
+ }
|
|
+ // Paper end - move check up
|
|
+
|
|
this.player.resetIdleTimer();
|
|
if (blockposition.getY() < this.minecraftServer.getMaxBuildHeight()) {
|
|
if (this.teleportPos == null && this.player.h((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D) < 64.0D && worldserver.a((EntityHuman) this.player, blockposition)) {
|
|
// CraftBukkit start - Check if we can actually do something over this large a distance
|
|
- Location eyeLoc = this.getPlayer().getEyeLocation();
|
|
- double reachDistance = NumberConversions.square(eyeLoc.getX() - blockposition.getX()) + NumberConversions.square(eyeLoc.getY() - blockposition.getY()) + NumberConversions.square(eyeLoc.getZ() - blockposition.getZ());
|
|
- if (reachDistance > (this.getPlayer().getGameMode() == org.bukkit.GameMode.CREATIVE ? CREATIVE_PLACE_DISTANCE_SQUARED : SURVIVAL_PLACE_DISTANCE_SQUARED)) {
|
|
- return;
|
|
- }
|
|
+ // Paper - move check up
|
|
this.player.clearActiveItem(); // SPIGOT-4706
|
|
// CraftBukkit end
|
|
EnumInteractionResult enuminteractionresult = this.player.playerInteractManager.a(this.player, worldserver, itemstack, enumhand, movingobjectpositionblock);
|