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:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user