Commit Graph

9324 Commits

Author SHA1 Message Date
e39cf893e7 Merge remote-tracking branch 'craftbukkit/for-clone' 2024-12-11 22:53:38 +01:00
0280fbb374 Disable deprecated annotation test 2024-12-03 15:33:45 +01:00
ca5499c7fa Switch Impl types to Holderable 2024-11-24 15:08:19 -08:00
ed6663d2b9 Expanded Art API 2024-11-23 18:08:13 +00:00
b9a4e9a745 API to allow/disallow tick sleeping 2024-11-12 22:25:35 +01:00
7c0d854ed3 API to check if the server is sleeping 2024-11-10 16:32:51 +01:00
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
14832a70e9 Optimise color distance check in MapPalette by removing floating point math 2024-06-29 12:04:48 +01:00
30b4dedabb DataComponent API
Exposes the data component logic used by vanilla ItemStack to API
consumers as a version-specific API.
The types and methods introduced by this patch do not follow the general
API deprecation contracts and will be adapted to each new minecraft
release without backwards compatibility measures.
2024-04-28 19:53:06 -04:00
Doc
65f5b7a4b7 Add AnvilView#bypassEnchantmentLevelRestriction
Anvils, by default, limit applied enchantment levels to their respective
maximum level. The added API enables plugins to disable this behaviour,
allowing enchantments that are overleveled to be applied via the anvil.
2024-10-06 16:45:20 -03:00
d300c94ec2 Properly resend entities
This resolves some issues which caused entities to not be resent correctly.
Entities that are interacted with need to be resent to the client, so we resend all the entity
data to the player whilst making sure not to clear dirty entries from the tracker. This makes
sure that values will be correctly updated to other players.

This also adds utilities to aid in further preventing entity desyncs.

This also also fixes the bug causing cancelling PlayerInteractEvent to cause items to continue
to be used despite being cancelled on the server.

For example, items being consumed but never finishing, shields being put up, etc.
The underlying issue of this is that the client modifies their synced data values,
and so we have to (forcibly) resend them in order for the client to reset their using item state.

See: https://github.com/PaperMC/Paper/pull/1896

== AT ==
public net.minecraft.server.level.ChunkMap$TrackedEntity serverEntity
2022-12-07 17:25:19 -05:00
ea24e2c6aa Fix incorrect command serialization by creating new Command
Fixes #11649 - As noted in the issue, when CommandNodes are serialized
they are used as the key in a Map. Their equals()/hashcode() should only
match if they are equal nodes (name & command), but due to the erasure of the command field pre-serialization, nodes with different commands can be mapped onto the same value. This causes the client to interpret both nodes as the same, causing suggestions where they should not.

This is fixed by creating a different no-op command for the
erasure, instead of them holding the same lambda.
2024-11-26 20:45:52 +01:00
2837612191 Fix Player.setPlayerListOrder to send update to clients 2024-12-10 15:45:47 +01:00
24f63384b2 Expand scoreboard tag count validation to API set 2024-10-21 01:41:04 +02:00
25c25923e9 DataComponent API
Exposes the data component logic used by vanilla ItemStack to API
consumers as a version-specific API.
The types and methods introduced by this patch do not follow the general
API deprecation contracts and will be adapted to each new minecraft
release without backwards compatibility measures.

== AT ==
public net/minecraft/world/item/component/ItemContainerContents MAX_SIZE
public net/minecraft/world/item/component/ItemContainerContents items
2024-04-28 19:53:01 -04:00
2a20fde332 Add feature patch hook for overrides 2024-12-05 13:00:22 +01:00
193eebecdf Tag Lifecycle Events
== AT ==
public net/minecraft/tags/TagEntry id
public net/minecraft/tags/TagEntry tag
public net/minecraft/tags/TagEntry required
2024-06-20 09:40:57 -07:00
45d04f9749 Add registry entry and builders 2024-06-13 23:45:32 +02:00
a1b891dd88 Registry Modification API
== AT ==
public net.minecraft.core.MappedRegistry validateWrite(Lnet/minecraft/resources/ResourceKey;)V
public net.minecraft.resources.RegistryOps lookupProvider
public net.minecraft.resources.RegistryOps$HolderLookupAdapter
2023-02-27 18:28:39 -08:00
463f952cd4 Only attempt to find spawn position if there isn't a fixed spawn position set 2024-11-28 15:20:25 -03:00
4bae091802 Expanded Art API 2024-11-23 18:58:49 +00:00
b2d8133382 Configurable Entity Despawn Time 2024-09-30 09:50:55 -07:00
7294ae3022 API to allow/disallow tick sleeping 2024-11-12 22:25:20 +01:00
b4c394a1c6 API to check if the server is sleeping 2024-11-10 16:32:34 +01:00
7b83e91bb7 Fix NPE when EntityResurrectEvent is uncancelled 2024-11-18 20:27:58 +01:00
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
318f7b2014 Reduce work done in CraftMapCanvas.drawImage by limiting size of image and using System.arraycopy instead of for loops and use bitwise operations to do bounds checks. 2024-06-29 12:06:51 +01:00
9467a08b36 Improve performance of RecipeMap#removeRecipe 2024-10-31 20:36:41 -07:00
7acf73ce66 Call CraftPlayer#onEntityRemove for all online players 2024-11-09 22:27:58 +01:00
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
b620df8e20 Fix inconsistencies in dispense events regarding stack size
The javadocs for BlockDispenseEvent suggest the ItemStack is a single
item which is being dispensed. Before this fix, sometimes it was the whole
stack before a single item had been taken. This fixes that so the stack size
is always 1.
2022-12-11 23:47:22 -08:00
6dfba7e0c7 Add Offline PDC API 2022-07-09 17:17:04 +02:00
11f0f5a80a Void damage configuration API 2024-09-25 04:43:26 -04:00
2f8f0f1f81 Add PlayerInsertLecternBookEvent 2020-08-29 21:55:41 +02:00
7b11ab058b Add recipeBrewTime 2024-09-20 17:39:22 +02:00
4cd3060ff8 Improve entity effect API 2024-09-27 17:12:50 -07:00
4a86a6e4ee Add enchantWithLevels with enchantment registry set 2024-09-25 16:26:04 +03:00
4fb38d1c36 create TileStateInventoryHolder
a missing interface to centralize getSnapshotInventory methods
2024-09-20 21:40:23 -07:00
cd6fb23fab Item serialization as json 2024-08-11 03:01:52 +03:00
e05d628610 Tag Lifecycle Events 2024-06-20 09:40:53 -07:00
0f47ed5252 Add FeatureFlag API 2023-03-09 11:24:43 -08:00
3fc7f9269a Deprecate for removal all OldEnum-related methods 2024-09-07 11:14:31 -07:00
c3bccfb1d6 Add enchantment seed update API 2024-08-17 13:02:56 +01:00
4641e233e7 Leashable API 2024-06-22 21:11:58 +02:00
d4da32994f Add even more Enchantment API
In a separate patch because it uses RegistryKeySet which
is after the previous "more enchant api" patch.
2024-07-19 08:43:01 -07:00
8769723fb3 Improve StandardMessenger exception messages 2024-08-12 18:38:19 +02:00
f14d6e62da Add an API for CanPlaceOn and CanDestroy NBT values 2018-09-12 18:53:35 +03:00
5dc2ca5b62 Fix PickupStatus getting reset 2024-07-23 18:37:12 +02:00
e8e8c4f7c2 add Plugin#getDataPath 2024-07-15 02:07:49 +00:00
7507d0f1ef Fix HelpCommand searching
Prevent index out of bounds exception when finding possible matches in
the help topics.
A general empty string is caught and directed to the defaultTopic by
getHelpTopic(). #findPossibleMatches hence should not concern itself
with possible empty strings anymore.
2024-07-13 18:00:37 +02:00