Paper/patches/server/0532-Collision-option-for-requiring-a-player-participant.patch

43 Zeilen
3.0 KiB
Diff

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
2023-09-22 22:13:57 +02:00
index 0d96f40ca4d08197f101a31cca7e334525542565..027e4f9f9f3464af8f21cf1f67019aec15666c47 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
2023-09-22 22:13:57 +02:00
@@ -1894,6 +1894,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
2021-06-11 14:02:28 +02:00
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
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
2023-09-22 07:41:27 +02:00
index a719ea3cd6714686ead9c1817e9592733a980444..350d931f99bea1291f890d87fca6ae644c1a9fe9 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
2023-06-08 02:54:54 +02:00
@@ -840,6 +840,7 @@ public abstract class AbstractMinecart extends Entity {
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) {
2023-06-08 21:35:20 +02:00
+ if (!this.level().paperConfig().collisions.allowVehicleCollisions && this.level().paperConfig().collisions.onlyPlayersCollide && !(entity instanceof Player)) return; // Paper
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
2023-09-22 07:41:27 +02:00
index 7c233b03bac04520f0be9148fcd12282680bd39d..d958715094c8581c5b008568f8384169c507290b 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
2023-09-22 07:41:27 +02:00
@@ -265,6 +265,7 @@ public class Boat extends Entity implements VariantHolder<Boat.Type> {
2021-06-11 14:02:28 +02:00
@Override
public void push(Entity entity) {
2023-06-08 21:35:20 +02:00
+ if (!this.level().paperConfig().collisions.allowVehicleCollisions && this.level().paperConfig().collisions.onlyPlayersCollide && !(entity instanceof Player)) return; // Paper
2021-06-11 14:02:28 +02:00
if (entity instanceof Boat) {
if (entity.getBoundingBox().minY < this.getBoundingBox().maxY) {
// CraftBukkit start