Cozary / Issue-Tracker

Issue Tracker of all of my mods.
0 stars 0 forks source link

RageMind (and possibly others) force cast wearer to Player, causing crash on non-player entities #78

Closed lcy0x1 closed 7 months ago

lcy0x1 commented 8 months ago

Forge 1.20.1 NamelessTrinkets 1.7.8 Curios use LivingEntity for wearer because it intends non-player to be able to wear curios as well. In 1.20.1, Curios formally adds infrastructure to allow non-player entities to wear curio. However, this mod still casts wearer to player without checks, causing crash when things are equipped on non-player entities.

Example crash log:

java.lang.ClassCastException: class dev.xkmc.modulargolems.content.entity.metalgolem.MetalGolemEntity cannot be cast to class net.minecraft.world.entity.player.Player (dev.xkmc.modulargolems.content.entity.metalgolem.MetalGolemEntity is in module modulargolems@2.4.30 of loader 'TRANSFORMER' @459e120b; net.minecraft.world.entity.player.Player is in module minecraft@1.20.1 of loader 'TRANSFORMER' @459e120b)
    at com.cozary.nameless_trinkets.items.trinkets.RageMind.curioTick(RageMind.java:125) ~[Nameless%20Trinkets-1.20.1-1.7.8.jar%23612!/:?] {re:classloading,pl:rei_plugin_compatibilities:B}
    at top.theillusivec4.curios.common.capability.ItemizedCurioCapability.curioTick(ItemizedCurioCapability.java:55) ~[curios-forge-5.7.2+1.20.1.jar%23512!/:5.7.2+1.20.1] {re:classloading,pl:rei_plugin_compatibilities:B}
    at top.theillusivec4.curios.common.event.CuriosEventHandler.lambda$tick$30(CuriosEventHandler.java:568) ~[curios-forge-5.7.2+1.20.1.jar%23512!/:5.7.2+1.20.1] {re:classloading,pl:rei_plugin_compatibilities:B}
Cozary commented 8 months ago

Trinkets are not intended to be used by any creature other than the Player.

I understand from the message that you would like it to be possible for other entities to be able to use them, rather than simply avoiding the crash.

I don't think it's negative to add it, so I'll keep it in mind for the future.

lcy0x1 commented 7 months ago

I understand that some trinkets are not meant to be used by non-players. I'm the dev of ModularGolems. I just want to make sure things won't crash when player put them on golems.