aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0484-Collision-option-for-requiring-a-player-participant.patch
blob: 612a957bf2d26112bbfe6656e3f70db312c417a0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
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
index 77f24eb88af8fde66ef2198bb7673c71de42800f..d8658bca3964c931be9dbbfc25de03f0d2e4b6c5 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -1871,6 +1871,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
     public void push(Entity entity) {
         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
                 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
index 1aecb6cc62b4b411ab0ff3b7fb11a5d9d050b959..2f73ca283f2d6e6bc5265c95ef767b3f606a3d69 100644
--- a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java
+++ b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java
@@ -789,6 +789,7 @@ public abstract class AbstractMinecart extends VehicleEntity {
     public void push(Entity entity) {
         if (!this.level().isClientSide) {
             if (!entity.noPhysics && !this.noPhysics) {
+                if (!this.level().paperConfig().collisions.allowVehicleCollisions && this.level().paperConfig().collisions.onlyPlayersCollide && !(entity instanceof Player)) return; // Paper - Collision option for requiring a player participant
                 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
index d1eaadba8ce1f472a174afcfe8e0d059a121612c..549202706396fee91c23f6e34f7faa7672e4b03f 100644
--- a/src/main/java/net/minecraft/world/entity/vehicle/Boat.java
+++ b/src/main/java/net/minecraft/world/entity/vehicle/Boat.java
@@ -200,6 +200,7 @@ public class Boat extends VehicleEntity implements VariantHolder<Boat.Type> {
 
     @Override
     public void push(Entity entity) {
+        if (!this.level().paperConfig().collisions.allowVehicleCollisions && this.level().paperConfig().collisions.onlyPlayersCollide && !(entity instanceof Player)) return; // Paper - Collision option for requiring a player participant
         if (entity instanceof Boat) {
             if (entity.getBoundingBox().minY < this.getBoundingBox().maxY) {
                 // CraftBukkit start