[1.14] Can't display a custom villager entity
desht opened this issue ยท 2 comments
I have the following page:
{
"type": "entity",
"name": "Mechanic",
"entity": "minecraft:villager{VillagerData:{profession:'pneumaticcraft:mechanic',level:1,type:'minecraft:plains'}}",
"text": "$(italic)Not a fan of $(l:tools/amadron_tablet)Amadron/$."
}
but it throws the following exception:
Caused by: java.lang.ClassCastException: net.minecraft.client.world.ClientWorld cannot be cast to net.minecraft.world.server.ServerWorld
at net.minecraft.entity.merchant.villager.VillagerEntity.readAdditional(VillagerEntity.java:439) ~[forge-1.14.4-28.2.3_mapped_snapshot_20191125-1.14.3-recomp.jar:?] {re:classloading}
at net.minecraft.entity.Entity.read(Entity.java:1667) ~[forge-1.14.4-28.2.3_mapped_snapshot_20191125-1.14.3-recomp.jar:?] {re:classloading,pl:accesstransformer:B}
at vazkii.patchouli.common.util.EntityUtil.lambda$loadEntity$0(EntityUtil.java:53) ~[Patchouli-1.14.4-1.1-25.128_mapped_snapshot_20191125-1.14.3.jar:1.1-25.128] {re:classloading}
... 39 more
Unfortunately, villager NBT reading requires a ServerWorld
(see VillagerEntity#readAdditional()
). Not sure there's an simple fix for this; possibly a custom extension of VillagerEntity
which overrides readAdditional()
to omit the resetBrain()
call?