mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-06 19:00:16 +01:00
a207d14a0e
Signed-off-by: Mariell Hoversholm <proximyst@proximyst.com>
36 lines
2.8 KiB
Diff
36 lines
2.8 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/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
index 773f2589c14e16d2f5b01a6dbd48e09d17d19c7e..d264fca2737f83a0860394f7bb6b269ffe669594 100644
|
|
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
@@ -1661,15 +1661,19 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener {
|
|
BlockPos blockposition = movingobjectpositionblock.getBlockPos();
|
|
Direction 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.resetLastActionTime();
|
|
if (blockposition.getY() < this.server.getMaxBuildHeight()) {
|
|
if (this.awaitingPositionFromClient == null && this.player.distanceToSqr((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D) < 64.0D && worldserver.mayInteract((net.minecraft.world.entity.player.Player) 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.stopUsingItem(); // SPIGOT-4706
|
|
// CraftBukkit end
|
|
InteractionResult enuminteractionresult = this.player.gameMode.useItemOn(this.player, worldserver, itemstack, enumhand, movingobjectpositionblock);
|