mirror of
https://github.com/PaperMC/Paper.git
synced 2024-10-30 07:19:58 +01:00
38 lines
2.9 KiB
Diff
38 lines
2.9 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 6476d2a478b85116061a13f7ef2a5fec2ade4a04..003cd8a304420671d487c9e55622d9578aa75b3a 100644
|
|
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
@@ -1694,17 +1694,21 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
|
BlockPos blockposition = movingobjectpositionblock.getBlockPos();
|
|
Direction enumdirection = movingobjectpositionblock.getDirection();
|
|
|
|
+ // Paper start - move check up
|
|
+ Location eyeLoc = this.getCraftPlayer().getEyeLocation();
|
|
+ double reachDistance = NumberConversions.square(eyeLoc.getX() - blockposition.getX()) + NumberConversions.square(eyeLoc.getY() - blockposition.getY()) + NumberConversions.square(eyeLoc.getZ() - blockposition.getZ());
|
|
+ if (reachDistance > (this.getCraftPlayer().getGameMode() == org.bukkit.GameMode.CREATIVE ? CREATIVE_PLACE_DISTANCE_SQUARED : SURVIVAL_PLACE_DISTANCE_SQUARED)) {
|
|
+ return;
|
|
+ }
|
|
+ // Paper end - move check up
|
|
+
|
|
this.player.resetLastActionTime();
|
|
int i = this.player.level.getMaxBuildHeight();
|
|
|
|
if (blockposition.getY() < i) {
|
|
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.getCraftPlayer().getEyeLocation();
|
|
- double reachDistance = NumberConversions.square(eyeLoc.getX() - blockposition.getX()) + NumberConversions.square(eyeLoc.getY() - blockposition.getY()) + NumberConversions.square(eyeLoc.getZ() - blockposition.getZ());
|
|
- if (reachDistance > (this.getCraftPlayer().getGameMode() == org.bukkit.GameMode.CREATIVE ? ServerGamePacketListenerImpl.CREATIVE_PLACE_DISTANCE_SQUARED : ServerGamePacketListenerImpl.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);
|