Commit graph

18790 commits

Author SHA1 Message Date
Spottedleaf
f9b1c374e4 Replace SimpleRandom with (Simple)ThreadUnsafeRandom
ThreadUnsafeRandom is a random implementation that is
identical to LegacyRandomSource behaviourally, but
without the thread checks.

SimpleThreadUnsafeRandom is ThreadUnsafeRandom except with
its nextInt(int) function replaced with a faster
but more biased implementation when bound is very large.

Additionally, replace Level/Entity randoms with ThreadUnsafeRandom.
This avoids the expensive CAS logic at the expense of losing the
thread check.
2024-11-27 06:16:27 -08:00
Lulu13022002
0cfa6aa89a Prevent duplicate/superfluous BlockPhysicsEvent (#11609) 2024-11-26 20:05:52 +01:00
Lulu13022002
cb940e72b1 Expose particle status client option (#11573) 2024-11-26 18:46:12 +01:00
Nassim Jahnke
cd36f8d3e2 [ci skip] leaf 2024-11-25 20:18:47 +01:00
Spottedleaf
22dea6efbd Add Server#isGlobalTickThread
This method should be present in Paper, not just in Folia, given
that the GlobalRegionScheduler is present.

Additonally, add Server#isOwnedByCurrentRegion(World, int, int, int, int)
for checking of a rectangle of chunks is owned by the current region.
2024-11-25 10:43:28 -08:00
Spottedleaf
c9731fc93d Change MinecraftServer#pluginsBlockingSleep to be Set
A plugin should not be allowed to be added twice or more, as this
would require two or more remove calls to unset the pause block.
2024-11-25 10:13:34 -08:00
dependabot[bot]
cea5939bba Bump dawidd6/action-download-artifact from 3 to 6 in /.github/workflows (#11666)
Bumps [dawidd6/action-download-artifact](https://github.com/dawidd6/action-download-artifact) from 3 to 6.
- [Release notes](https://github.com/dawidd6/action-download-artifact/releases)
- [Commits](https://github.com/dawidd6/action-download-artifact/compare/v3...v6)

---
updated-dependencies:
- dependency-name: dawidd6/action-download-artifact
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-25 16:03:18 +00:00
Glicz
c64c011b1e [ci skip] fix compile issues caused by b52fea4 (#11664) 2024-11-25 11:18:05 +01:00
Jake Potrebic
b52fea44fe [ci skip] use more jspecify in server 2024-11-24 19:26:32 -08:00
Jake Potrebic
ca5499c7fa Switch Impl types to Holderable 2024-11-24 15:08:19 -08:00
Jake Potrebic
ebd2dc259d Add all missing TagKey constants files (#11661) 2024-11-24 13:32:52 -08:00
Lulu13022002
8e2102c70b Fix painting variant builder (#11660) 2024-11-24 20:12:08 +01:00
Bjarne Koll
bbe32f42f0 Call ProjectileHitEvent for entity hits (#11652)
A simple bugfix replacing a new vanilla call to
Projectile#hitTargetOrDeflectSelf with the bukkit replacement to call
the event.
2024-11-23 23:13:10 +01:00
kokiriglade
d5c1214b8e Painting variant registry modification API (#11648) 2024-11-23 22:10:54 +00:00
Bjarne Koll
34989c63b0 Correctly damage tick wolf after armor block (#11653)
Spigot incorrectly returns false in Wolf#actuallyHurt if the armor
absorbed the damage causing the entity to not get damage invuln ticks.
Resolve this by correctly reverting to the "always true" return value as
the event is not cancelled.
2024-11-23 23:05:54 +01:00
Jake Potrebic
564005cc5f Configurable Entity Despawn Time (#11454)
* Configurable Entity Despawn Time

Co-authored-by: Kevin Raneri <kevin.raneri@gmail.com>

* Rebase

* Rebase

* rebase

* throw exceptions for this map

---------

Co-authored-by: Kevin Raneri <kevin.raneri@gmail.com>
2024-11-23 13:27:37 -08:00
Bjarne Koll
e598ee5d08 Correctly mirror vanilla non-exact ingredients (#11651) 2024-11-23 20:37:38 +01:00
Jake Potrebic
0dc6316e04 Support tags for more SimpleRegistry (#11607) 2024-11-23 11:26:51 -08:00
Nassim Jahnke
857931f5cc Make TypedKey an actual Key (#11641) 2024-11-23 20:21:24 +01:00
Lulu13022002
00e253fdf9 Fix jukebox component (#11642) 2024-11-23 20:09:34 +01:00
Jake Potrebic
c72a463cb5 Run 'freeze' listeners before tag events (#11606) 2024-11-23 10:52:00 -08:00
kokiriglade
ed6663d2b9 Expanded Art API 2024-11-23 18:08:13 +00:00
Abel
89bd3e5c99 Add API to allow/disallow tick sleeping (#11611) 2024-11-22 12:53:01 +01:00
Abel
9badea8a55 Add API to check if the server is sleeping (#11605) 2024-11-22 12:22:20 +01:00
Lulu13022002
22792d7987 Check for AbstractBoat instead of Boat in EAR ignore list 2024-11-21 18:37:49 +01:00
Nassim Jahnke
7fc75401ca [ci skip] Fix typos 2024-11-21 17:57:18 +01:00
Nassim Jahnke
e5b723ada2 Update spark 2024-11-21 10:43:07 +01:00
Lulu13022002
a44e23c205 Fix NPE when EntityResurrectEvent is uncancelled (#11636) 2024-11-19 12:21:31 +01:00
Bjarne Koll
938559b3e0 Fix incorrect invulnerability damage reduction (#11599)
Fixes incorrect spigot handling of the invulnerability damage
reduction applied when an already invulnerable entity is damaged with a
larger damage amount than the initial damage.
Vanilla still damages entities even if invulnerable if the damage to be
applied is larger than the previous damage taken. In that case, vanilla
applies the difference between the previous damage taken and the
proposed damage.

Spigot's damage modifier API takes over the computation of damage
reducing effects, however spigot invokes this handling with the initial
damage before computing the difference to the previous damage amount.
This leads to the reduction values to generally be larger than expected,
as they are computed on the not-yet-reduced value.
Spigot applies these reductions after calling the EntityDamageEvent and
*then* subtracts the previous damage point, leading to the final damage
amount being smaller than expected.

This patch cannot simply call the EntityDamageEvent with the reduced
damage, as that would lead to EntityDamageEvent#getDamage() returning
the already reduced damage, which breaks its method contract.
Instead, this patch makes use of the DamageModifier API, implementing
the last-damage-reduction as a DamageModifier.
2024-11-19 11:54:58 +01:00
Nassim Jahnke
f13d2012fe Add PlayerItemGroupCooldownEvent (#11625) 2024-11-19 11:33:06 +01:00
Lulu13022002
5ada2514df Fix drops for shearing mushroom cow (#11632) 2024-11-19 11:14:19 +01:00
Lulu13022002
1cc1ee1676 Fix drops for shearing bogged (#11628) 2024-11-19 11:05:54 +01:00
Bjarne Koll
a8904bbf98 [ci skip] Rebuild patches 2024-11-19 09:59:20 +01:00
Spottedleaf
c4ea377273 Add missing NotNull annotation for getChunksAtAsync cb param 2024-11-18 22:58:46 -08:00
Spottedleaf
70ccc97b36 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 22:48:40 -08:00
Spottedleaf
f7086a34b5 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 22:47:09 -08:00
Spottedleaf
989fd77808 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 22:34:32 -08:00
Owen1212055
76403d796b 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
Lulu13022002
33bafcbf2d Fix enderchest opening animation (#11635) 2024-11-18 20:47:52 +01:00
MiniDigger | Martin
9dcfb32d11 fix: move to jline-terminal-ffm on java 22+ and fall back to jni on 21, fixes #10405
ffm requires 1) native access allowed (the jdk cracks down on undocumented native access in 22) and 2) reverting the default console back to java.base, so the internal jline doesnt take over
2024-11-17 20:31:50 +01:00
Nassim Jahnke
0500ee7896 Fix inverted global skip check 2024-11-18 13:46:13 +01:00
Nassim Jahnke
a403e97804 Make logs less annoying 2024-11-18 13:06:15 +01:00
Nassim Jahnke
35c2de4fd0 [ci skip] Add missing feature patch identifiers 2024-11-18 12:31:36 +01:00
Nassim Jahnke
95022a668f Update disableGameRuleLimits casing 2024-11-18 12:24:37 +01:00
Space Walker
47f0eb6fb7 Update Alternate Current patch to 1.21.3 (#11602) 2024-11-18 10:29:51 +01:00
Josh Roy
f836a8d8b0 [ci skip] chore: change paste.gg links to mclo.gs (#11629) 2024-11-17 13:46:43 -05:00
Riley Park
227e1fee07 chore: refactor issue templates 2024-11-17 10:26:31 -08:00
Bjarne Koll
7c03ce11ef Updated Upstream (Bukkit/CraftBukkit) (#11626)
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:
36b11391 Fix copy pasting in UseCooldownComponent

CraftBukkit Changes:
a71a7e1f5 SPIGOT-7957: Fix setTarget method for Breeze
5bc0a094b SPIGOT-7955: Failure teleporting players between worlds using Player#teleport() when player has attribute modifiers
2e09c7a36 SPIGOT-7953: Item cooldown must be greater than 0
8ef9079fa Increase outdated build delay
2024-11-17 16:52:44 +01:00
Vivian Horvath
5a9b3c9e23 Fix Naming issue inside Add PlayerArmorChangeEvent (#11614) 2024-11-15 09:00:33 +00:00
Bjarne Koll
b2cf880b79 [ci skip] Rebuild patches 2024-11-15 09:41:04 +01:00