Commit Graph

1326 Commits

Author SHA1 Message Date
Spottedleaf
04f95191f1 Fix spawners converted from 1.21.4 not running finalisation logic
DataConverter incorrectly placed a fall_distance value with 0.0
if the entity did not have a FallDistance entry. This results in the
entity spawn data having 2 entries, which prevents finalisation
logic from running.

We can fix this by removing the fall_distance entry if it is 0.0.

In 1.21.8 there will be a proper fix for this and the patch can be
dropped.
2025-07-16 10:33:06 -07:00
Spottedleaf
21fb54246e Do not write fall_distance tag unless it already existed before
It looks like BaseSpawner will not run natural spawn finalization
unless the entire data tag only contains the ID.

This only fixes converting old data, we need a fix for already
converted data.
2025-07-15 17:09:06 -07:00
Shane Freeder
94d60e15b3 Copy thrown pearls list for removal (#12840) 2025-07-14 23:04:02 +02:00
Brokkonaut
d9b5003fa1 Dried Ghast events and Happy Ghast spawn reason (#12788) 2025-07-14 17:56:44 +02:00
Jake Potrebic
533d93c758 Don't consume anchor charge if loc changes (#12835) 2025-07-12 19:03:48 +00:00
Nassim Jahnke
cb47e01823 Remove more dead code, fix pre-existing desync when cancelling and closing container 2025-07-11 22:24:20 +02:00
Nassim Jahnke
a939945148 Fixup sendAllDataToRemote calls
Reduces unnecessary item copies by a lot
2025-07-11 17:43:05 +02:00
Jake Potrebic
b4466ec981 Dialog API (#12671) 2025-07-06 20:49:43 +02:00
Jason Penilla
6e598f8527 Fix incorrect createPath overload arguments, fixes #12043 (#12794)
Co-authored-by: Lulu13022002 <41980282+Lulu13022002@users.noreply.github.com>
Co-authored-by: Shane Freeder <theboyetronic@gmail.com>
2025-07-03 12:40:19 -07:00
Owen
0cadaefc09 Fix quitmessage nullability issues (#12783) 2025-07-01 18:44:17 -04:00
Nassim Jahnke
3fec37a9c1 Move the double call into the dispatch method
At some point later,
2025-07-01 21:44:24 +02:00
Nassim Jahnke
c3be00f0ec Always call plugin message dispatch on PlayerConnection 2025-07-01 21:09:44 +02:00
Owen
6ea679eb07 Allow listening to plugin messages during configuration phase (#12775) 2025-07-01 15:40:50 +02:00
Spottedleaf
4c47c76ecf Update DataConverter constants for 1.21.7
04b08a102a
2025-06-30 08:28:39 -07:00
Owen1212055
a9f74cbf6e Readd dropped diff during 1.21.6 2025-06-30 11:49:21 +02:00
Owen
7f60924390 Configuration API (#12301)
This implements a solution that preemptively exits the tick loop if we have already marked the connection as disconnecting. This avoids changing the result of Connection#isConnected in order to avoid other possibly unintentional changes. Fundamentally it should be investigated if closing the connection async is really still needed.

This also additionally removes the login disconnecting logic for server stopping, as this was also a possible issue in the config stage but also shouldn't be an issue as connections are closed on server stop very early.

Additionally, do not check for isConnecting() on VERIFYING, as that seemed to be an old diff originally trying to resolve this code, however isConnected is not updated at this point so it pretty much was useless.
2025-06-30 11:49:15 +02:00
Bjarne Koll
dda39a0f05 1.21.7-rc2 2025-06-30 11:49:13 +02:00
Nassim Jahnke
4d854e66b8 Disable MC-163962 fix by default
It changes restocking behavior pretty drastically compared to Vanilla, keep it as a config option for those that want it

Fixes #12761
2025-06-30 11:39:07 +02:00
Shane Freeder
35b2c6ece4 Use dropped item for stats info (#12747)
We are already using the dropped stack to determine the type, we
might as well also use it for the count, given that plugins can already
mutate the type, might as well let them mess with the amount.
2025-06-26 19:44:29 +01:00
Nassim Jahnke
e382e6872c Fix 0 yield on explosion events
Fixes #12745

That cooked is mildly cooked and should be fixed differently, e.g. a custom loot context param, but reverting the recent change in this line works for now
2025-06-26 16:58:05 +02:00
Nassim Jahnke
4e1a2555be Update try catch for command handling
Fixes #12729
2025-06-25 22:42:38 +02:00
Lulu13022002
c9e89f49b0 Expose arrow velocity in EntityShootBowEvent for mobs (#12688) 2025-06-25 22:11:18 +02:00
Pedro
aa6cd74c03 Remove unnecesary item check for ServerboundPlayerActionPacket RELEASE_USE_ITEM (#12668) 2025-06-25 22:09:11 +02:00
Owen
ea10fa4a79 Don't mutate the position of Items for MC-4 Fix (#12702) 2025-06-25 21:51:26 +02:00
Spottedleaf
692e93a91f Fix MC-299110
When converting entity/poi data (SimpleRegionStorage),
we need to insert the new data version so that force upgrading
will write the data back with the correct version.
2025-06-25 12:25:45 -07:00
Kezz
bee287927c Adventure 4.23.0 (#12690) 2025-06-25 21:16:18 +02:00
Owen
0caf75f839 Fix #12721 (#12725)
* Fix #12721

Track when knots are created and only fire the event then

* Use mutable boolean + check if actually spawned
2025-06-25 14:16:03 -04:00
Spottedleaf
aa6ee44a7a Re-add global region scheduler tick erroneously removed in last commit 2025-06-24 08:14:29 -07:00
Spottedleaf
7c90c7c497 Optimise EntityScheduler ticking
The vast majority of the time, there are no tasks scheduled to
the EntityScheduler. We can avoid iterating the entire entity list
by tracking which schedulers have any tasks scheduled.
2025-06-24 07:19:33 -07:00
Spottedleaf
2f083acbed Ensure player entity schedulers are ticked when they are dead
If the player dies, then they are removed from the world and
as a result are not present in the world entity map.

To guarantee that the player entity scheduler is ticked, we can
tick all schedulers for players in the server player list, and
then skip all players we find in the world entity map.

This problem is not present on Folia since Folia must guarantee
that the player remains in the world.
2025-06-24 05:12:58 -07:00
Spottedleaf
38c1ddb52a Add and use FeatureHooks.getAllEntities
The ServerLevel#getAllEntities function only returns entities which
are accessible. FeatureHooks#getAllEntities will return all
entities, whether or not they are accessible.

Use the new hook in the EntityCommand, which allows server admins
to inspect entities in unloaded chunks.

Use the hook as well for ticking the EntityScheduler. This fixes
an issue whether unloaded entities did not have their scheduler ticked.
2025-06-24 04:55:58 -07:00
Spottedleaf
46b4b0b8d5 Improve keepalive ping system
Send more keepalives, record all transactions within the last minute.
We send more keepalives so that the latency calculation is more
accurate. Since we send more keepalives, we track all pending
keepalives in case multiple end up in flight.

Additionally, replace the latency calculation with a true
average over the last 5 seconds of keepalive transactions.
2025-06-24 04:23:08 -07:00
Spottedleaf
d0e808f44c Move player to correct position in vehicle move packet handler
We add the change to guarantee that the player position moves
in-sync with the vehicle's. As a result, it should be teleporting
the player using the new position of the vehicle rather than the
old.
2025-06-24 02:09:39 -07:00
Pedro
803baf0ba6 Support hidden entities in Waypoints (#12715) 2025-06-22 13:42:06 -04:00
Owen
5edcf6ddf6 Cleanup/command dispatching (#12713) 2025-06-21 21:44:07 -04:00
Strokkur24
186e9e331b Relocate CommandMap#registerServerAliases() call to after lifecycle events have been run (#12601) 2025-06-21 14:44:07 -04:00
CraftBukkit/Spigot
e714de6365 Fix excess slot updates
By: AJ Ferguson <fergusonjva@gmail.com>
2025-06-21 13:16:55 +02:00
Owen
71b0c76861 Adds support for vanilla negative explosions (#12705)
Fixes #10460
2025-06-21 00:54:53 -04:00
Spottedleaf
e4eb69b8a1 Do not allow ticket level decreases to be processed asynchronously
Note: This cannot happen on the Fabric/NeoForge versions since
async ticket level processing is not allowed, but can happen on
Paper. This change is made here so that Paper can
remain in sync.

Ticket level decreases may be handled asynchronously when the
off-thread invokes processTicketUpdates() when the main thread
is running ChunkHolderManager#tick(). This is because the ticket
update is queued during tick(), but not executed (invoking
processTicketUpdates) until after releasing the ticket lock.
This creates a small window for an off-thread to invoke
processTicketUpdates() and steal the update.

When the update is stolen, the full chunk status update (if any)
will be eventually queued to execute via the chunk task queue.
If the chunk queue is processed during the server tick at any
point other than the ChunkHolderManager tick, then any ticket
level decrease will violate an important invariant in the
Moonrise chunk system: ticket level decreases only occur during
ChunkHolderManager tick. This invariant exists to make interfacing
with the chunk system easier, especially working with off-thread
contexts.

This change is specifically made to work towards fixing
https://github.com/PaperMC/Folia/issues/363
2025-06-20 21:10:09 -07:00
Spottedleaf
219f86ee06 Implement chunk unload delay config option
Fixes https://github.com/PaperMC/Paper/issues/12056
2025-06-20 21:07:21 -07:00
Spottedleaf
c77d5f99f9 Fix MC-297591
Vanilla does not increment ticket timeouts if the chunk is
progressing in generation. They made this change in 1.21.6
so that the ender pearl ticket does not expire if the chunk
fails to generate before the timeout expires. Rather than
blindly adjusting the entire system behavior to fix this
small issue, we instead add non-expirable tickets to keep
ender pearls ticking.
2025-06-20 20:53:01 -07:00
Owen
839c6a1845 Fix #11169 (#12706)
This technically fixes the improperly updated patch, and also no longer checks canPickUpLoot.
2025-06-20 19:22:27 -04:00
Owen
6a51c44ec2 Cleanup Primed TNT Fix (#12704)
This option should probably be removed as its a descendant of an option that allows "old tnt cannon" behavior before ~1.9 But this improves the fix so properly update the velocity/position rather than the questionable way it was doing it before.
2025-06-20 18:22:37 -04:00
Owen
4b3f967e49 Improve Fix MC-44654 (#12703)
This more properly implement spigot's fix for teleportation area effect clouds, now however supporting many other entity types specified in this bug report.

Currently, this is not an issue for (all) hanging blocks since they have a fix identical to this inside of setPos. Note however the client does not nicely support moving these entities anyways.
2025-06-20 16:02:24 -04:00
Spottedleaf
8980ead7ea Directly walk text component after converting from JSON
It's important to convert the ItemStack present inside
the text component. The ItemStack nests TEXT_COMPONENT (written
book pages, custom name, ...) which would otherwise not be walked
since we have set a breakpoint at the version and moved the walker
to the next version step.

This fixes item names for hover events inside written book pages
failing to convert to NBT. This issue is also present on DFU.
2025-06-17 19:02:35 -07:00
Spottedleaf
e4d7178a3c Implement WaypointTransmitter#isChunkVisible
The Vanilla chunk tracker on Moonrise always returns false. We need
to redirect to Moonrise's chunk loader.

aef2b81d6e
2025-06-17 17:53:12 -07:00
Spottedleaf
1fcc4162d1 Implement FeatureHooks#isChunkSent for Moonrise chunk system
Need to use the player chunk loader, as that will contain the
sent chunks.
2025-06-17 17:47:50 -07:00
Spottedleaf
40d5d31c83 Fix recursively converting JSON Text Components
See 142ec80d28
2025-06-17 16:38:01 -07:00
Bjarne Koll
023e6c2953 Ensure waypoints are per world 2025-06-17 23:43:05 +02:00
Spottedleaf
8318dcb74b Update DataConverter to 1.21.6-rc1
b388a85809

The 1.21.6 update will include better handling of legacy
hover events.
2025-06-17 10:00:54 -07:00