More more more work

This commit is contained in:
Nassim Jahnke 2022-07-27 22:46:05 +02:00
parent 50710fa684
commit 7a133678da
No known key found for this signature in database
GPG key ID: 6BE3B555EBC5982B
100 changed files with 239 additions and 234 deletions

View file

@ -1247,7 +1247,7 @@ index ae37e97e52557b48f129cc02eeea395378a48444..785fbcf9bafcdec1c5be213de3d85126
public int getSerializedSize() {
diff --git a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java
index 78e20871e4bd8d92c4475f797a55733c68f6aeb4..34d8fbb441def2e89415729a2f39b9a32eec95c7 100644
index 78e20871e4bd8d92c4475f797a55733c68f6aeb4..723608946947fa2792c7284fa5faa85ab9507897 100644
--- a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java
+++ b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java
@@ -29,6 +29,7 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer
@ -1258,22 +1258,30 @@ index 78e20871e4bd8d92c4475f797a55733c68f6aeb4..34d8fbb441def2e89415729a2f39b9a3
private volatile PalettedContainer.Data<T> data;
private final PalettedContainer.Strategy strategy;
private final ThreadingDetector threadingDetector = new ThreadingDetector("PalettedContainer");
@@ -41,7 +42,13 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer
@@ -41,14 +42,19 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer
this.threadingDetector.checkAndUnlock();
}
- public static <T> Codec<PalettedContainer<T>> codecRW(IdMap<T> idList, Codec<T> entryCodec, PalettedContainer.Strategy paletteProvider, T defaultValue) {
- PalettedContainerRO.Unpacker<T, PalettedContainer<T>> unpacker = PalettedContainer::unpack;
+ // Paper start - Anti-Xray - Add preset values
+ @Deprecated @io.papermc.paper.annotation.DoNotUse public static <T> Codec<PalettedContainer<T>> codecRW(IdMap<T> idList, Codec<T> entryCodec, PalettedContainer.Strategy paletteProvider, T defaultValue) {return codecRW(idList, entryCodec, paletteProvider, defaultValue, null);}
+ public static <T> Codec<PalettedContainer<T>> codecRW(IdMap<T> idList, Codec<T> entryCodec, PalettedContainer.Strategy paletteProvider, T defaultValue, T @org.jetbrains.annotations.Nullable [] presetValues) {
+ PalettedContainerRO.Unpacker<T, PalettedContainer<T>> unpacker = (idMapx, strategyx, packedData) -> {
+ return unpack(idMapx, strategyx, packedData, object, presetValues);
+ return unpack(idMapx, strategyx, packedData, defaultValue, presetValues);
+ };
+ // Paper end
PalettedContainerRO.Unpacker<T, PalettedContainer<T>> unpacker = PalettedContainer::unpack;
return codec(idList, entryCodec, paletteProvider, defaultValue, unpacker);
}
@@ -65,19 +72,52 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer
public static <T> Codec<PalettedContainerRO<T>> codecRO(IdMap<T> idList, Codec<T> entryCodec, PalettedContainer.Strategy paletteProvider, T defaultValue) {
PalettedContainerRO.Unpacker<T, PalettedContainerRO<T>> unpacker = (idListx, paletteProviderx, serialized) -> {
- return unpack(idListx, paletteProviderx, serialized).map((result) -> {
+ return unpack(idListx, paletteProviderx, serialized, defaultValue, null).map((result) -> { // Paper - Anti-Xray - Add preset values
return result;
});
};
@@ -65,19 +71,52 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer
});
}
@ -1329,7 +1337,7 @@ index 78e20871e4bd8d92c4475f797a55733c68f6aeb4..34d8fbb441def2e89415729a2f39b9a3
this.strategy = paletteProvider;
this.registry = idList;
this.data = this.createOrReuseData((PalettedContainer.Data<T>)null, 0);
@@ -92,11 +132,33 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer
@@ -92,11 +131,33 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer
@Override
public int onResize(int newBits, T object) {
PalettedContainer.Data<T> data = this.data;
@ -1364,7 +1372,7 @@ index 78e20871e4bd8d92c4475f797a55733c68f6aeb4..34d8fbb441def2e89415729a2f39b9a3
public T getAndSet(int x, int y, int z, T value) {
this.acquire();
@@ -166,25 +228,36 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer
@@ -166,25 +227,36 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer
data.palette.read(buf);
buf.readLongArray(data.storage.getRaw());
this.data = data;
@ -1404,7 +1412,7 @@ index 78e20871e4bd8d92c4475f797a55733c68f6aeb4..34d8fbb441def2e89415729a2f39b9a3
List<T> list = serialized.paletteEntries();
int i = paletteProvider.size();
int j = paletteProvider.calculateBitsForSerialization(idList, list.size());
@@ -220,7 +293,7 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer
@@ -220,7 +292,7 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer
}
}
@ -1413,7 +1421,7 @@ index 78e20871e4bd8d92c4475f797a55733c68f6aeb4..34d8fbb441def2e89415729a2f39b9a3
}
@Override
@@ -280,12 +353,12 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer
@@ -280,12 +352,12 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer
}
public PalettedContainer<T> copy() {
@ -1428,7 +1436,7 @@ index 78e20871e4bd8d92c4475f797a55733c68f6aeb4..34d8fbb441def2e89415729a2f39b9a3
}
@Override
@@ -329,9 +402,20 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer
@@ -329,9 +401,20 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer
return 1 + this.palette.getSerializedSize() + FriendlyByteBuf.getVarIntSize(this.storage.getSize()) + this.storage.getRaw().length * 8;
}

View file

@ -0,0 +1,29 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: JRoy <joshroy126@gmail.com>
Date: Fri, 5 Jun 2020 18:24:06 -0400
Subject: [PATCH] Add and implement PlayerRecipeBookClickEvent
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index a0f492b0c7783fc8c5ce2e1a60707ae2db74ab9f..640a9e56477e827f25acb962cbbda37a33401139 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -3205,9 +3205,15 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
if (!this.player.containerMenu.stillValid(this.player)) {
ServerGamePacketListenerImpl.LOGGER.debug("Player {} interacted with invalid menu {}", this.player, this.player.containerMenu);
} else {
- this.server.getRecipeManager().byKey(packet.getRecipe()).ifPresent((irecipe) -> {
- ((RecipeBookMenu) this.player.containerMenu).handlePlacement(packet.isShiftDown(), irecipe, this.player);
- });
+ // Paper start - fire event for clicking recipes in the recipe book
+ com.destroystokyo.paper.event.player.PlayerRecipeBookClickEvent event = new com.destroystokyo.paper.event.player.PlayerRecipeBookClickEvent(
+ player.getBukkitEntity(), org.bukkit.craftbukkit.util.CraftNamespacedKey.fromMinecraft(packet.getRecipe()), packet.isShiftDown());
+ if (event.callEvent() && this.player.containerMenu instanceof RecipeBookMenu<?> recipeBookMenu) { // check if inventory changed during event handling
+ this.server.getRecipeManager().byKey(org.bukkit.craftbukkit.util.CraftNamespacedKey.toMinecraft(event.getRecipe())).ifPresent((irecipe) -> {
+ recipeBookMenu.handlePlacement(event.isMakeAll(), irecipe, this.player);
+ });
+ }
+ // Paper end
}
}
}

View file

@ -9,7 +9,7 @@ on harddrives.
-DPaper.enable-sync-chunk-writes=true to enable
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java
index cc92e2c5e6b62c6a67d0a6534b078e3a6029daf5..26345494ce190b5cd2ab58dd7d4b046796767b20 100644
index 1e01277448a3cf2b2045b54b182166a66c822e20..a32cfa75a9bea896f558bab646d0868391b069a9 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java
@@ -136,7 +136,7 @@ public class DedicatedServerProperties extends Settings<DedicatedServerPropertie

View file

@ -18,10 +18,10 @@ index af00442931f9f6cf878bd61137c2f29fc7c8d0b1..431ff490760f54be76847c7b370dbbb4
return false;
} else if (this.player.blockActionRestricted(this.level, pos, this.gameModeForPlayer)) {
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 00a8b49b4e3b443fed22761b57ebcfa64c8d46aa..ffe92ac27172e9f00b7941a574d98475b4daff94 100644
index 640a9e56477e827f25acb962cbbda37a33401139..650a93fab930b5c2b649477b0549124bd1802e5c 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -829,7 +829,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -871,7 +871,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());
if (!this.server.isCommandBlockEnabled()) {
this.player.sendSystemMessage(Component.translatable("advMode.notEnabled"));
@ -30,7 +30,7 @@ index 00a8b49b4e3b443fed22761b57ebcfa64c8d46aa..ffe92ac27172e9f00b7941a574d98475
this.player.sendSystemMessage(Component.translatable("advMode.notAllowed"));
} else {
BaseCommandBlock commandblocklistenerabstract = null;
@@ -896,7 +896,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -938,7 +938,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());
if (!this.server.isCommandBlockEnabled()) {
this.player.sendSystemMessage(Component.translatable("advMode.notEnabled"));

View file

@ -5,7 +5,7 @@ Subject: [PATCH] Ensure Entity AABB's are never invalid
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 175f5400225584f1fedc940d967a3d6f8ede84c0..520b991a0a8adb91c933288faeba64c1798d8577 100644
index 0f85956d4d1c98225ff7cff7abad217a124f0dfc..258aa2ee24742d48be08940f147e1d998e667fb8 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -662,8 +662,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@ -19,7 +19,7 @@ index 175f5400225584f1fedc940d967a3d6f8ede84c0..520b991a0a8adb91c933288faeba64c1
}
protected AABB makeBoundingBox() {
@@ -3873,6 +3873,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -3870,6 +3870,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
}
public final void setPosRaw(double x, double y, double z) {
@ -31,7 +31,7 @@ index 175f5400225584f1fedc940d967a3d6f8ede84c0..520b991a0a8adb91c933288faeba64c1
if (this.position.x != x || this.position.y != y || this.position.z != z) {
this.position = new Vec3(x, y, z);
int i = Mth.floor(x);
@@ -3890,6 +3895,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -3887,6 +3892,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
this.levelCallback.onMove();
}

View file

@ -8,10 +8,10 @@ makes it so that the server keeps the last difficulty used instead
of restoring the server.properties every single load.
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 1774d6011ea165a36576f283de6531eed873ee4c..3496da11b02d823f6445b6b50d44ee2d2d7435af 100644
index 8e74c4b6b5186663537be304cfe462bb462e92f9..b80b2674077f23a5fe33d20e771b0e8b0968dc69 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -789,7 +789,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -791,7 +791,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
chunkproviderserver.getLightEngine().setTaskPerBatch(worldserver.paperConfig().misc.lightQueueSize); // Paper - increase light queue size
// CraftBukkit start
// this.updateMobSpawningFlags();
@ -63,7 +63,7 @@ index 4bb29f86538552bb62125cc61210fd77b1ec671d..817193ca5fc15134d2985187bc2226cc
return 0;
}
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index a44a9b4b3c78395cdd1d859407a880cb54386d86..ae45abf66d2e7b24d316a5db3d00c0b52f402b7f 100644
index e42df2956e2d852a5a4c8fdeda395a3efd32c44c..da83f111199a6b4c712a9bb8ab6f1d1b5c6ae77c 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -332,7 +332,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
@ -76,10 +76,10 @@ index a44a9b4b3c78395cdd1d859407a880cb54386d86..ae45abf66d2e7b24d316a5db3d00c0b5
@Override
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 86574b86b02dc0b0814cc0d0540e82957f094025..7c014f288184328384a811ecbeef83406a780289 100644
index be00b0f9c15e1e7c22c2d2ebf3063639520f2030..b0dffb7c7c8fece2528ac218acef428731145b92 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -1130,7 +1130,7 @@ public class ServerPlayer extends Player {
@@ -1128,7 +1128,7 @@ public class ServerPlayer extends Player {
this.isChangingDimension = true; // CraftBukkit - Set teleport invulnerability only if player changing worlds
this.connection.send(new ClientboundRespawnPacket(worldserver.dimensionTypeId(), worldserver.dimension(), BiomeManager.obfuscateSeed(worldserver.getSeed()), this.gameMode.getGameModeForPlayer(), this.gameMode.getPreviousGameModeForPlayer(), worldserver.isDebug(), worldserver.isFlat(), true, this.getLastDeathLocation()));
@ -89,10 +89,10 @@ index 86574b86b02dc0b0814cc0d0540e82957f094025..7c014f288184328384a811ecbeef8340
playerlist.sendPlayerPermissionLevel(this);
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index ffe92ac27172e9f00b7941a574d98475b4daff94..50226c6672ffb933fe7e22bf43641983eb6caa54 100644
index 650a93fab930b5c2b649477b0549124bd1802e5c..b72924b80021a4b9748723af7b6b71544d7bede1 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -3258,7 +3258,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -3475,7 +3475,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
public void handleChangeDifficulty(ServerboundChangeDifficultyPacket packet) {
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());
if (this.player.hasPermissions(2) || this.isSingleplayerOwner()) {

View file

@ -5,18 +5,19 @@ Subject: [PATCH] Don't allow null UUID's for chat
diff --git a/src/main/java/net/minecraft/network/chat/ChatSender.java b/src/main/java/net/minecraft/network/chat/ChatSender.java
index 1710d09d115a4adceeb56e07d68d8529eb099a26..8f5ccd61a37db718f527375387b421d438471b3c 100644
index eb33c74d51f9b096ac39adf167fa09afdaa5e56b..64b7ef689743b12723a6b0319948d6ad6152f448 100644
--- a/src/main/java/net/minecraft/network/chat/ChatSender.java
+++ b/src/main/java/net/minecraft/network/chat/ChatSender.java
@@ -13,6 +13,11 @@ public record ChatSender(UUID uuid, Component name, @Nullable Component teamName
public ChatSender(FriendlyByteBuf buf) {
this(buf.readUUID(), buf.readComponent(), buf.readNullable(FriendlyByteBuf::readComponent));
}
@@ -8,6 +8,12 @@ import net.minecraft.world.entity.player.ProfilePublicKey;
public record ChatSender(UUID profileId, @Nullable ProfilePublicKey profilePublicKey) {
public static final ChatSender SYSTEM = new ChatSender(Util.NIL_UUID, (ProfilePublicKey)null);
+ // Paper start
+ public ChatSender {
+ com.google.common.base.Preconditions.checkNotNull(uuid, "uuid cannot be null");
+ }
+ // Paper end
public static ChatSender system(Component name) {
return new ChatSender(Util.NIL_UUID, name);
+
public boolean isSystem() {
return SYSTEM.equals(this);
}

View file

@ -5,10 +5,10 @@ Subject: [PATCH] incremental chunk and player saving
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 3496da11b02d823f6445b6b50d44ee2d2d7435af..2257a93b9f28a3b30f03ecb08e21346e0deeb8bf 100644
index b80b2674077f23a5fe33d20e771b0e8b0968dc69..b8b82e9fe3273e3b53c4877e47b74f0db4dd8630 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -852,7 +852,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -854,7 +854,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
try {
this.isSaving = true;
@ -120,10 +120,10 @@ index 4e8a79f2d3b6f52c6284bc9b0ce2423dc43a154f..36a9d52d9af3bc398010c52dc16ab23e
for (int i = 0; i < this.futures.length(); ++i) {
CompletableFuture<Either<ChunkAccess, ChunkHolder.ChunkLoadingFailure>> completablefuture = (CompletableFuture) this.futures.get(i);
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 86cdc8951544c16f8dc5148bc2c7bf9bbf920c60..c468b012197b2c3444ad8bb0d8a9f41c7ab17b10 100644
index 6188f35e2b5300b6ff4a16e4d6e0e4a846261f8a..4d74eb7883c72fb42275fc5358917244bb36181d 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -106,6 +106,7 @@ import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemp
@@ -103,6 +103,7 @@ import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemp
import net.minecraft.world.level.storage.DimensionDataStorage;
import net.minecraft.world.level.storage.LevelStorageSource;
import net.minecraft.world.phys.Vec3;
@ -131,7 +131,7 @@ index 86cdc8951544c16f8dc5148bc2c7bf9bbf920c60..c468b012197b2c3444ad8bb0d8a9f41c
import org.apache.commons.lang3.mutable.MutableBoolean;
import org.apache.commons.lang3.mutable.MutableObject;
import org.slf4j.Logger;
@@ -715,6 +716,64 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -712,6 +713,64 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}
@ -196,7 +196,7 @@ index 86cdc8951544c16f8dc5148bc2c7bf9bbf920c60..c468b012197b2c3444ad8bb0d8a9f41c
protected void saveAllChunks(boolean flush) {
if (flush) {
List<ChunkHolder> list = (List) this.visibleChunkMap.values().stream().filter(ChunkHolder::wasAccessibleSinceLastSave).peek(ChunkHolder::refreshAccessibility).collect(Collectors.toList());
@@ -799,13 +858,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -796,13 +855,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}
int l = 0;
@ -211,7 +211,7 @@ index 86cdc8951544c16f8dc5148bc2c7bf9bbf920c60..c468b012197b2c3444ad8bb0d8a9f41c
}
@@ -843,6 +896,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -840,6 +893,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
this.level.unload(chunk);
}
@ -219,7 +219,7 @@ index 86cdc8951544c16f8dc5148bc2c7bf9bbf920c60..c468b012197b2c3444ad8bb0d8a9f41c
this.lightEngine.updateChunkStatus(ichunkaccess.getPos());
this.lightEngine.tryScheduleUpdate();
@@ -1263,6 +1317,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1260,6 +1314,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
asyncSaveData, chunk);
chunk.setUnsaved(false);
@ -227,7 +227,7 @@ index 86cdc8951544c16f8dc5148bc2c7bf9bbf920c60..c468b012197b2c3444ad8bb0d8a9f41c
}
// Paper end
@@ -1272,6 +1327,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1269,6 +1324,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
if (!chunk.isUnsaved()) {
return false;
} else {
@ -256,10 +256,10 @@ index 1d9a0f6effa1654609f4d0752ec69eed6ab7134b..585892f19bc0aea89889a358c0407f29
public void close() throws IOException {
// CraftBukkit start
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 443044aa09b80bdbbcd202b53d265c635b50015f..848690e6dfaec00ec9b8a8397d2a6d37f24c8d12 100644
index c3db29bc1b24a976617068a4ddae062857d61097..c7221d169badfae6653d64cb39e1435372ea179a 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1082,6 +1082,37 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -1083,6 +1083,37 @@ public class ServerLevel extends Level implements WorldGenLevel {
return !this.server.isUnderSpawnProtection(this, pos, player) && this.getWorldBorder().isWithinBounds(pos);
}
@ -298,10 +298,10 @@ index 443044aa09b80bdbbcd202b53d265c635b50015f..848690e6dfaec00ec9b8a8397d2a6d37
ServerChunkCache chunkproviderserver = this.getChunkSource();
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 7c014f288184328384a811ecbeef83406a780289..fd46ec45d7f6b43cc02069ff3f2dbbdcf1e66d3c 100644
index b0dffb7c7c8fece2528ac218acef428731145b92..8faa5ccd643158c59d55a6bf8e0e07a44881e6e9 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -178,6 +178,7 @@ import org.bukkit.inventory.MainHand;
@@ -179,6 +179,7 @@ import org.bukkit.inventory.MainHand;
public class ServerPlayer extends Player {
private static final Logger LOGGER = LogUtils.getLogger();
@ -310,10 +310,10 @@ index 7c014f288184328384a811ecbeef83406a780289..fd46ec45d7f6b43cc02069ff3f2dbbdc
private static final int NEUTRAL_MOB_DEATH_NOTIFICATION_RADII_Y = 10;
public ServerGamePacketListenerImpl connection;
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 4b9e030016bef762c01ace5181ade7d1480b8702..c1e62a0d1655993430da7e4cbd8075cd4239adb4 100644
index c9f0aa145b3f05b42b134654a841e88d6c39c3d1..74f7a49930b6fb1313c96a0d3f8802d1758e039c 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -561,6 +561,7 @@ public abstract class PlayerList {
@@ -565,6 +565,7 @@ public abstract class PlayerList {
protected void save(ServerPlayer player) {
if (!player.getBukkitEntity().isPersistent()) return; // CraftBukkit
if (!player.didPlayerJoinEvent) return; // Paper - If we never fired PJE, we disconnected during login. Data has not changed, and additionally, our saved vehicle is not loaded! If we save now, we will lose our vehicle (CraftBukkit bug)
@ -321,7 +321,7 @@ index 4b9e030016bef762c01ace5181ade7d1480b8702..c1e62a0d1655993430da7e4cbd8075cd
this.playerIo.save(player);
ServerStatsCounter serverstatisticmanager = (ServerStatsCounter) player.getStats(); // CraftBukkit
@@ -1163,10 +1164,22 @@ public abstract class PlayerList {
@@ -1167,10 +1168,22 @@ public abstract class PlayerList {
}
public void saveAll() {
@ -346,7 +346,7 @@ index 4b9e030016bef762c01ace5181ade7d1480b8702..c1e62a0d1655993430da7e4cbd8075cd
MinecraftTimings.savePlayers.stopTiming(); // Paper
return null; }); // Paper - ensure main
diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java b/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java
index 8dd9879d52ba9bd816fcfa5413ef3bfc25d562c7..44e1fdbf6798034b9092fe151568ff392da8af08 100644
index dc164608bfb2fb18a1adf83fa10bac4028dcac0a..a97909e77b9b28aede8c8716831c3f9a90618f09 100644
--- a/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java
+++ b/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java
@@ -457,6 +457,7 @@ public abstract class ChunkAccess implements BlockGetter, BiomeManager.NoiseBiom

View file

@ -46,10 +46,10 @@ index 0778fdd4f47015787f7ffbfb39c31ec0e1c039bd..912fd5135e89348bdd3c0a8b6c07860e
return tag != null && tag.getType() == IntArrayTag.TYPE && ((IntArrayTag)tag).getAsIntArray().length == 4;
}
diff --git a/src/main/java/net/minecraft/nbt/NbtUtils.java b/src/main/java/net/minecraft/nbt/NbtUtils.java
index 2df77845b78b9d5fae0a36103d42c8202ee2af9e..73ee50e05a1c8d432d9967d4e879b5bb373740ad 100644
index d6d8adf1e49cdb74dc5d8e2e60bcaca7c5e1c16d..b31741a9c3363e4288636ceff9b38c598a84aa43 100644
--- a/src/main/java/net/minecraft/nbt/NbtUtils.java
+++ b/src/main/java/net/minecraft/nbt/NbtUtils.java
@@ -74,6 +74,11 @@ public final class NbtUtils {
@@ -75,6 +75,11 @@ public final class NbtUtils {
if (nbt.contains("Name", 8)) {
string = nbt.getString("Name");
}

View file

@ -9,10 +9,10 @@ growing to large sizes and preventing login.
This now automatically cleans up the extra properties.
diff --git a/src/main/java/net/minecraft/nbt/NbtUtils.java b/src/main/java/net/minecraft/nbt/NbtUtils.java
index 73ee50e05a1c8d432d9967d4e879b5bb373740ad..5dda064813a0eb00438a7df909d51a4b2d48942e 100644
index b31741a9c3363e4288636ceff9b38c598a84aa43..46681f3fa63516aa750de11cf1dee17cb3734fcd 100644
--- a/src/main/java/net/minecraft/nbt/NbtUtils.java
+++ b/src/main/java/net/minecraft/nbt/NbtUtils.java
@@ -92,7 +92,8 @@ public final class NbtUtils {
@@ -93,7 +93,8 @@ public final class NbtUtils {
for(String string2 : compoundTag.getAllKeys()) {
ListTag listTag = compoundTag.getList(string2, 10);

View file

@ -6,22 +6,24 @@ Subject: [PATCH] Remove some streams from structures
This showed up a lot in the spark profiler, should have a low-medium performance improvement.
diff --git a/src/main/java/net/minecraft/world/level/levelgen/Beardifier.java b/src/main/java/net/minecraft/world/level/levelgen/Beardifier.java
index 89ec6902abaed56e57d3aa7e355a3db70baa02a0..0548be182bc342cc3855dcf7cc11519fc2805121 100644
index 24f58441ae7b43a62d74aa55e9808c1c65f466e4..8ec886a10fc901a964f626a350b39c3fda0e59d9 100644
--- a/src/main/java/net/minecraft/world/level/levelgen/Beardifier.java
+++ b/src/main/java/net/minecraft/world/level/levelgen/Beardifier.java
@@ -36,9 +36,10 @@ public class Beardifier implements DensityFunctions.BeardifierOrMarker {
int j = chunkPos.getMinBlockZ();
@@ -36,10 +36,11 @@ public class Beardifier implements DensityFunctions.BeardifierOrMarker {
int j = pos.getMinBlockZ();
ObjectList<Beardifier.Rigid> objectList = new ObjectArrayList<>(10);
ObjectList<JigsawJunction> objectList2 = new ObjectArrayList<>(32);
- structureManager.startsForStructure(chunkPos, (structure) -> {
- world.startsForStructure(pos, (structure) -> {
+ // Paper start - replace for each
+ for (net.minecraft.world.level.levelgen.structure.StructureStart structureStart : structureManager.startsForStructure(chunkPos, (structure) -> {
+ for (net.minecraft.world.level.levelgen.structure.StructureStart structureStart : structureManager.startsForStructure(pos, (structure) -> {
return structure.terrainAdaptation() != TerrainAdjustment.NONE;
- }).forEach((structureStart) -> {
+ })) {
TerrainAdjustment terrainAdjustment = structureStart.getStructure().terrainAdaptation();
- }).forEach((start) -> {
- TerrainAdjustment terrainAdjustment = start.getStructure().terrainAdaptation();
+ })) { // Paper end
+ TerrainAdjustment terrainAdjustment = structureStart.getStructure().terrainAdaptation();
for(StructurePiece structurePiece : structureStart.getPieces()) {
for(StructurePiece structurePiece : start.getPieces()) {
if (structurePiece.isCloseToChunk(pos, 12)) {
@@ -63,7 +64,7 @@ public class Beardifier implements DensityFunctions.BeardifierOrMarker {
}
}

View file

@ -5,7 +5,7 @@ Subject: [PATCH] Update itemstack legacy name and lore
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
index 5d7e07a9612dc8e62b5843b3c805f6423d5304f2..8400f6fc96efecf0ea77f2e163b589ec375272cd 100644
index 5e0852c4656813272a7ee6cb9c2331410c1b7739..cbcc90cffe38ea249cd0de4b0a90adc2a3ddeb0b 100644
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
@@ -166,6 +166,44 @@ public final class ItemStack {

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Spawn player in correct world on login
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index c1e62a0d1655993430da7e4cbd8075cd4239adb4..0b301b1f164853bfd23300993288a2958824e287 100644
index 74f7a49930b6fb1313c96a0d3f8802d1758e039c..04a4f87920f8e8ab56f864d58424153b54686e3f 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -199,7 +199,18 @@ public abstract class PlayerList {
@@ -200,7 +200,18 @@ public abstract class PlayerList {
}String lastKnownName = s; // Paper
// CraftBukkit end

View file

@ -56,10 +56,10 @@ index f5e52220abc5c678c090b32d83eb9644fa91ce9d..35575434f3c90f1bd23df6584ee8a5a9
}
diff --git a/src/main/java/net/minecraft/world/inventory/LoomMenu.java b/src/main/java/net/minecraft/world/inventory/LoomMenu.java
index 3b3e7a89ce1fc719d241c7a3dc8c746191d91f85..9cbdcb87d76fa36887413754ef625a16624aadd7 100644
index d028ad0ab0e800b0fd93362d21942dff392f24af..942b4cc710bede4c942d269dcfc14ae105ab848d 100644
--- a/src/main/java/net/minecraft/world/inventory/LoomMenu.java
+++ b/src/main/java/net/minecraft/world/inventory/LoomMenu.java
@@ -243,7 +243,8 @@ public class LoomMenu extends AbstractContainerMenu {
@@ -248,7 +248,8 @@ public class LoomMenu extends AbstractContainerMenu {
this.resultSlot.set(ItemStack.EMPTY);
}

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Don't check chunk for portal on world gen entity add
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index cf691b94b478dc058af706e1f2d13b51df231779..289073daacc2d477e965e668c6fb4041d27e3f8c 100644
index 4a2a8566c9d68f21a98774fcecac0f4fa43d88c4..09513bc7a5b78580da415d486369b9403e99c773 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3410,7 +3410,7 @@ public abstract class LivingEntity extends Entity {
@@ -3413,7 +3413,7 @@ public abstract class LivingEntity extends Entity {
Entity entity = this.getVehicle();
super.stopRiding(suppressCancellation); // Paper - suppress

View file

@ -360,10 +360,10 @@ index 36a9d52d9af3bc398010c52dc16ab23e53f2702a..ece4cd0de061969d4d2f07560e6cf38e
return this.isEntityTickingReady;
}
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index c468b012197b2c3444ad8bb0d8a9f41c7ab17b10..b486b800399b53cb6d4912e16f2a14f1a3062759 100644
index 4d74eb7883c72fb42275fc5358917244bb36181d..7b1781faed02a5b5fa37ca6f079d1fb620315c80 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -134,6 +134,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -131,6 +131,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
public final ServerLevel level;
private final ThreadedLevelLightEngine lightEngine;
private final BlockableEventLoop<Runnable> mainThreadExecutor;
@ -371,7 +371,7 @@ index c468b012197b2c3444ad8bb0d8a9f41c7ab17b10..b486b800399b53cb6d4912e16f2a14f1
public ChunkGenerator generator;
private RandomState randomState;
public final Supplier<DimensionDataStorage> overworldDataStorage;
@@ -337,6 +338,15 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -334,6 +335,15 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}
this.mainThreadExecutor = mainThreadExecutor;
@ -387,7 +387,7 @@ index c468b012197b2c3444ad8bb0d8a9f41c7ab17b10..b486b800399b53cb6d4912e16f2a14f1
ProcessorMailbox<Runnable> threadedmailbox = ProcessorMailbox.create(executor, "worldgen");
Objects.requireNonNull(mainThreadExecutor);
@@ -452,6 +462,37 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -449,6 +459,37 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
});
}
@ -425,7 +425,7 @@ index c468b012197b2c3444ad8bb0d8a9f41c7ab17b10..b486b800399b53cb6d4912e16f2a14f1
// Paper start
public void updatePlayerMobTypeMap(Entity entity) {
if (!this.level.paperConfig().entities.spawning.perPlayerMobSpawns) {
@@ -562,6 +603,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -559,6 +600,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
List<ChunkHolder> list1 = new ArrayList();
int j = centerChunk.x;
int k = centerChunk.z;
@ -433,7 +433,7 @@ index c468b012197b2c3444ad8bb0d8a9f41c7ab17b10..b486b800399b53cb6d4912e16f2a14f1
for (int l = -margin; l <= margin; ++l) {
for (int i1 = -margin; i1 <= margin; ++i1) {
@@ -580,6 +622,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -577,6 +619,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
ChunkStatus chunkstatus = (ChunkStatus) distanceToStatus.apply(j1);
CompletableFuture<Either<ChunkAccess, ChunkHolder.ChunkLoadingFailure>> completablefuture = playerchunk.getOrScheduleFuture(chunkstatus, this);
@ -448,7 +448,7 @@ index c468b012197b2c3444ad8bb0d8a9f41c7ab17b10..b486b800399b53cb6d4912e16f2a14f1
list1.add(playerchunk);
list.add(completablefuture);
@@ -937,11 +987,19 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -934,11 +984,19 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
if (requiredStatus == ChunkStatus.EMPTY) {
return this.scheduleChunkLoad(chunkcoordintpair);
} else {
@ -469,7 +469,7 @@ index c468b012197b2c3444ad8bb0d8a9f41c7ab17b10..b486b800399b53cb6d4912e16f2a14f1
if (optional.isPresent() && ((ChunkAccess) optional.get()).getStatus().isOrAfter(requiredStatus)) {
CompletableFuture<Either<ChunkAccess, ChunkHolder.ChunkLoadingFailure>> completablefuture = requiredStatus.load(this.level, this.structureTemplateManager, this.lightEngine, (ichunkaccess) -> {
@@ -953,6 +1011,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -950,6 +1008,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
} else {
return this.scheduleChunkGeneration(holder, requiredStatus);
}
@ -477,7 +477,7 @@ index c468b012197b2c3444ad8bb0d8a9f41c7ab17b10..b486b800399b53cb6d4912e16f2a14f1
}
}
@@ -992,14 +1051,24 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -989,14 +1048,24 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
};
CompletableFuture<CompoundTag> chunkSaveFuture = this.level.asyncChunkTaskManager.getChunkSaveFuture(pos.x, pos.z);
@ -507,7 +507,7 @@ index c468b012197b2c3444ad8bb0d8a9f41c7ab17b10..b486b800399b53cb6d4912e16f2a14f1
return ret;
// Paper end - Async chunk io
}
@@ -1078,7 +1147,10 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1075,7 +1144,10 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
this.releaseLightTicket(chunkcoordintpair);
return CompletableFuture.completedFuture(Either.right(playerchunk_failure));
});
@ -519,7 +519,7 @@ index c468b012197b2c3444ad8bb0d8a9f41c7ab17b10..b486b800399b53cb6d4912e16f2a14f1
}
protected void releaseLightTicket(ChunkPos pos) {
@@ -1162,7 +1234,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1159,7 +1231,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
long i = chunkHolder.getPos().toLong();
Objects.requireNonNull(chunkHolder);
@ -796,10 +796,10 @@ index 585892f19bc0aea89889a358c0407f2975b9efe5..918fda0fbbafa39ce0f421dcaf10f8dc
boolean flag1 = this.chunkMap.promoteChunkMap();
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index fd46ec45d7f6b43cc02069ff3f2dbbdcf1e66d3c..059e4f221f4e509bbdf2b5034890af49f5415d5b 100644
index 8faa5ccd643158c59d55a6bf8e0e07a44881e6e9..514d2d69980f843b5bc9339e63c48ba0e1176df5 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -193,6 +193,7 @@ public class ServerPlayer extends Player {
@@ -194,6 +194,7 @@ public class ServerPlayer extends Player {
private int lastRecordedArmor = Integer.MIN_VALUE;
private int lastRecordedLevel = Integer.MIN_VALUE;
private int lastRecordedExperience = Integer.MIN_VALUE;
@ -807,7 +807,7 @@ index fd46ec45d7f6b43cc02069ff3f2dbbdcf1e66d3c..059e4f221f4e509bbdf2b5034890af49
private float lastSentHealth = -1.0E8F;
private int lastSentFood = -99999999;
private boolean lastFoodSaturationZero = true;
@@ -337,6 +338,21 @@ public class ServerPlayer extends Player {
@@ -338,6 +339,21 @@ public class ServerPlayer extends Player {
this.maxHealthCache = this.getMaxHealth();
this.cachedSingleMobDistanceMap = new com.destroystokyo.paper.util.PooledHashSets.PooledObjectLinkedOpenHashSet<>(this); // Paper
}
@ -1112,10 +1112,10 @@ index 8770fe0db46b01e8b608637df4f1a669a3f4cdde..3c1698ba0d3bc412ab957777d9b5211d
private final String name;
private final Comparator<T> comparator;
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 0b301b1f164853bfd23300993288a2958824e287..ec48afe87b5d159b5bdbe035e214ea7c9024fadb 100644
index 04a4f87920f8e8ab56f864d58424153b54686e3f..9d54f0cffd201d3ee7f2ba39740e08be4823c691 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -178,6 +178,7 @@ public abstract class PlayerList {
@@ -179,6 +179,7 @@ public abstract class PlayerList {
}
public void placeNewPlayer(Connection connection, ServerPlayer player) {
@ -1123,7 +1123,7 @@ index 0b301b1f164853bfd23300993288a2958824e287..ec48afe87b5d159b5bdbe035e214ea7c
ServerPlayer prev = pendingPlayers.put(player.getUUID(), player);// Paper
if (prev != null) {
disconnectPendingPlayer(prev);
@@ -292,8 +293,8 @@ public abstract class PlayerList {
@@ -293,8 +294,8 @@ public abstract class PlayerList {
net.minecraft.server.level.ChunkMap playerChunkMap = worldserver1.getChunkSource().chunkMap;
net.minecraft.server.level.DistanceManager distanceManager = playerChunkMap.distanceManager;
distanceManager.addTicket(net.minecraft.server.level.TicketType.LOGIN, pos, 31, pos.toLong());
@ -1135,7 +1135,7 @@ index 0b301b1f164853bfd23300993288a2958824e287..ec48afe87b5d159b5bdbe035e214ea7c
if (updatingChunk != null) {
return updatingChunk.getEntityTickingChunkFuture();
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 520b991a0a8adb91c933288faeba64c1798d8577..bc3b174ceda5fb6dc6873429b8523ff85a1258a0 100644
index 258aa2ee24742d48be08940f147e1d998e667fb8..7e36e53d44b5efbd6498caecb717bec1dcbec96d 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -293,7 +293,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@ -1194,7 +1194,7 @@ index b234ba968e82ddf1e8f7c84d3a17659e3beda2b3..af22fa8aa8ddef4d592564b14d0114cc
net.minecraft.world.level.chunk.LevelChunk chunk = (net.minecraft.world.level.chunk.LevelChunk) either.left().orElse(null);
if (chunk != null) addTicket(x, z); // Paper
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index daea1ca1d3288b6c3b0cf2e58fe35cb5e4069698..1699ad9a3e0d03866a6a80a74a1a831f6d54d311 100644
index 14dc5a18bffc4d8a7d3e786142a3fd853aaeeac4..bd1611e9e83d0e579d38ad295d9f241570696cb3 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -1035,6 +1035,16 @@ public class CraftPlayer extends CraftHumanEntity implements Player {

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Optimize NetworkManager Exception Handling
diff --git a/src/main/java/net/minecraft/network/ConnectionProtocol.java b/src/main/java/net/minecraft/network/ConnectionProtocol.java
index d15ef330db69e0c948824d9bf112a26680c90b1b..25c98fa91260c5fe3bd42c0861e3834b4ec5dc5c 100644
index 672e296cec289abd3bf797d84e16983ca50907be..aec921477e035095d569eab3335175b93a65e672 100644
--- a/src/main/java/net/minecraft/network/ConnectionProtocol.java
+++ b/src/main/java/net/minecraft/network/ConnectionProtocol.java
@@ -299,6 +299,7 @@ public enum ConnectionProtocol {
@@ -302,6 +302,7 @@ public enum ConnectionProtocol {
@Nullable
public Packet<?> createPacket(int id, FriendlyByteBuf buf) {

View file

@ -6,10 +6,10 @@ Subject: [PATCH] Optimize the advancement data player iteration to be O(N)
diff --git a/src/main/java/net/minecraft/server/PlayerAdvancements.java b/src/main/java/net/minecraft/server/PlayerAdvancements.java
index 4591364057110b8abe6cc669b76918096cb6b776..736e604205c0dcbe2cf1f1e0d507f53a9c0d941b 100644
index 3f7f6a43ac0bf2efb0e66dc96438febbd92113e9..0c2f12e7930646a3da53a50f38be62e0cb1ed2b7 100644
--- a/src/main/java/net/minecraft/server/PlayerAdvancements.java
+++ b/src/main/java/net/minecraft/server/PlayerAdvancements.java
@@ -436,6 +436,16 @@ public class PlayerAdvancements {
@@ -435,6 +435,16 @@ public class PlayerAdvancements {
}
private void ensureVisibility(Advancement advancement) {
@ -26,7 +26,7 @@ index 4591364057110b8abe6cc669b76918096cb6b776..736e604205c0dcbe2cf1f1e0d507f53a
boolean flag = this.shouldBeVisible(advancement);
boolean flag1 = this.visible.contains(advancement);
@@ -451,15 +461,23 @@ public class PlayerAdvancements {
@@ -450,15 +460,23 @@ public class PlayerAdvancements {
}
if (flag != flag1 && advancement.getParent() != null) {

View file

@ -26,19 +26,19 @@ index a4f97c1df86c574af9b9824a38034a3d76d6e357..d65defd5fc54086a969c568b93dfb05f
}
// CraftBukkit end
diff --git a/src/main/java/net/minecraft/commands/CommandSourceStack.java b/src/main/java/net/minecraft/commands/CommandSourceStack.java
index 08cdd5807237c709accc989718178bc25428eb74..c948b9387e14d7f8bb2cd6236f513d57286d9301 100644
index 981f08a537253516a6ce8b78f6cd04d7e5e1b546..b14773074fc4b10ef427eb0ad9e21601a7287901 100644
--- a/src/main/java/net/minecraft/commands/CommandSourceStack.java
+++ b/src/main/java/net/minecraft/commands/CommandSourceStack.java
@@ -55,7 +55,7 @@ public class CommandSourceStack implements SharedSuggestionProvider, com.destroy
private final EntityAnchorArgument.Anchor anchor;
@@ -59,7 +59,7 @@ public class CommandSourceStack implements SharedSuggestionProvider, com.destroy
private final Vec2 rotation;
private final CommandSigningContext signingContext;
private final TaskChainer chatMessageChainer;
- public volatile CommandNode currentCommand; // CraftBukkit
+ public java.util.Map<Thread, CommandNode> currentCommand = new java.util.concurrent.ConcurrentHashMap<>(); // CraftBukkit // Paper
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) -> {
@@ -186,9 +186,11 @@ public class CommandSourceStack implements SharedSuggestionProvider, com.destroy
@@ -195,9 +195,11 @@ public class CommandSourceStack implements SharedSuggestionProvider, com.destroy
@Override
public boolean hasPermission(int level) {
// CraftBukkit start

View file

@ -10,10 +10,10 @@ This fixes that by checking if the modified spawn location is
still at a respawn anchor.
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index ec48afe87b5d159b5bdbe035e214ea7c9024fadb..be7a25560cd5521ddfe4793c7e51b1036fc8a19c 100644
index 9d54f0cffd201d3ee7f2ba39740e08be4823c691..ec0ceaac85b5868849b6399cdf8eb2b4447508e3 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -835,6 +835,7 @@ public abstract class PlayerList {
@@ -839,6 +839,7 @@ public abstract class PlayerList {
// Paper start
boolean isBedSpawn = false;
boolean isRespawn = false;
@ -21,7 +21,7 @@ index ec48afe87b5d159b5bdbe035e214ea7c9024fadb..be7a25560cd5521ddfe4793c7e51b103
// Paper end
// CraftBukkit start - fire PlayerRespawnEvent
@@ -845,7 +846,7 @@ public abstract class PlayerList {
@@ -849,7 +850,7 @@ public abstract class PlayerList {
Optional optional;
if (blockposition != null) {
@ -30,7 +30,7 @@ index ec48afe87b5d159b5bdbe035e214ea7c9024fadb..be7a25560cd5521ddfe4793c7e51b103
} else {
optional = Optional.empty();
}
@@ -889,7 +890,12 @@ public abstract class PlayerList {
@@ -893,7 +894,12 @@ public abstract class PlayerList {
}
// Spigot End
@ -44,7 +44,7 @@ index ec48afe87b5d159b5bdbe035e214ea7c9024fadb..be7a25560cd5521ddfe4793c7e51b103
if (!flag) entityplayer.reset(); // SPIGOT-4785
isRespawn = true; // Paper
} else {
@@ -927,8 +933,12 @@ public abstract class PlayerList {
@@ -931,8 +937,12 @@ public abstract class PlayerList {
}
// entityplayer1.initInventoryMenu();
entityplayer1.setHealth(entityplayer1.getHealth());

View file

@ -60,22 +60,14 @@ index 06fc39b19385d36fd0c5bb9a7042a238eb6e8a57..bb1f0e9dbcb792d015d1cb65664a96fd
LootContext lootContext = EntityPredicate.createContext(player, player);
List<CriterionTrigger.Listener<T>> list = null;
diff --git a/src/main/java/net/minecraft/server/PlayerAdvancements.java b/src/main/java/net/minecraft/server/PlayerAdvancements.java
index 736e604205c0dcbe2cf1f1e0d507f53a9c0d941b..a4f2eb219cc57303cc6642e6782700591e423cf4 100644
index 0c2f12e7930646a3da53a50f38be62e0cb1ed2b7..e7ec5e1144c1596b035f97fb1fb86d18e61be3c9 100644
--- a/src/main/java/net/minecraft/server/PlayerAdvancements.java
+++ b/src/main/java/net/minecraft/server/PlayerAdvancements.java
@@ -39,6 +39,7 @@ import net.minecraft.advancements.Criterion;
import net.minecraft.advancements.CriterionProgress;
import net.minecraft.advancements.CriterionTrigger;
import net.minecraft.advancements.CriterionTriggerInstance;
+import net.minecraft.advancements.critereon.SimpleCriterionTrigger;
import net.minecraft.network.chat.ChatType;
import net.minecraft.network.chat.Component;
import net.minecraft.network.protocol.game.ClientboundSelectAdvancementsTabPacket;
@@ -69,6 +70,8 @@ public class PlayerAdvancements {
@@ -68,6 +68,8 @@ public class PlayerAdvancements {
private Advancement lastSelectedTab;
private boolean isFirstPacket = true;
+ public final Map<SimpleCriterionTrigger, Set<CriterionTrigger.Listener>> criterionData = Maps.newIdentityHashMap(); // Paper - fix advancement data player leakage
+ public final Map<net.minecraft.advancements.critereon.SimpleCriterionTrigger, Set<CriterionTrigger.Listener>> criterionData = Maps.newIdentityHashMap(); // Paper - fix advancement data player leakage
+
public PlayerAdvancements(DataFixer dataFixer, PlayerList playerManager, ServerAdvancementManager advancementLoader, File advancementFile, ServerPlayer owner) {
this.dataFixer = dataFixer;

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Brand support
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 50226c6672ffb933fe7e22bf43641983eb6caa54..b924bf36e5a13d9fb7078e091e50c7e468bdd5b5 100644
index b72924b80021a4b9748723af7b6b71544d7bede1..322c9d39cd63e1651e5bb1b9ba5b070a18bf5340 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -279,6 +279,8 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -296,6 +296,8 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
private static final long KEEPALIVE_LIMIT = Long.getLong("paper.playerconnection.keepalive", 30) * 1000; // Paper - provide property to set keepalive limit
private static final int MAX_SIGN_LINE_LENGTH = Integer.getInteger("Paper.maxSignLength", 80); // Paper
@ -16,8 +16,8 @@ index 50226c6672ffb933fe7e22bf43641983eb6caa54..b924bf36e5a13d9fb7078e091e50c7e4
+
public ServerGamePacketListenerImpl(MinecraftServer server, Connection connection, ServerPlayer player) {
this.lastChatTimeStamp = new AtomicReference(Instant.EPOCH);
this.server = server;
@@ -3213,6 +3215,8 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
this.lastSeenMessagesValidator = new LastSeenMessagesValidator();
@@ -3430,6 +3432,8 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
private static final ResourceLocation CUSTOM_REGISTER = new ResourceLocation("register");
private static final ResourceLocation CUSTOM_UNREGISTER = new ResourceLocation("unregister");
@ -26,7 +26,7 @@ index 50226c6672ffb933fe7e22bf43641983eb6caa54..b924bf36e5a13d9fb7078e091e50c7e4
@Override
public void handleCustomPayload(ServerboundCustomPayloadPacket packet) {
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());
@@ -3240,6 +3244,15 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -3457,6 +3461,15 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
try {
byte[] data = new byte[packet.data.readableBytes()];
packet.data.readBytes(data);
@ -42,7 +42,7 @@ index 50226c6672ffb933fe7e22bf43641983eb6caa54..b924bf36e5a13d9fb7078e091e50c7e4
this.cserver.getMessenger().dispatchIncomingMessage(this.player.getBukkitEntity(), packet.identifier.toString(), data);
} catch (Exception ex) {
ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t dispatch custom payload", ex);
@@ -3249,6 +3262,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -3466,6 +3479,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
}
@ -56,10 +56,10 @@ index 50226c6672ffb933fe7e22bf43641983eb6caa54..b924bf36e5a13d9fb7078e091e50c7e4
return (!this.player.joining && !this.connection.isConnected()) || this.processedDisconnect; // Paper
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 1699ad9a3e0d03866a6a80a74a1a831f6d54d311..d06f6c9a7bfa7585d5dfb7da8654837605866a3e 100644
index bd1611e9e83d0e579d38ad295d9f241570696cb3..d70be6515dbf00ab6fe5b3c05d208a5686ce0209 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -2685,6 +2685,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -2679,6 +2679,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
// Paper end
};

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Add #setMaxPlayers API
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index be7a25560cd5521ddfe4793c7e51b1036fc8a19c..869fa7c3913185c3537185426e75c076fbbdb7fe 100644
index ec0ceaac85b5868849b6399cdf8eb2b4447508e3..32f8a030abb81aa29cab9432b72f9b522f1f6aa6 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -146,7 +146,7 @@ public abstract class PlayerList {
@@ -147,7 +147,7 @@ public abstract class PlayerList {
public final PlayerDataStorage playerIo;
private boolean doWhiteList;
private final RegistryAccess.Frozen registryHolder;

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Fix SpawnChangeEvent not firing for all use-cases
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 848690e6dfaec00ec9b8a8397d2a6d37f24c8d12..bb8d5868275407fe3c5eb29174bf1970cae498f9 100644
index c7221d169badfae6653d64cb39e1435372ea179a..f4ec0487051b0d61a79bef3067cb4fc19d64a544 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1850,6 +1850,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -1851,6 +1851,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
//ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(new BlockPosition(this.worldData.a(), 0, this.worldData.c()));
this.levelData.setSpawn(pos, angle);

View file

@ -54,10 +54,10 @@ index ece4cd0de061969d4d2f07560e6cf38e631098b3..90f65fdcc4acf6762c67a5cb3023d249
public ChunkHolder(ChunkPos pos, int level, LevelHeightAccessor world, LevelLightEngine lightingProvider, ChunkHolder.LevelChangeListener levelUpdateListener, ChunkHolder.PlayerProvider playersWatchingChunkProvider) {
this.futures = new AtomicReferenceArray(ChunkHolder.CHUNK_STATUSES.size());
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index b486b800399b53cb6d4912e16f2a14f1a3062759..13c4bfa296c854b5dbbffc495a029c6822131529 100644
index 7b1781faed02a5b5fa37ca6f079d1fb620315c80..b659a058a0b6eb6b1827aacbd703e15fcbb1609c 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -712,7 +712,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -709,7 +709,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
return either.mapLeft((list) -> {
return (LevelChunk) list.get(list.size() / 2);
});
@ -66,7 +66,7 @@ index b486b800399b53cb6d4912e16f2a14f1a3062759..13c4bfa296c854b5dbbffc495a029c68
}
@Nullable
@@ -1118,6 +1118,12 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1115,6 +1115,12 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
return "chunkGenerate " + requiredStatus.getName();
});
Executor executor = (runnable) -> {

View file

@ -8,10 +8,10 @@ the world per tick, this attempts to reduce the impact that join floods
has on the server
diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java
index ed4587248fada36c4c206be1fa36fef42fc969e2..ddde8f9f53f352c806166354e6a445543ecc2fbf 100644
index c06cb0f0e300c4d00b3aeed12772c38e8379cb0c..eb18253d4ae0618884c9061f8dda689119e10ef0 100644
--- a/src/main/java/net/minecraft/network/Connection.java
+++ b/src/main/java/net/minecraft/network/Connection.java
@@ -387,10 +387,22 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
@@ -396,8 +396,23 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
}
// Paper end
@ -26,11 +26,12 @@ index ed4587248fada36c4c206be1fa36fef42fc969e2..ddde8f9f53f352c806166354e6a44554
+ joinAttemptsThisTick = 0;
+ }
+ // Paper end
if (this.packetListener instanceof ServerLoginPacketListenerImpl) {
+ if (this.packetListener instanceof ServerLoginPacketListenerImpl) {
+ if ( ((ServerLoginPacketListenerImpl) this.packetListener).state != ServerLoginPacketListenerImpl.State.READY_TO_ACCEPT // Paper
+ || (joinAttemptsThisTick++ < MAX_PER_TICK)) { // Paper - limit the number of joins which can be processed each tick
((ServerLoginPacketListenerImpl) this.packetListener).tick();
+ || (joinAttemptsThisTick++ < MAX_PER_TICK)) { // Paper - limit the number of joins which can be processed each tick
+ ((ServerLoginPacketListenerImpl) this.packetListener).tick();
+ } // Paper
}
+ }
PacketListener packetlistener = this.packetListener;
if (this.packetListener instanceof ServerGamePacketListenerImpl) {
if (packetlistener instanceof TickablePacketListener) {

View file

@ -25,10 +25,10 @@ index 43759cdf3da0796d7969c6504ac9a6986c0f0518..750fef0f5b908b776a7306e54653eba4
this.connection.send(new ClientboundLoginDisconnectPacket(ichatmutablecomponent));
diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
index e51c03e05c4407ad3a51e573a5e79b003f86d9f1..000ee7e12a1c756e065e99ebdbcf4a51047ec4d3 100644
index 40b27dbdc15e07a6a9d63d41babe5ed0245c0e0b..0ad129adf726049c62f8d5c816cc32b3b6b9b2eb 100644
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
@@ -111,7 +111,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener
@@ -113,7 +113,7 @@ public class ServerLoginPacketListenerImpl implements TickablePacketListener, Se
// CraftBukkit start
@Deprecated
public void disconnect(String s) {

View file

@ -5,7 +5,7 @@ Subject: [PATCH] PortalCreateEvent needs to know its entity
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
index 8400f6fc96efecf0ea77f2e163b589ec375272cd..494a39cfafa5a632ccb61b196b0ec4e5772aa180 100644
index cbcc90cffe38ea249cd0de4b0a90adc2a3ddeb0b..b4ad1610d30396be344a04f5f3a565ae2b8f2265 100644
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
@@ -431,7 +431,7 @@ public final class ItemStack {
@ -79,10 +79,10 @@ index 5ce5902b13ebb9438433d189f2c03677e4cb54b3..e34b8cff424ad58eee65a65fa510fa99
private static int getFireTickDelay(RandomSource random) {
diff --git a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
index 0ff34d2c569fbeae95509abed343b1e2f593378a..d75eb5eef83c9b0d247c7d8cb5021e931fe3ef4c 100644
index ad38a7ced7f3dc05fb3d133e9da39f0a5eb0915b..7117dd220c393163fd5be77e332e56a34c667670 100644
--- a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
+++ b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
@@ -34,6 +34,7 @@ import net.minecraft.world.item.DyeColor;
@@ -35,6 +35,7 @@ import net.minecraft.world.item.DyeColor;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.context.BlockPlaceContext;
@ -90,7 +90,7 @@ index 0ff34d2c569fbeae95509abed343b1e2f593378a..d75eb5eef83c9b0d247c7d8cb5021e93
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.EmptyBlockGetter;
import net.minecraft.world.level.Level;
@@ -135,6 +136,12 @@ public abstract class BlockBehaviour {
@@ -136,6 +137,12 @@ public abstract class BlockBehaviour {
DebugPackets.sendNeighborsUpdatePacket(world, pos);
}

View file

@ -42,7 +42,7 @@ index a859a675b4bc543e139358223cc92ad5eee3ddb5..31a22f26070059e5379730c1940ff1c5
public net.minecraft.world.item.enchantment.Enchantment getHandle() {
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index 7d9a91b2afb6890a160c2cd1e1cf3f0fb6a10d92..c5d570131cd3c9b43ab7889454923c29078e0915 100644
index 61668447c4314562109e31bd5ca48da181e98529..79bd1a6d4003f990e667e9d66605e6cc74e05eee 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -478,6 +478,30 @@ public final class CraftMagicNumbers implements UnsafeValues {

View file

@ -5,7 +5,7 @@ Subject: [PATCH] Cache block data strings
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 2257a93b9f28a3b30f03ecb08e21346e0deeb8bf..ac65ff966b5ecd0960340c5a4063843e7c5582f3 100644
index b8b82e9fe3273e3b53c4877e47b74f0db4dd8630..ff2d51aa788d8605f901fa592491b5d2d0da27d1 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -2015,6 +2015,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa

View file

@ -9,10 +9,10 @@ as this is how Vanilla teleports entities.
Cancel any pending motion when teleported.
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index b924bf36e5a13d9fb7078e091e50c7e468bdd5b5..b1281d1a0a51953703552e5855dd5a48de4e781e 100644
index 322c9d39cd63e1651e5bb1b9ba5b070a18bf5340..8dae48382c8356e9721a1cf1a3b807d659e4d123 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -721,7 +721,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -763,7 +763,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
return;
}
@ -21,7 +21,7 @@ index b924bf36e5a13d9fb7078e091e50c7e468bdd5b5..b1281d1a0a51953703552e5855dd5a48
this.lastGoodX = this.awaitingPositionFromClient.x;
this.lastGoodY = this.awaitingPositionFromClient.y;
this.lastGoodZ = this.awaitingPositionFromClient.z;
@@ -1603,7 +1603,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -1669,7 +1669,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
// CraftBukkit end
this.awaitingTeleportTime = this.tickCount;
@ -31,7 +31,7 @@ index b924bf36e5a13d9fb7078e091e50c7e468bdd5b5..b1281d1a0a51953703552e5855dd5a48
}
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index bc3b174ceda5fb6dc6873429b8523ff85a1258a0..602525fdfe46fbe6e480a60f3382d04c344c7117 100644
index 7e36e53d44b5efbd6498caecb717bec1dcbec96d..1ed2670ab0687793b9298c2c1deb92da93e7bfd2 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -158,6 +158,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@ -42,7 +42,7 @@ index bc3b174ceda5fb6dc6873429b8523ff85a1258a0..602525fdfe46fbe6e480a60f3382d04c
static boolean isLevelAtLeast(CompoundTag tag, int level) {
return tag.contains("Bukkit.updateLevel") && tag.getInt("Bukkit.updateLevel") >= level;
}
@@ -1656,6 +1657,13 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -1651,6 +1652,13 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
}
public void moveTo(double x, double y, double z, float yaw, float pitch) {

View file

@ -6,10 +6,10 @@ Subject: [PATCH] Extend block drop capture to capture all items added to the
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index bb8d5868275407fe3c5eb29174bf1970cae498f9..2ac0db36942ecb6dd073bc08f42fb3d1a6c12f6d 100644
index f4ec0487051b0d61a79bef3067cb4fc19d64a544..f1506529687e47150a3134b3d5acac8021abe956 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1287,6 +1287,12 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -1288,6 +1288,12 @@ public class ServerLevel extends Level implements WorldGenLevel {
// WorldServer.LOGGER.warn("Tried to add entity {} but it was marked as removed already", EntityTypes.getKey(entity.getType())); // CraftBukkit
return false;
} else {

View file

@ -6,10 +6,10 @@ Subject: [PATCH] Expose the Entity Counter to allow plugins to use valid and
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 602525fdfe46fbe6e480a60f3382d04c344c7117..c2a17211cc216b9cf83ff393bf69ef49a3e778e8 100644
index 1ed2670ab0687793b9298c2c1deb92da93e7bfd2..511255467688d4c9397037753d2d4821af29bb79 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -4077,4 +4077,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -4074,4 +4074,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
void accept(Entity entity, double x, double y, double z);
}
@ -21,7 +21,7 @@ index 602525fdfe46fbe6e480a60f3382d04c344c7117..c2a17211cc216b9cf83ff393bf69ef49
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index c5d570131cd3c9b43ab7889454923c29078e0915..7de4cf40d96caba35b43b6b4ac4daa1bf28ef27f 100644
index 79bd1a6d4003f990e667e9d66605e6cc74e05eee..04b3608424e482daaae7b399e61cf0d5f8e03729 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -502,6 +502,10 @@ public final class CraftMagicNumbers implements UnsafeValues {

View file

@ -5,7 +5,7 @@ Subject: [PATCH] Entity#isTicking
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index c2a17211cc216b9cf83ff393bf69ef49a3e778e8..c5cd18b02e5956fef6779b0b89d33b515bc9d13a 100644
index 511255467688d4c9397037753d2d4821af29bb79..532678194c2724e31a19f0e4d73d79d84ef6699c 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -59,6 +59,7 @@ import net.minecraft.resources.ResourceKey;
@ -16,7 +16,7 @@ index c2a17211cc216b9cf83ff393bf69ef49a3e778e8..c5cd18b02e5956fef6779b0b89d33b51
import net.minecraft.server.level.ServerLevel;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.server.level.TicketType;
@@ -4082,5 +4083,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -4079,5 +4080,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
public static int nextEntityId() {
return ENTITY_COUNTER.incrementAndGet();
}

View file

@ -6,7 +6,7 @@ Subject: [PATCH] Fix deop kicking non-whitelisted player when white list is
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index ac65ff966b5ecd0960340c5a4063843e7c5582f3..115e598dcb075a8019b588b878e9d22994f0ce9f 100644
index ff2d51aa788d8605f901fa592491b5d2d0da27d1..6fd6d2a4faf8e72511170fb3c3aa80733ed0e8d9 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -2081,13 +2081,14 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa

View file

@ -6,10 +6,10 @@ Subject: [PATCH] Fix for large move vectors crashing server
Check movement distance also based on current position.
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index b1281d1a0a51953703552e5855dd5a48de4e781e..f1a41a931b22f88f0dd530fb559b1c2ed839527a 100644
index 8dae48382c8356e9721a1cf1a3b807d659e4d123..09edf5f6bbff8ae4af093d03e9a9f06337e87caa 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -536,9 +536,9 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -578,9 +578,9 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
if (entity != this.player && entity.getControllingPassenger() == this.player && entity == this.lastVehicle) {
ServerLevel worldserver = this.player.getLevel();
@ -22,7 +22,7 @@ index b1281d1a0a51953703552e5855dd5a48de4e781e..f1a41a931b22f88f0dd530fb559b1c2e
double d3 = ServerGamePacketListenerImpl.clampHorizontal(packet.getX()); final double toX = d3; // Paper - OBFHELPER
double d4 = ServerGamePacketListenerImpl.clampVertical(packet.getY()); final double toY = d4; // Paper - OBFHELPER
double d5 = ServerGamePacketListenerImpl.clampHorizontal(packet.getZ()); final double toZ = d5; // Paper - OBFHELPER
@@ -548,8 +548,19 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -590,8 +590,19 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
double d7 = d4 - this.vehicleFirstGoodY;
double d8 = d5 - this.vehicleFirstGoodZ;
double d9 = entity.getDeltaMovement().lengthSqr();
@ -44,7 +44,7 @@ index b1281d1a0a51953703552e5855dd5a48de4e781e..f1a41a931b22f88f0dd530fb559b1c2e
// CraftBukkit start - handle custom speeds and skipped ticks
this.allowedPlayerTicks += (System.currentTimeMillis() / 50) - this.lastTick;
@@ -595,9 +606,9 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -637,9 +648,9 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
boolean flag = worldserver.noCollision(entity, entity.getBoundingBox().deflate(0.0625D));
@ -57,7 +57,7 @@ index b1281d1a0a51953703552e5855dd5a48de4e781e..f1a41a931b22f88f0dd530fb559b1c2e
boolean flag1 = entity.verticalCollisionBelow;
entity.move(MoverType.PLAYER, new Vec3(d6, d7, d8));
@@ -1283,7 +1294,18 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -1349,7 +1360,18 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
double d8 = d1 - this.firstGoodY;
double d9 = d2 - this.firstGoodZ;
double d10 = this.player.getDeltaMovement().lengthSqr();
@ -77,7 +77,7 @@ index b1281d1a0a51953703552e5855dd5a48de4e781e..f1a41a931b22f88f0dd530fb559b1c2e
if (this.player.isSleeping()) {
if (d11 > 1.0D) {
@@ -1335,9 +1357,9 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -1401,9 +1423,9 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
AABB axisalignedbb = this.player.getBoundingBox();

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Improve inlinig for some hot IBlockData methods
diff --git a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
index d75eb5eef83c9b0d247c7d8cb5021e931fe3ef4c..254ac28e692cf06c3286c8f4c6edb9de412851a2 100644
index 7117dd220c393163fd5be77e332e56a34c667670..178d9ad7525b6743038ed45c6f85686a860ffd26 100644
--- a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
+++ b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
@@ -716,8 +716,14 @@ public abstract class BlockBehaviour {
@@ -717,8 +717,14 @@ public abstract class BlockBehaviour {
return this.shapeExceedsCube;
}
// Paper end
@ -23,7 +23,7 @@ index d75eb5eef83c9b0d247c7d8cb5021e931fe3ef4c..254ac28e692cf06c3286c8f4c6edb9de
if (!this.getBlock().hasDynamicShape()) {
this.cache = new BlockBehaviour.BlockStateBase.Cache(this.asState());
}
@@ -767,15 +773,15 @@ public abstract class BlockBehaviour {
@@ -768,15 +774,15 @@ public abstract class BlockBehaviour {
return this.shapeExceedsCube; // Paper - moved into shape cache init
}
@ -42,7 +42,7 @@ index d75eb5eef83c9b0d247c7d8cb5021e931fe3ef4c..254ac28e692cf06c3286c8f4c6edb9de
return this.isAir;
}
@@ -849,7 +855,7 @@ public abstract class BlockBehaviour {
@@ -850,7 +856,7 @@ public abstract class BlockBehaviour {
}
}
@ -51,7 +51,7 @@ index d75eb5eef83c9b0d247c7d8cb5021e931fe3ef4c..254ac28e692cf06c3286c8f4c6edb9de
return this.canOcclude;
}
@@ -1047,12 +1053,12 @@ public abstract class BlockBehaviour {
@@ -1048,12 +1054,12 @@ public abstract class BlockBehaviour {
return this.getBlock() == block;
}

View file

@ -5,7 +5,7 @@ Subject: [PATCH] Player elytra boost API
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index d06f6c9a7bfa7585d5dfb7da8654837605866a3e..c94a7ccb3d5420dc0c8493d5cb0381a47ea8f9a0 100644
index d70be6515dbf00ab6fe5b3c05d208a5686ce0209..a2a227f24855c89a1a8c45507f8ab0bd750638c4 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -592,6 +592,20 @@ public class CraftPlayer extends CraftHumanEntity implements Player {

View file

@ -15,7 +15,7 @@ manually reload the advancement data for all players, which
normally takes place as a part of the datapack reloading.
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index 7de4cf40d96caba35b43b6b4ac4daa1bf28ef27f..4192a6eff940bfe7823f100d4156f5c4d82d994c 100644
index 04b3608424e482daaae7b399e61cf0d5f8e03729..9f08928bdfc1644b7f902c1685c3324d6ee896c1 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -340,7 +340,13 @@ public final class CraftMagicNumbers implements UnsafeValues {

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Add API for quit reason
diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java
index ddde8f9f53f352c806166354e6a445543ecc2fbf..91556b52edaa1d5c4dc73a825c77b9a66b002c61 100644
index eb18253d4ae0618884c9061f8dda689119e10ef0..cc1aa02fdf214b63aa105f3b0b12723dc359d287 100644
--- a/src/main/java/net/minecraft/network/Connection.java
+++ b/src/main/java/net/minecraft/network/Connection.java
@@ -151,12 +151,15 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
@@ -147,12 +147,15 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
this.handlingFault = true;
if (this.channel.isOpen()) {
@ -25,10 +25,10 @@ index ddde8f9f53f352c806166354e6a445543ecc2fbf..91556b52edaa1d5c4dc73a825c77b9a6
Connection.LOGGER.debug("Failed to sent packet", throwable);
ConnectionProtocol enumprotocol = this.getCurrentProtocol();
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 059e4f221f4e509bbdf2b5034890af49f5415d5b..c9bb90854af9881f044c1968d116368957cc1d7d 100644
index 514d2d69980f843b5bc9339e63c48ba0e1176df5..8c6f55efb555c9ca7253ccc1cd9ba615cfb1171c 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -265,6 +265,7 @@ public class ServerPlayer extends Player {
@@ -266,6 +266,7 @@ public class ServerPlayer extends Player {
public double lastEntitySpawnRadiusSquared; // Paper - optimise isOutsideRange, this field is in blocks
public final com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<ServerPlayer> cachedSingleHashSet; // Paper
@ -37,22 +37,22 @@ index 059e4f221f4e509bbdf2b5034890af49f5415d5b..c9bb90854af9881f044c1968d1163689
public ServerPlayer(MinecraftServer server, ServerLevel world, GameProfile profile, @Nullable ProfilePublicKey publicKey) {
super(world, world.getSharedSpawnPos(), world.getSharedSpawnAngle(), profile, publicKey);
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index f1a41a931b22f88f0dd530fb559b1c2ed839527a..2687823d07df2c4b57cb684000621c69c1cfd10d 100644
index 09edf5f6bbff8ae4af093d03e9a9f06337e87caa..31295e991b4269bc36293a70ba10738b9668244e 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -469,6 +469,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -518,6 +518,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
final Component ichatbasecomponent = PaperAdventure.asVanilla(event.reason()); // Paper - Adventure
// CraftBukkit end
+ this.player.quitReason = org.bukkit.event.player.PlayerQuitEvent.QuitReason.KICKED; // Paper
this.connection.send(new ClientboundDisconnectPacket(ichatbasecomponent), (future) -> {
this.connection.send(new ClientboundDisconnectPacket(ichatbasecomponent), PacketSendListener.thenRun(() -> {
this.connection.disconnect(ichatbasecomponent);
});
}));
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 869fa7c3913185c3537185426e75c076fbbdb7fe..0dad9a0c98cc128d990d9bd2357895d9a07a0ac7 100644
index 32f8a030abb81aa29cab9432b72f9b522f1f6aa6..596750b47b8e780c0387b634a48282fa9383dc01 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -600,7 +600,7 @@ public abstract class PlayerList {
@@ -604,7 +604,7 @@ public abstract class PlayerList {
entityplayer.closeContainer(org.bukkit.event.inventory.InventoryCloseEvent.Reason.DISCONNECT); // Paper
}

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Expose world spawn angle
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 0dad9a0c98cc128d990d9bd2357895d9a07a0ac7..75c713f7afd8c4fd5fffada7397b102751eb6423 100644
index 596750b47b8e780c0387b634a48282fa9383dc01..e18c38132536e9d671376f7bf1a75941063a5136 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -878,7 +878,7 @@ public abstract class PlayerList {
@@ -882,7 +882,7 @@ public abstract class PlayerList {
if (location == null) {
worldserver1 = this.server.getLevel(Level.OVERWORLD);
blockposition = entityplayer1.getSpawnPoint(worldserver1);

View file

@ -5,7 +5,7 @@ Subject: [PATCH] Fix Player spawnParticle x/y/z precision loss
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index c94a7ccb3d5420dc0c8493d5cb0381a47ea8f9a0..39e0f1398e6f09ce7b0a4f1c9b677dca10a32c3f 100644
index a2a227f24855c89a1a8c45507f8ab0bd750638c4..ced1fd7ac0cbc80d5d65c95163ee271b26281773 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -2261,7 +2261,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {

View file

@ -12,7 +12,7 @@ Co-authored-by: Dylan Xaldin <Puremin0rez515@gmail.com>
Co-authored-by: pop4959 <pop4959@gmail.com>
diff --git a/src/main/java/net/minecraft/world/level/levelgen/DensityFunctions.java b/src/main/java/net/minecraft/world/level/levelgen/DensityFunctions.java
index 6825feea42667a0f14c4c730e5f1ac970c654c56..1d00c019eb976de22be6e5e1f3632ca0c00d77ea 100644
index 683474cd96d3a0cdfb3b22d0111c8d3231f01d92..f09fd5027535d2fc4d4afae010f08e7accff45b3 100644
--- a/src/main/java/net/minecraft/world/level/levelgen/DensityFunctions.java
+++ b/src/main/java/net/minecraft/world/level/levelgen/DensityFunctions.java
@@ -489,6 +489,16 @@ public final class DensityFunctions {
@ -33,31 +33,31 @@ index 6825feea42667a0f14c4c730e5f1ac970c654c56..1d00c019eb976de22be6e5e1f3632ca0
public EndIslandDensityFunction(long seed) {
RandomSource randomSource = new LegacyRandomSource(seed);
@@ -504,12 +514,26 @@ public final class DensityFunctions {
float f = 100.0F - Mth.sqrt((long) i * (long) i + (long) j * (long) j) * 8.0F; // Paper - cast ints to long to avoid integer overflow
float f = 100.0F - Mth.sqrt((long) x * (long) x + (long) z * (long) z) * 8.0F; // Paper - cast ints to long to avoid integer overflow
f = Mth.clamp(f, -100.0F, 80.0F);
+ NoiseCache cache = noiseCache.get().computeIfAbsent(simplexNoise, noiseKey -> new NoiseCache()); // Paper
for(int o = -12; o <= 12; ++o) {
for(int p = -12; p <= 12; ++p) {
long q = (long)(k + o);
long r = (long)(l + p);
- if (q * q + r * r > 4096L && simplexNoise.getValue((double)q, (double)r) < (double)-0.9F) {
- float g = (Mth.abs((float)q) * 3439.0F + Mth.abs((float)r) * 147.0F) % 13.0F + 9.0F;
+ NoiseCache cache = noiseCache.get().computeIfAbsent(sampler, noiseKey -> new NoiseCache()); // Paper
for(int m = -12; m <= 12; ++m) {
for(int n = -12; n <= 12; ++n) {
long o = (long)(i + m);
long p = (long)(j + n);
- if (o * o + p * p > 4096L && sampler.getValue((double)o, (double)p) < (double)-0.9F) {
- float g = (Mth.abs((float)o) * 3439.0F + Mth.abs((float)p) * 147.0F) % 13.0F + 9.0F;
+ // Paper start - Significantly improve end generation performance by using a noise cache
+ long key = net.minecraft.world.level.ChunkPos.asLong((int) q, (int) r);
+ long key = net.minecraft.world.level.ChunkPos.asLong((int) o, (int) p);
+ int index = (int) it.unimi.dsi.fastutil.HashCommon.mix(key) & 8191;
+ float g = Float.MIN_VALUE;
+ if (cache.keys[index] == key) {
+ g = cache.values[index];
+ } else {
+ if (q * q + r * r > 4096L && simplexNoise.getValue((double)q, (double)r) < (double)-0.9F) {
+ g = (Mth.abs((float) q) * 3439.0F + Mth.abs((float) r) * 147.0F) % 13.0F + 9.0F;
+ if (o * o + p * p > 4096L && sampler.getValue((double)o, (double)p) < (double)-0.9F) {
+ g = (Mth.abs((float) o) * 3439.0F + Mth.abs((float) p) * 147.0F) % 13.0F + 9.0F;
+ }
+ cache.keys[index] = key;
+ cache.values[index] = g;
+ }
+ if (g != Float.MIN_VALUE) {
+ // Paper end
float h = (float)(m - o * 2);
float s = (float)(n - p * 2);
float t = 100.0F - Mth.sqrt(h * h + s * s) * g;
float h = (float)(k - m * 2);
float q = (float)(l - n * 2);
float r = 100.0F - Mth.sqrt(h * h + q * q) * g;

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Climbing should not bypass cramming gamerule
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index c5cd18b02e5956fef6779b0b89d33b515bc9d13a..933b49da673c07e45f6cb5727598df492cf1a958 100644
index 532678194c2724e31a19f0e4d73d79d84ef6699c..11a5a0b3002300b882511b4ebafe96af5e230cb8 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -1837,6 +1837,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -1832,6 +1832,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
}
public boolean isPushable() {
@ -45,10 +45,10 @@ index 22f36cd3df49160f1b6668befdd05c2268edaa49..e39965c2e50bc8ee424ea07819346e06
} else if (entity.level.isClientSide && (!(entity1 instanceof Player) || !((Player) entity1).isLocalPlayer())) {
return false;
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 289073daacc2d477e965e668c6fb4041d27e3f8c..9310770edd38107211dafb94529d0edc73889e85 100644
index 09513bc7a5b78580da415d486369b9403e99c773..502d54845e1bcf538149a51be995320c6df10acb 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3332,7 +3332,7 @@ public abstract class LivingEntity extends Entity {
@@ -3335,7 +3335,7 @@ public abstract class LivingEntity extends Entity {
return;
}
// Paper end - don't run getEntities if we're not going to use its result
@ -57,7 +57,7 @@ index 289073daacc2d477e965e668c6fb4041d27e3f8c..9310770edd38107211dafb94529d0edc
if (!list.isEmpty()) {
// Paper - move up
@@ -3495,9 +3495,16 @@ public abstract class LivingEntity extends Entity {
@@ -3498,9 +3498,16 @@ public abstract class LivingEntity extends Entity {
return !this.isRemoved() && this.collides; // CraftBukkit
}

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Limit recipe packets
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 2687823d07df2c4b57cb684000621c69c1cfd10d..8254c6d3bcff79c9a718c89f8c04c2c2db035a8f 100644
index 31295e991b4269bc36293a70ba10738b9668244e..04bd217574e4395f3a42511d7e8b1938f5106cec 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -248,6 +248,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -261,6 +261,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
// CraftBukkit start - multithreaded fields
private final AtomicInteger chatSpamTickCount = new AtomicInteger();
private final java.util.concurrent.atomic.AtomicInteger tabSpamLimiter = new java.util.concurrent.atomic.AtomicInteger(); // Paper - configurable tab spam limits
@ -16,7 +16,7 @@ index 2687823d07df2c4b57cb684000621c69c1cfd10d..8254c6d3bcff79c9a718c89f8c04c2c2
// CraftBukkit end
private int dropSpamTickCount;
private double firstGoodX;
@@ -400,6 +401,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -428,6 +429,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
// CraftBukkit start
for (int spam; (spam = this.chatSpamTickCount.get()) > 0 && !this.chatSpamTickCount.compareAndSet(spam, spam - 1); ) ;
if (tabSpamLimiter.get() > 0) tabSpamLimiter.getAndDecrement(); // Paper - split to seperate variable
@ -24,7 +24,7 @@ index 2687823d07df2c4b57cb684000621c69c1cfd10d..8254c6d3bcff79c9a718c89f8c04c2c2
/* Use thread-safe field access instead
if (this.chatSpamTickCount > 0) {
--this.chatSpamTickCount;
@@ -3019,6 +3021,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -3224,6 +3226,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@Override
public void handlePlaceRecipe(ServerboundPlaceRecipePacket packet) {

View file

@ -1,28 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: JRoy <joshroy126@gmail.com>
Date: Fri, 5 Jun 2020 18:24:06 -0400
Subject: [PATCH] Add and implement PlayerRecipeBookClickEvent
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index c03867ed9a66a408900cadf81b09704e415dfca6..00a8b49b4e3b443fed22761b57ebcfa64c8d46aa 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2997,9 +2997,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());
this.player.resetLastActionTime();
if (!this.player.isSpectator() && this.player.containerMenu.containerId == packet.getContainerId() && this.player.containerMenu instanceof RecipeBookMenu) {
- this.server.getRecipeManager().byKey(packet.getRecipe()).ifPresent((irecipe) -> {
- ((RecipeBookMenu) this.player.containerMenu).handlePlacement(packet.isShiftDown(), irecipe, this.player);
- });
+ // Paper start - fire event for clicking recipes in the recipe book
+ com.destroystokyo.paper.event.player.PlayerRecipeBookClickEvent event = new com.destroystokyo.paper.event.player.PlayerRecipeBookClickEvent(
+ player.getBukkitEntity(), org.bukkit.craftbukkit.util.CraftNamespacedKey.fromMinecraft(packet.getRecipe()), packet.isShiftDown());
+ if (event.callEvent() && this.player.containerMenu instanceof RecipeBookMenu<?> recipeBookMenu) { // check if inventory changed during event handling
+ this.server.getRecipeManager().byKey(org.bukkit.craftbukkit.util.CraftNamespacedKey.toMinecraft(event.getRecipe())).ifPresent((irecipe) -> {
+ recipeBookMenu.handlePlacement(event.isMakeAll(), irecipe, this.player);
+ });
+ } // Paper end
}
}