Create

Create

86M Downloads

Trains Causing Crash

nebbne1st opened this issue ยท 1 comments

commented

Describe the Bug

When my trains (using the create mod in the Minecolonies dimensional adventure modpack 1.9 redux hotfix) collide with an entity it sometimes causes the game to crash, normally when its above a low speed but i think that is just coincidence

Reproduction Steps

1.Board a train
2.Move the train along the track
3.Collide with an entity (mob are other animal etc)
...

Expected Result

The server to not crash and the entity collided to just die or be pushed out of the way

Screenshots and Videos

No response

Crash Report or Log

https://pastebin.com/M6YybYUq

Operating System

Windows 10

Mod Version

0.5.1d

Minecraft Version

1.20.1

Forge Version

47.1.3

Other Mods

(Mod list is at the bottom of the crash report)

Additional Context

No response

commented

Due to unsafe code from https://www.curseforge.com/minecraft/mc-mods/durts-nether-dungeons

    @SubscribeEvent
    public static void applyVampirismEffect(LivingDeathEvent event) {
        if (!event.getEntity().f_19853_.m_5776_() && event.getSource().m_7639_() != null) {
            LivingEntity killer = (LivingEntity)event.getSource().m_7639_();
            LivingEntity entity = event.getEntity();
            if (killer.m_21023_((MobEffect)NDEffects.VAMPIRISM.get())) {
                int effectAmplifier = killer.m_21124_((MobEffect)NDEffects.VAMPIRISM.get()).m_19564_();
                int healPercentage = (effectAmplifier + 1) * 5 + 5;
                float healthToHeal = entity.m_21233_() * (float)healPercentage / 100.0F;
                killer.m_5634_(healthToHeal);
                killer.f_19853_.m_5594_((Player)null, killer.m_20183_(), (SoundEvent)NDSounds.VAMPIRISM.get(), SoundSource.PLAYERS, 1.0F, 1.0F);
            }
        }
    }

There is a reason why getEntity returns Entity and not LiviningEntity, you can't just blindly cast that