mirror of
https://github.com/AtlasMediaGroup/Scissors.git
synced 2024-12-01 11:27:10 -05:00
dcef1afe08
Realized what they are doing. Will rename commit later
46 lines
2.9 KiB
Diff
46 lines
2.9 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Video <videogamesm12@gmail.com>
|
|
Date: Sun, 20 Mar 2022 07:46:37 -0600
|
|
Subject: [PATCH] Validate coordinates before attempting to get block entities
|
|
when handling Creative Inventory packets
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
index 621ec8e8a197323da6b423fee57c816ac9d7c875..88d1620ba81eaa2d868401951a264fe0e0f998c6 100644
|
|
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
@@ -2933,21 +2933,26 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
|
if (this.player.gameMode.isCreative()) {
|
|
boolean flag = packet.getSlotNum() < 0;
|
|
ItemStack itemstack = packet.getItem();
|
|
- CompoundTag nbttagcompound = itemstack.getTagElement("BlockEntityTag");
|
|
|
|
+ /* Scissors - Do not pre-load chunks
|
|
+ CompoundTag nbttagcompound = itemstack.getTagElement("BlockEntityTag");
|
|
if (!itemstack.isEmpty() && nbttagcompound != null && nbttagcompound.contains("x") && nbttagcompound.contains("y") && nbttagcompound.contains("z") && this.player.getBukkitEntity().hasPermission("minecraft.nbt.copy")) { // Spigot
|
|
BlockPos blockposition = new BlockPos(nbttagcompound.getInt("x"), nbttagcompound.getInt("y"), nbttagcompound.getInt("z"));
|
|
- BlockEntity tileentity = this.player.level.getBlockEntity(blockposition);
|
|
+ if (Level.isInSpawnableBounds(blockposition) && blockposition.getY() < 255)
|
|
+ {
|
|
+ BlockEntity tileentity = this.player.level.getBlockEntity(blockposition);
|
|
|
|
- if (tileentity != null) {
|
|
- CompoundTag nbttagcompound1 = tileentity.save(new CompoundTag());
|
|
+ if (tileentity != null) {
|
|
+ CompoundTag nbttagcompound1 = tileentity.save(new CompoundTag());
|
|
|
|
- nbttagcompound1.remove("x");
|
|
- nbttagcompound1.remove("y");
|
|
- nbttagcompound1.remove("z");
|
|
- itemstack.addTagElement("BlockEntityTag", (Tag) nbttagcompound1);
|
|
+ nbttagcompound1.remove("x");
|
|
+ nbttagcompound1.remove("y");
|
|
+ nbttagcompound1.remove("z");
|
|
+ itemstack.addTagElement("BlockEntityTag", (Tag) nbttagcompound1);
|
|
+ }
|
|
}
|
|
}
|
|
+ */
|
|
|
|
boolean flag1 = packet.getSlotNum() >= 1 && packet.getSlotNum() <= 45;
|
|
boolean flag2 = itemstack.isEmpty() || itemstack.getDamageValue() >= 0 && itemstack.getCount() <= 64 && !itemstack.isEmpty();
|