The Bug:
The "maxEntityCramming" gamerule doesn't apply to bats.
Steps to Reproduce:
Summon around fifty bats.
Teleport all of the bats to your position by using the command provided below.
/tp @e[type=minecraft:bat] @s
Take note as to whether or not some of the bats received damage as a result of lots of them occupying the same space.
Observed Behavior:
The "maxEntityCramming" gamerule doesn't apply to bats.
Expected Behavior:
The "maxEntityCramming" gamerule would apply to bats.
Code Analysis:
Code analysis by @unknown can be found in this comment.
Linked issues
is duplicated by 3
relates to 2
Attachments
Comments 10
I used spawn eggs as well as the summon command. I set the maxEntityCramming gamerule to its default setting.
Based on MCP 1.12.2:
The reason for this is that the method for cramming is in EntityLivingBase.collideWithNearbyEntities()
, and the logic is inside the same block that makes entities push each other.
List<Entity> list = this.world.getEntitiesInAABBexcluding(this, this.getEntityBoundingBox(), EntitySelectors.getTeamCollisionPredicate(this));
Bats are excluded because getTeamCollisionPreciate()
returns false when the entity cannot be pushed, and EntityBat.canBePushed()
simply returns false.
Since it's rather explicit that only entities that can be pushed affect cramming (and that makes logical sense), I believe this is intended.
Duplicate of MC-89683
Can confirm in 21w41a. The expected behavior would be that bats would be affected by the "maxEntityCramming" gamerule, just like every other entity.
What commands are you using? How are you testing it?