[ci skip] Add more patch identifying comments

This commit is contained in:
Nassim Jahnke 2024-01-23 14:34:17 +01:00
parent 484d6bfb4e
commit 52619e7a21
No known key found for this signature in database
GPG Key ID: EF6771C01F6EF02F
99 changed files with 360 additions and 393 deletions

View File

@ -12,7 +12,7 @@ improve setPosition to use raw
public net.minecraft.world.entity.Entity setRot(FF)V
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index fdf3bf3decb14378f5e59e41bab26e965bc7be14..b74689297ca20efee391fe1da80377082d1758e5 100644
index fdf3bf3decb14378f5e59e41bab26e965bc7be14..ffd73624360e76caef477aeb0074fc8eba13c1c6 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -227,7 +227,7 @@ public abstract class PlayerList {
@ -32,7 +32,7 @@ index fdf3bf3decb14378f5e59e41bab26e965bc7be14..b74689297ca20efee391fe1da8037708
+ // Paper start - set raw so we aren't fully joined to the world (not added to chunk or world)
+ player.setPosRaw(loc.getX(), loc.getY(), loc.getZ());
+ player.setRot(loc.getYaw(), loc.getPitch());
+ // Paper end
+ // Paper end - set raw so we aren't fully joined to the world
// Spigot end
// CraftBukkit - Moved message to after join

View File

@ -6,7 +6,7 @@ Subject: [PATCH] Configurable Disabling Cat Chest Detection
Offers a gameplay feature to stop cats from blocking chests
diff --git a/src/main/java/net/minecraft/world/level/block/ChestBlock.java b/src/main/java/net/minecraft/world/level/block/ChestBlock.java
index 3d153e5c48bc80ec969de9a32113537e03fb812b..9804ee2020e5cef23d3f5174d153fc149e611503 100644
index 3d153e5c48bc80ec969de9a32113537e03fb812b..305bce4d833116cc21e64fdcdfe13f03e94ff4ba 100644
--- a/src/main/java/net/minecraft/world/level/block/ChestBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/ChestBlock.java
@@ -364,6 +364,11 @@ public class ChestBlock extends AbstractChestBlock<ChestBlockEntity> implements
@ -17,7 +17,7 @@ index 3d153e5c48bc80ec969de9a32113537e03fb812b..9804ee2020e5cef23d3f5174d153fc14
+ if (world.getMinecraftWorld().paperConfig().entities.behavior.disableChestCatDetection) {
+ return false;
+ }
+ // Paper end
+ // Paper end - Option to disable chest cat detection
List<Cat> list = world.getEntitiesOfClass(Cat.class, new AABB((double) pos.getX(), (double) (pos.getY() + 1), (double) pos.getZ(), (double) (pos.getX() + 1), (double) (pos.getY() + 2), (double) (pos.getZ() + 1)));
if (!list.isEmpty()) {

View File

@ -17,7 +17,7 @@ Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
Co-authored-by: SoSeDiK <mrsosedik@gmail.com>
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index d22341dd864ac3423ec4ae1e3f4febefe24ae3f6..8c8c3085711989c90ea9ae51b3d95abee284a71e 100644
index e8e5773776060b7b6861c80ec736bc5740a262c8..64b5af3745642d2a2e2075cb70ef4defbee64d15 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1937,7 +1937,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@ -40,7 +40,7 @@ index d22341dd864ac3423ec4ae1e3f4febefe24ae3f6..8c8c3085711989c90ea9ae51b3d95abe
if ( org.spigotmc.SpigotConfig.logCommands ) // Spigot
this.LOGGER.info(this.player.getScoreboardName() + " issued server command: " + s);
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index e2da717c11f48573babe27d0dac1d679e8eb6964..b80e4acbb67d6f2fbe31b1e518c20d7ec0ec4e49 100644
index 73ed8a00ed83a0f7da7a5f69e743850d7a5b76cc..7e7dfec65f1756e21eb79359e13d429fe1955bba 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -885,7 +885,7 @@ public final class CraftServer implements Server {
@ -53,7 +53,7 @@ index e2da717c11f48573babe27d0dac1d679e8eb6964..b80e4acbb67d6f2fbe31b1e518c20d7e
if (this.commandMap.dispatch(sender, commandLine)) {
return true;
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 49d0e2988d2267c4721d8ce37a96eb1d3944ea5a..054ada5455c6570f86d9a010fcb8eaf57bf7151d 100644
index 49d0e2988d2267c4721d8ce37a96eb1d3944ea5a..1ebbd53d545d4b9ac3341c6a68ec97a2f468fb48 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -498,7 +498,20 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@ -74,7 +74,7 @@ index 49d0e2988d2267c4721d8ce37a96eb1d3944ea5a..054ada5455c6570f86d9a010fcb8eaf5
+ this.getHandle().connection.chat(msg, playerChatMessage, false);
+ }
+ }
+ // Paper end
+ // Paper end - Improve chat handling
}
@Override

View File

@ -5,7 +5,7 @@ Subject: [PATCH] All chunks are slime spawn chunks toggle
diff --git a/src/main/java/net/minecraft/world/entity/monster/Slime.java b/src/main/java/net/minecraft/world/entity/monster/Slime.java
index 8b2206c5c56341ecd96837bdb3e0c6ab7c874af5..ef382b08ff8e7f24500aed6752c76e6ffc3f0729 100644
index 8b2206c5c56341ecd96837bdb3e0c6ab7c874af5..897c815fb448d1e9ca75b7f8b93b4021dccf7596 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Slime.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Slime.java
@@ -338,7 +338,7 @@ public class Slime extends Mob implements Enemy {
@ -13,7 +13,7 @@ index 8b2206c5c56341ecd96837bdb3e0c6ab7c874af5..ef382b08ff8e7f24500aed6752c76e6f
ChunkPos chunkcoordintpair = new ChunkPos(pos);
- boolean flag = WorldgenRandom.seedSlimeChunk(chunkcoordintpair.x, chunkcoordintpair.z, ((WorldGenLevel) world).getSeed(), world.getMinecraftWorld().spigotConfig.slimeSeed).nextInt(10) == 0; // Spigot
+ boolean flag = world.getMinecraftWorld().paperConfig().entities.spawning.allChunksAreSlimeChunks || WorldgenRandom.seedSlimeChunk(chunkcoordintpair.x, chunkcoordintpair.z, ((WorldGenLevel) world).getSeed(), world.getMinecraftWorld().spigotConfig.slimeSeed).nextInt(10) == 0; // Spigot // Paper
+ boolean flag = world.getMinecraftWorld().paperConfig().entities.spawning.allChunksAreSlimeChunks || WorldgenRandom.seedSlimeChunk(chunkcoordintpair.x, chunkcoordintpair.z, ((WorldGenLevel) world).getSeed(), world.getMinecraftWorld().spigotConfig.slimeSeed).nextInt(10) == 0; // Spigot // Paper
if (random.nextInt(10) == 0 && flag && pos.getY() < 40) {
return checkMobSpawnRules(type, world, spawnReason, pos, random);

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Add configurable portal search radius
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 450a55fd1b01ac67d911d152a04a3dee3aa0a2e9..6fe0883a6746a31acff7ede501e058b68ad6e78d 100644
index 16fa26878fc7bcf5d22d779ce7b37a59582ba033..927428f11e005fff28f01cfb584a2789aad02afb 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -3233,7 +3233,13 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@ -13,18 +13,18 @@ index 450a55fd1b01ac67d911d152a04a3dee3aa0a2e9..6fe0883a6746a31acff7ede501e058b6
BlockPos blockposition = worldborder.clampToBounds(this.getX() * d0, this.getY(), this.getZ() * d0);
// CraftBukkit start
- CraftPortalEvent event = this.callPortalEvent(this, destination, new Vec3(blockposition.getX(), blockposition.getY(), blockposition.getZ()), PlayerTeleportEvent.TeleportCause.NETHER_PORTAL, flag2 ? 16 : 128, 16);
+ // Paper start
+ // Paper start - Configurable portal search radius
+ int portalSearchRadius = destination.paperConfig().environment.portalSearchRadius;
+ if (level.paperConfig().environment.portalSearchVanillaDimensionScaling && flag2) { // == THE_NETHER
+ portalSearchRadius = (int) (portalSearchRadius / destination.dimensionType().coordinateScale());
+ }
+ // Paper end
+ // Paper end - Configurable portal search radius
+ CraftPortalEvent event = this.callPortalEvent(this, destination, new Vec3(blockposition.getX(), blockposition.getY(), blockposition.getZ()), PlayerTeleportEvent.TeleportCause.NETHER_PORTAL, portalSearchRadius, destination.paperConfig().environment.portalCreateRadius); // Paper start - configurable portal radius
if (event == null) {
return null;
}
diff --git a/src/main/java/net/minecraft/world/level/portal/PortalForcer.java b/src/main/java/net/minecraft/world/level/portal/PortalForcer.java
index 0762bb248b3bd43a06e89aa1893a6189f0e13866..ed5210c63d964be7c28f59df315766794ec3ea1f 100644
index 0762bb248b3bd43a06e89aa1893a6189f0e13866..431f1cf004471dbfb149f697300c3c7fe6bfda4d 100644
--- a/src/main/java/net/minecraft/world/level/portal/PortalForcer.java
+++ b/src/main/java/net/minecraft/world/level/portal/PortalForcer.java
@@ -43,7 +43,7 @@ public class PortalForcer {
@ -32,7 +32,7 @@ index 0762bb248b3bd43a06e89aa1893a6189f0e13866..ed5210c63d964be7c28f59df31576679
public Optional<BlockUtil.FoundRectangle> findPortalAround(BlockPos pos, boolean destIsNether, WorldBorder worldBorder) {
// CraftBukkit start
- return this.findPortalAround(pos, worldBorder, destIsNether ? 16 : 128); // Search Radius
+ return this.findPortalAround(pos, worldBorder, destIsNether ? level.paperConfig().environment.portalCreateRadius : level.paperConfig().environment.portalSearchRadius); // Search Radius // Paper - search Radius
+ return this.findPortalAround(pos, worldBorder, destIsNether ? level.paperConfig().environment.portalCreateRadius : level.paperConfig().environment.portalSearchRadius); // Search Radius // Paper - Configurable portal search radius
}
public Optional<BlockUtil.FoundRectangle> findPortalAround(BlockPos blockposition, WorldBorder worldborder, int i) {

View File

@ -49,7 +49,7 @@ index 0000000000000000000000000000000000000000..f699ce18ca044f813e194ef2786b7ea8
+ }
+}
diff --git a/src/main/java/net/minecraft/server/players/OldUsersConverter.java b/src/main/java/net/minecraft/server/players/OldUsersConverter.java
index 8d06e8d286da2573e40794adab695ff77e5afd86..78b11d6fd74fb0714a8013fdc78d096643c4f83c 100644
index 8d06e8d286da2573e40794adab695ff77e5afd86..b3c6e76105ee26a79a84a203935530f859460652 100644
--- a/src/main/java/net/minecraft/server/players/OldUsersConverter.java
+++ b/src/main/java/net/minecraft/server/players/OldUsersConverter.java
@@ -1,5 +1,6 @@
@ -63,7 +63,7 @@ index 8d06e8d286da2573e40794adab695ff77e5afd86..78b11d6fd74fb0714a8013fdc78d0966
root = NbtIo.readCompressed(new java.io.FileInputStream(file5), NbtAccounter.unlimitedHeap());
} catch (Exception exception) {
exception.printStackTrace();
+ ServerInternalException.reportInternalException(exception); // Paper
+ ServerInternalException.reportInternalException(exception); // Paper - ServerExceptionEvent
}
if (root != null) {
@ -71,24 +71,24 @@ index 8d06e8d286da2573e40794adab695ff77e5afd86..78b11d6fd74fb0714a8013fdc78d0966
NbtIo.writeCompressed(root, new java.io.FileOutputStream(file2));
} catch (Exception exception) {
exception.printStackTrace();
+ ServerInternalException.reportInternalException(exception); // Paper
+ ServerInternalException.reportInternalException(exception); // Paper - ServerExceptionEvent
}
}
// CraftBukkit end
diff --git a/src/main/java/net/minecraft/world/entity/ai/village/VillageSiege.java b/src/main/java/net/minecraft/world/entity/ai/village/VillageSiege.java
index c6fb4c33d7ea52b88d8fc0d90748cbab7387c565..fed09b886f4fa0006d160e5f2abb00dfee45434d 100644
index c6fb4c33d7ea52b88d8fc0d90748cbab7387c565..2b5b2869589991be37a4f128faabbff50e661470 100644
--- a/src/main/java/net/minecraft/world/entity/ai/village/VillageSiege.java
+++ b/src/main/java/net/minecraft/world/entity/ai/village/VillageSiege.java
@@ -118,6 +118,7 @@ public class VillageSiege implements CustomSpawner {
entityzombie.finalizeSpawn(world, world.getCurrentDifficultyAt(entityzombie.blockPosition()), MobSpawnType.EVENT, (SpawnGroupData) null, (CompoundTag) null);
} catch (Exception exception) {
VillageSiege.LOGGER.warn("Failed to create zombie for village siege at {}", vec3d, exception);
+ com.destroystokyo.paper.exception.ServerInternalException.reportInternalException(exception); // Paper
+ com.destroystokyo.paper.exception.ServerInternalException.reportInternalException(exception); // Paper - ServerExceptionEvent
return;
}
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 8be40065d6f0d53d5a264464fc4be208c7bad3a9..9a39bf50668340a77bbfd45218c03d9c00a6ce1e 100644
index 1b5eb2685c43804e5e4014ff1b70f52652be67f5..0032914a53154d11e2d36267771fd2da6d2f1d05 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -1,5 +1,10 @@
@ -106,19 +106,19 @@ index 8be40065d6f0d53d5a264464fc4be208c7bad3a9..9a39bf50668340a77bbfd45218c03d9c
// Paper start - Prevent tile entity and entity crashes
final String msg = String.format("Entity threw exception at %s:%s,%s,%s", entity.level().getWorld().getName(), entity.getX(), entity.getY(), entity.getZ());
MinecraftServer.LOGGER.error(msg, throwable);
+ getCraftServer().getPluginManager().callEvent(new ServerExceptionEvent(new ServerInternalException(msg, throwable)));
+ getCraftServer().getPluginManager().callEvent(new ServerExceptionEvent(new ServerInternalException(msg, throwable))); // Paper - ServerExceptionEvent
entity.discard();
// Paper end
}
diff --git a/src/main/java/net/minecraft/world/level/NaturalSpawner.java b/src/main/java/net/minecraft/world/level/NaturalSpawner.java
index 5d65baba605dd83e5f74d526aeda36d8ede8c014..92e76dd39dc3575e9466031dd799080a98ad8b8d 100644
index 5d65baba605dd83e5f74d526aeda36d8ede8c014..604766a286d00bb4b40c20482376fe80651beabe 100644
--- a/src/main/java/net/minecraft/world/level/NaturalSpawner.java
+++ b/src/main/java/net/minecraft/world/level/NaturalSpawner.java
@@ -291,6 +291,7 @@ public final class NaturalSpawner {
NaturalSpawner.LOGGER.warn("Can't spawn entity of type: {}", BuiltInRegistries.ENTITY_TYPE.getKey(type));
} catch (Exception exception) {
NaturalSpawner.LOGGER.warn("Failed to create mob", exception);
+ com.destroystokyo.paper.exception.ServerInternalException.reportInternalException(exception); // Paper
+ com.destroystokyo.paper.exception.ServerInternalException.reportInternalException(exception); // Paper - ServerExceptionEvent
}
return null;
@ -126,12 +126,12 @@ index 5d65baba605dd83e5f74d526aeda36d8ede8c014..92e76dd39dc3575e9466031dd799080a
entity = biomesettingsmobs_c.type.create(world.getLevel());
} catch (Exception exception) {
NaturalSpawner.LOGGER.warn("Failed to create mob", exception);
+ com.destroystokyo.paper.exception.ServerInternalException.reportInternalException(exception); // Paper
+ com.destroystokyo.paper.exception.ServerInternalException.reportInternalException(exception); // Paper - ServerExceptionEvent
continue;
}
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
index db3ee1f1d8429d3d646623877adc9f6920b7764f..b589b67471367f37e6d1f4737122914a649c01b3 100644
index db3ee1f1d8429d3d646623877adc9f6920b7764f..7208b7b916ff179e8dbe9925fb246e3652b4f9c2 100644
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
@@ -1,6 +1,7 @@
@ -150,7 +150,7 @@ index db3ee1f1d8429d3d646623877adc9f6920b7764f..b589b67471367f37e6d1f4737122914a
- + " (" + this.getBlockState(blockposition) + ") where there was no entity tile!");
- System.out.println("Chunk coordinates: " + (this.chunkPos.x * 16) + "," + (this.chunkPos.z * 16));
- new Exception().printStackTrace();
+ // Paper start
+ // Paper start - ServerExceptionEvent
+ ServerInternalException e = new ServerInternalException(
+ "Attempted to place a tile entity (" + blockEntity + ") at " + blockEntity.getBlockPos().getX() + ","
+ + blockEntity.getBlockPos().getY() + "," + blockEntity.getBlockPos().getZ()
@ -159,7 +159,7 @@ index db3ee1f1d8429d3d646623877adc9f6920b7764f..b589b67471367f37e6d1f4737122914a
+ "\nWorld: " + level.getLevel().dimension().location());
+ e.printStackTrace();
+ ServerInternalException.reportInternalException(e);
+ // Paper end
+ // Paper end - ServerExceptionEvent
// CraftBukkit end
}
}
@ -167,19 +167,19 @@ index db3ee1f1d8429d3d646623877adc9f6920b7764f..b589b67471367f37e6d1f4737122914a
// Paper start - Prevent tile entity and entity crashes
final String msg = String.format("BlockEntity threw exception at %s:%s,%s,%s", LevelChunk.this.getLevel().getWorld().getName(), this.getPos().getX(), this.getPos().getY(), this.getPos().getZ());
net.minecraft.server.MinecraftServer.LOGGER.error(msg, throwable);
+ net.minecraft.world.level.chunk.LevelChunk.this.level.getCraftServer().getPluginManager().callEvent(new com.destroystokyo.paper.event.server.ServerExceptionEvent(new ServerInternalException(msg, throwable)));
+ net.minecraft.world.level.chunk.LevelChunk.this.level.getCraftServer().getPluginManager().callEvent(new com.destroystokyo.paper.event.server.ServerExceptionEvent(new ServerInternalException(msg, throwable))); // Paper - ServerExceptionEvent
LevelChunk.this.removeBlockEntity(this.getPos());
// Paper end
// Spigot start
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java
index 5103081e8469dd5a393595eae00c6f6c9d0a5028..ab9681ba3a86212e0e23a9af8788eec1dbee36ab 100644
index 5103081e8469dd5a393595eae00c6f6c9d0a5028..9623a7bac79af37016ba5a5b37d4ef0b3dcb7312 100644
--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java
@@ -275,6 +275,7 @@ public class RegionFile implements AutoCloseable {
return true;
}
} catch (IOException ioexception) {
+ com.destroystokyo.paper.exception.ServerInternalException.reportInternalException(ioexception); // Paper
+ com.destroystokyo.paper.exception.ServerInternalException.reportInternalException(ioexception); // Paper - ServerExceptionEvent
return false;
}
}
@ -187,7 +187,7 @@ index 5103081e8469dd5a393595eae00c6f6c9d0a5028..ab9681ba3a86212e0e23a9af8788eec1
((java.nio.Buffer) buf).position(5); // CraftBukkit - decompile error
filechannel.write(buf);
} catch (Throwable throwable) {
+ com.destroystokyo.paper.exception.ServerInternalException.reportInternalException(throwable); // Paper
+ com.destroystokyo.paper.exception.ServerInternalException.reportInternalException(throwable); // Paper - ServerExceptionEvent
if (filechannel != null) {
try {
filechannel.close();

View File

@ -11,26 +11,26 @@ So avoid looking up scoreboards and short circuit to the "not on a team"
logic which is most likely to be true.
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 6fe0883a6746a31acff7ede501e058b68ad6e78d..08e3e87b2aa9d586cd1b441e7314d0775f7537c8 100644
index 927428f11e005fff28f01cfb584a2789aad02afb..939707c42db4509aa71ccd43bbfe4c17e6bc2c3f 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -2860,6 +2860,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@Nullable
public PlayerTeam getTeam() {
+ if (!this.level().paperConfig().scoreboards.allowNonPlayerEntitiesOnScoreboards && !(this instanceof Player)) { return null; } // Paper
+ if (!this.level().paperConfig().scoreboards.allowNonPlayerEntitiesOnScoreboards && !(this instanceof Player)) { return null; } // Paper - Perf: Disable Scoreboards for non players by default
return this.level().getScoreboard().getPlayersTeam(this.getScoreboardName());
}
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 4afd257f30ab063c4805e8a3144f51d643c49db3..a43539db71a7344e9477918dc5c7b07d46903bea 100644
index 2e47008a8ff1bb56b752d4eb880173b9edfbc4ad..3eeb40c2176a80b9e2a472d43671ae0fe087d9e7 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -832,6 +832,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
if (nbt.contains("Team", 8)) {
String s = nbt.getString("Team");
PlayerTeam scoreboardteam = this.level().getScoreboard().getPlayerTeam(s);
+ if (!this.level().paperConfig().scoreboards.allowNonPlayerEntitiesOnScoreboards && !(this instanceof net.minecraft.world.entity.player.Player)) { scoreboardteam = null; } // Paper
+ if (!this.level().paperConfig().scoreboards.allowNonPlayerEntitiesOnScoreboards && !(this instanceof net.minecraft.world.entity.player.Player)) { scoreboardteam = null; } // Paper - Perf: Disable Scoreboards for non players by default
boolean flag = scoreboardteam != null && this.level().getScoreboard().addPlayerToTeam(this.getStringUUID(), scoreboardteam);
if (!flag) {

View File

@ -6,27 +6,27 @@ Subject: [PATCH] Chunk Save Reattempt
We commonly have "Stream Closed" errors on chunk saving, so this code should re-try to save the chunk in the event of failure and hopefully prevent rollbacks.
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java
index ab9681ba3a86212e0e23a9af8788eec1dbee36ab..2a7f17726a161ddbcd0397fb4332de6980199c38 100644
index 9623a7bac79af37016ba5a5b37d4ef0b3dcb7312..f3d169436ce05f1c56599cfe15a56671b7d13516 100644
--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java
@@ -275,7 +275,7 @@ public class RegionFile implements AutoCloseable {
return true;
}
} catch (IOException ioexception) {
- com.destroystokyo.paper.exception.ServerInternalException.reportInternalException(ioexception); // Paper
+ com.destroystokyo.paper.util.SneakyThrow.sneaky(ioexception); // Paper - we want the upper try/catch to retry this
- com.destroystokyo.paper.exception.ServerInternalException.reportInternalException(ioexception); // Paper - ServerExceptionEvent
+ com.destroystokyo.paper.util.SneakyThrow.sneaky(ioexception); // Paper - Chunk save reattempt; we want the upper try/catch to retry this
return false;
}
}
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
index 2b6ba2e30c9a4682d6deb2ab750d6923ad8469e4..2d00333f25828ef5912c925d1213a56c564d85c9 100644
index 2b6ba2e30c9a4682d6deb2ab750d6923ad8469e4..fa592d5db10dbd4824de74658655ef61230ed431 100644
--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
@@ -209,6 +209,7 @@ public class RegionFileStorage implements AutoCloseable {
}
// Paper end - rewrite chunk system
try { // Paper
+ int attempts = 0; Exception laste = null; while (attempts++ < 5) { try { // Paper
+ int attempts = 0; Exception laste = null; while (attempts++ < 5) { try { // Paper - Chunk save reattempt
if (nbt == null) {
regionfile.clear(pos);
@ -34,7 +34,7 @@ index 2b6ba2e30c9a4682d6deb2ab750d6923ad8469e4..2d00333f25828ef5912c925d1213a56c
dataoutputstream.close();
}
}
+ // Paper start
+ // Paper start - Chunk save reattempt
+ return;
+ } catch (Exception ex) {
+ laste = ex;
@ -45,7 +45,7 @@ index 2b6ba2e30c9a4682d6deb2ab750d6923ad8469e4..2d00333f25828ef5912c925d1213a56c
+ com.destroystokyo.paper.exception.ServerInternalException.reportInternalException(laste);
+ net.minecraft.server.MinecraftServer.LOGGER.error("Failed to save chunk " + pos, laste);
+ }
+ // Paper end
+ // Paper end - Chunk save reattempt
} finally { // Paper start
regionfile.fileLock.unlock();
} // Paper end

View File

@ -6,7 +6,7 @@ Subject: [PATCH] Configurable Non Player Arrow Despawn Rate
Can set a much shorter despawn rate for arrows that players can not pick up.
diff --git a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
index 95d49d1f47a9c04535e94350bdcb4da88a1e5d27..b24f828d39fc26b4f85f5c76010f0ba47e9fe05f 100644
index 95d49d1f47a9c04535e94350bdcb4da88a1e5d27..0f700442a7559fac5d27d1fb6b3716f3853a9897 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
@@ -319,7 +319,7 @@ public abstract class AbstractArrow extends Projectile {
@ -14,7 +14,7 @@ index 95d49d1f47a9c04535e94350bdcb4da88a1e5d27..b24f828d39fc26b4f85f5c76010f0ba4
protected void tickDespawn() {
++this.life;
- if (this.life >= ((this instanceof ThrownTrident) ? this.level().spigotConfig.tridentDespawnRate : this.level().spigotConfig.arrowDespawnRate)) { // Spigot
+ if (this.life >= (pickup == Pickup.CREATIVE_ONLY ? this.level().paperConfig().entities.spawning.creativeArrowDespawnRate.value() : (pickup == Pickup.DISALLOWED ? this.level().paperConfig().entities.spawning.nonPlayerArrowDespawnRate.value() : ((this instanceof ThrownTrident) ? this.level().spigotConfig.tridentDespawnRate : this.level().spigotConfig.arrowDespawnRate)))) { // Spigot // Paper - TODO: Extract this to init?
+ if (this.life >= (pickup == Pickup.CREATIVE_ONLY ? this.level().paperConfig().entities.spawning.creativeArrowDespawnRate.value() : (pickup == Pickup.DISALLOWED ? this.level().paperConfig().entities.spawning.nonPlayerArrowDespawnRate.value() : ((this instanceof ThrownTrident) ? this.level().spigotConfig.tridentDespawnRate : this.level().spigotConfig.arrowDespawnRate)))) { // Spigot // Paper - Configurable non-player arrow despawn rate; TODO: Extract this to init?
this.discard();
}

View File

@ -5,21 +5,8 @@ Subject: [PATCH] Add World Util Methods
Methods that can be used for other patches to help improve logic.
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index f1b34765b436461f09e8b9122cb981e319684838..68035b041157ddbfcbefbcc3a2a3e2a18c558c2c 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -222,7 +222,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
public final LevelStorageSource.LevelStorageAccess convertable;
public final UUID uuid;
- public LevelChunk getChunkIfLoaded(int x, int z) {
+ @Override public LevelChunk getChunkIfLoaded(int x, int z) { // Paper - this was added in world too but keeping here for NMS ABI
return this.chunkSource.getChunk(x, z, false);
}
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 9a39bf50668340a77bbfd45218c03d9c00a6ce1e..076caf94ff0b91b1c3d2b8a335e3d67f006e0c73 100644
index 0032914a53154d11e2d36267771fd2da6d2f1d05..85b1e406b856f3452fe44f909fa5475196f1cf58 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -345,6 +345,22 @@ public abstract class Level implements LevelAccessor, AutoCloseable {

View File

@ -5,7 +5,7 @@ Subject: [PATCH] handle NaN health/absorb values and repair bad data
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 497cd74cd6efc4ad3679fd1a7489ebd194030835..52c895bf50d722c81ab08c5f53c2bc1212ab5ef3 100644
index 537ddaec422399dfa926936501d35bdc48b0baa3..966059931fa4b6c06dd5269be09db8cf9ca0bd51 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -793,7 +793,13 @@ public abstract class LivingEntity extends Entity implements Attackable {
@ -13,13 +13,13 @@ index 497cd74cd6efc4ad3679fd1a7489ebd194030835..52c895bf50d722c81ab08c5f53c2bc12
@Override
public void readAdditionalSaveData(CompoundTag nbt) {
- this.internalSetAbsorptionAmount(nbt.getFloat("AbsorptionAmount"));
+ // Paper start - jvm keeps optimizing the setter
+ // Paper start - Check for NaN
+ float absorptionAmount = nbt.getFloat("AbsorptionAmount");
+ if (Float.isNaN(absorptionAmount)) {
+ absorptionAmount = 0;
+ }
+ this.internalSetAbsorptionAmount(absorptionAmount);
+ // Paper end
+ // Paper end - Check for NaN
if (nbt.contains("Attributes", 9) && this.level() != null && !this.level().isClientSide) {
this.getAttributes().load(nbt.getList("Attributes", 10));
}
@ -27,10 +27,10 @@ index 497cd74cd6efc4ad3679fd1a7489ebd194030835..52c895bf50d722c81ab08c5f53c2bc12
}
public void setHealth(float health) {
+ // Paper start
+ // Paper start - Check for NaN
+ if (Float.isNaN(health)) { health = getMaxHealth(); if (this.valid) {
+ System.err.println("[NAN-HEALTH] " + getScoreboardName() + " had NaN health set");
+ } } // Paper end
+ } } // Paper end - Check for NaN
// CraftBukkit start - Handle scaled health
if (this instanceof ServerPlayer) {
org.bukkit.craftbukkit.entity.CraftPlayer player = ((ServerPlayer) this).getBukkitEntity();
@ -39,19 +39,19 @@ index 497cd74cd6efc4ad3679fd1a7489ebd194030835..52c895bf50d722c81ab08c5f53c2bc12
public final void setAbsorptionAmount(float absorptionAmount) {
- this.internalSetAbsorptionAmount(Mth.clamp(absorptionAmount, 0.0F, this.getMaxAbsorption()));
+ this.internalSetAbsorptionAmount(!Float.isNaN(absorptionAmount) ? Mth.clamp(absorptionAmount, 0.0F, this.getMaxAbsorption()) : 0.0F); // Paper
+ this.internalSetAbsorptionAmount(!Float.isNaN(absorptionAmount) ? Mth.clamp(absorptionAmount, 0.0F, this.getMaxAbsorption()) : 0.0F); // Paper - Check for NaN
}
protected void internalSetAbsorptionAmount(float absorptionAmount) {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index babd5dd5a83682d2bc36f988f008e788257b4157..a40d4d486ed674aae6ff319879c2ca2b2e4ce2cb 100644
index 1d48824c4cfd99ced6a70284aa3b7bce46af81fa..b15df5f55dc12c358df74df500f210976eaba048 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -2232,6 +2232,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
}
public void setRealHealth(double health) {
+ if (Double.isNaN(health)) {return;} // Paper
+ if (Double.isNaN(health)) {return;} // Paper - Check for NaN
this.health = health;
}

View File

@ -6,14 +6,14 @@ Subject: [PATCH] Use a Shared Random for Entities
Reduces memory usage and provides ensures more randomness, Especially since a lot of garbage entity objects get created.
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 76dddcd1a339842e6214bb1e4b813a858dbee63b..39ef390739c4bde28c87c1b83610602a86afd6ad 100644
index 939707c42db4509aa71ccd43bbfe4c17e6bc2c3f..6d3c575d12b3c1cc7c06a4cf1b671a2de894892a 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -165,6 +165,79 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
return tag.contains("Bukkit.updateLevel") && tag.getInt("Bukkit.updateLevel") >= level;
}
+ // Paper start
+ // Paper start - Share random for entities to make them more random
+ public static RandomSource SHARED_RANDOM = new RandomRandomSource();
+ private static final class RandomRandomSource extends java.util.Random implements net.minecraft.world.level.levelgen.BitRandomSource {
+ private boolean locked = false;
@ -84,7 +84,7 @@ index 76dddcd1a339842e6214bb1e4b813a858dbee63b..39ef390739c4bde28c87c1b83610602a
+ return super.nextGaussian();
+ }
+ }
+ // Paper end
+ // Paper end - Share random for entities to make them more random
+
private CraftEntity bukkitEntity;
@ -94,12 +94,12 @@ index 76dddcd1a339842e6214bb1e4b813a858dbee63b..39ef390739c4bde28c87c1b83610602a
this.stuckSpeedMultiplier = Vec3.ZERO;
this.nextStep = 1.0F;
- this.random = RandomSource.create();
+ this.random = SHARED_RANDOM; // Paper
+ this.random = SHARED_RANDOM; // Paper - Share random for entities to make them more random
this.remainingFireTicks = -this.getFireImmuneTicks();
this.fluidHeight = new Object2DoubleArrayMap(2);
this.fluidOnEyes = new HashSet();
diff --git a/src/main/java/net/minecraft/world/entity/animal/Squid.java b/src/main/java/net/minecraft/world/entity/animal/Squid.java
index 891d8b4c8cb73d5e310970066831ab3e2af14e91..f60c4cd0543fd5d50fa7e2c1a9e8381227adb540 100644
index 891d8b4c8cb73d5e310970066831ab3e2af14e91..4f32597c7af34d599f6658fe4962d41624e60419 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Squid.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Squid.java
@@ -44,7 +44,7 @@ public class Squid extends WaterAnimal {
@ -107,7 +107,7 @@ index 891d8b4c8cb73d5e310970066831ab3e2af14e91..f60c4cd0543fd5d50fa7e2c1a9e83812
public Squid(EntityType<? extends Squid> type, Level world) {
super(type, world);
- this.random.setSeed((long)this.getId());
+ //this.random.setSeed((long)this.getId()); // Paper - we set the random to shared, do not clobber the seed
+ //this.random.setSeed((long)this.getId()); // Paper - Share random for entities to make them more random
this.tentacleSpeed = 1.0F / (this.random.nextFloat() + 1.0F) * 0.2F;
}

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Configurable spawn chances for skeleton horses
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 68035b041157ddbfcbefbcc3a2a3e2a18c558c2c..148d1a15e861a26c8fd49204f9bd9821f3cde2fd 100644
index 5a5bb0daf8074a428f18e01bb522a46e4672b2a6..817e0ddc8821dd112fc5aa72bbbe11fdd1b56488 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -851,7 +851,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
@ -13,7 +13,7 @@ index 68035b041157ddbfcbefbcc3a2a3e2a18c558c2c..148d1a15e861a26c8fd49204f9bd9821
if (this.isRainingAt(blockposition)) {
DifficultyInstance difficultydamagescaler = this.getCurrentDifficultyAt(blockposition);
- boolean flag1 = this.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING) && this.random.nextDouble() < (double) difficultydamagescaler.getEffectiveDifficulty() * 0.01D && !this.getBlockState(blockposition.below()).is(Blocks.LIGHTNING_ROD);
+ boolean flag1 = this.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING) && this.random.nextDouble() < (double) difficultydamagescaler.getEffectiveDifficulty() * this.paperConfig().entities.spawning.skeletonHorseThunderSpawnChance.or(0.01D) && !this.getBlockState(blockposition.below()).is(Blocks.LIGHTNING_ROD); // Paper
+ boolean flag1 = this.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING) && this.random.nextDouble() < (double) difficultydamagescaler.getEffectiveDifficulty() * this.paperConfig().entities.spawning.skeletonHorseThunderSpawnChance.or(0.01D) && !this.getBlockState(blockposition.below()).is(Blocks.LIGHTNING_ROD); // Paper - Configurable spawn chances for skeleton horses
if (flag1) {
SkeletonHorse entityhorseskeleton = (SkeletonHorse) EntityType.SKELETON_HORSE.create(this);

View File

@ -6,31 +6,31 @@ Subject: [PATCH] Only process BlockPhysicsEvent if a plugin has a listener
Saves on some object allocation and processing when no plugin listens to this
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 8072eedb5bc699aa5b04fbca39f4db30534cde4b..62a40958f3cd1fa42073071e23e4307beccad722 100644
index 1c0238932eec690d369dc9d55069f8b6aa15ada3..53a135f9f61a29ddfff5aa7eb20b96a2f0fc1fdf 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1447,6 +1447,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
while (iterator.hasNext()) {
ServerLevel worldserver = (ServerLevel) iterator.next();
+ worldserver.hasPhysicsEvent = org.bukkit.event.block.BlockPhysicsEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper
+ worldserver.hasPhysicsEvent = org.bukkit.event.block.BlockPhysicsEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper - BlockPhysicsEvent
this.profiler.push(() -> {
return worldserver + " " + worldserver.dimension().location();
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 2fe69d7f530adaba026d3903f109987ac8d7da8d..404193d1a674ae8e92b4fcf5efdec6052fff21b4 100644
index 817e0ddc8821dd112fc5aa72bbbe11fdd1b56488..181a4e0e44cd05528c66ce87b653c33d6bd2fd03 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -221,6 +221,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
// CraftBukkit start
public final LevelStorageSource.LevelStorageAccess convertable;
public final UUID uuid;
+ public boolean hasPhysicsEvent = true; // Paper
+ public boolean hasPhysicsEvent = true; // Paper - BlockPhysicsEvent
@Override public LevelChunk getChunkIfLoaded(int x, int z) { // Paper - this was added in world too but keeping here for NMS ABI
public LevelChunk getChunkIfLoaded(int x, int z) {
return this.chunkSource.getChunk(x, z, false);
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 0af602c33d9940a0db68b2245e8caed2d78518fe..cd3a99585a471981b9fa1f614ddddfce570ee0e7 100644
index 48357a6af14af74195bd6c77488f7f1dc84221cf..1b1a4b91e7185013e9969fdb3a6582a5a6895663 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -583,7 +583,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@ -38,7 +38,7 @@ index 0af602c33d9940a0db68b2245e8caed2d78518fe..cd3a99585a471981b9fa1f614ddddfce
iblockdata1.updateIndirectNeighbourShapes(this, blockposition, k, j - 1); // Don't call an event for the old block to limit event spam
CraftWorld world = ((ServerLevel) this).getWorld();
- if (world != null) {
+ if (world != null && ((ServerLevel)this).hasPhysicsEvent) { // Paper
+ if (world != null && ((ServerLevel)this).hasPhysicsEvent) { // Paper - BlockPhysicsEvent
BlockPhysicsEvent event = new BlockPhysicsEvent(world.getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()), CraftBlockData.fromData(iblockdata));
this.getCraftServer().getPluginManager().callEvent(event);

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Entity AddTo/RemoveFrom World Events
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index f95d4fc714b98a86d732d16f0b783cd943ce0c15..ab55b028239f75b23a3e3fee10305a7896c2522b 100644
index 181a4e0e44cd05528c66ce87b653c33d6bd2fd03..449f2ebc77a1850fc948bffc66e605f7bdc8efdd 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -2415,6 +2415,7 @@ public class ServerLevel extends Level implements WorldGenLevel {

View File

@ -6,7 +6,7 @@ Subject: [PATCH] EntityPathfindEvent
Fires when an Entity decides to start moving to a location.
diff --git a/src/main/java/net/minecraft/world/entity/ai/navigation/FlyingPathNavigation.java b/src/main/java/net/minecraft/world/entity/ai/navigation/FlyingPathNavigation.java
index 3db41017c6690d4519564496edd8e7365b2f5a22..027eef4ace908147285c8d72b612d16e4f925672 100644
index 3db41017c6690d4519564496edd8e7365b2f5a22..e35c38feb62c3345d82636081decc09db9f061ab 100644
--- a/src/main/java/net/minecraft/world/entity/ai/navigation/FlyingPathNavigation.java
+++ b/src/main/java/net/minecraft/world/entity/ai/navigation/FlyingPathNavigation.java
@@ -40,7 +40,7 @@ public class FlyingPathNavigation extends PathNavigation {
@ -14,12 +14,12 @@ index 3db41017c6690d4519564496edd8e7365b2f5a22..027eef4ace908147285c8d72b612d16e
@Override
public Path createPath(Entity entity, int distance) {
- return this.createPath(entity.blockPosition(), distance);
+ return this.createPath(entity.blockPosition(), entity, distance); // Paper - Forward target entity
+ return this.createPath(entity.blockPosition(), entity, distance); // Paper - EntityPathfindEvent
}
@Override
diff --git a/src/main/java/net/minecraft/world/entity/ai/navigation/GroundPathNavigation.java b/src/main/java/net/minecraft/world/entity/ai/navigation/GroundPathNavigation.java
index 12564909abff7da4e5a4bb3d004a7ede2ffda12d..ac996b066415e461af1fcb71b19807401179c7f8 100644
index 12564909abff7da4e5a4bb3d004a7ede2ffda12d..47de460ff5435ea6712c800c77093126908d0fce 100644
--- a/src/main/java/net/minecraft/world/entity/ai/navigation/GroundPathNavigation.java
+++ b/src/main/java/net/minecraft/world/entity/ai/navigation/GroundPathNavigation.java
@@ -41,7 +41,7 @@ public class GroundPathNavigation extends PathNavigation {
@ -27,7 +27,7 @@ index 12564909abff7da4e5a4bb3d004a7ede2ffda12d..ac996b066415e461af1fcb71b1980740
@Override
- public Path createPath(BlockPos target, int distance) {
+ public Path createPath(BlockPos target, @javax.annotation.Nullable Entity entity, int distance) { // Paper
+ public Path createPath(BlockPos target, @javax.annotation.Nullable Entity entity, int distance) { // Paper - EntityPathfindEvent
LevelChunk levelChunk = this.level.getChunkSource().getChunkNow(SectionPos.blockToSectionCoord(target.getX()), SectionPos.blockToSectionCoord(target.getZ()));
if (levelChunk == null) {
return null;
@ -36,7 +36,7 @@ index 12564909abff7da4e5a4bb3d004a7ede2ffda12d..ac996b066415e461af1fcb71b1980740
if (blockPos.getY() > this.level.getMinBuildHeight()) {
- return super.createPath(blockPos.above(), distance);
+ return super.createPath(blockPos.above(), entity, distance); // Paper
+ return super.createPath(blockPos.above(), entity, distance); // Paper - EntityPathfindEvent
}
while(blockPos.getY() < this.level.getMaxBuildHeight() && levelChunk.getBlockState(blockPos).isAir()) {
@ -45,14 +45,14 @@ index 12564909abff7da4e5a4bb3d004a7ede2ffda12d..ac996b066415e461af1fcb71b1980740
if (!levelChunk.getBlockState(target).isSolid()) {
- return super.createPath(target, distance);
+ return super.createPath(target, entity, distance); // Paper
+ return super.createPath(target, entity, distance); // Paper - EntityPathfindEvent
} else {
BlockPos blockPos2;
for(blockPos2 = target.above(); blockPos2.getY() < this.level.getMaxBuildHeight() && levelChunk.getBlockState(blockPos2).isSolid(); blockPos2 = blockPos2.above()) {
}
- return super.createPath(blockPos2, distance);
+ return super.createPath(blockPos2, entity, distance); // Paper
+ return super.createPath(blockPos2, entity, distance); // Paper - EntityPathfindEvent
}
}
}
@ -60,12 +60,12 @@ index 12564909abff7da4e5a4bb3d004a7ede2ffda12d..ac996b066415e461af1fcb71b1980740
@Override
public Path createPath(Entity entity, int distance) {
- return this.createPath(entity.blockPosition(), distance);
+ return this.createPath(entity.blockPosition(), entity, distance); // Paper - Forward target entity
+ return this.createPath(entity.blockPosition(), entity, distance); // Paper - EntityPathfindEvent
}
private int getSurfaceY() {
diff --git a/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java b/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java
index fa19df17967f57b5ac99b8eee9d38864c0b7a1bb..d14b329e5bccf13139c32f71da274082efc7199c 100644
index fa19df17967f57b5ac99b8eee9d38864c0b7a1bb..85b3da93b6dd8e1a40d884db0721f30b9b237c69 100644
--- a/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java
+++ b/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java
@@ -110,7 +110,13 @@ public abstract class PathNavigation {
@ -73,13 +73,13 @@ index fa19df17967f57b5ac99b8eee9d38864c0b7a1bb..d14b329e5bccf13139c32f71da274082
@Nullable
public Path createPath(BlockPos target, int distance) {
- return this.createPath(ImmutableSet.of(target), 8, false, distance);
+ // Paper start - add target entity parameter
+ // Paper start - EntityPathfindEvent
+ return this.createPath(target, null, distance);
+ }
+ @Nullable
+ public Path createPath(BlockPos target, @Nullable Entity entity, int distance) {
+ return this.createPath(ImmutableSet.of(target), entity, 8, false, distance);
+ // Paper end
+ // Paper end - EntityPathfindEvent
}
@Nullable
@ -88,14 +88,15 @@ index fa19df17967f57b5ac99b8eee9d38864c0b7a1bb..d14b329e5bccf13139c32f71da274082
@Nullable
public Path createPath(Entity entity, int distance) {
- return this.createPath(ImmutableSet.of(entity.blockPosition()), 16, true, distance);
+ return this.createPath(ImmutableSet.of(entity.blockPosition()), entity, 16, true, distance); // Paper
+ return this.createPath(ImmutableSet.of(entity.blockPosition()), entity, 16, true, distance); // Paper - EntityPathfindEvent
}
@Nullable
@@ -130,6 +136,16 @@ public abstract class PathNavigation {
@@ -130,6 +136,17 @@ public abstract class PathNavigation {
@Nullable
protected Path createPath(Set<BlockPos> positions, int range, boolean useHeadPos, int distance, float followRange) {
+ // Paper start - EntityPathfindEvent
+ return this.createPath(positions, null, range, useHeadPos, distance, followRange);
+ }
+
@ -105,15 +106,15 @@ index fa19df17967f57b5ac99b8eee9d38864c0b7a1bb..d14b329e5bccf13139c32f71da274082
+ }
+
+ @Nullable protected Path createPath(Set<BlockPos> positions, @Nullable Entity target, int range, boolean useHeadPos, int distance, float followRange) {
+ // Paper end
+ // Paper end - EntityPathfindEvent
if (positions.isEmpty()) {
return null;
} else if (this.mob.getY() < (double)this.level.getMinBuildHeight()) {
@@ -139,6 +155,23 @@ public abstract class PathNavigation {
@@ -139,6 +156,23 @@ public abstract class PathNavigation {
} else if (this.path != null && !this.path.isDone() && positions.contains(this.targetPos)) {
return this.path;
} else {
+ // Paper start - Pathfind event
+ // Paper start - EntityPathfindEvent
+ boolean copiedSet = false;
+ for (BlockPos possibleTarget : positions) {
+ if (!new com.destroystokyo.paper.event.entity.EntityPathfindEvent(this.mob.getBukkitEntity(),
@ -129,12 +130,12 @@ index fa19df17967f57b5ac99b8eee9d38864c0b7a1bb..d14b329e5bccf13139c32f71da274082
+ }
+ }
+ }
+ // Paper end
+ // Paper end - EntityPathfindEvent
this.level.getProfiler().push("pathfind");
BlockPos blockPos = useHeadPos ? this.mob.blockPosition().above() : this.mob.blockPosition();
int i = (int)(followRange + (float)range);
diff --git a/src/main/java/net/minecraft/world/entity/ai/navigation/WallClimberNavigation.java b/src/main/java/net/minecraft/world/entity/ai/navigation/WallClimberNavigation.java
index e9b49c72aa73dfcef6c136d9ed7bb5044fe8405d..2d1b2b84d7cf5bafe2cccfa0dec2bae805dbe7cf 100644
index e9b49c72aa73dfcef6c136d9ed7bb5044fe8405d..185550dce31b3b31a1d1dfcebb29147131bfad66 100644
--- a/src/main/java/net/minecraft/world/entity/ai/navigation/WallClimberNavigation.java
+++ b/src/main/java/net/minecraft/world/entity/ai/navigation/WallClimberNavigation.java
@@ -16,9 +16,9 @@ public class WallClimberNavigation extends GroundPathNavigation {
@ -142,10 +143,10 @@ index e9b49c72aa73dfcef6c136d9ed7bb5044fe8405d..2d1b2b84d7cf5bafe2cccfa0dec2bae8
@Override
- public Path createPath(BlockPos target, int distance) {
+ public Path createPath(BlockPos target, @Nullable Entity entity, int distance) { // Paper
+ public Path createPath(BlockPos target, @Nullable Entity entity, int distance) { // Paper - EntityPathfindEvent
this.pathToPosition = target;
- return super.createPath(target, distance);
+ return super.createPath(target, entity, distance); // Paper
+ return super.createPath(target, entity, distance); // Paper - EntityPathfindEvent
}
@Override

View File

@ -1,7 +1,7 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Antony Riley <antony@cyberiantiger.org>
Date: Tue, 29 Mar 2016 08:22:55 +0300
Subject: [PATCH] Sanitise RegionFileCache and make configurable.
Subject: [PATCH] Sanitise RegionFileCache and make configurable
RegionFileCache prior to this patch would close every single open region
file upon reaching a size of 256.
@ -11,7 +11,7 @@ The implementation uses a LinkedHashMap as an LRU cache (modified from HashMap).
The maximum size of the RegionFileCache is also made configurable.
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
index 2d00333f25828ef5912c925d1213a56c564d85c9..465ad0bae446a20e941e8f2dbf2d85f2627482b9 100644
index fa592d5db10dbd4824de74658655ef61230ed431..e9cfbee008c1dda2eeac55196d490984fa62ab09 100644
--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
@@ -92,7 +92,7 @@ public class RegionFileStorage implements AutoCloseable {
@ -19,7 +19,7 @@ index 2d00333f25828ef5912c925d1213a56c564d85c9..465ad0bae446a20e941e8f2dbf2d85f2
}
// Paper end - cache regionfile does not exist state
- if (this.regionCache.size() >= 256) {
+ if (this.regionCache.size() >= io.papermc.paper.configuration.GlobalConfiguration.get().misc.regionFileCacheSize) { // Paper - configurable
+ if (this.regionCache.size() >= io.papermc.paper.configuration.GlobalConfiguration.get().misc.regionFileCacheSize) { // Paper - Sanitise RegionFileCache and make configurable.
((RegionFile) this.regionCache.removeLast()).close();
}

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Do not load chunks for Pathfinding
diff --git a/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java b/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java
index cd6778fa1d4261caf846ae71702621d2ec6b98c1..8e90b284fb576738b834626bb52c9962ccbc5ad2 100644
index cd6778fa1d4261caf846ae71702621d2ec6b98c1..dbb6a7d950b1a6f58a845b4d399ead6eb6d4fe14 100644
--- a/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java
+++ b/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java
@@ -465,7 +465,12 @@ public class WalkNodeEvaluator extends NodeEvaluator {
@ -13,12 +13,12 @@ index cd6778fa1d4261caf846ae71702621d2ec6b98c1..8e90b284fb576738b834626bb52c9962
if (l != 0 || n != 0) {
pos.set(i + l, j + m, k + n);
- BlockState blockState = world.getBlockState(pos);
+ // Paper start
+ // Paper start - Do not load chunks during pathfinding
+ BlockState blockState = world.getBlockStateIfLoaded(pos);
+ if (blockState == null) {
+ return BlockPathTypes.BLOCKED;
+ } else {
+ // Paper end
+ // Paper end - Do not load chunks during pathfinding
if (blockState.is(Blocks.CACTUS) || blockState.is(Blocks.SWEET_BERRY_BUSH)) {
return BlockPathTypes.DANGER_OTHER;
}
@ -35,8 +35,8 @@ index cd6778fa1d4261caf846ae71702621d2ec6b98c1..8e90b284fb576738b834626bb52c9962
protected static BlockPathTypes getBlockPathTypeRaw(BlockGetter world, BlockPos pos) {
- BlockState blockState = world.getBlockState(pos);
+ BlockState blockState = world.getBlockStateIfLoaded(pos); // Paper
+ if (blockState == null) return BlockPathTypes.BLOCKED; // Paper
+ BlockState blockState = world.getBlockStateIfLoaded(pos); // Paper - Do not load chunks during pathfinding
+ if (blockState == null) return BlockPathTypes.BLOCKED; // Paper - Do not load chunks during pathfinding
Block block = blockState.getBlock();
if (blockState.isAir()) {
return BlockPathTypes.OPEN;

View File

@ -9,20 +9,20 @@ of a variety of blocks that are random ticked.
Co-authored-by: MrPowerGamerBR <git@mrpowergamerbr.com>
diff --git a/src/main/java/net/minecraft/world/level/block/FarmBlock.java b/src/main/java/net/minecraft/world/level/block/FarmBlock.java
index 3ce4bb344dbb8b50ef4041801e034e79f0b0d19d..6c1e8ba518c883aa5c079b4c94f068833609acc3 100644
index 3ce4bb344dbb8b50ef4041801e034e79f0b0d19d..66106b821d7a384a2eb0f27993beb9f4257e6815 100644
--- a/src/main/java/net/minecraft/world/level/block/FarmBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/FarmBlock.java
@@ -92,6 +92,8 @@ public class FarmBlock extends Block {
@Override
public void randomTick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) {
int i = (Integer) state.getValue(FarmBlock.MOISTURE);
+ if (i > 0 && world.paperConfig().tickRates.wetFarmland != 1 && (world.paperConfig().tickRates.wetFarmland < 1 || (net.minecraft.server.MinecraftServer.currentTick + pos.hashCode()) % world.paperConfig().tickRates.wetFarmland != 0)) { return; } // Paper
+ if (i == 0 && world.paperConfig().tickRates.dryFarmland != 1 && (world.paperConfig().tickRates.dryFarmland < 1 || (net.minecraft.server.MinecraftServer.currentTick + pos.hashCode()) % world.paperConfig().tickRates.dryFarmland != 0)) { return; } // Paper
+ if (i > 0 && world.paperConfig().tickRates.wetFarmland != 1 && (world.paperConfig().tickRates.wetFarmland < 1 || (net.minecraft.server.MinecraftServer.currentTick + pos.hashCode()) % world.paperConfig().tickRates.wetFarmland != 0)) { return; } // Paper - Configurable random tick rates for blocks
+ if (i == 0 && world.paperConfig().tickRates.dryFarmland != 1 && (world.paperConfig().tickRates.dryFarmland < 1 || (net.minecraft.server.MinecraftServer.currentTick + pos.hashCode()) % world.paperConfig().tickRates.dryFarmland != 0)) { return; } // Paper - Configurable random tick rates for blocks
if (!FarmBlock.isNearWater(world, pos) && !world.isRainingAt(pos.above())) {
if (i > 0) {
diff --git a/src/main/java/net/minecraft/world/level/block/SpreadingSnowyDirtBlock.java b/src/main/java/net/minecraft/world/level/block/SpreadingSnowyDirtBlock.java
index 65db2229dae0547c7a3e2847bba7b1a1795ce30f..f38524cbcaa908644d901bf0929331d6dfd99ed9 100644
index 65db2229dae0547c7a3e2847bba7b1a1795ce30f..4e2e80006bd4edae227af7be5ca8e3284b7494f6 100644
--- a/src/main/java/net/minecraft/world/level/block/SpreadingSnowyDirtBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/SpreadingSnowyDirtBlock.java
@@ -3,6 +3,7 @@ package net.minecraft.world.level.block;
@ -37,7 +37,7 @@ index 65db2229dae0547c7a3e2847bba7b1a1795ce30f..f38524cbcaa908644d901bf0929331d6
@Override
public void randomTick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) {
+ if (this instanceof GrassBlock && world.paperConfig().tickRates.grassSpread != 1 && (world.paperConfig().tickRates.grassSpread < 1 || (MinecraftServer.currentTick + pos.hashCode()) % world.paperConfig().tickRates.grassSpread != 0)) { return; } // Paper
+ if (this instanceof GrassBlock && world.paperConfig().tickRates.grassSpread != 1 && (world.paperConfig().tickRates.grassSpread < 1 || (MinecraftServer.currentTick + pos.hashCode()) % world.paperConfig().tickRates.grassSpread != 0)) { return; } // Paper - Configurable random tick rates for blocks
if (!SpreadingSnowyDirtBlock.canBeGrass(state, world, pos)) {
// CraftBukkit start
if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(world, pos, Blocks.DIRT.defaultBlockState()).isCancelled()) {

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Fix Cancelling BlockPlaceEvent triggering physics
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index ab55b028239f75b23a3e3fee10305a7896c2522b..3379c481659b28671779f5434b31523941cb620e 100644
index 449f2ebc77a1850fc948bffc66e605f7bdc8efdd..ad9b4e88e2aaa5d7e70f65536c86742beafc91df 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1623,6 +1623,7 @@ public class ServerLevel extends Level implements WorldGenLevel {

View File

@ -11,7 +11,7 @@ After: http://i.imgur.com/nJ46crB.png
Optimize redundant converting of static fields into an unsigned long each call by precomputing it in ctor
diff --git a/src/main/java/net/minecraft/util/SimpleBitStorage.java b/src/main/java/net/minecraft/util/SimpleBitStorage.java
index f677cc252d5510a2365e73dc42bd266e56115e83..2b3fd62dca2d1475075b5dcde56cea85b749cb44 100644
index f677cc252d5510a2365e73dc42bd266e56115e83..18d8f3114831310c5f10da43d4333849d4eb6cae 100644
--- a/src/main/java/net/minecraft/util/SimpleBitStorage.java
+++ b/src/main/java/net/minecraft/util/SimpleBitStorage.java
@@ -11,8 +11,8 @@ public class SimpleBitStorage implements BitStorage {
@ -20,8 +20,8 @@ index f677cc252d5510a2365e73dc42bd266e56115e83..2b3fd62dca2d1475075b5dcde56cea85
private final int valuesPerLong;
- private final int divideMul;
- private final int divideAdd;
+ private final int divideMul; private final long divideMulUnsigned; // Paper - referenced in b(int) with 2 Integer.toUnsignedLong calls
+ private final int divideAdd; private final long divideAddUnsigned; // Paper
+ private final int divideMul; private final long divideMulUnsigned; // Paper - Perf: Optimize SimpleBitStorage; referenced in b(int) with 2 Integer.toUnsignedLong calls
+ private final int divideAdd; private final long divideAddUnsigned; // Paper - Perf: Optimize SimpleBitStorage
private final int divideShift;
public SimpleBitStorage(int elementBits, int size, int[] data) {
@ -31,8 +31,8 @@ index f677cc252d5510a2365e73dc42bd266e56115e83..2b3fd62dca2d1475075b5dcde56cea85
int i = 3 * (this.valuesPerLong - 1);
- this.divideMul = MAGIC[i + 0];
- this.divideAdd = MAGIC[i + 1];
+ this.divideMul = MAGIC[i + 0]; this.divideMulUnsigned = Integer.toUnsignedLong(this.divideMul); // Paper
+ this.divideAdd = MAGIC[i + 1]; this.divideAddUnsigned = Integer.toUnsignedLong(this.divideAdd); // Paper
+ this.divideMul = MAGIC[i + 0]; this.divideMulUnsigned = Integer.toUnsignedLong(this.divideMul); // Paper - Perf: Optimize SimpleBitStorage
+ this.divideAdd = MAGIC[i + 1]; this.divideAddUnsigned = Integer.toUnsignedLong(this.divideAdd); // Paper - Perf: Optimize SimpleBitStorage
this.divideShift = MAGIC[i + 2];
int j = (size + this.valuesPerLong - 1) / this.valuesPerLong;
if (data != null) {
@ -43,18 +43,18 @@ index f677cc252d5510a2365e73dc42bd266e56115e83..2b3fd62dca2d1475075b5dcde56cea85
- long l = Integer.toUnsignedLong(this.divideMul);
- long m = Integer.toUnsignedLong(this.divideAdd);
- return (int)((long)index * l + m >> 32 >> this.divideShift);
+ //long l = Integer.toUnsignedLong(this.divideMul); // Paper
+ //long m = Integer.toUnsignedLong(this.divideAdd); // Paper
+ return (int) ((long) index * this.divideMulUnsigned + this.divideAddUnsigned >> 32 >> this.divideShift); // Paper
+ //long l = Integer.toUnsignedLong(this.divideMul); // Paper - Perf: Optimize SimpleBitStorage
+ //long m = Integer.toUnsignedLong(this.divideAdd); // Paper - Perf: Optimize SimpleBitStorage
+ return (int) ((long) index * this.divideMulUnsigned + this.divideAddUnsigned >> 32 >> this.divideShift); // Paper - Perf: Optimize SimpleBitStorage
}
@Override
- public int getAndSet(int index, int value) {
- Validate.inclusiveBetween(0L, (long)(this.size - 1), (long)index);
- Validate.inclusiveBetween(0L, this.mask, (long)value);
+ public final int getAndSet(int index, int value) { // Paper - make final for inline
+ //Validate.inclusiveBetween(0L, (long)(this.size - 1), (long)index); // Paper
+ //Validate.inclusiveBetween(0L, this.mask, (long)value); // Paper
+ public final int getAndSet(int index, int value) { // Paper - Perf: Optimize SimpleBitStorage
+ //Validate.inclusiveBetween(0L, (long)(this.size - 1), (long)index); // Paper - Perf: Optimize SimpleBitStorage
+ //Validate.inclusiveBetween(0L, this.mask, (long)value); // Paper - Perf: Optimize SimpleBitStorage
int i = this.cellIndex(index);
long l = this.data[i];
int j = (index - i * this.valuesPerLong) * this.bits;
@ -65,9 +65,9 @@ index f677cc252d5510a2365e73dc42bd266e56115e83..2b3fd62dca2d1475075b5dcde56cea85
- public void set(int index, int value) {
- Validate.inclusiveBetween(0L, (long)(this.size - 1), (long)index);
- Validate.inclusiveBetween(0L, this.mask, (long)value);
+ public final void set(int index, int value) { // Paper - make final for inline
+ //Validate.inclusiveBetween(0L, (long)(this.size - 1), (long)index); // Paper
+ //Validate.inclusiveBetween(0L, this.mask, (long)value); // Paper
+ public final void set(int index, int value) { // Paper - Perf: Optimize SimpleBitStorage
+ //Validate.inclusiveBetween(0L, (long)(this.size - 1), (long)index); // Paper - Perf: Optimize SimpleBitStorage
+ //Validate.inclusiveBetween(0L, this.mask, (long)value); // Paper - Perf: Optimize SimpleBitStorage
int i = this.cellIndex(index);
long l = this.data[i];
int j = (index - i * this.valuesPerLong) * this.bits;
@ -77,13 +77,13 @@ index f677cc252d5510a2365e73dc42bd266e56115e83..2b3fd62dca2d1475075b5dcde56cea85
@Override
- public int get(int index) {
- Validate.inclusiveBetween(0L, (long)(this.size - 1), (long)index);
+ public final int get(int index) { // Paper - make final for inline
+ //Validate.inclusiveBetween(0L, (long)(this.size - 1), (long)index);
+ public final int get(int index) { // Paper - Perf: Optimize SimpleBitStorage
+ //Validate.inclusiveBetween(0L, (long)(this.size - 1), (long)index); - Perf: Optimize SimpleBitStorage
int i = this.cellIndex(index);
long l = this.data[i];
int j = (index - i * this.valuesPerLong) * this.bits;
diff --git a/src/main/java/net/minecraft/util/ZeroBitStorage.java b/src/main/java/net/minecraft/util/ZeroBitStorage.java
index 0710c72441c832a93275f3f9bd9dd7643dc0f229..f0f764f36fb92c64ab2dc8a0a50c3f48321c3c9a 100644
index 0710c72441c832a93275f3f9bd9dd7643dc0f229..b7a3f15dc1ed9e9322a86921052984c7cbd3262a 100644
--- a/src/main/java/net/minecraft/util/ZeroBitStorage.java
+++ b/src/main/java/net/minecraft/util/ZeroBitStorage.java
@@ -13,21 +13,21 @@ public class ZeroBitStorage implements BitStorage {
@ -93,9 +93,9 @@ index 0710c72441c832a93275f3f9bd9dd7643dc0f229..f0f764f36fb92c64ab2dc8a0a50c3f48
- public int getAndSet(int index, int value) {
- Validate.inclusiveBetween(0L, (long)(this.size - 1), (long)index);
- Validate.inclusiveBetween(0L, 0L, (long)value);
+ public final int getAndSet(int index, int value) { // Paper - make final for inline
+ //Validate.inclusiveBetween(0L, (long)(this.size - 1), (long)index); // Paper
+ //Validate.inclusiveBetween(0L, 0L, (long)value); // Paper
+ public final int getAndSet(int index, int value) { // Paper - Perf: Optimize SimpleBitStorage
+ //Validate.inclusiveBetween(0L, (long)(this.size - 1), (long)index); // Paper - Perf: Optimize SimpleBitStorage
+ //Validate.inclusiveBetween(0L, 0L, (long)value); // Paper - Perf: Optimize SimpleBitStorage
return 0;
}
@ -103,16 +103,16 @@ index 0710c72441c832a93275f3f9bd9dd7643dc0f229..f0f764f36fb92c64ab2dc8a0a50c3f48
- public void set(int index, int value) {
- Validate.inclusiveBetween(0L, (long)(this.size - 1), (long)index);
- Validate.inclusiveBetween(0L, 0L, (long)value);
+ public final void set(int index, int value) { // Paper - make final for inline
+ //Validate.inclusiveBetween(0L, (long)(this.size - 1), (long)index); // Paper
+ //Validate.inclusiveBetween(0L, 0L, (long)value); // Paper
+ public final void set(int index, int value) { // Paper - Perf: Optimize SimpleBitStorage
+ //Validate.inclusiveBetween(0L, (long)(this.size - 1), (long)index); // Paper - Perf: Optimize SimpleBitStorage
+ //Validate.inclusiveBetween(0L, 0L, (long)value); // Paper - Perf: Optimize SimpleBitStorage
}
@Override
- public int get(int index) {
- Validate.inclusiveBetween(0L, (long)(this.size - 1), (long)index);
+ public final int get(int index) { // Paper - make final for inline
+ //Validate.inclusiveBetween(0L, (long)(this.size - 1), (long)index); // Paper
+ public final int get(int index) { // Paper - Perf: Optimize SimpleBitStorage
+ //Validate.inclusiveBetween(0L, (long)(this.size - 1), (long)index); // Paper - Perf: Optimize SimpleBitStorage
return 0;
}

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Configurable Player Collision
diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundSetPlayerTeamPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundSetPlayerTeamPacket.java
index 3d2a689d11bfa230bab61a2a65c6051328f6b78d..e52644010dc2cf41bbf508b16b8ec2f0003e9d0b 100644
index 3d2a689d11bfa230bab61a2a65c6051328f6b78d..cf31771648549ab6d7e4e38b30409ca48a976bea 100644
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundSetPlayerTeamPacket.java
+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundSetPlayerTeamPacket.java
@@ -193,7 +193,7 @@ public class ClientboundSetPlayerTeamPacket implements Packet<ClientGamePacketLi
@ -13,19 +13,19 @@ index 3d2a689d11bfa230bab61a2a65c6051328f6b78d..e52644010dc2cf41bbf508b16b8ec2f0
buf.writeByte(this.options);
buf.writeUtf(this.nametagVisibility);
- buf.writeUtf(this.collisionRule);
+ buf.writeUtf(!io.papermc.paper.configuration.GlobalConfiguration.get().collisions.enablePlayerCollisions ? "never" : this.collisionRule); // Paper
+ buf.writeUtf(!io.papermc.paper.configuration.GlobalConfiguration.get().collisions.enablePlayerCollisions ? "never" : this.collisionRule); // Paper - Configurable player collision
buf.writeEnum(this.color);
buf.writeComponent(this.playerPrefix);
buf.writeComponent(this.playerSuffix);
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 180bcaa2b5a74c527d8556301fb4a8161c76a64c..24f7ecc68c206346e4e2957bc27bf5579ba1b663 100644
index 53a135f9f61a29ddfff5aa7eb20b96a2f0fc1fdf..9697e189cf79994ed7d231c7801761791c128310 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -621,6 +621,20 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.server.getPluginManager().callEvent(new org.bukkit.event.world.WorldLoadEvent(worldserver.getWorld()));
}
+ // Paper start - Handle collideRule team for player collision toggle
+ // Paper start - Configurable player collision; Handle collideRule team for player collision toggle
+ final ServerScoreboard scoreboard = this.getScoreboard();
+ final java.util.Collection<String> toRemove = scoreboard.getPlayerTeams().stream().filter(team -> team.getName().startsWith("collideRule_")).map(net.minecraft.world.scores.PlayerTeam::getName).collect(java.util.stream.Collectors.toList());
+ for (String teamName : toRemove) {
@ -37,20 +37,20 @@ index 180bcaa2b5a74c527d8556301fb4a8161c76a64c..24f7ecc68c206346e4e2957bc27bf557
+ net.minecraft.world.scores.PlayerTeam collideTeam = scoreboard.addPlayerTeam(this.getPlayerList().collideRuleTeamName);
+ collideTeam.setSeeFriendlyInvisibles(false); // Because we want to mimic them not being on a team at all
+ }
+ // Paper end
+ // Paper end - Configurable player collision
+
this.server.enablePlugins(org.bukkit.plugin.PluginLoadOrder.POSTWORLD);
this.server.getPluginManager().callEvent(new ServerLoadEvent(ServerLoadEvent.LoadType.STARTUP));
this.connection.acceptConnections();
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index b74689297ca20efee391fe1da80377082d1758e5..828abde34c7d883831e81b7759a862db43cfe2c6 100644
index ffd73624360e76caef477aeb0074fc8eba13c1c6..e3195f03ac449e6e4870489d530ef40918cd5556 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -156,6 +156,7 @@ public abstract class PlayerList {
// CraftBukkit start
private CraftServer cserver;
private final Map<String,ServerPlayer> playersByName = new java.util.HashMap<>();
+ public @Nullable String collideRuleTeamName; // Paper - Team name used for collideRule
+ public @Nullable String collideRuleTeamName; // Paper - Configurable player collision
public PlayerList(MinecraftServer server, LayeredRegistryAccess<RegistryLayer> registryManager, PlayerDataStorage saveHandler, int maxPlayers) {
this.cserver = server.server = new CraftServer((DedicatedServer) server, this);
@ -58,13 +58,13 @@ index b74689297ca20efee391fe1da80377082d1758e5..828abde34c7d883831e81b7759a862db
player.initInventoryMenu();
// CraftBukkit - Moved from above, added world
+ // Paper start - Add to collideRule team if needed
+ // Paper start - Configurable player collision; Add to collideRule team if needed
+ final net.minecraft.world.scores.Scoreboard scoreboard = this.getServer().getLevel(Level.OVERWORLD).getScoreboard();
+ final PlayerTeam collideRuleTeam = scoreboard.getPlayerTeam(this.collideRuleTeamName);
+ if (this.collideRuleTeamName != null && collideRuleTeam != null && player.getTeam() == null) {
+ scoreboard.addPlayerToTeam(player.getScoreboardName(), collideRuleTeam);
+ }
+ // Paper end
+ // Paper end - Configurable player collision
PlayerList.LOGGER.info("{}[{}] logged in with entity id {} at ([{}]{}, {}, {})", player.getName().getString(), s1, player.getId(), worldserver1.serverLevelData.getLevelName(), player.getX(), player.getY(), player.getZ());
}
@ -72,7 +72,7 @@ index b74689297ca20efee391fe1da80377082d1758e5..828abde34c7d883831e81b7759a862db
entityplayer.doTick(); // SPIGOT-924
// CraftBukkit end
+ // Paper start - Remove from collideRule team if needed
+ // Paper start - Configurable player collision; Remove from collideRule team if needed
+ if (this.collideRuleTeamName != null) {
+ final net.minecraft.world.scores.Scoreboard scoreBoard = this.server.getLevel(Level.OVERWORLD).getScoreboard();
+ final PlayerTeam team = scoreBoard.getPlayersTeam(this.collideRuleTeamName);
@ -80,7 +80,7 @@ index b74689297ca20efee391fe1da80377082d1758e5..828abde34c7d883831e81b7759a862db
+ scoreBoard.removePlayerFromTeam(entityplayer.getScoreboardName(), team);
+ }
+ }
+ // Paper end
+ // Paper end - Configurable player collision
+
this.save(entityplayer);
if (entityplayer.isPassenger()) {
@ -89,13 +89,13 @@ index b74689297ca20efee391fe1da80377082d1758e5..828abde34c7d883831e81b7759a862db
}
// CraftBukkit end
+ // Paper start - Remove collideRule team if it exists
+ // Paper start - Configurable player collision; Remove collideRule team if it exists
+ if (this.collideRuleTeamName != null) {
+ final net.minecraft.world.scores.Scoreboard scoreboard = this.getServer().getLevel(Level.OVERWORLD).getScoreboard();
+ final PlayerTeam team = scoreboard.getPlayersTeam(this.collideRuleTeamName);
+ if (team != null) scoreboard.removePlayerTeam(team);
+ }
+ // Paper end
+ // Paper end - Configurable player collision
}
// CraftBukkit start

View File

@ -6,14 +6,14 @@ Subject: [PATCH] Add handshake event to allow plugins to handle client
diff --git a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
index 4a649a2006f907c9b7542843ec6938d9375ca645..0d9658b1c6b5912a34058c0ce53b8e7f8c28afac 100644
index 5dedfeaa6cc683b5fc6c21f842265b8aea64fa58..ce51bde4db395ff30c7d75e3badd68d6395fa40f 100644
--- a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
@@ -89,9 +89,44 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL
this.connection.disconnect(ichatmutablecomponent);
} else {
this.connection.setListener(new ServerLoginPacketListenerImpl(this.server, this.connection));
+ // Paper start - handshake event
+ // Paper start - PlayerHandshakeEvent
+ boolean proxyLogicEnabled = org.spigotmc.SpigotConfig.bungee;
+ boolean handledByEvent = false;
+ // Try and handle the handshake through the event
@ -50,7 +50,7 @@ index 4a649a2006f907c9b7542843ec6938d9375ca645..0d9658b1c6b5912a34058c0ce53b8e7f
- if (org.spigotmc.SpigotConfig.bungee) {
+ // Don't try and handle default logic if it's been handled by the event.
+ if (!handledByEvent && proxyLogicEnabled) {
+ // Paper end
+ // Paper end - PlayerHandshakeEvent
+ // if (org.spigotmc.SpigotConfig.bungee) { // Paper - comment out, we check above!
if ( ( split.length == 3 || split.length == 4 ) && ( ServerHandshakePacketListenerImpl.HOST_PATTERN.matcher( split[1] ).matches() ) ) {
this.connection.hostname = split[0];

View File

@ -9,14 +9,14 @@ For servers with multiple IP's, ability to bind to a specific interface.
public net.minecraft.server.dedicated.Settings getStringRaw(Ljava/lang/String;)Ljava/lang/String;
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java
index d64ac84d4c5ef3dd3054a601deee128d3069686b..7edce6f8d1f313a9e1e100704d625e317f779fa0 100644
index d64ac84d4c5ef3dd3054a601deee128d3069686b..90fe26a546eeebf90ccf7f899103346cdb3ae702 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java
@@ -108,6 +108,8 @@ public class DedicatedServerProperties extends Settings<DedicatedServerPropertie
private final DedicatedServerProperties.WorldDimensionData worldDimensionData;
public final WorldOptions worldOptions;
+ public final String rconIp; // Paper - Add rcon ip
+ public final String rconIp; // Paper - Configurable rcon ip
+
// CraftBukkit start
public DedicatedServerProperties(Properties properties, OptionSet optionset) {
@ -28,7 +28,7 @@ index d64ac84d4c5ef3dd3054a601deee128d3069686b..7edce6f8d1f313a9e1e100704d625e31
+ // Paper start - Configurable rcon ip
+ final String rconIp = this.getStringRaw("rcon.ip");
+ this.rconIp = rconIp == null ? this.serverIp : rconIp;
+ // Paper end
+ // Paper end - Configurable rcon ip
}
// CraftBukkit start

View File

@ -5,14 +5,14 @@ Subject: [PATCH] Add ability to configure frosted_ice properties
diff --git a/src/main/java/net/minecraft/world/level/block/FrostedIceBlock.java b/src/main/java/net/minecraft/world/level/block/FrostedIceBlock.java
index 5c8f0751def701359b388eabeb14d1dc83438c5a..0d08a9d5555ebc296a1461aefbf48e8eee6b462d 100644
index 5c8f0751def701359b388eabeb14d1dc83438c5a..f3ec0f8b8faca6aa073e76af2477f78ac3034518 100644
--- a/src/main/java/net/minecraft/world/level/block/FrostedIceBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/FrostedIceBlock.java
@@ -40,6 +40,7 @@ public class FrostedIceBlock extends IceBlock {
@Override
public void tick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) {
+ if (!world.paperConfig().environment.frostedIce.enabled) return; // Paper - add ability to disable frosted ice
+ if (!world.paperConfig().environment.frostedIce.enabled) return; // Paper - Frosted ice options
if ((random.nextInt(3) == 0 || this.fewerNeigboursThan(world, pos, 4)) && world.getMaxLocalRawBrightness(pos) > 11 - state.getValue(AGE) - state.getLightBlock(world, pos) && this.slightlyMelt(state, world, pos)) {
BlockPos.MutableBlockPos mutableBlockPos = new BlockPos.MutableBlockPos();
@ -21,13 +21,13 @@ index 5c8f0751def701359b388eabeb14d1dc83438c5a..0d08a9d5555ebc296a1461aefbf48e8e
BlockState blockState = world.getBlockState(mutableBlockPos);
if (blockState.is(this) && !this.slightlyMelt(blockState, world, mutableBlockPos)) {
- world.scheduleTick(mutableBlockPos, this, Mth.nextInt(random, 20, 40));
+ world.scheduleTick(mutableBlockPos, this, Mth.nextInt(random, world.paperConfig().environment.frostedIce.delay.min, world.paperConfig().environment.frostedIce.delay.max)); // Paper - use configurable min/max delay
+ world.scheduleTick(mutableBlockPos, this, Mth.nextInt(random, world.paperConfig().environment.frostedIce.delay.min, world.paperConfig().environment.frostedIce.delay.max)); // Paper - Frosted ice options
}
}
} else {
- world.scheduleTick(pos, this, Mth.nextInt(random, 20, 40));
+ world.scheduleTick(pos, this, Mth.nextInt(random, world.paperConfig().environment.frostedIce.delay.min, world.paperConfig().environment.frostedIce.delay.max)); // Paper - use configurable min/max delay
+ world.scheduleTick(pos, this, Mth.nextInt(random, world.paperConfig().environment.frostedIce.delay.min, world.paperConfig().environment.frostedIce.delay.max)); // Paper - Frosted ice options
}
}

View File

@ -13,7 +13,7 @@ custom renderers are in use, defaulting to the much simpler Vanilla system.
Additionally, numerous issues to player position tracking on maps has been fixed.
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 3379c481659b28671779f5434b31523941cb620e..eb7c37da48b4b06d24f4f02132a5d5ac89de658b 100644
index ad9b4e88e2aaa5d7e70f65536c86742beafc91df..adb4e72652605f25b25dcd5690fbe7bb499c8809 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -2436,6 +2436,7 @@ public class ServerLevel extends Level implements WorldGenLevel {

View File

@ -5,14 +5,14 @@ Subject: [PATCH] Don't save empty scoreboard teams to scoreboard.dat
diff --git a/src/main/java/net/minecraft/world/scores/ScoreboardSaveData.java b/src/main/java/net/minecraft/world/scores/ScoreboardSaveData.java
index 28e631be85fb06245e152e1f5e0bae16b7358cfd..b49d60d20d170d16a7daf2bc874e5d8d04552b3e 100644
index 28e631be85fb06245e152e1f5e0bae16b7358cfd..6c3ed29e13ea78ceb1c9bb11ce0d9938bb8b4c62 100644
--- a/src/main/java/net/minecraft/world/scores/ScoreboardSaveData.java
+++ b/src/main/java/net/minecraft/world/scores/ScoreboardSaveData.java
@@ -148,6 +148,7 @@ public class ScoreboardSaveData extends SavedData {
ListTag listTag = new ListTag();
for(PlayerTeam playerTeam : this.scoreboard.getPlayerTeams()) {
+ if (!io.papermc.paper.configuration.GlobalConfiguration.get().scoreboards.saveEmptyScoreboardTeams && playerTeam.getPlayers().isEmpty()) continue; // Paper
+ if (!io.papermc.paper.configuration.GlobalConfiguration.get().scoreboards.saveEmptyScoreboardTeams && playerTeam.getPlayers().isEmpty()) continue; // Paper - Don't save empty scoreboard teams to scoreboard.dat
CompoundTag compoundTag = new CompoundTag();
compoundTag.putString("Name", playerTeam.getName());
compoundTag.putString("DisplayName", Component.Serializer.toJson(playerTeam.getDisplayName()));

View File

@ -1,7 +1,7 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 1 May 2016 21:19:14 -0400
Subject: [PATCH] LootTable API & Replenishable Lootables Feature
Subject: [PATCH] LootTable API and replenishable lootables
Provides an API to control the loot table for an object.
Also provides a feature that any Lootable Inventory (Chests in Structures)
@ -504,12 +504,12 @@ index 0000000000000000000000000000000000000000..9cfa5d36a6991067a3866e0d437749fa
+ }
+}
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 39ef390739c4bde28c87c1b83610602a86afd6ad..edbfc7bc783833a62542a4515dde13034ae29c10 100644
index 6d3c575d12b3c1cc7c06a4cf1b671a2de894892a..34bd4a3f8639295d4980d2b36fe07e2be0ec0d1e 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -238,6 +238,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
}
// Paper end
// Paper end - Share random for entities to make them more random
+ public com.destroystokyo.paper.loottable.PaperLootableInventoryData lootableData; // Paper
private CraftEntity bukkitEntity;

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Async GameProfileCache saving
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 3ecb45c98bfbc189e8235e980b14ee6b11536cc5..77ea9b316f186243c74cc080cc7c382ab6666a21 100644
index da845f0e07e1541514c60252192d49a85163b1a8..3410a2b68146f34f37446c9daeb20f8860b37292 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -960,7 +960,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@ -13,12 +13,12 @@ index 3ecb45c98bfbc189e8235e980b14ee6b11536cc5..77ea9b316f186243c74cc080cc7c382a
if (org.spigotmc.SpigotConfig.saveUserCacheOnStopOnly) {
MinecraftServer.LOGGER.info("Saving usercache.json");
- this.getProfileCache().save();
+ this.getProfileCache().save(false); // Paper
+ this.getProfileCache().save(false); // Paper - Perf: Async GameProfileCache saving
}
// Spigot end
io.papermc.paper.chunk.system.io.RegionFileIOThread.close(true); // Paper // Paper - rewrite chunk system
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index a267ab0b217573373d7b6a1f48cadab0f431da40..772d7c1e398538b8bbbd70aedaba05199d11b358 100644
index 69e8a7551762ab6de03f43d823e2149f5f9eca70..1df4c9b12852ac05652260678597d13ced40f80d 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -242,7 +242,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
@ -26,12 +26,12 @@ index a267ab0b217573373d7b6a1f48cadab0f431da40..772d7c1e398538b8bbbd70aedaba0519
if (this.convertOldUsers()) {
- this.getProfileCache().save();
+ this.getProfileCache().save(false); // Paper
+ this.getProfileCache().save(false); // Paper - Perf: Async GameProfileCache saving
}
if (!OldUsersConverter.serverReadyAfterUserconversion(this)) {
diff --git a/src/main/java/net/minecraft/server/players/GameProfileCache.java b/src/main/java/net/minecraft/server/players/GameProfileCache.java
index f5ac34923eb29a4d8df59d35f3381cdf08f74cf6..1924757cec5d7f2d13ef35f9bbe1554d786713d7 100644
index f5ac34923eb29a4d8df59d35f3381cdf08f74cf6..370cf30a6411577ec8ed7a32e473217e2f64782b 100644
--- a/src/main/java/net/minecraft/server/players/GameProfileCache.java
+++ b/src/main/java/net/minecraft/server/players/GameProfileCache.java
@@ -117,7 +117,7 @@ public class GameProfileCache {
@ -39,7 +39,7 @@ index f5ac34923eb29a4d8df59d35f3381cdf08f74cf6..1924757cec5d7f2d13ef35f9bbe1554d
this.safeAdd(usercache_usercacheentry);
- if( !org.spigotmc.SpigotConfig.saveUserCacheOnStopOnly ) this.save(); // Spigot - skip saving if disabled
+ if( !org.spigotmc.SpigotConfig.saveUserCacheOnStopOnly ) this.save(true); // Spigot - skip saving if disabled // Paper - async
+ if( !org.spigotmc.SpigotConfig.saveUserCacheOnStopOnly ) this.save(true); // Spigot - skip saving if disabled // Paper - Perf: Async GameProfileCache saving
}
private long getNextOperation() {
@ -48,7 +48,7 @@ index f5ac34923eb29a4d8df59d35f3381cdf08f74cf6..1924757cec5d7f2d13ef35f9bbe1554d
if (flag && !org.spigotmc.SpigotConfig.saveUserCacheOnStopOnly) { // Spigot - skip saving if disabled
- this.save();
+ this.save(true); // Paper
+ this.save(true); // Paper - Perf: Async GameProfileCache saving
}
return optional;
@ -57,7 +57,7 @@ index f5ac34923eb29a4d8df59d35f3381cdf08f74cf6..1924757cec5d7f2d13ef35f9bbe1554d
}
- public void save() {
+ public void save(boolean asyncSave) { // Paper
+ public void save(boolean asyncSave) { // Paper - Perf: Async GameProfileCache saving
JsonArray jsonarray = new JsonArray();
DateFormat dateformat = GameProfileCache.createDateFormat();
@ -65,7 +65,7 @@ index f5ac34923eb29a4d8df59d35f3381cdf08f74cf6..1924757cec5d7f2d13ef35f9bbe1554d
jsonarray.add(GameProfileCache.writeGameProfile(usercache_usercacheentry, dateformat));
});
String s = this.gson.toJson(jsonarray);
+ Runnable save = () -> { // Paper
+ Runnable save = () -> { // Paper - Perf: Async GameProfileCache saving
try {
BufferedWriter bufferedwriter = Files.newWriter(this.file, StandardCharsets.UTF_8);
@ -73,14 +73,14 @@ index f5ac34923eb29a4d8df59d35f3381cdf08f74cf6..1924757cec5d7f2d13ef35f9bbe1554d
} catch (IOException ioexception) {
;
}
+ // Paper start
+ // Paper start - Perf: Async GameProfileCache saving
+ };
+ if (asyncSave) {
+ io.papermc.paper.util.MCUtil.scheduleAsyncTask(save);
+ } else {
+ save.run();
+ }
+ // Paper end
+ // Paper end - Perf: Async GameProfileCache saving
}

View File

@ -4,28 +4,15 @@ Date: Sun, 22 May 2016 20:20:55 -0500
Subject: [PATCH] Optional TNT doesn't move in water
diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java
index fb16216b54eea81fceaf3edafa69b554ad01c807..90d2fa5b90d64ddb28075a50f4478b464a29a285 100644
--- a/src/main/java/net/minecraft/server/level/ServerEntity.java
+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java
@@ -73,7 +73,7 @@ public class ServerEntity {
@Nullable
private List<SynchedEntityData.DataValue<?>> trackedDataValues;
// CraftBukkit start
- private final Set<ServerPlayerConnection> trackedPlayers;
+ final Set<ServerPlayerConnection> trackedPlayers; // Paper - private -> package
public ServerEntity(ServerLevel worldserver, Entity entity, int i, boolean flag, Consumer<Packet<?>> consumer, Set<ServerPlayerConnection> trackedPlayers) {
this.trackedPlayers = trackedPlayers;
diff --git a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
index 5c3b86e2301079e775971aa4da6a8f2dc6a40d1f..d9ed22e9853eebdf6c517b41787a27a1a56a0871 100644
index 5c3b86e2301079e775971aa4da6a8f2dc6a40d1f..fe51d34f9d764ed4bff4a2a0c566e132dde36e55 100644
--- a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
+++ b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
@@ -106,6 +106,27 @@ public class PrimedTnt extends Entity implements TraceableEntity {
}
}
+ // Paper start - Optional prevent TNT from moving in water
+ // Paper start - Option to prevent TNT from moving in water
+ if (!this.isRemoved() && this.wasTouchingWater && this.level().paperConfig().fixes.preventTntFromMovingInWater) {
+ /*
+ * Author: Jedediah Smith <jedediah@silencegreys.com>
@ -45,7 +32,7 @@ index 5c3b86e2301079e775971aa4da6a8f2dc6a40d1f..d9ed22e9853eebdf6c517b41787a27a1
+ });
+ }
+ }
+ // Paper end
+ // Paper end - Option to prevent TNT from moving in water
}
private void explode() {
@ -54,10 +41,10 @@ index 5c3b86e2301079e775971aa4da6a8f2dc6a40d1f..d9ed22e9853eebdf6c517b41787a27a1
return (BlockState) this.entityData.get(PrimedTnt.DATA_BLOCK_STATE_ID);
}
+
+ // Paper start - Optional prevent TNT from moving in water
+ // Paper start - Option to prevent TNT from moving in water
+ @Override
+ public boolean isPushedByFluid() {
+ return !level().paperConfig().fixes.preventTntFromMovingInWater && super.isPushedByFluid();
+ }
+ // Paper end
+ // Paper end - Option to prevent TNT from moving in water
}

View File

@ -11,7 +11,7 @@ Co-authored-by: lexikiq <noellekiq@gmail.com>
Co-authored-by: Aikar <aikar@aikar.co>
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index eb7c37da48b4b06d24f4f02132a5d5ac89de658b..c63df0042b23e3728d5283b563889225691f6d56 100644
index adb4e72652605f25b25dcd5690fbe7bb499c8809..d96be9d3a24a5eb89fc2a7180b6d7e236e7c2448 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1557,7 +1557,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
@ -81,7 +81,7 @@ index 5bc68514a1e8a212e2681f06b918548c0ec565b6..1977e702f6af39ebf100c1f2f2edc2d1
double deltaLength = Math.sqrt(distanceSquared);
double relativeX = player.getX() + (deltaX / deltaLength) * viewDistance;
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index f093a271cc0b5a0e1f55930d2b3b48161abc9185..cbb531c7993bd5062255564e6e6546afb948f6ed 100644
index 50f9c4c2974b0a0150068c334e0537e69c0de8f7..36c6a79628ec16eb1ef018e541ed1bec2126bbe6 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -1366,4 +1366,15 @@ public abstract class Level implements LevelAccessor, AutoCloseable {

View File

@ -13,11 +13,11 @@ by adding code to all overrides in:
to return BLOCKED if it is outside the world border.
diff --git a/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java b/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java
index d14b329e5bccf13139c32f71da274082efc7199c..68edd488087a6ec1e65797cfbd4118bd0efbab50 100644
index 85b3da93b6dd8e1a40d884db0721f30b9b237c69..c3b406e6302ae0ac1ef56253ab614ca201a7a1c8 100644
--- a/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java
+++ b/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java
@@ -158,7 +158,7 @@ public abstract class PathNavigation {
// Paper start - Pathfind event
@@ -159,7 +159,7 @@ public abstract class PathNavigation {
// Paper start - EntityPathfindEvent
boolean copiedSet = false;
for (BlockPos possibleTarget : positions) {
- if (!new com.destroystokyo.paper.event.entity.EntityPathfindEvent(this.mob.getBukkitEntity(),

View File

@ -16,7 +16,7 @@ public net.minecraft.world.entity.projectile.Projectile cachedOwner
public net.minecraft.world.entity.projectile.Projectile ownerUUID
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 9f958136a8a4c4632ad8ca359860681448653176..294a8eac85e49e9fa0e39b87f3954787b05fe30d 100644
index d96be9d3a24a5eb89fc2a7180b6d7e236e7c2448..b974d917879a42d8df4bca4cbb505cb599c6f2ff 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -2368,6 +2368,12 @@ public class ServerLevel extends Level implements WorldGenLevel {

View File

@ -10,7 +10,7 @@ Adds an option to control the force mode of the particle.
This adds a new Builder API which is much friendlier to use.
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index c6fd543d03813d6edc12aa919e77bb9a7c7315e7..d5ff2037fd2756da1aac9660e65453913be172cd 100644
index b974d917879a42d8df4bca4cbb505cb599c6f2ff..a306269019b6b8ff6f24cbc3f209f2359ac668fe 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1742,12 +1742,17 @@ public class ServerLevel extends Level implements WorldGenLevel {
@ -34,7 +34,7 @@ index c6fd543d03813d6edc12aa919e77bb9a7c7315e7..d5ff2037fd2756da1aac9660e6545391
if (this.sendParticles(entityplayer, force, d0, d1, d2, packetplayoutworldparticles)) { // CraftBukkit
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 35ac3878b4391da29e248d26a6c76bf1582ea09d..c8e13ea3bc256b112fa5fd916c0fb583322c081b 100644
index e60992a618f05174f887ce85741a127161cef408..6abf000543cb842ff43f0adbde035fff595e553d 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -1948,13 +1948,20 @@ public class CraftWorld extends CraftRegionAccessor implements World {

View File

@ -7,7 +7,7 @@ Allows you to determine why an inventory was closed, enabling plugin developers
to "confirm" things based on if it was player triggered close or not.
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index d5ff2037fd2756da1aac9660e65453913be172cd..0bb2ed82e8a3dffa9fd9d7aa41685dd50dafac0c 100644
index a306269019b6b8ff6f24cbc3f209f2359ac668fe..9e967dac4db56e6b0713b7351a1cd0896e757c7e 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1474,7 +1474,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
@ -29,7 +29,7 @@ index d5ff2037fd2756da1aac9660e65453913be172cd..0bb2ed82e8a3dffa9fd9d7aa41685dd5
}
// Spigot End
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 3014467f1c9159e04afd0bb816e02af6599f1f71..e144adc6e5e2a195174ed7617c29993804ab87ff 100644
index 708d1033306da34844827854edaf8a68ed67a936..0bdb75f733896335b87a19eb4d29024186e2d4d0 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -692,7 +692,7 @@ public class ServerPlayer extends Player {
@ -75,7 +75,7 @@ index 3014467f1c9159e04afd0bb816e02af6599f1f71..e144adc6e5e2a195174ed7617c299938
this.doCloseContainer();
}
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index c1c9076be05cd4b0b19d16aabbf0320c2531cca1..d1c2dad79f6e265e184d374494b3f45414c5fafc 100644
index 51d5bed032f89333917accca242772a09ee98d93..678c46517757e3f37d5051fc88c481cbe8bf861b 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -219,6 +219,7 @@ import org.bukkit.event.inventory.ClickType;
@ -104,7 +104,7 @@ index c1c9076be05cd4b0b19d16aabbf0320c2531cca1..d1c2dad79f6e265e184d374494b3f454
this.player.doCloseContainer();
}
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 782cc6d910efe5bc5498d0083afab42fad6c4fa2..b4643717c98193884a43089ec7a7e362b7153d20 100644
index 99ba7c82f8a8db9d5841cce18ed5f39439b512b0..5517f873e709b6f3b9206f0ad0212a9524f2c691 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -518,7 +518,7 @@ public abstract class PlayerList {
@ -117,7 +117,7 @@ index 782cc6d910efe5bc5498d0083afab42fad6c4fa2..b4643717c98193884a43089ec7a7e362
PlayerQuitEvent playerQuitEvent = new PlayerQuitEvent(entityplayer.getBukkitEntity(), net.kyori.adventure.text.Component.translatable("multiplayer.player.left", net.kyori.adventure.text.format.NamedTextColor.YELLOW, io.papermc.paper.configuration.GlobalConfiguration.get().messages.useDisplayNameInQuitMessage ? entityplayer.getBukkitEntity().displayName() : io.papermc.paper.adventure.PaperAdventure.asAdventure(entityplayer.getDisplayName()))); // Paper - Adventure
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
index 0704fad49e680d3274b23024497963c4d0ad353b..636c8d53e5c07f5d75881113b8cfb366a007a162 100644
index 2ec9d75ad64c40cb4577151a050c534e38226b72..0c34063bdbfa70d65b3548e5ea800ef088a5444d 100644
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
@@ -265,7 +265,7 @@ public abstract class Player extends LivingEntity {
@ -173,7 +173,7 @@ index 092d2bfab7e8fd9840e853f09adc85311ab29046..af6f8d11f0384c353332f5c5bb0967e5
@Override
public boolean isBlocking() {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index f929327522b98c12823ebbf94531c1c3681b1efa..f0392f2562ee2b65011da556dbe1a8369c5f954c 100644
index bcbe11807186d2d79a155f6be7bda029ca5f555d..91ca962588fffc486ca44289f2eb0bac6fcd808d 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -1194,7 +1194,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Add Debug Entities option to debug dupe uuid issues
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index c9e3e104cd051a38e367653dc6c4f969665fc250..45ee0cd242271883412284625230822d9c8a5452 100644
index 422ef83670f7c4a2e5b0da48dc0906ad96b8ece0..e4936a70d3a686e5cba0ea9d878f6e09fbee713d 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -878,6 +878,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@ -26,7 +26,7 @@ index c9e3e104cd051a38e367653dc6c4f969665fc250..45ee0cd242271883412284625230822d
protected void tick() {
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 0bb2ed82e8a3dffa9fd9d7aa41685dd50dafac0c..8168a9a3f2b166775a531e7f834710669845d0ae 100644
index 9e967dac4db56e6b0713b7351a1cd0896e757c7e..2a7d7881a200e12ae9369bb2d704aecce9322e52 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1436,6 +1436,12 @@ public class ServerLevel extends Level implements WorldGenLevel {
@ -43,7 +43,7 @@ index 0bb2ed82e8a3dffa9fd9d7aa41685dd50dafac0c..8168a9a3f2b166775a531e7f83471066
// WorldServer.LOGGER.warn("Tried to add entity {} but it was marked as removed already", EntityTypes.getKey(entity.getType())); // CraftBukkit
return false;
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index ad2e61c7fd7906477e30e91c826d9ce4fb6bffc0..bbb6abd5a51a0ffef41f2ee38eb6d7a21d1c6c23 100644
index 47ba1f8fbbe3e5a052028ee1dbff31844bc61f78..72478a84e1dca85bb9694ea9816a1acc09c8ff5f 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -241,6 +241,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S

View File

@ -22,7 +22,7 @@ index 2eddeb8d5239bbfeefbf4d3bd363f1ad083299b6..e2b44b8ddb8afc6e1f7dddadb434c226
});
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 8168a9a3f2b166775a531e7f834710669845d0ae..4d468f34cfff2162928928d2e093502a2142189f 100644
index 2a7d7881a200e12ae9369bb2d704aecce9322e52..2010cc573b447d79552b64d61acfe8a668007a2f 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1442,6 +1442,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
@ -34,7 +34,7 @@ index 8168a9a3f2b166775a531e7f834710669845d0ae..4d468f34cfff2162928928d2e093502a
// WorldServer.LOGGER.warn("Tried to add entity {} but it was marked as removed already", EntityTypes.getKey(entity.getType())); // CraftBukkit
return false;
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 3748e7d8267f659cb4942e54efa7e993fa4a99b5..2670d20fce0e1c3e1930f3e4dc18c22b7cc1e0ec 100644
index a7119e1bccf009428e74cd3375bc61555062e408..f4e1fe5e5a12e5a3547a2e0305814ea60160c3fc 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -223,6 +223,11 @@ public abstract class PlayerList {
@ -59,13 +59,13 @@ index 3748e7d8267f659cb4942e54efa7e993fa4a99b5..2670d20fce0e1c3e1930f3e4dc18c22b
});
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 4b9cb1c85ed17250f145e815d5c40cf09b34e4d2..546f1ba9bb5e4c6135d8205d7421aeae0a3bbd89 100644
index 797c1c9db2fabd3f0ca6a37a17a368f63f144eb4..7abdfeacec4787819e2e66d3b8a322b750d203f7 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -237,6 +237,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
}
}
// Paper end
// Paper end - Share random for entities to make them more random
+ public org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason spawnReason; // Paper - Entity#getEntitySpawnReason
public com.destroystokyo.paper.loottable.PaperLootableInventoryData lootableData; // Paper
@ -108,7 +108,7 @@ index 4b9cb1c85ed17250f145e815d5c40cf09b34e4d2..546f1ba9bb5e4c6135d8205d7421aeae
} catch (Throwable throwable) {
diff --git a/src/main/java/net/minecraft/world/level/BaseSpawner.java b/src/main/java/net/minecraft/world/level/BaseSpawner.java
index 713608239cc7518d05b04d3dd79c3af0c358c64e..0d04581b73a9daa91bbcb0ef0b28d601fc0e9599 100644
index 388a66e37c9f1d9c62e0c8977a2d5b9068c58fe7..1bc11de2144bc8e0a313e753bbfeed571132d9d5 100644
--- a/src/main/java/net/minecraft/world/level/BaseSpawner.java
+++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java
@@ -189,6 +189,7 @@ public abstract class BaseSpawner {

View File

@ -6,7 +6,7 @@ Subject: [PATCH] Configurable Keep Spawn Loaded range per world
This lets you disable it for some worlds and lower it for others.
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index cef1554db34a1d917fa5c7bbccfe22efd93bebfd..f92e4d6cfae684b5c8df6424d63a574cb17ef6b7 100644
index f3a66cd277a3950b75076fd5f80f159f6eb4dd1c..fe6098ffcd63e4bb28c223c5693482b47c6a2331 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -768,30 +768,33 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@ -62,7 +62,7 @@ index cef1554db34a1d917fa5c7bbccfe22efd93bebfd..f92e4d6cfae684b5c8df6424d63a574c
// this.updateMobSpawningFlags();
worldserver.setSpawnSettings(this.isSpawningMonsters(), this.isSpawningAnimals());
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 4d468f34cfff2162928928d2e093502a2142189f..d2bf0cc0b5434a8f9ab84d9b12825c96531dfbe7 100644
index 2010cc573b447d79552b64d61acfe8a668007a2f..659a5395d55df0457a8565b9f1907d34d868be8a 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1879,12 +1879,84 @@ public class ServerLevel extends Level implements WorldGenLevel {
@ -190,7 +190,7 @@ index 4d2348df25410a0b5364eec066880326d6667dad..3754cda7e7731935893359d84f3ae061
this.maxCount = i * i;
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index c71a82ec42c7edd51979c9636205a931c56c6117..0b7f3c3df526372e5c249ba3c1bb04343fe86e48 100644
index 50d0d854159396064ee8ee7de5a7f885d8cc13a4..f72409e92cbf00c5665037bf4916ddbd352d66d5 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -1407,15 +1407,21 @@ public class CraftWorld extends CraftRegionAccessor implements World {

View File

@ -6,7 +6,7 @@ Subject: [PATCH] Optimise EntityGetter#getPlayerByUUID
Use the PlayerList map instead of iterating over all players
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index d2bf0cc0b5434a8f9ab84d9b12825c96531dfbe7..b3e1ac038eba2153b3358f6d79861ee73b576fe8 100644
index 659a5395d55df0457a8565b9f1907d34d868be8a..262335dfd4ea0315e43e0a055a7259916bb6ee37 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -555,6 +555,15 @@ public class ServerLevel extends Level implements WorldGenLevel {

View File

@ -18,7 +18,7 @@ public net.minecraft.world.entity.Entity isInsidePortal
public net.minecraft.world.entity.LivingEntity jumping
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index e29c63bb29a07259c23acdb700a680344bd22672..68d6274d9b78138da228f6ce74a6c6b34eced2b0 100644
index 262335dfd4ea0315e43e0a055a7259916bb6ee37..77cd3c3381c7aa12fbde8fbced0b830aabadf42f 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -2,7 +2,6 @@ package net.minecraft.server.level;
@ -112,7 +112,7 @@ index e29c63bb29a07259c23acdb700a680344bd22672..68d6274d9b78138da228f6ce74a6c6b3
} else {
passenger.stopRiding();
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 8d1f1c694a6ad073597934531db57fa11c99fc1c..0d51b57a302d908cfc40ff3a2e0b7c616a1a6113 100644
index 7abdfeacec4787819e2e66d3b8a322b750d203f7..10b338c9feae7d1360573d4be58be42a0b3203f5 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -397,6 +397,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@ -340,7 +340,7 @@ index b149e8bcac034bb3fc118a9adcb0de45e18ed5e9..fc35cfc9d045f3e5b6a50af1d0ba83b6
+
}
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 92c85ed4eb72b950fc819b5d47ca379697ff864b..d86f158bdaefe6a71c8f48fe44c7370de158e2ea 100644
index 53cbe0e86acf2c5b329e4805875a8b1db94c0a25..fe500eb9ec252a213bd45746f984288a64eb6056 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -162,6 +162,12 @@ public abstract class Level implements LevelAccessor, AutoCloseable {

View File

@ -1104,7 +1104,7 @@ index 90ec22d35edb2874417bbea590e0d3c37ad93d64..fc230d835f9aa526a4b179d36d921f0f
public ClientboundLevelChunkWithLightPacket(FriendlyByteBuf buf) {
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 5f6eca4e652ab96a8697e908d11a66e4eb551409..9530ce54cfba964f7f27e5837797146af86e4ff7 100644
index 77cd3c3381c7aa12fbde8fbced0b830aabadf42f..f4262817adfcbf1fa2db4e930b8b3a2879d99baf 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -569,7 +569,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
@ -1117,7 +1117,7 @@ index 5f6eca4e652ab96a8697e908d11a66e4eb551409..9530ce54cfba964f7f27e5837797146a
this.convertable = convertable_conversionsession;
this.uuid = WorldUUID.getUUID(convertable_conversionsession.levelDirectory.path().toFile());
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
index 32327f639b3cc10444ad122fb3405174e32c4f01..3629f164f05cc2d33c76bb21cfe4598539aa08e0 100644
index deef24ad28ecf7895aa03bf8dae085814d307ece..99784bac05ea0d2ea1e9053466e21c1175fe0a4b 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
@@ -49,7 +49,7 @@ import org.bukkit.event.player.PlayerInteractEvent;
@ -1155,7 +1155,7 @@ index 5de5209e04d631bd6a50e28e8d3abebf148252c1..19b3f4fa7678a038bf25efc2a8b46dda
DebugPackets.sendPoiPacketsForChunk(world, chunkPos);
}
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 12d9bcbd37b7ef67f2b922a13da7dbc3ba9838c1..7cf24513f2e09c72742bdb0d7866103f983027b5 100644
index fe500eb9ec252a213bd45746f984288a64eb6056..1540a00e28e95f74dd46b62bdb30840d0e674e01 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -177,6 +177,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@ -1217,7 +1217,7 @@ index 5e8d2e4245757a0889645ea79ee68afb53f7dde4..f7e5e016a7028a9196e689e950805b0d
}
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
index 86eff98a4f73fc1eb1f5f977204aa9307aa54013..e599bfb9a7b0b85bea2940f6bf55118305dd0ce8 100644
index 2f4eccd75479562060c3ce8208ae0d55bb744f65..f76ed2035fb08143e70cd9962c368cf8f3d5af8c 100644
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
@@ -91,7 +91,7 @@ public class LevelChunk extends ChunkAccess {
@ -1558,7 +1558,7 @@ index 545b14f02ac72dda30891d681eba585d19fd5e1d..6dc7e23e96aaffb912611a9dbd41459c
private static final byte[] EMPTY_LIGHT = new byte[2048];
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 01fa200bc6911388ee3b0e700e82ad681e02fe4a..217fd2af254f7206cf4c1d7d7ad08384a38427d2 100644
index eba4767efb8ebe373c8f8898d6dd7f9f759d4ce3..4ba05f0448bcb75d9c334758a5482b0cab8cc9d7 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -2373,7 +2373,7 @@ public final class CraftServer implements Server {
@ -1571,7 +1571,7 @@ index 01fa200bc6911388ee3b0e700e82ad681e02fe4a..217fd2af254f7206cf4c1d7d7ad08384
@Override
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 86f31b8356e1632537d34b39c105d01958eba23a..9896ea05523f6fb75213c861c9cf3962976cce88 100644
index 76dd24fe01b0b7052db60fa531c977fe2a361254..40c9f9a0e1a2b126160428124b3430b56f5a0b83 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -421,11 +421,16 @@ public class CraftWorld extends CraftRegionAccessor implements World {

View File

@ -300,7 +300,7 @@ index 0000000000000000000000000000000000000000..95d6022c9cfb2e36ec5a71be6e343540
+ }
+}
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index 70f15e3af9e954483ab116500f84a9ee17f67ce4..56fe3f4edd15239533a1ae9287e86528b3296bdc 100644
index 3b11d7e3ccb9f9ca289355d4dab235d2040fcd06..a2220291f6d0726019187c2fc93bca801a3f0610 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -292,6 +292,7 @@ public class ServerChunkCache extends ChunkSource {
@ -312,7 +312,7 @@ index 70f15e3af9e954483ab116500f84a9ee17f67ce4..56fe3f4edd15239533a1ae9287e86528
chunkproviderserver_b.managedBlock(completablefuture::isDone);
io.papermc.paper.chunk.system.scheduling.ChunkTaskScheduler.popChunkWait(); // Paper - async chunk debug // Paper - rewrite chunk system
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 9530ce54cfba964f7f27e5837797146af86e4ff7..50bdb4596eecf04738817b46a125097bc1d3b45b 100644
index f4262817adfcbf1fa2db4e930b8b3a2879d99baf..5b8d3588fa062df8ccbfcd08af7918ab5c8487a3 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -648,6 +648,13 @@ public class ServerLevel extends Level implements WorldGenLevel {

View File

@ -7,7 +7,7 @@ Suspected case would be around the technique used in .stopRiding
Stack will identify any causer of this and warn instead of crashing.
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 19f1432ae1405eee0ee56dec151e7d602816a943..37e6b841b3c3d8720a1947065d4fada8c25ec2cf 100644
index 2b9a1a178233fb7cfb4d58853ff3176cb1236d3a..e3146ae94ae55764fcd7ec650a44d457889c179d 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -989,6 +989,13 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@ -25,7 +25,7 @@ index 19f1432ae1405eee0ee56dec151e7d602816a943..37e6b841b3c3d8720a1947065d4fada8
EntityType<?> entitytypes = entity.getType();
int i = entitytypes.clientTrackingRange() * 16;
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 50bdb4596eecf04738817b46a125097bc1d3b45b..1b92cee2f51b844340d213ccfc78d1524a71c9dc 100644
index 5b8d3588fa062df8ccbfcd08af7918ab5c8487a3..97a04d12acbf0d6eb8f9f4ecc45085570f74a0f5 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -2496,7 +2496,7 @@ public class ServerLevel extends Level implements WorldGenLevel {

View File

@ -7,10 +7,10 @@ Prevents pathfinding from spamming failures for things such as
arrow attacks.
diff --git a/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java b/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java
index 68edd488087a6ec1e65797cfbd4118bd0efbab50..a9922074b6aa6a9898615385bb11d2a758662970 100644
index c3b406e6302ae0ac1ef56253ab614ca201a7a1c8..a04fb58c29b462e20ed0b702cef478e3985b7cd2 100644
--- a/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java
+++ b/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java
@@ -192,9 +192,29 @@ public abstract class PathNavigation {
@@ -193,9 +193,29 @@ public abstract class PathNavigation {
return this.moveTo(this.createPath(x, y, z, 1), speed);
}

View File

@ -55,7 +55,7 @@ index 0a75cba1b0b5a85826bd60615e3f09d2f41cc6a3..b5dcb539548ca35d7c8a076d474a5c67
// CraftBukkit end
public boolean isRealPlayer; // Paper
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 05983ba80532f3c0235af7e712948edf4d8f021b..dc6774fdc215de6a157b64678aec5a79344084e9 100644
index c04db4712ac4127cffe250e404eed9198b377429..4be466a21fb1fb936e1eaa6351e30a53c7b5cbb4 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -295,6 +295,12 @@ public abstract class PlayerList {
@ -102,12 +102,4 @@ index 05983ba80532f3c0235af7e712948edf4d8f021b..dc6774fdc215de6a157b64678aec5a79
+ // Paper end - Fire PlayerJoinEvent when Player is actually ready
player.initInventoryMenu();
// CraftBukkit - Moved from above, added world
// Paper start - Add to collideRule team if needed
@@ -412,6 +429,7 @@ public abstract class PlayerList {
scoreboard.addPlayerToTeam(player.getScoreboardName(), collideRuleTeam);
}
// Paper end
+ // CraftBukkit - Moved from above, added world
PlayerList.LOGGER.info("{}[{}] logged in with entity id {} at ([{}]{}, {}, {})", player.getName().getString(), s1, player.getId(), worldserver1.serverLevelData.getLevelName(), player.getX(), player.getY(), player.getZ());
}
// Paper start - Configurable player collision; Add to collideRule team if needed

View File

@ -545,7 +545,7 @@ index 61f05f34ca33837c643f2915e753ec3935a38314..85b8be8ffac0fb40e9cae0528271ed41
throw new SkipPacketException(var13);
}
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index 3779e02083fb41e93248aed27a9214be88167e5a..1d8f8b1910f50e90d60bb2a924d49f3fd3518fd6 100644
index 9c7079d0c3c25bef970891b0579daa940fa61e33..249944e48d3e07cc5dd412f58f39a3abdbe446b1 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -194,6 +194,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
@ -587,7 +587,7 @@ index 9db7fc8c053aa9e929fa6dddf70290a8f7ad5273..dfa07c9ede9d748a05ee47826bdbcf73
final MinecraftServer server;
public volatile boolean running;
diff --git a/src/main/java/net/minecraft/server/players/OldUsersConverter.java b/src/main/java/net/minecraft/server/players/OldUsersConverter.java
index 14bd0b94ece3f826f822b4900c7250ebdc27d937..59eb65e207ff0206b0dfad6f2dcffe785f61f8ff 100644
index e697b8f7b165d2394d8155cbee7453e23ac2bee4..6706ac701963fed4798247e6e835b06fc92b0cf4 100644
--- a/src/main/java/net/minecraft/server/players/OldUsersConverter.java
+++ b/src/main/java/net/minecraft/server/players/OldUsersConverter.java
@@ -358,7 +358,7 @@ public class OldUsersConverter {
@ -596,7 +596,7 @@ index 14bd0b94ece3f826f822b4900c7250ebdc27d937..59eb65e207ff0206b0dfad6f2dcffe78
} catch (Exception exception) {
- exception.printStackTrace();
+ io.papermc.paper.util.TraceUtil.printStackTrace(exception); // Paper
ServerInternalException.reportInternalException(exception); // Paper
ServerInternalException.reportInternalException(exception); // Paper - ServerExceptionEvent
}
@@ -372,7 +372,7 @@ public class OldUsersConverter {
@ -605,11 +605,11 @@ index 14bd0b94ece3f826f822b4900c7250ebdc27d937..59eb65e207ff0206b0dfad6f2dcffe78
} catch (Exception exception) {
- exception.printStackTrace();
+ io.papermc.paper.util.TraceUtil.printStackTrace(exception); // Paper
ServerInternalException.reportInternalException(exception); // Paper
ServerInternalException.reportInternalException(exception); // Paper - ServerExceptionEvent
}
}
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
index 796aa86e12cf9062b3467a3678c895af5ad626fe..9e01a22df54492d9c8e9f9defd84014dc109514b 100644
index 873e8de4638d14ce9052e3978f528e10fa591924..6e1006675339551ca499a57a8f8553020f16a4fa 100644
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
@@ -599,7 +599,7 @@ public class LevelChunk extends ChunkAccess {
@ -619,7 +619,7 @@ index 796aa86e12cf9062b3467a3678c895af5ad626fe..9e01a22df54492d9c8e9f9defd84014d
- e.printStackTrace();
+ io.papermc.paper.util.TraceUtil.printStackTrace(e);
ServerInternalException.reportInternalException(e);
// Paper end
// Paper end - ServerExceptionEvent
// CraftBukkit end
diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftAsyncScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftAsyncScheduler.java
index 3c1992e212a6d6f1db4d5b807b38d71913619fc0..9c1aff17aabd062640e3f451a2ef8c50a7c62f10 100644

View File

@ -5,7 +5,7 @@ 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 74ce2fc0256c1747bb1638eea8947d3416f23ab8..efb5a5b31ada326593b3bea0f49c05591db18801 100644
index e824ac0c487ab42c68cbf1a6f7c24d4b689809c3..7d265471685e34b434ab25bee14854f6f261837b 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -898,7 +898,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@ -76,7 +76,7 @@ index a2220291f6d0726019187c2fc93bca801a3f0610..25009accd401fc3860c57cac1ef628b2
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 6a1e893d4ec1e5fe598422807f1717b19579fe2e..cdd766ccf85df7d0c17d36c544a5346dc46b4f22 100644
index 97a04d12acbf0d6eb8f9f4ecc45085570f74a0f5..9f9bb129b7450a9862293e83fefe0acb8986235d 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1301,6 +1301,37 @@ public class ServerLevel extends Level implements WorldGenLevel {
@ -130,10 +130,10 @@ index 6020da902ef3c05d38116c302e3848aa1828e1fa..553cdac6fef1626d0eac86ca971fcf65
private static final int NEUTRAL_MOB_DEATH_NOTIFICATION_RADII_Y = 10;
private static final int FLY_STAT_RECORDING_SPEED = 25;
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 7750c1980ea7e211a35ad077b95ab0e206900e17..8c32e68e82a1c87a473b2ea50afeeb0043b0e8fa 100644
index 5657999a85b9b9dfb48a51170d5fa3d9c37263ad..172d7c3df8f9aab24d49b2ff12e3cdf5f40727f9 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -552,6 +552,7 @@ public abstract class PlayerList {
@@ -551,6 +551,7 @@ public abstract class PlayerList {
protected void save(ServerPlayer player) {
if (!player.getBukkitEntity().isPersistent()) return; // CraftBukkit
@ -141,7 +141,7 @@ index 7750c1980ea7e211a35ad077b95ab0e206900e17..8c32e68e82a1c87a473b2ea50afeeb00
this.playerIo.save(player);
ServerStatsCounter serverstatisticmanager = (ServerStatsCounter) player.getStats(); // CraftBukkit
@@ -1152,10 +1153,22 @@ public abstract class PlayerList {
@@ -1151,10 +1152,22 @@ public abstract class PlayerList {
}
public void saveAll() {

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 8c32e68e82a1c87a473b2ea50afeeb0043b0e8fa..d5890b41c2ddf955416a64132f3022d95850f04b 100644
index 172d7c3df8f9aab24d49b2ff12e3cdf5f40727f9..db40e72020ff651e8e77cf2f214e3d5cce61ea5a 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -806,6 +806,7 @@ public abstract class PlayerList {
@@ -805,6 +805,7 @@ public abstract class PlayerList {
// Paper start - Add PlayerPostRespawnEvent
boolean isBedSpawn = false;
boolean isRespawn = false;
@ -21,7 +21,7 @@ index 8c32e68e82a1c87a473b2ea50afeeb0043b0e8fa..d5890b41c2ddf955416a64132f3022d9
// Paper end - Add PlayerPostRespawnEvent
// CraftBukkit start - fire PlayerRespawnEvent
@@ -816,7 +817,7 @@ public abstract class PlayerList {
@@ -815,7 +816,7 @@ public abstract class PlayerList {
Optional optional;
if (blockposition != null) {
@ -30,7 +30,7 @@ index 8c32e68e82a1c87a473b2ea50afeeb0043b0e8fa..d5890b41c2ddf955416a64132f3022d9
} else {
optional = Optional.empty();
}
@@ -860,7 +861,12 @@ public abstract class PlayerList {
@@ -859,7 +860,12 @@ public abstract class PlayerList {
}
// Spigot End
@ -44,7 +44,7 @@ index 8c32e68e82a1c87a473b2ea50afeeb0043b0e8fa..d5890b41c2ddf955416a64132f3022d9
if (!flag) entityplayer.reset(); // SPIGOT-4785
isRespawn = true; // Paper - Add PlayerPostRespawnEvent
} else {
@@ -898,8 +904,14 @@ public abstract class PlayerList {
@@ -897,8 +903,14 @@ public abstract class PlayerList {
}
// entityplayer1.initInventoryMenu();
entityplayer1.setHealth(entityplayer1.getHealth());

View File

@ -5,7 +5,7 @@ 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 cdd766ccf85df7d0c17d36c544a5346dc46b4f22..5089fe44bdd1d20b6b54ef26e8107c5c75ff3ea2 100644
index 9f9bb129b7450a9862293e83fefe0acb8986235d..10ccdfa28d5b9da5c380f7417a6bc800f642e390 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -2014,9 +2014,11 @@ public class ServerLevel extends Level implements WorldGenLevel {

View File

@ -6,7 +6,7 @@ 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 5089fe44bdd1d20b6b54ef26e8107c5c75ff3ea2..53404e9a6f5f3aff625ce2e247bea1bfe478a996 100644
index 10ccdfa28d5b9da5c380f7417a6bc800f642e390..c6d8dd26f3e9a1aab95c6b394d5f856990b564f1 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1512,6 +1512,12 @@ public class ServerLevel extends Level implements WorldGenLevel {

View File

@ -49,10 +49,10 @@ index 6597e6e9987ddb5906909c22704fdfb6557aee8e..6bb846d3ee2fb54ab3ffa116607f2a83
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 d5890b41c2ddf955416a64132f3022d95850f04b..bd009fdf73d2eb03708e80683d360be0ba13edd6 100644
index db40e72020ff651e8e77cf2f214e3d5cce61ea5a..d356981f7ed3c517aa6c9ff81a7a72b9872021ad 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -579,7 +579,7 @@ public abstract class PlayerList {
@@ -578,7 +578,7 @@ public abstract class PlayerList {
entityplayer.closeContainer(org.bukkit.event.inventory.InventoryCloseEvent.Reason.DISCONNECT); // Paper - Inventory close reason
}

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 bd009fdf73d2eb03708e80683d360be0ba13edd6..a393af8e54837e6bf9e05050dd3b38d5ad015782 100644
index d356981f7ed3c517aa6c9ff81a7a72b9872021ad..3fa1033936fa3d0c00fc4d51ec10d1977765d2d5 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -849,7 +849,7 @@ public abstract class PlayerList {
@@ -848,7 +848,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] Remove stale POIs
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 53404e9a6f5f3aff625ce2e247bea1bfe478a996..fdf85454fc55de4d966442d32ee004e7e66b0ed7 100644
index c6d8dd26f3e9a1aab95c6b394d5f856990b564f1..30a71abd6dab3967d7206583ece6c496f5ff61df 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -2083,6 +2083,11 @@ public class ServerLevel extends Level implements WorldGenLevel {

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Fix villager boat exploit
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index a393af8e54837e6bf9e05050dd3b38d5ad015782..77302ac01edc715c0536821611a88ac951135a41 100644
index 3fa1033936fa3d0c00fc4d51ec10d1977765d2d5..a24aa06d65dadaece78e37ba6f67aee724c410f0 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -604,6 +604,14 @@ public abstract class PlayerList {
@@ -603,6 +603,14 @@ public abstract class PlayerList {
PlayerList.LOGGER.debug("Removing player mount");
entityplayer.stopRiding();
entity.getPassengersAndSelf().forEach((entity1) -> {

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Add sendOpLevel API
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 77302ac01edc715c0536821611a88ac951135a41..ed106322419be1065fd900b02f4f71d268726e38 100644
index a24aa06d65dadaece78e37ba6f67aee724c410f0..5541508a1c50ec5375db48d87203c922c6a439de 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -1102,6 +1102,11 @@ public abstract class PlayerList {
@@ -1101,6 +1101,11 @@ public abstract class PlayerList {
}
private void sendPlayerPermissionLevel(ServerPlayer player, int permissionLevel) {
@ -20,7 +20,7 @@ index 77302ac01edc715c0536821611a88ac951135a41..ed106322419be1065fd900b02f4f71d2
if (player.connection != null) {
byte b0;
@@ -1116,8 +1121,10 @@ public abstract class PlayerList {
@@ -1115,8 +1120,10 @@ public abstract class PlayerList {
player.connection.send(new ClientboundEntityEventPacket(player, b0));
}
@ -32,7 +32,7 @@ index 77302ac01edc715c0536821611a88ac951135a41..ed106322419be1065fd900b02f4f71d2
public boolean isWhiteListed(GameProfile profile) {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index bbe18e0342ad68c844f095d3b6413929adc18ab5..8b23a8fbdc1db7043969ca0a36c59dffd92782d3 100644
index 7d5733f6c45c0521b1d1a37d6dfc3b0a7aad1662..a0e33c3b6e8134ec7570a8c160da41c4a92d5040 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -633,6 +633,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player {

View File

@ -5,31 +5,31 @@ Subject: [PATCH] Add EntityMoveEvent
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 6268b8ffe365c45406df7f40fcbc0567cc5d1db4..e048caafe645e33764a26154b5150c5c5de5b1ad 100644
index 1aa73c3934c754fb9a4e09e8ac9c7f96d608ceb5..849161e11d547445d9bd10ac54bcd994a62aab06 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1529,6 +1529,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
while (iterator.hasNext()) {
ServerLevel worldserver = (ServerLevel) iterator.next();
worldserver.hasPhysicsEvent = org.bukkit.event.block.BlockPhysicsEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper
worldserver.hasPhysicsEvent = org.bukkit.event.block.BlockPhysicsEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper - BlockPhysicsEvent
+ worldserver.hasEntityMoveEvent = io.papermc.paper.event.entity.EntityMoveEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper - Add EntityMoveEvent
this.profiler.push(() -> {
return worldserver + " " + worldserver.dimension().location();
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index fdf85454fc55de4d966442d32ee004e7e66b0ed7..4b1ddc849efaaba6fe35e46d7a979e6c65f0dbd2 100644
index 30a71abd6dab3967d7206583ece6c496f5ff61df..be76b852ced7ac9cd3c2d3469d6120cc504e9700 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -221,6 +221,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
public final LevelStorageSource.LevelStorageAccess convertable;
public final UUID uuid;
public boolean hasPhysicsEvent = true; // Paper
public boolean hasPhysicsEvent = true; // Paper - BlockPhysicsEvent
+ public boolean hasEntityMoveEvent; // Paper - Add EntityMoveEvent
@Override public LevelChunk getChunkIfLoaded(int x, int z) { // Paper - this was added in world too but keeping here for NMS ABI
public LevelChunk getChunkIfLoaded(int x, int z) {
return this.chunkSource.getChunk(x, z, false);
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index cf57c977d64a76d29a4f9a4811d55a17cc51e368..a2ed9d38f66004d8e7affd5d8e6277076ea04b3d 100644
index 71aaa67177cb782e3ee20d57b73a4f6904b39cf1..6db503e99166cae9efdc25d2eae66956e6cf9699 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3361,6 +3361,20 @@ public abstract class LivingEntity extends Entity implements Attackable {

View File

@ -5,7 +5,7 @@ Subject: [PATCH] added option to disable pathfinding updates on block changes
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 4b1ddc849efaaba6fe35e46d7a979e6c65f0dbd2..8aa3d8ea13fe7a68628e7647f4da2558873415b4 100644
index be76b852ced7ac9cd3c2d3469d6120cc504e9700..a27dd0fe48f018e5e2f99e00d8ef5d1f61cea635 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1657,6 +1657,7 @@ public class ServerLevel extends Level implements WorldGenLevel {

View File

@ -21,7 +21,7 @@ index a20d47f54f12dfc0a5f76dd969238e34c958b618..1c9cf5e1c4ee05724ffcdbd77a19bca1
this.saveUserBanList();
this.loadIpBanList();
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index b6f87e28625df68548a296001a0d67601513f7d1..a27e9ba8448930e45e283b8e19156bcf86b9baee 100644
index 5ecf65315b42cd07dcd69a10c445b1f0576f03c5..a27e9ba8448930e45e283b8e19156bcf86b9baee 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -199,6 +199,12 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
@ -42,13 +42,13 @@ index b6f87e28625df68548a296001a0d67601513f7d1..a27e9ba8448930e45e283b8e19156bcf
}
- if (this.convertOldUsers()) {
- this.getProfileCache().save(false); // Paper
- this.getProfileCache().save(false); // Paper - Perf: Async GameProfileCache saving
- }
if (!OldUsersConverter.serverReadyAfterUserconversion(this)) {
return false;
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index ed106322419be1065fd900b02f4f71d268726e38..6d31d09c4c14c7038d2698fc13de47cc56ef2964 100644
index 5541508a1c50ec5375db48d87203c922c6a439de..974ca4ebdbbbbe38ef0f0c1992f69bdcfd52cbf9 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -176,6 +176,7 @@ public abstract class PlayerList {

View File

@ -7,12 +7,12 @@ Fixes disappearance of held items, when a player gets disconnected and PlayerDro
Closes #5036
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 6d31d09c4c14c7038d2698fc13de47cc56ef2964..be5f0e2f23673b914d259e114281fdc0b6047ab6 100644
index 974ca4ebdbbbbe38ef0f0c1992f69bdcfd52cbf9..b6f173055be42e8627f162f02da00227a4e5f2b6 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -597,6 +597,14 @@ public abstract class PlayerList {
@@ -596,6 +596,14 @@ public abstract class PlayerList {
}
// Paper end
// Paper end - Configurable player collision
+ // Paper - Drop carried item when player has disconnected
+ if (!entityplayer.containerMenu.getCarried().isEmpty()) {

View File

@ -8,7 +8,7 @@ Paper.bypassHostCheck
Seriously, fix your firewalls. -.-
diff --git a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
index 228359f13511262a0e4afeb9deff982ca0f46d9a..e694fd535212105e9229a6047002fdde93aede79 100644
index 9b611fc277baf99a5d24b30a11f0efa77b22693f..0c6d172c8b723d2ceff7443dfe50ae280cb6dc2d 100644
--- a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
@@ -30,6 +30,7 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL
@ -21,7 +21,7 @@ index 228359f13511262a0e4afeb9deff982ca0f46d9a..e694fd535212105e9229a6047002fdde
this.server = server;
@@ -129,7 +130,7 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL
if (!handledByEvent && proxyLogicEnabled) {
// Paper end
// Paper end - PlayerHandshakeEvent
// if (org.spigotmc.SpigotConfig.bungee) { // Paper - comment out, we check above!
- if ( ( split.length == 3 || split.length == 4 ) && ( ServerHandshakePacketListenerImpl.HOST_PATTERN.matcher( split[1] ).matches() ) ) {
+ if ( ( split.length == 3 || split.length == 4 ) && ( ServerHandshakePacketListenerImpl.BYPASS_HOSTCHECK || ServerHandshakePacketListenerImpl.HOST_PATTERN.matcher( split[1] ).matches() ) ) { // Paper - Add bypass host check

View File

@ -19,10 +19,10 @@ index 6252f71c6b5df2a35d58c8f7cd64049b2819ddc0..cc393b070f6df598bd4523605d20900c
} else {
if (this.player.getHealth() > 0.0F) {
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index be5f0e2f23673b914d259e114281fdc0b6047ab6..67513e8a00e2a5208628c2804dd88c5f576df993 100644
index b6f173055be42e8627f162f02da00227a4e5f2b6..cb71aacd23696bf0bf83d2850a5f9cbd46eb1996 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -781,6 +781,12 @@ public abstract class PlayerList {
@@ -780,6 +780,12 @@ public abstract class PlayerList {
}
public ServerPlayer respawn(ServerPlayer entityplayer, ServerLevel worldserver, boolean flag, Location location, boolean avoidSuffocation, RespawnReason reason) {
@ -35,7 +35,7 @@ index be5f0e2f23673b914d259e114281fdc0b6047ab6..67513e8a00e2a5208628c2804dd88c5f
entityplayer.stopRiding(); // CraftBukkit
this.players.remove(entityplayer);
this.playersByName.remove(entityplayer.getScoreboardName().toLowerCase(java.util.Locale.ROOT)); // Spigot
@@ -822,6 +828,7 @@ public abstract class PlayerList {
@@ -821,6 +827,7 @@ public abstract class PlayerList {
// Paper start - Add PlayerPostRespawnEvent
boolean isBedSpawn = false;
@ -43,7 +43,7 @@ index be5f0e2f23673b914d259e114281fdc0b6047ab6..67513e8a00e2a5208628c2804dd88c5f
boolean isRespawn = false;
boolean isLocAltered = false; // Paper - Fix SPIGOT-5989
// Paper end - Add PlayerPostRespawnEvent
@@ -842,6 +849,7 @@ public abstract class PlayerList {
@@ -841,6 +848,7 @@ public abstract class PlayerList {
if (optional.isPresent()) {
BlockState iblockdata = worldserver1.getBlockState(blockposition);
boolean flag3 = iblockdata.is(Blocks.RESPAWN_ANCHOR);
@ -51,7 +51,7 @@ index be5f0e2f23673b914d259e114281fdc0b6047ab6..67513e8a00e2a5208628c2804dd88c5f
Vec3 vec3d = (Vec3) optional.get();
float f1;
@@ -870,7 +878,7 @@ public abstract class PlayerList {
@@ -869,7 +877,7 @@ public abstract class PlayerList {
}
Player respawnPlayer = entityplayer1.getBukkitEntity();

View File

@ -103,7 +103,7 @@ index 2f69f4368bb0fb6d254c1f445953c8dd05d0b0aa..e70ff6389436f33f4ec1d0b238601419
}
// Spigot End
diff --git a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
index e694fd535212105e9229a6047002fdde93aede79..a0b655f23176b034d302ea12261f7aac1176213d 100644
index 0c6d172c8b723d2ceff7443dfe50ae280cb6dc2d..a53dd1ea02bd19826cd9fd337459b08e9533bce8 100644
--- a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
@@ -45,6 +45,7 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL
@ -123,7 +123,7 @@ index e694fd535212105e9229a6047002fdde93aede79..a0b655f23176b034d302ea12261f7aac
org.apache.logging.log4j.LogManager.getLogger().debug("Failed to check connection throttle", t);
}
@@ -131,8 +133,11 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL
// Paper end
// Paper end - PlayerHandshakeEvent
// if (org.spigotmc.SpigotConfig.bungee) { // Paper - comment out, we check above!
if ( ( split.length == 3 || split.length == 4 ) && ( ServerHandshakePacketListenerImpl.BYPASS_HOSTCHECK || ServerHandshakePacketListenerImpl.HOST_PATTERN.matcher( split[1] ).matches() ) ) { // Paper - Add bypass host check
+ // Paper start - Unix domain socket support

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Add cause to Weather/ThunderChangeEvents
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 8aa3d8ea13fe7a68628e7647f4da2558873415b4..6409a731209b3dbb6c1ad790aff1954f449bf759 100644
index a27dd0fe48f018e5e2f99e00d8ef5d1f61cea635..2abfa8df53a0cbb1abefd5ee121ccdc6524d8523 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -667,8 +667,8 @@ public class ServerLevel extends Level implements WorldGenLevel {

View File

@ -48,7 +48,7 @@ index 96814e626a95e4e3c2f4df1a0339d37bb02f2e61..ba12919c3f9aec34a9e64993b143ae92
public boolean shouldDisconnect() {
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index e789a6369c792e577e918fcb44bb59c6c5f71d49..88645ffa12f630daf9bd74bb5848ed9dd23d0c1f 100644
index ad6a0f1a1a9ed11760098b700e8f305faf066fcd..6f7a55bc2379f28e17b7e3500959972bbff9830d 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -2173,7 +2173,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@ -437,10 +437,10 @@ index e70ff6389436f33f4ec1d0b238601419bddb3fe0..cde1ae539f8808ecaf28afda20dc5ea2
}
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 67513e8a00e2a5208628c2804dd88c5f576df993..fc26226d59bb670957587b8e221214cd1d19f844 100644
index cb71aacd23696bf0bf83d2850a5f9cbd46eb1996..0ec9d49b938ff701535fadaf701dc8f3ad4d0664 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -684,7 +684,7 @@ public abstract class PlayerList {
@@ -683,7 +683,7 @@ public abstract class PlayerList {
while (iterator.hasNext()) {
entityplayer = (ServerPlayer) iterator.next();
this.save(entityplayer); // CraftBukkit - Force the player's inventory to be saved
@ -449,7 +449,7 @@ index 67513e8a00e2a5208628c2804dd88c5f576df993..fc26226d59bb670957587b8e221214cd
}
// Instead of kicking then returning, we need to store the kick reason
@@ -1332,8 +1332,8 @@ public abstract class PlayerList {
@@ -1331,8 +1331,8 @@ public abstract class PlayerList {
// Paper end
// CraftBukkit start - disconnect safely
for (ServerPlayer player : this.players) {
@ -491,7 +491,7 @@ index 6724d0a1af13e97bc1d3bd94fd43fef742a0deab..20ba0a0c9eae28658888a77dd2170f62
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 44a63ead4c00e82254de8d41a3711cf3e1c4f083..b4980d4f99aae9b2ab9d408e77e50bc50ca2d450 100644
index 7b5fd058817f27ffefcdc7e3667e8258a87cbb4c..667d0f7f50f7000d71efe429e2218e0358e22698 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -591,7 +591,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {

View File

@ -8,20 +8,20 @@ ticket level 33 (yes getChunkIfLoaded will actually perform a chunk
load in that case).
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 6409a731209b3dbb6c1ad790aff1954f449bf759..3aa1bd080064008a2f8a280947ee7741ce205b59 100644
index 2abfa8df53a0cbb1abefd5ee121ccdc6524d8523..97abb99f6fd3e718771a928d3aacc9d0042c7250 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -224,7 +224,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
public boolean hasEntityMoveEvent; // Paper - Add EntityMoveEvent
@Override public LevelChunk getChunkIfLoaded(int x, int z) { // Paper - this was added in world too but keeping here for NMS ABI
public LevelChunk getChunkIfLoaded(int x, int z) {
- return this.chunkSource.getChunk(x, z, false);
+ return this.chunkSource.getChunkAtIfLoadedImmediately(x, z); // Paper - Use getChunkIfLoadedImmediately
}
@Override
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 50db0a36c17791373fcae1c7b80f7353ef665f3c..80a5bd7a57ceb617752f645c1a4f046fea6e8de6 100644
index cd01f33799436af1aeeb2d9cd2acff164c3118ce..479d14c8c6e8acf2586c2af875515405bea2843f 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -203,6 +203,13 @@ public abstract class Level implements LevelAccessor, AutoCloseable {

View File

@ -96,10 +96,10 @@ index 6d385f169b5daab69cd40e37ffaa38416dc91223..cfe980606a87ccad1cbf9354728a8d2e
this.server.getPlayerList().broadcastSystemMessage(PaperAdventure.asVanilla(quitMessage), false);
// Paper end
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index fc26226d59bb670957587b8e221214cd1d19f844..5f7f42586949aae4a3722bd0486c68b2c8499b8f 100644
index 0ec9d49b938ff701535fadaf701dc8f3ad4d0664..cedfc39539f7eb7d2cc0dfeda347cf59fadd95fc 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -570,6 +570,11 @@ public abstract class PlayerList {
@@ -569,6 +569,11 @@ public abstract class PlayerList {
}
public net.kyori.adventure.text.Component remove(ServerPlayer entityplayer) { // CraftBukkit - return string // Paper - return Component

View File

@ -154,10 +154,10 @@ index 2535c002c45d2d92bc779d3c9198cf3c737bd7f2..165d75cdc40af7e35d41fed242e11eed
public SectionPos getLastSectionPos() {
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 5f7f42586949aae4a3722bd0486c68b2c8499b8f..89c91072a6b50b2b917d8a21510d9b5daa5d6005 100644
index cedfc39539f7eb7d2cc0dfeda347cf59fadd95fc..a4d2ddbb9cee1682fc5d91e90d2fd0b74a47aa3c 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -872,7 +872,7 @@ public abstract class PlayerList {
@@ -871,7 +871,7 @@ public abstract class PlayerList {
location = CraftLocation.toBukkit(vec3d, worldserver1.getWorld(), f1, 0.0F);
} else if (blockposition != null) {
entityplayer1.connection.send(new ClientboundGameEventPacket(ClientboundGameEventPacket.NO_RESPAWN_BLOCK_AVAILABLE, 0.0F));
@ -187,7 +187,7 @@ index ecaa7f0b2bf795f16187f11fa27f6d5d435ccbfe..acd5ec218b8d4c096f44ae2eec1379ee
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index b4980d4f99aae9b2ab9d408e77e50bc50ca2d450..149906e1ab9d1cf2d186fbe4a47ac258d7802dee 100644
index 667d0f7f50f7000d71efe429e2218e0358e22698..75d06c92de46a8cb374985435e89bb3b03962ee4 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -1318,9 +1318,9 @@ public class CraftPlayer extends CraftHumanEntity implements Player {

View File

@ -7,7 +7,7 @@ Subject: [PATCH] Add methods to find targets for lightning strikes
public net.minecraft.server.level.ServerLevel findLightningRod(Lnet/minecraft/core/BlockPos;)Ljava/util/Optional;
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 3aa1bd080064008a2f8a280947ee7741ce205b59..0f245c374695c6652506417e38c0a0ea58d379e6 100644
index 97abb99f6fd3e718771a928d3aacc9d0042c7250..66b6cb42f2365b0d63cd8625715bdf997261b6ac 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -993,6 +993,11 @@ public class ServerLevel extends Level implements WorldGenLevel {

View File

@ -9,7 +9,7 @@ chunk through it. This should also be OK from a leak prevention/
state desync POV because the TE is getting unloaded anyways.
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 0f245c374695c6652506417e38c0a0ea58d379e6..109143fca98c6952ca6129f261a9ff8b43f00e52 100644
index 66b6cb42f2365b0d63cd8625715bdf997261b6ac..7da6bd04b6ea4f8bb99fe6dba9dd4ecaba96a284 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1558,9 +1558,13 @@ public class ServerLevel extends Level implements WorldGenLevel {

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Fix merchant inventory not closing on entity removal
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 109143fca98c6952ca6129f261a9ff8b43f00e52..6540c4e1d9d347ce41fb0f504ee275ee3a1c0a4f 100644
index 7da6bd04b6ea4f8bb99fe6dba9dd4ecaba96a284..36ffc24778b307d239a8af43486ed54f78c7ea68 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -2629,6 +2629,11 @@ public class ServerLevel extends Level implements WorldGenLevel {

View File

@ -8,7 +8,7 @@ This ensures at least a valid version of the chunk exists
on disk, even if outdated
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java
index 0ae3d1ea6f00efcdea5da5bf1a0f984f4473f5a2..6ca572500a3bb36acf481e54262e811295d64136 100644
index cd362c5ee40e6542a42ee7429072e312569e5999..bbb134d82b30905b3213df9b855e7cf94ad71279 100644
--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java
@@ -529,6 +529,9 @@ public class RegionFile implements AutoCloseable {
@ -47,7 +47,7 @@ index 0ae3d1ea6f00efcdea5da5bf1a0f984f4473f5a2..6ca572500a3bb36acf481e54262e8112
ByteBuffer bytebuffer = ByteBuffer.wrap(this.buf, 0, this.count);
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
index 9e30b47ece5549c30f487e5542ae65d5faaa8c39..99f2e104b2214dbbc0b6e43d9011744ff4b0b843 100644
index 88e4efd686d64aa5049d92416fb27589d0e58753..753a9ddfabaab0014f68426c8e44213912faf021 100644
--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
@@ -286,10 +286,17 @@ public class RegionFileStorage implements AutoCloseable {
@ -79,7 +79,7 @@ index 9e30b47ece5549c30f487e5542ae65d5faaa8c39..99f2e104b2214dbbc0b6e43d9011744f
- }
+ // Paper - don't write garbage data to disk if writing serialization fails; move into try block to only write if successfully serialized
}
// Paper start
// Paper start - Chunk save reattempt
return;
@@ -346,4 +350,13 @@ public class RegionFileStorage implements AutoCloseable {
}

View File

@ -26,10 +26,10 @@ index d4658328eeecb1c9e3e25eec14dea07e9e2a8b74..ebda34825bbd10145a81d54c345e31c2
GameProfile gameprofile = this.server.getSingleplayerProfile();
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 89c91072a6b50b2b917d8a21510d9b5daa5d6005..3daa5cce3cfb438ef63f60ec84f3f54271fcdfe7 100644
index a4d2ddbb9cee1682fc5d91e90d2fd0b74a47aa3c..e67bcde933d8d64ca1d9d18b938f118994bf222b 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -679,7 +679,7 @@ public abstract class PlayerList {
@@ -678,7 +678,7 @@ public abstract class PlayerList {
for (int i = 0; i < this.players.size(); ++i) {
entityplayer = (ServerPlayer) this.players.get(i);

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Add configurable height for slime spawn
diff --git a/src/main/java/net/minecraft/world/entity/monster/Slime.java b/src/main/java/net/minecraft/world/entity/monster/Slime.java
index 3752ff83c91be55e8a5e7c81b75409d64a8aafde..2e59a32aa8afe45641a319b1a6c347ee944398a8 100644
index 2977e5986958cbee987893dd9de1dfb3764b291d..2502cb476032c6a247132ce2e427721d6c9f8ce4 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Slime.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Slime.java
@@ -336,7 +336,11 @@ public class Slime extends Mob implements Enemy {
@ -23,7 +23,7 @@ index 3752ff83c91be55e8a5e7c81b75409d64a8aafde..2e59a32aa8afe45641a319b1a6c347ee
@@ -347,7 +351,10 @@ public class Slime extends Mob implements Enemy {
ChunkPos chunkcoordintpair = new ChunkPos(pos);
boolean flag = world.getMinecraftWorld().paperConfig().entities.spawning.allChunksAreSlimeChunks || WorldgenRandom.seedSlimeChunk(chunkcoordintpair.x, chunkcoordintpair.z, ((WorldGenLevel) world).getSeed(), world.getMinecraftWorld().spigotConfig.slimeSeed).nextInt(10) == 0; // Spigot // Paper
boolean flag = world.getMinecraftWorld().paperConfig().entities.spawning.allChunksAreSlimeChunks || WorldgenRandom.seedSlimeChunk(chunkcoordintpair.x, chunkcoordintpair.z, ((WorldGenLevel) world).getSeed(), world.getMinecraftWorld().spigotConfig.slimeSeed).nextInt(10) == 0; // Spigot // Paper
- if (random.nextInt(10) == 0 && flag && pos.getY() < 40) {
+ // Paper start - Replace rules for Height in Slime Chunks

View File

@ -6,10 +6,10 @@ Subject: [PATCH] Use username instead of display name in
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index ab01a3af073a7bf3fcda9595929afabb80e0a4da..6dca7b3f5b7f94fd3e2e6a829922b58d81a7e5f5 100644
index bc16ce7734fa328192a67491fac83f89e3e819f6..9643482f933dc81e34fbaf6874ecfd50e1677c4b 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -1448,7 +1448,7 @@ public abstract class PlayerList {
@@ -1447,7 +1447,7 @@ public abstract class PlayerList {
// CraftBukkit start
public ServerStatsCounter getPlayerStats(ServerPlayer entityhuman) {
ServerStatsCounter serverstatisticmanager = entityhuman.getStats();

View File

@ -23,7 +23,7 @@ index ff99336e0b8131ae161cfa5c4fc83c6905e3dbc8..5e5a018433414af76eaa1e781f61612d
}
});
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 6540c4e1d9d347ce41fb0f504ee275ee3a1c0a4f..6f271c36f2dc47678f7e0b66872ae2c90baebafc 100644
index 36ffc24778b307d239a8af43486ed54f78c7ea68..6cd9f531b3c92641d8452a6d7a807ea8f9a61e8f 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -2538,6 +2538,7 @@ public class ServerLevel extends Level implements WorldGenLevel {

View File

@ -7,7 +7,7 @@ There are no plans to support creating worlds while worlds are
being ticked themselvess.
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 96780b3a1a2f19b768f737202bdae5c80ac5bf98..44f5d7b359f172521be30c464d7acf6881dbeef0 100644
index 35053ad6cdb071d3f256a23d532d1abb77f14858..fb86e510dc3197cf47b999d80a34a60c37f1d3c8 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -307,6 +307,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@ -35,7 +35,7 @@ index 96780b3a1a2f19b768f737202bdae5c80ac5bf98..44f5d7b359f172521be30c464d7acf68
+ Iterator iterator = this.getAllLevels().iterator(); // Paper - Throw exception on world create while being ticked; move down
while (iterator.hasNext()) {
ServerLevel worldserver = (ServerLevel) iterator.next();
worldserver.hasPhysicsEvent = org.bukkit.event.block.BlockPhysicsEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper
worldserver.hasPhysicsEvent = org.bukkit.event.block.BlockPhysicsEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper - BlockPhysicsEvent
@@ -1577,6 +1580,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.profiler.pop();
worldserver.explosionDensityCache.clear(); // Paper - Optimize explosions

View File

@ -7,7 +7,7 @@ The previous solution caused a bunch of bandaid fixes inorder to resolve edge ca
Just simply prevent them from being added to the world instead.
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 6f271c36f2dc47678f7e0b66872ae2c90baebafc..b15b3c1216baa84f696881deeae2de9d81201e27 100644
index 6cd9f531b3c92641d8452a6d7a807ea8f9a61e8f..68537510653ac189cde1e4f8b9ef542532300a67 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1519,6 +1519,7 @@ public class ServerLevel extends Level implements WorldGenLevel {

View File

@ -126,7 +126,7 @@ index fea9355a25ab42f81504f90be7b3448044fa76dd..c164e222e1eaeee06cacf0c46edc32e4
return this.anyPlayerCloseEnoughForSpawning(pos, false);
}
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index b15b3c1216baa84f696881deeae2de9d81201e27..f3884f7169835d3d65b8935ee41038f80306a61b 100644
index 68537510653ac189cde1e4f8b9ef542532300a67..dfb4e538a9cb05124dc49db940ea44e3fac478cf 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1006,7 +1006,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
@ -173,10 +173,10 @@ index c24701ed78824dc5377f8517dedf6a5aeff0614d..a38cda0029af022eccb12c12f1652fa8
this.player.server.getPlayerList().broadcastAll(new ClientboundPlayerInfoUpdatePacket(ClientboundPlayerInfoUpdatePacket.Action.UPDATE_GAME_MODE, this.player), this.player); // CraftBukkit
this.level.updateSleepingPlayerList();
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 6dca7b3f5b7f94fd3e2e6a829922b58d81a7e5f5..48211cdc96aab8db73a097f6899d7a9408595bf4 100644
index 9643482f933dc81e34fbaf6874ecfd50e1677c4b..551ceff75bc36a75bb992f1081d7343d1a956fd8 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -711,8 +711,10 @@ public abstract class PlayerList {
@@ -710,8 +710,10 @@ public abstract class PlayerList {
Player player = entity.getBukkitEntity();
PlayerLoginEvent event = new PlayerLoginEvent(player, loginlistener.connection.hostname, ((java.net.InetSocketAddress) socketaddress).getAddress(), ((java.net.InetSocketAddress) loginlistener.connection.channel.remoteAddress()).getAddress());

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Remove unnecessary onTrackingStart during navigation warning
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index f3884f7169835d3d65b8935ee41038f80306a61b..528901e658cf553de0580bcff21e42740b5d0cd4 100644
index dfb4e538a9cb05124dc49db940ea44e3fac478cf..61e68f9479b1bf9570eac012170b28e4b8322b1e 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -2566,7 +2566,7 @@ public class ServerLevel extends Level implements WorldGenLevel {

View File

@ -7,7 +7,7 @@ Makes certain entities check all players when searching for a player
instead of just checking players in their world.
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 528901e658cf553de0580bcff21e42740b5d0cd4..a15bdf56c32b16c143c3060dc7d5f61544f8dc5f 100644
index 61e68f9479b1bf9570eac012170b28e4b8322b1e..1506483f7d02f94ad1b00d9d3f94b7a0d99e2ca6 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -2689,4 +2689,12 @@ public class ServerLevel extends Level implements WorldGenLevel {
@ -24,7 +24,7 @@ index 528901e658cf553de0580bcff21e42740b5d0cd4..a15bdf56c32b16c143c3060dc7d5f615
+ // Paper end - check global player list where appropriate
}
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 626012f925ae7e7e99fe86f4d57e6b063fe14904..c7ece2c998b5abefc8d571e4b1ad0008dfe0733a 100644
index 1cbbbfc691830195679f8371d9db5d69eed28f3d..6b4f51e0d3324afbab85c9d96833ee145cc54caf 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3677,7 +3677,7 @@ public abstract class LivingEntity extends Entity implements Attackable {

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Friction API
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index c7ece2c998b5abefc8d571e4b1ad0008dfe0733a..3ef0b5b1e105c973e8b135f504581625256545f9 100644
index 6b4f51e0d3324afbab85c9d96833ee145cc54caf..85fe9bb49ca687cdd8b1fe35fb168c21f08d5593 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -261,6 +261,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
@ -37,10 +37,10 @@ index c7ece2c998b5abefc8d571e4b1ad0008dfe0733a..3ef0b5b1e105c973e8b135f504581625
nbt.putFloat("Health", this.getHealth());
nbt.putShort("HurtTime", (short) this.hurtTime);
nbt.putInt("HurtByTimestamp", this.lastHurtByMobTimestamp);
@@ -802,6 +808,16 @@ public abstract class LivingEntity extends Entity implements Attackable {
absorptionAmount = 0;
@@ -803,6 +809,16 @@ public abstract class LivingEntity extends Entity implements Attackable {
}
this.internalSetAbsorptionAmount(absorptionAmount);
// Paper end - Check for NaN
+ // Paper start - Friction API
+ if (nbt.contains("Paper.FrictionState")) {
+ String fs = nbt.getString("Paper.FrictionState");
@ -51,9 +51,9 @@ index c7ece2c998b5abefc8d571e4b1ad0008dfe0733a..3ef0b5b1e105c973e8b135f504581625
+ }
+ }
+ // Paper end - Friction API
// Paper end
if (nbt.contains("Attributes", 9) && this.level() != null && !this.level().isClientSide) {
this.getAttributes().load(nbt.getList("Attributes", 10));
}
diff --git a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
index 8aaca29b115a55bf48306e71432c4c20d2bd21dc..eb0d6238588efa35fa868f26290547574a08eca2 100644
--- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Prevent GameEvents being fired from unloaded chunks
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index a15bdf56c32b16c143c3060dc7d5f61544f8dc5f..d803b2c246f7e1935d2a466fe509df7fe80b2498 100644
index 1506483f7d02f94ad1b00d9d3f94b7a0d99e2ca6..7660a9eac7a2aff48b32c42e56633dd7202c2e01 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1656,6 +1656,11 @@ public class ServerLevel extends Level implements WorldGenLevel {

View File

@ -41,7 +41,7 @@ index 0e9d515381a673e683b63a12c1a9e79a5eedd80b..096eb30dcfdd62b1d946891f7480e9d9
}
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 898a7bf653e4d213104eb339ea4bc30bc9b26455..5a1d53bf288069040837995e72ef0f16b79f9ecc 100644
index 17351ef19ced295ec4fe5aa684b9fa4db1dadf27..d3ac9442a3073fe9207b6a1f74333502c7da6105 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -665,17 +665,18 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@ -49,7 +49,7 @@ index 898a7bf653e4d213104eb339ea4bc30bc9b26455..5a1d53bf288069040837995e72ef0f16
iblockdata1.updateIndirectNeighbourShapes(this, blockposition, k, j - 1); // Don't call an event for the old block to limit event spam
CraftWorld world = ((ServerLevel) this).getWorld();
+ boolean cancelledUpdates = false; // Paper - Fix block place logic
if (world != null && ((ServerLevel)this).hasPhysicsEvent) { // Paper
if (world != null && ((ServerLevel)this).hasPhysicsEvent) { // Paper - BlockPhysicsEvent
BlockPhysicsEvent event = new BlockPhysicsEvent(world.getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()), CraftBlockData.fromData(iblockdata));
this.getCraftServer().getPluginManager().callEvent(event);

View File

@ -1148,7 +1148,7 @@ index 0000000000000000000000000000000000000000..d306f911757a4d556c82c0070d4837db
+ }
+}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 681acc1ec995d9dbd5cfd30445b967093a3e4466..6ee3eb03967f020d96e4770b71ae39df3e69a79c 100644
index 14393bd35c3c77ee8d7bad0c71e880f6dd9c1be5..b703a21df8f27a987f74f99ceff476ec75f647d0 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1503,6 +1503,20 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@ -1173,10 +1173,10 @@ index 681acc1ec995d9dbd5cfd30445b967093a3e4466..6ee3eb03967f020d96e4770b71ae39df
this.profiler.push("commandFunctions");
MinecraftTimings.commandFunctionsTimer.startTiming(); // Spigot // Paper
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 14bcf8b155139dcfe3b397b3b516402b3c05e09c..67e044a2c71833704357e5b3d46b4e7f8891e995 100644
index f9cb05de12c938ea6d44a806f73bc0ae48b4394f..70c89dee884838983070d3cca7bc3e2ef13674d7 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -649,6 +649,7 @@ public abstract class PlayerList {
@@ -648,6 +648,7 @@ public abstract class PlayerList {
entityplayer.unRide();
worldserver.removePlayerImmediately(entityplayer, Entity.RemovalReason.UNLOADED_WITH_PLAYER);
@ -1185,7 +1185,7 @@ index 14bcf8b155139dcfe3b397b3b516402b3c05e09c..67e044a2c71833704357e5b3d46b4e7f
this.players.remove(entityplayer);
this.playersByName.remove(entityplayer.getScoreboardName().toLowerCase(java.util.Locale.ROOT)); // Spigot
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index fda3aa0c11d86270e96d345cf8a8b249f817dfa3..c709049deccc8218d603382e4f628e493a99c5ae 100644
index a3ac7e5df3eb4fd3a76453d3837fb83ed07abc22..155886a611e49cb6d1204c675b4f44a85ec60d33 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -246,11 +246,23 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S

View File

@ -5,10 +5,10 @@ Subject: [PATCH] API for updating recipes on clients
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 67e044a2c71833704357e5b3d46b4e7f8891e995..02aaa2abd1815bc8505a09033025cf64bc4662b2 100644
index 70c89dee884838983070d3cca7bc3e2ef13674d7..1e0cc8051f0a36a21b277eab15daf612e04e4c9d 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -1544,6 +1544,13 @@ public abstract class PlayerList {
@@ -1543,6 +1543,13 @@ public abstract class PlayerList {
}
public void reloadResources() {
@ -22,7 +22,7 @@ index 67e044a2c71833704357e5b3d46b4e7f8891e995..02aaa2abd1815bc8505a09033025cf64
// CraftBukkit start
/*Iterator iterator = this.advancements.values().iterator();
@@ -1559,7 +1566,15 @@ public abstract class PlayerList {
@@ -1558,7 +1565,15 @@ public abstract class PlayerList {
}
// CraftBukkit end

View File

@ -7,7 +7,7 @@ Subject: [PATCH] Fix missing map initialize event call
public net.minecraft.world.level.storage.DimensionDataStorage readSavedData(Ljava/util/function/Function;Lnet/minecraft/util/datafix/DataFixTypes;Ljava/lang/String;)Lnet/minecraft/world/level/saveddata/SavedData;
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index d803b2c246f7e1935d2a466fe509df7fe80b2498..9e8f47ab8b337a43760d781852348e4bddbb46d9 100644
index 7660a9eac7a2aff48b32c42e56633dd7202c2e01..afafc216ac3e2a8233d4227f63ff85b3287fd12d 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1945,13 +1945,25 @@ public class ServerLevel extends Level implements WorldGenLevel {

View File

@ -19,7 +19,7 @@ where generation happened directly to a ServerLevel and the
entity still has the flag set.
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 9e8f47ab8b337a43760d781852348e4bddbb46d9..0c4c20ce794dd7e12cf1712dccc975bf21b01133 100644
index afafc216ac3e2a8233d4227f63ff85b3287fd12d..0793c75dccc765b14718392fbc136b8f8ffc8f91 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1508,6 +1508,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
@ -31,7 +31,7 @@ index 9e8f47ab8b337a43760d781852348e4bddbb46d9..0c4c20ce794dd7e12cf1712dccc975bf
if (entity.valid) {
MinecraftServer.LOGGER.error("Attempted Double World add on {}", entity, new Throwable());
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 633a709d3f7768dce644affc4ce9b75711e971f1..da52068d063f5dd978454e3b516384df25eb204b 100644
index 633917f96c03336218a247401b3953b890acfc2e..4df2d7ae5c0cb82aa7ca1dd8c1b6e0b2991b28b3 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -678,7 +678,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@ -68,7 +68,7 @@ index a6e20b5ee4fe1841dfc2350264b5935b968fe3f3..9da8d56ff3768fb37d1ab89300da4eca
}, () -> {
EntityType.LOGGER.warn("Skipping Entity with id {}", nbt.getString("id"));
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index e11eb4b3796debeadde58e43d9176aef029228bd..228e8233caf3653d6411e4d85e5dcfd6a012b40f 100644
index a51f16f01a05860f4188b2b777a015908adbd120..dcbcd97f4b16083c1c56ffdccdc35bc3ad1e20dc 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 {

View File

@ -44,7 +44,7 @@ index 15139198a02e366c0bbfcd5495a21c48e05b3a23..3b0fd733e8fd9639362f251876bea814
// CraftBukkit start - modelled on below
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 0c4c20ce794dd7e12cf1712dccc975bf21b01133..4edae565873fdafdd83a0b4509676d4c62b3bbbe 100644
index 0793c75dccc765b14718392fbc136b8f8ffc8f91..715f6fb68d832545f36184a77f2229c2a1a79f75 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1318,7 +1318,7 @@ public class ServerLevel extends Level implements WorldGenLevel {

View File

@ -14,10 +14,10 @@ movement will load only the chunk the player enters anyways and avoids loading
massive amounts of surrounding chunks due to large AABB lookups.
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 17573871e13affb72e282da02eaba395808b3d9d..f168c9bb2fa3ca5b3168fb4c420a77e5bba6185b 100644
index d1ca2b75d82653064b905b94a638abbb2d0e710d..1c56b7cd0cfc8cdc0ccfc7ce79cd3e23bef1b334 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -935,6 +935,7 @@ public abstract class PlayerList {
@@ -934,6 +934,7 @@ public abstract class PlayerList {
entityplayer1.setShiftKeyDown(false);
entityplayer1.forceSetPositionRotation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
@ -26,7 +26,7 @@ index 17573871e13affb72e282da02eaba395808b3d9d..f168c9bb2fa3ca5b3168fb4c420a77e5
// CraftBukkit end
entityplayer1.setPos(entityplayer1.getX(), entityplayer1.getY() + 1.0D, entityplayer1.getZ());
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 3d7c6d38dba3e74bc0b868ee5efb7cc80bc0352c..c20a9fb40a2c3f555096299de662b5488c00ee26 100644
index 51b0ec061da092aa1a303ff88b8d029133b82e73..5aa9498f41a3f70af6aec04cfaa587841e2fbebb 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -241,6 +241,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S

View File

@ -71,7 +71,7 @@ index 6f2452de76e8f5fcc1367066e0e753740764eb98..e047dee632022abfe05865d1e71838be
cause = cause.getCause();
}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 6ee3eb03967f020d96e4770b71ae39df3e69a79c..69b3d89a352fe5cfd51e2e566c9fa4dfbd765263 100644
index b703a21df8f27a987f74f99ceff476ec75f647d0..e2e37b75475c7c243245ca3ff78d29c51ff0ad39 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -297,7 +297,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@ -122,7 +122,7 @@ index 6ee3eb03967f020d96e4770b71ae39df3e69a79c..69b3d89a352fe5cfd51e2e566c9fa4df
if (this.metricsRecorder.isRecording()) {
this.cancelRecordingMetrics();
@@ -997,7 +1014,21 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.getProfileCache().save(false); // Paper
this.getProfileCache().save(false); // Paper - Perf: Async GameProfileCache saving
}
// Spigot end
+ // Paper start - move final shutdown items here
@ -266,10 +266,10 @@ index 9e0c5bb92fb45cab7d78c5ad631c64170d48729f..6de6dad36203479677a29ad61e21bc36
}
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index f168c9bb2fa3ca5b3168fb4c420a77e5bba6185b..947cb3b24d6e379b080f3de8cd4ea60e0ca457e4 100644
index 1c56b7cd0cfc8cdc0ccfc7ce79cd3e23bef1b334..c423bf30173d2bf6cd3b202de6d490d45c41bf72 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -613,7 +613,7 @@ public abstract class PlayerList {
@@ -612,7 +612,7 @@ public abstract class PlayerList {
this.cserver.getPluginManager().callEvent(playerQuitEvent);
entityplayer.getBukkitEntity().disconnect(playerQuitEvent.getQuitMessage());
@ -277,7 +277,7 @@ index f168c9bb2fa3ca5b3168fb4c420a77e5bba6185b..947cb3b24d6e379b080f3de8cd4ea60e
+ if (server.isSameThread()) entityplayer.doTick(); // SPIGOT-924 // Paper - don't tick during emergency shutdowns (Watchdog)
// CraftBukkit end
// Paper start - Remove from collideRule team if needed
// Paper start - Configurable player collision; Remove from collideRule team if needed
diff --git a/src/main/java/net/minecraft/util/thread/BlockableEventLoop.java b/src/main/java/net/minecraft/util/thread/BlockableEventLoop.java
index f5829ae484d93b547a5437b85a9621346384a11b..83701fbfaa56a232593ee8f11a3afb8941238bfa 100644
--- a/src/main/java/net/minecraft/util/thread/BlockableEventLoop.java
@ -291,7 +291,7 @@ index f5829ae484d93b547a5437b85a9621346384a11b..83701fbfaa56a232593ee8f11a3afb89
}
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 25ed0f62058fa531d8bf9cf1e8fb99651ee46a67..1e78a00ab36362ff7650410ed2af1a822613de4f 100644
index 7116e2b98a8c6cc026fd9ea8c5f2c00764906a8c..8a3a526f7dbce1090d39232dd310d91cc54efc44 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -940,6 +940,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@ -303,7 +303,7 @@ index 25ed0f62058fa531d8bf9cf1e8fb99651ee46a67..1e78a00ab36362ff7650410ed2af1a82
final String msg = String.format("Entity threw exception at %s:%s,%s,%s", entity.level().getWorld().getName(), entity.getX(), entity.getY(), entity.getZ());
MinecraftServer.LOGGER.error(msg, throwable);
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
index 9e01a22df54492d9c8e9f9defd84014dc109514b..d85ed706703e50f76df8db414827ccd41a5985d9 100644
index 6e1006675339551ca499a57a8f8553020f16a4fa..6daa7fc7bf08e5f915da4a728a96d2e7a3abd14d 100644
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
@@ -1176,6 +1176,7 @@ public class LevelChunk extends ChunkAccess {

View File

@ -19,7 +19,7 @@ index 7a4234abf620b8394307fa01913bc00215a64e23..4b467f1af93452d13829f756d55dee18
private MinecraftTimings() {}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 69b3d89a352fe5cfd51e2e566c9fa4dfbd765263..8817f62324bcf8367bd6d4486e6ed99caf547f4f 100644
index e2e37b75475c7c243245ca3ff78d29c51ff0ad39..399cb6d50b5a49ab873fab9b5f86c986364d49c3 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1353,8 +1353,79 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@ -123,7 +123,7 @@ index 3b0fd733e8fd9639362f251876bea814a2515618..c2973fcfde402b5432db37468e4a40a1
}
}
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 4edae565873fdafdd83a0b4509676d4c62b3bbbe..30b9a46ec74978adeb80222eea67a6a43b3203e2 100644
index 715f6fb68d832545f36184a77f2229c2a1a79f75..ac5c505a9d280fb128bbc59526bb8bbe7aaaf307 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -216,6 +216,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
@ -151,7 +151,7 @@ index 4edae565873fdafdd83a0b4509676d4c62b3bbbe..30b9a46ec74978adeb80222eea67a6a4
}
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index e5944ff3c1118e57c9e7a14cbb5181b2d7f7a79a..267de93f036541a8a31971bcbd0f79678ab35d7b 100644
index ec6b607f6564acceddd694d65ab6014f129250d6..b47e9d029c72f1ce397fcfaa3d6da8bddb2cb4a8 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -929,6 +929,11 @@ public abstract class Level implements LevelAccessor, AutoCloseable {

View File

@ -90,7 +90,7 @@ index 0000000000000000000000000000000000000000..7d93652c1abbb6aee6eb7c26cf35d4d0
+ }
+}
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 30b9a46ec74978adeb80222eea67a6a43b3203e2..88f8821aba04adb23b11531a93f395381a0e4ce7 100644
index ac5c505a9d280fb128bbc59526bb8bbe7aaaf307..6ced436bda5beaa107ad333d35f39efe366f0595 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -855,6 +855,10 @@ public class ServerLevel extends Level implements WorldGenLevel {
@ -258,7 +258,7 @@ index 68648c5a5e3ff079f832092af0f2f801c42d1ede..8bafd5fd7499ba4a04bf706cfd1e1560
+ // Paper end
}
diff --git a/src/main/java/net/minecraft/util/SimpleBitStorage.java b/src/main/java/net/minecraft/util/SimpleBitStorage.java
index 2b3fd62dca2d1475075b5dcde56cea85b749cb44..e4d0d7e8fc58b8f9f614d74a141e452166e0364c 100644
index 18d8f3114831310c5f10da43d4333849d4eb6cae..8eb4d55e76c3a9827f896844cef9f3583914a49c 100644
--- a/src/main/java/net/minecraft/util/SimpleBitStorage.java
+++ b/src/main/java/net/minecraft/util/SimpleBitStorage.java
@@ -124,6 +124,28 @@ public class SimpleBitStorage implements BitStorage {
@ -291,7 +291,7 @@ index 2b3fd62dca2d1475075b5dcde56cea85b749cb44..e4d0d7e8fc58b8f9f614d74a141e4521
public void getAll(IntConsumer action) {
int i = 0;
diff --git a/src/main/java/net/minecraft/util/ZeroBitStorage.java b/src/main/java/net/minecraft/util/ZeroBitStorage.java
index f0f764f36fb92c64ab2dc8a0a50c3f48321c3c9a..311625277a26c9c187025a1036978229241b965f 100644
index b7a3f15dc1ed9e9322a86921052984c7cbd3262a..f8de91393564b3691c17339ac9196cc0fc1cf748 100644
--- a/src/main/java/net/minecraft/util/ZeroBitStorage.java
+++ b/src/main/java/net/minecraft/util/ZeroBitStorage.java
@@ -46,6 +46,15 @@ public class ZeroBitStorage implements BitStorage {
@ -324,7 +324,7 @@ index 1a2a4dcb3cfa2690f2aa936a6c176319d807bd74..f97bdfbd07db000845d3b791de64056c
public BlockPos getHomePos() {
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 267de93f036541a8a31971bcbd0f79678ab35d7b..c003f9b8109bd3e688d5b160150d229be4ae4d8a 100644
index b47e9d029c72f1ce397fcfaa3d6da8bddb2cb4a8..1dfc48d4beabff13d5affd662acc99f49902843a 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -1400,10 +1400,18 @@ public abstract class Level implements LevelAccessor, AutoCloseable {

View File

@ -76,7 +76,7 @@ index 454d0187ff8370a0d99cca051ee0a8c50b39cfb7..3e2d5dcd62775b6ed7c0ce0ba51a71b6
});
throw RunningOnDifferentThreadException.RUNNING_ON_DIFFERENT_THREAD;
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 88f8821aba04adb23b11531a93f395381a0e4ce7..2d4830b4b7df1516c75de1fefd6f8176d8ef16a2 100644
index 6ced436bda5beaa107ad333d35f39efe366f0595..38c57ad6f028db325bb78fd849e9150af2d6d2ca 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1239,7 +1239,26 @@ public class ServerLevel extends Level implements WorldGenLevel {
@ -122,7 +122,7 @@ index 88f8821aba04adb23b11531a93f395381a0e4ce7..2d4830b4b7df1516c75de1fefd6f8176
private void tickPassenger(Entity vehicle, Entity passenger) {
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 199624dee66e0d47d110ee077646111cbdf2ccbd..1242487930b28fce587114a51a4da3cf9086b762 100644
index 01cebabe1410f220743205a44b74c63e4cfd171e..4bf49ef00ad54869966a84c34ebe5f1829f19417 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -1051,7 +1051,42 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S

View File

@ -2201,10 +2201,10 @@ index bd1a53e2ce2644681c23f8cf678afa2a99166d9b..4ef7cc68bdcad9eaa157325a195aa74e
}
}
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 947cb3b24d6e379b080f3de8cd4ea60e0ca457e4..5a932f329f67fd01a263b9536cbfb1c9a011f746 100644
index c423bf30173d2bf6cd3b202de6d490d45c41bf72..c3d0a1c562a26b6025718f848d01ce7ec05793e4 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -936,7 +936,7 @@ public abstract class PlayerList {
@@ -935,7 +935,7 @@ public abstract class PlayerList {
entityplayer1.forceSetPositionRotation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
worldserver1.getChunkSource().addRegionTicket(net.minecraft.server.level.TicketType.POST_TELEPORT, new net.minecraft.world.level.ChunkPos(location.getBlockX() >> 4, location.getBlockZ() >> 4), 1, entityplayer.getId()); // Paper
@ -2214,7 +2214,7 @@ index 947cb3b24d6e379b080f3de8cd4ea60e0ca457e4..5a932f329f67fd01a263b9536cbfb1c9
entityplayer1.setPos(entityplayer1.getX(), entityplayer1.getY() + 1.0D, entityplayer1.getZ());
}
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 1242487930b28fce587114a51a4da3cf9086b762..5bccb05967ac48175d6c45a7d19f83b1f61e5de9 100644
index 4bf49ef00ad54869966a84c34ebe5f1829f19417..1b72c095f35ba4d94aae0b626aaf2ff500352ad9 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -1237,9 +1237,44 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@ -2600,7 +2600,7 @@ index 8c436d16914e160be8e3074badc1293af2ae6b31..a3d15f30eaab29d85cb6b3d693df9980
// Paper start
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index c003f9b8109bd3e688d5b160150d229be4ae4d8a..4d91ff3dda92bdd503dd16d4f9e56aa18458592b 100644
index 1dfc48d4beabff13d5affd662acc99f49902843a..c405265a536b17b93e47384fbb699670f0ac431f 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -299,6 +299,10 @@ public abstract class Level implements LevelAccessor, AutoCloseable {

View File

@ -2008,16 +2008,16 @@ index 0000000000000000000000000000000000000000..33cd90c30c22200a4e1ae64f40a0bf78
+ }
+}
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 2d4830b4b7df1516c75de1fefd6f8176d8ef16a2..1f0e9689acc1470a65a3c51505d5a386da7abc8e 100644
index 38c57ad6f028db325bb78fd849e9150af2d6d2ca..c8ed96a458ab05f20c5904d4e449f08f68522184 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -223,6 +223,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
public final UUID uuid;
public boolean hasPhysicsEvent = true; // Paper
public boolean hasPhysicsEvent = true; // Paper - BlockPhysicsEvent
public boolean hasEntityMoveEvent; // Paper - Add EntityMoveEvent
+ private final alternate.current.wire.WireHandler wireHandler = new alternate.current.wire.WireHandler(this); // Paper - optimize redstone (Alternate Current)
@Override public LevelChunk getChunkIfLoaded(int x, int z) { // Paper - this was added in world too but keeping here for NMS ABI
public LevelChunk getChunkIfLoaded(int x, int z) {
return this.chunkSource.getChunkAtIfLoadedImmediately(x, z); // Paper - Use getChunkIfLoadedImmediately
@@ -2593,6 +2594,13 @@ public class ServerLevel extends Level implements WorldGenLevel {
return crashreportsystemdetails;
@ -2034,7 +2034,7 @@ index 2d4830b4b7df1516c75de1fefd6f8176d8ef16a2..1f0e9689acc1470a65a3c51505d5a386
EntityCallbacks() {}
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 4d91ff3dda92bdd503dd16d4f9e56aa18458592b..ae42d5b3dea423a144056c64337af213609923d4 100644
index c405265a536b17b93e47384fbb699670f0ac431f..0f4e0a20cc6478d37f6e6a39a551532855021380 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -1897,4 +1897,14 @@ public abstract class Level implements LevelAccessor, AutoCloseable {

View File

@ -5,7 +5,7 @@ Subject: [PATCH] optimize dirt and snow spreading
diff --git a/src/main/java/net/minecraft/world/level/block/SpreadingSnowyDirtBlock.java b/src/main/java/net/minecraft/world/level/block/SpreadingSnowyDirtBlock.java
index f38524cbcaa908644d901bf0929331d6dfd99ed9..35a70bd30bc4beb06de4bb6e305ec3a787b43044 100644
index 4e2e80006bd4edae227af7be5ca8e3284b7494f6..f3003a3832deff7724d28b4b3a091f4802a4cb29 100644
--- a/src/main/java/net/minecraft/world/level/block/SpreadingSnowyDirtBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/SpreadingSnowyDirtBlock.java
@@ -19,8 +19,13 @@ public abstract class SpreadingSnowyDirtBlock extends SnowyDirtBlock {
@ -41,7 +41,7 @@ index f38524cbcaa908644d901bf0929331d6dfd99ed9..35a70bd30bc4beb06de4bb6e305ec3a7
@Override
public void randomTick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) {
if (this instanceof GrassBlock && world.paperConfig().tickRates.grassSpread != 1 && (world.paperConfig().tickRates.grassSpread < 1 || (MinecraftServer.currentTick + pos.hashCode()) % world.paperConfig().tickRates.grassSpread != 0)) { return; } // Paper
if (this instanceof GrassBlock && world.paperConfig().tickRates.grassSpread != 1 && (world.paperConfig().tickRates.grassSpread < 1 || (MinecraftServer.currentTick + pos.hashCode()) % world.paperConfig().tickRates.grassSpread != 0)) { return; } // Paper - Configurable random tick rates for blocks
- if (!SpreadingSnowyDirtBlock.canBeGrass(state, world, pos)) {
+ // Paper start - Perf: optimize dirt and snow spreading
+ net.minecraft.world.level.chunk.ChunkAccess cachedBlockChunk = world.getChunkIfLoaded(pos);

View File

@ -50,13 +50,13 @@ index 0000000000000000000000000000000000000000..5c42823726e70ce6c9d0121d07431548
+ }
+}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 8817f62324bcf8367bd6d4486e6ed99caf547f4f..8c6962029ae04285351e5f16ab4c010cd28f486a 100644
index 399cb6d50b5a49ab873fab9b5f86c986364d49c3..a18d9569627ba39ad2898be61d40e147d601f84e 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1687,6 +1687,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
while (iterator.hasNext()) {
ServerLevel worldserver = (ServerLevel) iterator.next();
worldserver.hasPhysicsEvent = org.bukkit.event.block.BlockPhysicsEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper
worldserver.hasPhysicsEvent = org.bukkit.event.block.BlockPhysicsEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper - BlockPhysicsEvent
+ net.minecraft.world.level.block.entity.HopperBlockEntity.skipHopperEvents = worldserver.paperConfig().hopper.disableMoveEvent || org.bukkit.event.inventory.InventoryMoveItemEvent.getHandlerList().getRegisteredListeners().length == 0; // Paper - Perf: Optimize Hoppers
worldserver.hasEntityMoveEvent = io.papermc.paper.event.entity.EntityMoveEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper - Add EntityMoveEvent

View File

@ -8,7 +8,7 @@ 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 8c6962029ae04285351e5f16ab4c010cd28f486a..c0ae62a5e9af48e7778b37d64aeef7e069256d4c 100644
index a18d9569627ba39ad2898be61d40e147d601f84e..559e159a0cfdefb5a0d69224409d91c4ad67371a 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -311,6 +311,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@ -24,11 +24,11 @@ index 8c6962029ae04285351e5f16ab4c010cd28f486a..c0ae62a5e9af48e7778b37d64aeef7e0
while (iterator.hasNext()) {
ServerLevel worldserver = (ServerLevel) iterator.next();
+ worldserver.updateLagCompensationTick(); // Paper - lag compensation
worldserver.hasPhysicsEvent = org.bukkit.event.block.BlockPhysicsEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper
worldserver.hasPhysicsEvent = org.bukkit.event.block.BlockPhysicsEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper - BlockPhysicsEvent
net.minecraft.world.level.block.entity.HopperBlockEntity.skipHopperEvents = worldserver.paperConfig().hopper.disableMoveEvent || org.bukkit.event.inventory.InventoryMoveItemEvent.getHandlerList().getRegisteredListeners().length == 0; // Paper - Perf: Optimize Hoppers
worldserver.hasEntityMoveEvent = io.papermc.paper.event.entity.EntityMoveEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper - Add EntityMoveEvent
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 1f0e9689acc1470a65a3c51505d5a386da7abc8e..ffe910da16c33ebbce77fef441d9d5c2d097ce61 100644
index c8ed96a458ab05f20c5904d4e449f08f68522184..f32a28474b7f604df871a9bf3e1fb2e4077c8bc1 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -565,6 +565,17 @@ public class ServerLevel extends Level implements WorldGenLevel {
@ -63,7 +63,7 @@ index 83e017efd15d0ecaffc327f02d6d5330c8ed6937..cfd4ac06a9af6bf3fac293110482e1df
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 b920f72e659956cc2d2d44743caddb0136d467e4..ca1900d29a86b9b39078da39b071950128c08c23 100644
index a0b556d91151ba5941f5a433c303c27e4000db5e..fb6cf6e8c72c11b58788c50c2ed34c4e25fc94f9 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3827,6 +3827,10 @@ public abstract class LivingEntity extends Entity implements Attackable {

View File

@ -8,7 +8,7 @@ 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 ffe910da16c33ebbce77fef441d9d5c2d097ce61..fa203e66887f5db1083728166e2f81ea4f656bd7 100644
index f32a28474b7f604df871a9bf3e1fb2e4077c8bc1..8e9936c3725194775cf9b342bd44275a0e2a0088 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -576,6 +576,115 @@ public class ServerLevel extends Level implements WorldGenLevel {