forked from TECHNOVE/Airplane
-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
76 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: jacob <[email protected]> | ||
Date: Tue, 3 May 2022 23:19:12 -0700 | ||
Subject: [PATCH] Fix Entity Collisions | ||
|
||
|
||
diff --git a/src/main/java/com.nftworlds/NFTWorldsConfig.java b/src/main/java/com.nftworlds/NFTWorldsConfig.java | ||
index 054608653984024927ae8f01d948da80d3895176..81f47ff70bd89612e5149fac9863da51ad0501f3 100644 | ||
--- a/src/main/java/com.nftworlds/NFTWorldsConfig.java | ||
+++ b/src/main/java/com.nftworlds/NFTWorldsConfig.java | ||
@@ -152,9 +152,9 @@ public class NFTWorldsConfig { | ||
entityQueueMS = getInt("entity-queue.ms", 30); | ||
} | ||
|
||
- public static int maxEntitiesForCollisions = 50; | ||
+ public static int maxEntitiesForCollisions = -1; | ||
private static void maxEntitiesForCollisions() { | ||
- maxEntitiesForCollisions = getInt("max-entities-for-collisions", 50); | ||
+ maxEntitiesForCollisions = getInt("max-entities-for-collisions", -1); | ||
} | ||
|
||
//Entity ticking | ||
@@ -391,4 +391,7 @@ public class NFTWorldsConfig { | ||
public static int ticksBetweenChunkPurging = 1; | ||
private static void ticksBetweenChunkPurging() { ticksBetweenChunkPurging = getInt("ticks-between-chunk-purging", 1); }; | ||
|
||
+ public static boolean onlyPlayersPushEntities = false; | ||
+ private static void onlyPlayersPushEntities() { onlyPlayersPushEntities = getBoolean("only-players-push-entities", false); } | ||
+ | ||
} | ||
\ No newline at end of file | ||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java | ||
index 6cf117086e5b0b04341814b22809a9a7a17f5aaf..4ca946b75488d7f7c96cee20df227bf5454b3ef6 100644 | ||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java | ||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java | ||
@@ -3304,15 +3304,9 @@ public abstract class LivingEntity extends Entity { | ||
} | ||
|
||
ChunkPos pos = this.chunkPosition(); | ||
- if (this.level.getChunkEntityCount(pos.x, pos.z) < NFTWorldsConfig.maxEntitiesForCollisions) { | ||
+ if (NFTWorldsConfig.maxEntitiesForCollisions == -1 || this.level.getChunkEntityCount(pos.x, pos.z) < NFTWorldsConfig.maxEntitiesForCollisions) { | ||
if (tickCount % NFTWorldsConfig.ticksBetweenCollisions == 0) { | ||
- if (NFTWorldsConfig.disableMobCollisions) { | ||
- if (this instanceof net.minecraft.world.entity.player.Player) { | ||
- this.pushEntities(); | ||
- } | ||
- } else { | ||
- this.pushEntities(); | ||
- } | ||
+ this.pushEntities(); | ||
} | ||
} | ||
this.level.getProfiler().pop(); | ||
@@ -3383,6 +3377,7 @@ public abstract class LivingEntity extends Entity { | ||
if (i <= 0 && level.paperConfig.maxCollisionsPerEntity <= 0) { | ||
return; | ||
} | ||
+ | ||
// Paper end - don't run getEntities if we're not going to use its result | ||
List<Entity> list = this.level.getEntities(this, this.getBoundingBox(), EntitySelector.pushable(this, level.paperConfig.fixClimbingBypassingCrammingRule)); // Paper - fix climbing bypassing cramming rule | ||
|
||
@@ -3410,7 +3405,13 @@ public abstract class LivingEntity extends Entity { | ||
entity.numCollisions++; // Paper | ||
this.numCollisions++; // Paper | ||
|
||
- this.doPush(entity); | ||
+ if (NFTWorldsConfig.onlyPlayersPushEntities) { | ||
+ if (this instanceof net.minecraft.world.entity.player.Player) { | ||
+ this.doPush(entity); | ||
+ } | ||
+ } else { | ||
+ this.doPush(entity); | ||
+ } | ||
} | ||
} | ||
|