Update Paper

This commit is contained in:
Spottedleaf 2024-02-13 16:20:10 -08:00
parent 32ff12e4dc
commit d3d0df309c
7 changed files with 186 additions and 481 deletions

View File

@ -2,7 +2,7 @@ group=dev.folia
version=1.20.4-R0.1-SNAPSHOT
mcVersion=1.20.4
paperRef=9e171ef8ff0a0ec57ebc75772fc9de578c987059
paperRef=31699ae9a8f3a57491e9c9276cffa5a51e9a5f60
org.gradle.caching=true
org.gradle.parallel=true

View File

@ -11,10 +11,10 @@ the schedulers depending on the result of the ownership
check.
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index 2d53675907f411046978b0a234c0b6f33c909973..15252f744d60408a816dba1c0ca0c7104236ae6f 100644
index ca27559cf4aa1c2e44fdca2022e213b1b1c80f4e..3fae7b21353d18ff1e8005fbbe83be783de8a953 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -2837,6 +2837,14 @@ public final class Bukkit {
@@ -2857,6 +2857,14 @@ public final class Bukkit {
return server.isOwnedByCurrentRegion(entity);
}
// Paper end - Folia region threading API
@ -30,10 +30,10 @@ index 2d53675907f411046978b0a234c0b6f33c909973..15252f744d60408a816dba1c0ca0c710
@NotNull
public static Server.Spigot spigot() {
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 9af4bc16da09e59009c47911219e99450cdf2aa5..8d51301e1a0a2a528353b90e2e2d0e4c69c6a4f5 100644
index b4f8281d3797ec825a7671f38077cd65d5a1d76e..fe3d89c2c319c4f4b2b3e4a121d6626a898f501b 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -2481,4 +2481,10 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@@ -2497,4 +2497,10 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
*/
boolean isOwnedByCurrentRegion(@NotNull Entity entity);
// Paper end - Folia region threading API

View File

@ -106,10 +106,10 @@ index d06185566b447c432d4dc2e3ba04d121bcdbc71b..680919045310be7e50e2d503a23d265f
public SystemReport fillSystemReport(SystemReport details) {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 4df3b94c8126f00188f5e125757411a0359728fa..825e7abebd6eb898198106ca6e783ec462e64173 100644
index 9f7ed337463cc9bb370a5541d9de5cd8f9c1a78a..c4144c239a5d91bc0faec84fe49829337aa339dc 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -264,7 +264,7 @@ import javax.annotation.Nullable; // Paper
@@ -266,7 +266,7 @@ import javax.annotation.Nullable; // Paper
import javax.annotation.Nonnull; // Paper
public final class CraftServer implements Server {

File diff suppressed because it is too large Load Diff

View File

@ -29,10 +29,10 @@ index 41bf71d116ffc5431586ce54abba7f8def6c1dcf..519da6886613b8460e989767b1a21e31
}
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index b736cb55542ea7bc35d1a02e7fe5913de024ca60..eade31ea668c171dceafee958e265041a439c54b 100644
index b8e77755a1706e60e9dfa1310aa2449ee0dbc6ad..0725386d7ef47171012671725ceddfe92b43b203 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -2907,6 +2907,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@@ -2911,6 +2911,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
if (!force && (!this.canRide(entity) || !entity.canAddPassenger(this))) {
return false;
} else {
@ -40,7 +40,7 @@ index b736cb55542ea7bc35d1a02e7fe5913de024ca60..eade31ea668c171dceafee958e265041
// CraftBukkit start
if (entity.getBukkitEntity() instanceof Vehicle && this.getBukkitEntity() instanceof LivingEntity) {
VehicleEnterEvent event = new VehicleEnterEvent((Vehicle) entity.getBukkitEntity(), this.getBukkitEntity());
@@ -2928,6 +2929,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@@ -2932,6 +2933,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
return false;
}
// CraftBukkit end
@ -48,7 +48,7 @@ index b736cb55542ea7bc35d1a02e7fe5913de024ca60..eade31ea668c171dceafee958e265041
if (this.isPassenger()) {
this.stopRiding();
}
@@ -3005,6 +3007,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@@ -3009,6 +3011,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
throw new IllegalStateException("Use x.stopRiding(y), not y.removePassenger(x)");
} else {
// CraftBukkit start
@ -56,7 +56,7 @@ index b736cb55542ea7bc35d1a02e7fe5913de024ca60..eade31ea668c171dceafee958e265041
CraftEntity craft = (CraftEntity) entity.getBukkitEntity().getVehicle();
Entity orig = craft == null ? null : craft.getHandle();
if (this.getBukkitEntity() instanceof Vehicle && entity.getBukkitEntity() instanceof LivingEntity) {
@@ -3032,6 +3035,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@@ -3036,6 +3039,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
return false;
}
// CraftBukkit end
@ -792,10 +792,10 @@ index 7b7b89e67d53ed70efae714192c5fa32977f3d9c..00f334e5449f76b735b844fed44c9872
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderDragonPart.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderDragonPart.java
index 5817f497424bb0e680c34d125b3fe53dba07a5cc..6dd1d6e7a504a76d84f5bc1140ff5223d9fa1e98 100644
index cc4194ac9d7501b5d15655674dade14d59cb6733..d89885eb1d4212bf26de5f32bce2b49ecd8182e0 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderDragonPart.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderDragonPart.java
@@ -15,8 +15,16 @@ public class CraftEnderDragonPart extends CraftComplexPart implements EnderDrago
@@ -16,8 +16,16 @@ public class CraftEnderDragonPart extends CraftComplexPart implements EnderDrago
return (EnderDragon) super.getParent();
}
@ -1590,10 +1590,10 @@ index e9f471e60af0725ec34e2985d63ae9ea9f88590a..6a443f42ecec16abea3ddf7bc2e85bb8
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
index 4afc1c9d2a7638e84a55fe30932dc36db465c31a..b7be4fd0179a26d220819346457ba097f4c7d22d 100644
index f1e4dfd203d455ec089cd2b5679c4083400dbc7f..6abb7ee0f5d32613b2ff7da09810ae407e293838 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -416,6 +416,13 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
@@ -454,6 +454,13 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
this.getHandle().invulnerableTime = ticks;
}
@ -1607,7 +1607,7 @@ index 4afc1c9d2a7638e84a55fe30932dc36db465c31a..b7be4fd0179a26d220819346457ba097
@Override
public int getNoActionTicks() {
return this.getHandle().getNoActionTime();
@@ -429,6 +436,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
@@ -467,6 +474,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
@Override
public net.minecraft.world.entity.LivingEntity getHandle() {
@ -1878,10 +1878,10 @@ index 706c74c832f6893df3797023f68add31139c7d57..80a612f16669e571e336dd6369a968b4
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMushroomCow.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMushroomCow.java
index e5df527d3f0b82327bcd4cb66c12baa439b4cec6..3ca3c62485e5701c76e4fbfac853ed128194e0ce 100644
index 1d78ae1db211a452a42fb4a7bef4cca4b7c71a1f..e4e8d7561036ab04d069cfe54f1fba61b478c5d8 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMushroomCow.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMushroomCow.java
@@ -10,8 +10,16 @@ public class CraftMushroomCow extends CraftCow implements MushroomCow, io.paperm
@@ -19,6 +19,13 @@ public class CraftMushroomCow extends CraftCow implements MushroomCow, io.paperm
super(server, entity);
}
@ -1892,6 +1892,11 @@ index e5df527d3f0b82327bcd4cb66c12baa439b4cec6..3ca3c62485e5701c76e4fbfac853ed12
+ }
+ // Folia end - region threading
+
@Override
public boolean hasEffectsForNextStew() {
return this.getHandle().stewEffects != null && !this.getHandle().stewEffects.isEmpty();
@@ -74,6 +81,7 @@ public class CraftMushroomCow extends CraftCow implements MushroomCow, io.paperm
@Override
public net.minecraft.world.entity.animal.MushroomCow getHandle() {
+ io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading
@ -2130,10 +2135,10 @@ index 2638c341bc02f201f7ab17fdebcdbdf3a7ec05bf..0f5c2d31a2dea13a46ba81e353393633
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index f5985bac1f72591e31a85d53a5dfde7c26966a62..fc301fcf812b79ac7ceae710132a762f101b82b2 100644
index 3d47913cb590463b636cbdc052fb54778951ba61..8fc071a6249193af5e1795cc19f50996ea22d96f 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -574,7 +574,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -580,7 +580,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@Override
public void kick(net.kyori.adventure.text.Component message, org.bukkit.event.player.PlayerKickEvent.Cause cause) {
@ -2142,7 +2147,7 @@ index f5985bac1f72591e31a85d53a5dfde7c26966a62..fc301fcf812b79ac7ceae710132a762f
final ServerGamePacketListenerImpl connection = this.getHandle().connection;
if (connection != null) {
connection.disconnect(message == null ? net.kyori.adventure.text.Component.empty() : message, cause);
@@ -2179,9 +2179,16 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -2209,9 +2209,16 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
return this;
}
@ -2160,7 +2165,7 @@ index f5985bac1f72591e31a85d53a5dfde7c26966a62..fc301fcf812b79ac7ceae710132a762f
}
public void setHandle(final ServerPlayer entity) {
@@ -3215,7 +3222,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -3266,7 +3273,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
{
if ( CraftPlayer.this.getHealth() <= 0 && CraftPlayer.this.isOnline() )
{

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Throw UnsupportedOperationException() for broken APIs
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 4f9c1b04ce6e4874cfb80a91c50aceda0eff2acc..3f266934e70a5f29d55d390841e536999cec8582 100644
index a4e47391105366e52b949f39ba4a1ebed94b2188..853afba9d0a814acc001ba5db5ef3653f8b16392 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1266,6 +1266,7 @@ public final class CraftServer implements Server {
@@ -1283,6 +1283,7 @@ public final class CraftServer implements Server {
@Override
public World createWorld(WorldCreator creator) {
@ -16,7 +16,7 @@ index 4f9c1b04ce6e4874cfb80a91c50aceda0eff2acc..3f266934e70a5f29d55d390841e53699
Preconditions.checkState(this.console.getAllLevels().iterator().hasNext(), "Cannot create additional worlds on STARTUP");
//Preconditions.checkState(!this.console.isIteratingOverLevels, "Cannot create a world while worlds are being ticked"); // Paper - Cat - Temp disable. We'll see how this goes.
Preconditions.checkArgument(creator != null, "WorldCreator cannot be null");
@@ -1444,6 +1445,7 @@ public final class CraftServer implements Server {
@@ -1461,6 +1462,7 @@ public final class CraftServer implements Server {
@Override
public boolean unloadWorld(World world, boolean save) {

View File

@ -9,7 +9,7 @@ data deserialization and is racey even in Vanilla. But in Folia,
some accesses may throw and as such we need to fix this directly.
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index b9e7c8776b5b4086fb2455035857947f9a4b3dba..c8ee0307fa6c13c34a1db80ddf65d8381fd556be 100644
index add6fc106d3c38d97b48ec0df3ac2515c8c0486e..cbc89b8898f9243776af88c2b04ad3c2e4e23fb6 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -644,7 +644,7 @@ public class ServerPlayer extends Player {
@ -22,10 +22,10 @@ index b9e7c8776b5b4086fb2455035857947f9a4b3dba..c8ee0307fa6c13c34a1db80ddf65d838
// CraftBukkit start
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 03e96af48a1d54d19383a3f0b270248f673ad0aa..28da90b59f60d3f7618a42e149467a3a55c91682 100644
index a463c46778e5ee641c1b7d634b79ec68414cd936..b640d877f924094bcabbf9618bbd9aa0a70bf94a 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -4361,6 +4361,11 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -4374,6 +4374,11 @@ public abstract class LivingEntity extends Entity implements Attackable {
}
});