Commit Graph

75 Commits

Author SHA1 Message Date
4eda045b15 Backport fix for MC-296337 (Fixes #12617) (#12619) 2025-06-06 19:05:30 +01:00
cbcf75a57c Update visual fire handling with TriState support (#12303)
Replaced the Boolean-based visual fire system with TriState for improved clarity and flexibility, enabling three distinct states: TRUE, FALSE, and NOT_SET. Deprecated older methods in favor of new ones and updated internal handling to reflect these changes. Adjusted serialization and deserialization logic to accommodate the new TriState implementation.
2025-05-07 23:33:41 +02:00
5acfdd6af4 Fix save/load NaN Entity Motion (#12269) 2025-04-30 19:53:32 +02:00
f00727c57e 1.21.5
Co-authored-by: Bjarne Koll <git@lynxplay.dev>
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
Co-authored-by: Lulu13022002 <41980282+Lulu13022002@users.noreply.github.com>
Co-authored-by: MiniDigger | Martin <admin@minidigger.dev>
Co-authored-by: Nassim Jahnke <nassim@njahnke.dev>
Co-authored-by: Noah van der Aa <ndvdaa@gmail.com>
Co-authored-by: Owen1212055 <23108066+Owen1212055@users.noreply.github.com>
Co-authored-by: Shane Freeder <theboyetronic@gmail.com>
Co-authored-by: Spottedleaf <Spottedleaf@users.noreply.github.com>
Co-authored-by: Tamion <70228790+notTamion@users.noreply.github.com>
Co-authored-by: Warrior <50800980+Warriorrrr@users.noreply.github.com>
2025-04-12 17:27:00 +02:00
8de7e356fa Add null check to level ref in Entity constructor (#12218) 2025-03-03 17:46:20 +01:00
a3781ff3be Separate tick count to ensure vanilla parity (#12077) 2025-02-16 20:46:37 +01:00
7bee99714a Cleanup damage source a bit (#12106) 2025-02-16 20:14:00 +01:00
cb25c0cf31 [ci skip] Fix annotation fields used in NMS getBukkitEntity (#12120) 2025-02-16 19:17:26 +01:00
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
aac246ae29 Expand on entity serialization API (#11807) 2024-12-27 00:08:00 +01:00
3b0b3a0aef and some more 2024-12-21 13:45:04 +01:00
e0593e9286 More diff/changed variable name cleanup 2024-12-21 12:15:25 +01:00
2213ce5bbc fix enderpearl across portals 2024-12-20 21:22:58 +01:00
f3c1eb3dc0 More param name fixes 2024-12-20 12:45:19 +01:00
6126012369 readd beacon effect cause 2024-12-18 19:29:39 +01:00
972266605e Remove dead code, param renames in added methods 2024-12-17 22:04:50 +01:00
f8cb014d20 Move Aikar's EAR 1 into EAR 2 patch 2024-12-16 14:08:25 +01:00
8f1dcdd0b7 update restamp, add back entity ATs, rebuild patches 2024-12-15 22:39:52 +01:00
8cca65b8ac remove all the rest of the import hunks 2024-12-15 11:42:42 -08:00
03daab51f7 Entity class 2024-12-14 11:41:23 +01:00
45ddf764d9 Move patches to unapplied 2024-12-12 12:30:31 +01: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
24f63384b2 Expand scoreboard tag count validation to API set 2024-10-21 01:41:04 +02:00
b2d8133382 Configurable Entity Despawn Time 2024-09-30 09:50:55 -07:00
66e26ebe48 Void damage configuration API 2024-09-29 14:20:42 -07:00
d42ef390ea Fix DamageSource API
Uses the correct entity in the EntityDamageByEntity event
Returns the correct entity for API's DamageSource#getCausingEntity
2024-03-09 14:13:04 -08:00
ddbfcd4403 Restore vanilla entity drops behavior
Instead of just tracking the itemstacks, this tracks with it, the
action to take with that itemstack to apply the correct logic
on dropping the item instead of generalizing it for all dropped
items like CB does.
2022-03-22 09:34:41 -07:00
fff5d44a12 Don't fire sync events during worldgen
Fixes EntityPotionEffectEvent
Fixes EntityPoseChangeEvent

Asynchronous chunk generation provides an opportunity for things
to happen async that previously fired synchronous-only events. This
patch is for mitigating those issues by various methods.

Also fixes correctly marking/clearing the entity generation flag.
This patch sets the generation flag anytime an entity is created
via StructureTemplate before loading from NBT to catch uses of
the flag during the loading logic. This patch clears the generation
flag from an entity when added to a ServerLevel for the situation
where generation happened directly to a ServerLevel and the
entity still has the flag set.
2023-11-23 10:33:25 -08:00
7dcff24771 Fix slot desync
General patch fixing slot desyncs between the server and client that
result from cancelled events/paper introduced logic.

Co-authored-by: Minecrell <minecrell@minecrell.net>
Co-authored-by: Newwind <support@newwindserver.com>
2023-08-23 13:22:09 -07:00
1cb5b6e838 Expand Pose API 2023-01-11 20:59:01 +02:00
a13bff4a5f Folia scheduler and owned region API
Pulling Folia API to Paper is primarily intended for plugins
that want to target both Paper and Folia without unnecessary
compatibility layers.

Add both a location based scheduler, an entity based scheduler,
and a global region scheduler.

Owned region API may be useful for plugins which want to perform
operations over large areas outside of the buffer zone provided
by the regionaliser, as it is not guaranteed that anything
outside of the buffer zone is owned. Then, the plugins may use
the schedulers depending on the result of the ownership check.
2023-06-17 11:52:52 +02:00
6fca06ec72 Don't load chunks for supporting block checks 2023-07-05 23:11:53 +01:00
e48a6a04cc Refresh ProjectileSource for projectiles
Makes sure the value returned by Projectile#getShooter in
the API matches the owner UUID specified in the entity nbt.
Previously, after the entity reloaded, Projectile#getShooter
would return null, while the entity still had an owner.

Also fixes setting the shooter/owner to null actually
clearing the owner.

Co-authored-by: Warrior <50800980+Warriorrrr@users.noreply.github.com>
2023-05-30 12:59:10 -07:00
735cda1084 Expose pre-collision moving velocity to VehicleBlockCollisionEvent 2022-10-11 23:30:32 +03:00
18a23db6f2 Improve PortalEvents 2022-12-15 10:33:39 -08:00
df65fbea3e Player Entity Tracking Events 2022-03-30 18:16:52 +02:00
5ca5bc3d6c Fix EntityCombustEvent cancellation cant fully prevent entities from being set on fire 2022-10-31 14:20:52 +03:00
ce5660a8e9 Add various missing EntityDropItemEvent calls 2021-07-20 21:35:47 -07:00
4c16855bdd Prevent entity loading causing async lookups 2022-03-06 11:09:09 -05:00
636e993d37 Ensure entity passenger world matches ridden entity
Bad plugins doing this would cause some obvious problems...
2022-03-31 05:11:37 -07:00
0a2552a791 Freeze Tick Lock API 2021-12-26 20:27:43 -05:00
d237e02832 Forward CraftEntity in teleport command 2021-12-04 17:04:47 -08:00
16f4f7a2e0 don't attempt to teleport dead entities 2021-10-24 22:48:14 -05:00
8c5582489a Update head rotation in missing places
In certain areas the player's head rotation could be desynced when teleported/moved.
This is because bukkit uses a separate head rotation field for yaw.
This issue only applies to players.
2021-06-21 21:55:23 -04:00
33aad47ee1 Add Raw Byte Entity Serialization
== AT ==
public net.minecraft.world.entity.Entity setLevel(Lnet/minecraft/world/level/Level;)V
2021-10-24 16:20:31 -04:00
424403988d Add back EntityPortalExitEvent 2021-05-16 09:39:46 -07:00
8a3f9f7eb6 Optimize indirect passenger iteration 2021-08-09 00:38:37 -04:00
a85863338c Expand EntityUnleashEvent 2021-01-29 15:13:11 +01:00
df6902585c Collision option for requiring a player participant 2020-11-14 16:48:37 +01:00
d9c0a60246 MC-4: Fix item position desync
This fixes item position desync (MC-4) by running the item coordinates
through the encode/decode methods of the packet that causes the precision
loss, which forces the server to lose the same precision as the client
keeping them in sync.
2020-12-08 20:24:52 -06:00