Update to Minecraft 1.17.1 (#6097)

This commit is contained in:
Nassim Jahnke 2021-07-07 08:52:40 +02:00
parent 43f52d9c13
commit 7037cd401f
58 changed files with 182 additions and 258 deletions

View file

@ -2,5 +2,5 @@
# Merchant.getLevel() # Merchant.getLevel()
# Entity.getCommandSenderWorld() # Entity.getCommandSenderWorld()
# to getWorld(), which confuses our ability to map this method properly. This patch disambiguates it # to getWorld(), which confuses our ability to map this method properly. This patch disambiguates it
net/minecraft/world/item/trading/IMerchant fD ()Lnet/minecraft/world/level/World; getLevel net/minecraft/world/item/trading/IMerchant fE ()Lnet/minecraft/world/level/World; getLevel
net/minecraft/world/entity/npc/EntityVillagerAbstract fD ()Lnet/minecraft/world/level/World; getLevel net/minecraft/world/entity/npc/EntityVillagerAbstract fE ()Lnet/minecraft/world/level/World; getLevel

View file

@ -35,7 +35,7 @@ c net/minecraft/world/level/block/MultifaceBlock net/minecraft/world/level/block
# another missed one # another missed one
c net/minecraft/server/players/UserCache net/minecraft/server/players/GameProfileCache c net/minecraft/server/players/UserCache net/minecraft/server/players/GameProfileCache
m (Ljava/lang/String;)Lcom/mojang/authlib/GameProfile; getProfile get m (Ljava/lang/String;)Ljava/util/Optional; getProfile get
p 0 name p 0 name
# change dimension in ServerPlayer # change dimension in ServerPlayer

View file

@ -228,3 +228,6 @@ public net.minecraft.world.level.block.entity.AbstractFurnaceBlockEntity recipeT
# Improve CraftChunk#getEntities # Improve CraftChunk#getEntities
public net.minecraft.world.level.entity.PersistentEntitySectionManager sectionStorage public net.minecraft.world.level.entity.PersistentEntitySectionManager sectionStorage
# Optimize light engine
public-f net.minecraft.world.level.chunk.DataLayer

View file

@ -71,7 +71,7 @@ repositories {
} }
dependencies { dependencies {
paramMappings("org.quiltmc:yarn:1.17+build.2:mergedv2") paramMappings("org.quiltmc:yarn:1.17.1+build.1:mergedv2")
remapper("org.quiltmc:tiny-remapper:0.4.1") remapper("org.quiltmc:tiny-remapper:0.4.1")
decompiler("net.minecraftforge:forgeflower:1.5.498.12") decompiler("net.minecraftforge:forgeflower:1.5.498.12")
paperclip("io.papermc:paperclip:2.0.1") paperclip("io.papermc:paperclip:2.0.1")

View file

@ -1,7 +1,7 @@
group = io.papermc.paper group = io.papermc.paper
version = 1.17-R0.1-SNAPSHOT version = 1.17.1-R0.1-SNAPSHOT
mcVersion = 1.17 mcVersion = 1.17.1
org.gradle.parallel=true org.gradle.parallel=true
org.gradle.vfs.watch=false org.gradle.vfs.watch=false

View file

@ -32,7 +32,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
compileOnly("org.apache.maven:maven-resolver-provider:3.8.1") compileOnly("org.apache.maven:maven-resolver-provider:3.8.1")
compileOnly("org.apache.maven.resolver:maven-resolver-connector-basic:1.7.0") compileOnly("org.apache.maven.resolver:maven-resolver-connector-basic:1.7.0")
@@ -0,0 +0,0 @@ tasks.withType<Javadoc>().configureEach { @@ -0,0 +0,0 @@ tasks.withType<Javadoc>().configureEach {
"https://javadoc.io/doc/org.yaml/snakeyaml/1.27/", "https://javadoc.io/doc/org.yaml/snakeyaml/1.28/",
"https://javadoc.io/doc/org.jetbrains/annotations/21.0.1/", // Paper - we don't want Java 5 annotations "https://javadoc.io/doc/org.jetbrains/annotations/21.0.1/", // Paper - we don't want Java 5 annotations
"https://javadoc.io/doc/net.md-5/bungeecord-chat/1.16-R0.4/", "https://javadoc.io/doc/net.md-5/bungeecord-chat/1.16-R0.4/",
+ // Paper start + // Paper start
@ -1141,8 +1141,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
/** /**
@@ -0,0 +0,0 @@ public interface Sign extends TileState, Colorable { @@ -0,0 +0,0 @@ public interface Sign extends TileState, Colorable {
* @param index Line number to get the text from, starting at 0 * @param index Line number to get the text from, starting at 0
* @throws IndexOutOfBoundsException Thrown when the line does not exist
* @return Text on the given line * @return Text on the given line
* @throws IndexOutOfBoundsException Thrown when the line does not exist
+ * @deprecated in favour of {@link #line(int)} + * @deprecated in favour of {@link #line(int)}
*/ */
@NotNull @NotNull
@ -2344,9 +2344,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
} }
/** /**
* @see Player#getLocale()
*
* @return the player's new locale * @return the player's new locale
* @see Player#getLocale()
+ * @deprecated in favour of {@link #locale()} + * @deprecated in favour of {@link #locale()}
*/ */
@NotNull @NotNull

View file

@ -27,8 +27,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ tasks.withType<Javadoc>().configureEach { @@ -0,0 +0,0 @@ tasks.withType<Javadoc>().configureEach {
(options as StandardJavadocDocletOptions).links( (options as StandardJavadocDocletOptions).links(
"https://guava.dev/releases/21.0/api/docs/", "https://guava.dev/releases/21.0/api/docs/",
"https://javadoc.io/doc/org.yaml/snakeyaml/1.27/", "https://javadoc.io/doc/org.yaml/snakeyaml/1.28/",
- "https://javadoc.io/doc/org.jetbrains/annotations-java5/20.1.0/", - "https://javadoc.io/doc/org.jetbrains/annotations-java5/21.0.1/",
+ "https://javadoc.io/doc/org.jetbrains/annotations/21.0.1/", // Paper - we don't want Java 5 annotations + "https://javadoc.io/doc/org.jetbrains/annotations/21.0.1/", // Paper - we don't want Java 5 annotations
"https://javadoc.io/doc/net.md-5/bungeecord-chat/1.16-R0.4/", "https://javadoc.io/doc/net.md-5/bungeecord-chat/1.16-R0.4/",
) )

View file

@ -85,8 +85,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+tasks.withType<Javadoc>().configureEach { +tasks.withType<Javadoc>().configureEach {
+ (options as StandardJavadocDocletOptions).links( + (options as StandardJavadocDocletOptions).links(
+ "https://guava.dev/releases/21.0/api/docs/", + "https://guava.dev/releases/21.0/api/docs/",
+ "https://javadoc.io/doc/org.yaml/snakeyaml/1.27/", + "https://javadoc.io/doc/org.yaml/snakeyaml/1.28/",
+ "https://javadoc.io/doc/org.jetbrains/annotations-java5/20.1.0/", + "https://javadoc.io/doc/org.jetbrains/annotations-java5/21.0.1/",
+ "https://javadoc.io/doc/net.md-5/bungeecord-chat/1.16-R0.4/", + "https://javadoc.io/doc/net.md-5/bungeecord-chat/1.16-R0.4/",
+ ) + )
+} +}
@ -103,7 +103,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- -
- <groupId>org.spigotmc</groupId> - <groupId>org.spigotmc</groupId>
- <artifactId>spigot-api</artifactId> - <artifactId>spigot-api</artifactId>
- <version>1.17-R0.1-SNAPSHOT</version> - <version>1.17.1-R0.1-SNAPSHOT</version>
- <packaging>jar</packaging> - <packaging>jar</packaging>
- -
- <name>Spigot-API</name> - <name>Spigot-API</name>
@ -241,7 +241,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- <dependency> - <dependency>
- <groupId>org.eclipse.jdt</groupId> - <groupId>org.eclipse.jdt</groupId>
- <artifactId>ecj</artifactId> - <artifactId>ecj</artifactId>
- <version>3.24.0</version> - <version>3.26.0</version>
- </dependency> - </dependency>
- </dependencies> - </dependencies>
- </plugin> - </plugin>
@ -263,7 +263,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- <plugin> - <plugin>
- <groupId>org.apache.maven.plugins</groupId> - <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-shade-plugin</artifactId> - <artifactId>maven-shade-plugin</artifactId>
- <version>3.2.3</version> - <version>3.2.4</version>
- <executions> - <executions>
- <execution> - <execution>
- <phase>package</phase> - <phase>package</phase>
@ -288,12 +288,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- <plugin> - <plugin>
- <groupId>org.apache.maven.plugins</groupId> - <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-javadoc-plugin</artifactId> - <artifactId>maven-javadoc-plugin</artifactId>
- <version>3.2.0</version> - <version>3.3.0</version>
- <configuration> - <configuration>
- <links> - <links>
- <link>https://guava.dev/releases/21.0/api/docs/</link> - <link>https://guava.dev/releases/21.0/api/docs/</link>
- <link>https://javadoc.io/doc/org.yaml/snakeyaml/1.27/</link> - <link>https://javadoc.io/doc/org.yaml/snakeyaml/1.28/</link>
- <link>https://javadoc.io/doc/org.jetbrains/annotations-java5/20.1.0/</link> - <link>https://javadoc.io/doc/org.jetbrains/annotations-java5/21.0.1/</link>
- <link>https://javadoc.io/doc/net.md-5/bungeecord-chat/1.16-R0.4/</link> - <link>https://javadoc.io/doc/net.md-5/bungeecord-chat/1.16-R0.4/</link>
- </links> - </links>
- </configuration> - </configuration>
@ -312,7 +312,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- <plugin> - <plugin>
- <groupId>org.apache.maven.plugins</groupId> - <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-checkstyle-plugin</artifactId> - <artifactId>maven-checkstyle-plugin</artifactId>
- <version>3.1.1</version> - <version>3.1.2</version>
- <executions> - <executions>
- <execution> - <execution>
- <phase>process-classes</phase> - <phase>process-classes</phase>
@ -329,14 +329,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- <dependency> - <dependency>
- <groupId>com.puppycrawl.tools</groupId> - <groupId>com.puppycrawl.tools</groupId>
- <artifactId>checkstyle</artifactId> - <artifactId>checkstyle</artifactId>
- <version>8.39</version> - <version>8.44</version>
- </dependency> - </dependency>
- </dependencies> - </dependencies>
- </plugin> - </plugin>
- <plugin> - <plugin>
- <groupId>org.codehaus.mojo</groupId> - <groupId>org.codehaus.mojo</groupId>
- <artifactId>animal-sniffer-maven-plugin</artifactId> - <artifactId>animal-sniffer-maven-plugin</artifactId>
- <version>1.19</version> - <version>1.20</version>
- <executions> - <executions>
- <execution> - <execution>
- <phase>process-classes</phase> - <phase>process-classes</phase>

View file

@ -12,23 +12,23 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/org/bukkit/entity/ArmorStand.java --- a/src/main/java/org/bukkit/entity/ArmorStand.java
+++ b/src/main/java/org/bukkit/entity/ArmorStand.java +++ b/src/main/java/org/bukkit/entity/ArmorStand.java
@@ -0,0 +0,0 @@ public interface ArmorStand extends LivingEntity { @@ -0,0 +0,0 @@ public interface ArmorStand extends LivingEntity {
* Returns the item the armor stand is currently holding.
* *
* @return the held item * @return the held item
* @see #getEquipment()
- * @deprecated prefer {@link EntityEquipment#getItemInHand()} - * @deprecated prefer {@link EntityEquipment#getItemInHand()}
+ * @deprecated prefer {@link ArmorStand#getItem(EquipmentSlot)} // Paper + * @deprecated prefer {@link ArmorStand#getItem(EquipmentSlot)} // Paper
* @see #getEquipment()
*/ */
@NotNull @NotNull
@Deprecated
@@ -0,0 +0,0 @@ public interface ArmorStand extends LivingEntity { @@ -0,0 +0,0 @@ public interface ArmorStand extends LivingEntity {
*
* @param item the item to hold * @param item the item to hold
* @see #getEquipment()
* @deprecated prefer * @deprecated prefer
- * {@link EntityEquipment#setItemInHand(org.bukkit.inventory.ItemStack)} - * {@link EntityEquipment#setItemInHand(org.bukkit.inventory.ItemStack)}
+ * {@link ArmorStand#setItem(EquipmentSlot, ItemStack)} // Paper + * {@link ArmorStand#setItem(EquipmentSlot, ItemStack)} // Paper
* @see #getEquipment()
*/ */
@Deprecated @Deprecated
void setItemInHand(@Nullable ItemStack item);
@@ -0,0 +0,0 @@ public interface ArmorStand extends LivingEntity { @@ -0,0 +0,0 @@ public interface ArmorStand extends LivingEntity {
* @param tick {@code true} if this armour stand can tick, {@code false} otherwise * @param tick {@code true} if this armour stand can tick, {@code false} otherwise
*/ */

View file

@ -38,7 +38,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ player.loginTime = System.currentTimeMillis(); // Paper + player.loginTime = System.currentTimeMillis(); // Paper
GameProfile gameprofile = player.getGameProfile(); GameProfile gameprofile = player.getGameProfile();
GameProfileCache usercache = this.server.getProfileCache(); GameProfileCache usercache = this.server.getProfileCache();
GameProfile gameprofile1 = usercache.get(gameprofile.getId()); Optional<GameProfile> optional = usercache.get(gameprofile.getId());
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java b/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java b/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java --- a/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java

View file

@ -94,8 +94,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public org.bukkit.generator.ChunkGenerator generator; public org.bukkit.generator.ChunkGenerator generator;
+ public static final boolean DEBUG_ENTITIES = Boolean.getBoolean("debug.entities"); // Paper + public static final boolean DEBUG_ENTITIES = Boolean.getBoolean("debug.entities"); // Paper
public boolean preventPoiUpdated = false; // CraftBukkit - SPIGOT-5710
public boolean captureBlockStates = false; public boolean captureBlockStates = false;
public boolean captureTreeGeneration = false;
diff --git a/src/main/java/net/minecraft/world/level/entity/EntityLookup.java b/src/main/java/net/minecraft/world/level/entity/EntityLookup.java diff --git a/src/main/java/net/minecraft/world/level/entity/EntityLookup.java b/src/main/java/net/minecraft/world/level/entity/EntityLookup.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/entity/EntityLookup.java --- a/src/main/java/net/minecraft/world/level/entity/EntityLookup.java

View file

@ -165,15 +165,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
return; return;
} }
this.player.getInventory().pickSlot(packet.getSlot()); // Paper - Diff above if changed this.player.getInventory().pickSlot(packet.getSlot()); // Paper - Diff above if changed
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
ListTag pageList = testStack.getTag().getList("pages", 8);
if (pageList.size() > 100) {
ServerGamePacketListenerImpl.LOGGER.warn(this.player.getScoreboardName() + " tried to send a book with too many pages");
- server.scheduleOnMain(() -> this.disconnect("Book too large!"));
+ server.scheduleOnMain(() -> this.disconnect("Book too large!", org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_ACTION)); // Paper - kick event cause
return;
}
long byteTotal = 0;
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
int byteLength = testString.getBytes(java.nio.charset.StandardCharsets.UTF_8).length; int byteLength = testString.getBytes(java.nio.charset.StandardCharsets.UTF_8).length;
if (byteLength > 256 * 4) { if (byteLength > 256 * 4) {

View file

@ -25,4 +25,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper end + // Paper end
@Override @Override
public boolean dropItem(boolean dropAll) { public boolean dropItem(boolean dropAll) {
return this.getHandle().drop(dropAll); if (!(this.getHandle() instanceof ServerPlayer)) return false;

View file

@ -77,5 +77,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- if ( this.getOnlineMode() || org.spigotmc.SpigotConfig.bungee ) - if ( this.getOnlineMode() || org.spigotmc.SpigotConfig.bungee )
+ if ( this.getOnlineMode() || com.destroystokyo.paper.PaperConfig.isProxyOnlineMode() ) // Paper - Handle via setting + if ( this.getOnlineMode() || com.destroystokyo.paper.PaperConfig.isProxyOnlineMode() ) // Paper - Handle via setting
{ {
profile = this.console.getProfileCache().get( name ); profile = this.console.getProfileCache().get(name).orElse(null);
} }

View file

@ -1448,7 +1448,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+import io.papermc.paper.adventure.PaperAdventure; +import io.papermc.paper.adventure.PaperAdventure;
import java.io.File; import java.io.File;
import java.net.SocketAddress; import java.net.SocketAddress;
import java.text.SimpleDateFormat; import java.nio.file.Path;
@@ -0,0 +0,0 @@ import org.apache.logging.log4j.LogManager; @@ -0,0 +0,0 @@ import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
@ -2443,9 +2443,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ final ServerGamePacketListenerImpl connection = player.connection; + final ServerGamePacketListenerImpl connection = player.connection;
+ final net.minecraft.world.entity.player.Inventory inventory = player.getInventory(); + final net.minecraft.world.entity.player.Inventory inventory = player.getInventory();
+ final int slot = inventory.items.size() + inventory.selected; + final int slot = inventory.items.size() + inventory.selected;
+ connection.send(new net.minecraft.network.protocol.game.ClientboundContainerSetSlotPacket(0, slot, item)); + final int stateId = getHandle().containerMenu.getStateId();
+ connection.send(new net.minecraft.network.protocol.game.ClientboundContainerSetSlotPacket(0, stateId, slot, item));
+ connection.send(new net.minecraft.network.protocol.game.ClientboundOpenBookPacket(net.minecraft.world.InteractionHand.MAIN_HAND)); + connection.send(new net.minecraft.network.protocol.game.ClientboundOpenBookPacket(net.minecraft.world.InteractionHand.MAIN_HAND));
+ connection.send(new net.minecraft.network.protocol.game.ClientboundContainerSetSlotPacket(0, slot, inventory.getSelected())); + connection.send(new net.minecraft.network.protocol.game.ClientboundContainerSetSlotPacket(0, stateId, slot, inventory.getSelected()));
+ } + }
+ // Paper end + // Paper end
+ +

View file

@ -14,8 +14,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
placeEvent.getPlayer().updateInventory(); placeEvent.getPlayer().updateInventory();
+ world.capturedTileEntities.clear(); // Paper - clear out tile entities as chests and such will pop loot + world.capturedTileEntities.clear(); // Paper - clear out tile entities as chests and such will pop loot
// revert back all captured blocks // revert back all captured blocks
world.preventPoiUpdated = true; // CraftBukkit - SPIGOT-5710
for (BlockState blockstate : blocks) { for (BlockState blockstate : blocks) {
blockstate.update(true, false);
diff --git a/src/main/java/net/minecraft/world/level/block/entity/ChestBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/ChestBlockEntity.java diff --git a/src/main/java/net/minecraft/world/level/block/entity/ChestBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/ChestBlockEntity.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/ChestBlockEntity.java --- a/src/main/java/net/minecraft/world/level/block/entity/ChestBlockEntity.java

View file

@ -46,14 +46,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // If the event isn't handled, we can assume that we have no completions, and so we'll ask the server + // If the event isn't handled, we can assume that we have no completions, and so we'll ask the server
+ if (!event.isHandled()) { + if (!event.isHandled()) {
+ if (!event.isCancelled()) { + if (!event.isCancelled()) {
+
+ this.server.scheduleOnMain(() -> { // Paper - This needs to be on main
+ ParseResults<CommandSourceStack> parseresults = this.server.getCommands().getDispatcher().parse(stringreader, this.player.createCommandSourceStack());
- this.server.getCommands().getDispatcher().getCompletionSuggestions(parseresults).thenAccept((suggestions) -> { - this.server.getCommands().getDispatcher().getCompletionSuggestions(parseresults).thenAccept((suggestions) -> {
- if (suggestions.isEmpty()) return; // CraftBukkit - don't send through empty suggestions - prevents [<args>] from showing for plugins with nothing more to offer - if (suggestions.isEmpty()) return; // CraftBukkit - don't send through empty suggestions - prevents [<args>] from showing for plugins with nothing more to offer
- this.connection.send(new ClientboundCommandSuggestionsPacket(packet.getId(), suggestions)); - this.connection.send(new ClientboundCommandSuggestionsPacket(packet.getId(), suggestions));
- }); - });
+ this.server.scheduleOnMain(() -> { // Paper - This needs to be on main
+ ParseResults<CommandSourceStack> parseresults = this.server.getCommands().getDispatcher().parse(stringreader, this.player.createCommandSourceStack());
+
+ this.server.getCommands().getDispatcher().getCompletionSuggestions(parseresults).thenAccept((suggestions) -> { + this.server.getCommands().getDispatcher().getCompletionSuggestions(parseresults).thenAccept((suggestions) -> {
+ if (suggestions.isEmpty()) return; // CraftBukkit - don't send through empty suggestions - prevents [<args>] from showing for plugins with nothing more to offer + if (suggestions.isEmpty()) return; // CraftBukkit - don't send through empty suggestions - prevents [<args>] from showing for plugins with nothing more to offer
+ this.connection.send(new ClientboundCommandSuggestionsPacket(packet.getId(), suggestions)); + this.connection.send(new ClientboundCommandSuggestionsPacket(packet.getId(), suggestions));

View file

@ -2362,9 +2362,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- this.flushWorker(); - this.flushWorker();
+ this.level.asyncChunkTaskManager.flush(); // Paper - flush to preserve behavior compat with pre-async behaviour + this.level.asyncChunkTaskManager.flush(); // Paper - flush to preserve behavior compat with pre-async behaviour
+// this.i(); // Paper - nuke IOWorker +// this.i(); // Paper - nuke IOWorker
ChunkMap.LOGGER.info("ThreadedAnvilChunkStorage ({}): All chunks are saved", this.storageFolder.getName());
} else { } else {
this.visibleChunkMap.values().stream().filter(ChunkHolder::wasAccessibleSinceLastSave).forEach((playerchunk) -> { this.visibleChunkMap.values().stream().filter(ChunkHolder::wasAccessibleSinceLastSave).forEach((playerchunk) -> {
ChunkAccess ichunkaccess = (ChunkAccess) playerchunk.getChunkToSave().getNow(null); // CraftBukkit - decompile error
@@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
} }
@ -3355,7 +3355,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
} }
public void flushWorker() { public void flushWorker() {
- this.worker.synchronize().join(); - this.worker.synchronize(true).join();
+ com.destroystokyo.paper.io.PaperFileIOThread.Holder.INSTANCE.flush(); // Paper - nuke IO worker + com.destroystokyo.paper.io.PaperFileIOThread.Holder.INSTANCE.flush(); // Paper - nuke IO worker
} }

View file

@ -1,28 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Shane Freeder <theboyetronic@gmail.com>
Date: Wed, 30 Jun 2021 22:11:11 +0100
Subject: [PATCH] Backport MC-229191 ore distribution changes
diff --git a/src/main/java/net/minecraft/data/worldgen/Features.java b/src/main/java/net/minecraft/data/worldgen/Features.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/data/worldgen/Features.java
+++ b/src/main/java/net/minecraft/data/worldgen/Features.java
@@ -0,0 +0,0 @@ public class Features {
public static final ConfiguredFeature<?, ?> ORE_REDSTONE = register("ore_redstone", Feature.ORE.configured(ORE_REDSTONE_CONFIG).rangeUniform(VerticalAnchor.bottom(), VerticalAnchor.absolute(15)).squared().count(8));
public static final ConfiguredFeature<?, ?> PROTOTYPE_ORE_REDSTONE = register("prototype_ore_redstone", Feature.ORE.configured(ORE_REDSTONE_CONFIG).rangeUniform(VerticalAnchor.bottom(), VerticalAnchor.absolute(15)).squared().count(4));
public static final ConfiguredFeature<?, ?> PROTOTYPE_ORE_REDSTONE_LOWER = register("prototype_ore_redstone_lower", Feature.ORE.configured(ORE_REDSTONE_CONFIG).rangeTriangle(VerticalAnchor.aboveBottom(-32), VerticalAnchor.aboveBottom(32)).squared().count(8));
- public static final ConfiguredFeature<?, ?> ORE_DIAMOND = register("ore_diamond", Feature.ORE.configured(new OreConfiguration(ORE_DIAMOND_TARGET_LIST, 8)).rangeUniform(VerticalAnchor.bottom(), VerticalAnchor.absolute(16)).squared());
+ public static final ConfiguredFeature<?, ?> ORE_DIAMOND = register("ore_diamond", Feature.ORE.configured(new OreConfiguration(ORE_DIAMOND_TARGET_LIST, 8)).rangeUniform(VerticalAnchor.bottom(), VerticalAnchor.absolute(15)).squared()); // Paper
public static final ConfiguredFeature<?, ?> PROTOTYPE_ORE_DIAMOND = register("prototype_ore_diamond", Feature.ORE.configured(new OreConfiguration(ORE_DIAMOND_TARGET_LIST, 4, 0.5F)).rangeTriangle(VerticalAnchor.aboveBottom(-80), VerticalAnchor.aboveBottom(80)).squared().count(6));
public static final ConfiguredFeature<?, ?> PROTOTYPE_ORE_DIAMOND_LARGE = register("prototype_ore_diamond_large", Feature.ORE.configured(new OreConfiguration(ORE_DIAMOND_TARGET_LIST, 12, 0.7F)).rangeTriangle(VerticalAnchor.aboveBottom(-80), VerticalAnchor.aboveBottom(80)).squared().rarity(9));
public static final ConfiguredFeature<?, ?> ORE_LAPIS = register("ore_lapis", Feature.ORE.configured(new OreConfiguration(ORE_LAPIS_TARGET_LIST, 7)).rangeTriangle(VerticalAnchor.absolute(0), VerticalAnchor.absolute(30)).squared());
@@ -0,0 +0,0 @@ public class Features {
public static final ConfiguredFeature<?, ?> PROTOTYPE_ORE_LAPIS_BURIED = register("prototype_ore_lapis_buried", Feature.SCATTERED_ORE.configured(new OreConfiguration(ORE_LAPIS_TARGET_LIST, 7, 1.0F)).rangeUniform(VerticalAnchor.bottom(), VerticalAnchor.absolute(64)).squared().count(4));
public static final ConfiguredFeature<?, ?> ORE_INFESTED = register("ore_infested", Feature.ORE.configured(new OreConfiguration(ORE_INFESTED_TARGET_LIST, 9)).rangeUniform(VerticalAnchor.bottom(), VerticalAnchor.absolute(63)).squared().count(7));
public static final ConfiguredFeature<?, ?> PROTOTYPE_ORE_INFESTED = register("prototype_ore_infested", Feature.ORE.configured(new OreConfiguration(ORE_INFESTED_TARGET_LIST, 9)).rangeUniform(VerticalAnchor.bottom(), VerticalAnchor.absolute(63)).squared().count(14));
- public static final ConfiguredFeature<?, ?> ORE_EMERALD = register("ore_emerald", Feature.REPLACE_SINGLE_BLOCK.configured(new ReplaceBlockConfiguration(ORE_EMERALD_TARGET_LIST)).rangeUniform(VerticalAnchor.absolute(4), VerticalAnchor.absolute(31)).squared().count(UniformInt.of(6, 24)));
+ public static final ConfiguredFeature<?, ?> ORE_EMERALD = register("ore_emerald", Feature.REPLACE_SINGLE_BLOCK.configured(new ReplaceBlockConfiguration(ORE_EMERALD_TARGET_LIST)).rangeUniform(VerticalAnchor.absolute(4), VerticalAnchor.absolute(31)).squared().count(UniformInt.of(3, 8))); // Paper
public static final ConfiguredFeature<?, ?> PROTOTYPE_ORE_EMERALD = register("prototype_ore_emerald", Feature.ORE.configured(new OreConfiguration(ORE_EMERALD_TARGET_LIST, 3)).rangeTriangle(VerticalAnchor.absolute(32), VerticalAnchor.absolute(480)).squared().count(50));
public static final ConfiguredFeature<?, ?> ORE_DEBRIS_LARGE = register("ore_debris_large", Feature.SCATTERED_ORE.configured(new OreConfiguration(OreConfiguration.Predicates.NETHER_ORE_REPLACEABLES, Features.States.ANCIENT_DEBRIS, 3, 1.0F)).rangeTriangle(VerticalAnchor.absolute(8), VerticalAnchor.absolute(24)).squared());
public static final ConfiguredFeature<?, ?> ORE_DEBRIS_SMALL = register("ore_debris_small", Feature.SCATTERED_ORE.configured(new OreConfiguration(OreConfiguration.Predicates.NETHER_ORE_REPLACEABLES, Features.States.ANCIENT_DEBRIS, 2, 1.0F)).range(Features.Decorators.RANGE_8_8).squared());

View file

@ -13,8 +13,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ @@ -0,0 +0,0 @@
+package com.destroystokyo.paper.profile; +package com.destroystokyo.paper.profile;
+ +
+import com.destroystokyo.paper.profile.PlayerProfile;
+import com.destroystokyo.paper.profile.ProfileProperty;
+import com.destroystokyo.paper.PaperConfig; +import com.destroystokyo.paper.PaperConfig;
+import com.google.common.base.Charsets; +import com.google.common.base.Charsets;
+import com.mojang.authlib.GameProfile; +import com.mojang.authlib.GameProfile;
@ -24,7 +22,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+import net.minecraft.server.players.GameProfileCache; +import net.minecraft.server.players.GameProfileCache;
+import org.apache.commons.lang3.Validate; +import org.apache.commons.lang3.Validate;
+import org.bukkit.craftbukkit.entity.CraftPlayer; +import org.bukkit.craftbukkit.entity.CraftPlayer;
+import org.spigotmc.SpigotConfig;
+ +
+import javax.annotation.Nonnull; +import javax.annotation.Nonnull;
+import javax.annotation.Nullable; +import javax.annotation.Nullable;
@ -32,6 +29,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+import java.util.Collection; +import java.util.Collection;
+import java.util.Iterator; +import java.util.Iterator;
+import java.util.Objects; +import java.util.Objects;
+import java.util.Optional;
+import java.util.Set; +import java.util.Set;
+import java.util.UUID; +import java.util.UUID;
+ +
@ -166,7 +164,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ if (profile.getId() == null) { + if (profile.getId() == null) {
+ final GameProfile profile; + final GameProfile profile;
+ if (onlineMode) { + if (onlineMode) {
+ profile = lookupUUID ? userCache.get(name) : userCache.getProfileIfCached(name); + profile = lookupUUID ? userCache.get(name).orElse(null) : userCache.getProfileIfCached(name);
+ } else { + } else {
+ // Make an OfflinePlayer using an offline mode UUID since the name has no profile + // Make an OfflinePlayer using an offline mode UUID since the name has no profile
+ profile = new GameProfile(UUID.nameUUIDFromBytes(("OfflinePlayer:" + name).getBytes(Charsets.UTF_8)), name); + profile = new GameProfile(UUID.nameUUIDFromBytes(("OfflinePlayer:" + name).getBytes(Charsets.UTF_8)), name);
@ -179,8 +177,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ } + }
+ +
+ if ((profile.getName() == null || !hasTextures()) && profile.getId() != null) { + if ((profile.getName() == null || !hasTextures()) && profile.getId() != null) {
+ GameProfile profile = userCache.get(this.profile.getId()); + Optional<GameProfile> optProfile = userCache.get(this.profile.getId());
+ if (profile != null) { + if (optProfile.isPresent()) {
+ GameProfile profile = optProfile.get();
+ if (this.profile.getName() == null) { + if (this.profile.getName() == null) {
+ // if old has it, assume its newer, so overwrite, else use cached if it was set and ours wasn't + // if old has it, assume its newer, so overwrite, else use cached if it was set and ours wasn't
+ copyProfileProperties(this.profile, profile); + copyProfileProperties(this.profile, profile);
@ -478,7 +477,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/players/GameProfileCache.java --- a/src/main/java/net/minecraft/server/players/GameProfileCache.java
+++ b/src/main/java/net/minecraft/server/players/GameProfileCache.java +++ b/src/main/java/net/minecraft/server/players/GameProfileCache.java
@@ -0,0 +0,0 @@ public class GameProfileCache { @@ -0,0 +0,0 @@ public class GameProfileCache {
} return this.operationCount.incrementAndGet();
} }
+ // Paper start + // Paper start
@ -488,9 +487,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ } + }
+ // Paper end + // Paper end
+ +
@Nullable public synchronized Optional<GameProfile> get(String name) { // Paper - synchronize
public GameProfile get(UUID uuid) { String s1 = name.toLowerCase(Locale.ROOT);
GameProfileCache.GameProfileInfo usercache_usercacheentry = (GameProfileCache.GameProfileInfo) this.profilesByUUID.get(uuid); GameProfileCache.GameProfileInfo usercache_usercacheentry = (GameProfileCache.GameProfileInfo) this.profilesByName.get(s1);
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java

View file

@ -16,7 +16,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ public static int maxBookPageSize = 2560; + public static int maxBookPageSize = 2560;
+ public static double maxBookTotalSizeMultiplier = 0.98D; + public static double maxBookTotalSizeMultiplier = 0.98D;
+ private static void maxBookSize() { + private static void maxBookSize() {
+ maxBookPageSize = getInt("settings.book-size.page-max", maxBookPageSize); + maxBookPageSize = Math.min(8192, getInt("settings.book-size.page-max", maxBookPageSize));
+ maxBookTotalSizeMultiplier = getDouble("settings.book-size.total-multiplier", maxBookTotalSizeMultiplier); + maxBookTotalSizeMultiplier = getDouble("settings.book-size.total-multiplier", maxBookTotalSizeMultiplier);
+ } + }
+ +
@ -32,20 +32,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@Override @Override
public void handleEditBook(ServerboundEditBookPacket packet) { public void handleEditBook(ServerboundEditBookPacket packet) {
+ // Paper start + // Paper start
+ ItemStack testStack = packet.getBook(); + if (!this.cserver.isPrimaryThread()) {
+ if (!this.cserver.isPrimaryThread() && !testStack.isEmpty() && testStack.getTag() != null) { + List<String> pageList = packet.getPages();
+ ListTag pageList = testStack.getTag().getList("pages", 8);
+ if (pageList.size() > 100) {
+ ServerGamePacketListenerImpl.LOGGER.warn(this.player.getScoreboardName() + " tried to send a book with too many pages");
+ server.scheduleOnMain(() -> this.disconnect("Book too large!"));
+ return;
+ }
+ long byteTotal = 0; + long byteTotal = 0;
+ int maxBookPageSize = com.destroystokyo.paper.PaperConfig.maxBookPageSize; + int maxBookPageSize = com.destroystokyo.paper.PaperConfig.maxBookPageSize;
+ double multiplier = Math.max(0.3D, Math.min(1D, com.destroystokyo.paper.PaperConfig.maxBookTotalSizeMultiplier)); + double multiplier = Math.max(0.3D, Math.min(1D, com.destroystokyo.paper.PaperConfig.maxBookTotalSizeMultiplier));
+ long byteAllowed = maxBookPageSize; + long byteAllowed = maxBookPageSize;
+ for (int i = 0; i < pageList.size(); ++i) { + for (String testString : pageList) {
+ String testString = pageList.getString(i);
+ int byteLength = testString.getBytes(java.nio.charset.StandardCharsets.UTF_8).length; + int byteLength = testString.getBytes(java.nio.charset.StandardCharsets.UTF_8).length;
+ if (byteLength > 256 * 4) { + if (byteLength > 256 * 4) {
+ ServerGamePacketListenerImpl.LOGGER.warn(this.player.getScoreboardName() + " tried to send a book with with a page too large!"); + ServerGamePacketListenerImpl.LOGGER.warn(this.player.getScoreboardName() + " tried to send a book with with a page too large!");

View file

@ -35,7 +35,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- } - }
+ ServerChunkCache chunkproviderserver = worldserver.getChunkSource(); // Paper + ServerChunkCache chunkproviderserver = worldserver.getChunkSource(); // Paper
// WorldServer worldserver = this.F(); // WorldServer worldserver = this.E();
this.forceTicks = true; this.forceTicks = true;
// CraftBukkit end // CraftBukkit end
+ if (worldserver.getWorld().getKeepSpawnInMemory()) { // Paper + if (worldserver.getWorld().getKeepSpawnInMemory()) { // Paper

View file

@ -11,7 +11,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java +++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java
@@ -0,0 +0,0 @@ public class DedicatedServerProperties extends Settings<DedicatedServerPropertie @@ -0,0 +0,0 @@ public class DedicatedServerProperties extends Settings<DedicatedServerPropertie
@Nullable @Nullable
public WorldGenSettings worldGenSettings; private WorldGenSettings worldGenSettings;
+ public final String rconIp; // Paper - Add rcon ip + public final String rconIp; // Paper - Add rcon ip
+ +

View file

@ -1,42 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Shane Freeder <theboyetronic@gmail.com>
Date: Tue, 29 Jun 2021 17:17:34 +0100
Subject: [PATCH] Don't complete skull lookups on main thread (MC-227435)
diff --git a/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java
@@ -0,0 +0,0 @@ public class SkullBlockEntity extends BlockEntity {
public static void updateGameprofile(@Nullable GameProfile owner, Consumer<GameProfile> callback) {
if (owner != null && !StringUtil.isNullOrEmpty(owner.getName()) && (!owner.isComplete() || !owner.getProperties().containsKey("textures")) && SkullBlockEntity.profileCache != null && SkullBlockEntity.sessionService != null) {
- SkullBlockEntity.profileCache.getAsync(owner.getName(), (gameprofile1) -> {
+ // Paper start
+ SkullBlockEntity.profileCache.getAsync(owner.getName(), (gameprofile) -> {
+ if (gameprofile == null) {
+ net.minecraft.server.MinecraftServer.getServer().scheduleOnMain(() -> callback.accept(owner));
+ return;
+ }
+ Runnable runnable = () -> {
+ GameProfile gameprofile1 = gameprofile;
Property property = (Property) Iterables.getFirst(gameprofile1.getProperties().get("textures"), (Object) null);
if (property == null) {
gameprofile1 = SkullBlockEntity.sessionService.fillProfileProperties(gameprofile1, true);
}
- SkullBlockEntity.profileCache.add(gameprofile1);
- callback.accept(gameprofile1);
+ GameProfile finalGameprofile = gameprofile1;
+ net.minecraft.server.MinecraftServer.getServer().scheduleOnMain(() -> {
+ SkullBlockEntity.profileCache.add(finalGameprofile);
+ callback.accept(finalGameprofile);
+ });
+ };
+ net.minecraft.Util.backgroundExecutor().execute(runnable);
+ // Paper end
});
} else {
callback.accept(owner);

View file

@ -16,4 +16,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ if (!GameProfileCache.usesAuthentication() && gameprofile == null && !org.apache.commons.lang3.StringUtils.isBlank(name)) { // Paper - Don't lookup a profile with a blank name + if (!GameProfileCache.usesAuthentication() && gameprofile == null && !org.apache.commons.lang3.StringUtils.isBlank(name)) { // Paper - Don't lookup a profile with a blank name
UUID uuid = Player.createPlayerUUID(new GameProfile((UUID) null, name)); UUID uuid = Player.createPlayerUUID(new GameProfile((UUID) null, name));
gameprofile = new GameProfile(uuid, name); return Optional.of(new GameProfile(uuid, name));

View file

@ -210,7 +210,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.processChunkUnload(pos); this.processChunkUnload(pos);
@@ -0,0 +0,0 @@ public class PersistentEntitySectionManager<T extends EntityAccess> implements A @@ -0,0 +0,0 @@ public class PersistentEntitySectionManager<T extends EntityAccess> implements A
while(!longSet.isEmpty()) { while(!longSet.isEmpty()) {
this.permanentStorage.flush(); this.permanentStorage.flush(false);
this.processPendingLoads(); this.processPendingLoads();
- longSet.removeIf((pos) -> { - longSet.removeIf((pos) -> {
+ longSet.removeIf((java.util.function.LongPredicate) (pos) -> { // Paper - decompile fix + longSet.removeIf((java.util.function.LongPredicate) (pos) -> { // Paper - decompile fix

View file

@ -10,7 +10,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
connection.send(new net.minecraft.network.protocol.game.ClientboundOpenBookPacket(net.minecraft.world.InteractionHand.MAIN_HAND)); connection.send(new net.minecraft.network.protocol.game.ClientboundOpenBookPacket(net.minecraft.world.InteractionHand.MAIN_HAND));
connection.send(new net.minecraft.network.protocol.game.ClientboundContainerSetSlotPacket(0, slot, inventory.getSelected())); connection.send(new net.minecraft.network.protocol.game.ClientboundContainerSetSlotPacket(0, stateId, slot, inventory.getSelected()));
} }
+ +
+ @Override + @Override

View file

@ -20,4 +20,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ return !this.horse.hasInventoryChanged(this.horseContainer) && this.horseContainer.stillValid(player) && (this.horse.isAlive() && this.horse.valid) && this.horse.distanceTo((Entity) player) < 8.0F; // Paper - Fix MC-161754 + return !this.horse.hasInventoryChanged(this.horseContainer) && this.horseContainer.stillValid(player) && (this.horse.isAlive() && this.horse.valid) && this.horse.distanceTo((Entity) player) < 8.0F; // Paper - Fix MC-161754
} }
private boolean hasChest(AbstractHorse entityhorseabstract) { private boolean hasChest(AbstractHorse horse) {

View file

@ -69,8 +69,8 @@ diff --git a/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEnti
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java --- a/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java
@@ -0,0 +0,0 @@ import java.util.function.Consumer; @@ -0,0 +0,0 @@ import javax.annotation.Nullable;
import javax.annotation.Nullable; import net.minecraft.Util;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
+import net.minecraft.nbt.ListTag; +import net.minecraft.nbt.ListTag;

View file

@ -71,10 +71,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.setDamageValue(this.getDamageValue()); this.setDamageValue(this.getDamageValue());
} }
@@ -0,0 +0,0 @@ public final class ItemStack { @@ -0,0 +0,0 @@ public final class ItemStack {
nbttagcompound.putString("id", String.valueOf(Registry.ENCHANTMENT.getKey(enchantment))); ListTag nbttaglist = this.tag.getList("Enchantments", 10);
nbttagcompound.putShort("lvl", (short) ((byte) level));
nbttaglist.add(nbttagcompound); nbttaglist.add(EnchantmentHelper.storeEnchantment(EnchantmentHelper.getEnchantmentId(enchantment), (byte) level));
+ processEnchantOrder(nbttagcompound); // Paper + processEnchantOrder(this.tag); // Paper
} }
public boolean isEnchanted() { public boolean isEnchanted() {

View file

@ -84,22 +84,22 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundContainerSetContentPacket.java --- a/src/main/java/net/minecraft/network/protocol/game/ClientboundContainerSetContentPacket.java
+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundContainerSetContentPacket.java +++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundContainerSetContentPacket.java
@@ -0,0 +0,0 @@ public class ClientboundContainerSetContentPacket implements Packet<ClientGamePa @@ -0,0 +0,0 @@ public class ClientboundContainerSetContentPacket implements Packet<ClientGamePa
private final int containerId; this.carriedItem = buf.readItem();
private final List<ItemStack> items; }
+ //Paper start + //Paper start
+ @Override + @Override
+ public boolean packetTooLarge(net.minecraft.network.Connection manager) { + public boolean packetTooLarge(net.minecraft.network.Connection manager) {
+ for (int i = 0 ; i < this.items.size() ; i++) { + for (int i = 0 ; i < this.items.size() ; i++) {
+ manager.send(new ClientboundContainerSetSlotPacket(this.containerId, i, this.items.get(i))); + manager.send(new ClientboundContainerSetSlotPacket(this.containerId, this.stateId, i, this.items.get(i)));
+ } + }
+ return true; + return true;
+ } + }
+ // Paper end + // Paper end
+ +
public ClientboundContainerSetContentPacket(int syncId, NonNullList<ItemStack> contents) { @Override
this.containerId = syncId; public void write(FriendlyByteBuf buf) {
this.items = NonNullList.withSize(contents.size(), ItemStack.EMPTY); buf.writeByte(this.containerId);
diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacket.java diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacket.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacket.java --- a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacket.java

View file

@ -115,6 +115,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ */ // Paper - move down to make death event cancellable - this is the runKillTrigger below + */ // Paper - move down to make death event cancellable - this is the runKillTrigger below
+ +
if (!this.level.isClientSide && this.hasCustomName()) {
LivingEntity.LOGGER.info("Named entity {} died: {}", this, this.getCombatTracker().getDeathMessage().getString());
}
this.dead = true; this.dead = true;
- this.getCombatTracker().recheckStatus(); - this.getCombatTracker().recheckStatus();
+ // Paper - moved into if below + // Paper - moved into if below

File diff suppressed because one or more lines are too long

View file

@ -2319,7 +2319,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/network/PacketEncoder.java --- a/src/main/java/net/minecraft/network/PacketEncoder.java
+++ b/src/main/java/net/minecraft/network/PacketEncoder.java +++ b/src/main/java/net/minecraft/network/PacketEncoder.java
@@ -0,0 +0,0 @@ public class PacketEncoder extends MessageToByteEncoder<Packet<?>> { @@ -0,0 +0,0 @@ public class PacketEncoder extends MessageToByteEncoder<Packet<?>> {
throw new IllegalArgumentException("Packet too big (is " + j + ", should be less than 2097152): " + packet); throw new IllegalArgumentException("Packet too big (is " + j + ", should be less than 8388608): " + packet);
} }
} catch (Throwable var9) { } catch (Throwable var9) {
- LOGGER.error(var9); - LOGGER.error(var9);
@ -3313,6 +3313,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
Optional<LevelChunk> optional = ((Either) playerchunk.getTickingChunkFuture().getNow(ChunkHolder.UNLOADED_LEVEL_CHUNK)).left(); Optional<LevelChunk> optional = ((Either) playerchunk.getTickingChunkFuture().getNow(ChunkHolder.UNLOADED_LEVEL_CHUNK)).left();
if (optional.isPresent()) { if (optional.isPresent()) {
@@ -0,0 +0,0 @@ public class ServerChunkCache extends ChunkSource {
}
this.level.getProfiler().popPush("broadcast");
- list.forEach((playerchunk) -> {
+ this.chunkMap.getChunks().forEach((playerchunk) -> { // Paper - no... just no...
Optional<LevelChunk> optional = ((Either) playerchunk.getTickingChunkFuture().getNow(ChunkHolder.UNLOADED_LEVEL_CHUNK)).left(); // CraftBukkit - decompile error
Objects.requireNonNull(playerchunk);
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java

View file

@ -15,8 +15,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- this.unloadQueue = Queues.newConcurrentLinkedQueue(); - this.unloadQueue = Queues.newConcurrentLinkedQueue();
+ this.unloadQueue = new com.destroystokyo.paper.utils.CachedSizeConcurrentLinkedQueue<>(); // Paper - need constant-time size() + this.unloadQueue = new com.destroystokyo.paper.utils.CachedSizeConcurrentLinkedQueue<>(); // Paper - need constant-time size()
this.structureManager = structureManager; this.structureManager = structureManager;
this.storageFolder = session.getDimensionPath(world.dimension()); File file = session.getDimensionPath(world.dimension());
this.level = world;
@@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
// Spigot start // Spigot start
org.spigotmc.SlackActivityAccountant activityAccountant = this.level.getServer().slackActivityAccountant; org.spigotmc.SlackActivityAccountant activityAccountant = this.level.getServer().slackActivityAccountant;

View file

@ -183,6 +183,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
} }
// this.level.timings.doTickTiles.startTiming(); // Spigot // Paper // this.level.timings.doTickTiles.startTiming(); // Spigot // Paper
@@ -0,0 +0,0 @@ public class ServerChunkCache extends ChunkSource {
}
this.level.getProfiler().popPush("broadcast");
- this.chunkMap.getChunks().forEach((playerchunk) -> { // Paper - no... just no...
+ this.chunkMap.forEachVisibleChunk((playerchunk) -> { // Paper - safe iterator incase chunk loads, also no wrapping
Optional<LevelChunk> optional = ((Either) playerchunk.getTickingChunkFuture().getNow(ChunkHolder.UNLOADED_LEVEL_CHUNK)).left(); // CraftBukkit - decompile error
Objects.requireNonNull(playerchunk);
@@ -0,0 +0,0 @@ public class ServerChunkCache extends ChunkSource { @@ -0,0 +0,0 @@ public class ServerChunkCache extends ChunkSource {
super.doRunTask(task); super.doRunTask(task);
} }

View file

@ -228,7 +228,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
this.overworldDataStorage = persistentStateManagerFactory; this.overworldDataStorage = persistentStateManagerFactory;
this.poiManager = new PoiManager(new File(this.storageFolder, "poi"), dataFixer, dsync, world); this.poiManager = new PoiManager(new File(file, "poi"), dataFixer, dsync, world);
this.setViewDistance(viewDistance); this.setViewDistance(viewDistance);
+ // Paper start - no-tick view distance + // Paper start - no-tick view distance
+ this.setNoTickViewDistance(this.level.paperConfig.noTickViewDistance); + this.setNoTickViewDistance(this.level.paperConfig.noTickViewDistance);

View file

@ -351,25 +351,22 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
for(int i = 0; i < chunk.getSectionsCount(); ++i) { for(int i = 0; i < chunk.getSectionsCount(); ++i) {
@@ -0,0 +0,0 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl @@ -0,0 +0,0 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl
});
}
- this.chunkMap.releaseLightTicket(chunkPos);
+ // this.chunkMap.releaseLightTicket(chunkPos); // Paper - move into post task below
}, () -> { }, () -> {
return "lightChunk " + chunkPos + " " + excludeBlocks; return "lightChunk " + chunkPos + " " + excludeBlocks;
- })); - }));
- return CompletableFuture.supplyAsync(() -> { - return CompletableFuture.supplyAsync(() -> {
+ // Paper start - merge the 2 together + // Paper start - merge the 2 together
+ }), () -> { + }), () -> {
+ this.chunkMap.releaseLightTicket(chunkPos); // Paper - release light tickets as post task to ensure they stay loaded until fully done + this.chunkMap.releaseLightTicket(chunkPos); // Paper - moved from below, we want to call this even when returning early
+ if (skippedPre[0]) return; // Paper - future's already complete + if (skippedPre[0]) return; // Paper - future's already complete
chunk.setLightCorrect(true); chunk.setLightCorrect(true);
super.retainData(chunkPos, false); super.retainData(chunkPos, false);
- this.chunkMap.releaseLightTicket(chunkPos);
- return chunk; - return chunk;
- }, (runnable) -> { - }, (runnable) -> {
- this.addTask(chunkPos.x, chunkPos.z, ThreadedLevelLightEngine.TaskType.POST_UPDATE, runnable); - this.addTask(chunkPos.x, chunkPos.z, ThreadedLevelLightEngine.TaskType.POST_UPDATE, runnable);
+ // Paper start + //this.chunkMap.releaseLightTicket(chunkPos); // Paper - moved up
+ future.complete(chunk); + future.complete(chunk);
}); });
+ return future; + return future;

View file

@ -151,18 +151,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ registerCleaner(); + registerCleaner();
+ // Paper end + // Paper end
if (bytes.length != 2048) { if (bytes.length != 2048) {
throw (IllegalArgumentException) Util.pauseInIde((Throwable) (new IllegalArgumentException("ChunkNibbleArrays should be 2048 bytes not: " + bytes.length))); throw (IllegalArgumentException) Util.pauseInIde((Throwable) (new IllegalArgumentException("DataLayer should be 2048 bytes not: " + bytes.length)));
} }
@@ -0,0 +0,0 @@ public class DataLayer { @@ -0,0 +0,0 @@ public class DataLayer {
public void set(int index, int value) { // PAIL: private -> public private void set(int index, int value) {
if (this.data == null) { if (this.data == null) {
- this.data = new byte[2048]; - this.data = new byte[2048];
+ this.data = BYTE_2048.acquire(); // Paper + this.data = BYTE_2048.acquire(); // Paper
+ registerCleaner();// Paper + registerCleaner();// Paper
} }
int k = this.getPosition(index); int k = DataLayer.getByteIndex(index);
@@ -0,0 +0,0 @@ public class DataLayer { @@ -0,0 +0,0 @@ public class DataLayer {
public byte[] getData() { public byte[] getData() {
if (this.data == null) { if (this.data == null) {
@ -231,28 +231,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.clearCache(); this.clearCache();
} }
diff --git a/src/main/java/net/minecraft/world/level/lighting/FlatDataLayer.java b/src/main/java/net/minecraft/world/level/lighting/FlatDataLayer.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/lighting/FlatDataLayer.java
+++ b/src/main/java/net/minecraft/world/level/lighting/FlatDataLayer.java
@@ -0,0 +0,0 @@ public class FlatDataLayer extends DataLayer {
public FlatDataLayer(DataLayer chunkNibbleArray, int offset) {
super(128);
- System.arraycopy(chunkNibbleArray.getData(), offset * 128, this.data, 0, 128);
+ System.arraycopy(chunkNibbleArray.getIfSet(), offset * 128, this.data, 0, 128); // Paper
}
@Override
@@ -0,0 +0,0 @@ public class FlatDataLayer extends DataLayer {
@Override
public byte[] getData() {
- byte[] bs = new byte[2048];
+ byte[] bs = BYTE_2048.acquire(); // Paper
for(int i = 0; i < 16; ++i) {
System.arraycopy(this.data, 0, bs, i * 128, 128);
diff --git a/src/main/java/net/minecraft/world/level/lighting/LayerLightSectionStorage.java b/src/main/java/net/minecraft/world/level/lighting/LayerLightSectionStorage.java diff --git a/src/main/java/net/minecraft/world/level/lighting/LayerLightSectionStorage.java b/src/main/java/net/minecraft/world/level/lighting/LayerLightSectionStorage.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/lighting/LayerLightSectionStorage.java --- a/src/main/java/net/minecraft/world/level/lighting/LayerLightSectionStorage.java
@ -286,17 +264,31 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/world/level/lighting/SkyLightSectionStorage.java --- a/src/main/java/net/minecraft/world/level/lighting/SkyLightSectionStorage.java
+++ b/src/main/java/net/minecraft/world/level/lighting/SkyLightSectionStorage.java +++ b/src/main/java/net/minecraft/world/level/lighting/SkyLightSectionStorage.java
@@ -0,0 +0,0 @@ public class SkyLightSectionStorage extends LayerLightSectionStorage<SkyLightSec @@ -0,0 +0,0 @@ public class SkyLightSectionStorage extends LayerLightSectionStorage<SkyLightSec
l = SectionPos.offset(l, Direction.UP);
}
- return new DataLayer((new FlatDataLayer(dataLayer2, 0)).getData()); return repeatFirstLayer(dataLayer2);
+ return new DataLayer().markPoolSafe(new FlatDataLayer(dataLayer2, 0).getData()); // Paper - mark pool use as safe (no auto cleaner)
} else { } else {
- return new DataLayer(); - return new DataLayer();
+ return new DataLayer().markPoolSafe(); // Paper - mark pool use as safe (no auto cleaner) + return new DataLayer().markPoolSafe(); // Paper - mark pool use as safe (no auto cleaner)
} }
} }
} }
private static DataLayer repeatFirstLayer(DataLayer source) {
if (source.isEmpty()) {
- return new DataLayer();
+ return new DataLayer().markPoolSafe(); // Paper - mark pool use as safe (no auto cleaner)
} else {
byte[] bs = source.getData();
byte[] cs = new byte[2048];
@@ -0,0 +0,0 @@ public class SkyLightSectionStorage extends LayerLightSectionStorage<SkyLightSec
System.arraycopy(bs, 0, cs, i * 128, 128);
}
- return new DataLayer(cs);
+ return new DataLayer(cs).markPoolSafe(cs); // Paper - mark pool use as safe (no auto cleaner)
}
}
@@ -0,0 +0,0 @@ public class SkyLightSectionStorage extends LayerLightSectionStorage<SkyLightSec @@ -0,0 +0,0 @@ public class SkyLightSectionStorage extends LayerLightSectionStorage<SkyLightSec
this.updatingSectionData.copyDataLayer(l); this.updatingSectionData.copyDataLayer(l);
} }

View file

@ -187,8 +187,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
do { do {
@@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
this.level.asyncChunkTaskManager.flush(); // Paper - flush to preserve behavior compat with pre-async behaviour
// this.i(); // Paper - nuke IOWorker // this.i(); // Paper - nuke IOWorker
ChunkMap.LOGGER.info("ThreadedAnvilChunkStorage ({}): All chunks are saved", this.storageFolder.getName());
} else { } else {
- this.visibleChunkMap.values().stream().filter(ChunkHolder::wasAccessibleSinceLastSave).forEach((playerchunk) -> { - this.visibleChunkMap.values().stream().filter(ChunkHolder::wasAccessibleSinceLastSave).forEach((playerchunk) -> {
+ visibleChunks.values().stream().filter(ChunkHolder::wasAccessibleSinceLastSave).forEach((playerchunk) -> { + visibleChunks.values().stream().filter(ChunkHolder::wasAccessibleSinceLastSave).forEach((playerchunk) -> {

View file

@ -59,12 +59,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
} }
private long getNextOperation() { private long getNextOperation() {
@@ -0,0 +0,0 @@ public class GameProfileCache { return this.operationCount.incrementAndGet();
} }
@Nullable - public Optional<GameProfile> get(String name) {
- public GameProfile get(String name) { + public synchronized Optional<GameProfile> get(String name) { // Paper - synchronize
+ public synchronized GameProfile get(String name) { // Paper - synchronize
String s1 = name.toLowerCase(Locale.ROOT); String s1 = name.toLowerCase(Locale.ROOT);
GameProfileCache.GameProfileInfo usercache_usercacheentry = (GameProfileCache.GameProfileInfo) this.profilesByName.get(s1); GameProfileCache.GameProfileInfo usercache_usercacheentry = (GameProfileCache.GameProfileInfo) this.profilesByName.get(s1);
boolean flag = false; boolean flag = false;
@ -76,7 +75,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ this.save(true); // Paper + this.save(true); // Paper
} }
return gameprofile; return optional;
@@ -0,0 +0,0 @@ public class GameProfileCache { @@ -0,0 +0,0 @@ public class GameProfileCache {
return arraylist; return arraylist;
} }
@ -98,6 +97,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
} catch (IOException ioexception) { } catch (IOException ioexception) {
; ;
} }
-
+ // Paper start + // Paper start
+ }; + };
+ if (asyncSave) { + if (asyncSave) {
@ -106,6 +106,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ save.run(); + save.run();
+ } + }
+ // Paper end + // Paper end
} }
private Stream<GameProfileCache.GameProfileInfo> getTopMRUProfiles(int limit) {

View file

@ -99,7 +99,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- this.distanceManager = new ChunkMap.ChunkDistanceManager(executor, mainThreadExecutor); - this.distanceManager = new ChunkMap.ChunkDistanceManager(executor, mainThreadExecutor);
+ this.distanceManager = new ChunkMap.ChunkDistanceManager(executor, mainThreadExecutor); this.distanceManager.chunkMap = this; // Paper + this.distanceManager = new ChunkMap.ChunkDistanceManager(executor, mainThreadExecutor); this.distanceManager.chunkMap = this; // Paper
this.overworldDataStorage = persistentStateManagerFactory; this.overworldDataStorage = persistentStateManagerFactory;
this.poiManager = new PoiManager(new File(this.storageFolder, "poi"), dataFixer, dsync, world); this.poiManager = new PoiManager(new File(file, "poi"), dataFixer, dsync, world);
this.setViewDistance(viewDistance); this.setViewDistance(viewDistance);
@@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
this.playerEntityTrackerTrackMaps[ordinal] = new com.destroystokyo.paper.util.misc.PlayerAreaMap(this.pooledLinkedPlayerHashSets); this.playerEntityTrackerTrackMaps[ordinal] = new com.destroystokyo.paper.util.misc.PlayerAreaMap(this.pooledLinkedPlayerHashSets);
@ -350,7 +350,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
final int[] chunksTicked = {0}; this.chunkMap.forEachVisibleChunk((playerchunk) -> { // Paper - safe iterator incase chunk loads, also no wrapping final int[] chunksTicked = {0}; this.chunkMap.forEachVisibleChunk((playerchunk) -> { // Paper - safe iterator incase chunk loads, also no wrapping
Optional<LevelChunk> optional = ((Either) playerchunk.getTickingChunkFuture().getNow(ChunkHolder.UNLOADED_LEVEL_CHUNK)).left(); Optional<LevelChunk> optional = ((Either) playerchunk.getTickingChunkFuture().getNow(ChunkHolder.UNLOADED_LEVEL_CHUNK)).left();
@@ -0,0 +0,0 @@ public class ServerChunkCache extends ChunkSource { @@ -0,0 +0,0 @@ public class ServerChunkCache extends ChunkSource {
this.level.getProfiler().pop(); LevelChunk chunk = (LevelChunk) optional.get();
ChunkPos chunkcoordintpair = chunk.getPos(); ChunkPos chunkcoordintpair = chunk.getPos();
- if (this.level.isPositionEntityTicking(chunkcoordintpair) && !this.chunkMap.noPlayersCloseForSpawning(chunkcoordintpair)) { - if (this.level.isPositionEntityTicking(chunkcoordintpair) && !this.chunkMap.noPlayersCloseForSpawning(chunkcoordintpair)) {

View file

@ -623,26 +623,18 @@ diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/sr
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -0,0 +0,0 @@ import net.minecraft.core.BlockPos;
import net.minecraft.core.SectionPos;
import net.minecraft.network.protocol.Packet;
import net.minecraft.server.level.progress.ChunkProgressListener;
+import net.minecraft.util.Mth;
import net.minecraft.util.VisibleForDebug;
import net.minecraft.util.profiling.ProfilerFiller;
import net.minecraft.util.thread.BlockableEventLoop;
@@ -0,0 +0,0 @@ public class ServerChunkCache extends ChunkSource { @@ -0,0 +0,0 @@ public class ServerChunkCache extends ChunkSource {
} }
} }
+ // Paper start - helper + // Paper start - helper
+ public boolean isPositionTicking(Entity entity) { + public boolean isPositionTicking(Entity entity) {
+ return this.isPositionTicking(ChunkPos.asLong(Mth.floor(entity.getX()) >> 4, Mth.floor(entity.getZ()) >> 4)); + return this.isPositionTicking(ChunkPos.asLong(net.minecraft.util.Mth.floor(entity.getX()) >> 4, net.minecraft.util.Mth.floor(entity.getZ()) >> 4));
+ } + }
+ // Paper end + // Paper end
+ +
public boolean isPositionTicking(long i) { public boolean isPositionTicking(long pos) {
return this.checkChunkFuture(i, (Function<ChunkHolder, CompletableFuture<Either<LevelChunk, ChunkHolder.ChunkLoadingFailure>>>) ChunkHolder::getTickingChunkFuture); // CraftBukkit - decompile error return this.checkChunkFuture(pos, (Function<ChunkHolder, CompletableFuture<Either<LevelChunk, ChunkHolder.ChunkLoadingFailure>>>) ChunkHolder::getTickingChunkFuture); // CraftBukkit - decompile error
} }
diff --git a/src/main/java/net/minecraft/world/entity/EntityType.java b/src/main/java/net/minecraft/world/entity/EntityType.java diff --git a/src/main/java/net/minecraft/world/entity/EntityType.java b/src/main/java/net/minecraft/world/entity/EntityType.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644

View file

@ -9,12 +9,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -0,0 +0,0 @@ public class ServerPlayer extends Player { @@ -0,0 +0,0 @@ public class ServerPlayer extends Player {
public void trackChunk(ChunkPos chunkcoordintpair, Packet<?> packet, Packet<?> packet1) { public void trackChunk(ChunkPos chunkPos, Packet<?> chunkDataPacket, Packet<?> lightUpdatePacket) {
this.connection.send(packet1); this.connection.send(lightUpdatePacket);
this.connection.send(packet); this.connection.send(chunkDataPacket);
+ // Paper start + // Paper start
+ if(io.papermc.paper.event.packet.PlayerChunkLoadEvent.getHandlerList().getRegisteredListeners().length > 0){ + if(io.papermc.paper.event.packet.PlayerChunkLoadEvent.getHandlerList().getRegisteredListeners().length > 0){
+ new io.papermc.paper.event.packet.PlayerChunkLoadEvent(this.getBukkitEntity().getWorld().getChunkAt(chunkcoordintpair.longKey), this.getBukkitEntity()).callEvent(); + new io.papermc.paper.event.packet.PlayerChunkLoadEvent(this.getBukkitEntity().getWorld().getChunkAt(chunkPos.longKey), this.getBukkitEntity()).callEvent();
+ } + }
+ // Paper end + // Paper end
} }

View file

@ -171,7 +171,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- <groupId>org.spigotmc</groupId> - <groupId>org.spigotmc</groupId>
- <artifactId>spigot</artifactId> - <artifactId>spigot</artifactId>
- <packaging>jar</packaging> - <packaging>jar</packaging>
- <version>1.17-R0.1-SNAPSHOT</version> - <version>1.17.1-R0.1-SNAPSHOT</version>
- <name>Spigot</name> - <name>Spigot</name>
- <url>https://www.spigotmc.org/</url> - <url>https://www.spigotmc.org/</url>
- -
@ -516,7 +516,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- <dependency> - <dependency>
- <groupId>org.eclipse.jdt</groupId> - <groupId>org.eclipse.jdt</groupId>
- <artifactId>ecj</artifactId> - <artifactId>ecj</artifactId>
- <version>3.24.0</version> - <version>3.26.0</version>
- </dependency> - </dependency>
- </dependencies> - </dependencies>
- </plugin> - </plugin>
@ -552,7 +552,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- <plugin> - <plugin>
- <groupId>org.apache.maven.plugins</groupId> - <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-checkstyle-plugin</artifactId> - <artifactId>maven-checkstyle-plugin</artifactId>
- <version>3.1.1</version> - <version>3.1.2</version>
- <executions> - <executions>
- <execution> - <execution>
- <phase>process-classes</phase> - <phase>process-classes</phase>
@ -569,7 +569,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- <dependency> - <dependency>
- <groupId>com.puppycrawl.tools</groupId> - <groupId>com.puppycrawl.tools</groupId>
- <artifactId>checkstyle</artifactId> - <artifactId>checkstyle</artifactId>
- <version>8.39</version> - <version>8.44</version>
- </dependency> - </dependency>
- </dependencies> - </dependencies>
- </plugin> - </plugin>

View file

@ -30,7 +30,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ return "Paper"; //Paper - Paper > // Spigot - Spigot > // CraftBukkit - cb > vanilla! + return "Paper"; //Paper - Paper > // Spigot - Spigot > // CraftBukkit - cb > vanilla!
} }
public SystemReport fillSystemReport(SystemReport systemreport) { public SystemReport fillSystemReport(SystemReport details) {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java

View file

@ -36,8 +36,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- public volatile CommandNode currentCommand; // CraftBukkit - public volatile CommandNode currentCommand; // CraftBukkit
+ public ThreadLocal<CommandNode> currentCommand = new ThreadLocal<>(); // CraftBukkit // Paper + public ThreadLocal<CommandNode> currentCommand = new ThreadLocal<>(); // CraftBukkit // Paper
public CommandSourceStack(CommandSource output, Vec3 pos, Vec2 rot, ServerLevel world, int level, String simpleName, Component name, MinecraftServer server, @Nullable Entity entity) { public CommandSourceStack(CommandSource output, Vec3 pos, Vec2 rot, ServerLevel world, int level, String name, Component displayName, MinecraftServer server, @Nullable Entity entity) {
this(output, pos, rot, world, level, simpleName, name, server, entity, false, (commandcontext, flag, j) -> { this(output, pos, rot, world, level, name, displayName, server, entity, false, (commandcontext, flag, j) -> {
@@ -0,0 +0,0 @@ public class CommandSourceStack implements SharedSuggestionProvider, com.destroy @@ -0,0 +0,0 @@ public class CommandSourceStack implements SharedSuggestionProvider, com.destroy
@Override @Override
public boolean hasPermission(int level) { public boolean hasPermission(int level) {

View file

@ -1188,16 +1188,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.chunkMap.getChunks().forEach((playerchunk) -> { // Paper - no... just no... this.chunkMap.getChunks().forEach((playerchunk) -> { // Paper - no... just no...
Optional<LevelChunk> optional = ((Either) playerchunk.getTickingChunkFuture().getNow(ChunkHolder.UNLOADED_LEVEL_CHUNK)).left(); Optional<LevelChunk> optional = ((Either) playerchunk.getTickingChunkFuture().getNow(ChunkHolder.UNLOADED_LEVEL_CHUNK)).left();
@@ -0,0 +0,0 @@ public class ServerChunkCache extends ChunkSource {
this.level.getProfiler().push("broadcast");
LevelChunk chunk = (LevelChunk) optional.get();
+ this.level.timings.broadcastChunkUpdates.startTiming(); // Paper - timings
playerchunk.broadcastChanges(chunk);
+ this.level.timings.broadcastChunkUpdates.stopTiming(); // Paper - timings
this.level.getProfiler().pop();
ChunkPos chunkcoordintpair = chunk.getPos();
@@ -0,0 +0,0 @@ public class ServerChunkCache extends ChunkSource { @@ -0,0 +0,0 @@ public class ServerChunkCache extends ChunkSource {
NaturalSpawner.spawnForChunk(this.level, chunk, spawnercreature_d, this.spawnFriendlies, this.spawnEnemies, flag2); NaturalSpawner.spawnForChunk(this.level, chunk, spawnercreature_d, this.spawnFriendlies, this.spawnEnemies, flag2);
} }
@ -1218,6 +1208,21 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ } // Paper - timings + } // Paper - timings
} }
this.level.getProfiler().popPush("broadcast");
@@ -0,0 +0,0 @@ public class ServerChunkCache extends ChunkSource {
Optional<LevelChunk> optional = ((Either) playerchunk.getTickingChunkFuture().getNow(ChunkHolder.UNLOADED_LEVEL_CHUNK)).left(); // CraftBukkit - decompile error
Objects.requireNonNull(playerchunk);
- optional.ifPresent(playerchunk::broadcastChanges);
+
+ // Paper start - timings
+ optional.ifPresent(chunk -> {
+ this.level.timings.broadcastChunkUpdates.startTiming(); // Paper - timings
+ playerchunk.broadcastChanges(chunk);
+ this.level.timings.broadcastChunkUpdates.stopTiming(); // Paper - timings
+ });
+ // Paper end
});
this.level.getProfiler().pop(); this.level.getProfiler().pop();
this.level.getProfiler().pop(); this.level.getProfiler().pop();
} }
@ -1268,10 +1273,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl @@ -0,0 +0,0 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl
this.updateSkyBrightness(); this.updateSkyBrightness();
this.tickTime(); this.tickTime();
gameprofilerfiller.popPush("chunkSource");
+ this.timings.chunkProviderTick.startTiming(); // Paper - timings
this.getChunkSource().tick(shouldKeepTicking);
+ this.timings.chunkProviderTick.stopTiming(); // Paper - timings
gameprofilerfiller.popPush("tickPending"); gameprofilerfiller.popPush("tickPending");
- timings.doTickPending.startTiming(); // Spigot - timings.doTickPending.startTiming(); // Spigot
+ timings.scheduledBlocks.startTiming(); // Paper + timings.scheduledBlocks.startTiming(); // Paper
@ -1286,6 +1287,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ this.timings.raids.startTiming(); // Paper - timings + this.timings.raids.startTiming(); // Paper - timings
this.raids.tick(); this.raids.tick();
+ this.timings.raids.stopTiming(); // Paper - timings + this.timings.raids.stopTiming(); // Paper - timings
gameprofilerfiller.popPush("chunkSource");
+ this.timings.chunkProviderTick.startTiming(); // Paper - timings
this.getChunkSource().tick(shouldKeepTicking);
+ this.timings.chunkProviderTick.stopTiming(); // Paper - timings
gameprofilerfiller.popPush("blockEvents"); gameprofilerfiller.popPush("blockEvents");
timings.doSounds.startTiming(); // Spigot timings.doSounds.startTiming(); // Spigot
this.runBlockEvents(); this.runBlockEvents();

View file

@ -115,10 +115,10 @@ diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -0,0 +0,0 @@ import com.mojang.datafixers.DataFixer; @@ -0,0 +0,0 @@ import com.mojang.authlib.GameProfile;
import io.netty.buffer.ByteBuf; import com.mojang.authlib.GameProfileRepository;
import io.netty.buffer.ByteBufOutputStream; import com.mojang.authlib.minecraft.MinecraftSessionService;
import io.netty.buffer.Unpooled; import com.mojang.datafixers.DataFixer;
+import io.papermc.paper.adventure.PaperAdventure; // Paper +import io.papermc.paper.adventure.PaperAdventure; // Paper
import it.unimi.dsi.fastutil.longs.LongIterator; import it.unimi.dsi.fastutil.longs.LongIterator;
import java.awt.GraphicsEnvironment; import java.awt.GraphicsEnvironment;

View file

@ -80,7 +80,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
int effectiveTickViewDistance = this.getEffectiveViewDistance(); int effectiveTickViewDistance = this.getEffectiveViewDistance();
int effectiveNoTickViewDistance = Math.max(this.getEffectiveNoTickViewDistance(), effectiveTickViewDistance); int effectiveNoTickViewDistance = Math.max(this.getEffectiveNoTickViewDistance(), effectiveTickViewDistance);
@@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
this.poiManager = new PoiManager(new File(this.storageFolder, "poi"), dataFixer, dsync, world); this.poiManager = new PoiManager(new File(file, "poi"), dataFixer, dsync, world);
this.setViewDistance(viewDistance); this.setViewDistance(viewDistance);
this.playerMobDistanceMap = this.level.paperConfig.perPlayerMobSpawns ? new com.destroystokyo.paper.util.PlayerMobDistanceMap() : null; // Paper this.playerMobDistanceMap = this.level.paperConfig.perPlayerMobSpawns ? new com.destroystokyo.paper.util.PlayerMobDistanceMap() : null; // Paper
+ // Paper start - use distance map to optimise entity tracker + // Paper start - use distance map to optimise entity tracker

View file

@ -21,6 +21,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ } + }
+ this.player.getInventory().pickSlot(packet.getSlot()); // Paper - Diff above if changed + this.player.getInventory().pickSlot(packet.getSlot()); // Paper - Diff above if changed
+ // Paper end + // Paper end
this.player.connection.send(new ClientboundContainerSetSlotPacket(-2, this.player.getInventory().selected, this.player.getInventory().getItem(this.player.getInventory().selected))); this.player.connection.send(new ClientboundContainerSetSlotPacket(-2, 0, this.player.getInventory().selected, this.player.getInventory().getItem(this.player.getInventory().selected)));
this.player.connection.send(new ClientboundContainerSetSlotPacket(-2, packet.getSlot(), this.player.getInventory().getItem(packet.getSlot()))); this.player.connection.send(new ClientboundContainerSetSlotPacket(-2, 0, packet.getSlot(), this.player.getInventory().getItem(packet.getSlot())));
this.player.connection.send(new ClientboundSetCarriedItemPacket(this.player.getInventory().selected)); this.player.connection.send(new ClientboundSetCarriedItemPacket(this.player.getInventory().selected));

View file

@ -26,7 +26,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ GameProfile profile; + GameProfile profile;
+ // Only fetch an online UUID in online mode + // Only fetch an online UUID in online mode
+ if (com.destroystokyo.paper.PaperConfig.isProxyOnlineMode()) { + if (com.destroystokyo.paper.PaperConfig.isProxyOnlineMode()) {
+ profile = console.getProfileCache().get( name ); + profile = console.getProfileCache().get(name).orElse(null);
+ } else { + } else {
+ // Make an OfflinePlayer using an offline mode UUID since the name has no profile + // Make an OfflinePlayer using an offline mode UUID since the name has no profile
+ profile = new GameProfile(UUID.nameUUIDFromBytes(("OfflinePlayer:" + name).getBytes(Charsets.UTF_8)), name); + profile = new GameProfile(UUID.nameUUIDFromBytes(("OfflinePlayer:" + name).getBytes(Charsets.UTF_8)), name);

View file

@ -558,7 +558,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public final CallbackExecutor callbackExecutor = new CallbackExecutor(); public final CallbackExecutor callbackExecutor = new CallbackExecutor();
@@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
this.overworldDataStorage = persistentStateManagerFactory; this.overworldDataStorage = persistentStateManagerFactory;
this.poiManager = new PoiManager(new File(this.storageFolder, "poi"), dataFixer, dsync, world); this.poiManager = new PoiManager(new File(file, "poi"), dataFixer, dsync, world);
this.setViewDistance(viewDistance); this.setViewDistance(viewDistance);
+ this.playerMobDistanceMap = this.level.paperConfig.perPlayerMobSpawns ? new com.destroystokyo.paper.util.PlayerMobDistanceMap() : null; // Paper + this.playerMobDistanceMap = this.level.paperConfig.perPlayerMobSpawns ? new com.destroystokyo.paper.util.PlayerMobDistanceMap() : null; // Paper
// Paper start - no-tick view distance // Paper start - no-tick view distance

View file

@ -22,7 +22,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/world/level/Level.java --- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -0,0 +0,0 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -0,0 +0,0 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
public boolean preventPoiUpdated = false; // CraftBukkit - SPIGOT-5710
public boolean captureBlockStates = false; public boolean captureBlockStates = false;
public boolean captureTreeGeneration = false; public boolean captureTreeGeneration = false;
- public Map<BlockPos, CapturedBlockState> capturedBlockStates = new java.util.LinkedHashMap<>(); - public Map<BlockPos, CapturedBlockState> capturedBlockStates = new java.util.LinkedHashMap<>();

@ -1 +1 @@
Subproject commit 3cec511b16ffa31cb414997a14be313716882e12 Subproject commit a4785704979a469daa2b7f6826c84e7fe886bb03

@ -1 +1 @@
Subproject commit 214b9f14e8f28d3dfb1b9344d649063eba38c166 Subproject commit d8198b3ec5d3a9d15cfb0dde7307c3b549574c55

@ -1 +1 @@
Subproject commit b121d3b9534b9eeceb3a3592860e9cc2c8519ddf Subproject commit fb556bfa1404661b38cc3abd1f0a7d02764f8f5b

@ -1 +1 @@
Subproject commit f773da845ca2da21064a4025b6ad12178da0ed7c Subproject commit 610a8c06f422aecbe72d4fa38fae6f634b8d1ceb