Skip to content

Commit

Permalink
Simplify vanilla Minecart pushable logic
Browse files Browse the repository at this point in the history
  • Loading branch information
Dreeam-qwq committed May 22, 2024
1 parent e30198b commit 03def6b
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions patches/server/0043-Optimize-Minecart-collisions.patch
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,24 @@ Co-authored-by: MrHua269 <wangxyper@163.com>
Skip tick collisions to to prevent lag causing by massive stacked Minecart
Useful for anarchy server.

diff --git a/src/main/java/net/minecraft/world/entity/EntitySelector.java b/src/main/java/net/minecraft/world/entity/EntitySelector.java
index f1b9e83206cc67e6ef29ebe088351b0aaa5eb349..e0a51e269aa076def275710174d3654d07e1a7aa 100644
--- a/src/main/java/net/minecraft/world/entity/EntitySelector.java
+++ b/src/main/java/net/minecraft/world/entity/EntitySelector.java
@@ -63,6 +63,13 @@ public final class EntitySelector {
}
public static Predicate<Entity> pushable(Entity entity, boolean ignoreClimbing) {
// Paper end - Climbing should not bypass cramming gamerule
+
+ // Leaf start - Optimize Minecart collisions
+ if (entity instanceof net.minecraft.world.entity.vehicle.AbstractMinecart) {
+ return x -> true;
+ }
+ // Leaf end - Optimize Minecart collisions
+
PlayerTeam scoreboardteam = entity.getTeam();
Team.CollisionRule scoreboardteambase_enumteampush = scoreboardteam == null ? Team.CollisionRule.ALWAYS : scoreboardteam.getCollisionRule();

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 e7a1ce585c9e552e6f9ce9acd26fdfe5c43e0b5d..f9ae853fa762f103cfc6d7ad6f975ce099e348a3 100644
--- a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java
Expand Down

0 comments on commit 03def6b

Please sign in to comment.