even moar patches

This commit is contained in:
Jake Potrebic 2023-06-07 15:58:10 -07:00
parent 44e22b45a5
commit c31a22c563
No known key found for this signature in database
GPG Key ID: ECE0B3C133C016C5
25 changed files with 80 additions and 80 deletions

View File

@ -7,7 +7,7 @@ Subject: [PATCH] Villager Restocks API
public net.minecraft.world.entity.npc.Villager numberOfRestocksToday
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java
index 7479a68d9c1025c8f2cd784b2607b549d40f3638..ae8c32c3497125fa2d1959e3a44b7c3013646762 100644
index 87d9cd989be932cf3eb9e777cbc2d2246ccf9d9a..350cfc1526894f4dac56832a6d1dfbbc9b25123c 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java
@@ -92,6 +92,18 @@ public class CraftVillager extends CraftAbstractVillager implements Villager {

View File

@ -5,13 +5,13 @@ Subject: [PATCH] Validate PickItem Packet and kick for invalid
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 4ad848bd15a9bcb14a53e7f391938982a2f4c207..39dbdfe8c74b2bf3d57f59c073f882dd2eca79ab 100644
index 093eaae15344b39e217978e4c0bdbc37b83f6799..3c0f15d294891143624ac7feadb09c3f8de3059e 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -959,7 +959,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -960,7 +960,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@Override
public void handlePickItem(ServerboundPickItemPacket packet) {
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
- this.player.getInventory().pickSlot(packet.getSlot());
+ // Paper start - validate pick item position
+ if (!(packet.getSlot() >= 0 && packet.getSlot() < this.player.getInventory().items.size())) {

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Expose game version
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index b7dc51e29aed83fe40cc4730a1b8448b432ebff8..0dbabab39dddfbc2a11c509e6e7e12814e60c6c2 100644
index 7f4ee248bede39701365d200cdc4e39f7bdd8b26..db932976919ae8a2a258b61d386e6a5c54fe7be4 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -577,6 +577,13 @@ public final class CraftServer implements Server {

View File

@ -17,7 +17,7 @@ keeping long lived large direct buffers in cache.
Set system properly at server startup if not set already to help protect from this.
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
index 7f85bc8e8a666a32e392fa57418bf0d479e758d0..e7b088a6ffed52d2dc9d6528d827997d68fcc84c 100644
index 203a25a2a8d843c33440d849a94b85e2c717d2a0..9f1b363e1a6fa4925dc4560654af8426e6908c9d 100644
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
@@ -26,6 +26,7 @@ public class Main {

View File

@ -29,10 +29,10 @@ index 0000000000000000000000000000000000000000..2d5494d2813b773e60ddba6790b750a9
+ }
+}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index ebc8446631a4c4abccd2292ec52b69a0b6685199..e189de6d2aa94e9bbb20f1477ee2e34431adb324 100644
index d7428c963fc369e04926a5987653ea5bd325d51d..260fbcafbb4c2049372ea57451d22479e4a3addd 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -892,6 +892,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -880,6 +880,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
// CraftBukkit start
private boolean hasStopped = false;
public volatile boolean hasFullyShutdown = false; // Paper
@ -40,7 +40,7 @@ index ebc8446631a4c4abccd2292ec52b69a0b6685199..e189de6d2aa94e9bbb20f1477ee2e344
private final Object stopLock = new Object();
public final boolean hasStopped() {
synchronized (this.stopLock) {
@@ -906,6 +907,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -894,6 +895,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
if (this.hasStopped) return;
this.hasStopped = true;
}
@ -48,7 +48,7 @@ index ebc8446631a4c4abccd2292ec52b69a0b6685199..e189de6d2aa94e9bbb20f1477ee2e344
// Paper start - kill main thread, and kill it hard
shutdownThread = Thread.currentThread();
org.spigotmc.WatchdogThread.doStop(); // Paper
@@ -1007,6 +1009,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1025,6 +1027,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
public void safeShutdown(boolean waitForShutdown, boolean isRestarting) {
this.isRestarting = isRestarting;
@ -74,7 +74,7 @@ index 0c7f280bae81bbb492d5780a43e5ffda0f58756a..238a7bc87ab49da1f0fa3c733dd512fd
this.connection.send(new ClientboundDisconnectPacket(ichatmutablecomponent));
this.connection.disconnect(ichatmutablecomponent);
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 0dbabab39dddfbc2a11c509e6e7e12814e60c6c2..9c50a908146b599b79176bd64f6773539db14996 100644
index db932976919ae8a2a258b61d386e6a5c54fe7be4..067457ff4f108a5725021cc2a9c501f5e9500307 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1015,6 +1015,7 @@ public final class CraftServer implements Server {

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Prevent teleporting dead entities
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 39dbdfe8c74b2bf3d57f59c073f882dd2eca79ab..f77abe31d6d56c11dba390cca4b8069bc535103a 100644
index 3c0f15d294891143624ac7feadb09c3f8de3059e..a9cdf3e774dbc8b689c7bbd95d94c8be32b33d92 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1613,6 +1613,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -1605,6 +1605,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
}
public void internalTeleport(double d0, double d1, double d2, float f, float f1, Set<RelativeMovement> set) { // Paper

View File

@ -6,7 +6,7 @@ Subject: [PATCH] Deobfuscate stacktraces in log messages, crash reports, and
diff --git a/build.gradle.kts b/build.gradle.kts
index c04f733d053a52218893ef2b9ca050f911b50b0a..e63ad0e49818709cb292b9e43f5b52f5cb13002f 100644
index d86a4eebb4fd4144d762407aaccc7de497d0a5c1..16739eb5fc89fce4a77ad84387c785a5d41a9df2 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -19,6 +19,7 @@ dependencies {
@ -22,8 +22,8 @@ index c04f733d053a52218893ef2b9ca050f911b50b0a..e63ad0e49818709cb292b9e43f5b52f5
implementation("org.spongepowered:configurate-yaml:4.1.2") // Paper - config files
implementation("commons-lang:commons-lang:2.6")
+ implementation("net.fabricmc:mapping-io:0.3.0") // Paper - needed to read mappings for stacktrace deobfuscation
runtimeOnly("org.xerial:sqlite-jdbc:3.41.2.2")
runtimeOnly("com.mysql:mysql-connector-j:8.0.32")
runtimeOnly("org.xerial:sqlite-jdbc:3.42.0.0")
runtimeOnly("com.mysql:mysql-connector-j:8.0.33")
runtimeOnly("com.lmax:disruptor:3.4.4") // Paper
@@ -105,6 +107,18 @@ tasks.check {
}
@ -474,7 +474,7 @@ index 52eb3176437113f9a0ff85d10ce5c2415e1b5570..b54ddd0ba0b001fbcb1838a838ca4890
}
}
diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java
index ca9a36e357e73b1b518ebb5c937314269655de32..59bb1d340e0be6f15a8c6ac21500cdd909c18a8b 100644
index 7e11cf7d6871b6125ccccae2b765cd4dfcf38d3b..e857327b796455953e76ddf70913c37a3f1e2ee2 100644
--- a/src/main/java/net/minecraft/network/Connection.java
+++ b/src/main/java/net/minecraft/network/Connection.java
@@ -64,13 +64,13 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
@ -494,7 +494,7 @@ index ca9a36e357e73b1b518ebb5c937314269655de32..59bb1d340e0be6f15a8c6ac21500cdd9
});
private final PacketFlow receiving;
private final Queue<Connection.PacketHolder> queue = Queues.newConcurrentLinkedQueue();
@@ -199,7 +199,7 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
@@ -172,7 +172,7 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
}
}
@ -504,7 +504,7 @@ index ca9a36e357e73b1b518ebb5c937314269655de32..59bb1d340e0be6f15a8c6ac21500cdd9
protected void channelRead0(ChannelHandlerContext channelhandlercontext, Packet<?> packet) {
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index 549ea8e0fe702615eefcbfd1cd6a30e05b7b3fd5..771677c0e1cd7bfe089b9a5bb9095650216ff588 100644
index eef9206a9d6a398eb1d44a36b6a1a342ed7bc878..9d2eb13130d3b68fd0ca07243a3a41735f89c7b2 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -195,6 +195,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
@ -516,10 +516,10 @@ index 549ea8e0fe702615eefcbfd1cd6a30e05b7b3fd5..771677c0e1cd7bfe089b9a5bb9095650
paperConfigurations.initializeWorldDefaultsConfiguration();
org.spigotmc.WatchdogThread.doStart(org.spigotmc.SpigotConfig.timeoutTime, org.spigotmc.SpigotConfig.restartOnCrash);
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 4bf38f9006be9e838c54783dafd40cf84553d627..51e8070864ffc4a35377021a7ded9813a40c1a11 100644
index a25d46fc3e2a106ab94c6b2b49558dd7be11c5b9..8cdb2bdd404f2f091493bb7a93f62f764a8e511b 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -218,7 +218,9 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -221,7 +221,9 @@ public class ServerLevel extends Level implements WorldGenLevel {
public final UUID uuid;
public boolean hasPhysicsEvent = true; // Paper
public static Throwable getAddToWorldStackTrace(Entity entity) {
@ -530,7 +530,7 @@ index 4bf38f9006be9e838c54783dafd40cf84553d627..51e8070864ffc4a35377021a7ded9813
}
@Override public LevelChunk getChunkIfLoaded(int x, int z) { // Paper - this was added in world too but keeping here for NMS ABI
@@ -1326,7 +1328,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -1235,7 +1237,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
if (entity.isRemoved()) {
// Paper start
if (DEBUG_ENTITIES) {
@ -540,7 +540,7 @@ index 4bf38f9006be9e838c54783dafd40cf84553d627..51e8070864ffc4a35377021a7ded9813
}
// Paper end
diff --git a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java
index fbf375534e2b8bd6ef052c4625764f4f8feb2ed6..bb9e65eee7e0ca0f715cd5791c47579a57b1b577 100644
index 776528e50a5abc0e02d9de99231fb47352aa4f43..4017c15a62ce1048a61f55f46f915fd516496181 100644
--- a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java
+++ b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java
@@ -51,10 +51,10 @@ public class ServerConnectionListener {
@ -592,10 +592,10 @@ index 6599f874d9f97e9ef4862039ecad7277bbc5fd91..7edd4b88eb0476f0630630bc4681e859
}
}
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
index ee1c9f2c8dd30b3f32a6d49aa1c43148f4e5ccac..73a3f9eae86df8e9afd08ee9da4c1b8e16dededd 100644
index cb8166771b57bb4dd7e64150bd02e8944307783f..04d0e2db1bb38700a1bc210296d7f8bfdd3aead5 100644
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
@@ -633,7 +633,7 @@ public class LevelChunk extends ChunkAccess {
@@ -603,7 +603,7 @@ public class LevelChunk extends ChunkAccess {
+ " (" + getBlockState(blockposition) + ") where there was no entity tile!\n" +
"Chunk coordinates: " + (this.chunkPos.x * 16) + "," + (this.chunkPos.z * 16) +
"\nWorld: " + level.getLevel().dimension().location());
@ -621,10 +621,10 @@ index 3c1992e212a6d6f1db4d5b807b38d71913619fc0..9c1aff17aabd062640e3f451a2ef8c50
CraftAsyncScheduler() {
diff --git a/src/main/java/org/spigotmc/WatchdogThread.java b/src/main/java/org/spigotmc/WatchdogThread.java
index 383c52c62f49b17db2fbf58009d6ea132d124bea..e0a71bfc1498a517456b21747ab6ef3f1067a3f3 100644
index 29b315188e3deb994b45b2154b2ce4f17c4fde2d..571d80ca3e85fc108137b317ed1033ca4714718e 100644
--- a/src/main/java/org/spigotmc/WatchdogThread.java
+++ b/src/main/java/org/spigotmc/WatchdogThread.java
@@ -105,7 +105,7 @@ public final class WatchdogThread extends io.papermc.paper.util.TickThread // Pa
@@ -105,7 +105,7 @@ public class WatchdogThread extends Thread
log.log( Level.SEVERE, "During the run of the server, a plugin set an excessive velocity on an entity" );
log.log( Level.SEVERE, "This may be the cause of the issue, or it may be entirely unrelated" );
log.log( Level.SEVERE, org.bukkit.craftbukkit.CraftServer.excessiveVelEx.getMessage());
@ -633,7 +633,7 @@ index 383c52c62f49b17db2fbf58009d6ea132d124bea..e0a71bfc1498a517456b21747ab6ef3f
{
log.log( Level.SEVERE, "\t\t" + stack );
}
@@ -193,7 +193,7 @@ public final class WatchdogThread extends io.papermc.paper.util.TickThread // Pa
@@ -192,7 +192,7 @@ public class WatchdogThread extends Thread
}
log.log( Level.SEVERE, "\tStack:" );
//

View File

@ -5,12 +5,12 @@ Subject: [PATCH] Implement Mob Goal API
diff --git a/build.gradle.kts b/build.gradle.kts
index e63ad0e49818709cb292b9e43f5b52f5cb13002f..719f4b4bff2ab651156f17e27412ae8b0e9e5d02 100644
index 16739eb5fc89fce4a77ad84387c785a5d41a9df2..bc71323234b69a07ac84703c04734711ca0dd113 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -36,6 +36,7 @@ dependencies {
runtimeOnly("org.apache.maven.resolver:maven-resolver-connector-basic:1.7.3")
runtimeOnly("org.apache.maven.resolver:maven-resolver-transport-http:1.7.3")
runtimeOnly("org.apache.maven.resolver:maven-resolver-connector-basic:1.9.10")
runtimeOnly("org.apache.maven.resolver:maven-resolver-transport-http:1.9.10")
+ testImplementation("io.github.classgraph:classgraph:4.8.47") // Paper - mob goal test
testImplementation("junit:junit:4.13.2")
@ -792,10 +792,10 @@ index 4379b9948f1eecfe6fd7dea98e298ad5f761019a..3f081183521603824430709886a9cc31
LOOK,
JUMP,
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 9c50a908146b599b79176bd64f6773539db14996..ea1f82fd9369c75b1bfdc8f82c70f1bc132afdca 100644
index 067457ff4f108a5725021cc2a9c501f5e9500307..b31657b4dd8ea2c8c3a4fb51ad37067118983d05 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -2760,5 +2760,11 @@ public final class CraftServer implements Server {
@@ -2758,5 +2758,11 @@ public final class CraftServer implements Server {
public boolean isStopping() {
return net.minecraft.server.MinecraftServer.getServer().hasStopped();
}

View File

@ -57,7 +57,7 @@ index a28f359202e6502c6ea5e9c918ec0b3e9a3fca61..76dffb2705e5207db96895f82f1c7c56
static record GossipEntry(UUID target, GossipType type, int value) {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java
index ae8c32c3497125fa2d1959e3a44b7c3013646762..a1705b0fae9574d4ce2bb815ea57a35f8551c3a6 100644
index 350cfc1526894f4dac56832a6d1dfbbc9b25123c..e6fcdbabde66f4707627fc8c3012aa20de8e34e3 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java
@@ -18,6 +18,13 @@ import org.bukkit.entity.Villager;

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Option for maximum exp value when merging orbs
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index 195f5ef5fcabcf021e429b2a51aa274e929c7322..52d4e6904601d680c89168d2b1e765868d57e798 100644
index 4a1699b56f2111881653404b38f18c9e2e7473b4..3f6d9c6b88e14135917bdfe5e5df019213dde325 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -648,16 +648,30 @@ public class CraftEventFactory {

View File

@ -9,7 +9,7 @@ Plugins can cancel this if they want to ensure experience orbs do not lose impor
metadata such as spawn reason, or conditionally move data from source to target.
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index 52d4e6904601d680c89168d2b1e765868d57e798..0ad0d6e15f57c16fb71f988ac7d0d2e243493801 100644
index 3f6d9c6b88e14135917bdfe5e5df019213dde325..7af0710c40c1453bd0bd8ecb4ea7606bbe76c20f 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -658,7 +658,7 @@ public class CraftEventFactory {

View File

@ -8,7 +8,7 @@ Adds a new method to fetch the location of a player's bed without generating any
getPotentialBedLocation - Gets the last known location of a player's bed. This does not preform any check if the bed is still valid and does not load any chunks.
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
index 14984e791bd9309672b1fb404b8552849854d393..3f6e9214358c938b39106dd6c3eb652c8549c60b 100644
index ed6d7743ab6513ee4f4c09eae1c7124197df4ed1..2d3a7bb9f68350df136ee3d2e3aed0bbbe1a91cc 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
@@ -12,6 +12,7 @@ import net.minecraft.nbt.CompoundTag;

View File

@ -10,10 +10,10 @@ Adds a 5 second grace period for any async tasks to finish and warns
if any are still running after that delay just as reload does.
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index e189de6d2aa94e9bbb20f1477ee2e34431adb324..4a58843f7ce2dd9e50f9daf3065d056a28910e5a 100644
index 260fbcafbb4c2049372ea57451d22479e4a3addd..49283b13a88402ac5b54fd8c64e90a82499d09d7 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -932,6 +932,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -920,6 +920,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
// CraftBukkit start
if (this.server != null) {
this.server.disablePlugins();
@ -22,7 +22,7 @@ index e189de6d2aa94e9bbb20f1477ee2e34431adb324..4a58843f7ce2dd9e50f9daf3065d056a
// CraftBukkit end
if (this.getConnection() != null) {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index ea1f82fd9369c75b1bfdc8f82c70f1bc132afdca..d4439eb165cf01f4dd7eb106d14f7b96c1989e63 100644
index b31657b4dd8ea2c8c3a4fb51ad37067118983d05..cd04bdf3637584b6ea7298b5d833d4a71ce427ff 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1025,6 +1025,31 @@ public final class CraftServer implements Server {

View File

@ -6,7 +6,7 @@ Subject: [PATCH] Ensure EntityRaider respects game and entity rules for
diff --git a/src/main/java/net/minecraft/world/entity/raid/Raider.java b/src/main/java/net/minecraft/world/entity/raid/Raider.java
index 0c6a3887d28a8b520e8d73a5feae68e05bf97101..50010cc6774c351539cf09e517b7967f45822ec8 100644
index d8834abadc82617a2d09506432102211ea99b0b7..11a999182fd561611b3399d93ce9e2565cd4332a 100644
--- a/src/main/java/net/minecraft/world/entity/raid/Raider.java
+++ b/src/main/java/net/minecraft/world/entity/raid/Raider.java
@@ -312,6 +312,7 @@ public abstract class Raider extends PatrollingMonster {

View File

@ -13,7 +13,7 @@ A config is provided if you rather let players use these exploits, and let
them destroy the worlds End Portals and get on top of the nether easy.
diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java
index d2518db0dacbb1278b03da77a355fd23ff680b91..ec187a4969a84e50014f846f5af54b32c235d471 100644
index 75d827f1eecb24f7ab985bdea2bbf65b8478fc8c..d646660f988994d4fdb05901349c5946a2f6c48c 100644
--- a/src/main/java/net/minecraft/world/level/Explosion.java
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
@@ -168,6 +168,7 @@ public class Explosion {
@ -34,10 +34,10 @@ index d2518db0dacbb1278b03da77a355fd23ff680b91..ec187a4969a84e50014f846f5af54b32
this.level.getProfiler().push("explosion_blocks");
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 31edf8f2c683f56e53040e735d015ca6d6966d01..0ef98a3a3f8685c801f74431fcfab88541b6a170 100644
index cde79f2001904852159cc4ed8a42e9b5aac74851..4aad91def765910d6e8820cb92a288a304a17b5b 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -435,6 +435,10 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -432,6 +432,10 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
public boolean setBlock(BlockPos pos, BlockState state, int flags, int maxUpdateDepth) {
// CraftBukkit start - tree generation
if (this.captureTreeGeneration) {
@ -49,10 +49,10 @@ index 31edf8f2c683f56e53040e735d015ca6d6966d01..0ef98a3a3f8685c801f74431fcfab885
if (blockstate == null) {
blockstate = CapturedBlockState.getTreeBlockState(this, pos, flags);
diff --git a/src/main/java/net/minecraft/world/level/block/Block.java b/src/main/java/net/minecraft/world/level/block/Block.java
index f475926cfa6fc98f9f8f4fe8be6fd200cce39c7e..536a4e9f2bec3f44ca00edaf518c5d6c475d3c8b 100644
index 7646b66bc5ba0288608de0d836c7307e02eebe67..36b196c8834c4eb873bfca0b12f1fc2b421ea071 100644
--- a/src/main/java/net/minecraft/world/level/block/Block.java
+++ b/src/main/java/net/minecraft/world/level/block/Block.java
@@ -90,6 +90,19 @@ public class Block extends BlockBehaviour implements ItemLike {
@@ -88,6 +88,19 @@ public class Block extends BlockBehaviour implements ItemLike {
protected final StateDefinition<Block, BlockState> stateDefinition;
private BlockState defaultBlockState;
// Paper start
@ -73,7 +73,7 @@ index f475926cfa6fc98f9f8f4fe8be6fd200cce39c7e..536a4e9f2bec3f44ca00edaf518c5d6c
public co.aikar.timings.Timing getTiming() {
if (timing == null) {
diff --git a/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java b/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java
index 76720517cd2d82065eb8430cf854b536295341db..29755807fdb6c30e31c0ec2bbf33bed9afd5d478 100644
index 9e70f5ba6ff0935d245f357131b062c1cc7058fc..4f6b7ed4809086811f0460544ba2ec0606f0f5da 100644
--- a/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java
@@ -199,6 +199,12 @@ public class PistonBaseBlock extends DirectionalBlock {
@ -86,19 +86,19 @@ index 76720517cd2d82065eb8430cf854b536295341db..29755807fdb6c30e31c0ec2bbf33bed9
+ return false;
+ }
+ // Paper end - prevent retracting when we're facing the wrong way
BlockState iblockdata1 = (BlockState) state.setValue(PistonBaseBlock.EXTENDED, true);
if (!world.isClientSide) {
boolean flag = this.getNeighborSignal(world, pos, enumdirection);
@@ -231,7 +237,7 @@ public class PistonBaseBlock extends DirectionalBlock {
BlockState iblockdata1 = (BlockState) ((BlockState) Blocks.MOVING_PISTON.defaultBlockState().setValue(MovingPistonBlock.FACING, enumdirection)).setValue(MovingPistonBlock.TYPE, this.isSticky ? PistonType.STICKY : PistonType.DEFAULT);
@@ -232,7 +238,7 @@ public class PistonBaseBlock extends DirectionalBlock {
BlockState iblockdata2 = (BlockState) ((BlockState) Blocks.MOVING_PISTON.defaultBlockState().setValue(MovingPistonBlock.FACING, enumdirection)).setValue(MovingPistonBlock.TYPE, this.isSticky ? PistonType.STICKY : PistonType.DEFAULT);
world.setBlock(pos, iblockdata1, 20);
- world.setBlockEntity(MovingPistonBlock.newMovingBlockEntity(pos, iblockdata1, (BlockState) this.defaultBlockState().setValue(PistonBaseBlock.FACING, Direction.from3DDataValue(data & 7)), enumdirection, false, true));
+ world.setBlockEntity(MovingPistonBlock.newMovingBlockEntity(pos, iblockdata1, (BlockState) this.defaultBlockState().setValue(PistonBaseBlock.FACING, Direction.from3DDataValue(data & 7)), enumdirection, false, true)); // Paper - diff on change
world.blockUpdated(pos, iblockdata1.getBlock());
iblockdata1.updateNeighbourShapes(world, pos, 2);
world.setBlock(pos, iblockdata2, 20);
- world.setBlockEntity(MovingPistonBlock.newMovingBlockEntity(pos, iblockdata2, (BlockState) this.defaultBlockState().setValue(PistonBaseBlock.FACING, Direction.from3DDataValue(data & 7)), enumdirection, false, true));
+ world.setBlockEntity(MovingPistonBlock.newMovingBlockEntity(pos, iblockdata2, (BlockState) this.defaultBlockState().setValue(PistonBaseBlock.FACING, Direction.from3DDataValue(data & 7)), enumdirection, false, true)); // Paper - diff on change
world.blockUpdated(pos, iblockdata2.getBlock());
iblockdata2.updateNeighbourShapes(world, pos, 2);
if (this.isSticky) {
@@ -260,7 +266,14 @@ public class PistonBaseBlock extends DirectionalBlock {
@@ -261,7 +267,14 @@ public class PistonBaseBlock extends DirectionalBlock {
}
}
} else {
@ -115,20 +115,20 @@ index 76720517cd2d82065eb8430cf854b536295341db..29755807fdb6c30e31c0ec2bbf33bed9
world.playSound((Player) null, pos, SoundEvents.PISTON_CONTRACT, SoundSource.BLOCKS, 0.5F, world.random.nextFloat() * 0.15F + 0.6F);
diff --git a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
index 7cc6dcb128f2792fc32bb8f50e4c94d600255207..b245b3912a4e2f4e83872c29c5a9602743b5eccb 100644
index 2451bb61e304fbe5cdfd6bbb248575e9e1135075..74f84bfcb1da6186c7a6783512c2fc7ba995215f 100644
--- a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
+++ b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
@@ -235,7 +235,7 @@ public abstract class BlockBehaviour implements FeatureElement {
@@ -229,7 +229,7 @@ public abstract class BlockBehaviour implements FeatureElement {
/** @deprecated */
@Deprecated
public boolean canBeReplaced(BlockState state, BlockPlaceContext context) {
- return this.material.isReplaceable() && (context.getItemInHand().isEmpty() || !context.getItemInHand().is(this.asItem()));
+ return this.material.isReplaceable() && (context.getItemInHand().isEmpty() || !context.getItemInHand().is(this.asItem())) && (state.isDestroyable() || (context.getPlayer() != null && context.getPlayer().getAbilities().instabuild)); // Paper
- return state.canBeReplaced() && (context.getItemInHand().isEmpty() || !context.getItemInHand().is(this.asItem()));
+ return state.canBeReplaced() && (context.getItemInHand().isEmpty() || !context.getItemInHand().is(this.asItem())) && (state.isDestroyable() || (context.getPlayer() != null && context.getPlayer().getAbilities().instabuild)); // Paper;
}
/** @deprecated */
@@ -800,6 +800,12 @@ public abstract class BlockBehaviour implements FeatureElement {
return ((Block) this.owner).builtInRegistryHolder();
@@ -891,6 +891,12 @@ public abstract class BlockBehaviour implements FeatureElement {
return this.legacySolid;
}
+ // Paper start
@ -137,20 +137,20 @@ index 7cc6dcb128f2792fc32bb8f50e4c94d600255207..b245b3912a4e2f4e83872c29c5a96027
+ }
+ // Paper end
+
public Material getMaterial() {
return this.material;
public boolean isValidSpawn(BlockGetter world, BlockPos pos, EntityType<?> type) {
return this.getBlock().properties.isValidSpawn.test(this.asState(), world, pos, type);
}
@@ -897,7 +903,7 @@ public abstract class BlockBehaviour implements FeatureElement {
@@ -994,7 +1000,7 @@ public abstract class BlockBehaviour implements FeatureElement {
}
public PushReaction getPistonPushReaction() {
- return this.getBlock().getPistonPushReaction(this.asState());
+ return !isDestroyable() ? PushReaction.BLOCK : this.getBlock().getPistonPushReaction(this.asState()); // Paper
- return this.pushReaction;
+ return !this.isDestroyable() ? PushReaction.BLOCK : this.pushReaction; // Paper
}
public boolean isSolidRender(BlockGetter world, BlockPos pos) {
diff --git a/src/main/java/net/minecraft/world/level/portal/PortalForcer.java b/src/main/java/net/minecraft/world/level/portal/PortalForcer.java
index d1c7eba29c64a6dbf55d3062ced9769eecb548ed..faaf50cb9bce254aef554ed8b402b145532e12a4 100644
index 389b63605d416678d35666bbd46e0fa05a02f898..33a6fda1e8f2df61b44f0e3ddda356ffa386f2df 100644
--- a/src/main/java/net/minecraft/world/level/portal/PortalForcer.java
+++ b/src/main/java/net/minecraft/world/level/portal/PortalForcer.java
@@ -221,6 +221,13 @@ public class PortalForcer {
@ -164,6 +164,6 @@ index d1c7eba29c64a6dbf55d3062ced9769eecb548ed..faaf50cb9bce254aef554ed8b402b145
+ }
+ }
+ // Paper end - prevent destroying unbreakable blocks
if (k < 0 && !this.level.getBlockState(temp).getMaterial().isSolid()) {
if (k < 0 && !this.level.getBlockState(temp).isSolid()) {
return false;
}

View File

@ -18,10 +18,10 @@ index 05ac41e136da43284fb24a6b698ebd36318278fb..5ca3ad7b3d7606accd0a58b3c708fadb
@VisibleForTesting
static long encode(double value) {
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index f2bdb647f137a1334789dc56e517844b74d70bd9..1c638f65d33e5890a7a32bf7e89d484ae2afc093 100644
index 3616f106b8bd5824700bfb67678599e6e1eca712..b312094bc88cd981fb424c244896c4c1d6454698 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -1350,9 +1350,13 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1877,9 +1877,13 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
public void updatePlayer(ServerPlayer player) {
org.spigotmc.AsyncCatcher.catchOp("player tracker update"); // Spigot
if (player != this.entity) {
@ -31,17 +31,17 @@ index f2bdb647f137a1334789dc56e517844b74d70bd9..1c638f65d33e5890a7a32bf7e89d484a
+ double vec3d_dx = player.getX() - this.entity.getX();
+ double vec3d_dz = player.getZ() - this.entity.getZ();
+ // Paper end - remove allocation of Vec3D here
double d0 = (double) Math.min(this.getEffectiveRange(), io.papermc.paper.chunk.PlayerChunkLoader.getSendViewDistance(player) * 16); // Paper - per player view distance
double d0 = (double) Math.min(this.getEffectiveRange(), ChunkMap.this.viewDistance * 16);
- double d1 = vec3d.x * vec3d.x + vec3d.z * vec3d.z;
+ double d1 = vec3d_dx * vec3d_dx + vec3d_dz * vec3d_dz; // Paper
double d2 = d0 * d0;
boolean flag = d1 <= d2 && this.entity.broadcastToPlayer(player);
diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java
index b3bc4af0b0be7223318e945c6eee4fe042523934..d4696783f5adaee5f4350dfe5da8d6b85cf07f7e 100644
index 5ec480397fb043717c63961651f7c62440e57201..3f3c7ced3a43e2b0eb451930c09188e3706a1bee 100644
--- a/src/main/java/net/minecraft/server/level/ServerEntity.java
+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java
@@ -165,7 +165,13 @@ public class ServerEntity {
@@ -161,7 +161,13 @@ public class ServerEntity {
i = Mth.floor(this.entity.getYRot() * 256.0F / 360.0F);
j = Mth.floor(this.entity.getXRot() * 256.0F / 360.0F);
Vec3 vec3d = this.entity.trackingPosition();

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Ensure safe gateway teleport
diff --git a/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java
index c7de74b7fcfb5f4d8adbe7e703087a03d9d9056d..c73024cc62490c336ffe26313580e88d25ca7078 100644
index 11f9b40d0cfb77d69ecd2c7ef71dc409d1d79eba..d9baa85962236c42219cf09d4f3129be93ff069c 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java
@@ -106,7 +106,14 @@ public class TheEndGatewayBlockEntity extends TheEndPortalBlockEntity {

View File

@ -6,10 +6,10 @@ Subject: [PATCH] Fix villager trading demand - MC-163962
Prevent demand from going negative and tending to negative infinity
diff --git a/src/main/java/net/minecraft/world/item/trading/MerchantOffer.java b/src/main/java/net/minecraft/world/item/trading/MerchantOffer.java
index f6fe6c39a8b11f4902e49e85db501808331392a2..8de9ea7928b272bbaf9c49940a8079f2499c8ee1 100644
index 67f34a1670cb51a3d2aca3140800ad9b92533d84..dc5908374565dd3080679779cbfe7620a4810015 100644
--- a/src/main/java/net/minecraft/world/item/trading/MerchantOffer.java
+++ b/src/main/java/net/minecraft/world/item/trading/MerchantOffer.java
@@ -113,7 +113,7 @@ public class MerchantOffer {
@@ -115,7 +115,7 @@ public class MerchantOffer {
}
public void updateDemand() {

View File

@ -15,13 +15,13 @@ Previously maps would load all chunks in a certain radius depending on
five ticks that movement occur in anyways.
diff --git a/src/main/java/net/minecraft/world/item/MapItem.java b/src/main/java/net/minecraft/world/item/MapItem.java
index 0c4b4c8b770ea0adb1a8346ea2cda96570687bea..e58ba9c46e6de59b55c6471a44e1a5f158e70e07 100644
index 9b55b04ab2769c6089d16a9c7bc61ca41683559f..7a5e5fa67ed5625cfbe74ba8ea8810095100e836 100644
--- a/src/main/java/net/minecraft/world/item/MapItem.java
+++ b/src/main/java/net/minecraft/world/item/MapItem.java
@@ -134,9 +134,9 @@ public class MapItem extends ComplexItem {
int j2 = (j / i + k1 - 64) * i;
int k2 = (k / i + l1 - 64) * i;
Multiset<MaterialColor> multiset = LinkedHashMultiset.create();
Multiset<MapColor> multiset = LinkedHashMultiset.create();
- LevelChunk chunk = world.getChunk(SectionPos.blockToSectionCoord(j2), SectionPos.blockToSectionCoord(k2));
+ LevelChunk chunk = world.getChunkIfLoaded(SectionPos.blockToSectionCoord(j2), SectionPos.blockToSectionCoord(k2)); // Paper - Maps shouldn't load chunks

View File

@ -6,7 +6,7 @@ Subject: [PATCH] Use seed based lookup for Treasure Maps - Fixes lag from
diff --git a/src/main/java/net/minecraft/world/item/MapItem.java b/src/main/java/net/minecraft/world/item/MapItem.java
index e58ba9c46e6de59b55c6471a44e1a5f158e70e07..f883e1bc4150bc074f1d8363a95b4eae16f3828e 100644
index 7a5e5fa67ed5625cfbe74ba8ea8810095100e836..75b110c6fb685390306fe3b8504aeea9bd6deedd 100644
--- a/src/main/java/net/minecraft/world/item/MapItem.java
+++ b/src/main/java/net/minecraft/world/item/MapItem.java
@@ -250,14 +250,13 @@ public class MapItem extends ComplexItem {