Commit Graph
100 Commits
Author SHA1 Message Date
Bjarne KollandGitHub 7d5695d774 Improve ItemMeta#hasCustomModelData compatibility (#12414)
Ports the follow commits from spigot to paper.
All credits to go the respective commit authors listed below.

Bukkit: 47480cd07c0957a94b220f3087b851594b063e54
CraftBukkit: c6c8165aa0d5679b9b015b209c1645a222f8c3a6
CraftBukkit: d275d3b96e041f6421f3bb7de1e6022ea8be5456

By: md_5 <git@md-5.net>
By: Doc <nachito94@msn.com>
2025-04-14 13:23:39 +02:00
Bjarne Koll 8f62e0fb31 Correctly order getArmorContents
Mojangs EQUIPMENT_SLOT_MAPPING uses an Int2ObjectArrayMap and hence
technically does provide iteration stability, however it is filled from
a MapN, which destroys the well order of the entries.
To iterate from smallest to largest inventory index correctly, this
commit introduces a sorted array based on the EQUIPMENT_SLOT_MAPPING.
2025-04-13 11:41:59 +02:00
Bjarne KollandGitHub 0cf731589a Bump to adventure 4.20.0 (#12391)
* Update adventure to 4.19.0

The update only includes a new configuration for MiniMessage,
specifically one to prevent it from emitting virtual components.
As virtual components break the generated component tree, items quickly
become unstackable with items generated before adventure 4.18.

Plugin developers may construct their own mini message instance which
will emit virtual components if they so choose.

* Bump to adventure 4.20.0
2025-04-07 13:29:57 +02:00
Bjarne Koll e5d988df85 Revert "Fix cancelling PlayerInteractEvent at (0, 0, 0) (#12215)"
This reverts commit a2b0ff0644.
2025-03-09 18:39:08 +01:00
Bjarne KollandGitHub 9be4e07a3e Pin snapshot dependencies (#12185)
Additionally pins configurate-core as a transitive dependency of
configurate-yml, as the yaml snapshot depends on a snapshot itself.
2025-02-25 21:44:42 +01:00
Bjarne Koll 7b4d44f573 Revert "Always pass event block to damage source (#12158)"
This reverts commit ab984a0711.

The block damage is null *and has been* null in cases where the block
has already been cleared. Consumers are supposed to use the
getDamagerBlockState instead.
2025-02-21 11:52:04 +01:00
Bjarne KollandGitHub ab984a0711 Always pass event block to damage source (#12158)
Always passes the respective block to a damage source when passing a
block state. While we could technically use the damageSourcePosition
here by, we'd have to translate it back to a block position by
subtracting .5 from all its components.
Such behaviour however relies on the caller logic's mutation of the
damageSourcePosition and will break once this position is not the centre
of the block.

Passing in the block at the specific callsite is a lot more future
proof.
2025-02-20 20:22:46 +01:00
Bjarne KollandGitHub 142695eb00 Default minecraft alias to redirect (#12146)
While the running server will still be using the recently introduced
copy-mechanic for vanilla command namespacing, the data converter logic
relies on the fact that namespaced aliases were redirects as well.

To not break the converted, the commands type now takes a modern flag
only set by the running server.
2025-02-18 00:09:54 +01:00
Bjarne KollandGitHub 3b9106c7d1 Readd dead redirect recovery (#12136)
While the paper command system no longer uses redirects for namespaced
registration, vanilla still does. This means that removal of vanilla
redirecting target nodes still causes issues, e.g. the removal of the
vanilla 'msg' node in favour of a command alias one.
Redirecting nodes like tell, minecraft:msg and minecraft:tell are broken
by this and need to by flattened before sending them to the client.
2025-02-17 23:51:52 +01:00
Bjarne KollandGitHub edacfdf462 Do not queue player info packets (#12080)
Player info packets carry chat state to other clients since the
introduction of chat signatures. Queuing these packets while force
pushing chat packets allows for potentially inverted packet order, which
may cause chain corruption on clients.
2025-02-09 11:51:11 +01:00
Bjarne KollandGitHub 6b7650d81b Only add goat horn once (#12001) 2025-01-22 18:20:24 +01:00
Bjarne KollandGitHub 209e5f8580 Readd dropped hunk for ender dragon fight data (#11975)
Dragon fight data should be read from the now split world instead of the
main world level.dat.
Partial hunk was dropped during hardfork.
2025-01-14 19:03:30 +01:00
Bjarne KollandGitHub eeec611b9d Fix zombie villager infection chance hunk (#11974)
Dropped during hardfork, now moved to a false-ed out if statement to
prevent dropping in future updates.
2025-01-14 17:15:47 +01:00
1bb3677651 Remove deprecation from EntityRemoveEvent (#11961)
Bukkits entity remove event is called at a different time than the
existing paper event, specifically it is called after an entity has been
stored during chunk unloads.

This means that, while the bukkit event can have a defined reason, it
does not allow modification to the entity data. In this regard it
differs from the paper implementation and prevents developers from using
the paper event as an alternative.

Co-authored-by: TonytheMacaroni <tonythemacaroni123@gmail.com>
2025-01-13 17:51:58 +01:00
Bjarne KollandGitHub e5542cfdc3 Hide unnecessary decorated pot data (#11957)
Prevent decorated pots from sending their contents to clients as
contents are not needed for rendering.
2025-01-12 17:49:49 +01:00
Bjarne KollandGitHub 1b38f2810e Fix reading recipes used on furnace (#11947) 2025-01-10 19:49:58 +01:00
Bjarne KollandGitHub 400717174e Correct obfuscation of oversized items (#11944) 2025-01-10 14:38:50 +01:00
Bjarne Koll 887f3f74d1 [ci skip] Replace FQN with import in EventExecutor 2024-12-29 00:34:45 +01:00
Bjarne KollandGitHub dac977a106 Correctly force particles (#11850) 2024-12-28 16:42:11 +01:00
Bjarne KollandGitHub e0abc5f85d Do not spawn fire for visual lightning (#11845) 2024-12-28 14:58:22 +01:00
Bjarne Koll 33411ec0a1 Properly remove UnsafeValues#getDamageEffect 2024-12-28 00:21:27 +01:00
Bjarne KollandGitHub e10dcbf7ca [ci skip] Improve build workflow conditions (#11842)
The goal of the build workflow is split into multiple requirements.
  1. Run on pushes to same repo.
  2. Run on PR open/reopen/syncs from repos that are not the same
     (PRs from the same repo are covered by 1)
  3. Run on labeled PRs that have the build-pr-jar flag.
2024-12-27 22:43:08 +01:00
Bjarne KollandGitHub 321d17cc8c [ci skip] Only build PRs on correct label (#11811) 2024-12-24 22:58:10 +01:00
Bjarne KollandGitHub b8a0541ccf Fix 0 parameter in Player#applyMending (#11802)
Prevent division by zero in Player#applyMending by simply using zero
instead if the divider itself is zero.
This matches vanilla behaviour in the sense that
ExperienceOrb#repairPlayerItems, which this logic is lifted from, does
pass zero to the enchantment helper and runs its first iteration on
repairing. Vanilla is not affected as the computation failing with zero
is used to compute the leftover exp value, which is not needed if zero
itself is passed in.
As the paper impl however exposes said value to the initial event, our
code needs to account for the zero division.
2024-12-24 10:58:58 +01:00
Bjarne KollandGitHub 17d76ae42b Correctly die when cancelling EntityResurrectEvent (#11785)
The existing logic in LivingEntity#checkTotemDeathProtection completes
by checking whether the death protection component is null or not.
In cases where the event was cancelled, the component needs to be nulled
out to prevent the method from returning true, causing the player to
properly die.
2024-12-23 19:38:10 +01:00
Bjarne KollandGitHub f8bf600375 Fix potion effect type removal (#11778)
An incorrectly updated hunk attempted to remove the MobEffectInstance
from the active effect map instead of the Holder<MobEffect> as the
parameter name was changed from holder to effect during hardfork.
2024-12-23 04:51:58 +01:00
Bjarne Koll 286e3468d7 Some more cleanup 2024-12-21 16:03:34 +01:00
Bjarne Koll fd1b6b1ae9 Readd configurable auth server down kick message 2024-12-20 03:07:59 +01:00
Bjarne Koll 68bbd2e202 Improve diff in ServerPlayer#openHorseInventory 2024-12-20 03:07:58 +01:00
Bjarne Koll 993db46961 Comment typo 2024-12-20 03:07:58 +01:00
Bjarne Koll 431303ff40 Move ChunkMap setServerViewDistance to ATs 2024-12-20 03:07:58 +01:00
Bjarne Koll 88b2981e09 Readd final mod to ChunkHolder#getTickingChunk 2024-12-17 20:32:08 +01:00
Bjarne Koll 35afd218f5 net/minecraft/server/level 2024-12-15 06:22:17 +01:00
Bjarne Koll dde17defa5 net/minecraft/world/entity/vehicle 2024-12-14 17:17:22 +01:00
Bjarne Koll 216f3118ae net/minecraft/world/level/block/entity/trialspawner 2024-12-14 17:17:22 +01:00
Bjarne Koll afa25753de Fix compile issue in MinecraftServer 2024-12-14 05:48:25 +01:00
Bjarne Koll f25c1a33a0 Finish block entity 2024-12-14 05:45:11 +01:00
Bjarne Koll 4091c6ac4d Follow up on block entities 2024-12-13 20:17:16 +01:00
Bjarne Koll e0fae5ef02 Part of block entities 2024-12-13 20:11:23 +01:00
Bjarne Koll ee51737be6 More work 2024-12-13 17:24:35 +01:00
Bjarne Koll 92ef45d166 First attempt 2024-12-13 17:14:25 +01:00
Bjarne Koll 881d616533 Updated Upstream (Bukkit/CraftBukkit/Spigot) (#11702)
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:
ed0ec489 SPIGOT-7965: Unknown TransformReason for Hoglins
9db03457 SPIGOT-7964: Fix typo in Deprecation annotation
d14119af PR-1082: Add "since" to Deprecation annotations
e8a318d4 PR-1067: Add method to get Advancement requirements

CraftBukkit Changes:
40dd796db SPIGOT-7971: NotSerializableException on serialize CraftUseCooldownComponent
fa85c5e0a SPIGOT-7968: ProjectileHitEvent not trigerred when arrow hits entity
b75b792ec SPIGOT-7970: World#getMaxHeight() returning incorrect value
2b9a094bb SPIGOT-7965: Unknown TransformReason for Hoglins
fd3f5a380 SPIGOT-7966: Some trees do not generate with #generateTree
f2822317c PR-1515: Add a Class reader and Class node argument provider
07abf6852 PR-1514: Add a test case for ClassTraverser
a7577cb24 Fix Inventory#addItem not respecting max stack size
066a74e74 PR-1490: Add method to get Advancement requirements
4a1df30e4 PR-1512: Test Art class based on specific values instead of the implementation, to better catch implementation changes
53254c56f PR-1503: Simplify CAS loop to getAndSet
e9447dc5e Make BlockDataMeta#setBlockData hide unspecified states
dd08a7120 SPIGOT-7960: Fix inconsistency between natural item drop coordinates
e9e8ed753 SPIGOT-7960: Improve natural item drop methods

Spigot Changes:
60c9969b Rebuild patches
2024-12-03 15:47:48 +01:00
Bjarne Koll bbe32f42f0 Call ProjectileHitEvent for entity hits (#11652)
A simple bugfix replacing a new vanilla call to
Projectile#hitTargetOrDeflectSelf with the bukkit replacement to call
the event.
2024-11-23 23:13:10 +01:00
Bjarne Koll 34989c63b0 Correctly damage tick wolf after armor block (#11653)
Spigot incorrectly returns false in Wolf#actuallyHurt if the armor
absorbed the damage causing the entity to not get damage invuln ticks.
Resolve this by correctly reverting to the "always true" return value as
the event is not cancelled.
2024-11-23 23:05:54 +01:00
Bjarne Koll a8904bbf98 [ci skip] Rebuild patches 2024-11-19 09:59:20 +01:00
Bjarne Koll b2cf880b79 [ci skip] Rebuild patches 2024-11-15 09:41:04 +01:00
Bjarne Koll a47a008ce1 Fix incorrect invulnerability damage reduction
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-11 21:35:22 +01:00
Bjarne Koll 75993b6fb4 [ci skip] Rebuild patches 2024-11-03 00:37:14 +01:00
Bjarne Koll 966c80c18f Update material tags and entity effect 2024-10-27 12:20:17 +01:00
Bjarne Koll a02a757a57 Fix crafting (and server icon) 2024-10-25 22:33:37 +02:00
Bjarne Koll 4903e806c3 Test compile fixes 2024-10-25 19:15:40 +02:00
Bjarne Koll d333b32d4f Compiler issue v5 2024-10-25 18:08:28 +02:00
Bjarne Koll f3f59e196d Compiler issues v4 2024-10-25 17:08:48 +02:00
Bjarne Koll 319032e137 Compiler issues v3 2024-10-25 14:55:49 +02:00
Bjarne Koll c6a0ad379d Compiler issues v2 2024-10-25 13:52:04 +02:00
Bjarne Koll cc0308bf1d Some more compile issues 2024-10-25 13:34:01 +02:00
Bjarne Koll 4c984f6e46 Compile issues 1 2024-10-25 13:19:23 +02:00
Bjarne Koll f37c1be91e Work on compile errors 2024-10-25 12:30:19 +02:00
Bjarne Koll a040040900 1037 2024-10-25 12:28:34 +02:00
Bjarne Koll 27f4fa04e6 Wrong attempt at Tag lifecycle 2024-10-25 12:06:49 +02:00
Bjarne Koll 42e181498c 1020 2024-10-25 00:08:35 +02:00
Bjarne Koll 6ca02ef090 1000 2024-10-24 23:03:27 +02:00
Bjarne Koll c8414e5d1d Update work 989 2024-10-24 22:29:29 +02:00
Bjarne Koll ff6f80cbff Upstream update 2024-10-24 19:29:35 +02:00
Bjarne Koll e7c58ce74f 963 2024-10-24 17:16:31 +02:00
Bjarne Koll 3a9a8b1d29 Readd wrongly removed diff 2024-10-24 16:31:09 +02:00
Bjarne Koll 199ab95b0d Patch me this, patch me that 2024-10-24 12:11:32 +02:00
Bjarne Koll 951043246e Patches, patches, patches 2024-10-24 10:42:29 +02:00
Bjarne Koll c9e7a34e4b Work work work work 2024-10-23 20:50:46 +02:00
Bjarne Koll 592816683c 553 2024-10-23 20:15:25 +02:00
Bjarne Koll 0a91b13eb3 503 2024-10-23 19:46:06 +02:00
Bjarne Koll 0047482c6f Some more work 2024-10-23 17:58:11 +02:00
Bjarne Koll 986b61757e 440 2024-10-23 17:13:43 +02:00
Bjarne Koll 49575a0657 400 2024-10-23 16:55:24 +02:00
Bjarne Koll 078eb7f455 298 2024-10-23 15:02:51 +02:00
Bjarne Koll c2e37b8c98 Skip Improve-exact-choice-recipe-ingredients for now 2024-10-23 14:12:17 +02:00
Bjarne Koll 292fb8b8e7 Fluid Flowing ifLoaded patch 2024-10-23 13:13:00 +02:00
Bjarne Koll de0ed829eb 242 2024-10-23 12:32:08 +02:00
Bjarne Koll 5a3a8af328 Update projectile launch to 1.21.2 2024-10-23 12:02:36 +02:00
Bjarne Koll 25c384ac38 Breakpoint before projectile mess 2024-10-23 11:04:00 +02:00
Bjarne Koll 38e1465620 Work work work 2024-10-23 00:02:50 +02:00
Bjarne Koll 149a25fb83 Work it 2024-10-22 23:30:51 +02:00
Bjarne Koll 2e66bc9719 More work? 2024-10-22 22:38:26 +02:00
Bjarne Koll 649ade0d96 Some work 2024-10-22 22:00:33 +02: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
Bjarne Koll 3753d8b292 De-deprecate BlockData#getDestroySpeed 2024-06-16 12:44:22 +02: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 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
Bjarne Koll 22595ec4c0 Revert DamageSource#getCausingEntity to vanilla 2024-06-15 18:39:55 +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
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
Bjarne Koll e0f5e2a1d5 538 2024-06-14 00:44:26 +02:00
Bjarne Koll d0743357eb Missing FQN in CraftPotionBrewer getter 2024-04-25 19:45:17 +02:00