some work

This commit is contained in:
Jake Potrebic 2023-09-21 15:01:00 -07:00
parent c60dd35989
commit a27262375c
No known key found for this signature in database
GPG Key ID: ECE0B3C133C016C5
79 changed files with 311 additions and 304 deletions

View File

@ -2152,7 +2152,7 @@ index 762a9392ffac3042356709dddd15bb3516048bed..3544e2dc2522e9d6305d727d56e73490
buf.writeComponent(this.footer);
}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 2a7c614df7b9c9405a5dd23e6a888ede7fc86683..b50489d7d506e0ae3e61a8d47b04cc54f95c35db 100644
index 2a7c614df7b9c9405a5dd23e6a888ede7fc86683..794ab78d91cb54008679aecbc8f01edaa6501cab 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -190,6 +190,7 @@ import org.bukkit.craftbukkit.SpigotTimings; // Spigot
@ -2212,7 +2212,7 @@ index 2a7c614df7b9c9405a5dd23e6a888ede7fc86683..b50489d7d506e0ae3e61a8d47b04cc54
this.motd = motd;
}
@@ -2338,27 +2349,28 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -2338,23 +2349,28 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
public void logChatMessage(Component message, ChatType.Bound params, @Nullable String prefix) {
@ -2239,10 +2239,6 @@ index 2a7c614df7b9c9405a5dd23e6a888ede7fc86683..b50489d7d506e0ae3e61a8d47b04cc54
public ChatDecorator getChatDecorator() {
- return ChatDecorator.PLAIN;
- }
-
- public boolean logIPs() {
- return true;
+ // Paper start - moved to ChatPreviewProcessor
+ return ChatDecorator.create((sender, commandSourceStack, message) -> {
+ final io.papermc.paper.adventure.ChatDecorationProcessor processor = new io.papermc.paper.adventure.ChatDecorationProcessor(this, sender, commandSourceStack, message);
@ -2251,7 +2247,7 @@ index 2a7c614df7b9c9405a5dd23e6a888ede7fc86683..b50489d7d506e0ae3e61a8d47b04cc54
+ // Paper end
}
public static record ReloadableResources(CloseableResourceManager resourceManager, ReloadableServerResources managers) implements AutoCloseable {
public boolean logIPs() {
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 084339c7da80ce21ab8405e20b76af87dbbbe8ce..b944cda955c5660d3a9b84e9c92c2b19337a027a 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java

View File

@ -732,7 +732,7 @@ index 6f1501e13e29ce25919c23213df53248c4b454d7..047fc7206131e0f36ab45d04e98b7a23
} catch (Exception exception) {
if (exception instanceof ReportedException) {
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index b50489d7d506e0ae3e61a8d47b04cc54f95c35db..bacb6e1f1e4faa95490bf5d6d977e9d73bdacef5 100644
index 794ab78d91cb54008679aecbc8f01edaa6501cab..0eb3a55cbf2ed2c3f5e809ee60aba3767f7aa01b 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -185,7 +185,7 @@ import org.bukkit.craftbukkit.Main;

View File

@ -6,7 +6,7 @@ Subject: [PATCH] Show 'Paper' in client crashes, server lists, and Mojang
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index bacb6e1f1e4faa95490bf5d6d977e9d73bdacef5..9f17f3aa637c9babcf876ca92a668e3ed19c92ed 100644
index 0eb3a55cbf2ed2c3f5e809ee60aba3767f7aa01b..38896d1beb8adce59d62c6aeefb86ef8fb69ce40 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1463,7 +1463,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa

View File

@ -12,7 +12,7 @@ Previous implementation did not calculate TPS correctly.
Switch to a realistic rolling average and factor in std deviation as an extra reporting variable
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 9f17f3aa637c9babcf876ca92a668e3ed19c92ed..baf17f4fd1c3901b5f2c57c197721df7cf6e51cb 100644
index 38896d1beb8adce59d62c6aeefb86ef8fb69ce40..c8f952998cfa35e043796a88acf555a34ba979c3 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -277,7 +277,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa

View File

@ -10,7 +10,7 @@ This patch adds a per-tick cache that is used for storing and retrieving
an entity's exposure during an explosion.
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index baf17f4fd1c3901b5f2c57c197721df7cf6e51cb..d57ac9e0b58ae30ade85c07a6d5d8af922ffea24 100644
index c8f952998cfa35e043796a88acf555a34ba979c3..4eb9d3a3de91a7af2930f7e014256eeeafcb4ac7 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1396,6 +1396,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa

View File

@ -6,7 +6,7 @@ Subject: [PATCH] Only process BlockPhysicsEvent if a plugin has a listener
Saves on some object allocation and processing when no plugin listens to this
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index d57ac9e0b58ae30ade85c07a6d5d8af922ffea24..0f2fad44d1ab2188f79839bb13e3988a2847520f 100644
index 4eb9d3a3de91a7af2930f7e014256eeeafcb4ac7..19cb043e5c501b664d101b11717b759be9dd4cfd 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1357,6 +1357,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa

View File

@ -18,7 +18,7 @@ index 1294b38262505b0d54089e428df9b363219de1f0..ee37ec0de1ca969144824427ae42b0c8
buf.writeComponent(this.playerPrefix);
buf.writeComponent(this.playerSuffix);
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 0f2fad44d1ab2188f79839bb13e3988a2847520f..9855ea8c2a13950782b07915bd2ffe68404d571e 100644
index 19cb043e5c501b664d101b11717b759be9dd4cfd..c667cf1564011a922f208e671ff293485324b5cd 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -575,6 +575,20 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa

View File

@ -6,7 +6,7 @@ Subject: [PATCH] remove null possibility for getServer singleton
to stop IDE complaining about potential NPE
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 9855ea8c2a13950782b07915bd2ffe68404d571e..f5483f4d2c0339b505bd4a6512b23be2af79d9f7 100644
index c667cf1564011a922f208e671ff293485324b5cd..c6802d54fcd594f2fc7bd8615f8a95e5cfe9e1c0 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -189,6 +189,7 @@ import co.aikar.timings.MinecraftTimings; // Paper

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Async GameProfileCache saving
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index f5483f4d2c0339b505bd4a6512b23be2af79d9f7..6ab95b11eafe69ed0fd584e87ac0f0bb176ce180 100644
index c6802d54fcd594f2fc7bd8615f8a95e5cfe9e1c0..8ef6e39e4711d2147e5ad97e9f8028e005588ac5 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -933,7 +933,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa

View File

@ -30,7 +30,7 @@ will have plugins and worlds saving to the disk has a high potential to result
in corruption/dataloss.
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 6ab95b11eafe69ed0fd584e87ac0f0bb176ce180..834c60f1e85995c487f59f6504e96385d5d0ff27 100644
index 8ef6e39e4711d2147e5ad97e9f8028e005588ac5..8a3a8b8ccbf3b5e3b41f33c8b5c6a0834e547131 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -233,6 +233,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa

View File

@ -252,7 +252,7 @@ index c3631efda9c7fa531a8a9f18fbee7b5f8655382b..769f6489632302627fa1730cc08e77f5
}
}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 834c60f1e85995c487f59f6504e96385d5d0ff27..440d1db090dfa62843124cec802224553aad51c0 100644
index 8a3a8b8ccbf3b5e3b41f33c8b5c6a0834e547131..a654f345f55493816c239f296864c9f75ee5247a 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -164,7 +164,7 @@ import com.mojang.datafixers.util.Pair;

View File

@ -181,7 +181,7 @@ index 0000000000000000000000000000000000000000..6b0bdc266109cdfb874f08bf74323603
+
+}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 440d1db090dfa62843124cec802224553aad51c0..59864c92d6371e6dbd6afa11aee5f8ad0689379d 100644
index a654f345f55493816c239f296864c9f75ee5247a..76728fd630e103e8e3431c6b54ef944cb62b33fd 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -3,6 +3,9 @@ package net.minecraft.server;

View File

@ -28,18 +28,18 @@ respond to the request.
[2]: https://netty.io/wiki/user-guide-for-4.x.html#wiki-h4-13
diff --git a/src/main/java/net/minecraft/server/network/LegacyQueryHandler.java b/src/main/java/net/minecraft/server/network/LegacyQueryHandler.java
index 5518a0efb65190732c88ca18a0bdf35316b8687c..d3311d1d4a5f7535f07116865ef0701d82bcbcbd 100644
index 33e3a81f8ec18f0ba7170d885c4717640bf40eab..738da83f82bf01bde94c956ac22525a638db3906 100644
--- a/src/main/java/net/minecraft/server/network/LegacyQueryHandler.java
+++ b/src/main/java/net/minecraft/server/network/LegacyQueryHandler.java
@@ -17,6 +17,7 @@ public class LegacyQueryHandler extends ChannelInboundHandlerAdapter {
@@ -15,6 +15,7 @@ public class LegacyQueryHandler extends ChannelInboundHandlerAdapter {
private static final Logger LOGGER = LogUtils.getLogger();
public static final int FAKE_PROTOCOL_VERSION = 127;
private final ServerConnectionListener serverConnectionListener;
private final ServerInfo server;
+ private ByteBuf buf; // Paper
public LegacyQueryHandler(ServerConnectionListener networkIo) {
this.serverConnectionListener = networkIo;
@@ -25,6 +26,16 @@ public class LegacyQueryHandler extends ChannelInboundHandlerAdapter {
public LegacyQueryHandler(ServerInfo server) {
this.server = server;
@@ -23,6 +24,16 @@ public class LegacyQueryHandler extends ChannelInboundHandlerAdapter {
public void channelRead(ChannelHandlerContext channelhandlercontext, Object object) {
ByteBuf bytebuf = (ByteBuf) object;
@ -56,27 +56,47 @@ index 5518a0efb65190732c88ca18a0bdf35316b8687c..d3311d1d4a5f7535f07116865ef0701d
bytebuf.markReaderIndex();
boolean flag = true;
@@ -55,6 +66,10 @@ public class LegacyQueryHandler extends ChannelInboundHandlerAdapter {
this.sendFlushAndClose(channelhandlercontext, this.createReply(s));
break;
default:
+ // Paper start - Replace with improved version below
+ if (bytebuf.readUnsignedByte() != 0x01 || bytebuf.readUnsignedByte() != 0xFA) return;
+ readLegacy1_6(channelhandlercontext, bytebuf);
+ /*
boolean flag1 = bytebuf.readUnsignedByte() == 1;
@@ -34,7 +45,7 @@ public class LegacyQueryHandler extends ChannelInboundHandlerAdapter {
flag1 &= bytebuf.readUnsignedByte() == 250;
@@ -78,6 +93,7 @@ public class LegacyQueryHandler extends ChannelInboundHandlerAdapter {
} finally {
bytebuf1.release();
SocketAddress socketaddress = channelhandlercontext.channel().remoteAddress();
int i = bytebuf.readableBytes();
- String s;
+ String s = null; // Paper
org.bukkit.event.server.ServerListPingEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callServerListPingEvent(socketaddress, this.server.getMotd(), this.server.getPlayerCount(), this.server.getMaxPlayers()); // CraftBukkit
if (i == 0) {
@@ -47,16 +58,24 @@ public class LegacyQueryHandler extends ChannelInboundHandlerAdapter {
}
+ */ // Paper end - Replace with improved version below
}
bytebuf.release();
@@ -95,6 +111,90 @@ public class LegacyQueryHandler extends ChannelInboundHandlerAdapter {
if (bytebuf.isReadable()) {
- if (!LegacyQueryHandler.readCustomPayloadPacket(bytebuf)) {
- return;
+ // Paper start - Replace with improved version below
+ if (bytebuf.readUnsignedByte() != 250) {
+ s = this.readLegacy1_6(channelhandlercontext, bytebuf);
+ if (s == null) {
+ return;
+ }
}
-
- LegacyQueryHandler.LOGGER.debug("Ping: (1.6) from {}", socketaddress);
+ // if (!LegacyQueryHandler.readCustomPayloadPacket(bytebuf)) {
+ // return;
+ // }
+ //
+ // LegacyQueryHandler.LOGGER.debug("Ping: (1.6) from {}", socketaddress);
+ // Paper end
} else {
LegacyQueryHandler.LOGGER.debug("Ping: (1.4-1.5.x) from {}", socketaddress);
}
- s = LegacyQueryHandler.createVersion1Response(this.server, event); // CraftBukkit
+ if (s == null) s = LegacyQueryHandler.createVersion1Response(this.server, event); // CraftBukkit // Paper
LegacyQueryHandler.sendFlushAndClose(channelhandlercontext, LegacyQueryHandler.createLegacyDisconnectPacket(channelhandlercontext.alloc(), s));
}
@@ -107,6 +126,90 @@ public class LegacyQueryHandler extends ChannelInboundHandlerAdapter {
}
}
+ // Paper start
@ -86,12 +106,12 @@ index 5518a0efb65190732c88ca18a0bdf35316b8687c..d3311d1d4a5f7535f07116865ef0701d
+ return null;
+ }
+
+ String result = buf.toString(buf.readerIndex(), size, StandardCharsets.UTF_16BE);
+ String result = buf.toString(buf.readerIndex(), size, java.nio.charset.StandardCharsets.UTF_16BE);
+ buf.skipBytes(size); // toString doesn't increase readerIndex automatically
+ return result;
+ }
+
+ private void readLegacy1_6(ChannelHandlerContext ctx, ByteBuf part) {
+ private String readLegacy1_6(ChannelHandlerContext ctx, ByteBuf part) {
+ ByteBuf buf = this.buf;
+
+ if (buf == null) {
@ -104,35 +124,35 @@ index 5518a0efb65190732c88ca18a0bdf35316b8687c..d3311d1d4a5f7535f07116865ef0701d
+ buf.writeBytes(part);
+
+ if (!buf.isReadable(Short.BYTES + Short.BYTES + Byte.BYTES + Short.BYTES + Integer.BYTES)) {
+ return;
+ return null;
+ }
+
+ String s = readLegacyString(buf);
+ if (s == null) {
+ return;
+ return null;
+ }
+
+ if (!s.equals("MC|PingHost")) {
+ removeHandler(ctx);
+ return;
+ return null;
+ }
+
+ if (!buf.isReadable(Short.BYTES) || !buf.isReadable(buf.readShort())) {
+ return;
+ return null;
+ }
+
+ MinecraftServer server = this.serverConnectionListener.getServer();
+ net.minecraft.server.MinecraftServer server = net.minecraft.server.MinecraftServer.getServer();
+ int protocolVersion = buf.readByte();
+ String host = readLegacyString(buf);
+ if (host == null) {
+ removeHandler(ctx);
+ return;
+ return null;
+ }
+ int port = buf.readInt();
+
+ if (buf.isReadable()) {
+ removeHandler(ctx);
+ return;
+ return null;
+ }
+
+ buf.release();
@ -141,8 +161,8 @@ index 5518a0efb65190732c88ca18a0bdf35316b8687c..d3311d1d4a5f7535f07116865ef0701d
+ LOGGER.debug("Ping: (1.6) from {}", ctx.channel().remoteAddress());
+
+ String response = String.format("\u00a71\u0000%d\u0000%s\u0000%s\u0000%d\u0000%d",
+ Byte.MAX_VALUE, server.getServerVersion(), server.getMotd(), server.getPlayerCount(), server.getMaxPlayers());
+ this.sendFlushAndClose(ctx, this.createReply(response));
+ Byte.MAX_VALUE, server.getServerVersion(), server.getMotd(), server.getPlayerCount(), server.getMaxPlayers());
+ return response;
+ }
+
+ private void removeHandler(ChannelHandlerContext ctx) {
@ -163,6 +183,6 @@ index 5518a0efb65190732c88ca18a0bdf35316b8687c..d3311d1d4a5f7535f07116865ef0701d
+ }
+ // Paper end
+
private void sendFlushAndClose(ChannelHandlerContext ctx, ByteBuf buf) {
ctx.pipeline().firstContext().writeAndFlush(buf).addListener(ChannelFutureListener.CLOSE);
}
// CraftBukkit start
private static String createVersion0Response(ServerInfo serverinfo, org.bukkit.event.server.ServerListPingEvent event) {
return String.format(Locale.ROOT, "%s\u00a7%d\u00a7%d", event.getMotd(), event.getNumPlayers(), event.getMaxPlayers());

View File

@ -86,65 +86,70 @@ index 0000000000000000000000000000000000000000..cc54b1c207981235b5160e8773b27cf9
+
+}
diff --git a/src/main/java/net/minecraft/server/network/LegacyQueryHandler.java b/src/main/java/net/minecraft/server/network/LegacyQueryHandler.java
index d3311d1d4a5f7535f07116865ef0701d82bcbcbd..21393ad40095a4049e5b6871169b2db7aa92d13c 100644
index 738da83f82bf01bde94c956ac22525a638db3906..d4f5a98a0b1ca9f2a8baa6e0b27353df94d1f333 100644
--- a/src/main/java/net/minecraft/server/network/LegacyQueryHandler.java
+++ b/src/main/java/net/minecraft/server/network/LegacyQueryHandler.java
@@ -48,13 +48,21 @@ public class LegacyQueryHandler extends ChannelInboundHandlerAdapter {
MinecraftServer minecraftserver = this.serverConnectionListener.getServer();
int i = bytebuf.readableBytes();
String s;
- org.bukkit.event.server.ServerListPingEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callServerListPingEvent(minecraftserver.server, inetsocketaddress.getAddress(), minecraftserver.getMotd(), minecraftserver.getPlayerCount(), minecraftserver.getMaxPlayers()); // CraftBukkit
+ //org.bukkit.event.server.ServerListPingEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callServerListPingEvent(minecraftserver.server, inetsocketaddress.getAddress(), minecraftserver.getMotd(), minecraftserver.getPlayerCount(), minecraftserver.getMaxPlayers()); // CraftBukkit // Paper
+ com.destroystokyo.paper.event.server.PaperServerListPingEvent event; // Paper
@@ -46,11 +46,22 @@ public class LegacyQueryHandler extends ChannelInboundHandlerAdapter {
SocketAddress socketaddress = channelhandlercontext.channel().remoteAddress();
int i = bytebuf.readableBytes();
String s = null; // Paper
- org.bukkit.event.server.ServerListPingEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callServerListPingEvent(socketaddress, this.server.getMotd(), this.server.getPlayerCount(), this.server.getMaxPlayers()); // CraftBukkit
+ // org.bukkit.event.server.ServerListPingEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callServerListPingEvent(socketaddress, this.server.getMotd(), this.server.getPlayerCount(), this.server.getMaxPlayers()); // CraftBukkit // Paper
+ com.destroystokyo.paper.event.server.PaperServerListPingEvent event; // Paper
switch (i) {
case 0:
LegacyQueryHandler.LOGGER.debug("Ping: (<1.3.x) from {}:{}", inetsocketaddress.getAddress(), inetsocketaddress.getPort());
- s = String.format(Locale.ROOT, "%s\u00a7%d\u00a7%d", event.getMotd(), event.getNumPlayers(), event.getMaxPlayers()); // CraftBukkit
if (i == 0) {
LegacyQueryHandler.LOGGER.debug("Ping: (<1.3.x) from {}", socketaddress);
- s = LegacyQueryHandler.createVersion0Response(this.server, event); // CraftBukkit
+
+ // Paper start - Call PaperServerListPingEvent and use results
+ event = com.destroystokyo.paper.network.PaperLegacyStatusClient.processRequest(minecraftserver, inetsocketaddress, 39, null);
+ event = com.destroystokyo.paper.network.PaperLegacyStatusClient.processRequest(net.minecraft.server.MinecraftServer.getServer(), (java.net.InetSocketAddress) socketaddress, 39, null);
+ if (event == null) {
+ channelhandlercontext.close();
+ break;
+ bytebuf.release();
+ flag = false;
+ return;
+ }
+ s = String.format(Locale.ROOT, "%s\u00a7%d\u00a7%d", com.destroystokyo.paper.network.PaperLegacyStatusClient.getUnformattedMotd(event), event.getNumPlayers(), event.getMaxPlayers());
this.sendFlushAndClose(channelhandlercontext, this.createReply(s));
+ // Paper end
break;
case 1:
LegacyQueryHandler.sendFlushAndClose(channelhandlercontext, LegacyQueryHandler.createLegacyDisconnectPacket(channelhandlercontext.alloc(), s));
} else {
if (bytebuf.readUnsignedByte() != 1) {
@@ -62,7 +70,14 @@ public class LegacyQueryHandler extends ChannelInboundHandlerAdapter {
@@ -75,7 +86,18 @@ public class LegacyQueryHandler extends ChannelInboundHandlerAdapter {
LegacyQueryHandler.LOGGER.debug("Ping: (1.4-1.5.x) from {}", socketaddress);
}
LegacyQueryHandler.LOGGER.debug("Ping: (1.4-1.5.x) from {}:{}", inetsocketaddress.getAddress(), inetsocketaddress.getPort());
- s = String.format(Locale.ROOT, "\u00a71\u0000%d\u0000%s\u0000%s\u0000%d\u0000%d", 127, minecraftserver.getServerVersion(), event.getMotd(), event.getNumPlayers(), event.getMaxPlayers()); // CraftBukkit
+ // Paper start - Call PaperServerListPingEvent and use results
+ event = com.destroystokyo.paper.network.PaperLegacyStatusClient.processRequest(minecraftserver, inetsocketaddress, 127, null); // Paper
+ if (event == null) {
+ channelhandlercontext.close();
+ break;
- if (s == null) s = LegacyQueryHandler.createVersion1Response(this.server, event); // CraftBukkit // Paper
+ if (s == null) {
+ // Paper start - Call PaperServerListPingEvent and use results
+ event = com.destroystokyo.paper.network.PaperLegacyStatusClient.processRequest(net.minecraft.server.MinecraftServer.getServer(), (java.net.InetSocketAddress) socketaddress, 127, null); // Paper
+ if (event == null) {
+ channelhandlercontext.close();
+ bytebuf.release();
+ flag = false;
+ return;
+ }
+ s = String.format(Locale.ROOT, "\u00a71\u0000%d\u0000%s\u0000%s\u0000%d\u0000%d", new Object[] { event.getProtocolVersion(), this.server.getServerVersion(), event.getMotd(), event.getNumPlayers(), event.getMaxPlayers()}); // CraftBukkit
+ // Paper end
+ }
+ s = String.format(Locale.ROOT, "\u00a71\u0000%d\u0000%s\u0000%s\u0000%d\u0000%d", new Object[] { event.getProtocolVersion(), minecraftserver.getServerVersion(), event.getMotd(), event.getNumPlayers(), event.getMaxPlayers()}); // CraftBukkit
+ // Paper end
this.sendFlushAndClose(channelhandlercontext, this.createReply(s));
break;
default:
@@ -172,8 +187,16 @@ public class LegacyQueryHandler extends ChannelInboundHandlerAdapter {
LegacyQueryHandler.sendFlushAndClose(channelhandlercontext, LegacyQueryHandler.createLegacyDisconnectPacket(channelhandlercontext.alloc(), s));
}
@@ -187,8 +209,16 @@ public class LegacyQueryHandler extends ChannelInboundHandlerAdapter {
LOGGER.debug("Ping: (1.6) from {}", ctx.channel().remoteAddress());
- String response = String.format("\u00a71\u0000%d\u0000%s\u0000%s\u0000%d\u0000%d",
- Byte.MAX_VALUE, server.getServerVersion(), server.getMotd(), server.getPlayerCount(), server.getMaxPlayers());
+ InetSocketAddress virtualHost = com.destroystokyo.paper.network.PaperNetworkClient.prepareVirtualHost(host, port);
- Byte.MAX_VALUE, server.getServerVersion(), server.getMotd(), server.getPlayerCount(), server.getMaxPlayers());
+ java.net.InetSocketAddress virtualHost = com.destroystokyo.paper.network.PaperNetworkClient.prepareVirtualHost(host, port);
+ com.destroystokyo.paper.event.server.PaperServerListPingEvent event = com.destroystokyo.paper.network.PaperLegacyStatusClient.processRequest(
+ server, (InetSocketAddress) ctx.channel().remoteAddress(), protocolVersion, virtualHost);
+ server, (java.net.InetSocketAddress) ctx.channel().remoteAddress(), protocolVersion, virtualHost);
+ if (event == null) {
+ ctx.close();
+ return;
+ return null;
+ }
+
+ String response = String.format("\u00a71\u0000%d\u0000%s\u0000%s\u0000%d\u0000%d", event.getProtocolVersion(), event.getVersion(),
+ com.destroystokyo.paper.network.PaperLegacyStatusClient.getMotd(event), event.getNumPlayers(), event.getMaxPlayers());
this.sendFlushAndClose(ctx, this.createReply(response));
return response;
}

View File

@ -9,10 +9,10 @@ e.g. servers which allow and support the usage of mod packs.
provide an optional flag to disable this check, at your own risk.
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index c48205d83eff82decf73724a315d2a9265d197e4..0868e977d356a1e3b5c49c9c788d8e3d0cb85c84 100644
index df3baed35f408e2098f6c98522aed8017d61f489..380c1c32a2f404b2e6b801f5ebeccae54d9395fa 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -192,6 +192,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -194,6 +194,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
// Paper start
private org.bukkit.event.player.PlayerResourcePackStatusEvent.Status resourcePackStatus;
private String resourcePackHash;
@ -20,7 +20,7 @@ index c48205d83eff82decf73724a315d2a9265d197e4..0868e977d356a1e3b5c49c9c788d8e3d
// Paper end
public CraftPlayer(CraftServer server, ServerPlayer entity) {
@@ -2078,7 +2079,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -2052,7 +2053,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
// Paper end
public void addChannel(String channel) {

View File

@ -5,13 +5,13 @@ Subject: [PATCH] Add openSign method to HumanEntity
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
index 2f5704b19148f390402c0823030806ba96860286..74f1af3dccddf52965e5c91277be3592649e8cfa 100644
index c40b3b8ff02c0e21fab53f6749f9c72b7e3c48a1..e5b2686e466a2604ebcdb6e5c3b6fb7ff7bc6eec 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
@@ -626,6 +626,12 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
}
}
+ // Paper start - move open sign method to HumanEntity
+ @Override
+ public void openSign(final org.bukkit.block.Sign sign, final org.bukkit.block.sign.Side side) {

View File

@ -6,12 +6,12 @@ Subject: [PATCH] Configurable sprint interruption on attack
If the sprint interruption is disabled players continue sprinting when they attack entities.
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
index a668a62da9fb7fc013f078c030580b13a62db3ca..10dd06a23b34b7c8515c9ccc3988a9e8182c460d 100644
index dabd68122861d673fc70cb1c66d24cb176129965..4a3c6a583672179d4dd81726ef87d9d584dd139d 100644
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
@@ -1290,7 +1290,11 @@ public abstract class Player extends LivingEntity {
@@ -1296,7 +1296,11 @@ public abstract class Player extends LivingEntity {
}
this.setDeltaMovement(this.getDeltaMovement().multiply(0.6D, 1.0D, 0.6D));
- this.setSprinting(false);
+ // Paper start - Configuration option to disable automatic sprint interruption
@ -20,5 +20,5 @@ index a668a62da9fb7fc013f078c030580b13a62db3ca..10dd06a23b34b7c8515c9ccc3988a9e8
+ }
+ // Paper end
}
if (flag3) {

View File

@ -8,13 +8,13 @@ Fires an event anytime an enderman intends to teleport away from the player
You may cancel this, enabling ranged attacks to damage the enderman for example.
diff --git a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java b/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
index 084a9bb8ca0ec57fad1efbc540e4b58eacb61970..d2dd4537f8a81d02a4d3570834549d7e27b749b9 100644
index 3a5cf39c59fd14db865341f551bb67c9dc869ffd..1dea327e8df8651940f204bb96f56a8f6294aaed 100644
--- a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
+++ b/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
@@ -122,6 +122,12 @@ public class EnderMan extends Monster implements NeutralMob {
@@ -124,6 +124,12 @@ public class EnderMan extends Monster implements NeutralMob {
this.setTarget(target, EntityTargetEvent.TargetReason.UNKNOWN, true);
}
+ // Paper start
+ private boolean tryEscape(com.destroystokyo.paper.event.entity.EndermanEscapeEvent.Reason reason) {
+ return new com.destroystokyo.paper.event.entity.EndermanEscapeEvent((org.bukkit.craftbukkit.entity.CraftEnderman) this.getBukkitEntity(), reason).callEvent();
@ -24,19 +24,19 @@ index 084a9bb8ca0ec57fad1efbc540e4b58eacb61970..d2dd4537f8a81d02a4d3570834549d7e
@Override
public boolean setTarget(LivingEntity entityliving, EntityTargetEvent.TargetReason reason, boolean fireEvent) {
if (!super.setTarget(entityliving, reason, fireEvent)) {
@@ -276,7 +282,7 @@ public class EnderMan extends Monster implements NeutralMob {
@@ -283,7 +289,7 @@ public class EnderMan extends Monster implements NeutralMob {
if (this.level().isDay() && this.tickCount >= this.targetChangeTime + 600) {
float f = this.getLightLevelDependentMagicValue();
- if (f > 0.5F && this.level().canSeeSky(this.blockPosition()) && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F) {
+ if (f > 0.5F && this.level().canSeeSky(this.blockPosition()) && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F && this.tryEscape(com.destroystokyo.paper.event.entity.EndermanEscapeEvent.Reason.RUNAWAY)) { // Paper
this.setTarget((LivingEntity) null);
this.teleport();
}
@@ -402,11 +408,13 @@ public class EnderMan extends Monster implements NeutralMob {
@@ -409,11 +415,13 @@ public class EnderMan extends Monster implements NeutralMob {
} else {
flag1 = flag && this.hurtWithCleanWater(source, (ThrownPotion) source.getDirectEntity(), amount);
+ if (this.tryEscape(com.destroystokyo.paper.event.entity.EndermanEscapeEvent.Reason.INDIRECT)) { // Paper start
for (int i = 0; i < 64; ++i) {
if (this.teleport()) {
@ -44,10 +44,10 @@ index 084a9bb8ca0ec57fad1efbc540e4b58eacb61970..d2dd4537f8a81d02a4d3570834549d7e
}
}
+ } // Paper end
return flag1;
}
@@ -633,7 +641,7 @@ public class EnderMan extends Monster implements NeutralMob {
@@ -640,7 +648,7 @@ public class EnderMan extends Monster implements NeutralMob {
} else {
if (this.target != null && !this.enderman.isPassenger()) {
if (this.enderman.isLookingAtMe((Player) this.target)) {
@ -55,4 +55,4 @@ index 084a9bb8ca0ec57fad1efbc540e4b58eacb61970..d2dd4537f8a81d02a4d3570834549d7e
+ if (this.target.distanceToSqr((Entity) this.enderman) < 16.0D && this.enderman.tryEscape(com.destroystokyo.paper.event.entity.EndermanEscapeEvent.Reason.STARE)) { // Paper
this.enderman.teleport();
}

View File

@ -12,7 +12,7 @@ index 0e13edd23016a6ffe6492de322e1d675137e3c9e..cb161c3d1a08d9c14320104001866429
@@ -17,6 +17,7 @@ public class CraftEnderman extends CraftMonster implements Enderman {
super(server, entity);
}
+ @Override public boolean teleportRandomly() { return getHandle().teleport(); } // Paper
@Override
public MaterialData getCarriedMaterial() {

View File

@ -16,11 +16,11 @@ public net.minecraft.world.entity.projectile.Projectile cachedOwner
public net.minecraft.world.entity.projectile.Projectile ownerUUID
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 17d9c5a6c357ac5e3eacd9e4d2cff9a05ec0f262..f2eefdeab44ad4f7c0abd0e55e688e74a83abfff 100644
index 303ce1ef47ae9aad137ee29f23b9084d08717cbb..024854ba480643b28c4334dbff0523fb3b023ba3 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -2327,6 +2327,12 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -2071,6 +2071,12 @@ public class ServerLevel extends Level implements WorldGenLevel {
public void onTickingEnd(Entity entity) {
ServerLevel.this.entityTickList.remove(entity);
+ // Paper start - Reset pearls when they stop being ticked
@ -30,7 +30,7 @@ index 17d9c5a6c357ac5e3eacd9e4d2cff9a05ec0f262..f2eefdeab44ad4f7c0abd0e55e688e74
+ }
+ // Paper end
}
public void onTrackingStart(Entity entity) {
diff --git a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
index b4a37d11e381d08c82945966ee5f969364f6e3ee..e9ae25a70c747c173ebd2e393818d205527d5314 100644
@ -42,5 +42,5 @@ index b4a37d11e381d08c82945966ee5f969364f6e3ee..e9ae25a70c747c173ebd2e393818d205
this.cachedOwner = null;
+ if (this instanceof ThrownEnderpearl && this.level() != null && this.level().paperConfig().fixes.disableUnloadedChunkEnderpearlExploit) { this.ownerUUID = null; } // Paper - Don't store shooter name for pearls to block enderpearl travel exploit
}
this.leftOwner = nbt.getBoolean("LeftOwner");

View File

@ -10,12 +10,12 @@ Adds an option to control the force mode of the particle.
This adds a new Builder API which is much friendlier to use.
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index f2eefdeab44ad4f7c0abd0e55e688e74a83abfff..68257f257dd3b167e237482c8d149590103896b2 100644
index 024854ba480643b28c4334dbff0523fb3b023ba3..9242f42ad622897721a86b5a443aa67619e52918 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1717,12 +1717,17 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -1485,12 +1485,17 @@ public class ServerLevel extends Level implements WorldGenLevel {
}
public <T extends ParticleOptions> int sendParticles(ServerPlayer sender, T t0, double d0, double d1, double d2, int i, double d3, double d4, double d5, double d6, boolean force) {
+ // Paper start - Particle API Expansion
+ return sendParticles(players, sender, t0, d0, d1, d2, i, d3, d4, d5, d6, force);
@ -25,20 +25,20 @@ index f2eefdeab44ad4f7c0abd0e55e688e74a83abfff..68257f257dd3b167e237482c8d149590
ClientboundLevelParticlesPacket packetplayoutworldparticles = new ClientboundLevelParticlesPacket(t0, force, d0, d1, d2, (float) d3, (float) d4, (float) d5, (float) d6, i);
// CraftBukkit end
int j = 0;
- for (int k = 0; k < this.players.size(); ++k) {
- ServerPlayer entityplayer = (ServerPlayer) this.players.get(k);
+ for (Player entityhuman : receivers) { // Paper - Particle API Expansion
+ ServerPlayer entityplayer = (ServerPlayer) entityhuman; // Paper - Particle API Expansion
if (sender != null && !entityplayer.getBukkitEntity().canSee(sender.getBukkitEntity())) continue; // CraftBukkit
if (this.sendParticles(entityplayer, force, d0, d1, d2, packetplayoutworldparticles)) { // CraftBukkit
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index d348ca56ae452dc80d5dabe874d9f8d72970fc4d..0476f00719d180d28a2a4bab3f4152b00a1e4e67 100644
index 9d79b31baea99d25218e9d3f27ab895d4f73ef8a..69cf1142c9d40f581f4d84ebc4d58e95c9a71ddc 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -1863,11 +1863,17 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@@ -1873,11 +1873,17 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@Override
public <T> void spawnParticle(Particle particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, double extra, T data, boolean force) {
- if (data != null) {

View File

@ -10,7 +10,7 @@ index 5bd28e1f475aeadaa626a4e9e9e2a1b3a28675f4..148ea4089c4f67894b28e21e961a661a
+++ b/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java
@@ -203,9 +203,9 @@ public class SignBlockEntity extends BlockEntity implements CommandSource { // C
Style chatmodifier = signtext.getMessage(i, entityhuman.isTextFilteringEnabled()).getStyle();
if (entityhuman.isTextFilteringEnabled()) {
- signtext = signtext.setMessage(i, Component.literal(filteredtext.filteredOrEmpty()).setStyle(chatmodifier));
+ signtext = signtext.setMessage(i, Component.literal(net.minecraft.SharedConstants.filterText(filteredtext.filteredOrEmpty())).setStyle(chatmodifier)); // Paper - filter sign text to chat only
@ -19,4 +19,4 @@ index 5bd28e1f475aeadaa626a4e9e9e2a1b3a28675f4..148ea4089c4f67894b28e21e961a661a
+ signtext = signtext.setMessage(i, Component.literal(net.minecraft.SharedConstants.filterText(filteredtext.raw())).setStyle(chatmodifier), Component.literal(net.minecraft.SharedConstants.filterText(filteredtext.filteredOrEmpty())).setStyle(chatmodifier)); // Paper - filter sign text to chat only
}
}

View File

@ -10,7 +10,7 @@ index 331b642c36af97f7f05bd63f96d42d1af443e5a3..a3af96b2518b41f370d09cfda26dc589
--- a/src/main/java/net/minecraft/world/level/block/FrostedIceBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/FrostedIceBlock.java
@@ -38,7 +38,8 @@ public class FrostedIceBlock extends IceBlock {
for(Direction direction : Direction.values()) {
mutableBlockPos.setWithOffset(pos, direction);
- BlockState blockState = world.getBlockState(mutableBlockPos);
@ -20,7 +20,7 @@ index 331b642c36af97f7f05bd63f96d42d1af443e5a3..a3af96b2518b41f370d09cfda26dc589
world.scheduleTick(mutableBlockPos, this, Mth.nextInt(random, world.paperConfig().environment.frostedIce.delay.min, world.paperConfig().environment.frostedIce.delay.max)); // Paper - use configurable min/max delay
}
@@ -75,7 +76,10 @@ public class FrostedIceBlock extends IceBlock {
for(Direction direction : Direction.values()) {
mutableBlockPos.setWithOffset(pos, direction);
- if (world.getBlockState(mutableBlockPos).is(this)) {

View File

@ -8,13 +8,13 @@ Allow control over whether or not an enderman aggros a player.
This allows you to override/extend the pumpkin/stare logic.
diff --git a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java b/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
index d2dd4537f8a81d02a4d3570834549d7e27b749b9..06a0a06f3f4ed20f151ddac35ae7d56852e191ae 100644
index 1dea327e8df8651940f204bb96f56a8f6294aaed..bf5b7b996c9141c7cef9c281323115bd593dc777 100644
--- a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
+++ b/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
@@ -234,7 +234,15 @@ public class EnderMan extends Monster implements NeutralMob {
@@ -236,7 +236,15 @@ public class EnderMan extends Monster implements NeutralMob {
this.readPersistentAngerSaveData(this.level(), nbt);
}
- boolean isLookingAtMe(Player player) {
+ // Paper start - EndermanAttackPlayerEvent
+ private boolean isLookingAtMe(Player player) {
@ -26,5 +26,5 @@ index d2dd4537f8a81d02a4d3570834549d7e27b749b9..06a0a06f3f4ed20f151ddac35ae7d568
+ private boolean isLookingAtMe_check(Player player) {
+ // Paper end
ItemStack itemstack = (ItemStack) player.getInventory().armor.get(3);
if (itemstack.is(Blocks.CARVED_PUMPKIN.asItem())) {

View File

@ -6,11 +6,11 @@ Subject: [PATCH] WitchConsumePotionEvent
Fires when a witch consumes the potion in their hand
diff --git a/src/main/java/net/minecraft/world/entity/monster/Witch.java b/src/main/java/net/minecraft/world/entity/monster/Witch.java
index 112c4f203e2c1e3b1e0259e687ee2293c0132953..6a6b8672e65212dc2a1d837563d623b8bce8da28 100644
index eeecb9057e039b4696ca4de1cd7191a95d17a1a6..a949e8546ecc2d6fd6690d8a00207dc187e2451a 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Witch.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Witch.java
@@ -124,7 +124,11 @@ public class Witch extends Raider implements RangedAttackMob {
@@ -126,7 +126,11 @@ public class Witch extends Raider implements RangedAttackMob {
this.setItemSlot(EquipmentSlot.MAINHAND, ItemStack.EMPTY);
if (itemstack.is(Items.POTION)) {
- List<MobEffectInstance> list = PotionUtils.getMobEffects(itemstack);
@ -19,6 +19,6 @@ index 112c4f203e2c1e3b1e0259e687ee2293c0132953..6a6b8672e65212dc2a1d837563d623b8
+
+ List<MobEffectInstance> list = event.callEvent() ? PotionUtils.getMobEffects(org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(event.getPotion())) : null;
+ // Paper end
if (list != null) {
Iterator iterator = list.iterator();

View File

@ -6,13 +6,13 @@ Subject: [PATCH] WitchThrowPotionEvent
Fired when a witch throws a potion at a player
diff --git a/src/main/java/net/minecraft/world/entity/monster/Witch.java b/src/main/java/net/minecraft/world/entity/monster/Witch.java
index 6a6b8672e65212dc2a1d837563d623b8bce8da28..0341a1cf05865f1a182a25adc5651f80ae09290a 100644
index a949e8546ecc2d6fd6690d8a00207dc187e2451a..40876df2503eed53c5d7769931f8201fb709cf6f 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Witch.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Witch.java
@@ -236,9 +236,16 @@ public class Witch extends Raider implements RangedAttackMob {
@@ -239,9 +239,16 @@ public class Witch extends Raider implements RangedAttackMob {
potionregistry = Potions.WEAKNESS;
}
+ // Paper start
+ ItemStack potion = PotionUtils.setPotion(new ItemStack(Items.SPLASH_POTION), potionregistry);
+ com.destroystokyo.paper.event.entity.WitchThrowPotionEvent event = new com.destroystokyo.paper.event.entity.WitchThrowPotionEvent((org.bukkit.entity.Witch) this.getBukkitEntity(), (org.bukkit.entity.LivingEntity) target.getBukkitEntity(), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(potion));

View File

@ -5,10 +5,10 @@ Subject: [PATCH] WitchReadyPotionEvent
diff --git a/src/main/java/net/minecraft/world/entity/monster/Witch.java b/src/main/java/net/minecraft/world/entity/monster/Witch.java
index 0341a1cf05865f1a182a25adc5651f80ae09290a..df024c3108df807772fc487f5c59004a59938bf2 100644
index 40876df2503eed53c5d7769931f8201fb709cf6f..ca24b592273208e61e0e0ba59b7e5a3c11ebf952 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Witch.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Witch.java
@@ -157,7 +157,11 @@ public class Witch extends Raider implements RangedAttackMob {
@@ -160,7 +160,11 @@ public class Witch extends Raider implements RangedAttackMob {
}
if (potionregistry != null) {

View File

@ -21,7 +21,7 @@ check is essentially the same as this.getHandle() == other.getHandle()
However, replaced it too to make it clearer of intent.
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
index 02277fc7e48e03d749edb7ec1c3f045dca900615..185b3af59bf72244bbbfc46c3336e4f7f14e73a8 100644
index a6009f9075035e34150ff692d38cac47930363d1..0fd9119c710afdd46a60d81ae3f9ce5da88d2541 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -841,14 +841,15 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {

View File

@ -36,10 +36,10 @@ This change will result in some major changes to fishing formulas.
I would love to see this change in Vanilla, so Mojang please pull :)
diff --git a/src/main/java/net/minecraft/world/level/storage/loot/entries/LootPoolSingletonContainer.java b/src/main/java/net/minecraft/world/level/storage/loot/entries/LootPoolSingletonContainer.java
index 710a66e9aafe8bd622f9f37789c281aba98d030e..d125b5a470be0f4c56c2c1f229fc5c83fc4d2f3b 100644
index 7a52d03c488fb1e277228914b810e2d6e02beaef..4fbb0f7fefcb383c25c1c4df2e788d9a153ae376 100644
--- a/src/main/java/net/minecraft/world/level/storage/loot/entries/LootPoolSingletonContainer.java
+++ b/src/main/java/net/minecraft/world/level/storage/loot/entries/LootPoolSingletonContainer.java
@@ -113,9 +113,35 @@ public abstract class LootPoolSingletonContainer extends LootPoolEntryContainer
@@ -122,9 +122,35 @@ public abstract class LootPoolSingletonContainer extends LootPoolEntryContainer
protected abstract class EntryBase implements LootPoolEntry {
@Override
public int getWeight(float luck) {

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Make shield blocking delay configurable
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 021f3f81746a6e986c8899aa4b28ef87a67bed44..9e4b430c8d3ed6538e8b2549ee3f61b9e0d98c42 100644
index 231ba23fabeb88b659a7ea9702eebe4aad72a209..5fb892e47b1ad33435e2aafeb1212ffe6b89ffdd 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3750,12 +3750,24 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -3809,12 +3809,24 @@ public abstract class LivingEntity extends Entity implements Attackable {
if (this.isUsingItem() && !this.useItem.isEmpty()) {
Item item = this.useItem.getItem();
@ -35,7 +35,7 @@ index 021f3f81746a6e986c8899aa4b28ef87a67bed44..9e4b430c8d3ed6538e8b2549ee3f61b9
return this.isShiftKeyDown();
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
index 24d13be4a5a6cd9d8d9f46c089fd23baa6da954d..4ea0b3423ad08c7645afdf1eabc66fdf299e3ef5 100644
index 03d791e98d369c1d8fe4a4da11f89301392a934d..78c27ec1135c55baf16d1794f4f33d9b36bc0aa6 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -810,5 +810,15 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {

View File

@ -9,7 +9,7 @@ Adds missing call to Illagers and also adds Arrow ItemStack to skeletons
public net.minecraft.world.entity.projectile.AbstractArrow getPickupItem()Lnet.minecraft.world.item.ItemStack;
diff --git a/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java b/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java
index 9634de10605eb477c073d4241f8ea5f17eea268d..4ea7a6bd6fdc98bef30546e19e2676a78fb29007 100644
index 8a668d36bafa5ba172b0ce510b46096ec2fd116a..dadb419a04b343d6ba59353c6caa1a50aa07b67f 100644
--- a/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java
+++ b/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java
@@ -201,7 +201,7 @@ public abstract class AbstractSkeleton extends Monster implements RangedAttackMo

View File

@ -7,10 +7,10 @@ Called when a player is firing a bow and the server is choosing an arrow to use.
Plugins can skip selection of certain arrows and control which is used.
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
index 10dd06a23b34b7c8515c9ccc3988a9e8182c460d..48ba8f67b93bed0cfa540d7cb94199b633a349e6 100644
index 4a3c6a583672179d4dd81726ef87d9d584dd139d..799ebcf4c148d402039efc369fd4cda5354c5473 100644
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
@@ -2260,18 +2260,29 @@ public abstract class Player extends LivingEntity {
@@ -2262,18 +2262,29 @@ public abstract class Player extends LivingEntity {
return ImmutableList.of(Pose.STANDING, Pose.CROUCHING, Pose.SWIMMING);
}

View File

@ -9,10 +9,10 @@ Co-authored-by: aerulion <aerulion@gmail.com>
This event is called when an entity receives knockback by another entity.
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 4c8ad4e6ed90d5ba25100abfd2f334a3d1e46288..427c5ff03bc5ae9469f979f106e3eed513d01536 100644
index 3fc715e7ceb35e2309ba3ffeb19ae58cfd25fde6..ff8a82764811ce19d6688723fd9a725f46fdbedc 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -1894,8 +1894,17 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -1850,8 +1850,17 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
}
public void push(double deltaX, double deltaY, double deltaZ) {
@ -33,10 +33,10 @@ index 4c8ad4e6ed90d5ba25100abfd2f334a3d1e46288..427c5ff03bc5ae9469f979f106e3eed5
protected void markHurt() {
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 9e4b430c8d3ed6538e8b2549ee3f61b9e0d98c42..fe14ebe86ce2bc5835e51c7bbe56a5d69fa02bea 100644
index 5fb892e47b1ad33435e2aafeb1212ffe6b89ffdd..7d7c8772bd8dfb96cfff2c1f020719c0156a09cd 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -1484,7 +1484,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -1516,7 +1516,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
d0 = (Math.random() - Math.random()) * 0.01D;
}
@ -45,7 +45,7 @@ index 9e4b430c8d3ed6538e8b2549ee3f61b9e0d98c42..fe14ebe86ce2bc5835e51c7bbe56a5d6
if (!flag) {
this.indicateDamage(d0, d1);
}
@@ -1533,7 +1533,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -1565,7 +1565,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
}
protected void blockedByShield(LivingEntity target) {
@ -54,7 +54,7 @@ index 9e4b430c8d3ed6538e8b2549ee3f61b9e0d98c42..fe14ebe86ce2bc5835e51c7bbe56a5d6
}
private boolean checkTotemDeathProtection(DamageSource source) {
@@ -1793,6 +1793,11 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -1826,6 +1826,11 @@ public abstract class LivingEntity extends Entity implements Attackable {
}
public void knockback(double strength, double x, double z) {
@ -66,7 +66,7 @@ index 9e4b430c8d3ed6538e8b2549ee3f61b9e0d98c42..fe14ebe86ce2bc5835e51c7bbe56a5d6
strength *= 1.0D - this.getAttributeValue(Attributes.KNOCKBACK_RESISTANCE);
if (strength > 0.0D) {
this.hasImpulse = true;
@@ -1800,6 +1805,15 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -1833,6 +1838,15 @@ public abstract class LivingEntity extends Entity implements Attackable {
Vec3 vec3d1 = (new Vec3(x, 0.0D, z)).normalize().scale(strength);
this.setDeltaMovement(vec3d.x / 2.0D - vec3d1.x, this.onGround() ? Math.min(0.4D, vec3d.y / 2.0D + strength) : vec3d.y, vec3d.z / 2.0D - vec3d1.z);
@ -83,10 +83,10 @@ index 9e4b430c8d3ed6538e8b2549ee3f61b9e0d98c42..fe14ebe86ce2bc5835e51c7bbe56a5d6
}
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
index 58d6a0bc8e94eaa22dcd5d86522ab378e5b3e7cd..2fc099e2fb17073f3ab4ac5e868b1c583bf8a594 100644
index 645ee527b9e7e7edbf3320eae6e441bea84f58f9..2b5f5aed31bd235a213f57b9d65b0ea1fae8de08 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -1633,7 +1633,7 @@ public abstract class Mob extends LivingEntity implements Targeting {
@@ -1647,7 +1647,7 @@ public abstract class Mob extends LivingEntity implements Targeting {
if (flag) {
if (f1 > 0.0F && target instanceof LivingEntity) {
@ -122,10 +122,10 @@ index 29cfd065f246bbd3d3c2a5bbd32c3f4813a02951..03ec02f9a2fb5abb5387cd0d83c9481d
}
}
diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
index 0f39550f82aa1646dd5e4a887e33c414160ee7d9..9d5d03a913366c0f60557e39523c30df7e2fde33 100644
index 8bfb2f94226e6b623def141a7af79d0f46d7d445..fc0750f9b2257a3dbf0fab2f0cd4bb020e044752 100644
--- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
+++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
@@ -467,7 +467,7 @@ public class EnderDragon extends Mob implements Enemy {
@@ -458,7 +458,7 @@ public class EnderDragon extends Mob implements Enemy {
double d3 = entity.getZ() - d1;
double d4 = Math.max(d2 * d2 + d3 * d3, 0.1D);
@ -135,10 +135,10 @@ index 0f39550f82aa1646dd5e4a887e33c414160ee7d9..9d5d03a913366c0f60557e39523c30df
entity.hurt(this.damageSources().mobAttack(this), 5.0F);
this.doEnchantDamageEffects(this, entity);
diff --git a/src/main/java/net/minecraft/world/entity/monster/Ravager.java b/src/main/java/net/minecraft/world/entity/monster/Ravager.java
index 63ee0f07114e75201a1bcc2741512e3da54893ea..02f962eed1d85e8c532264f63666d26401d6a8f2 100644
index 041f1650b853138e4286fe83a08d79d276054ce7..344e933311f5cdccb66069d486b111a003639dfe 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Ravager.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Ravager.java
@@ -282,7 +282,7 @@ public class Ravager extends Raider {
@@ -265,7 +265,7 @@ public class Ravager extends Raider {
double d1 = entity.getZ() - this.getZ();
double d2 = Math.max(d0 * d0 + d1 * d1, 0.001D);
@ -161,10 +161,10 @@ index 81003ce3f05c6be6f52a92b86a4721235f4ce12a..004382377ee364143a34287e7b6546ae
}
}
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
index 48ba8f67b93bed0cfa540d7cb94199b633a349e6..734d00e84ec0bcef91a12546873de64e33e14d0c 100644
index 799ebcf4c148d402039efc369fd4cda5354c5473..edc73a920f5c0f17e00fda48e64c26c96e71b11d 100644
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
@@ -1284,9 +1284,9 @@ public abstract class Player extends LivingEntity {
@@ -1290,9 +1290,9 @@ public abstract class Player extends LivingEntity {
if (flag5) {
if (i > 0) {
if (target instanceof LivingEntity) {
@ -176,7 +176,7 @@ index 48ba8f67b93bed0cfa540d7cb94199b633a349e6..734d00e84ec0bcef91a12546873de64e
}
this.setDeltaMovement(this.getDeltaMovement().multiply(0.6D, 1.0D, 0.6D));
@@ -1308,7 +1308,7 @@ public abstract class Player extends LivingEntity {
@@ -1314,7 +1314,7 @@ public abstract class Player extends LivingEntity {
if (entityliving != this && entityliving != target && !this.isAlliedTo((Entity) entityliving) && (!(entityliving instanceof ArmorStand) || !((ArmorStand) entityliving).isMarker()) && this.distanceToSqr((Entity) entityliving) < 9.0D) {
// CraftBukkit start - Only apply knockback if the damage hits
if (entityliving.hurt(this.damageSources().playerAttack(this).sweep(), f4)) {
@ -186,7 +186,7 @@ index 48ba8f67b93bed0cfa540d7cb94199b633a349e6..734d00e84ec0bcef91a12546873de64e
// CraftBukkit end
}
diff --git a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
index 7acd5d9fb7f7d3e067de779a9e3f0cedb587c68a..86a82ecdcffc27b523fddc2709bbd92f315e8590 100644
index 61a23f67c71116881bab9febf8db219a6c0b98a1..c5512adfb2d38616bb741d03038158c379020ecf 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
@@ -401,7 +401,7 @@ public abstract class AbstractArrow extends Projectile {

View File

@ -6,10 +6,10 @@ Subject: [PATCH] Expand Explosions API
Add Entity as a Source capability, and add more API choices, and on Location.
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 0476f00719d180d28a2a4bab3f4152b00a1e4e67..905cf3c98c363c4cd8b236e557572d8cc2ab88a8 100644
index 69cf1142c9d40f581f4d84ebc4d58e95c9a71ddc..d2fa8e46446f2e7a8fd8bfed5901a959b27a73e0 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -716,6 +716,12 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@@ -726,6 +726,12 @@ public class CraftWorld extends CraftRegionAccessor implements World {
public boolean createExplosion(double x, double y, double z, float power, boolean setFire, boolean breakBlocks, Entity source) {
return !this.world.explode(source == null ? null : ((CraftEntity) source).getHandle(), x, y, z, power, setFire, breakBlocks ? net.minecraft.world.level.Level.ExplosionInteraction.MOB : net.minecraft.world.level.Level.ExplosionInteraction.NONE).wasCanceled;
}

View File

@ -6,7 +6,7 @@ Subject: [PATCH] LivingEntity Hand Raised/Item Use API
How long an entity has raised hands to charge an attack or use an item
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
index 4ea0b3423ad08c7645afdf1eabc66fdf299e3ef5..f79118891ca87515cbcea8b798e434cb57bbe494 100644
index 78c27ec1135c55baf16d1794f4f33d9b36bc0aa6..f8340bd15c978c2b9124ee57dd55484bfd608f62 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -820,5 +820,30 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Add config to disable ender dragon legacy check
diff --git a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java
index c1c89d93f437850f6126ca69664dc9a3c5feac96..43a82ed953dd5d19f1c1c55b011b0cedef5ad7a2 100644
index f310098b0a59fa5341198bb8282b23dfa4a7fc3a..e70273664b4a38ef4ba803c60409a24a07d5bed7 100644
--- a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java
+++ b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java
@@ -106,6 +106,10 @@ public class EndDragonFight {

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Implement World.getEntity(UUID) API
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 905cf3c98c363c4cd8b236e557572d8cc2ab88a8..58f261162627c3065bb1b518e0e99f5c822c022c 100644
index d2fa8e46446f2e7a8fd8bfed5901a959b27a73e0..a9089569e063b5124c246b52b10f4a5728af49e0 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -1040,6 +1040,15 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@@ -1050,6 +1050,15 @@ public class CraftWorld extends CraftRegionAccessor implements World {
return list;
}

View File

@ -7,10 +7,10 @@ Allows you to determine why an inventory was closed, enabling plugin developers
to "confirm" things based on if it was player triggered close or not.
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 68257f257dd3b167e237482c8d149590103896b2..33ce550ea68d4862e0966ed827200cf426909d85 100644
index 9242f42ad622897721a86b5a443aa67619e52918..0e60542256d8e6ded167a3b9a75cca7d0915cb2f 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1449,7 +1449,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -1217,7 +1217,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
for (net.minecraft.world.level.block.entity.BlockEntity tileentity : chunk.getBlockEntities().values()) {
if (tileentity instanceof net.minecraft.world.Container) {
for (org.bukkit.entity.HumanEntity h : Lists.newArrayList(((net.minecraft.world.Container) tileentity).getViewers())) {
@ -19,7 +19,7 @@ index 68257f257dd3b167e237482c8d149590103896b2..33ce550ea68d4862e0966ed827200cf4
}
}
}
@@ -2417,7 +2417,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -2161,7 +2161,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
// Spigot Start
if (entity.getBukkitEntity() instanceof org.bukkit.inventory.InventoryHolder && (!(entity instanceof ServerPlayer) || entity.getRemovalReason() != Entity.RemovalReason.KILLED)) { // SPIGOT-6876: closeInventory clears death message
for (org.bukkit.entity.HumanEntity h : Lists.newArrayList(((org.bukkit.inventory.InventoryHolder) entity.getBukkitEntity()).getInventory().getViewers())) {
@ -29,10 +29,10 @@ index 68257f257dd3b167e237482c8d149590103896b2..33ce550ea68d4862e0966ed827200cf4
}
// Spigot End
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 3842caf61e388aa65b3a18c587480a7dabb8341b..bd7b8ede44a5971b034ffb75fbddbadda8f42702 100644
index 491dffdcbb065acf5861dc01b403d1a895c92baa..3a9fd9ea736d1b3dbb261158d690e218baa4df96 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -682,7 +682,7 @@ public class ServerPlayer extends Player {
@@ -641,7 +641,7 @@ public class ServerPlayer extends Player {
}
// Paper end
if (!this.level().isClientSide && !this.containerMenu.stillValid(this)) {
@ -41,7 +41,7 @@ index 3842caf61e388aa65b3a18c587480a7dabb8341b..bd7b8ede44a5971b034ffb75fbddbadd
this.containerMenu = this.inventoryMenu;
}
@@ -875,7 +875,7 @@ public class ServerPlayer extends Player {
@@ -834,7 +834,7 @@ public class ServerPlayer extends Player {
// SPIGOT-943 - only call if they have an inventory open
if (this.containerMenu != this.inventoryMenu) {
@ -50,7 +50,7 @@ index 3842caf61e388aa65b3a18c587480a7dabb8341b..bd7b8ede44a5971b034ffb75fbddbadd
}
net.kyori.adventure.text.Component deathMessage = event.deathMessage() != null ? event.deathMessage() : net.kyori.adventure.text.Component.empty(); // Paper - Adventure
@@ -1494,7 +1494,7 @@ public class ServerPlayer extends Player {
@@ -1453,7 +1453,7 @@ public class ServerPlayer extends Player {
}
// CraftBukkit end
if (this.containerMenu != this.inventoryMenu) {
@ -59,7 +59,7 @@ index 3842caf61e388aa65b3a18c587480a7dabb8341b..bd7b8ede44a5971b034ffb75fbddbadd
}
// this.nextContainerCounter(); // CraftBukkit - moved up
@@ -1522,7 +1522,13 @@ public class ServerPlayer extends Player {
@@ -1481,7 +1481,13 @@ public class ServerPlayer extends Player {
@Override
public void closeContainer() {
@ -75,10 +75,10 @@ index 3842caf61e388aa65b3a18c587480a7dabb8341b..bd7b8ede44a5971b034ffb75fbddbadd
this.doCloseContainer();
}
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index d01daadf038b381c4b0d7787553ccd341c0787af..2b71b1345a8fc20ca94b837323560c4d70df97fe 100644
index 2addf6dfbe808d4a74d74812ae024925cb3bdb13..025eacdf53f42b47f5815cbacfe74d0990da0e42 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -222,6 +222,7 @@ import org.bukkit.event.inventory.ClickType;
@@ -215,6 +215,7 @@ import org.bukkit.event.inventory.ClickType;
import org.bukkit.event.inventory.CraftItemEvent;
import org.bukkit.event.inventory.InventoryAction;
import org.bukkit.event.inventory.InventoryClickEvent;
@ -86,7 +86,7 @@ index d01daadf038b381c4b0d7787553ccd341c0787af..2b71b1345a8fc20ca94b837323560c4d
import org.bukkit.event.inventory.InventoryCreativeEvent;
import org.bukkit.event.inventory.InventoryType.SlotType;
import org.bukkit.event.inventory.SmithItemEvent;
@@ -2661,10 +2662,15 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -2517,10 +2518,15 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@Override
public void handleContainerClose(ServerboundContainerClosePacket packet) {
@ -104,10 +104,10 @@ index d01daadf038b381c4b0d7787553ccd341c0787af..2b71b1345a8fc20ca94b837323560c4d
this.player.doCloseContainer();
}
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 875b08503fbbac256fad1b3f3d9c742bf1cdced2..e00c1916202a4e0550cc19c9cb279448a9fcdd1e 100644
index 0cdab5d4f1b4d368dfee0dc50183a83ca446fc17..6e88a9e8ea63e54fd191263f105d3e9f81f27f3a 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -533,7 +533,7 @@ public abstract class PlayerList {
@@ -520,7 +520,7 @@ public abstract class PlayerList {
// CraftBukkit start - Quitting must be before we do final save of data, in case plugins need to modify it
// See SPIGOT-5799, SPIGOT-6145
if (entityplayer.containerMenu != entityplayer.inventoryMenu) {
@ -115,12 +115,12 @@ index 875b08503fbbac256fad1b3f3d9c742bf1cdced2..e00c1916202a4e0550cc19c9cb279448
+ entityplayer.closeContainer(org.bukkit.event.inventory.InventoryCloseEvent.Reason.DISCONNECT); // Paper
}
PlayerQuitEvent playerQuitEvent = new PlayerQuitEvent(entityplayer.getBukkitEntity(), net.kyori.adventure.text.Component.translatable("multiplayer.player.left", net.kyori.adventure.text.format.NamedTextColor.YELLOW, io.papermc.paper.configuration.GlobalConfiguration.get().messages.useDisplayNameInQuitMessage ? entityplayer.getBukkitEntity().displayName() : PaperAdventure.asAdventure(entityplayer.getDisplayName()))); // Paper - Adventure
PlayerQuitEvent playerQuitEvent = new PlayerQuitEvent(entityplayer.getBukkitEntity(), net.kyori.adventure.text.Component.translatable("multiplayer.player.left", net.kyori.adventure.text.format.NamedTextColor.YELLOW, io.papermc.paper.configuration.GlobalConfiguration.get().messages.useDisplayNameInQuitMessage ? entityplayer.getBukkitEntity().displayName() : io.papermc.paper.adventure.PaperAdventure.asAdventure(entityplayer.getDisplayName()))); // Paper - Adventure
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
index 734d00e84ec0bcef91a12546873de64e33e14d0c..c7bcbc3f0542a74c30e29bded3bfc0e94daeab25 100644
index edc73a920f5c0f17e00fda48e64c26c96e71b11d..ddd43b5e9ab77c1baaa7c777dc0b3e89789d7626 100644
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
@@ -269,7 +269,7 @@ public abstract class Player extends LivingEntity {
@@ -270,7 +270,7 @@ public abstract class Player extends LivingEntity {
this.updateIsUnderwater();
super.tick();
if (!this.level().isClientSide && this.containerMenu != null && !this.containerMenu.stillValid(this)) {
@ -129,7 +129,7 @@ index 734d00e84ec0bcef91a12546873de64e33e14d0c..c7bcbc3f0542a74c30e29bded3bfc0e9
this.containerMenu = this.inventoryMenu;
}
@@ -492,6 +492,13 @@ public abstract class Player extends LivingEntity {
@@ -497,6 +497,13 @@ public abstract class Player extends LivingEntity {
}
@ -144,7 +144,7 @@ index 734d00e84ec0bcef91a12546873de64e33e14d0c..c7bcbc3f0542a74c30e29bded3bfc0e9
this.containerMenu = this.inventoryMenu;
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
index 74f1af3dccddf52965e5c91277be3592649e8cfa..552fb0be2f31bd52a5ae43526d55aa29828f786e 100644
index e5b2686e466a2604ebcdb6e5c3b6fb7ff7bc6eec..aa131c233ee9d7926ca77e1afedd27baf7639423 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
@@ -376,7 +376,7 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
@ -173,10 +173,10 @@ index 74f1af3dccddf52965e5c91277be3592649e8cfa..552fb0be2f31bd52a5ae43526d55aa29
@Override
public boolean isBlocking() {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 0868e977d356a1e3b5c49c9c788d8e3d0cb85c84..240f90460ddddf8168b7bc661a55fe7e5c94c67d 100644
index 380c1c32a2f404b2e6b801f5ebeccae54d9395fa..9366cc71807cc88d5dd70138b9ce5d49335731db 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -1189,7 +1189,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -1149,7 +1149,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
// Close any foreign inventory
if (this.getHandle().containerMenu != this.getHandle().inventoryMenu) {
@ -186,10 +186,10 @@ index 0868e977d356a1e3b5c49c9c788d8e3d0cb85c84..240f90460ddddf8168b7bc661a55fe7e
// Check if the fromWorld and toWorld are the same.
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index ceb8d024888425248cb40eb3fbbe39fc4be1207b..4942ea5a66af310eac646a6be20e997d53ab99fb 100644
index f51a0e99d7e3ad6379057175931cf95e863b45dd..dde0bc20808e988c6d44dd42e20155cbe72d1757 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -1304,7 +1304,7 @@ public class CraftEventFactory {
@@ -1306,7 +1306,7 @@ public class CraftEventFactory {
public static AbstractContainerMenu callInventoryOpenEvent(ServerPlayer player, AbstractContainerMenu container, boolean cancelled) {
if (player.containerMenu != player.inventoryMenu) { // fire INVENTORY_CLOSE if one already open
@ -198,7 +198,7 @@ index ceb8d024888425248cb40eb3fbbe39fc4be1207b..4942ea5a66af310eac646a6be20e997d
}
CraftServer server = player.level().getCraftServer();
@@ -1478,8 +1478,18 @@ public class CraftEventFactory {
@@ -1480,8 +1480,18 @@ public class CraftEventFactory {
return event;
}

View File

@ -16,10 +16,10 @@ Refresh the player inventory when PlayerInteractEntityEvent is
cancelled to avoid this problem.
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 2b71b1345a8fc20ca94b837323560c4d70df97fe..32acb0ea31c3d617a0a087e11e5a8bfa6eb83db9 100644
index 025eacdf53f42b47f5815cbacfe74d0990da0e42..4af898571bfe218d38ce8a1ec042f142317cd00d 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2542,6 +2542,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -2398,6 +2398,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
}
if (event.isCancelled()) {

View File

@ -5,13 +5,13 @@ Subject: [PATCH] Use AsyncAppender to keep logging IO off main thread
diff --git a/build.gradle.kts b/build.gradle.kts
index e1dc32d94576d751c4078d78fbf3ce3b47f02159..ae64cbbff21ab56d27fd55a4f21b6241d0a54e98 100644
index 7002a2ccb519ede29244924062f7ed2f49546f7d..7cb7a4024f53c50d88652cb6c497d815ed67c148 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -38,6 +38,7 @@ dependencies {
implementation("commons-lang:commons-lang:2.6")
runtimeOnly("org.xerial:sqlite-jdbc:3.42.0.0")
runtimeOnly("com.mysql:mysql-connector-j:8.0.33")
runtimeOnly("org.xerial:sqlite-jdbc:3.43.0.0")
runtimeOnly("com.mysql:mysql-connector-j:8.1.0")
+ runtimeOnly("com.lmax:disruptor:3.4.4") // Paper
runtimeOnly("org.apache.maven:maven-resolver-provider:3.8.5")

View File

@ -6,10 +6,10 @@ Subject: [PATCH] add more information to Entity.toString()
UUID, ticks lived, valid, dead
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 427c5ff03bc5ae9469f979f106e3eed513d01536..c1ece46bea30faf550040b7a3f36c8966029aa9d 100644
index ff8a82764811ce19d6688723fd9a725f46fdbedc..6e3012f482df9efc21545c72cf21d1a14bd62585 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -3137,7 +3137,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -3121,7 +3121,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
public String toString() {
String s = this.level() == null ? "~NULL~" : this.level().toString();

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Option to prevent armor stands from doing entity lookups
diff --git a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java
index 68ac3ffae5d800bde3c5b5163a52768a43bb5963..a59381646031a1a99c98c8c6ad9de7efc96b774a 100644
index 37c19685049ef6b267a74a4323dc4ec33159c3d2..4859a4c78e59745ef75155bc8d6915fce5a217d8 100644
--- a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java
+++ b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java
@@ -337,6 +337,7 @@ public class ArmorStand extends LivingEntity {
@ -14,13 +14,13 @@ index 68ac3ffae5d800bde3c5b5163a52768a43bb5963..a59381646031a1a99c98c8c6ad9de7ef
protected void pushEntities() {
+ if (!this.level().paperConfig().entities.armorStands.doCollisionEntityLookups) return; // Paper
List<Entity> list = this.level().getEntities((Entity) this, this.getBoundingBox(), ArmorStand.RIDABLE_MINECARTS);
Iterator iterator = list.iterator();
for (int i = 0; i < list.size(); ++i) {
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index ce24a52b2b9fb0ae7cfb085a204de8780bc8f5d6..0b02ba70956ea1352ea8e67957b3789408b67f6b 100644
index 068382daaeae03e67b2859cce7d15e290c92352e..32a0cc8602998be451cbb4dc8a68417bdb2c911a 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -849,6 +849,13 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -844,6 +844,13 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
// Paper end
}
}

View File

@ -39,7 +39,7 @@ index a6638e626600e4304a973497a39e3fac52203b16..e68b7a1b03783e4f9de24c5ae8773fc3
BlockCanBuildEvent event = new BlockCanBuildEvent(CraftBlock.at(context.getLevel(), context.getClickedPos()), player, CraftBlockData.fromData(state), defaultReturn);
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 0b02ba70956ea1352ea8e67957b3789408b67f6b..8320bece16dfa339e33801e43ff2f297bc876001 100644
index 32a0cc8602998be451cbb4dc8a68417bdb2c911a..beec98739e6be4e51e812091c0be8d98dd459c3f 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -273,6 +273,45 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@ -89,10 +89,10 @@ index 0b02ba70956ea1352ea8e67957b3789408b67f6b..8320bece16dfa339e33801e43ff2f297
public boolean isClientSide() {
return this.isClientSide;
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index 4942ea5a66af310eac646a6be20e997d53ab99fb..53af54ffecd7fdb20588d75a8c32003cb89a75b1 100644
index dde0bc20808e988c6d44dd42e20155cbe72d1757..f423e98fccb7712f7d989ee5780dd5e7b824255f 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -1341,6 +1341,14 @@ public class CraftEventFactory {
@@ -1343,6 +1343,14 @@ public class CraftEventFactory {
Projectile projectile = (Projectile) entity.getBukkitEntity();
org.bukkit.entity.Entity collided = position.getEntity().getBukkitEntity();
com.destroystokyo.paper.event.entity.ProjectileCollideEvent event = new com.destroystokyo.paper.event.entity.ProjectileCollideEvent(projectile, collided);

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Allow disabling armour stand ticking
diff --git a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java
index a59381646031a1a99c98c8c6ad9de7efc96b774a..719f68f96e58ddcdd3592131c691d21263c81915 100644
index 4859a4c78e59745ef75155bc8d6915fce5a217d8..6483ad071c119353267a4f13b192a50931995c2a 100644
--- a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java
+++ b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java
@@ -93,9 +93,16 @@ public class ArmorStand extends LivingEntity {
@ -54,7 +54,7 @@ index a59381646031a1a99c98c8c6ad9de7efc96b774a..719f68f96e58ddcdd3592131c691d212
CompoundTag nbttagcompound1 = nbt.getCompound("Pose");
this.readPose(nbttagcompound1);
@@ -663,7 +678,29 @@ public class ArmorStand extends LivingEntity {
@@ -671,7 +686,29 @@ public class ArmorStand extends LivingEntity {
@Override
public void tick() {
@ -84,7 +84,7 @@ index a59381646031a1a99c98c8c6ad9de7efc96b774a..719f68f96e58ddcdd3592131c691d212
Rotations vector3f = (Rotations) this.entityData.get(ArmorStand.DATA_HEAD_POSE);
if (!this.headPose.equals(vector3f)) {
@@ -792,31 +829,37 @@ public class ArmorStand extends LivingEntity {
@@ -800,31 +837,37 @@ public class ArmorStand extends LivingEntity {
public void setHeadPose(Rotations angle) {
this.headPose = angle;
this.entityData.set(ArmorStand.DATA_HEAD_POSE, angle);

View File

@ -32,10 +32,10 @@ index 8f20239f3ef7ebe41fac8ee6e024c36dafec33c4..d00fb16ae3b94dfcb10fd1a7c1671595
this.horse.setTrap(false);
diff --git a/src/main/java/net/minecraft/world/level/EntityGetter.java b/src/main/java/net/minecraft/world/level/EntityGetter.java
index ea98625fe7c00743b8df74a24e6d4b75df4189a5..66a5783e2a83c75ca46d1fd6f97d9de733c01a09 100644
index a583599e3b49d5ded871252646904a80825a01ff..c41d0efb40f137d71b2a038dd362d17ddb2fac60 100644
--- a/src/main/java/net/minecraft/world/level/EntityGetter.java
+++ b/src/main/java/net/minecraft/world/level/EntityGetter.java
@@ -105,6 +105,28 @@ public interface EntityGetter {
@@ -93,6 +93,28 @@ public interface EntityGetter {
return player;
}

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Add TNTPrimeEvent
diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
index 9d5d03a913366c0f60557e39523c30df7e2fde33..fada988941c33e09bce5e71bcb2bb733185f6c12 100644
index fc0750f9b2257a3dbf0fab2f0cd4bb020e044752..1621a06eff438eccdbc04a2abebd718567c320b3 100644
--- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
+++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
@@ -567,6 +567,11 @@ public class EnderDragon extends Mob implements Enemy {
@@ -558,6 +558,11 @@ public class EnderDragon extends Mob implements Enemy {
});
craftBlock.getNMS().spawnAfterBreak((ServerLevel) this.level(), blockposition, ItemStack.EMPTY, false);
}

View File

@ -22,26 +22,26 @@ to take the burden of this into their own hand without having to rely on
plugins doing unsafe things.
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 32acb0ea31c3d617a0a087e11e5a8bfa6eb83db9..9092a04f7a98f022c9a9bfe5310643b4b89ce2e7 100644
index 4af898571bfe218d38ce8a1ec042f142317cd00d..879b27c58a8a3479e2ab83b020b6ee9e98b93d2b 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -267,6 +267,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
private long keepAliveChallenge;
@@ -253,6 +253,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
private int ackBlockChangesUpTo = -1;
// CraftBukkit start - multithreaded fields
private final AtomicInteger chatSpamTickCount = new AtomicInteger();
+ private final java.util.concurrent.atomic.AtomicInteger tabSpamLimiter = new java.util.concurrent.atomic.AtomicInteger(); // Paper - configurable tab spam limits
// CraftBukkit end
private int dropSpamTickCount;
private double firstGoodX;
@@ -415,6 +416,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
this.server.getProfiler().pop();
@@ -372,6 +373,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
this.keepConnectionAlive();
// CraftBukkit start
for (int spam; (spam = this.chatSpamTickCount.get()) > 0 && !this.chatSpamTickCount.compareAndSet(spam, spam - 1); ) ;
+ if (tabSpamLimiter.get() > 0) tabSpamLimiter.getAndDecrement(); // Paper - split to seperate variable
/* Use thread-safe field access instead
if (this.chatSpamTickCount > 0) {
--this.chatSpamTickCount;
@@ -799,7 +801,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -696,7 +698,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
public void handleCustomCommandSuggestions(ServerboundCommandSuggestionPacket packet) {
// PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); // Paper - run this async
// CraftBukkit start

View File

@ -30,10 +30,10 @@ index ff682a671f04a333615c4f22dc4b2aedd00eb117..8d8fe55a05eea237a8af99ed15ab16d6
this.loadPaperNBT(nbt); // Paper
}
diff --git a/src/main/java/net/minecraft/world/entity/animal/allay/Allay.java b/src/main/java/net/minecraft/world/entity/animal/allay/Allay.java
index 33a058474cd9d5e089a39e04cf5176eb9df62603..339c70f101d026a100a801e66cf514b3329a89d2 100644
index 41621adf597d76cad0a7098ac0da8ceb29b43ed7..5ad5f22e5aa26445e5eb229958e7bf356bdd460e 100644
--- a/src/main/java/net/minecraft/world/entity/animal/allay/Allay.java
+++ b/src/main/java/net/minecraft/world/entity/animal/allay/Allay.java
@@ -514,7 +514,7 @@ public class Allay extends PathfinderMob implements InventoryCarrier, VibrationS
@@ -509,7 +509,7 @@ public class Allay extends PathfinderMob implements InventoryCarrier, VibrationS
});
}

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Remove unnecessary itemmeta handling
diff --git a/src/main/java/net/minecraft/network/FriendlyByteBuf.java b/src/main/java/net/minecraft/network/FriendlyByteBuf.java
index c2f56f4628e42c130e4c55030432cb43aa0d8458..9938bb90bef84cf784f9a1ceb02a1a45aa8b48a1 100644
index 9c211b0db837b16d50aee63d0caf45e1a12bcc83..2e395962b555bef0ce1a98e1d768e7738f011535 100644
--- a/src/main/java/net/minecraft/network/FriendlyByteBuf.java
+++ b/src/main/java/net/minecraft/network/FriendlyByteBuf.java
@@ -688,7 +688,7 @@ public class FriendlyByteBuf extends ByteBuf {
@@ -641,7 +641,7 @@ public class FriendlyByteBuf extends ByteBuf {
if (item.canBeDepleted() || item.shouldOverrideMultiplayerNbt()) {
// Spigot start - filter
stack = stack.copy();
@ -17,7 +17,7 @@ index c2f56f4628e42c130e4c55030432cb43aa0d8458..9938bb90bef84cf784f9a1ceb02a1a45
// Spigot end
nbttagcompound = stack.getTag();
}
@@ -709,7 +709,7 @@ public class FriendlyByteBuf extends ByteBuf {
@@ -662,7 +662,7 @@ public class FriendlyByteBuf extends ByteBuf {
itemstack.setTag(this.readNbt());
// CraftBukkit start

View File

@ -8,10 +8,10 @@ Add -Ddebug.entities=true to your JVM flags to gain more information
1.17: Needs to be reworked for new entity storage system
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 8dc2a217d018e0a11fb852cf46d4e9b5290ea6a0..af92411006c3d281815b3f4c3de5f0280d3a5901 100644
index 425a0baa9321e9b484814f38fe28de3c82333443..65916397278ea0cbbc33a46e501a4b6979e6d4ef 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -897,6 +897,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1417,6 +1417,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
} else {
ChunkMap.TrackedEntity playerchunkmap_entitytracker = new ChunkMap.TrackedEntity(entity, i, j, entitytypes.trackDeltas());
@ -19,7 +19,7 @@ index 8dc2a217d018e0a11fb852cf46d4e9b5290ea6a0..af92411006c3d281815b3f4c3de5f028
this.entityMap.put(entity.getId(), playerchunkmap_entitytracker);
playerchunkmap_entitytracker.updatePlayers(this.level.players());
if (entity instanceof ServerPlayer) {
@@ -939,7 +940,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1459,7 +1460,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
if (playerchunkmap_entitytracker1 != null) {
playerchunkmap_entitytracker1.broadcastRemoved();
}
@ -29,7 +29,7 @@ index 8dc2a217d018e0a11fb852cf46d4e9b5290ea6a0..af92411006c3d281815b3f4c3de5f028
protected void tick() {
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 33ce550ea68d4862e0966ed827200cf426909d85..6b157b362cffedae26133fc0f0af1094655ee11f 100644
index 0e60542256d8e6ded167a3b9a75cca7d0915cb2f..af33e4be10c9d571eb6f7ba5730b7ed4d8647761 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -221,6 +221,9 @@ public class ServerLevel extends Level implements WorldGenLevel {
@ -42,7 +42,7 @@ index 33ce550ea68d4862e0966ed827200cf426909d85..6b157b362cffedae26133fc0f0af1094
@Override public LevelChunk getChunkIfLoaded(int x, int z) { // Paper - this was added in world too but keeping here for NMS ABI
return this.chunkSource.getChunk(x, z, false);
@@ -1411,7 +1414,28 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -1179,7 +1182,28 @@ public class ServerLevel extends Level implements WorldGenLevel {
// CraftBukkit start
private boolean addEntity(Entity entity, CreatureSpawnEvent.SpawnReason spawnReason) {
org.spigotmc.AsyncCatcher.catchOp("entity add"); // Spigot
@ -72,7 +72,7 @@ index 33ce550ea68d4862e0966ed827200cf426909d85..6b157b362cffedae26133fc0f0af1094
return false;
} else {
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index c1ece46bea30faf550040b7a3f36c8966029aa9d..7ca89b1a5bbeefd8622cb0f93e0235abcefbc033 100644
index 6e3012f482df9efc21545c72cf21d1a14bd62585..72c5fde2220524f66a2608ecfa96c7b56f8b198c 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -238,6 +238,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@ -85,7 +85,7 @@ index c1ece46bea30faf550040b7a3f36c8966029aa9d..7ca89b1a5bbeefd8622cb0f93e0235ab
if (this.bukkitEntity == null) {
this.bukkitEntity = CraftEntity.getEntity(this.level.getCraftServer(), this);
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 8320bece16dfa339e33801e43ff2f297bc876001..18234d71eba7d2a2874f3e5c9628d82970acc033 100644
index beec98739e6be4e51e812091c0be8d98dd459c3f..e66e35b25dfce6f071173de87c452a9dd38fcf4d 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -150,6 +150,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {

View File

@ -9,10 +9,10 @@ thread dumps at an interval until the point of crash.
This will help diagnose what was going on in that time before the crash.
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 9f59ef54ef6f6af8b0fef8567d8cfbefb64bc29f..d05f776204a720084a583c6d6dfe47936761b6e3 100644
index 76728fd630e103e8e3431c6b54ef944cb62b33fd..715ebeb36f0620eaeafa63bf87a30e63363069a3 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1047,6 +1047,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1046,6 +1046,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.status = this.buildServerStatus();
// Spigot start
@ -21,7 +21,7 @@ index 9f59ef54ef6f6af8b0fef8567d8cfbefb64bc29f..d05f776204a720084a583c6d6dfe4793
long start = System.nanoTime(), curTime, tickSection = start; // Paper - Further improve server tick loop
lastTick = start - TICK_TIME; // Paper
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index 97df17a1636ac1ba765a8e486cfbb46bfac9ee6c..980088f5af3d44d47b94ecde52cdc5f9277f6329 100644
index e11aee38009a6a37dceaf42232e295b71e0b7d40..1ea037e33e50ed4f1d4bcbc294cc26cac7cc8d94 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -197,6 +197,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
@ -33,10 +33,10 @@ index 97df17a1636ac1ba765a8e486cfbb46bfac9ee6c..980088f5af3d44d47b94ecde52cdc5f9
com.destroystokyo.paper.Metrics.PaperMetrics.startMetrics();
com.destroystokyo.paper.VersionHistoryManager.INSTANCE.getClass(); // load version history now
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index e19ddd1ab4d15ee041c74bb3767e3a9c41072f34..2e64d43cdc25135fadb759ea503b26104b881968 100644
index e6b0b567ccbe8d7e3f21ffdc336ee2b2ddfb34e9..7afc77aa2b9959689d18b0a93c9d87e663b0f034 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -915,6 +915,7 @@ public final class CraftServer implements Server {
@@ -918,6 +918,7 @@ public final class CraftServer implements Server {
@Override
public void reload() {
@ -44,7 +44,7 @@ index e19ddd1ab4d15ee041c74bb3767e3a9c41072f34..2e64d43cdc25135fadb759ea503b2610
this.reloadCount++;
this.configuration = YamlConfiguration.loadConfiguration(this.getConfigFile());
this.commandsConfiguration = YamlConfiguration.loadConfiguration(this.getCommandsConfigFile());
@@ -1004,6 +1005,7 @@ public final class CraftServer implements Server {
@@ -1007,6 +1008,7 @@ public final class CraftServer implements Server {
this.enablePlugins(PluginLoadOrder.STARTUP);
this.enablePlugins(PluginLoadOrder.POSTWORLD);
this.getPluginManager().callEvent(new ServerLoadEvent(ServerLoadEvent.LoadType.RELOAD));
@ -66,10 +66,10 @@ index ddc5f2d9aa7dda6aff132392927e3d7e3674dbff..3ac48dafe2300ff4cf4591569fec9ce4
public static boolean bungee;
diff --git a/src/main/java/org/spigotmc/WatchdogThread.java b/src/main/java/org/spigotmc/WatchdogThread.java
index a9897c494b3dc56d900356d74030359832febbaa..b47d043144c499b1499f6b4be5a16a3f75c9fcb8 100644
index 6e1fa4f0616ccfd258acd1b4f5b08fc0ad4c9529..06efdd7aa6d35a670e81c4f303618a7ba301396a 100644
--- a/src/main/java/org/spigotmc/WatchdogThread.java
+++ b/src/main/java/org/spigotmc/WatchdogThread.java
@@ -14,6 +14,10 @@ public final class WatchdogThread extends io.papermc.paper.util.TickThread // Pa
@@ -14,6 +14,10 @@ public class WatchdogThread extends Thread
private static WatchdogThread instance;
private long timeoutTime;
private boolean restart;
@ -80,7 +80,7 @@ index a9897c494b3dc56d900356d74030359832febbaa..b47d043144c499b1499f6b4be5a16a3f
private volatile long lastTick;
private volatile boolean stopping;
@@ -22,6 +26,8 @@ public final class WatchdogThread extends io.papermc.paper.util.TickThread // Pa
@@ -22,6 +26,8 @@ public class WatchdogThread extends Thread
super( "Paper Watchdog Thread" );
this.timeoutTime = timeoutTime;
this.restart = restart;
@ -89,7 +89,7 @@ index a9897c494b3dc56d900356d74030359832febbaa..b47d043144c499b1499f6b4be5a16a3f
}
private static long monotonicMillis()
@@ -61,9 +67,18 @@ public final class WatchdogThread extends io.papermc.paper.util.TickThread // Pa
@@ -61,9 +67,18 @@ public class WatchdogThread extends Thread
while ( !this.stopping )
{
//
@ -110,7 +110,7 @@ index a9897c494b3dc56d900356d74030359832febbaa..b47d043144c499b1499f6b4be5a16a3f
log.log( Level.SEVERE, "------------------------------" );
log.log( Level.SEVERE, "The server has stopped responding! This is (probably) not a Paper bug." ); // Paper
log.log( Level.SEVERE, "If you see a plugin in the Server thread dump below, then please report it to that author" );
@@ -93,30 +108,46 @@ public final class WatchdogThread extends io.papermc.paper.util.TickThread // Pa
@@ -93,29 +108,45 @@ public class WatchdogThread extends Thread
}
}
// Paper end
@ -122,7 +122,6 @@ index a9897c494b3dc56d900356d74030359832febbaa..b47d043144c499b1499f6b4be5a16a3f
+ // Paper end - Different message for short timeout
log.log( Level.SEVERE, "------------------------------" );
log.log( Level.SEVERE, "Server thread dump (Look for plugins here before reporting to Paper!):" ); // Paper
io.papermc.paper.chunk.system.scheduling.ChunkTaskScheduler.dumpAllChunkLoadInfo(isLongTimeout); // Paper // Paper - rewrite chunk system
WatchdogThread.dumpThread( ManagementFactory.getThreadMXBean().getThreadInfo( MinecraftServer.getServer().serverThread.getId(), Integer.MAX_VALUE ), log );
log.log( Level.SEVERE, "------------------------------" );
//

View File

@ -23,10 +23,10 @@ Modified isEmpty to use the isEmpty() method instead of the slightly confusing s
The point of this is readability, but does have a side-benefit of a small microptimization
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index e00c1916202a4e0550cc19c9cb279448a9fcdd1e..2bccba03bb12cf17a82c1e54c2bb10535b7c8964 100644
index 6e88a9e8ea63e54fd191263f105d3e9f81f27f3a..68b6956fc1866fc5b78544cfd348db864b3042e9 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -649,7 +649,7 @@ public abstract class PlayerList {
@@ -636,7 +636,7 @@ public abstract class PlayerList {
} else if (!this.isWhiteListed(gameprofile, event)) { // Paper
//ichatmutablecomponent = Component.translatable("multiplayer.disconnect.not_whitelisted"); // Paper
//event.disallow(PlayerLoginEvent.Result.KICK_WHITELIST, net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(org.spigotmc.SpigotConfig.whitelistMessage)); // Spigot // Paper - Adventure - moved to isWhitelisted
@ -36,7 +36,7 @@ index e00c1916202a4e0550cc19c9cb279448a9fcdd1e..2bccba03bb12cf17a82c1e54c2bb1053
ichatmutablecomponent = Component.translatable("multiplayer.disconnect.banned_ip.reason", ipbanentry.getReason());
diff --git a/src/main/java/net/minecraft/server/players/StoredUserList.java b/src/main/java/net/minecraft/server/players/StoredUserList.java
index 58ebac3ddf8a59cee8fd87b9106d068507768992..08173a6e0b7e46c041a81d6b51d77a0aea182525 100644
index 4d6f5e627d386f9ca2d7653b0f485c82a13557f5..09fc086548b9d0f97849f56f41e3a5be87f5091a 100644
--- a/src/main/java/net/minecraft/server/players/StoredUserList.java
+++ b/src/main/java/net/minecraft/server/players/StoredUserList.java
@@ -14,6 +14,8 @@ import java.io.BufferedReader;

View File

@ -6,7 +6,7 @@ Subject: [PATCH] Use a Queue for Queueing Commands
Lists are bad as Queues mmmkay.
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index 980088f5af3d44d47b94ecde52cdc5f9277f6329..ff908bab7d83e5c049d86a0c8ea235ca3c69936b 100644
index 1ea037e33e50ed4f1d4bcbc294cc26cac7cc8d94..f17116ee619338e1dc8ae1fb9d5b18ad28164ba3 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -69,7 +69,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
@ -17,11 +17,11 @@ index 980088f5af3d44d47b94ecde52cdc5f9277f6329..ff908bab7d83e5c049d86a0c8ea235ca
+ private final java.util.Queue<ConsoleInput> serverCommandQueue = new java.util.concurrent.ConcurrentLinkedQueue<>(); // Paper - use a proper queuemmands
@Nullable
private QueryThreadGs4 queryThreadGs4;
// public final RemoteControlCommandListener rconConsoleSource; // CraftBukkit - remove field
@@ -439,13 +439,15 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
return;
}
// Paper end - rewrite chunk system
// private final RemoteControlCommandListener rconConsoleSource; // CraftBukkit - remove field
@@ -412,13 +412,15 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
}
public void handleConsoleInput(String command, CommandSourceStack commandSource) {
- this.consoleInput.add(new ConsoleInput(command, commandSource));
+ this.serverCommandQueue.add(new ConsoleInput(command, commandSource)); // Paper - use proper queue
}

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Ability to get Tile Entities from a chunk without snapshots
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java
index 8ae78690748b2cb5d5186d8859871c1630e10130..b738e1f7debac7d70910d5ac908ca9d4f60640d5 100644
index f07a6b1d782426581c84ffa19447c1375c4cbc07..719730451635d418b3f5024c35620412add42b7f 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java
@@ -125,6 +125,13 @@ public class CraftChunk implements Chunk {
@@ -169,6 +169,13 @@ public class CraftChunk implements Chunk {
@Override
public BlockState[] getTileEntities() {
@ -22,7 +22,7 @@ index 8ae78690748b2cb5d5186d8859871c1630e10130..b738e1f7debac7d70910d5ac908ca9d4
if (!this.isLoaded()) {
this.getWorld().getChunkAt(x, z); // Transient load for this tick
}
@@ -134,7 +141,29 @@ public class CraftChunk implements Chunk {
@@ -178,7 +185,29 @@ public class CraftChunk implements Chunk {
BlockState[] entities = new BlockState[chunk.blockEntities.size()];
for (BlockPos position : chunk.blockEntities.keySet()) {

View File

@ -5,23 +5,10 @@ Subject: [PATCH] Slime Pathfinder Events
diff --git a/src/main/java/net/minecraft/world/entity/monster/Slime.java b/src/main/java/net/minecraft/world/entity/monster/Slime.java
index 476a9b2db5deac803f1cb3c2cbe88b69cc3da8e5..30779b817db6f8e392036b4ec66e1c5cf50cd0f5 100644
index 382cdfd7d7dceeeffed1cdc34b9e475a69b5c76b..4677e47e4a84d09025cfb9327c1ed3bead1a3feb 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Slime.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Slime.java
@@ -41,6 +41,12 @@ import net.minecraft.world.level.ServerLevelAccessor;
import net.minecraft.world.level.WorldGenLevel;
import net.minecraft.world.level.levelgen.WorldgenRandom;
import net.minecraft.world.phys.Vec3;
+// Paper start
+import com.destroystokyo.paper.event.entity.SlimeChangeDirectionEvent;
+import com.destroystokyo.paper.event.entity.SlimeSwimEvent;
+import com.destroystokyo.paper.event.entity.SlimeTargetLivingEntityEvent;
+import com.destroystokyo.paper.event.entity.SlimeWanderEvent;
+// Paper end
// CraftBukkit start
import java.util.ArrayList;
import java.util.List;
@@ -107,6 +113,7 @@ public class Slime extends Mob implements Enemy {
@@ -115,6 +115,7 @@ public class Slime extends Mob implements Enemy {
@Override
public void addAdditionalSaveData(CompoundTag nbt) {
super.addAdditionalSaveData(nbt);
@ -29,7 +16,7 @@ index 476a9b2db5deac803f1cb3c2cbe88b69cc3da8e5..30779b817db6f8e392036b4ec66e1c5c
nbt.putInt("Size", this.getSize() - 1);
nbt.putBoolean("wasOnGround", this.wasOnGround);
}
@@ -115,6 +122,11 @@ public class Slime extends Mob implements Enemy {
@@ -123,6 +124,11 @@ public class Slime extends Mob implements Enemy {
public void readAdditionalSaveData(CompoundTag nbt) {
this.setSize(nbt.getInt("Size") + 1, false);
super.readAdditionalSaveData(nbt);
@ -41,16 +28,16 @@ index 476a9b2db5deac803f1cb3c2cbe88b69cc3da8e5..30779b817db6f8e392036b4ec66e1c5c
this.wasOnGround = nbt.getBoolean("wasOnGround");
}
@@ -450,7 +462,7 @@ public class Slime extends Mob implements Enemy {
@@ -463,7 +469,7 @@ public class Slime extends Mob implements Enemy {
@Override
public boolean canUse() {
- return (this.slime.isInWater() || this.slime.isInLava()) && this.slime.getMoveControl() instanceof Slime.SlimeMoveControl;
+ return (this.slime.isInWater() || this.slime.isInLava()) && this.slime.getMoveControl() instanceof Slime.SlimeMoveControl && this.slime.canWander && new SlimeSwimEvent((org.bukkit.entity.Slime) this.slime.getBukkitEntity()).callEvent(); // Paper
+ return (this.slime.isInWater() || this.slime.isInLava()) && this.slime.getMoveControl() instanceof Slime.SlimeMoveControl && this.slime.canWander && new com.destroystokyo.paper.event.entity.SlimeSwimEvent((org.bukkit.entity.Slime) this.slime.getBukkitEntity()).callEvent(); // Paper
}
@Override
@@ -489,7 +501,15 @@ public class Slime extends Mob implements Enemy {
@@ -502,7 +508,15 @@ public class Slime extends Mob implements Enemy {
public boolean canUse() {
LivingEntity entityliving = this.slime.getTarget();
@ -62,12 +49,12 @@ index 476a9b2db5deac803f1cb3c2cbe88b69cc3da8e5..30779b817db6f8e392036b4ec66e1c5c
+ if (!this.slime.canAttack(entityliving)) {
+ return false;
+ }
+ return this.slime.getMoveControl() instanceof Slime.SlimeMoveControl && this.slime.canWander && new SlimeTargetLivingEntityEvent((org.bukkit.entity.Slime) this.slime.getBukkitEntity(), (org.bukkit.entity.LivingEntity) entityliving.getBukkitEntity()).callEvent();
+ return this.slime.getMoveControl() instanceof Slime.SlimeMoveControl && this.slime.canWander && new com.destroystokyo.paper.event.entity.SlimeTargetLivingEntityEvent((org.bukkit.entity.Slime) this.slime.getBukkitEntity(), (org.bukkit.entity.LivingEntity) entityliving.getBukkitEntity()).callEvent();
+ // Paper end
}
@Override
@@ -502,7 +522,15 @@ public class Slime extends Mob implements Enemy {
@@ -515,7 +529,15 @@ public class Slime extends Mob implements Enemy {
public boolean canContinueToUse() {
LivingEntity entityliving = this.slime.getTarget();
@ -79,12 +66,12 @@ index 476a9b2db5deac803f1cb3c2cbe88b69cc3da8e5..30779b817db6f8e392036b4ec66e1c5c
+ if (!this.slime.canAttack(entityliving)) {
+ return false;
+ }
+ return --this.growTiredTimer > 0 && this.slime.canWander && new SlimeTargetLivingEntityEvent((org.bukkit.entity.Slime) this.slime.getBukkitEntity(), (org.bukkit.entity.LivingEntity) entityliving.getBukkitEntity()).callEvent();
+ return --this.growTiredTimer > 0 && this.slime.canWander && new com.destroystokyo.paper.event.entity.SlimeTargetLivingEntityEvent((org.bukkit.entity.Slime) this.slime.getBukkitEntity(), (org.bukkit.entity.LivingEntity) entityliving.getBukkitEntity()).callEvent();
+ // Paper end
}
@Override
@@ -527,6 +555,13 @@ public class Slime extends Mob implements Enemy {
@@ -540,6 +562,13 @@ public class Slime extends Mob implements Enemy {
}
}
@ -98,7 +85,7 @@ index 476a9b2db5deac803f1cb3c2cbe88b69cc3da8e5..30779b817db6f8e392036b4ec66e1c5c
}
private static class SlimeRandomDirectionGoal extends Goal {
@@ -542,7 +577,7 @@ public class Slime extends Mob implements Enemy {
@@ -555,7 +584,7 @@ public class Slime extends Mob implements Enemy {
@Override
public boolean canUse() {
@ -107,28 +94,28 @@ index 476a9b2db5deac803f1cb3c2cbe88b69cc3da8e5..30779b817db6f8e392036b4ec66e1c5c
}
@Override
@@ -550,6 +585,11 @@ public class Slime extends Mob implements Enemy {
@@ -563,6 +592,11 @@ public class Slime extends Mob implements Enemy {
if (--this.nextRandomizeTime <= 0) {
this.nextRandomizeTime = this.adjustedTickDelay(40 + this.slime.getRandom().nextInt(60));
this.chosenDegrees = (float) this.slime.getRandom().nextInt(360);
+ // Paper start
+ SlimeChangeDirectionEvent event = new SlimeChangeDirectionEvent((org.bukkit.entity.Slime) this.slime.getBukkitEntity(), this.chosenDegrees);
+ com.destroystokyo.paper.event.entity.SlimeChangeDirectionEvent event = new com.destroystokyo.paper.event.entity.SlimeChangeDirectionEvent((org.bukkit.entity.Slime) this.slime.getBukkitEntity(), this.chosenDegrees);
+ if (!this.slime.canWander || !event.callEvent()) return;
+ this.chosenDegrees = event.getNewYaw();
+ // Paper end
}
MoveControl controllermove = this.slime.getMoveControl();
@@ -574,7 +614,7 @@ public class Slime extends Mob implements Enemy {
@@ -587,7 +621,7 @@ public class Slime extends Mob implements Enemy {
@Override
public boolean canUse() {
- return !this.slime.isPassenger();
+ return !this.slime.isPassenger() && this.slime.canWander && new SlimeWanderEvent((org.bukkit.entity.Slime) this.slime.getBukkitEntity()).callEvent(); // Paper
+ return !this.slime.isPassenger() && this.slime.canWander && new com.destroystokyo.paper.event.entity.SlimeWanderEvent((org.bukkit.entity.Slime) this.slime.getBukkitEntity()).callEvent(); // Paper
}
@Override
@@ -589,4 +629,15 @@ public class Slime extends Mob implements Enemy {
@@ -602,4 +636,15 @@ public class Slime extends Mob implements Enemy {
}
}

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Configurable speed for water flowing over lava
diff --git a/src/main/java/net/minecraft/world/level/block/LiquidBlock.java b/src/main/java/net/minecraft/world/level/block/LiquidBlock.java
index fd7a7772eef7e2e4418539a11cefa98046b087e1..bbabe4ad8afcc3a2069f6e9d4a9adcb643266894 100644
index 3d8def659e017e3d525c7b40eacaf579a5ba3b5b..4a1830f85f47014da63e4584f411d13f0f0cd8b3 100644
--- a/src/main/java/net/minecraft/world/level/block/LiquidBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/LiquidBlock.java
@@ -106,11 +106,31 @@ public class LiquidBlock extends Block implements BucketPickup {
@@ -108,11 +108,31 @@ public class LiquidBlock extends Block implements BucketPickup {
@Override
public void onPlace(BlockState state, Level world, BlockPos pos, BlockState oldState, boolean notify) {
if (this.shouldSpreadLiquid(world, pos, state)) {
@ -41,7 +41,7 @@ index fd7a7772eef7e2e4418539a11cefa98046b087e1..bbabe4ad8afcc3a2069f6e9d4a9adcb6
@Override
public BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor world, BlockPos pos, BlockPos neighborPos) {
if (state.getFluidState().isSource() || neighborState.getFluidState().isSource()) {
@@ -123,7 +143,7 @@ public class LiquidBlock extends Block implements BucketPickup {
@@ -125,7 +145,7 @@ public class LiquidBlock extends Block implements BucketPickup {
@Override
public void neighborChanged(BlockState state, Level world, BlockPos pos, Block sourceBlock, BlockPos sourcePos, boolean notify) {
if (this.shouldSpreadLiquid(world, pos, state)) {

View File

@ -7,7 +7,7 @@ Avoids a hashmap lookup by cacheing a reference to the CraftBlockData
and cloning it when one is needed.
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 803f3ebaa9fe43c88f461168ee43fc6ba920a764..2451bb61e304fbe5cdfd6bbb248575e9e1135075 100644
index 6c171199dcc30f56a6d0ab7ecf398b505d145067..916d7b35145345cb3bf5ca46df38eae0512c4e95 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
@@ -809,6 +809,14 @@ public abstract class BlockBehaviour implements FeatureElement {

View File

@ -8,7 +8,7 @@ Use larger initial sizes to increase bucket capacity on the BiMap
BiMap.get was seen to be using a good bit of CPU time.
diff --git a/src/main/java/net/minecraft/core/MappedRegistry.java b/src/main/java/net/minecraft/core/MappedRegistry.java
index 300e009abbc41961d59d55d965e9a99d44c21e32..1e33434f9f361542e03da3e4812bc6d76768a202 100644
index dee7ac4dab7e3c1b53f0ff81650ebd922f382ece..26b92e27de1f079ab8440538c65377ed80e8b6ef 100644
--- a/src/main/java/net/minecraft/core/MappedRegistry.java
+++ b/src/main/java/net/minecraft/core/MappedRegistry.java
@@ -36,13 +36,11 @@ public class MappedRegistry<T> implements WritableRegistry<T> {

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Add PhantomPreSpawnEvent
diff --git a/src/main/java/net/minecraft/world/entity/monster/Phantom.java b/src/main/java/net/minecraft/world/entity/monster/Phantom.java
index 7582efc69928718a164f704a54bce026ad6f7dd9..9bd6e71ea38bf050832f0f7bbed4a5db6ddcef71 100644
index d19bf99d03bf505a1a277b49fba6ee4769802ef2..658393f451e46a93c5665fe3c580aa395ace68d1 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Phantom.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Phantom.java
@@ -171,6 +171,11 @@ public class Phantom extends FlyingMob implements Enemy {
@@ -172,6 +172,11 @@ public class Phantom extends FlyingMob implements Enemy {
}
this.setPhantomSize(nbt.getInt("Size"));
@ -20,7 +20,7 @@ index 7582efc69928718a164f704a54bce026ad6f7dd9..9bd6e71ea38bf050832f0f7bbed4a5db
}
@Override
@@ -180,6 +185,11 @@ public class Phantom extends FlyingMob implements Enemy {
@@ -181,6 +186,11 @@ public class Phantom extends FlyingMob implements Enemy {
nbt.putInt("AY", this.anchorPoint.getY());
nbt.putInt("AZ", this.anchorPoint.getZ());
nbt.putInt("Size", this.getPhantomSize());
@ -32,8 +32,8 @@ index 7582efc69928718a164f704a54bce026ad6f7dd9..9bd6e71ea38bf050832f0f7bbed4a5db
}
@Override
@@ -236,6 +246,14 @@ public class Phantom extends FlyingMob implements Enemy {
return (double) this.getEyeHeight();
@@ -241,6 +251,14 @@ public class Phantom extends FlyingMob implements Enemy {
return -0.125F;
}
+ // Paper start

View File

@ -6,10 +6,10 @@ Subject: [PATCH] Make CraftWorld#loadChunk(int, int, false) load unconverted
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 58f261162627c3065bb1b518e0e99f5c822c022c..57f9324aa73be4fcbb9668ef7be6b6e64d57800e 100644
index a9089569e063b5124c246b52b10f4a5728af49e0..b7c5d1c9db8284e2ed51da603ebed36be1563046 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -400,7 +400,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@@ -397,7 +397,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@Override
public boolean loadChunk(int x, int z, boolean generate) {
org.spigotmc.AsyncCatcher.catchOp("chunk load"); // Spigot

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Add ray tracing methods to LivingEntity
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index fe14ebe86ce2bc5835e51c7bbe56a5d69fa02bea..c995c8ac6785e5f8951013f3a37127573351c2c7 100644
index 7d7c8772bd8dfb96cfff2c1f020719c0156a09cd..8f8f343139444cc6fddf0d13083194ec7bbce545 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3771,6 +3771,20 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -3830,6 +3830,20 @@ public abstract class LivingEntity extends Entity implements Attackable {
}
// Paper start
@ -30,7 +30,7 @@ index fe14ebe86ce2bc5835e51c7bbe56a5d69fa02bea..c995c8ac6785e5f8951013f3a3712757
public int getShieldBlockingDelay() {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
index f79118891ca87515cbcea8b798e434cb57bbe494..0707329670292551d966afe30818f17d079fcb3b 100644
index f8340bd15c978c2b9124ee57dd55484bfd608f62..3d9e4ebb29f670d32bfe044ad22daaf82313498d 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -201,6 +201,33 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {