IndustrialReborn

IndustrialReborn

150k Downloads

Animal Feeder continuously feeds animals on their breeding cooldown, tends to "prefer' certain animals

trunksbomb opened this issue ยท 3 comments

commented

image

I tried to get creative with cow breeding and set up this tower of cows. I am using the Animal Feeder to breed the cows, but two behaviors are unexpected:

  1. The Feeder continues to feed animals that can't breed - this isn't necessarily a problem since the machine is the Animal Feeder, not the Animal Breeder. However, it is unexpected because of the following point:
  2. The Feeder "prefers" animals in a certain position. I'm assuming that this is simply a byproduct of how the vanilla serverWorld.getEntitiesByClass() method operates, probably returning the entity list in the same order every time. This normally wouldn't be a problem because the animals are moving around, but my cows are locked in position and so presumably the list is the same every time.

I propose two solutions, both of which would solve this particular issue on their own:

  1. Randomize the list of nearby entities after obtaining it AND/OR
  2. Sort the list of nearby entities to put animals that haven't bred yet at the front

In either case, the Feeder will continue to feed all animals as it does but it will either prefer animals that haven't been bred yet or it will be completely random which two animals it chooses.

commented

I can't seem to reproduce this problem myself. Are you on 1.20.4 or 1.20.1?

commented

I have sorted the animal feeder's nearby entities by their age (in 2c40e27), but since I can't reproduce, I'm unsure if this will fix your issue, hence why I'm leaving this open.

commented

My apologies, I found the problem. It has been fixed in bba813a and a new release is out on CurseForge