diff --git a/patches/api/0373-Collision-API.patch b/patches/api/0373-Collision-API.patch index 8a63115a96fbc..ed3709a86ac53 100644 --- a/patches/api/0373-Collision-API.patch +++ b/patches/api/0373-Collision-API.patch @@ -3,7 +3,63 @@ 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..a37d7f50dc09b12c8ae56a3180f146b4d77ac8d7 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/event/entity/EntityCollideWithEntityEvent.java +@@ -0,0 +1,49 @@ ++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.NotNull; ++import java.util.HashSet; ++import java.util.Set; ++ ++public class EntityCollideWithEntityEvent extends Event implements Cancellable { ++ ++ private static final HandlerList handlers = new HandlerList(); ++ private boolean cancelled; ++ private final Set entities; ++ ++ 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 handlers; ++ } ++ ++ @NotNull ++ public static HandlerList getHandlerList() { ++ return handlers; ++ } ++ ++ @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 87489972dff661c7c9ec4d128e25e2f7666b598e..14edb1b4caeda0c8aecf3528bd0005fafa6197ff 100644 --- a/src/main/java/org/bukkit/RegionAccessor.java diff --git a/patches/server/0837-Collision-API.patch b/patches/server/0837-Collision-API.patch index efa8916419853..70724cdbc391c 100644 --- a/patches/server/0837-Collision-API.patch +++ b/patches/server/0837-Collision-API.patch @@ -3,9 +3,22 @@ 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 ce765fbe067d56ce0e5ae0bfade01f3b50e004be..32e38163d42c069056269defd4c2e2905de93bd5 100644 +--- a/src/main/java/net/minecraft/world/entity/Entity.java ++++ b/src/main/java/net/minecraft/world/entity/Entity.java +@@ -2093,6 +2093,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { + if (!this.isPassengerOfSameVehicle(entity)) { + if (!entity.noPhysics && !this.noPhysics) { + if (this.level.paperConfig().collisions.onlyPlayersCollide && !(entity instanceof ServerPlayer || this instanceof ServerPlayer)) return; // Paper ++ 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 57bb76050919d187adef4bfa8b21416a70867d23..254cdf5efe85583c5ef126d46af7c5246daa97c2 100644 +index 5a94a06bb531fe7805b43b5033a1d6edeee3b883..8cc1d7f5c5f8e9b9d6f7ab26025acf7237262959 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java @@ -1021,5 +1021,12 @@ public abstract class CraftRegionAccessor implements RegionAccessor { @@ -22,7 +35,7 @@ index 57bb76050919d187adef4bfa8b21416a70867d23..254cdf5efe85583c5ef126d46af7c524 // Paper end } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -index 706eeebe3ebbecd431c42140e7f351d5f7faf032..53bda7a59a3abf6f99a044df5f2c44bedf1af501 100644 +index e02c454ba75f440342d85b466426b9363992d923..4199bc76c1f304e19fa7c3b7763d31b56a57221b 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java @@ -1435,4 +1435,19 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { diff --git a/patches/server/0874-Fix-EntityCombustEvent-cancellation-cant-fully-preve.patch b/patches/server/0874-Fix-EntityCombustEvent-cancellation-cant-fully-preve.patch index 0e7507d0b879a..7acf62b93654b 100644 --- a/patches/server/0874-Fix-EntityCombustEvent-cancellation-cant-fully-preve.patch +++ b/patches/server/0874-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 45178d204a79eb47b36adf6e4dfa17d71c6b2c3a..f402f9c530b9c98ea6295ba88ed0179ff7670986 100644 +index 32e38163d42c069056269defd4c2e2905de93bd5..293d4de2a71f5b8a438de3d65ec5a789a28de45a 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -3353,6 +3353,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -3354,6 +3354,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { pluginManager.callEvent(entityCombustEvent); if (!entityCombustEvent.isCancelled()) { this.setSecondsOnFire(entityCombustEvent.getDuration(), false); diff --git a/patches/server/0899-Improve-PortalEvents.patch b/patches/server/0899-Improve-PortalEvents.patch index 8c4ad39c14a30..aaec34a51cda8 100644 --- a/patches/server/0899-Improve-PortalEvents.patch +++ b/patches/server/0899-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 f402f9c530b9c98ea6295ba88ed0179ff7670986..83d9487f20f42b678682ccb53b5e20c5932a579f 100644 +index 293d4de2a71f5b8a438de3d65ec5a789a28de45a..276384053ea9c18f9ca068d960861d53efa1c003 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -3736,7 +3736,14 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -3737,7 +3737,14 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { Location enter = bukkitEntity.getLocation(); Location exit = CraftLocation.toBukkit(exitPosition, exitWorldServer.getWorld()); diff --git a/patches/server/0975-Folia-scheduler-and-owned-region-API.patch b/patches/server/0975-Folia-scheduler-and-owned-region-API.patch index e06d6a57516fd..0b8f309f0752d 100644 --- a/patches/server/0975-Folia-scheduler-and-owned-region-API.patch +++ b/patches/server/0975-Folia-scheduler-and-owned-region-API.patch @@ -1158,7 +1158,7 @@ index 12bb0c619762ca9fc080ae884ce29de477dbcdc2..80919d247a9204ebf8d0e55df7fc6a24 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 bf77b0dae2ca25437df7386d2196da24d681e2ed..4516991a4d1299d7e93019a4b9bc227b4844e9ef 100644 +index 6ca846263778cba7acb35830c1259ef7cf07405a..7bb6e398e7ecc3e971ca8c13a5b31b774967c0d2 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -246,11 +246,23 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { @@ -1186,7 +1186,7 @@ index bf77b0dae2ca25437df7386d2196da24d681e2ed..4516991a4d1299d7e93019a4b9bc227b @Override public CommandSender getBukkitSender(CommandSourceStack wrapper) { return this.getBukkitEntity(); -@@ -4697,6 +4709,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -4698,6 +4710,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { return; } // Paper end - rewrite chunk system @@ -1194,7 +1194,7 @@ index bf77b0dae2ca25437df7386d2196da24d681e2ed..4516991a4d1299d7e93019a4b9bc227b if (this.removalReason == null) { this.removalReason = reason; } -@@ -4707,12 +4720,28 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -4708,12 +4721,28 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { if (reason != RemovalReason.UNLOADED_TO_CHUNK) this.getPassengers().forEach(Entity::stopRiding); // Paper - chunk system - don't adjust passenger state when unloading, it's just not safe (and messes with our logic in entity chunk unload) this.levelCallback.onRemove(reason); @@ -1224,7 +1224,7 @@ index bf77b0dae2ca25437df7386d2196da24d681e2ed..4516991a4d1299d7e93019a4b9bc227b public void setLevelCallback(EntityInLevelCallback changeListener) { this.levelCallback = changeListener; diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 9d86b54a9945d4644f7920e06e5d04faaaa2e8c8..16906e8ba7d05275561d465a08b792137d284c4e 100644 +index 4d2443f40dc2e1b38b7c80e7b5f9ca7a4f84c107..3363ac5f0b2c059e0794fe22194c7fc1006806f4 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -310,6 +310,76 @@ public final class CraftServer implements Server { diff --git a/patches/server/1056-Restore-vanilla-entity-drops-behavior.patch b/patches/server/1056-Restore-vanilla-entity-drops-behavior.patch index 4b72d8152a0d3..8794b7dcd3428 100644 --- a/patches/server/1056-Restore-vanilla-entity-drops-behavior.patch +++ b/patches/server/1056-Restore-vanilla-entity-drops-behavior.patch @@ -39,10 +39,10 @@ index 08980763020a13ab49dc7d637625a4fba56da8c9..907c8f15f5247f9972c6677ff0f9e1aa } // Paper diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index c655c6fee393c62ba79301f76baa72f9b1154a9a..fece91254b10b59474056aa730fd420f90cd7bec 100644 +index 899262f1b7bea923eb680bbb8f976ed39b8319e3..44772a4404cfbc7348db5015f68b2357ed969e34 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -2673,6 +2673,25 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -2674,6 +2674,25 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { @Nullable public ItemEntity spawnAtLocation(ItemStack stack, float yOffset) { @@ -68,7 +68,7 @@ index c655c6fee393c62ba79301f76baa72f9b1154a9a..fece91254b10b59474056aa730fd420f if (stack.isEmpty()) { return null; } else if (this.level().isClientSide) { -@@ -2680,14 +2699,21 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -2681,14 +2700,21 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { } else { // CraftBukkit start - Capture drops for death event if (this instanceof net.minecraft.world.entity.LivingEntity && !((net.minecraft.world.entity.LivingEntity) this).forceDrops) {