Commit Graph

31 Commits

Author SHA1 Message Date
Spottedleaf
878da16a6b Fix non block ticking chunks not sending block/light updates
Needed to redirect the getTickingChunk call in
broadcastChangedChunks to use the chunk to send method.
2024-11-18 23:02:17 -08:00
Spottedleaf
37b9630f6a Do not create unneccessary callback in ChunkTaskScheduler#scheduleChunkLoad
If the parameter has addTicket = false and onComplete = null,
then the loadCallback would do no work and as a result does
not need to be created.
2024-11-18 23:02:17 -08:00
Spottedleaf
8c5b837e05 Rework async chunk api implementation
Firstly, the old methods all routed to the CompletableFuture method.
However, the CF method could not guarantee that if the caller
was off-main that the future would be "completed" on-main. Since
the callback methods used the CF one, this meant that the callback
methods did not guarantee that the callbacks were to be called on
the main thread.

Now, all methods route to getChunkAtAsync(x, z, gen, urgent, cb)
so that the methods with the callback are guaranteed to invoke
the callback on the main thread. The CF behavior remains unchanged;
it may still appear to complete on main if invoked off-main.

Secondly, remove the scheduleOnMain invocation in the async
chunk completion. This unnecessarily delays the callback
by 1 tick.

Thirdly, add getChunksAtAsync(minX, minZ, maxX, maxZ, ...) which
will load chunks within an area. This method is provided as a helper
as keeping all chunks loaded within an area can be complicated to
implement for plugins (due to the lacking ticket API), and is
already implemented internally anyways.

Fourthly, remove the ticket addition that occured with getChunkAt
and getChunkAtAsync. The ticket addition may delay the unloading
of the chunk unnecessarily. It also fixes a very rare timing bug
where the future/callback would be completed after the chunk
unloads.
2024-11-18 23:00:59 -08:00
Owen
de6173b061
Item DataComponent API (#10845)
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
Co-authored-by: Lulu13022002 <41980282+Lulu13022002@users.noreply.github.com>
Co-authored-by: Bjarne Koll <git@lynxplay.dev>
2024-11-18 15:09:44 -05:00
Nassim Jahnke
daf31133b5
Make logs less annoying 2024-11-18 13:06:15 +01:00
Spottedleaf
c60af44a94 Fix experimental minecart collisions on sloped rails
We are supposed to ignore some collisions on the sloped
rail.
2024-11-14 21:01:04 -08:00
Jason Penilla
661839e033
Fix and optimize getChunkCount (#11610)
It was returning ticking chunk count instead of the intended full chunk count.
We can also directly use the size of the fullChunks collection instead of iterating all chunks.
2024-11-11 12:17:36 -07:00
Nassim Jahnke
17dbf74ccf
Improve CraftEntity and CraftPlayer equals 2024-11-09 21:17:42 +01:00
Jason Penilla
00ef8bdcb0
Fix Entity#isTicking and update Paper entity command (#11590)
fixes #10299
2024-11-09 15:41:26 +01:00
Jake Potrebic
c6aa61ee18
Updated Upstream (Bukkit/CraftBukkit/Spigot) (#11561)
Updated Upstream (Bukkit/CraftBukkit/Spigot)

Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
b9df8e9f SPIGOT-7933: Improve custom Minecart max speed
fc496179 Fix InstrumentTest
7c0ec598 PR-1075: Make Art an interface
c389f5a4 PR-1074: Make Sound an interface

CraftBukkit Changes:
df1efc0bb SPIGOT-7945: `Bukkit#dispatchCommand` throws `UnsupportedOperationException`
285df6e85 SPIGOT-7933: Improve custom Minecart max speed
a0f3d4e50 SPIGOT-7940: Recipe book errors after reload
9e0618ec2 SPIGOT-7937: Cannot spawn minecart during world generation with minecart_improvements enabled
1eb4d28da SPIGOT-7941: Fix resistance over 4 amplify causing issues in damage
52b99158a PR-1504: Make Art an interface
e18ae35f1 PR-1502: Make Sound an interface

Spigot Changes:
e65d67a7 SPIGOT-7934: Item entities start "bouncing" under certain conditions
2024-11-04 18:42:38 +01:00
Spottedleaf
a6df4c8cdc Handle corrupt light data gracefully
First, if the light data is not marked as correct, we should not be
parsing it in the first place. This will eliminate errors from
parsing possibly different versioned light data.

Secondly, if parsing the light data throws an exception (from
the SWMRNibbleArray constructor), then we can simply mark
the returned chunk as having incorrect light data - rather than
propagating the exception and causing the chunk to be re-generated.
2024-11-02 16:33:08 -07:00
Noah van der Aa
7ee4835074
Correctly clear explosion density cache(#11541) 2024-10-31 22:30:18 +01:00
Bjarne Koll
ad9c58e103
Only expose velocity relative tp flags to API (#11532)
Since 1.21.2, vanilla split relative teleportation flags into position
and delta/velocity flags into separate enum entries.
This highlighted a design flaw in the paper api addition for teleport
flags, which just simply mirrored internals while also only being able
to apply the delta/velocity part of a flag, given the teleport target is
always absolute in the API.

This patch proposes to simply no longer expose the non-velocity related
flags to the API, instead marking the entire Relative enum as being
purely velocity related, as non-velocity related flags are not useful to
callers. This was done over simply exposing all internal flags, as
another vanilla change to the internal enum would result in the same
breakage.

The newly proposed API *only* promises that the passed flags prevent the
loss of velocity in the specific axis/context, which should be
independent enough of vanillas specific implementation of this feature.
2024-10-31 17:25:52 +01:00
Bjarne Koll
dfedf79a2f
Correctly cancel consumption of consumable
See: #11534
2024-10-31 12:44:02 +01:00
Lulu13022002
1523212d4e
don't resend effects when PlayerItemConsumeEvent is cancelled 2024-10-30 17:07:49 +01:00
Nassim Jahnke
1a1d0cf01a
Use target pitch in teleport (generally the same thing) 2024-10-30 14:36:09 +01:00
Nassim Jahnke
9f1fa0b4f8
Fix item gravity on inactive items, remove dumb active skipping 2024-10-30 14:06:43 +01:00
Nassim Jahnke
fe2f3d4693
Fix portal exit resulting in bad teleport transition 2024-10-29 22:35:10 +01:00
Lulu13022002
d576cfc234
cleanup bugfix patch 2024-10-29 16:54:40 +01:00
Owen1212055
99b1bf9b0f
Use new ClientboundPlayerRotationPacket for setting player rotation 2024-10-28 12:14:00 -04:00
Jason Penilla
e35f199344
Use declaration order for state holder property iteration
Mostly an aesthetic change for serialization, should not have any impact on performance or correctness.
2024-10-27 18:29:34 -07:00
Jason Penilla
29bf7beba9
Fix unused parameter in PlayerList#remove 2024-10-27 12:09:27 -07:00
Nassim Jahnke
02bca1e655
Remove timings impl 2024-10-27 18:39:30 +01:00
Nassim Jahnke
348c855096
Readd last API patch (with TODO) 2024-10-27 10:03:59 +01:00
Jason Penilla
b14d336442
Apply watchdoge patches 2024-10-25 18:13:48 -07:00
Spottedleaf
be2edeac2b Fix boats/minecarts not dropping when destroyed
Diff to clone the item was lost, which meant that the spawned
item was air.
2024-10-25 15:04:29 -07:00
Spottedleaf
ba1ee87e70 Revert "Add max minecarft speed gamerule config"
This reverts commit 61136fe43b.
2024-10-25 14:10:40 -07:00
Spottedleaf
61136fe43b Add max minecarft speed gamerule config 2024-10-25 14:07:01 -07:00
Spottedleaf
e92607cd21 Fix MSPT command
Used wrong variable for tick length
2024-10-25 13:19:27 -07:00
Spottedleaf
683ce2062e Fix Anti-Xray using wrong data in chunk deserialize 2024-10-25 13:05:26 -07:00
Spottedleaf
b711764991 Rebase fixups 2024-10-25 12:24:15 -07:00