Chickens with NoAI set to true still lay eggs
/summon minecraft:chicken ~1 ~ ~1 {NoAI:1b,EggLayTime:1}
Considering the mob should have no AI, eggs really should not appear.
Code Analysis
Code analysis done by [Mod] Anthony Cicinelli
Doing a check for the isNoAi() bool in the aiStep() method fixes this issue
Current Code
public void aiStep() { super.aiStep(); this.oFlap = this.flap; this.oFlapSpeed = this.flapSpeed; this.flapSpeed += (this.onGround ? -1.0F : 4.0F) * 0.3F; this.flapSpeed = Mth.clamp(this.flapSpeed, 0.0F, 1.0F); if (!this.onGround && this.flapping < 1.0F) { this.flapping = 1.0F; } this.flapping *= 0.9F; Vec3 vec3 = this.getDeltaMovement(); if (!this.onGround && vec3.y < 0.0D) { this.setDeltaMovement(vec3.multiply(1.0D, 0.6D, 1.0D)); } this.flap += this.flapping * 2.0F; if (!this.level.isClientSide && this.isAlive() && !this.isBaby() && !this.isChickenJockey() && --this.eggTime <= 0) { this.playSound(SoundEvents.CHICKEN_EGG, 1.0F, (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F); this.spawnAtLocation(Items.EGG); this.gameEvent(GameEvent.ENTITY_PLACE); this.eggTime = this.random.nextInt(6000) + 6000; } }
Fixed Code
public void aiStep() { super.aiStep(); this.oFlap = this.flap; this.oFlapSpeed = this.flapSpeed; this.flapSpeed += (this.onGround ? -1.0F : 4.0F) * 0.3F; this.flapSpeed = Mth.clamp(this.flapSpeed, 0.0F, 1.0F); if (!this.onGround && this.flapping < 1.0F) { this.flapping = 1.0F; } this.flapping *= 0.9F; Vec3 vec3 = this.getDeltaMovement(); if (!this.onGround && vec3.y < 0.0D) { this.setDeltaMovement(vec3.multiply(1.0D, 0.6D, 1.0D)); } this.flap += this.flapping * 2.0F; //Adding a check if the isNoAi bool fixes MC-69151 if (!this.level.isClientSide && this.isAlive() && !this.isBaby() && !this.isChickenJockey() && --this.eggTime <= 0 && !isNoAi()) { this.playSound(SoundEvents.CHICKEN_EGG, 1.0F, (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F); this.spawnAtLocation(Items.EGG); this.gameEvent(GameEvent.ENTITY_PLACE); this.eggTime = this.random.nextInt(6000) + 6000; } }
Linked Issues
is duplicated by1
Created Issue:
chickens with NoAI true still lay eggs
/summon Chicken ~ ~ ~ {NoAI:true}Considering the mob should have no AI, eggs really should not appear.
is duplicated by
/summonChicken ~ ~ ~ {NoAI:true}Considering the mob should have no AI, eggs really should not appear.
/summon minecraft:chicken ~1 ~ ~1 {NoAI:1b,EggLayTime:1}Considering the mob should have no AI, eggs really should not appear.
chickens with NoAI true still lay eggsChickens with NoAI set to true still lay eggs
/summon minecraft:chicken ~1 ~ ~1 {NoAI:1b,EggLayTime:1}Considering the mob should have no AI, eggs really should not appear.
Code Analysis
Code analysis done by [Mod] Anthony Cicinelli
Doing a check for the isNoAi() bool in the aiStep() method fixes this issue
Current Code
public void aiStep() { super.aiStep(); this.oFlap = this.flap; this.oFlapSpeed = this.flapSpeed; this.flapSpeed += (this.onGround ? -1.0F : 4.0F) * 0.3F; this.flapSpeed = Mth.clamp(this.flapSpeed, 0.0F, 1.0F); if (!this.onGround && this.flapping < 1.0F) { this.flapping = 1.0F; } this.flapping *= 0.9F; Vec3 vec3 = this.getDeltaMovement(); if (!this.onGround && vec3.y < 0.0D) { this.setDeltaMovement(vec3.multiply(1.0D, 0.6D, 1.0D)); } this.flap += this.flapping * 2.0F; if (!this.level.isClientSide && this.isAlive() && !this.isBaby() && !this.isChickenJockey() && --this.eggTime <= 0) { this.playSound(SoundEvents.CHICKEN_EGG, 1.0F, (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F); this.spawnAtLocation(Items.EGG); this.gameEvent(GameEvent.ENTITY_PLACE); this.eggTime = this.random.nextInt(6000) + 6000; } }Fixed Code
public void aiStep() { super.aiStep(); this.oFlap = this.flap; this.oFlapSpeed = this.flapSpeed; this.flapSpeed += (this.onGround ? -1.0F : 4.0F) * 0.3F; this.flapSpeed = Mth.clamp(this.flapSpeed, 0.0F, 1.0F); if (!this.onGround && this.flapping < 1.0F) { this.flapping = 1.0F; } this.flapping *= 0.9F; Vec3 vec3 = this.getDeltaMovement(); if (!this.onGround && vec3.y < 0.0D) { this.setDeltaMovement(vec3.multiply(1.0D, 0.6D, 1.0D)); } this.flap += this.flapping * 2.0F; //Adding a check if the isNoAi bool fixes MC-69151 if (!this.level.isClientSide && this.isAlive() && !this.isBaby() && !this.isChickenJockey() && --this.eggTime <= 0 && !isNoAi()) { this.playSound(SoundEvents.CHICKEN_EGG, 1.0F, (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F); this.spawnAtLocation(Items.EGG); this.gameEvent(GameEvent.ENTITY_PLACE); this.eggTime = this.random.nextInt(6000) + 6000; } }
/summon minecraft:chicken ~1 ~ ~1 {NoAI:1b,EggLayTime:1}Considering the mob should have no AI, eggs really should not appear.
Code Analysis
Code analysis done by [Mod] Anthony Cicinelli
Doing a check for the isNoAi() bool in the aiStep() method fixes this issue
Current Code
net/minecraft/world/entity/animal/Chicken.javapublic void aiStep() { super.aiStep(); this.oFlap = this.flap; this.oFlapSpeed = this.flapSpeed; this.flapSpeed += (this.onGround ? -1.0F : 4.0F) * 0.3F; this.flapSpeed = Mth.clamp(this.flapSpeed, 0.0F, 1.0F); if (!this.onGround && this.flapping < 1.0F) { this.flapping = 1.0F; } this.flapping *= 0.9F; Vec3 vec3 = this.getDeltaMovement(); if (!this.onGround && vec3.y < 0.0D) { this.setDeltaMovement(vec3.multiply(1.0D, 0.6D, 1.0D)); } this.flap += this.flapping * 2.0F; if (!this.level.isClientSide && this.isAlive() && !this.isBaby() && !this.isChickenJockey() && --this.eggTime <= 0) { this.playSound(SoundEvents.CHICKEN_EGG, 1.0F, (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F); this.spawnAtLocation(Items.EGG); this.gameEvent(GameEvent.ENTITY_PLACE); this.eggTime = this.random.nextInt(6000) + 6000; } }Fixed Code
net/minecraft/world/entity/animal/Chicken.javapublic void aiStep() { super.aiStep(); this.oFlap = this.flap; this.oFlapSpeed = this.flapSpeed; this.flapSpeed += (this.onGround ? -1.0F : 4.0F) * 0.3F; this.flapSpeed = Mth.clamp(this.flapSpeed, 0.0F, 1.0F); if (!this.onGround && this.flapping < 1.0F) { this.flapping = 1.0F; } this.flapping *= 0.9F; Vec3 vec3 = this.getDeltaMovement(); if (!this.onGround && vec3.y < 0.0D) { this.setDeltaMovement(vec3.multiply(1.0D, 0.6D, 1.0D)); } this.flap += this.flapping * 2.0F; //Adding a check if the isNoAi bool fixes MC-69151 if (!this.level.isClientSide && this.isAlive() && !this.isBaby() && !this.isChickenJockey() && --this.eggTime <= 0 && !isNoAi()) { this.playSound(SoundEvents.CHICKEN_EGG, 1.0F, (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F); this.spawnAtLocation(Items.EGG); this.gameEvent(GameEvent.ENTITY_PLACE); this.eggTime = this.random.nextInt(6000) + 6000; } }
Closest Issue Found – MC-69151
I'm assuming the response will be the same as to the Ticket mentioned above, but though it wouldn't hurt to add into be checked.
Chickens still Flap when NoAI is set on them, even when on the Ground. Should be removed for both instances. Same with Horses Bucking Up.
In a way, the regular egg can be seen as some sort of Survival-spawn egg, so I'd also assume on first glance that it is intended.. Which reminds me a bit of MC-61006 and MC-69151, where NoAI-Chicken or AI-chicken with Mobloot-gamerule off still lay eggs, which I personally would prefer to be adjustable for mapmaker's sake at least (maybe with another tag) and not WaI/Won't Fix for both, but that's another thing.
I guess we need to live with some exceptions from the rules or special cases every now and then ![]()
Duplicate of MC-69151

Bug confirmed for 1.8
Still happening in 1.8.3
Confirmed for 1.8.5
As [Mojang] Searge (Michael Stoyke) has stated on several issues,
That must be one of the most meaningless statements ever made. Anyway, where can we at least suggest this to be changed? It's pretty annoying that they still lay eggs.
For feature suggestions or changes please see: Minecraft Suggestions on Reddit.
Hold up. Why do you assume laying eggs is not a part of its AI?
I didn't assume, I looked at the code. There are many aspects of entity behavior that logically should be handled by the AI that aren't, because they're remnants of old code. Hopefully that will change when entities are given an overhaul.
Will trigger a bug report: "Chickens with NoAI true no longer lay eggs"
Every change breaks someone's workflow.
Fixing this would just limit options; the egg laying is already controlled/disable-able with the IsChickenJockey tag.
I can confirm this behavior in 1.19.2. You can use the following command to easily reproduce this issue.
/summon minecraft:chicken ~1 ~ ~1 {NoAI:1b,EggLayTime:1}