3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-14 20:10:05 +01:00
Dieser Commit ist enthalten in:
Owen1212055 2024-10-23 09:54:09 -04:00
Ursprung 5e262c1691
Commit aa37f7250d
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 2133292072886A30
32 geänderte Dateien mit 211 neuen und 226 gelöschten Zeilen

Datei anzeigen

@ -0,0 +1,24 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
Date: Sun, 5 Jan 2020 17:24:34 -0600
Subject: [PATCH] Prevent bees loading chunks checking hive position
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 b1a72ed404f4bc31f32dd771dd320b7c783c9651..310a2aa23365f9a8a8b7b6fa2323aed792f95adb 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Bee.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Bee.java
@@ -514,7 +514,12 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
@Nullable
BeehiveBlockEntity getBeehiveBlockEntity() {
- return this.hivePos == null ? null : (this.isTooFarAway(this.hivePos) ? null : (BeehiveBlockEntity) this.level().getBlockEntity(this.hivePos, BlockEntityType.BEEHIVE).orElse(null)); // CraftBukkit - decompile error
+ // Paper start - move over logic to accommodate isTooFarAway with chunk load check
+ if (this.hivePos != null && !this.isTooFarAway(this.hivePos) && this.level().getChunkIfLoadedImmediately(this.hivePos.getX() >> 4, this.hivePos.getZ() >> 4) != null) {
+ return (BeehiveBlockEntity) this.level().getBlockEntity(this.hivePos, BlockEntityType.BEEHIVE).orElse(null);
+ }
+ return null;
+ // Paper end
}
boolean isHiveValid() {

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
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 963092cd5a4e756ad6a471379a81d8996cc2b091..20c9921339ec6b5127fbadcedc19577f3906074d 100644
index cccdaa29ea97ec1d9e79f5a4811884d54e641677..b5025914678484cc615dc1982762d5d7f55a4557 100644
--- a/src/main/java/net/minecraft/world/level/block/DoubleBlockCombiner.java
+++ b/src/main/java/net/minecraft/world/level/block/DoubleBlockCombiner.java
@@ -34,7 +34,12 @@ public class DoubleBlockCombiner {

Datei anzeigen

@ -6,10 +6,10 @@ Subject: [PATCH] Optimise EntityGetter#getPlayerByUUID
Use the PlayerList map instead of iterating over all players
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index a6a21def1ae0d35fa106da6242c49a0928e4eda5..c85d5b941b5cb1c37cd2619d419006c5956f6eaf 100644
index 64c1fd62a865adb1e11edd326a1a5ccdc98f13ed..c7a1328e6642ad6c76179bddec117c4281577e86 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -330,6 +330,15 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -333,6 +333,15 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
}
// Paper end
@ -24,4 +24,4 @@ index a6a21def1ae0d35fa106da6242c49a0928e4eda5..c85d5b941b5cb1c37cd2619d419006c5
+
// 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) {
// IRegistryCustom.Dimension iregistrycustom_dimension = minecraftserver.registryAccess(); // CraftBukkit - decompile error
super(iworlddataserver, resourcekey, minecraftserver.registryAccess(), worlddimension.type(), false, flag, i, minecraftserver.getMaxChainedNeighborUpdates(), gen, biomeProvider, env, spigotConfig -> minecraftserver.paperConfigurations.createWorldConfig(io.papermc.paper.configuration.PaperConfigurations.createWorldContextMap(convertable_conversionsession.levelDirectory.path(), iworlddataserver.getLevelName(), resourcekey.location(), spigotConfig, minecraftserver.registryAccess(), iworlddataserver.getGameRules()))); // Paper - create paper world configs

Datei anzeigen

@ -15,7 +15,7 @@ This patch resolves the conflict by offsetting checking Spigot's entity
activation range check from an item's move method.
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 f9dfd6e7b610cfee75524a525ab0e72bed5522da..e110296a95441a13ec431d897796326b0277edb1 100644
index 75ebf09777e19645eee296a9edabac39c858ffb9..c390d8b3a706d0177b9f3105a7b9a84265688ece 100644
--- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
+++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
@@ -175,7 +175,7 @@ public class ItemEntity extends Entity implements TraceableEntity {
@ -25,10 +25,10 @@ index f9dfd6e7b610cfee75524a525ab0e72bed5522da..e110296a95441a13ec431d897796326b
- if (!this.onGround() || this.getDeltaMovement().horizontalDistanceSqr() > 9.999999747378752E-6D || (this.tickCount + this.getId()) % 4 == 0) {
+ if (!this.onGround() || this.getDeltaMovement().horizontalDistanceSqr() > 9.999999747378752E-6D || (this.tickCount + this.getId()) % 4 == 0) { // Paper - Diff on change
this.move(MoverType.SELF, this.getDeltaMovement());
this.applyEffectsFromBlocks();
float f = 0.98F;
diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java
index 6d51464f6368151e8acc532414ee223714584e96..9fb9fa62c32445ac3c3883a6433759c86dcfc428 100644
index 5dac9bdb23de3d143cd678e583eaf6e8095bb209..ad15c7db36bdeadaa8f2ec8f15f41d6f3395bd55 100644
--- a/src/main/java/org/spigotmc/ActivationRange.java
+++ b/src/main/java/org/spigotmc/ActivationRange.java
@@ -256,7 +256,7 @@ public class ActivationRange

Datei anzeigen

@ -4,11 +4,11 @@ Date: Tue, 14 Jan 2020 17:49:03 -0500
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
index ce8ac06b47e81161ad5ff6cc865ad6d3d59807c1..d4fe425954d36f0baddb256e3c83009a84084b72 100644
--- a/src/main/java/net/minecraft/world/level/Explosion.java
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
@@ -194,7 +194,7 @@ public class Explosion {
diff --git a/src/main/java/net/minecraft/world/level/ServerExplosion.java b/src/main/java/net/minecraft/world/level/ServerExplosion.java
index d1878f597c3d8119e9b248f4fe8af435ce8c9710..d3d74a7f306d88b0d5cd83893b3ee5e750fd4caf 100644
--- a/src/main/java/net/minecraft/world/level/ServerExplosion.java
+++ b/src/main/java/net/minecraft/world/level/ServerExplosion.java
@@ -150,7 +150,7 @@ public class ServerExplosion implements Explosion {
for (float f1 = 0.3F; f > 0.0F; f -= 0.22500001F) {
BlockPos blockposition = BlockPos.containing(d4, d5, d6);
BlockState iblockdata = this.level.getBlockState(blockposition);

Datei anzeigen

@ -0,0 +1,63 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Spottedleaf <Spottedleaf@users.noreply.github.com>
Date: Fri, 27 Dec 2019 09:42:26 -0800
Subject: [PATCH] Guard against serializing mismatching chunk coordinate
Should help if something dumb happens
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 329e7eb1c3e92445b3fae9e1e79d0497b7e3e3f2..909acbf5b8c6edcb4529647c11464d911d6f8c15 100644
--- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkStorage.java
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkStorage.java
@@ -172,8 +172,19 @@ public class ChunkStorage implements AutoCloseable {
}
public CompletableFuture<Void> write(ChunkPos chunkPos, Supplier<CompoundTag> nbtSupplier) {
+ // Paper start - guard against possible chunk pos desync
+ final Supplier<CompoundTag> guardedPosCheck = () -> {
+ CompoundTag nbt = nbtSupplier.get();
+ if (nbt != null && !chunkPos.equals(SerializableChunkData.getChunkCoordinate(nbt))) {
+ final String world = (ChunkStorage.this instanceof net.minecraft.server.level.ChunkMap) ? ((net.minecraft.server.level.ChunkMap) ChunkStorage.this).level.getWorld().getName() : null;
+ throw new IllegalArgumentException("Chunk coordinate and serialized data do not have matching coordinates, trying to serialize coordinate " + chunkPos
+ + " but compound says coordinate is " + SerializableChunkData.getChunkCoordinate(nbt) + (world == null ? " for an unknown world" : (" for world: " + world)));
+ }
+ return nbt;
+ };
+ // Paper end - guard against possible chunk pos desync
this.handleLegacyStructureIndex(chunkPos);
- return this.worker.store(chunkPos, nbtSupplier);
+ return this.worker.store(chunkPos, guardedPosCheck); // Paper - guard against possible chunk pos desync
}
protected void handleLegacyStructureIndex(ChunkPos chunkPos) {
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/SerializableChunkData.java b/src/main/java/net/minecraft/world/level/chunk/storage/SerializableChunkData.java
index 4367ccc628bb4f404d6a081083002518442f462b..92ad7704a77c024afe090488764eaf59a4f7505f 100644
--- a/src/main/java/net/minecraft/world/level/chunk/storage/SerializableChunkData.java
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/SerializableChunkData.java
@@ -91,13 +91,25 @@ public record SerializableChunkData(Registry<Biome> biomeRegistry, ChunkPos chun
public static final String SECTIONS_TAG = "sections";
public static final String BLOCK_LIGHT_TAG = "BlockLight";
public static final String SKY_LIGHT_TAG = "SkyLight";
+ // Paper start - guard against serializing mismatching coordinates
+ // TODO Note: This needs to be re-checked each update
+ public static ChunkPos getChunkCoordinate(final CompoundTag chunkData) {
+ final int dataVersion = ChunkStorage.getVersion(chunkData);
+ if (dataVersion < 2842) { // Level tag is removed after this version
+ final CompoundTag levelData = chunkData.getCompound("Level");
+ return new ChunkPos(levelData.getInt("xPos"), levelData.getInt("zPos"));
+ } else {
+ return new ChunkPos(chunkData.getInt("xPos"), chunkData.getInt("zPos"));
+ }
+ }
+ // Paper end - guard against serializing mismatching coordinates
@Nullable
public static SerializableChunkData parse(LevelHeightAccessor world, RegistryAccess registryManager, CompoundTag nbt) {
if (!nbt.contains("Status", 8)) {
return null;
} else {
- ChunkPos chunkcoordintpair = new ChunkPos(nbt.getInt("xPos"), nbt.getInt("zPos"));
+ ChunkPos chunkcoordintpair = new ChunkPos(nbt.getInt("xPos"), nbt.getInt("zPos")); // Paper - guard against serializing mismatching coordinates; diff on change, see ChunkSerializer#getChunkCoordinate
long i = nbt.getLong("LastUpdate");
long j = nbt.getLong("InhabitedTime");
ChunkStatus chunkstatus = ChunkStatus.byName(nbt.getString("Status"));

Datei anzeigen

@ -6,7 +6,7 @@ Subject: [PATCH] Alternative item-despawn-rate
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
index e110296a95441a13ec431d897796326b0277edb1..c724359995d65c88e7f365eea55f3e4382a46ddd 100644
index c390d8b3a706d0177b9f3105a7b9a84265688ece..65deb4568a80577f67f39de3af9fb568975a649d 100644
--- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
+++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
@@ -62,6 +62,7 @@ public class ItemEntity extends Entity implements TraceableEntity {
@ -17,7 +17,7 @@ index e110296a95441a13ec431d897796326b0277edb1..c724359995d65c88e7f365eea55f3e43
public ItemEntity(EntityType<? extends ItemEntity> type, Level world) {
super(type, world);
@@ -215,7 +216,7 @@ public class ItemEntity extends Entity implements TraceableEntity {
@@ -216,7 +217,7 @@ public class ItemEntity extends Entity implements TraceableEntity {
}
}
@ -26,7 +26,7 @@ index e110296a95441a13ec431d897796326b0277edb1..c724359995d65c88e7f365eea55f3e43
// CraftBukkit start - fire ItemDespawnEvent
if (CraftEventFactory.callItemDespawnEvent(this).isCancelled()) {
this.age = 0;
@@ -238,7 +239,7 @@ public class ItemEntity extends Entity implements TraceableEntity {
@@ -239,7 +240,7 @@ public class ItemEntity extends Entity implements TraceableEntity {
this.lastTick = MinecraftServer.currentTick;
// CraftBukkit end
@ -35,7 +35,7 @@ index e110296a95441a13ec431d897796326b0277edb1..c724359995d65c88e7f365eea55f3e43
// CraftBukkit start - fire ItemDespawnEvent
if (org.bukkit.craftbukkit.event.CraftEventFactory.callItemDespawnEvent(this).isCancelled()) {
this.age = 0;
@@ -294,7 +295,7 @@ public class ItemEntity extends Entity implements TraceableEntity {
@@ -297,7 +298,7 @@ public class ItemEntity extends Entity implements TraceableEntity {
private boolean isMergable() {
ItemStack itemstack = this.getItem();
@ -44,7 +44,7 @@ index e110296a95441a13ec431d897796326b0277edb1..c724359995d65c88e7f365eea55f3e43
}
private void tryToMerge(ItemEntity other) {
@@ -542,6 +543,7 @@ public class ItemEntity extends Entity implements TraceableEntity {
@@ -558,6 +559,7 @@ public class ItemEntity extends Entity implements TraceableEntity {
public void setItem(ItemStack stack) {
this.getEntityData().set(ItemEntity.DATA_ITEM, stack);
@ -52,7 +52,7 @@ index e110296a95441a13ec431d897796326b0277edb1..c724359995d65c88e7f365eea55f3e43
}
@Override
@@ -596,7 +598,7 @@ public class ItemEntity extends Entity implements TraceableEntity {
@@ -612,7 +614,7 @@ public class ItemEntity extends Entity implements TraceableEntity {
public void makeFakeItem() {
this.setNeverPickUp();
@ -60,4 +60,4 @@ index e110296a95441a13ec431d897796326b0277edb1..c724359995d65c88e7f365eea55f3e43
+ this.age = this.despawnRate - 1; // Spigot // Paper - Alternative item-despawn-rate
}
public float getSpin(float tickDelta) {
public static float getSpin(float f, float f1) {

Datei anzeigen

@ -8,10 +8,10 @@ Sets tracking range of watermobs to animals instead of misc and simplifies code
Also ignores Enderdragon, defaulting it to Mojang's setting
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 5573a5d0d0e10e3c584e821d3e8e7ba64a41a627..ee54706b36bd227edacea2a1b6099009bd652039 100644
index aa3155bb57c09895d13914b46c77de78a90f250a..b849d24144dc9f7d24484398cec3b2b90befb507 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -1545,6 +1545,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1604,6 +1604,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
while (iterator.hasNext()) {
Entity entity = (Entity) iterator.next();
int j = entity.getType().clientTrackingRange() * 16;

Datei anzeigen

@ -5,10 +5,10 @@ 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
index 58536ee8707c5ad0625cae2f26a58cf03b3f85d7..4134ee48909110f8c338f5d553d4cc1e9e31aaba 100644
index 310a2aa23365f9a8a8b7b6fa2323aed792f95adb..8c7943fdb56cd75c362e47e6c934bde5a714adaa 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Bee.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Bee.java
@@ -144,7 +144,22 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
@@ -150,7 +150,22 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
public Bee(EntityType<? extends Bee> type, Level world) {
super(type, world);
this.remainingCooldownBeforeLocatingNewFlower = Mth.nextInt(this.random, 20, 60);

Datei anzeigen

@ -18,10 +18,10 @@ public net.minecraft.world.level.block.TurtleEggBlock decreaseEggs(Lnet/minecraf
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
index 363dd6ab9c7b650913795ef350374d5c4e7e4925..e862814c1e54776f11050623b52476accc2f1f79 100644
index 6a4cc64068f67ee18a9e505888edb3874597b98a..067a2d969ca0979ae67b600e303deec93eda0251 100644
--- a/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 {
@@ -36,6 +36,11 @@ public class IceBlock extends HalfTransparentBlock {
@Override
public void playerDestroy(Level world, Player player, BlockPos pos, BlockState state, @Nullable BlockEntity blockEntity, ItemStack tool) {
super.playerDestroy(world, player, pos, state, blockEntity, tool);
@ -34,7 +34,7 @@ index 363dd6ab9c7b650913795ef350374d5c4e7e4925..e862814c1e54776f11050623b52476ac
if (world.dimensionType().ultraWarm()) {
world.removeBlock(pos, false);
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
index d4e14ac1514e2d8b87b4667a91c90eded3ba6636..f041b5d80bff9c022b007e04ef1558e9116acc6b 100644
index e5ac2d79b21db4e9a92b739e39d41a22deee175b..aae00320ab8003420bae5de7df47f553b62c5aab 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
@@ -452,6 +452,18 @@ public class CraftBlock implements Block {

Datei anzeigen

@ -7,10 +7,10 @@ bypass the need to get a player chunk, then get the either,
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
index a939bad7da9c852827a2d67d9ace5d0df4911a31..1049452baaf0381ffbf15b30da956c2a1994da35 100644
index 3bbc7aa52a2ee797d6033684e73d6b307c2fadcc..4302d5119c43eb8de0c026162fc62ddeb5ab87cb 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -179,6 +179,12 @@ public class ServerChunkCache extends ChunkSource {
@@ -191,6 +191,12 @@ public class ServerChunkCache extends ChunkSource {
return this.getChunk(x, z, leastStatus, create);
}, this.mainThreadProcessor).join();
} else {
@ -20,14 +20,14 @@ index a939bad7da9c852827a2d67d9ace5d0df4911a31..1049452baaf0381ffbf15b30da956c2a
+ return ifLoaded;
+ }
+ // Paper end - Perf: Optimise getChunkAt calls for loaded chunks
ProfilerFiller gameprofilerfiller = this.level.getProfiler();
ProfilerFiller gameprofilerfiller = Profiler.get();
gameprofilerfiller.incrementCounter("getChunk");
@@ -222,33 +228,7 @@ public class ServerChunkCache extends ChunkSource {
@@ -234,33 +240,7 @@ public class ServerChunkCache extends ChunkSource {
if (Thread.currentThread() != this.mainThread) {
return null;
} else {
- this.level.getProfiler().incrementCounter("getChunkNow");
- Profiler.get().incrementCounter("getChunkNow");
- long k = ChunkPos.asLong(chunkX, chunkZ);
-
- ChunkAccess ichunkaccess;

Datei anzeigen

@ -302,10 +302,10 @@ index 0000000000000000000000000000000000000000..95d6022c9cfb2e36ec5a71be6e343540
+ }
+}
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index 1049452baaf0381ffbf15b30da956c2a1994da35..60f678c26fb5144386d8697ddfd5b6d841563b6f 100644
index 4302d5119c43eb8de0c026162fc62ddeb5ab87cb..7e5714fea4cda68b9ae21031c0e0d39061b07e2f 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -206,6 +206,7 @@ public class ServerChunkCache extends ChunkSource {
@@ -218,6 +218,7 @@ public class ServerChunkCache extends ChunkSource {
Objects.requireNonNull(completablefuture);
if (!completablefuture.isDone()) { // Paper
@ -314,10 +314,10 @@ index 1049452baaf0381ffbf15b30da956c2a1994da35..60f678c26fb5144386d8697ddfd5b6d8
chunkproviderserver_b.managedBlock(completablefuture::isDone);
this.level.timings.syncChunkLoad.stopTiming(); // Paper
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index c85d5b941b5cb1c37cd2619d419006c5956f6eaf..f1fa4cb11f69e248dd55b8aa69f5d07268f182a1 100644
index c7a1328e6642ad6c76179bddec117c4281577e86..e2984ccee4e01b260109d038969f9ff3ea21b87f 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -422,6 +422,13 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -412,6 +412,13 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
this.getCraftServer().addWorld(this.getWorld()); // CraftBukkit
}

Datei anzeigen

@ -6,7 +6,7 @@ Subject: [PATCH] Improve java version check
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
index bcc9d3b1503b1be1841c9ab40e879a1cbb0549f2..224b7f5394a568a3982f1e9a554e72af969fbe43 100644
index 1efb42f7ad357f9b4185dea79106ccd38c9f5325..c618934b5cf66d9625c7be2ac114f1a1ca629d33 100644
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
@@ -203,11 +203,20 @@ public class Main {

Datei anzeigen

@ -7,10 +7,10 @@ Adds a new event similar to PlayerEggThrowEvent, but without the Player requirem
(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
index 62850e899955732afdd255ea1e55fc84b7c6c96b..dbd60cc8c39f5d2d4c77e2de4f2567e7fa456cd2 100644
index eb197a719177dcc1605ee0ff3c471ba91783f040..155c2bbd35adacb7c3668fbe81a7c454e5102c8b 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/ThrownEgg.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/ThrownEgg.java
@@ -86,6 +86,13 @@ public class ThrownEgg extends ThrowableItemProjectile {
@@ -88,6 +88,13 @@ public class ThrownEgg extends ThrowableItemProjectile {
}
}
// CraftBukkit end

Datei anzeigen

@ -7,10 +7,10 @@ Subject: [PATCH] Entity Jump API
public net.minecraft.world.entity.LivingEntity jumping
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 8ee6d25c3860fe7f2e5039c74c736d82eefda237..4c32b26e29ca3db0a2f62052e14bcc3e4c1cdea5 100644
index f720d4d93ed13b1b9287a1ee7dc8bc4794834e1a..304a401fb1f378ff2cbfd888acf56a8516f79310 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3433,8 +3433,10 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -3539,8 +3539,10 @@ public abstract class LivingEntity extends Entity implements Attackable {
} else if (this.isInLava() && (!this.onGround() || d3 > d4)) {
this.jumpInLiquid(FluidTags.LAVA);
} else if ((this.onGround() || flag && d3 <= d4) && this.noJumpDelay == 0) {
@ -22,10 +22,10 @@ index 8ee6d25c3860fe7f2e5039c74c736d82eefda237..4c32b26e29ca3db0a2f62052e14bcc3e
} else {
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
index 228cfb77e12ed5979e422dc5dbb5e8dcf363b509..8df42121aa22ec9f95a1b8627b64b0ff71e36314 100644
index 0b0887b7d2c69138617bee6ec3145f0a83b8734d..705c26ceff9371b09311bd7fa796c0efde7ebfee 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Panda.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Panda.java
@@ -541,7 +541,9 @@ public class Panda extends Animal {
@@ -530,7 +530,9 @@ public class Panda extends Animal {
Panda entitypanda = (Panda) iterator.next();
if (!entitypanda.isBaby() && entitypanda.onGround() && !entitypanda.isInWater() && entitypanda.canPerformAction()) {
@ -36,24 +36,24 @@ index 228cfb77e12ed5979e422dc5dbb5e8dcf363b509..8df42121aa22ec9f95a1b8627b64b0ff
}
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 4d91bc4b90a208fec789325dbcec8cc56d1a2a8b..aa4111eef22546f8aa630228c51ef5761c9b373b 100644
index 32973d9c7bf4c4105d7bd82d3723e0b70cd79644..c661ae4e5c07494c7de852cc8d01f0f9839c1590 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Ravager.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Ravager.java
@@ -160,7 +160,9 @@ public class Ravager extends Raider {
}
@@ -174,7 +174,9 @@ public class Ravager extends Raider {
}
if (!flag && this.onGround()) {
+ if (new com.destroystokyo.paper.event.entity.EntityJumpEvent(getBukkitLivingEntity()).callEvent()) { // Paper - Entity Jump API
this.jumpFromGround();
+ } else { this.setJumping(false); } // Paper - Entity Jump API; setJumping(false) stops a potential loop
if (!flag && this.onGround()) {
+ if (new com.destroystokyo.paper.event.entity.EntityJumpEvent(getBukkitLivingEntity()).callEvent()) { // Paper - Entity Jump API
this.jumpFromGround();
+ } else { this.setJumping(false); } // Paper - Entity Jump API; setJumping(false) stops a potential loop
}
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
index c0684f1864ece26b4f337ac615db04f615957c13..05ba1654ec02ff2b518251c128661e3d8dfa4c6d 100644
index c4c83b4e17aac23794fdb51acfba4e7ef8451e2c..81034513faa3bd4f306430bc48532ba671a7b94b 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -974,4 +974,20 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
@@ -993,4 +993,20 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
return org.bukkit.craftbukkit.CraftEquipmentSlot.getHand(this.getHandle().getUsedItemHand());
}
// Paper end - active item API

Datei anzeigen

@ -5,10 +5,10 @@ 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
index 9d56aff2766b684f0fb20e93d504de1a7a564b11..94242c19740ae6ab2c86e3949bab6cee631b938f 100644
index 463d34e7b54efd503c4879d1386b2439474863dd..fa80b6220aba144521dc0a2a35914c10046c1963 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -403,6 +403,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -406,6 +406,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
public void inactiveTick() { }
// Spigot end
protected int numCollisions = 0; // Paper - Cap entity collisions
@ -16,7 +16,7 @@ index 9d56aff2766b684f0fb20e93d504de1a7a564b11..94242c19740ae6ab2c86e3949bab6cee
public boolean spawnedViaMobSpawner; // Paper - Yes this name is similar to above, upstream took the better one
// Paper start - Entity origin API
@javax.annotation.Nullable
@@ -2282,6 +2283,9 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -2398,6 +2399,9 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
if (spawnedViaMobSpawner) {
nbttagcompound.putBoolean("Paper.FromMobSpawner", true);
}
@ -26,7 +26,7 @@ index 9d56aff2766b684f0fb20e93d504de1a7a564b11..94242c19740ae6ab2c86e3949bab6cee
// Paper end
return nbttagcompound;
} catch (Throwable throwable) {
@@ -2424,6 +2428,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -2541,6 +2545,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
}
spawnedViaMobSpawner = nbt.getBoolean("Paper.FromMobSpawner"); // Restore entity's from mob spawner status
@ -35,15 +35,17 @@ index 9d56aff2766b684f0fb20e93d504de1a7a564b11..94242c19740ae6ab2c86e3949bab6cee
String spawnReasonName = nbt.getString("Paper.SpawnReason");
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
index 8072e67f7b2f5944670159d3de1b01090bd1019d..a4e1c878dc7677e8ccc7c568ab455e85513d86cb 100644
index 5d4c0d7fec42bf843b11875f7a09bcb9279b3b54..dea13596eb8a3b7bc69c19545b2227b4c45ed241 100644
--- a/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java
@@ -88,6 +88,8 @@ public class NetherPortalBlock extends Block implements Portal {
@@ -89,6 +89,10 @@ public class NetherPortalBlock extends Block implements Portal {
if (entity != null) {
entity.setPortalCooldown();
+ 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 - Add option to nerf pigmen from nether portals
}
}
}
+ // Paper start - Add option to nerf pigmen from nether portals
+ entity.fromNetherPortal = true;
+ if (world.paperConfig().entities.behavior.nerfPigmenFromNetherPortals) ((net.minecraft.world.entity.Mob) entity).aware = false;
+ // Paper end - Add option to nerf pigmen from nether portals
Entity entity1 = entity.getVehicle();
if (entity1 != null) {

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] add hand to BlockMultiPlaceEvent
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index 8172a75aef7c3dcdd92817f148466a4cad4c78ed..235ac5c12dab593da3a40e348a010ff626ce74a3 100644
index 834516cac1f3ac5f078dd4e4dfa449f39462658c..41f23ce732b6e90828b1bbda7f4b3470cd462c4a 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -412,13 +412,18 @@ public class CraftEventFactory {
@@ -411,13 +411,18 @@ public class CraftEventFactory {
}
org.bukkit.inventory.ItemStack item;

Datei anzeigen

@ -5,10 +5,10 @@ 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
index bc4d324f086d815c139408629a561ea4d94c839b..8614fad5b3df7a6030384b108b1689bf6b9f1209 100644
index 1240f18b3d40f8bde2346c893304ae340a727e24..c2589f42c467ca672417c24076313da51bb2dcbb 100644
--- a/src/main/java/net/minecraft/world/level/block/TripWireHookBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/TripWireHookBlock.java
@@ -189,6 +189,7 @@ public class TripWireHookBlock extends Block {
@@ -191,6 +191,7 @@ public class TripWireHookBlock extends Block {
TripWireHookBlock.emitState(world, pos, flag4, flag5, flag2, flag3);
if (!flag) {

Datei anzeigen

@ -5,10 +5,10 @@ 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
index 615be0b85fb3d28a044c6bae6a0fe93ec4fca061..1807da10d07d1f6e4ddbc0fa1b8da34a688d67c3 100644
index dac63f51fc23cc7f35ee299d1e04c96c210db52b..e07b79ef172095c1800c88342b3ac8dc7703aea2 100644
--- a/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 {
@@ -319,7 +319,7 @@ public class IronGolem extends AbstractGolem implements NeutralMob {
BlockPos blockposition1 = blockposition.below();
BlockState iblockdata = world.getBlockState(blockposition1);

Datei anzeigen

@ -8,10 +8,10 @@ This allows you to solve an issue in vanilla behavior where:
* 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
index d981f8679149669f6ca4ea950d744149974532b2..e2a3978899497b6622829d6577cfaa723092da9d 100644
index 81d27114bd081096612e50a8cb93cae772cf46eb..2ed71c9a091bedea276f9043fb0c082dd250cdae 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Zombie.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Zombie.java
@@ -454,10 +454,8 @@ public class Zombie extends Monster {
@@ -484,10 +484,8 @@ public class Zombie extends Monster {
public boolean killedEntity(ServerLevel world, LivingEntity other) {
boolean flag = super.killedEntity(world, other);
@ -21,6 +21,6 @@ index d981f8679149669f6ca4ea950d744149974532b2..e2a3978899497b6622829d6577cfaa72
- }
+ 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 - Configurable chance of villager zombie infection
// CraftBukkit start
flag = Zombie.zombifyVillager(world, entityvillager, this.blockPosition(), this.isSilent(), CreatureSpawnEvent.SpawnReason.INFECTION) == null;
}
if (this.convertVillagerToZombieVillager(world, entityvillager)) {
flag = false;

Datei anzeigen

@ -8,10 +8,10 @@ faster on its own, however removing the try catch makes it
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
index 6775217c065026aa61fce56a17c93010209b6941..59f9ff720e92c69e11afe7f6ccecd81b0e54a74d 100644
index add5ec0f8e8bd0b89511dcb656e1d4cda702a86b..7181acfafad91aa5f6ab7ce663d9be4a1b65b02a 100644
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
@@ -270,18 +270,20 @@ public class LevelChunk extends ChunkAccess {
@@ -293,18 +293,20 @@ public class LevelChunk extends ChunkAccess {
}
public FluidState getFluidState(int x, int y, int z) {
@ -38,7 +38,7 @@ index 6775217c065026aa61fce56a17c93010209b6941..59f9ff720e92c69e11afe7f6ccecd81b
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.forThrowable(throwable, "Getting fluid state");
CrashReportCategory crashreportsystemdetails = crashreport.addCategory("Block being got");
@@ -291,6 +293,7 @@ public class LevelChunk extends ChunkAccess {
@@ -314,6 +316,7 @@ public class LevelChunk extends ChunkAccess {
});
throw new ReportedException(crashreport);
}
@ -47,10 +47,10 @@ index 6775217c065026aa61fce56a17c93010209b6941..59f9ff720e92c69e11afe7f6ccecd81b
// 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
index 2c153af611399e884752f8256bee4fe32de5c572..90d1c3e23e753c29660f7d993b3c90ac022941c3 100644
index 771529ba28a16664ad19ed9c0f4bf95eeb7da76b..52f44f14bbda60fe771c351e01e6ff470d7371e6 100644
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java
@@ -43,7 +43,7 @@ public class LevelChunkSection {
@@ -49,7 +49,7 @@ public class LevelChunkSection {
}
public FluidState getFluidState(int x, int y, int z) {

Datei anzeigen

@ -125,10 +125,10 @@ index 72f2e81b9905a0d57ed8e2a88578f62d5235c456..7b58b2d6297800c2dcdbf7539e5ab8e7
public static void registerCommands(final MinecraftServer server) {
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index ddc3da84c5a55d2cd977fcdb18121351606a6b3c..53bb62c1dcb487be915759d22e06aea80be54f36 100644
index 5f84618775d66d50557fa71f77fa322c2d1da791..708552756a33339ce9eefe48c9999a2ec08f7e1c 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -258,6 +258,11 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -264,6 +264,11 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
private int playerIdleTimeout;
private final long[] tickTimesNanos;
private long aggregatedTickTimesNanos;
@ -140,19 +140,19 @@ index ddc3da84c5a55d2cd977fcdb18121351606a6b3c..53bb62c1dcb487be915759d22e06aea8
@Nullable
private KeyPair keyPair;
@Nullable
@@ -1472,6 +1477,11 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.aggregatedTickTimesNanos += j;
this.tickTimesNanos[k] = j;
this.smoothedTickTimeMillis = this.smoothedTickTimeMillis * 0.8F + (float) j / (float) TimeUtil.NANOSECONDS_PER_MILLISECOND * 0.19999999F;
@@ -1538,6 +1543,11 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.aggregatedTickTimesNanos += k;
this.tickTimesNanos[l] = k;
this.smoothedTickTimeMillis = this.smoothedTickTimeMillis * 0.8F + (float) k / (float) TimeUtil.NANOSECONDS_PER_MILLISECOND * 0.19999999F;
+ // Paper start - Add tick times API and /mspt command
+ this.tickTimes5s.add(this.tickCount, j);
+ this.tickTimes10s.add(this.tickCount, j);
+ this.tickTimes60s.add(this.tickCount, j);
+ // Paper end - Add tick times API and /mspt command
this.logTickMethodTime(i);
this.profiler.pop();
org.spigotmc.WatchdogThread.tick(); // Spigot
@@ -2855,4 +2865,30 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
gameprofilerfiller.pop();
co.aikar.timings.TimingsManager.FULL_SERVER_TICK.stopTiming(); // Paper
@@ -2944,4 +2954,30 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
public static record ServerResourcePackInfo(UUID id, String url, String hash, boolean isRequired, @Nullable Component prompt) {
}
@ -184,13 +184,14 @@ index ddc3da84c5a55d2cd977fcdb18121351606a6b3c..53bb62c1dcb487be915759d22e06aea8
+ // Paper end - Add tick times API and /mspt command
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 9d07873c4a17549452ac8d9b6ac14d88cde185bc..0078d999c132e56c6af242718fc1b983caa8b147 100644
index 0a4cb8376d23e07e4b7a0620e536d87fef0cab11..daa2def7026579d75899cce6d33b91b7649ee076 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -2688,6 +2688,16 @@ public final class CraftServer implements Server {
@@ -2705,6 +2705,18 @@ public final class CraftServer implements Server {
return CraftMagicNumbers.INSTANCE;
}
+ // Paper start
+ @Override
+ public long[] getTickTimes() {
+ return this.getServer().tickTimes5s.getTimes();
@ -200,6 +201,7 @@ index 9d07873c4a17549452ac8d9b6ac14d88cde185bc..0078d999c132e56c6af242718fc1b983
+ public double getAverageTickTime() {
+ return this.getServer().tickTimes5s.getAverage();
+ }
+ // Paper end
+
// Spigot start
private final org.bukkit.Server.Spigot spigot = new org.bukkit.Server.Spigot()

Datei anzeigen

@ -6,10 +6,10 @@ Subject: [PATCH] Expose MinecraftServer#isRunning
This allows for plugins to detect if the server is actually turning off in onDisable rather than just plugins reloading.
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 0078d999c132e56c6af242718fc1b983caa8b147..7226c506c902fc94f27cc5d444e25882138759c2 100644
index daa2def7026579d75899cce6d33b91b7649ee076..f5b0aa5ee92b24fd53d83eb45df1a5dece10733f 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -2932,5 +2932,10 @@ public final class CraftServer implements Server {
@@ -2951,5 +2951,10 @@ public final class CraftServer implements Server {
public int getCurrentTick() {
return net.minecraft.server.MinecraftServer.currentTick;
}

Datei anzeigen

@ -6,7 +6,7 @@ Subject: [PATCH] Add Raw Byte ItemStack Serialization
Serializes using NBT which is safer for server data migrations than bukkits format.
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index 432f019afff36aa6143c052f7387a6c275a09de8..8b11f5f8cec74c57d614d73233a449c97cd56d18 100644
index d5038fb8720bfe39ffaf3fdea072c01487d315f9..180259d1e5401777e121a8c1ec95034afbc0917b 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -464,6 +464,53 @@ public final class CraftMagicNumbers implements UnsafeValues {

Datei anzeigen

@ -10,10 +10,10 @@ When not per player it will use the Vanilla mechanic of one delay per
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
index 4ccb5ba03d19223d25aee4cebd4b8bec2838a3e0..d4bda65d10bee880a341196364db63523f36e380 100644
index 099a9aa7e64da22e720fa527cac8750991ee8562..ea8279637a2af4d18c9decbf3342b058edeffd73 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -270,6 +270,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
@@ -297,6 +297,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
public boolean wonGame;
private int containerUpdateDelay; // Paper - Configurable container update tick rate
public long loginTime; // Paper - Replace OfflinePlayer#getLastPlayed
@ -22,7 +22,7 @@ index 4ccb5ba03d19223d25aee4cebd4b8bec2838a3e0..d4bda65d10bee880a341196364db6352
public boolean queueHealthUpdatePacket;
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
index 7b5db53d4cf97e41175896de47303526198fb8f6..1741360aa3f2409b1a8ddf1d4602ffe57651a586 100644
index 8837db46ced2412942949a3c6f81ec7d9a0bacda..e93ef232b0426a1095dad05fc4acb2a74db5b689 100644
--- a/src/main/java/net/minecraft/world/level/levelgen/PatrolSpawner.java
+++ b/src/main/java/net/minecraft/world/level/levelgen/PatrolSpawner.java
@@ -24,7 +24,7 @@ public class PatrolSpawner implements CustomSpawner {

Datei anzeigen

@ -6,10 +6,10 @@ Subject: [PATCH] Remote Connections shouldn't hold up shutdown
Bugs in the connection logic appears to leave stale connections even, preventing shutdown
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index b15cee6f21ff300b596922a8eed35a5f8a89fe22..d6dc8c983d26ce89f17a990be4284fdc78ad164b 100644
index 6d36c02d42e0b6e667d3076b1b455ba3adfde65b..82d5f1235d158326ce6fb1eb6d481c00f57467d3 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -416,11 +416,11 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
@@ -398,11 +398,11 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
}
if (this.rconThread != null) {

Datei anzeigen

@ -0,0 +1,22 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: chickeneer <emcchickeneer@gmail.com>
Date: Tue, 17 Mar 2020 14:18:50 -0500
Subject: [PATCH] Do not allow Vexes to load chunks
diff --git a/src/main/java/net/minecraft/world/entity/monster/Vex.java b/src/main/java/net/minecraft/world/entity/monster/Vex.java
index 1a5a61f3c6587992acadc83d5dff97ae2fe53235..183a33b7d666d652b455baa7e8339e9c4a870a58 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Vex.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Vex.java
@@ -354,7 +354,10 @@ public class Vex extends Monster implements TraceableEntity {
for (int i = 0; i < 3; ++i) {
BlockPos blockposition1 = blockposition.offset(Vex.this.random.nextInt(15) - 7, Vex.this.random.nextInt(11) - 5, Vex.this.random.nextInt(15) - 7);
- if (Vex.this.level().isEmptyBlock(blockposition1)) {
+ // Paper start - Don't load chunks
+ final net.minecraft.world.level.block.state.BlockState blockState = Vex.this.level().getBlockStateIfLoaded(blockposition1);
+ if (blockState != null && blockState.isAir()) {
+ // Paper end - Don't load chunks
Vex.this.moveControl.setWantedPosition((double) blockposition1.getX() + 0.5D, (double) blockposition1.getY() + 0.5D, (double) blockposition1.getZ() + 0.5D, 0.25D);
if (Vex.this.getTarget() == null) {
Vex.this.getLookControl().setLookAt((double) blockposition1.getX() + 0.5D, (double) blockposition1.getY() + 0.5D, (double) blockposition1.getZ() + 0.5D, 180.0F, 20.0F);

Datei anzeigen

@ -1,18 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
Date: Sun, 5 Jan 2020 17:24:34 -0600
Subject: [PATCH] Prevent bees loading chunks checking hive position
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 048d03c8ef3ef865641b2276477cf84e8d4397a1..58536ee8707c5ad0625cae2f26a58cf03b3f85d7 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Bee.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Bee.java
@@ -510,6 +510,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
} else if (this.isTooFarAway(this.hivePos)) {
return false;
} else {
+ if (this.level().getChunkIfLoadedImmediately(this.hivePos.getX() >> 4, this.hivePos.getZ() >> 4) == null) return true; // Paper - just assume the hive is still there, no need to load the chunk(s)
BlockEntity tileentity = this.level().getBlockEntity(this.hivePos);
return tileentity != null && tileentity.getType() == BlockEntityType.BEEHIVE;

Datei anzeigen

@ -1,52 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Spottedleaf <Spottedleaf@users.noreply.github.com>
Date: Fri, 27 Dec 2019 09:42:26 -0800
Subject: [PATCH] Guard against serializing mismatching chunk coordinate
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
index 47f5f3d58bb3bf85cf35f9baae77df7fab5c844f..0dd6f1bce4913cb84ba21a20df5573bab3a64645 100644
--- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java
@@ -88,8 +88,21 @@ public class ChunkSerializer {
public ChunkSerializer() {}
+ // Paper start - guard against serializing mismatching coordinates
+ // TODO Note: This needs to be re-checked each update
+ public static ChunkPos getChunkCoordinate(final CompoundTag chunkData) {
+ final int dataVersion = ChunkStorage.getVersion(chunkData);
+ if (dataVersion < 2842) { // Level tag is removed after this version
+ final CompoundTag levelData = chunkData.getCompound("Level");
+ return new ChunkPos(levelData.getInt("xPos"), levelData.getInt("zPos"));
+ } else {
+ return new ChunkPos(chunkData.getInt("xPos"), chunkData.getInt("zPos"));
+ }
+ }
+ // Paper end - guard against serializing mismatching coordinates
+
public static ProtoChunk read(ServerLevel world, PoiManager poiStorage, RegionStorageInfo key, ChunkPos chunkPos, CompoundTag nbt) {
- ChunkPos chunkcoordintpair1 = new ChunkPos(nbt.getInt("xPos"), nbt.getInt("zPos"));
+ 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)) {
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
index 3e194944e50f8395074d68d4abe4c084c3fadcc1..9aa9ab894080a5819fc45698771afd034906d36a 100644
--- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkStorage.java
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkStorage.java
@@ -172,6 +172,13 @@ public class ChunkStorage implements AutoCloseable {
}
public CompletableFuture<Void> write(ChunkPos chunkPos, CompoundTag nbt) {
+ // Paper start - guard against serializing mismatching coordinates
+ if (nbt != null && !chunkPos.equals(ChunkSerializer.getChunkCoordinate(nbt))) {
+ final 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
+ + " but compound says coordinate is " + ChunkSerializer.getChunkCoordinate(nbt) + (world == null ? " for an unknown world" : (" for world: " + world)));
+ }
+ // Paper end - guard against serializing mismatching coordinates
this.handleLegacyStructureIndex(chunkPos);
return this.worker.store(chunkPos, nbt);
}

Datei anzeigen

@ -1,58 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: chickeneer <emcchickeneer@gmail.com>
Date: Tue, 17 Mar 2020 14:18:50 -0500
Subject: [PATCH] Do not allow bees to load chunks for beehives
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 4134ee48909110f8c338f5d553d4cc1e9e31aaba..615b57fac9def18d9dcaefcfe397c74c11cac627 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Bee.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Bee.java
@@ -421,6 +421,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
if (this.hivePos == null) {
return false;
} else {
+ if (!this.level().isLoadedAndInBounds(this.hivePos)) return false; // Paper - Do not allow bees to load chunks for beehives
BlockEntity tileentity = this.level().getBlockEntity(this.hivePos);
return tileentity instanceof BeehiveBlockEntity && ((BeehiveBlockEntity) tileentity).isFireNearby();
@@ -454,6 +455,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
}
private boolean doesHiveHaveSpace(BlockPos pos) {
+ if (!this.level().isLoadedAndInBounds(pos)) return false; // Paper - Do not allow bees to load chunks for beehives
BlockEntity tileentity = this.level().getBlockEntity(pos);
return tileentity instanceof BeehiveBlockEntity ? !((BeehiveBlockEntity) tileentity).isFull() : false;
@@ -924,6 +926,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
@Override
public boolean canBeeUse() {
if (Bee.this.hasHive() && Bee.this.wantsToEnterHive() && Bee.this.hivePos.closerToCenterThan(Bee.this.position(), 2.0D)) {
+ if (!Bee.this.level().isLoadedAndInBounds(Bee.this.hivePos)) return false; // Paper - Do not allow bees to load chunks for beehives
BlockEntity tileentity = Bee.this.level().getBlockEntity(Bee.this.hivePos);
if (tileentity instanceof BeehiveBlockEntity) {
@@ -947,6 +950,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
@Override
public void start() {
+ if (!Bee.this.level().isLoadedAndInBounds(Bee.this.hivePos)) return; // Paper - Do not allow bees to load chunks for beehives
BlockEntity tileentity = Bee.this.level().getBlockEntity(Bee.this.hivePos);
if (tileentity instanceof BeehiveBlockEntity tileentitybeehive) {
diff --git a/src/main/java/net/minecraft/world/entity/monster/Vex.java b/src/main/java/net/minecraft/world/entity/monster/Vex.java
index d6f73c719d58970c6d13340f78c3303916b46546..2985296a9a034e535157f55e322fc8c107827752 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Vex.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Vex.java
@@ -356,7 +356,10 @@ public class Vex extends Monster implements TraceableEntity {
for (int i = 0; i < 3; ++i) {
BlockPos blockposition1 = blockposition.offset(Vex.this.random.nextInt(15) - 7, Vex.this.random.nextInt(11) - 5, Vex.this.random.nextInt(15) - 7);
- if (Vex.this.level().isEmptyBlock(blockposition1)) {
+ // Paper start - Don't load chunks
+ final net.minecraft.world.level.block.state.BlockState blockState = Vex.this.level().getBlockStateIfLoaded(blockposition1);
+ if (blockState != null && blockState.isAir()) {
+ // Paper end - Don't load chunks
Vex.this.moveControl.setWantedPosition((double) blockposition1.getX() + 0.5D, (double) blockposition1.getY() + 0.5D, (double) blockposition1.getZ() + 0.5D, 0.25D);
if (Vex.this.getTarget() == null) {
Vex.this.getLookControl().setLookAt((double) blockposition1.getX() + 0.5D, (double) blockposition1.getY() + 0.5D, (double) blockposition1.getZ() + 0.5D, 180.0F, 20.0F);