2021-06-11 14:02:28 +02:00
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Mariell Hoversholm <proximyst@proximyst.com>
Date: Sat, 14 Nov 2020 16:48:37 +0100
Subject: [PATCH] Collision option for requiring a player participant
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
2024-08-31 20:29:50 +02:00
index bed376337035545e7ec677f2f7fe3372a3c9ea25..7d131f3b3f5739468aa3115e97ed28b6bfeca33d 100644
2021-06-11 14:02:28 +02:00
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
2024-07-29 00:28:28 +02:00
@@ -1936,6 +1936,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
2021-06-11 14:02:28 +02:00
public void push(Entity entity) {
if (!this.isPassengerOfSameVehicle(entity)) {
if (!entity.noPhysics && !this.noPhysics) {
2024-01-19 22:13:42 +01:00
+ if (this.level.paperConfig().collisions.onlyPlayersCollide && !(entity instanceof ServerPlayer || this instanceof ServerPlayer)) return; // Paper - Collision option for requiring a player participant
2021-06-11 14:02:28 +02:00
double d0 = entity.getX() - this.getX();
double d1 = entity.getZ() - this.getZ();
double d2 = Mth.absMax(d0, d1);
diff --git a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java
2024-09-15 21:39:53 +02:00
index 4d8c14d3a42f3e4b963cf5f8fa764df79813912b..93634fb01962ca7a35026e3c365f2a7f6b258a39 100644
2021-06-11 14:02:28 +02:00
--- a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java
+++ b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java
2024-09-15 21:39:53 +02:00
@@ -799,6 +799,7 @@ public abstract class AbstractMinecart extends VehicleEntity {
2021-06-11 14:02:28 +02:00
public void push(Entity entity) {
2023-06-08 02:54:54 +02:00
if (!this.level().isClientSide) {
2021-06-11 14:02:28 +02:00
if (!entity.noPhysics && !this.noPhysics) {
2024-01-19 22:13:42 +01:00
+ if (!this.level().paperConfig().collisions.allowVehicleCollisions && this.level().paperConfig().collisions.onlyPlayersCollide && !(entity instanceof Player)) return; // Paper - Collision option for requiring a player participant
2021-06-11 14:02:28 +02:00
if (!this.hasPassenger(entity)) {
// CraftBukkit start
VehicleEntityCollisionEvent collisionEvent = new VehicleEntityCollisionEvent((Vehicle) this.getBukkitEntity(), entity.getBukkitEntity());
diff --git a/src/main/java/net/minecraft/world/entity/vehicle/Boat.java b/src/main/java/net/minecraft/world/entity/vehicle/Boat.java
2024-06-13 22:57:13 +02:00
index 2cb535639bff0e867c1b1e845fee6e34bb237044..907f751c859855484151fb5d607acee2f2a35076 100644
2021-06-11 14:02:28 +02:00
--- a/src/main/java/net/minecraft/world/entity/vehicle/Boat.java
+++ b/src/main/java/net/minecraft/world/entity/vehicle/Boat.java
2024-06-13 22:57:13 +02:00
@@ -204,6 +204,7 @@ public class Boat extends VehicleEntity implements Leashable, VariantHolder<Boat
2021-06-11 14:02:28 +02:00
@Override
public void push(Entity entity) {
2024-01-19 22:13:42 +01:00
+ if (!this.level().paperConfig().collisions.allowVehicleCollisions && this.level().paperConfig().collisions.onlyPlayersCollide && !(entity instanceof Player)) return; // Paper - Collision option for requiring a player participant
2021-06-11 14:02:28 +02:00
if (entity instanceof Boat) {
if (entity.getBoundingBox().minY < this.getBoundingBox().maxY) {
// CraftBukkit start