Apply patches for 1.20.4

- Compile needs to be checked.
- Behaviors around the new tick manager need to be designed
  and implemented.

Chk update.txt for anything specific.
This commit is contained in:
Spottedleaf 2023-12-16 15:32:48 -08:00
parent 1e5e2154c9
commit de6a87e338
17 changed files with 1301 additions and 1232 deletions

View File

@ -4,7 +4,7 @@ plugins {
java java
`maven-publish` `maven-publish`
id("com.github.johnrengelman.shadow") version "8.1.1" apply false id("com.github.johnrengelman.shadow") version "8.1.1" apply false
id("io.papermc.paperweight.patcher") version "1.5.9" id("io.papermc.paperweight.patcher") version "1.5.11"
} }
val paperMavenPublicUrl = "https://repo.papermc.io/repository/maven-public/" val paperMavenPublicUrl = "https://repo.papermc.io/repository/maven-public/"
@ -17,7 +17,7 @@ repositories {
} }
dependencies { dependencies {
remapper("net.fabricmc:tiny-remapper:0.8.6:fat") remapper("net.fabricmc:tiny-remapper:0.8.10:fat")
decompiler("net.minecraftforge:forgeflower:2.0.627.2") decompiler("net.minecraftforge:forgeflower:2.0.627.2")
paperclip("io.papermc:paperclip:3.0.3") paperclip("io.papermc:paperclip:3.0.3")
} }

View File

@ -1,8 +1,8 @@
group=dev.folia group=dev.folia
version=1.20.2-R0.1-SNAPSHOT version=1.20.4-R0.1-SNAPSHOT
mcVersion=1.20.2 mcVersion=1.20.4
paperRef=ce7f0680956bb1c779ac4db9fe0fd1f00bb35bae paperRef=f1820dc80a02009980e6466ea5847933861b911a
org.gradle.caching=true org.gradle.caching=true
org.gradle.parallel=true org.gradle.parallel=true

Binary file not shown.

View File

@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
networkTimeout=10000 networkTimeout=10000
validateDistributionUrl=true validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME

View File

@ -23,7 +23,7 @@ index fc2dae69165776d08274e34a69962cc70445f411..06149045a44148bf0af5f52952ff0092
} }
diff --git a/src/main/java/org/bukkit/scheduler/BukkitScheduler.java b/src/main/java/org/bukkit/scheduler/BukkitScheduler.java diff --git a/src/main/java/org/bukkit/scheduler/BukkitScheduler.java b/src/main/java/org/bukkit/scheduler/BukkitScheduler.java
index d2ab2ee1e1e8fbaac4edef5b3ee313ee4ceb6991..8476504e3d54721c64f02eddd5b48193ac8f366b 100644 index 487b5ca23159b531475c3d650894be707b49914e..31b90d1c2259a8f200b0589909dbbfe4cc526989 100644
--- a/src/main/java/org/bukkit/scheduler/BukkitScheduler.java --- a/src/main/java/org/bukkit/scheduler/BukkitScheduler.java
+++ b/src/main/java/org/bukkit/scheduler/BukkitScheduler.java +++ b/src/main/java/org/bukkit/scheduler/BukkitScheduler.java
@@ -7,6 +7,15 @@ import java.util.function.Consumer; @@ -7,6 +7,15 @@ import java.util.function.Consumer;

View File

@ -11,7 +11,7 @@ the schedulers depending on the result of the ownership
check. check.
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index 884902cb7f86c0b56594ccafc7d05c6c7a23ab53..b7e1c8bd8dd38e1a9e74925740b22dad61a75f49 100644 index 4863d9f21f0a0f11974be85360edc587ffd7eab3..56548d416cb116b0f130a18a3c0ee8aed51a7be0 100644
--- a/src/main/java/org/bukkit/Bukkit.java --- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java +++ b/src/main/java/org/bukkit/Bukkit.java
@@ -2827,6 +2827,14 @@ public final class Bukkit { @@ -2827,6 +2827,14 @@ public final class Bukkit {
@ -30,7 +30,7 @@ index 884902cb7f86c0b56594ccafc7d05c6c7a23ab53..b7e1c8bd8dd38e1a9e74925740b22dad
@NotNull @NotNull
public static Server.Spigot spigot() { public static Server.Spigot spigot() {
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index d0c634629aa0b6bac0da93655dd86ad3aea0ce30..85b169c04f44431363d4e14d4857140f160ceace 100644 index f1fa97d12f97baf97beb92ca0719cf3cf906b225..e25f86fb8d4bda9284744c0b8ae7db4f4f9f93a0 100644
--- a/src/main/java/org/bukkit/Server.java --- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java +++ b/src/main/java/org/bukkit/Server.java
@@ -2473,4 +2473,10 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi @@ -2473,4 +2473,10 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi

View File

@ -5,13 +5,13 @@ Subject: [PATCH] Build changes
diff --git a/build.gradle.kts b/build.gradle.kts diff --git a/build.gradle.kts b/build.gradle.kts
index 79beac737c17412913983614bd478d33e3c6ed58..0cd12a854e544e867abfd94c18a9f138ba57e587 100644 index 170a915098f09ace226648da342a04c5c7583d11..512496d086b21bd0d5c5cc070a41185eedc6c2f1 100644
--- a/build.gradle.kts --- a/build.gradle.kts
+++ b/build.gradle.kts +++ b/build.gradle.kts
@@ -13,8 +13,12 @@ configurations.named(log4jPlugins.compileClasspathConfigurationName) { @@ -27,8 +27,12 @@ repositories {
val alsoShade: Configuration by configurations.creating
dependencies { dependencies {
extraRuntime(platform("net.kyori:adventure-bom:4.15.0-SNAPSHOT"))
- implementation(project(":paper-api")) - implementation(project(":paper-api"))
- implementation(project(":paper-mojangapi")) - implementation(project(":paper-mojangapi"))
+ // Folia start + // Folia start
@ -23,7 +23,7 @@ index 79beac737c17412913983614bd478d33e3c6ed58..0cd12a854e544e867abfd94c18a9f138
// Paper start // Paper start
implementation("org.jline:jline-terminal-jansi:3.21.0") implementation("org.jline:jline-terminal-jansi:3.21.0")
implementation("net.minecrell:terminalconsoleappender:1.3.0") implementation("net.minecrell:terminalconsoleappender:1.3.0")
@@ -70,7 +74,7 @@ tasks.jar { @@ -84,7 +88,7 @@ tasks.jar {
attributes( attributes(
"Main-Class" to "org.bukkit.craftbukkit.Main", "Main-Class" to "org.bukkit.craftbukkit.Main",
"Implementation-Title" to "CraftBukkit", "Implementation-Title" to "CraftBukkit",
@ -32,7 +32,7 @@ index 79beac737c17412913983614bd478d33e3c6ed58..0cd12a854e544e867abfd94c18a9f138
"Implementation-Vendor" to date, // Paper "Implementation-Vendor" to date, // Paper
"Specification-Title" to "Bukkit", "Specification-Title" to "Bukkit",
"Specification-Version" to project.version, "Specification-Version" to project.version,
@@ -154,7 +158,7 @@ fun TaskContainer.registerRunTask( @@ -168,7 +172,7 @@ fun TaskContainer.registerRunTask(
name: String, name: String,
block: JavaExec.() -> Unit block: JavaExec.() -> Unit
): TaskProvider<JavaExec> = register<JavaExec>(name) { ): TaskProvider<JavaExec> = register<JavaExec>(name) {
@ -93,10 +93,10 @@ index 9d687da5bdf398bb3f6c84cdf1249a7213d09f2e..e2f704c115fd6e00960bb56bb0779f11
).openBufferedStream()) { ).openBufferedStream()) {
JsonObject json = new Gson().fromJson(reader, JsonObject.class); JsonObject json = new Gson().fromJson(reader, JsonObject.class);
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 8f31413c939cc2b0454ad3d9a1b618dbae449d00..6758e3ff1100bba2852e44cbb0b38ce4f22490e8 100644 index 34f19ac897a30c0c4e3ab406013fcca1c8b7db93..5ed6c8710b78458031ed6b0273fb2f6a5f482ea7 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1697,7 +1697,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -1866,7 +1866,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@DontObfuscate @DontObfuscate
public String getServerModName() { public String getServerModName() {
@ -106,10 +106,10 @@ index 8f31413c939cc2b0454ad3d9a1b618dbae449d00..6758e3ff1100bba2852e44cbb0b38ce4
public SystemReport fillSystemReport(SystemReport details) { 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 diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 9c08303de2891de92e06de8a939a618b7a6f7321..bbc51ebf0dc0801ace9d5e7875fb2fe100b286bc 100644 index 782bb8ca67517dde5dba8f0a133eb8699353dd01..f4ba1b9adbd0e526421a755fd6c536fe20ffa716 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -269,7 +269,7 @@ import javax.annotation.Nullable; // Paper @@ -270,7 +270,7 @@ import javax.annotation.Nullable; // Paper
import javax.annotation.Nonnull; // Paper import javax.annotation.Nonnull; // Paper
public final class CraftServer implements Server { public final class CraftServer implements Server {

File diff suppressed because it is too large Load Diff

View File

@ -6,10 +6,10 @@ Subject: [PATCH] Max pending logins
Should help the floodgates on launch Should help the floodgates on launch
diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
index 6f483c6581daeaf68f85e3b730d31c5b7a6ae001..f7c2d6d82ee1b5975cd114934b7beaec3d5d490d 100644 index d0f7434164f6241ec81c990c7a127f504e019291..8586df59afd0af51721a0950c7bf4582092417fc 100644
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
@@ -88,7 +88,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener, @@ -89,7 +89,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
if (this.server.getPlayerList().pushPendingJoin(name, uniqueId, this.connection)) { if (this.server.getPlayerList().pushPendingJoin(name, uniqueId, this.connection)) {
// Folia end - region threading - rewrite login process // Folia end - region threading - rewrite login process
this.verifyLoginAndFinishConnectionSetup((GameProfile) Objects.requireNonNull(this.authenticatedProfile)); this.verifyLoginAndFinishConnectionSetup((GameProfile) Objects.requireNonNull(this.authenticatedProfile));
@ -19,10 +19,10 @@ index 6f483c6581daeaf68f85e3b730d31c5b7a6ae001..f7c2d6d82ee1b5975cd114934b7beaec
if (this.state == ServerLoginPacketListenerImpl.State.WAITING_FOR_DUPE_DISCONNECT && !this.isPlayerAlreadyInWorld((GameProfile) Objects.requireNonNull(this.authenticatedProfile))) { if (this.state == ServerLoginPacketListenerImpl.State.WAITING_FOR_DUPE_DISCONNECT && !this.isPlayerAlreadyInWorld((GameProfile) Objects.requireNonNull(this.authenticatedProfile))) {
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 6cce2a9bc9beeeef25b7bacd2ad307ed3ae44432..41ba8950b3aada5eea55a0db841c6b9291262bf2 100644 index 0fa69640a699e1c33cb307366b0335ac9bac4282..bc31d4dfd6fca354c093f552901a59e5b83c92d7 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java --- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -173,6 +173,17 @@ public abstract class PlayerList { @@ -171,6 +171,17 @@ public abstract class PlayerList {
conflictingId = this.connectionById.get(byId); conflictingId = this.connectionById.get(byId);
if (conflictingName == null && conflictingId == null) { if (conflictingName == null && conflictingId == null) {

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 diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index dd18591d7928ab04f6f7c09aa89a26ccbe20c323..385d5bc08928dd990b690b926e174af86f178c64 100644 index 9f38cec134dfd476d0a8d56b628238d2d27baf83..65ae803da6fa395c9ad031460fc76077da62aeec 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java --- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -2863,6 +2863,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { @@ -2918,6 +2918,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
if (!force && (!this.canRide(entity) || !entity.canAddPassenger(this))) { if (!force && (!this.canRide(entity) || !entity.canAddPassenger(this))) {
return false; return false;
} else { } else {
@ -40,7 +40,7 @@ index dd18591d7928ab04f6f7c09aa89a26ccbe20c323..385d5bc08928dd990b690b926e174af8
// CraftBukkit start // CraftBukkit start
if (entity.getBukkitEntity() instanceof Vehicle && this.getBukkitEntity() instanceof LivingEntity) { if (entity.getBukkitEntity() instanceof Vehicle && this.getBukkitEntity() instanceof LivingEntity) {
VehicleEnterEvent event = new VehicleEnterEvent((Vehicle) entity.getBukkitEntity(), this.getBukkitEntity()); VehicleEnterEvent event = new VehicleEnterEvent((Vehicle) entity.getBukkitEntity(), this.getBukkitEntity());
@@ -2884,6 +2885,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { @@ -2939,6 +2940,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
if (event.isCancelled()) { if (event.isCancelled()) {
return false; return false;
} }
@ -48,7 +48,7 @@ index dd18591d7928ab04f6f7c09aa89a26ccbe20c323..385d5bc08928dd990b690b926e174af8
// Spigot end // Spigot end
if (this.isPassenger()) { if (this.isPassenger()) {
this.stopRiding(); this.stopRiding();
@@ -2962,6 +2964,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { @@ -3017,6 +3019,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
throw new IllegalStateException("Use x.stopRiding(y), not y.removePassenger(x)"); throw new IllegalStateException("Use x.stopRiding(y), not y.removePassenger(x)");
} else { } else {
// CraftBukkit start // CraftBukkit start
@ -56,7 +56,7 @@ index dd18591d7928ab04f6f7c09aa89a26ccbe20c323..385d5bc08928dd990b690b926e174af8
CraftEntity craft = (CraftEntity) entity.getBukkitEntity().getVehicle(); CraftEntity craft = (CraftEntity) entity.getBukkitEntity().getVehicle();
Entity orig = craft == null ? null : craft.getHandle(); Entity orig = craft == null ? null : craft.getHandle();
if (this.getBukkitEntity() instanceof Vehicle && entity.getBukkitEntity() instanceof LivingEntity) { if (this.getBukkitEntity() instanceof Vehicle && entity.getBukkitEntity() instanceof LivingEntity) {
@@ -2989,6 +2992,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { @@ -3044,6 +3047,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
if (event.isCancelled()) { if (event.isCancelled()) {
return false; return false;
} }
@ -456,10 +456,10 @@ index 80e571c977db5cdf43bfbfce035f37a3fa325c95..6fafba37dd7128a397ba046be7b33067
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftCat.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftCat.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftCat.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftCat.java
index 6c9531c018be29b5794d047b50007fde1b50b494..cb2f710a48c1e42cf800f657befaac4e2b8a82ff 100644 index 0ccc20157fb9fdb9c99b942dcb4675db5f928b23..aa9881552e0ba78d844de105184953c487ad426b 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftCat.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftCat.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftCat.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftCat.java
@@ -15,8 +15,16 @@ public class CraftCat extends CraftTameableAnimal implements Cat { @@ -16,8 +16,16 @@ public class CraftCat extends CraftTameableAnimal implements Cat {
super(server, entity); super(server, entity);
} }
@ -897,10 +897,10 @@ index d657fd2c507a5b215aeab0a5f3e9c2ee892a27c8..9fc90b162aab15a9cd60b02aba563181
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
index 690e57b55adb53d56d874cbddec6226a515f43a2..9f070a9f0894d88688ff50efc3f4dba8188c3885 100644 index cd29fa29fa65060c21c715bd756c5a35429eeb96..c46d00843f4a1a1c482f18856a846c09eff30293 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -826,7 +826,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { @@ -845,7 +845,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
@Override @Override
public UUID getUniqueId() { public UUID getUniqueId() {
@ -909,7 +909,7 @@ index 690e57b55adb53d56d874cbddec6226a515f43a2..9f070a9f0894d88688ff50efc3f4dba8
} }
@Override @Override
@@ -841,6 +841,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { @@ -860,6 +860,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
} }
public Entity getHandle() { public Entity getHandle() {
@ -1359,10 +1359,10 @@ index 8746f80d08df5501b32958eb123aa7d814573ddf..c6c6eb55f4649e18beef9832c2ea7b9d
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
index aefb9879b2edadfb4b21d80135d713b9d34c9941..320b69a62a01d54d116115cc6b571ad63558befd 100644 index 8a1e765363aeb61078fd23980d3856dc680cb05e..98f2be104eb2882f8c841a637ba821d96e0bf6bd 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
@@ -291,8 +291,16 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { @@ -292,8 +292,16 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
this.mode = mode; this.mode = mode;
} }
@ -1464,7 +1464,7 @@ index 63cae1a2e95d8da17c45c4404a8dd0ca6a413c39..f57139f03da9519802ee156f37691d08
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java
index f444e843535ec68ede0f05e7e7ef182ce872342b..c8fdfb3ee9ad5ca1853ac2ec3a7ff04ce8081dbb 100644 index 81498941748d646ebe6495f4a7ce6953532144c6..23ff09abb5f99b0cee2375769004c4f709257e39 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java
@@ -18,8 +18,16 @@ public class CraftItem extends CraftEntity implements Item { @@ -18,8 +18,16 @@ public class CraftItem extends CraftEntity implements Item {
@ -1590,10 +1590,10 @@ index 70b377c03346cb8573827aeb493f3b6eb8efb1f8..b2e8c26162dd5782a0447cd03ca00fb4
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
index 1992bd985d1beae77b88d71c5fa551a277943fdb..abc18d0e52d1e6ab4d04a9d8b97f91c9d6c4c02e 100644 index ba2cd9c4cdbd5ddab1300320d7e0ede4d4b7a31a..66edfd724275c06b58d0a4a5fb5e484257850e36 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -417,6 +417,13 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { @@ -418,6 +418,13 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
this.getHandle().invulnerableTime = ticks; this.getHandle().invulnerableTime = ticks;
} }
@ -1607,7 +1607,7 @@ index 1992bd985d1beae77b88d71c5fa551a277943fdb..abc18d0e52d1e6ab4d04a9d8b97f91c9
@Override @Override
public int getNoActionTicks() { public int getNoActionTicks() {
return this.getHandle().getNoActionTime(); return this.getHandle().getNoActionTime();
@@ -430,6 +437,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { @@ -431,6 +438,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
@Override @Override
public net.minecraft.world.entity.LivingEntity getHandle() { public net.minecraft.world.entity.LivingEntity getHandle() {
@ -1878,7 +1878,7 @@ 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 diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMushroomCow.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMushroomCow.java
index 7ee489da5963fd722fc2531fef14911447a16557..f07b07805ce0b168e945c81ae82b690db0ba79e5 100644 index e5df527d3f0b82327bcd4cb66c12baa439b4cec6..3ca3c62485e5701c76e4fbfac853ed128194e0ce 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMushroomCow.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMushroomCow.java
+++ b/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 @@ -10,8 +10,16 @@ public class CraftMushroomCow extends CraftCow implements MushroomCow, io.paperm
@ -2130,10 +2130,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 diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 249887106315ed0625b08bc8b2a74404cf0a418b..6c8f6e26687b557fcdcd65c657d8b35d3fde805e 100644 index 374a845acc6b12eb82af4282d52e22f1291f77f7..7a8762a35cb47f86c64be00c220a997c8f9f5108 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -611,7 +611,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -619,7 +619,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@Override @Override
public void kick(net.kyori.adventure.text.Component message, org.bukkit.event.player.PlayerKickEvent.Cause cause) { public void kick(net.kyori.adventure.text.Component message, org.bukkit.event.player.PlayerKickEvent.Cause cause) {
@ -2142,7 +2142,7 @@ index 249887106315ed0625b08bc8b2a74404cf0a418b..6c8f6e26687b557fcdcd65c657d8b35d
final ServerGamePacketListenerImpl connection = this.getHandle().connection; final ServerGamePacketListenerImpl connection = this.getHandle().connection;
if (connection != null) { if (connection != null) {
connection.disconnect(message == null ? net.kyori.adventure.text.Component.empty() : message, cause); connection.disconnect(message == null ? net.kyori.adventure.text.Component.empty() : message, cause);
@@ -2138,9 +2138,16 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -2162,9 +2162,16 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
return this; return this;
} }
@ -2160,7 +2160,7 @@ index 249887106315ed0625b08bc8b2a74404cf0a418b..6c8f6e26687b557fcdcd65c657d8b35d
} }
public void setHandle(final ServerPlayer entity) { public void setHandle(final ServerPlayer entity) {
@@ -3156,7 +3163,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -3162,7 +3169,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
{ {
if ( CraftPlayer.this.getHealth() <= 0 && CraftPlayer.this.isOnline() ) if ( CraftPlayer.this.getHealth() <= 0 && CraftPlayer.this.isOnline() )
{ {
@ -2865,7 +2865,7 @@ index 4b3a764114c8372e1549dadeeced26dc7727f2d1..04cbe165b99d348a864da5d342225fc9
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftTrident.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftTrident.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftTrident.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftTrident.java
index c8b65210d2416b5a293cb4bcc1b71f56ed365cd7..0e3045647382111066000fc03925596c1d757e6b 100644 index 8a6af0db8e0aa0cffbf19584be747076c2c8ee44..b7c639a027001a064333fb4e8feb0e049e8cabbd 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftTrident.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftTrident.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftTrident.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftTrident.java
@@ -12,8 +12,16 @@ public class CraftTrident extends CraftArrow implements Trident { @@ -12,8 +12,16 @@ public class CraftTrident extends CraftArrow implements Trident {

View File

@ -10,11 +10,11 @@ the impact from scaling the region threads, but is not a fix
to the underlying issue. to the underlying issue.
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 75d5e7f1b247e27f526a3f76fa7df7aeca4e90ac..5ded3dbc379f199ed735b6ce0ebf6a2e3485f93b 100644 index 99a086ed2c0d5615a55539a31b8cd8483569e9c0..844424e7488eb42753f50e0e998aebf93c912877 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -2877,6 +2877,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -1469,6 +1469,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
} // Folia end - region threading
public final void executeMidTickTasks() { public final void executeMidTickTasks() {
+ if (true) return; // Folia - disable mid-tick task execution + if (true) return; // Folia - disable mid-tick task execution

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 diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 541915675dd3ad832992360283e3ba1b3cc62e27..bc778637c7d4371cafa9bcda67f8965f57cc66d6 100644 index d2c8ad04c59035449dc798a637acc6e809d35fc4..7cbf625384f02e3c8c40a57cd5582ecaca4bd15c 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1268,6 +1268,7 @@ public final class CraftServer implements Server { @@ -1263,6 +1263,7 @@ public final class CraftServer implements Server {
@Override @Override
public World createWorld(WorldCreator creator) { public World createWorld(WorldCreator creator) {
@ -16,7 +16,7 @@ index 541915675dd3ad832992360283e3ba1b3cc62e27..bc778637c7d4371cafa9bcda67f8965f
Preconditions.checkState(this.console.getAllLevels().iterator().hasNext(), "Cannot create additional worlds on STARTUP"); 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.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"); Preconditions.checkArgument(creator != null, "WorldCreator cannot be null");
@@ -1410,6 +1411,7 @@ public final class CraftServer implements Server { @@ -1442,6 +1443,7 @@ public final class CraftServer implements Server {
@Override @Override
public boolean unloadWorld(World world, boolean save) { public boolean unloadWorld(World world, boolean save) {
@ -25,10 +25,10 @@ index 541915675dd3ad832992360283e3ba1b3cc62e27..bc778637c7d4371cafa9bcda67f8965f
if (world == null) { if (world == null) {
return false; return false;
diff --git a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboard.java b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboard.java diff --git a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboard.java b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboard.java
index a8c5bfc54ed2b8bd873f124c7080d73fe73a86ad..f59e9e6dd21a7d034b5e3b6e7787458d3c3c7bbc 100644 index 81889e30a634ac84d996f688d0a2466e9efa19ca..f2ad3247b512ed5115dea475035736eddc038c7e 100644
--- a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboard.java --- a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboard.java
+++ b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboard.java +++ b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboard.java
@@ -43,6 +43,7 @@ public final class CraftScoreboard implements org.bukkit.scoreboard.Scoreboard { @@ -45,6 +45,7 @@ public final class CraftScoreboard implements org.bukkit.scoreboard.Scoreboard {
} }
@Override @Override
public CraftObjective registerNewObjective(String name, Criteria criteria, net.kyori.adventure.text.Component displayName, RenderType renderType) throws IllegalArgumentException { public CraftObjective registerNewObjective(String name, Criteria criteria, net.kyori.adventure.text.Component displayName, RenderType renderType) throws IllegalArgumentException {
@ -36,7 +36,7 @@ index a8c5bfc54ed2b8bd873f124c7080d73fe73a86ad..f59e9e6dd21a7d034b5e3b6e7787458d
if (displayName == null) { if (displayName == null) {
displayName = net.kyori.adventure.text.Component.empty(); displayName = net.kyori.adventure.text.Component.empty();
} }
@@ -198,6 +199,7 @@ public final class CraftScoreboard implements org.bukkit.scoreboard.Scoreboard { @@ -204,6 +205,7 @@ public final class CraftScoreboard implements org.bukkit.scoreboard.Scoreboard {
@Override @Override
public Team registerNewTeam(String name) { public Team registerNewTeam(String name) {
@ -44,7 +44,7 @@ index a8c5bfc54ed2b8bd873f124c7080d73fe73a86ad..f59e9e6dd21a7d034b5e3b6e7787458d
Preconditions.checkArgument(name != null, "Team name cannot be null"); Preconditions.checkArgument(name != null, "Team name cannot be null");
Preconditions.checkArgument(name.length() <= Short.MAX_VALUE, "Team name '%s' is longer than the limit of 32767 characters (%s)", name, name.length()); Preconditions.checkArgument(name.length() <= Short.MAX_VALUE, "Team name '%s' is longer than the limit of 32767 characters (%s)", name, name.length());
Preconditions.checkArgument(this.board.getPlayerTeam(name) == null, "Team name '%s' is already in use", name); Preconditions.checkArgument(this.board.getPlayerTeam(name) == null, "Team name '%s' is already in use", name);
@@ -225,6 +227,7 @@ public final class CraftScoreboard implements org.bukkit.scoreboard.Scoreboard { @@ -231,6 +233,7 @@ public final class CraftScoreboard implements org.bukkit.scoreboard.Scoreboard {
@Override @Override
public void clearSlot(DisplaySlot slot) { public void clearSlot(DisplaySlot slot) {
@ -53,7 +53,7 @@ index a8c5bfc54ed2b8bd873f124c7080d73fe73a86ad..f59e9e6dd21a7d034b5e3b6e7787458d
this.board.setDisplayObjective(CraftScoreboardTranslations.fromBukkitSlot(slot), null); this.board.setDisplayObjective(CraftScoreboardTranslations.fromBukkitSlot(slot), null);
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboardManager.java b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboardManager.java diff --git a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboardManager.java b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboardManager.java
index 891f850ea99dac1433f3e395e26be14c8abf2bfb..345ee10b109b9b3d7343d915f6bd6b95704cdf60 100644 index b3e1adeb932da9b3bed16acd94e2f16da48a7c72..46a8262f21ef95714c122240ee86f01858010047 100644
--- a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboardManager.java --- a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboardManager.java
+++ b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboardManager.java +++ b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboardManager.java
@@ -42,6 +42,7 @@ public final class CraftScoreboardManager implements ScoreboardManager { @@ -42,6 +42,7 @@ public final class CraftScoreboardManager implements ScoreboardManager {

View File

@ -9,10 +9,10 @@ add explicit block update suppression techniques, it's better
than the server crashing. than the server crashing.
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 2329d08c736ab04f640b0baef3a0d3dce6840a31..1480ddf3a1cc3164571a867be1f5aa02f4c66864 100644 index 91f17ee2b6c9e1413b5bef62adcfe2a0d9537fef..474757fe16986d84f84302a22441c332d622d038 100644
--- a/src/main/java/net/minecraft/world/level/Level.java --- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -1744,7 +1744,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -1764,7 +1764,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
Direction enumdirection = (Direction) iterator.next(); Direction enumdirection = (Direction) iterator.next();
BlockPos blockposition1 = pos.relative(enumdirection); BlockPos blockposition1 = pos.relative(enumdirection);
@ -22,10 +22,10 @@ index 2329d08c736ab04f640b0baef3a0d3dce6840a31..1480ddf3a1cc3164571a867be1f5aa02
if (iblockdata.is(Blocks.COMPARATOR)) { if (iblockdata.is(Blocks.COMPARATOR)) {
diff --git a/src/main/java/net/minecraft/world/level/block/DetectorRailBlock.java b/src/main/java/net/minecraft/world/level/block/DetectorRailBlock.java diff --git a/src/main/java/net/minecraft/world/level/block/DetectorRailBlock.java b/src/main/java/net/minecraft/world/level/block/DetectorRailBlock.java
index 05dfb1790a292f9f85b641377c2ca3675726c127..971fcb61915f8b5f3fc4cbe3f3e4c8d639abdee6 100644 index 034a3bc5b5e526e28088a9715a41ad8ab843860b..42877ed3c59141072a551d0f0d6db7e0eef919a0 100644
--- a/src/main/java/net/minecraft/world/level/block/DetectorRailBlock.java --- a/src/main/java/net/minecraft/world/level/block/DetectorRailBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/DetectorRailBlock.java +++ b/src/main/java/net/minecraft/world/level/block/DetectorRailBlock.java
@@ -127,9 +127,9 @@ public class DetectorRailBlock extends BaseRailBlock { @@ -134,9 +134,9 @@ public class DetectorRailBlock extends BaseRailBlock {
while (iterator.hasNext()) { while (iterator.hasNext()) {
BlockPos blockposition1 = (BlockPos) iterator.next(); BlockPos blockposition1 = (BlockPos) iterator.next();
@ -38,10 +38,10 @@ index 05dfb1790a292f9f85b641377c2ca3675726c127..971fcb61915f8b5f3fc4cbe3f3e4c8d6
} }
diff --git a/src/main/java/net/minecraft/world/level/block/PoweredRailBlock.java b/src/main/java/net/minecraft/world/level/block/PoweredRailBlock.java diff --git a/src/main/java/net/minecraft/world/level/block/PoweredRailBlock.java b/src/main/java/net/minecraft/world/level/block/PoweredRailBlock.java
index 7fddb6fa8fd30ef88346a59f7867aae792f13772..b963f364b4763091c3b5d0f938eaa6798ffa4553 100644 index b84c48902ef24fdae17578a304e6c93dc20c5dce..218c1954a7922c9e6bf6f34f9497f89ce1207eac 100644
--- a/src/main/java/net/minecraft/world/level/block/PoweredRailBlock.java --- a/src/main/java/net/minecraft/world/level/block/PoweredRailBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/PoweredRailBlock.java +++ b/src/main/java/net/minecraft/world/level/block/PoweredRailBlock.java
@@ -97,9 +97,9 @@ public class PoweredRailBlock extends BaseRailBlock { @@ -104,9 +104,9 @@ public class PoweredRailBlock extends BaseRailBlock {
} }
protected boolean isSameRailWithPower(Level world, BlockPos pos, boolean flag, int distance, RailShape shape) { protected boolean isSameRailWithPower(Level world, BlockPos pos, boolean flag, int distance, RailShape shape) {
@ -54,10 +54,10 @@ index 7fddb6fa8fd30ef88346a59f7867aae792f13772..b963f364b4763091c3b5d0f938eaa679
} else { } else {
RailShape blockpropertytrackposition1 = (RailShape) iblockdata.getValue(PoweredRailBlock.SHAPE); RailShape blockpropertytrackposition1 = (RailShape) iblockdata.getValue(PoweredRailBlock.SHAPE);
diff --git a/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java b/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java diff --git a/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java b/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java
index f695d81a646307846abb490b484f166be2993382..fe0ae679f3803156c253cc9caa166e7a9c6ddeed 100644 index bf0e67921d96edde46a97543099f9c03634fca11..b64f0a30a0f7aee5ac9838a11756fdc5c93c36f6 100644
--- a/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java --- a/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java +++ b/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java
@@ -193,8 +193,9 @@ public class RedStoneWireBlock extends Block { @@ -200,8 +200,9 @@ public class RedStoneWireBlock extends Block {
while (iterator.hasNext()) { while (iterator.hasNext()) {
Direction enumdirection = (Direction) iterator.next(); Direction enumdirection = (Direction) iterator.next();
RedstoneSide blockpropertyredstoneside = (RedstoneSide) state.getValue((Property) RedStoneWireBlock.PROPERTY_BY_DIRECTION.get(enumdirection)); RedstoneSide blockpropertyredstoneside = (RedstoneSide) state.getValue((Property) RedStoneWireBlock.PROPERTY_BY_DIRECTION.get(enumdirection));

View File

@ -9,10 +9,10 @@ data deserialization and is racey even in Vanilla. But in Folia,
some accesses may throw and as such we need to fix this directly. 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 diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 89f7825a8cf415f3c2e0ddcb41c159a84d2e4bd1..97bfb92e52c3c5ef1cd22afe2b97c204eb45025a 100644 index c66815bd2a13554aec7176258f8fae542d668d3f..a22173984c418e648ae5308de26fbd5f9cbe6973 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -637,7 +637,7 @@ public class ServerPlayer extends Player { @@ -644,7 +644,7 @@ public class ServerPlayer extends Player {
this.getBukkitEntity().readExtraData(nbt); // CraftBukkit this.getBukkitEntity().readExtraData(nbt); // CraftBukkit
if (this.isSleeping()) { if (this.isSleeping()) {
@ -22,10 +22,10 @@ index 89f7825a8cf415f3c2e0ddcb41c159a84d2e4bd1..97bfb92e52c3c5ef1cd22afe2b97c204
// CraftBukkit start // CraftBukkit start
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index db4f220bc9767ced5a98addc9e8b440b4f4f5b03..82996d0c2891871bd6ef9ff81aef123add08ebda 100644 index d74c6ee198daa125d78cd815e1e0d1f7194caeac..15e441ba4d5286e7bf677f7c0ad5fb8f62437d72 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -4347,6 +4347,11 @@ public abstract class LivingEntity extends Entity implements Attackable { @@ -4360,6 +4360,11 @@ public abstract class LivingEntity extends Entity implements Attackable {
} }
}); });

View File

@ -7,10 +7,10 @@ This allows the player to be re-positioned before logging into
the world without causing thread checks to trip on Folia. the world without causing thread checks to trip on Folia.
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 41ba8950b3aada5eea55a0db841c6b9291262bf2..4b1ee6b9351aeb96ac7a3c2aaa8c464bbca91e22 100644 index bc31d4dfd6fca354c093f552901a59e5b83c92d7..72c32a9b4b0606162a0f994b3d8170f0fe4d5022 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java --- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -516,7 +516,13 @@ public abstract class PlayerList { @@ -514,7 +514,13 @@ public abstract class PlayerList {
CompoundTag nbttagcompound1 = nbttagcompound.getCompound("RootVehicle"); CompoundTag nbttagcompound1 = nbttagcompound.getCompound("RootVehicle");
// CraftBukkit start // CraftBukkit start
ServerLevel finalWorldServer = worldserver1; ServerLevel finalWorldServer = worldserver1;

View File

@ -1361,10 +1361,10 @@ index 0000000000000000000000000000000000000000..e36fd244f71a92d11c6ee45944948be5
+ } + }
+} +}
diff --git a/src/main/java/net/minecraft/network/protocol/PacketUtils.java b/src/main/java/net/minecraft/network/protocol/PacketUtils.java diff --git a/src/main/java/net/minecraft/network/protocol/PacketUtils.java b/src/main/java/net/minecraft/network/protocol/PacketUtils.java
index c06bed93f6a701b1639c1cc334802e7b802431a5..e635f21e3c9c000da9c9da9bf2ec9ed87f664da5 100644 index 98fb69a9adeb6eaab199aec127692acb07f56808..7cc624505931dcb6696c3ef3ee3bbea74f77ad06 100644
--- a/src/main/java/net/minecraft/network/protocol/PacketUtils.java --- a/src/main/java/net/minecraft/network/protocol/PacketUtils.java
+++ b/src/main/java/net/minecraft/network/protocol/PacketUtils.java +++ b/src/main/java/net/minecraft/network/protocol/PacketUtils.java
@@ -50,7 +50,10 @@ public class PacketUtils { @@ -51,7 +51,10 @@ public class PacketUtils {
if (listener.shouldHandleMessage(packet)) { if (listener.shouldHandleMessage(packet)) {
co.aikar.timings.Timing timing = co.aikar.timings.MinecraftTimings.getPacketTiming(packet); // Paper - timings co.aikar.timings.Timing timing = co.aikar.timings.MinecraftTimings.getPacketTiming(packet); // Paper - timings
try (co.aikar.timings.Timing ignored = timing.startTiming()) { // Paper - timings try (co.aikar.timings.Timing ignored = timing.startTiming()) { // Paper - timings
@ -1373,13 +1373,13 @@ index c06bed93f6a701b1639c1cc334802e7b802431a5..e635f21e3c9c000da9c9da9bf2ec9ed8
packet.handle(listener); packet.handle(listener);
+ } finally { profiler.stopTimer(packetTimerId); } // Folia - profiler + } finally { profiler.stopTimer(packetTimerId); } // Folia - profiler
} catch (Exception exception) { } catch (Exception exception) {
if (exception instanceof ReportedException) { label25:
ReportedException reportedexception = (ReportedException) exception; {
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 5ded3dbc379f199ed735b6ce0ebf6a2e3485f93b..4b189b54c8f326939a7b9ffdfb35edfb7d8cee63 100644 index 844424e7488eb42753f50e0e998aebf93c912877..d04862c5f06bafb67b055959ddfe8334914cf5c7 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1462,6 +1462,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -1585,6 +1585,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
// Folia start - region threading // Folia start - region threading
public void tickServer(long startTime, long scheduledEnd, long targetBuffer, public void tickServer(long startTime, long scheduledEnd, long targetBuffer,
io.papermc.paper.threadedregions.TickRegions.TickRegionData region) { io.papermc.paper.threadedregions.TickRegions.TickRegionData region) {
@ -1387,7 +1387,7 @@ index 5ded3dbc379f199ed735b6ce0ebf6a2e3485f93b..4b189b54c8f326939a7b9ffdfb35edfb
if (region != null) { if (region != null) {
region.world.getCurrentWorldData().updateTickData(); region.world.getCurrentWorldData().updateTickData();
if (region.world.checkInitialised.get() != ServerLevel.WORLD_INIT_CHECKED) { if (region.world.checkInitialised.get() != ServerLevel.WORLD_INIT_CHECKED) {
@@ -1496,10 +1497,16 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -1619,10 +1620,16 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
// Folia start - region threading // Folia start - region threading
if (region != null) { if (region != null) {
@ -1404,7 +1404,7 @@ index 5ded3dbc379f199ed735b6ce0ebf6a2e3485f93b..4b189b54c8f326939a7b9ffdfb35edfb
for (Entity entity : region.world.getCurrentWorldData().getLocalEntitiesCopy()) { for (Entity entity : region.world.getCurrentWorldData().getLocalEntitiesCopy()) {
if (!io.papermc.paper.util.TickThread.isTickThreadFor(entity) || entity.isRemoved()) { if (!io.papermc.paper.util.TickThread.isTickThreadFor(entity) || entity.isRemoved()) {
continue; continue;
@@ -1507,10 +1514,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -1630,10 +1637,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
org.bukkit.craftbukkit.entity.CraftEntity bukkit = entity.getBukkitEntityRaw(); org.bukkit.craftbukkit.entity.CraftEntity bukkit = entity.getBukkitEntityRaw();
if (bukkit != null) { if (bukkit != null) {
bukkit.taskScheduler.executeTick(); bukkit.taskScheduler.executeTick();
@ -1420,7 +1420,7 @@ index 5ded3dbc379f199ed735b6ce0ebf6a2e3485f93b..4b189b54c8f326939a7b9ffdfb35edfb
} }
// Folia end - region threading // Folia end - region threading
@@ -1528,6 +1540,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -1653,6 +1665,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
} }
this.profiler.push("save"); this.profiler.push("save");
final boolean fullSave = autosavePeriod > 0 && io.papermc.paper.threadedregions.RegionizedServer.getCurrentTick() % autosavePeriod == 0; // Folia - region threading final boolean fullSave = autosavePeriod > 0 && io.papermc.paper.threadedregions.RegionizedServer.getCurrentTick() % autosavePeriod == 0; // Folia - region threading
@ -1428,7 +1428,7 @@ index 5ded3dbc379f199ed735b6ce0ebf6a2e3485f93b..4b189b54c8f326939a7b9ffdfb35edfb
try { try {
this.isSaving = true; this.isSaving = true;
if (playerSaveInterval > 0) { if (playerSaveInterval > 0) {
@@ -1541,6 +1554,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -1666,6 +1679,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
} finally { } finally {
this.isSaving = false; this.isSaving = false;
} }
@ -1436,7 +1436,7 @@ index 5ded3dbc379f199ed735b6ce0ebf6a2e3485f93b..4b189b54c8f326939a7b9ffdfb35edfb
this.profiler.pop(); this.profiler.pop();
// Paper end // Paper end
io.papermc.paper.util.CachedLists.reset(); // Paper io.papermc.paper.util.CachedLists.reset(); // Paper
@@ -1598,6 +1612,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -1748,6 +1762,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
} }
public void tickChildren(BooleanSupplier shouldKeepTicking, io.papermc.paper.threadedregions.TickRegions.TickRegionData region) { // Folia - region threading public void tickChildren(BooleanSupplier shouldKeepTicking, io.papermc.paper.threadedregions.TickRegions.TickRegionData region) { // Folia - region threading
@ -1444,7 +1444,7 @@ index 5ded3dbc379f199ed735b6ce0ebf6a2e3485f93b..4b189b54c8f326939a7b9ffdfb35edfb
final io.papermc.paper.threadedregions.RegionizedWorldData regionizedWorldData = io.papermc.paper.threadedregions.TickRegionScheduler.getCurrentRegionizedWorldData(); // Folia - regionised ticking final io.papermc.paper.threadedregions.RegionizedWorldData regionizedWorldData = io.papermc.paper.threadedregions.TickRegionScheduler.getCurrentRegionizedWorldData(); // Folia - regionised ticking
if (region == null) this.getPlayerList().getPlayers().forEach((entityplayer) -> { // Folia - region threading if (region == null) this.getPlayerList().getPlayers().forEach((entityplayer) -> { // Folia - region threading
entityplayer.connection.suspendFlushing(); entityplayer.connection.suspendFlushing();
@@ -1664,12 +1679,14 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -1814,12 +1829,14 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
try { try {
worldserver.timings.doTick.startTiming(); // Spigot worldserver.timings.doTick.startTiming(); // Spigot
@ -1518,10 +1518,10 @@ index f640a0b8742a8362401f91a9a0f8fbb31885dca0..50597a8b45bbd7dcc40b361da78358d9
// Folia end - region threading - replace entity tracking ticking // Folia end - region threading - replace entity tracking ticking
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index 4ed40924942bc3252fb1a533190765fbfdb2ba72..b9b1dfe04eda8498f0ceff0aee66489d2a02b814 100644 index a363c9d74d2a50a3bb3c3e323f7cf921c50bbff7..d248c0492a34c11fb96c9dd6f0a3d180ee846c51 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -436,16 +436,23 @@ public class ServerChunkCache extends ChunkSource { @@ -434,16 +434,23 @@ public class ServerChunkCache extends ChunkSource {
@Override @Override
public void tick(BooleanSupplier shouldKeepTicking, boolean tickChunks) { public void tick(BooleanSupplier shouldKeepTicking, boolean tickChunks) {
@ -1543,76 +1543,76 @@ index 4ed40924942bc3252fb1a533190765fbfdb2ba72..b9b1dfe04eda8498f0ceff0aee66489d
this.tickChunks(); this.tickChunks();
+ } finally { profiler.stopTimer(ca.spottedleaf.leafprofiler.LProfilerRegistry.CHUNK_TICK); } // Folia - profiler + } finally { profiler.stopTimer(ca.spottedleaf.leafprofiler.LProfilerRegistry.CHUNK_TICK); } // Folia - profiler
this.level.timings.chunks.stopTiming(); // Paper - timings this.level.timings.chunks.stopTiming(); // Paper - timings
this.chunkMap.tick();
} }
@@ -458,6 +465,7 @@ public class ServerChunkCache extends ChunkSource {
@@ -459,6 +466,7 @@ public class ServerChunkCache extends ChunkSource {
private void tickChunks() { private void tickChunks() {
io.papermc.paper.threadedregions.RegionizedWorldData regionizedWorldData = this.level.getCurrentWorldData(); // Folia - region threading io.papermc.paper.threadedregions.RegionizedWorldData regionizedWorldData = this.level.getCurrentWorldData(); // Folia - region threading
+ final ca.spottedleaf.leafprofiler.RegionizedProfiler.Handle profiler = io.papermc.paper.threadedregions.TickRegionScheduler.getProfiler(); // Folia - profiler + final ca.spottedleaf.leafprofiler.RegionizedProfiler.Handle profiler = io.papermc.paper.threadedregions.TickRegionScheduler.getProfiler(); // Folia - profiler
long i = this.level.getGameTime(); //long i = this.level.getGameTime(); // Folia - region threading
long j = 1; // Folia - region threading long j = 1; // Folia - region threading
@@ -480,6 +488,7 @@ public class ServerChunkCache extends ChunkSource { @@ -512,6 +520,7 @@ public class ServerChunkCache extends ChunkSource {
int l = this.distanceManager.getNaturalSpawnChunkCount(); // Paper start - per player mob spawning
// Paper start - per player mob spawning int naturalSpawnChunkCount = k;
NaturalSpawner.SpawnState spawnercreature_d; // moved down NaturalSpawner.SpawnState spawnercreature_d; // moved down
+ profiler.startTimer(ca.spottedleaf.leafprofiler.LProfilerRegistry.MOB_SPAWN_ENTITY_COUNT); try { // Folia - profiler + profiler.startTimer(ca.spottedleaf.leafprofiler.LProfilerRegistry.MOB_SPAWN_ENTITY_COUNT); try { // Folia - profiler
if ((this.spawnFriendlies || this.spawnEnemies) && this.level.paperConfig().entities.spawning.perPlayerMobSpawns) { // don't count mobs when animals and monsters are disabled if ((this.spawnFriendlies || this.spawnEnemies) && this.level.paperConfig().entities.spawning.perPlayerMobSpawns) { // don't count mobs when animals and monsters are disabled
// re-set mob counts // re-set mob counts
for (ServerPlayer player : regionizedWorldData.getLocalPlayers()) { // Folia - region threading for (ServerPlayer player : this.level.getLocalPlayers()) { // Folia - region threading
@@ -499,6 +508,7 @@ public class ServerChunkCache extends ChunkSource { @@ -531,6 +540,7 @@ public class ServerChunkCache extends ChunkSource {
} else { } else {
spawnercreature_d = NaturalSpawner.createState(l, regionizedWorldData.getLoadedEntities(), this::getFullChunk, !this.level.paperConfig().entities.spawning.perPlayerMobSpawns ? new LocalMobCapCalculator(this.chunkMap) : null, false); // Folia - region threading spawnercreature_d = NaturalSpawner.createState(naturalSpawnChunkCount, regionizedWorldData.getLoadedEntities(), this::getFullChunk, !this.level.paperConfig().entities.spawning.perPlayerMobSpawns ? new LocalMobCapCalculator(this.chunkMap) : null, false); // Folia - region threading - note: function only cares about loaded entities, doesn't need all
} }
+ } finally { profiler.stopTimer(ca.spottedleaf.leafprofiler.LProfilerRegistry.MOB_SPAWN_ENTITY_COUNT); } // Folia - profiler + } finally { profiler.stopTimer(ca.spottedleaf.leafprofiler.LProfilerRegistry.MOB_SPAWN_ENTITY_COUNT); } // Folia - profiler
// Paper end // Paper end
this.level.timings.countNaturalMobs.stopTiming(); // Paper - timings this.level.timings.countNaturalMobs.stopTiming(); // Paper - timings
@@ -566,6 +576,9 @@ public class ServerChunkCache extends ChunkSource { @@ -592,6 +602,9 @@ public class ServerChunkCache extends ChunkSource {
} }
try { try {
// Paper end - optimise chunk tick iteration // Paper end - optimise chunk tick iteration
+ long spawnChunkCount = 0L; // Folia - profiler + long spawnChunkCount = 0L; // Folia - profiler
+ long randomChunkCount = 0L; // Folia - profiler + long randomChunkCount = 0L; // Folia - profiler
+ profiler.startTimer(ca.spottedleaf.leafprofiler.LProfilerRegistry.SPAWN_AND_RANDOM_TICK); try { // Folia - profiler + profiler.startTimer(ca.spottedleaf.leafprofiler.LProfilerRegistry.SPAWN_AND_RANDOM_TICK); try { // Folia - profiler
while (iterator1.hasNext()) { while (chunkIterator.hasNext()) {
LevelChunk chunk1 = iterator1.next(); // Paper - optimise chunk tick iteration LevelChunk chunk1 = chunkIterator.next(); // Paper - optimise chunk tick iteration
ChunkPos chunkcoordintpair = chunk1.getPos(); ChunkPos chunkcoordintpair = chunk1.getPos();
@@ -596,15 +609,20 @@ public class ServerChunkCache extends ChunkSource { @@ -623,15 +636,20 @@ public class ServerChunkCache extends ChunkSource {
if (tick && chunk1.chunkStatus.isOrAfter(net.minecraft.server.level.FullChunkStatus.ENTITY_TICKING)) { // Paper - optimise chunk tick iteration // Paper end - optimise chunk tick iteration
chunk1.incrementInhabitedTime(j); chunk1.incrementInhabitedTime(j);
if (spawn && flag2 && (this.spawnEnemies || this.spawnFriendlies) && this.level.getWorldBorder().isWithinBounds(chunkcoordintpair)) { // Spigot // Paper - optimise chunk tick iteration if (spawn && flag && (this.spawnEnemies || this.spawnFriendlies) && this.level.getWorldBorder().isWithinBounds(chunkcoordintpair)) { // Spigot // Paper - optimise chunk tick iteration
+ ++spawnChunkCount; // Folia - profiler + ++spawnChunkCount; // Folia - profiler
NaturalSpawner.spawnForChunk(this.level, chunk1, spawnercreature_d, this.spawnFriendlies, this.spawnEnemies, flag1); NaturalSpawner.spawnForChunk(this.level, chunk1, spawnercreature_d, this.spawnFriendlies, this.spawnEnemies, flag1);
} }
if (true || this.level.shouldTickBlocksAt(chunkcoordintpair.toLong())) { // Paper - optimise chunk tick iteration if (true || this.level.shouldTickBlocksAt(chunkcoordintpair.toLong())) { // Paper - optimise chunk tick iteration
+ ++randomChunkCount; // Folia - profiler + ++randomChunkCount; // Folia - profiler
this.level.tickChunk(chunk1, k); this.level.tickChunk(chunk1, l);
if ((chunksTicked++ & 1) == 0) net.minecraft.server.MinecraftServer.getServer().executeMidTickTasks(); // Paper if ((chunksTicked++ & 1) == 0) net.minecraft.server.MinecraftServer.getServer().executeMidTickTasks(); // Paper
}
} }
} }
} + profiler.addCounter(ca.spottedleaf.leafprofiler.LProfilerRegistry.SPAWN_CHUNK_COUNT, spawnChunkCount); // Folia - profiler
+ profiler.addCounter(ca.spottedleaf.leafprofiler.LProfilerRegistry.SPAWN_CHUNK_COUNT, spawnChunkCount); // Folia - profiler + profiler.addCounter(ca.spottedleaf.leafprofiler.LProfilerRegistry.RANDOM_CHUNK_TICK_COUNT, randomChunkCount); // Folia - profiler
+ profiler.addCounter(ca.spottedleaf.leafprofiler.LProfilerRegistry.RANDOM_CHUNK_TICK_COUNT, randomChunkCount); // Folia - profiler + } finally { profiler.stopTimer(ca.spottedleaf.leafprofiler.LProfilerRegistry.SPAWN_AND_RANDOM_TICK); } // Folia - profiler
+ } finally { profiler.stopTimer(ca.spottedleaf.leafprofiler.LProfilerRegistry.SPAWN_AND_RANDOM_TICK); } // Folia - profiler // Paper start - optimise chunk tick iteration
// Paper start - optimise chunk tick iteration } finally {
} finally { if (chunkIterator instanceof io.papermc.paper.util.maplist.IteratorSafeOrderedReferenceSet.Iterator safeIterator) {
if (iterator1 instanceof io.papermc.paper.util.maplist.IteratorSafeOrderedReferenceSet.Iterator safeIterator) { @@ -643,9 +661,11 @@ public class ServerChunkCache extends ChunkSource {
@@ -615,9 +633,11 @@ public class ServerChunkCache extends ChunkSource {
this.level.timings.chunkTicks.stopTiming(); // Paper gameprofilerfiller.popPush("customSpawners");
gameprofilerfiller.popPush("customSpawners"); if (flag) {
if (flag2) { + profiler.startTimer(ca.spottedleaf.leafprofiler.LProfilerRegistry.MISC_MOB_SPAWN_TICK); try { // Folia - profiler
+ profiler.startTimer(ca.spottedleaf.leafprofiler.LProfilerRegistry.MISC_MOB_SPAWN_TICK); try { // Folia - profiler try (co.aikar.timings.Timing ignored = this.level.timings.miscMobSpawning.startTiming()) { // Paper - timings
try (co.aikar.timings.Timing ignored = this.level.timings.miscMobSpawning.startTiming()) { // Paper - timings this.level.tickCustomSpawners(this.spawnEnemies, this.spawnFriendlies);
this.level.tickCustomSpawners(this.spawnEnemies, this.spawnFriendlies); } // Paper - timings
} // Paper - timings + } finally { profiler.stopTimer(ca.spottedleaf.leafprofiler.LProfilerRegistry.MISC_MOB_SPAWN_TICK); } // Folia - profiler
+ } finally { profiler.stopTimer(ca.spottedleaf.leafprofiler.LProfilerRegistry.MISC_MOB_SPAWN_TICK); } // Folia - profiler }
} }
gameprofilerfiller.popPush("broadcast"); @@ -655,6 +675,7 @@ public class ServerChunkCache extends ChunkSource {
@@ -626,6 +646,7 @@ public class ServerChunkCache extends ChunkSource {
// Paper start - optimise chunk tick iteration // Paper start - optimise chunk tick iteration
// Folia start - region threading // Folia start - region threading
if (!this.level.needsChangeBroadcasting.isEmpty()) { if (!this.level.needsChangeBroadcasting.isEmpty()) {
@ -1620,7 +1620,7 @@ index 4ed40924942bc3252fb1a533190765fbfdb2ba72..b9b1dfe04eda8498f0ceff0aee66489d
for (Iterator<ChunkHolder> iterator = this.level.needsChangeBroadcasting.iterator(); iterator.hasNext();) { for (Iterator<ChunkHolder> iterator = this.level.needsChangeBroadcasting.iterator(); iterator.hasNext();) {
ChunkHolder holder = iterator.next(); ChunkHolder holder = iterator.next();
if (!io.papermc.paper.util.TickThread.isTickThreadFor(holder.newChunkHolder.world, holder.pos)) { if (!io.papermc.paper.util.TickThread.isTickThreadFor(holder.newChunkHolder.world, holder.pos)) {
@@ -637,6 +658,7 @@ public class ServerChunkCache extends ChunkSource { @@ -666,6 +687,7 @@ public class ServerChunkCache extends ChunkSource {
iterator.remove(); iterator.remove();
} }
} }
@ -1629,10 +1629,10 @@ index 4ed40924942bc3252fb1a533190765fbfdb2ba72..b9b1dfe04eda8498f0ceff0aee66489d
// Folia end - region threading // Folia end - region threading
// Paper end - optimise chunk tick iteration // Paper end - optimise chunk tick iteration
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 10cf0ffb2cf519f0904dbe709b9042d30d5fd827..724aa1d8147ea2fb5e46d291adacfb7e1f5b5f62 100644 index 72af30b281f2bb1dd4beee746a1b3f7bebbc7260..8cf413e42d560d90dfcbcb1d61ed410e992a8f4c 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -891,6 +891,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -893,6 +893,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
public void tick(BooleanSupplier shouldKeepTicking, io.papermc.paper.threadedregions.TickRegions.TickRegionData region) { // Folia - regionised ticking public void tick(BooleanSupplier shouldKeepTicking, io.papermc.paper.threadedregions.TickRegions.TickRegionData region) { // Folia - regionised ticking
final io.papermc.paper.threadedregions.RegionizedWorldData regionizedWorldData = this.getCurrentWorldData(); // Folia - regionised ticking final io.papermc.paper.threadedregions.RegionizedWorldData regionizedWorldData = this.getCurrentWorldData(); // Folia - regionised ticking
@ -1640,8 +1640,8 @@ index 10cf0ffb2cf519f0904dbe709b9042d30d5fd827..724aa1d8147ea2fb5e46d291adacfb7e
ProfilerFiller gameprofilerfiller = this.getProfiler(); ProfilerFiller gameprofilerfiller = this.getProfiler();
regionizedWorldData.setHandlingTick(true); // Folia - regionised ticking regionizedWorldData.setHandlingTick(true); // Folia - regionised ticking
@@ -910,24 +911,34 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -921,9 +922,13 @@ public class ServerLevel extends Level implements WorldGenLevel {
if (!this.isDebug()) { if (!this.isDebug() && flag) {
j = regionizedWorldData.getRedstoneGameTime(); // Folia - region threading j = regionizedWorldData.getRedstoneGameTime(); // Folia - region threading
gameprofilerfiller.push("blockTicks"); gameprofilerfiller.push("blockTicks");
+ profiler.startTimer(ca.spottedleaf.leafprofiler.LProfilerRegistry.BLOCK_TICK); try { // Folia - profiler + profiler.startTimer(ca.spottedleaf.leafprofiler.LProfilerRegistry.BLOCK_TICK); try { // Folia - profiler
@ -1654,13 +1654,16 @@ index 10cf0ffb2cf519f0904dbe709b9042d30d5fd827..724aa1d8147ea2fb5e46d291adacfb7e
gameprofilerfiller.pop(); gameprofilerfiller.pop();
} }
this.timings.scheduledBlocks.stopTiming(); // Paper this.timings.scheduledBlocks.stopTiming(); // Paper
@@ -931,18 +936,24 @@ public class ServerLevel extends Level implements WorldGenLevel {
gameprofilerfiller.popPush("raid"); gameprofilerfiller.popPush("raid");
this.timings.raids.startTiming(); // Paper - timings if (flag) {
+ profiler.startTimer(ca.spottedleaf.leafprofiler.LProfilerRegistry.RAIDS_TICK); try { // Folia - profiler this.timings.raids.startTiming(); // Paper - timings
this.raids.tick(); + profiler.startTimer(ca.spottedleaf.leafprofiler.LProfilerRegistry.RAIDS_TICK); try { // Folia - profiler
+ } finally { profiler.stopTimer(ca.spottedleaf.leafprofiler.LProfilerRegistry.RAIDS_TICK); } // Folia - profiler this.raids.tick();
this.timings.raids.stopTiming(); // Paper - timings + } finally { profiler.stopTimer(ca.spottedleaf.leafprofiler.LProfilerRegistry.RAIDS_TICK); } // Folia - profiler
this.timings.raids.stopTiming(); // Paper - timings
}
gameprofilerfiller.popPush("chunkSource"); gameprofilerfiller.popPush("chunkSource");
this.timings.chunkProviderTick.startTiming(); // Paper - timings this.timings.chunkProviderTick.startTiming(); // Paper - timings
+ profiler.startTimer(ca.spottedleaf.leafprofiler.LProfilerRegistry.CHUNK_PROVIDER_TICK); try { // Folia - profiler + profiler.startTimer(ca.spottedleaf.leafprofiler.LProfilerRegistry.CHUNK_PROVIDER_TICK); try { // Folia - profiler
@ -1668,22 +1671,23 @@ index 10cf0ffb2cf519f0904dbe709b9042d30d5fd827..724aa1d8147ea2fb5e46d291adacfb7e
+ } finally { profiler.stopTimer(ca.spottedleaf.leafprofiler.LProfilerRegistry.CHUNK_PROVIDER_TICK); } // Folia - profiler + } finally { profiler.stopTimer(ca.spottedleaf.leafprofiler.LProfilerRegistry.CHUNK_PROVIDER_TICK); } // Folia - profiler
this.timings.chunkProviderTick.stopTiming(); // Paper - timings this.timings.chunkProviderTick.stopTiming(); // Paper - timings
gameprofilerfiller.popPush("blockEvents"); gameprofilerfiller.popPush("blockEvents");
this.timings.doSounds.startTiming(); // Spigot if (flag) {
+ profiler.startTimer(ca.spottedleaf.leafprofiler.LProfilerRegistry.BLOCK_EVENT_TICK); try { // Folia - profiler this.timings.doSounds.startTiming(); // Spigot
this.runBlockEvents(); + profiler.startTimer(ca.spottedleaf.leafprofiler.LProfilerRegistry.BLOCK_EVENT_TICK); try { // Folia - profiler
+ } finally { profiler.stopTimer(ca.spottedleaf.leafprofiler.LProfilerRegistry.BLOCK_EVENT_TICK); } // Folia - profiler this.runBlockEvents();
this.timings.doSounds.stopTiming(); // Spigot + } finally { profiler.stopTimer(ca.spottedleaf.leafprofiler.LProfilerRegistry.BLOCK_EVENT_TICK); } // Folia - profiler
regionizedWorldData.setHandlingTick(false); // Folia - regionised ticking this.timings.doSounds.stopTiming(); // Spigot
gameprofilerfiller.pop(); }
@@ -941,6 +952,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -958,6 +969,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
gameprofilerfiller.push("entities"); gameprofilerfiller.push("entities");
this.timings.tickEntities.startTiming(); // Spigot this.timings.tickEntities.startTiming(); // Spigot
if (this.dragonFight != null) { if (this.dragonFight != null && flag) {
+ profiler.startTimer(ca.spottedleaf.leafprofiler.LProfilerRegistry.DRAGON_FIGHT_TICK); try { // Folia - profiler + profiler.startTimer(ca.spottedleaf.leafprofiler.LProfilerRegistry.DRAGON_FIGHT_TICK); try { // Folia - profiler
if (io.papermc.paper.util.TickThread.isTickThreadFor(this, this.dragonFight.origin)) { // Folia - region threading if (io.papermc.paper.util.TickThread.isTickThreadFor(this, this.dragonFight.origin)) { // Folia - region threading
gameprofilerfiller.push("dragonFight"); gameprofilerfiller.push("dragonFight");
this.dragonFight.tick(); this.dragonFight.tick();
@@ -953,10 +965,12 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -970,10 +982,12 @@ public class ServerLevel extends Level implements WorldGenLevel {
fightCenter fightCenter
); );
} // Folia end - region threading } // Folia end - region threading
@ -1696,7 +1700,7 @@ index 10cf0ffb2cf519f0904dbe709b9042d30d5fd827..724aa1d8147ea2fb5e46d291adacfb7e
regionizedWorldData.forEachTickingEntity((entity) -> { // Folia - regionised ticking regionizedWorldData.forEachTickingEntity((entity) -> { // Folia - regionised ticking
if (!entity.isRemoved()) { if (!entity.isRemoved()) {
if (false && this.shouldDiscardEntity(entity)) { // CraftBukkit - We prevent spawning in general, so this butchering is not needed if (false && this.shouldDiscardEntity(entity)) { // CraftBukkit - We prevent spawning in general, so this butchering is not needed
@@ -984,10 +998,13 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -1001,10 +1015,13 @@ public class ServerLevel extends Level implements WorldGenLevel {
} }
} }
}); });
@ -1710,7 +1714,7 @@ index 10cf0ffb2cf519f0904dbe709b9042d30d5fd827..724aa1d8147ea2fb5e46d291adacfb7e
} }
gameprofilerfiller.push("entityManagement"); gameprofilerfiller.push("entityManagement");
@@ -1047,12 +1064,15 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -1064,12 +1081,15 @@ public class ServerLevel extends Level implements WorldGenLevel {
} }
public void tickCustomSpawners(boolean spawnMonsters, boolean spawnAnimals) { public void tickCustomSpawners(boolean spawnMonsters, boolean spawnAnimals) {
@ -1726,7 +1730,7 @@ index 10cf0ffb2cf519f0904dbe709b9042d30d5fd827..724aa1d8147ea2fb5e46d291adacfb7e
} }
} }
@@ -1495,6 +1515,11 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -1519,6 +1539,11 @@ public class ServerLevel extends Level implements WorldGenLevel {
// Paper start- timings // Paper start- timings
final boolean isActive = org.spigotmc.ActivationRange.checkIfActive(entity); final boolean isActive = org.spigotmc.ActivationRange.checkIfActive(entity);
timer = isActive ? entity.getType().tickTimer.startTiming() : entity.getType().inactiveTickTimer.startTiming(); // Paper timer = isActive ? entity.getType().tickTimer.startTiming() : entity.getType().inactiveTickTimer.startTiming(); // Paper
@ -1738,7 +1742,7 @@ index 10cf0ffb2cf519f0904dbe709b9042d30d5fd827..724aa1d8147ea2fb5e46d291adacfb7e
try { try {
// Paper end - timings // Paper end - timings
entity.setOldPosAndRot(); entity.setOldPosAndRot();
@@ -1520,7 +1545,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -1544,7 +1569,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
// Folia end - region threading // Folia end - region threading
} else { entity.inactiveTick(); } // Paper - EAR 2 } else { entity.inactiveTick(); } // Paper - EAR 2
this.getProfiler().pop(); this.getProfiler().pop();
@ -1747,7 +1751,7 @@ index 10cf0ffb2cf519f0904dbe709b9042d30d5fd827..724aa1d8147ea2fb5e46d291adacfb7e
Iterator iterator = entity.getPassengers().iterator(); Iterator iterator = entity.getPassengers().iterator();
while (iterator.hasNext()) { while (iterator.hasNext()) {
@@ -1544,6 +1569,11 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -1568,6 +1593,11 @@ public class ServerLevel extends Level implements WorldGenLevel {
// Paper - EAR 2 // Paper - EAR 2
final boolean isActive = org.spigotmc.ActivationRange.checkIfActive(passenger); final boolean isActive = org.spigotmc.ActivationRange.checkIfActive(passenger);
co.aikar.timings.Timing timer = isActive ? passenger.getType().passengerTickTimer.startTiming() : passenger.getType().passengerInactiveTickTimer.startTiming(); // Paper co.aikar.timings.Timing timer = isActive ? passenger.getType().passengerTickTimer.startTiming() : passenger.getType().passengerInactiveTickTimer.startTiming(); // Paper
@ -1759,7 +1763,7 @@ index 10cf0ffb2cf519f0904dbe709b9042d30d5fd827..724aa1d8147ea2fb5e46d291adacfb7e
try { try {
// Paper end // Paper end
passenger.setOldPosAndRot(); passenger.setOldPosAndRot();
@@ -1583,7 +1613,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -1607,7 +1637,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
this.tickPassenger(passenger, entity2); this.tickPassenger(passenger, entity2);
} }
@ -1769,10 +1773,10 @@ index 10cf0ffb2cf519f0904dbe709b9042d30d5fd827..724aa1d8147ea2fb5e46d291adacfb7e
} else { } else {
passenger.stopRiding(); passenger.stopRiding();
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 4b1ee6b9351aeb96ac7a3c2aaa8c464bbca91e22..7edaa7558e40942f94c459e9b480ef640146ec6b 100644 index 72c32a9b4b0606162a0f994b3d8170f0fe4d5022..dfc0e3ce3ba88c3dbff909524de348fbe76de3a9 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java --- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -1325,6 +1325,7 @@ public abstract class PlayerList { @@ -1323,6 +1323,7 @@ public abstract class PlayerList {
public void saveAll(int interval) { public void saveAll(int interval) {
io.papermc.paper.util.MCUtil.ensureMain("Save Players" , () -> { // Paper - Ensure main io.papermc.paper.util.MCUtil.ensureMain("Save Players" , () -> { // Paper - Ensure main
@ -1780,7 +1784,7 @@ index 4b1ee6b9351aeb96ac7a3c2aaa8c464bbca91e22..7edaa7558e40942f94c459e9b480ef64
MinecraftTimings.savePlayers.startTiming(); // Paper MinecraftTimings.savePlayers.startTiming(); // Paper
int numSaved = 0; int numSaved = 0;
long now = System.nanoTime(); // Folia - region threading long now = System.nanoTime(); // Folia - region threading
@@ -1336,7 +1337,9 @@ public abstract class PlayerList { @@ -1334,7 +1335,9 @@ public abstract class PlayerList {
} }
// Folia end - region threading // Folia end - region threading
if (interval == -1 || now - entityplayer.lastSave >= timeInterval) { // Folia - region threading if (interval == -1 || now - entityplayer.lastSave >= timeInterval) { // Folia - region threading
@ -1791,10 +1795,10 @@ index 4b1ee6b9351aeb96ac7a3c2aaa8c464bbca91e22..7edaa7558e40942f94c459e9b480ef64
if (interval != -1 && max != -1 && ++numSaved >= max) { if (interval != -1 && max != -1 && ++numSaved >= max) {
break; break;
diff --git a/src/main/java/net/minecraft/world/entity/EntityType.java b/src/main/java/net/minecraft/world/entity/EntityType.java diff --git a/src/main/java/net/minecraft/world/entity/EntityType.java b/src/main/java/net/minecraft/world/entity/EntityType.java
index 73871f456a85bda1e51f54986d0e61fb629822e8..3f3494c20cd15a721090f1b36293562a6b834b14 100644 index 940b8d0b89d7e55c938aefbe80ee71b0db3dacb8..a3a6c10f5b4157062a8a8d5ee4638c4e9d6fcf62 100644
--- a/src/main/java/net/minecraft/world/entity/EntityType.java --- a/src/main/java/net/minecraft/world/entity/EntityType.java
+++ b/src/main/java/net/minecraft/world/entity/EntityType.java +++ b/src/main/java/net/minecraft/world/entity/EntityType.java
@@ -322,6 +322,13 @@ public class EntityType<T extends Entity> implements FeatureElement, EntityTypeT @@ -326,6 +326,13 @@ public class EntityType<T extends Entity> implements FeatureElement, EntityTypeT
return BuiltInRegistries.ENTITY_TYPE.getOptional(ResourceLocation.tryParse(id)); return BuiltInRegistries.ENTITY_TYPE.getOptional(ResourceLocation.tryParse(id));
} }
@ -1808,7 +1812,7 @@ index 73871f456a85bda1e51f54986d0e61fb629822e8..3f3494c20cd15a721090f1b36293562a
public EntityType(EntityType.EntityFactory<T> factory, MobCategory spawnGroup, boolean saveable, boolean summonable, boolean fireImmune, boolean spawnableFarFromPlayer, ImmutableSet<Block> canSpawnInside, EntityDimensions dimensions, int maxTrackDistance, int trackTickInterval, FeatureFlagSet requiredFeatures) { public EntityType(EntityType.EntityFactory<T> factory, MobCategory spawnGroup, boolean saveable, boolean summonable, boolean fireImmune, boolean spawnableFarFromPlayer, ImmutableSet<Block> canSpawnInside, EntityDimensions dimensions, int maxTrackDistance, int trackTickInterval, FeatureFlagSet requiredFeatures) {
// Paper start // Paper start
this(factory, spawnGroup, saveable, summonable, fireImmune, spawnableFarFromPlayer, canSpawnInside, dimensions, maxTrackDistance, trackTickInterval, requiredFeatures, "custom"); this(factory, spawnGroup, saveable, summonable, fireImmune, spawnableFarFromPlayer, canSpawnInside, dimensions, maxTrackDistance, trackTickInterval, requiredFeatures, "custom");
@@ -332,6 +339,12 @@ public class EntityType<T extends Entity> implements FeatureElement, EntityTypeT @@ -336,6 +343,12 @@ public class EntityType<T extends Entity> implements FeatureElement, EntityTypeT
this.passengerTickTimer = co.aikar.timings.MinecraftTimings.getEntityTimings(id, "passengerTick"); this.passengerTickTimer = co.aikar.timings.MinecraftTimings.getEntityTimings(id, "passengerTick");
this.passengerInactiveTickTimer = co.aikar.timings.MinecraftTimings.getEntityTimings(id, "passengerInactiveTick"); this.passengerInactiveTickTimer = co.aikar.timings.MinecraftTimings.getEntityTimings(id, "passengerInactiveTick");
// Paper end // Paper end
@ -1822,10 +1826,10 @@ index 73871f456a85bda1e51f54986d0e61fb629822e8..3f3494c20cd15a721090f1b36293562a
this.factory = factory; this.factory = factory;
this.category = spawnGroup; this.category = spawnGroup;
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 1480ddf3a1cc3164571a867be1f5aa02f4c66864..c58ca3dd28b9c113a26feb1a7f05bd78c0dbd678 100644 index 474757fe16986d84f84302a22441c332d622d038..9244aaa1be1a4ba2c6eec5bcaeea7c5c0081ac39 100644
--- a/src/main/java/net/minecraft/world/level/Level.java --- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -226,6 +226,9 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -229,6 +229,9 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
return this.getCurrentWorldData().getLocalPlayers(); return this.getCurrentWorldData().getLocalPlayers();
} }
// Folia end - region ticking // Folia end - region ticking
@ -1835,7 +1839,7 @@ index 1480ddf3a1cc3164571a867be1f5aa02f4c66864..c58ca3dd28b9c113a26feb1a7f05bd78
protected Level(WritableLevelData worlddatamutable, ResourceKey<Level> resourcekey, RegistryAccess iregistrycustom, Holder<DimensionType> holder, Supplier<ProfilerFiller> supplier, boolean flag, boolean flag1, long i, int j, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env, java.util.function.Function<org.spigotmc.SpigotWorldConfig, io.papermc.paper.configuration.WorldConfiguration> paperWorldConfigCreator, java.util.concurrent.Executor executor) { // Paper - Async-Anti-Xray - Pass executor protected Level(WritableLevelData worlddatamutable, ResourceKey<Level> resourcekey, RegistryAccess iregistrycustom, Holder<DimensionType> holder, Supplier<ProfilerFiller> supplier, boolean flag, boolean flag1, long i, int j, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env, java.util.function.Function<org.spigotmc.SpigotWorldConfig, io.papermc.paper.configuration.WorldConfiguration> paperWorldConfigCreator, java.util.concurrent.Executor executor) { // Paper - Async-Anti-Xray - Pass executor
this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName()); // Spigot this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName()); // Spigot
@@ -318,6 +321,9 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -321,6 +324,9 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
this.minSection = io.papermc.paper.util.WorldUtil.getMinSection(this); this.minSection = io.papermc.paper.util.WorldUtil.getMinSection(this);
this.maxSection = io.papermc.paper.util.WorldUtil.getMaxSection(this); this.maxSection = io.papermc.paper.util.WorldUtil.getMaxSection(this);
// Paper end - optimise collisions // Paper end - optimise collisions
@ -1845,7 +1849,7 @@ index 1480ddf3a1cc3164571a867be1f5aa02f4c66864..c58ca3dd28b9c113a26feb1a7f05bd78
} }
// Paper start // Paper start
@@ -1295,17 +1301,21 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -1304,17 +1310,21 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
} }
protected void tickBlockEntities() { protected void tickBlockEntities() {
@ -1865,9 +1869,9 @@ index 1480ddf3a1cc3164571a867be1f5aa02f4c66864..c58ca3dd28b9c113a26feb1a7f05bd78
this.timings.tileEntityTick.startTiming(); // Spigot this.timings.tileEntityTick.startTiming(); // Spigot
+ profiler.startTimer(ca.spottedleaf.leafprofiler.LProfilerRegistry.TILE_ENTITY_TICK); try { // Folia - profiler + profiler.startTimer(ca.spottedleaf.leafprofiler.LProfilerRegistry.TILE_ENTITY_TICK); try { // Folia - profiler
// Spigot start // Spigot start
// Iterator iterator = this.blockEntityTickers.iterator(); // Iterator<TickingBlockEntity> iterator = this.blockEntityTickers.iterator();
int tilesThisCycle = 0; boolean flag = this.tickRateManager().runsNormally();
@@ -1336,6 +1346,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -1347,6 +1357,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
} }
} }
blockEntityTickers.removeAll(toRemove); // Folia - regionised ticking blockEntityTickers.removeAll(toRemove); // Folia - regionised ticking
@ -1876,10 +1880,10 @@ index 1480ddf3a1cc3164571a867be1f5aa02f4c66864..c58ca3dd28b9c113a26feb1a7f05bd78
this.timings.tileEntityTick.stopTiming(); // Spigot this.timings.tileEntityTick.stopTiming(); // Spigot
regionizedWorldData.seTtickingBlockEntities(false); // Folia - regionised ticking regionizedWorldData.seTtickingBlockEntities(false); // Folia - regionised ticking
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BlockEntityType.java b/src/main/java/net/minecraft/world/level/block/entity/BlockEntityType.java diff --git a/src/main/java/net/minecraft/world/level/block/entity/BlockEntityType.java b/src/main/java/net/minecraft/world/level/block/entity/BlockEntityType.java
index 2c1bc515468e2ba99d463021758fb72ef160fbe9..93cc5523a1c3637bf4f04ff4ef0f8ef6e1050a59 100644 index 2e110da3502a7ac5ec4cc20510a3fac933569895..5aac65f37a0190c5d6a7175073fb0cc0f129de11 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/BlockEntityType.java --- a/src/main/java/net/minecraft/world/level/block/entity/BlockEntityType.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/BlockEntityType.java +++ b/src/main/java/net/minecraft/world/level/block/entity/BlockEntityType.java
@@ -78,10 +78,17 @@ public class BlockEntityType<T extends BlockEntity> { @@ -80,10 +80,17 @@ public class BlockEntityType<T extends BlockEntity> {
} }
Type<?> type = Util.fetchChoiceType(References.BLOCK_ENTITY, id); Type<?> type = Util.fetchChoiceType(References.BLOCK_ENTITY, id);
@ -1898,7 +1902,7 @@ index 2c1bc515468e2ba99d463021758fb72ef160fbe9..93cc5523a1c3637bf4f04ff4ef0f8ef6
this.factory = factory; this.factory = factory;
this.validBlocks = blocks; this.validBlocks = blocks;
this.dataType = type; this.dataType = type;
@@ -126,7 +133,12 @@ public class BlockEntityType<T extends BlockEntity> { @@ -128,7 +135,12 @@ public class BlockEntityType<T extends BlockEntity> {
} }
public BlockEntityType<T> build(Type<?> type) { public BlockEntityType<T> build(Type<?> type) {

2
update.txt Normal file
View File

@ -0,0 +1,2 @@
- Fix compile
- Tick rate manager - what to do with you (also: check tickChunks [specifically inhabited time] with respect to how this works now)