[1.14.4] Upgrade Aquatic causes casting issue with projectile/special attack entity being cast to LivingEntity
noobanidus opened this issue ยท 3 comments
I haven't the time to look into it extensively myself but I'm presuming that some type of loot table is being registered or instantiated for this wave entity and thus JER is presuming it is a living entity.
You might need to check inheritance before casting here.
I can comment on this as well. The add()
methods in MobTableBuilder
always use LivingEntity
without even checking if its an instance of it. Right now it cycles through all the registered entities, and this doesn't exactly work well since the entities won't always be an instance of LivingEntity
of course, but I did also notice there is a check to tell if the entity is in the MISC
classification before calling the add()
method; this works fine in Vanilla, but some other modders might not realize what impact that really has.
Looking at it further, I don't understand why you're making the assumption that every non-MISC will be EntityType<LivingEntity>
, especially when you are specifically using generics to cast to it. If you used EntityType<?>
instead (as ForgeRegistries.ENTITIES
is) you could do:
Entity LivingEntity = entityType.create(world)
if (LivingEntity instanceof LivingEntity) {
}
The only other use I can see of this is with sheep specifically, so I'm guessing if you just split out the add
which takes an EntityPropertySetter<T>
into its own thing specifically for sheep, you could (with a little duplication) have both pretty easily -- and not crash when things aren't descended from LivingEntity.
I attempted to test this out for myself but I'm unable to build the project for some reason due to the access transformer on the loot pool conditions not functioning properly.