diff --git a/patches/api/0365-Collision-API.patch b/patches/api/0365-Collision-API.patch index f59dc05fbbc1..5e43f6d1fa23 100644 --- a/patches/api/0365-Collision-API.patch +++ b/patches/api/0365-Collision-API.patch @@ -3,7 +3,68 @@ From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com> Date: Wed, 6 Oct 2021 20:10:36 -0400 Subject: [PATCH] Collision API +Co-authored-by: Tamion <70228790+notTamion@users.noreply.github.com> +diff --git a/src/main/java/io/papermc/paper/event/entity/EntityCollideWithEntityEvent.java b/src/main/java/io/papermc/paper/event/entity/EntityCollideWithEntityEvent.java +new file mode 100644 +index 0000000000000000000000000000000000000000..0505e5479526bcfb757e6078d6bbec423498c303 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/event/entity/EntityCollideWithEntityEvent.java +@@ -0,0 +1,54 @@ ++package io.papermc.paper.event.entity; ++ ++import org.bukkit.entity.Entity; ++import org.bukkit.event.Cancellable; ++import org.bukkit.event.Event; ++import org.bukkit.event.HandlerList; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.NotNull; ++import java.util.Set; ++ ++/** ++ * Fired when two entities collide with each other. ++ * If cancelled, the entities won't get pushed away from each other. ++ */ ++public class EntityCollideWithEntityEvent extends Event implements Cancellable { ++ ++ private static final HandlerList HANDLER_LIST = new HandlerList(); ++ private boolean cancelled; ++ private final Set entities; ++ ++ @ApiStatus.Internal ++ public EntityCollideWithEntityEvent(@NotNull Entity entity1, @NotNull Entity entity2) { ++ entities = Set.of(entity1, entity2); ++ } ++ ++ /** ++ * Returns the Entities involved in this event ++ * ++ * @return Entities that are involved in this event ++ */ ++ public @NotNull Set getEntities() { ++ return entities; ++ } ++ ++ @Override ++ public @NotNull HandlerList getHandlers() { ++ return HANDLER_LIST; ++ } ++ ++ @NotNull ++ public static HandlerList getHandlerList() { ++ return HANDLER_LIST; ++ } ++ ++ @Override ++ public boolean isCancelled() { ++ return cancelled; ++ } ++ ++ @Override ++ public void setCancelled(final boolean cancel) { ++ this.cancelled = cancel; ++ } ++} diff --git a/src/main/java/org/bukkit/RegionAccessor.java b/src/main/java/org/bukkit/RegionAccessor.java index 44ee56a5956cc17194c767a0c1071a2abffe818a..43dd6c59cceba12f27e6b265acc3ad97eea37abd 100644 --- a/src/main/java/org/bukkit/RegionAccessor.java diff --git a/patches/server/0749-Collision-API.patch b/patches/server/0749-Collision-API.patch index b4840d04acf6..207acabc73c4 100644 --- a/patches/server/0749-Collision-API.patch +++ b/patches/server/0749-Collision-API.patch @@ -3,7 +3,20 @@ From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com> Date: Wed, 6 Oct 2021 20:10:44 -0400 Subject: [PATCH] Collision API +Co-authored-by: Tamion <70228790+notTamion@users.noreply.github.com> +diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java +index 4b54b3e121508fb1590654123e86c6c5de54a755..f8125c2319013241b48b818977fb1dc5d9050905 100644 +--- a/src/main/java/net/minecraft/world/entity/Entity.java ++++ b/src/main/java/net/minecraft/world/entity/Entity.java +@@ -1907,6 +1907,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess + if (!this.isPassengerOfSameVehicle(entity)) { + if (!entity.noPhysics && !this.noPhysics) { + if (this.level.paperConfig().collisions.onlyPlayersCollide && !(entity instanceof ServerPlayer || this instanceof ServerPlayer)) return; // Paper - Collision option for requiring a player participant ++ if (!new io.papermc.paper.event.entity.EntityCollideWithEntityEvent(this.getBukkitEntity(), entity.getBukkitEntity()).callEvent()) return; // Paper + double d0 = entity.getX() - this.getX(); + double d1 = entity.getZ() - this.getZ(); + double d2 = Mth.absMax(d0, d1); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java b/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java index d1c265733941874002f6dfc7543917af88600659..72c275d7da798ee10a224bbd3f4c92abd82601e1 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java diff --git a/patches/server/0783-Fix-EntityCombustEvent-cancellation-cant-fully-preve.patch b/patches/server/0783-Fix-EntityCombustEvent-cancellation-cant-fully-preve.patch index 5def430ee344..bf69795a707a 100644 --- a/patches/server/0783-Fix-EntityCombustEvent-cancellation-cant-fully-preve.patch +++ b/patches/server/0783-Fix-EntityCombustEvent-cancellation-cant-fully-preve.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Fix EntityCombustEvent cancellation cant fully prevent diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 4b54b3e121508fb1590654123e86c6c5de54a755..0a4069e6c544deb0ad576350ec371fe1ec5de8f4 100644 +index f8125c2319013241b48b818977fb1dc5d9050905..f4a1f4f9519fa3b42f571df3c5731207aa10a69d 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -3127,6 +3127,10 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -3128,6 +3128,10 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess pluginManager.callEvent(entityCombustEvent); if (!entityCombustEvent.isCancelled()) { this.igniteForSeconds(entityCombustEvent.getDuration(), false); diff --git a/patches/server/0797-Player-Entity-Tracking-Events.patch b/patches/server/0797-Player-Entity-Tracking-Events.patch index 4a5f62d8740d..1c275fc316e3 100644 --- a/patches/server/0797-Player-Entity-Tracking-Events.patch +++ b/patches/server/0797-Player-Entity-Tracking-Events.patch @@ -21,10 +21,10 @@ index de19a5ea96fa38621513e970e04d153576f4f6ae..bff776f07bcc7841acc5757c1f53bde1 } else if (this.seenBy.remove(player.connection)) { this.serverEntity.removePairing(player); diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 0a4069e6c544deb0ad576350ec371fe1ec5de8f4..63e4fa54c6931a3fc33b081662823f5b736d8496 100644 +index f4a1f4f9519fa3b42f571df3c5731207aa10a69d..a45dfbcffcc52523ed7e2bc83722397297a22c92 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -3853,7 +3853,14 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -3854,7 +3854,14 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess public void startSeenByPlayer(ServerPlayer player) {} diff --git a/patches/server/0806-Improve-PortalEvents.patch b/patches/server/0806-Improve-PortalEvents.patch index 680471754c78..749e53005cdf 100644 --- a/patches/server/0806-Improve-PortalEvents.patch +++ b/patches/server/0806-Improve-PortalEvents.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Improve PortalEvents diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 63e4fa54c6931a3fc33b081662823f5b736d8496..48103cefacf75a51619f7a3ebeb7731956a65a4f 100644 +index a45dfbcffcc52523ed7e2bc83722397297a22c92..70d302d0bcae3064a0616c36b71ea922a3388a85 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -3513,7 +3513,14 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -3514,7 +3514,14 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess Location enter = bukkitEntity.getLocation(); Location exit = CraftLocation.toBukkit(exitPosition, exitWorldServer.getWorld()); diff --git a/patches/server/0870-Folia-scheduler-and-owned-region-API.patch b/patches/server/0870-Folia-scheduler-and-owned-region-API.patch index 43a97348900a..fab5cd5d2603 100644 --- a/patches/server/0870-Folia-scheduler-and-owned-region-API.patch +++ b/patches/server/0870-Folia-scheduler-and-owned-region-API.patch @@ -1185,7 +1185,7 @@ index 942af999a4a3aa03cb7ef5f0b9d377c78677fd0e..0246db4a1f6eb168fa88260282311fee this.players.remove(entityplayer); this.playersByName.remove(entityplayer.getScoreboardName().toLowerCase(java.util.Locale.ROOT)); // Spigot diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 16f36d1bfe6458f9aa935cdc63066c082bc83f8e..638aeef75dc5f7ab8b8e050118a7c709246a85f4 100644 +index 72ec1fc977fcbaa84072541e0343b1c949f0fd4d..cf935071c83b2295d6d1fb40ea631324f24e9354 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -250,11 +250,23 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess @@ -1213,7 +1213,7 @@ index 16f36d1bfe6458f9aa935cdc63066c082bc83f8e..638aeef75dc5f7ab8b8e050118a7c709 @Override public CommandSender getBukkitSender(CommandSourceStack wrapper) { return this.getBukkitEntity(); -@@ -4472,6 +4484,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -4473,6 +4485,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess public final void setRemoved(Entity.RemovalReason entity_removalreason, EntityRemoveEvent.Cause cause) { CraftEventFactory.callEntityRemoveEvent(this, cause); // CraftBukkit end @@ -1221,7 +1221,7 @@ index 16f36d1bfe6458f9aa935cdc63066c082bc83f8e..638aeef75dc5f7ab8b8e050118a7c709 if (this.removalReason == null) { this.removalReason = entity_removalreason; } -@@ -4482,12 +4495,28 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -4483,12 +4496,28 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess this.getPassengers().forEach(Entity::stopRiding); this.levelCallback.onRemove(entity_removalreason); diff --git a/patches/server/0937-Restore-vanilla-entity-drops-behavior.patch b/patches/server/0937-Restore-vanilla-entity-drops-behavior.patch index 1b3e74a14f3f..c8a1e922cdeb 100644 --- a/patches/server/0937-Restore-vanilla-entity-drops-behavior.patch +++ b/patches/server/0937-Restore-vanilla-entity-drops-behavior.patch @@ -50,10 +50,10 @@ index e447aa85b51c7e28fcd89bf8aa7602c88d599239..0d4224c56bcdff54bbf6cc2d9d25e4d7 if (entityitem == null) { return null; diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index ee38f76e46c20e9fadfb5d4d602b7b82a8a22e51..4e96b6c05bf8b8235e91bdd26e5615c5299fd9aa 100644 +index 8833e8ad39b3e8c7289e49726ab621597874a3b6..e77f0cd06f6cbfb17b22eab791a1dd871444ba5f 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -2524,6 +2524,25 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -2525,6 +2525,25 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess @Nullable public ItemEntity spawnAtLocation(ItemStack stack, float yOffset) { @@ -79,7 +79,7 @@ index ee38f76e46c20e9fadfb5d4d602b7b82a8a22e51..4e96b6c05bf8b8235e91bdd26e5615c5 if (stack.isEmpty()) { return null; } else if (this.level().isClientSide) { -@@ -2531,14 +2550,21 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -2532,14 +2551,21 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess } else { // CraftBukkit start - Capture drops for death event if (this instanceof net.minecraft.world.entity.LivingEntity && !((net.minecraft.world.entity.LivingEntity) this).forceDrops) { diff --git a/patches/server/0969-Fix-DamageSource-API.patch b/patches/server/0969-Fix-DamageSource-API.patch index 2f3c82881635..c6c81733efb1 100644 --- a/patches/server/0969-Fix-DamageSource-API.patch +++ b/patches/server/0969-Fix-DamageSource-API.patch @@ -48,10 +48,10 @@ index a78fd4f9ce97ebece45979908382de8f5fc14c1b..160dc3216e8f5db5f9b3cce5e2d655f2 } diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 4e96b6c05bf8b8235e91bdd26e5615c5299fd9aa..3c1bcf8d1a07b35a8688160c9f05f792451338a3 100644 +index e77f0cd06f6cbfb17b22eab791a1dd871444ba5f..19121060c5fbcc07573058f260308e74348abe4a 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -3195,7 +3195,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -3196,7 +3196,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess return; } diff --git a/patches/server/0981-Rewrite-chunk-system.patch b/patches/server/0981-Rewrite-chunk-system.patch index f1d58b12066d..cae02157487b 100644 --- a/patches/server/0981-Rewrite-chunk-system.patch +++ b/patches/server/0981-Rewrite-chunk-system.patch @@ -19500,7 +19500,7 @@ index 7984f17cd9c4cef8100909b6c33b3144c8096fcf..639f72618a7c22fa94effa9d0406b97f } } diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 3c1bcf8d1a07b35a8688160c9f05f792451338a3..03840f520624662d4ce3ac9f3065a01c71b5f299 100644 +index 19121060c5fbcc07573058f260308e74348abe4a..f9c2fdc5a0e66326be2f8f6bf4d0d35a74e4ce22 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -482,6 +482,58 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess @@ -19562,7 +19562,7 @@ index 3c1bcf8d1a07b35a8688160c9f05f792451338a3..03840f520624662d4ce3ac9f3065a01c public Entity(EntityType type, Level world) { this.id = Entity.ENTITY_COUNTER.incrementAndGet(); this.passengers = ImmutableList.of(); -@@ -2608,11 +2660,11 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -2609,11 +2661,11 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess return InteractionResult.PASS; } @@ -19576,7 +19576,7 @@ index 3c1bcf8d1a07b35a8688160c9f05f792451338a3..03840f520624662d4ce3ac9f3065a01c return false; } -@@ -4037,6 +4089,13 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -4038,6 +4090,13 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess }).count(); } @@ -19590,7 +19590,7 @@ index 3c1bcf8d1a07b35a8688160c9f05f792451338a3..03840f520624662d4ce3ac9f3065a01c public boolean hasExactlyOnePlayerPassenger() { if (this.passengers.isEmpty()) { return false; } // Paper - Optimize indirect passenger iteration return this.countPlayerPassengers() == 1; -@@ -4387,6 +4446,12 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -4388,6 +4447,12 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess return; } // Paper end - Block invalid positions and bounding box @@ -19603,7 +19603,7 @@ index 3c1bcf8d1a07b35a8688160c9f05f792451338a3..03840f520624662d4ce3ac9f3065a01c // Paper start - Fix MC-4 if (this instanceof ItemEntity) { if (io.papermc.paper.configuration.GlobalConfiguration.get().misc.fixEntityPositionDesync) { -@@ -4514,6 +4579,13 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -4515,6 +4580,13 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess @Override public final void setRemoved(Entity.RemovalReason entity_removalreason, EntityRemoveEvent.Cause cause) { @@ -19617,7 +19617,7 @@ index 3c1bcf8d1a07b35a8688160c9f05f792451338a3..03840f520624662d4ce3ac9f3065a01c CraftEventFactory.callEntityRemoveEvent(this, cause); // CraftBukkit end final boolean alreadyRemoved = this.removalReason != null; // Paper - Folia schedulers -@@ -4525,7 +4597,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -4526,7 +4598,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess this.stopRiding(); } @@ -19626,7 +19626,7 @@ index 3c1bcf8d1a07b35a8688160c9f05f792451338a3..03840f520624662d4ce3ac9f3065a01c this.levelCallback.onRemove(entity_removalreason); // Paper start - Folia schedulers if (!(this instanceof ServerPlayer) && entity_removalreason != RemovalReason.CHANGED_DIMENSION && !alreadyRemoved) { -@@ -4556,7 +4628,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -4557,7 +4629,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess @Override public boolean shouldBeSaved() { diff --git a/patches/server/1012-Detail-more-information-in-watchdog-dumps.patch b/patches/server/1012-Detail-more-information-in-watchdog-dumps.patch index e7c399214582..1d34bdd62d4a 100644 --- a/patches/server/1012-Detail-more-information-in-watchdog-dumps.patch +++ b/patches/server/1012-Detail-more-information-in-watchdog-dumps.patch @@ -122,7 +122,7 @@ index 11d5729f91b45bbd5b634c8c63469396bc2a3f9c..e8e18748d12c567eec990d3247086fca private void tickPassenger(Entity vehicle, Entity passenger) { diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 257943b4c984d6faee29eca17c8f951e7f43168b..0fbcf60a994f67bdd81d40e4a8bf38f0cbb8993d 100644 +index c167d69cb70d7e85a9aeb6044210a44cdd64daf1..3e166ca6bd80669cc848e7ef454735514492106b 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -1074,8 +1074,43 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess @@ -183,7 +183,7 @@ index 257943b4c984d6faee29eca17c8f951e7f43168b..0fbcf60a994f67bdd81d40e4a8bf38f0 } private boolean isStateClimbable(BlockState state) { -@@ -4405,7 +4447,9 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -4406,7 +4448,9 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess } public void setDeltaMovement(Vec3 velocity) { @@ -193,7 +193,7 @@ index 257943b4c984d6faee29eca17c8f951e7f43168b..0fbcf60a994f67bdd81d40e4a8bf38f0 } public void addDeltaMovement(Vec3 velocity) { -@@ -4508,7 +4552,9 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -4509,7 +4553,9 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess } // Paper end - Fix MC-4 if (this.position.x != x || this.position.y != y || this.position.z != z) { diff --git a/patches/server/1013-Collision-optimisations.patch b/patches/server/1013-Collision-optimisations.patch index 1d14ead3c6d3..ab1a99f9c923 100644 --- a/patches/server/1013-Collision-optimisations.patch +++ b/patches/server/1013-Collision-optimisations.patch @@ -2214,7 +2214,7 @@ index 60ba289e724463129dfb27aa5e3b6daf3dd7386e..68446b7532dfbda303293aa9e756644c entityplayer1.setPos(entityplayer1.getX(), entityplayer1.getY() + 1.0D, entityplayer1.getZ()); } diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 0fbcf60a994f67bdd81d40e4a8bf38f0cbb8993d..8ad2d17615ff489b2fbbb13480dd0b217a42d805 100644 +index 3e166ca6bd80669cc848e7ef454735514492106b..f72df6fa81edda5698e5bbb3e657b08b6f54c734 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -1261,9 +1261,44 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess @@ -2364,7 +2364,7 @@ index 0fbcf60a994f67bdd81d40e4a8bf38f0cbb8993d..8ad2d17615ff489b2fbbb13480dd0b21 } public static Vec3 collideBoundingBox(@Nullable Entity entity, Vec3 movement, AABB entityBoundingBox, Level world, List collisions) { -@@ -2735,11 +2820,70 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -2736,11 +2821,70 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess float f = this.dimensions.width() * 0.8F; AABB axisalignedbb = AABB.ofSize(this.getEyePosition(), (double) f, 1.0E-6D, (double) f);