Archiviert
13
0
Dieses Repository wurde am 2024-12-25 archiviert. Du kannst Dateien ansehen und es klonen, aber nicht pushen oder Issues/Pull-Requests öffnen.
Paper-Old/patches/server/0494-Move-range-check-for-block-placing-up.patch

38 Zeilen
2.9 KiB
Diff

2021-06-11 14:02:28 +02:00
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
2021-06-17 19:11:00 +02:00
index 3e91275b318904ffa31183987fcbc7b28692781a..ea17f9263bef3a2a36dde15d0d75b8a5a695aa93 100644
2021-06-11 14:02:28 +02:00
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
2021-06-17 19:11:00 +02:00
@@ -1693,17 +1693,21 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
2021-06-11 14:02:28 +02:00
BlockPos blockposition = movingobjectpositionblock.getBlockPos();
Direction enumdirection = movingobjectpositionblock.getDirection();
+ // Paper start - move check up
2021-06-14 11:46:59 +02:00
+ Location eyeLoc = this.getCraftPlayer().getEyeLocation();
2021-06-11 14:02:28 +02:00
+ double reachDistance = NumberConversions.square(eyeLoc.getX() - blockposition.getX()) + NumberConversions.square(eyeLoc.getY() - blockposition.getY()) + NumberConversions.square(eyeLoc.getZ() - blockposition.getZ());
2021-06-14 11:46:59 +02:00
+ if (reachDistance > (this.getCraftPlayer().getGameMode() == org.bukkit.GameMode.CREATIVE ? CREATIVE_PLACE_DISTANCE_SQUARED : SURVIVAL_PLACE_DISTANCE_SQUARED)) {
2021-06-11 14:02:28 +02:00
+ return;
+ }
+ // Paper end - move check up
+
this.player.resetLastActionTime();
2021-06-14 11:46:59 +02:00
int i = this.player.level.getMaxBuildHeight();
if (blockposition.getY() < i) {
2021-06-11 14:02:28 +02:00
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
2021-06-14 11:46:59 +02:00
- Location eyeLoc = this.getCraftPlayer().getEyeLocation();
2021-06-11 14:02:28 +02:00
- double reachDistance = NumberConversions.square(eyeLoc.getX() - blockposition.getX()) + NumberConversions.square(eyeLoc.getY() - blockposition.getY()) + NumberConversions.square(eyeLoc.getZ() - blockposition.getZ());
2021-06-14 11:46:59 +02:00
- if (reachDistance > (this.getCraftPlayer().getGameMode() == org.bukkit.GameMode.CREATIVE ? ServerGamePacketListenerImpl.CREATIVE_PLACE_DISTANCE_SQUARED : ServerGamePacketListenerImpl.SURVIVAL_PLACE_DISTANCE_SQUARED)) {
2021-06-11 14:02:28 +02:00
- return;
- }
+ // Paper - move check up
this.player.stopUsingItem(); // SPIGOT-4706
// CraftBukkit end
InteractionResult enuminteractionresult = this.player.gameMode.useItemOn(this.player, worldserver, itemstack, enumhand, movingobjectpositionblock);