Archiviert
13
0

[ci skip] Add more identifying patch comments

Dieser Commit ist enthalten in:
Nassim Jahnke 2024-01-21 12:53:04 +01:00
Ursprung f7dd304b1f
Commit 98e6d20ebd
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: EF6771C01F6EF02F
66 geänderte Dateien mit 315 neuen und 355 gelöschten Zeilen

Datei anzeigen

@ -5,18 +5,10 @@ Subject: [PATCH] Add GameEvent tags
diff --git a/src/main/java/org/bukkit/Tag.java b/src/main/java/org/bukkit/Tag.java diff --git a/src/main/java/org/bukkit/Tag.java b/src/main/java/org/bukkit/Tag.java
index 31bdecf8cbea40129a568c1761f27fa1ae0f535a..35d52539f264202d50d70e6aaab4678571dc8ad2 100644 index 31bdecf8cbea40129a568c1761f27fa1ae0f535a..741c34b74811666c3b38e9d6fbb74b0a7bc64699 100644
--- a/src/main/java/org/bukkit/Tag.java --- a/src/main/java/org/bukkit/Tag.java
+++ b/src/main/java/org/bukkit/Tag.java +++ b/src/main/java/org/bukkit/Tag.java
@@ -968,6 +968,7 @@ public interface Tag<T extends Keyed> extends Keyed { @@ -985,6 +985,25 @@ public interface Tag<T extends Keyed> extends Keyed {
* Vanilla tag representing entities which are dismounted when underwater.
*/
Tag<EntityType> ENTITY_TYPES_DISMOUNTS_UNDERWATER = Bukkit.getTag(REGISTRY_ENTITY_TYPES, NamespacedKey.minecraft("dismounts_underwater"), EntityType.class);
+
/**
* Vanilla tag representing entities which are not controlled by their mount.
*/
@@ -985,6 +986,25 @@ public interface Tag<T extends Keyed> extends Keyed {
*/ */
Tag<EntityType> ENTITY_TYPES_CAN_TURN_IN_BOATS = Bukkit.getTag(REGISTRY_ENTITY_TYPES, NamespacedKey.minecraft("can_turn_in_boats"), EntityType.class); Tag<EntityType> ENTITY_TYPES_CAN_TURN_IN_BOATS = Bukkit.getTag(REGISTRY_ENTITY_TYPES, NamespacedKey.minecraft("can_turn_in_boats"), EntityType.class);

Datei anzeigen

@ -579,10 +579,10 @@ index 72ea6ddd00eed73459d700d657929f83ba1ca7ee..bb1b6bc9349af6dec369420035e86092
ITEM_CHORUS_FRUIT_TELEPORT("item.chorus_fruit.teleport"), ITEM_CHORUS_FRUIT_TELEPORT("item.chorus_fruit.teleport"),
ITEM_CROP_PLANT("item.crop.plant"), ITEM_CROP_PLANT("item.crop.plant"),
diff --git a/src/main/java/org/bukkit/Tag.java b/src/main/java/org/bukkit/Tag.java diff --git a/src/main/java/org/bukkit/Tag.java b/src/main/java/org/bukkit/Tag.java
index 35d52539f264202d50d70e6aaab4678571dc8ad2..8b584130c039ba915f28dc87f13c2538f26134f2 100644 index 741c34b74811666c3b38e9d6fbb74b0a7bc64699..1137a21afa0283fa3d391415e98171e3c160aa1f 100644
--- a/src/main/java/org/bukkit/Tag.java --- a/src/main/java/org/bukkit/Tag.java
+++ b/src/main/java/org/bukkit/Tag.java +++ b/src/main/java/org/bukkit/Tag.java
@@ -976,14 +976,17 @@ public interface Tag<T extends Keyed> extends Keyed { @@ -975,14 +975,17 @@ public interface Tag<T extends Keyed> extends Keyed {
/** /**
* Vanilla tag representing entities which deflect arrows. * Vanilla tag representing entities which deflect arrows.
*/ */

Datei anzeigen

@ -1,7 +1,7 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co> From: Aikar <aikar@aikar.co>
Date: Sat, 6 Apr 2019 10:16:48 -0400 Date: Sat, 6 Apr 2019 10:16:48 -0400
Subject: [PATCH] Optimize Captured TileEntity Lookup Subject: [PATCH] Optimize Captured BlockEntity Lookup
upstream was doing a containsKey/get pattern, and always doing it at that. upstream was doing a containsKey/get pattern, and always doing it at that.
that scenario is only even valid if were in the middle of a block place. that scenario is only even valid if were in the middle of a block place.
@ -10,7 +10,7 @@ Optimize to check if the captured list even has values in it, and also to
just do a get call since the value can never be null. just do a get call since the value can never be null.
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index b10c93cbcf264a3e13d48f30a2c09ae5568a510e..3fdec0ff323ac94517f1ab9a13764a8959148127 100644 index b10c93cbcf264a3e13d48f30a2c09ae5568a510e..c8b2399c55c8ea4fcb953202c0ea74d95b47c359 100644
--- a/src/main/java/net/minecraft/world/level/Level.java --- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -998,9 +998,12 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -998,9 +998,12 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@ -19,12 +19,12 @@ index b10c93cbcf264a3e13d48f30a2c09ae5568a510e..3fdec0ff323ac94517f1ab9a13764a89
public BlockEntity getBlockEntity(BlockPos blockposition, boolean validate) { public BlockEntity getBlockEntity(BlockPos blockposition, boolean validate) {
- if (this.capturedTileEntities.containsKey(blockposition)) { - if (this.capturedTileEntities.containsKey(blockposition)) {
- return this.capturedTileEntities.get(blockposition); - return this.capturedTileEntities.get(blockposition);
+ // Paper start - Optimize capturedTileEntities lookup + // Paper start - Perf: Optimize capturedTileEntities lookup
+ net.minecraft.world.level.block.entity.BlockEntity blockEntity; + net.minecraft.world.level.block.entity.BlockEntity blockEntity;
+ if (!this.capturedTileEntities.isEmpty() && (blockEntity = this.capturedTileEntities.get(blockposition)) != null) { + if (!this.capturedTileEntities.isEmpty() && (blockEntity = this.capturedTileEntities.get(blockposition)) != null) {
+ return blockEntity; + return blockEntity;
} }
+ // Paper end + // Paper end - Perf: Optimize capturedTileEntities lookup
// CraftBukkit end // CraftBukkit end
return this.isOutsideBuildHeight(blockposition) ? null : (!this.isClientSide && !io.papermc.paper.util.TickThread.isTickThread() ? null : this.getChunkAt(blockposition).getBlockEntity(blockposition, LevelChunk.EntityCreationType.IMMEDIATE)); // Paper - rewrite chunk system return this.isOutsideBuildHeight(blockposition) ? null : (!this.isClientSide && !io.papermc.paper.util.TickThread.isTickThread() ? null : this.getChunkAt(blockposition).getBlockEntity(blockposition, LevelChunk.EntityCreationType.IMMEDIATE)); // Paper - rewrite chunk system
} }

Datei anzeigen

@ -9,7 +9,7 @@ public net.minecraft.world.level.BaseSpawner delay(Lnet/minecraft/world/level/Le
public net.minecraft.world.level.BaseSpawner setNextSpawnData(Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/SpawnData;)V public net.minecraft.world.level.BaseSpawner setNextSpawnData(Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/SpawnData;)V
diff --git a/src/main/java/net/minecraft/world/level/BaseSpawner.java b/src/main/java/net/minecraft/world/level/BaseSpawner.java diff --git a/src/main/java/net/minecraft/world/level/BaseSpawner.java b/src/main/java/net/minecraft/world/level/BaseSpawner.java
index 231674f1483ad71630ac71ba92efc50f94a5659b..0578ac12d92f9af0b0113587db9351b4a41bedd5 100644 index 231674f1483ad71630ac71ba92efc50f94a5659b..3b48d50bd3727647dc2d73cccc3fbd8a4f649715 100644
--- a/src/main/java/net/minecraft/world/level/BaseSpawner.java --- a/src/main/java/net/minecraft/world/level/BaseSpawner.java
+++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java +++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java
@@ -235,7 +235,13 @@ public abstract class BaseSpawner { @@ -235,7 +235,13 @@ public abstract class BaseSpawner {
@ -64,7 +64,7 @@ index 231674f1483ad71630ac71ba92efc50f94a5659b..0578ac12d92f9af0b0113587db9351b4
+ +
+ nbt.putShort("MinSpawnDelay", (short) Math.min(Short.MAX_VALUE, this.minSpawnDelay)); + nbt.putShort("MinSpawnDelay", (short) Math.min(Short.MAX_VALUE, this.minSpawnDelay));
+ nbt.putShort("MaxSpawnDelay", (short) Math.min(Short.MAX_VALUE, this.maxSpawnDelay)); + nbt.putShort("MaxSpawnDelay", (short) Math.min(Short.MAX_VALUE, this.maxSpawnDelay));
+ // Paper nbt + // Paper end
nbt.putShort("SpawnCount", (short) this.spawnCount); nbt.putShort("SpawnCount", (short) this.spawnCount);
nbt.putShort("MaxNearbyEntities", (short) this.maxNearbyEntities); nbt.putShort("MaxNearbyEntities", (short) this.maxNearbyEntities);
nbt.putShort("RequiredPlayerRange", (short) this.requiredPlayerRange); nbt.putShort("RequiredPlayerRange", (short) this.requiredPlayerRange);

Datei anzeigen

@ -6,50 +6,49 @@ Subject: [PATCH] Configurable Keep Spawn Loaded range per world
This lets you disable it for some worlds and lower it for others. 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 diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index f317b9fdb2bfbae9babd64d4801f190042fc1867..6407af497c719d0f6a4446192bed622af34d6bc6 100644 index f317b9fdb2bfbae9babd64d4801f190042fc1867..1d069e33f64463e96199fa336336ffc44e3ed10e 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -768,30 +768,33 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -768,30 +768,33 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
// CraftBukkit start // CraftBukkit start
public void prepareLevels(ChunkProgressListener worldloadlistener, ServerLevel worldserver) { public void prepareLevels(ChunkProgressListener worldloadlistener, ServerLevel worldserver) {
+ ServerChunkCache chunkproviderserver = worldserver.getChunkSource(); // Paper + ServerChunkCache chunkproviderserver = worldserver.getChunkSource(); // Paper - Configurable Keep Spawn Loaded range per world
// WorldServer worldserver = this.overworld(); // WorldServer worldserver = this.overworld();
this.forceTicks = true; this.forceTicks = true;
// CraftBukkit end // CraftBukkit end
+ if (worldserver.getWorld().getKeepSpawnInMemory()) { // Paper + if (worldserver.getWorld().getKeepSpawnInMemory()) { // Paper - Configurable Keep Spawn Loaded range per world
MinecraftServer.LOGGER.info("Preparing start region for dimension {}", worldserver.dimension().location()); MinecraftServer.LOGGER.info("Preparing start region for dimension {}", worldserver.dimension().location());
BlockPos blockposition = worldserver.getSharedSpawnPos(); BlockPos blockposition = worldserver.getSharedSpawnPos();
worldloadlistener.updateSpawnPos(new ChunkPos(blockposition)); worldloadlistener.updateSpawnPos(new ChunkPos(blockposition));
- ServerChunkCache chunkproviderserver = worldserver.getChunkSource(); - ServerChunkCache chunkproviderserver = worldserver.getChunkSource();
+ //ChunkProviderServer chunkproviderserver = worldserver.getChunkProvider(); // Paper - move up + //ChunkProviderServer chunkproviderserver = worldserver.getChunkProvider(); // Paper - Configurable Keep Spawn Loaded range per world; move up
this.nextTickTimeNanos = Util.getNanos(); this.nextTickTimeNanos = Util.getNanos();
- // CraftBukkit start - // CraftBukkit start
- if (worldserver.getWorld().getKeepSpawnInMemory()) { - if (worldserver.getWorld().getKeepSpawnInMemory()) {
- chunkproviderserver.addRegionTicket(TicketType.START, new ChunkPos(blockposition), 11, Unit.INSTANCE); - chunkproviderserver.addRegionTicket(TicketType.START, new ChunkPos(blockposition), 11, Unit.INSTANCE);
- + // Paper start - Configurable Keep Spawn Loaded range per world
- while (chunkproviderserver.getTickingGenerated() != 441) {
- // this.nextTickTimeNanos = SystemUtils.getNanos() + MinecraftServer.PREPARE_LEVELS_DEFAULT_DELAY_NANOS;
- this.executeModerately();
- }
- }
+ // Paper start - configurable spawn reason
+ int radiusBlocks = worldserver.paperConfig().spawn.keepSpawnLoadedRange * 16; + int radiusBlocks = worldserver.paperConfig().spawn.keepSpawnLoadedRange * 16;
+ int radiusChunks = radiusBlocks / 16 + ((radiusBlocks & 15) != 0 ? 1 : 0); + int radiusChunks = radiusBlocks / 16 + ((radiusBlocks & 15) != 0 ? 1 : 0);
+ int totalChunks = ((radiusChunks) * 2 + 1); + int totalChunks = ((radiusChunks) * 2 + 1);
+ totalChunks *= totalChunks; + totalChunks *= totalChunks;
+ worldloadlistener.setChunkRadius(radiusBlocks / 16); + worldloadlistener.setChunkRadius(radiusBlocks / 16);
+
- while (chunkproviderserver.getTickingGenerated() != 441) {
- // this.nextTickTimeNanos = SystemUtils.getNanos() + MinecraftServer.PREPARE_LEVELS_DEFAULT_DELAY_NANOS;
- this.executeModerately();
- }
- }
+ worldserver.addTicketsForSpawn(radiusBlocks, blockposition); + worldserver.addTicketsForSpawn(radiusBlocks, blockposition);
+ // Paper end + // Paper end - Configurable Keep Spawn Loaded range per world
// this.nextTickTimeNanos = SystemUtils.getNanos() + MinecraftServer.PREPARE_LEVELS_DEFAULT_DELAY_NANOS; // this.nextTickTimeNanos = SystemUtils.getNanos() + MinecraftServer.PREPARE_LEVELS_DEFAULT_DELAY_NANOS;
this.executeModerately(); this.executeModerately();
// Iterator iterator = this.levels.values().iterator(); // Iterator iterator = this.levels.values().iterator();
+ } + } // Paper - Configurable Keep Spawn Loaded range per world
if (true) { if (true) {
ServerLevel worldserver1 = worldserver; ServerLevel worldserver1 = worldserver;
@ -58,19 +57,19 @@ index f317b9fdb2bfbae9babd64d4801f190042fc1867..6407af497c719d0f6a4446192bed622a
this.executeModerately(); this.executeModerately();
// CraftBukkit end // CraftBukkit end
- worldloadlistener.stop(); - worldloadlistener.stop();
+ if (worldserver.getWorld().getKeepSpawnInMemory()) worldloadlistener.stop(); // Paper + if (worldserver.getWorld().getKeepSpawnInMemory()) worldloadlistener.stop(); // Paper - Configurable Keep Spawn Loaded range per world
// CraftBukkit start // CraftBukkit start
// this.updateMobSpawningFlags(); // this.updateMobSpawningFlags();
worldserver.setSpawnSettings(this.isSpawningMonsters(), this.isSpawningAnimals()); 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 diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 43424a9d8e985f4965b4d101f7fee398e3d1f52c..978f0f20c3aceb1c6f967c2bec3d010e344aad0c 100644 index 43424a9d8e985f4965b4d101f7fee398e3d1f52c..e8d54a421bb743844c031a4e43965e5873f79995 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1897,12 +1897,84 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -1897,12 +1897,84 @@ public class ServerLevel extends Level implements WorldGenLevel {
return ((MapIndex) this.getServer().overworld().getDataStorage().computeIfAbsent(MapIndex.factory(), "idcounts")).getFreeAuxValueForMap(); return ((MapIndex) this.getServer().overworld().getDataStorage().computeIfAbsent(MapIndex.factory(), "idcounts")).getFreeAuxValueForMap();
} }
+ // Paper start - helper function for configurable spawn radius + // Paper start - Configurable Keep Spawn Loaded range per world
+ public void addTicketsForSpawn(int radiusInBlocks, BlockPos spawn) { + public void addTicketsForSpawn(int radiusInBlocks, BlockPos spawn) {
+ // In order to respect vanilla behavior, which is ensuring everything but the spawn border can tick, we add tickets + // In order to respect vanilla behavior, which is ensuring everything but the spawn border can tick, we add tickets
+ // with level 31 for the non-border spawn chunks + // with level 31 for the non-border spawn chunks
@ -135,11 +134,11 @@ index 43424a9d8e985f4965b4d101f7fee398e3d1f52c..978f0f20c3aceb1c6f967c2bec3d010e
+ chunkproviderserver.removeRegionTicket(TicketType.START, new ChunkPos(spawn.offset(-radiusInBlocks, 0, z)), 1, Unit.INSTANCE); // level 32 + chunkproviderserver.removeRegionTicket(TicketType.START, new ChunkPos(spawn.offset(-radiusInBlocks, 0, z)), 1, Unit.INSTANCE); // level 32
+ } + }
+ } + }
+ // Paper end + // Paper end - Configurable Keep Spawn Loaded range per world
+ +
public void setDefaultSpawnPos(BlockPos pos, float angle) { public void setDefaultSpawnPos(BlockPos pos, float angle) {
- ChunkPos chunkcoordintpair = new ChunkPos(new BlockPos(this.levelData.getXSpawn(), 0, this.levelData.getZSpawn())); - ChunkPos chunkcoordintpair = new ChunkPos(new BlockPos(this.levelData.getXSpawn(), 0, this.levelData.getZSpawn()));
+ // Paper - configurable spawn radius + // Paper start - Configurable Keep Spawn Loaded range per world
+ BlockPos prevSpawn = this.getSharedSpawnPos(); + BlockPos prevSpawn = this.getSharedSpawnPos();
+ //ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(new BlockPosition(this.worldData.a(), 0, this.worldData.c())); + //ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(new BlockPosition(this.worldData.a(), 0, this.worldData.c()));
@ -155,7 +154,7 @@ index 43424a9d8e985f4965b4d101f7fee398e3d1f52c..978f0f20c3aceb1c6f967c2bec3d010e
} }
diff --git a/src/main/java/net/minecraft/server/level/progress/ChunkProgressListener.java b/src/main/java/net/minecraft/server/level/progress/ChunkProgressListener.java diff --git a/src/main/java/net/minecraft/server/level/progress/ChunkProgressListener.java b/src/main/java/net/minecraft/server/level/progress/ChunkProgressListener.java
index 1b565b2809c2d367e21971c5154f35c9763995e6..b0f899835ded29aff108d1674bf4a1a6c89693db 100644 index 1b565b2809c2d367e21971c5154f35c9763995e6..4792eaa30464f4c4ca7f2d6cf20f734beed81f23 100644
--- a/src/main/java/net/minecraft/server/level/progress/ChunkProgressListener.java --- a/src/main/java/net/minecraft/server/level/progress/ChunkProgressListener.java
+++ b/src/main/java/net/minecraft/server/level/progress/ChunkProgressListener.java +++ b/src/main/java/net/minecraft/server/level/progress/ChunkProgressListener.java
@@ -12,4 +12,6 @@ public interface ChunkProgressListener { @@ -12,4 +12,6 @@ public interface ChunkProgressListener {
@ -163,10 +162,10 @@ index 1b565b2809c2d367e21971c5154f35c9763995e6..b0f899835ded29aff108d1674bf4a1a6
void stop(); void stop();
+ +
+ void setChunkRadius(int radius); // Paper - allow changing chunk radius + void setChunkRadius(int radius); // Paper - Configurable Keep Spawn Loaded range per world
} }
diff --git a/src/main/java/net/minecraft/server/level/progress/LoggerChunkProgressListener.java b/src/main/java/net/minecraft/server/level/progress/LoggerChunkProgressListener.java diff --git a/src/main/java/net/minecraft/server/level/progress/LoggerChunkProgressListener.java b/src/main/java/net/minecraft/server/level/progress/LoggerChunkProgressListener.java
index 4d2348df25410a0b5364eec066880326d6667dad..b9176ec634ed806dda6ce84b8978803111462428 100644 index 4d2348df25410a0b5364eec066880326d6667dad..3754cda7e7731935893359d84f3ae06157a347c6 100644
--- a/src/main/java/net/minecraft/server/level/progress/LoggerChunkProgressListener.java --- a/src/main/java/net/minecraft/server/level/progress/LoggerChunkProgressListener.java
+++ b/src/main/java/net/minecraft/server/level/progress/LoggerChunkProgressListener.java +++ b/src/main/java/net/minecraft/server/level/progress/LoggerChunkProgressListener.java
@@ -11,12 +11,19 @@ import org.slf4j.Logger; @@ -11,12 +11,19 @@ import org.slf4j.Logger;
@ -180,13 +179,13 @@ index 4d2348df25410a0b5364eec066880326d6667dad..b9176ec634ed806dda6ce84b89788031
private long nextTickTime = Long.MAX_VALUE; private long nextTickTime = Long.MAX_VALUE;
public LoggerChunkProgressListener(int radius) { public LoggerChunkProgressListener(int radius) {
+ // Paper start - Allow changing radius later for configurable spawn patch + // Paper start - Configurable Keep Spawn Loaded range per world
+ this.setChunkRadius(radius); // Move to method + this.setChunkRadius(radius); // Move to method
+ } + }
+ +
+ @Override + @Override
+ public void setChunkRadius(int radius) { + public void setChunkRadius(int radius) {
+ // Paper end + // Paper end - Configurable Keep Spawn Loaded range per world
int i = radius * 2 + 1; int i = radius * 2 + 1;
this.maxCount = i * i; this.maxCount = i * i;
} }

Datei anzeigen

@ -33,7 +33,7 @@ this fix, as the data will remain in the oversized file. Once the server returns
to a jar with this fix, the data will be restored. to a jar with this fix, the data will be restored.
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 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 2a7f17726a161ddbcd0397fb4332de6980199c38..72dacdc271325c814fb43cd6daaf3a209801ffda 100644 index 2a7f17726a161ddbcd0397fb4332de6980199c38..69ed808ca5fbfb9191d0818bb0f1c839d11d9d11 100644
--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java --- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java
@@ -18,8 +18,11 @@ import java.nio.file.LinkOption; @@ -18,8 +18,11 @@ import java.nio.file.LinkOption;
@ -71,7 +71,7 @@ index 2a7f17726a161ddbcd0397fb4332de6980199c38..72dacdc271325c814fb43cd6daaf3a20
+ // Paper start + // Paper start
+ private final byte[] oversized = new byte[1024]; + private final byte[] oversized = new byte[1024];
+ private int oversizedCount = 0; + private int oversizedCount;
+ +
+ private synchronized void initOversizedState() throws IOException { + private synchronized void initOversizedState() throws IOException {
+ Path metaFile = getOversizedMetaFile(); + Path metaFile = getOversizedMetaFile();
@ -141,10 +141,10 @@ index 2a7f17726a161ddbcd0397fb4332de6980199c38..72dacdc271325c814fb43cd6daaf3a20
private final ChunkPos pos; private final ChunkPos pos;
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 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 465ad0bae446a20e941e8f2dbf2d85f2627482b9..2ab7060f5c9a54bc7beb819f381a202c977f0a80 100644 index 465ad0bae446a20e941e8f2dbf2d85f2627482b9..affd43308ac565066cefa799238e46b75a28b270 100644
--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java --- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
@@ -121,6 +121,71 @@ public class RegionFileStorage implements AutoCloseable { @@ -121,6 +121,43 @@ public class RegionFileStorage implements AutoCloseable {
} }
} }
@ -153,22 +153,6 @@ index 465ad0bae446a20e941e8f2dbf2d85f2627482b9..2ab7060f5c9a54bc7beb819f381a202c
+ org.apache.logging.log4j.LogManager.getLogger().fatal(msg + " (" + file.toString().replaceAll(".+[\\\\/]", "") + " - " + x + "," + z + ") Go clean it up to remove this message. /minecraft:tp " + (x<<4)+" 128 "+(z<<4) + " - DO NOT REPORT THIS TO PAPER - You may ask for help on Discord, but do not file an issue. These error messages can not be removed."); + org.apache.logging.log4j.LogManager.getLogger().fatal(msg + " (" + file.toString().replaceAll(".+[\\\\/]", "") + " - " + x + "," + z + ") Go clean it up to remove this message. /minecraft:tp " + (x<<4)+" 128 "+(z<<4) + " - DO NOT REPORT THIS TO PAPER - You may ask for help on Discord, but do not file an issue. These error messages can not be removed.");
+ } + }
+ +
+ private static final int DEFAULT_SIZE_THRESHOLD = 1024 * 8;
+ private static final int OVERZEALOUS_TOTAL_THRESHOLD = 1024 * 64;
+ private static final int OVERZEALOUS_THRESHOLD = 1024;
+ private static int SIZE_THRESHOLD = DEFAULT_SIZE_THRESHOLD;
+ private static void resetFilterThresholds() {
+ SIZE_THRESHOLD = Math.max(1024 * 4, Integer.getInteger("Paper.FilterThreshhold", DEFAULT_SIZE_THRESHOLD));
+ }
+ static {
+ resetFilterThresholds();
+ }
+
+ static boolean isOverzealous() {
+ return SIZE_THRESHOLD == OVERZEALOUS_THRESHOLD;
+ }
+
+
+ private static CompoundTag readOversizedChunk(RegionFile regionfile, ChunkPos chunkCoordinate) throws IOException { + private static CompoundTag readOversizedChunk(RegionFile regionfile, ChunkPos chunkCoordinate) throws IOException {
+ synchronized (regionfile) { + synchronized (regionfile) {
+ try (DataInputStream datainputstream = regionfile.getChunkDataInputStream(chunkCoordinate)) { + try (DataInputStream datainputstream = regionfile.getChunkDataInputStream(chunkCoordinate)) {
@ -199,24 +183,12 @@ index 465ad0bae446a20e941e8f2dbf2d85f2627482b9..2ab7060f5c9a54bc7beb819f381a202c
+ level.put(key, levelList); + level.put(key, levelList);
+ } + }
+ } + }
+
+ private static int getNBTSize(net.minecraft.nbt.Tag nbtBase) {
+ DataOutputStream test = new DataOutputStream(new org.apache.commons.io.output.NullOutputStream());
+ try {
+ nbtBase.write(test);
+ return test.size();
+ } catch (IOException e) {
+ e.printStackTrace();
+ return 0;
+ }
+ }
+
+ // Paper end + // Paper end
+ +
@Nullable @Nullable
public CompoundTag read(ChunkPos pos) throws IOException { public CompoundTag read(ChunkPos pos) throws IOException {
// CraftBukkit start - SPIGOT-5680: There's no good reason to preemptively create files on read, save that for writing // CraftBukkit start - SPIGOT-5680: There's no good reason to preemptively create files on read, save that for writing
@@ -132,6 +197,12 @@ public class RegionFileStorage implements AutoCloseable { @@ -132,6 +169,12 @@ public class RegionFileStorage implements AutoCloseable {
try { // Paper try { // Paper
DataInputStream datainputstream = regionfile.getChunkDataInputStream(pos); DataInputStream datainputstream = regionfile.getChunkDataInputStream(pos);
@ -229,7 +201,7 @@ index 465ad0bae446a20e941e8f2dbf2d85f2627482b9..2ab7060f5c9a54bc7beb819f381a202c
CompoundTag nbttagcompound; CompoundTag nbttagcompound;
label43: label43:
{ {
@@ -218,6 +289,7 @@ public class RegionFileStorage implements AutoCloseable { @@ -218,6 +261,7 @@ public class RegionFileStorage implements AutoCloseable {
try { try {
NbtIo.write(nbt, (DataOutput) dataoutputstream); NbtIo.write(nbt, (DataOutput) dataoutputstream);

Datei anzeigen

@ -8,7 +8,7 @@ This patch also adds a chunk status cache on region files (note that
its only purpose is to cache the status on DISK) its only purpose is to cache the status on DISK)
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 45ee0cd242271883412284625230822d9c8a5452..1faa4e0626022f08faa47327b61b6250814e0b82 100644 index 45ee0cd242271883412284625230822d9c8a5452..56f52d4b9c1af6a04d464640ed06b841a47b4cd9 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java --- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -679,9 +679,13 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -679,9 +679,13 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@ -87,13 +87,13 @@ index 45ee0cd242271883412284625230822d9c8a5452..1faa4e0626022f08faa47327b61b6250
+ ChunkHolder chunkHolder = io.papermc.paper.chunk.system.ChunkSystem.getUnloadingChunkHolder(this.level, chunkX, chunkZ); + ChunkHolder chunkHolder = io.papermc.paper.chunk.system.ChunkSystem.getUnloadingChunkHolder(this.level, chunkX, chunkZ);
+ return chunkHolder == null ? null : chunkHolder.getAvailableChunkNow(); + return chunkHolder == null ? null : chunkHolder.getAvailableChunkNow();
+ } + }
+ // Paper end + // Paper end - Cache chunk status on disk
+ +
boolean anyPlayerCloseEnoughForSpawning(ChunkPos pos) { boolean anyPlayerCloseEnoughForSpawning(ChunkPos pos) {
// Spigot start // Spigot start
return this.anyPlayerCloseEnoughForSpawning(pos, false); return this.anyPlayerCloseEnoughForSpawning(pos, false);
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 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 72dacdc271325c814fb43cd6daaf3a209801ffda..647ce340c81606ab86d33e1f9dec1fb0afc262d8 100644 index 69ed808ca5fbfb9191d0818bb0f1c839d11d9d11..0ae3d1ea6f00efcdea5da5bf1a0f984f4473f5a2 100644
--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java --- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java
@@ -50,6 +50,30 @@ public class RegionFile implements AutoCloseable { @@ -50,6 +50,30 @@ public class RegionFile implements AutoCloseable {
@ -122,7 +122,7 @@ index 72dacdc271325c814fb43cd6daaf3a209801ffda..647ce340c81606ab86d33e1f9dec1fb0
+ final int location = getChunkLocation(x, z); + final int location = getChunkLocation(x, z);
+ return this.statuses[location]; + return this.statuses[location];
+ } + }
+ // Paper end + // Paper end - Cache chunk status
+ +
public RegionFile(Path file, Path directory, boolean dsync) throws IOException { public RegionFile(Path file, Path directory, boolean dsync) throws IOException {
this(file, directory, RegionFileVersion.VERSION_DEFLATE, dsync); this(file, directory, RegionFileVersion.VERSION_DEFLATE, dsync);
@ -131,7 +131,7 @@ index 72dacdc271325c814fb43cd6daaf3a209801ffda..647ce340c81606ab86d33e1f9dec1fb0
return this.getOffset(pos) != 0; return this.getOffset(pos) != 0;
} }
+ private static int getChunkLocation(int x, int z) { return (x & 31) + (z & 31) * 32; } // Paper - OBFHELPER - sort of, mirror of logic below + private static int getChunkLocation(int x, int z) { return (x & 31) + (z & 31) * 32; } // Paper - Cache chunk status; OBFHELPER - sort of, mirror of logic below
private static int getOffsetIndex(ChunkPos pos) { private static int getOffsetIndex(ChunkPos pos) {
return pos.getRegionLocalX() + pos.getRegionLocalZ() * 32; return pos.getRegionLocalX() + pos.getRegionLocalZ() * 32;
} }
@ -139,24 +139,24 @@ index 72dacdc271325c814fb43cd6daaf3a209801ffda..647ce340c81606ab86d33e1f9dec1fb0
synchronized (this) { synchronized (this) {
try { try {
// Paper end // Paper end
+ this.closed = true; // Paper + this.closed = true; // Paper - Cache chunk status
try { try {
this.padToFullSector(); this.padToFullSector();
} finally { } finally {
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 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 c46320794e9673d7ff24aae5e9086cc90988791c..deed4d50e0e4d810647a0745ef328c20dfe51093 100644 index affd43308ac565066cefa799238e46b75a28b270..8563383d45f89ee01dd5df13af5bd0cf1b3d7b01 100644
--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java --- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
@@ -289,6 +289,7 @@ public class RegionFileStorage implements AutoCloseable { @@ -261,6 +261,7 @@ public class RegionFileStorage implements AutoCloseable {
try { try {
NbtIo.write(nbt, (DataOutput) dataoutputstream); NbtIo.write(nbt, (DataOutput) dataoutputstream);
+ regionfile.setStatus(pos.x, pos.z, ChunkSerializer.getStatus(nbt)); // Paper - cache status on disk + regionfile.setStatus(pos.x, pos.z, ChunkSerializer.getStatus(nbt)); // Paper - Cache chunk status
regionfile.setOversized(pos.x, pos.z, false); // Paper - We don't do this anymore, mojang stores differently, but clear old meta flag if it exists to get rid of our own meta file once last oversized is gone regionfile.setOversized(pos.x, pos.z, false); // Paper - We don't do this anymore, mojang stores differently, but clear old meta flag if it exists to get rid of our own meta file once last oversized is gone
} catch (Throwable throwable) { } catch (Throwable throwable) {
if (dataoutputstream != null) { if (dataoutputstream != null) {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index af027128cc06f877f745296b2320e1bca29fd02b..bcd782f9b13c71f1a5bce4836463d0b57e5ada72 100644 index af027128cc06f877f745296b2320e1bca29fd02b..d4518b9c1338226a9a814d2512aaddbb76a42da8 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -310,9 +310,23 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -310,9 +310,23 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@ -180,8 +180,8 @@ index af027128cc06f877f745296b2320e1bca29fd02b..bcd782f9b13c71f1a5bce4836463d0b5
- return this.isChunkLoaded(x, z) || this.world.getChunkSource().chunkMap.read(new ChunkPos(x, z)).get().isPresent(); - return this.isChunkLoaded(x, z) || this.world.getChunkSource().chunkMap.read(new ChunkPos(x, z)).get().isPresent();
- } catch (InterruptedException | ExecutionException ex) { - } catch (InterruptedException | ExecutionException ex) {
+ return world.getChunkSource().chunkMap.getChunkStatusOnDisk(new ChunkPos(x, z)) == ChunkStatus.FULL; + return world.getChunkSource().chunkMap.getChunkStatusOnDisk(new ChunkPos(x, z)) == ChunkStatus.FULL;
+ // Paper end
+ } catch (java.io.IOException ex) { + } catch (java.io.IOException ex) {
+ // Paper end - Fix this method
throw new RuntimeException(ex); throw new RuntimeException(ex);
} }
} }
@ -240,7 +240,7 @@ index af027128cc06f877f745296b2320e1bca29fd02b..bcd782f9b13c71f1a5bce4836463d0b5
+ world.getChunkSource().addRegionTicket(TicketType.PLUGIN, chunkPos, 1, Unit.INSTANCE); + world.getChunkSource().addRegionTicket(TicketType.PLUGIN, chunkPos, 1, Unit.INSTANCE);
+ world.getChunkSource().getChunk(x, z, ChunkStatus.FULL, true); + world.getChunkSource().getChunk(x, z, ChunkStatus.FULL, true);
+ return true; + return true;
+ // Paper end + // Paper end - Optimize this method
} }
@Override @Override

Datei anzeigen

@ -5,14 +5,14 @@ Subject: [PATCH] Show blockstate location if we failed to read it
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java
index f046f507a095e0cb8f839b9b4b06add3a671486b..f7f211b4f08a7f21a183078affd6f875aa30dd50 100644 index f046f507a095e0cb8f839b9b4b06add3a671486b..f1f6d85399db86ce7aee1fccde51d6259b427e7e 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java
@@ -25,6 +25,7 @@ public class CraftBlockEntityState<T extends BlockEntity> extends CraftBlockStat @@ -25,6 +25,7 @@ public class CraftBlockEntityState<T extends BlockEntity> extends CraftBlockStat
this.tileEntity = tileEntity; this.tileEntity = tileEntity;
+ try { // Paper - show location on failure + try { // Paper - Show blockstate location if we failed to read it
// Paper start // Paper start
this.snapshotDisabled = DISABLE_SNAPSHOT; this.snapshotDisabled = DISABLE_SNAPSHOT;
if (DISABLE_SNAPSHOT) { if (DISABLE_SNAPSHOT) {
@ -20,14 +20,14 @@ index f046f507a095e0cb8f839b9b4b06add3a671486b..f7f211b4f08a7f21a183078affd6f875
this.load(this.snapshot); this.load(this.snapshot);
} }
// Paper end // Paper end
+ // Paper start - show location on failure + // Paper start - Show blockstate location if we failed to read it
+ } catch (Throwable thr) { + } catch (Throwable thr) {
+ if (thr instanceof ThreadDeath) { + if (thr instanceof ThreadDeath) {
+ throw (ThreadDeath)thr; + throw (ThreadDeath)thr;
+ } + }
+ throw new RuntimeException("Failed to read BlockState at: world: " + this.getWorld().getName() + " location: (" + this.getX() + ", " + this.getY() + ", " + this.getZ() + ")", thr); + throw new RuntimeException("Failed to read BlockState at: world: " + this.getWorld().getName() + " location: (" + this.getX() + ", " + this.getY() + ", " + this.getZ() + ")", thr);
+ } + }
+ // Paper end + // Paper end - Show blockstate location if we failed to read it
} }
protected CraftBlockEntityState(CraftBlockEntityState<T> state) { protected CraftBlockEntityState(CraftBlockEntityState<T> state) {

Datei anzeigen

@ -17,7 +17,7 @@ This should fully solve all of the issues around it so that only natural
influences natural spawns. influences natural spawns.
diff --git a/src/main/java/net/minecraft/world/level/NaturalSpawner.java b/src/main/java/net/minecraft/world/level/NaturalSpawner.java diff --git a/src/main/java/net/minecraft/world/level/NaturalSpawner.java b/src/main/java/net/minecraft/world/level/NaturalSpawner.java
index 9ed7abddf30d298a5abb04974efd1b470d015b09..fe38079d69f3e9987ad5ab077ae09d05017a681a 100644 index 9ed7abddf30d298a5abb04974efd1b470d015b09..a19c0e30ebcea8feff035a451ded567dfa86dfff 100644
--- a/src/main/java/net/minecraft/world/level/NaturalSpawner.java --- a/src/main/java/net/minecraft/world/level/NaturalSpawner.java
+++ b/src/main/java/net/minecraft/world/level/NaturalSpawner.java +++ b/src/main/java/net/minecraft/world/level/NaturalSpawner.java
@@ -88,6 +88,13 @@ public final class NaturalSpawner { @@ -88,6 +88,13 @@ public final class NaturalSpawner {
@ -30,7 +30,7 @@ index 9ed7abddf30d298a5abb04974efd1b470d015b09..fe38079d69f3e9987ad5ab077ae09d05
+ entity.spawnReason == org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.CHUNK_GEN)) { + entity.spawnReason == org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.CHUNK_GEN)) {
+ continue; + continue;
+ } + }
+ // Paper end + // Paper end - Only count natural spawns
BlockPos blockposition = entity.blockPosition(); BlockPos blockposition = entity.blockPosition();
chunkSource.query(ChunkPos.asLong(blockposition), (chunk) -> { chunkSource.query(ChunkPos.asLong(blockposition), (chunk) -> {

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] offset item frame ticking
diff --git a/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java b/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java diff --git a/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java b/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java
index 469e4cc75eab1344a159ed5addd53f50cea7bd90..5f4c42c4ba44923cabb873bfad33abc2b1362e73 100644 index 469e4cc75eab1344a159ed5addd53f50cea7bd90..f88918b7c15b72f4cb1dd313734f550432fd5858 100644
--- a/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java --- a/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java +++ b/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java
@@ -38,7 +38,7 @@ public abstract class HangingEntity extends Entity { @@ -38,7 +38,7 @@ public abstract class HangingEntity extends Entity {
@ -13,7 +13,7 @@ index 469e4cc75eab1344a159ed5addd53f50cea7bd90..5f4c42c4ba44923cabb873bfad33abc2
return entity instanceof HangingEntity; return entity instanceof HangingEntity;
}; };
- private int checkInterval; - private int checkInterval;
+ private int checkInterval; { this.checkInterval = this.getId() % this.level().spigotConfig.hangingTickFrequency; } // Paper + private int checkInterval; { this.checkInterval = this.getId() % this.level().spigotConfig.hangingTickFrequency; } // Paper - Perf: offset item frame ticking
public BlockPos pos; public BlockPos pos;
protected Direction direction; protected Direction direction;

Datei anzeigen

@ -5,22 +5,22 @@ Subject: [PATCH] Prevent consuming the wrong itemstack
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 8e89eb11e8477c921b30840644b6c3ba9d18c3ef..a3eac4dfe28bc55721d292e2f309b3467a3db140 100644 index 8e89eb11e8477c921b30840644b6c3ba9d18c3ef..f893b0a8fac50f83ed847281f8283b32c6415777 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3709,9 +3709,14 @@ public abstract class LivingEntity extends Entity implements Attackable { @@ -3709,9 +3709,14 @@ public abstract class LivingEntity extends Entity implements Attackable {
} }
public void startUsingItem(InteractionHand hand) { public void startUsingItem(InteractionHand hand) {
+ // Paper start - forwarder to method with forceUpdate parameter + // Paper start - Prevent consuming the wrong itemstack
+ this.startUsingItem(hand, false); + this.startUsingItem(hand, false);
+ } + }
+ public void startUsingItem(InteractionHand hand, boolean forceUpdate) { + public void startUsingItem(InteractionHand hand, boolean forceUpdate) {
+ // Paper end + // Paper end - Prevent consuming the wrong itemstack
ItemStack itemstack = this.getItemInHand(hand); ItemStack itemstack = this.getItemInHand(hand);
- if (!itemstack.isEmpty() && !this.isUsingItem()) { - if (!itemstack.isEmpty() && !this.isUsingItem()) {
+ if (!itemstack.isEmpty() && !this.isUsingItem() || forceUpdate) { // Paper use override flag + if (!itemstack.isEmpty() && !this.isUsingItem() || forceUpdate) { // Paper - Prevent consuming the wrong itemstack
this.useItem = itemstack; this.useItem = itemstack;
this.useItemRemaining = itemstack.getUseDuration(); this.useItemRemaining = itemstack.getUseDuration();
if (!this.level().isClientSide) { if (!this.level().isClientSide) {
@ -28,7 +28,7 @@ index 8e89eb11e8477c921b30840644b6c3ba9d18c3ef..a3eac4dfe28bc55721d292e2f309b346
this.releaseUsingItem(); this.releaseUsingItem();
} else { } else {
if (!this.useItem.isEmpty() && this.isUsingItem()) { if (!this.useItem.isEmpty() && this.isUsingItem()) {
+ this.startUsingItem(this.getUsedItemHand(), true); // Paper + this.startUsingItem(this.getUsedItemHand(), true); // Paper - Prevent consuming the wrong itemstack
this.triggerItemUseEffects(this.useItem, 16); this.triggerItemUseEffects(this.useItem, 16);
// CraftBukkit start - fire PlayerItemConsumeEvent // CraftBukkit start - fire PlayerItemConsumeEvent
ItemStack itemstack; ItemStack itemstack;

Datei anzeigen

@ -5,14 +5,14 @@ Subject: [PATCH] Dont send unnecessary sign update
diff --git a/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java diff --git a/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java
index a822b190aeee1d644c3509bb75106fa4dfdd963f..1a54db9f8b2fb3071e79ec26c49242b528b8cd9e 100644 index a822b190aeee1d644c3509bb75106fa4dfdd963f..9939cad5af2d7873f188f18978029663a8d785de 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java --- a/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java
@@ -184,6 +184,7 @@ public class SignBlockEntity extends BlockEntity implements CommandSource { // C @@ -184,6 +184,7 @@ public class SignBlockEntity extends BlockEntity implements CommandSource { // C
this.level.sendBlockUpdated(this.getBlockPos(), this.getBlockState(), this.getBlockState(), 3); this.level.sendBlockUpdated(this.getBlockPos(), this.getBlockState(), this.getBlockState(), 3);
} else { } else {
SignBlockEntity.LOGGER.warn("Player {} just tried to change non-editable sign", player.getName().getString()); SignBlockEntity.LOGGER.warn("Player {} just tried to change non-editable sign", player.getName().getString());
+ if (player.distanceToSqr(this.getBlockPos().getX(), this.getBlockPos().getY(), this.getBlockPos().getZ()) < 32 * 32) // Paper + if (player.distanceToSqr(this.getBlockPos().getX(), this.getBlockPos().getY(), this.getBlockPos().getZ()) < 32 * 32) // Paper - Dont send far away sign update
((ServerPlayer) player).connection.send(this.getUpdatePacket()); // CraftBukkit ((ServerPlayer) player).connection.send(this.getUpdatePacket()); // CraftBukkit
} }
} }

Datei anzeigen

@ -5,14 +5,14 @@ Subject: [PATCH] Add option to disable pillager patrols
diff --git a/src/main/java/net/minecraft/world/level/levelgen/PatrolSpawner.java b/src/main/java/net/minecraft/world/level/levelgen/PatrolSpawner.java diff --git a/src/main/java/net/minecraft/world/level/levelgen/PatrolSpawner.java b/src/main/java/net/minecraft/world/level/levelgen/PatrolSpawner.java
index 65d9211b812995869e58900a2873583658122312..e5918fa3be107ac3a2fc8831fd78733a7506730a 100644 index 65d9211b812995869e58900a2873583658122312..c7aea059de151cf8ae6e660785e176586bc23ff3 100644
--- a/src/main/java/net/minecraft/world/level/levelgen/PatrolSpawner.java --- a/src/main/java/net/minecraft/world/level/levelgen/PatrolSpawner.java
+++ b/src/main/java/net/minecraft/world/level/levelgen/PatrolSpawner.java +++ b/src/main/java/net/minecraft/world/level/levelgen/PatrolSpawner.java
@@ -25,6 +25,7 @@ public class PatrolSpawner implements CustomSpawner { @@ -25,6 +25,7 @@ public class PatrolSpawner implements CustomSpawner {
@Override @Override
public int tick(ServerLevel world, boolean spawnMonsters, boolean spawnAnimals) { public int tick(ServerLevel world, boolean spawnMonsters, boolean spawnAnimals) {
+ if (world.paperConfig().entities.behavior.pillagerPatrols.disable) return 0; // Paper + if (world.paperConfig().entities.behavior.pillagerPatrols.disable) return 0; // Paper - Add option to disable pillager patrols
if (!spawnMonsters) { if (!spawnMonsters) {
return 0; return 0;
} else if (!world.getGameRules().getBoolean(GameRules.RULE_DO_PATROL_SPAWNING)) { } else if (!world.getGameRules().getBoolean(GameRules.RULE_DO_PATROL_SPAWNING)) {

Datei anzeigen

@ -101,19 +101,19 @@ index 0000000000000000000000000000000000000000..02d98ec591b676acf64460d14d608860
+ } + }
+} +}
diff --git a/src/main/java/net/minecraft/server/Bootstrap.java b/src/main/java/net/minecraft/server/Bootstrap.java diff --git a/src/main/java/net/minecraft/server/Bootstrap.java b/src/main/java/net/minecraft/server/Bootstrap.java
index c887d34171f89c731d76c4ca92c70be2b1edc1e6..5816998cde8504d58732e63eb2179a5d828f35bb 100644 index c887d34171f89c731d76c4ca92c70be2b1edc1e6..438ae006a8e7da0e5124415b8350ebfd45ac6a10 100644
--- a/src/main/java/net/minecraft/server/Bootstrap.java --- a/src/main/java/net/minecraft/server/Bootstrap.java
+++ b/src/main/java/net/minecraft/server/Bootstrap.java +++ b/src/main/java/net/minecraft/server/Bootstrap.java
@@ -78,6 +78,7 @@ public class Bootstrap { @@ -78,6 +78,7 @@ public class Bootstrap {
CauldronInteraction.bootStrap(); CauldronInteraction.bootStrap();
// Paper start // Paper start
BuiltInRegistries.bootStrap(() -> { BuiltInRegistries.bootStrap(() -> {
+ io.papermc.paper.world.worldgen.OptionallyFlatBedrockConditionSource.bootstrap(); // Paper - optional flat bedrock + io.papermc.paper.world.worldgen.OptionallyFlatBedrockConditionSource.bootstrap(); // Paper - Flat bedrock generator settings
io.papermc.paper.plugin.entrypoint.LaunchEntryPointHandler.enterBootstrappers(); // Paper - Entrypoint for bootstrapping io.papermc.paper.plugin.entrypoint.LaunchEntryPointHandler.enterBootstrappers(); // Paper - Entrypoint for bootstrapping
}); });
// Paper end // Paper end
diff --git a/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java b/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java diff --git a/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java b/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java
index 902156477bdfc9917105f1229f760c26e5af302a..58609a0911c4e32b6f80f050cd3d23f70ad75b1b 100644 index 902156477bdfc9917105f1229f760c26e5af302a..98c7f695093acbcf9382a5f07a7a89e373709763 100644
--- a/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java --- a/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java
+++ b/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java +++ b/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java
@@ -207,7 +207,7 @@ public final class NoiseBasedChunkGenerator extends ChunkGenerator { @@ -207,7 +207,7 @@ public final class NoiseBasedChunkGenerator extends ChunkGenerator {
@ -121,7 +121,7 @@ index 902156477bdfc9917105f1229f760c26e5af302a..58609a0911c4e32b6f80f050cd3d23f7
public void buildSurface(WorldGenRegion region, StructureManager structures, RandomState noiseConfig, ChunkAccess chunk) { public void buildSurface(WorldGenRegion region, StructureManager structures, RandomState noiseConfig, ChunkAccess chunk) {
if (!SharedConstants.debugVoidTerrain(chunk.getPos())) { if (!SharedConstants.debugVoidTerrain(chunk.getPos())) {
- WorldGenerationContext worldgenerationcontext = new WorldGenerationContext(this, region); - WorldGenerationContext worldgenerationcontext = new WorldGenerationContext(this, region);
+ WorldGenerationContext worldgenerationcontext = new WorldGenerationContext(this, region, region.getMinecraftWorld()); // Paper + WorldGenerationContext worldgenerationcontext = new WorldGenerationContext(this, region, region.getMinecraftWorld()); // Paper - Flat bedrock generator settings
this.buildSurface(chunk, worldgenerationcontext, noiseConfig, structures, region.getBiomeManager(), region.registryAccess().registryOrThrow(Registries.BIOME), Blender.of(region)); this.buildSurface(chunk, worldgenerationcontext, noiseConfig, structures, region.getBiomeManager(), region.registryAccess().registryOrThrow(Registries.BIOME), Blender.of(region));
} }
@ -130,26 +130,26 @@ index 902156477bdfc9917105f1229f760c26e5af302a..58609a0911c4e32b6f80f050cd3d23f7
}); });
Aquifer aquifer = noisechunk.aquifer(); Aquifer aquifer = noisechunk.aquifer();
- CarvingContext carvingcontext = new CarvingContext(this, chunkRegion.registryAccess(), chunk.getHeightAccessorForGeneration(), noisechunk, noiseConfig, ((NoiseGeneratorSettings) this.settings.value()).surfaceRule()); - CarvingContext carvingcontext = new CarvingContext(this, chunkRegion.registryAccess(), chunk.getHeightAccessorForGeneration(), noisechunk, noiseConfig, ((NoiseGeneratorSettings) this.settings.value()).surfaceRule());
+ CarvingContext carvingcontext = new CarvingContext(this, chunkRegion.registryAccess(), chunk.getHeightAccessorForGeneration(), noisechunk, noiseConfig, ((NoiseGeneratorSettings) this.settings.value()).surfaceRule(), chunkRegion.getMinecraftWorld()); // Paper + CarvingContext carvingcontext = new CarvingContext(this, chunkRegion.registryAccess(), chunk.getHeightAccessorForGeneration(), noisechunk, noiseConfig, ((NoiseGeneratorSettings) this.settings.value()).surfaceRule(), chunkRegion.getMinecraftWorld()); // Paper - Flat bedrock generator settings
CarvingMask carvingmask = ((ProtoChunk) chunk).getOrCreateCarvingMask(carverStep); CarvingMask carvingmask = ((ProtoChunk) chunk).getOrCreateCarvingMask(carverStep);
for (int j = -8; j <= 8; ++j) { for (int j = -8; j <= 8; ++j) {
diff --git a/src/main/java/net/minecraft/world/level/levelgen/WorldGenerationContext.java b/src/main/java/net/minecraft/world/level/levelgen/WorldGenerationContext.java diff --git a/src/main/java/net/minecraft/world/level/levelgen/WorldGenerationContext.java b/src/main/java/net/minecraft/world/level/levelgen/WorldGenerationContext.java
index b99283c31193e2110f6e3f39c23dbfc2442bab2b..1c9d9ecdafb2bd04348045ba0404da052dcd6437 100644 index b99283c31193e2110f6e3f39c23dbfc2442bab2b..a34e53249668d917c9d77c6837b91360a2349bbc 100644
--- a/src/main/java/net/minecraft/world/level/levelgen/WorldGenerationContext.java --- a/src/main/java/net/minecraft/world/level/levelgen/WorldGenerationContext.java
+++ b/src/main/java/net/minecraft/world/level/levelgen/WorldGenerationContext.java +++ b/src/main/java/net/minecraft/world/level/levelgen/WorldGenerationContext.java
@@ -6,10 +6,13 @@ import net.minecraft.world.level.chunk.ChunkGenerator; @@ -6,10 +6,13 @@ import net.minecraft.world.level.chunk.ChunkGenerator;
public class WorldGenerationContext { public class WorldGenerationContext {
private final int minY; private final int minY;
private final int height; private final int height;
+ private final @javax.annotation.Nullable net.minecraft.world.level.Level level; // Paper + private final @javax.annotation.Nullable net.minecraft.world.level.Level level; // Paper - Flat bedrock generator settings
- public WorldGenerationContext(ChunkGenerator generator, LevelHeightAccessor world) { - public WorldGenerationContext(ChunkGenerator generator, LevelHeightAccessor world) {
+ public WorldGenerationContext(ChunkGenerator generator, LevelHeightAccessor world) { this(generator, world, null); } // Paper + public WorldGenerationContext(ChunkGenerator generator, LevelHeightAccessor world) { this(generator, world, null); } // Paper - Flat bedrock generator settings
+ public WorldGenerationContext(ChunkGenerator generator, LevelHeightAccessor world, @org.jetbrains.annotations.Nullable net.minecraft.world.level.Level level) { // Paper + public WorldGenerationContext(ChunkGenerator generator, LevelHeightAccessor world, @org.jetbrains.annotations.Nullable net.minecraft.world.level.Level level) { // Paper - Flat bedrock generator settings
this.minY = Math.max(world.getMinBuildHeight(), generator.getMinY()); this.minY = Math.max(world.getMinBuildHeight(), generator.getMinY());
this.height = Math.min(world.getHeight(), generator.getGenDepth()); this.height = Math.min(world.getHeight(), generator.getGenDepth());
+ this.level = level; // Paper + this.level = level; // Paper - Flat bedrock generator settings
} }
public int getMinGenY() { public int getMinGenY() {
@ -158,17 +158,17 @@ index b99283c31193e2110f6e3f39c23dbfc2442bab2b..1c9d9ecdafb2bd04348045ba0404da05
return this.height; return this.height;
} }
+ +
+ // Paper start + // Paper start - Flat bedrock generator settings
+ public net.minecraft.world.level.Level getWorld() { + public net.minecraft.world.level.Level getWorld() {
+ if (this.level == null) { + if (this.level == null) {
+ throw new NullPointerException("WorldGenerationContext was initialized without a Level, but WorldGenerationContext#getWorld was called"); + throw new NullPointerException("WorldGenerationContext was initialized without a Level, but WorldGenerationContext#getWorld was called");
+ } + }
+ return this.level; + return this.level;
+ } + }
+ // Paper end + // Paper end - Flat bedrock generator settings
} }
diff --git a/src/main/java/net/minecraft/world/level/levelgen/carver/CarvingContext.java b/src/main/java/net/minecraft/world/level/levelgen/carver/CarvingContext.java diff --git a/src/main/java/net/minecraft/world/level/levelgen/carver/CarvingContext.java b/src/main/java/net/minecraft/world/level/levelgen/carver/CarvingContext.java
index a745458ea3581ea91a68c863e3fd0a0292d73a61..f84ee8afe95f912a972e37fbae7a06ecdd3aba06 100644 index a745458ea3581ea91a68c863e3fd0a0292d73a61..6fcb84e4d2cd310bd1e04f4cf7b9bc2bbbf4fdad 100644
--- a/src/main/java/net/minecraft/world/level/levelgen/carver/CarvingContext.java --- a/src/main/java/net/minecraft/world/level/levelgen/carver/CarvingContext.java
+++ b/src/main/java/net/minecraft/world/level/levelgen/carver/CarvingContext.java +++ b/src/main/java/net/minecraft/world/level/levelgen/carver/CarvingContext.java
@@ -21,8 +21,8 @@ public class CarvingContext extends WorldGenerationContext { @@ -21,8 +21,8 @@ public class CarvingContext extends WorldGenerationContext {
@ -177,13 +177,13 @@ index a745458ea3581ea91a68c863e3fd0a0292d73a61..f84ee8afe95f912a972e37fbae7a06ec
- public CarvingContext(NoiseBasedChunkGenerator noiseChunkGenerator, RegistryAccess registryManager, LevelHeightAccessor heightLimitView, NoiseChunk chunkNoiseSampler, RandomState noiseConfig, SurfaceRules.RuleSource materialRule) { - public CarvingContext(NoiseBasedChunkGenerator noiseChunkGenerator, RegistryAccess registryManager, LevelHeightAccessor heightLimitView, NoiseChunk chunkNoiseSampler, RandomState noiseConfig, SurfaceRules.RuleSource materialRule) {
- super(noiseChunkGenerator, heightLimitView); - super(noiseChunkGenerator, heightLimitView);
+ public CarvingContext(NoiseBasedChunkGenerator noiseChunkGenerator, RegistryAccess registryManager, LevelHeightAccessor heightLimitView, NoiseChunk chunkNoiseSampler, RandomState noiseConfig, SurfaceRules.RuleSource materialRule, @javax.annotation.Nullable net.minecraft.world.level.Level level) { // Paper + public CarvingContext(NoiseBasedChunkGenerator noiseChunkGenerator, RegistryAccess registryManager, LevelHeightAccessor heightLimitView, NoiseChunk chunkNoiseSampler, RandomState noiseConfig, SurfaceRules.RuleSource materialRule, @javax.annotation.Nullable net.minecraft.world.level.Level level) { // Paper - Flat bedrock generator settings
+ super(noiseChunkGenerator, heightLimitView, level); // Paper + super(noiseChunkGenerator, heightLimitView, level); // Paper - Flat bedrock generator settings
this.registryAccess = registryManager; this.registryAccess = registryManager;
this.noiseChunk = chunkNoiseSampler; this.noiseChunk = chunkNoiseSampler;
this.randomState = noiseConfig; this.randomState = noiseConfig;
diff --git a/src/main/java/net/minecraft/world/level/levelgen/placement/PlacementContext.java b/src/main/java/net/minecraft/world/level/levelgen/placement/PlacementContext.java diff --git a/src/main/java/net/minecraft/world/level/levelgen/placement/PlacementContext.java b/src/main/java/net/minecraft/world/level/levelgen/placement/PlacementContext.java
index 640c2683c842655bbaee8f293f1c2613ef44844e..53d818b0cc602f827d0b907e293515f6810c6792 100644 index 640c2683c842655bbaee8f293f1c2613ef44844e..c7dfd844c7846281ceff0d443c0160054fd36c5c 100644
--- a/src/main/java/net/minecraft/world/level/levelgen/placement/PlacementContext.java --- a/src/main/java/net/minecraft/world/level/levelgen/placement/PlacementContext.java
+++ b/src/main/java/net/minecraft/world/level/levelgen/placement/PlacementContext.java +++ b/src/main/java/net/minecraft/world/level/levelgen/placement/PlacementContext.java
@@ -18,7 +18,7 @@ public class PlacementContext extends WorldGenerationContext { @@ -18,7 +18,7 @@ public class PlacementContext extends WorldGenerationContext {
@ -191,7 +191,7 @@ index 640c2683c842655bbaee8f293f1c2613ef44844e..53d818b0cc602f827d0b907e293515f6
public PlacementContext(WorldGenLevel world, ChunkGenerator generator, Optional<PlacedFeature> placedFeature) { public PlacementContext(WorldGenLevel world, ChunkGenerator generator, Optional<PlacedFeature> placedFeature) {
- super(generator, world); - super(generator, world);
+ super(generator, world, world.getLevel()); // Paper + super(generator, world, world.getLevel()); // Paper - Flat bedrock generator settings
this.level = world; this.level = world;
this.generator = generator; this.generator = generator;
this.topFeature = placedFeature; this.topFeature = placedFeature;

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Prevent sync chunk loads when villagers try to find beds
diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/SleepInBed.java b/src/main/java/net/minecraft/world/entity/ai/behavior/SleepInBed.java diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/SleepInBed.java b/src/main/java/net/minecraft/world/entity/ai/behavior/SleepInBed.java
index 964fc8615d071d33c821f0c54ac1ebd4884df0cd..dcfc668503c50927b4a4dbb3988d531215d513f8 100644 index 964fc8615d071d33c821f0c54ac1ebd4884df0cd..271e913a87a782dbf12686887f768d899bfb0fbf 100644
--- a/src/main/java/net/minecraft/world/entity/ai/behavior/SleepInBed.java --- a/src/main/java/net/minecraft/world/entity/ai/behavior/SleepInBed.java
+++ b/src/main/java/net/minecraft/world/entity/ai/behavior/SleepInBed.java +++ b/src/main/java/net/minecraft/world/entity/ai/behavior/SleepInBed.java
@@ -43,7 +43,8 @@ public class SleepInBed extends Behavior<LivingEntity> { @@ -43,7 +43,8 @@ public class SleepInBed extends Behavior<LivingEntity> {
@ -13,8 +13,8 @@ index 964fc8615d071d33c821f0c54ac1ebd4884df0cd..dcfc668503c50927b4a4dbb3988d5312
} }
- BlockState blockState = world.getBlockState(globalPos.pos()); - BlockState blockState = world.getBlockState(globalPos.pos());
+ BlockState blockState = world.getBlockStateIfLoaded(globalPos.pos()); // Paper + BlockState blockState = world.getBlockStateIfLoaded(globalPos.pos()); // Paper - Prevent sync chunk loads when villagers try to find beds
+ if (blockState == null) { return false; } // Paper + if (blockState == null) { return false; } // Paper - Prevent sync chunk loads when villagers try to find beds
return globalPos.pos().closerToCenterThan(entity.position(), 2.0D) && blockState.is(BlockTags.BEDS) && !blockState.getValue(BedBlock.OCCUPIED); return globalPos.pos().closerToCenterThan(entity.position(), 2.0D) && blockState.is(BlockTags.BEDS) && !blockState.getValue(BedBlock.OCCUPIED);
} }
} }

Datei anzeigen

@ -5,19 +5,19 @@ Subject: [PATCH] MC-145656 Fix Follow Range Initial Target
diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/target/NearestAttackableTargetGoal.java b/src/main/java/net/minecraft/world/entity/ai/goal/target/NearestAttackableTargetGoal.java diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/target/NearestAttackableTargetGoal.java b/src/main/java/net/minecraft/world/entity/ai/goal/target/NearestAttackableTargetGoal.java
index 0dad5be671f990d0edf0a155e2534b3812438902..370e601ff5adccc3924055b69b42dd2f1970ae45 100644 index 0dad5be671f990d0edf0a155e2534b3812438902..175ba1184fc997f562f0834b172e17dc1b5b3027 100644
--- a/src/main/java/net/minecraft/world/entity/ai/goal/target/NearestAttackableTargetGoal.java --- a/src/main/java/net/minecraft/world/entity/ai/goal/target/NearestAttackableTargetGoal.java
+++ b/src/main/java/net/minecraft/world/entity/ai/goal/target/NearestAttackableTargetGoal.java +++ b/src/main/java/net/minecraft/world/entity/ai/goal/target/NearestAttackableTargetGoal.java
@@ -38,6 +38,7 @@ public class NearestAttackableTargetGoal<T extends LivingEntity> extends TargetG @@ -38,6 +38,7 @@ public class NearestAttackableTargetGoal<T extends LivingEntity> extends TargetG
this.randomInterval = reducedTickDelay(reciprocalChance); this.randomInterval = reducedTickDelay(reciprocalChance);
this.setFlags(EnumSet.of(Goal.Flag.TARGET)); this.setFlags(EnumSet.of(Goal.Flag.TARGET));
this.targetConditions = TargetingConditions.forCombat().range(this.getFollowDistance()).selector(targetPredicate); this.targetConditions = TargetingConditions.forCombat().range(this.getFollowDistance()).selector(targetPredicate);
+ if (mob.level().paperConfig().entities.entitiesTargetWithFollowRange) this.targetConditions.useFollowRange(); // Paper + if (mob.level().paperConfig().entities.entitiesTargetWithFollowRange) this.targetConditions.useFollowRange(); // Paper - Fix MC-145656
} }
@Override @Override
diff --git a/src/main/java/net/minecraft/world/entity/ai/targeting/TargetingConditions.java b/src/main/java/net/minecraft/world/entity/ai/targeting/TargetingConditions.java diff --git a/src/main/java/net/minecraft/world/entity/ai/targeting/TargetingConditions.java b/src/main/java/net/minecraft/world/entity/ai/targeting/TargetingConditions.java
index f29823f2e8a54bd4e81e2940b5c505b152f23e88..58422f00c7d64dbd1cf6d7211c9838875cbe7778 100644 index f29823f2e8a54bd4e81e2940b5c505b152f23e88..fae0dbfb6ac09a0c152c0f74a72583f44316def7 100644
--- a/src/main/java/net/minecraft/world/entity/ai/targeting/TargetingConditions.java --- a/src/main/java/net/minecraft/world/entity/ai/targeting/TargetingConditions.java
+++ b/src/main/java/net/minecraft/world/entity/ai/targeting/TargetingConditions.java +++ b/src/main/java/net/minecraft/world/entity/ai/targeting/TargetingConditions.java
@@ -76,7 +76,7 @@ public class TargetingConditions { @@ -76,7 +76,7 @@ public class TargetingConditions {
@ -25,7 +25,7 @@ index f29823f2e8a54bd4e81e2940b5c505b152f23e88..58422f00c7d64dbd1cf6d7211c983887
if (this.range > 0.0D) { if (this.range > 0.0D) {
double d = this.testInvisible ? targetEntity.getVisibilityPercent(baseEntity) : 1.0D; double d = this.testInvisible ? targetEntity.getVisibilityPercent(baseEntity) : 1.0D;
- double e = Math.max(this.range * d, 2.0D); - double e = Math.max(this.range * d, 2.0D);
+ double e = Math.max((this.useFollowRange ? this.getFollowRange(baseEntity) : this.range) * d, 2.0D); // Paper + double e = Math.max((this.useFollowRange ? this.getFollowRange(baseEntity) : this.range) * d, 2.0D); // Paper - Fix MC-145656
double f = baseEntity.distanceToSqr(targetEntity.getX(), targetEntity.getY(), targetEntity.getZ()); double f = baseEntity.distanceToSqr(targetEntity.getX(), targetEntity.getY(), targetEntity.getZ());
if (f > e * e) { if (f > e * e) {
return false; return false;
@ -34,7 +34,7 @@ index f29823f2e8a54bd4e81e2940b5c505b152f23e88..58422f00c7d64dbd1cf6d7211c983887
} }
} }
+ +
+ // Paper start + // Paper start - Fix MC-145656
+ private boolean useFollowRange = false; + private boolean useFollowRange = false;
+ +
+ public TargetingConditions useFollowRange() { + public TargetingConditions useFollowRange() {
@ -46,5 +46,5 @@ index f29823f2e8a54bd4e81e2940b5c505b152f23e88..58422f00c7d64dbd1cf6d7211c983887
+ net.minecraft.world.entity.ai.attributes.AttributeInstance attributeinstance = entityliving.getAttribute(net.minecraft.world.entity.ai.attributes.Attributes.FOLLOW_RANGE); + net.minecraft.world.entity.ai.attributes.AttributeInstance attributeinstance = entityliving.getAttribute(net.minecraft.world.entity.ai.attributes.Attributes.FOLLOW_RANGE);
+ return attributeinstance == null ? 16.0D : attributeinstance.getValue(); + return attributeinstance == null ? 16.0D : attributeinstance.getValue();
+ } + }
+ // Paper end + // Paper end - Fix MC-145656
} }

Datei anzeigen

@ -56,14 +56,14 @@ index cbeaadaecf816070b3a37938c8e683180939afc4..95e5073a68e4dd38b70e8268daf21609
public static void onChunkHolderCreate(final ServerLevel level, final ChunkHolder holder) { public static void onChunkHolderCreate(final ServerLevel level, final ChunkHolder holder) {
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 1faa4e0626022f08faa47327b61b6250814e0b82..1b84c29605fb141ad286f6ae67a726d0a5088d32 100644 index 56f52d4b9c1af6a04d464640ed06b841a47b4cd9..5b2e4a2c1ae99b4c1ee5e1daaca7ca79a87d3ad1 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java --- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -533,6 +533,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -533,6 +533,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
entity.discard(); entity.discard();
needsRemoval = true; needsRemoval = true;
} }
+ checkDupeUUID(world, entity); // Paper + checkDupeUUID(world, entity); // Paper - duplicate uuid resolving
return !needsRemoval; return !needsRemoval;
}), position); // Paper - rewrite chunk system }), position); // Paper - rewrite chunk system
// CraftBukkit end // CraftBukkit end
@ -71,7 +71,7 @@ index 1faa4e0626022f08faa47327b61b6250814e0b82..1b84c29605fb141ad286f6ae67a726d0
throw new UnsupportedOperationException(); // Paper - rewrite chunk system throw new UnsupportedOperationException(); // Paper - rewrite chunk system
} }
+ // Paper start + // Paper start - duplicate uuid resolving
+ // rets true if to prevent the entity from being added + // rets true if to prevent the entity from being added
+ public static boolean checkDupeUUID(ServerLevel level, Entity entity) { + public static boolean checkDupeUUID(ServerLevel level, Entity entity) {
+ io.papermc.paper.configuration.WorldConfiguration.Entities.Spawning.DuplicateUUID.DuplicateUUIDMode mode = level.paperConfig().entities.spawning.duplicateUuid.mode; + io.papermc.paper.configuration.WorldConfiguration.Entities.Spawning.DuplicateUUID.DuplicateUUIDMode mode = level.paperConfig().entities.spawning.duplicateUuid.mode;
@ -113,7 +113,7 @@ index 1faa4e0626022f08faa47327b61b6250814e0b82..1b84c29605fb141ad286f6ae67a726d0
+ } + }
+ return false; + return false;
+ } + }
+ // Paper end + // Paper end - duplicate uuid resolving
public CompletableFuture<Either<LevelChunk, ChunkHolder.ChunkLoadingFailure>> prepareTickingChunk(ChunkHolder holder) { public CompletableFuture<Either<LevelChunk, ChunkHolder.ChunkLoadingFailure>> prepareTickingChunk(ChunkHolder holder) {
throw new UnsupportedOperationException(); // Paper - rewrite chunk system throw new UnsupportedOperationException(); // Paper - rewrite chunk system
} }

Datei anzeigen

@ -13,7 +13,7 @@ This of course is undesirable, so just return the loaded side as "primary"
and treat it as a single chest if the other sides are unloaded and treat it as a single chest if the other sides are unloaded
diff --git a/src/main/java/net/minecraft/world/level/block/DoubleBlockCombiner.java b/src/main/java/net/minecraft/world/level/block/DoubleBlockCombiner.java diff --git a/src/main/java/net/minecraft/world/level/block/DoubleBlockCombiner.java b/src/main/java/net/minecraft/world/level/block/DoubleBlockCombiner.java
index 0a40d9b7e394fa10d6bfb0057440e1b0e55d1fc4..67da7795caebc882f14814217efccd139fc8f1e3 100644 index 0a40d9b7e394fa10d6bfb0057440e1b0e55d1fc4..c889d2e08b9e7c8ee374f0148e72bb3bc9a1d826 100644
--- a/src/main/java/net/minecraft/world/level/block/DoubleBlockCombiner.java --- a/src/main/java/net/minecraft/world/level/block/DoubleBlockCombiner.java
+++ b/src/main/java/net/minecraft/world/level/block/DoubleBlockCombiner.java +++ b/src/main/java/net/minecraft/world/level/block/DoubleBlockCombiner.java
@@ -25,7 +25,12 @@ public class DoubleBlockCombiner { @@ -25,7 +25,12 @@ public class DoubleBlockCombiner {
@ -21,12 +21,12 @@ index 0a40d9b7e394fa10d6bfb0057440e1b0e55d1fc4..67da7795caebc882f14814217efccd13
} else { } else {
BlockPos blockPos = pos.relative(directionMapper.apply(state)); BlockPos blockPos = pos.relative(directionMapper.apply(state));
- BlockState blockState = world.getBlockState(blockPos); - BlockState blockState = world.getBlockState(blockPos);
+ // Paper start + // Paper start - Don't load Chunks from Hoppers and other things
+ BlockState blockState = world.getBlockStateIfLoaded(blockPos); + BlockState blockState = world.getBlockStateIfLoaded(blockPos);
+ if (blockState == null) { + if (blockState == null) {
+ return new DoubleBlockCombiner.NeighborCombineResult.Single<>(blockEntity); + return new DoubleBlockCombiner.NeighborCombineResult.Single<>(blockEntity);
+ } + }
+ // Paper end + // Paper end - Don't load Chunks from Hoppers and other things
if (blockState.is(state.getBlock())) { if (blockState.is(state.getBlock())) {
DoubleBlockCombiner.BlockType blockType2 = typeMapper.apply(blockState); DoubleBlockCombiner.BlockType blockType2 = typeMapper.apply(blockState);
if (blockType2 != DoubleBlockCombiner.BlockType.SINGLE && blockType != blockType2 && blockState.getValue(directionProperty) == state.getValue(directionProperty)) { if (blockType2 != DoubleBlockCombiner.BlockType.SINGLE && blockType != blockType2 && blockState.getValue(directionProperty) == state.getValue(directionProperty)) {

Datei anzeigen

@ -6,7 +6,7 @@ Subject: [PATCH] Optimise EntityGetter#getPlayerByUUID
Use the PlayerList map instead of iterating over all players 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 diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 978f0f20c3aceb1c6f967c2bec3d010e344aad0c..b10097cd28f0dc360cda9b31e8184ed3a7003780 100644 index 978f0f20c3aceb1c6f967c2bec3d010e344aad0c..854030f910c6e789cbc9f19aab76437f35bf7668 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -558,6 +558,15 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -558,6 +558,15 @@ public class ServerLevel extends Level implements WorldGenLevel {
@ -20,7 +20,7 @@ index 978f0f20c3aceb1c6f967c2bec3d010e344aad0c..b10097cd28f0dc360cda9b31e8184ed3
+ final Player player = this.getServer().getPlayerList().getPlayer(uuid); + final Player player = this.getServer().getPlayerList().getPlayer(uuid);
+ return player != null && player.level() == this ? player : null; + return player != null && player.level() == this ? player : null;
+ } + }
+ // Paper end + // Paper end - optimise getPlayerByUUID
+ +
// Add env and gen to constructor, IWorldDataServer -> WorldDataServer // Add env and gen to constructor, IWorldDataServer -> WorldDataServer
public ServerLevel(MinecraftServer minecraftserver, Executor executor, LevelStorageSource.LevelStorageAccess convertable_conversionsession, PrimaryLevelData iworlddataserver, ResourceKey<Level> resourcekey, LevelStem worlddimension, ChunkProgressListener worldloadlistener, boolean flag, long i, List<CustomSpawner> list, boolean flag1, @Nullable RandomSequences randomsequences, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider) { public ServerLevel(MinecraftServer minecraftserver, Executor executor, LevelStorageSource.LevelStorageAccess convertable_conversionsession, PrimaryLevelData iworlddataserver, ResourceKey<Level> resourcekey, LevelStem worlddimension, ChunkProgressListener worldloadlistener, boolean flag, long i, List<CustomSpawner> list, boolean flag1, @Nullable RandomSequences randomsequences, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider) {

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Optimize call to getFluid for explosions
diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java
index e59348b849a71ff5eba5bd74a9e2819a560787db..120151da61398ea8afcd658a8407efcf738b9476 100644 index e59348b849a71ff5eba5bd74a9e2819a560787db..b1fdfae75aeea78ca77987e40242bf498447bc08 100644
--- a/src/main/java/net/minecraft/world/level/Explosion.java --- a/src/main/java/net/minecraft/world/level/Explosion.java
+++ b/src/main/java/net/minecraft/world/level/Explosion.java +++ b/src/main/java/net/minecraft/world/level/Explosion.java
@@ -191,7 +191,7 @@ public class Explosion { @@ -191,7 +191,7 @@ public class Explosion {
@ -13,7 +13,7 @@ index e59348b849a71ff5eba5bd74a9e2819a560787db..120151da61398ea8afcd658a8407efcf
BlockPos blockposition = BlockPos.containing(d4, d5, d6); BlockPos blockposition = BlockPos.containing(d4, d5, d6);
BlockState iblockdata = this.level.getBlockState(blockposition); BlockState iblockdata = this.level.getBlockState(blockposition);
- FluidState fluid = this.level.getFluidState(blockposition); - FluidState fluid = this.level.getFluidState(blockposition);
+ FluidState fluid = iblockdata.getFluidState(); // Paper + FluidState fluid = iblockdata.getFluidState(); // Paper - Perf: Optimize call to getFluid for explosions
if (!this.level.isInWorldBounds(blockposition)) { if (!this.level.isInWorldBounds(blockposition)) {
break; break;

Datei anzeigen

@ -2,7 +2,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Spottedleaf <Spottedleaf@users.noreply.github.com> From: Spottedleaf <Spottedleaf@users.noreply.github.com>
Date: Fri, 17 Jan 2020 18:44:55 -0800 Date: Fri, 17 Jan 2020 18:44:55 -0800
Subject: [PATCH] Fix last firework in stack not having effects when dispensed Subject: [PATCH] Fix last firework in stack not having effects when dispensed
- #2871
CB used the resulting item in the dispenser rather than the item CB used the resulting item in the dispenser rather than the item
dispensed. The resulting item would have size == 0 and therefore dispensed. The resulting item would have size == 0 and therefore

Datei anzeigen

@ -6,7 +6,7 @@ Subject: [PATCH] Guard against serializing mismatching chunk coordinate
Should help if something dumb happens Should help if something dumb happens
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java
index 97cdd8cd7749185230471f34f7d1ce3abcd0fd11..982fb3ef071d6a66f16744717e8e146bef6d9e8c 100644 index 97cdd8cd7749185230471f34f7d1ce3abcd0fd11..7862caa0f787634cec14af81fe1f39803a43f115 100644
--- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java --- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java
@@ -94,6 +94,18 @@ public class ChunkSerializer { @@ -94,6 +94,18 @@ public class ChunkSerializer {
@ -24,7 +24,7 @@ index 97cdd8cd7749185230471f34f7d1ce3abcd0fd11..982fb3ef071d6a66f16744717e8e146b
+ return new ChunkPos(chunkData.getInt("xPos"), chunkData.getInt("zPos")); + return new ChunkPos(chunkData.getInt("xPos"), chunkData.getInt("zPos"));
+ } + }
+ } + }
+ // Paper end + // Paper end - guard against serializing mismatching coordinates
// Paper start // Paper start
public static final class InProgressChunkHolder { public static final class InProgressChunkHolder {
@ -33,25 +33,25 @@ index 97cdd8cd7749185230471f34f7d1ce3abcd0fd11..982fb3ef071d6a66f16744717e8e146b
public static InProgressChunkHolder loadChunk(ServerLevel world, PoiManager poiStorage, ChunkPos chunkPos, CompoundTag nbt, boolean distinguish) { public static InProgressChunkHolder loadChunk(ServerLevel world, PoiManager poiStorage, ChunkPos chunkPos, CompoundTag nbt, boolean distinguish) {
// Paper end // Paper end
- ChunkPos chunkcoordintpair1 = new ChunkPos(nbt.getInt("xPos"), nbt.getInt("zPos")); - ChunkPos chunkcoordintpair1 = new ChunkPos(nbt.getInt("xPos"), nbt.getInt("zPos"));
+ ChunkPos chunkcoordintpair1 = new ChunkPos(nbt.getInt("xPos"), nbt.getInt("zPos")); // Paper - diff on change, see ChunkSerializer#getChunkCoordinate + ChunkPos chunkcoordintpair1 = new ChunkPos(nbt.getInt("xPos"), nbt.getInt("zPos")); // Paper - guard against serializing mismatching coordinates; diff on change, see ChunkSerializer#getChunkCoordinate
if (!Objects.equals(chunkPos, chunkcoordintpair1)) { if (!Objects.equals(chunkPos, chunkcoordintpair1)) {
ChunkSerializer.LOGGER.error("Chunk file at {} is in the wrong location; relocating. (Expected {}, got {})", new Object[]{chunkPos, chunkPos, chunkcoordintpair1}); ChunkSerializer.LOGGER.error("Chunk file at {} is in the wrong location; relocating. (Expected {}, got {})", new Object[]{chunkPos, chunkPos, chunkcoordintpair1});
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkStorage.java diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkStorage.java
index b4e7c9b317d532d4915932f8f79dfebf2b63ff16..e4b3a70ff9f906a10f2ba3c07642193ca3269db7 100644 index b4e7c9b317d532d4915932f8f79dfebf2b63ff16..af8a8e85742497e8dac7a59a3cd5938e09580e45 100644
--- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkStorage.java --- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkStorage.java
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkStorage.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkStorage.java
@@ -178,6 +178,13 @@ public class ChunkStorage implements AutoCloseable { @@ -178,6 +178,13 @@ public class ChunkStorage implements AutoCloseable {
// Paper start - async chunk io // Paper start - async chunk io
public void write(ChunkPos chunkPos, CompoundTag nbt) throws IOException { public void write(ChunkPos chunkPos, CompoundTag nbt) throws IOException {
+ // Paper start + // Paper start - guard against serializing mismatching coordinates
+ if (nbt != null && !chunkPos.equals(ChunkSerializer.getChunkCoordinate(nbt))) { + if (nbt != null && !chunkPos.equals(ChunkSerializer.getChunkCoordinate(nbt))) {
+ String world = (this instanceof net.minecraft.server.level.ChunkMap) ? ((net.minecraft.server.level.ChunkMap)this).level.getWorld().getName() : null; + String world = (this instanceof net.minecraft.server.level.ChunkMap) ? ((net.minecraft.server.level.ChunkMap)this).level.getWorld().getName() : null;
+ throw new IllegalArgumentException("Chunk coordinate and serialized data do not have matching coordinates, trying to serialize coordinate " + chunkPos.toString() + throw new IllegalArgumentException("Chunk coordinate and serialized data do not have matching coordinates, trying to serialize coordinate " + chunkPos.toString()
+ + " but compound says coordinate is " + ChunkSerializer.getChunkCoordinate(nbt).toString() + (world == null ? " for an unknown world" : (" for world: " + world))); + + " but compound says coordinate is " + ChunkSerializer.getChunkCoordinate(nbt).toString() + (world == null ? " for an unknown world" : (" for world: " + world)));
+ } + }
+ // Paper end + // Paper end - guard against serializing mismatching coordinates
this.regionFileCache.write(chunkPos, nbt); this.regionFileCache.write(chunkPos, nbt);
// Paper end - Async chunk loading // Paper end - Async chunk loading
if (this.legacyStructureHandler != null) { if (this.legacyStructureHandler != null) {

Datei anzeigen

@ -1,19 +1,19 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: kickash32 <kickash32@gmail.com> From: kickash32 <kickash32@gmail.com>
Date: Mon, 3 Jun 2019 02:02:39 -0400 Date: Mon, 3 Jun 2019 02:02:39 -0400
Subject: [PATCH] Implement alternative item-despawn-rate Subject: [PATCH] Alternative item-despawn-rate
Co-authored-by: Noah van der Aa <ndvdaa@gmail.com> Co-authored-by: Noah van der Aa <ndvdaa@gmail.com>
diff --git a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java 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 bbd0d161f27d0e061c14ad87990e44492bb7fe3d..36ccb7701cc5f6648940256b62321034eff964c6 100644 index 16c30342ac9ebf5cffa0bf23ab9700b6704a1ec0..ffbeea768cbb09b6f828ef1a9394c9fe50e99914 100644
--- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java --- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
+++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java +++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
@@ -56,6 +56,7 @@ public class ItemEntity extends Entity implements TraceableEntity { @@ -56,6 +56,7 @@ public class ItemEntity extends Entity implements TraceableEntity {
public final float bobOffs; public final float bobOffs;
private int lastTick = MinecraftServer.currentTick - 1; // CraftBukkit private int lastTick = MinecraftServer.currentTick - 1; // CraftBukkit
public boolean canMobPickup = true; // Paper public boolean canMobPickup = true; // Paper
+ private int despawnRate = -1; // Paper + private int despawnRate = -1; // Paper - Alternative item-despawn-rate
public ItemEntity(EntityType<? extends ItemEntity> type, Level world) { public ItemEntity(EntityType<? extends ItemEntity> type, Level world) {
super(type, world); super(type, world);
@ -22,7 +22,7 @@ index bbd0d161f27d0e061c14ad87990e44492bb7fe3d..36ccb7701cc5f6648940256b62321034
} }
- if (!this.level().isClientSide && this.age >= this.level().spigotConfig.itemDespawnRate) { // Spigot - if (!this.level().isClientSide && this.age >= this.level().spigotConfig.itemDespawnRate) { // Spigot
+ if (!this.level().isClientSide && this.age >= this.despawnRate) { // Spigot // Paper + if (!this.level().isClientSide && this.age >= this.despawnRate) { // Spigot // Paper - Alternative item-despawn-rate
// CraftBukkit start - fire ItemDespawnEvent // CraftBukkit start - fire ItemDespawnEvent
if (CraftEventFactory.callItemDespawnEvent(this).isCancelled()) { if (CraftEventFactory.callItemDespawnEvent(this).isCancelled()) {
this.age = 0; this.age = 0;
@ -31,7 +31,7 @@ index bbd0d161f27d0e061c14ad87990e44492bb7fe3d..36ccb7701cc5f6648940256b62321034
// CraftBukkit end // CraftBukkit end
- if (!this.level().isClientSide && this.age >= this.level().spigotConfig.itemDespawnRate) { // Spigot - if (!this.level().isClientSide && this.age >= this.level().spigotConfig.itemDespawnRate) { // Spigot
+ if (!this.level().isClientSide && this.age >= this.despawnRate) { // Spigot // Paper + if (!this.level().isClientSide && this.age >= this.despawnRate) { // Spigot // Paper - Alternative item-despawn-rate
// CraftBukkit start - fire ItemDespawnEvent // CraftBukkit start - fire ItemDespawnEvent
if (org.bukkit.craftbukkit.event.CraftEventFactory.callItemDespawnEvent(this).isCancelled()) { if (org.bukkit.craftbukkit.event.CraftEventFactory.callItemDespawnEvent(this).isCancelled()) {
this.age = 0; this.age = 0;
@ -40,7 +40,7 @@ index bbd0d161f27d0e061c14ad87990e44492bb7fe3d..36ccb7701cc5f6648940256b62321034
ItemStack itemstack = this.getItem(); ItemStack itemstack = this.getItem();
- return this.isAlive() && this.pickupDelay != 32767 && this.age != -32768 && this.age < 6000 && itemstack.getCount() < itemstack.getMaxStackSize(); - return this.isAlive() && this.pickupDelay != 32767 && this.age != -32768 && this.age < 6000 && itemstack.getCount() < itemstack.getMaxStackSize();
+ return this.isAlive() && this.pickupDelay != 32767 && this.age != -32768 && this.age < this.despawnRate && itemstack.getCount() < itemstack.getMaxStackSize(); // Paper - respect despawn rate in pickup check. + return this.isAlive() && this.pickupDelay != 32767 && this.age != -32768 && this.age < this.despawnRate && itemstack.getCount() < itemstack.getMaxStackSize(); // Paper - Alternative item-despawn-rate
} }
private void tryToMerge(ItemEntity other) { private void tryToMerge(ItemEntity other) {
@ -48,7 +48,7 @@ index bbd0d161f27d0e061c14ad87990e44492bb7fe3d..36ccb7701cc5f6648940256b62321034
public void setItem(ItemStack stack) { public void setItem(ItemStack stack) {
this.getEntityData().set(ItemEntity.DATA_ITEM, stack); this.getEntityData().set(ItemEntity.DATA_ITEM, stack);
+ this.despawnRate = this.level().paperConfig().entities.spawning.altItemDespawnRate.enabled ? this.level().paperConfig().entities.spawning.altItemDespawnRate.items.getOrDefault(stack.getItem(), this.level().spigotConfig.itemDespawnRate) : this.level().spigotConfig.itemDespawnRate; // Paper + this.despawnRate = this.level().paperConfig().entities.spawning.altItemDespawnRate.enabled ? this.level().paperConfig().entities.spawning.altItemDespawnRate.items.getOrDefault(stack.getItem(), this.level().spigotConfig.itemDespawnRate) : this.level().spigotConfig.itemDespawnRate; // Paper - Alternative item-despawn-rate
} }
@Override @Override
@ -57,7 +57,7 @@ index bbd0d161f27d0e061c14ad87990e44492bb7fe3d..36ccb7701cc5f6648940256b62321034
public void makeFakeItem() { public void makeFakeItem() {
this.setNeverPickUp(); this.setNeverPickUp();
- this.age = this.level().spigotConfig.itemDespawnRate - 1; // Spigot - this.age = this.level().spigotConfig.itemDespawnRate - 1; // Spigot
+ this.age = this.despawnRate - 1; // Spigot // Paper + this.age = this.despawnRate - 1; // Spigot // Paper - Alternative item-despawn-rate
} }
public float getSpin(float tickDelta) { public float getSpin(float tickDelta) {

Datei anzeigen

@ -13,16 +13,14 @@ Quickly loading the exact world spawn chunk before searching the
heightmap resolves the issue without having to load all spawn chunks. heightmap resolves the issue without having to load all spawn chunks.
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 26a611b8d75513690811fbbd15dc37e6f4a50dd4..21eac12dcc3571e647b07b313015d809cb0fbcea 100644 index 26a611b8d75513690811fbbd15dc37e6f4a50dd4..f052c3eb14d5f50fb82889b011387991d5e4aac7 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java --- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -3411,6 +3411,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S @@ -3411,6 +3411,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
if (flag1) { if (flag1) {
blockposition1 = ServerLevel.END_SPAWN_POINT; blockposition1 = ServerLevel.END_SPAWN_POINT;
} else { } else {
+ // Paper start - Ensure spawn chunk is always loaded before calculating Y coordinate + destination.getChunkAt(destination.getSharedSpawnPos()); // Paper - Ensure spawn chunk is always loaded before calculating Y coordinate
+ destination.getChunkAt(destination.getSharedSpawnPos());
+ // Paper end
blockposition1 = destination.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, destination.getSharedSpawnPos()); blockposition1 = destination.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, destination.getSharedSpawnPos());
} }
// CraftBukkit start // CraftBukkit start

Datei anzeigen

@ -1,18 +1,18 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: kickash32 <kickash32@gmail.com> From: kickash32 <kickash32@gmail.com>
Date: Mon, 19 Aug 2019 01:27:58 +0500 Date: Mon, 19 Aug 2019 01:27:58 +0500
Subject: [PATCH] implement optional per player mob spawns Subject: [PATCH] Optional per player mob spawns
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 2130f15d92bab1d4e35a92a681ac34cd9c929ea9..1f9efff4ddccf2569fdfe42e6cbc92792643d0ea 100644 index 2130f15d92bab1d4e35a92a681ac34cd9c929ea9..8fdffba03688e9f2fd57a97343b66933a4aee9c6 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java --- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -288,6 +288,29 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -288,6 +288,29 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}); });
} }
+ // Paper start + // Paper start - Optional per player mob spawns
+ public void updatePlayerMobTypeMap(Entity entity) { + public void updatePlayerMobTypeMap(Entity entity) {
+ if (!this.level.paperConfig().entities.spawning.perPlayerMobSpawns) { + if (!this.level.paperConfig().entities.spawning.perPlayerMobSpawns) {
+ return; + return;
@ -33,13 +33,13 @@ index 2130f15d92bab1d4e35a92a681ac34cd9c929ea9..1f9efff4ddccf2569fdfe42e6cbc9279
+ public int getMobCountNear(ServerPlayer entityPlayer, net.minecraft.world.entity.MobCategory mobCategory) { + public int getMobCountNear(ServerPlayer entityPlayer, net.minecraft.world.entity.MobCategory mobCategory) {
+ return entityPlayer.mobCounts[mobCategory.ordinal()]; + return entityPlayer.mobCounts[mobCategory.ordinal()];
+ } + }
+ // Paper end + // Paper end - Optional per player mob spawns
+ +
private static double euclideanDistanceSquared(ChunkPos pos, Entity entity) { private static double euclideanDistanceSquared(ChunkPos pos, Entity entity) {
double d0 = (double) SectionPos.sectionToBlockCoord(pos.x, 8); double d0 = (double) SectionPos.sectionToBlockCoord(pos.x, 8);
double d1 = (double) SectionPos.sectionToBlockCoord(pos.z, 8); double d1 = (double) SectionPos.sectionToBlockCoord(pos.z, 8);
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index 16028723b36c1ca3a3c5d1bf2a7c82d2b42a0be4..24d9a2c37db4bbf2585b33d06f5ea57eb2adf356 100644 index 16028723b36c1ca3a3c5d1bf2a7c82d2b42a0be4..488f7e2f1ab0312673983d9079b4d7d99eebe611 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -549,7 +549,19 @@ public class ServerChunkCache extends ChunkSource { @@ -549,7 +549,19 @@ public class ServerChunkCache extends ChunkSource {
@ -47,7 +47,7 @@ index 16028723b36c1ca3a3c5d1bf2a7c82d2b42a0be4..24d9a2c37db4bbf2585b33d06f5ea57e
this.level.timings.countNaturalMobs.startTiming(); // Paper - timings this.level.timings.countNaturalMobs.startTiming(); // Paper - timings
int k = this.distanceManager.getNaturalSpawnChunkCount(); int k = this.distanceManager.getNaturalSpawnChunkCount();
- NaturalSpawner.SpawnState spawnercreature_d = NaturalSpawner.createState(k, this.level.getAllEntities(), this::getFullChunk, new LocalMobCapCalculator(this.chunkMap)); - NaturalSpawner.SpawnState spawnercreature_d = NaturalSpawner.createState(k, this.level.getAllEntities(), this::getFullChunk, new LocalMobCapCalculator(this.chunkMap));
+ // Paper start - per player mob spawning + // Paper start - Optional per player mob spawns
+ int naturalSpawnChunkCount = k; + int naturalSpawnChunkCount = k;
+ NaturalSpawner.SpawnState spawnercreature_d; // moved down + NaturalSpawner.SpawnState spawnercreature_d; // moved down
+ if ((this.spawnFriendlies || this.spawnEnemies) && this.level.paperConfig().entities.spawning.perPlayerMobSpawns) { // don't count mobs when animals and monsters are disabled + if ((this.spawnFriendlies || this.spawnEnemies) && this.level.paperConfig().entities.spawning.perPlayerMobSpawns) { // don't count mobs when animals and monsters are disabled
@ -59,39 +59,39 @@ index 16028723b36c1ca3a3c5d1bf2a7c82d2b42a0be4..24d9a2c37db4bbf2585b33d06f5ea57e
+ } else { + } else {
+ spawnercreature_d = NaturalSpawner.createState(naturalSpawnChunkCount, this.level.getAllEntities(), this::getFullChunk, !this.level.paperConfig().entities.spawning.perPlayerMobSpawns ? new LocalMobCapCalculator(this.chunkMap) : null, false); + spawnercreature_d = NaturalSpawner.createState(naturalSpawnChunkCount, this.level.getAllEntities(), this::getFullChunk, !this.level.paperConfig().entities.spawning.perPlayerMobSpawns ? new LocalMobCapCalculator(this.chunkMap) : null, false);
+ } + }
+ // Paper end + // Paper end - Optional per player mob spawns
this.level.timings.countNaturalMobs.stopTiming(); // Paper - timings this.level.timings.countNaturalMobs.stopTiming(); // Paper - timings
this.lastSpawnState = spawnercreature_d; this.lastSpawnState = spawnercreature_d;
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 5aef108c5b78cfc02af5c73b9bc03004fba33ca7..26410f43c7bbb368d9ef7206d3b9759f86afba4b 100644 index 5aef108c5b78cfc02af5c73b9bc03004fba33ca7..fff540886166a60b967cf14e93776e36dcbe1308 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -253,6 +253,10 @@ public class ServerPlayer extends Player { @@ -253,6 +253,10 @@ public class ServerPlayer extends Player {
public boolean queueHealthUpdatePacket = false; public boolean queueHealthUpdatePacket = false;
public net.minecraft.network.protocol.game.ClientboundSetHealthPacket queuedHealthUpdatePacket; public net.minecraft.network.protocol.game.ClientboundSetHealthPacket queuedHealthUpdatePacket;
// Paper end // Paper end
+ // Paper start - mob spawning rework + // Paper start - Optional per player mob spawns
+ public static final int MOBCATEGORY_TOTAL_ENUMS = net.minecraft.world.entity.MobCategory.values().length; + public static final int MOBCATEGORY_TOTAL_ENUMS = net.minecraft.world.entity.MobCategory.values().length;
+ public final int[] mobCounts = new int[MOBCATEGORY_TOTAL_ENUMS]; // Paper + public final int[] mobCounts = new int[MOBCATEGORY_TOTAL_ENUMS]; // Paper
+ // Paper end - mob spawning rework + // Paper end - Optional per player mob spawns
// CraftBukkit start // CraftBukkit start
public String displayName; public String displayName;
diff --git a/src/main/java/net/minecraft/world/level/NaturalSpawner.java b/src/main/java/net/minecraft/world/level/NaturalSpawner.java diff --git a/src/main/java/net/minecraft/world/level/NaturalSpawner.java b/src/main/java/net/minecraft/world/level/NaturalSpawner.java
index fe38079d69f3e9987ad5ab077ae09d05017a681a..9df761f5cf043e8d2dffa711c20ab32fe2992331 100644 index fe38079d69f3e9987ad5ab077ae09d05017a681a..4aa2a174400fe879501571c175d5ac4d09ac7de3 100644
--- a/src/main/java/net/minecraft/world/level/NaturalSpawner.java --- a/src/main/java/net/minecraft/world/level/NaturalSpawner.java
+++ b/src/main/java/net/minecraft/world/level/NaturalSpawner.java +++ b/src/main/java/net/minecraft/world/level/NaturalSpawner.java
@@ -70,6 +70,12 @@ public final class NaturalSpawner { @@ -70,6 +70,12 @@ public final class NaturalSpawner {
private NaturalSpawner() {} private NaturalSpawner() {}
public static NaturalSpawner.SpawnState createState(int spawningChunkCount, Iterable<Entity> entities, NaturalSpawner.ChunkGetter chunkSource, LocalMobCapCalculator densityCapper) { public static NaturalSpawner.SpawnState createState(int spawningChunkCount, Iterable<Entity> entities, NaturalSpawner.ChunkGetter chunkSource, LocalMobCapCalculator densityCapper) {
+ // Paper start - add countMobs parameter + // Paper start - Optional per player mob spawns
+ return createState(spawningChunkCount, entities, chunkSource, densityCapper, false); + return createState(spawningChunkCount, entities, chunkSource, densityCapper, false);
+ } + }
+ +
+ public static NaturalSpawner.SpawnState createState(int spawningChunkCount, Iterable<Entity> entities, NaturalSpawner.ChunkGetter chunkSource, LocalMobCapCalculator densityCapper, boolean countMobs) { + public static NaturalSpawner.SpawnState createState(int spawningChunkCount, Iterable<Entity> entities, NaturalSpawner.ChunkGetter chunkSource, LocalMobCapCalculator densityCapper, boolean countMobs) {
+ // Paper end + // Paper end - Optional per player mob spawns
PotentialCalculator spawnercreatureprobabilities = new PotentialCalculator(); PotentialCalculator spawnercreatureprobabilities = new PotentialCalculator();
Object2IntOpenHashMap<MobCategory> object2intopenhashmap = new Object2IntOpenHashMap(); Object2IntOpenHashMap<MobCategory> object2intopenhashmap = new Object2IntOpenHashMap();
Iterator iterator = entities.iterator(); Iterator iterator = entities.iterator();
@ -100,16 +100,16 @@ index fe38079d69f3e9987ad5ab077ae09d05017a681a..9df761f5cf043e8d2dffa711c20ab32f
} }
- if (entity instanceof Mob) { - if (entity instanceof Mob) {
+ if (densityCapper != null && entity instanceof Mob) { // Paper + if (densityCapper != null && entity instanceof Mob) { // Paper - Optional per player mob spawns
densityCapper.addMob(chunk.getPos(), enumcreaturetype); densityCapper.addMob(chunk.getPos(), enumcreaturetype);
} }
object2intopenhashmap.addTo(enumcreaturetype, 1); object2intopenhashmap.addTo(enumcreaturetype, 1);
+ // Paper start + // Paper start - Optional per player mob spawns
+ if (countMobs) { + if (countMobs) {
+ chunk.level.getChunkSource().chunkMap.updatePlayerMobTypeMap(entity); + chunk.level.getChunkSource().chunkMap.updatePlayerMobTypeMap(entity);
+ } + }
+ // Paper end + // Paper end - Optional per player mob spawns
}); });
} }
} }
@ -118,7 +118,7 @@ index fe38079d69f3e9987ad5ab077ae09d05017a681a..9df761f5cf043e8d2dffa711c20ab32f
} }
- if ((spawnAnimals || !enumcreaturetype.isFriendly()) && (spawnMonsters || enumcreaturetype.isFriendly()) && (rareSpawn || !enumcreaturetype.isPersistent()) && info.canSpawnForCategory(enumcreaturetype, chunk.getPos(), limit)) { - if ((spawnAnimals || !enumcreaturetype.isFriendly()) && (spawnMonsters || enumcreaturetype.isFriendly()) && (rareSpawn || !enumcreaturetype.isPersistent()) && info.canSpawnForCategory(enumcreaturetype, chunk.getPos(), limit)) {
+ // Paper start - only allow spawns upto the limit per chunk and update count afterwards + // Paper start - Optional per player mob spawns; only allow spawns upto the limit per chunk and update count afterwards
+ int currEntityCount = info.mobCategoryCounts.getInt(enumcreaturetype); + int currEntityCount = info.mobCategoryCounts.getInt(enumcreaturetype);
+ int k1 = limit * info.getSpawnableChunkCount() / NaturalSpawner.MAGIC_NUMBER; + int k1 = limit * info.getSpawnableChunkCount() / NaturalSpawner.MAGIC_NUMBER;
+ int difference = k1 - currEntityCount; + int difference = k1 - currEntityCount;
@ -136,18 +136,18 @@ index fe38079d69f3e9987ad5ab077ae09d05017a681a..9df761f5cf043e8d2dffa711c20ab32f
+ difference = (minDiff == Integer.MAX_VALUE) ? 0 : minDiff; + difference = (minDiff == Integer.MAX_VALUE) ? 0 : minDiff;
+ } + }
+ if ((spawnAnimals || !enumcreaturetype.isFriendly()) && (spawnMonsters || enumcreaturetype.isFriendly()) && (rareSpawn || !enumcreaturetype.isPersistent()) && difference > 0) { + if ((spawnAnimals || !enumcreaturetype.isFriendly()) && (spawnMonsters || enumcreaturetype.isFriendly()) && (rareSpawn || !enumcreaturetype.isPersistent()) && difference > 0) {
+ // Paper end + // Paper end - Optional per player mob spawns
// CraftBukkit end // CraftBukkit end
Objects.requireNonNull(info); Objects.requireNonNull(info);
NaturalSpawner.SpawnPredicate spawnercreature_c = info::canSpawn; NaturalSpawner.SpawnPredicate spawnercreature_c = info::canSpawn;
Objects.requireNonNull(info); Objects.requireNonNull(info);
- NaturalSpawner.spawnCategoryForChunk(enumcreaturetype, world, chunk, spawnercreature_c, info::afterSpawn); - NaturalSpawner.spawnCategoryForChunk(enumcreaturetype, world, chunk, spawnercreature_c, info::afterSpawn);
+ // Paper start + // Paper start - Optional per player mob spawns
+ int spawnCount = NaturalSpawner.spawnCategoryForChunk(enumcreaturetype, world, chunk, spawnercreature_c, info::afterSpawn, + int spawnCount = NaturalSpawner.spawnCategoryForChunk(enumcreaturetype, world, chunk, spawnercreature_c, info::afterSpawn,
+ difference, world.paperConfig().entities.spawning.perPlayerMobSpawns ? world.getChunkSource().chunkMap::updatePlayerMobTypeMap : null); + difference, world.paperConfig().entities.spawning.perPlayerMobSpawns ? world.getChunkSource().chunkMap::updatePlayerMobTypeMap : null);
+ info.mobCategoryCounts.mergeInt(enumcreaturetype, spawnCount, Integer::sum); + info.mobCategoryCounts.mergeInt(enumcreaturetype, spawnCount, Integer::sum);
+ // Paper end + // Paper end - Optional per player mob spawns
} }
} }
@ -155,18 +155,18 @@ index fe38079d69f3e9987ad5ab077ae09d05017a681a..9df761f5cf043e8d2dffa711c20ab32f
} }
public static void spawnCategoryForChunk(MobCategory group, ServerLevel world, LevelChunk chunk, NaturalSpawner.SpawnPredicate checker, NaturalSpawner.AfterSpawnCallback runner) { public static void spawnCategoryForChunk(MobCategory group, ServerLevel world, LevelChunk chunk, NaturalSpawner.SpawnPredicate checker, NaturalSpawner.AfterSpawnCallback runner) {
+ // Paper start - add parameters and int ret type + // Paper start - Optional per player mob spawns
+ spawnCategoryForChunk(group, world, chunk, checker, runner, Integer.MAX_VALUE, null); + spawnCategoryForChunk(group, world, chunk, checker, runner, Integer.MAX_VALUE, null);
+ } + }
+ public static int spawnCategoryForChunk(MobCategory group, ServerLevel world, LevelChunk chunk, NaturalSpawner.SpawnPredicate checker, NaturalSpawner.AfterSpawnCallback runner, int maxSpawns, Consumer<Entity> trackEntity) { + public static int spawnCategoryForChunk(MobCategory group, ServerLevel world, LevelChunk chunk, NaturalSpawner.SpawnPredicate checker, NaturalSpawner.AfterSpawnCallback runner, int maxSpawns, Consumer<Entity> trackEntity) {
+ // Paper end - add parameters and int ret type + // Paper end - Optional per player mob spawns
BlockPos blockposition = NaturalSpawner.getRandomPosWithin(world, chunk); BlockPos blockposition = NaturalSpawner.getRandomPosWithin(world, chunk);
if (blockposition.getY() >= world.getMinBuildHeight() + 1) { if (blockposition.getY() >= world.getMinBuildHeight() + 1) {
- NaturalSpawner.spawnCategoryForPosition(group, world, chunk, blockposition, checker, runner); - NaturalSpawner.spawnCategoryForPosition(group, world, chunk, blockposition, checker, runner);
+ return NaturalSpawner.spawnCategoryForPosition(group, world, chunk, blockposition, checker, runner, maxSpawns, trackEntity); // Paper + return NaturalSpawner.spawnCategoryForPosition(group, world, chunk, blockposition, checker, runner, maxSpawns, trackEntity); // Paper - Optional per player mob spawns
} }
+ return 0; // Paper + return 0; // Paper - Optional per player mob spawns
} }
@VisibleForDebug @VisibleForDebug
@ -174,22 +174,22 @@ index fe38079d69f3e9987ad5ab077ae09d05017a681a..9df761f5cf043e8d2dffa711c20ab32f
}); });
} }
+ // Paper start - add maxSpawns parameter and return spawned mobs + // Paper start - Optional per player mob spawns
public static void spawnCategoryForPosition(MobCategory group, ServerLevel world, ChunkAccess chunk, BlockPos pos, NaturalSpawner.SpawnPredicate checker, NaturalSpawner.AfterSpawnCallback runner) { public static void spawnCategoryForPosition(MobCategory group, ServerLevel world, ChunkAccess chunk, BlockPos pos, NaturalSpawner.SpawnPredicate checker, NaturalSpawner.AfterSpawnCallback runner) {
+ spawnCategoryForPosition(group, world,chunk, pos, checker, runner, Integer.MAX_VALUE, null); + spawnCategoryForPosition(group, world,chunk, pos, checker, runner, Integer.MAX_VALUE, null);
+ } + }
+ public static int spawnCategoryForPosition(MobCategory group, ServerLevel world, ChunkAccess chunk, BlockPos pos, NaturalSpawner.SpawnPredicate checker, NaturalSpawner.AfterSpawnCallback runner, int maxSpawns, Consumer<Entity> trackEntity) { + public static int spawnCategoryForPosition(MobCategory group, ServerLevel world, ChunkAccess chunk, BlockPos pos, NaturalSpawner.SpawnPredicate checker, NaturalSpawner.AfterSpawnCallback runner, int maxSpawns, Consumer<Entity> trackEntity) {
+ // Paper end - add maxSpawns parameter and return spawned mobs + // Paper end - Optional per player mob spawns
StructureManager structuremanager = world.structureManager(); StructureManager structuremanager = world.structureManager();
ChunkGenerator chunkgenerator = world.getChunkSource().getGenerator(); ChunkGenerator chunkgenerator = world.getChunkSource().getGenerator();
int i = pos.getY(); int i = pos.getY();
BlockState iblockdata = world.getBlockStateIfLoadedAndInBounds(pos); // Paper - don't load chunks for mob spawn BlockState iblockdata = world.getBlockStateIfLoadedAndInBounds(pos); // Paper - don't load chunks for mob spawn
+ int j = 0; // Paper - moved up + int j = 0; // Paper - Optional per player mob spawns; moved up
if (iblockdata != null && !iblockdata.isRedstoneConductor(chunk, pos)) { // Paper - don't load chunks for mob spawn if (iblockdata != null && !iblockdata.isRedstoneConductor(chunk, pos)) { // Paper - don't load chunks for mob spawn
BlockPos.MutableBlockPos blockposition_mutableblockposition = new BlockPos.MutableBlockPos(); BlockPos.MutableBlockPos blockposition_mutableblockposition = new BlockPos.MutableBlockPos();
- int j = 0; - int j = 0;
+ //int j = 0; // Paper - moved up + //int j = 0; // Paper - Optional per player mob spawns; moved up
int k = 0; int k = 0;
while (k < 3) { while (k < 3) {
@ -198,7 +198,7 @@ index fe38079d69f3e9987ad5ab077ae09d05017a681a..9df761f5cf043e8d2dffa711c20ab32f
PreSpawnStatus doSpawning = isValidSpawnPostitionForType(world, group, structuremanager, chunkgenerator, biomesettingsmobs_c, blockposition_mutableblockposition, d2); PreSpawnStatus doSpawning = isValidSpawnPostitionForType(world, group, structuremanager, chunkgenerator, biomesettingsmobs_c, blockposition_mutableblockposition, d2);
if (doSpawning == PreSpawnStatus.ABORT) { if (doSpawning == PreSpawnStatus.ABORT) {
- return; - return;
+ return j; // Paper + return j; // Paper - Optional per player mob spawns
} }
if (doSpawning == PreSpawnStatus.SUCCESS && checker.test(biomesettingsmobs_c.type, blockposition_mutableblockposition, chunk)) { if (doSpawning == PreSpawnStatus.SUCCESS && checker.test(biomesettingsmobs_c.type, blockposition_mutableblockposition, chunk)) {
// Paper end // Paper end
@ -206,7 +206,7 @@ index fe38079d69f3e9987ad5ab077ae09d05017a681a..9df761f5cf043e8d2dffa711c20ab32f
if (entityinsentient == null) { if (entityinsentient == null) {
- return; - return;
+ return j; // Paper + return j; // Paper - Optional per player mob spawns
} }
entityinsentient.moveTo(d0, (double) i, d1, world.random.nextFloat() * 360.0F, 0.0F); entityinsentient.moveTo(d0, (double) i, d1, world.random.nextFloat() * 360.0F, 0.0F);
@ -214,17 +214,17 @@ index fe38079d69f3e9987ad5ab077ae09d05017a681a..9df761f5cf043e8d2dffa711c20ab32f
++j; ++j;
++k1; ++k1;
runner.run(entityinsentient, chunk); runner.run(entityinsentient, chunk);
+ // Paper start + // Paper start - Optional per player mob spawns
+ if (trackEntity != null) { + if (trackEntity != null) {
+ trackEntity.accept(entityinsentient); + trackEntity.accept(entityinsentient);
+ } + }
+ // Paper end + // Paper end - Optional per player mob spawns
} }
// CraftBukkit end // CraftBukkit end
- if (j >= entityinsentient.getMaxSpawnClusterSize()) { - if (j >= entityinsentient.getMaxSpawnClusterSize()) {
- return; - return;
+ if (j >= entityinsentient.getMaxSpawnClusterSize() || j >= maxSpawns) { // Paper + if (j >= entityinsentient.getMaxSpawnClusterSize() || j >= maxSpawns) { // Paper - Optional per player mob spawns
+ return j; // Paper + return j; // Paper - Optional per player mob spawns
} }
if (entityinsentient.isMaxGroupSizeReached(k1)) { if (entityinsentient.isMaxGroupSizeReached(k1)) {
@ -232,7 +232,7 @@ index fe38079d69f3e9987ad5ab077ae09d05017a681a..9df761f5cf043e8d2dffa711c20ab32f
} }
} }
+ return j; // Paper + return j; // Paper - Optional per player mob spawns
} }
private static boolean isRightDistanceToPlayerAndSpawnPoint(ServerLevel world, ChunkAccess chunk, BlockPos.MutableBlockPos pos, double squaredDistance) { private static boolean isRightDistanceToPlayerAndSpawnPoint(ServerLevel world, ChunkAccess chunk, BlockPos.MutableBlockPos pos, double squaredDistance) {
@ -241,7 +241,7 @@ index fe38079d69f3e9987ad5ab077ae09d05017a681a..9df761f5cf043e8d2dffa711c20ab32f
this.mobCategoryCounts.addTo(enumcreaturetype, 1); this.mobCategoryCounts.addTo(enumcreaturetype, 1);
- this.localMobCapCalculator.addMob(new ChunkPos(blockposition), enumcreaturetype); - this.localMobCapCalculator.addMob(new ChunkPos(blockposition), enumcreaturetype);
+ if (this.localMobCapCalculator != null) this.localMobCapCalculator.addMob(new ChunkPos(blockposition), enumcreaturetype); // Paper + if (this.localMobCapCalculator != null) this.localMobCapCalculator.addMob(new ChunkPos(blockposition), enumcreaturetype); // Paper - Optional per player mob spawns
} }
public int getSpawnableChunkCount() { public int getSpawnableChunkCount() {
@ -249,7 +249,7 @@ index fe38079d69f3e9987ad5ab077ae09d05017a681a..9df761f5cf043e8d2dffa711c20ab32f
int i = limit * this.spawnableChunkCount / NaturalSpawner.MAGIC_NUMBER; int i = limit * this.spawnableChunkCount / NaturalSpawner.MAGIC_NUMBER;
// CraftBukkit end // CraftBukkit end
+ if (this.localMobCapCalculator == null) return this.mobCategoryCounts.getInt(enumcreaturetype) < i; // Paper + if (this.localMobCapCalculator == null) return this.mobCategoryCounts.getInt(enumcreaturetype) < i; // Paper - Optional per player mob spawns
return this.mobCategoryCounts.getInt(enumcreaturetype) >= i ? false : this.localMobCapCalculator.canSpawn(enumcreaturetype, chunkcoordintpair); return this.mobCategoryCounts.getInt(enumcreaturetype) >= i ? false : this.localMobCapCalculator.canSpawn(enumcreaturetype, chunkcoordintpair);
} }
} }

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Bees get gravity in void. Fixes MC-167279
diff --git a/src/main/java/net/minecraft/world/entity/animal/Bee.java b/src/main/java/net/minecraft/world/entity/animal/Bee.java diff --git a/src/main/java/net/minecraft/world/entity/animal/Bee.java b/src/main/java/net/minecraft/world/entity/animal/Bee.java
index 0f7b02d39b5dc781e65537c1b6d924e6c51e5dc7..d9297c0b2934084a065af7d7c93af8d44c3de8e1 100644 index 0f7b02d39b5dc781e65537c1b6d924e6c51e5dc7..06e990b6957a4ef48c8778bbd175d3afddf52ca3 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Bee.java --- a/src/main/java/net/minecraft/world/entity/animal/Bee.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Bee.java +++ b/src/main/java/net/minecraft/world/entity/animal/Bee.java
@@ -147,7 +147,22 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal { @@ -147,7 +147,22 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
@ -13,7 +13,7 @@ index 0f7b02d39b5dc781e65537c1b6d924e6c51e5dc7..d9297c0b2934084a065af7d7c93af8d4
super(type, world); super(type, world);
this.remainingCooldownBeforeLocatingNewFlower = Mth.nextInt(this.random, 20, 60); this.remainingCooldownBeforeLocatingNewFlower = Mth.nextInt(this.random, 20, 60);
- this.moveControl = new FlyingMoveControl(this, 20, true); - this.moveControl = new FlyingMoveControl(this, 20, true);
+ // Paper start - apply gravity to bees when they get stuck in the void, fixes MC-167279 + // Paper start - Fix MC-167279
+ class BeeFlyingMoveControl extends FlyingMoveControl { + class BeeFlyingMoveControl extends FlyingMoveControl {
+ public BeeFlyingMoveControl(final Mob entity, final int maxPitchChange, final boolean noGravity) { + public BeeFlyingMoveControl(final Mob entity, final int maxPitchChange, final boolean noGravity) {
+ super(entity, maxPitchChange, noGravity); + super(entity, maxPitchChange, noGravity);
@ -28,7 +28,7 @@ index 0f7b02d39b5dc781e65537c1b6d924e6c51e5dc7..d9297c0b2934084a065af7d7c93af8d4
+ } + }
+ } + }
+ this.moveControl = new BeeFlyingMoveControl(this, 20, true); + this.moveControl = new BeeFlyingMoveControl(this, 20, true);
+ // Paper end + // Paper end - Fix MC-167279
this.lookControl = new Bee.BeeLookControl(this); this.lookControl = new Bee.BeeLookControl(this);
this.setPathfindingMalus(BlockPathTypes.DANGER_FIRE, -1.0F); this.setPathfindingMalus(BlockPathTypes.DANGER_FIRE, -1.0F);
this.setPathfindingMalus(BlockPathTypes.WATER, -1.0F); this.setPathfindingMalus(BlockPathTypes.WATER, -1.0F);

Datei anzeigen

@ -18,18 +18,18 @@ public net.minecraft.world.level.block.TurtleEggBlock decreaseEggs(Lnet/minecraf
Co-authored-by: William Blake Galbreath <Blake.Galbreath@GMail.com> Co-authored-by: William Blake Galbreath <Blake.Galbreath@GMail.com>
diff --git a/src/main/java/net/minecraft/world/level/block/IceBlock.java b/src/main/java/net/minecraft/world/level/block/IceBlock.java diff --git a/src/main/java/net/minecraft/world/level/block/IceBlock.java b/src/main/java/net/minecraft/world/level/block/IceBlock.java
index c919b5a382b1bfcafd938ff926d9146cc5cf0cdc..f05998e0af1e844f19bf86b74f652a9901088c37 100644 index c919b5a382b1bfcafd938ff926d9146cc5cf0cdc..52c6c26a300cfd19c478afba411a17c8d5ea0c3c 100644
--- a/src/main/java/net/minecraft/world/level/block/IceBlock.java --- a/src/main/java/net/minecraft/world/level/block/IceBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/IceBlock.java +++ b/src/main/java/net/minecraft/world/level/block/IceBlock.java
@@ -35,6 +35,11 @@ public class IceBlock extends HalfTransparentBlock { @@ -35,6 +35,11 @@ public class IceBlock extends HalfTransparentBlock {
@Override @Override
public void playerDestroy(Level world, Player player, BlockPos pos, BlockState state, @Nullable BlockEntity blockEntity, ItemStack tool) { public void playerDestroy(Level world, Player player, BlockPos pos, BlockState state, @Nullable BlockEntity blockEntity, ItemStack tool) {
super.playerDestroy(world, player, pos, state, blockEntity, tool); super.playerDestroy(world, player, pos, state, blockEntity, tool);
+ // Paper start + // Paper start - Improve Block#breakNaturally API
+ this.afterDestroy(world, pos, tool); + this.afterDestroy(world, pos, tool);
+ } + }
+ public void afterDestroy(Level world, BlockPos pos, ItemStack tool) { + public void afterDestroy(Level world, BlockPos pos, ItemStack tool) {
+ // Paper end + // Paper end - Improve Block#breakNaturally API
if (EnchantmentHelper.getItemEnchantmentLevel(Enchantments.SILK_TOUCH, tool) == 0) { if (EnchantmentHelper.getItemEnchantmentLevel(Enchantments.SILK_TOUCH, tool) == 0) {
if (world.dimensionType().ultraWarm()) { if (world.dimensionType().ultraWarm()) {
world.removeBlock(pos, false); world.removeBlock(pos, false);

Datei anzeigen

@ -7,19 +7,19 @@ bypass the need to get a player chunk, then get the either,
then unwrap it... then unwrap it...
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index 24d9a2c37db4bbf2585b33d06f5ea57eb2adf356..4039bd5a80bd2305082d21c0fe826f76d8beb4c4 100644 index 488f7e2f1ab0312673983d9079b4d7d99eebe611..70f15e3af9e954483ab116500f84a9ee17f67ce4 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -268,6 +268,12 @@ public class ServerChunkCache extends ChunkSource { @@ -268,6 +268,12 @@ public class ServerChunkCache extends ChunkSource {
return this.getChunk(x, z, leastStatus, create); return this.getChunk(x, z, leastStatus, create);
}, this.mainThreadProcessor).join(); }, this.mainThreadProcessor).join();
} else { } else {
+ // Paper start - optimise for loaded chunks + // Paper start - Perf: Optimise getChunkAt calls for loaded chunks
+ LevelChunk ifLoaded = this.getChunkAtIfLoadedMainThread(x, z); + LevelChunk ifLoaded = this.getChunkAtIfLoadedMainThread(x, z);
+ if (ifLoaded != null) { + if (ifLoaded != null) {
+ return ifLoaded; + return ifLoaded;
+ } + }
+ // Paper end + // Paper end - Perf: Optimise getChunkAt calls for loaded chunks
ProfilerFiller gameprofilerfiller = this.level.getProfiler(); ProfilerFiller gameprofilerfiller = this.level.getProfiler();
gameprofilerfiller.incrementCounter("getChunk"); gameprofilerfiller.incrementCounter("getChunk");
@ -60,7 +60,7 @@ index 24d9a2c37db4bbf2585b33d06f5ea57eb2adf356..4039bd5a80bd2305082d21c0fe826f76
- return null; - return null;
- } - }
- } - }
+ return this.getChunkAtIfLoadedMainThread(chunkX, chunkZ); // Paper - optimise for loaded chunks + return this.getChunkAtIfLoadedMainThread(chunkX, chunkZ); // Paper - Perf: Optimise getChunkAt calls for loaded chunks
} }
} }

Datei anzeigen

@ -300,14 +300,14 @@ 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 diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index 4039bd5a80bd2305082d21c0fe826f76d8beb4c4..974b4970be214ca36a801d39932abcc751e540a5 100644 index 70f15e3af9e954483ab116500f84a9ee17f67ce4..56fe3f4edd15239533a1ae9287e86528b3296bdc 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -292,6 +292,7 @@ public class ServerChunkCache extends ChunkSource { @@ -292,6 +292,7 @@ public class ServerChunkCache extends ChunkSource {
// Paper start - async chunk io/loading // Paper start - async chunk io/loading
io.papermc.paper.chunk.system.scheduling.ChunkTaskScheduler.pushChunkWait(this.level, x1, z1); // Paper - rewrite chunk system io.papermc.paper.chunk.system.scheduling.ChunkTaskScheduler.pushChunkWait(this.level, x1, z1); // Paper - rewrite chunk system
// Paper end // Paper end
+ com.destroystokyo.paper.io.SyncLoadFinder.logSyncLoad(this.level, x1, z1); // Paper - sync load info + com.destroystokyo.paper.io.SyncLoadFinder.logSyncLoad(this.level, x1, z1); // Paper - Add debug for sync chunk loads
this.level.timings.syncChunkLoad.startTiming(); // Paper this.level.timings.syncChunkLoad.startTiming(); // Paper
chunkproviderserver_b.managedBlock(completablefuture::isDone); chunkproviderserver_b.managedBlock(completablefuture::isDone);
io.papermc.paper.chunk.system.scheduling.ChunkTaskScheduler.popChunkWait(); // Paper - async chunk debug // Paper - rewrite chunk system io.papermc.paper.chunk.system.scheduling.ChunkTaskScheduler.popChunkWait(); // Paper - async chunk debug // Paper - rewrite chunk system

Datei anzeigen

@ -6,14 +6,14 @@ Subject: [PATCH] Improve java version check
Co-Authored-By: MiniDigger <admin@benndorf.dev> Co-Authored-By: MiniDigger <admin@benndorf.dev>
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
index ebfebbb9b7de93dd43ee6d0531832a71f8556d33..fdce27bbd60897e7584db627b5f9ff32c930cd78 100644 index 4d2ebb7af055d1c78a648914c5a1862fe9bc8b8f..5030b865c84d84ed5be9f4987a7f0a829b8ea1e5 100644
--- a/src/main/java/org/bukkit/craftbukkit/Main.java --- a/src/main/java/org/bukkit/craftbukkit/Main.java
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java
@@ -201,23 +201,27 @@ public class Main { @@ -201,23 +201,27 @@ public class Main {
return; return;
} }
+ // Paper start - better java version checks + // Paper start - Improve java version check
+ boolean skip = Boolean.getBoolean("Paper.IgnoreJavaVersion"); + boolean skip = Boolean.getBoolean("Paper.IgnoreJavaVersion");
float javaVersion = Float.parseFloat(System.getProperty("java.class.version")); float javaVersion = Float.parseFloat(System.getProperty("java.class.version"));
- if (javaVersion < 61.0) { - if (javaVersion < 61.0) {
@ -40,7 +40,7 @@ index ebfebbb9b7de93dd43ee6d0531832a71f8556d33..fdce27bbd60897e7584db627b5f9ff32
+ if (skip && (isOldVersion || isPreRelease)) { + if (skip && (isOldVersion || isPreRelease)) {
+ System.err.println("Unsupported Java detected ("+ javaVersionName + "), but the check was skipped. Proceed with caution! "); + System.err.println("Unsupported Java detected ("+ javaVersionName + "), but the check was skipped. Proceed with caution! ");
+ } + }
+ // Paper end - better java version checks + // Paper end - Improve java version check
+ +
try { try {
// Paper start - Handled by TerminalConsoleAppender // Paper start - Handled by TerminalConsoleAppender

Datei anzeigen

@ -7,20 +7,20 @@ Adds a new event similar to PlayerEggThrowEvent, but without the Player requirem
(dispensers can throw eggs to hatch them, too). (dispensers can throw eggs to hatch them, too).
diff --git a/src/main/java/net/minecraft/world/entity/projectile/ThrownEgg.java b/src/main/java/net/minecraft/world/entity/projectile/ThrownEgg.java diff --git a/src/main/java/net/minecraft/world/entity/projectile/ThrownEgg.java b/src/main/java/net/minecraft/world/entity/projectile/ThrownEgg.java
index 98d42143e70c5be809deb6c03270987ff9db46d5..b64ecadae45c2126b92963ac8d118dde76126ddd 100644 index 98d42143e70c5be809deb6c03270987ff9db46d5..785196e6f4677074890ca965e9add85ccfd0e6e3 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/ThrownEgg.java --- a/src/main/java/net/minecraft/world/entity/projectile/ThrownEgg.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/ThrownEgg.java +++ b/src/main/java/net/minecraft/world/entity/projectile/ThrownEgg.java
@@ -82,6 +82,13 @@ public class ThrownEgg extends ThrowableItemProjectile { @@ -82,6 +82,13 @@ public class ThrownEgg extends ThrowableItemProjectile {
} }
} }
// CraftBukkit end // CraftBukkit end
+ // Paper start + // Paper start - Add ThrownEggHatchEvent
+ com.destroystokyo.paper.event.entity.ThrownEggHatchEvent event = new com.destroystokyo.paper.event.entity.ThrownEggHatchEvent((org.bukkit.entity.Egg) getBukkitEntity(), hatching, b0, hatchingType); + com.destroystokyo.paper.event.entity.ThrownEggHatchEvent event = new com.destroystokyo.paper.event.entity.ThrownEggHatchEvent((org.bukkit.entity.Egg) getBukkitEntity(), hatching, b0, hatchingType);
+ event.callEvent(); + event.callEvent();
+ hatching = event.isHatching(); + hatching = event.isHatching();
+ b0 = hatching ? event.getNumHatches() : 0; // If hatching is set to false, ensure child count is 0 + b0 = hatching ? event.getNumHatches() : 0; // If hatching is set to false, ensure child count is 0
+ hatchingType = event.getHatchingType(); + hatchingType = event.getHatchingType();
+ // Paper end + // Paper end - Add ThrownEggHatchEvent
for (int i = 0; i < b0; ++i) { for (int i = 0; i < b0; ++i) {
Entity entitychicken = this.level().getWorld().makeEntity(new org.bukkit.Location(this.level().getWorld(), this.getX(), this.getY(), this.getZ(), this.getYRot(), 0.0F), hatchingType.getEntityClass()); // CraftBukkit Entity entitychicken = this.level().getWorld().makeEntity(new org.bukkit.Location(this.level().getWorld(), this.getX(), this.getY(), this.getZ(), this.getYRot(), 0.0F), hatchingType.getEntityClass()); // CraftBukkit

Datei anzeigen

@ -5,45 +5,45 @@ Subject: [PATCH] Entity Jump API
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index a3eac4dfe28bc55721d292e2f309b3467a3db140..f9e2d3cba01fcf39bc29dc8b5b5879ddc3add0e5 100644 index a3eac4dfe28bc55721d292e2f309b3467a3db140..5f7ed9de581ab52fd8e1c674eeaa550619a05d19 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3283,8 +3283,10 @@ public abstract class LivingEntity extends Entity implements Attackable { @@ -3283,8 +3283,10 @@ public abstract class LivingEntity extends Entity implements Attackable {
} else if (this.isInLava() && (!this.onGround() || d3 > d4)) { } else if (this.isInLava() && (!this.onGround() || d3 > d4)) {
this.jumpInLiquid(FluidTags.LAVA); this.jumpInLiquid(FluidTags.LAVA);
} else if ((this.onGround() || flag && d3 <= d4) && this.noJumpDelay == 0) { } else if ((this.onGround() || flag && d3 <= d4) && this.noJumpDelay == 0) {
+ if (new com.destroystokyo.paper.event.entity.EntityJumpEvent(getBukkitLivingEntity()).callEvent()) { // Paper + if (new com.destroystokyo.paper.event.entity.EntityJumpEvent(getBukkitLivingEntity()).callEvent()) { // Paper - Entity Jump API
this.jumpFromGround(); this.jumpFromGround();
this.noJumpDelay = 10; this.noJumpDelay = 10;
+ } else { this.setJumping(false); } // Paper - setJumping(false) stops a potential loop + } else { this.setJumping(false); } // Paper - Entity Jump API; setJumping(false) stops a potential loop
} }
} else { } else {
this.noJumpDelay = 0; this.noJumpDelay = 0;
diff --git a/src/main/java/net/minecraft/world/entity/animal/Panda.java b/src/main/java/net/minecraft/world/entity/animal/Panda.java diff --git a/src/main/java/net/minecraft/world/entity/animal/Panda.java b/src/main/java/net/minecraft/world/entity/animal/Panda.java
index 3d947293d33407e5d24f8fba738ab872e1d890b6..27e1ed14f2ae4f7922c7c3bc1ac21156bafcb0ba 100644 index 3d947293d33407e5d24f8fba738ab872e1d890b6..48df7de02e0765bfe62ae1b8a4c0029743430221 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Panda.java --- a/src/main/java/net/minecraft/world/entity/animal/Panda.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Panda.java +++ b/src/main/java/net/minecraft/world/entity/animal/Panda.java
@@ -527,7 +527,9 @@ public class Panda extends Animal { @@ -527,7 +527,9 @@ public class Panda extends Animal {
Panda entitypanda = (Panda) iterator.next(); Panda entitypanda = (Panda) iterator.next();
if (!entitypanda.isBaby() && entitypanda.onGround() && !entitypanda.isInWater() && entitypanda.canPerformAction()) { if (!entitypanda.isBaby() && entitypanda.onGround() && !entitypanda.isInWater() && entitypanda.canPerformAction()) {
+ if (new com.destroystokyo.paper.event.entity.EntityJumpEvent(getBukkitLivingEntity()).callEvent()) { // Paper + if (new com.destroystokyo.paper.event.entity.EntityJumpEvent(getBukkitLivingEntity()).callEvent()) { // Paper - Entity Jump API
entitypanda.jumpFromGround(); entitypanda.jumpFromGround();
+ } else { this.setJumping(false); } // Paper - setJumping(false) stops a potential loop + } else { this.setJumping(false); } // Paper - Entity Jump API; setJumping(false) stops a potential loop
} }
} }
diff --git a/src/main/java/net/minecraft/world/entity/monster/Ravager.java b/src/main/java/net/minecraft/world/entity/monster/Ravager.java diff --git a/src/main/java/net/minecraft/world/entity/monster/Ravager.java b/src/main/java/net/minecraft/world/entity/monster/Ravager.java
index 344e933311f5cdccb66069d486b111a003639dfe..add3cd866452df727107e94fb2039bddebe909be 100644 index 344e933311f5cdccb66069d486b111a003639dfe..c45a9b4d9a4894919c5c798ada80629493821c61 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Ravager.java --- a/src/main/java/net/minecraft/world/entity/monster/Ravager.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Ravager.java +++ b/src/main/java/net/minecraft/world/entity/monster/Ravager.java
@@ -167,7 +167,9 @@ public class Ravager extends Raider { @@ -167,7 +167,9 @@ public class Ravager extends Raider {
} }
if (!flag && this.onGround()) { if (!flag && this.onGround()) {
+ if (new com.destroystokyo.paper.event.entity.EntityJumpEvent(getBukkitLivingEntity()).callEvent()) { // Paper + if (new com.destroystokyo.paper.event.entity.EntityJumpEvent(getBukkitLivingEntity()).callEvent()) { // Paper - Entity Jump API
this.jumpFromGround(); this.jumpFromGround();
+ } else { this.setJumping(false); } // Paper - setJumping(false) stops a potential loop + } else { this.setJumping(false); } // Paper - Entity Jump API; setJumping(false) stops a potential loop
} }
} }

Datei anzeigen

@ -5,14 +5,14 @@ Subject: [PATCH] Add option to nerf pigmen from nether portals
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 21eac12dcc3571e647b07b313015d809cb0fbcea..7f08a5a9c853c1f54e1d3b142c52cfa5dfb8c091 100644 index 21eac12dcc3571e647b07b313015d809cb0fbcea..d1a256a0a27ebfd91497840334c94dfe1a40c980 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java --- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -399,6 +399,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S @@ -399,6 +399,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
// Paper start // Paper start
public long activatedImmunityTick = Integer.MIN_VALUE; // Paper public long activatedImmunityTick = Integer.MIN_VALUE; // Paper
public boolean isTemporarilyActive = false; // Paper public boolean isTemporarilyActive = false; // Paper
+ public boolean fromNetherPortal; // Paper + public boolean fromNetherPortal; // Paper - Add option to nerf pigmen from nether portals
protected int numCollisions = 0; // Paper protected int numCollisions = 0; // Paper
public boolean spawnedViaMobSpawner; // Paper - Yes this name is similar to above, upstream took the better one public boolean spawnedViaMobSpawner; // Paper - Yes this name is similar to above, upstream took the better one
@javax.annotation.Nullable @javax.annotation.Nullable
@ -35,15 +35,15 @@ index 21eac12dcc3571e647b07b313015d809cb0fbcea..7f08a5a9c853c1f54e1d3b142c52cfa5
String spawnReasonName = nbt.getString("Paper.SpawnReason"); String spawnReasonName = nbt.getString("Paper.SpawnReason");
try { try {
diff --git a/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java b/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java diff --git a/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java b/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java
index c9ff8a3fd8d65033ce5a476e8ceaf9d1b8e2d887..4e52e92846428b0d01635b90f3480b4a2c13a0b4 100644 index c9ff8a3fd8d65033ce5a476e8ceaf9d1b8e2d887..2a8f97d97ae7f268da920b5e3b9719743fa9a8e0 100644
--- a/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java --- a/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java +++ b/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java
@@ -71,6 +71,8 @@ public class NetherPortalBlock extends Block { @@ -71,6 +71,8 @@ public class NetherPortalBlock extends Block {
if (entity != null) { if (entity != null) {
entity.setPortalCooldown(); entity.setPortalCooldown();
+ entity.fromNetherPortal = true; // Paper + entity.fromNetherPortal = true; // Paper - Add option to nerf pigmen from nether portals
+ if (world.paperConfig().entities.behavior.nerfPigmenFromNetherPortals) ((net.minecraft.world.entity.Mob) entity).aware = false; // Paper + if (world.paperConfig().entities.behavior.nerfPigmenFromNetherPortals) ((net.minecraft.world.entity.Mob) entity).aware = false; // Paper - Add option to nerf pigmen from nether portals
} }
} }
} }

Datei anzeigen

@ -384,7 +384,7 @@ index 0000000000000000000000000000000000000000..c3e54da4ab6440811aab2f9dd1e21880
+ } + }
+} +}
diff --git a/src/main/java/net/minecraft/server/gui/MinecraftServerGui.java b/src/main/java/net/minecraft/server/gui/MinecraftServerGui.java diff --git a/src/main/java/net/minecraft/server/gui/MinecraftServerGui.java b/src/main/java/net/minecraft/server/gui/MinecraftServerGui.java
index d292fdb165436f0b9b46b32110f5e09ad0e517a1..2e93eec8733c5b548a15269a322fe4dd1f189b7d 100644 index d292fdb165436f0b9b46b32110f5e09ad0e517a1..2bbc57b4869caf690f53618d60359c5133ec62a8 100644
--- a/src/main/java/net/minecraft/server/gui/MinecraftServerGui.java --- a/src/main/java/net/minecraft/server/gui/MinecraftServerGui.java
+++ b/src/main/java/net/minecraft/server/gui/MinecraftServerGui.java +++ b/src/main/java/net/minecraft/server/gui/MinecraftServerGui.java
@@ -95,7 +95,7 @@ public class MinecraftServerGui extends JComponent { @@ -95,7 +95,7 @@ public class MinecraftServerGui extends JComponent {
@ -392,7 +392,7 @@ index d292fdb165436f0b9b46b32110f5e09ad0e517a1..2e93eec8733c5b548a15269a322fe4dd
private JComponent buildInfoPanel() { private JComponent buildInfoPanel() {
JPanel jpanel = new JPanel(new BorderLayout()); JPanel jpanel = new JPanel(new BorderLayout());
- StatsComponent guistatscomponent = new StatsComponent(this.server); - StatsComponent guistatscomponent = new StatsComponent(this.server);
+ com.destroystokyo.paper.gui.GuiStatsComponent guistatscomponent = new com.destroystokyo.paper.gui.GuiStatsComponent(this.server); // Paper + com.destroystokyo.paper.gui.GuiStatsComponent guistatscomponent = new com.destroystokyo.paper.gui.GuiStatsComponent(this.server); // Paper - Make GUI graph fancier
Collection<Runnable> collection = this.finalizers; // CraftBukkit - decompile error Collection<Runnable> collection = this.finalizers; // CraftBukkit - decompile error
Objects.requireNonNull(guistatscomponent); Objects.requireNonNull(guistatscomponent);

Datei anzeigen

@ -5,14 +5,14 @@ Subject: [PATCH] Validate tripwire hook placement before update
diff --git a/src/main/java/net/minecraft/world/level/block/TripWireHookBlock.java b/src/main/java/net/minecraft/world/level/block/TripWireHookBlock.java diff --git a/src/main/java/net/minecraft/world/level/block/TripWireHookBlock.java b/src/main/java/net/minecraft/world/level/block/TripWireHookBlock.java
index eed36b6736a4f971022fdbce989da03f42794bb5..02b62ac13d4968f80cb0ae3702755d0f1d95e692 100644 index eed36b6736a4f971022fdbce989da03f42794bb5..d9b3877257b31ca1b5acc4a47fbf5b993de69ae0 100644
--- a/src/main/java/net/minecraft/world/level/block/TripWireHookBlock.java --- a/src/main/java/net/minecraft/world/level/block/TripWireHookBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/TripWireHookBlock.java +++ b/src/main/java/net/minecraft/world/level/block/TripWireHookBlock.java
@@ -188,6 +188,7 @@ public class TripWireHookBlock extends Block { @@ -188,6 +188,7 @@ public class TripWireHookBlock extends Block {
TripWireHookBlock.emitState(world, pos, flag4, flag5, flag2, flag3); TripWireHookBlock.emitState(world, pos, flag4, flag5, flag2, flag3);
if (!flag) { if (!flag) {
+ if (world.getBlockState(pos).getBlock() == Blocks.TRIPWIRE_HOOK) // Paper - validate + if (world.getBlockState(pos).getBlock() == Blocks.TRIPWIRE_HOOK) // Paper - Validate tripwire hook placement before update
world.setBlock(pos, (BlockState) iblockdata3.setValue(TripWireHookBlock.FACING, enumdirection), 3); world.setBlock(pos, (BlockState) iblockdata3.setValue(TripWireHookBlock.FACING, enumdirection), 3);
if (flag1) { if (flag1) {
TripWireHookBlock.notifyNeighbors(block, world, pos, enumdirection); TripWireHookBlock.notifyNeighbors(block, world, pos, enumdirection);

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Add option to allow iron golems to spawn in air
diff --git a/src/main/java/net/minecraft/world/entity/animal/IronGolem.java b/src/main/java/net/minecraft/world/entity/animal/IronGolem.java diff --git a/src/main/java/net/minecraft/world/entity/animal/IronGolem.java b/src/main/java/net/minecraft/world/entity/animal/IronGolem.java
index ce83fe0b68fcb229dd37fe07e5f21b52a60c32de..f383928fc5b331ddf128bdcb6a23010d8fe088d3 100644 index ce83fe0b68fcb229dd37fe07e5f21b52a60c32de..6cfe0d6c46caa122db107c607d27a2bdcd82f7a8 100644
--- a/src/main/java/net/minecraft/world/entity/animal/IronGolem.java --- a/src/main/java/net/minecraft/world/entity/animal/IronGolem.java
+++ b/src/main/java/net/minecraft/world/entity/animal/IronGolem.java +++ b/src/main/java/net/minecraft/world/entity/animal/IronGolem.java
@@ -325,7 +325,7 @@ public class IronGolem extends AbstractGolem implements NeutralMob { @@ -325,7 +325,7 @@ public class IronGolem extends AbstractGolem implements NeutralMob {
@ -13,7 +13,7 @@ index ce83fe0b68fcb229dd37fe07e5f21b52a60c32de..f383928fc5b331ddf128bdcb6a23010d
BlockState iblockdata = world.getBlockState(blockposition1); BlockState iblockdata = world.getBlockState(blockposition1);
- if (!iblockdata.entityCanStandOn(world, blockposition1, this)) { - if (!iblockdata.entityCanStandOn(world, blockposition1, this)) {
+ if (!iblockdata.entityCanStandOn(world, blockposition1, this) && !this.level().paperConfig().entities.spawning.ironGolemsCanSpawnInAir) { // Paper + if (!iblockdata.entityCanStandOn(world, blockposition1, this) && !this.level().paperConfig().entities.spawning.ironGolemsCanSpawnInAir) { // Paper - Add option to allow iron golems to spawn in air
return false; return false;
} else { } else {
for (int i = 1; i < 3; ++i) { for (int i = 1; i < 3; ++i) {

Datei anzeigen

@ -8,7 +8,7 @@ This allows you to solve an issue in vanilla behavior where:
* On normal difficulty they will have a 50% of getting infected or dying. * On normal difficulty they will have a 50% of getting infected or dying.
diff --git a/src/main/java/net/minecraft/world/entity/monster/Zombie.java b/src/main/java/net/minecraft/world/entity/monster/Zombie.java diff --git a/src/main/java/net/minecraft/world/entity/monster/Zombie.java b/src/main/java/net/minecraft/world/entity/monster/Zombie.java
index d4f72024c15d03f70a86f09714403ace6e26885a..79634693899f50e34ffe0898f75e5b31fd11ab53 100644 index d4f72024c15d03f70a86f09714403ace6e26885a..a073637adbb7bb8fc49cf97da6c0b6e9792d8e16 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Zombie.java --- a/src/main/java/net/minecraft/world/entity/monster/Zombie.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Zombie.java +++ b/src/main/java/net/minecraft/world/entity/monster/Zombie.java
@@ -452,12 +452,8 @@ public class Zombie extends Monster { @@ -452,12 +452,8 @@ public class Zombie extends Monster {
@ -21,8 +21,8 @@ index d4f72024c15d03f70a86f09714403ace6e26885a..79634693899f50e34ffe0898f75e5b31
- if (world.getDifficulty() != Difficulty.HARD && this.random.nextBoolean()) { - if (world.getDifficulty() != Difficulty.HARD && this.random.nextBoolean()) {
- return flag; - return flag;
- } - }
+ final double fallbackChance = world.getDifficulty() == Difficulty.HARD ? 100d : world.getDifficulty() == Difficulty.NORMAL ? 50d : 0d; // Paper + final double fallbackChance = world.getDifficulty() == Difficulty.HARD ? 100d : world.getDifficulty() == Difficulty.NORMAL ? 50d : 0d; // Paper - Configurable chance of villager zombie infection
+ if (this.random.nextDouble() * 100 < world.paperConfig().entities.behavior.zombieVillagerInfectionChance.or(fallbackChance) && other instanceof Villager entityvillager) { // Paper + if (this.random.nextDouble() * 100 < world.paperConfig().entities.behavior.zombieVillagerInfectionChance.or(fallbackChance) && other instanceof Villager entityvillager) { // Paper - Configurable chance of villager zombie infection
// CraftBukkit start // CraftBukkit start
flag = Zombie.zombifyVillager(world, entityvillager, this.blockPosition(), this.isSilent(), CreatureSpawnEvent.SpawnReason.INFECTION) == null; flag = Zombie.zombifyVillager(world, entityvillager, this.blockPosition(), this.isSilent(), CreatureSpawnEvent.SpawnReason.INFECTION) == null;
} }

Datei anzeigen

@ -8,7 +8,7 @@ faster on its own, however removing the try catch makes it
easier to inline due to code size easier to inline due to code size
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java 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 e599bfb9a7b0b85bea2940f6bf55118305dd0ce8..3acef646275aa05100e13e149bc5ff6d1ccbbea8 100644 index e599bfb9a7b0b85bea2940f6bf55118305dd0ce8..796aa86e12cf9062b3467a3678c895af5ad626fe 100644
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
@@ -377,18 +377,20 @@ public class LevelChunk extends ChunkAccess { @@ -377,18 +377,20 @@ public class LevelChunk extends ChunkAccess {
@ -20,8 +20,8 @@ index e599bfb9a7b0b85bea2940f6bf55118305dd0ce8..3acef646275aa05100e13e149bc5ff6d
- -
- if (l >= 0 && l < this.sections.length) { - if (l >= 0 && l < this.sections.length) {
- LevelChunkSection chunksection = this.sections[l]; - LevelChunkSection chunksection = this.sections[l];
+ // try { // Paper - remove try catch + // Paper start - Perf: Optimise Chunk#getFluid
+ // Paper start - reduce the number of ops in this call + // try { // Remove try catch
+ int index = this.getSectionIndex(y); + int index = this.getSectionIndex(y);
+ if (index >= 0 && index < this.sections.length) { + if (index >= 0 && index < this.sections.length) {
+ LevelChunkSection chunksection = this.sections[index]; + LevelChunkSection chunksection = this.sections[index];
@ -29,12 +29,12 @@ index e599bfb9a7b0b85bea2940f6bf55118305dd0ce8..3acef646275aa05100e13e149bc5ff6d
if (!chunksection.hasOnlyAir()) { if (!chunksection.hasOnlyAir()) {
- return chunksection.getFluidState(x & 15, y & 15, z & 15); - return chunksection.getFluidState(x & 15, y & 15, z & 15);
+ return chunksection.states.get((y & 15) << 8 | (z & 15) << 4 | x & 15).getFluidState(); + return chunksection.states.get((y & 15) << 8 | (z & 15) << 4 | x & 15).getFluidState();
+ // Paper end + // Paper end - Perf: Optimise Chunk#getFluid
} }
} }
return Fluids.EMPTY.defaultFluidState(); return Fluids.EMPTY.defaultFluidState();
+ /* // Paper - remove try catch + /* // Paper - Perf: Optimise Chunk#getFluid
} catch (Throwable throwable) { } catch (Throwable throwable) {
CrashReport crashreport = CrashReport.forThrowable(throwable, "Getting fluid state"); CrashReport crashreport = CrashReport.forThrowable(throwable, "Getting fluid state");
CrashReportCategory crashreportsystemdetails = crashreport.addCategory("Block being got"); CrashReportCategory crashreportsystemdetails = crashreport.addCategory("Block being got");
@ -42,12 +42,12 @@ index e599bfb9a7b0b85bea2940f6bf55118305dd0ce8..3acef646275aa05100e13e149bc5ff6d
}); });
throw new ReportedException(crashreport); throw new ReportedException(crashreport);
} }
+ */ // Paper - remove try catch + */ // Paper - Perf: Optimise Chunk#getFluid
} }
// CraftBukkit start // CraftBukkit start
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java
index 4eeb719b40ff1c18a7cdda7ecc6b135dbedd626e..b8fee4f8a0cfe32b9ef7f3f3cf818cbaec0d3fca 100644 index 4eeb719b40ff1c18a7cdda7ecc6b135dbedd626e..3efd0a462306fbd02a506a3f952d609645b1f874 100644
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java
@@ -46,7 +46,7 @@ public class LevelChunkSection { @@ -46,7 +46,7 @@ public class LevelChunkSection {
@ -55,7 +55,7 @@ index 4eeb719b40ff1c18a7cdda7ecc6b135dbedd626e..b8fee4f8a0cfe32b9ef7f3f3cf818cba
public FluidState getFluidState(int x, int y, int z) { public FluidState getFluidState(int x, int y, int z) {
- return ((BlockState) this.states.get(x, y, z)).getFluidState(); - return ((BlockState) this.states.get(x, y, z)).getFluidState();
+ return this.states.get(x, y, z).getFluidState(); // Paper - diff on change - we expect this to be effectively just getType(x, y, z).getFluid(). If this changes we need to check other patches that use IBlockData#getFluid. + return this.states.get(x, y, z).getFluidState(); // Paper - Perf: Optimise Chunk#getFluid; diff on change - we expect this to be effectively just getType(x, y, z).getFluid(). If this changes we need to check other patches that use IBlockData#getFluid.
} }
public void acquire() { public void acquire() {

Datei anzeigen

@ -10,7 +10,7 @@ When not per player it will use the Vanilla mechanic of one delay per
world and the world age for the start day. world and the world age for the start day.
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 26410f43c7bbb368d9ef7206d3b9759f86afba4b..e6d9b3ddfaf60fce5e6232bd39c5b6307fa6aa7c 100644 index fff540886166a60b967cf14e93776e36dcbe1308..070dddc5597cf623e2a29e731739383fd98b94d1 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -249,6 +249,7 @@ public class ServerPlayer extends Player { @@ -249,6 +249,7 @@ public class ServerPlayer extends Player {
@ -22,15 +22,15 @@ index 26410f43c7bbb368d9ef7206d3b9759f86afba4b..e6d9b3ddfaf60fce5e6232bd39c5b630
public boolean queueHealthUpdatePacket = false; public boolean queueHealthUpdatePacket = false;
public net.minecraft.network.protocol.game.ClientboundSetHealthPacket queuedHealthUpdatePacket; public net.minecraft.network.protocol.game.ClientboundSetHealthPacket queuedHealthUpdatePacket;
diff --git a/src/main/java/net/minecraft/world/level/levelgen/PatrolSpawner.java b/src/main/java/net/minecraft/world/level/levelgen/PatrolSpawner.java diff --git a/src/main/java/net/minecraft/world/level/levelgen/PatrolSpawner.java b/src/main/java/net/minecraft/world/level/levelgen/PatrolSpawner.java
index e5918fa3be107ac3a2fc8831fd78733a7506730a..60a301b4a21be91bb3c2b84728467a693017e28f 100644 index c7aea059de151cf8ae6e660785e176586bc23ff3..1c4dafdfb3898b5efe06d66792b1b0841ec5724d 100644
--- a/src/main/java/net/minecraft/world/level/levelgen/PatrolSpawner.java --- a/src/main/java/net/minecraft/world/level/levelgen/PatrolSpawner.java
+++ b/src/main/java/net/minecraft/world/level/levelgen/PatrolSpawner.java +++ b/src/main/java/net/minecraft/world/level/levelgen/PatrolSpawner.java
@@ -25,7 +25,7 @@ public class PatrolSpawner implements CustomSpawner { @@ -25,7 +25,7 @@ public class PatrolSpawner implements CustomSpawner {
@Override @Override
public int tick(ServerLevel world, boolean spawnMonsters, boolean spawnAnimals) { public int tick(ServerLevel world, boolean spawnMonsters, boolean spawnAnimals) {
- if (world.paperConfig().entities.behavior.pillagerPatrols.disable) return 0; // Paper - if (world.paperConfig().entities.behavior.pillagerPatrols.disable) return 0; // Paper - Add option to disable pillager patrols
+ if (world.paperConfig().entities.behavior.pillagerPatrols.disable || world.paperConfig().entities.behavior.pillagerPatrols.spawnChance == 0) return 0; // Paper - Pillager patrol spawn settings and per player options + if (world.paperConfig().entities.behavior.pillagerPatrols.disable || world.paperConfig().entities.behavior.pillagerPatrols.spawnChance == 0) return 0; // Paper - Add option to disable pillager patrols & Pillager patrol spawn settings and per player options
if (!spawnMonsters) { if (!spawnMonsters) {
return 0; return 0;
} else if (!world.getGameRules().getBoolean(GameRules.RULE_DO_PATROL_SPAWNING)) { } else if (!world.getGameRules().getBoolean(GameRules.RULE_DO_PATROL_SPAWNING)) {

Datei anzeigen

@ -16,7 +16,7 @@ So even if something NEW comes up, it would be impossible to drop the
same item twice because the source was destroyed. same item twice because the source was destroyed.
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index b2dc3729a8312179d219bd93a755729c86f4dece..d13759736cf802cae56e68c11f09f15e1e08d09c 100644 index 85371495d4f11e339a0211145c0303976515ef8f..14be6f3a591fded3ff8690241061a7a07d2a89a6 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java --- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -2467,11 +2467,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S @@ -2467,11 +2467,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@ -70,7 +70,7 @@ index b2dc3729a8312179d219bd93a755729c86f4dece..d13759736cf802cae56e68c11f09f15e
// CraftBukkit end // CraftBukkit end
} }
@@ -3438,7 +3446,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S @@ -3436,7 +3444,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
} }
public boolean canChangeDimensions() { public boolean canChangeDimensions() {
@ -80,7 +80,7 @@ index b2dc3729a8312179d219bd93a755729c86f4dece..d13759736cf802cae56e68c11f09f15e
public float getBlockExplosionResistance(Explosion explosion, BlockGetter world, BlockPos pos, BlockState blockState, FluidState fluidState, float max) { public float getBlockExplosionResistance(Explosion explosion, BlockGetter world, BlockPos pos, BlockState blockState, FluidState fluidState, float max) {
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index d3bb5a6ee350043e7f5c173b9496c1d71b3957b1..0af0b62a4bd9b3c027a5a608b81831864d54fd11 100644 index da68b02c6c66a205254d755e4ab5f379cbe9a666..28ea07dc7796f7fc12d5f11aed22eb35ee60c9b5 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -1705,9 +1705,9 @@ public abstract class LivingEntity extends Entity implements Attackable { @@ -1705,9 +1705,9 @@ public abstract class LivingEntity extends Entity implements Attackable {

Datei anzeigen

@ -13,7 +13,7 @@ A config is provided if you rather let players use these exploits, and let
them destroy the worlds End Portals and get on top of the nether easy. them destroy the worlds End Portals and get on top of the nether easy.
diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java
index 120151da61398ea8afcd658a8407efcf738b9476..e720be2185b63f2cf3df9270191bac1ba50af2d5 100644 index b1fdfae75aeea78ca77987e40242bf498447bc08..cf81854facadaf3c1f860bcaaf69db463a31b0c9 100644
--- a/src/main/java/net/minecraft/world/level/Explosion.java --- a/src/main/java/net/minecraft/world/level/Explosion.java
+++ b/src/main/java/net/minecraft/world/level/Explosion.java +++ b/src/main/java/net/minecraft/world/level/Explosion.java
@@ -191,6 +191,7 @@ public class Explosion { @@ -191,6 +191,7 @@ public class Explosion {
@ -21,7 +21,7 @@ index 120151da61398ea8afcd658a8407efcf738b9476..e720be2185b63f2cf3df9270191bac1b
BlockPos blockposition = BlockPos.containing(d4, d5, d6); BlockPos blockposition = BlockPos.containing(d4, d5, d6);
BlockState iblockdata = this.level.getBlockState(blockposition); BlockState iblockdata = this.level.getBlockState(blockposition);
+ if (!iblockdata.isDestroyable()) continue; // Paper - Protect Bedrock and End Portal/Frames from being destroyed + if (!iblockdata.isDestroyable()) continue; // Paper - Protect Bedrock and End Portal/Frames from being destroyed
FluidState fluid = iblockdata.getFluidState(); // Paper FluidState fluid = iblockdata.getFluidState(); // Paper - Perf: Optimize call to getFluid for explosions
if (!this.level.isInWorldBounds(blockposition)) { if (!this.level.isInWorldBounds(blockposition)) {
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java

Datei anzeigen

@ -6,7 +6,7 @@ Subject: [PATCH] Ensure Entity position and AABB are never invalid
Co-authored-by: Spottedleaf <Spottedleaf@users.noreply.github.com> Co-authored-by: Spottedleaf <Spottedleaf@users.noreply.github.com>
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index a1d990aa2e79af9e1ff078892cdb38a382f21da7..e1ce61dcadf325633ed809eef92fc07bac4cbf05 100644 index 2b3b6b7cda65434c903582a99e42e71762daccf8..44ff63b89056eb2f944ead71d74d17d1fd5351b2 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java --- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -728,8 +728,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S @@ -728,8 +728,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@ -20,7 +20,7 @@ index a1d990aa2e79af9e1ff078892cdb38a382f21da7..e1ce61dcadf325633ed809eef92fc07b
} }
protected AABB makeBoundingBox() { protected AABB makeBoundingBox() {
@@ -4243,7 +4243,29 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S @@ -4241,7 +4241,29 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
return this.getZ((2.0D * this.random.nextDouble() - 1.0D) * widthScale); return this.getZ((2.0D * this.random.nextDouble() - 1.0D) * widthScale);
} }
@ -50,7 +50,7 @@ index a1d990aa2e79af9e1ff078892cdb38a382f21da7..e1ce61dcadf325633ed809eef92fc07b
// Paper start - rewrite chunk system // Paper start - rewrite chunk system
if (this.updatingSectionStatus) { if (this.updatingSectionStatus) {
LOGGER.error("Refusing to update position for entity " + this + " to position " + new Vec3(x, y, z) + " since it is processing a section status update", new Throwable()); LOGGER.error("Refusing to update position for entity " + this + " to position " + new Vec3(x, y, z) + " since it is processing a section status update", new Throwable());
@@ -4267,6 +4289,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S @@ -4265,6 +4287,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
this.levelCallback.onMove(); this.levelCallback.onMove();
} }

Datei anzeigen

@ -8,11 +8,11 @@ makes it so that the server keeps the last difficulty used instead
of restoring the server.properties every single load. of restoring the server.properties every single load.
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 739e6cf058f2d85c874d1c4f114963035b8c645f..6ffb81f09e7422adeb29f0651a9d3b6e7f6860d3 100644 index 72dd2986c366a7840116b2426c4e2e6b807d0cfa..77f6b636c8e9935e51d54a47c0ac7a171aab2e60 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -828,7 +828,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -828,7 +828,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
if (worldserver.getWorld().getKeepSpawnInMemory()) worldloadlistener.stop(); // Paper if (worldserver.getWorld().getKeepSpawnInMemory()) worldloadlistener.stop(); // Paper - Configurable Keep Spawn Loaded range per world
// CraftBukkit start // CraftBukkit start
// this.updateMobSpawningFlags(); // this.updateMobSpawningFlags();
- worldserver.setSpawnSettings(this.isSpawningMonsters(), this.isSpawningAnimals()); - worldserver.setSpawnSettings(this.isSpawningMonsters(), this.isSpawningAnimals());
@ -76,7 +76,7 @@ index 684e9e9d78f0d410176fa8b9c9d0fbfda6a156dc..6c009f7443eabce73ace587a9fc686c3
@Override @Override
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 71068a285ff039b609f4551d522481f2dff8235e..da445644b1f2de9f80e8198a8ed150103627187b 100644 index b48a663d73ded1633f85819b3c754cf6b60064e3..65b3a2c9acd0d2f1b990d9059ed319bc50d899b9 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -1209,7 +1209,7 @@ public class ServerPlayer extends Player { @@ -1209,7 +1209,7 @@ public class ServerPlayer extends Player {
@ -89,7 +89,7 @@ index 71068a285ff039b609f4551d522481f2dff8235e..da445644b1f2de9f80e8198a8ed15010
playerlist.sendPlayerPermissionLevel(this); playerlist.sendPlayerPermissionLevel(this);
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index ea0628515793f9a4aad5d41def90eb3034a81680..de8c48f6d3ab7eb15e934b323986ea1120ac585a 100644 index 1f8818dd98b8d9b5eb278b5a0f3ea36971c641fa..c8a56234a4f2e0c045e7ba6cec9eb8127f03255f 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -3176,7 +3176,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -3176,7 +3176,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@ -102,7 +102,7 @@ index ea0628515793f9a4aad5d41def90eb3034a81680..de8c48f6d3ab7eb15e934b323986ea11
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 33894e96a54039d5b406c552d8a5db6e17037151..4bb4df79dbe65fd5a6f53df64890eaa582724972 100644 index c2cafdacde4edef8674b96fd8614a47b6af4b64b..71da3ebf372b63119fadbe2412aa02dce61086b4 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -955,8 +955,8 @@ public final class CraftServer implements Server { @@ -955,8 +955,8 @@ public final class CraftServer implements Server {
@ -117,7 +117,7 @@ index 33894e96a54039d5b406c552d8a5db6e17037151..4bb4df79dbe65fd5a6f53df64890eaa5
for (SpawnCategory spawnCategory : SpawnCategory.values()) { for (SpawnCategory spawnCategory : SpawnCategory.values()) {
if (CraftSpawnCategory.isValidForLimits(spawnCategory)) { if (CraftSpawnCategory.isValidForLimits(spawnCategory)) {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 357b82e110b789b7a12735a844a9c7e720b4f479..664389b1f37acee12cdd4bdd6fc0b9d3e6f568fb 100644 index 729c3c273e2393674f30af1cfb0ab0dcf0fb3e20..c74d14e6a78b103fe2bffa8d69b5e7e20215781c 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -1158,7 +1158,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -1158,7 +1158,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {

Datei anzeigen

@ -22,7 +22,7 @@ wants it to collect even faster, they can restore that setting back to 1 instead
Not adding it to .getType() though to keep behavior consistent with vanilla for performance reasons. Not adding it to .getType() though to keep behavior consistent with vanilla for performance reasons.
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 4bb4df79dbe65fd5a6f53df64890eaa582724972..776b3d4d165303715e70c44689bb556541cb7582 100644 index 71da3ebf372b63119fadbe2412aa02dce61086b4..a25cc6f7d91100b98996d9f07fff3c62018ddf86 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -377,7 +377,7 @@ public final class CraftServer implements Server { @@ -377,7 +377,7 @@ public final class CraftServer implements Server {
@ -44,7 +44,7 @@ index 4bb4df79dbe65fd5a6f53df64890eaa582724972..776b3d4d165303715e70c44689bb5565
this.printSaveWarning = false; this.printSaveWarning = false;
this.console.autosavePeriod = this.configuration.getInt("ticks-per.autosave"); this.console.autosavePeriod = this.configuration.getInt("ticks-per.autosave");
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index cb053e6c8f3cc1346a679354696e0fa0b6d3a150..36d7c41505d41443e6034dfc88ce177fe47d980f 100644 index c74d14e6a78b103fe2bffa8d69b5e7e20215781c..95f3b5d9293077e2933b0a0a91bfeb43b6efc6fe 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -282,7 +282,13 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -282,7 +282,13 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@ -115,7 +115,7 @@ index cb053e6c8f3cc1346a679354696e0fa0b6d3a150..36d7c41505d41443e6034dfc88ce177f
+ world.getChunkSource().addRegionTicket(TicketType.PLUGIN, chunkPos, 0, Unit.INSTANCE); // Paper + world.getChunkSource().addRegionTicket(TicketType.PLUGIN, chunkPos, 0, Unit.INSTANCE); // Paper
world.getChunkSource().getChunk(x, z, ChunkStatus.FULL, true); world.getChunkSource().getChunk(x, z, ChunkStatus.FULL, true);
return true; return true;
// Paper end // Paper end - Optimize this method
@@ -2260,6 +2275,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -2260,6 +2275,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
io.papermc.paper.chunk.system.ChunkSystem.scheduleChunkLoad(this.getHandle(), x, z, gen, ChunkStatus.FULL, true, priority, (c) -> { io.papermc.paper.chunk.system.ChunkSystem.scheduleChunkLoad(this.getHandle(), x, z, gen, ChunkStatus.FULL, true, priority, (c) -> {
net.minecraft.server.MinecraftServer.getServer().scheduleOnMain(() -> { net.minecraft.server.MinecraftServer.getServer().scheduleOnMain(() -> {

Datei anzeigen

@ -5,12 +5,12 @@ 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 diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 8a7dd236435b08e0857041641eec9edcef936503..3be046b4062e9eb9e642c17ba43b4d446e6ba9d7 100644 index 135dc03be7e81306dacaf7d10359ea10529d8303..4b7c3b71a15a3e223ea1e8366be31130bc5e5504 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -2034,9 +2034,11 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -2034,9 +2034,11 @@ public class ServerLevel extends Level implements WorldGenLevel {
public void setDefaultSpawnPos(BlockPos pos, float angle) { public void setDefaultSpawnPos(BlockPos pos, float angle) {
// Paper - configurable spawn radius // Paper start - Configurable Keep Spawn Loaded range per world
BlockPos prevSpawn = this.getSharedSpawnPos(); BlockPos prevSpawn = this.getSharedSpawnPos();
+ Location prevSpawnLoc = this.getWorld().getSpawnLocation(); // Paper - Call SpawnChangeEvent + Location prevSpawnLoc = this.getWorld().getSpawnLocation(); // Paper - Call SpawnChangeEvent
//ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(new BlockPosition(this.worldData.a(), 0, this.worldData.c())); //ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(new BlockPosition(this.worldData.a(), 0, this.worldData.c()));
@ -21,7 +21,7 @@ index 8a7dd236435b08e0857041641eec9edcef936503..3be046b4062e9eb9e642c17ba43b4d44
// if this keepSpawnInMemory is false a plugin has already removed our tickets, do not re-add // if this keepSpawnInMemory is false a plugin has already removed our tickets, do not re-add
this.removeTicketsForSpawn(this.paperConfig().spawn.keepSpawnLoadedRange * 16, prevSpawn); this.removeTicketsForSpawn(this.paperConfig().spawn.keepSpawnLoadedRange * 16, prevSpawn);
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 36d7c41505d41443e6034dfc88ce177fe47d980f..4fe507969849f8abd12aadb6943a8a2fce27b5b5 100644 index 95f3b5d9293077e2933b0a0a91bfeb43b6efc6fe..d6d49854eede2b9005725969c6c062168c4b2fce 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -262,12 +262,14 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -262,12 +262,14 @@ public class CraftWorld extends CraftRegionAccessor implements World {

Datei anzeigen

@ -9,7 +9,7 @@ the game, immediately stop the server to prevent data corruption.
You can override this functionality at your own peril. You can override this functionality at your own peril.
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java
index 02beedb84a8bec001270116c6ce496db012e6b8a..08abe8064f01b20aae0c7a018e11fe2ef42de71b 100644 index 0341d9e951366b77e7eeac7cdaa950af62c88aab..0ef8ecc7932107029d85e961e2e747d7312d816e 100644
--- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java --- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java
@@ -124,8 +124,20 @@ public class ChunkSerializer { @@ -124,8 +124,20 @@ public class ChunkSerializer {
@ -31,5 +31,5 @@ index 02beedb84a8bec001270116c6ce496db012e6b8a..08abe8064f01b20aae0c7a018e11fe2e
+ } + }
+ } + }
// Paper end // Paper end
ChunkPos chunkcoordintpair1 = new ChunkPos(nbt.getInt("xPos"), nbt.getInt("zPos")); // Paper - diff on change, see ChunkSerializer#getChunkCoordinate ChunkPos chunkcoordintpair1 = new ChunkPos(nbt.getInt("xPos"), nbt.getInt("zPos")); // Paper - guard against serializing mismatching coordinates; diff on change, see ChunkSerializer#getChunkCoordinate

Datei anzeigen

@ -6,10 +6,10 @@ Subject: [PATCH] Expose the Entity Counter to allow plugins to use valid and
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 8a613a8a874b8b3949630fcadc25cf39b7fb0659..9b723b5c429fcb356cc056dc56e1c7be1d20a728 100644 index 961cd2886ca2fdafdeb958ee714e3d436bd7f330..b56ee5c771d1316e05eba29a8e9d3e9d4468b83c 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java --- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -4510,4 +4510,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S @@ -4508,4 +4508,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
void accept(Entity entity, double x, double y, double z); void accept(Entity entity, double x, double y, double z);
} }

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Entity#isTicking
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 9b723b5c429fcb356cc056dc56e1c7be1d20a728..bf7d307c26c52035f3799ca80dccc8e8798d8f89 100644 index b56ee5c771d1316e05eba29a8e9d3e9d4468b83c..f8acf77f5157cdee4e40d03b571a830aa726ba70 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java --- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -4515,5 +4515,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S @@ -4513,5 +4513,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
public static int nextEntityId() { public static int nextEntityId() {
return ENTITY_COUNTER.incrementAndGet(); return ENTITY_COUNTER.incrementAndGet();
} }

Datei anzeigen

@ -28,10 +28,10 @@ index 05ac41e136da43284fb24a6b698ebd36318278fb..3c4ac79c094dc2fff7de94150a34b7bf
public Vec3 decode(long x, long y, long z) { public Vec3 decode(long x, long y, long z) {
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 180f87a67c84fc0cf3f54755da9801365d4158f8..9085eeffaa7b50e5e59a794d0323cae83248f242 100644 index dc957fce9f6b5709d6f74fa66a99235d8933d8cc..17152781725a6cf0e1ce5da8374fb3a74cb84351 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java --- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -4286,6 +4286,16 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S @@ -4284,6 +4284,16 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
return; return;
} }
// Paper end - rewrite chunk system // Paper end - rewrite chunk system

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Optimize indirect passenger iteration
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 72f50fe74695e32167d414c1c9ee38deb95afb79..8b84de55028a9c4d65fe5ae99b808f0d84ce6799 100644 index e6142fc4ac6fe6149f6094124223cdebd56e7b76..2b34c7bc49fff37b6e0a603b6670103fe959fe2a 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java --- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -3926,20 +3926,34 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S @@ -3924,20 +3924,34 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
} }
private Stream<Entity> getIndirectPassengersStream() { private Stream<Entity> getIndirectPassengersStream() {
@ -43,7 +43,7 @@ index 72f50fe74695e32167d414c1c9ee38deb95afb79..8b84de55028a9c4d65fe5ae99b808f0d
return () -> { return () -> {
return this.getIndirectPassengersStream().iterator(); return this.getIndirectPassengersStream().iterator();
}; };
@@ -3962,6 +3976,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S @@ -3960,6 +3974,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
// Paper end - rewrite chunk system // Paper end - rewrite chunk system
public boolean hasExactlyOnePlayerPassenger() { public boolean hasExactlyOnePlayerPassenger() {

Datei anzeigen

@ -257,7 +257,7 @@ index 0000000000000000000000000000000000000000..d3b39d88a72ca25057fd8574d32f28db
+ } + }
+} +}
diff --git a/src/main/java/net/minecraft/world/level/NaturalSpawner.java b/src/main/java/net/minecraft/world/level/NaturalSpawner.java diff --git a/src/main/java/net/minecraft/world/level/NaturalSpawner.java b/src/main/java/net/minecraft/world/level/NaturalSpawner.java
index 9df761f5cf043e8d2dffa711c20ab32fe2992331..48cc5623973713e07d95639e5359fc15e59785cc 100644 index 4aa2a174400fe879501571c175d5ac4d09ac7de3..6fbd136f4bbfa34ef88a7743c63a542ed0cc2c02 100644
--- a/src/main/java/net/minecraft/world/level/NaturalSpawner.java --- a/src/main/java/net/minecraft/world/level/NaturalSpawner.java
+++ b/src/main/java/net/minecraft/world/level/NaturalSpawner.java +++ b/src/main/java/net/minecraft/world/level/NaturalSpawner.java
@@ -190,6 +190,16 @@ public final class NaturalSpawner { @@ -190,6 +190,16 @@ public final class NaturalSpawner {
@ -275,10 +275,10 @@ index 9df761f5cf043e8d2dffa711c20ab32fe2992331..48cc5623973713e07d95639e5359fc15
+ // Paper end - Add mobcaps commands + // Paper end - Add mobcaps commands
+ +
public static void spawnCategoryForChunk(MobCategory group, ServerLevel world, LevelChunk chunk, NaturalSpawner.SpawnPredicate checker, NaturalSpawner.AfterSpawnCallback runner) { public static void spawnCategoryForChunk(MobCategory group, ServerLevel world, LevelChunk chunk, NaturalSpawner.SpawnPredicate checker, NaturalSpawner.AfterSpawnCallback runner) {
// Paper start - add parameters and int ret type // Paper start - Optional per player mob spawns
spawnCategoryForChunk(group, world, chunk, checker, runner, Integer.MAX_VALUE, null); spawnCategoryForChunk(group, world, chunk, checker, runner, Integer.MAX_VALUE, null);
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index f4b1d6ed1e1065e6be175b7b68e29517ebfa2da8..9491eb5b47defd7949fe2e691d63d3767be1f337 100644 index 775e40dc356406cf289807abb83cda5ca186563f..b603541d56c7cee7aff8d3448d18c76cd72b63cb 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -2279,6 +2279,11 @@ public final class CraftServer implements Server { @@ -2279,6 +2279,11 @@ public final class CraftServer implements Server {
@ -294,7 +294,7 @@ index f4b1d6ed1e1065e6be175b7b68e29517ebfa2da8..9491eb5b47defd7949fe2e691d63d376
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 305a525815d7a3ea3f5dd3c093a76af0252c2f7e..b49580716ff1dc85adcd466d1df9ce678a58546f 100644 index 189c0ab39f56e7a6d92aa6ee24f29a232b446cdf..3dc6f7f376f845ec36663d147a2e08ecc077700a 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -1761,9 +1761,14 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -1761,9 +1761,14 @@ public class CraftWorld extends CraftRegionAccessor implements World {

Datei anzeigen

@ -10,7 +10,7 @@ hoping that at least then we don't swap chunks, and maybe recover
them all. them all.
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java
index a95909bc818f395ce5772c5129f9cc9b789ce133..72cfe25cbc2076bc83c9f965ab70b0e636800212 100644 index 0ef8ecc7932107029d85e961e2e747d7312d816e..c09d42c03e1e430dd65218e8297be9e35cdef030 100644
--- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java --- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java
@@ -70,6 +70,18 @@ import net.minecraft.world.ticks.ProtoChunkTicks; @@ -70,6 +70,18 @@ import net.minecraft.world.ticks.ProtoChunkTicks;
@ -42,7 +42,7 @@ index a95909bc818f395ce5772c5129f9cc9b789ce133..72cfe25cbc2076bc83c9f965ab70b0e6
nbttagcompound.putString("Status", BuiltInRegistries.CHUNK_STATUS.getKey(chunk.getStatus()).toString()); nbttagcompound.putString("Status", BuiltInRegistries.CHUNK_STATUS.getKey(chunk.getStatus()).toString());
BlendingData blendingdata = chunk.getBlendingData(); BlendingData blendingdata = chunk.getBlendingData();
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkStorage.java diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkStorage.java
index 7f7c05c498dfe11842a0c35d6e8c2c428cf7647b..4a84ada69c6abc8f2743579d4451e639836274b4 100644 index cccc3741227402b24c76d31a339d01323610b9f0..2f7c9e0e62599688c0ed2e05444bce5040035a99 100644
--- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkStorage.java --- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkStorage.java
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkStorage.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkStorage.java
@@ -41,7 +41,7 @@ public class ChunkStorage implements AutoCloseable { @@ -41,7 +41,7 @@ public class ChunkStorage implements AutoCloseable {
@ -87,7 +87,7 @@ index c8298a597818227de33a4afce4698ec0666cf758..6762b0f71ea9e369bb77103b7f193898
this.used.set(start, start + size); this.used.set(start, start + size);
} }
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 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 647ce340c81606ab86d33e1f9dec1fb0afc262d8..2c951dfb17a11bd81c19080a1f8f498f8e534cff 100644 index 0ae3d1ea6f00efcdea5da5bf1a0f984f4473f5a2..1f8fa4a054ed1c76688d1a919ea170587fb4806f 100644
--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java --- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java
@@ -50,6 +50,355 @@ public class RegionFile implements AutoCloseable { @@ -50,6 +50,355 @@ public class RegionFile implements AutoCloseable {
@ -685,7 +685,7 @@ index 647ce340c81606ab86d33e1f9dec1fb0afc262d8..2c951dfb17a11bd81c19080a1f8f498f
return bytebuffer; return bytebuffer;
} }
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 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 9fa07295bf73317a4c2bbbbaf1918393c891f09a..a2794ec3d846136da64b6888d846587499a5f635 100644 index 9e30b47ece5549c30f487e5542ae65d5faaa8c39..156cecae8ea7ffbc38974829942a1c92e828eca9 100644
--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java --- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
@@ -24,6 +24,7 @@ public class RegionFileStorage implements AutoCloseable { @@ -24,6 +24,7 @@ public class RegionFileStorage implements AutoCloseable {
@ -727,7 +727,7 @@ index 9fa07295bf73317a4c2bbbbaf1918393c891f09a..a2794ec3d846136da64b6888d8465874
this.regionCache.putAndMoveToFirst(i, regionfile1); this.regionCache.putAndMoveToFirst(i, regionfile1);
// Paper start // Paper start
@@ -216,6 +223,13 @@ public class RegionFileStorage implements AutoCloseable { @@ -188,6 +195,13 @@ public class RegionFileStorage implements AutoCloseable {
if (regionfile == null) { if (regionfile == null) {
return null; return null;
} }
@ -741,7 +741,7 @@ index 9fa07295bf73317a4c2bbbbaf1918393c891f09a..a2794ec3d846136da64b6888d8465874
// CraftBukkit end // CraftBukkit end
try { // Paper try { // Paper
DataInputStream datainputstream = regionfile.getChunkDataInputStream(pos); DataInputStream datainputstream = regionfile.getChunkDataInputStream(pos);
@@ -232,6 +246,20 @@ public class RegionFileStorage implements AutoCloseable { @@ -204,6 +218,20 @@ public class RegionFileStorage implements AutoCloseable {
try { try {
if (datainputstream != null) { if (datainputstream != null) {
nbttagcompound = NbtIo.read((DataInput) datainputstream); nbttagcompound = NbtIo.read((DataInput) datainputstream);

Datei anzeigen

@ -76,7 +76,7 @@ index 7de24c39b460e43d27839b3821e67213508ece81..7297bca9224c12d7ace0e1967340d994
}); });
throw RunningOnDifferentThreadException.RUNNING_ON_DIFFERENT_THREAD; 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 diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 922639eee09ff9878a979ebfdaa36f865746cbdd..c6c69ea8a471eff84256f1a66d4eda98f55c269e 100644 index dcbcb1df7a8c1e5f78b8f202e4207afc1054a414..ec2a8656148b7ccdf519ce6d13494d22dadc0789 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1244,7 +1244,26 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -1244,7 +1244,26 @@ public class ServerLevel extends Level implements WorldGenLevel {
@ -122,7 +122,7 @@ index 922639eee09ff9878a979ebfdaa36f865746cbdd..c6c69ea8a471eff84256f1a66d4eda98
private void tickPassenger(Entity vehicle, Entity passenger) { 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 diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index f3f12e2394a85fd49ba0bc14944b0f073ca5fecc..bbc8a7f27ffdeda8f994b04213e631e1b82ee67c 100644 index b9d70f71b2b03190e329d1f843b54ac4c73543ab..054825419c98351af15309ecfa007fd7e1ee1bea 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java --- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -1031,7 +1031,42 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S @@ -1031,7 +1031,42 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@ -182,7 +182,7 @@ index f3f12e2394a85fd49ba0bc14944b0f073ca5fecc..bbc8a7f27ffdeda8f994b04213e631e1
} }
private boolean isStateClimbable(BlockState state) { private boolean isStateClimbable(BlockState state) {
@@ -4272,7 +4314,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S @@ -4270,7 +4312,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
} }
public void setDeltaMovement(Vec3 velocity) { public void setDeltaMovement(Vec3 velocity) {
@ -192,7 +192,7 @@ index f3f12e2394a85fd49ba0bc14944b0f073ca5fecc..bbc8a7f27ffdeda8f994b04213e631e1
} }
public void addDeltaMovement(Vec3 velocity) { public void addDeltaMovement(Vec3 velocity) {
@@ -4375,7 +4419,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S @@ -4373,7 +4417,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
} }
// Paper end - Fix MC-4 // Paper end - Fix MC-4
if (this.position.x != x || this.position.y != y || this.position.z != z) { if (this.position.x != x || this.position.y != y || this.position.z != z) {

Datei anzeigen

@ -8,7 +8,7 @@ This ensures at least a valid version of the chunk exists
on disk, even if outdated 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 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 2c951dfb17a11bd81c19080a1f8f498f8e534cff..b0fa77d298ad1476fdc2433b0308276068e53a71 100644 index 1f8fa4a054ed1c76688d1a919ea170587fb4806f..50de979a447171ab98de59bf25b6c82871d03543 100644
--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java --- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java
@@ -1003,6 +1003,9 @@ public class RegionFile implements AutoCloseable { @@ -1003,6 +1003,9 @@ public class RegionFile implements AutoCloseable {
@ -47,12 +47,12 @@ index 2c951dfb17a11bd81c19080a1f8f498f8e534cff..b0fa77d298ad1476fdc2433b03082760
ByteBuffer bytebuffer = ByteBuffer.wrap(this.buf, 0, this.count); 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 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 a2794ec3d846136da64b6888d846587499a5f635..6bec4549fbcfb68a053300451e25babf8ff38e99 100644 index 156cecae8ea7ffbc38974829942a1c92e828eca9..a25e7183da64f726773aa279707ae67941246b46 100644
--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java --- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
@@ -342,10 +342,17 @@ public class RegionFileStorage implements AutoCloseable { @@ -314,10 +314,17 @@ public class RegionFileStorage implements AutoCloseable {
NbtIo.write(nbt, (DataOutput) dataoutputstream); NbtIo.write(nbt, (DataOutput) dataoutputstream);
regionfile.setStatus(pos.x, pos.z, ChunkSerializer.getStatus(nbt)); // Paper - cache status on disk regionfile.setStatus(pos.x, pos.z, ChunkSerializer.getStatus(nbt)); // Paper - Cache chunk status
regionfile.setOversized(pos.x, pos.z, false); // Paper - We don't do this anymore, mojang stores differently, but clear old meta flag if it exists to get rid of our own meta file once last oversized is gone regionfile.setOversized(pos.x, pos.z, false); // Paper - We don't do this anymore, mojang stores differently, but clear old meta flag if it exists to get rid of our own meta file once last oversized is gone
+ dataoutputstream.close(); // Paper - only write if successful + dataoutputstream.close(); // Paper - only write if successful
+ // Paper start - don't write garbage data to disk if writing serialization fails + // Paper start - don't write garbage data to disk if writing serialization fails
@ -69,7 +69,7 @@ index a2794ec3d846136da64b6888d846587499a5f635..6bec4549fbcfb68a053300451e25babf
} catch (Throwable throwable1) { } catch (Throwable throwable1) {
throwable.addSuppressed(throwable1); throwable.addSuppressed(throwable1);
} }
@@ -353,10 +360,7 @@ public class RegionFileStorage implements AutoCloseable { @@ -325,10 +332,7 @@ public class RegionFileStorage implements AutoCloseable {
throw throwable; throw throwable;
} }
@ -81,7 +81,7 @@ index a2794ec3d846136da64b6888d846587499a5f635..6bec4549fbcfb68a053300451e25babf
} }
// Paper start // Paper start
return; return;
@@ -402,4 +406,13 @@ public class RegionFileStorage implements AutoCloseable { @@ -374,4 +378,13 @@ public class RegionFileStorage implements AutoCloseable {
} }
} }

Datei anzeigen

@ -41,7 +41,7 @@ index 003fd247b12323cca5fd82a6cdf31bd897afd682..a93a085b2e9564a2ff950fff505d856b
} else if (iblockdata1.is((Block) this)) { } else if (iblockdata1.is((Block) this)) {
++k; ++k;
diff --git a/src/main/java/net/minecraft/world/level/block/TripWireHookBlock.java b/src/main/java/net/minecraft/world/level/block/TripWireHookBlock.java diff --git a/src/main/java/net/minecraft/world/level/block/TripWireHookBlock.java b/src/main/java/net/minecraft/world/level/block/TripWireHookBlock.java
index 02b62ac13d4968f80cb0ae3702755d0f1d95e692..0f6ea0adb4b99d934e1a3fcb92562dffb2a45f63 100644 index d9b3877257b31ca1b5acc4a47fbf5b993de69ae0..7f2dcf6a9e69779e6f898284b58fb1e32902000c 100644
--- a/src/main/java/net/minecraft/world/level/block/TripWireHookBlock.java --- a/src/main/java/net/minecraft/world/level/block/TripWireHookBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/TripWireHookBlock.java +++ b/src/main/java/net/minecraft/world/level/block/TripWireHookBlock.java
@@ -118,7 +118,13 @@ public class TripWireHookBlock extends Block { @@ -118,7 +118,13 @@ public class TripWireHookBlock extends Block {
@ -82,6 +82,6 @@ index 02b62ac13d4968f80cb0ae3702755d0f1d95e692..0f6ea0adb4b99d934e1a3fcb92562dff
TripWireHookBlock.emitState(world, pos, flag4, flag5, flag2, flag3); TripWireHookBlock.emitState(world, pos, flag4, flag5, flag2, flag3);
- if (!flag) { - if (!flag) {
+ if (!beingRemoved) { // Paper - fix tripwire state inconsistency + if (!beingRemoved) { // Paper - fix tripwire state inconsistency
if (world.getBlockState(pos).getBlock() == Blocks.TRIPWIRE_HOOK) // Paper - validate if (world.getBlockState(pos).getBlock() == Blocks.TRIPWIRE_HOOK) // Paper - Validate tripwire hook placement before update
world.setBlock(pos, (BlockState) iblockdata3.setValue(TripWireHookBlock.FACING, enumdirection), 3); world.setBlock(pos, (BlockState) iblockdata3.setValue(TripWireHookBlock.FACING, enumdirection), 3);
if (flag1) { if (flag1) {

Datei anzeigen

@ -113,12 +113,12 @@ index 6cd6d69a20e95e344fc18ab67dc300824537a59b..2e2a7c2cf3081187da817479a9da3eb1
} }
} }
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 534493aaddced9200e1618d5eabf2b176a1f35b6..a58c47b16254262ec705a8f986ef42c71503770d 100644 index b303603178a9de5f14bede9e601f80cfb44ecc91..bf78917f1e356dc3b7d7bcedffab282978a35917 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java --- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -898,7 +898,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -898,7 +898,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
} }
// Paper end // Paper end - Cache chunk status on disk
- boolean anyPlayerCloseEnoughForSpawning(ChunkPos pos) { - boolean anyPlayerCloseEnoughForSpawning(ChunkPos pos) {
+ public boolean anyPlayerCloseEnoughForSpawning(ChunkPos pos) { // Paper - public + public boolean anyPlayerCloseEnoughForSpawning(ChunkPos pos) { // Paper - public
@ -126,7 +126,7 @@ index 534493aaddced9200e1618d5eabf2b176a1f35b6..a58c47b16254262ec705a8f986ef42c7
return this.anyPlayerCloseEnoughForSpawning(pos, false); 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 diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 82a71a150c555dd4dfe0ce03a3addba53fda5387..9ef3445aadf98d205a60803f459d07c4ac820ba9 100644 index 43d14fac84b932c0a5a94dd6b01c22c1a289b8c2..f594998de4ff40b56d039bc48721f6b53f0a1ec0 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1032,7 +1032,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -1032,7 +1032,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
@ -139,7 +139,7 @@ index 82a71a150c555dd4dfe0ce03a3addba53fda5387..9ef3445aadf98d205a60803f459d07c4
if (!list.isEmpty()) { if (!list.isEmpty()) {
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index d27793e21f9352896a96d5ccfdd0281b0b102a03..6cf989b4827b78d25bcb0ad4b683b6b1569e12dd 100644 index aad7e1d9e17a0daa8697c13d1ef8cf7331cdf001..142094dcdfd9ba1c4cb77107d17f4c6b28888e7e 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -468,14 +468,14 @@ public class ServerPlayer extends Player { @@ -468,14 +468,14 @@ public class ServerPlayer extends Player {
@ -160,7 +160,7 @@ index d27793e21f9352896a96d5ccfdd0281b0b102a03..6cf989b4827b78d25bcb0ad4b683b6b1
while (!world.noCollision(this, this.getBoundingBox(), true) && this.getY() < (double) (world.getMaxBuildHeight() - 1)) { // Paper - make sure this loads chunks, we default to NOT loading now while (!world.noCollision(this, this.getBoundingBox(), true) && this.getY() < (double) (world.getMaxBuildHeight() - 1)) { // Paper - make sure this loads chunks, we default to NOT loading now
this.setPos(this.getX(), this.getY() + 1.0D, this.getZ()); this.setPos(this.getX(), this.getY() + 1.0D, this.getZ());
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
index c14ab35c4336c025c242e8a350ac4b8d1b1d5c78..15f6bd2e61c02392e8383dc93d734990c8c7edca 100644 index aad371a281486631151388ee2348ffaa2a465bc5..8b339ad425d4021b859126d763adf393cb0e86c5 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java --- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
@@ -92,7 +92,7 @@ public class ServerPlayerGameMode { @@ -92,7 +92,7 @@ public class ServerPlayerGameMode {
@ -173,7 +173,7 @@ index c14ab35c4336c025c242e8a350ac4b8d1b1d5c78..15f6bd2e61c02392e8383dc93d734990
this.player.server.getPlayerList().broadcastAll(new ClientboundPlayerInfoUpdatePacket(ClientboundPlayerInfoUpdatePacket.Action.UPDATE_GAME_MODE, this.player), this.player); // CraftBukkit this.player.server.getPlayerList().broadcastAll(new ClientboundPlayerInfoUpdatePacket(ClientboundPlayerInfoUpdatePacket.Action.UPDATE_GAME_MODE, this.player), this.player); // CraftBukkit
this.level.updateSleepingPlayerList(); 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 diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 92b88e82e9a49a0e967a7e694f1d2f4ade8adbf1..fbf388fe93383daf5e87e54a8a413a2239bfdc69 100644 index b1f13c4d8de125a56b76bc85ccced039ac3c4785..b8213713b54e0bfaa0ddca41ec76f6840c0e1d20 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java --- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/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 { @@ -711,8 +711,10 @@ public abstract class PlayerList {
@ -298,7 +298,7 @@ index 110dd5418b0512a2f27f0c4d5a5f1812356a6a12..5d247ac38fe8a61603b3d934f3000bcd
} }
diff --git a/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java b/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java diff --git a/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java b/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java
index 7a990fb47f39da00026d3005d5bb11d3abd14026..ea5fffa7e045d854ce9522f00246e3746f40f028 100644 index 56cc6ecf7f95687db7c7c062b4ee979bfe49844b..94dd97662ba07689fbfa16ef5c7d99fe12ce83de 100644
--- a/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java --- a/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java
+++ b/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java +++ b/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java
@@ -252,7 +252,13 @@ public abstract class AbstractHorse extends Animal implements ContainerListener, @@ -252,7 +252,13 @@ public abstract class AbstractHorse extends Animal implements ContainerListener,
@ -474,7 +474,7 @@ index 0813e7510c43ed6916e83635f2be6d39ce2feb5b..137ee0271f1d7adbf3c463b96e9c4627
} }
} }
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java diff --git a/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java
index d3e2fd7fcfeec133a7baa0007c979c9e379c2f10..1ef558bdd27e9b64413e64f0fa9c68a35f43c39d 100644 index 83a5417d14e89c3e582e400543fe41f129bbbf3b..5ea2cad4031d69f0204e3094d9ac5d127ef2438c 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java --- a/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java
@@ -291,7 +291,11 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider, Name @@ -291,7 +291,11 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider, Name

Datei anzeigen

@ -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 diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index c726af466c1156a3b2c1ee18d1ac1b4613ee2431..0e66212733665307840d10bd6ea049d45f674ddb 100644 index f039ea2716efa3fabf041f75388c2c9b7f41948f..03beb4cf21d98d2b7439c5d548dc1dae51482d9b 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/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 { @@ -261,6 +261,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
@ -55,13 +55,13 @@ index c726af466c1156a3b2c1ee18d1ac1b4613ee2431..0e66212733665307840d10bd6ea049d4
if (nbt.contains("Attributes", 9) && this.level() != null && !this.level().isClientSide) { if (nbt.contains("Attributes", 9) && this.level() != null && !this.level().isClientSide) {
this.getAttributes().load(nbt.getList("Attributes", 10)); 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 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 e19a0f1fac3dd04927f73f3d11a921ffc4608388..491a521f0e5e272fbad7870fa3adefdea22e179f 100644 index 13efea97d1836a48ef4c0e077a61571d9c171a0e..635f93b4205bd11a8080fbc1db53aa2430aacb77 100644
--- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java --- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
+++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java +++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
@@ -57,6 +57,7 @@ public class ItemEntity extends Entity implements TraceableEntity { @@ -57,6 +57,7 @@ public class ItemEntity extends Entity implements TraceableEntity {
private int lastTick = MinecraftServer.currentTick - 1; // CraftBukkit private int lastTick = MinecraftServer.currentTick - 1; // CraftBukkit
public boolean canMobPickup = true; // Paper public boolean canMobPickup = true; // Paper
private int despawnRate = -1; // Paper private int despawnRate = -1; // Paper - Alternative item-despawn-rate
+ public net.kyori.adventure.util.TriState frictionState = net.kyori.adventure.util.TriState.NOT_SET; // Paper - Friction API + public net.kyori.adventure.util.TriState frictionState = net.kyori.adventure.util.TriState.NOT_SET; // Paper - Friction API
public ItemEntity(EntityType<? extends ItemEntity> type, Level world) { public ItemEntity(EntityType<? extends ItemEntity> type, Level world) {
@ -110,7 +110,7 @@ index e19a0f1fac3dd04927f73f3d11a921ffc4608388..491a521f0e5e272fbad7870fa3adefde
this.setItem(ItemStack.of(nbttagcompound1)); this.setItem(ItemStack.of(nbttagcompound1));
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java
index b1bbab951ef9a3d2bd98cc54665ba824263542eb..81498941748d646ebe6495f4a7ce6953532144c6 100644 index cbfd4cf1d7d32757cf124d1aaa4b83d8a155868f..832def3c518be8d6d81e71f6022566e6179e2d17 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java
@@ -99,6 +99,18 @@ public class CraftItem extends CraftEntity implements Item { @@ -99,6 +99,18 @@ public class CraftItem extends CraftEntity implements Item {
@ -133,7 +133,7 @@ index b1bbab951ef9a3d2bd98cc54665ba824263542eb..81498941748d646ebe6495f4a7ce6953
public int getHealth() { public int getHealth() {
return this.getHandle().health; return this.getHandle().health;
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
index 9de132dc39f2af083b2f60d6344b9a9635c1de83..45ebd9ffc37163e3a11c80c15b41c5aeed2b6983 100644 index d12734b0c6b10ca8997a79e06fc9791abe0e9ed5..97c7bb2032584847f2f8a946c1f8d13fef908edf 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -1083,6 +1083,18 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { @@ -1083,6 +1083,18 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Player Entity Tracking Events
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index a58c47b16254262ec705a8f986ef42c71503770d..8c5364e6adecc01f4fa9dcd0b4fd18e81324d1a9 100644 index bf78917f1e356dc3b7d7bcedffab282978a35917..6420a6c16a8c3f0f45649834fe40e1939d1fead7 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java --- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -1409,7 +1409,11 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -1409,7 +1409,11 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@ -21,10 +21,10 @@ index a58c47b16254262ec705a8f986ef42c71503770d..8c5364e6adecc01f4fa9dcd0b4fd18e8
} else if (this.seenBy.remove(player.connection)) { } else if (this.seenBy.remove(player.connection)) {
this.serverEntity.removePairing(player); this.serverEntity.removePairing(player);
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 0c1cb3d5892b81b9f8a1894e429bc237c877298d..ee3dac1d45e0ab85cd21871029650fbed7310a34 100644 index 98f7248920a25930ac813e22bbd816294f06d057..6e1c088a234ff4c93ea790c46f1e1f015fc24bec 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java --- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -4107,7 +4107,14 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S @@ -4105,7 +4105,14 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
public void startSeenByPlayer(ServerPlayer player) {} public void startSeenByPlayer(ServerPlayer player) {}

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Improve PortalEvents
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index ee3dac1d45e0ab85cd21871029650fbed7310a34..30e831bc4409260047016279aa5f36d2ad2934b4 100644 index 6e1c088a234ff4c93ea790c46f1e1f015fc24bec..805f438e4b7a03393424c2ba11bf1f7fc4822f52 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java --- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -3765,7 +3765,14 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S @@ -3763,7 +3763,14 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
Location enter = bukkitEntity.getLocation(); Location enter = bukkitEntity.getLocation();
Location exit = CraftLocation.toBukkit(exitPosition, exitWorldServer.getWorld()); Location exit = CraftLocation.toBukkit(exitPosition, exitWorldServer.getWorld());

Datei anzeigen

@ -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 diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index e9ec17c4dfb44f6f562dedd20d123064492ef736..ffb87573b1c5df4e6f4d36d0331738da221e0f38 100644 index addb4133295739ea19e0e770e040698411399944..5caa39b529c6c0798d91e8e8468b40988f6fb987 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1629,6 +1629,20 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -1629,6 +1629,20 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@ -1173,7 +1173,7 @@ index e9ec17c4dfb44f6f562dedd20d123064492ef736..ffb87573b1c5df4e6f4d36d0331738da
this.profiler.push("commandFunctions"); this.profiler.push("commandFunctions");
MinecraftTimings.commandFunctionsTimer.startTiming(); // Spigot // Paper 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 diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 79e2fbad2c03d6187671a073553a573022aeb060..5ee35035639374185c18477c9b9ab0dc8a2fae20 100644 index 09397946cb9fa82e20772ea981bdadbc6a5c93c7..7c02d16a859f1cf1b24a01099af4ee29f5621e00 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java --- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/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 { @@ -649,6 +649,7 @@ public abstract class PlayerList {
@ -1185,7 +1185,7 @@ index 79e2fbad2c03d6187671a073553a573022aeb060..5ee35035639374185c18477c9b9ab0dc
this.players.remove(entityplayer); this.players.remove(entityplayer);
this.playersByName.remove(entityplayer.getScoreboardName().toLowerCase(java.util.Locale.ROOT)); // Spigot 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 diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index d29ded9946138418af7c993fba6267e16a24c00c..037f21e5cfe1c399c708721d26b456583cd3d924 100644 index a5a57d1be35e911e26a9f10ee413db34f3637086..e29794df5b84649a710e8181c6a550105d6800e9 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java --- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -249,11 +249,23 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S @@ -249,11 +249,23 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@ -1213,7 +1213,7 @@ index d29ded9946138418af7c993fba6267e16a24c00c..037f21e5cfe1c399c708721d26b45658
@Override @Override
public CommandSender getBukkitSender(CommandSourceStack wrapper) { public CommandSender getBukkitSender(CommandSourceStack wrapper) {
return this.getBukkitEntity(); return this.getBukkitEntity();
@@ -4736,6 +4748,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S @@ -4734,6 +4746,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
return; return;
} }
// Paper end - rewrite chunk system // Paper end - rewrite chunk system
@ -1221,7 +1221,7 @@ index d29ded9946138418af7c993fba6267e16a24c00c..037f21e5cfe1c399c708721d26b45658
if (this.removalReason == null) { if (this.removalReason == null) {
this.removalReason = reason; this.removalReason = reason;
} }
@@ -4746,12 +4759,28 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S @@ -4744,12 +4757,28 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
if (reason != RemovalReason.UNLOADED_TO_CHUNK) this.getPassengers().forEach(Entity::stopRiding); // Paper - chunk system - don't adjust passenger state when unloading, it's just not safe (and messes with our logic in entity chunk unload) if (reason != RemovalReason.UNLOADED_TO_CHUNK) this.getPassengers().forEach(Entity::stopRiding); // Paper - chunk system - don't adjust passenger state when unloading, it's just not safe (and messes with our logic in entity chunk unload)
this.levelCallback.onRemove(reason); this.levelCallback.onRemove(reason);
@ -1251,7 +1251,7 @@ index d29ded9946138418af7c993fba6267e16a24c00c..037f21e5cfe1c399c708721d26b45658
public void setLevelCallback(EntityInLevelCallback changeListener) { public void setLevelCallback(EntityInLevelCallback changeListener) {
this.levelCallback = changeListener; this.levelCallback = changeListener;
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 5f24bab8b21452e502af70a925ceeaecbedd4a6c..78acd7d97608c4862f1d39e36785d3f396cd0019 100644 index 50868ed5d90c404cb5da05956c879ca0f090455c..74b0a638c3f8098895c0855894d029f12fc55197 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -306,6 +306,76 @@ public final class CraftServer implements Server { @@ -306,6 +306,76 @@ public final class CraftServer implements Server {

Datei anzeigen

@ -6,7 +6,7 @@ Subject: [PATCH] Improve cancelling PreCreatureSpawnEvent with per player mob
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 8c5364e6adecc01f4fa9dcd0b4fd18e81324d1a9..34edd2032abb9e444d7b67672dc72335216dbe82 100644 index 2ef28c2506bb4490c04be35e71e0ebd17a2bee7c..198e1d360b2d76a2ec8bdcc3b1dc121a0d8430d4 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java --- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -386,8 +386,26 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -386,8 +386,26 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@ -35,10 +35,10 @@ index 8c5364e6adecc01f4fa9dcd0b4fd18e81324d1a9..34edd2032abb9e444d7b67672dc72335
- return entityPlayer.mobCounts[mobCategory.ordinal()]; - return entityPlayer.mobCounts[mobCategory.ordinal()];
+ return entityPlayer.mobCounts[mobCategory.ordinal()] + entityPlayer.mobBackoffCounts[mobCategory.ordinal()]; // Paper - per player mob count backoff + return entityPlayer.mobCounts[mobCategory.ordinal()] + entityPlayer.mobBackoffCounts[mobCategory.ordinal()]; // Paper - per player mob count backoff
} }
// Paper end // Paper end - Optional per player mob spawns
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index 1483007b79e18107e41037c279e048f04f666d1d..5152979bf81345fc365e7b16028c7d970d2f5856 100644 index 32129fdd5b2542a0acb828fb843fa4e44533946c..dfecd5531862109cd89cfd8a041a8beef70c1a6a 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -539,7 +539,17 @@ public class ServerChunkCache extends ChunkSource { @@ -539,7 +539,17 @@ public class ServerChunkCache extends ChunkSource {
@ -61,19 +61,19 @@ index 1483007b79e18107e41037c279e048f04f666d1d..5152979bf81345fc365e7b16028c7d97
spawnercreature_d = NaturalSpawner.createState(naturalSpawnChunkCount, this.level.getAllEntities(), this::getFullChunk, null, true); spawnercreature_d = NaturalSpawner.createState(naturalSpawnChunkCount, this.level.getAllEntities(), this::getFullChunk, null, true);
} else { } else {
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 3abcb4470bbf8f83204532ff5f3f5e152866a9f0..e32a2ea53f61410f0470bdccf1e479af1a571469 100644 index 1ff728159ba77145e14944a2fb453eab061ad01a..706af62b06c36d4bcc3fa1fea1dbf5dad0d53b54 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -260,6 +260,7 @@ public class ServerPlayer extends Player { @@ -260,6 +260,7 @@ public class ServerPlayer extends Player {
public static final int MOBCATEGORY_TOTAL_ENUMS = net.minecraft.world.entity.MobCategory.values().length; public static final int MOBCATEGORY_TOTAL_ENUMS = net.minecraft.world.entity.MobCategory.values().length;
public final int[] mobCounts = new int[MOBCATEGORY_TOTAL_ENUMS]; // Paper public final int[] mobCounts = new int[MOBCATEGORY_TOTAL_ENUMS]; // Paper
// Paper end - mob spawning rework // Paper end - Optional per player mob spawns
+ public final int[] mobBackoffCounts = new int[MOBCATEGORY_TOTAL_ENUMS]; // Paper - per player mob count backoff + public final int[] mobBackoffCounts = new int[MOBCATEGORY_TOTAL_ENUMS]; // Paper - per player mob count backoff
// CraftBukkit start // CraftBukkit start
public String displayName; public String displayName;
diff --git a/src/main/java/net/minecraft/world/level/NaturalSpawner.java b/src/main/java/net/minecraft/world/level/NaturalSpawner.java diff --git a/src/main/java/net/minecraft/world/level/NaturalSpawner.java b/src/main/java/net/minecraft/world/level/NaturalSpawner.java
index 48cc5623973713e07d95639e5359fc15e59785cc..46d743db099e69e10f5534aafdd7aa5eda67dec9 100644 index 6fbd136f4bbfa34ef88a7743c63a542ed0cc2c02..2d95450d664a60d11fdc962b0c85a9db7eb3363e 100644
--- a/src/main/java/net/minecraft/world/level/NaturalSpawner.java --- a/src/main/java/net/minecraft/world/level/NaturalSpawner.java
+++ b/src/main/java/net/minecraft/world/level/NaturalSpawner.java +++ b/src/main/java/net/minecraft/world/level/NaturalSpawner.java
@@ -277,6 +277,11 @@ public final class NaturalSpawner { @@ -277,6 +277,11 @@ public final class NaturalSpawner {
@ -86,5 +86,5 @@ index 48cc5623973713e07d95639e5359fc15e59785cc..46d743db099e69e10f5534aafdd7aa5e
+ } + }
+ // Paper end - per player mob count backoff + // Paper end - per player mob count backoff
if (doSpawning == PreSpawnStatus.ABORT) { if (doSpawning == PreSpawnStatus.ABORT) {
return j; // Paper return j; // Paper - Optional per player mob spawns
} }

Datei anzeigen

@ -9,7 +9,7 @@ food consumption, turtle egg count decreases, ice to water
conversions and beehive releases conversions and beehive releases
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
index 41c647c46585d454f3b10a860a2b6d979d1199a3..9b32f0951d99db42b75ee6303842f97811d1906c 100644 index 7c781820b31864999f8057ec1484f1353eb4f1ff..14d8cab88eb40560635fc51c00db225dd209dc88 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java --- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
@@ -433,8 +433,8 @@ public class ServerPlayerGameMode { @@ -433,8 +433,8 @@ public class ServerPlayerGameMode {
@ -24,7 +24,7 @@ index 41c647c46585d454f3b10a860a2b6d979d1199a3..9b32f0951d99db42b75ee6303842f978
// return true; // CraftBukkit // return true; // CraftBukkit
diff --git a/src/main/java/net/minecraft/world/level/block/BeehiveBlock.java b/src/main/java/net/minecraft/world/level/block/BeehiveBlock.java diff --git a/src/main/java/net/minecraft/world/level/block/BeehiveBlock.java b/src/main/java/net/minecraft/world/level/block/BeehiveBlock.java
index ed87664f513cf82c7bf8439672a656d0a57c1991..80a362fb6c073dee086bf4a46128a1fe53d83f37 100644 index a0ab721a01faccf216259c46e6d6f638426732c2..2d4a770ec7c0737eee6f06b32958716d50d230a1 100644
--- a/src/main/java/net/minecraft/world/level/block/BeehiveBlock.java --- a/src/main/java/net/minecraft/world/level/block/BeehiveBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/BeehiveBlock.java +++ b/src/main/java/net/minecraft/world/level/block/BeehiveBlock.java
@@ -84,8 +84,8 @@ public class BeehiveBlock extends BaseEntityBlock { @@ -84,8 +84,8 @@ public class BeehiveBlock extends BaseEntityBlock {
@ -77,7 +77,7 @@ index 0f0750f8c790d0db72a0e6b277449a1461674890..03b5ab8251497c0c94467f90e6663a0d
protected static void preventDropFromBottomPart(Level world, BlockPos pos, BlockState state, Player player) { protected static void preventDropFromBottomPart(Level world, BlockPos pos, BlockState state, Player player) {
diff --git a/src/main/java/net/minecraft/world/level/block/IceBlock.java b/src/main/java/net/minecraft/world/level/block/IceBlock.java diff --git a/src/main/java/net/minecraft/world/level/block/IceBlock.java b/src/main/java/net/minecraft/world/level/block/IceBlock.java
index f05998e0af1e844f19bf86b74f652a9901088c37..19f6e36daed6af02dca3bb88bb81000268264438 100644 index 52c6c26a300cfd19c478afba411a17c8d5ea0c3c..9c8c1df5187daefb1c8098b4d4a0976c71a7bbfd 100644
--- a/src/main/java/net/minecraft/world/level/block/IceBlock.java --- a/src/main/java/net/minecraft/world/level/block/IceBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/IceBlock.java +++ b/src/main/java/net/minecraft/world/level/block/IceBlock.java
@@ -33,8 +33,8 @@ public class IceBlock extends HalfTransparentBlock { @@ -33,8 +33,8 @@ public class IceBlock extends HalfTransparentBlock {
@ -88,7 +88,7 @@ index f05998e0af1e844f19bf86b74f652a9901088c37..19f6e36daed6af02dca3bb88bb810002
- super.playerDestroy(world, player, pos, state, blockEntity, tool); - super.playerDestroy(world, player, pos, state, blockEntity, tool);
+ public void playerDestroy(Level world, Player player, BlockPos pos, BlockState state, @Nullable BlockEntity blockEntity, ItemStack tool, boolean includeDrops, boolean dropExp) { // Paper - fix drops not preventing stats/food exhaustion + public void playerDestroy(Level world, Player player, BlockPos pos, BlockState state, @Nullable BlockEntity blockEntity, ItemStack tool, boolean includeDrops, boolean dropExp) { // Paper - fix drops not preventing stats/food exhaustion
+ super.playerDestroy(world, player, pos, state, blockEntity, tool, includeDrops, dropExp); // Paper - fix drops not preventing stats/food exhaustion + super.playerDestroy(world, player, pos, state, blockEntity, tool, includeDrops, dropExp); // Paper - fix drops not preventing stats/food exhaustion
// Paper start // Paper start - Improve Block#breakNaturally API
this.afterDestroy(world, pos, tool); this.afterDestroy(world, pos, tool);
} }
diff --git a/src/main/java/net/minecraft/world/level/block/TurtleEggBlock.java b/src/main/java/net/minecraft/world/level/block/TurtleEggBlock.java diff --git a/src/main/java/net/minecraft/world/level/block/TurtleEggBlock.java b/src/main/java/net/minecraft/world/level/block/TurtleEggBlock.java

Datei anzeigen

@ -5,11 +5,11 @@ Subject: [PATCH] Configurable Region Compression Format
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 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 b0fa77d298ad1476fdc2433b0308276068e53a71..22de360e6775943c0c8bd5717c78d49b45e70d6d 100644 index f629d026a946103e6e846663b0e63a1c0b7b82c4..08b99905f4e57e8b88f8da9683305937c110e1e9 100644
--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java --- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java
@@ -424,11 +424,11 @@ public class RegionFile implements AutoCloseable { @@ -424,11 +424,11 @@ public class RegionFile implements AutoCloseable {
// Paper end // Paper end - Cache chunk status
public RegionFile(Path file, Path directory, boolean dsync) throws IOException { public RegionFile(Path file, Path directory, boolean dsync) throws IOException {
- this(file, directory, RegionFileVersion.VERSION_DEFLATE, dsync); - this(file, directory, RegionFileVersion.VERSION_DEFLATE, dsync);

Datei anzeigen

@ -34,7 +34,7 @@ The results indicate that this logic is 5 times faster than Vanilla
and 2.3 times faster than Lithium. and 2.3 times faster than Lithium.
diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java
index 10f17478a148060ad2724bb5c79868cea3047ded..1fa02130dcb65b3109fde0cb612b538b1c4cd4cb 100644 index 4d51baab29b1a913c3efef2cb4ab0cac6c8cf38a..1fa02130dcb65b3109fde0cb612b538b1c4cd4cb 100644
--- a/src/main/java/net/minecraft/world/level/Explosion.java --- a/src/main/java/net/minecraft/world/level/Explosion.java
+++ b/src/main/java/net/minecraft/world/level/Explosion.java +++ b/src/main/java/net/minecraft/world/level/Explosion.java
@@ -111,6 +111,271 @@ public class Explosion { @@ -111,6 +111,271 @@ public class Explosion {
@ -371,7 +371,7 @@ index 10f17478a148060ad2724bb5c79868cea3047ded..1fa02130dcb65b3109fde0cb612b538b
- BlockPos blockposition = BlockPos.containing(d4, d5, d6); - BlockPos blockposition = BlockPos.containing(d4, d5, d6);
- BlockState iblockdata = this.level.getBlockState(blockposition); - BlockState iblockdata = this.level.getBlockState(blockposition);
- if (!iblockdata.isDestroyable()) continue; // Paper - Protect Bedrock and End Portal/Frames from being destroyed - if (!iblockdata.isDestroyable()) continue; // Paper - Protect Bedrock and End Portal/Frames from being destroyed
- FluidState fluid = iblockdata.getFluidState(); // Paper - FluidState fluid = iblockdata.getFluidState(); // Paper - Perf: Optimize call to getFluid for explosions
+ // Paper start - optimise explosions + // Paper start - optimise explosions
+ final int blockX = Mth.floor(d4); + final int blockX = Mth.floor(d4);
+ final int blockY = Mth.floor(d5); + final int blockY = Mth.floor(d5);

Datei anzeigen

@ -108,7 +108,7 @@ index 2b998bdbe49bf8211b755e0eb7c1bf13ac280eab..627a88ec8c3b215b19b55a6d461c8754
List list; List list;
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 8984a159dbdaab16a1a69e98a504f6d9621bf69a..6a106d4b9db8265d1a62e7ae13b0f05596fa3587 100644 index ce808a48478be3b310d33f4b28364f70f4cd3236..1b2b510cf5ea1799c1f5dec990cec52671e900a9 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java --- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -191,6 +191,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -191,6 +191,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@ -132,7 +132,7 @@ index 8984a159dbdaab16a1a69e98a504f6d9621bf69a..6a106d4b9db8265d1a62e7ae13b0f055
super(session.getDimensionPath(world.dimension()).resolve("region"), dataFixer, dsync); super(session.getDimensionPath(world.dimension()).resolve("region"), dataFixer, dsync);
@@ -409,7 +414,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -409,7 +414,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
} }
// Paper end // Paper end - Optional per player mob spawns
- private static double euclideanDistanceSquared(ChunkPos pos, Entity entity) { - private static double euclideanDistanceSquared(ChunkPos pos, Entity entity) {
+ public static double euclideanDistanceSquared(ChunkPos pos, Entity entity) { // Paper - optimise chunk iteration; public + public static double euclideanDistanceSquared(ChunkPos pos, Entity entity) { // Paper - optimise chunk iteration; public
@ -187,7 +187,7 @@ index c80a625f7289e3bb33c6851d2072957e153ca1fb..7c425ac50c83757b66a2178bc19d4c92
public String getDebugStatus() { public String getDebugStatus() {
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index 5d8a3d4bd7be3092a1e2959d122f5bc1c87f0ae1..a9ec46a5a751b8b06046c58525f7f6d0894adc8f 100644 index dfecd5531862109cd89cfd8a041a8beef70c1a6a..65a20974428ae1c0be2022d997234a16dc281292 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -516,18 +516,10 @@ public class ServerChunkCache extends ChunkSource { @@ -516,18 +516,10 @@ public class ServerChunkCache extends ChunkSource {
@ -365,7 +365,7 @@ index 5d8a3d4bd7be3092a1e2959d122f5bc1c87f0ae1..a9ec46a5a751b8b06046c58525f7f6d0
gameprofilerfiller.pop(); gameprofilerfiller.pop();
} }
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 6f06262d358a7f63a2ea35c0fd70b0c5aaa96182..ad6fd14f7f19c20967906a8e01a4f76ee80aaf84 100644 index 6ae35f3adce280e8be8e7e2f3bc4a0896ef6df83..84974c72dd3838ea118cc60c284709911cd7630b 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -325,6 +325,9 @@ public class ServerPlayer extends Player { @@ -325,6 +325,9 @@ public class ServerPlayer extends Player {

Datei anzeigen

@ -8,7 +8,7 @@ Areas affected by lag comepnsation:
- Eating food items - Eating food items
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index ffb87573b1c5df4e6f4d36d0331738da221e0f38..947190e48a05f1212c85a507e52a7f56618efaf6 100644 index 5caa39b529c6c0798d91e8e8468b40988f6fb987..09cf38a5d98fee1b73116d671c765ce17eb306d3 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -311,6 +311,9 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -311,6 +311,9 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@ -30,13 +30,13 @@ index ffb87573b1c5df4e6f4d36d0331738da221e0f38..947190e48a05f1212c85a507e52a7f56
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 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 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 diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index f66857ee0cdb3b110a0c3afedbc1c70bb3357a81..24145582ceb89406deb3d7fc3dfbe473c3d85229 100644 index 9d65f0558c7c4db75ed6337dc241c01746933315..3cef73da0ac4cbf8104fa5dff8321f605287a580 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -570,6 +570,17 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -570,6 +570,17 @@ public class ServerLevel extends Level implements WorldGenLevel {
return player != null && player.level() == this ? player : null; return player != null && player.level() == this ? player : null;
} }
// Paper end // Paper end - optimise getPlayerByUUID
+ // Paper start - lag compensation + // Paper start - lag compensation
+ private long lagCompensationTick = net.minecraft.server.MinecraftServer.SERVER_INIT; + private long lagCompensationTick = net.minecraft.server.MinecraftServer.SERVER_INIT;
+ +
@ -52,7 +52,7 @@ index f66857ee0cdb3b110a0c3afedbc1c70bb3357a81..24145582ceb89406deb3d7fc3dfbe473
// Add env and gen to constructor, IWorldDataServer -> WorldDataServer // Add env and gen to constructor, IWorldDataServer -> WorldDataServer
public ServerLevel(MinecraftServer minecraftserver, Executor executor, LevelStorageSource.LevelStorageAccess convertable_conversionsession, PrimaryLevelData iworlddataserver, ResourceKey<Level> resourcekey, LevelStem worlddimension, ChunkProgressListener worldloadlistener, boolean flag, long i, List<CustomSpawner> list, boolean flag1, @Nullable RandomSequences randomsequences, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider) { public ServerLevel(MinecraftServer minecraftserver, Executor executor, LevelStorageSource.LevelStorageAccess convertable_conversionsession, PrimaryLevelData iworlddataserver, ResourceKey<Level> resourcekey, LevelStem worlddimension, ChunkProgressListener worldloadlistener, boolean flag, long i, List<CustomSpawner> list, boolean flag1, @Nullable RandomSequences randomsequences, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider) {
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
index 27d22a6aef3f71179ea102062f1338cce5d46fea..52aadf7336c1486ccf0d192e27b742f9e63cfe9b 100644 index 96dd68d55dbcb4f6bf3f3096802e48ca50ab766e..b8c0f11a29ebc738a935d78e7a1e19914d43b533 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java --- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
@@ -124,7 +124,7 @@ public class ServerPlayerGameMode { @@ -124,7 +124,7 @@ public class ServerPlayerGameMode {
@ -65,7 +65,7 @@ index 27d22a6aef3f71179ea102062f1338cce5d46fea..52aadf7336c1486ccf0d192e27b742f9
if (this.hasDelayedDestroy) { 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 diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 768f1cb6b9a5f234be02f07a7ba84156e629fa03..5b2169737f831ba57ce7925cbe9a82c3cd712974 100644 index a09ad0cdbc9f3eb2ac77836076292822991b3d08..3d8efaaeea5cf7582c23cbb48beecf8eaf98a03e 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3819,6 +3819,10 @@ public abstract class LivingEntity extends Entity implements Attackable { @@ -3819,6 +3819,10 @@ public abstract class LivingEntity extends Entity implements Attackable {
@ -95,7 +95,7 @@ index 768f1cb6b9a5f234be02f07a7ba84156e629fa03..5b2169737f831ba57ce7925cbe9a82c3
@@ -3885,7 +3894,10 @@ public abstract class LivingEntity extends Entity implements Attackable { @@ -3885,7 +3894,10 @@ public abstract class LivingEntity extends Entity implements Attackable {
if (!itemstack.isEmpty() && !this.isUsingItem() || forceUpdate) { // Paper use override flag if (!itemstack.isEmpty() && !this.isUsingItem() || forceUpdate) { // Paper - Prevent consuming the wrong itemstack
this.useItem = itemstack; this.useItem = itemstack;
- this.useItemRemaining = itemstack.getUseDuration(); - this.useItemRemaining = itemstack.getUseDuration();
+ // Paper start - lag compensate eating + // Paper start - lag compensate eating