Commit graph

9505 commits

Author SHA1 Message Date
Spottedleaf
ae80a251fc Properly handle large values of spawnChunkRadius
The chunk system does not allow ticket levels below 0, so we need
to add tickets for each individual chunk instead.
2024-12-01 14:07:46 -08:00
Spottedleaf
4bc80b8a44 Do not break when PlayerNaturallySpawnCreaturesEvent is cancelled
If there is a player nearby which had its event not cancelled,
then that should take precedence.
2024-12-01 13:53:04 -08:00
Spottedleaf
0f90942b1a Fix non-null initialisation of context collision shape
Force LazyEntityCollisionContext#getEntity() to delegate

- By delegating when the entity is retrieved, we can correctly catch
  cases where the collision method is inspecting some entity state.

Adjust constant collision shape determination

- Our previous hack did not actually catch every case. For now,
  it will only assume a constant collision shape of EMPTY for
  air blocks.

Fixes https://github.com/PaperMC/Paper/issues/11697
2024-12-01 13:43:37 -08:00
MrPowerGamerBR
1e035f374b
Only attempt to find spawn position if there isn't a fixed spawn position set (#11682) 2024-12-01 16:44:03 +01:00
Nassim Jahnke
27e4ddcd06
Fix item_model adapter, rename internal classes
Fixes #11688
2024-11-30 10:56:37 +01:00
Nassim Jahnke
9039c3923c
Add back discard policy 2024-11-30 10:44:57 +01:00
Lulu13022002
47f2071350
Deprecate ChatVisibility#UNKNOWN (#11683) 2024-11-29 17:12:17 +01:00
Nassim Jahnke
5ab678947f
Copy dispatcher root children before passing it into async tree building 2024-11-29 17:07:54 +01:00
Nassim Jahnke
64828f3a60
Clean up thread pool usage (#11681)
Using an unbound LinkedBlockingQueue means you *have* to set core and max core thread pool size the same, as they will never go above the minimum pool size by just passing them through. So this fixes the async command executor pool to actually use 2 threads, and also cleans up other usage to be explicitly "fixed" thread pool sizes, and splits off one more in Minecraft's Util class
2024-11-29 17:07:35 +01:00
Nassim Jahnke
9953384d89
[ci skip] leaf 2024-11-29 09:44:19 +01:00
Spottedleaf
da9d110d5b Remove chunk save reattempt patch
This patch does not appear to be doing anything useful, and may
hide errors.

Currently, the save logic does not run through this path either
so it did not do anything.

Additionally, properly implement support for handling
RegionFileSizeException in Moonrise.
2024-11-28 18:27:59 -08:00
Spottedleaf
0cc7bd4857 Use Player view distance for PlayerNaturallySpawnCreaturesEvent
The spigot view distance may not be correct, as the player may
have a specific view distance configured.
2024-11-28 14:23:38 -08:00
Spottedleaf
78fd8f931b Copy items when constructing ClientboundSetCursorItemPacket
Unlike ClientboundContainerSetSlotPacket, the constructor
itself does not copy the item. Thus, we need to pass a copy of
the item to the constructor.
2024-11-28 14:02:35 -08:00
Jake Potrebic
5f6a79668c
deprecate adventure key() methods where applicable 2024-11-28 13:51:48 -08:00
Noah
cb2ab7d225
Remove string dupe exploit setting (#11670) 2024-11-28 18:17:57 +01:00
Spottedleaf
d38624bdd8 Do not call modifyEntityTrackingRange on own range
The range is already modified, so this call will not do anything.
2024-11-27 12:19:39 -08:00
Spottedleaf
afb5b13056 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
7e789e8376
Prevent duplicate/superfluous BlockPhysicsEvent (#11609) 2024-11-26 20:05:52 +01:00
Lulu13022002
f4741f22e8
Expose particle status client option (#11573) 2024-11-26 18:46:12 +01:00
Nassim Jahnke
5f0932b6c8
[ci skip] leaf 2024-11-25 20:19:50 +01:00
Spottedleaf
4190ee7439 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
280b497783 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]
cd9e697b52
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
a63013cf48
[ci skip] fix compile issues caused by 5b53cb4 (#11664) 2024-11-25 11:18:05 +01:00
Jake Potrebic
5b53cb404d
[ci skip] use more jspecify in server 2024-11-24 19:26:32 -08:00
Jake Potrebic
cf956ac8d2
Add all missing TagKey constants files (#11661) 2024-11-24 22:32:52 +01:00
Lulu13022002
9bc147178d
Fix painting variant builder (#11660) 2024-11-24 20:12:08 +01:00
Jake Potrebic
bf8405fcdd
[ci skip] Rebuild patches 2024-11-23 22:48:48 -08:00
Bjarne Koll
bb32b05498
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
6051dac82b
Painting variant registry modification API (#11648) 2024-11-23 23:10:54 +01:00
Bjarne Koll
edabff8a35
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
eef40b78c2
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
aee6f7abe1
Correctly mirror vanilla non-exact ingredients (#11651) 2024-11-23 20:37:38 +01:00
Jake Potrebic
860d948731
Support tags for more SimpleRegistry (#11607) 2024-11-23 20:26:51 +01:00
Nassim Jahnke
f2412609a1
Make TypedKey an actual Key (#11641) 2024-11-23 20:21:24 +01:00
Lulu13022002
751e9bd125
Fix jukebox component (#11642) 2024-11-23 20:09:34 +01:00
Jake Potrebic
915637df5c
Run 'freeze' listeners before tag events (#11606) 2024-11-23 10:52:00 -08:00
Abel
817550c520
Add API to allow/disallow tick sleeping (#11611) 2024-11-22 12:53:01 +01:00
Abel
8dc42fadfa
Add API to check if the server is sleeping (#11605) 2024-11-22 12:22:20 +01:00
Lulu13022002
f8e2a671eb
Check for AbstractBoat instead of Boat in EAR ignore list 2024-11-21 18:37:49 +01:00
Nassim Jahnke
55475f05d5
[ci skip] Fix typos 2024-11-21 17:57:18 +01:00
Nassim Jahnke
c28d89d625
Update spark 2024-11-21 10:43:07 +01:00
Lulu13022002
85bfdc09bc
Fix NPE when EntityResurrectEvent is uncancelled (#11636) 2024-11-19 12:21:31 +01:00
Bjarne Koll
d0dcd7d251
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
57eab3e312
Add PlayerItemGroupCooldownEvent (#11625) 2024-11-19 11:33:06 +01:00
Lulu13022002
21cc763352
Fix drops for shearing mushroom cow (#11632) 2024-11-19 11:14:19 +01:00
Lulu13022002
f9f964d4d2
Fix drops for shearing bogged (#11628) 2024-11-19 11:05:54 +01:00
Bjarne Koll
01dd50fb3a
[ci skip] Rebuild patches 2024-11-19 09:59:20 +01:00
Spottedleaf
fdef6d392b Add missing NotNull annotation for getChunksAtAsync cb param 2024-11-18 23:02:17 -08:00
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