Cannot build an EntityType without a datafixer due to an IllegalArgumentException
The bug
This bug report is based off of Minecraft 1.15.2 Pre-release 2 with Yarn names and decompiled with FernFlower.
EntityType$Builder#build(String id) tries to get a datafixer for the entity before creating the type, and continue even if it is unable to get the fixer.
The vanilla code looks like this:
public EntityType<T> build(String id) { if (this.saveable) { try { Schemas.getFixer().getSchema(DataFixUtils.makeKey(SharedConstants.getGameVersion().getWorldVersion())).getChoiceType(TypeReferences.ENTITY_TREE, id); } catch (IllegalStateException var3) { if (SharedConstants.isDevelopment) { throw var3; } EntityType.LOGGER.warn("No data fixer registered for entity {}", id); } } return new EntityType(this.factory, this.category, this.saveable, this.summonable, this.fireImmune, this.spawnableFarFromPlayer, this.size); }
Vanilla catches an IllegalStateException, but the actual exception that is thrown by Schema#getChoiceType is IllegalArgumentException. This means that if an EntityType is built for an entity that doesn't have a type, the game will fail hard and crash.
Recommended change:
...
} catch (IllegalArgumentException var3) {
...
2020-01-19, 10:13 PM
2020-02-05, 01:35 PM
2020-02-05, 01:35 PM
1
0