Wyrmroost

Wyrmroost

7M Downloads

Summoning with Variants that do not exist crashes the game

Mlemtlestgent opened this issue ยท 2 comments

commented

https://pastebin.com/uGr1nFQJ

So I was testing with command blocks and I was attempting to see all the variants of the Alpine dragon. And I encountered an issue where the game would crash when I would attempt to spawn an Alpine with the variant 6, the command going as followed:
/summon wyrmroost:alpine 0 ~ 0 {Variant:6,NoAI:1}

The game crashes to desktop once the creature is spawned and any attempts to access the world will immediately cause a CTD and basically makes it inaccessible so it seems that an entity is spawned, but it automatically crashes the game.

commented

There are six Alpine variants. Presumably, their IDs are 0-5, so Variant 6 would probably be invalid. That said, it should probably default to something instead of crashing.

commented

This happens because I didn't design the rendering for entities that could possibly have more variants than the expected values. It's limited like this because I used an array instead of some sort of collection (reason behind this is because it could save someone a few more fps)
I didn't think about situations where the variant of a creature could be forced with something like /summon
I'll work on something more flexible.

For now, There is many solutions, and easy-to-avoid situations here:
To avoid this you can simply be more careful when it comes to summoning. Asking what the variant range for each creature is.
OR, you could do it the old school route and spamming spawn eggs until you get what you want. This is probably the safest bet.

For FIXING this: If you have a good knowledge on file systems and on how the game works, you can recover a world with an erroring entity like this. Using NBTExplorer you can dig into the world's save data, find the entity, and simply remove it from existence. This will solve the soft-locked world.