Chickens

Chickens

17M Downloads

Cycle in chicken parents causes stack overflow

ryankoppenhaver opened this issue ยท 3 comments

commented

Issue Description:

(This might be a case of "well, don't do that, then", but I didn't see anything in the description or other issues about it, so I thought I'd report it just in case. I'm going to just work around this in my own pack by adding some crafting recipes.)

The isEnabled() method in ChickenRegistryItem recursively calls isEnabled() on the current chicken's parents. If any chicken type is its own ancestor, this leads to infinite recursion:

net.minecraftforge.fml.common.LoaderExceptionModCrash: Caught exception from Chickens (chickens)
Caused by: java.lang.StackOverflowError
	at com.setycz.chickens.registry.ChickensRegistryItem.isEnabled(ChickensRegistryItem.java:174)
	at com.setycz.chickens.registry.ChickensRegistryItem.isEnabled(ChickensRegistryItem.java:175)
	at com.setycz.chickens.registry.ChickensRegistryItem.isEnabled(ChickensRegistryItem.java:175)
	at com.setycz.chickens.registry.ChickensRegistryItem.isEnabled(ChickensRegistryItem.java:175)
[...]

Steps to reproduce (important):

  1. Edit config/chickens/chickens.json as follows:

    "chickens:snowballchicken": {
     /* ... */
      "parent_1": "chickens:whitechicken",
      "parent_2": "chickens:waterchicken"
    },
    "chickens:waterchicken": {
      /* ... */
      "parent_1": "chickens:bluechicken",
      "parent_2": "chickens:snowballchicken"
    },
  2. Launch Minecraft

What happens:

The game crashes during startup.

What you expected to happen:

The player could find either snowball or water chickens in the world, then breed the other.

Affected Versions:

  • Chickens: 6.1.0
  • Minecraft: 1.12.2
  • Forge: 14.23.4.2753
commented

humm. yeah I think your the first person to ever do that. I will look into some type of a fix for it.

commented

hello i have this same problem xD but i modifity all ;) + use logic breed.

any can help to work it ?
chickens.zip

commented

@halk6000
For me this happened when I tried to make the Soulstone and Quartz chickens breedable. Putting those two back to blank made it load.