13
0
geforkt von Mirrors/Paper

Update to Minecraft 1.17.1 (#6097)

Dieser Commit ist enthalten in:
Nassim Jahnke 2021-07-07 08:52:40 +02:00
Ursprung 43f52d9c13
Commit 7037cd401f
58 geänderte Dateien mit 182 neuen und 258 gelöschten Zeilen

Datei anzeigen

@ -2,5 +2,5 @@
# Merchant.getLevel()
# Entity.getCommandSenderWorld()
# 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/entity/npc/EntityVillagerAbstract 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 fE ()Lnet/minecraft/world/level/World; getLevel

Datei anzeigen

@ -35,7 +35,7 @@ c net/minecraft/world/level/block/MultifaceBlock net/minecraft/world/level/block
# another missed one
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
# change dimension in ServerPlayer

Datei anzeigen

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

Datei anzeigen

@ -71,7 +71,7 @@ repositories {
}
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")
decompiler("net.minecraftforge:forgeflower:1.5.498.12")
paperclip("io.papermc:paperclip:2.0.1")

Datei anzeigen

@ -1,7 +1,7 @@
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.vfs.watch=false

Datei anzeigen

@ -32,7 +32,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
compileOnly("org.apache.maven:maven-resolver-provider:3.8.1")
compileOnly("org.apache.maven.resolver:maven-resolver-connector-basic:1.7.0")
@@ -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/net.md-5/bungeecord-chat/1.16-R0.4/",
+ // Paper start
@ -1141,8 +1141,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
/**
@@ -0,0 +0,0 @@ public interface Sign extends TileState, Colorable {
* @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
* @throws IndexOutOfBoundsException Thrown when the line does not exist
+ * @deprecated in favour of {@link #line(int)}
*/
@NotNull
@ -2344,9 +2344,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
/**
* @see Player#getLocale()
*
* @return the player's new locale
* @see Player#getLocale()
+ * @deprecated in favour of {@link #locale()}
*/
@NotNull

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

@ -38,7 +38,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ player.loginTime = System.currentTimeMillis(); // Paper
GameProfile gameprofile = player.getGameProfile();
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
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java

Datei anzeigen

@ -94,8 +94,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public org.bukkit.generator.ChunkGenerator generator;
+ public static final boolean DEBUG_ENTITIES = Boolean.getBoolean("debug.entities"); // Paper
public boolean preventPoiUpdated = false; // CraftBukkit - SPIGOT-5710
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
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/entity/EntityLookup.java

Datei anzeigen

@ -165,15 +165,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
return;
}
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
int byteLength = testString.getBytes(java.nio.charset.StandardCharsets.UTF_8).length;
if (byteLength > 256 * 4) {

Datei anzeigen

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

Datei anzeigen

@ -77,5 +77,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- if ( this.getOnlineMode() || org.spigotmc.SpigotConfig.bungee )
+ 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);
}

Datei anzeigen

@ -1448,7 +1448,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+import io.papermc.paper.adventure.PaperAdventure;
import java.io.File;
import java.net.SocketAddress;
import java.text.SimpleDateFormat;
import java.nio.file.Path;
@@ -0,0 +0,0 @@ import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@ -2443,9 +2443,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ final ServerGamePacketListenerImpl connection = player.connection;
+ final net.minecraft.world.entity.player.Inventory inventory = player.getInventory();
+ 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.ClientboundContainerSetSlotPacket(0, slot, inventory.getSelected()));
+ connection.send(new net.minecraft.network.protocol.game.ClientboundContainerSetSlotPacket(0, stateId, slot, inventory.getSelected()));
+ }
+ // Paper end
+

Datei anzeigen

@ -14,8 +14,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
placeEvent.getPlayer().updateInventory();
+ world.capturedTileEntities.clear(); // Paper - clear out tile entities as chests and such will pop loot
// revert back all captured blocks
world.preventPoiUpdated = true; // CraftBukkit - SPIGOT-5710
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
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/ChestBlockEntity.java

Datei anzeigen

@ -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 (!event.isHandled()) {
+ 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) -> {
- 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.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) -> {
+ 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));

Datei anzeigen

@ -2362,9 +2362,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- this.flushWorker();
+ this.level.asyncChunkTaskManager.flush(); // Paper - flush to preserve behavior compat with pre-async behaviour
+// this.i(); // Paper - nuke IOWorker
ChunkMap.LOGGER.info("ThreadedAnvilChunkStorage ({}): All chunks are saved", this.storageFolder.getName());
} else {
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
}
@ -3355,7 +3355,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
public void flushWorker() {
- this.worker.synchronize().join();
- this.worker.synchronize(true).join();
+ com.destroystokyo.paper.io.PaperFileIOThread.Holder.INSTANCE.flush(); // Paper - nuke IO worker
}

Datei anzeigen

@ -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());

Datei anzeigen

@ -13,8 +13,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@
+package com.destroystokyo.paper.profile;
+
+import com.destroystokyo.paper.profile.PlayerProfile;
+import com.destroystokyo.paper.profile.ProfileProperty;
+import com.destroystokyo.paper.PaperConfig;
+import com.google.common.base.Charsets;
+import com.mojang.authlib.GameProfile;
@ -24,7 +22,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+import net.minecraft.server.players.GameProfileCache;
+import org.apache.commons.lang3.Validate;
+import org.bukkit.craftbukkit.entity.CraftPlayer;
+import org.spigotmc.SpigotConfig;
+
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
@ -32,6 +29,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Objects;
+import java.util.Optional;
+import java.util.Set;
+import java.util.UUID;
+
@ -166,7 +164,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ if (profile.getId() == null) {
+ final GameProfile profile;
+ if (onlineMode) {
+ profile = lookupUUID ? userCache.get(name) : userCache.getProfileIfCached(name);
+ profile = lookupUUID ? userCache.get(name).orElse(null) : userCache.getProfileIfCached(name);
+ } else {
+ // 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);
@ -179,8 +177,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ }
+
+ if ((profile.getName() == null || !hasTextures()) && profile.getId() != null) {
+ GameProfile profile = userCache.get(this.profile.getId());
+ if (profile != null) {
+ Optional<GameProfile> optProfile = userCache.get(this.profile.getId());
+ if (optProfile.isPresent()) {
+ GameProfile profile = optProfile.get();
+ 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
+ copyProfileProperties(this.profile, profile);
@ -478,7 +477,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/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 {
}
return this.operationCount.incrementAndGet();
}
+ // Paper start
@ -488,9 +487,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ }
+ // Paper end
+
@Nullable
public GameProfile get(UUID uuid) {
GameProfileCache.GameProfileInfo usercache_usercacheentry = (GameProfileCache.GameProfileInfo) this.profilesByUUID.get(uuid);
public synchronized Optional<GameProfile> get(String name) { // Paper - synchronize
String s1 = name.toLowerCase(Locale.ROOT);
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
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

@ -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);

Datei anzeigen

@ -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
UUID uuid = Player.createPlayerUUID(new GameProfile((UUID) null, name));
gameprofile = new GameProfile(uuid, name);
return Optional.of(new GameProfile(uuid, name));

Datei anzeigen

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

Datei anzeigen

@ -10,7 +10,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -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.ClientboundContainerSetSlotPacket(0, slot, inventory.getSelected()));
connection.send(new net.minecraft.network.protocol.game.ClientboundContainerSetSlotPacket(0, stateId, slot, inventory.getSelected()));
}
+
+ @Override

Datei anzeigen

@ -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
}
private boolean hasChest(AbstractHorse entityhorseabstract) {
private boolean hasChest(AbstractHorse horse) {

Datei anzeigen

@ -69,8 +69,8 @@ diff --git a/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEnti
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 @@ import java.util.function.Consumer;
import javax.annotation.Nullable;
@@ -0,0 +0,0 @@ import javax.annotation.Nullable;
import net.minecraft.Util;
import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag;
+import net.minecraft.nbt.ListTag;

Datei anzeigen

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

Datei anzeigen

@ -84,22 +84,22 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/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
private final int containerId;
private final List<ItemStack> items;
this.carriedItem = buf.readItem();
}
+ //Paper start
+ @Override
+ public boolean packetTooLarge(net.minecraft.network.Connection manager) {
+ 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;
+ }
+ // Paper end
+
public ClientboundContainerSetContentPacket(int syncId, NonNullList<ItemStack> contents) {
this.containerId = syncId;
this.items = NonNullList.withSize(contents.size(), ItemStack.EMPTY);
@Override
public void write(FriendlyByteBuf buf) {
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
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacket.java

Datei anzeigen

@ -115,6 +115,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ */ // 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.getCombatTracker().recheckStatus();
+ // Paper - moved into if below

Dateidiff unterdrückt, weil mindestens eine Zeile zu lang ist

Datei anzeigen

@ -2319,7 +2319,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/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<?>> {
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) {
- LOGGER.error(var9);
@ -3313,6 +3313,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
Optional<LevelChunk> optional = ((Either) playerchunk.getTickingChunkFuture().getNow(ChunkHolder.UNLOADED_LEVEL_CHUNK)).left();
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
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java

Datei anzeigen

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

Datei anzeigen

@ -183,6 +183,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
// 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 {
super.doRunTask(task);
}

Datei anzeigen

@ -228,7 +228,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
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);
+ // Paper start - no-tick view distance
+ this.setNoTickViewDistance(this.level.paperConfig.noTickViewDistance);

Datei anzeigen

@ -351,25 +351,22 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
for(int i = 0; i < chunk.getSectionsCount(); ++i) {
@@ -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 CompletableFuture.supplyAsync(() -> {
+ // 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
chunk.setLightCorrect(true);
super.retainData(chunkPos, false);
- this.chunkMap.releaseLightTicket(chunkPos);
- return chunk;
- }, (runnable) -> {
- this.addTask(chunkPos.x, chunkPos.z, ThreadedLevelLightEngine.TaskType.POST_UPDATE, runnable);
+ // Paper start
+ //this.chunkMap.releaseLightTicket(chunkPos); // Paper - moved up
+ future.complete(chunk);
});
+ return future;

Datei anzeigen

@ -151,18 +151,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ registerCleaner();
+ // Paper end
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 {
public void set(int index, int value) { // PAIL: private -> public
private void set(int index, int value) {
if (this.data == null) {
- this.data = new byte[2048];
+ this.data = BYTE_2048.acquire(); // Paper
+ registerCleaner();// Paper
}
int k = this.getPosition(index);
int k = DataLayer.getByteIndex(index);
@@ -0,0 +0,0 @@ public class DataLayer {
public byte[] getData() {
if (this.data == null) {
@ -231,28 +231,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
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
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- 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
+++ b/src/main/java/net/minecraft/world/level/lighting/SkyLightSectionStorage.java
@@ -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 new DataLayer().markPoolSafe(new FlatDataLayer(dataLayer2, 0).getData()); // Paper - mark pool use as safe (no auto cleaner)
return repeatFirstLayer(dataLayer2);
} else {
- return new DataLayer();
+ 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
this.updatingSectionData.copyDataLayer(l);
}

Datei anzeigen

@ -187,8 +187,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
do {
@@ -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
ChunkMap.LOGGER.info("ThreadedAnvilChunkStorage ({}): All chunks are saved", this.storageFolder.getName());
} else {
- this.visibleChunkMap.values().stream().filter(ChunkHolder::wasAccessibleSinceLastSave).forEach((playerchunk) -> {
+ visibleChunks.values().stream().filter(ChunkHolder::wasAccessibleSinceLastSave).forEach((playerchunk) -> {

Datei anzeigen

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

Datei anzeigen

@ -99,7 +99,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- this.distanceManager = new ChunkMap.ChunkDistanceManager(executor, mainThreadExecutor);
+ this.distanceManager = new ChunkMap.ChunkDistanceManager(executor, mainThreadExecutor); this.distanceManager.chunkMap = this; // Paper
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);
@@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
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
Optional<LevelChunk> optional = ((Either) playerchunk.getTickingChunkFuture().getNow(ChunkHolder.UNLOADED_LEVEL_CHUNK)).left();
@@ -0,0 +0,0 @@ public class ServerChunkCache extends ChunkSource {
this.level.getProfiler().pop();
LevelChunk chunk = (LevelChunk) optional.get();
ChunkPos chunkcoordintpair = chunk.getPos();
- if (this.level.isPositionEntityTicking(chunkcoordintpair) && !this.chunkMap.noPlayersCloseForSpawning(chunkcoordintpair)) {

Datei anzeigen

@ -623,26 +623,18 @@ diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/sr
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/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 {
}
}
+ // Paper start - helper
+ 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
+
public boolean isPositionTicking(long i) {
return this.checkChunkFuture(i, (Function<ChunkHolder, CompletableFuture<Either<LevelChunk, ChunkHolder.ChunkLoadingFailure>>>) ChunkHolder::getTickingChunkFuture); // CraftBukkit - decompile error
public boolean isPositionTicking(long pos) {
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
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644

Datei anzeigen

@ -9,12 +9,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/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 {
public void trackChunk(ChunkPos chunkcoordintpair, Packet<?> packet, Packet<?> packet1) {
this.connection.send(packet1);
this.connection.send(packet);
public void trackChunk(ChunkPos chunkPos, Packet<?> chunkDataPacket, Packet<?> lightUpdatePacket) {
this.connection.send(lightUpdatePacket);
this.connection.send(chunkDataPacket);
+ // Paper start
+ 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
}

Datei anzeigen

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

Datei anzeigen

@ -30,7 +30,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ 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
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java

Datei anzeigen

@ -36,8 +36,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- public volatile CommandNode currentCommand; // CraftBukkit
+ 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) {
this(output, pos, rot, world, level, simpleName, name, server, entity, false, (commandcontext, flag, j) -> {
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, name, displayName, server, entity, false, (commandcontext, flag, j) -> {
@@ -0,0 +0,0 @@ public class CommandSourceStack implements SharedSuggestionProvider, com.destroy
@Override
public boolean hasPermission(int level) {

Datei anzeigen

@ -1188,16 +1188,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.chunkMap.getChunks().forEach((playerchunk) -> { // Paper - no... just no...
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 {
NaturalSpawner.spawnForChunk(this.level, chunk, spawnercreature_d, this.spawnFriendlies, this.spawnEnemies, flag2);
}
@ -1218,6 +1208,21 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ } // 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();
}
@ -1268,10 +1273,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl
this.updateSkyBrightness();
this.tickTime();
gameprofilerfiller.popPush("chunkSource");
+ this.timings.chunkProviderTick.startTiming(); // Paper - timings
this.getChunkSource().tick(shouldKeepTicking);
+ this.timings.chunkProviderTick.stopTiming(); // Paper - timings
gameprofilerfiller.popPush("tickPending");
- timings.doTickPending.startTiming(); // Spigot
+ timings.scheduledBlocks.startTiming(); // Paper
@ -1286,6 +1287,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ this.timings.raids.startTiming(); // Paper - timings
this.raids.tick();
+ 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");
timings.doSounds.startTiming(); // Spigot
this.runBlockEvents();

Datei anzeigen

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

Datei anzeigen

@ -80,7 +80,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
int effectiveTickViewDistance = this.getEffectiveViewDistance();
int effectiveNoTickViewDistance = Math.max(this.getEffectiveNoTickViewDistance(), effectiveTickViewDistance);
@@ -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.playerMobDistanceMap = this.level.paperConfig.perPlayerMobSpawns ? new com.destroystokyo.paper.util.PlayerMobDistanceMap() : null; // Paper
+ // Paper start - use distance map to optimise entity tracker

Datei anzeigen

@ -21,6 +21,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ }
+ this.player.getInventory().pickSlot(packet.getSlot()); // Paper - Diff above if changed
+ // 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, packet.getSlot(), this.player.getInventory().getItem(packet.getSlot())));
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, 0, packet.getSlot(), this.player.getInventory().getItem(packet.getSlot())));
this.player.connection.send(new ClientboundSetCarriedItemPacket(this.player.getInventory().selected));

Datei anzeigen

@ -26,7 +26,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ GameProfile profile;
+ // Only fetch an online UUID in online mode
+ if (com.destroystokyo.paper.PaperConfig.isProxyOnlineMode()) {
+ profile = console.getProfileCache().get( name );
+ profile = console.getProfileCache().get(name).orElse(null);
+ } else {
+ // 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);

Datei anzeigen

@ -558,7 +558,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public final CallbackExecutor callbackExecutor = new CallbackExecutor();
@@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
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.playerMobDistanceMap = this.level.paperConfig.perPlayerMobSpawns ? new com.destroystokyo.paper.util.PlayerMobDistanceMap() : null; // Paper
// Paper start - no-tick view distance

Datei anzeigen

@ -22,7 +22,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/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 {
public boolean preventPoiUpdated = false; // CraftBukkit - SPIGOT-5710
public boolean captureBlockStates = false;
public boolean captureTreeGeneration = false;
- 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