Validate block entity tag query positions (#43)

This commit is contained in:
Luna 2022-07-12 02:55:09 -03:00 committed by GitHub
parent d382eb52e7
commit ba694be2bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -0,0 +1,19 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Luna <lunahatesgogle@gmail.com>
Date: Mon, 11 Jul 2022 17:21:37 -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 0d8d28a324b4bf093d7318be71eb67bb0dad9429..fe549835e0dc0b6c06a16e7471f53170f1d9c7b0 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1273,7 +1273,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@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;