testserver/patches/server/0556-Collision-option-for-r...

43 lines
2.9 KiB
Diff
Raw Normal View History

2021-06-11 12:02:28 +00: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
2022-11-03 21:03:31 +00:00
index c22778e5155abf5dcfbf574ef633f253208f7e6c..0624f832f301ec2a36085e66f67b6a529583a496 100644
2021-06-11 12:02:28 +00:00
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
2022-10-11 12:43:10 +00:00
@@ -1779,6 +1779,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
2021-06-11 12:02:28 +00: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 12:02:28 +00: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
index 4984b2b3294e425247b595bcf36812728fb4cd16..3f31a3c17ecca6e93b794478129b95ecff4e1a9c 100644
2021-06-11 12:02:28 +00:00
--- a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java
+++ b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java
2022-06-08 07:30:41 +00:00
@@ -833,6 +833,7 @@ public abstract class AbstractMinecart extends Entity {
2021-06-11 12:02:28 +00:00
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
2021-06-11 12:02:28 +00: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
2022-07-21 19:53:04 +00:00
index 8471c34d02ba5819580754f98ce8cc0b50a0b328..5641a7b5c5e3d93cddabd91703c6f001700c5869 100644
2021-06-11 12:02:28 +00:00
--- a/src/main/java/net/minecraft/world/entity/vehicle/Boat.java
+++ b/src/main/java/net/minecraft/world/entity/vehicle/Boat.java
2022-06-08 07:30:41 +00:00
@@ -243,6 +243,7 @@ public class Boat extends Entity {
2021-06-11 12:02:28 +00:00
@Override
public void push(Entity entity) {
+ if (!this.level.paperConfig().collisions.allowVehicleCollisions && this.level.paperConfig().collisions.onlyPlayersCollide && !(entity instanceof Player)) return; // Paper
2021-06-11 12:02:28 +00:00
if (entity instanceof Boat) {
if (entity.getBoundingBox().minY < this.getBoundingBox().maxY) {
// CraftBukkit start