mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-02 17:01:38 +01:00
43 lines
2.9 KiB
Diff
43 lines
2.9 KiB
Diff
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 81c70cf84618f4e987c68dba081317a658c6cd91..bfac12f0e89c4c7d48321ea608363518742304af 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
|
@@ -1715,6 +1715,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
|
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
|
|
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 4984b2b3294e425247b595bcf36812728fb4cd16..3f31a3c17ecca6e93b794478129b95ecff4e1a9c 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java
|
|
@@ -833,6 +833,7 @@ public abstract class AbstractMinecart extends Entity {
|
|
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
|
|
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 8471c34d02ba5819580754f98ce8cc0b50a0b328..5641a7b5c5e3d93cddabd91703c6f001700c5869 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/vehicle/Boat.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/vehicle/Boat.java
|
|
@@ -243,6 +243,7 @@ public class Boat extends Entity {
|
|
|
|
@Override
|
|
public void push(Entity entity) {
|
|
+ if (!this.level.paperConfig().collisions.allowVehicleCollisions && this.level.paperConfig().collisions.onlyPlayersCollide && !(entity instanceof Player)) return; // Paper
|
|
if (entity instanceof Boat) {
|
|
if (entity.getBoundingBox().minY < this.getBoundingBox().maxY) {
|
|
// CraftBukkit start
|