mirror of
https://github.com/SparklyPower/SparklyPaper.git
synced 2025-12-19 15:09:27 +00:00
Update to Minecraft 1.20.4
This commit is contained in:
@@ -6,6 +6,8 @@
|
||||
<h1 align="center">✨ SparklyPaper ✨</h1>
|
||||
</p>
|
||||
|
||||
 
|
||||
|
||||
SparklyPower's Paper fork, making large servers snappier with high-performance optimizations and improvements! Focused on performance improvements for Survival servers with high player counts.
|
||||
|
||||
Our fork has handmade patches to add and optimize some of the things that we have in our server, with some cherry-picked patches from other forks.
|
||||
|
||||
@@ -6,7 +6,7 @@ plugins {
|
||||
id("com.github.johnrengelman.shadow") version "8.1.1" apply false
|
||||
|
||||
// In general, keep this version in sync with upstream. Sometimes a newer version than upstream might work, but an older version is extremely likely to break.
|
||||
id("io.papermc.paperweight.patcher") version "1.5.7"
|
||||
id("io.papermc.paperweight.patcher") version "1.5.11"
|
||||
}
|
||||
|
||||
val paperMavenPublicUrl = "https://repo.papermc.io/repository/maven-public/"
|
||||
@@ -19,7 +19,7 @@ repositories {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
remapper("net.fabricmc:tiny-remapper:0.8.6:fat") // Must be kept in sync with upstream
|
||||
remapper("net.fabricmc:tiny-remapper:0.8.10:fat") // Must be kept in sync with upstream
|
||||
decompiler("net.minecraftforge:forgeflower:2.0.627.2") // Must be kept in sync with upstream
|
||||
paperclip("io.papermc:paperclip:3.0.3") // You probably want this to be kept in sync with upstream
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
group=net.sparklypower.sparklypaper
|
||||
version=1.20.2-R0.1-SNAPSHOT
|
||||
version=1.20.4-R0.1-SNAPSHOT
|
||||
|
||||
mcVersion=1.20.2
|
||||
paperRef=ffa41152390b121b919454b64f99097f356b25bf
|
||||
mcVersion=1.20.4
|
||||
paperRef=b42a1da8737895f4fcacfae9b4d49a96b1445972
|
||||
|
||||
org.gradle.caching=true
|
||||
org.gradle.parallel=true
|
||||
|
||||
@@ -5,7 +5,7 @@ Subject: [PATCH] new fork who dis - Rebrand to SparklyPaper and Build Changes
|
||||
|
||||
|
||||
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||
index 79beac737c17412913983614bd478d33e3c6ed58..5812c7056d11be2cc966728de6b07cd903e8d320 100644
|
||||
index 170a915098f09ace226648da342a04c5c7583d11..5c2c47b6e01c65ade4da9df65e8a799fb2654989 100644
|
||||
--- a/build.gradle.kts
|
||||
+++ b/build.gradle.kts
|
||||
@@ -3,6 +3,8 @@ import io.papermc.paperweight.util.*
|
||||
@@ -17,16 +17,16 @@ index 79beac737c17412913983614bd478d33e3c6ed58..5812c7056d11be2cc966728de6b07cd9
|
||||
id("com.github.johnrengelman.shadow")
|
||||
}
|
||||
|
||||
@@ -13,8 +15,15 @@ configurations.named(log4jPlugins.compileClasspathConfigurationName) {
|
||||
val alsoShade: Configuration by configurations.creating
|
||||
@@ -27,8 +29,15 @@ repositories {
|
||||
|
||||
dependencies {
|
||||
extraRuntime(platform("net.kyori:adventure-bom:4.15.0-SNAPSHOT"))
|
||||
- implementation(project(":paper-api"))
|
||||
- implementation(project(":paper-mojangapi"))
|
||||
+ // SparklyPaper start
|
||||
+ implementation(project(":sparklypaper-api"))
|
||||
+ implementation(kotlin("reflect"))
|
||||
+ implementation("io.papermc.paper:paper-mojangapi:1.20.2-R0.1-SNAPSHOT") {
|
||||
+ implementation("io.papermc.paper:paper-mojangapi:1.20.4-R0.1-SNAPSHOT") {
|
||||
+ exclude("io.papermc.paper", "paper-api")
|
||||
+ }
|
||||
+ implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.0")
|
||||
@@ -35,7 +35,7 @@ index 79beac737c17412913983614bd478d33e3c6ed58..5812c7056d11be2cc966728de6b07cd9
|
||||
// Paper start
|
||||
implementation("org.jline:jline-terminal-jansi:3.21.0")
|
||||
implementation("net.minecrell:terminalconsoleappender:1.3.0")
|
||||
@@ -64,13 +73,18 @@ tasks.jar {
|
||||
@@ -78,13 +87,18 @@ tasks.jar {
|
||||
manifest {
|
||||
val git = Git(rootProject.layout.projectDirectory.path)
|
||||
val gitHash = git("rev-parse", "--short=7", "HEAD").getText().trim()
|
||||
@@ -56,7 +56,7 @@ index 79beac737c17412913983614bd478d33e3c6ed58..5812c7056d11be2cc966728de6b07cd9
|
||||
"Implementation-Vendor" to date, // Paper
|
||||
"Specification-Title" to "Bukkit",
|
||||
"Specification-Version" to project.version,
|
||||
@@ -154,7 +168,7 @@ fun TaskContainer.registerRunTask(
|
||||
@@ -168,7 +182,7 @@ fun TaskContainer.registerRunTask(
|
||||
name: String,
|
||||
block: JavaExec.() -> Unit
|
||||
): TaskProvider<JavaExec> = register<JavaExec>(name) {
|
||||
@@ -66,10 +66,10 @@ index 79beac737c17412913983614bd478d33e3c6ed58..5812c7056d11be2cc966728de6b07cd9
|
||||
standardInput = System.`in`
|
||||
workingDir = rootProject.layout.projectDirectory
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 8f31413c939cc2b0454ad3d9a1b618dbae449d00..25367df06a8a6e8b0b3a56652a5fb1c70a15632d 100644
|
||||
index 34f19ac897a30c0c4e3ab406013fcca1c8b7db93..f1c65967b74e79452870438eea0942cc700fe0e9 100644
|
||||
--- a/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
|
||||
public String getServerModName() {
|
||||
@@ -79,10 +79,10 @@ index 8f31413c939cc2b0454ad3d9a1b618dbae449d00..25367df06a8a6e8b0b3a56652a5fb1c7
|
||||
|
||||
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 9c08303de2891de92e06de8a939a618b7a6f7321..aaf04e2be3ed707e51a81d2b1c58dda6f7a8092a 100644
|
||||
index 782bb8ca67517dde5dba8f0a133eb8699353dd01..e81a3a5e9aab6cb0c76d9e557a31d94536680ce4 100644
|
||||
--- a/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
|
||||
|
||||
public final class CraftServer implements Server {
|
||||
|
||||
@@ -5,7 +5,7 @@ Subject: [PATCH] SparklyPaper config files
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
index 1c9742ad81f04052d2c3bc18c7636f45b2fc5160..9a6915a87ae8aa4ffefea575d7a7d5199c800799 100644
|
||||
index 58536aabf607015939a1326f80207c0a06eed8ff..b69860955a6c1efb68b17e1fc9b0c42771f40e15 100644
|
||||
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
@@ -218,6 +218,15 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
@@ -25,10 +25,10 @@ index 1c9742ad81f04052d2c3bc18c7636f45b2fc5160..9a6915a87ae8aa4ffefea575d7a7d519
|
||||
io.papermc.paper.brigadier.PaperBrigadierProviderImpl.INSTANCE.getClass(); // init PaperBrigadierProvider
|
||||
// Paper end
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
||||
index 2354a0e5d15e9be633d9fe3a1a9feefe7b9b7782..b9e0822638a3979bd43392efdb595153e6f34675 100644
|
||||
index 0b56e5f7f18fc4286992af22d402205b771165a3..f5e3c87581cbdc762806ad4412b68d3c84612b88 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
||||
@@ -176,6 +176,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
@@ -179,6 +179,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
// Paper end
|
||||
|
||||
public final com.destroystokyo.paper.antixray.ChunkPacketBlockController chunkPacketBlockController; // Paper - Anti-Xray
|
||||
@@ -36,7 +36,7 @@ index 2354a0e5d15e9be633d9fe3a1a9feefe7b9b7782..b9e0822638a3979bd43392efdb595153
|
||||
public final co.aikar.timings.WorldTimingsHandler timings; // Paper
|
||||
public static BlockPos lastPhysicsProblem; // Spigot
|
||||
private org.spigotmc.TickLimiter entityLimiter;
|
||||
@@ -213,6 +214,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
@@ -216,6 +217,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
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.paperConfig = paperWorldConfigCreator.apply(this.spigotConfig); // Paper
|
||||
@@ -116,10 +116,10 @@ index 0000000000000000000000000000000000000000..bc0ec96f91f7c9ab9f9a865a50f69707
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index 73e373c04986582d8841ec896a4ee9565eee2e95..d03563baf1e9e25fce8bab1f9fe3f2e57358590b 100644
|
||||
index e81a3a5e9aab6cb0c76d9e557a31d94536680ce4..ec838fa5248743ccd96f2c19b25b17d9a2ace3d0 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -117,6 +117,7 @@ import net.minecraft.world.level.storage.WorldData;
|
||||
@@ -118,6 +118,7 @@ import net.minecraft.world.level.storage.PrimaryLevelData;
|
||||
import net.minecraft.world.level.storage.loot.LootDataManager;
|
||||
import net.minecraft.world.level.validation.ContentValidationException;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
@@ -127,7 +127,7 @@ index 73e373c04986582d8841ec896a4ee9565eee2e95..d03563baf1e9e25fce8bab1f9fe3f2e5
|
||||
import org.bukkit.BanList;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
@@ -1041,6 +1042,7 @@ public final class CraftServer implements Server {
|
||||
@@ -1036,6 +1037,7 @@ public final class CraftServer implements Server {
|
||||
|
||||
org.spigotmc.SpigotConfig.init((File) this.console.options.valueOf("spigot-settings")); // Spigot
|
||||
this.console.paperConfigurations.reloadConfigs(this.console);
|
||||
@@ -135,7 +135,7 @@ index 73e373c04986582d8841ec896a4ee9565eee2e95..d03563baf1e9e25fce8bab1f9fe3f2e5
|
||||
for (ServerLevel world : this.console.getAllLevels()) {
|
||||
// world.serverLevelData.setDifficulty(config.difficulty); // Paper - per level difficulty
|
||||
world.setSpawnSettings(world.serverLevelData.getDifficulty() != Difficulty.PEACEFUL && config.spawnMonsters, config.spawnAnimals); // Paper - per level difficulty (from MinecraftServer#setDifficulty(ServerLevel, Difficulty, boolean))
|
||||
@@ -1056,6 +1058,7 @@ public final class CraftServer implements Server {
|
||||
@@ -1051,6 +1053,7 @@ public final class CraftServer implements Server {
|
||||
}
|
||||
}
|
||||
world.spigotConfig.init(); // Spigot
|
||||
@@ -143,7 +143,7 @@ index 73e373c04986582d8841ec896a4ee9565eee2e95..d03563baf1e9e25fce8bab1f9fe3f2e5
|
||||
}
|
||||
|
||||
Plugin[] pluginClone = pluginManager.getPlugins().clone(); // Paper
|
||||
@@ -1071,6 +1074,7 @@ public final class CraftServer implements Server {
|
||||
@@ -1066,6 +1069,7 @@ public final class CraftServer implements Server {
|
||||
this.reloadData();
|
||||
org.spigotmc.SpigotConfig.registerCommands(); // Spigot
|
||||
io.papermc.paper.command.PaperCommands.registerCommands(this.console); // Paper
|
||||
@@ -152,7 +152,7 @@ index 73e373c04986582d8841ec896a4ee9565eee2e95..d03563baf1e9e25fce8bab1f9fe3f2e5
|
||||
this.ignoreVanillaPermissions = this.commandsConfiguration.getBoolean("ignore-vanilla-permissions");
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
index c737c5d62407337d3db2899cfc01713a058a6467..5e3033fe176d161ed5a18a73bae752d6689a3e01 100644
|
||||
index 4b457cbfc56e55e0ae0fee5b69e2e75349702aab..2791bd21e570c6bbcb3be19fac4a520a810f952d 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
@@ -174,6 +174,14 @@ public class Main {
|
||||
|
||||
@@ -11,7 +11,7 @@ data is already available in the blockPosition struct, so we use that
|
||||
instead of re-doing the casting.
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/util/MCUtil.java b/src/main/java/io/papermc/paper/util/MCUtil.java
|
||||
index d02546b18cb689724887b4e85e8d32a18828a4ad..91eaff58bb422ba188e6cfaa9c20b45bec211edd 100644
|
||||
index 8240bb085b619f257f8c0a25775e0b15068e440f..6d9668d993bb922ae9d2b76a4d766903cc3f98a4 100644
|
||||
--- a/src/main/java/io/papermc/paper/util/MCUtil.java
|
||||
+++ b/src/main/java/io/papermc/paper/util/MCUtil.java
|
||||
@@ -213,7 +213,7 @@ public final class MCUtil {
|
||||
@@ -24,10 +24,10 @@ index d02546b18cb689724887b4e85e8d32a18828a4ad..91eaff58bb422ba188e6cfaa9c20b45b
|
||||
|
||||
public static long getCoordinateKey(final ChunkPos pair) {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index d435d04ab50b2f64e6438c6c26639b6048322013..9906cde792a07a433e45613518e741801026077d 100644
|
||||
index 9abe817ae202edaa2d88cd59ae5c7db0b1c634be..cfb4daaa28263aef1c74eac574b4f0e8b2f87776 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -306,7 +306,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
@@ -307,7 +307,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
||||
public double yo;
|
||||
public double zo;
|
||||
private Vec3 position;
|
||||
|
||||
@@ -83,10 +83,10 @@ index 35674f92a67f93382103c2766df4b678ba5c862f..bfdd0ce9acfae75a403d3689b391dd8f
|
||||
|
||||
private void sendDirtyEntityData() {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java b/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java
|
||||
index 759ecd79534a7706f7d4a63eb9dacbefcfe54674..0780dd4abf035cdd4001fb9702494c54be83361a 100644
|
||||
index 69912c5b300b67394dce3876d2d96872033cf156..bde22dcbc67211a62c2280b0c6cf5b85aa3b96eb 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java
|
||||
@@ -488,6 +488,16 @@ public class ItemFrame extends HangingEntity {
|
||||
@@ -483,6 +483,16 @@ public class ItemFrame extends HangingEntity {
|
||||
}
|
||||
this.setItem(ItemStack.fromBukkitCopy(event.getItemStack()));
|
||||
// Paper end
|
||||
@@ -104,7 +104,7 @@ index 759ecd79534a7706f7d4a63eb9dacbefcfe54674..0780dd4abf035cdd4001fb9702494c54
|
||||
if (!player.getAbilities().instabuild) {
|
||||
itemstack.shrink(1);
|
||||
diff --git a/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java b/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java
|
||||
index e4c4948e076cd64686dfd16ae0568fafc1437140..0e7c7593eec47bc266f53ee8b2053917a84ae61e 100644
|
||||
index e4c4948e076cd64686dfd16ae0568fafc1437140..fec7d474df8cfc8c36f5a69faac7ad03ad648d45 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java
|
||||
@@ -67,6 +67,16 @@ public class MapItemSavedData extends SavedData {
|
||||
|
||||
@@ -9,10 +9,10 @@ Optimizes "image in map" maps, without requiring the map to be locked, which som
|
||||
This has the disadvantage that the vanilla map data will never be updated while the CraftMapRenderer is not present, but that's not a huuuge problem for us
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/item/MapItem.java b/src/main/java/net/minecraft/world/item/MapItem.java
|
||||
index c368b437597edf7e165326727ae778a69c3fcc83..190716ea7857c7ad5427a527ad8d6b5a241a00b6 100644
|
||||
index 797415866a7f182d804f6b8e57ceb07a6ac2a20a..fc824f471e5d814cb3eee48516731c2b001fb54e 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/MapItem.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/MapItem.java
|
||||
@@ -332,7 +332,7 @@ public class MapItem extends ComplexItem {
|
||||
@@ -324,7 +324,7 @@ public class MapItem extends ComplexItem {
|
||||
worldmap.tickCarriedBy(entityhuman, stack);
|
||||
}
|
||||
|
||||
|
||||
@@ -73,10 +73,10 @@ index 62484ebf4550b05182f693a3180bbac5d5fd906d..67800e426445060a8343e27a7452b8d7
|
||||
throw new IllegalStateException("Ticking retired scheduler");
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 25367df06a8a6e8b0b3a56652a5fb1c70a15632d..d83b2f3c03c2e22a3e7c97dc4e4b156d1b321738 100644
|
||||
index f1c65967b74e79452870438eea0942cc700fe0e9..4820e5ae050966d89a0d0b587c83537d4a1e1393 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -308,6 +308,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -314,6 +314,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
// Paper start - lag compensation
|
||||
public static final long SERVER_INIT = System.nanoTime();
|
||||
// Paper end - lag compensation
|
||||
@@ -84,7 +84,7 @@ index 25367df06a8a6e8b0b3a56652a5fb1c70a15632d..d83b2f3c03c2e22a3e7c97dc4e4b156d
|
||||
|
||||
public static <S extends MinecraftServer> S spin(Function<Thread, S> serverFactory) {
|
||||
AtomicReference<S> atomicreference = new AtomicReference();
|
||||
@@ -1471,6 +1472,18 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1640,6 +1641,18 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
MinecraftTimings.bukkitSchedulerTimer.stopTiming(); // Spigot // Paper
|
||||
// Paper start - Folia scheduler API
|
||||
((io.papermc.paper.threadedregions.scheduler.FoliaGlobalRegionScheduler) Bukkit.getGlobalRegionScheduler()).tick();
|
||||
@@ -103,7 +103,7 @@ index 25367df06a8a6e8b0b3a56652a5fb1c70a15632d..d83b2f3c03c2e22a3e7c97dc4e4b156d
|
||||
getAllLevels().forEach(level -> {
|
||||
for (final Entity entity : level.getEntityLookup().getAllCopy()) {
|
||||
if (entity.isRemoved()) {
|
||||
@@ -1482,6 +1495,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1651,6 +1664,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -113,10 +113,10 @@ index 25367df06a8a6e8b0b3a56652a5fb1c70a15632d..d83b2f3c03c2e22a3e7c97dc4e4b156d
|
||||
io.papermc.paper.adventure.providers.ClickCallbackProviderImpl.CALLBACK_MANAGER.handleQueue(this.tickCount); // Paper
|
||||
this.profiler.push("commandFunctions");
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
index 9f843b89dc20b91bf7243facee8486d525e4a1b3..d118989be2171c51af6f09e758538b2af476872f 100644
|
||||
index aa4dbf91cf6da329fdcacbde98bb870eb48e8f5c..f974724f76a1d4edb65cacad7707882d6c6d3a1b 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
@@ -208,7 +208,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
||||
@@ -213,7 +213,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
||||
private final CraftPersistentDataContainer persistentDataContainer = new CraftPersistentDataContainer(CraftEntity.DATA_TYPE_REGISTRY);
|
||||
protected net.kyori.adventure.pointer.Pointers adventure$pointers; // Paper - implement pointers
|
||||
// Paper start - Folia shedulers
|
||||
@@ -125,7 +125,7 @@ index 9f843b89dc20b91bf7243facee8486d525e4a1b3..d118989be2171c51af6f09e758538b2a
|
||||
private final io.papermc.paper.threadedregions.scheduler.FoliaEntityScheduler apiScheduler = new io.papermc.paper.threadedregions.scheduler.FoliaEntityScheduler(this);
|
||||
|
||||
@Override
|
||||
@@ -221,6 +221,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
||||
@@ -226,6 +226,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
||||
this.server = server;
|
||||
this.entity = entity;
|
||||
this.entityType = CraftEntityType.minecraftToBukkit(entity.getType());
|
||||
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Blazingly Simple Farm Checks
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/CropBlock.java b/src/main/java/net/minecraft/world/level/block/CropBlock.java
|
||||
index 6365ddea0c23bc5d4009d98915f2b39aed2a0328..41a0a22bf28eec79bc6dd96622789a2fd2ec646d 100644
|
||||
index 9550ce8588c6aa3ba4cbbbb86912eae2b452eb01..622413a5f9a472a759e9cc869ee7cdb223880188 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/CropBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/CropBlock.java
|
||||
@@ -74,6 +74,57 @@ public class CropBlock extends BushBlock implements BonemealableBlock {
|
||||
@@ -81,6 +81,57 @@ public class CropBlock extends BushBlock implements BonemealableBlock {
|
||||
int i = this.getAge(state);
|
||||
|
||||
if (i < this.getMaxAge()) {
|
||||
@@ -66,7 +66,7 @@ index 6365ddea0c23bc5d4009d98915f2b39aed2a0328..41a0a22bf28eec79bc6dd96622789a2f
|
||||
float f = CropBlock.getGrowthSpeed(this, world, pos);
|
||||
|
||||
// Spigot start
|
||||
@@ -96,6 +147,8 @@ public class CropBlock extends BushBlock implements BonemealableBlock {
|
||||
@@ -103,6 +154,8 @@ public class CropBlock extends BushBlock implements BonemealableBlock {
|
||||
// Spigot end
|
||||
CraftEventFactory.handleBlockGrowEvent(world, pos, this.getStateForAge(i + 1), 2); // CraftBukkit
|
||||
}
|
||||
@@ -76,10 +76,10 @@ index 6365ddea0c23bc5d4009d98915f2b39aed2a0328..41a0a22bf28eec79bc6dd96622789a2f
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/FarmBlock.java b/src/main/java/net/minecraft/world/level/block/FarmBlock.java
|
||||
index 502dcba14da9d3dcefc61fdc349a4e1e1d94b478..fc8d56f02e8b22261cf2f205b39dfa1aeea5a7ff 100644
|
||||
index 59bbdead2ebd8965d222540c7243dde051bbcc4b..e7cc73fe8f7aaa1f66c598c9018983319db4213f 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/FarmBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/FarmBlock.java
|
||||
@@ -85,6 +85,19 @@ public class FarmBlock extends Block {
|
||||
@@ -92,6 +92,19 @@ public class FarmBlock extends Block {
|
||||
@Override
|
||||
public void randomTick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) {
|
||||
int i = (Integer) state.getValue(FarmBlock.MOISTURE);
|
||||
@@ -99,7 +99,7 @@ index 502dcba14da9d3dcefc61fdc349a4e1e1d94b478..fc8d56f02e8b22261cf2f205b39dfa1a
|
||||
if (i > 0 && world.paperConfig().tickRates.wetFarmland != 1 && (world.paperConfig().tickRates.wetFarmland < 1 || (net.minecraft.server.MinecraftServer.currentTick + pos.hashCode()) % world.paperConfig().tickRates.wetFarmland != 0)) { return; } // Paper
|
||||
if (i == 0 && world.paperConfig().tickRates.dryFarmland != 1 && (world.paperConfig().tickRates.dryFarmland < 1 || (net.minecraft.server.MinecraftServer.currentTick + pos.hashCode()) % world.paperConfig().tickRates.dryFarmland != 0)) { return; } // Paper
|
||||
|
||||
@@ -143,7 +156,7 @@ public class FarmBlock extends Block {
|
||||
@@ -150,7 +163,7 @@ public class FarmBlock extends Block {
|
||||
return world.getBlockState(pos.above()).is(BlockTags.MAINTAINS_FARMLAND);
|
||||
}
|
||||
|
||||
@@ -109,10 +109,10 @@ index 502dcba14da9d3dcefc61fdc349a4e1e1d94b478..fc8d56f02e8b22261cf2f205b39dfa1a
|
||||
int xOff = pos.getX();
|
||||
int yOff = pos.getY();
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/StemBlock.java b/src/main/java/net/minecraft/world/level/block/StemBlock.java
|
||||
index 0d9be3b28ba4957c3f4da5455283fca903836c91..d20af373521636a0fb42712effd09619b9c78960 100644
|
||||
index 121a872cd750a87b779895687ae1abf5bb77b088..a5d1931dc80febe74601d7a8f2d975c702b357aa 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/StemBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/StemBlock.java
|
||||
@@ -51,6 +51,50 @@ public class StemBlock extends BushBlock implements BonemealableBlock {
|
||||
@@ -73,6 +73,56 @@ public class StemBlock extends BushBlock implements BonemealableBlock {
|
||||
@Override
|
||||
public void randomTick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) {
|
||||
if (world.getRawBrightness(pos, 0) >= 9) {
|
||||
@@ -144,18 +144,24 @@ index 0d9be3b28ba4957c3f4da5455283fca903836c91..d20af373521636a0fb42712effd09619
|
||||
+ BlockState iblockdata1 = world.getBlockState(blockposition1.below());
|
||||
+
|
||||
+ if (world.getBlockState(blockposition1).isAir() && (iblockdata1.is(Blocks.FARMLAND) || iblockdata1.is(BlockTags.DIRT))) {
|
||||
+ // CraftBukkit start
|
||||
+ if (!CraftEventFactory.handleBlockGrowEvent(world, blockposition1, this.fruit.defaultBlockState())) {
|
||||
+ return;
|
||||
+ Registry<Block> iregistry = world.registryAccess().registryOrThrow(Registries.BLOCK);
|
||||
+ Optional<Block> optional = iregistry.getOptional(this.fruit);
|
||||
+ Optional<Block> optional1 = iregistry.getOptional(this.attachedStem);
|
||||
+
|
||||
+ if (optional.isPresent() && optional1.isPresent()) {
|
||||
+ // CraftBukkit start
|
||||
+ if (!CraftEventFactory.handleBlockGrowEvent(world, blockposition1, ((Block) optional.get()).defaultBlockState())) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+ // Now that we know that the crop will grow... is the next stage the crop's max age? If yes, we are going to check if the farm land is moist!
|
||||
+ if (isCurrentFarmlandStateMoist && !FarmBlock.isNearWater(world, farmlandBelowTheCurrentBlock)) {
|
||||
+ // Whoops, farm land ain't moist!
|
||||
+ // From FarmBlock, set the moisture to 0
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleMoistureChangeEvent(world, farmlandBelowTheCurrentBlock, (BlockState) farmlandBelowTheCurrentBlockData.setValue(FarmBlock.MOISTURE, 0), 2); // CraftBukkit
|
||||
+ }
|
||||
+ world.setBlockAndUpdate(pos, (BlockState) ((Block) optional1.get()).defaultBlockState().setValue(HorizontalDirectionalBlock.FACING, enumdirection));
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+ // Now that we know that the crop will grow... is the next stage the crop's max age? If yes, we are going to check if the farm land is moist!
|
||||
+ if (isCurrentFarmlandStateMoist && !FarmBlock.isNearWater(world, farmlandBelowTheCurrentBlock)) {
|
||||
+ // Whoops, farm land ain't moist!
|
||||
+ // From FarmBlock, set the moisture to 0
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleMoistureChangeEvent(world, farmlandBelowTheCurrentBlock, (BlockState) farmlandBelowTheCurrentBlockData.setValue(FarmBlock.MOISTURE, 0), 2); // CraftBukkit
|
||||
+ }
|
||||
+ world.setBlockAndUpdate(pos, (BlockState) this.fruit.getAttachedStem().defaultBlockState().setValue(HorizontalDirectionalBlock.FACING, enumdirection));
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
@@ -163,7 +169,7 @@ index 0d9be3b28ba4957c3f4da5455283fca903836c91..d20af373521636a0fb42712effd09619
|
||||
float f = CropBlock.getGrowthSpeed(this, world, pos);
|
||||
|
||||
if (random.nextFloat() < ((this == Blocks.PUMPKIN_STEM ? world.spigotConfig.pumpkinModifier : world.spigotConfig.melonModifier) / (100.0f * (Math.floor((25.0F / f) + 1))))) { // Spigot - SPIGOT-7159: Better modifier resolution
|
||||
@@ -74,7 +118,8 @@ public class StemBlock extends BushBlock implements BonemealableBlock {
|
||||
@@ -102,7 +152,8 @@ public class StemBlock extends BushBlock implements BonemealableBlock {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,10 +10,10 @@ Caches when Bat's spooky season starts and ends, and when Skeleton and Zombies h
|
||||
Avoids unnecessary date checks, even tho that this shouldn't really improve performance that much... unless you have a lot of bats/zombies/skeletons spawning.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index d83b2f3c03c2e22a3e7c97dc4e4b156d1b321738..cebda87d198edc844f5629a5cd4c71cd6dd75caf 100644
|
||||
index 4820e5ae050966d89a0d0b587c83537d4a1e1393..f43060555bf02f13268b284606045fce2b3e911a 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -309,6 +309,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -315,6 +315,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
public static final long SERVER_INIT = System.nanoTime();
|
||||
// Paper end - lag compensation
|
||||
public final Set<Entity> entitiesWithScheduledTasks = java.util.concurrent.ConcurrentHashMap.newKeySet(); // SparklyPaper - skip EntityScheduler's executeTick checks if there isn't any tasks to be run (concurrent because plugins may schedule tasks async)
|
||||
@@ -22,7 +22,7 @@ index d83b2f3c03c2e22a3e7c97dc4e4b156d1b321738..cebda87d198edc844f5629a5cd4c71cd
|
||||
public static <S extends MinecraftServer> S spin(Function<Thread, S> serverFactory) {
|
||||
AtomicReference<S> atomicreference = new AtomicReference();
|
||||
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
index 9a6915a87ae8aa4ffefea575d7a7d5199c800799..7f90783254d4178e02baf6b5b0a60508a4ce2806 100644
|
||||
index b69860955a6c1efb68b17e1fc9b0c42771f40e15..734fd1ced38a16649177bb941e76d9ca66dceac5 100644
|
||||
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
@@ -227,6 +227,10 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
@@ -37,10 +37,10 @@ index 9a6915a87ae8aa4ffefea575d7a7d5199c800799..7f90783254d4178e02baf6b5b0a60508
|
||||
io.papermc.paper.brigadier.PaperBrigadierProviderImpl.INSTANCE.getClass(); // init PaperBrigadierProvider
|
||||
// Paper end
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/ambient/Bat.java b/src/main/java/net/minecraft/world/entity/ambient/Bat.java
|
||||
index 5beaa849a250ea005733250ad3edfa8382224667..02060f41c17dd22f27bdbf930ab7580984c5c841 100644
|
||||
index 6b614818b14ecfc8fc82b523eeb7e21fdf9bf1ba..2588e7eb1f55d3f01f4f8d794a59f3ba16f5985a 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/ambient/Bat.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/ambient/Bat.java
|
||||
@@ -227,7 +227,7 @@ public class Bat extends AmbientCreature {
|
||||
@@ -231,7 +231,7 @@ public class Bat extends AmbientCreature {
|
||||
int i = world.getMaxLocalRawBrightness(pos);
|
||||
byte b0 = 4;
|
||||
|
||||
@@ -49,7 +49,7 @@ index 5beaa849a250ea005733250ad3edfa8382224667..02060f41c17dd22f27bdbf930ab75809
|
||||
b0 = 7;
|
||||
} else if (random.nextBoolean()) {
|
||||
return false;
|
||||
@@ -237,6 +237,8 @@ public class Bat extends AmbientCreature {
|
||||
@@ -241,6 +241,8 @@ public class Bat extends AmbientCreature {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ index 5beaa849a250ea005733250ad3edfa8382224667..02060f41c17dd22f27bdbf930ab75809
|
||||
private static boolean isHalloween() {
|
||||
LocalDate localdate = LocalDate.now();
|
||||
int i = localdate.get(ChronoField.DAY_OF_MONTH);
|
||||
@@ -244,6 +246,7 @@ public class Bat extends AmbientCreature {
|
||||
@@ -248,6 +250,7 @@ public class Bat extends AmbientCreature {
|
||||
|
||||
return j == 10 && i >= 20 || j == 11 && i <= 3;
|
||||
}
|
||||
@@ -87,7 +87,7 @@ index b319021b22c5dceba6199ed27814b2dcf47b8d50..4e7f19215bafc8ff6b06abc08076a154
|
||||
this.armorDropChances[EquipmentSlot.HEAD.getIndex()] = 0.0F;
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/Zombie.java b/src/main/java/net/minecraft/world/entity/monster/Zombie.java
|
||||
index 5fdad1600cc7a7c22d1d9a58b6b2dda605521b97..852be41caa3434c898ef2b0731e6f864e817c02b 100644
|
||||
index 753defa8f8b48d004a2a53b2fc322fd9c083d95e..cc7073efaa9984c95b125878df94556b1e865c7a 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/Zombie.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/Zombie.java
|
||||
@@ -553,10 +553,11 @@ public class Zombie extends Monster {
|
||||
|
||||
@@ -30,18 +30,18 @@ index 17ba07cbd4792f63d88ce29d00da280f30c4abff..8e8aad958c96fa1df3d906ec120a89ad
|
||||
final TrackedChunk chunk = this.byChunk.get(CoordinateUtils.getChunkKey(chunkX, chunkZ));
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||
index 8c33a12ca879c46893150d6adfb8aa4d397c6b4c..66d9358c30b827a1299e9d9b0d3793a0eb62d67b 100644
|
||||
index 6e212f672579a3e08dc362c287be59ca5170d717..a9763733a0026f7785349dcdd845a01f50a022b1 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||
@@ -621,7 +621,7 @@ public class ServerChunkCache extends ChunkSource {
|
||||
@@ -647,7 +647,7 @@ public class ServerChunkCache extends ChunkSource {
|
||||
|
||||
// Paper start - optimise chunk tick iteration
|
||||
com.destroystokyo.paper.util.maplist.ReferenceList<ServerPlayer> playersNearby
|
||||
- = nearbyPlayers.getPlayers(chunkcoordintpair, io.papermc.paper.util.player.NearbyPlayers.NearbyMapType.SPAWN_RANGE);
|
||||
// Paper start - optimise chunk tick iteration
|
||||
com.destroystokyo.paper.util.maplist.ReferenceList<ServerPlayer> playersNearby
|
||||
- = nearbyPlayers.getPlayers(chunkcoordintpair, io.papermc.paper.util.player.NearbyPlayers.NearbyMapType.SPAWN_RANGE);
|
||||
+ = nearbyPlayers.getPlayers(chunk1.nearbyPlayersCoordinateKey, io.papermc.paper.util.player.NearbyPlayers.NearbyMapType.SPAWN_RANGE); // nearbyPlayers.getPlayers(chunkcoordintpair, io.papermc.paper.util.player.NearbyPlayers.NearbyMapType.SPAWN_RANGE); // SparklyPaper - cache coordinate key used for nearby players
|
||||
if (playersNearby == null) {
|
||||
continue;
|
||||
}
|
||||
if (playersNearby == null) {
|
||||
continue;
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java b/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java
|
||||
index f7e5e016a7028a9196e689e950805b0d5b31fe38..d0285843920f78e05ce07b1b0b2d8ce97ec8041e 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java
|
||||
|
||||
@@ -27,10 +27,10 @@ index caa73632aee15583c6b6ed12a668c8f49b794708..fa4c8a52a57775ef8f23e48e57b76ff7
|
||||
}
|
||||
// CraftBukkit end
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
index 3a792ddc31e76038b84e8f87088c4cd94c349138..e1fb00bd5f4a2849026c6c9c50423810a494f925 100644
|
||||
index fd84786f3e72875e79df46416f47f3403876cef3..a26150660b70442444d7dbcb5cae4ccab19838d5 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -183,7 +183,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
@@ -184,7 +184,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
private boolean hasPlayedBefore = false;
|
||||
private final ConversationTracker conversationTracker = new ConversationTracker();
|
||||
private final Set<String> channels = new HashSet<String>();
|
||||
@@ -39,7 +39,7 @@ index 3a792ddc31e76038b84e8f87088c4cd94c349138..e1fb00bd5f4a2849026c6c9c50423810
|
||||
private final Set<UUID> unlistedEntities = new HashSet<>(); // Paper
|
||||
private static final WeakHashMap<Plugin, WeakReference<Plugin>> pluginWeakReferences = new WeakHashMap<>();
|
||||
private int hash = 0;
|
||||
@@ -2086,9 +2086,16 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
@@ -2094,9 +2094,16 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
|
||||
@Override
|
||||
public boolean canSee(org.bukkit.entity.Entity entity) {
|
||||
|
||||
@@ -6,19 +6,19 @@ Subject: [PATCH] Revert "Fix MC-117075: TE Unload Lag Spike"
|
||||
This reverts commit 188c1c5b77133f7c3da9c67a97432d79d50d2b34.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
||||
index b9e0822638a3979bd43392efdb595153e6f34675..ddb618fce875b1a337b139c9c47433453654017b 100644
|
||||
index f5e3c87581cbdc762806ad4412b68d3c84612b88..0740a7e90c8b7947448990cd9e76328d7d4a7e95 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
||||
@@ -1270,8 +1270,6 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
// Spigot start
|
||||
// Iterator iterator = this.blockEntityTickers.iterator();
|
||||
@@ -1281,8 +1281,6 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
boolean flag = this.tickRateManager().runsNormally();
|
||||
|
||||
int tilesThisCycle = 0;
|
||||
- var toRemove = new it.unimi.dsi.fastutil.objects.ObjectOpenCustomHashSet<TickingBlockEntity>(net.minecraft.Util.identityStrategy()); // Paper - use removeAll
|
||||
- var toRemove = new it.unimi.dsi.fastutil.objects.ReferenceOpenHashSet<TickingBlockEntity>(); // Paper - use removeAll
|
||||
- toRemove.add(null);
|
||||
for (tileTickPosition = 0; tileTickPosition < this.blockEntityTickers.size(); tileTickPosition++) { // Paper - Disable tick limiters
|
||||
this.tileTickPosition = (this.tileTickPosition < this.blockEntityTickers.size()) ? this.tileTickPosition : 0;
|
||||
TickingBlockEntity tickingblockentity = (TickingBlockEntity) this.blockEntityTickers.get(this.tileTickPosition);
|
||||
@@ -1279,6 +1277,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
@@ -1290,6 +1288,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
if (tickingblockentity == null) {
|
||||
this.getCraftServer().getLogger().severe("Spigot has detected a null entity and has removed it, preventing a crash");
|
||||
tilesThisCycle--;
|
||||
@@ -26,16 +26,16 @@ index b9e0822638a3979bd43392efdb595153e6f34675..ddb618fce875b1a337b139c9c4743345
|
||||
continue;
|
||||
}
|
||||
// Spigot end
|
||||
@@ -1286,7 +1285,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
@@ -1297,7 +1296,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
if (tickingblockentity.isRemoved()) {
|
||||
// Spigot start
|
||||
tilesThisCycle--;
|
||||
- toRemove.add(tickingblockentity); // Paper - use removeAll
|
||||
+ this.blockEntityTickers.remove(this.tileTickPosition--);
|
||||
// Spigot end
|
||||
} else if (this.shouldTickBlocksAt(tickingblockentity.getPos())) {
|
||||
} else if (flag && this.shouldTickBlocksAt(tickingblockentity.getPos())) {
|
||||
tickingblockentity.tick();
|
||||
@@ -1297,7 +1296,6 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
@@ -1308,7 +1307,6 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
// Paper end - execute chunk tasks during tick
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,10 +8,10 @@ We replaced the `blockEntityTickers` list with a custom list based on fastutil's
|
||||
This is WAY FASTER than using `removeAll` with a list of entries to be removed, because we don't need to calculate the identity of each block entity to be removed, and we can jump directly to where the search should begin, giving a performance boost for small removals (because we don't need to loop thru the entire list to find what element should be removed) and a performance boost for big removals (no need to calculate the identity of each block entity).
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
||||
index ddb618fce875b1a337b139c9c47433453654017b..f50a66841fd8c798cd881612be302c292afcfa65 100644
|
||||
index 0740a7e90c8b7947448990cd9e76328d7d4a7e95..d9acec6352adf9e7d774cf3ea9486e57fc02ff83 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
||||
@@ -117,7 +117,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
@@ -120,7 +120,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
public static final int TICKS_PER_DAY = 24000;
|
||||
public static final int MAX_ENTITY_SPAWN_Y = 20000000;
|
||||
public static final int MIN_ENTITY_SPAWN_Y = -20000000;
|
||||
@@ -20,7 +20,7 @@ index ddb618fce875b1a337b139c9c47433453654017b..f50a66841fd8c798cd881612be302c29
|
||||
protected final NeighborUpdater neighborUpdater;
|
||||
private final List<TickingBlockEntity> pendingBlockEntityTickers = Lists.newArrayList();
|
||||
private boolean tickingBlockEntities;
|
||||
@@ -1277,7 +1277,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
@@ -1288,7 +1288,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
if (tickingblockentity == null) {
|
||||
this.getCraftServer().getLogger().severe("Spigot has detected a null entity and has removed it, preventing a crash");
|
||||
tilesThisCycle--;
|
||||
@@ -29,16 +29,16 @@ index ddb618fce875b1a337b139c9c47433453654017b..f50a66841fd8c798cd881612be302c29
|
||||
continue;
|
||||
}
|
||||
// Spigot end
|
||||
@@ -1285,7 +1285,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
@@ -1296,7 +1296,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
if (tickingblockentity.isRemoved()) {
|
||||
// Spigot start
|
||||
tilesThisCycle--;
|
||||
- this.blockEntityTickers.remove(this.tileTickPosition--);
|
||||
+ this.blockEntityTickers.markAsRemoved(this.tileTickPosition); // this.blockEntityTickers.remove(this.tileTickPosition--); // SparklyPaper - optimize block entity removals
|
||||
// Spigot end
|
||||
} else if (this.shouldTickBlocksAt(tickingblockentity.getPos())) {
|
||||
} else if (flag && this.shouldTickBlocksAt(tickingblockentity.getPos())) {
|
||||
tickingblockentity.tick();
|
||||
@@ -1296,7 +1296,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
@@ -1307,7 +1307,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
// Paper end - execute chunk tasks during tick
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,12 +12,12 @@ But here's the thing: We don't care if we have a small performance penalty if th
|
||||
And finally, we also cache the chunk's coordinate key when creating the block entity, which is actually "free" because we just reuse the already cached chunk coordinate key from the chunk!
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
||||
index f50a66841fd8c798cd881612be302c292afcfa65..6048e9ed03b633eb545a82a506e5033c61d8176f 100644
|
||||
index d9acec6352adf9e7d774cf3ea9486e57fc02ff83..4c0aa4b4c79562d43df9fc07a56731056f6a2348 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
||||
@@ -1270,6 +1270,10 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
// Spigot start
|
||||
// Iterator iterator = this.blockEntityTickers.iterator();
|
||||
@@ -1281,6 +1281,10 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
boolean flag = this.tickRateManager().runsNormally();
|
||||
|
||||
int tilesThisCycle = 0;
|
||||
+ // SparklyPaper start - optimize tickBlockEntities
|
||||
+ int shouldTickBlocksAtLastResult = -1; // -1 = undefined
|
||||
@@ -26,13 +26,13 @@ index f50a66841fd8c798cd881612be302c292afcfa65..6048e9ed03b633eb545a82a506e5033c
|
||||
for (tileTickPosition = 0; tileTickPosition < this.blockEntityTickers.size(); tileTickPosition++) { // Paper - Disable tick limiters
|
||||
this.tileTickPosition = (this.tileTickPosition < this.blockEntityTickers.size()) ? this.tileTickPosition : 0;
|
||||
TickingBlockEntity tickingblockentity = (TickingBlockEntity) this.blockEntityTickers.get(this.tileTickPosition);
|
||||
@@ -1287,13 +1291,25 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
@@ -1298,13 +1302,25 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
tilesThisCycle--;
|
||||
this.blockEntityTickers.markAsRemoved(this.tileTickPosition); // this.blockEntityTickers.remove(this.tileTickPosition--); // SparklyPaper - optimize block entity removals
|
||||
// Spigot end
|
||||
- } else if (this.shouldTickBlocksAt(tickingblockentity.getPos())) {
|
||||
+ // } else if (this.shouldTickBlocksAt(tickingblockentity.getPos())) { // SparklyPaper start - optimize tickBlockEntities
|
||||
+ } else {
|
||||
- } else if (flag && this.shouldTickBlocksAt(tickingblockentity.getPos())) {
|
||||
+ // } else if (flag && this.shouldTickBlocksAt(tickingblockentity.getPos())) { // SparklyPaper start - optimize tickBlockEntities
|
||||
+ } else if (flag) {
|
||||
+ long chunkPos = tickingblockentity.getChunkCoordinateKey();
|
||||
+ boolean shouldTick;
|
||||
+ if (shouldTickBlocksAtChunkPos == chunkPos && shouldTickBlocksAtLastResult != -1) {
|
||||
|
||||
@@ -56,10 +56,10 @@ index 8b5293b0c696ef21d0101493ffa41b60bf0bc86b..601198a33adb29316b0617d5390d1620
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index cebda87d198edc844f5629a5cd4c71cd6dd75caf..53284b2b0d0a2546e8c045a960a1db9b8d06e3f7 100644
|
||||
index f43060555bf02f13268b284606045fce2b3e911a..f34a9d3a255ee72e2c467376bd1f7bc2a1309443 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -1561,7 +1561,16 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1730,7 +1730,16 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
|
||||
try {
|
||||
worldserver.timings.doTick.startTiming(); // Spigot
|
||||
@@ -77,10 +77,10 @@ index cebda87d198edc844f5629a5cd4c71cd6dd75caf..53284b2b0d0a2546e8c045a960a1db9b
|
||||
for (final io.papermc.paper.chunk.SingleThreadChunkRegionManager regionManager : worldserver.getChunkSource().chunkMap.regionManagers) {
|
||||
regionManager.recalculateRegions();
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index c88d5b9125f6ee43bf2be60fd1745d836f271b78..3721a45fbc38d6fc92cc8ba5080c7bd18b8d006c 100644
|
||||
index b78a9628a88f2a495ef6de74446a02a14d41a1f6..094a6ddebf79aa49b3e3cd8a032db7b8d23607c4 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -685,6 +685,12 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
@@ -687,6 +687,12 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
}
|
||||
// Paper end - optimise nearby player retrieval
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user