Commit Graph
91 Commits
Author SHA1 Message Date
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
Bjarne Koll d6adc0b264 Some more compilation fixes 2024-04-25 19:42:24 +02:00
Bjarne Koll b7e5de9401 Update Enchantment damage increase API
The Enchantment damage increase API added previously used the
EntityCategory enum as a parameter. These values are now however
determined by tags instead of the categories themselves.

Deprecated the outdated api method, create a new overload that takes
EntityType instead and implement deprecated method by guessing an entity
type from the builtin registry based on the category passed.
This method allows
a) the tags to still be modified and the legacy
   method still respecting such.
b) potential cursed implementations of enchantments of plugins to not
   break that override the getDamageBonus method on Enchantment.
2024-04-25 18:42:50 +02:00
Bjarne Koll d7874011e2 Make things explodes via patches 2023-12-06 18:33:52 +01:00
Bjarne Koll c730cdcecf Fix custom potion mixes patch 2023-12-06 17:39:37 +01:00
Bjarne Koll 414d8a9efe More work work work work work work work work work 2023-09-22 16:42:56 +02:00
Bjarne Koll d2b6bfa507 Work here, work there, work for everyone 2023-09-22 16:35:40 +02:00
Bjarne Koll dff4f6bdd5 Working hard on messing with leafs patches 2023-09-22 16:20:09 +02:00
Bjarne Koll 7f8ad55e87 More work 2023-09-22 15:47:26 +02:00
Bjarne Koll 0c48ad35ee More work work work 2023-09-22 15:32:32 +02:00
Bjarne Koll c3c850f4fc Fix PaperAdvancementDisplay 2023-09-22 15:19:33 +02:00
Bjarne Koll f865f927a0 More more more (more ??) more work 2023-09-22 15:15:57 +02:00
Bjarne Koll 42b9f5a66d Port sidebar slots patch 2023-09-22 14:33:54 +02:00
Bjarne Koll b5c4a402ee More work work work 2023-09-22 14:22:24 +02:00
Bjarne Koll 2578e385d9 Missing paper comment 2023-09-22 13:42:04 +02:00
Bjarne Koll 1d8c69ef63 Fix leave message in common packet listener 2023-09-22 13:39:00 +02:00
Bjarne Koll 37b58b3df7 Drop manual isEditable copy in CraftSign
Signs no longer have a specific isEdiable state, the entire API in this
regard needs updating/deprecation. The boolean field is completely gone,
replaced by a uuid (which will need a new setEditingPlayer(UUID) method
on the Sign interface), and the current upstream implementation of
setEdiable simply flips the is_waxed state.

This patch is hence not needed as it neither allows editing (which will
be redone in a later patch) nor is required to copy the is_waxed boolean
flag as it lives in the signs compound tag and is covered by applyTo.
2023-06-08 11:35:39 +02:00
Bjarne Koll ff68512997 Update fluid chunk loading patch 2023-06-08 11:18:51 +02:00
Bjarne Koll 53f112de49 Minimize strict-advancement-dimension-checks.patch 2023-06-08 10:53:00 +02:00
Bjarne Koll 45d04f9749 Add registry entry and builders 2024-06-13 23:45:32 +02:00
Bjarne Koll c7c3d8a9cb 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:27 +01:00
Bjarne Koll 66e1ce8504 Correct update cursor
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 14:58:57 +01:00
Bjarne Koll 64e1a54657 Remove streams from SensorNearest
The behavioural nearby sensors are validated every tick on the entities
that registered the respective sensors and are therefore a good subject
to performance improvements.

More specifically this commit replaces the Stream#filter usage with
ArrayList#removeIf as the removeIf method on an array list is heavily
optimized towards a single internal array re-allocation without any
further overhead on the removeIf call.

The only negative of this change is the rather agressive diff these
patches introduce as the methods are basically being reimplemented
compared to the previous stream-based implementation.

See: https://nipafx.dev/java-stream-performance/
Note: Updated LICENCE.md to release this commit under MIT
2021-03-03 03:52:43 +01:00
Bjarne Kollandkokiriglade fcc777a0a8 Introduce registry entry and builders
Co-authored-by: kokiriglade <git@kokirigla.de>
2024-06-13 22:35:05 +02:00
Bjarne Koll c8efaa46cb Remove wall-time / unused skip tick protection
Spigot still maintains some partial implementation of "tick skipping", a
practice in which the MinecraftServer.currentTick field is updated not
by an increment of one per actual tick, but instead set to
System.currentTimeMillis() / 50. This behaviour means that the tracked
tick may "skip" a tick value in case a previous tick took more than the
expected 50ms.

To compensate for this in important paths, spigot/craftbukkit
implements "wall-time". Instead of incrementing/decrementing ticks on
block entities/entities by one for each call to their tick() method,
they instead increment/decrement important values, like
an ItemEntity's age or pickupDelay, by the difference of
`currentTick - lastTick`, where `lastTick` is the value of
`currentTick` during the last tick() call.

These "fixes" however do not play nicely with minecraft's simulation
distance as entities/block entities implementing the above behaviour
would "catch up" their values when moving from a non-ticking chunk to a
ticking one as their `lastTick` value remains stuck on the last tick in
a ticking chunk and hence lead to a large "catch up" once ticked again.

Paper completely removes the "tick skipping" behaviour (See patch
"Further-improve-server-tick-loop"), making the above precautions
completely unnecessary, which also rids paper of the previous described
incompatibility with non-ticking chunks.
2024-09-16 23:07:29 +02:00
Bjarne Koll 7b21e8c8d9 Only call EntityDamageEvents before actuallyHurt
The recent upstream update moved around the event logic for
EntiyDamageEvent and its derivatives.
However, the event was called on every call to #hurt as it was moved out
of actuallyHurt.

This patch moves the invocation directly before the #actuallyHurt calls,
respective invulnerable timings.
2024-07-08 22:01:08 +02:00
Bjarne Koll c05db66ee6 Configurable damage tick when blocking with shield 2024-06-13 17:16:01 +02:00
Bjarne Koll 99cd3b6813 Adopt MaterialRerouting
Adopts the paper-api to the material rerouting infrastructure introduced
by upstream.
2024-06-13 11:02:36 +02:00
Bjarne Koll c90fc43eb8 Only erase allay memory on non-item targets
Spigot incorrectly instanceOf checks the EntityTargetEvent#getTarget
against the internal ItemEntity type and removes the nearest wanted item
memory if said instanceOf check fails, (which is always the case)
causing allays to behave differently as they constantly lose their
target item.

This commit fixes the faulty behaviour by instance performing a check
against the CraftItem type.
2023-08-04 15:53:36 +02:00
Bjarne Koll d648e75653 Correctly shrink items during EntityResurrectEvent
The EntityResurrectEvent logic is supposed to locate a totem of undying
in any of the interaction slots of the player inventory and then, if the
called EntityResurrectEvent is not cancelled, shrink that item by 1,
usually reducing it to zero.

For this, the logic iterates over the items in the interaction slots and
breaks out the loop if a totem of undying was found.
However, even if no totem of undying was found, the iteration item stack
variable remains as a refernce to the last interaction slot probed.

Plugins uncancelling a EntityResurrectEvent, which is published
pre-cancelled to listeners if no totem of undying could be found,
would hence cause the server logic to shrink completely unrelated items
found in, at the writing of this patch, the players off hand slot.

This patch corrects this behaviour by only shrinking the item if a totem
of undying was found and the event was called uncancelled.
2023-01-10 21:06:42 +01:00
Bjarne Koll 83a6307788 Fix setPatternColor on tropical fish bucket meta
Prior to this commit, the tropical fish bucket meta would set the body
color to the previous metas pattern colour when updating the pattern
colour.

This commit hence simply fixes this by using the proper body colour
value when updating the pattern color.
2021-11-06 23:15:20 +01:00