Commit Graph

1126 Commits

Author SHA1 Message Date
Lulu13022002
a06179a018 Update entity effect (#12104) 2025-02-12 23:14:07 +01:00
Tamion
072a8317b2 Add proper attached blocks API to AbstractArrow (#12099) 2025-02-12 23:13:07 +01:00
Spottedleaf
e2f0efd1af Remove nms.Entity#isChunkLoaded
This method was used pre 1.17 era where an Entity was explicitly
tied to a (then called) Chunk's entity slices. If an entity
was not inside a Chunk, then it was considered invalid as
it was not possible to save the entity.

In 1.17+, entities are now tied to a separately tracked entity
section management system. This system is far more reliable now
as it no longer requires a full chunk load to properly track
entities for saving. As a result, an Entity if inside the world
is always attached to some entity chunk section (except in rare
cases in Vanilla which are fixed in Moonrise).

As a result, whether the chunk the entity is in is loaded is no
longer an indication of whether they are tracked in the world
and we can reliably infer that the entity is correctly in the
world through the valid field alone.

Additionally drop the isInWorld() check, as valid=true implies
isInWorld=true. More importantly, the isInWorld() check invokes
getHandle which may trip a thread check on Folia. This will fix
World#getEntities() and friends exploding on Folia.

However, World#getEntities() on Folia still cannot reliably return
all entities in the world as actions such as cross-region
(not cross-world) teleporting will remove entities from the world.
2025-01-28 17:33:48 -08:00
masmc05
3af5e77132 Add Player#give (#11995) 2025-01-26 21:19:00 +01:00
Warrior
ce95b5d653 Use proper default for setting null display background color (#12010) 2025-01-25 21:33:47 +01:00
Creeam
336ea9dfeb Check for empty when sending equipment changes (#12008) 2025-01-25 20:04:47 +01:00
TomTom
30046e0410 Fix a rare crash with a concurrent modification of scaled health attributes (#12002) 2025-01-22 18:58:44 +00:00
Nassim Jahnke
cd9d6d6998 Allow duplicate relative flags in entity teleport
Fixes #11976
2025-01-15 12:13:58 +01:00
Lulu13022002
2ea6aee343 Deprecate Turtle#isDigging (#11959) 2025-01-12 12:49:25 -08:00
masmc05
08ac057fda Rename getPotentialBedLocation to getPotentialRespawnLocation (#11950) 2025-01-12 02:17:46 +01:00
Miles
c94922514a MenuType API addition InventoryView Builders (#11816) 2025-01-11 20:21:24 +01:00
Jake Potrebic
ac3aaa248b Don't use delayed registries in impl anywhere (#11918) 2025-01-11 20:02:28 +01:00
Shane Bee
4106da712c Fix retain passengers teleport flag (#11858) 2025-01-04 21:19:07 +01:00
Hannes Greule
287eb52fa4 Use hidden classes for event executors (#11848)
Static final MethodHandles perform similar to direct calls. Additionally,
hidden classes simplify logic around ClassLoaders as they can be defined
weakly coupled to their defining class loader. All variants of methods
(static, private, non-void) can be covered by this mechanism.
2024-12-29 00:11:09 +01:00
Strokkur24
93a3df085c Extend HumanEntity#dropItem API (#11810) 2024-12-28 23:47:21 +01:00
Bjarne Koll
dac977a106 Correctly force particles (#11850) 2024-12-28 16:42:11 +01:00
Jake Potrebic
0629524cb2 Directly build Art (#11813) 2024-12-27 16:07:48 -08:00
SoSeDiK
aac246ae29 Expand on entity serialization API (#11807) 2024-12-27 00:08:00 +01:00
Pedro
d568e175ee Port basic lookAt methods from Player to Entity (#11775) 2024-12-24 23:00:07 +01:00
Bjarne Koll
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
Lulu13022002
051ab9117a fix more diff 2024-12-20 23:39:43 +01:00
Spottedleaf
48f34f8c90 Port CB changes from Moonrise patch 2024-12-20 10:52:51 -08:00
Spottedleaf
6186079231 Migrate ChunkSystem class to PaperHooks 2024-12-20 09:22:42 -08:00
Lulu13022002
5922e6334b fix allowPermanentBlockBreakExploits config 2024-12-18 23:35:47 +01:00
Lulu13022002
6126012369 readd beacon effect cause 2024-12-18 19:29:39 +01:00
Nassim Jahnke
a15bb2bbd0 Fix and clean up MapItemSavedData Spigot patch
It's been dysfunctional for a good while, though I don't think it's even needed. That can be investigated later
2024-12-16 09:56:45 +01:00
Jake Potrebic
4cc2be301d it compiles? 2024-12-15 14:36:05 -08:00
Jake Potrebic
cb51a4fbcd more compile fixes 2024-12-15 14:12:59 -08:00
Lulu13022002
ec57b99bf5 readd removal cause for thrown eggs 2024-12-15 23:07:15 +01:00
Nassim Jahnke
6dcb4a33b6 Fix some compilation errors 2024-12-15 21:28:08 +01:00
Owen1212055
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
96DarkCode96
2837612191 Fix Player.setPlayerListOrder to send update to clients 2024-12-10 15:45:47 +01:00
Nassim Jahnke
2a20fde332 Add feature patch hook for overrides 2024-12-05 13:00:22 +01:00
Flo0
35f6f25e78 API for checking sent chunks 2024-04-08 16:43:16 +02:00
Jake Potrebic
cea3e6b65b Improve entity effect API 2024-09-27 17:13:16 -07:00
Lulu13022002
52acc18e4f Leashable API 2024-06-22 21:17:54 +02:00
Tamion
92fa922afd Fix PickupStatus getting reset 2024-07-21 19:11:22 +02:00
Jake Potrebic
471be1b4da fix horse inventories
Horse inventories now combine 2 inventories (like
result inventories).

== AT ==
public net/minecraft/world/inventory/HorseInventoryMenu SLOT_BODY_ARMOR
2024-07-06 13:57:10 -07:00
Owen1212055
84d07ca942 Suspicious Effect Entry API
Exposes a new suspicious effect entry type that properly represents
storable effects in the context of suspicious effects as they only
define the potion effect type and duration.

This differentiates them from the existing PotionEffect API found in
bukkit and hence clarifies that storable values in the parts of the API
in which it replaces PotionEffect.

Co-authored-by: Yannick Lamprecht <yannicklamprecht@live.de>
2024-03-03 19:43:40 +01:00
Jake Potrebic
e1b7819229 Fix equipment slot and group API
Adds the following:
- Add test for EquipmentSlotGroup
- Expose LivingEntity#canUseSlot

Co-authored-by: SoSeDiK <mrsosedik@gmail.com>
2024-05-22 10:01:19 -07:00
nostalfinals
445e9a65fb Added API to get player ha proxy address 2024-04-08 23:24:38 +08:00
Nassim Jahnke
898bf90054 Fixup NamespacedKey handling 2024-01-06 14:31:00 +01:00
Lukas Planz
57894618cf Add experience points API 2023-09-05 20:34:20 +02:00
booky10
4853ebd729 Fix missing event call for entity teleport API 2023-11-12 05:09:47 +01:00
Tamion
cb16d3df2c Fix strikeLightningEffect powers lightning rods and clears copper 2023-09-30 12:36:14 +02:00
David Scandurra
d1685ef68f Allow null itemstack for Player#sendEquipmentChange 2023-10-25 20:36:25 +02:00
booky10
2b6b81bde9 Add player idle duration API
Implements API for getting and resetting a player's idle duration.
2023-10-14 03:11:11 +02:00
booky10
efc4457fa1 Update entity data when attaching firework to entity
== AT ==
public net.minecraft.world.entity.projectile.FireworkRocketEntity DATA_ATTACHED_TO_TARGET
2023-08-27 16:11:31 +02:00
Jake Potrebic
d300049246 Add titleOverride to InventoryOpenEvent 2022-03-04 12:45:03 -08:00
Aeltumn
1fc4ca9178 Implement OfflinePlayer#isConnected 2023-08-24 13:05:30 +02:00