Scissors/patches/server/0036-Validate-block-entity-...

20 lines
1.3 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Luna <lunahatesgogle@gmail.com>
Date: Mon, 11 Jul 2022 17:29:12 -0300
Subject: [PATCH] Validate block entity tag query positions
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 5086fc9f81e9ae894b6fa64819e77267812cae17..ca2b1affa23faf7153fad9e97afbb3b55f1e85d4 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1360,7 +1360,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@Override
public void handleBlockEntityTagQuery(ServerboundBlockEntityTagQuery packet) {
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());
- if (this.player.hasPermissions(2)) {
+ if (this.player.hasPermissions(2) && Level.isInSpawnableBounds(packet.getPos())) { // Scissors - Validate block entity tag query positions
BlockEntity tileentity = this.player.getLevel().getBlockEntity(packet.getPos());
CompoundTag nbttagcompound = tileentity != null ? tileentity.saveWithoutMetadata() : null;