Commit graph

3082 commits

Author SHA1 Message Date
Lulu13022002
2891c40adb Add missing effect cause and deprecate PATROL_CAPTAIN cause (#10958) 2024-06-23 22:08:13 +02:00
scarfacered
ef2ce51913 Fix SoundEffects only to players diff (#10966)
Co-authored-by: Nassim Jahnke <nassim@njahnke.dev>
2024-06-23 16:03:32 -04:00
Shane Freeder
69258a8c33 Do not crash when an exp orb attempts to mend an unrepairable item 2024-06-23 14:04:58 +01:00
Lulu13022002
8c6ba348c9 Fix wrong diff applying delta twice (#10959) 2024-06-22 20:11:34 +02:00
Pedro
f5e0f69e72 Fix PlayerShearBlockEvent drops ignored for Pumpkin (#10956) 2024-06-22 09:50:47 -04:00
Spottedleaf
89961bad94 Fix unload queue storing chunks in wrong sections
The unload queue stored the chunks in the same section as
the chunk coordinate, when it needed to apply the unload shift.

Additionally, change the default region shift to the ticket
propagator shift as there is no benefit to using a low region
shift since no regionizing is occuring. This makes the unload
queue shift 6, which should reduce the number of sections to deal
with while processing unloads.
2024-06-21 11:57:03 -07:00
Lulu13022002
31ddf26e18 Preserve velocity for fireball (#10934) 2024-06-21 20:06:31 +02:00
Lulu13022002
ffff490cc8 deprecate and update some entity tags (#10932) 2024-06-21 18:51:00 +02:00
Lulu13022002
58268601ac Validate using_converts_to for food component (#10931) 2024-06-21 18:48:48 +02:00
Lulu13022002
22e64d8059 Fix NPE of AbstractArrow#getWeapon (#10933) 2024-06-21 18:48:29 +02:00
Lulu13022002
5c5a5fb93c Fix base damage for trident (#10948) 2024-06-21 18:48:18 +02:00
Shane Freeder
28238907c1 Revert "Fixes exception log messages getting dropped during bootstrap (#10935)" (Closes #10945)
This reverts commit 05dd6c2bec.
2024-06-21 10:05:27 +01:00
Shane Freeder
71f3228b5c Fix diff in sprint interruption option (Closes #10939) 2024-06-21 01:21:23 +01:00
Jake Potrebic
05dd6c2bec Fixes exception log messages getting dropped during bootstrap (#10935) 2024-06-20 11:26:07 -07:00
Lulu13022002
26fd1c1b56 Validate speed for tool component rule (#10923) 2024-06-20 18:32:32 +02:00
Lulu13022002
461f02dce2 Experimental annotation changes (#10914)
* Experimental annotation changes

* wind charge damage type is not experimental anymore
2024-06-20 18:03:09 +02:00
Lulu13022002
a362e724b2 Fix jukebox playable component not being applied on item meta (#10922) 2024-06-20 17:57:56 +02:00
Spottedleaf
72883ff600 Re-add chunk system debug commands
Re-adds the 'chunkinfo', 'holderinfo' and 'debug chunks' commands.

Additionally, this re-adds chunk debug dumping during watchdog
long timeouts.
2024-06-19 12:11:21 -07:00
Spottedleaf
287baeab18 Add debug for chunk system unload crash
Somehow, a chunkholder is present in the unload queue after
it has been unloaded. It is likely that this is a result of
adding the chunk holder to the unload queue while it is
unloading. However, that should not be possible.

To find out where it is being added to the unload queue, track
the last stacktrace which adds to the unload queue and check
on chunk holder remove if the holder is present in the unload queue
and log the stacktrace.
2024-06-19 10:55:04 -07:00
Spottedleaf
e985ffabb2 Fix ChunkHolder#getFullChunkNow returning non-null when it should not
In the new chunk system, the chunk is only at FULL when either
the FULL callbacks have been invoked or during the FULL callbacks.
2024-06-19 10:42:48 -07:00
Spottedleaf
3c4ca08b26 Cleanup MCUtils patch for chunk system
Remove utilities that are unused, as well as replacing
the full chunk map with a concurrentutil implementation.

Additionally, fix the addition/removal of chunks to/from the
full chunk map so that getChunkIfLoaded correctly returns a
non-null chunk when calling the load or unload events.
2024-06-19 10:29:03 -07:00
Spottedleaf
45ae3a360b Copy missing diff from old chunk system patch
Fixes:
- EntitiesLoadEvent/EntitiesUnloadEvent not firing
- Chunks not saving properly in a lot of cases
2024-06-19 09:27:15 -07:00
Spottedleaf
311fbf4a30 Re-add fixlight command 2024-06-19 08:37:12 -07:00
Jason Penilla
2475b329fa Add ticket for chunk load in isChunkGenerated 2024-06-18 21:15:20 -07:00
Jason Penilla
15c0e90d6e Execute chunk tasks while waiting for chunk load in isChunkGenerated
this shouldn't be needed as we are requesting EMPTY status, however there is a deeper issue that we will just work around for now

fixes #10916
2024-06-18 21:04:13 -07:00
Jason Penilla
6ae5176a52 Add missing null check to getFullChunkIfLoaded
fixes #10915
2024-06-18 18:27:50 -07:00
Jason Penilla
acc349cf7d Remove getUnloadingChunkHolder check
It always returns null now. So it could NPE and is not useful.
2024-06-18 12:51:40 -07:00
Jason Penilla
aaf37cb47d Fix CraftWorld#isChunkGenerated
The upstream implementation is returning true for non-full chunks.

This fix is not ideal since the new chunk system doesn't have a region file/chunk status patch. May want to be revisited before a non-experimental release.
2024-06-18 12:44:07 -07:00
Nassim Jahnke
97bd52887e Use ItemStack.empty() when air is passed into constructor 2024-06-18 15:31:30 +02:00
Bjarne Koll
8d4decb590 Correct duplicate attribute check (#10901)
Brackets got lost during the update, leading to an incorrect
precondition call.
2024-06-18 11:11:14 +02:00
Jake Potrebic
59da9d1a80 Fix NPE for Jukebox#setRecord
Fallback to the global registry if no level exists
Fixes #10899
2024-06-17 17:42:48 -07:00
Emilia Kond
ffa51cc8b0 [ci skip] Fix javadoc mistake in EnchantmentRegistryEntry.Builder (#10898)
The javadoc for EnchantmentRegistryEntry.Builder accidentally refers to
GameEventRegistryEntry, which is a different buildable registry entry.
2024-06-18 00:54:49 +03:00
willkroboth
7887bddbae Fix hasFiredAsync parameter when AsyncPlayerSendCommandsEvent is called (#10896) 2024-06-17 21:16:55 +02:00
Jake Potrebic
70f3730d25 Delegate ItemStack (#10852) 2024-06-17 12:12:42 -07:00
Nassim Jahnke
27a9efdca5 Make chunk system loggers calm down a bit 2024-06-17 13:43:21 +02:00
Nassim Jahnke
08a87667f7 Add back improved watchdog support patch 2024-06-17 13:36:43 +02:00
Jake Potrebic
a9fdf73f2e make EntityPortalReadyEvent#setTargetWorld work again 2024-06-16 15:48:38 -07:00
Jake Potrebic
1862266320 remove remaining reference to 'pgive' 2024-06-16 15:38:59 -07:00
Jake Potrebic
bb6b0b4cb1 Enchantment and GameEvent Registry builders (#10889)
Co-authored-by: Bjarne Koll <git@lynxplay.dev>
2024-06-16 15:00:12 -07:00
Nassim Jahnke
e816087107 Fix legacy cb version in remapper 2024-06-16 23:23:50 +02:00
Spottedleaf
50fedea85f Fix implementations of ChunkHolder#getChunkIfPresent
Implementations for ChunkStatuses below FULL are supposed to always
return ProtoChunk instances. However, since we used the last completed
status, it could return LevelChunk.

To resolve this, follow Vanilla behavior of tracking chunk
completions by status and replace old ProtoChunk statuses with
ImposterProtoChunk when the chunk generates to FULL.

Additionally, implement an optimisation for retrieving full chunks
by storing a map of pos -> LevelChunk. This requires only a simple
map lookup to occur for full chunks which are loaded.
2024-06-16 14:09:44 -07:00
Jake Potrebic
25c3a98398 Registry Modification API (#10893)
* Registry Modification API

* some fixes

* even more fixes
2024-06-16 12:39:59 -07:00
Nassim Jahnke
c675152a56 Fix getAddress connection check 2024-06-16 21:31:39 +02:00
Jake Potrebic
bff551166c call EntityDamageItemEvent for thorns 2024-06-16 09:47:53 -07:00
Bjarne Koll
07e821664d Update Wither#canTravelThroughPortals 2024-06-16 18:04:11 +02:00
Bjarne Koll
d04e9fafa4 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:
2b4b6d14 PR-1023: Convert InventoryView to interface

CraftBukkit Changes:
68603b1c1 Use expanded interaction ranges for traced interact events
eae9f760c PR-1414: Convert InventoryView to interface
ee9eafe67 Fix Implementation for DamageSource#isIndirect for internal custom causing entity
2024-06-16 17:21:14 +02:00
Jake Potrebic
35a678ddb3 update 'improve mass craft perf' patch 2024-06-16 08:08:06 -07:00
Jakub Zacek
b6b5a57b8b Add Adventure API to ServerLinks (#10891) 2024-06-16 13:54:38 +02:00
Nassim Jahnke
78a67f00ea Remove bad server.scheduleOnMain disconnect calls from old patches
The new behavior of disconnect to block the current thread until the disconnect succeeded is better than throwing it off to happen at some point
2024-06-16 12:56:00 +02:00
Nassim Jahnke
fc90ea0624 Add back more patches 2024-06-16 12:47:57 +02:00
Bjarne Koll
3753d8b292 De-deprecate BlockData#getDestroySpeed 2024-06-16 12:44:22 +02:00
Yannick Lamprecht
f594b47eda address compile and test issue (#10890) 2024-06-16 11:47:44 +02:00
Spottedleaf
f63023a6ac Fix NPE in V3808
The armor items may not exist, so we need to null check it.
2024-06-15 22:57:01 -07:00
Owen1212055
c4a1f15d70 Restore functionality to sand dupe setting 2024-06-15 22:04:02 -04:00
Owen1212055
0410d79c1d Owen fixing stuff!!! 2024-06-15 21:43:06 -04:00
Spottedleaf
f679845d59 Remove unnecessary changes from chunk status fix 2024-06-15 15:31:04 -07:00
Bjarne Koll
a2c7a9b490 Deprecate BlockData#getDestroySpeed for removal
The method sadly is not usable in 1.21 without a player as all of an
enchantments attribtue modifiers rely on a base value supplied by a
player. The method could only offer a rough estimate based on some
default values, however a better method for this should be added down
the line rather than trying to force such logic into the existing one.
2024-06-16 00:19:10 +02:00
Bjarne Koll
26f246b908 Properly forward DispenseEvent #getItem to saddle
Correctly use the DispenseEvent's #getItem ItemStack when placing the
saddle on entities during a dispense behaviour instead of the original
stack.
2024-06-16 00:01:55 +02:00
Bjarne Koll
cffcda2bc7 Configurable damage tick when blocking with shield (#10877)
A long standing bug in spigot and its derivatives was the fact that
players taking damage while blocking with a shield would not receive
invulnerability, while they do in vanilla.

This enabled the pvp technique of disabling a shield and immediately
attacking again to knock a player into the air.
While upstream fixed this and properly aligned itself with vanilla
damage logic (in this specific case) changing such long standing
behaviour has some downsides.

To allow players used to this specific bug to still use it, this patch
introduces a configuration option to re-introduce said bug.
As there is no easy way to *only* re-add this bug, the option is found
in the unsupported section as it may introduce other damage related
disparity from vanilla.
2024-06-15 23:09:34 +02:00
Aya
87aea64a44 Add back RecipeIterator fixes patch (#10887) 2024-06-15 20:49:08 +01:00
Jake Potrebic
80cb0a621b correctly change enchantment registry to a 'delayed' version 2024-06-15 12:04:06 -07:00
Nassim Jahnke
3a74801788 Fix max chunk status checks 2024-06-15 19:57:59 +02:00
Nassim Jahnke
b81fffb934 Add back more optimization patches 2024-06-15 19:24:11 +02:00
Bjarne Koll
128085ba3e Improve enchantWithLevels logic
Previously would stream and optionally filter out all entries in the
enchantment registry.
Moves it to using the empty optional if treasure is allowed, leaving the
logic to EnchantmentHelper.
2024-06-15 19:08:11 +02:00
Nassim Jahnke
967ee0c7b1 Merge remote-tracking branch 'origin/dev/1.21' into dev/1.21 2024-06-15 18:52:19 +02:00
Bjarne Koll
22595ec4c0 Revert DamageSource#getCausingEntity to vanilla 2024-06-15 18:39:55 +02:00
Nassim Jahnke
efb91589dc 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:
e2160a18 Make MapCursor#type not depends on deprecated values

CraftBukkit Changes:
6ce172642 SPIGOT-7761: Ender pearl does not damage or spawn endermites
f5a63f734 SPIGOT-7759: Chunk not there when requested in ChunkUnloadEvent
28287259c Remove unused import
eb9a7dde0 SPIGOT-7757: Cannot set item in Stonecutter Inventory
f8be9d752 Move deserialized removed unhandled tags to dedicated removedTags
a7e576186 Fix potential mutability issue with CraftMetaItem copy constructor
995885452 SPIGOT-7741: Vanilla ItemComponent in commands can't remove components
9ef69aa0b PR-1284: Move ItemType <-> ItemMeta linking to a centralized place
3e82eafbe PR-1420: Fix DirectEntity and CausingEntity Damager for Creepers ignited by Player
c23daa71f SPIGOT-7751: Fix crash caused by arrows from trial spawners
Make MapCursor#type not depends on deprecated values
SPIGOT-7761: Ender pearl does not damage or spawn endermites
2024-06-15 18:28:18 +02:00
Ghast
4c472e3401 Fix ItemMeta#removeEnchantments (#10886) 2024-06-15 17:26:55 +02:00
Jake Potrebic
87f8c7ca9b Fix Player#sendBlockState (#10855) 2024-06-15 08:05:21 -07:00
Jake Potrebic
2053f3bd83 Update AbstractArrow item method implementations for 1.20.6 (#10885) 2024-06-15 16:40:29 +02:00
Nassim Jahnke
9b3cf41d7a Update more optimization patches 2024-06-15 14:12:22 +02:00
Spottedleaf
fddfa624cf Chunk System and Starlight WIP
Chunk system patch was refactored to take advantage of
newer ConcurrentUtil's concurrent long hash table (which
fixes hash collisions caused by chaining fastutil's long hash
and CHM's hash) plus some other minor improvements.

The chunk system was also merged with Starlight, which mostly
provides a small improvement to ThreadedLevelLightEngine#checkBlock
as the scheduling was rewritten.
2024-06-14 17:19:25 -07:00
Jake Potrebic
9b34dc14d9 remove api that was scheduled for removal 2024-06-14 14:07:44 -07:00
Spottedleaf
2bfea35de3 Update ConcurrentUtil
Mostly for the primitive long to reference hashtable impl
2024-06-14 10:47:33 -07:00
Spottedleaf
6b1346c1f6 DataConverter 1.21 2024-06-14 10:34:45 -07:00
Spottedleaf
e9068d28c6 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:
befcf86d SPIGOT-7740: Fix using new map cursor types
09229095 Add EntityDamageEvent.DamageCause#CAMPFIRE

CraftBukkit Changes:
a1d2cd152 SPIGOT-7747: Mob head is not dropped when mob was blown up by a charged creeper
8078294bc SPIGOT-7746: Server Crashing when Players Getting into End Portals
8d842e250 SPIGOT-7744: Fix exception for shooting projectiles with flame enchantment
64e0ad129 SPIGOT-7744: Fix crash when shooting arrows in creative mode
819f7a10a Fix player items not dropping on death
0a0229bb5 Implement DamageCause#CAMPFIRE and minor improvement in exception for Unhandled block damage
2024-06-14 10:15:52 -07:00
Nassim Jahnke
3f581a6024 Fix body equipmentslot and effect enum 2024-06-14 18:53:32 +02:00
Nassim Jahnke
1aee096320 Fixup and deprecate player profiles in ping event
The player sample uses game profile internally, but discards everything but the name and uuid and does not follow player profile restrictions, so it doesn't make sense to use that in the event.
2024-06-14 18:14:55 +02:00
Nassim Jahnke
201427a880 Make it compile 2024-06-14 18:02:15 +02:00
Bjarne Koll
492de57f77 Adopt previous commit changes in API 2024-06-14 16:02:59 +02:00
Bjarne Koll
f548e7fbd5 Some work on the ItemMend events 2024-06-14 16:01:00 +02:00
Bjarne Koll
be8b9314b4 Pretend to fix compile errors 2024-06-14 15:16:29 +02:00
Nassim Jahnke
d29210d668 Fix more compile issues 2024-06-14 14:28:06 +02:00
Nassim Jahnke
bcdf841f2d Fix more compile issues 2024-06-14 14:11:52 +02:00
Nassim Jahnke
9206b1ea14 Fix a few compile errors 2024-06-14 13:07:50 +02:00
Bjarne Koll
7289589315 988 2024-06-14 11:59:44 +02:00
Bjarne Koll
8a6e31ec59 960 2024-06-14 11:07:50 +02:00
Bjarne Koll
2b73df0fd7 956 2024-06-14 10:56:28 +02:00
Bjarne Koll
4eaa335676 922 2024-06-14 10:17:11 +02:00
Jason Penilla
0785c29a37 update some patches 2024-06-13 20:41:44 -07:00
Jake Potrebic
a0f4d303eb 788/1053 2024-06-13 18:30:23 -07:00
Jake Potrebic
4ff15b38e5 650/1053 2024-06-13 17:08:12 -07:00
Jake Potrebic
dfa326fc2f 585/1053 2024-06-13 16:32:45 -07:00
Bjarne Koll
e0f5e2a1d5 538 2024-06-14 00:44:26 +02:00
Jake Potrebic
02d989b548 531/1053 2024-06-13 14:42:02 -07:00
Jake Potrebic
29e69c49da 487/1053 2024-06-13 13:57:13 -07:00
Jake Potrebic
7bcc1a4674 385 2024-06-13 13:14:13 -07:00
Jake Potrebic
e07671b7df 279 2024-06-13 12:04:27 -07:00
Jake Potrebic
9120ce5d4b 194 2024-06-13 11:09:28 -07:00
Jake Potrebic
6a05c85176 117 2024-06-13 10:30:39 -07:00
Jake Potrebic
79da0788dd 62 2024-06-13 10:12:48 -07:00
Jake Potrebic
0ef31547a1 Finish API patches 2024-06-13 08:45:43 -07:00
Bjarne Koll
b52915b54e Update upstream (Bukkit/CraftBukkit/Spigot) (#10875)
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:
376e37db SPIGOT-7677: Update which entities are marked as spawnable
06c4add3 SPIGOT-7737: Add separate TreeType.MEGA_PINE
19b7caaa SPIGOT-7731: Spawn eggs cannot have damage
e585297e PR-1022: Add force option to Player#spawnParticle
d26e0094 PR-1018: Add methods to get players seeing specific chunks
8df1ed18 PR-978: Add Material#isCompostable and Material#getCompostChance
4b9b59c7 SPIGOT-7676: Enforce locale parameter in toLowerCase and toUpperCase method calls and always use root locale
8d1e700a PR-1020: Cast instead of using #typed when getting BlockType and ItemType to better work with testing / mocks
fa28607a PR-1016: Fix incorrect assumption of Fireball having constant speed
4c6c8586 PR-1015: Add a tool component to ItemMeta
6f6b2123 PR-1014: Add PotionEffectTypeCategory to distinguish between beneficial and harmful effects
f511cfe1 PR-1013, SPIGOT-4288, SPIGOT-6202: Add material rerouting in preparation for the switch to ItemType and BlockType
def44cbf SPIGOT-7669: Fix typo in ProjectileHitEvent#getHitBlockFace documentation
53fa4f72 PR-1011: Throw an exception if a RecipeChoice is ever supplied air

CraftBukkit Changes:
ee95e171a SPIGOT-7737: Add separate TreeType.MEGA_PINE
0dae4c62c Fix spawn egg equality check and copy constructor
ab59e847c Fix spawn eggs with no entity creating invalid stacks and disconnect creative clients
3b6093b28 SPIGOT-7736: Creative spawn egg use loses components
c6b4d5a87 SPIGOT-7731: Spawn eggs cannot have damage
340ccd57f SPIGOT-7735: Fix serialization of player heads with note block sound
fd2f41834 SPIGOT-7734: Can't register a custom advancement using unsafe()
02456e2a5 PR-1413: Add force option to Player#spawnParticle
6a61f38b2 SPIGOT-7680: Per-world weather command
58c41cebb PR-1409: Add methods to get players seeing specific chunks
16c976797 PR-1412: Fix shipwreck loot tables not being set for BlockTransformers
7189ba636 PR-1360: Add Material#isCompostable and Material#getCompostChance
900384556 SPIGOT-7676: Enforce locale parameter in toLowerCase and toUpperCase method calls and always use root locale
bdb40c5f1 Increase outdated build delay
d6607c7dd SPIGOT-7675: Fix FoodComponent config deserialization
b148ed332 PR-1406: Fix incorrect assumption of Fireball having constant speed
3ec31ca75 PR-1405: Add a tool component to ItemMeta
5d7d675b9 PR-1404: Add PotionEffectTypeCategory to distinguish between beneficial and harmful effects
960827981 PR-1403, SPIGOT-4288, SPIGOT-6202: Add material rerouting in preparation for the switch to ItemType and BlockType
94e44ec93 PR-1401: Add a config option to accept old keys in registry get calls
a43701920 PR-1402: Fix ChunkSnapshot#isSectionEmpty() is always false
87d0a3368 SPIGOT-7668: Move NONE Registry updater to FieldRename to avoid some class loader issues
2ea1e7ac2 PR-1399: Fix regression preventing positive .setDamage value from causing knockback for 0 damage events
ba2d49d21 Increase outdated build delay

Spigot Changes:
fcd94e21 Rebuild patches
342f4939 SPIGOT-7661: Add experimental unload-frozen-chunks option
2024-06-13 16:45:27 +02:00
Bjarne Koll
5df0660d63 Prevent internal NPE on ItemStack#damage (#10836)
ItemStack#damage internally uses ItemStack#hurtAndBreak, which
previously would call a Consumer in case the item broke.
Since 1.20.5 the break game event logic however resides in said method
and was using the equipment slot passed, which is null in the case of
the API ItemStack#damage method.

This commit prevents the NPE by first null checking the slot.
Addittionally, hurtAndBreak also now checks if the player has infinite
materials, e.g. is in creative mode, to prevent damaging the item.

As such as filter is undesirable for API calls, this commit also skips
this logic in case of an API invocation.
2024-06-10 08:24:52 +02:00
Lulu13022002
bd9e2e7fe8 Handle alpha channel from potion_contents component (#10808) 2024-06-04 22:55:29 +02:00
Jake Potrebic
1eacf97f18 Make Bogged implement Shearable (#10844) 2024-06-04 13:26:40 -07:00
Jake Potrebic
a992033d60 Add since to deprecated for removals (#10848) 2024-06-04 12:40:18 -07:00
Spottedleaf
3df0d9a457 Do not perform chunk existance check for I/O scheduling
In order to check if a chunk exists, the RegionFile lock
(if the RegionFile is opened) will be acquired. However,
the RegionFile may be performing I/O operations, in which
case will stall the acquire operation.

To ensure that threads scheduling loads do not incur a stall,
we can avoid this check entirely - the RegionFile I/O
thread(s) will eventually perform the exist check itself.
2024-06-03 13:28:31 -07:00
Bjarne Koll
ca07564e47 Only assign blockstate data if super ctor did not (#10841)
The CraftBlockStateMeta constructor CraftBlockStateMeta(Map) invokes its
parent constructor, which itself invokes deserializeInternal, which is
implemented on CraftBlockStateMeta to read the components and block
entity tag from the passed map.

Field initialization happens after the call to the super constructor,
meaning the current code overwrites the parsed internal data with the
EMPTY defaults.

This is prevented by moving the initialization into its own code block
that can null check the fields prior to defaulting their value to EMPTY.
2024-06-03 19:39:20 +02:00
Jake Potrebic
a69530eb66 clarify what getEntityId actually returns (#10839) 2024-06-03 10:20:43 -07:00
Jake Potrebic
5db39ab195 Use RegistryOps in the correct places (#10843) 2024-06-02 15:19:17 -07:00
Bjarne Koll
97ed3762cf Fix CommandSourceStack#bypassSelectorPermissions (#10837)
The previous implementation would throw a command exception if the
CommandSourceStack had its bypassSelectorPermissions flag set to true,
which is the incorrect behaviour.

Instead, it should only throw an exception if the flag is set to false
and all its other checks "fail" too.
2024-06-01 16:26:11 +02:00
Jake Potrebic
3a135ada91 Fire TabCompleteEvent for legacy commands (#10834) 2024-05-31 08:46:42 -07:00
TotalledZebra
2cc4c182ae Add entity heal API (#10267) 2024-05-30 23:31:45 +03:00
Jake Potrebic
ea9c42406e fix knockback events (#10831)
* fix knockback events

* squash

* handle cancelled event for explosions
2024-05-30 13:17:16 -07:00
Jason Penilla
ef45b03497 Use CommandSourceStack in AsyncPlayerSendCommandsEvent (#10826) 2024-05-30 11:32:43 -07:00
Shane Freeder
3bb51e10ab Fix sending disconnect packet in phases where it doesn't exist 2024-05-30 19:05:39 +01:00
Jake Potrebic
25b99bc93a Deprecate InvAction#HOTBAR_MOVE_AND_READD (#10784) 2024-05-29 14:56:14 -07:00
SoSeDiK
2786ee1e8f Extend fishing API (#10634)
Adds a missing fishing state when the fish is lured and fires an event for it.
Also adds a way to control the fish swimming time towards the bobber.
2024-05-30 00:45:01 +03:00
Jake Potrebic
a888e73efa Add registry-related argument types (#10770)
* Add registry-related argument types

* fix tests
2024-05-29 14:11:52 -07:00
Jake Potrebic
3991e67f19 Several fixes and new api for experience merging/stacking (#9242) 2024-05-29 13:58:57 -07:00
Bjarne Koll
6496275397 Flatten namespaced vanilla command alias redirects (#10821)
The brigadier command dispatcher is not capable of executing commands
that redirect more than one.
The exemplary alias 'minecraft:tp' may hence not redirect to 'tp' it
instead has to redirect to 'teleport' as 'tp' itself is merely a
redirect.
2024-05-29 21:47:07 +02:00
Jake Potrebic
532b3df1ee Fix skipping custom block entity tag (#10812) 2024-05-29 12:22:51 -07:00
Jake Potrebic
91b9b6b0de Allow firework effects with no colors (#10814) 2024-05-29 11:50:44 -07:00
Jake Potrebic
966eda751d Use RegistryOps for loadAdvancement (#10799) 2024-05-29 11:27:29 -07:00
Jake Potrebic
82ece252bc handle BODY slot for non-mobs (#10822) 2024-05-29 11:23:51 -07:00
Lulu13022002
cae5734b19 Fix max temper API for llama (#10823) 2024-05-29 20:17:56 +02:00
Bjarne Koll
4a8e32ec74 Only remove worldgen block entity on changed block (#10794) 2024-05-28 11:45:03 +02:00
Shane Freeder
1f743f10af Fix missing debug trace 2024-05-27 18:33:34 +01:00
Tamion
cca7c50e9f Fix Cancelling BlockPlaceEvent calling onRemove (#10773) 2024-05-27 00:03:48 +02:00
Jake Potrebic
e20678fb20 Prevent NPE if hooked entity was cleared (#10712) 2024-05-26 14:41:30 -07:00
Lulu13022002
0ca35d0dd9 Fix more item desync when an event is cancelled (#10654) 2024-05-26 23:30:45 +02:00
Cross
7c18a81fde Extend Player Interact cancellation to cover Jigsaw blocks (#10719) 2024-05-26 21:54:55 +01:00
Jake Potrebic
2b16bc2a30 Fix BlockStateMeta equals (#10795) 2024-05-26 13:49:00 -07:00
Lulu13022002
dfcf0b3ac3 Fix integer overflow for lag compensating eating check (#10797) 2024-05-26 22:35:58 +02:00
Jake Potrebic
dd6b67a80a fix and cleanup loot table patches (#10100)
* fix and cleanup loot table patches

* fixes
2024-05-26 12:51:15 -07:00
Lulu13022002
fff2347845 Clear firework item properly (#10793) 2024-05-26 19:57:38 +02:00
Jake Potrebic
37155664bb readd itemstack data sanitization (#10454)
* readd itemstack data sanitization

* use autocloseable
2024-05-26 10:56:33 -07:00
Jake Potrebic
85894149b3 reset meta block state on BlockStateMeta#setBlockState 2024-05-25 22:36:55 -07:00
Jake Potrebic
476103747a Fix NPE for color-related metas
Fixes #10789
2024-05-25 19:55:51 -07:00
Janet Blackquill
fe5c08d312 Expose anvil cost in the API (#10682) 2024-05-25 19:47:14 -04:00
Jake Potrebic
169a23c23a Fix CraftMetaBlockState for data components (#10731)
This will go on forever...
2024-05-25 16:37:35 -07:00
Lulu13022002
f5963e84a3 Fix a few issues with ItemMeta (#10740) 2024-05-26 00:58:56 +02:00
jake-brennan714
10c04efb2a [ci skip] Update Player#getListeningPluginChannels Jdoc (#10778) 2024-05-25 17:59:01 -04:00
Lulu13022002
8af4ab8bf7 Allow to define new map cursor types (#10782) 2024-05-25 23:56:44 +02:00
TonytheMacaroni
5af1dfa5cb Use getter/setter on Mob for equipment drop chances (#10780) 2024-05-24 13:52:54 -04:00
Shane Freeder
e04d670f1d Do not re-wrap vanilla goals (#10751)
There is no need to rewrap vanilla goals when they're being reregistered,
this breaks some expectations around behavior outside of general
wasting of resources.

Resolves: #10743
2024-05-24 15:22:41 +01:00
Jason Penilla
d644dfaa27 Allow using PluginLoader classpath API from Bukkit plugins (#10758)
Allows using the PluginLoader API without any of the other changes imposed by switching to a paper-plugin.yml.

Used by setting paper-plugin-loader in plugin.yml to the class name of your PluginLoader.

Also allows skipping the libraries field by setting paper-skip-libraries to true (by default both libraries and jars provided by the PluginLoader are added to the classpath).
2024-05-23 13:13:02 -07:00
Jake Potrebic
3636a1dcf5 Remove incorrect logic for Fireball#setVelocity (#10764) 2024-05-23 12:48:11 -07:00
Jake Potrebic
bbe01377d5 Improve default item attributes API (#10765) 2024-05-23 11:44:07 -07:00
Jason Penilla
cb60dbc9e3 Print CommandRegisteredEvent deprecation warnings again (#10756) 2024-05-23 10:44:45 -07:00
Jake Potrebic
d637706bbd Fix equipment slot and group API (#10767) 2024-05-23 10:39:44 -07:00
Jake Potrebic
98853ee548 [ci skip] Move logic in our patches to ItemType/BlockType (#10772) 2024-05-23 10:32:02 -07:00
Jake Potrebic
c7e42591dd Always show command exception stack traces in logs (#10766) 2024-05-22 10:24:09 -07:00
Jake Potrebic
0c9dd451de fix default item attributes 2024-05-22 07:16:50 -07:00
Spottedleaf
dd88498616 Fix compile 2024-05-21 08:41:36 -07:00
Spottedleaf
e29a098cbe Remove ThreadedWorldUpgrader patch
The patch does not implement Vanilla forceUpgrade behavior.
Specifically, poi/entity conversion and regionfile recreation.

The Vanilla force upgrader is also no longer broken by CB, so the
bug fixes from this patch are not relevant anymore.
2024-05-21 08:21:28 -07:00
Jason Penilla
e71c77f5e9 Add a better warning message than "Server performance will be affected" for CommandRegisteredEvent use (#10754) 2024-05-20 11:15:21 -07:00
Jake Potrebic
93cb23c488 Add an 'empty' RecipeChoice for certain ingredient slots (#10710) 2024-05-20 07:20:47 -07:00
Jake Potrebic
763f42fc65 Check for more correct profile validation (#10730) 2024-05-19 17:45:43 -07:00
Jake Potrebic
3fb22e8951 fix CompassMeta not being correct (#10737) 2024-05-19 17:15:44 -07:00
Shane Freeder
c889d48f8c Make PaperSimplePluginClassLoader show class which is not found 2024-05-18 21:17:54 +01:00
Jake Potrebic
f14fe2e4f4 Fixes issues in the suppress dismount cancellation patch (#10735) 2024-05-17 14:37:16 -07:00
Jake Potrebic
5bd61ce801 Fix NPE sending resource pack without prompt
Fixes KyoriPowered/adventure#1075
2024-05-17 14:22:45 -07:00
Riley Park
1570ecc56c Expose server build information (#10729)
* Expose server build information

* squash patches

* final tweaks

---------

Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
Co-authored-by: masmc05 <masmc05@gmail.com>
2024-05-15 17:06:59 -07:00
Jason Penilla
b7e944756d Show stacktrace when modifyItemStack fails 2024-05-13 22:58:50 -07:00
Jason Penilla
9e0c66cd6c Correctly copy alias requirements in command upgrader
Fixes NPE when converting namespaced commands.

Since the brigadier command api, more aliased commands
(namespaced variants) are registered in the vanilla dispatcher,
which made this issue more apparent.
2024-05-13 15:55:15 -07:00
Spottedleaf
e5d36081c0 Make exception during command conversion non-fatal
Instead of allowing chunks to fail to convert completely,
simply log the exception and the offending command. Command
conversion failure should never result in chunk data deletion,
as commands are not critical chunk data.
2024-05-13 14:40:02 -07:00
Jake Potrebic
036a488ef5 fix creating complex recipes that have air results
Fixes #10715
2024-05-13 06:16:45 -07:00
Jake Potrebic
0c984809fd Better way to keep paper datapack enabled 2024-05-12 21:48:07 -07:00
Jake Potrebic
eba7123352 Improve Recipe validation (#10707) 2024-05-12 13:46:46 -07:00
Bjarne Koll
def79f079d Prevent infinite recursion on cyclic brig redirect (#10705)
Prevent infinite recursion when declaring a cyclic relation between
command nodes via child nodes redirecting to an nth parent by marking a
command node as unwrapped before unwrapping its children.
2024-05-12 17:41:21 +02:00
Owen1212055
cde6cb4f28 Properly pass requirement on namespaced redirects (#10701) 2024-05-12 02:46:42 -04:00
Jason Penilla
f9008ceb01 Fix signed book page serialization (#10696) 2024-05-11 15:13:18 -07:00
Jake Potrebic
702864d8f8 Updated Upstream (Bukkit/CraftBukkit) (#10691)
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:
fa99e752 PR-1007: Add ItemMeta#getAsComponentString()
94a91782 Fix copy-pasted BlockType.Typed documentation
9b34ac8c Largely restore deprecated PotionData API
51a6449b PR-1008: Deprecate ITEMS_TOOLS, removed in 1.20.5
702d15fe Fix Javadoc reference
42f6cdf4 PR-919: Add internal ItemType and BlockType, delegate Material methods to them
237bb37b SPIGOT-1166, SPIGOT-7647: Expose Damager BlockState in EntityDamageByBlockEvent
035ea146 SPIGOT-6993: Allow #setVelocity to change the speed of a fireball and add a note to #setDirection about it
8c7880fb PR-1004: Improve field rename handling and centralize conversion between bukkit and string more
87c90e93 SPIGOT-7650: Add DamageSource for EntityDeathEvent and PlayerDeathEvent

CraftBukkit Changes:
4af0f22e8 SPIGOT-7664: Item meta should prevail over block states
c2ccc46ec SPIGOT-7666: Fix access to llama and horse special slot
124ac66d7 SPIGOT-7665: Fix ThrownPotion#getEffects() implementation only bringing custom effects
66f1f439a Restore null page behaviour of signed books even though not strictly allowed by API
6118e5398 Fix regression listening to minecraft:brand custom payloads
c1a26b366 Fix unnecessary and potential not thread-safe chat visibility check
12360a7ec Remove unused imports
147b098b4 PR-1397: Add ItemMeta#getAsComponentString()
428aefe0e Largely restore deprecated PotionData API
afe5b5ee9 PR-1275: Add internal ItemType and BlockType, delegate Material methods to them
8afeafa7d SPIGOT-1166, SPIGOT-7647: Expose Damager BlockState in EntityDamageByBlockEvent
4e7d749d4 SPIGOT-6993: Allow #setVelocity to change the speed of a fireball and add a note to #setDirection about it
441880757 Support both entity_data and bucket_entity_data on axolotl/fish buckets
0e22fdd1e Fix custom direct BlockState being not correctly set in DamageSource
f2182ed47 SPIGOT-7659: TropicalFishBucketMeta should use BUCKET_ENTITY_DATA
2a6207fe1 PR-1393: Improve field rename handling and centralize conversion between bukkit and string more
c024a5039 SPIGOT-7650: Add DamageSource for EntityDeathEvent and PlayerDeathEvent
741b84480 PR-1390: Improve internal handling of damage sources
0364df4e1 SPIGOT-7657: Error when loading angry entities
2024-05-11 14:48:37 -07:00
Owen1212055
567cc3f4b3 Brigadier Command Support (#8235)
Adds the ability for plugins to register their own brigadier commands 

---------

Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
Co-authored-by: Jason Penilla <11360596+jpenilla@users.noreply.github.com>
Co-authored-by: Bjarne Koll <git@lynxplay.dev>
2024-05-11 16:30:30 -04:00
Jake Potrebic
b71a9db7ad handle recent ItemMeta changes in serialization logic 2024-05-11 09:14:16 -07:00
Jake Potrebic
c5fb79b218 adjust ItemMeta to distinguish null and empty modifiers
Fixes #10686 (again)
2024-05-11 07:16:21 -07:00
Jake Potrebic
df292ced7a Fix keepalive time interval (#10690) 2024-05-10 17:23:58 -07:00
Jake Potrebic
8a5f5f023a Fix stacks losing empty attr modifiers
Fixes #10686
2024-05-10 12:05:06 -07:00
Jason Penilla
71de67180a Add conversion for summon command 2024-05-10 12:57:07 +02:00
Nassim Jahnke
fb102cafd1 Add validation to player profile and properties (#10680) 2024-05-10 12:52:03 +02:00
Spottedleaf
af67859c56 Use MCDataConverter instead of raw convert call for cmd converter
MCDataConverter uses the breakpoint system, which for future
updates may be neccesary (probably not).

Also, add the 1.20.6 version field.
2024-05-10 00:34:37 -07:00
Joseph Burton
67b30c5ed5 Fix DataConverter ConverterParticleToNBT.parseProperties
- The old code was using `StringReader.peek()` in a place where it meant to be `StringReader.skip()`.
- The vanilla code allows a trailing comma, but only if there is no whitespace between it and the closing bracket, which is a bit weird. I think that's a bug and it shouldn't allow trailing commas, but if you disagree then only the first issue needs to be fixed.
2024-05-10 00:31:58 -07:00
Spottedleaf
79fcb6baf4 Fix chunk data version check not running in chunk system
The old read() method should just redirect to the new
chunk system method, however due to an error in moving
the chunk system patch around the data version check was
left in the old (UNUSED) read() method.
2024-05-09 23:47:13 -07:00
Spottedleaf
b407e24c84 Invalidate PathTypeCache when pathfinding updates are disabled
The configuration should not allow the cache to break. Additionally,
invalidating the cache is cheap and as such there is no gain to avoid
invalidating it.
2024-05-09 23:07:32 -07:00
Spottedleaf
df07e2152f Fix entity tracker desync when new players are added to the tracker
The delta position packet instructs the client to update
the entity position by a position difference. However, this position
difference is relative to the last position in the entity tracker
state, not the last position which has been sent to the player. As
a result, if the last position the player has recorded is different
than the one stored in the entity tracker (which occurs when a new
player is added to an existing entity tracker state) then the sent
position difference will cause a position desync for the client.

We can resolve this problem by either tracking the last position
sent per-player, or by simply resetting the last sent position
in the entity tracker state every time a new player is added.
Resetting the last sent position every time a new player is
added to the tracker is just easier to do, so that is what
this patch does.
2024-05-09 17:08:59 -07:00
Nassim Jahnke
1ebe089f8d Print data component type on encoding error 2024-05-09 15:12:12 +02:00
Shane Freeder
2d2eafa713 Update Adventure to 4.17.0 Release 2024-05-08 15:48:45 +01:00
Bjarne Koll
93f003b64f Correctly compare holders in BeaconMenu (#10673) 2024-05-08 03:18:57 +02:00
Lulu13022002
624d28817c Fix hopper pull event being skipped after the first call (#10667) 2024-05-07 14:28:45 +02:00
Jason Penilla
c0abf0cfc9 Fix ping event always receiving protocol version 0 (#10671) 2024-05-07 05:24:45 -07:00
Jake Potrebic
dfd0478a87 Fix BlockStateMeta (#10647)
* Fixes CraftMetaBlockState block entity data components

* rebase and merge into general item meta fix

* Add javadoc notice

* Update message

---------

Co-authored-by: Bjarne Koll <git@lynxplay.dev>
2024-05-05 12:56:46 -07:00
SoSeDiK
b00b419da9 Add a way to check whether the chest is blocked (#10635)
* More Chest Block API

* rebased and slight logic fixes
2024-05-05 20:57:28 +03:00
Bridge
254ed14dc9 Prevent profile lookups when unnecessary (#10651) 2024-05-05 19:07:30 +02:00
Tamion
548fa24c1e Fix EntityLoadCrossbowEvent (#10645)
* fix

* hehe
2024-05-05 18:54:04 +02:00
Lulu13022002
1465288208 [ci skip] Update old particle reference in javadoc (#10652) 2024-05-05 18:44:06 +02:00
NonSwag
b5d6fdee48 Add missing SpigotConfig logCommands check (#10659) 2024-05-05 18:41:02 +02:00
Nostal Yuu
de6967e549 Added API to get player's proxy address (#10400) 2024-05-06 00:39:32 +08:00
Jake Potrebic
838bab409e Updated Upstream (CraftBukkit) (#10646)
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

CraftBukkit Changes:
66fd94322 SPIGOT-7652: Remove remap for SPELL_MOB_AMBIENT which no longer exists
ecfa4f973 SPIGOT-7654: ItemStack#isSimilar does not work with empty BlockStateMeta
4460ecc49 SPIGOT-7655: ItemMeta#addItemFlags(ItemFlag.HIDE_ATTRIBUTES) not working when no attribute modifiers set
5d84f48a4 SPIGOT-7653: Update ApiVersion.CURRENT with latest version and include tests
2024-05-05 09:08:55 -07:00