Force LazyEntityCollisionContext#getEntity() to delegate

By delegating when the entity is retrieved, we can correctly catch
cases where the collision method is inspecting some entity state.
This commit is contained in:
Spottedleaf
2024-12-01 11:36:16 -08:00
parent e40c40613d
commit 6c75d6935e

View File

@@ -2162,10 +2162,16 @@ public final class CollisionUtil {
public CollisionContext getDelegate() {
this.delegated = true;
final Entity entity = this.getEntity();
final Entity entity = super.getEntity();
return this.delegate == null ? this.delegate = (entity == null ? CollisionContext.empty() : CollisionContext.of(entity)) : this.delegate;
}
@Override
public Entity getEntity() {
this.getDelegate();
return super.getEntity();
}
@Override
public boolean isDescending() {
return this.getDelegate().isDescending();