Apply all patches

This commit is contained in:
Nassim Jahnke 2023-12-06 19:18:53 +01:00
parent a364b7e88b
commit b8f9558745
38 changed files with 219 additions and 204 deletions

View File

@ -187,43 +187,20 @@ index 68550d4497a5f10bf653482f79be77373df53f27..55f96545d6db95e3e657502a7910d96f
public String getDebugStatus() {
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index 8ef4b33c09c64c417e9b0d259550d7f78d1cec14..8c33a12ca879c46893150d6adfb8aa4d397c6b4c 100644
index bf14dbec0a08370364bf652ababadac27917b7f1..2defa2503fbb69ba92821b701dc63467a65cb4ee 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -553,52 +553,114 @@ public class ServerChunkCache extends ChunkSource {
@@ -516,18 +516,43 @@ public class ServerChunkCache extends ChunkSource {
this.lastSpawnState = spawnercreature_d;
gameprofilerfiller.popPush("filteringLoadedChunks");
- List<ServerChunkCache.ChunkAndHolder> list = Lists.newArrayListWithCapacity(l);
gameprofilerfiller.push("pollingChunks");
gameprofilerfiller.push("filteringLoadedChunks");
- List<ServerChunkCache.ChunkAndHolder> list = Lists.newArrayListWithCapacity(this.chunkMap.size());
- Iterator iterator = this.chunkMap.getChunks().iterator();
+ // Paper - optimise chunk tick iteration
+ // Paper - optimise chunk tick iteration
this.level.timings.chunkTicks.startTiming(); // Paper
- while (iterator.hasNext()) {
- ChunkHolder playerchunk = (ChunkHolder) iterator.next();
- LevelChunk chunk = playerchunk.getTickingChunk();
-
- if (chunk != null) {
- list.add(new ServerChunkCache.ChunkAndHolder(chunk, playerchunk));
- }
- }
+ // Paper - optimise chunk tick iteration
gameprofilerfiller.popPush("spawnAndTick");
boolean flag2 = this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING) && !this.level.players().isEmpty(); // CraftBukkit
- Collections.shuffle(list);
- // Paper start - call player naturally spawn event
- int chunkRange = level.spigotConfig.mobSpawnRange;
- chunkRange = (chunkRange > level.spigotConfig.viewDistance) ? (byte) level.spigotConfig.viewDistance : chunkRange;
- chunkRange = Math.min(chunkRange, 8);
- for (ServerPlayer entityPlayer : this.level.players()) {
- entityPlayer.playerNaturallySpawnedEvent = new com.destroystokyo.paper.event.entity.PlayerNaturallySpawnCreaturesEvent(entityPlayer.getBukkitEntity(), (byte) chunkRange);
- entityPlayer.playerNaturallySpawnedEvent.callEvent();
- };
- // Paper end
- Iterator iterator1 = list.iterator();
+ // Paper start - optimise chunk tick iteration
+ ChunkMap playerChunkMap = this.chunkMap;
+ for (ServerPlayer player : this.level.players) {
@ -235,7 +212,9 @@ index 8ef4b33c09c64c417e9b0d259550d7f78d1cec14..8c33a12ca879c46893150d6adfb8aa4d
+ }
+
+ int viewDistance = io.papermc.paper.chunk.system.ChunkSystem.getTickViewDistance(player);
+
- if (chunk != null) {
- list.add(new ServerChunkCache.ChunkAndHolder(chunk, playerchunk));
+ // copied and modified from isOutisdeRange
+ int chunkRange = (int)level.spigotConfig.mobSpawnRange;
+ chunkRange = (chunkRange > viewDistance) ? viewDistance : chunkRange;
@ -248,7 +227,7 @@ index 8ef4b33c09c64c417e9b0d259550d7f78d1cec14..8c33a12ca879c46893150d6adfb8aa4d
+ player.playerNaturallySpawnedEvent = null;
+ player.lastEntitySpawnRadiusSquared = -1.0;
+ continue;
+ }
}
+
+ int range = Math.min(event.getSpawnRadius(), DistanceManager.MOB_SPAWN_RANGE); // limit to max spawn range
+ int chunkX = io.papermc.paper.util.CoordinateUtils.getChunkCoordinate(player.getX());
@ -257,81 +236,138 @@ index 8ef4b33c09c64c417e9b0d259550d7f78d1cec14..8c33a12ca879c46893150d6adfb8aa4d
+ playerChunkMap.playerMobSpawnMap.addOrUpdate(player, chunkX, chunkZ, range);
+ player.lastEntitySpawnRadiusSquared = (double)((range << 4) * (range << 4)); // used in anyPlayerCloseEnoughForSpawning
+ player.playerNaturallySpawnedEvent = event;
+ }
}
+ // Paper end - optimise chunk tick iteration
int chunksTicked = 0; // Paper
+ // Paper start - optimise chunk tick iteration
+ io.papermc.paper.util.player.NearbyPlayers nearbyPlayers = this.chunkMap.getNearbyPlayers(); // Paper - optimise chunk tick iteration
+ Iterator<LevelChunk> iterator1;
+ if (this.level.paperConfig().entities.spawning.perPlayerMobSpawns) {
+ iterator1 = this.tickingChunks.iterator();
+ } else {
+ iterator1 = this.tickingChunks.unsafeIterator();
+ List<LevelChunk> shuffled = Lists.newArrayListWithCapacity(this.tickingChunks.size());
+ while (iterator1.hasNext()) {
+ shuffled.add(iterator1.next());
+ }
+ Collections.shuffle(shuffled);
+ iterator1 = shuffled.iterator();
+ }
+ try {
+ // Paper end - optimise chunk tick iteration
while (iterator1.hasNext()) {
- ServerChunkCache.ChunkAndHolder chunkproviderserver_a = (ServerChunkCache.ChunkAndHolder) iterator1.next();
- LevelChunk chunk1 = chunkproviderserver_a.chunk;
+ LevelChunk chunk1 = iterator1.next(); // Paper - optimise chunk tick iteration
ChunkPos chunkcoordintpair = chunk1.getPos();
if (this.level.getServer().tickRateManager().runsNormally()) {
gameprofilerfiller.popPush("naturalSpawnCount");
@@ -562,33 +587,95 @@ public class ServerChunkCache extends ChunkSource {
gameprofilerfiller.popPush("spawnAndTick");
boolean flag = this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING) && !this.level.players().isEmpty(); // CraftBukkit
- if (this.level.isNaturalSpawningAllowed(chunkcoordintpair) && this.chunkMap.anyPlayerCloseEnoughForSpawning(chunkcoordintpair)) {
- Util.shuffle(list, this.level.random);
- // Paper start - call player naturally spawn event
- int chunkRange = level.spigotConfig.mobSpawnRange;
- chunkRange = (chunkRange > level.spigotConfig.viewDistance) ? (byte) level.spigotConfig.viewDistance : chunkRange;
- chunkRange = Math.min(chunkRange, 8);
- for (ServerPlayer entityPlayer : this.level.players()) {
- entityPlayer.playerNaturallySpawnedEvent = new com.destroystokyo.paper.event.entity.PlayerNaturallySpawnCreaturesEvent(entityPlayer.getBukkitEntity(), (byte) chunkRange);
- entityPlayer.playerNaturallySpawnedEvent.callEvent();
+ // Paper start - optimise chunk tick iteration
+ com.destroystokyo.paper.util.maplist.ReferenceList<ServerPlayer> playersNearby
+ = nearbyPlayers.getPlayers(chunkcoordintpair, io.papermc.paper.util.player.NearbyPlayers.NearbyMapType.SPAWN_RANGE);
+ if (playersNearby == null) {
+ continue;
+ }
+ Object[] rawData = playersNearby.getRawData();
+ boolean spawn = false;
+ boolean tick = false;
+ for (int itr = 0, len = playersNearby.size(); itr < len; ++itr) {
+ ServerPlayer player = (ServerPlayer)rawData[itr];
+ if (player.isSpectator()) {
+ for (ServerPlayer player : this.level.players) {
+ if (!player.affectsSpawning || player.isSpectator()) {
+ playerChunkMap.playerMobSpawnMap.remove(player);
+ player.playerNaturallySpawnedEvent = null;
+ player.lastEntitySpawnRadiusSquared = -1.0;
+ continue;
+ }
+
+ double distance = ChunkMap.euclideanDistanceSquared(chunkcoordintpair, player);
+ spawn |= player.lastEntitySpawnRadiusSquared >= distance;
+ tick |= ((double)io.papermc.paper.util.player.NearbyPlayers.SPAWN_RANGE_VIEW_DISTANCE_BLOCKS) * ((double)io.papermc.paper.util.player.NearbyPlayers.SPAWN_RANGE_VIEW_DISTANCE_BLOCKS) >= distance;
+ if (spawn & tick) {
+ break;
+ int viewDistance = io.papermc.paper.chunk.system.ChunkSystem.getTickViewDistance(player);
+
+ // copied and modified from isOutisdeRange
+ int chunkRange = (int)level.spigotConfig.mobSpawnRange;
+ chunkRange = (chunkRange > viewDistance) ? viewDistance : chunkRange;
+ chunkRange = (chunkRange > DistanceManager.MOB_SPAWN_RANGE) ? DistanceManager.MOB_SPAWN_RANGE : chunkRange;
+
+ com.destroystokyo.paper.event.entity.PlayerNaturallySpawnCreaturesEvent event = new com.destroystokyo.paper.event.entity.PlayerNaturallySpawnCreaturesEvent(player.getBukkitEntity(), (byte)chunkRange);
+ event.callEvent();
+ if (event.isCancelled() || event.getSpawnRadius() < 0) {
+ playerChunkMap.playerMobSpawnMap.remove(player);
+ player.playerNaturallySpawnedEvent = null;
+ player.lastEntitySpawnRadiusSquared = -1.0;
+ continue;
+ }
+
+ int range = Math.min(event.getSpawnRadius(), DistanceManager.MOB_SPAWN_RANGE); // limit to max spawn range
+ int chunkX = io.papermc.paper.util.CoordinateUtils.getChunkCoordinate(player.getX());
+ int chunkZ = io.papermc.paper.util.CoordinateUtils.getChunkCoordinate(player.getZ());
+
+ playerChunkMap.playerMobSpawnMap.addOrUpdate(player, chunkX, chunkZ, range);
+ player.lastEntitySpawnRadiusSquared = (double)((range << 4) * (range << 4)); // used in anyPlayerCloseEnoughForSpawning
+ player.playerNaturallySpawnedEvent = event;
}
- // Paper end
+ // Paper end - optimise chunk tick iteration
int l = this.level.getGameRules().getInt(GameRules.RULE_RANDOMTICKING);
boolean flag1 = this.level.ticksPerSpawnCategory.getLong(org.bukkit.entity.SpawnCategory.ANIMAL) != 0L && this.level.getLevelData().getGameTime() % this.level.ticksPerSpawnCategory.getLong(org.bukkit.entity.SpawnCategory.ANIMAL) == 0L; // CraftBukkit
- Iterator iterator1 = list.iterator();
int chunksTicked = 0; // Paper
- while (iterator1.hasNext()) {
- ServerChunkCache.ChunkAndHolder chunkproviderserver_a = (ServerChunkCache.ChunkAndHolder) iterator1.next();
- LevelChunk chunk1 = chunkproviderserver_a.chunk;
+ // Paper start - optimise chunk tick iteration
+ io.papermc.paper.util.player.NearbyPlayers nearbyPlayers = this.chunkMap.getNearbyPlayers(); // Paper - optimise chunk tick iteration
+ Iterator<LevelChunk> chunkIterator;
+ if (this.level.paperConfig().entities.spawning.perPlayerMobSpawns) {
+ chunkIterator = this.tickingChunks.iterator();
+ } else {
+ chunkIterator = this.tickingChunks.unsafeIterator();
+ List<LevelChunk> shuffled = Lists.newArrayListWithCapacity(this.tickingChunks.size());
+ while (chunkIterator.hasNext()) {
+ shuffled.add(chunkIterator.next());
+ }
+ Util.shuffle(shuffled, this.level.random);
+ chunkIterator = shuffled.iterator();
+ }
+ try {
+ // Paper end - optimise chunk tick iteration
+ while (chunkIterator.hasNext()) {
+ LevelChunk chunk1 = chunkIterator.next(); // Paper - optimise chunk tick iteration
ChunkPos chunkcoordintpair = chunk1.getPos();
- if (this.level.isNaturalSpawningAllowed(chunkcoordintpair) && this.chunkMap.anyPlayerCloseEnoughForSpawning(chunkcoordintpair)) {
+ // Paper start - optimise chunk tick iteration
+ com.destroystokyo.paper.util.maplist.ReferenceList<ServerPlayer> playersNearby
+ = nearbyPlayers.getPlayers(chunkcoordintpair, io.papermc.paper.util.player.NearbyPlayers.NearbyMapType.SPAWN_RANGE);
+ if (playersNearby == null) {
+ continue;
+ }
+
+ Object[] rawData = playersNearby.getRawData();
+ boolean spawn = false;
+ boolean tick = false;
+ for (int itr = 0, len = playersNearby.size(); itr < len; ++itr) {
+ ServerPlayer player = (ServerPlayer)rawData[itr];
+ if (player.isSpectator()) {
+ continue;
+ }
+
+ double distance = ChunkMap.euclideanDistanceSquared(chunkcoordintpair, player);
+ spawn |= player.lastEntitySpawnRadiusSquared >= distance;
+ tick |= ((double)io.papermc.paper.util.player.NearbyPlayers.SPAWN_RANGE_VIEW_DISTANCE_BLOCKS) * ((double)io.papermc.paper.util.player.NearbyPlayers.SPAWN_RANGE_VIEW_DISTANCE_BLOCKS) >= distance;
+ if (spawn & tick) {
+ break;
+ }
+ }
+ if (tick && chunk1.chunkStatus.isOrAfter(net.minecraft.server.level.FullChunkStatus.ENTITY_TICKING)) {
+ // Paper end - optimise chunk tick iteration
chunk1.incrementInhabitedTime(j);
- if (flag && (this.spawnEnemies || this.spawnFriendlies) && this.level.getWorldBorder().isWithinBounds(chunkcoordintpair) && this.chunkMap.anyPlayerCloseEnoughForSpawning(chunkcoordintpair, true)) { // Spigot
+ if (spawn && flag && (this.spawnEnemies || this.spawnFriendlies) && this.level.getWorldBorder().isWithinBounds(chunkcoordintpair)) { // Spigot // Paper - optimise chunk tick iteration
NaturalSpawner.spawnForChunk(this.level, chunk1, spawnercreature_d, this.spawnFriendlies, this.spawnEnemies, flag1);
}
- if (this.level.shouldTickBlocksAt(chunkcoordintpair.toLong())) {
+ if (true || this.level.shouldTickBlocksAt(chunkcoordintpair.toLong())) { // Paper - optimise chunk tick iteration
this.level.timings.doTickTiles.startTiming(); // Spigot
this.level.tickChunk(chunk1, l);
if ((chunksTicked++ & 1) == 0) net.minecraft.server.MinecraftServer.getServer().executeMidTickTasks(); // Paper
@@ -596,6 +683,13 @@ public class ServerChunkCache extends ChunkSource {
}
}
}
+ // Paper start - optimise chunk tick iteration
+ } finally {
+ if (chunkIterator instanceof io.papermc.paper.util.maplist.IteratorSafeOrderedReferenceSet.Iterator safeIterator) {
+ safeIterator.finishedIterating();
+ }
+ }
+ // Paper end - optimise chunk tick iteration
+ if (tick && chunk1.chunkStatus.isOrAfter(net.minecraft.server.level.FullChunkStatus.ENTITY_TICKING)) { // Paper - optimise chunk tick iteration
chunk1.incrementInhabitedTime(j);
- if (flag2 && (this.spawnEnemies || this.spawnFriendlies) && this.level.getWorldBorder().isWithinBounds(chunkcoordintpair) && this.chunkMap.anyPlayerCloseEnoughForSpawning(chunkcoordintpair, true)) { // Spigot
+ if (spawn && flag2 && (this.spawnEnemies || this.spawnFriendlies) && this.level.getWorldBorder().isWithinBounds(chunkcoordintpair)) { // Spigot // Paper - optimise chunk tick iteration
NaturalSpawner.spawnForChunk(this.level, chunk1, spawnercreature_d, this.spawnFriendlies, this.spawnEnemies, flag1);
}
- if (this.level.shouldTickBlocksAt(chunkcoordintpair.toLong())) {
+ if (true || this.level.shouldTickBlocksAt(chunkcoordintpair.toLong())) { // Paper - optimise chunk tick iteration
this.level.tickChunk(chunk1, k);
if ((chunksTicked++ & 1) == 0) net.minecraft.server.MinecraftServer.getServer().executeMidTickTasks(); // Paper
}
}
}
+ // Paper start - optimise chunk tick iteration
+ } finally {
+ if (iterator1 instanceof io.papermc.paper.util.maplist.IteratorSafeOrderedReferenceSet.Iterator safeIterator) {
+ safeIterator.finishedIterating();
+ }
+ }
+ // Paper end - optimise chunk tick iteration
this.level.timings.chunkTicks.stopTiming(); // Paper
gameprofilerfiller.popPush("customSpawners");
if (flag2) {
@@ -608,11 +670,23 @@ public class ServerChunkCache extends ChunkSource {
gameprofilerfiller.popPush("customSpawners");
if (flag) {
@@ -606,11 +700,23 @@ public class ServerChunkCache extends ChunkSource {
}
gameprofilerfiller.popPush("broadcast");
@ -357,12 +393,12 @@ index 8ef4b33c09c64c417e9b0d259550d7f78d1cec14..8c33a12ca879c46893150d6adfb8aa4d
+ // Paper - optimise chunk tick iteration
gameprofilerfiller.pop();
gameprofilerfiller.pop();
this.chunkMap.tick();
}
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 67f03dd59ebcf74fae476b79a367778a9e942ed3..08980763020a13ab49dc7d637625a4fba56da8c9 100644
index 695a103f2517f3e888e86e76f3615bd69b00a175..5fe743567f2e9cf0f9442ddd87453c51af8060e6 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -318,6 +318,9 @@ public class ServerPlayer extends Player {
@@ -325,6 +325,9 @@ public class ServerPlayer extends Player {
});
}
// Paper end - replace player chunk loader

View File

@ -8,10 +8,10 @@ Areas affected by lag comepnsation:
- Eating food items
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 1bac9f7894321b5710f5475f6598ec9f3ccd94d3..8f31413c939cc2b0454ad3d9a1b618dbae449d00 100644
index e7bcb076788cefa94b70e455bef1f9653cec6415..98153bf0359db8d5a94fa6f75a05373e4e7cc4ae 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -305,6 +305,9 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -311,6 +311,9 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
public volatile Thread shutdownThread; // Paper
public volatile boolean abnormalExit = false; // Paper
public boolean isIteratingOverLevels = false; // Paper
@ -21,7 +21,7 @@ index 1bac9f7894321b5710f5475f6598ec9f3ccd94d3..8f31413c939cc2b0454ad3d9a1b618db
public static <S extends MinecraftServer> S spin(Function<Thread, S> serverFactory) {
AtomicReference<S> atomicreference = new AtomicReference();
@@ -1522,6 +1525,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1691,6 +1694,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
Iterator iterator = this.getAllLevels().iterator(); // Paper - move down
while (iterator.hasNext()) {
ServerLevel worldserver = (ServerLevel) iterator.next();
@ -30,10 +30,10 @@ index 1bac9f7894321b5710f5475f6598ec9f3ccd94d3..8f31413c939cc2b0454ad3d9a1b618db
net.minecraft.world.level.block.entity.HopperBlockEntity.skipHopperEvents = worldserver.paperConfig().hopper.disableMoveEvent || org.bukkit.event.inventory.InventoryMoveItemEvent.getHandlerList().getRegisteredListeners().length == 0; // Paper
worldserver.hasEntityMoveEvent = io.papermc.paper.event.entity.EntityMoveEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index deebfe66d9c0f799043c3458a0108dc18bfdf15f..4296e0fec900ac0be4f1ebbc539e60f28f96a9cc 100644
index b0576234320042b0c9c1f326671b76fa3a2a6915..072e7b75ade6db8f48437d096639faf8f924ad03 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -564,6 +564,17 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -566,6 +566,17 @@ public class ServerLevel extends Level implements WorldGenLevel {
return player != null && player.level() == this ? player : null;
}
// Paper end
@ -52,7 +52,7 @@ index deebfe66d9c0f799043c3458a0108dc18bfdf15f..4296e0fec900ac0be4f1ebbc539e60f2
// Add env and gen to constructor, IWorldDataServer -> WorldDataServer
public ServerLevel(MinecraftServer minecraftserver, Executor executor, LevelStorageSource.LevelStorageAccess convertable_conversionsession, PrimaryLevelData iworlddataserver, ResourceKey<Level> resourcekey, LevelStem worlddimension, ChunkProgressListener worldloadlistener, boolean flag, long i, List<CustomSpawner> list, boolean flag1, @Nullable RandomSequences randomsequences, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider) {
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
index 25f7adf194a165fa28488f80b87382c08111f896..346912d854a176a410920e69d063919f5d34626a 100644
index 899439e0af639e8d9124522b3cb6a10601b17fe2..b214c934b9a537f52cef142c519c2b9b55a89ae3 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
@@ -124,7 +124,7 @@ public class ServerPlayerGameMode {
@ -65,10 +65,10 @@ index 25f7adf194a165fa28488f80b87382c08111f896..346912d854a176a410920e69d063919f
if (this.hasDelayedDestroy) {
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 6d4d46163ffcffa98f400c2656703eb5c4818f40..675d695989cef5d8fc2e85673efbb57ec1bb38bd 100644
index bed0a01be1703aad8fbfa549d5799e3f84759f32..e1eab03233149fd0714785955d21dc80dc664d96 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3816,6 +3816,10 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -3818,6 +3818,10 @@ public abstract class LivingEntity extends Entity implements Attackable {
this.getEntityData().resendPossiblyDesyncedDataValues(java.util.List.of(DATA_LIVING_ENTITY_FLAGS), serverPlayer);
}
// Paper end
@ -79,7 +79,7 @@ index 6d4d46163ffcffa98f400c2656703eb5c4818f40..675d695989cef5d8fc2e85673efbb57e
private void updatingUsingItem() {
if (this.isUsingItem()) {
if (ItemStack.isSameItem(this.getItemInHand(this.getUsedItemHand()), this.useItem)) {
@@ -3834,7 +3838,12 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -3836,7 +3840,12 @@ public abstract class LivingEntity extends Entity implements Attackable {
this.triggerItemUseEffects(stack, 5);
}
@ -93,7 +93,7 @@ index 6d4d46163ffcffa98f400c2656703eb5c4818f40..675d695989cef5d8fc2e85673efbb57e
this.completeUsingItem();
}
@@ -3882,7 +3891,10 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -3884,7 +3893,10 @@ public abstract class LivingEntity extends Entity implements Attackable {
if (!itemstack.isEmpty() && !this.isUsingItem() || forceUpdate) { // Paper use override flag
this.useItem = itemstack;
@ -105,7 +105,7 @@ index 6d4d46163ffcffa98f400c2656703eb5c4818f40..675d695989cef5d8fc2e85673efbb57e
if (!this.level().isClientSide) {
this.setLivingEntityFlag(1, true);
this.setLivingEntityFlag(2, hand == InteractionHand.OFF_HAND);
@@ -3907,7 +3919,10 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -3909,7 +3921,10 @@ public abstract class LivingEntity extends Entity implements Attackable {
}
} else if (!this.isUsingItem() && !this.useItem.isEmpty()) {
this.useItem = ItemStack.EMPTY;
@ -117,7 +117,7 @@ index 6d4d46163ffcffa98f400c2656703eb5c4818f40..675d695989cef5d8fc2e85673efbb57e
}
}
@@ -4042,7 +4057,10 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -4044,7 +4059,10 @@ public abstract class LivingEntity extends Entity implements Attackable {
}
this.useItem = ItemStack.EMPTY;

View File

@ -14,10 +14,10 @@ field by calling any method on the class, and for convenience
we use values().
diff --git a/src/main/java/net/minecraft/world/level/chunk/UpgradeData.java b/src/main/java/net/minecraft/world/level/chunk/UpgradeData.java
index 62709ed72faf823e18ad77477eb2f5dbf9c98660..27fcb816f151527029fb1fd02d8247863ccc3d32 100644
index 0f94af3502ef517c33d04841a80ea2ace077f0af..f9c1012216928b16feb14f0bf78fb328a443a7ee 100644
--- a/src/main/java/net/minecraft/world/level/chunk/UpgradeData.java
+++ b/src/main/java/net/minecraft/world/level/chunk/UpgradeData.java
@@ -139,6 +139,7 @@ public class UpgradeData {
@@ -138,6 +138,7 @@ public class UpgradeData {
Fluid fluid = tick.type() == Fluids.EMPTY ? level.getFluidState(tick.pos()).getType() : tick.type();
level.scheduleTick(tick.pos(), fluid, tick.delay(), tick.priority());
});

View File

@ -9,7 +9,7 @@ scoreboards. If a player's scoreboard has a displayed objective for the
still had a 'gold' team, it would still be displayed
diff --git a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboardManager.java b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboardManager.java
index 24c5e6e3dd41e72d22819964bc8e77f0ebc2d089..891f850ea99dac1433f3e395e26be14c8abf2bfb 100644
index cad42a0f3c016bf65181e50d139ae4e2fb9158a5..b3e1adeb932da9b3bed16acd94e2f16da48a7c72 100644
--- a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboardManager.java
+++ b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboardManager.java
@@ -87,8 +87,8 @@ public final class CraftScoreboardManager implements ScoreboardManager {

View File

@ -8,10 +8,10 @@ we can instead use the nearby player tracking system to reduce
the number of tests per search.
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 4296e0fec900ac0be4f1ebbc539e60f28f96a9cc..e33c8a4d8027329a71777e9734c79068b48672f4 100644
index 072e7b75ade6db8f48437d096639faf8f924ad03..d5543fe1c1f25798e7dea774d6e20132901dc05e 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -575,6 +575,115 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -577,6 +577,115 @@ public class ServerLevel extends Level implements WorldGenLevel {
this.lagCompensationTick = (System.nanoTime() - net.minecraft.server.MinecraftServer.SERVER_INIT) / (java.util.concurrent.TimeUnit.MILLISECONDS.toNanos(50L));
}
// Paper end - lag compensation

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Fix missing map initialize event call
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index e33c8a4d8027329a71777e9734c79068b48672f4..c88d5b9125f6ee43bf2be60fd1745d836f271b78 100644
index d5543fe1c1f25798e7dea774d6e20132901dc05e..eba414c592332b67143268ef56b912b35f2a2c14 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -2100,7 +2100,23 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -2129,7 +2129,23 @@ public class ServerLevel extends Level implements WorldGenLevel {
@Nullable
@Override
public MapItemSavedData getMapData(String id) {
@ -34,10 +34,10 @@ index e33c8a4d8027329a71777e9734c79068b48672f4..c88d5b9125f6ee43bf2be60fd1745d83
@Override
diff --git a/src/main/java/net/minecraft/world/level/storage/DimensionDataStorage.java b/src/main/java/net/minecraft/world/level/storage/DimensionDataStorage.java
index bd30ebc66484a6c4770cf697a2e9b0a123681b1c..f921f55e815a4da01828e025881a7a03591c3978 100644
index 1aea6a257ffceb511368a6e8dee5051e120894ad..269c81cd60d98a94721c77d700af223bda15a61a 100644
--- a/src/main/java/net/minecraft/world/level/storage/DimensionDataStorage.java
+++ b/src/main/java/net/minecraft/world/level/storage/DimensionDataStorage.java
@@ -57,7 +57,7 @@ public class DimensionDataStorage {
@@ -58,7 +58,7 @@ public class DimensionDataStorage {
}
@Nullable

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Use correct variable for initializing CraftLootTable
diff --git a/src/main/java/net/minecraft/world/level/storage/loot/LootDataManager.java b/src/main/java/net/minecraft/world/level/storage/loot/LootDataManager.java
index ac4de8a082b495d945723d6062d9eacaa9add2bb..08f5239d5eea9133340ec9e1a3a7d8d5e792ced0 100644
index 973b786368cf628815f099eefe968338c97c52ed..3b740b1fcada96a6fac18a22ea77d1d3ad2a9cce 100644
--- a/src/main/java/net/minecraft/world/level/storage/loot/LootDataManager.java
+++ b/src/main/java/net/minecraft/world/level/storage/loot/LootDataManager.java
@@ -101,7 +101,7 @@ public class LootDataManager implements PreparableReloadListener, LootDataResolv
@@ -103,7 +103,7 @@ public class LootDataManager implements PreparableReloadListener, LootDataResolv
});
// CraftBukkit start
map1.forEach((key, lootTable) -> {

View File

@ -5,12 +5,12 @@ Subject: [PATCH] Fix UnsafeValues#loadAdvancement
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index 4d66a9f24d718de4c6862b20ccb7240332523db4..548c77592a3520e8053483644eba805079a14f1a 100644
index c0e36388652e89059c91117722945645119a5738..9fe7038343320e3cb5fd5fcb661995726089bb5d 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -319,7 +319,27 @@ public final class CraftMagicNumbers implements UnsafeValues {
JsonObject jsonobject = GsonHelper.convertToJsonObject(jsonelement, "advancement");
net.minecraft.advancements.Advancement nms = net.minecraft.advancements.Advancement.fromJson(jsonobject, new DeserializationContext(minecraftkey, MinecraftServer.getServer().getLootData()));
@@ -316,7 +316,27 @@ public final class CraftMagicNumbers implements UnsafeValues {
JsonElement jsonelement = ServerAdvancementManager.GSON.fromJson(advancement, JsonElement.class);
net.minecraft.advancements.Advancement nms = Util.getOrThrow(net.minecraft.advancements.Advancement.CODEC.parse(JsonOps.INSTANCE, jsonelement), JsonParseException::new);
if (nms != null) {
- MinecraftServer.getServer().getAdvancements().advancements.put(minecraftkey, new AdvancementHolder(minecraftkey, nms));
+ // Paper start - Fix throw UnsupportedOperationException

View File

@ -6,10 +6,10 @@ Subject: [PATCH] Add player idle duration API
Implements API for getting and resetting a player's idle duration.
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index e593e0bc9d207325a9e9d38296b29230a353077e..64c3e4b0ce2cc111eedc2aa1ecf2c6c5d05f1e9d 100644
index 7b81dd72bc107648f2c0df19adeaa8ca7de7b204..44646111beaea041d3494f9b5557ed8b838a2413 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -3286,6 +3286,18 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -3301,6 +3301,18 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
}
// Paper end

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Allow null itemstack for Player#sendEquipmentChange
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 64c3e4b0ce2cc111eedc2aa1ecf2c6c5d05f1e9d..3a792ddc31e76038b84e8f87088c4cd94c349138 100644
index 44646111beaea041d3494f9b5557ed8b838a2413..985e33b84cae3f074751e512b35ea8a1cc165e09 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -1078,7 +1078,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -1085,7 +1085,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@Override
public void sendEquipmentChange(LivingEntity entity, EquipmentSlot slot, ItemStack item) {

View File

@ -6,10 +6,10 @@ Subject: [PATCH] Add API to get the collision shape of a block before it's
diff --git a/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java b/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java
index 0bf863f597f3657a0f158756a2a91bda7eb453f6..2a9dba6d4a94f1488ef9d86ee4f60b7fd06419fb 100644
index 28a798e497c2c12794169068e69b56dd954978f3..7b4086240fad7eb3ef8eed9eb94ffeb79308e3da 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java
@@ -669,6 +669,20 @@ public class CraftBlockData implements BlockData {
@@ -676,6 +676,20 @@ public class CraftBlockData implements BlockData {
return this.state.isFaceSturdy(EmptyBlockGetter.INSTANCE, BlockPos.ZERO, CraftBlock.blockFaceToNotch(face), CraftBlockSupport.toNMS(support));
}

View File

@ -47,10 +47,10 @@ index 799837c172a5f7856c78e6fe2595c575f3058a5e..7205865bbe0f83fb35678bddc0977f92
Vec3 vec3d = raytrace1.getFrom().subtract(raytrace1.getTo());
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 44d6a7373fe0c7b6afff31e149174367e9873bf9..30528f527de27c1cc21d1d20a6ed7d54bd93cb5a 100644
index abb14719496971a780650782bdce17c638c7b270..95c0c00075e12f4faa1a86a4161fd22dfc69fdd8 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -1120,9 +1120,15 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@@ -1126,9 +1126,15 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@Override
public RayTraceResult rayTraceEntities(Location start, Vector direction, double maxDistance, double raySize, Predicate<? super Entity> filter) {
@ -68,7 +68,7 @@ index 44d6a7373fe0c7b6afff31e149174367e9873bf9..30528f527de27c1cc21d1d20a6ed7d54
Preconditions.checkArgument(direction != null, "Vector direction cannot be null");
direction.checkFinite();
@@ -1172,9 +1178,16 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@@ -1178,9 +1184,16 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@Override
public RayTraceResult rayTraceBlocks(Location start, Vector direction, double maxDistance, FluidCollisionMode fluidCollisionMode, boolean ignorePassableBlocks) {
@ -87,15 +87,15 @@ index 44d6a7373fe0c7b6afff31e149174367e9873bf9..30528f527de27c1cc21d1d20a6ed7d54
Preconditions.checkArgument(direction != null, "Vector direction cannot be null");
direction.checkFinite();
@@ -1187,16 +1200,23 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@@ -1193,16 +1206,23 @@ public class CraftWorld extends CraftRegionAccessor implements World {
}
Vector dir = direction.clone().normalize().multiply(maxDistance);
- Vec3 startPos = CraftLocation.toVec3D(start);
+ Vec3 startPos = io.papermc.paper.util.MCUtil.toVec3(start); // Paper
Vec3 endPos = startPos.add(dir.getX(), dir.getY(), dir.getZ());
- HitResult nmsHitResult = this.getHandle().clip(new ClipContext(startPos, endPos, ignorePassableBlocks ? ClipContext.Block.COLLIDER : ClipContext.Block.OUTLINE, CraftFluidCollisionMode.toNMS(fluidCollisionMode), null));
+ HitResult nmsHitResult = this.getHandle().clip(new ClipContext(startPos, endPos, ignorePassableBlocks ? ClipContext.Block.COLLIDER : ClipContext.Block.OUTLINE, CraftFluidCollisionMode.toNMS(fluidCollisionMode), null), canCollide); // Paper - use method with canCollide predicate
- HitResult nmsHitResult = this.getHandle().clip(new ClipContext(startPos, endPos, ignorePassableBlocks ? ClipContext.Block.COLLIDER : ClipContext.Block.OUTLINE, CraftFluidCollisionMode.toNMS(fluidCollisionMode), CollisionContext.empty()));
+ HitResult nmsHitResult = this.getHandle().clip(new ClipContext(startPos, endPos, ignorePassableBlocks ? ClipContext.Block.COLLIDER : ClipContext.Block.OUTLINE, CraftFluidCollisionMode.toNMS(fluidCollisionMode), CollisionContext.empty()), canCollide); // Paper - use method with canCollide predicate
return CraftRayTraceResult.fromNMS(this, nmsHitResult);
}

View File

@ -6,10 +6,10 @@ Subject: [PATCH] Broadcast take item packets with collector as source
This fixes players (which can't view the collector) seeing item pickups with themselves as the target.
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 675d695989cef5d8fc2e85673efbb57ec1bb38bd..a76eb3d051db0229ed088b71c92ff3f131449007 100644
index e1eab03233149fd0714785955d21dc80dc664d96..1580c3a13a7fd84e709e184ad57e7d70d143abd2 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3701,7 +3701,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -3703,7 +3703,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
public void take(Entity item, int count) {
if (!item.isRemoved() && !this.level().isClientSide && (item instanceof ItemEntity || item instanceof AbstractArrow || item instanceof ExperienceOrb)) {

View File

@ -5,19 +5,18 @@ Subject: [PATCH] fix secure profile with proxy online mode
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index 4454944ba851216c8c88fe76ee910a2da52a2292..1c9742ad81f04052d2c3bc18c7636f45b2fc5160 100644
index db363bca264e37c29fda58291246aba0d3759de0..58536aabf607015939a1326f80207c0a06eed8ff 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -637,8 +637,11 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
@Override
@@ -638,7 +638,11 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
public boolean enforceSecureProfile() {
DedicatedServerProperties dedicatedserverproperties = this.getProperties();
-
- return dedicatedserverproperties.enforceSecureProfile && dedicatedserverproperties.onlineMode && this.services.profileKeySignatureValidator() != null;
- return dedicatedserverproperties.enforceSecureProfile && dedicatedserverproperties.onlineMode && this.services.canValidateProfileKeys();
+ // Paper start - fix secure profile with proxy online mode
+ return dedicatedserverproperties.enforceSecureProfile
+ && io.papermc.paper.configuration.GlobalConfiguration.get().proxies.isProxyOnlineMode()
+ && this.services.profileKeySignatureValidator() != null;
+ && this.services.canValidateProfileKeys();
+ // Paper end
}

View File

@ -6,7 +6,7 @@ Subject: [PATCH] Fix strikeLightningEffect powers lightning rods and clears
diff --git a/src/main/java/net/minecraft/world/entity/LightningBolt.java b/src/main/java/net/minecraft/world/entity/LightningBolt.java
index 471275c5362b61ce8b5b9dd5c85b3e93cabd3f76..841ee02f6ad19d737534a2bf9f52d0d09785660f 100644
index 255fb5e922c63130708e4bcab208b4db52a58387..1e76230c078ef07418345b0bc50c574cf63c9094 100644
--- a/src/main/java/net/minecraft/world/entity/LightningBolt.java
+++ b/src/main/java/net/minecraft/world/entity/LightningBolt.java
@@ -45,7 +45,7 @@ public class LightningBolt extends Entity {
@ -46,10 +46,10 @@ index 471275c5362b61ce8b5b9dd5c85b3e93cabd3f76..841ee02f6ad19d737534a2bf9f52d0d0
BlockState iblockdata = BaseFireBlock.getState(this.level(), blockposition);
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 30528f527de27c1cc21d1d20a6ed7d54bd93cb5a..f19f2199cac5a7eb275f40cc23472416a40ec0da 100644
index 95c0c00075e12f4faa1a86a4161fd22dfc69fdd8..5de25f3f6944055e9d6c3cae29ad0885a95d5f38 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -773,7 +773,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@@ -774,7 +774,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
LightningBolt lightning = EntityType.LIGHTNING_BOLT.create(this.world);
lightning.moveTo(loc.getX(), loc.getY(), loc.getZ());
@ -58,7 +58,7 @@ index 30528f527de27c1cc21d1d20a6ed7d54bd93cb5a..f19f2199cac5a7eb275f40cc23472416
this.world.strikeLightning(lightning, LightningStrikeEvent.Cause.CUSTOM);
return (LightningStrike) lightning.getBukkitEntity();
}
@@ -2430,7 +2430,6 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@@ -2436,7 +2436,6 @@ public class CraftWorld extends CraftRegionAccessor implements World {
{
LightningBolt lightning = EntityType.LIGHTNING_BOLT.create( CraftWorld.this.world );
lightning.moveTo( loc.getX(), loc.getY(), loc.getZ() );
@ -66,7 +66,7 @@ index 30528f527de27c1cc21d1d20a6ed7d54bd93cb5a..f19f2199cac5a7eb275f40cc23472416
CraftWorld.this.world.strikeLightning( lightning, LightningStrikeEvent.Cause.CUSTOM );
return (LightningStrike) lightning.getBukkitEntity();
}
@@ -2440,8 +2439,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@@ -2446,8 +2445,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
{
LightningBolt lightning = EntityType.LIGHTNING_BOLT.create( CraftWorld.this.world );
lightning.moveTo( loc.getX(), loc.getY(), loc.getZ() );

View File

@ -11,10 +11,10 @@ also changed. Also in several places, the breed item was stored after
it was decreased by one to consume the item.
diff --git a/src/main/java/net/minecraft/world/entity/animal/Animal.java b/src/main/java/net/minecraft/world/entity/animal/Animal.java
index be105a4460e9bf2ef4b72a307fa31291c37d5e0e..a836bfd2ea8af8098a20fb37ca25a5a613226f67 100644
index 907ed82fea71254d6624eda878e2668cd26422a7..f6e0eefe068fe1a9fe159b382cf94de488521728 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Animal.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Animal.java
@@ -150,8 +150,9 @@ public abstract class Animal extends AgeableMob {
@@ -152,8 +152,9 @@ public abstract class Animal extends AgeableMob {
int i = this.getAge();
if (!this.level().isClientSide && i == 0 && this.canFallInLove()) {
@ -25,7 +25,7 @@ index be105a4460e9bf2ef4b72a307fa31291c37d5e0e..a836bfd2ea8af8098a20fb37ca25a5a6
return InteractionResult.SUCCESS;
}
@@ -180,10 +181,18 @@ public abstract class Animal extends AgeableMob {
@@ -182,10 +183,18 @@ public abstract class Animal extends AgeableMob {
return this.inLove <= 0;
}
@ -44,7 +44,7 @@ index be105a4460e9bf2ef4b72a307fa31291c37d5e0e..a836bfd2ea8af8098a20fb37ca25a5a6
return;
}
this.inLove = entityEnterLoveModeEvent.getTicksInLove();
@@ -191,7 +200,7 @@ public abstract class Animal extends AgeableMob {
@@ -193,7 +202,7 @@ public abstract class Animal extends AgeableMob {
if (player != null) {
this.loveCause = player.getUUID();
}
@ -82,7 +82,7 @@ index 1d9427da270edb447a2c8e031c4f05fe5d39603b..7dee2d1c4ce038f42334120f5dedb836
boolean bl3 = this.isBaby();
diff --git a/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java b/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java
index 09e9c0e55c789f03a4b64136f28154bd114db6f5..a0628b9d74c29d02bfba583edf7ee6f2cde2cff6 100644
index 8fe5a4ccf474c094b8081828c93e8973cdabb6ed..63bbb5723f587788a65cc1cdac4cea94d96f254b 100644
--- a/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java
+++ b/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java
@@ -513,7 +513,7 @@ public abstract class AbstractHorse extends Animal implements ContainerListener,

View File

@ -29,7 +29,7 @@ index 52439f4b959c74027eb191a3af960c70beb978e8..a2c057d92ea34368c7efc538b6e5b15e
public void addModifier(AttributeModifier modifier) {
throw new UnsupportedOperationException("Cannot modify default attributes");
diff --git a/src/main/java/org/bukkit/craftbukkit/attribute/CraftAttributeInstance.java b/src/main/java/org/bukkit/craftbukkit/attribute/CraftAttributeInstance.java
index 0029412b1242879deb898524001bb4cc7550fa78..8e8b0a09ef58a4a3ccc31f2e11a0d6b9f3ee9b39 100644
index e0faf9bf55f95ab21bd3452cee73196ae7ba8122..971d9a6a64d4d93950441e36aa41522c6b145ebb 100644
--- a/src/main/java/org/bukkit/craftbukkit/attribute/CraftAttributeInstance.java
+++ b/src/main/java/org/bukkit/craftbukkit/attribute/CraftAttributeInstance.java
@@ -44,6 +44,21 @@ public class CraftAttributeInstance implements AttributeInstance {

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Fix missing event call for entity teleport API
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
index 0e6c7284b9aee6c5f2454a3a095ebf349f887740..9f843b89dc20b91bf7243facee8486d525e4a1b3 100644
index 0349d9b6ad12e0a426cb1307be8633240b7426fe..aa4dbf91cf6da329fdcacbde98bb870eb48e8f5c 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -603,6 +603,17 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
@@ -610,6 +610,17 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
return false;
}

View File

@ -8,10 +8,10 @@ For each player on each tick, enter block triggers are invoked, and these create
To avoid this, we now lazily create the LootContext if the criterion passes the predicate AND if any of the listener triggers require a loot context instance
diff --git a/src/main/java/net/minecraft/advancements/critereon/SimpleCriterionTrigger.java b/src/main/java/net/minecraft/advancements/critereon/SimpleCriterionTrigger.java
index f0367a9cce13ef576fbb7023c0aba6eb48963606..997ddf7cd0051ba67e9c4ef7da39481649303791 100644
index 0a22ed467d04c6421f4f8ef227a665ae135a5b0b..31fa6a0cb00139bfcb71f4fd30da8b736bf491f2 100644
--- a/src/main/java/net/minecraft/advancements/critereon/SimpleCriterionTrigger.java
+++ b/src/main/java/net/minecraft/advancements/critereon/SimpleCriterionTrigger.java
@@ -54,14 +54,14 @@ public abstract class SimpleCriterionTrigger<T extends SimpleCriterionTrigger.Si
@@ -45,14 +45,14 @@ public abstract class SimpleCriterionTrigger<T extends SimpleCriterionTrigger.Si
PlayerAdvancements playerAdvancements = player.getAdvancements();
Set<CriterionTrigger.Listener<T>> set = (Set) playerAdvancements.criterionData.get(this); // Paper - fix AdvancementDataPlayer leak
if (set != null && !set.isEmpty()) {
@ -22,7 +22,7 @@ index f0367a9cce13ef576fbb7023c0aba6eb48963606..997ddf7cd0051ba67e9c4ef7da394816
for(CriterionTrigger.Listener<T> listener : set) {
T simpleInstance = listener.trigger();
if (predicate.test(simpleInstance)) {
Optional<ContextAwarePredicate> optional = simpleInstance.playerPredicate();
Optional<ContextAwarePredicate> optional = simpleInstance.player();
- if (optional.isEmpty() || optional.get().matches(lootContext)) {
+ if (optional.isEmpty() || optional.get().matches(lootContext = (lootContext == null ? EntityPredicate.createContext(player, player) : lootContext))) { // Paper - lazily create LootContext for criterions
if (list == null) {

View File

@ -8,10 +8,10 @@ being added with generation to have effects added to them. The event
does not support asynchronous firing.
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index a76eb3d051db0229ed088b71c92ff3f131449007..87134e57a57df0fceda903e35d22f3f2de31adf3 100644
index 1580c3a13a7fd84e709e184ad57e7d70d143abd2..d01ce95110b42000a67e2697eed3da0e050f144b 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -1134,6 +1134,11 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -1133,6 +1133,11 @@ public abstract class LivingEntity extends Entity implements Attackable {
}
public boolean addEffect(MobEffectInstance mobeffect, @Nullable Entity entity, EntityPotionEffectEvent.Cause cause) {
@ -23,7 +23,7 @@ index a76eb3d051db0229ed088b71c92ff3f131449007..87134e57a57df0fceda903e35d22f3f2
// org.spigotmc.AsyncCatcher.catchOp("effect add"); // Spigot // Paper - move to API
if (this.isTickingEffects) {
this.effectsToProcess.add(new ProcessableEffect(mobeffect, cause));
@@ -1153,10 +1158,13 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -1152,10 +1157,13 @@ public abstract class LivingEntity extends Entity implements Attackable {
override = new MobEffectInstance(mobeffect1).update(mobeffect);
}
@ -37,7 +37,7 @@ index a76eb3d051db0229ed088b71c92ff3f131449007..87134e57a57df0fceda903e35d22f3f2
// CraftBukkit end
if (mobeffect1 == null) {
@@ -1164,7 +1172,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -1163,7 +1171,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
this.onEffectAdded(mobeffect, entity);
flag = true;
// CraftBukkit start

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Fix CraftMetaItem#getAttributeModifier duplication check
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
index 9105c420c0c8d2285f5f45c184d54e9a5c5fbc57..21702c14986f6dedd37326ddc74245b9e493a715 100644
index 8762a7a22723150a1a42b3459f3744b8235da142..ed87722957a0bd5f6348b91ac2ea9bb5ceb6d853 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
@@ -1175,7 +1175,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
@@ -1176,7 +1176,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
Preconditions.checkNotNull(modifier, "AttributeModifier cannot be null");
this.checkAttributeList();
for (Map.Entry<Attribute, AttributeModifier> entry : this.attributeModifiers.entries()) {

View File

@ -9,10 +9,10 @@ on dropping the item instead of generalizing it for all dropped
items like CB does.
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 08980763020a13ab49dc7d637625a4fba56da8c9..907c8f15f5247f9972c6677ff0f9e1aa22764a04 100644
index 5fe743567f2e9cf0f9442ddd87453c51af8060e6..8efbbd379244e3ed54d4aba199037cc20ccd096a 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -937,22 +937,20 @@ public class ServerPlayer extends Player {
@@ -944,22 +944,20 @@ public class ServerPlayer extends Player {
if (this.isRemoved()) {
return;
}
@ -39,10 +39,10 @@ index 08980763020a13ab49dc7d637625a4fba56da8c9..907c8f15f5247f9972c6677ff0f9e1aa
} // Paper
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index c655c6fee393c62ba79301f76baa72f9b1154a9a..fece91254b10b59474056aa730fd420f90cd7bec 100644
index 92508e9ea17d2ea00b4da20a249325c390442016..7b3ec2f2a522b565ef16f8724cd0ec835e374a32 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -2673,6 +2673,25 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -2702,6 +2702,25 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@Nullable
public ItemEntity spawnAtLocation(ItemStack stack, float yOffset) {
@ -68,7 +68,7 @@ index c655c6fee393c62ba79301f76baa72f9b1154a9a..fece91254b10b59474056aa730fd420f
if (stack.isEmpty()) {
return null;
} else if (this.level().isClientSide) {
@@ -2680,14 +2699,21 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -2709,14 +2728,21 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
} else {
// CraftBukkit start - Capture drops for death event
if (this instanceof net.minecraft.world.entity.LivingEntity && !((net.minecraft.world.entity.LivingEntity) this).forceDrops) {
@ -89,14 +89,14 @@ index c655c6fee393c62ba79301f76baa72f9b1154a9a..fece91254b10b59474056aa730fd420f
- entityitem.setDefaultPickUpDelay();
+ entityitem.setDefaultPickUpDelay(); // Paper - diff on change (in dropConsumer)
// Paper start
// Paper start
return this.spawnAtLocation(entityitem);
}
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 87134e57a57df0fceda903e35d22f3f2de31adf3..15e1d8c09fad181406a6acb8b3f177cd5e6c0f52 100644
index d01ce95110b42000a67e2697eed3da0e050f144b..45b1a182acf6b2aef40b714d31ca125d8f74619a 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -255,7 +255,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -254,7 +254,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
// CraftBukkit start
public int expToDrop;
public boolean forceDrops;
@ -123,10 +123,10 @@ index 1e07febcf7a3dfb281728cc5e3e4f15dd776d7e0..c9a4feb4a52c0eb621b120e5b8c18d0a
}
diff --git a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java
index 9dcf28bdcb5770a191e62353a60c953731671283..523f14916073fb137578da777a23ba8265fd8af6 100644
index 68fc2f614253f43ed9b09f54ca06aabb2bdd8fe3..630cb49ac05a8939c619c7b6710c9cf0ab85c8e7 100644
--- a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java
+++ b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java
@@ -623,7 +623,7 @@ public class ArmorStand extends LivingEntity {
@@ -610,7 +610,7 @@ public class ArmorStand extends LivingEntity {
itemstack.setHoverName(this.getCustomName());
}
@ -135,7 +135,7 @@ index 9dcf28bdcb5770a191e62353a60c953731671283..523f14916073fb137578da777a23ba82
return this.brokenByAnything(damageSource); // Paper
}
@@ -637,7 +637,7 @@ public class ArmorStand extends LivingEntity {
@@ -624,7 +624,7 @@ public class ArmorStand extends LivingEntity {
for (i = 0; i < this.handItems.size(); ++i) {
itemstack = (ItemStack) this.handItems.get(i);
if (!itemstack.isEmpty()) {
@ -144,7 +144,7 @@ index 9dcf28bdcb5770a191e62353a60c953731671283..523f14916073fb137578da777a23ba82
this.handItems.set(i, ItemStack.EMPTY);
}
}
@@ -645,7 +645,7 @@ public class ArmorStand extends LivingEntity {
@@ -632,7 +632,7 @@ public class ArmorStand extends LivingEntity {
for (i = 0; i < this.armorItems.size(); ++i) {
itemstack = (ItemStack) this.armorItems.get(i);
if (!itemstack.isEmpty()) {
@ -154,7 +154,7 @@ index 9dcf28bdcb5770a191e62353a60c953731671283..523f14916073fb137578da777a23ba82
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index 5dc160b743534665c6b3efb10b10f7c36e2da5ab..64ae7cfe765ebe697a2cce1b71751e628d6f1662 100644
index 916b29914f77bed0dbfdcd5eae8a6ef22948b9b0..e0f80414e01852b6f48c173dc2343ec928147e2f 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -942,17 +942,21 @@ public class CraftEventFactory {

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Add Structure check API
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index f19f2199cac5a7eb275f40cc23472416a40ec0da..90c76ddcb8af13409490b8976263d27a71954668 100644
index 5de25f3f6944055e9d6c3cae29ad0885a95d5f38..e1fad381b861471a17529c246bb8a4a9c7646420 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -230,6 +230,12 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@@ -231,6 +231,12 @@ public class CraftWorld extends CraftRegionAccessor implements World {
};
}
// Paper end

View File

@ -8,7 +8,7 @@ In general, the client now has an acknowledgment system which will prevent block
It should be noted that this system does not yet support block entities, so those still need to resynced when needed.
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
index 346912d854a176a410920e69d063919f5d34626a..3706e94108f68a16fea63e734f3e3b6871dcb0b8 100644
index b214c934b9a537f52cef142c519c2b9b55a89ae3..58f972832c39a27a8ccd606f9144e1c54adbf6f3 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
@@ -199,7 +199,7 @@ public class ServerPlayerGameMode {
@ -149,10 +149,10 @@ index 277555a26e8281dd1a626e572794b08cf51d00c5..aa0f09a18ea781e027ea70928b30d3e9
return false;
}
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
index 4697df75fdee2023c41260bed211e3e3d90d2b9b..d0f7baa80cb7d0883304abe2ed990c258a0d92b6 100644
index c4228284145c27f6fe995bd1875d3f17f4786ddd..09493b78531d5b9199cd518b2ebf650a604f74fa 100644
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
@@ -436,10 +436,12 @@ public final class ItemStack {
@@ -457,10 +457,12 @@ public final class ItemStack {
world.preventPoiUpdated = false;
// Brute force all possible updates

View File

@ -1,20 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
Date: Tue, 7 Nov 2023 18:59:04 -0800
Subject: [PATCH] Don't unpack loot table for TEs not in world
Fixed by 23w44a/1.20.3. Remove it then
diff --git a/src/main/java/net/minecraft/world/level/block/entity/RandomizableContainerBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/RandomizableContainerBlockEntity.java
index 081691f9710ff1115e4308f79ed49fbc38941193..3e638f12956e57548f76c7e2403ba370f7baa249 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/RandomizableContainerBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/RandomizableContainerBlockEntity.java
@@ -70,7 +70,7 @@ public abstract class RandomizableContainerBlockEntity extends BaseContainerBloc
}
public void unpackLootTable(@Nullable Player player) {
- if (this.lootableData.shouldReplenish(player) && this.level.getServer() != null) { // Paper
+ if (this.level != null && this.lootableData.shouldReplenish(player) && this.level.getServer() != null) { // Paper - don't unpack loot table if not in world
LootTable lootTable = this.level.getServer().getLootData().getLootTable(this.lootTable);
if (player instanceof ServerPlayer) {
CriteriaTriggers.GENERATE_LOOT.trigger((ServerPlayer)player, this.lootTable);