Commit graph

3480 commits

Author SHA1 Message Date
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
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
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
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
Lulu13022002
6735c60738
Fix enderchest opening animation (#11635) 2024-11-18 20:47:52 +01:00
MiniDigger | Martin
d8b66dd93d 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-18 17:01:08 +01:00
Nassim Jahnke
4e01ede950
Fix inverted global skip check 2024-11-18 13:46:13 +01:00
Nassim Jahnke
daf31133b5
Make logs less annoying 2024-11-18 13:06:15 +01:00
Nassim Jahnke
11d708d831
[ci skip] Add missing feature patch identifiers 2024-11-18 12:31:36 +01:00
Nassim Jahnke
575c1c4f89
Update disableGameRuleLimits casing 2024-11-18 12:24:37 +01:00
Space Walker
34804890e8
Update Alternate Current patch to 1.21.3 (#11602) 2024-11-18 10:29:51 +01:00
Bjarne Koll
7b13d936de
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
be886cf4e7
Fix Naming issue inside Add PlayerArmorChangeEvent (#11614) 2024-11-15 10:00:33 +01:00
Bjarne Koll
13f48d8320
[ci skip] Rebuild patches 2024-11-15 09:41:04 +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
Barnaby
52fb26524e
Optimize custom map rendering (#11000) 2024-11-11 18:04:22 +01:00
Jake Potrebic
1ef4c0e7ff
Improve performance of RecipeMap#removeRecipe (#11547) 2024-11-10 01:26:05 +01:00
Space Walker
6da7b9e888
Update Eigencraft patch to 1.21.3 (#11553) 2024-11-10 00:52:51 +01:00
Lulu13022002
59b79c8bbb
Fix NPE with enchantable (#11557) 2024-11-09 23:26:01 +01:00
Noah
9d1c91d083
[ci skip] Fix UseCooldownComponent jd (#11565) 2024-11-09 23:24:56 +01:00
Abel
2e6eafb7e8
Improve Minecart#getMinecartMaterial (#11544)
Removes the hardcoded lookup in favour of calling the
AbstractVehicle getItemDrop method.
2024-11-09 23:22:01 +01:00
Jake Potrebic
94ea770212
Re-add exact choice shapeless support (#11546)
* Re-add exact choice shapeless support

* don't re-create maps every shapeless match

* add missing paper comment with last patch
2024-11-09 13:53:53 -08:00
Yannick Lamprecht
e47f79acd9
Configure mockito agent (#11560) 2024-11-09 22:49:07 +01:00
Gero
bcbd10804f
Call CraftPlayer#onEntityRemove for all online players (#11598) 2024-11-09 22:35:58 +01:00
Nassim Jahnke
0af4e84eff
[ci skip] Add identifying line to some larger/optimization patches 2024-11-09 21:44:55 +01:00
Nassim Jahnke
17dbf74ccf
Improve CraftEntity and CraftPlayer equals 2024-11-09 21:17:42 +01:00
Nassim Jahnke
6483ecb8a2
Updated Upstream (Bukkit/CraftBukkit)
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:
a6aba46f PR-1078: Improve Javadocs of Player#loadData() and Player#saveData()
1e2e6a18 SPIGOT-7946: API for server pause when empty seconds
54a36938 SPIGOT-7944, PR-1077: Allow nullable fields in DamageTypeTags

CraftBukkit Changes:
2702c5c8e SPIGOT-7946: API for server pause when empty seconds
485f910fc SPIGOT-7947: addPassenger doesn't work if the vehicle is a player
ecf3dff0e SPIGOT-7949: Registering a new scoreboard objective with an empty display name throws a NPE
9b048cc84 SPIGOT-7948: `Bukkit#dispatchCommand` uses the wrong `CommandListenerWrapper` for Players
7b44d4640 SPIGOT-7931: Fix sync in Anvil View when result item is taken
2024-11-09 17:01:35 +01:00
Jason Penilla
00ef8bdcb0
Fix Entity#isTicking and update Paper entity command (#11590)
fixes #10299
2024-11-09 15:41:26 +01:00
Noah van der Aa
99f4bb29ba
Fix infinite fireworks (#11592) (#11594) 2024-11-08 11:29:40 +00:00
Bjarne Koll
fcb6c72bc9
Correctly pass velocity native compressor (#11509) 2024-11-06 11:00:10 +01:00
Bjarne Koll
42a1901d3b
Correctly adopt upstream item EAR fix (#11582)
EAR 2 evaluates the entities activity on the already incremented entity
tick. This diverges from spigots behaviour and hence needed adoption for
their item ear fix.
2024-11-05 09:52:18 +00: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
Bjarne Koll
ce0a041947
[ci skip] Rebuild patches 2024-11-03 00:37:14 +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
Bjarne Koll
92131adaf2
Decrease dead entity teleport warning (#11559)
Decreases the warning back to its 1.21.1 level where only teleports of
dead/invalid entities across dimensions were logged.
2024-11-01 22:25:31 +01:00
Lulu13022002
d19be64b15
Fix NPE with spark when CraftServer is not init yet (#11558) 2024-11-01 21:37:45 +01:00
Bjarne Koll
85c870e9c7
Correct update cursor (#11554)
Spigot uses a no longer valid ClientboundContainerSetSlotPacket with the
slot -1, which would update the carried stack in versions <=1.21.1 but
now leads to an IOOB.
1.21.2 instead introduced the ClientboundSetCursorItemPacket, which this
patch uses instead.
2024-11-01 15:57:23 +01:00
Bjarne Koll
a5d742637a
Correctly support RecipeChoice.empty (#11550)
The previous implementation was based off of spigots logic in
CraftRecipe#toIngredient, which is completely incorrect as
nms.Ingredient.of() is a throwing call.

Correctly insert handling for the empty() choice in the toNMSOptional
logic.
2024-11-01 11:30:40 +01:00
Jake Potrebic
16d7d73bd5
bunch more general fixes 2024-10-31 20:35:06 -07:00
Jake Potrebic
1de01302d4
re-add a dispense fix patch 2024-10-31 19:51:36 -07:00
Jake Potrebic
5c0930dfad
Fix fix recipe iterator patch 2024-10-31 19:34:10 -07:00
Nassim Jahnke
52a05907c7
Updated Upstream (Bukkit/CraftBukkit) (#11543)
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:
97c59261 PR-1073: Make Biome an interface
a38581aa Fix further javadoc errors
8271c490 Fix javadoc error
8a9ecf29 PR-1072: Fix bad naming for Vault State methods
6dd58108 PR-1071: Make Fluid an interface and add missing entry
ed2cdfc3 PR-1070: Make Attribute an interface and align names with the new minecraft ones
63472efb PR-1069: Add missing winter drop experimental annotation to pale boats

CraftBukkit Changes:
7235ad7b0 PR-1501: Make Biome an interface
602904003 PR-1500: Rename implementation for Vault State methods
75f26f79f PR-1499: Make Fluid an interface and add missing entry
4cfd87adc PR-1498: Make Attribute an interface and align names with the new minecraft ones
6bb0db5cb SPIGOT-7928: ExactChoice acts as MaterialChoice
3eaf3a13c SPIGOT-7929: Error when setting EquippableComponent
abbf57bac SPIGOT-7930: Fix spawning entities with SummonEntityEffect
92d6ab6cf PR-1497: Move boat field rename entries to below key renaming, so that keys are also renamed
abfe292aa PR-1496: Use correct Fluid class on Tags type check
c7aab7fa7 SPIGOT-7923: Fix Dispenser logic to avoid firing empty projectiles
2024-10-31 23:44:34 +01: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
Lulu13022002
147b7961fe
get previous redstone level from the right state for experimental wires 2024-10-31 16:48:37 +01:00
Bjarne Koll
dfedf79a2f
Correctly cancel consumption of consumable
See: #11534
2024-10-31 12:44:02 +01:00
Bjarne Koll
40a960db45
Rebuild patches 2024-10-30 18:36:22 +01:00
Jason Penilla
580a610550
Allow using old ender pearl behavior & apply ender pearl exploit patch (#11524)
When enabled, ender pearls will not load chunks and will save to the world instead of the player.

Also changes the exploit config to be default false, as it only makes sense when legacy behavior is enabled.
2024-10-30 18:09:05 +01:00
Noah van der Aa
13308806ac
Add Friction API to minecarts 2024-10-30 17:31:33 +01:00
Lulu13022002
1523212d4e
don't resend effects when PlayerItemConsumeEvent is cancelled 2024-10-30 17:07:49 +01:00
Lulu13022002
8ba3073343
fix "is_freezing" damage type tag 2024-10-30 14:55:46 +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