More more more more more more more more work

This commit is contained in:
Nassim Jahnke 2023-06-07 23:14:56 +02:00
parent c1f313b273
commit 838d8afd76
No known key found for this signature in database
GPG key ID: 6BE3B555EBC5982B
40 changed files with 199 additions and 214 deletions

View file

@ -2793,18 +2793,10 @@ index 4c62df5a3781ec9df4a5c5f1b528649e6e8a62d1..affd1b8c7589ba59330dc0b6fc803cce
}
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 8e35fecb84fb9ed61cb31d218f8a21bb7cabeb48..41c863a104d53b6c6feb4576d5b62cead229efec 100644
index 8e35fecb84fb9ed61cb31d218f8a21bb7cabeb48..584feb744bd2aa34f788de17d43c16a04c33a2c6 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java
@@ -185,6 +185,7 @@ public class SignBlockEntity extends BlockEntity implements CommandSource { // C
this.level.sendBlockUpdated(this.getBlockPos(), this.getBlockState(), this.getBlockState(), 3);
} else {
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
((ServerPlayer) player).connection.send(this.getUpdatePacket()); // CraftBukkit
}
}
@@ -208,20 +209,22 @@ public class SignBlockEntity extends BlockEntity implements CommandSource { // C
@@ -208,20 +208,22 @@ public class SignBlockEntity extends BlockEntity implements CommandSource { // C
// CraftBukkit start
Player player1 = ((ServerPlayer) player).getBukkitEntity();

View file

@ -47,7 +47,7 @@ index f47eeb70661661610ef1a96dd9da67785825c126..0ef3e9b472e35bd2572b04722781abf7
}
diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkWithLightPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkWithLightPacket.java
index aee73c4e20aff9bd0a560dc891f74f4f601c24b6..7825d6f0fdcfda6212cff8033ec55fb7db236154 100644
index 26e46d751c8f8162c2bafe2fc109fc91dc4b7c0f..ff42a3e76500ad6e087b7f1cd6ec45acde124180 100644
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkWithLightPacket.java
+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkWithLightPacket.java
@@ -57,4 +57,11 @@ public class ClientboundLevelChunkWithLightPacket implements Packet<ClientGamePa

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Call WhitelistToggleEvent when whitelist is toggled
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 06961cb5cf7c3e8898c93b4f4d0449e7c3edc4b4..9f855fcbc9be12f7542557e1c32248748fad14c3 100644
index 2aaa8b4f89ce5c2d2e3d931e1c16b630e7863cc4..84e26b03c74ae977dc53cf8f27b20a27fa7382d2 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -1150,6 +1150,7 @@ public abstract class PlayerList {
@@ -1157,6 +1157,7 @@ public abstract class PlayerList {
}
public void setUsingWhiteList(boolean whitelistEnabled) {

View file

@ -10,10 +10,10 @@ persistenting Living Entity, SPAWNER for spawners,
or DEFAULT since data was not stored.
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index e46f18e342f2e682c4d5bbac22187a171df8eb33..58c1769ea15249df950a40e2f164e2ff7aeb05bd 100644
index 7a1587ef175e075d7748604cf33db7e3d514479f..0601c61a66c7db633c6f26439eaf53ce73c3f585 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1288,6 +1288,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -1197,6 +1197,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
return true;
}
// Paper end
@ -22,10 +22,10 @@ index e46f18e342f2e682c4d5bbac22187a171df8eb33..58c1769ea15249df950a40e2f164e2ff
// Paper start
if (DEBUG_ENTITIES) {
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 9f855fcbc9be12f7542557e1c32248748fad14c3..e261521d526cb2192761a0432b28f82c83258540 100644
index 84e26b03c74ae977dc53cf8f27b20a27fa7382d2..a01f2f56fb8cd10475b7e42d0c7f75d0bc49c64a 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -226,6 +226,11 @@ public abstract class PlayerList {
@@ -233,6 +233,11 @@ public abstract class PlayerList {
worldserver1 = worldserver;
}
@ -34,10 +34,10 @@ index 9f855fcbc9be12f7542557e1c32248748fad14c3..e261521d526cb2192761a0432b28f82c
+ player.spawnReason = org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.DEFAULT; // set Player SpawnReason to DEFAULT on first login
+ }
+ // Paper end
player.setLevel(worldserver1);
player.setServerLevel(worldserver1);
String s1 = "local";
@@ -366,7 +371,7 @@ public abstract class PlayerList {
@@ -373,7 +378,7 @@ public abstract class PlayerList {
// CraftBukkit start
ServerLevel finalWorldServer = worldserver1;
Entity entity = EntityType.loadEntityRecursive(nbttagcompound1.getCompound("Entity"), finalWorldServer, (entity1) -> {
@ -47,7 +47,7 @@ index 9f855fcbc9be12f7542557e1c32248748fad14c3..e261521d526cb2192761a0432b28f82c
});
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 55658cdb2b5aca0bfebefc7fcec36aefe5f42e7b..7288d6d7f08b2e6b9696948d6c4451f479e419b6 100644
index 53559c8cbf6df35255cb231b5eaa6cd4d940bd84..08fa8e64af8074523c6e9478b443af38a97de65e 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -234,6 +234,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@ -58,7 +58,7 @@ index 55658cdb2b5aca0bfebefc7fcec36aefe5f42e7b..7288d6d7f08b2e6b9696948d6c4451f4
public com.destroystokyo.paper.loottable.PaperLootableInventoryData lootableData; // Paper
private CraftEntity bukkitEntity;
@@ -2062,6 +2063,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -2129,6 +2130,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
}
nbt.put("Paper.Origin", this.newDoubleList(origin.getX(), origin.getY(), origin.getZ()));
}
@ -68,7 +68,7 @@ index 55658cdb2b5aca0bfebefc7fcec36aefe5f42e7b..7288d6d7f08b2e6b9696948d6c4451f4
// Save entity's from mob spawner status
if (spawnedViaMobSpawner) {
nbt.putBoolean("Paper.FromMobSpawner", true);
@@ -2208,6 +2212,26 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -2275,6 +2279,26 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
}
spawnedViaMobSpawner = nbt.getBoolean("Paper.FromMobSpawner"); // Restore entity's from mob spawner status
@ -96,10 +96,10 @@ index 55658cdb2b5aca0bfebefc7fcec36aefe5f42e7b..7288d6d7f08b2e6b9696948d6c4451f4
} catch (Throwable throwable) {
diff --git a/src/main/java/net/minecraft/world/level/BaseSpawner.java b/src/main/java/net/minecraft/world/level/BaseSpawner.java
index 405f36e9e115ad44bb91aad885785761786204ca..091c72b95e3c4c3528812ace4aec64d451f25462 100644
index b5d605feff68181269f23d95d60a3ed555133d85..44b5b5cadad39cb20a44d7b1b73764568ac72f98 100644
--- a/src/main/java/net/minecraft/world/level/BaseSpawner.java
+++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java
@@ -185,6 +185,7 @@ public abstract class BaseSpawner {
@@ -186,6 +186,7 @@ public abstract class BaseSpawner {
// Spigot End
}
entity.spawnedViaMobSpawner = true; // Paper
@ -108,7 +108,7 @@ index 405f36e9e115ad44bb91aad885785761786204ca..091c72b95e3c4c3528812ace4aec64d4
// Spigot Start
if (org.bukkit.craftbukkit.event.CraftEventFactory.callSpawnerSpawnEvent(entity, pos).isCancelled()) {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
index c69f5192f11f8bf080d752971264a01bdb91a30f..02ef4c66b18edd2138a92b609f837664ec20a559 100644
index 18967257c5c217868a5356369e3e3b200044aa39..5d8532bc2c4253aa3941ff8c4d48cc8c3860b3b0 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -1303,5 +1303,10 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Implement PlayerPostRespawnEvent
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index e261521d526cb2192761a0432b28f82c83258540..9ea6ee5a04c14a2d1b178c36d34b118a43fa05b0 100644
index a01f2f56fb8cd10475b7e42d0c7f75d0bc49c64a..405d574f9515c8239faf1e7f996446fbb2c66e11 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -751,9 +751,14 @@ public abstract class PlayerList {
@@ -758,9 +758,14 @@ public abstract class PlayerList {
boolean flag2 = false;
@ -24,7 +24,7 @@ index e261521d526cb2192761a0432b28f82c83258540..9ea6ee5a04c14a2d1b178c36d34b118a
ServerLevel worldserver1 = this.server.getLevel(entityplayer.getRespawnDimension());
if (worldserver1 != null) {
Optional optional;
@@ -805,6 +810,7 @@ public abstract class PlayerList {
@@ -812,6 +817,7 @@ public abstract class PlayerList {
location = respawnEvent.getRespawnLocation();
if (!flag) entityplayer.reset(); // SPIGOT-4785
@ -32,7 +32,7 @@ index e261521d526cb2192761a0432b28f82c83258540..9ea6ee5a04c14a2d1b178c36d34b118a
} else {
location.setWorld(worldserver.getWorld());
}
@@ -864,6 +870,13 @@ public abstract class PlayerList {
@@ -871,6 +877,13 @@ public abstract class PlayerList {
if (entityplayer.connection.isDisconnected()) {
this.save(entityplayer);
}

View file

@ -6,7 +6,7 @@ Subject: [PATCH] don't go below 0 for pickupDelay, breaks picking up items
vanilla checks for == 0
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 298dff12c511e8b767d5a7ee14f94fe0745e5338..007625b1a121f1e7241f7cbfba0b1f168e8be5df 100644
index 04b4c7af20d6aa9924fb1d345f11cb51dcadc708..6938f996e7e6d394a54ef6dda2e09acb2021d87f 100644
--- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
+++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
@@ -121,6 +121,7 @@ public class ItemEntity extends Entity implements TraceableEntity {

View file

@ -6,10 +6,10 @@ Subject: [PATCH] Server Tick Events
Fires event at start and end of a server tick
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index d11ba8d081861b852bf74662d5e963ac89c226ca..b647007dc94e2ea416ce4dc659c8b2d623426979 100644
index 04b4173d33fc56e3ad3d958e7ffad967d4890bf0..9afe3e4af44ee0c648fcb8bd115809e358f07273 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1309,6 +1309,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1313,6 +1313,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
});
isOversleep = false;MinecraftTimings.serverOversleep.stopTiming();
// Paper end
@ -17,7 +17,7 @@ index d11ba8d081861b852bf74662d5e963ac89c226ca..b647007dc94e2ea416ce4dc659c8b2d6
++this.tickCount;
this.tickChildren(shouldKeepTicking);
@@ -1330,6 +1331,11 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1334,6 +1335,11 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.runAllTasks();
}
// Paper end

View file

@ -11,10 +11,10 @@ Example Usage: https://gist.github.com/aikar/5bb202de6057a051a950ce1f29feb0b4
public net.minecraft.world.entity.player.Inventory compartments
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 4a4c9bcfa24e116aa242de2cc4291cf4480331b1..dd2607bc1388bf59bed3635c336e733414bf8e96 100644
index 04ce33975b8ed83c3d803cd319228bcadf94f1de..ec841a36977c20389a8ab158b942d066e6cad346 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -806,6 +806,46 @@ public class ServerPlayer extends Player {
@@ -805,6 +805,46 @@ public class ServerPlayer extends Player {
});
}
@ -61,7 +61,7 @@ index 4a4c9bcfa24e116aa242de2cc4291cf4480331b1..dd2607bc1388bf59bed3635c336e7334
@Override
public void die(DamageSource damageSource) {
this.gameEvent(GameEvent.ENTITY_DIE);
@@ -889,7 +929,12 @@ public class ServerPlayer extends Player {
@@ -888,7 +928,12 @@ public class ServerPlayer extends Player {
this.dropExperience();
// we clean the player's inventory after the EntityDeathEvent is called so plugins can get the exact state of the inventory.
if (!event.getKeepInventory()) {

View file

@ -10,10 +10,10 @@ 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.
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index d0fe8a99163c924c44983a9a575bd76714865cab..24d167436dab54ad18875c3633b1246a21d63518 100644
index 1fa76e005c39698a48068baa430a9c1f48e1bb85..c0920dfe011ec9b3be1018df3e8b13bea16dee87 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -905,9 +905,12 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -893,9 +893,12 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@Nullable
public BlockEntity getBlockEntity(BlockPos blockposition, boolean validate) {
@ -26,5 +26,5 @@ index d0fe8a99163c924c44983a9a575bd76714865cab..24d167436dab54ad18875c3633b1246a
}
+ // Paper 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 && Thread.currentThread() != this.thread ? null : this.getChunkAt(blockposition).getBlockEntity(blockposition, LevelChunk.EntityCreationType.IMMEDIATE));
}

View file

@ -5,7 +5,7 @@ Subject: [PATCH] Add Heightmap API
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 4421392702304514c2cb26f32817ed150c9dc947..cb0c6578be38187dbc50aac116e70c492196b8e3 100644
index 728f9046648411580b81773f59ac6cf95a3053e7..706c0602047a16217541fb00ccd1a42c88061781 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -220,6 +220,29 @@ public class CraftWorld extends CraftRegionAccessor implements World {

View file

@ -9,10 +9,10 @@ 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
diff --git a/src/main/java/net/minecraft/world/level/BaseSpawner.java b/src/main/java/net/minecraft/world/level/BaseSpawner.java
index 091c72b95e3c4c3528812ace4aec64d451f25462..54a20433483d5b67a6668fcdbddc1654a246fee2 100644
index 44b5b5cadad39cb20a44d7b1b73764568ac72f98..65d78f1c93c98695e9a4369693f54751d3a69b25 100644
--- a/src/main/java/net/minecraft/world/level/BaseSpawner.java
+++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java
@@ -239,7 +239,13 @@ public abstract class BaseSpawner {
@@ -240,7 +240,13 @@ public abstract class BaseSpawner {
}
public void load(@Nullable Level world, BlockPos pos, CompoundTag nbt) {
@ -26,7 +26,7 @@ index 091c72b95e3c4c3528812ace4aec64d451f25462..54a20433483d5b67a6668fcdbddc1654
boolean flag = nbt.contains("SpawnData", 10);
if (flag) {
@@ -262,9 +268,15 @@ public abstract class BaseSpawner {
@@ -263,9 +269,15 @@ public abstract class BaseSpawner {
this.spawnPotentials = SimpleWeightedRandomList.single(this.nextSpawnData != null ? this.nextSpawnData : new SpawnData());
}
@ -44,7 +44,7 @@ index 091c72b95e3c4c3528812ace4aec64d451f25462..54a20433483d5b67a6668fcdbddc1654
this.spawnCount = nbt.getShort("SpawnCount");
}
@@ -281,9 +293,20 @@ public abstract class BaseSpawner {
@@ -282,9 +294,20 @@ public abstract class BaseSpawner {
}
public CompoundTag save(CompoundTag nbt) {

View file

@ -5,7 +5,7 @@ Subject: [PATCH] Fix CB call to changed postToMainThread method
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 9059b5c3cbb0f6cb0c9e6c6030929046225a87e2..4069debcda5afd68ba28c82174da9f33f55d7d18 100644
index 73af810aa0fe6c17244a23585a92e3cad97b7ab3..a8f154f5eb74b8a2a60f245144bcf9996cf5fe5e 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -515,7 +515,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic

View file

@ -6,10 +6,10 @@ Subject: [PATCH] Fix sounds when item frames are modified (MC-123450)
This also fixes the adding sound playing when the item frame direction is changed.
diff --git a/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java b/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java
index 8de89f5cdad9ad02670b09bb3bb5cf67714e7df5..70107774f12a996c0f64b46cb4c6af9c5f50aa61 100644
index a7ca700b9b1b3c09e9edd596d28e1123c211adc3..dc999068891bfdfd4873ca939b4c4389d63f4415 100644
--- a/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java
+++ b/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java
@@ -332,7 +332,7 @@ public class ItemFrame extends HangingEntity {
@@ -331,7 +331,7 @@ public class ItemFrame extends HangingEntity {
this.onItemChanged(itemstack);
this.getEntityData().set(ItemFrame.DATA_ITEM, itemstack);

View file

@ -50,7 +50,7 @@ index 0000000000000000000000000000000000000000..c5b07ec346105d1b95c1c938ffca12a2
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
index 2f01b47b9aa669bff551a3966a5a2caf0fee0de7..97f0f5fac4e1ddf1f39981687d08adf6a5662457 100644
index d6b44134781007d29f4042d5ab707188c965331b..90ec90acd6cfe0dcc677c7f26493fc8184cacca8 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
@@ -649,4 +649,16 @@ public class CraftBlock implements Block {

View file

@ -6,10 +6,10 @@ Subject: [PATCH] Configurable Keep Spawn Loaded range per world
This lets you disable it for some worlds and lower it for others.
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index b647007dc94e2ea416ce4dc659c8b2d623426979..9367b999e91d53b742fb161fd9131a2c99e35c6d 100644
index 9afe3e4af44ee0c648fcb8bd115809e358f07273..02287a932feb98341e4e9f76538abdb1649a07ec 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -740,31 +740,34 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -740,30 +740,33 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
// CraftBukkit start
public void prepareLevels(ChunkProgressListener worldloadlistener, ServerLevel worldserver) {
@ -26,7 +26,6 @@ index b647007dc94e2ea416ce4dc659c8b2d623426979..9367b999e91d53b742fb161fd9131a2c
- ServerChunkCache chunkproviderserver = worldserver.getChunkSource();
+ //ChunkProviderServer chunkproviderserver = worldserver.getChunkProvider(); // Paper - move up
chunkproviderserver.getLightEngine().setTaskPerBatch(500);
this.nextTickTime = Util.getMillis();
- // CraftBukkit start
- if (worldserver.getWorld().getKeepSpawnInMemory()) {
@ -54,28 +53,20 @@ index b647007dc94e2ea416ce4dc659c8b2d623426979..9367b999e91d53b742fb161fd9131a2c
if (true) {
ServerLevel worldserver1 = worldserver;
@@ -787,7 +790,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -786,7 +789,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
// this.nextTickTime = SystemUtils.getMillis() + 10L;
this.executeModerately();
// CraftBukkit end
- worldloadlistener.stop();
+ if (worldserver.getWorld().getKeepSpawnInMemory()) worldloadlistener.stop(); // Paper
chunkproviderserver.getLightEngine().setTaskPerBatch(5);
// CraftBukkit start
// this.updateMobSpawningFlags();
worldserver.setSpawnSettings(this.isSpawningMonsters(), this.isSpawningAnimals());
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 58c1769ea15249df950a40e2f164e2ff7aeb05bd..2a2e795923ecaa300c7fc26fd71444711bd43535 100644
index 0601c61a66c7db633c6f26439eaf53ce73c3f585..bfa12c4e44b089c4c1b03c7b8ec80774e29bd4ae 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -64,6 +64,7 @@ import net.minecraft.network.protocol.game.ClientboundSoundEntityPacket;
import net.minecraft.network.protocol.game.ClientboundSoundPacket;
import net.minecraft.network.protocol.game.DebugPackets;
import net.minecraft.resources.ResourceKey;
+import io.papermc.paper.util.MCUtil;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.ServerScoreboard;
import net.minecraft.server.level.progress.ChunkProgressListener;
@@ -1725,12 +1726,84 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -1634,12 +1634,84 @@ public class ServerLevel extends Level implements WorldGenLevel {
return ((MapIndex) this.getServer().overworld().getDataStorage().computeIfAbsent(MapIndex::load, MapIndex::new, "idcounts")).getFreeAuxValueForMap();
}
@ -200,10 +191,10 @@ index 4d2348df25410a0b5364eec066880326d6667dad..286aad3205ef8a9e21a47ef07893844f
this.maxCount = i * i;
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index cb0c6578be38187dbc50aac116e70c492196b8e3..901799f0d222b2f1934436467e73ff80c26aef4a 100644
index 706c0602047a16217541fb00ccd1a42c88061781..3a052597cacb898d6fc76b52ea984e5f2a534a6b 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -1344,15 +1344,21 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@@ -1354,15 +1354,21 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@Override
public void setKeepSpawnInMemory(boolean keepLoaded) {

View file

@ -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.
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 ddcc212ba83d9365adb842b3d3ced64e3d7dd155..584985272a02eb5b61a22cf2404fbd97a55a3358 100644
index 67a2f3c02aa4983b3ec2df073821190ddb36543c..a628dd4a380b5c5089ad528fadf12d7036258a25 100644
--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java
@@ -18,8 +18,12 @@ import java.nio.file.LinkOption;
@ -49,15 +49,15 @@ index ddcc212ba83d9365adb842b3d3ced64e3d7dd155..584985272a02eb5b61a22cf2404fbd97
import net.minecraft.world.level.ChunkPos;
import org.slf4j.Logger;
@@ -45,6 +49,7 @@ public class RegionFile implements AutoCloseable {
@@ -44,6 +48,7 @@ public class RegionFile implements AutoCloseable {
private final IntBuffer timestamps;
@VisibleForTesting
protected final RegionBitmap usedSectors;
public final java.util.concurrent.locks.ReentrantLock fileLock = new java.util.concurrent.locks.ReentrantLock(true); // Paper
+ public final Path regionFile; // Paper
public RegionFile(Path file, Path directory, boolean dsync) throws IOException {
this(file, directory, RegionFileVersion.VERSION_DEFLATE, dsync);
@@ -52,6 +57,8 @@ public class RegionFile implements AutoCloseable {
@@ -51,6 +56,8 @@ public class RegionFile implements AutoCloseable {
public RegionFile(Path file, Path directory, RegionFileVersion outputChunkStreamVersion, boolean dsync) throws IOException {
this.header = ByteBuffer.allocateDirect(8192);
@ -66,7 +66,7 @@ index ddcc212ba83d9365adb842b3d3ced64e3d7dd155..584985272a02eb5b61a22cf2404fbd97
this.usedSectors = new RegionBitmap();
this.version = outputChunkStreamVersion;
if (!Files.isDirectory(directory, new LinkOption[0])) {
@@ -430,6 +437,74 @@ public class RegionFile implements AutoCloseable {
@@ -420,6 +427,74 @@ public class RegionFile implements AutoCloseable {
}
@ -142,7 +142,7 @@ index ddcc212ba83d9365adb842b3d3ced64e3d7dd155..584985272a02eb5b61a22cf2404fbd97
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
index 1a1ade7538263f4c1a91eb122086a150af3d86ba..8f729134d8f024678f3f5927059791e28ccb5b90 100644
index e4c706d553a3d7058a32409ec7af8771c92d9777..b7a73c0d56e547db46f86a5d13cf6f1ee6cd3d09 100644
--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
@@ -11,8 +11,10 @@ import java.nio.file.Path;
@ -156,7 +156,7 @@ index 1a1ade7538263f4c1a91eb122086a150af3d86ba..8f729134d8f024678f3f5927059791e2
import net.minecraft.util.ExceptionCollector;
import net.minecraft.world.level.ChunkPos;
@@ -79,6 +81,71 @@ public class RegionFileStorage implements AutoCloseable {
@@ -52,6 +54,71 @@ public class RegionFileStorage implements AutoCloseable {
}
}
@ -228,8 +228,8 @@ index 1a1ade7538263f4c1a91eb122086a150af3d86ba..8f729134d8f024678f3f5927059791e2
@Nullable
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
@@ -90,6 +157,12 @@ public class RegionFileStorage implements AutoCloseable {
try { // Paper
@@ -62,6 +129,12 @@ public class RegionFileStorage implements AutoCloseable {
// CraftBukkit end
DataInputStream datainputstream = regionfile.getChunkDataInputStream(pos);
+ // Paper start
@ -241,7 +241,7 @@ index 1a1ade7538263f4c1a91eb122086a150af3d86ba..8f729134d8f024678f3f5927059791e2
CompoundTag nbttagcompound;
label43:
{
@@ -176,6 +249,7 @@ public class RegionFileStorage implements AutoCloseable {
@@ -139,6 +212,7 @@ public class RegionFileStorage implements AutoCloseable {
try {
NbtIo.write(nbt, (DataOutput) dataoutputstream);

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Expose the internal current tick
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 03a175ce27f7d816ce1f157f41674cd4dbcc5fe2..ca20401d795af96f6d8b9f1c10c854e8355e6899 100644
index 9020f6ab2391e67670333bb4bdf0125cd392f4ee..621ac87b0ae04d3a2decc1f653b346978946577d 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -2732,5 +2732,10 @@ public final class CraftServer implements Server {
@@ -2730,5 +2730,10 @@ public final class CraftServer implements Server {
profile.getProperties().putAll(((CraftPlayer)player).getHandle().getGameProfile().getProperties());
return new com.destroystokyo.paper.profile.CraftPlayerProfile(profile);
}

View file

@ -8,11 +8,11 @@ This patch also adds a chunk status cache on region files (note that
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
index 27b646341bdae8918649c5e9fdf05708638ad835..299c7c60edf491cc44e609517474d8247fb6c724 100644
index 74fcf9debaebd5c99c2c06dfc5e169261da284de..d28710dca4b9e8110f85e5e9412fd8f29b3425fe 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -674,9 +674,13 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
// Paper end
@@ -1170,9 +1170,13 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}
private CompletableFuture<Optional<CompoundTag>> readChunk(ChunkPos chunkPos) {
- return this.read(chunkPos).thenApplyAsync((optional) -> {
@ -28,7 +28,7 @@ index 27b646341bdae8918649c5e9fdf05708638ad835..299c7c60edf491cc44e609517474d824
}
// CraftBukkit start
@@ -685,6 +689,63 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1181,6 +1185,63 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
// CraftBukkit end
}
@ -93,11 +93,11 @@ index 27b646341bdae8918649c5e9fdf05708638ad835..299c7c60edf491cc44e609517474d824
// Spigot start
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
index 584985272a02eb5b61a22cf2404fbd97a55a3358..cda87a66fe80bf910f629c64e36c1fecbad81d77 100644
index a628dd4a380b5c5089ad528fadf12d7036258a25..307cfa108c9ccb2012327910f8fe31b6a155761a 100644
--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java
@@ -51,6 +51,30 @@ public class RegionFile implements AutoCloseable {
public final java.util.concurrent.locks.ReentrantLock fileLock = new java.util.concurrent.locks.ReentrantLock(true); // Paper
@@ -50,6 +50,30 @@ public class RegionFile implements AutoCloseable {
protected final RegionBitmap usedSectors;
public final Path regionFile; // Paper
+ // Paper start - Cache chunk status
@ -127,7 +127,7 @@ index 584985272a02eb5b61a22cf2404fbd97a55a3358..cda87a66fe80bf910f629c64e36c1fec
public RegionFile(Path file, Path directory, boolean dsync) throws IOException {
this(file, directory, RegionFileVersion.VERSION_DEFLATE, dsync);
}
@@ -398,6 +422,7 @@ public class RegionFile implements AutoCloseable {
@@ -397,11 +421,13 @@ public class RegionFile implements AutoCloseable {
return this.getOffset(pos) != 0;
}
@ -135,19 +135,17 @@ index 584985272a02eb5b61a22cf2404fbd97a55a3358..cda87a66fe80bf910f629c64e36c1fec
private static int getOffsetIndex(ChunkPos pos) {
return pos.getRegionLocalX() + pos.getRegionLocalZ() * 32;
}
@@ -408,6 +433,7 @@ public class RegionFile implements AutoCloseable {
synchronized (this) {
try {
// Paper end
public void close() throws IOException {
+ this.closed = true; // Paper
try {
this.padToFullSector();
} 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
index 8f729134d8f024678f3f5927059791e28ccb5b90..b294ef87fb93e7f4651dc04128124f297575860d 100644
index b7a73c0d56e547db46f86a5d13cf6f1ee6cd3d09..867755f9a2c1245f9e3ec0028abee4b798c8b2d4 100644
--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
@@ -249,6 +249,7 @@ public class RegionFileStorage implements AutoCloseable {
@@ -212,6 +212,7 @@ public class RegionFileStorage implements AutoCloseable {
try {
NbtIo.write(nbt, (DataOutput) dataoutputstream);
@ -156,7 +154,7 @@ index 8f729134d8f024678f3f5927059791e28ccb5b90..b294ef87fb93e7f4651dc04128124f29
} catch (Throwable throwable) {
if (dataoutputstream != null) {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 901799f0d222b2f1934436467e73ff80c26aef4a..87efc9c4d63b7c413b37f1a1a58100bf17615509 100644
index 3a052597cacb898d6fc76b52ea984e5f2a534a6b..76054a4fc036b1f9577aa8da215388c5137f3611 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -308,9 +308,23 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@ -185,7 +183,7 @@ index 901799f0d222b2f1934436467e73ff80c26aef4a..87efc9c4d63b7c413b37f1a1a58100bf
throw new RuntimeException(ex);
}
}
@@ -424,20 +438,48 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@@ -421,20 +435,48 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@Override
public boolean loadChunk(int x, int z, boolean generate) {
org.spigotmc.AsyncCatcher.catchOp("chunk load"); // Spigot

View file

@ -25,15 +25,15 @@ P3) Solutions for 1) and especially 2) might not be future-proof, while this
server-internal fix makes this change future-proof.
diff --git a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
index a85175190c1ebb14b496a0bfe2f7136e06d0072c..ae0e422ee7e1dcf01b4c7b64b23afdbbbe19819e 100644
index e5da57b35cd82ee7b4e844cfe74289a71d38779a..62b111b83dedd145d678e592b9ffdc286bfb7486 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
@@ -164,7 +164,7 @@ public abstract class Projectile extends Entity implements TraceableEntity {
@@ -165,7 +165,7 @@ public abstract class Projectile extends Entity implements TraceableEntity {
this.shoot((double) f5, (double) f6, (double) f7, speed, divergence);
Vec3 vec3d = shooter.getDeltaMovement();
- this.setDeltaMovement(this.getDeltaMovement().add(vec3d.x, shooter.isOnGround() ? 0.0D : vec3d.y, vec3d.z));
+ if (!shooter.level.paperConfig().misc.disableRelativeProjectileVelocity) this.setDeltaMovement(this.getDeltaMovement().add(vec3d.x, shooter.isOnGround() ? 0.0D : vec3d.y, vec3d.z)); // Paper - allow disabling relative velocity
- this.setDeltaMovement(this.getDeltaMovement().add(vec3d.x, shooter.onGround() ? 0.0D : vec3d.y, vec3d.z));
+ if (!shooter.level.paperConfig().misc.disableRelativeProjectileVelocity) this.setDeltaMovement(this.getDeltaMovement().add(vec3d.x, shooter.onGround() ? 0.0D : vec3d.y, vec3d.z)); // Paper - allow disabling relative velocity
}
// CraftBukkit start - call projectile hit event

View file

@ -5,10 +5,10 @@ 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
index 46946473713f08ef0304a49b017a8970f1957e88..f7d031e9a5aa533d78a49ed6147dd47dd0f27f01 100644
index 760e9e96cb567861f40a0b3debb58dc867be4026..d19bf87596e574150c7ebd58c9a132363f5f1e54 100644
--- a/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java
@@ -39,7 +39,7 @@ public abstract class HangingEntity extends Entity {
@@ -38,7 +38,7 @@ public abstract class HangingEntity extends Entity {
protected static final Predicate<Entity> HANGING_ENTITY = (entity) -> {
return entity instanceof HangingEntity;
};

View file

@ -7,10 +7,10 @@ The problem was we were checking isExpired() on the entry, but if it
was expired at that point, then it would be null.
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 9ea6ee5a04c14a2d1b178c36d34b118a43fa05b0..4efa85f9c18927248dc2397df0bd3cd0a9063347 100644
index 405d574f9515c8239faf1e7f996446fbb2c66e11..94fbe7f2b0f18c3a533de3a4e486e985aa6f5153 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -635,8 +635,10 @@ public abstract class PlayerList {
@@ -642,8 +642,10 @@ public abstract class PlayerList {
Player player = entity.getBukkitEntity();
PlayerLoginEvent event = new PlayerLoginEvent(player, loginlistener.connection.hostname, ((java.net.InetSocketAddress) socketaddress).getAddress(), ((java.net.InetSocketAddress) loginlistener.connection.channel.remoteAddress()).getAddress());

View file

@ -5,10 +5,10 @@ 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
index 69fbbd2745008e2d9caf6a30dd0779339e1c685b..5eaedecd2e53bcdc30defbf56d6a70a0c49f03ec 100644
index 724e4a870d0bbe4c1895ea6a745972ebdd9f5c52..f565b9a3643d0b457d10cc8a909aa975994f77fc 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3609,9 +3609,14 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -3658,9 +3658,14 @@ public abstract class LivingEntity extends Entity implements Attackable {
}
public void startUsingItem(InteractionHand hand) {
@ -23,23 +23,23 @@ index 69fbbd2745008e2d9caf6a30dd0779339e1c685b..5eaedecd2e53bcdc30defbf56d6a70a0
+ if (!itemstack.isEmpty() && !this.isUsingItem() || forceUpdate) { // Paper use override flag
this.useItem = itemstack;
this.useItemRemaining = itemstack.getUseDuration();
if (!this.level.isClientSide) {
@@ -3691,6 +3696,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
if (!this.level().isClientSide) {
@@ -3740,6 +3745,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
this.releaseUsingItem();
} else {
if (!this.useItem.isEmpty() && this.isUsingItem()) {
+ this.startUsingItem(this.getUsedItemHand(), true); // Paper
+ this.startUsingItem(this.getUsedItemHand(), true); // Paper
this.triggerItemUseEffects(this.useItem, 16);
// CraftBukkit start - fire PlayerItemConsumeEvent
ItemStack itemstack;
@@ -3726,8 +3732,8 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -3774,8 +3780,8 @@ public abstract class LivingEntity extends Entity implements Attackable {
}
this.stopUsingItem();
- // Paper start - if the replacement is anything but the default, update the client inventory
- if (this instanceof ServerPlayer && !com.google.common.base.Objects.equal(defaultReplacement, itemstack)) {
+ // Paper start
+ if (this instanceof ServerPlayer) {
((ServerPlayer) this).getBukkitEntity().updateInventory();
}
// Paper end
- // Paper start - if the replacement is anything but the default, update the client inventory
- if (this instanceof ServerPlayer && !com.google.common.base.Objects.equal(defaultReplacement, itemstack)) {
+ // Paper start
+ if (this instanceof ServerPlayer) {
((ServerPlayer) this).getBukkitEntity().updateInventory();
}
// Paper end

View file

@ -0,0 +1,18 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Nassim Jahnke <nassim@njahnke.dev>
Date: Sat, 11 Sep 2021 11:56:51 +0200
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
index 584feb744bd2aa34f788de17d43c16a04c33a2c6..41c863a104d53b6c6feb4576d5b62cead229efec 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java
@@ -185,6 +185,7 @@ public class SignBlockEntity extends BlockEntity implements CommandSource { // C
this.level.sendBlockUpdated(this.getBlockPos(), this.getBlockState(), this.getBlockState(), 3);
} else {
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
((ServerPlayer) player).connection.send(this.getUpdatePacket()); // CraftBukkit
}
}

View file

@ -114,11 +114,11 @@ index 06e1774dfbb667aca69bc30c9675ed472cb5728c..1d5bc86516df3781aea894c3afd34042
public static SurfaceRules.RuleSource end() {
diff --git a/src/main/java/net/minecraft/server/Bootstrap.java b/src/main/java/net/minecraft/server/Bootstrap.java
index ac2b7b5161eaaca3620268ae865d6f2a80227fde..a1192d1f6b99669f843e8d9a8928ff0e8c030559 100644
index e6e2c63b19d010569fb70b629188be3eec28025d..e2393e31a008c78e7a593c1e36fc7fd40a443c73 100644
--- a/src/main/java/net/minecraft/server/Bootstrap.java
+++ b/src/main/java/net/minecraft/server/Bootstrap.java
@@ -71,6 +71,7 @@ public class Bootstrap {
CauldronInteraction.bootStrap();
@@ -79,6 +79,7 @@ public class Bootstrap {
BuiltInRegistries.bootStrap();
// Paper start
BuiltInRegistries.bootStrap(() -> {
+ net.minecraft.core.Registry.register(net.minecraft.core.registries.BuiltInRegistries.MATERIAL_CONDITION, new net.minecraft.resources.ResourceLocation("paper", "bedrock_condition_source"), net.minecraft.data.worldgen.SurfaceRuleData.PaperBedrockConditionSource.CODEC.codec());
@ -126,7 +126,7 @@ index ac2b7b5161eaaca3620268ae865d6f2a80227fde..a1192d1f6b99669f843e8d9a8928ff0e
});
// 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
index 4f3387d1b128bc98614cfabfb5306781bdcd93be..0d8fd4eaf912eb4d40bb9f600dd2a8d5c21ab572 100644
index 54308f1decc3982f30bf8b7a8a9d8865bfdbb9fd..0fca35ac82a1854260980b7c2664be82033e3bad 100644
--- a/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 {

View file

@ -5,7 +5,7 @@ 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
index 638942d54c6ea2d305350a330ac9fb8b82294f53..7f4fb6ad4b3b3da52a111b0c58499f27d8443124 100644
index 0dad5be671f990d0edf0a155e2534b3812438902..63cd37a5e1a44cae269c9f25e1b6a730bc265de8 100644
--- 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
@@ -38,6 +38,7 @@ public class NearestAttackableTargetGoal<T extends LivingEntity> extends TargetG
@ -17,7 +17,7 @@ index 638942d54c6ea2d305350a330ac9fb8b82294f53..7f4fb6ad4b3b3da52a111b0c58499f27
@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
index 9f65f6cdbcc054bde03c42d7d3b16f65b93e5deb..a7575b5ef56af6f53448d391abb4956e130148ca 100644
index f29823f2e8a54bd4e81e2940b5c505b152f23e88..58422f00c7d64dbd1cf6d7211c9838875cbe7778 100644
--- a/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 {

View file

@ -33,10 +33,10 @@ But for those who are ok with leaving this inconsistent behavior, you may use WA
It is recommended you regenerate the entities, as these were legit entities, and deserve your love.
diff --git a/src/main/java/io/papermc/paper/chunk/system/ChunkSystem.java b/src/main/java/io/papermc/paper/chunk/system/ChunkSystem.java
index 0dc94dec1317b3f86d38074c6cbe41ab828cab1d..0e45a340ae534caf676b7f9d0adcbcee5829925e 100644
index 8a5e93961dac4d87c81c0e70b6f4124a1f1d2556..bb5870e5f6949790e97cde83665caac8c384ccd2 100644
--- a/src/main/java/io/papermc/paper/chunk/system/ChunkSystem.java
+++ b/src/main/java/io/papermc/paper/chunk/system/ChunkSystem.java
@@ -73,7 +73,17 @@ public final class ChunkSystem {
@@ -223,7 +223,17 @@ public final class ChunkSystem {
}
public static void onEntityPreAdd(final ServerLevel level, final Entity entity) {
@ -56,10 +56,10 @@ index 0dc94dec1317b3f86d38074c6cbe41ab828cab1d..0e45a340ae534caf676b7f9d0adcbcee
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
index 299c7c60edf491cc44e609517474d8247fb6c724..430be10a2b0487dc26f21793592ca08d01a39e53 100644
index d28710dca4b9e8110f85e5e9412fd8f29b3425fe..97f8336108b1b96a99eb5e5650feb5832aee89fa 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -537,6 +537,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -874,6 +874,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
entity.discard();
needsRemoval = true;
}
@ -67,8 +67,8 @@ index 299c7c60edf491cc44e609517474d8247fb6c724..430be10a2b0487dc26f21793592ca08d
return !needsRemoval;
}));
// CraftBukkit end
@@ -548,6 +549,49 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
throw new UnsupportedOperationException(); // Paper - rewrite chunk system
@@ -924,6 +925,49 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
});
}
+ // Paper start
@ -115,5 +115,5 @@ index 299c7c60edf491cc44e609517474d8247fb6c724..430be10a2b0487dc26f21793592ca08d
+ }
+ // Paper end
public CompletableFuture<Either<LevelChunk, ChunkHolder.ChunkLoadingFailure>> prepareTickingChunk(ChunkHolder holder) {
throw new UnsupportedOperationException(); // Paper - rewrite chunk system
}
CompletableFuture<Either<List<ChunkAccess>, ChunkHolder.ChunkLoadingFailure>> completablefuture = this.getChunkRangeFuture(holder, 1, (i) -> {
return ChunkStatus.FULL;

View file

@ -5,10 +5,10 @@ Subject: [PATCH] PlayerDeathEvent#shouldDropExperience
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index dd2607bc1388bf59bed3635c336e733414bf8e96..c93ede55cdd575f0c928bc9bf90c47480e52f91b 100644
index ec841a36977c20389a8ab158b942d066e6cad346..47d4fa864531684135dc1856ae9a4ff76c0328bd 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -926,7 +926,7 @@ public class ServerPlayer extends Player {
@@ -925,7 +925,7 @@ public class ServerPlayer extends Player {
this.tellNeutralMobsThatIDied();
}
// SPIGOT-5478 must be called manually now

View file

@ -5,14 +5,14 @@ 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 f7bd3e5b30b19e56d16fbc86f40dc851da99c63b..78fe610d69db727411bf685127c39d009090ee14 100644
index 17d8332356c9611d6a4b1ea2c8e160b46fa704ba..b4d5a33bfc5616d69a3570c99ea0af52397f8ffb 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Bee.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Bee.java
@@ -498,6 +498,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
@@ -497,6 +497,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
} else if (this.isTooFarAway(this.hivePos)) {
return false;
} else {
+ if (level.getChunkIfLoadedImmediately(hivePos.getX() >> 4, 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);
+ 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;

View file

@ -6,12 +6,12 @@ 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 2a2e795923ecaa300c7fc26fd71444711bd43535..dcdf59d18c0336f766bd320b2d536c115df3435d 100644
index bfa12c4e44b089c4c1b03c7b8ec80774e29bd4ae..a4a48f602010b88423cc8135c98d416b26640022 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -424,6 +424,15 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -326,6 +326,15 @@ public class ServerLevel extends Level implements WorldGenLevel {
}
// Paper end - rewrite chunk system
// Paper end
+ // Paper start - optimise getPlayerByUUID
+ @Nullable
@ -23,5 +23,5 @@ index 2a2e795923ecaa300c7fc26fd71444711bd43535..dcdf59d18c0336f766bd320b2d536c11
+ // Paper end
+
// 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, 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) {
// IRegistryCustom.Dimension iregistrycustom_dimension = minecraftserver.registryAccess(); // CraftBukkit - decompile error

View file

@ -15,23 +15,23 @@ 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 007625b1a121f1e7241f7cbfba0b1f168e8be5df..6836288bd380651007f3aa76e608767f612f6644 100644
index 6938f996e7e6d394a54ef6dda2e09acb2021d87f..b85d0c7252a32210e4cb29c3e4fff4c080537451 100644
--- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
+++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
@@ -149,7 +149,7 @@ public class ItemEntity extends Entity implements TraceableEntity {
}
}
- 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
- 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());
float f1 = 0.98F;
diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java
index e2dfc4d9a16a738dd0fe91838603e1d4370afa56..08bf9f85fe02a3f89640a2f3ae23089a119a394a 100644
index 66dbfabdb104d272d48588a4773d198d3938f1ef..9527b702fa823f00852e409a53cae772943dbe09 100644
--- a/src/main/java/org/spigotmc/ActivationRange.java
+++ b/src/main/java/org/spigotmc/ActivationRange.java
@@ -257,7 +257,7 @@ public class ActivationRange
@@ -251,7 +251,7 @@ public class ActivationRange
isActive = true;
}
// Add a little performance juice to active entities. Skip 1/4 if not immune.

View file

@ -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
index e09e6be4f7c8b6c3761b38e181e4c0288a5c1871..83b2b56dbb6d74b58c43bf375ae7d1df9805037b 100644
index 401076c5350429052994d98c414a83a21f908010..75d827f1eecb24f7ab985bdea2bbf65b8478fc8c 100644
--- a/src/main/java/net/minecraft/world/level/Explosion.java
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
@@ -168,7 +168,7 @@ public class Explosion {

View file

@ -9,10 +9,10 @@ dispensed. The resulting item would have size == 0 and therefore
be convertered to air, hence why the effects disappeared.
diff --git a/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java b/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java
index 18e746e064f8e39e070a51218357f54c6b16fb7b..abd20f9495c315e73c1eb6572b8fc47db27450d7 100644
index b13944a7a688ed9013e4c7dfdad6523738b9c35c..cec6ee5d31f2a86a61fd142035af853fa512e211 100644
--- a/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java
+++ b/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java
@@ -516,7 +516,7 @@ public interface DispenseItemBehavior {
@@ -515,7 +515,7 @@ public interface DispenseItemBehavior {
}
itemstack1 = CraftItemStack.asNMSCopy(event.getItem());

View file

@ -18,7 +18,7 @@ public net.minecraft.world.entity.Entity isInsidePortal
public net.minecraft.world.entity.LivingEntity jumping
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index dcdf59d18c0336f766bd320b2d536c115df3435d..5ad746ae673ef09f5581cf9fbbf1c9afa0ff0cd9 100644
index a4a48f602010b88423cc8135c98d416b26640022..af663f9318dceac52ad7b7fb71a1020208bbc5ee 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -2,7 +2,6 @@ package net.minecraft.server.level;
@ -29,7 +29,7 @@ index dcdf59d18c0336f766bd320b2d536c115df3435d..5ad746ae673ef09f5581cf9fbbf1c9af
import com.google.common.collect.Lists;
import com.mojang.datafixers.DataFixer;
import com.mojang.datafixers.util.Pair;
@@ -1046,17 +1045,17 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -956,17 +955,17 @@ public class ServerLevel extends Level implements WorldGenLevel {
++TimingHistory.entityTicks; // Paper - timings
// Spigot start
co.aikar.timings.Timing timer; // Paper
@ -51,7 +51,7 @@ index dcdf59d18c0336f766bd320b2d536c115df3435d..5ad746ae673ef09f5581cf9fbbf1c9af
try {
// Paper end - timings
entity.setOldPosAndRot();
@@ -1067,9 +1066,13 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -977,9 +976,13 @@ public class ServerLevel extends Level implements WorldGenLevel {
return BuiltInRegistries.ENTITY_TYPE.getKey(entity.getType()).toString();
});
gameprofilerfiller.incrementCounter("tickNonPassenger");
@ -65,7 +65,7 @@ index dcdf59d18c0336f766bd320b2d536c115df3435d..5ad746ae673ef09f5581cf9fbbf1c9af
Iterator iterator = entity.getPassengers().iterator();
while (iterator.hasNext()) {
@@ -1077,13 +1080,18 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -987,13 +990,18 @@ public class ServerLevel extends Level implements WorldGenLevel {
this.tickPassenger(entity, entity1);
}
@ -85,7 +85,7 @@ index dcdf59d18c0336f766bd320b2d536c115df3435d..5ad746ae673ef09f5581cf9fbbf1c9af
passenger.setOldPosAndRot();
++passenger.tickCount;
ProfilerFiller gameprofilerfiller = this.getProfiler();
@@ -1092,8 +1100,17 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -1002,8 +1010,17 @@ public class ServerLevel extends Level implements WorldGenLevel {
return BuiltInRegistries.ENTITY_TYPE.getKey(passenger.getType()).toString();
});
gameprofilerfiller.incrementCounter("tickPassenger");
@ -103,7 +103,7 @@ index dcdf59d18c0336f766bd320b2d536c115df3435d..5ad746ae673ef09f5581cf9fbbf1c9af
gameprofilerfiller.pop();
Iterator iterator = passenger.getPassengers().iterator();
@@ -1103,6 +1120,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -1013,6 +1030,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
this.tickPassenger(passenger, entity2);
}
@ -112,10 +112,10 @@ index dcdf59d18c0336f766bd320b2d536c115df3435d..5ad746ae673ef09f5581cf9fbbf1c9af
} else {
passenger.stopRiding();
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 7288d6d7f08b2e6b9696948d6c4451f479e419b6..8be765356261190a070715effbcaadfc83ab6c9c 100644
index 08fa8e64af8074523c6e9478b443af38a97de65e..5ec0f3304b2ef352e3cdd73974716b1a18bb26e9 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -386,6 +386,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -390,6 +390,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
public void inactiveTick() { }
// Spigot end
// Paper start
@ -124,7 +124,7 @@ index 7288d6d7f08b2e6b9696948d6c4451f479e419b6..8be765356261190a070715effbcaadfc
protected int numCollisions = 0; // Paper
public boolean spawnedViaMobSpawner; // Paper - Yes this name is similar to above, upstream took the better one
@javax.annotation.Nullable
@@ -911,6 +913,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -910,6 +912,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
} else {
this.wasOnFire = this.isOnFire();
if (movementType == MoverType.PISTON) {
@ -133,7 +133,7 @@ index 7288d6d7f08b2e6b9696948d6c4451f479e419b6..8be765356261190a070715effbcaadfc
movement = this.limitPistonMovement(movement);
if (movement.equals(Vec3.ZERO)) {
return;
@@ -923,6 +927,13 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -922,6 +926,13 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
this.stuckSpeedMultiplier = Vec3.ZERO;
this.setDeltaMovement(Vec3.ZERO);
}
@ -148,10 +148,10 @@ index 7288d6d7f08b2e6b9696948d6c4451f479e419b6..8be765356261190a070715effbcaadfc
movement = this.maybeBackOffFromEdge(movement, movementType);
Vec3 vec3d1 = this.collide(movement);
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
index dbf442e9686e59723ed0456f97e472cc663f8cc7..fa9cc50488d5044e13a97fb4aa9269fec999ad88 100644
index b60714796725ba3dc0a17ff4ca7df8b344e838da..382bf998dba1fac7e4e4e93f8c262dc39ce6e459 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -215,6 +215,19 @@ public abstract class Mob extends LivingEntity implements Targeting {
@@ -218,6 +218,19 @@ public abstract class Mob extends LivingEntity implements Targeting {
return this.lookControl;
}
@ -172,7 +172,7 @@ index dbf442e9686e59723ed0456f97e472cc663f8cc7..fa9cc50488d5044e13a97fb4aa9269fe
Entity entity = this.getControlledVehicle();
diff --git a/src/main/java/net/minecraft/world/entity/PathfinderMob.java b/src/main/java/net/minecraft/world/entity/PathfinderMob.java
index 6ae3f5cd42dfd424fc3741957995f47ad5ec8941..bffec7fdf49994f702ea4c378237dac0983d0a19 100644
index d8ce7ea5fcb2785435ec1f530cb6e7114c01e4b7..5f3a14ca456e65894e824864ccf3cd5fabc9c6bd 100644
--- a/src/main/java/net/minecraft/world/entity/PathfinderMob.java
+++ b/src/main/java/net/minecraft/world/entity/PathfinderMob.java
@@ -19,6 +19,7 @@ public abstract class PathfinderMob extends Mob {
@ -182,7 +182,7 @@ index 6ae3f5cd42dfd424fc3741957995f47ad5ec8941..bffec7fdf49994f702ea4c378237dac0
+ public BlockPos movingTarget = null; public BlockPos getMovingTarget() { return movingTarget; } // Paper
public float getWalkTargetValue(BlockPos pos) {
return this.getWalkTargetValue(pos, this.level);
return this.getWalkTargetValue(pos, this.level());
diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java b/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java
index 07c1ca01c38d5d7d0a95ad5004b5df9f4a222935..e5995d0db5dcfba59a873ff439601894fdacd556 100644
--- a/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java
@ -217,7 +217,7 @@ index 07c1ca01c38d5d7d0a95ad5004b5df9f4a222935..e5995d0db5dcfba59a873ff439601894
this.availableGoals.stream().filter((wrappedGoal) -> {
return wrappedGoal.getGoal() == goal;
diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/MoveToBlockGoal.java b/src/main/java/net/minecraft/world/entity/ai/goal/MoveToBlockGoal.java
index 6efba52c2e5d7811ee329ed22c1c76f75d7ddbe1..26bf383caea68834c654b25653ced9017f1b1b22 100644
index d27e5f9dac4703b839ab8444f6b54bf54d58af86..34f319ad09276c6f68dde449c79351de0d7d86f5 100644
--- a/src/main/java/net/minecraft/world/entity/ai/goal/MoveToBlockGoal.java
+++ b/src/main/java/net/minecraft/world/entity/ai/goal/MoveToBlockGoal.java
@@ -14,7 +14,7 @@ public abstract class MoveToBlockGoal extends Goal {
@ -245,33 +245,33 @@ index 6efba52c2e5d7811ee329ed22c1c76f75d7ddbe1..26bf383caea68834c654b25653ced901
this.mob = mob;
@@ -114,6 +121,7 @@ public abstract class MoveToBlockGoal extends Goal {
mutableBlockPos.setWithOffset(blockPos, m, k - 1, n);
if (this.mob.isWithinRestriction(mutableBlockPos) && this.isValidTarget(this.mob.level, mutableBlockPos)) {
if (this.mob.isWithinRestriction(mutableBlockPos) && this.isValidTarget(this.mob.level(), mutableBlockPos)) {
this.blockPos = mutableBlockPos;
+ setTargetPosition(mutableBlockPos.immutable()); // Paper
return true;
}
}
diff --git a/src/main/java/net/minecraft/world/entity/npc/Villager.java b/src/main/java/net/minecraft/world/entity/npc/Villager.java
index caab72b733eabfe6a78c2a75e252817def49cbd0..ece23ee7812ca62ff8e763ffc29cda2711d2f2e1 100644
index 73a5750dd47cf8869070f92594cfb926193c8761..3d36b121ca16f84efe9331c182a959227d35630e 100644
--- a/src/main/java/net/minecraft/world/entity/npc/Villager.java
+++ b/src/main/java/net/minecraft/world/entity/npc/Villager.java
@@ -225,17 +225,29 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
@@ -226,17 +226,34 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
@Override
public void inactiveTick() {
// SPIGOT-3874, SPIGOT-3894, SPIGOT-3846, SPIGOT-5286 :(
- if (level.spigotConfig.tickInactiveVillagers && this.isEffectiveAi()) {
- if (this.level().spigotConfig.tickInactiveVillagers && this.isEffectiveAi()) {
- this.customServerAiStep();
+ // Paper start
+ if (this.getUnhappyCounter() > 0) {
+ this.setUnhappyCounter(this.getUnhappyCounter() - 1);
+ }
}
+ if (this.isEffectiveAi()) {
+ if (level.spigotConfig.tickInactiveVillagers) {
+ this.customServerAiStep();
+ } else {
+ this.mobTick(true);
+ }
}
+ }
+ maybeDecayGossip();
+ // Paper end
+
@ -280,25 +280,29 @@ index caab72b733eabfe6a78c2a75e252817def49cbd0..ece23ee7812ca62ff8e763ffc29cda27
// Spigot End
@Override
- protected void customServerAiStep() {
+ protected void customServerAiStep() { mobTick(false); }
+ protected void mobTick(boolean inactive) {
this.level.getProfiler().push("villagerBrain");
- this.getBrain().tick((ServerLevel) this.level, this);
+ if (!inactive) this.getBrain().tick((ServerLevel) this.level, this); // Paper
this.level.getProfiler().pop();
+ @Deprecated // Paper
protected void customServerAiStep() {
+ // Paper start
+ this.customServerAiStep(false);
+ }
+ protected void customServerAiStep(final boolean inactive) {
+ // Paper end
this.level().getProfiler().push("villagerBrain");
- this.getBrain().tick((ServerLevel) this.level(), this);
+ if (!inactive) this.getBrain().tick((ServerLevel) this.level(), this); // Paper
this.level().getProfiler().pop();
if (this.assignProfessionWhenSpawned) {
this.assignProfessionWhenSpawned = false;
@@ -259,7 +271,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
@@ -260,7 +277,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
this.lastTradedPlayer = null;
}
- if (!this.isNoAi() && this.random.nextInt(100) == 0) {
+ if (!inactive && !this.isNoAi() && this.random.nextInt(100) == 0) { // Paper
Raid raid = ((ServerLevel) this.level).getRaidAt(this.blockPosition());
Raid raid = ((ServerLevel) this.level()).getRaidAt(this.blockPosition());
if (raid != null && raid.isActive() && !raid.isOver()) {
@@ -270,6 +282,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
@@ -271,6 +288,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
if (this.getVillagerData().getProfession() == VillagerProfession.NONE && this.isTrading()) {
this.stopTrading();
}
@ -307,7 +311,7 @@ index caab72b733eabfe6a78c2a75e252817def49cbd0..ece23ee7812ca62ff8e763ffc29cda27
super.customServerAiStep();
}
diff --git a/src/main/java/net/minecraft/world/entity/vehicle/MinecartHopper.java b/src/main/java/net/minecraft/world/entity/vehicle/MinecartHopper.java
index 9b36bf3dbad7c31a20446208f3f410246f85eff6..1b8f22805af87dc08e0dea9fd93a5f93c0b05107 100644
index b149e8bcac034bb3fc118a9adcb0de45e18ed5e9..fc35cfc9d045f3e5b6a50af1d0ba83b6e322091f 100644
--- a/src/main/java/net/minecraft/world/entity/vehicle/MinecartHopper.java
+++ b/src/main/java/net/minecraft/world/entity/vehicle/MinecartHopper.java
@@ -52,6 +52,7 @@ public class MinecartHopper extends AbstractMinecartContainer implements Hopper
@ -321,11 +325,11 @@ index 9b36bf3dbad7c31a20446208f3f410246f85eff6..1b8f22805af87dc08e0dea9fd93a5f93
@@ -89,10 +90,12 @@ public class MinecartHopper extends AbstractMinecartContainer implements Hopper
public boolean suckInItems() {
if (HopperBlockEntity.suckInItems(this.level, this)) {
if (HopperBlockEntity.suckInItems(this.level(), this)) {
+ this.immunize(); // Paper
return true;
} else {
for(ItemEntity itemEntity : this.level.getEntitiesOfClass(ItemEntity.class, this.getBoundingBox().inflate(0.25D, 0.0D, 0.25D), EntitySelector.ENTITY_STILL_ALIVE)) {
for(ItemEntity itemEntity : this.level().getEntitiesOfClass(ItemEntity.class, this.getBoundingBox().inflate(0.25D, 0.0D, 0.25D), EntitySelector.ENTITY_STILL_ALIVE)) {
if (HopperBlockEntity.addItem(this, itemEntity)) {
+ this.immunize(); // Paper
return true;
@ -344,10 +348,10 @@ index 9b36bf3dbad7c31a20446208f3f410246f85eff6..1b8f22805af87dc08e0dea9fd93a5f93
+
}
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 24d167436dab54ad18875c3633b1246a21d63518..48aef158ace14d3ca1f05ba2c6e5681e3ef9be59 100644
index c0920dfe011ec9b3be1018df3e8b13bea16dee87..f219546099c84ee262bb802631f86515a41cd7ca 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -161,6 +161,12 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -160,6 +160,12 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
public Map<BlockPos, BlockEntity> capturedTileEntities = new HashMap<>();
public List<ItemEntity> captureDrops;
public final it.unimi.dsi.fastutil.objects.Object2LongOpenHashMap<SpawnCategory> ticksPerSpawnCategory = new it.unimi.dsi.fastutil.objects.Object2LongOpenHashMap<>();
@ -361,7 +365,7 @@ index 24d167436dab54ad18875c3633b1246a21d63518..48aef158ace14d3ca1f05ba2c6e5681e
public final org.spigotmc.SpigotWorldConfig spigotConfig; // Spigot
// Paper start
diff --git a/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java b/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java
index 2f5f8e084c30bf654a19582e0b7baa9cde1b99b5..4f7b12d8f213d43f4ef5538b7e05809a1a106cbd 100644
index 45f55c79a9d105f732054d61c4cf83eb5db49762..17a6327ab7b26dfab38881bbc0689b0b25f8f025 100644
--- a/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java
@@ -143,6 +143,10 @@ public class PistonMovingBlockEntity extends BlockEntity {
@ -376,7 +380,7 @@ index 2f5f8e084c30bf654a19582e0b7baa9cde1b99b5..4f7b12d8f213d43f4ef5538b7e05809a
}
}
diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java
index 08bf9f85fe02a3f89640a2f3ae23089a119a394a..f158fc8a151272428a33dc5f6e1742876edc80d5 100644
index 9527b702fa823f00852e409a53cae772943dbe09..5f822417377b58f6952fa6e44a6e486047e354a2 100644
--- a/src/main/java/org/spigotmc/ActivationRange.java
+++ b/src/main/java/org/spigotmc/ActivationRange.java
@@ -1,39 +1,52 @@
@ -560,9 +564,9 @@ index 08bf9f85fe02a3f89640a2f3ae23089a119a394a..f158fc8a151272428a33dc5f6e174287
+ ActivationType.VILLAGER.boundingBox = player.getBoundingBox().inflate( villagerActivationRange, worldHeight, villagerActivationRange );
+ // Paper end
// Paper start
java.util.List<Entity> entities = world.getEntities((Entity)null, maxBB, null);
@@ -172,60 +250,118 @@ public class ActivationRange
world.getEntities().get(maxBB, ActivationRange::activateEntity);
}
@@ -166,60 +244,118 @@ public class ActivationRange
* @param entity
* @return
*/
@ -598,8 +602,8 @@ index 08bf9f85fe02a3f89640a2f3ae23089a119a394a..f158fc8a151272428a33dc5f6e174287
+ // Paper end
if ( !( entity instanceof AbstractArrow ) )
{
- if ( !entity.isOnGround() || !entity.passengers.isEmpty() || entity.isPassenger() )
+ if ( (!entity.isOnGround() && !(entity instanceof FlyingMob)) ) // Paper - remove passengers logic
- if ( !entity.onGround() || !entity.passengers.isEmpty() || entity.isPassenger() )
+ if ( (!entity.onGround() && !(entity instanceof FlyingMob)) ) // Paper - remove passengers logic
{
- return true;
+ return 10; // Paper
@ -624,7 +628,8 @@ index 08bf9f85fe02a3f89640a2f3ae23089a119a394a..f158fc8a151272428a33dc5f6e174287
{
- return true;
+ return 20; // Paper
+ }
}
- if ( entity instanceof Villager && ( (Villager) entity ).canBreed() )
+ // Paper start
+ if (entity instanceof Bee) {
+ Bee bee = (Bee)entity;
@ -652,8 +657,7 @@ index 08bf9f85fe02a3f89640a2f3ae23089a119a394a..f158fc8a151272428a33dc5f6e174287
+ return config.villagersWorkImmunityFor;
+ }
+ }
}
- if ( entity instanceof Villager && ( (Villager) entity ).canBreed() )
+ }
+ if ( entity instanceof Llama && ( (Llama) entity ).inCaravan() )
{
- return true;
@ -681,11 +685,11 @@ index 08bf9f85fe02a3f89640a2f3ae23089a119a394a..f158fc8a151272428a33dc5f6e174287
+ // Paper start
+ if (entity instanceof Mob && ((Mob) entity).targetSelector.hasTasks() ) {
+ return 0;
}
+ }
+ if (entity instanceof Pillager) {
+ Pillager pillager = (Pillager) entity;
+ // TODO:?
+ }
}
+ // Paper end
}
// SPIGOT-6644: Otherwise the target refresh tick will be missed
@ -698,7 +702,7 @@ index 08bf9f85fe02a3f89640a2f3ae23089a119a394a..f158fc8a151272428a33dc5f6e174287
}
/**
@@ -240,8 +376,19 @@ public class ActivationRange
@@ -234,8 +370,19 @@ public class ActivationRange
if ( entity instanceof FireworkRocketEntity ) {
return true;
}
@ -719,7 +723,7 @@ index 08bf9f85fe02a3f89640a2f3ae23089a119a394a..f158fc8a151272428a33dc5f6e174287
// Should this entity tick?
if ( !isActive )
@@ -249,15 +396,19 @@ public class ActivationRange
@@ -243,15 +390,19 @@ public class ActivationRange
if ( ( MinecraftServer.currentTick - entity.activatedTick - 1 ) % 20 == 0 )
{
// Check immunities every 20 ticks.

View file

@ -1,18 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Nassim Jahnke <nassim@njahnke.dev>
Date: Sat, 11 Sep 2021 11:56:51 +0200
Subject: [PATCH] Dont send unnecessary sign update
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 574ff62d6ae3b44a95cc9a08e7cc684acaab5057..0bf9726714697a192cdd1e4c74330b2a0acf8920 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -3237,6 +3237,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
if (!tileentitysign.isEditable() || !this.player.getUUID().equals(tileentitysign.getPlayerWhoMayEdit())) {
ServerGamePacketListenerImpl.LOGGER.warn("Player {} just tried to change non-editable sign", this.player.getName().getString());
+ if (this.player.distanceToSqr(blockposition.getX(), blockposition.getY(), blockposition.getZ()) < 32 * 32) // Paper
this.send(tileentity.getUpdatePacket()); // CraftBukkit
return;
}