mirror of
https://github.com/PaperMC/Folia.git
synced 2025-04-19 18:49:21 +08:00
Compare commits
11 Commits
92efc63ec3
...
873afea939
Author | SHA1 | Date | |
---|---|---|---|
|
873afea939 | ||
|
b05f1ef01d | ||
|
f8132c51c3 | ||
|
87f8bd3e00 | ||
|
1f0b85d4e4 | ||
|
5cc35a8e23 | ||
|
35d31075a6 | ||
|
ec78da5ae0 | ||
|
e7bb50eac6 | ||
|
81b9f70be9 | ||
|
e7e959208c |
@ -0,0 +1,92 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Euphyllia Bierque <bierque.euphyllia@gmail.com>
|
||||
Date: Tue, 28 Jan 2025 16:34:17 -0800
|
||||
Subject: [PATCH] Add TPS From Region
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
|
||||
index 9196b1e62b328b1e9790b966600aba9681dd0ddc..86192033979d78f6308451b024995eac963af9ab 100644
|
||||
--- a/src/main/java/org/bukkit/Bukkit.java
|
||||
+++ b/src/main/java/org/bukkit/Bukkit.java
|
||||
@@ -2975,6 +2975,42 @@ public final class Bukkit {
|
||||
return server.isGlobalTickThread();
|
||||
}
|
||||
// Paper end - Folia region threading API
|
||||
+ // Folia start - region TPS API
|
||||
+ /**
|
||||
+ * Gets the TPS from the region which owns the specified location, or {@code null} if no region owns
|
||||
+ * the specified location.
|
||||
+ *
|
||||
+ * @param location The location for which to get the TPS
|
||||
+ * @return TPS (5s, 15s, 1m, 5m, 15m), or null if the region doesn't exist
|
||||
+ */
|
||||
+ public static double @Nullable [] getRegionTPS(@NotNull Location location) {
|
||||
+ return server.getRegionTPS(location);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the TPS from the region which owns the specified chunk, or {@code null} if no region owns
|
||||
+ * the specified location.
|
||||
+ *
|
||||
+ * @param chunk - The specified chunk
|
||||
+ * @return TPS (5s, 15s, 1m, 5m, 15m), or null if the region doesn't exist
|
||||
+ */
|
||||
+ public static double @Nullable [] getRegionTPS(@NotNull Chunk chunk) {
|
||||
+ return server.getRegionTPS(chunk);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the TPS from the region which owns the specified chunk, or {@code null} if no region owns
|
||||
+ * the specified location.
|
||||
+ *
|
||||
+ * @param world - World containing the chunk
|
||||
+ * @param chunkX - X-coordinate of the chunk
|
||||
+ * @param chunkZ - Z-coordinate of the chunk
|
||||
+ * @return TPS (5s, 15s, 1m, 5m, 15m), or null if the region doesn't exist
|
||||
+ */
|
||||
+ public static double @Nullable [] getRegionTPS(@NotNull World world, int chunkX, int chunkZ) {
|
||||
+ return server.getRegionTPS(world, chunkX, chunkZ);
|
||||
+ }
|
||||
+ // Folia end - region TPS API
|
||||
|
||||
@NotNull
|
||||
public static Server.Spigot spigot() {
|
||||
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
|
||||
index 11923ef0ea75f702273ba5481ac6d46cc0f17697..4cad7f842418b0702575db29cc79dcfcc207d589 100644
|
||||
--- a/src/main/java/org/bukkit/Server.java
|
||||
+++ b/src/main/java/org/bukkit/Server.java
|
||||
@@ -2654,4 +2654,34 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||
*/
|
||||
void allowPausing(@NotNull org.bukkit.plugin.Plugin plugin, boolean value);
|
||||
// Paper end - API to check if the server is sleeping
|
||||
+ // Folia start - region TPS API
|
||||
+ /**
|
||||
+ * Gets the TPS from the region which owns the specified location, or {@code null} if no region owns
|
||||
+ * the specified location.
|
||||
+ *
|
||||
+ * @param location The location for which to get the TPS
|
||||
+ * @return TPS (5s, 15s, 1m, 5m, 15m), or null if the region doesn't exist
|
||||
+ */
|
||||
+ double @Nullable [] getRegionTPS(@NotNull Location location);
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the TPS from the region which owns the specified chunk, or {@code null} if no region owns
|
||||
+ * the specified location.
|
||||
+ *
|
||||
+ * @param chunk - The specified chunk
|
||||
+ * @return TPS (5s, 15s, 1m, 5m, 15m), or null if the region doesn't exist
|
||||
+ */
|
||||
+ double @Nullable [] getRegionTPS(@NotNull Chunk chunk);
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the TPS from the region which owns the specified chunk, or {@code null} if no region owns
|
||||
+ * the specified location.
|
||||
+ *
|
||||
+ * @param world - World containing the chunk
|
||||
+ * @param chunkX - X-coordinate of the chunk
|
||||
+ * @param chunkZ - Z-coordinate of the chunk
|
||||
+ * @return TPS (5s, 15s, 1m, 5m, 15m), or null if the region doesn't exist
|
||||
+ */
|
||||
+ double @Nullable [] getRegionTPS(@NotNull World world, int chunkX, int chunkZ);
|
||||
+ // Folia end - region TPS API
|
||||
}
|
@ -1,11 +1,20 @@
|
||||
--- a/ca/spottedleaf/moonrise/patches/collisions/CollisionUtil.java
|
||||
+++ b/ca/spottedleaf/moonrise/patches/collisions/CollisionUtil.java
|
||||
@@ -1940,7 +_,7 @@
|
||||
@@ -1940,6 +_,17 @@
|
||||
|
||||
for (int currChunkZ = minChunkZ; currChunkZ <= maxChunkZ; ++currChunkZ) {
|
||||
for (int currChunkX = minChunkX; currChunkX <= maxChunkX; ++currChunkX) {
|
||||
- final ChunkAccess chunk = chunkSource.getChunk(currChunkX, currChunkZ, ChunkStatus.FULL, loadChunks);
|
||||
+ final ChunkAccess chunk = !ca.spottedleaf.moonrise.common.util.TickThread.isTickThreadFor((net.minecraft.server.level.ServerLevel)world, currChunkX, currChunkZ) ? null : chunkSource.getChunk(currChunkX, currChunkZ, ChunkStatus.FULL, loadChunks); // Folia - region threading
|
||||
+ // Folia start - region threading
|
||||
+ if (!ca.spottedleaf.moonrise.common.util.TickThread.isTickThreadFor(world, currChunkX, currChunkZ, 4)) {
|
||||
+ if (checkOnly) {
|
||||
+ return true;
|
||||
+ } else {
|
||||
+ intoAABB.add(getBoxForChunk(currChunkX, currChunkZ));
|
||||
+ ret = true;
|
||||
+ continue;
|
||||
+ }
|
||||
+ }
|
||||
+ // Folia end - region threading
|
||||
final ChunkAccess chunk = chunkSource.getChunk(currChunkX, currChunkZ, ChunkStatus.FULL, loadChunks);
|
||||
|
||||
if (chunk == null) {
|
||||
if ((collisionFlags & COLLISION_FLAG_COLLIDE_WITH_UNLOADED_CHUNKS) != 0) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- /dev/null
|
||||
+++ b/io/papermc/paper/threadedregions/TeleportUtils.java
|
||||
@@ -1,0 +_,70 @@
|
||||
@@ -1,0 +_,82 @@
|
||||
+package io.papermc.paper.threadedregions;
|
||||
+
|
||||
+import ca.spottedleaf.concurrentutil.completable.CallbackCompletable;
|
||||
@ -13,8 +13,14 @@
|
||||
+
|
||||
+public final class TeleportUtils {
|
||||
+
|
||||
+ public static void teleport(final Entity from, final boolean useFromRootVehicle, final Entity to, final Float yaw, final Float pitch,
|
||||
+ final long teleportFlags, final PlayerTeleportEvent.TeleportCause cause, final Consumer<Entity> onComplete) {
|
||||
+ public static <T extends Entity> void teleport(final T from, final boolean useFromRootVehicle, final Entity to, final Float yaw, final Float pitch,
|
||||
+ final long teleportFlags, final PlayerTeleportEvent.TeleportCause cause, final Consumer<Entity> onComplete) {
|
||||
+ teleport(from, useFromRootVehicle, to, yaw, pitch, teleportFlags, cause, onComplete, null);
|
||||
+ }
|
||||
+
|
||||
+ public static <T extends Entity> void teleport(final T from, final boolean useFromRootVehicle, final Entity to, final Float yaw, final Float pitch,
|
||||
+ final long teleportFlags, final PlayerTeleportEvent.TeleportCause cause, final Consumer<Entity> onComplete,
|
||||
+ final java.util.function.Predicate<T> preTeleport) {
|
||||
+ // retrieve coordinates
|
||||
+ final CallbackCompletable<Location> positionCompletable = new CallbackCompletable<>();
|
||||
+
|
||||
@ -27,10 +33,16 @@
|
||||
+ return;
|
||||
+ }
|
||||
+ final boolean scheduled = from.getBukkitEntity().taskScheduler.schedule(
|
||||
+ (final Entity realFrom) -> {
|
||||
+ (final T realFrom) -> {
|
||||
+ final Vec3 pos = new Vec3(
|
||||
+ loc.getX(), loc.getY(), loc.getZ()
|
||||
+ );
|
||||
+ if (preTeleport != null && !preTeleport.test(realFrom)) {
|
||||
+ if (onComplete != null) {
|
||||
+ onComplete.accept(null);
|
||||
+ }
|
||||
+ return;
|
||||
+ }
|
||||
+ (useFromRootVehicle ? realFrom.getRootVehicle() : realFrom).teleportAsync(
|
||||
+ ((CraftWorld)loc.getWorld()).getHandle(), pos, null, null, null,
|
||||
+ cause, teleportFlags, onComplete
|
||||
|
@ -111,7 +111,7 @@
|
||||
+ // Folia start - region threading
|
||||
+ for (Entity possible : this.level.getCurrentWorldData().trackerEntities) {
|
||||
+ ChunkMap.TrackedEntity trackedEntity1 = possible.moonrise$getTrackedEntity();
|
||||
+ if (trackedEntity == null) {
|
||||
+ if (trackedEntity1 == null) {
|
||||
+ continue;
|
||||
+ }
|
||||
+ // Folia end - region threading
|
||||
|
@ -188,7 +188,32 @@
|
||||
} else {
|
||||
LOGGER.warn("Failed to spawn player ender pearl in level ({}), skipping", optional.get());
|
||||
}
|
||||
@@ -1357,6 +_,324 @@
|
||||
@@ -817,12 +_,23 @@
|
||||
|
||||
Entity camera = this.getCamera();
|
||||
if (camera != this) {
|
||||
- if (camera.isAlive()) {
|
||||
+ if (camera.canBeSpectated()) { // Folia - region threading - replace removed check
|
||||
+ if (ca.spottedleaf.moonrise.common.util.TickThread.isTickThreadFor(camera) && !camera.isRemoved()) { // Folia - region threading
|
||||
this.absMoveTo(camera.getX(), camera.getY(), camera.getZ(), camera.getYRot(), camera.getXRot());
|
||||
this.serverLevel().getChunkSource().move(this);
|
||||
if (this.wantsToStopRiding()) {
|
||||
this.setCamera(this);
|
||||
}
|
||||
+ } else { // Folia start - region threading
|
||||
+ Entity realCamera = camera.getBukkitEntity().getHandleRaw();
|
||||
+ if (realCamera != camera) {
|
||||
+ this.setCamera(this);
|
||||
+ this.setCamera(realCamera);
|
||||
+ } else {
|
||||
+ this.teleportToCameraOffRegion();
|
||||
+ }
|
||||
+ }
|
||||
+ // Folia end - region threading
|
||||
} else {
|
||||
this.setCamera(this);
|
||||
}
|
||||
@@ -1357,9 +_,332 @@
|
||||
}
|
||||
}
|
||||
|
||||
@ -513,18 +538,74 @@
|
||||
@Nullable
|
||||
@Override
|
||||
public ServerPlayer teleport(TeleportTransition teleportTransition) {
|
||||
@@ -2398,6 +_,11 @@
|
||||
+ // Folia start - region threading
|
||||
+ if (true) {
|
||||
+ throw new UnsupportedOperationException("Must use teleportAsync while in region threading");
|
||||
+ }
|
||||
+ // Folia end - region threading
|
||||
if (this.isSleeping()) return null; // CraftBukkit - SPIGOT-3154
|
||||
if (this.isRemoved()) {
|
||||
return null;
|
||||
@@ -2397,7 +_,30 @@
|
||||
return (Entity)(this.camera == null ? this : this.camera);
|
||||
}
|
||||
|
||||
+ // Folia start - region threading
|
||||
+ private void teleportToCameraOffRegion() {
|
||||
+ Entity cameraFinal = this.camera;
|
||||
+ // use the task scheduler, as we don't know where the caller is invoking from
|
||||
+ if (this != cameraFinal) {
|
||||
+ this.getBukkitEntity().taskScheduler.schedule((final ServerPlayer newPlayer) -> {
|
||||
+ io.papermc.paper.threadedregions.TeleportUtils.teleport(
|
||||
+ newPlayer, false, cameraFinal, null, null, 0L,
|
||||
+ org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.SPECTATE, null,
|
||||
+ (final ServerPlayer newerPlayer) -> {
|
||||
+ return newerPlayer.camera == cameraFinal;
|
||||
+ }
|
||||
+ );
|
||||
+ }, null, 1L);
|
||||
+ } // else: do not bother teleporting to self
|
||||
+ }
|
||||
+ // Folia end - region threading
|
||||
+
|
||||
public void setCamera(@Nullable Entity entityToSpectate) {
|
||||
+ // Folia start - region threading
|
||||
+ if (entityToSpectate != null && !ca.spottedleaf.moonrise.common.util.TickThread.isTickThreadFor(entityToSpectate)) {
|
||||
+ if (entityToSpectate != null && (entityToSpectate != this && !entityToSpectate.canBeSpectated())) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // Folia end - region threading
|
||||
Entity camera = this.getCamera();
|
||||
this.camera = (Entity)(entityToSpectate == null ? this : entityToSpectate);
|
||||
if (camera != this.camera) {
|
||||
@@ -2416,16 +_,19 @@
|
||||
}
|
||||
}
|
||||
// Paper end - Add PlayerStartSpectatingEntityEvent and PlayerStopSpectatingEntity
|
||||
- if (this.camera.level() instanceof ServerLevel serverLevel) {
|
||||
- this.teleportTo(serverLevel, this.camera.getX(), this.camera.getY(), this.camera.getZ(), Set.of(), this.getYRot(), this.getXRot(), false, org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.SPECTATE); // CraftBukkit
|
||||
- }
|
||||
-
|
||||
- if (entityToSpectate != null) {
|
||||
- this.serverLevel().getChunkSource().move(this);
|
||||
- }
|
||||
-
|
||||
+ // Folia - region threading - move down
|
||||
+
|
||||
+ // Folia - region threading - not needed
|
||||
+
|
||||
+ // Folia start - region threading - handle camera setting better
|
||||
+ if (this.camera == this
|
||||
+ || (ca.spottedleaf.moonrise.common.util.TickThread.isTickThreadFor(this.camera) && this.camera.moonrise$getTrackedEntity() != null
|
||||
+ && this.camera.moonrise$getTrackedEntity().seenBy.contains(this.connection))) {
|
||||
+ // Folia end - region threading - handle camera setting better
|
||||
this.connection.send(new ClientboundSetCameraPacket(this.camera));
|
||||
- this.connection.resetPosition();
|
||||
+ } // Folia - region threading - handle camera setting better
|
||||
+ //this.connection.resetPosition(); // Folia - region threading - not needed
|
||||
+ this.teleportToCameraOffRegion(); // Folia - region threading - moved down
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2896,11 +_,11 @@
|
||||
}
|
||||
|
||||
|
@ -134,7 +134,7 @@
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -817,7 +_,7 @@
|
||||
@@ -824,7 +_,7 @@
|
||||
}
|
||||
|
||||
// This needs to be on main
|
||||
@ -143,7 +143,7 @@
|
||||
} else if (!completions.isEmpty()) {
|
||||
final com.mojang.brigadier.suggestion.SuggestionsBuilder builder0 = new com.mojang.brigadier.suggestion.SuggestionsBuilder(packet.getCommand(), stringReader.getTotalLength());
|
||||
final com.mojang.brigadier.suggestion.SuggestionsBuilder builder = builder0.createOffset(builder0.getInput().lastIndexOf(' ') + 1);
|
||||
@@ -1200,11 +_,11 @@
|
||||
@@ -1207,11 +_,11 @@
|
||||
}
|
||||
// Paper end - Book size limits
|
||||
// CraftBukkit start
|
||||
@ -157,7 +157,7 @@
|
||||
// CraftBukkit end
|
||||
int slot = packet.slot();
|
||||
if (Inventory.isHotbarSlot(slot) || slot == 40) {
|
||||
@@ -1215,7 +_,22 @@
|
||||
@@ -1222,7 +_,22 @@
|
||||
Consumer<List<FilteredText>> consumer = optional.isPresent()
|
||||
? texts -> this.signBook(texts.get(0), texts.subList(1, texts.size()), slot)
|
||||
: texts -> this.updateBookContents(texts, slot);
|
||||
@ -181,7 +181,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1341,9 +_,10 @@
|
||||
@@ -1348,9 +_,10 @@
|
||||
int i = this.receivedMovePacketCount - this.knownMovePacketCount;
|
||||
|
||||
// CraftBukkit start - handle custom speeds and skipped ticks
|
||||
@ -194,7 +194,7 @@
|
||||
|
||||
if (i > Math.max(this.allowedPlayerTicks, 5)) {
|
||||
LOGGER.debug("{} is sending move packets too frequently ({} packets since last tick)", this.player.getName().getString(), i);
|
||||
@@ -1532,7 +_,7 @@
|
||||
@@ -1539,7 +_,7 @@
|
||||
|
||||
// If the event is cancelled we move the player back to their old location.
|
||||
if (event.isCancelled()) {
|
||||
@ -203,7 +203,7 @@
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1540,7 +_,7 @@
|
||||
@@ -1547,7 +_,7 @@
|
||||
// there to avoid any 'Moved wrongly' or 'Moved too quickly' errors.
|
||||
// We only do this if the Event was not cancelled.
|
||||
if (!oldTo.equals(event.getTo()) && !event.isCancelled()) {
|
||||
@ -212,7 +212,7 @@
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1799,9 +_,9 @@
|
||||
@@ -1806,9 +_,9 @@
|
||||
if (!this.player.isSpectator()) {
|
||||
// limit how quickly items can be dropped
|
||||
// If the ticks aren't the same then the count starts from 0 and we update the lastDropTick.
|
||||
@ -224,7 +224,7 @@
|
||||
} else {
|
||||
// Else we increment the drop count and check the amount.
|
||||
this.dropCount++;
|
||||
@@ -1829,7 +_,7 @@
|
||||
@@ -1836,7 +_,7 @@
|
||||
case ABORT_DESTROY_BLOCK:
|
||||
case STOP_DESTROY_BLOCK:
|
||||
// Paper start - Don't allow digging into unloaded chunks
|
||||
@ -233,7 +233,7 @@
|
||||
this.player.connection.ackBlockChangesUpTo(packet.getSequence());
|
||||
return;
|
||||
}
|
||||
@@ -1911,7 +_,7 @@
|
||||
@@ -1918,7 +_,7 @@
|
||||
}
|
||||
// Paper end - improve distance check
|
||||
BlockPos blockPos = hitResult.getBlockPos();
|
||||
@ -242,7 +242,7 @@
|
||||
Vec3 vec3 = location.subtract(Vec3.atCenterOf(blockPos));
|
||||
double d = 1.0000001;
|
||||
if (Math.abs(vec3.x()) < 1.0000001 && Math.abs(vec3.y()) < 1.0000001 && Math.abs(vec3.z()) < 1.0000001) {
|
||||
@@ -2032,7 +_,7 @@
|
||||
@@ -2039,7 +_,7 @@
|
||||
for (ServerLevel serverLevel : this.server.getAllLevels()) {
|
||||
Entity entity = packet.getEntity(serverLevel);
|
||||
if (entity != null) {
|
||||
@ -251,7 +251,7 @@
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -2064,7 +_,7 @@
|
||||
@@ -2071,7 +_,7 @@
|
||||
}
|
||||
// CraftBukkit end
|
||||
LOGGER.info("{} lost connection: {}", this.player.getName().getString(), details.reason().getString());
|
||||
@ -260,7 +260,7 @@
|
||||
super.onDisconnect(details, quitMessage); // Paper - Fix kick event leave message not being sent
|
||||
}
|
||||
|
||||
@@ -2073,6 +_,8 @@
|
||||
@@ -2080,6 +_,8 @@
|
||||
this.removePlayerFromWorld(null);
|
||||
}
|
||||
|
||||
@ -269,7 +269,7 @@
|
||||
private void removePlayerFromWorld(@Nullable net.kyori.adventure.text.Component quitMessage) {
|
||||
// Paper end - Fix kick event leave message not being sent
|
||||
this.chatMessageChain.close();
|
||||
@@ -2086,6 +_,8 @@
|
||||
@@ -2093,6 +_,8 @@
|
||||
this.player.disconnect();
|
||||
// Paper start - Adventure
|
||||
quitMessage = quitMessage == null ? this.server.getPlayerList().remove(this.player) : this.server.getPlayerList().remove(this.player, quitMessage); // Paper - pass in quitMessage to fix kick message not being used
|
||||
@ -278,7 +278,7 @@
|
||||
if ((quitMessage != null) && !quitMessage.equals(net.kyori.adventure.text.Component.empty())) {
|
||||
this.server.getPlayerList().broadcastSystemMessage(PaperAdventure.asVanilla(quitMessage), false);
|
||||
// Paper end - Adventure
|
||||
@@ -2324,7 +_,7 @@
|
||||
@@ -2331,7 +_,7 @@
|
||||
this.player.resetLastActionTime();
|
||||
// CraftBukkit start
|
||||
if (sync) {
|
||||
@ -287,7 +287,7 @@
|
||||
} else {
|
||||
handler.run();
|
||||
}
|
||||
@@ -2379,7 +_,7 @@
|
||||
@@ -2386,7 +_,7 @@
|
||||
String originalFormat = event.getFormat(), originalMessage = event.getMessage();
|
||||
this.cserver.getPluginManager().callEvent(event);
|
||||
|
||||
@ -296,7 +296,7 @@
|
||||
// Evil plugins still listening to deprecated event
|
||||
final PlayerChatEvent queueEvent = new PlayerChatEvent(player, event.getMessage(), event.getFormat(), event.getRecipients());
|
||||
queueEvent.setCancelled(event.isCancelled());
|
||||
@@ -2476,6 +_,7 @@
|
||||
@@ -2483,6 +_,7 @@
|
||||
if (rawMessage.isEmpty()) {
|
||||
LOGGER.warn("{} tried to send an empty message", this.player.getScoreboardName());
|
||||
} else if (this.getCraftPlayer().isConversing()) {
|
||||
@ -304,7 +304,7 @@
|
||||
final String conversationInput = rawMessage;
|
||||
this.server.processQueue.add(() -> ServerGamePacketListenerImpl.this.getCraftPlayer().acceptConversationInput(conversationInput));
|
||||
} else if (this.player.getChatVisibility() == ChatVisiblity.SYSTEM) { // Re-add "Command Only" flag check
|
||||
@@ -2701,8 +_,25 @@
|
||||
@@ -2708,8 +_,25 @@
|
||||
// Spigot end
|
||||
|
||||
public void switchToConfig() {
|
||||
@ -331,7 +331,7 @@
|
||||
this.send(ClientboundStartConfigurationPacket.INSTANCE);
|
||||
this.connection.setupOutboundProtocol(ConfigurationProtocols.CLIENTBOUND);
|
||||
}
|
||||
@@ -2727,7 +_,7 @@
|
||||
@@ -2734,7 +_,7 @@
|
||||
// Spigot end
|
||||
this.player.resetLastActionTime();
|
||||
this.player.setShiftKeyDown(packet.isUsingSecondaryAction());
|
||||
@ -340,7 +340,7 @@
|
||||
if (!serverLevel.getWorldBorder().isWithinBounds(target.blockPosition())) {
|
||||
return;
|
||||
}
|
||||
@@ -2859,6 +_,12 @@
|
||||
@@ -2866,6 +_,12 @@
|
||||
switch (action) {
|
||||
case PERFORM_RESPAWN:
|
||||
if (this.player.wonGame) {
|
||||
@ -353,7 +353,7 @@
|
||||
this.player.wonGame = false;
|
||||
this.player = this.server.getPlayerList().respawn(this.player, true, Entity.RemovalReason.CHANGED_DIMENSION, RespawnReason.END_PORTAL); // CraftBukkit
|
||||
this.resetPosition();
|
||||
@@ -2868,6 +_,17 @@
|
||||
@@ -2875,6 +_,17 @@
|
||||
return;
|
||||
}
|
||||
|
||||
@ -371,7 +371,7 @@
|
||||
this.player = this.server.getPlayerList().respawn(this.player, false, Entity.RemovalReason.KILLED, RespawnReason.DEATH); // CraftBukkit
|
||||
this.resetPosition();
|
||||
if (this.server.isHardcore()) {
|
||||
@@ -3441,7 +_,21 @@
|
||||
@@ -3448,7 +_,21 @@
|
||||
}
|
||||
List<String> list = Stream.of(lines).map(ChatFormatting::stripFormatting).collect(Collectors.toList());
|
||||
// Paper end - Limit client sign length
|
||||
|
@ -27,7 +27,7 @@
|
||||
private EntityDimensions dimensions;
|
||||
private float eyeHeight;
|
||||
public boolean isInPowderSnow;
|
||||
@@ -525,6 +_,19 @@
|
||||
@@ -521,6 +_,23 @@
|
||||
}
|
||||
}
|
||||
// Paper end - optimise entity tracker
|
||||
@ -43,11 +43,15 @@
|
||||
+ this.pistonDeltasGameTime += fromRedstoneTimeOffset;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public boolean canBeSpectated() {
|
||||
+ return !this.getBukkitEntity().taskScheduler.isRetired();
|
||||
+ }
|
||||
+ // Folia end - region ticking
|
||||
|
||||
public Entity(EntityType<?> entityType, Level level) {
|
||||
this.type = entityType;
|
||||
@@ -655,8 +_,7 @@
|
||||
@@ -651,8 +_,7 @@
|
||||
// due to interactions on the client.
|
||||
public void resendPossiblyDesyncedEntityData(net.minecraft.server.level.ServerPlayer player) {
|
||||
if (player.getBukkitEntity().canSee(this.getBukkitEntity())) {
|
||||
@ -57,7 +61,7 @@
|
||||
if (tracker == null) {
|
||||
return;
|
||||
}
|
||||
@@ -823,7 +_,7 @@
|
||||
@@ -819,7 +_,7 @@
|
||||
public void postTick() {
|
||||
// No clean way to break out of ticking once the entity has been copied to a new world, so instead we move the portalling later in the tick cycle
|
||||
if (!(this instanceof ServerPlayer) && this.isAlive()) { // Paper - don't attempt to teleport dead entities
|
||||
@ -66,7 +70,7 @@
|
||||
}
|
||||
}
|
||||
// CraftBukkit end
|
||||
@@ -841,7 +_,7 @@
|
||||
@@ -837,7 +_,7 @@
|
||||
this.boardingCooldown--;
|
||||
}
|
||||
|
||||
@ -75,7 +79,7 @@
|
||||
if (this.canSpawnSprintParticle()) {
|
||||
this.spawnSprintParticle();
|
||||
}
|
||||
@@ -1104,8 +_,8 @@
|
||||
@@ -1100,8 +_,8 @@
|
||||
} else {
|
||||
this.wasOnFire = this.isOnFire();
|
||||
if (type == MoverType.PISTON) {
|
||||
@ -86,7 +90,7 @@
|
||||
movement = this.limitPistonMovement(movement);
|
||||
if (movement.equals(Vec3.ZERO)) {
|
||||
return;
|
||||
@@ -1404,7 +_,7 @@
|
||||
@@ -1400,7 +_,7 @@
|
||||
if (pos.lengthSqr() <= 1.0E-7) {
|
||||
return pos;
|
||||
} else {
|
||||
@ -95,7 +99,7 @@
|
||||
if (gameTime != this.pistonDeltasGameTime) {
|
||||
Arrays.fill(this.pistonDeltas, 0.0);
|
||||
this.pistonDeltasGameTime = gameTime;
|
||||
@@ -3038,6 +_,7 @@
|
||||
@@ -3034,6 +_,7 @@
|
||||
}
|
||||
|
||||
if (force || this.canRide(vehicle) && vehicle.canAddPassenger(this)) {
|
||||
@ -103,7 +107,7 @@
|
||||
// CraftBukkit start
|
||||
if (vehicle.getBukkitEntity() instanceof org.bukkit.entity.Vehicle && this.getBukkitEntity() instanceof org.bukkit.entity.LivingEntity) {
|
||||
org.bukkit.event.vehicle.VehicleEnterEvent event = new org.bukkit.event.vehicle.VehicleEnterEvent((org.bukkit.entity.Vehicle) vehicle.getBukkitEntity(), this.getBukkitEntity());
|
||||
@@ -3059,6 +_,7 @@
|
||||
@@ -3055,6 +_,7 @@
|
||||
return false;
|
||||
}
|
||||
// CraftBukkit end
|
||||
@ -111,7 +115,7 @@
|
||||
if (this.isPassenger()) {
|
||||
this.stopRiding();
|
||||
}
|
||||
@@ -3126,7 +_,7 @@
|
||||
@@ -3122,7 +_,7 @@
|
||||
this.passengers = ImmutableList.copyOf(list);
|
||||
}
|
||||
|
||||
@ -120,7 +124,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3140,6 +_,7 @@
|
||||
@@ -3136,6 +_,7 @@
|
||||
throw new IllegalStateException("Use x.stopRiding(y), not y.removePassenger(x)");
|
||||
} else {
|
||||
// CraftBukkit start
|
||||
@ -128,7 +132,7 @@
|
||||
org.bukkit.craftbukkit.entity.CraftEntity craft = (org.bukkit.craftbukkit.entity.CraftEntity) passenger.getBukkitEntity().getVehicle();
|
||||
Entity orig = craft == null ? null : craft.getHandle();
|
||||
if (this.getBukkitEntity() instanceof org.bukkit.entity.Vehicle && passenger.getBukkitEntity() instanceof org.bukkit.entity.LivingEntity) {
|
||||
@@ -3167,6 +_,7 @@
|
||||
@@ -3163,6 +_,7 @@
|
||||
return false;
|
||||
}
|
||||
// CraftBukkit end
|
||||
@ -136,7 +140,7 @@
|
||||
if (this.passengers.size() == 1 && this.passengers.get(0) == passenger) {
|
||||
this.passengers = ImmutableList.of();
|
||||
} else {
|
||||
@@ -3174,7 +_,7 @@
|
||||
@@ -3170,7 +_,7 @@
|
||||
}
|
||||
|
||||
passenger.boardingCooldown = 60;
|
||||
@ -145,7 +149,7 @@
|
||||
}
|
||||
return true; // CraftBukkit
|
||||
}
|
||||
@@ -3258,7 +_,7 @@
|
||||
@@ -3254,7 +_,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@ -154,7 +158,7 @@
|
||||
if (this.level() instanceof ServerLevel serverLevel) {
|
||||
this.processPortalCooldown();
|
||||
if (this.portalProcess != null) {
|
||||
@@ -3266,21 +_,20 @@
|
||||
@@ -3262,21 +_,20 @@
|
||||
ProfilerFiller profilerFiller = Profiler.get();
|
||||
profilerFiller.push("portal");
|
||||
this.setPortalCooldown();
|
||||
@ -184,7 +188,7 @@
|
||||
}
|
||||
|
||||
public int getDimensionChangingDelay() {
|
||||
@@ -3420,6 +_,11 @@
|
||||
@@ -3416,6 +_,11 @@
|
||||
|
||||
@Nullable
|
||||
public PlayerTeam getTeam() {
|
||||
@ -196,7 +200,7 @@
|
||||
if (!this.level().paperConfig().scoreboards.allowNonPlayerEntitiesOnScoreboards && !(this instanceof Player)) { return null; } // Paper - Perf: Disable Scoreboards for non players by default
|
||||
return this.level().getScoreboard().getPlayersTeam(this.getScoreboardName());
|
||||
}
|
||||
@@ -3726,8 +_,782 @@
|
||||
@@ -3722,8 +_,789 @@
|
||||
this.portalProcess = entity.portalProcess;
|
||||
}
|
||||
|
||||
@ -585,25 +589,32 @@
|
||||
+ ca.spottedleaf.moonrise.common.util.CoordinateUtils.getChunkX(pos), ca.spottedleaf.moonrise.common.util.CoordinateUtils.getChunkZ(pos)
|
||||
+ )
|
||||
+ ) {
|
||||
+ boolean hasPassengers = !this.passengers.isEmpty();
|
||||
+ EntityTreeNode passengerTree = this.detachPassengers();
|
||||
+ // Note: The client does not accept position updates for controlled entities. So, we must
|
||||
+ // perform a lot of tracker updates here to make it all work out.
|
||||
+
|
||||
+ // first, clear the tracker
|
||||
+ passengerTree.clearTracker();
|
||||
+ if (hasPassengers) {
|
||||
+ // Note: The client does not accept position updates for controlled entities. So, we must
|
||||
+ // perform a lot of tracker updates here to make it all work out.
|
||||
+
|
||||
+ // first, clear the tracker
|
||||
+ passengerTree.clearTracker();
|
||||
+ }
|
||||
+
|
||||
+ for (EntityTreeNode entity : passengerTree.getFullTree()) {
|
||||
+ entity.root.teleportSyncSameRegion(pos, yaw, pitch, velocity);
|
||||
+ }
|
||||
+
|
||||
+ passengerTree.restore();
|
||||
+ // re-add to the tracker once the tree is restored
|
||||
+ passengerTree.addTracker();
|
||||
+ if (hasPassengers) {
|
||||
+ passengerTree.restore();
|
||||
+ // re-add to the tracker once the tree is restored
|
||||
+ passengerTree.addTracker();
|
||||
+
|
||||
+ // adjust entities to final position
|
||||
+ passengerTree.adjustRiders(true);
|
||||
+ // adjust entities to final position
|
||||
+ passengerTree.adjustRiders(true);
|
||||
+
|
||||
+ // the tracker clear/add logic is only used in the same region, as the other logic
|
||||
+ // performs add/remove from world logic which will also perform add/remove tracker logic
|
||||
+ // the tracker clear/add logic is only used in the same region, as the other logic
|
||||
+ // performs add/remove from world logic which will also perform add/remove tracker logic
|
||||
+ }
|
||||
+
|
||||
+ if (teleportComplete != null) {
|
||||
+ teleportComplete.accept(this);
|
||||
@ -979,7 +990,7 @@
|
||||
// Paper start - Fix item duplication and teleport issues
|
||||
if ((!this.isAlive() || !this.valid) && (teleportTransition.newLevel() != this.level)) {
|
||||
LOGGER.warn("Illegal Entity Teleport " + this + " to " + teleportTransition.newLevel() + ":" + teleportTransition.position(), new Throwable());
|
||||
@@ -3911,6 +_,12 @@
|
||||
@@ -3907,6 +_,12 @@
|
||||
}
|
||||
}
|
||||
|
||||
@ -992,7 +1003,33 @@
|
||||
protected void removeAfterChangingDimensions() {
|
||||
this.setRemoved(Entity.RemovalReason.CHANGED_DIMENSION, null); // CraftBukkit - add Bukkit remove cause
|
||||
if (this instanceof Leashable leashable && leashable.isLeashed()) { // Paper - only call if it is leashed
|
||||
@@ -4790,7 +_,8 @@
|
||||
@@ -4242,6 +_,12 @@
|
||||
}
|
||||
|
||||
public void startSeenByPlayer(ServerPlayer serverPlayer) {
|
||||
+ // Folia start - region threading
|
||||
+ if (serverPlayer.getCamera() == this) {
|
||||
+ // set camera again
|
||||
+ serverPlayer.connection.send(new net.minecraft.network.protocol.game.ClientboundSetCameraPacket(this));
|
||||
+ }
|
||||
+ // Folia end - region threading
|
||||
}
|
||||
|
||||
public void stopSeenByPlayer(ServerPlayer serverPlayer) {
|
||||
@@ -4251,6 +_,12 @@
|
||||
new io.papermc.paper.event.player.PlayerUntrackEntityEvent(serverPlayer.getBukkitEntity(), this.getBukkitEntity()).callEvent();
|
||||
}
|
||||
// Paper end - entity tracking events
|
||||
+ // Folia start - region threading
|
||||
+ if (serverPlayer.getCamera() == this) {
|
||||
+ // unset camera, the player tick method should TP us close enough again to invoke startSeenByPlayer
|
||||
+ serverPlayer.connection.send(new net.minecraft.network.protocol.game.ClientboundSetCameraPacket(serverPlayer));
|
||||
+ }
|
||||
+ // Folia end - region threading
|
||||
}
|
||||
|
||||
public float rotate(Rotation transformRotation) {
|
||||
@@ -4786,7 +_,8 @@
|
||||
}
|
||||
}
|
||||
// Paper end - Fix MC-4
|
||||
@ -1002,7 +1039,7 @@
|
||||
synchronized (this.posLock) { // Paper - detailed watchdog information
|
||||
this.position = new Vec3(x, y, z);
|
||||
} // Paper - detailed watchdog information
|
||||
@@ -4809,7 +_,7 @@
|
||||
@@ -4805,7 +_,7 @@
|
||||
}
|
||||
// Paper start - Block invalid positions and bounding box; don't allow desync of pos and AABB
|
||||
// hanging has its own special logic
|
||||
@ -1011,7 +1048,7 @@
|
||||
this.setBoundingBox(this.makeBoundingBox());
|
||||
}
|
||||
// Paper end - Block invalid positions and bounding box
|
||||
@@ -4893,6 +_,12 @@
|
||||
@@ -4889,6 +_,12 @@
|
||||
return this.removalReason != null;
|
||||
}
|
||||
|
||||
@ -1024,7 +1061,7 @@
|
||||
@Nullable
|
||||
public Entity.RemovalReason getRemovalReason() {
|
||||
return this.removalReason;
|
||||
@@ -4915,6 +_,9 @@
|
||||
@@ -4911,6 +_,9 @@
|
||||
org.bukkit.craftbukkit.event.CraftEventFactory.callEntityRemoveEvent(this, cause);
|
||||
// CraftBukkit end
|
||||
final boolean alreadyRemoved = this.removalReason != null; // Paper - Folia schedulers
|
||||
@ -1034,7 +1071,7 @@
|
||||
if (this.removalReason == null) {
|
||||
this.removalReason = removalReason;
|
||||
}
|
||||
@@ -4937,6 +_,10 @@
|
||||
@@ -4933,6 +_,10 @@
|
||||
public void unsetRemoved() {
|
||||
this.removalReason = null;
|
||||
}
|
||||
|
@ -9,7 +9,7 @@
|
||||
protected int autoSpinAttackTicks;
|
||||
protected float autoSpinAttackDmg;
|
||||
@Nullable
|
||||
@@ -307,6 +_,21 @@
|
||||
@@ -307,6 +_,26 @@
|
||||
return this.getYHeadRot();
|
||||
}
|
||||
// CraftBukkit end
|
||||
@ -23,6 +23,11 @@
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean canBeSpectated() {
|
||||
+ return super.canBeSpectated() && this.getHealth() > 0.0F;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ protected void resetStoredPositions() {
|
||||
+ super.resetStoredPositions();
|
||||
+ this.lastClimbablePos = Optional.empty();
|
||||
|
@ -77,12 +77,12 @@ relative to the parent, exactly similar to the D field of Timers,
|
||||
where Y is the total number of times the counter is invoked.
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/command/PaperCommands.java b/src/main/java/io/papermc/paper/command/PaperCommands.java
|
||||
index a587d83b78af4efc484f939529acf70834f60d7e..45f76aaaa7dedb77a83b4a2c87905bf9a099a93c 100644
|
||||
index 5ca37a31d97a0fd068bf4ca3804456c91a6059f4..7f88caf7ca1be6e83c144bebe4221b020f74b4e0 100644
|
||||
--- a/src/main/java/io/papermc/paper/command/PaperCommands.java
|
||||
+++ b/src/main/java/io/papermc/paper/command/PaperCommands.java
|
||||
@@ -20,6 +20,7 @@ public final class PaperCommands {
|
||||
@@ -19,6 +19,7 @@ public final class PaperCommands {
|
||||
COMMANDS.put("paper", new PaperCommand("paper"));
|
||||
COMMANDS.put("callback", new CallbackCommand("callback"));
|
||||
COMMANDS.put("mspt", new MSPTCommand("mspt"));
|
||||
COMMANDS.put("tps", new io.papermc.paper.threadedregions.commands.CommandServerHealth()); // Folia - region threading
|
||||
+ COMMANDS.put("profiler", new io.papermc.paper.threadedregions.commands.CommandProfiler()); // Folia - region threading - profiler
|
||||
}
|
||||
|
@ -7,10 +7,10 @@ When regions take too long, having the server print the stacktrace
|
||||
of the ticking region should help debug the cause.
|
||||
|
||||
diff --git a/src/main/java/org/spigotmc/WatchdogThread.java b/src/main/java/org/spigotmc/WatchdogThread.java
|
||||
index a9339f59f81dff307317ae4afdff0dc296febcc9..75b698c2bcbbf487200b29083671332a6cc222ed 100644
|
||||
index dced8899be0bb8d562093dc3a7673ed8185b85a6..8228752184aaf91288092c1c60e8a431723ded41 100644
|
||||
--- a/src/main/java/org/spigotmc/WatchdogThread.java
|
||||
+++ b/src/main/java/org/spigotmc/WatchdogThread.java
|
||||
@@ -159,7 +159,7 @@ public class WatchdogThread extends Thread {
|
||||
@@ -159,7 +159,7 @@ public class WatchdogThread extends ca.spottedleaf.moonrise.common.util.TickThre
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,79 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Euphyllia Bierque <bierque.euphyllia@gmail.com>
|
||||
Date: Tue, 28 Jan 2025 16:35:13 -0800
|
||||
Subject: [PATCH] Add TPS From Region
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index b254cab566110c590ba22b0bd48cc165bfd7ae27..bcd17eba9798747010ed96903992939a284199df 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -3349,4 +3349,68 @@ public final class CraftServer implements Server {
|
||||
this.console.addPluginAllowingSleep(plugin.getName(), value);
|
||||
}
|
||||
// Paper end - API to check if the server is sleeping
|
||||
+ // Folia start - region TPS API
|
||||
+ /**
|
||||
+ * Gets the TPS from the region which owns the specified location, or {@code null} if no region owns
|
||||
+ * the specified location.
|
||||
+ *
|
||||
+ * @param location The location for which to get the TPS
|
||||
+ * @return TPS (5s, 15s, 1m, 5m, 15m), or null if the region doesn't exist
|
||||
+ */
|
||||
+ @Override
|
||||
+ public double[] getRegionTPS(Location location) {
|
||||
+ Preconditions.checkArgument(location != null, "Location cannot be null");
|
||||
+
|
||||
+ return this.getRegionTPS(location.getWorld(), location.getBlockX() >> 4, location.getBlockZ() >> 4);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the TPS from the region which owns the specified chunk, or {@code null} if no region owns
|
||||
+ * the specified location.
|
||||
+ *
|
||||
+ * @param chunk - The specified chunk
|
||||
+ * @return TPS (5s, 15s, 1m, 5m, 15m), or null if the region doesn't exist
|
||||
+ */
|
||||
+ @Override
|
||||
+ public double[] getRegionTPS(org.bukkit.Chunk chunk) {
|
||||
+ Preconditions.checkArgument(chunk != null, "Chunk cannot be null");
|
||||
+
|
||||
+ return this.getRegionTPS(chunk.getWorld(), chunk.getX(), chunk.getZ());
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the TPS from the region which owns the specified chunk, or {@code null} if no region owns
|
||||
+ * the specified location.
|
||||
+ *
|
||||
+ * @param world - World containing the chunk
|
||||
+ * @param chunkX - X-coordinate of the chunk
|
||||
+ * @param chunkZ - Z-coordinate of the chunk
|
||||
+ * @return TPS (5s, 15s, 1m, 5m, 15m), or null if the region doesn't exist
|
||||
+ */
|
||||
+ @Override
|
||||
+ public double[] getRegionTPS(World world, int chunkX, int chunkZ) {
|
||||
+ Preconditions.checkArgument(world != null, "World cannot be null");
|
||||
+
|
||||
+ return getTPSFromRegion(((CraftWorld)world).getHandle(), chunkX, chunkZ);
|
||||
+ }
|
||||
+
|
||||
+ private static double[] getTPSFromRegion(ServerLevel world, int chunkX, int chunkZ) {
|
||||
+ io.papermc.paper.threadedregions.ThreadedRegionizer.ThreadedRegion<io.papermc.paper.threadedregions.TickRegions.TickRegionData, io.papermc.paper.threadedregions.TickRegions.TickRegionSectionData>
|
||||
+ region = world.regioniser.getRegionAtSynchronised(chunkX, chunkZ);
|
||||
+ if (region == null) {
|
||||
+ return null;
|
||||
+ } else {
|
||||
+ io.papermc.paper.threadedregions.TickRegions.TickRegionData regionData = region.getData();
|
||||
+ final long currTime = System.nanoTime();
|
||||
+ final io.papermc.paper.threadedregions.TickRegionScheduler.RegionScheduleHandle regionScheduleHandle = regionData.getRegionSchedulingHandle();
|
||||
+ return new double[] {
|
||||
+ regionScheduleHandle.getTickReport5s(currTime).tpsData().segmentAll().average(),
|
||||
+ regionScheduleHandle.getTickReport15s(currTime).tpsData().segmentAll().average(),
|
||||
+ regionScheduleHandle.getTickReport1m(currTime).tpsData().segmentAll().average(),
|
||||
+ regionScheduleHandle.getTickReport5m(currTime).tpsData().segmentAll().average(),
|
||||
+ regionScheduleHandle.getTickReport15m(currTime).tpsData().segmentAll().average(),
|
||||
+ };
|
||||
+ }
|
||||
+ }
|
||||
+ // Folia end - region TPS API
|
||||
}
|
@ -12,7 +12,35 @@
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.level.ChunkPos;
|
||||
@@ -119,50 +_,157 @@
|
||||
@@ -15,8 +_,26 @@
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(TickThread.class);
|
||||
|
||||
+ private static String getRegionInfo(final ThreadedRegionizer.ThreadedRegion<TickRegions.TickRegionData, TickRegions.TickRegionSectionData> region) {
|
||||
+ if (region == null) {
|
||||
+ return "{null}";
|
||||
+ }
|
||||
+
|
||||
+ final ChunkPos center = region.getCenterChunk();
|
||||
+ final net.minecraft.server.level.ServerLevel world = region.regioniser.world;
|
||||
+
|
||||
+ return "{center=" + center + ",world=" + (world == null ? "null" : WorldUtil.getWorldName(world)) + "}";
|
||||
+ }
|
||||
+
|
||||
private static String getThreadContext() {
|
||||
- return "thread=" + Thread.currentThread().getName();
|
||||
+ final Thread thread = Thread.currentThread();
|
||||
+
|
||||
+ if (!(thread instanceof TickThread)) {
|
||||
+ return "[thread=" + thread + ",class=" + thread.getClass().getName() + "]";
|
||||
+ }
|
||||
+
|
||||
+ return "[thread=" + thread.getName() + ",class=" + thread.getClass().getName() + ",region=" + getRegionInfo(TickRegionScheduler.getCurrentRegion()) + "]";
|
||||
+
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -123,50 +_,157 @@
|
||||
}
|
||||
|
||||
public static boolean isShutdownThread() {
|
||||
|
@ -1,9 +1,10 @@
|
||||
--- a/src/main/java/io/papermc/paper/command/PaperCommands.java
|
||||
+++ b/src/main/java/io/papermc/paper/command/PaperCommands.java
|
||||
@@ -19,6 +_,7 @@
|
||||
@@ -18,7 +_,7 @@
|
||||
static {
|
||||
COMMANDS.put("paper", new PaperCommand("paper"));
|
||||
COMMANDS.put("callback", new CallbackCommand("callback"));
|
||||
COMMANDS.put("mspt", new MSPTCommand("mspt"));
|
||||
- COMMANDS.put("mspt", new MSPTCommand("mspt"));
|
||||
+ COMMANDS.put("tps", new io.papermc.paper.threadedregions.commands.CommandServerHealth()); // Folia - region threading
|
||||
}
|
||||
|
||||
|
@ -91,6 +91,37 @@
|
||||
//Preconditions.checkState(!this.console.isIteratingOverLevels, "Cannot unload a world while worlds are being ticked"); // Paper - Cat - Temp disable. We'll see how this goes.
|
||||
if (world == null) {
|
||||
return false;
|
||||
@@ -3083,11 +_,27 @@
|
||||
|
||||
@Override
|
||||
public double[] getTPS() {
|
||||
+ // Folia start - region threading
|
||||
+ ca.spottedleaf.concurrentutil.scheduler.SchedulerThreadPool.SchedulableTick task = io.papermc.paper.threadedregions.TickRegionScheduler.getCurrentTickingTask();
|
||||
+ if (task == null) {
|
||||
+ // might be on the shutdown thread, try retrieving the current region
|
||||
+ if (io.papermc.paper.threadedregions.TickRegionScheduler.getCurrentRegion() != null) {
|
||||
+ // we are on the shutdown thread
|
||||
+ task = io.papermc.paper.threadedregions.TickRegionScheduler.getCurrentRegion().getData().getRegionSchedulingHandle();
|
||||
+ }
|
||||
+ }
|
||||
+ if (!(task instanceof io.papermc.paper.threadedregions.TickRegionScheduler.RegionScheduleHandle tickHandle)) {
|
||||
+ throw new UnsupportedOperationException("Not on any region");
|
||||
+ }
|
||||
+
|
||||
+ // 1m, 5m, 15m
|
||||
+ long currTime = System.nanoTime();
|
||||
return new double[] {
|
||||
- net.minecraft.server.MinecraftServer.getServer().tps1.getAverage(),
|
||||
- net.minecraft.server.MinecraftServer.getServer().tps5.getAverage(),
|
||||
- net.minecraft.server.MinecraftServer.getServer().tps15.getAverage()
|
||||
+ tickHandle.getTickReport1m(currTime).tpsData().segmentAll().average(),
|
||||
+ tickHandle.getTickReport5m(currTime).tpsData().segmentAll().average(),
|
||||
+ tickHandle.getTickReport15m(currTime).tpsData().segmentAll().average(),
|
||||
};
|
||||
+ // Folia end - region threading
|
||||
}
|
||||
|
||||
// Paper start - adventure sounds
|
||||
@@ -3258,7 +_,7 @@
|
||||
|
||||
@Override
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
@@ -230,7 +_,7 @@
|
||||
@@ -233,7 +_,7 @@
|
||||
|
||||
@Override
|
||||
public int getTickableTileEntityCount() {
|
||||
@ -9,7 +9,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -297,7 +_,7 @@
|
||||
@@ -300,7 +_,7 @@
|
||||
// Paper start - per world spawn limits
|
||||
for (SpawnCategory spawnCategory : SpawnCategory.values()) {
|
||||
if (CraftSpawnCategory.isValidForLimits(spawnCategory)) {
|
||||
@ -18,7 +18,7 @@
|
||||
}
|
||||
}
|
||||
// Paper end - per world spawn limits
|
||||
@@ -367,6 +_,7 @@
|
||||
@@ -371,6 +_,7 @@
|
||||
|
||||
@Override
|
||||
public Chunk getChunkAt(int x, int z) {
|
||||
@ -26,7 +26,7 @@
|
||||
warnUnsafeChunk("getting a faraway chunk", x, z); // Paper
|
||||
net.minecraft.world.level.chunk.LevelChunk chunk = (net.minecraft.world.level.chunk.LevelChunk) this.world.getChunk(x, z, ChunkStatus.FULL, true);
|
||||
return new CraftChunk(chunk);
|
||||
@@ -397,10 +_,10 @@
|
||||
@@ -401,10 +_,10 @@
|
||||
@Override
|
||||
public boolean isChunkGenerated(int x, int z) {
|
||||
// Paper start - Fix this method
|
||||
@ -39,7 +39,7 @@
|
||||
}
|
||||
ChunkAccess chunk = world.getChunkSource().getChunkAtImmediately(x, z);
|
||||
if (chunk != null) {
|
||||
@@ -457,7 +_,7 @@
|
||||
@@ -461,7 +_,7 @@
|
||||
}
|
||||
|
||||
private boolean unloadChunk0(int x, int z, boolean save) {
|
||||
@ -48,7 +48,7 @@
|
||||
if (!this.isChunkLoaded(x, z)) {
|
||||
return true;
|
||||
}
|
||||
@@ -474,7 +_,7 @@
|
||||
@@ -478,7 +_,7 @@
|
||||
|
||||
@Override
|
||||
public boolean regenerateChunk(int x, int z) {
|
||||
@ -57,7 +57,7 @@
|
||||
throw new UnsupportedOperationException("Not supported in this Minecraft version! Unless you can fix it, this is not a bug :)");
|
||||
/*
|
||||
if (!unloadChunk0(x, z, false)) {
|
||||
@@ -501,6 +_,7 @@
|
||||
@@ -505,6 +_,7 @@
|
||||
|
||||
@Override
|
||||
public boolean refreshChunk(int x, int z) {
|
||||
@ -65,7 +65,7 @@
|
||||
ChunkHolder playerChunk = this.world.getChunkSource().chunkMap.getVisibleChunkIfPresent(ChunkPos.asLong(x, z));
|
||||
if (playerChunk == null) return false;
|
||||
|
||||
@@ -551,7 +_,7 @@
|
||||
@@ -555,7 +_,7 @@
|
||||
|
||||
@Override
|
||||
public boolean loadChunk(int x, int z, boolean generate) {
|
||||
@ -74,7 +74,7 @@
|
||||
warnUnsafeChunk("loading a faraway chunk", x, z); // Paper
|
||||
ChunkAccess chunk = this.world.getChunkSource().getChunk(x, z, generate || isChunkGenerated(x, z) ? ChunkStatus.FULL : ChunkStatus.EMPTY, true); // Paper
|
||||
|
||||
@@ -591,7 +_,7 @@
|
||||
@@ -595,7 +_,7 @@
|
||||
|
||||
final DistanceManager distanceManager = this.world.getChunkSource().chunkMap.distanceManager;
|
||||
if (distanceManager.addPluginRegionTicket(new ChunkPos(x, z), plugin)) {
|
||||
@ -83,7 +83,33 @@
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -779,13 +_,15 @@
|
||||
@@ -649,21 +_,24 @@
|
||||
|
||||
@Override
|
||||
public boolean isChunkForceLoaded(int x, int z) {
|
||||
+ io.papermc.paper.threadedregions.RegionizedServer.ensureGlobalTickThread("Cannot read force-loaded chunk off global region"); // Folia - region threading
|
||||
return this.getHandle().getForcedChunks().contains(ChunkPos.asLong(x, z));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setChunkForceLoaded(int x, int z, boolean forced) {
|
||||
+ io.papermc.paper.threadedregions.RegionizedServer.ensureGlobalTickThread("Cannot modify force-loaded chunks off global region"); // Folia - region threading
|
||||
warnUnsafeChunk("forceloading a faraway chunk", x, z); // Paper
|
||||
this.getHandle().setChunkForced(x, z, forced);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<Chunk> getForceLoadedChunks() {
|
||||
+ io.papermc.paper.threadedregions.RegionizedServer.ensureGlobalTickThread("Cannot read force-loaded chunks off global region"); // Folia - region threading
|
||||
Set<Chunk> chunks = new HashSet<>();
|
||||
|
||||
for (long coord : this.getHandle().getForcedChunks()) {
|
||||
- chunks.add(this.getChunkAt(ChunkPos.getX(coord), ChunkPos.getZ(coord)));
|
||||
+ chunks.add(new org.bukkit.craftbukkit.CraftChunk(this.world, ChunkPos.getX(coord), ChunkPos.getZ(coord))); // Folia - region threading
|
||||
}
|
||||
|
||||
return Collections.unmodifiableCollection(chunks);
|
||||
@@ -783,13 +_,15 @@
|
||||
|
||||
@Override
|
||||
public boolean generateTree(Location loc, TreeType type, BlockChangeDelegate delegate) {
|
||||
@ -104,7 +130,7 @@
|
||||
BlockPos position = ((CraftBlockState) blockstate).getPosition();
|
||||
net.minecraft.world.level.block.state.BlockState oldBlock = this.world.getBlockState(position);
|
||||
int flag = ((CraftBlockState) blockstate).getFlag();
|
||||
@@ -793,10 +_,10 @@
|
||||
@@ -797,10 +_,10 @@
|
||||
net.minecraft.world.level.block.state.BlockState newBlock = this.world.getBlockState(position);
|
||||
this.world.notifyAndUpdatePhysics(position, null, oldBlock, newBlock, newBlock, flag, 512);
|
||||
}
|
||||
@ -117,7 +143,7 @@
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -830,6 +_,7 @@
|
||||
@@ -834,6 +_,7 @@
|
||||
|
||||
@Override
|
||||
public void setTime(long time) {
|
||||
@ -125,7 +151,7 @@
|
||||
long margin = (time - this.getFullTime()) % 24000;
|
||||
if (margin < 0) margin += 24000;
|
||||
this.setFullTime(this.getFullTime() + margin);
|
||||
@@ -842,6 +_,7 @@
|
||||
@@ -846,6 +_,7 @@
|
||||
|
||||
@Override
|
||||
public void setFullTime(long time) {
|
||||
@ -133,7 +159,7 @@
|
||||
// Notify anyone who's listening
|
||||
TimeSkipEvent event = new TimeSkipEvent(this, TimeSkipEvent.SkipReason.CUSTOM, time - this.world.getDayTime());
|
||||
this.server.getPluginManager().callEvent(event);
|
||||
@@ -869,7 +_,7 @@
|
||||
@@ -873,7 +_,7 @@
|
||||
|
||||
@Override
|
||||
public long getGameTime() {
|
||||
@ -142,7 +168,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -894,6 +_,7 @@
|
||||
@@ -898,6 +_,7 @@
|
||||
}
|
||||
public boolean createExplosion(double x, double y, double z, float power, boolean setFire, boolean breakBlocks, Entity source, Consumer<net.minecraft.world.level.ServerExplosion> configurator) {
|
||||
// Paper end - expand explosion API
|
||||
@ -150,7 +176,7 @@
|
||||
net.minecraft.world.level.Level.ExplosionInteraction explosionType;
|
||||
if (!breakBlocks) {
|
||||
explosionType = net.minecraft.world.level.Level.ExplosionInteraction.NONE; // Don't break blocks
|
||||
@@ -903,6 +_,7 @@
|
||||
@@ -907,6 +_,7 @@
|
||||
explosionType = net.minecraft.world.level.Level.ExplosionInteraction.MOB; // Respect mobGriefing gamerule
|
||||
}
|
||||
|
||||
@ -158,7 +184,7 @@
|
||||
net.minecraft.world.entity.Entity entity = (source == null) ? null : ((CraftEntity) source).getHandle();
|
||||
return !this.world.explode0(entity, Explosion.getDefaultDamageSource(this.world, entity), null, x, y, z, power, setFire, explosionType, ParticleTypes.EXPLOSION, ParticleTypes.EXPLOSION_EMITTER, SoundEvents.GENERIC_EXPLODE, configurator).wasCanceled; // Paper - expand explosion API
|
||||
}
|
||||
@@ -985,6 +_,7 @@
|
||||
@@ -989,6 +_,7 @@
|
||||
|
||||
@Override
|
||||
public int getHighestBlockYAt(int x, int z, org.bukkit.HeightMap heightMap) {
|
||||
@ -166,7 +192,7 @@
|
||||
warnUnsafeChunk("getting a faraway chunk", x >> 4, z >> 4); // Paper
|
||||
// Transient load for this tick
|
||||
return this.world.getChunk(x >> 4, z >> 4).getHeight(CraftHeightMap.toNMS(heightMap), x, z);
|
||||
@@ -1015,6 +_,7 @@
|
||||
@@ -1019,6 +_,7 @@
|
||||
@Override
|
||||
public void setBiome(int x, int y, int z, Holder<net.minecraft.world.level.biome.Biome> bb) {
|
||||
BlockPos pos = new BlockPos(x, 0, z);
|
||||
@ -174,7 +200,7 @@
|
||||
if (this.world.hasChunkAt(pos)) {
|
||||
net.minecraft.world.level.chunk.LevelChunk chunk = this.world.getChunkAt(pos);
|
||||
|
||||
@@ -1325,6 +_,7 @@
|
||||
@@ -1349,6 +_,7 @@
|
||||
|
||||
@Override
|
||||
public void setStorm(boolean hasStorm) {
|
||||
@ -182,7 +208,7 @@
|
||||
this.world.serverLevelData.setRaining(hasStorm, org.bukkit.event.weather.WeatherChangeEvent.Cause.PLUGIN); // Paper - Add cause to Weather/ThunderChangeEvents
|
||||
this.setWeatherDuration(0); // Reset weather duration (legacy behaviour)
|
||||
this.setClearWeatherDuration(0); // Reset clear weather duration (reset "/weather clear" commands)
|
||||
@@ -1337,6 +_,7 @@
|
||||
@@ -1361,6 +_,7 @@
|
||||
|
||||
@Override
|
||||
public void setWeatherDuration(int duration) {
|
||||
@ -190,7 +216,7 @@
|
||||
this.world.serverLevelData.setRainTime(duration);
|
||||
}
|
||||
|
||||
@@ -1347,6 +_,7 @@
|
||||
@@ -1371,6 +_,7 @@
|
||||
|
||||
@Override
|
||||
public void setThundering(boolean thundering) {
|
||||
@ -198,7 +224,7 @@
|
||||
this.world.serverLevelData.setThundering(thundering, org.bukkit.event.weather.ThunderChangeEvent.Cause.PLUGIN); // Paper - Add cause to Weather/ThunderChangeEvents
|
||||
this.setThunderDuration(0); // Reset weather duration (legacy behaviour)
|
||||
this.setClearWeatherDuration(0); // Reset clear weather duration (reset "/weather clear" commands)
|
||||
@@ -1359,6 +_,7 @@
|
||||
@@ -1383,6 +_,7 @@
|
||||
|
||||
@Override
|
||||
public void setThunderDuration(int duration) {
|
||||
@ -206,7 +232,7 @@
|
||||
this.world.serverLevelData.setThunderTime(duration);
|
||||
}
|
||||
|
||||
@@ -1369,6 +_,7 @@
|
||||
@@ -1393,6 +_,7 @@
|
||||
|
||||
@Override
|
||||
public void setClearWeatherDuration(int duration) {
|
||||
@ -214,7 +240,7 @@
|
||||
this.world.serverLevelData.setClearWeatherTime(duration);
|
||||
}
|
||||
|
||||
@@ -1567,6 +_,7 @@
|
||||
@@ -1591,6 +_,7 @@
|
||||
|
||||
@Override
|
||||
public void setKeepSpawnInMemory(boolean keepLoaded) {
|
||||
@ -222,7 +248,7 @@
|
||||
if (keepLoaded) {
|
||||
this.setGameRule(GameRule.SPAWN_CHUNK_RADIUS, this.getGameRuleDefault(GameRule.SPAWN_CHUNK_RADIUS));
|
||||
} else {
|
||||
@@ -1635,6 +_,7 @@
|
||||
@@ -1659,6 +_,7 @@
|
||||
|
||||
@Override
|
||||
public void setHardcore(boolean hardcore) {
|
||||
@ -230,7 +256,7 @@
|
||||
this.world.serverLevelData.settings.hardcore = hardcore;
|
||||
}
|
||||
|
||||
@@ -1647,6 +_,7 @@
|
||||
@@ -1671,6 +_,7 @@
|
||||
@Override
|
||||
@Deprecated
|
||||
public void setTicksPerAnimalSpawns(int ticksPerAnimalSpawns) {
|
||||
@ -238,7 +264,7 @@
|
||||
this.setTicksPerSpawns(SpawnCategory.ANIMAL, ticksPerAnimalSpawns);
|
||||
}
|
||||
|
||||
@@ -1659,6 +_,7 @@
|
||||
@@ -1683,6 +_,7 @@
|
||||
@Override
|
||||
@Deprecated
|
||||
public void setTicksPerMonsterSpawns(int ticksPerMonsterSpawns) {
|
||||
@ -246,7 +272,7 @@
|
||||
this.setTicksPerSpawns(SpawnCategory.MONSTER, ticksPerMonsterSpawns);
|
||||
}
|
||||
|
||||
@@ -1671,6 +_,7 @@
|
||||
@@ -1695,6 +_,7 @@
|
||||
@Override
|
||||
@Deprecated
|
||||
public void setTicksPerWaterSpawns(int ticksPerWaterSpawns) {
|
||||
@ -254,7 +280,7 @@
|
||||
this.setTicksPerSpawns(SpawnCategory.WATER_ANIMAL, ticksPerWaterSpawns);
|
||||
}
|
||||
|
||||
@@ -1683,6 +_,7 @@
|
||||
@@ -1707,6 +_,7 @@
|
||||
@Override
|
||||
@Deprecated
|
||||
public void setTicksPerWaterAmbientSpawns(int ticksPerWaterAmbientSpawns) {
|
||||
@ -262,7 +288,7 @@
|
||||
this.setTicksPerSpawns(SpawnCategory.WATER_AMBIENT, ticksPerWaterAmbientSpawns);
|
||||
}
|
||||
|
||||
@@ -1695,6 +_,7 @@
|
||||
@@ -1719,6 +_,7 @@
|
||||
@Override
|
||||
@Deprecated
|
||||
public void setTicksPerWaterUndergroundCreatureSpawns(int ticksPerWaterUndergroundCreatureSpawns) {
|
||||
@ -270,7 +296,7 @@
|
||||
this.setTicksPerSpawns(SpawnCategory.WATER_UNDERGROUND_CREATURE, ticksPerWaterUndergroundCreatureSpawns);
|
||||
}
|
||||
|
||||
@@ -1707,11 +_,13 @@
|
||||
@@ -1731,11 +_,13 @@
|
||||
@Override
|
||||
@Deprecated
|
||||
public void setTicksPerAmbientSpawns(int ticksPerAmbientSpawns) {
|
||||
@ -284,7 +310,7 @@
|
||||
Preconditions.checkArgument(spawnCategory != null, "SpawnCategory cannot be null");
|
||||
Preconditions.checkArgument(CraftSpawnCategory.isValidForLimits(spawnCategory), "SpawnCategory.%s are not supported", spawnCategory);
|
||||
|
||||
@@ -1728,21 +_,25 @@
|
||||
@@ -1752,21 +_,25 @@
|
||||
|
||||
@Override
|
||||
public void setMetadata(String metadataKey, MetadataValue newMetadataValue) {
|
||||
@ -310,7 +336,7 @@
|
||||
this.server.getWorldMetadata().removeMetadata(this, metadataKey, owningPlugin);
|
||||
}
|
||||
|
||||
@@ -1755,6 +_,7 @@
|
||||
@@ -1779,6 +_,7 @@
|
||||
@Override
|
||||
@Deprecated
|
||||
public void setMonsterSpawnLimit(int limit) {
|
||||
@ -318,7 +344,7 @@
|
||||
this.setSpawnLimit(SpawnCategory.MONSTER, limit);
|
||||
}
|
||||
|
||||
@@ -1767,6 +_,7 @@
|
||||
@@ -1791,6 +_,7 @@
|
||||
@Override
|
||||
@Deprecated
|
||||
public void setAnimalSpawnLimit(int limit) {
|
||||
@ -326,7 +352,7 @@
|
||||
this.setSpawnLimit(SpawnCategory.ANIMAL, limit);
|
||||
}
|
||||
|
||||
@@ -1779,6 +_,7 @@
|
||||
@@ -1803,6 +_,7 @@
|
||||
@Override
|
||||
@Deprecated
|
||||
public void setWaterAnimalSpawnLimit(int limit) {
|
||||
@ -334,7 +360,7 @@
|
||||
this.setSpawnLimit(SpawnCategory.WATER_ANIMAL, limit);
|
||||
}
|
||||
|
||||
@@ -1791,6 +_,7 @@
|
||||
@@ -1815,6 +_,7 @@
|
||||
@Override
|
||||
@Deprecated
|
||||
public void setWaterAmbientSpawnLimit(int limit) {
|
||||
@ -342,7 +368,7 @@
|
||||
this.setSpawnLimit(SpawnCategory.WATER_AMBIENT, limit);
|
||||
}
|
||||
|
||||
@@ -1803,6 +_,7 @@
|
||||
@@ -1827,6 +_,7 @@
|
||||
@Override
|
||||
@Deprecated
|
||||
public void setWaterUndergroundCreatureSpawnLimit(int limit) {
|
||||
@ -350,7 +376,7 @@
|
||||
this.setSpawnLimit(SpawnCategory.WATER_UNDERGROUND_CREATURE, limit);
|
||||
}
|
||||
|
||||
@@ -1815,6 +_,7 @@
|
||||
@@ -1839,6 +_,7 @@
|
||||
@Override
|
||||
@Deprecated
|
||||
public void setAmbientSpawnLimit(int limit) {
|
||||
@ -358,7 +384,7 @@
|
||||
this.setSpawnLimit(SpawnCategory.AMBIENT, limit);
|
||||
}
|
||||
|
||||
@@ -1837,6 +_,7 @@
|
||||
@@ -1861,6 +_,7 @@
|
||||
|
||||
@Override
|
||||
public void setSpawnLimit(SpawnCategory spawnCategory, int limit) {
|
||||
@ -366,7 +392,7 @@
|
||||
Preconditions.checkArgument(spawnCategory != null, "SpawnCategory cannot be null");
|
||||
Preconditions.checkArgument(CraftSpawnCategory.isValidForLimits(spawnCategory), "SpawnCategory.%s are not supported", spawnCategory);
|
||||
|
||||
@@ -1919,7 +_,7 @@
|
||||
@@ -1943,7 +_,7 @@
|
||||
if (!(entity instanceof CraftEntity craftEntity) || entity.getWorld() != this || sound == null || category == null) return;
|
||||
|
||||
ClientboundSoundEntityPacket packet = new ClientboundSoundEntityPacket(CraftSound.bukkitToMinecraftHolder(sound), net.minecraft.sounds.SoundSource.valueOf(category.name()), craftEntity.getHandle(), volume, pitch, seed);
|
||||
@ -375,7 +401,7 @@
|
||||
if (entityTracker != null) {
|
||||
entityTracker.broadcastAndSend(packet);
|
||||
}
|
||||
@@ -1940,7 +_,7 @@
|
||||
@@ -1964,7 +_,7 @@
|
||||
if (!(entity instanceof CraftEntity craftEntity) || entity.getWorld() != this || sound == null || category == null) return;
|
||||
|
||||
ClientboundSoundEntityPacket packet = new ClientboundSoundEntityPacket(Holder.direct(SoundEvent.createVariableRangeEvent(ResourceLocation.parse(sound))), net.minecraft.sounds.SoundSource.valueOf(category.name()), craftEntity.getHandle(), volume, pitch, seed);
|
||||
@ -384,7 +410,7 @@
|
||||
if (entityTracker != null) {
|
||||
entityTracker.broadcastAndSend(packet);
|
||||
}
|
||||
@@ -2023,6 +_,7 @@
|
||||
@@ -2047,6 +_,7 @@
|
||||
|
||||
@Override
|
||||
public boolean setGameRuleValue(String rule, String value) {
|
||||
@ -392,7 +418,7 @@
|
||||
// No null values allowed
|
||||
if (rule == null || value == null) return false;
|
||||
|
||||
@@ -2065,6 +_,7 @@
|
||||
@@ -2089,6 +_,7 @@
|
||||
|
||||
@Override
|
||||
public <T> boolean setGameRule(GameRule<T> rule, T newValue) {
|
||||
@ -400,7 +426,7 @@
|
||||
Preconditions.checkArgument(rule != null, "GameRule cannot be null");
|
||||
Preconditions.checkArgument(newValue != null, "GameRule value cannot be null");
|
||||
|
||||
@@ -2292,6 +_,12 @@
|
||||
@@ -2316,6 +_,12 @@
|
||||
|
||||
@Override
|
||||
public void sendGameEvent(Entity sourceEntity, org.bukkit.GameEvent gameEvent, Vector position) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -667,7 +_,7 @@
|
||||
@@ -672,7 +_,7 @@
|
||||
|
||||
@Override
|
||||
public void kickPlayer(String message) {
|
||||
@ -9,7 +9,7 @@
|
||||
this.getHandle().transferCookieConnection.kickPlayer(CraftChatMessage.fromStringOrEmpty(message, true), org.bukkit.event.player.PlayerKickEvent.Cause.PLUGIN); // Paper - kick event cause
|
||||
}
|
||||
|
||||
@@ -685,7 +_,7 @@
|
||||
@@ -690,7 +_,7 @@
|
||||
|
||||
@Override
|
||||
public void kick(net.kyori.adventure.text.Component message, org.bukkit.event.player.PlayerKickEvent.Cause cause) {
|
||||
@ -18,7 +18,7 @@
|
||||
final ServerGamePacketListenerImpl connection = this.getHandle().connection;
|
||||
if (connection != null) {
|
||||
connection.disconnect(message == null ? net.kyori.adventure.text.Component.empty() : message, cause);
|
||||
@@ -1405,6 +_,11 @@
|
||||
@@ -1410,6 +_,11 @@
|
||||
|
||||
@Override
|
||||
public boolean teleport(Location location, org.bukkit.event.player.PlayerTeleportEvent.TeleportCause cause, io.papermc.paper.entity.TeleportFlag... flags) {
|
||||
@ -30,7 +30,7 @@
|
||||
Set<io.papermc.paper.entity.TeleportFlag.Relative> relativeArguments;
|
||||
Set<io.papermc.paper.entity.TeleportFlag> allFlags;
|
||||
if (flags.length == 0) {
|
||||
@@ -2069,7 +_,7 @@
|
||||
@@ -2074,7 +_,7 @@
|
||||
private void unregisterEntity(Entity other) {
|
||||
// Paper end
|
||||
ChunkMap tracker = ((ServerLevel) this.getHandle().level()).getChunkSource().chunkMap;
|
||||
@ -39,7 +39,7 @@
|
||||
if (entry != null) {
|
||||
entry.removePlayer(this.getHandle());
|
||||
}
|
||||
@@ -2166,7 +_,7 @@
|
||||
@@ -2171,7 +_,7 @@
|
||||
if (original != null) otherPlayer.setUUID(original); // Paper - uuid override
|
||||
}
|
||||
|
||||
@ -48,7 +48,7 @@
|
||||
if (entry != null && !entry.seenBy.contains(this.getHandle().connection)) {
|
||||
entry.updatePlayer(this.getHandle());
|
||||
}
|
||||
@@ -2315,9 +_,16 @@
|
||||
@@ -2320,9 +_,16 @@
|
||||
return this;
|
||||
}
|
||||
|
||||
@ -66,7 +66,7 @@
|
||||
}
|
||||
|
||||
public void setHandle(final ServerPlayer entity) {
|
||||
@@ -3349,7 +_,7 @@
|
||||
@@ -3354,7 +_,7 @@
|
||||
{
|
||||
if ( CraftPlayer.this.getHealth() <= 0 && CraftPlayer.this.isOnline() )
|
||||
{
|
||||
|
@ -2,7 +2,7 @@ group=dev.folia
|
||||
version=1.21.4-R0.1-SNAPSHOT
|
||||
mcVersion=1.21.4
|
||||
|
||||
paperRef=336ea9dfeb23d9eae0711db974a3465dfe72746f
|
||||
paperRef=54b2e9d9738ce32e2f415c321f20e3fc07063c14
|
||||
|
||||
org.gradle.configuration-cache=true
|
||||
org.gradle.caching=true
|
||||
|
Loading…
x
Reference in New Issue
Block a user