Commit Graph

2123 Commits

Author SHA1 Message Date
MrPowerGamerBR
faa2f475b0
Lazily create LootContext for criterions (#9969)
For each player on each tick, enter block triggers are invoked, and these create loot contexts that are promptly thrown away since the trigger doesn't pass the predicate

To avoid this, we now lazily create the LootContext if the criterion passes the predicate AND if any of the listener triggers require a loot context instance
2023-11-25 17:01:26 -05:00
TonytheMacaroni
334b2f20db
Fix max nearby entities class check (#9967) 2023-11-25 16:48:32 -05:00
Shane Freeder
ed753d34d2
Re-add missing vanilla safeMode arg 2023-11-25 09:49:48 +00:00
Jake Potrebic
96d5e6ca48
Code Generation for TypedKeys (#9233)
Currently includes generated key holder classes for types
used in the Registry Modification API
2023-11-22 20:56:28 -08:00
Isaac - The456
250388defe
add getAdvancementProgress() to PlayerAdvancementCriterionGrantEvent (#9865)
this allows for simpler checks for if an advancement would be given to a player,
and denying it (as the advancement grant event is non-cancelable)
2023-11-18 20:18:48 -05:00
booky10
86117967db
Fix missing event call for entity teleport API (#9937)
* Fix missing event call for entity teleport API

Previously a plugin couldn't cancel or modify an entity-teleport from another plugin.

* rebase
2023-11-18 20:05:34 -05:00
TonytheMacaroni
581c7434be
Add API to retrieve an attribute modifier from a UUID (#9924)
* Add attribute modifier from UUID API

* Add method to remove by UUID

* Add overload for UnmodifiableAttributeInstance, better precondition messages

* rebase
2023-11-18 19:55:57 -05:00
Jake Potrebic
39dee1ab52
More paper config cleanup (#9938)
Also adds a warning and error message if a newer config version
was found signaling a downgrade.
2023-11-18 16:29:14 -08:00
Jake Potrebic
e5274eeac9
Fix spawners checking max nearby entities with correct type (#8945)
Co-authored-by: Owen1212055 <23108066+Owen1212055@users.noreply.github.com>
2023-11-18 15:59:12 -08:00
Bjarne Koll
0a8c873722
Call LivingEntity#onItemPickup before mutation (#9948)
The existing EntityPickupItemEvent fixes patch moves the call to LivingEntity#onItemPickup for piglins after the respective EntityPickupItemEvent calls, which is correct.
However the patch moved the call so far down the line that the existing logic already mutated the picked up item entity, leading to faulty state being passed to the onItemPickup method.

To prevent logic in LivingEntity#onItemPickup to read from an ItemEntity that was already mutated, this commit moves the calls prior to the two respective mutations (either gold_nugget or rest).

This was chosen above taking a copy of the original item and restoring state later on to avoid a full item stack clone.
2023-11-17 07:43:25 +01:00
Jake Potrebic
f186318a91
Run the chat callback on the main thread as expected (#9935) 2023-11-11 15:33:19 -08:00
Jake Potrebic
a506b48daa
Fix several issues with EntityBreedEvent (#8677)
Upstream did not account for different hands when storing
the breed item for later use in the event. Also they only
stored a reference to the stack, not a copy so if the stack
changed after love mode was started, the breed item in the event
also changed. Also in several places, the breed item was stored after
it was decreased by one to consume the item.
2023-11-11 15:23:02 -08:00
booky10
9548629853
Add hand to fish event for all player interactions (#9929) 2023-11-11 23:00:45 +01:00
booky10
9ee60eca7d
Add aggressive mob API (#9838) 2023-11-11 16:17:36 -05:00
Owen
dd47ec6fe2
Add Entity Movement Direction API (#7085)
This allows you to get player movement when riding vehicles, etc.
2023-11-11 16:04:34 -05:00
Jake Potrebic
d8847bc1f3
Updated Upstream (Bukkit/CraftBukkit) (#9922)
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:
fde5602a PR-927: Add PlayerRecipeBookSettingsChangeEvent
949ff217 PR-930: Add methods to get/set evoker fang attack delay
f6f7c79d SPIGOT-7514, PR-929: Add "Enchantment Roll" API to enchant items according to Minecraft mechanics
d40e22da PR-712: Add API to get full result of crafting items

CraftBukkit Changes:
c8feb0629 PR-1291: Improve precondition message in Entity#playEffect
482c56a00 PR-1285: Add PlayerRecipeBookSettingsChangeEvent
cdf798800 PR-1290: Add methods to get/set evoker fang attack delay
2c1b5f78f SPIGOT-7514, PR-1289: Add "Enchantment Roll" API to enchant items according to Minecraft mechanics
6aa644ae9 PR-992: Add API to get full result of crafting items
ffb1319bc PR-1287: Fix scoreboards not updating in Player#setStatistic
2023-11-11 12:25:45 -08:00
Luis
63e77b531d
Add Enchantment cost API (#9856)
Cost is a property of individual enchantments, and is used by vanilla in combination with environmental aspects like tool enchantability and bookshelf count to determine the final cost of an enchantment as shown in an enchanting table.

Having access to the base cost of an enchantment using these vanilla methods can allow plugin developers to determine the "value" of an enchantment, and use it in custom logic where needed. I came across this recently when trying to assign an economic value to enchantments during tool repairing, and noticed these values don't seem to be obtainable under the current API.
2023-11-11 15:09:48 -05:00
Tamion
6675d13b31
Fix strikeLightningEffect powers lightning rods & clears copper (#9780)
* Fix strikeLightningEffect powers lightning rods and clears copper

* Fixed vanilla behavior break

* rebase

* revert spigot cleanup and remove setter

* better fix for behaviour break

* rebase and clean

* fix
2023-11-11 12:09:14 -08:00
Jake Potrebic
c95bc5f86d
Don't unpack loot table for TEs not in world (#9918)
Fixed by 23w44a/1.20.3
2023-11-11 11:23:12 -08:00
Shane Freeder
4675152f49
Don't leave the NearbyPlayers tracker in an entirely busted state on double-add detection 2023-11-05 22:15:38 +00:00
Layla Silbernberg / LadySilver47
8cafc07297
Added missing enchantables to material tags (#9888) 2023-11-05 00:37:51 +01:00
Tamion
e289accb03
Add more API to LingeringPotionSplashEvent (#9901)
* Add createAreaEffectCloud API

* Add missing NotNull

* Add missing Paper comments

* Better solution

* Better naming

* New patch and rename

* rename patch
2023-11-04 16:24:06 -07:00
NonSwag
2553f30153
fix secure profile with proxy online mode (#9700) 2023-11-05 00:12:47 +01:00
booky10
75d04e9b04
Broadcast take item packets with collector as source (#9884)
This fixes players (which can't view the collector) seeing item pickups with themselves as the target.
2023-11-04 15:16:55 -07:00
TonytheMacaroni
23860da6c2
Add predicate for block when raytracing (#9691)
* Add predicate for block data when raytracing blocks

* Match based on block, instead of block data

* Use instanceof instead of casting

* Use Position instead of Location, add overload for rayTraceEntities

* Implement requested changes

* Invert predicate

* Cleanup
2023-11-04 15:00:51 -07:00
TrollyLoki
8a3980c60b
Add API to get the collision shape of a block before it's placed (#9821)
* Add API to get the collision shape of a block before it's placed

* Tweak API documentation

* Clarify behavior

* Rebase

* Rebase
2023-11-04 16:32:10 -05:00
Jake Potrebic
0cdce89d59
Fix a bunch of stuff with player spawn locations (#9887)
If a playerdata doesn't contain a valid, loaded world, reset
to the main world spawn point
2023-11-04 14:11:55 -07:00
powercas_gamer
15a0de2eef
Make Team extend ForwardingAudience (#9852) 2023-11-04 21:50:56 +01:00
booky10
43c343228e
Add entity API for getting the combined gene of a Panda (#9891) 2023-11-04 21:28:23 +01:00
Tamion
bffb08c2f9
Deprecate Player#boostElytra (#9899)
The Paper method was chosen for deprecation because it was more
restrictive in that it has an isGliding check.
2023-11-04 13:20:13 -07:00
Jake Potrebic
6592fed511
Use a server impl for hopper event to track get/setItem calls (#9905)
* Use a server impl for hopper event to track getItem/setItem calls

* Rebase

* Comments
2023-11-04 12:58:40 -07:00
Warrior
aa6c4c11e5
Include packet class name in packet encoding error messages (#9907) 2023-11-04 12:34:34 -07:00
booky10
f78d7ce8ff
Remove "fix-curing-zombie-villager-discount" exploit option (#9895) 2023-11-04 20:20:01 +01:00
Lulu13022002
44057da467
Remove duplicate water-sensitivity damage for unaware mobs (#9908) 2023-11-04 12:10:27 -07:00
Warrior
230682d51b
Add raw iron & raw copper blocks to anti xray defaults (#7622) 2023-11-04 15:07:48 +00:00
TomTom
487109fddc
Readd 0414 use distance map to optimise entity tracker (#9868) 2023-11-03 14:05:57 +00:00
Nassim Jahnke
8493340be4 Add another slot sanity check 2023-11-03 14:49:55 +10:00
Md5Lukas
0b218903a8
Fix villager infection chance not being handled properly (#9897) 2023-11-01 14:59:00 -07:00
Jake Potrebic
1865625d95
Fix NPE when no valid world is found on legacy Players (#9885) 2023-10-29 15:33:32 +00:00
booky10
5bb30ce95b
Fix entity camera not being reset when cancelling spectating start/stop events (#9883) 2023-10-29 01:45:07 +01:00
Shane Freeder
415d7081d2
[ci skip] Fix author in last patch 2023-10-29 00:58:15 +01:00
Gero
a81a384303
Implement Velocity VarInt optimizations (#8418)
---------

Co-authored-by: Owen1212055 <23108066+Owen1212055@users.noreply.github.com>
2023-10-28 19:56:47 -04:00
booky10
5bdfb29ba1
Add player idle duration API (#9833)
* Add player idle duration API

Implements API for getting, setting and resetting a player's idle duration.

* Remove idle duration setter

* Rebase
2023-10-28 19:25:46 -04:00
caramel
c6fac381ed
fix UnsafeValues#loadAdvancement doesn't recalculate position (#9846) 2023-10-28 16:13:33 -07:00
Kenox
8b1ac39e89
Fix warden spawn reason from DEFAULT to NATURAL (#8744) 2023-10-28 19:10:31 -04:00
caramel
52849f6da6
Cleanup disable explosion knockback patch (#9858) 2023-10-28 15:50:26 -07:00
Tamion
b1faa5d5f4
Fix PotionAPI ignores icon flag (#9864)
* fix PotionAPI ignores icon flag

* also fix CraftPotionUtil#toBukkit

* also CraftPotionUtil#fromBukkit

* use CraftPotionUtil
2023-10-28 15:39:47 -07:00
Warrior
b3cac042c1
Fix crash when version_history.json is empty (#9871) 2023-10-28 15:24:54 -07:00
SplotyCode
29350674b3
Fix null item in sendEquipmentChange (#9869) 2023-10-28 15:15:20 -07:00
Jake Potrebic
8cf2503804
Updated Upstream (Bukkit/CraftBukkit) (#9876)
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:
19830133 PR-925: Add hit entity/block to events extending ProjectileHitEvent

CraftBukkit Changes:
5a72c3c04 SPIGOT-7510: Try to fix broken reflection usage of plugins
6fa69f235 PR-1281: Add hit entity/block to events extending ProjectileHitEvent
224f733ac Fix NPE introduced in #f4d977e
2023-10-28 15:02:13 -07:00
Lulu13022002
996d529fb3
Resend entity using the bundle packet (#9853) 2023-10-27 15:48:13 +02:00
Jason Penilla
b974a6b6f3
Update paperweight to 1.5.9 (#9872) 2023-10-26 16:34:58 -07:00
Jake Potrebic
acc6d012b0
Updated Upstream (Bukkit/CraftBukkit/Spigot) (#9861) 2023-10-26 14:56:40 -07:00
Jason
c1ac98328c
Fix log level of advancement debug message (#9860) 2023-10-23 19:07:44 +02:00
Jake Potrebic
90fe0d58a5
Updated Upstream (Bukkit/CraftBukkit/Spigot) (#9825)
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:
897a0a23 SPIGOT-5753: Back PotionType by a minecraft registry
255b2aa1 SPIGOT-7080: Add World#locateNearestBiome
ff984826 Remove javadoc.io doc links

CraftBukkit Changes:
71b0135cc SPIGOT-5753: Back PotionType by a minecraft registry
a6bcb8489 SPIGOT-7080: Add World#locateNearestBiome
ad0e57434 SPIGOT-7502: CraftMetaItem - cannot deserialize BlockStateTag
b3efca57a SPIGOT-6400: Use Mockito instead of InvocationHandler
38c599f9d PR-1272: Only allow one entity in CraftItem instead of two
f065271ac SPIGOT-7498: ChunkSnapshot.getBlockEmittedLight() gets 64 blocks upper in Overworld

Spigot Changes:
e0e223fe Remove javadoc.io doc links
2023-10-22 20:12:00 +01:00
Shane Freeder
489bff9bbd
Temp fix for serialisable blockdata 2023-10-22 19:56:25 +01:00
MiniDigger | Martin
71a1787f6c
[ci skip] cleanup some ATs (#9840) 2023-10-21 17:17:55 -07:00
Lulu13022002
3a5c6f8cee
Fix NPE in SculkBloomEvent world access (#9857) 2023-10-21 13:20:24 -07:00
Brokkonaut
a3e4d1aa36
Don't check if we can see non-visible entities 2023-10-21 20:53:33 +01:00
Spottedleaf
4b0bc74c90 Initialise default nibble arrays in ChunkAccess directly
When ChunkAccess was converted to an abstract class some versions
ago, the code to initialise nibble arrays should have been moved.
However, the code was not moved and so now mods constructing their
own implementations of ChunkAccess would not have the nibble arrays
initialised.

This is ported to Paper from Starlight to keep the code base in sync,
not because it fixes anything known.
2023-10-16 18:57:45 -07:00
Spottedleaf
00331d943e Fix mushrooms not generating in swamps
During feature generation, light data is not initialised and
will always return 15 in Starlight. Vanilla can possibly return
0 if partially initialised, which allows some mushroom blocks to
generate.

In general, the brightness value from the light engine should not
be used until the chunk is ready. To emulate Vanilla behavior better,
we return 0 as the brightness during world gen unless the target
chunk is finished lighting.

The regular light retrieval outside of WorldGenRegion remains
the same, as behaviorally chunks not lit should be at max
skylight and zero block light.
2023-10-16 18:52:28 -07:00
Spottedleaf
2f4281e2b4 Remove unused skyLightSources
There is no point in initialising the sources in Starlight,
as we do not use them. Additionally, they are not saved to
disk so we do not need them.

Maintaining and initialising them is not a negligible cost,
which is why they are being removed.
2023-10-16 18:49:41 -07:00
caramel
e57af7d01e
sync netty version with vanilla (#9842) 2023-10-15 15:41:17 +01:00
caramel
44ee1cd05e
fix recipe packet limiter (#9841) 2023-10-15 15:11:15 +01:00
Md5Lukas
852c1c236d
Add additional tags to ItemMeta obfuscation filtering (#9665) 2023-10-14 23:41:15 +02:00
Md5Lukas
3e1c5e3eb0
Add BlockData setter for FallingBlock (#9829) 2023-10-14 22:46:31 +02:00
Jakub Zacek
e4d184f39d
Replace bukkit Consumers with java consumers (#9836) 2023-10-14 22:43:32 +02:00
froobynooby
3e9d2ac5f2
Don't call options events on login (#9834)
* Don't call options events on login

* Merge changes into client options API patch
2023-10-14 11:32:00 -07:00
SplotyCode
f613437019
Fix CraftPlayerProfile#setId regression (#9822) 2023-10-12 01:20:25 +00:00
Jake Potrebic
2f5bb7e306
add predicate recipe choice only for potion mixes (#9486) 2023-10-10 16:07:21 -07:00
caramel
5509610db5
Fix UnsafeValues#loadAdvancement (#9753) 2023-10-10 15:19:00 -07:00
Jake Potrebic
7e5dd92f9f
fix flat bedrock world config (#9728) 2023-10-10 14:43:10 -07:00
TrollyLoki
69ce9276e4
Make setVelocity method of Fireballs change the travel direction to an arbitrary vector (#9815) 2023-10-10 23:09:45 +02:00
Xander de Keijzer
72f7945e77
Fix painting loosing art on face change (#9798) 2023-10-10 22:24:35 +02:00
Jake Potrebic
e87240b674
Fixes for loot tables (#9818) 2023-10-10 10:35:49 -07:00
Spottedleaf
99b735c1ac Make EntityLookup#get use read lock for entity maps
On Folia, this map is modified by multiple threads and iterating
it may throw errors, for example using the /kill command or any
other command that uses an entity selector.
2023-10-09 10:02:37 -07:00
Warrior
a702a083cd
Move clientBrandName over to ServerPlayer (#9809) 2023-10-08 12:07:48 +02:00
Bjarne Koll
29a0209575
Properly check water block when random ticking ice (#9804)
Readds a lost update to the shared mutable state in the random block
ticking optimisation.
2023-10-06 21:34:00 +01:00
Nassim Jahnke
cfe311d7a5
Fix item effects conversion if no tag is present
Fixes #9796
2023-10-05 16:03:26 +10:00
Nassim Jahnke
431e6418ab
Fixup player profile getters and constructor to expected nullability (#9770) 2023-10-05 05:31:24 +00:00
Warrior
02cfaa8ff8
Fix mobs not spawning when using an older config (#9793) 2023-10-04 10:08:47 -07:00
Shane Freeder
5eec4ec3bf
Quick tweaks to logical flow of getMapData 2023-10-04 16:25:26 +01:00
booky10
f36bb59739
Fix entity data not updated for firework attached to entity (#9783) 2023-10-03 18:29:44 -07:00
Jake Potrebic
6573d9555d
update configurate (#9230) 2023-10-03 18:06:23 -07:00
Nassim Jahnke
9d21a88218
Fix tests 2023-10-04 07:58:30 +10:00
Nassim Jahnke
bb1c0dd6fa
Implement tracking range y setting 2023-10-03 22:19:39 +10:00
Nassim Jahnke
f6969b6374
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:
09b1c123 PR-916: Add more lightning API
c085f3de PR-859: Add Entity#getTrackedBy

CraftBukkit Changes:
1bf30a4e9 SPIGOT-7495: Spawning bee entity in asynchronous BlockPopulator causes IllegalStateException - Accessing LegacyRandomSource from multiple threads
476c5bccd PR-1267: Add more lightning API
40d5e6c02 PR-1190: Add Entity#getTrackedBy
40d41acc1 SPIGOT-7491: Downgrade bundled SQLite to be updated next release
44b31da38 PR-1264: Load Bukkit class before creating Registry item
dc45a6738 SPIGOT-7496: Failure to load datapacks with multiple identical predicates
f508657d6 Fix decompile error affecting javac
ef7a4743d PR-1265: Ensure UTF-8 used in new test resource

Spigot Changes:
224dad51 Rebuild patches
2023-10-03 22:00:24 +10:00
Lulu13022002
38376f43a0
Some jd fixes (#9781) 2023-10-01 00:20:51 +00:00
Nassim Jahnke
c4ba28a21a
Don't throw when removing unplaced player in NearbyPlayers 2023-09-30 15:37:00 +10:00
Nassim Jahnke
0f69290f07
[ci skip] Fix typo (important) 2023-09-29 13:20:32 +10:00
Nassim Jahnke
4cdbb0c86c
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:
044d4ee9 SPIGOT-7283, SPIGOT-7318: Add AsyncStructureGenerateEvent and BlockState cloning
57b73d57 PR-913: Deprecate Projectile#doesBounce() and #setBounce()
43373c44 PR-904: Update FeatureFlag for 1.20.2
a7bbbf0c PR-911: Expand DataPack API with 1.20.2 pack version methods
0341e3a0 SPIGOT-7489: Add TeleportDuration to Display Entity
bcd8d2aa PR-912: Update Minecraft Wiki URLs

CraftBukkit Changes:
99aafc222 Increase outdated build delay
dab849f08 SPIGOT-7283, SPIGOT-7318: Add AsyncStructureGenerateEvent and BlockState cloning
041b29ae3 Upgrade specialsource-maven-plugin
851a32cff PR-1263: Remove unused implementation of AbstractProjectile#doesBounce() and #setBounce()
251af0da3 PR-1261: Expand DataPack API with 1.20.2 pack version methods
46e4ba627 Upgrade specialsource-maven-plugin
df3738a24 SPIGOT-7489: Add TeleportDuration to Display Entity
8d0fea457 PR-1262: Update Minecraft Wiki URLs
e62905aab SPIGOT-7490: Fix entity equipment updates

Spigot Changes:
a0f3d486 Rebuild patches
2023-09-29 13:05:28 +10:00
Jake Potrebic
1765917a6f
Fix creating the reverse map for loot table keys (#9766) 2023-09-28 16:29:34 -07:00
Spottedleaf
fe54a13b13 Properly call overloaded super onDisconnect
Since the method is overloaded, the call to super (which is changed
to call the overloaded method) without the additional parameters
will result in recursion.
2023-09-26 13:16:24 -07:00
Spottedleaf
b3b961f9d5 Fire PlayerConnectionCloseEvent for configuration packet listener
If the player moves to the configuration stage, we also need
to fire the event.
2023-09-26 09:20:17 -07:00
Spottedleaf
c207429b21 Fix VoxelShape#isFullBlock() for non-single AABB types
The correct logic to implement NOT_SAME with Shapes#block()
is to test whether any shape data exists outside of [0.0, 1.0]
and to test whether the shape is completely filled from 0.0 to 1.0
on all axis. This can be implemented by checking whether the
bounds represent the full block and whether everything within
the bounds is filled.
2023-09-26 09:16:11 -07:00
Jake Potrebic
298c47857b
Fix tests that broke during the junit 5 update (#9757)
Co-authored-by: Jason Penilla <11360596+jpenilla@users.noreply.github.com>
2023-09-25 09:05:05 +10:00
Shane Freeder
3cf03fc31a
Fix/update wiki (#9758) 2023-09-25 09:02:46 +10:00
Shane Freeder
5cbce366b2 Handle new brand payload type 2023-09-24 19:48:29 +01:00
Warrior
5923b7d085
Fix missing map initialize event call & missing map id assignment (#9756) 2023-09-24 19:17:29 +01:00
Nassim Jahnke
e284bb1215
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:
fb23cbb3 Define surefire plugin version
d022084a Define ordering for MetadataStoreTest
99a7f6f0 PR-910: Match generic max absorption attribute name style with the rest
c7390d71 PR-909: Update tests to JUnit 5

CraftBukkit Changes:
f0661c351 PR-1230: Move unstructured PDC NBT serialisation to SNBT
452fcb599 PR-1256: Update tests to JUnit 5
2023-09-24 18:25:25 +10:00