More more more more more more more work

This commit is contained in:
Nassim Jahnke 2022-07-27 23:50:05 +02:00
parent 6b80b342d9
commit c8f3d9ee8c
No known key found for this signature in database
GPG Key ID: 6BE3B555EBC5982B
50 changed files with 81 additions and 136 deletions

View File

@ -9,10 +9,10 @@ is not a WorldGenRegion, we can bypass the deadlock entirely.
See https://bugs.mojang.com/browse/MC-246262 See https://bugs.mojang.com/browse/MC-246262
diff --git a/src/main/java/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java b/src/main/java/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java diff --git a/src/main/java/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java b/src/main/java/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java
index fcd6b2a438ffc2f039036a45ff88ba46017981f7..b667663ea0dbac0bc59cee9090e9769770934b06 100644 index 4aac9be67a073e60272a68b52c2cda026d4ee28f..30c44b39f9b7a434bb77d6307d2514f2ce9d2857 100644
--- a/src/main/java/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java --- a/src/main/java/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java
+++ b/src/main/java/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java +++ b/src/main/java/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java
@@ -265,7 +265,11 @@ public class StructureTemplate { @@ -266,7 +266,11 @@ public class StructureTemplate {
if (definedstructure_blockinfo.nbt != null) { if (definedstructure_blockinfo.nbt != null) {
tileentity = world.getBlockEntity(blockposition2); tileentity = world.getBlockEntity(blockposition2);
@ -25,7 +25,7 @@ index fcd6b2a438ffc2f039036a45ff88ba46017981f7..b667663ea0dbac0bc59cee9090e97697
world.setBlock(blockposition2, Blocks.BARRIER.defaultBlockState(), 20); world.setBlock(blockposition2, Blocks.BARRIER.defaultBlockState(), 20);
} }
@@ -380,7 +384,11 @@ public class StructureTemplate { @@ -381,7 +385,11 @@ public class StructureTemplate {
if (pair1.getSecond() != null) { if (pair1.getSecond() != null) {
tileentity = world.getBlockEntity(blockposition6); tileentity = world.getBlockEntity(blockposition6);
if (tileentity != null) { if (tileentity != null) {

View File

@ -0,0 +1,24 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Shane Freeder <theboyetronic@gmail.com>
Date: Wed, 13 Apr 2022 08:25:42 +0100
Subject: [PATCH] Prevent tile entity copies loading chunks
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 8ac6bba7a4427733f9f03835480fd574fe17dd93..ae83029dc0a3b5e6d511dd4e0140d4f19c325a42 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -3392,7 +3392,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
BlockPos blockposition = BlockEntity.getPosFromTag(nbttagcompound);
if (this.player.level.isLoaded(blockposition)) {
- BlockEntity tileentity = this.player.level.getBlockEntity(blockposition);
+ // Paper start
+ BlockEntity tileentity = null;
+ if (this.player.distanceToSqr(blockposition.getX(), blockposition.getY(), blockposition.getZ()) < 32 * 32 && this.player.getLevel().isLoadedAndInBounds(blockposition)) {
+ tileentity = this.player.level.getBlockEntity(blockposition);
+ }
+ // Paper end
if (tileentity != null) {
tileentity.saveToItem(itemstack);

View File

@ -6,10 +6,10 @@ Subject: [PATCH] Use username instead of display name in
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index c247d27e516d1d7c5dc1e4b50ff6c81cbc54b0cc..20cdfdb3b9351f74e89bc45b3ab972384165659a 100644 index 685f3375a825c1ce88fb7d066153d69dd6090ac3..0f064faa7d03960f9babfb99785e8c88eeb814a9 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java --- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -1449,7 +1449,7 @@ public abstract class PlayerList { @@ -1469,7 +1469,7 @@ public abstract class PlayerList {
// CraftBukkit start // CraftBukkit start
public ServerStatsCounter getPlayerStats(ServerPlayer entityhuman) { public ServerStatsCounter getPlayerStats(ServerPlayer entityhuman) {
ServerStatsCounter serverstatisticmanager = entityhuman.getStats(); ServerStatsCounter serverstatisticmanager = entityhuman.getStats();

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Pass ServerLevel for gamerule callbacks
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index 2cc45ec6a5f0b0d5c1ba44551d9a126176dfa8f6..b42327dcf0cc9feaf4fdb67de949dd36cf71bbaa 100644 index 20670bc075c387ee0422eb1014207e26105efccd..bdd6560fe85950b0a857a949cb38c044da44ca6b 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java --- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -309,7 +309,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface @@ -309,7 +309,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
@ -18,10 +18,10 @@ index 2cc45ec6a5f0b0d5c1ba44551d9a126176dfa8f6..b42327dcf0cc9feaf4fdb67de949dd36
if (dedicatedserverproperties.enableQuery) { if (dedicatedserverproperties.enableQuery) {
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index e08e6091dc0b885275045260386c88b368954fe6..e8069222397f7143ffd662e554904ff811b386d4 100644 index ae83029dc0a3b5e6d511dd4e0140d4f19c325a42..9f574e4425e73826b969302cf85025fc63b66f4a 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2785,7 +2785,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -2988,7 +2988,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
this.player = this.server.getPlayerList().respawn(this.player, false); this.player = this.server.getPlayerList().respawn(this.player, false);
if (this.server.isHardcore()) { if (this.server.isHardcore()) {
this.player.setGameMode(GameType.SPECTATOR, org.bukkit.event.player.PlayerGameModeChangeEvent.Cause.HARDCORE_DEATH, null); // Paper this.player.setGameMode(GameType.SPECTATOR, org.bukkit.event.player.PlayerGameModeChangeEvent.Cause.HARDCORE_DEATH, null); // Paper

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Add pre-unbreaking amount to PlayerItemDamageEvent
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
index 30b307076e61c183acd5a1d900043b09f54734fc..6b3cfc19c4fd1382ddf534265a1114995a4f6b55 100644 index 67626e7faa4d0854d31b41c0a702edbeb6ce4270..c18a0bc94d0210396046f4475e49a739088593f3 100644
--- a/src/main/java/net/minecraft/world/item/ItemStack.java --- a/src/main/java/net/minecraft/world/item/ItemStack.java
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java +++ b/src/main/java/net/minecraft/world/item/ItemStack.java
@@ -563,10 +563,11 @@ public final class ItemStack { @@ -563,10 +563,11 @@ public final class ItemStack {

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Add PlayerStopUsingItemEvent
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index ea54c429c170c9aca68a96f38ae4dfc3a23b0f5e..279051442ac6cf288a03a16a35ddbf66d1cd1e90 100644 index 44c0f77bdeeb9061b1dfcd904ed2c63910e30e42..cff7993bdafd2f69e46c9985c7601a69ae47f452 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3901,6 +3901,7 @@ public abstract class LivingEntity extends Entity { @@ -3904,6 +3904,7 @@ public abstract class LivingEntity extends Entity {
public void releaseUsingItem() { public void releaseUsingItem() {
if (!this.useItem.isEmpty()) { if (!this.useItem.isEmpty()) {

View File

@ -22,10 +22,10 @@ index 68f99e93ed3e843b4001a7a27620f88a48b85e67..0dc96c39151ec4dbeec3947cb17606f5
} }
}); });
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index c89e85c1fe37c8fba54825be76bb1caa15d84dcd..458ebb5dabd1f24ea3d49ef57eea687ce61f0fc0 100644 index 802b929a16b6a8aeee608caeb524e268f8df53bd..5b3a7626579ff6bcf3ad32f7193bf905aa1b70bc 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -2489,6 +2489,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -2490,6 +2490,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
} }
public void onTickingStart(Entity entity) { public void onTickingStart(Entity entity) {

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Do not accept invalid client settings
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index e8069222397f7143ffd662e554904ff811b386d4..28c76e7b3260ce56421057b88c3555f18b29da06 100644 index 9f574e4425e73826b969302cf85025fc63b66f4a..c5278cc28eaba16d6adc31fc5f276e0c972fd8dc 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -3354,6 +3354,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -3571,6 +3571,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@Override @Override
public void handleClientInformation(ServerboundClientInformationPacket packet) { public void handleClientInformation(ServerboundClientInformationPacket packet) {
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel()); PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());

View File

@ -17,10 +17,10 @@ index effc19371309a1af44e1b660b547b58530a8df3c..2374cc9bab5039d0a0dc11d4b2ec573a
implementation("org.apache.logging.log4j:log4j-iostreams:2.17.1") // Paper implementation("org.apache.logging.log4j:log4j-iostreams:2.17.1") // Paper
implementation("org.apache.logging.log4j:log4j-slf4j18-impl:2.17.1") // Paper implementation("org.apache.logging.log4j:log4j-slf4j18-impl:2.17.1") // Paper
diff --git a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java diff --git a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java
index 597c7660bd517322d8bc9c5acef6956c40067405..c2d7f0ca042882e1bf76f150e9c9be9044ef887c 100644 index cfdbcd024de6ad0f9d4e83b2f912b36ef3299458..abcc3266d18f34d160eac87fdea153dce24c60b8 100644
--- a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java --- a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java
+++ b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java +++ b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java
@@ -110,6 +110,12 @@ public class ServerConnectionListener { @@ -111,6 +111,12 @@ public class ServerConnectionListener {
ServerConnectionListener.LOGGER.info("Paper: Using " + com.velocitypowered.natives.util.Natives.cipher.getLoadedVariant() + " cipher from Velocity."); ServerConnectionListener.LOGGER.info("Paper: Using " + com.velocitypowered.natives.util.Natives.cipher.getLoadedVariant() + " cipher from Velocity.");
// Paper end // Paper end
@ -33,7 +33,7 @@ index 597c7660bd517322d8bc9c5acef6956c40067405..c2d7f0ca042882e1bf76f150e9c9be90
this.channels.add(((ServerBootstrap) ((ServerBootstrap) (new ServerBootstrap()).channel(oclass)).childHandler(new ChannelInitializer<Channel>() { this.channels.add(((ServerBootstrap) ((ServerBootstrap) (new ServerBootstrap()).channel(oclass)).childHandler(new ChannelInitializer<Channel>() {
protected void initChannel(Channel channel) { protected void initChannel(Channel channel) {
try { try {
@@ -123,6 +129,30 @@ public class ServerConnectionListener { @@ -124,6 +130,30 @@ public class ServerConnectionListener {
int j = ServerConnectionListener.this.server.getRateLimitPacketsPerSecond(); int j = ServerConnectionListener.this.server.getRateLimitPacketsPerSecond();
Object object = j > 0 ? new RateKickingConnection(j) : new Connection(PacketFlow.SERVERBOUND); Object object = j > 0 ? new RateKickingConnection(j) : new Connection(PacketFlow.SERVERBOUND);

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Prevent entity loading causing async lookups
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index ae30cfb8681e474af1236411a7ec8e8f99d045ca..172016efc07d12fa0bbafe3c45410ffd72acd984 100644 index 6a1f11a2519cc320407696cc7165404a43d0b961..33ec6c1e942a7f852e4726683918ed06cde2e16a 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java --- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -788,6 +788,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { @@ -788,6 +788,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {

View File

@ -7,10 +7,10 @@ There are no plans to support creating worlds while worlds are
being ticked themselvess. being ticked themselvess.
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 104428d032721fc488c2931c06e802e9b00e47bd..35a5cc8ed861401d3dd28b08ebc5d40aad82b0df 100644 index ad9609ccb33bbe9bdda94a50900258ad3e0339f0..6a81076239080ae6457308ca2e3628c3d32691bf 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -295,6 +295,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -297,6 +297,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
public volatile Thread shutdownThread; // Paper public volatile Thread shutdownThread; // Paper
public volatile boolean abnormalExit = false; // Paper public volatile boolean abnormalExit = false; // Paper

View File

@ -2008,10 +2008,10 @@ index 0000000000000000000000000000000000000000..33cd90c30c22200a4e1ae64f40a0bf78
+ } + }
+} +}
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 458ebb5dabd1f24ea3d49ef57eea687ce61f0fc0..aa3c6f18d817826e9af2a3047b0b683dd16ea7f7 100644 index 5b3a7626579ff6bcf3ad32f7193bf905aa1b70bc..c09cdc4b717bcd7b3096a068d6abc90efc486529 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -217,6 +217,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -218,6 +218,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
public final UUID uuid; public final UUID uuid;
public boolean hasPhysicsEvent = true; // Paper public boolean hasPhysicsEvent = true; // Paper
public boolean hasEntityMoveEvent = false; // Paper public boolean hasEntityMoveEvent = false; // Paper
@ -2019,7 +2019,7 @@ index 458ebb5dabd1f24ea3d49ef57eea687ce61f0fc0..aa3c6f18d817826e9af2a3047b0b683d
public static Throwable getAddToWorldStackTrace(Entity entity) { public static Throwable getAddToWorldStackTrace(Entity entity) {
return new Throwable(entity + " Added to world at " + new java.util.Date()); return new Throwable(entity + " Added to world at " + new java.util.Date());
} }
@@ -2478,6 +2479,13 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -2479,6 +2480,13 @@ public class ServerLevel extends Level implements WorldGenLevel {
return this.entityManager.canPositionTick(pos.toLong()); // Paper return this.entityManager.canPositionTick(pos.toLong()); // Paper
} }

View File

@ -11,10 +11,10 @@ distance trigger. This adds a config option to ignore that
and use the exact dimension key of the worlds involved. and use the exact dimension key of the worlds involved.
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 4a28aeee2235690da28337605bba40417138c360..5f0d934399991ae94795ad0a94da689c242ffeba 100644 index a6e999b7698948564f6b7e1852a87acf389d60d7..94944ba458178f9e5b772224da329bb5d85f4394 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -1253,6 +1253,12 @@ public class ServerPlayer extends Player { @@ -1251,6 +1251,12 @@ public class ServerPlayer extends Player {
// CraftBukkit start // CraftBukkit start
ResourceKey<Level> maindimensionkey = CraftDimensionUtil.getMainDimensionKey(origin); ResourceKey<Level> maindimensionkey = CraftDimensionUtil.getMainDimensionKey(origin);
ResourceKey<Level> maindimensionkey1 = CraftDimensionUtil.getMainDimensionKey(this.level); ResourceKey<Level> maindimensionkey1 = CraftDimensionUtil.getMainDimensionKey(this.level);

View File

@ -7,10 +7,10 @@ The previous solution caused a bunch of bandaid fixes inorder to resolve edge ca
Just simply prevent them from being added to the world instead. Just simply prevent them from being added to the world instead.
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index aa3c6f18d817826e9af2a3047b0b683dd16ea7f7..1a918eabbaaed26d9bdf5c01e0488b5a117ba516 100644 index c09cdc4b717bcd7b3096a068d6abc90efc486529..083349794d5ceb50322c5a645dd33fbfcc1c8155 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1433,6 +1433,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -1434,6 +1434,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
// WorldServer.LOGGER.warn("Tried to add entity {} but it was marked as removed already", EntityTypes.getKey(entity.getType())); // CraftBukkit // WorldServer.LOGGER.warn("Tried to add entity {} but it was marked as removed already", EntityTypes.getKey(entity.getType())); // CraftBukkit
return false; return false;
} else { } else {
@ -19,10 +19,10 @@ index aa3c6f18d817826e9af2a3047b0b683dd16ea7f7..1a918eabbaaed26d9bdf5c01e0488b5a
if (captureDrops != null && entity instanceof net.minecraft.world.entity.item.ItemEntity) { if (captureDrops != null && entity instanceof net.minecraft.world.entity.item.ItemEntity) {
captureDrops.add((net.minecraft.world.entity.item.ItemEntity) entity); captureDrops.add((net.minecraft.world.entity.item.ItemEntity) entity);
diff --git a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java diff --git a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
index ae4b251e10babb07055d031ff48ac7dd5d4be4a0..08f15739dd7e2ab80718ab8d983b483a46309deb 100644 index 30c417c3169c1df43662fd77ac6816db64a42802..4c78c04ed031ec2e04642ebe5d79527e848d95f6 100644
--- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java --- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
+++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java +++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
@@ -509,7 +509,7 @@ public class ItemEntity extends Entity { @@ -507,7 +507,7 @@ public class ItemEntity extends Entity {
} }
public void setItem(ItemStack stack) { public void setItem(ItemStack stack) {

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Don't print component in resource pack rejection message
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 8e6045c51c46b8d8fa6f4b7fbe4b9478693bac82..924d0601dab2e1b4e38dd138c9ecd7287ca4d733 100644 index c5278cc28eaba16d6adc31fc5f276e0c972fd8dc..ea47d8f0275a99920c6e3f5c7a9c09ccb2341139 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1979,7 +1979,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -2045,7 +2045,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
public void handleResourcePackResponse(ServerboundResourcePackPacket packet) { public void handleResourcePackResponse(ServerboundResourcePackPacket packet) {
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel()); PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());
if (packet.getAction() == ServerboundResourcePackPacket.Action.DECLINED && this.server.isResourcePackRequired()) { if (packet.getAction() == ServerboundResourcePackPacket.Action.DECLINED && this.server.isResourcePackRequired()) {

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Add various missing EntityDropItemEvent calls
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 172016efc07d12fa0bbafe3c45410ffd72acd984..5449c84d131915284822c1da14e972b04c022853 100644 index 33ec6c1e942a7f852e4726683918ed06cde2e16a..700e2299200b536255dd38c2f84e9ab13ab31811 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java --- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -2509,6 +2509,14 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { @@ -2506,6 +2506,14 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
stack.setCount(0); // Paper - destroy this item - if this ever leaks due to game bugs, ensure it doesn't dupe stack.setCount(0); // Paper - destroy this item - if this ever leaks due to game bugs, ensure it doesn't dupe
entityitem.setDefaultPickUpDelay(); entityitem.setDefaultPickUpDelay();

View File

@ -6,23 +6,24 @@ Subject: [PATCH] Add some minimal debug information to chat packet errors
TODO: potentially add some kick leeway TODO: potentially add some kick leeway
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 924d0601dab2e1b4e38dd138c9ecd7287ca4d733..8914b20e5823c0b0cfccf986db9e9265b7f757f5 100644 index ea47d8f0275a99920c6e3f5c7a9c09ccb2341139..3b3a60bbc4547ae7e89ce40ae1572dbe1c028416 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2159,14 +2159,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -2294,7 +2294,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
private boolean tryHandleChat(String s, Instant instant) { private boolean tryHandleChat(String message, Instant timestamp, LastSeenMessages.Update acknowledgment) {
if (!this.updateChatOrder(instant)) { if (!this.updateChatOrder(timestamp)) {
- ServerGamePacketListenerImpl.LOGGER.warn("{} sent out-of-order chat: '{}'", this.player.getName().getString(), s); - ServerGamePacketListenerImpl.LOGGER.warn("{} sent out-of-order chat: '{}'", this.player.getName().getString(), message);
+ ServerGamePacketListenerImpl.LOGGER.warn("{} sent out-of-order chat: '{}'; {} > {}", this.player.getName().getString(), s, this.lastChatTimeStamp.get().getEpochSecond(), instant.getEpochSecond()); // Paper + ServerGamePacketListenerImpl.LOGGER.warn("{} sent out-of-order chat: '{}': {} > {}", this.player.getName().getString(), message, this.lastChatTimeStamp.get().getEpochSecond(), timestamp.getEpochSecond()); // Paper
this.server.scheduleOnMain(() -> { // Paper - push to main this.server.scheduleOnMain(() -> { // Paper - push to main
this.disconnect(Component.translatable("multiplayer.disconnect.out_of_order_chat")); this.disconnect(Component.translatable("multiplayer.disconnect.out_of_order_chat"));
}); // Paper - push to main }); // Paper - push to main
@@ -2551,7 +2551,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
return false; return false;
} else { } else {
if (this.isChatExpired(instant)) { if (message.hasExpiredServer(Instant.now())) {
- ServerGamePacketListenerImpl.LOGGER.warn("{} sent expired chat: '{}'. Is the client/server system time unsynchronized?", this.player.getName().getString(), s); - ServerGamePacketListenerImpl.LOGGER.warn("{} sent expired chat: '{}'. Is the client/server system time unsynchronized?", this.player.getName().getString(), message.signedContent().plain());
+ ServerGamePacketListenerImpl.LOGGER.warn("{} sent expired chat: '{}'. Is the client/server system time unsynchronized? c: {} s: {}", this.player.getName().getString(), s, instant.getEpochSecond(), Instant.now().getEpochSecond()); // Paper + ServerGamePacketListenerImpl.LOGGER.warn("{} sent expired chat: '{}'. Is the client/server system time unsynchronized? c: {} s: {}", this.player.getName().getString(), message.signedContent().plain(), message.timeStamp().getEpochSecond(), Instant.now().getEpochSecond()); // Paper
} }
return this.resetLastActionTime(); return true;

View File

@ -5,15 +5,15 @@ Subject: [PATCH] Fix Spigot Config not using commands.spam-exclusions
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 8914b20e5823c0b0cfccf986db9e9265b7f757f5..9d89da66c0c5ab07252430eaff6d20e5e83db658 100644 index 3b3a60bbc4547ae7e89ce40ae1572dbe1c028416..64542840d4b0a86d13e4a1ebef05a0761ea8edb9 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2400,7 +2400,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -2572,7 +2572,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
} }
// Spigot end // Spigot end
// this.chatSpamTickCount += 20; // this.chatSpamTickCount += 20;
- if (this.chatSpamTickCount.addAndGet(20) > 200 && !this.server.getPlayerList().isOp(this.player.getGameProfile())) { - if (this.chatSpamTickCount.addAndGet(20) > 200 && !this.server.getPlayerList().isOp(this.player.getGameProfile())) {
+ if (counted && this.chatSpamTickCount.addAndGet(20) > 200 && !this.server.getPlayerList().isOp(this.player.getGameProfile())) { // Paper - exclude from SpigotConfig.spamExclusions + if (counted && this.chatSpamTickCount.addAndGet(20) > 200 && !this.server.getPlayerList().isOp(this.player.getGameProfile())) { // Paper - exclude from SpigotConfig.spamExclusions
if (!isSync) { // CraftBukkit end
Waitable waitable = new Waitable() { this.disconnect(Component.translatable("disconnect.spam"), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM); // Paper - kick event cause
@Override }

View File

@ -5,10 +5,10 @@ Subject: [PATCH] More Teleport API
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 9d89da66c0c5ab07252430eaff6d20e5e83db658..935c482be4bf3767e197a576d0e38eac51115dd4 100644 index 64542840d4b0a86d13e4a1ebef05a0761ea8edb9..e8b6fe40b4d51f506fc9686a12ec240c6bb8328b 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1660,11 +1660,17 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -1726,11 +1726,17 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
return false; // CraftBukkit - Return event status return false; // CraftBukkit - Return event status
} }
@ -69,7 +69,7 @@ index 2a6c67634c31c332102d24bef293da1bacd0c000..b80cc0938b2b3928f4450f1314a9fbd7
// Let the server handle cross world teleports // Let the server handle cross world teleports
if (location.getWorld() != null && !location.getWorld().equals(this.getWorld())) { if (location.getWorld() != null && !location.getWorld().equals(this.getWorld())) {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 287520f91e22309e1268be1940e0fafb628980a9..d7ba155d9485128f4c7ad8ab4a2b7302a86aeb67 100644 index 37f43ef07881b0898caef3ec28779a8b61fada47..0cb2b0bda179f90ec8bf8bc4d9be092290eccba0 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -1123,7 +1123,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -1123,7 +1123,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player {

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Add EntityPortalReadyEvent
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 5449c84d131915284822c1da14e972b04c022853..99f454b4a3a12fb9bf8e1d506ab311e4166700da 100644 index 700e2299200b536255dd38c2f84e9ab13ab31811..f925a8d550ecbf2044a37bfe58b30d6578c5f6af 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java --- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -2856,6 +2856,13 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { @@ -2853,6 +2853,13 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
if (true && !this.isPassenger() && this.portalTime++ >= i) { // CraftBukkit if (true && !this.isPassenger() && this.portalTime++ >= i) { // CraftBukkit
this.level.getProfiler().push("portal"); this.level.getProfiler().push("portal");
this.portalTime = i; this.portalTime = i;
@ -22,7 +22,7 @@ index 5449c84d131915284822c1da14e972b04c022853..99f454b4a3a12fb9bf8e1d506ab311e4
this.setPortalCooldown(); this.setPortalCooldown();
// CraftBukkit start // CraftBukkit start
if (this instanceof ServerPlayer) { if (this instanceof ServerPlayer) {
@@ -2863,6 +2870,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { @@ -2860,6 +2867,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
} else { } else {
this.changeDimension(worldserver1); this.changeDimension(worldserver1);
} }

View File

@ -31,7 +31,7 @@ index e5de2c1d11e5de88420caba35bf75c8bbd799db5..a9cdf9034ad269f7a71358443acc0532
} }
diff --git a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java diff --git a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
index 08f15739dd7e2ab80718ab8d983b483a46309deb..c58c296bbb0fbd1930dba38bcab7ec3103917ba5 100644 index 4c78c04ed031ec2e04642ebe5d79527e848d95f6..fcc5444a1268931a0fd2df1e6bbbc17cfd5a61e0 100644
--- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java --- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
+++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java +++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
@@ -64,7 +64,12 @@ public class ItemEntity extends Entity { @@ -64,7 +64,12 @@ public class ItemEntity extends Entity {

View File

@ -1,24 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Shane Freeder <theboyetronic@gmail.com>
Date: Wed, 13 Apr 2022 08:25:42 +0100
Subject: [PATCH] Prevent tile entity copies loading chunks
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index cd4fbce5d7b53e343db2a16f45ef05c696b97121..e08e6091dc0b885275045260386c88b368954fe6 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -3176,7 +3176,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
if (!itemstack.isEmpty() && nbttagcompound != null && nbttagcompound.contains("x") && nbttagcompound.contains("y") && nbttagcompound.contains("z") && this.player.getBukkitEntity().hasPermission("minecraft.nbt.copy")) { // Spigot
BlockPos blockposition = BlockEntity.getPosFromTag(nbttagcompound);
- BlockEntity tileentity = this.player.level.getBlockEntity(blockposition);
+ // Paper start
+ BlockEntity tileentity = null;
+ if (this.player.distanceToSqr(blockposition.getX(), blockposition.getY(), blockposition.getZ()) < 32 * 32 && this.player.getLevel().isLoadedAndInBounds(blockposition)) {
+ tileentity = this.player.level.getBlockEntity(blockposition);
+ }
+ // Paper end
if (tileentity != null) {
tileentity.saveToItem(itemstack);

View File

@ -1,19 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Nassim Jahnke <jahnke.nassim@gmail.com>
Date: Fri, 10 Jun 2022 16:02:35 +0200
Subject: [PATCH] Remove invalid signature login stacktrace
diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
index 07fa94cc67225d6398634c450d6800d609fdb3fb..039b47e19d672ec9066c41fcc6342523992bf7b6 100644
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
@@ -299,7 +299,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener
try {
this.playerProfilePublicKey = ServerLoginPacketListenerImpl.validatePublicKey(packet, this.server.getServiceSignatureValidator(), this.server.enforceSecureProfile());
} catch (ServerLoginPacketListenerImpl.PublicKeyParseException loginlistener_a) {
- ServerLoginPacketListenerImpl.LOGGER.error(loginlistener_a.getMessage(), loginlistener_a.getCause());
+ //ServerLoginPacketListenerImpl.LOGGER.error(loginlistener_a.getMessage(), loginlistener_a.getCause()); // Paper - unnecessary stacktrace
if (!this.connection.isMemoryConnection()) {
this.disconnect(loginlistener_a.getComponent());
return;

View File

@ -1,18 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Noah van der Aa <ndvdaa@gmail.com>
Date: Wed, 15 Jun 2022 22:34:07 +0200
Subject: [PATCH] Fix MC-252439
diff --git a/src/main/java/net/minecraft/world/entity/monster/ZombieVillager.java b/src/main/java/net/minecraft/world/entity/monster/ZombieVillager.java
index 05cf30e6572c9bb7e11d71de1cd79df987bf062a..cff0ed9ae6e79f84870343e43574f384dd73ea88 100644
--- a/src/main/java/net/minecraft/world/entity/monster/ZombieVillager.java
+++ b/src/main/java/net/minecraft/world/entity/monster/ZombieVillager.java
@@ -266,6 +266,7 @@ public class ZombieVillager extends Zombie implements VillagerDataHolder {
entityvillager.setVillagerXp(this.villagerXp);
entityvillager.finalizeSpawn(world, world.getCurrentDifficultyAt(entityvillager.blockPosition()), MobSpawnType.CONVERSION, (SpawnGroupData) null, (CompoundTag) null);
+ entityvillager.refreshBrain(world); // Paper - Fix MC-252439
if (this.conversionStarter != null) {
Player entityhuman = world.getPlayerByUUID(this.conversionStarter);

View File

@ -1,19 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Shane Freeder <theboyetronic@gmail.com>
Date: Mon, 20 Jun 2022 14:59:38 +0100
Subject: [PATCH] Fix missing null check in
ChunkGenerator#findNearestMapStructure
diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
index cdfe2589ca598263d58a11a978e176ab3ecb87e6..264ca51c2f2a5ff69688372b71ad7355366bac1a 100644
--- a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
+++ b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
@@ -353,6 +353,7 @@ public abstract class ChunkGenerator {
if (structureplacement1 instanceof ConcentricRingsStructurePlacement) {
ConcentricRingsStructurePlacement concentricringsstructureplacement = (ConcentricRingsStructurePlacement) structureplacement1;
Pair<BlockPos, Holder<Structure>> pair1 = this.getNearestGeneratedStructure((Set) entry.getValue(), world, structuremanager, center, skipReferencedStructures, concentricringsstructureplacement);
+ if (pair1 == null) continue; // Paper
BlockPos blockposition1 = (BlockPos) pair1.getFirst();
double d1 = center.distSqr(blockposition1);