mirror of
https://github.com/YatopiaMC/Yatopia.git
synced 2024-08-25 15:22:47 +02:00
52 lines
2.2 KiB
Diff
52 lines
2.2 KiB
Diff
From 3a72f2f137008ff78a6b0e6c0494b66f58902390 Mon Sep 17 00:00:00 2001
|
|
From: tr7zw <tr7zw@live.de>
|
|
Date: Mon, 23 Mar 2020 23:11:10 +0100
|
|
Subject: [PATCH] Add option for only players to have collisions with Entities
|
|
|
|
---
|
|
src/main/java/de/tr7zw/yapfa/YapfaConfig.java | 6 ++++++
|
|
src/main/java/net/minecraft/server/EntityLiving.java | 11 +++++++++--
|
|
2 files changed, 15 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/src/main/java/de/tr7zw/yapfa/YapfaConfig.java b/src/main/java/de/tr7zw/yapfa/YapfaConfig.java
|
|
index 9711cbc522..655c4e68f3 100644
|
|
--- a/src/main/java/de/tr7zw/yapfa/YapfaConfig.java
|
|
+++ b/src/main/java/de/tr7zw/yapfa/YapfaConfig.java
|
|
@@ -216,4 +216,10 @@ public class YapfaConfig {
|
|
disableEntityCollisionboxes = getBoolean("settings.disableEntityCollisionboxes", false);
|
|
}
|
|
|
|
+ public static boolean onlyPlayerCollisions = false;
|
|
+ private static void onlyPlayerCollisions() {
|
|
+ onlyPlayerCollisions = getBoolean("settings.onlyPlayerCollisions", false);
|
|
+ }
|
|
+
|
|
+
|
|
}
|
|
\ No newline at end of file
|
|
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
|
|
index a337f75995..c240d4877f 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityLiving.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
|
|
@@ -2689,8 +2689,15 @@ public abstract class EntityLiving extends Entity {
|
|
if (i <= 0 && world.paperConfig.maxCollisionsPerEntity <= 0) {
|
|
return;
|
|
}
|
|
- // Paper - end don't run getEntities if we're not going to use its result
|
|
- List<Entity> list = this.world.getEntities(this, this.getBoundingBox(), IEntitySelector.a(this));
|
|
+ // Tuinity - end don't run getEntities if we're not going to use its result
|
|
+ // YAPFA start
|
|
+ List<Entity> list = null;
|
|
+ if(de.tr7zw.yapfa.YapfaConfig.onlyPlayerCollisions) {
|
|
+ list = this.world.getEntities(this, this.getBoundingBox(), entity -> entity.getEntityType() == EntityTypes.PLAYER);
|
|
+ } else {
|
|
+ list = this.world.getEntities(this, this.getBoundingBox(), IEntitySelector.a(this));
|
|
+ }
|
|
+ // YAPFA end
|
|
|
|
if (!list.isEmpty()) {
|
|
// Paper - move up
|
|
--
|
|
2.25.1.windows.1
|
|
|