mojira.dev
MC-9164

Chickens can be bred with nether wart, melon seeds, and pumpkin seeds

What I expected to happen was...
Chickens would follow melon seeds, pumpkin seeds, and nether wart as they do wheat seeds.

What really happened was...
The Chickens ignored all three but could still be bred with them.

Steps to Reproduce:
1. Make a new Creative world.
2. Spawn a Chicken.
3. Get melon seeds, pumpkin seeds, and nether wart and hold them in front of the Chicken.
4. Observe how the Chicken takes no notice, but if you right click it with those seeds it will enter love mode.

Linked issues

Comments 17

Added Nether Wart.

Chicken's code checks the item used for breeding to be any kind of seed (all seed items inherit ItemSeeds class). However, the AI task responsible for detecting and following the player with seeds in hand defines only one acceptable item type; not by class or a list of IDs.

Possible fixes are either adding more tasks (each configured with different seed type) or adjusting the task implementation to allow a list of different seed types. I like the latter better...

Current code

EntityAITempt

...
    private int breedingFood; // <-- will be changed
    ...
    public EntityAITempt(EntityCreature creature, float par2, int breedingFoodId, boolean par4) {
        this.temptedEntity = creature;
        this.field_75282_b = par2;
        this.breedingFood = breedingFoodId; // <-- will be changed
        this.scaredByPlayerMovement = par4;
        this.setMutexBits(3);
    }
    ...
    public boolean shouldExecute() {
                ...
                ItemStack var1 = this.temptingPlayer.getCurrentEquippedItem();
                return var1 == null ? false : var1.itemID == this.breedingFood; // <-- will be changed
            }
        }
    }

EntityChicken

public EntityChicken(World world) {
        ...
        this.tasks.addTask(3, new EntityAITempt(this, 0.25F, Item.seeds.itemID, false));
        ...
    }

Fix

EntityAITempt

...
    private int[] breedingFoods; // <-- part of fix
    ...
    public EntityAITempt(EntityCreature creature, float par2, int breedingFoodId, boolean par4) {
        this.temptedEntity = creature;
        this.field_75282_b = par2;
        this.breedingFoods = new int[] { breedingFoodId }; // <-- part of fix
        this.scaredByPlayerMovement = par4;
        this.setMutexBits(3);
    }
    // New method
    public EntityAITempt(EntityCreature par1EntityCreature, float par2, int[] breedingFoodIds, boolean par4) {
        this.temptedEntity = par1EntityCreature;
        this.field_75282_b = par2;
        this.breedingFoods = breedingFoodIds;
        this.scaredByPlayerMovement = par4;
        this.setMutexBits(3);
    }
    ...
    public boolean shouldExecute() {
                ...
                ItemStack var1 = this.temptingPlayer.getCurrentEquippedItem();
                if (var1 == null)
                    return false;
                for (int i = 0; i < this.breedingFoods.length; i++)
                    if (var1.itemID == this.breedingFoods[i])
                        return true;
                return false;
            }
        }
    }

EntityChicken

public EntityChicken(World world) {
        ...
        this.tasks.addTask(3, new EntityAITempt(this, 0.25F, new int[] { Item.seeds.itemID, Item.melonSeeds.itemID, Item.netherStalkSeeds.itemID, Item.pumpkinSeeds.itemID }, false));
        ...
    }

Changes tested on 1.4.7 and they work. Now where did I put that lava bucket, too many chickens love me...

Chickens eating nether warts would seem strange to me... I'd also say they're only "seeds" for implementation reasons.
Maybe instead of changing the luring to match the breeding, the opposite would be more sensible?

Chickens eat quite a bit of stuff, not just wheat seed. However, not knowing what the nether stuff really is or how chickens would like it, I'll only say the same "seems strange to me". Also, I know what melon seeds are like, and I would think chickens wouldn't be that happy about eating them.

The change to drop nether wart from follow-effect (with my fixes) and edibles (would need a change still) is easy.

Also, simply dropping back to single seed (wheat's) would be just fine. However, I still think the change to allow multiple food items for tempting and breeding would be sensible in general, and just use it differently for different animals. Especially for pigs which eat just about anything. (Same seems to apply to some dogs, but that is another story.)

Is this issue still in 1.7.4 in survival or it's just my chickens preference?

7 more comments

Yeah, for me, the real bug is that they can be bred using these other things, not that they don't follow them.
That netherwart is considered a seed by the chickens (for breeding) is a side-effect of how they are implemented, not any kind of logic.
For the other real seeds, that they can be bred is also a side-effect, but it's more reasonable, so it's up to them as to whether they should work or not. But it should still be consistent between following and breeding.

Not sure if any of you who are complaining about the supposed new behavior have actually tested it, but they can't be bred or led with anything besides wheat seeds now.

Reoccurs in 1.8 pre-1

chumbanotz

migrated

Confirmed

chickens, melon, nether, pumpkin, seeds, wart

Snapshot 13w05b, Snapshot 13w06a, Snapshot 13w07a, Snapshot 13w09a, Snapshot 13w09b, ..., Minecraft 1.7.5, Minecraft 14w10b, Minecraft 14w10c, Minecraft 14w17a, Minecraft 1.8-pre1

Minecraft 14w34d

Retrieved