Please, do not close this issue as a duplicate of an Invalid or Duplicate report!
I've seen many people try to report this bug, always to have it closed as a duplicate of
MC-16257 or a duplicate of a duplicate of MC-16257. The outcome is the same: a valid ticket is closed as a duplicate of an "invalid" one, hindering chances of this bug ever being fixed. Either re-open MC-16257, or do not close this as a duplicate, please. What follows is some pretty solid evidence that this bug is not Invalid.
What I expected to happen:
Horse spawners would work in the game whether or not SpawnData/SpawnPotentials are present.
What actually happened:
The game crashed in response to a horse spawner if and only if it had SpawnData or SpawnPotentials. This renders it impossible to create a custom horse spawner in vanilla Minecraft.
Why this is not Invalid:
Contrary to Dinnerbone's claim, this crash does not only happen due to invalid entity IDs. A spawner with the EntityID "EntityHorse" will not cause a crash, unless it also includes SpawnData or SpawnPotentials. This behavior is unique to EntityHorse; no other entity causes crashes if and only if a spawner attempts to customize its properties.
Steps to Reproduce:
- Import the attached "Good Random Horse" schematic into your world.
- Observe that it spawns horses, but they are random. Also observe that no horse is spinning in the spawner cage.
- Import the attached "Bad Horse" schematic into your world.
- Observe that it, too, does not crash the game...
- Wait until it spawns a horse, and observe that your game has crashed! Not consistent or logical behavior at all, is it?
- Import the attached "Forced Good Custom Horse" schematic into your world. This schematic makes use of entity riding to hide the horse from the player until it has already been spawned, narrowly avoiding the crash (the developer console still gets spammed with stacktraces however - more on that below).
- Observe that it spawns white horses every time.
- More importantly, observe that it does not stop spawning horses regardless of how many are nearby. It also allows horses to spawn underwater, in darkness, or even inside solid blocks. The workaround may avoid causing the crash, but I certainly wouldn't call this a permanent solution!
- Note that the spawner's odd behavior is actually intended: the rider of the horses is a quickly-despawning XPOrb. Thus, the spawner's entity cap and spawn condition rules follow those of XPOrbs. Please don't change this behavior; many spawner setups make use of the "topmost entity defines spawning conditions" behavior and would break if it were changed (the behavior allows mapmakers to customize spawning conditions to suit their needs). The "Forced Good Custom Horse" schematic doesn't need any fixing - "Bad Horse" does!
I'm not sure why this would happen, but check out "Console Spam InvocationTargetException.txt" - it's an incredibly long stacktrace which occurs prior to the crash. It's not part of the crash report, so I don't think anyone's reported it yet. It's produced by EntityList.createEntityByName (MCP name) when trying to render any horse spawner (any of the three attached schematics): this is why the entity is null by the time the game hits line 110 of the spawner logic class, causing the crash. This is also what differentiates this from your average "unknown entity ID" crash - the ID is not unknown, but I have no idea why the reflection calls fail.
EDIT: I have found the cause; I've posted in-detail below. To sum it up briefly, horses don't accept instantiation with a null world, which happens to be a requirement for mobs to not cause crashes with SpawnData spawners.