Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Github Actions <[email protected]>
Date: Mon, 9 Feb 2026 12:37:26 +0300
Subject: [PATCH] Optimize map lookups with isEmpty check


diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
index 8d092716cdcc48b829a1c0ee2e5416d648143a37..da36090b8bd290125ddedfd33e14857344e33a3c 100644
--- a/net/minecraft/world/entity/Entity.java
+++ b/net/minecraft/world/entity/Entity.java
@@ -4771,7 +4771,7 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name
}

public boolean hasPassenger(Entity entity) {
- return this.passengers.contains(entity);
+ return !passengers.isEmpty() && this.passengers.contains(entity); // Leaf - Optimize map lookups with isEmpty check
}

public boolean hasPassenger(Predicate<Entity> predicate) {
diff --git a/net/minecraft/world/entity/LivingEntity.java b/net/minecraft/world/entity/LivingEntity.java
index 3b3a801e632bf65b9bef5833755b2de3be1b059a..bad7d25cb3cbefcee82fe1fe30a17c851083cfce 100644
--- a/net/minecraft/world/entity/LivingEntity.java
+++ b/net/minecraft/world/entity/LivingEntity.java
@@ -1175,7 +1175,7 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
}

public boolean hasEffect(Holder<MobEffect> effect) {
- return this.activeEffects.containsKey(effect);
+ return !activeEffects.isEmpty() && this.activeEffects.containsKey(effect); // Leaf - Optimize map lookups with isEmpty check
}

public @Nullable MobEffectInstance getEffect(Holder<MobEffect> effect) {
@@ -4306,7 +4306,7 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
// CraftBukkit start - collidable API
@Override
public boolean canCollideWithBukkit(Entity entity) {
- return this.isPushable() && this.collides != this.collidableExemptions.contains(entity.getUUID());
+ return this.isPushable() && this.collides != (!this.collidableExemptions.isEmpty() && this.collidableExemptions.contains(entity.getUUID())); // Leaf - Optimize map lookups with isEmpty check
}
// CraftBukkit end