Mob killed and attack events are swapped in MCreator 1.7.8

Submitted by Hakann on Wed, 03/07/2018 - 13:15
Issue description

Mob killed and attack events are swapped!(This bug wasn't fixed in 1.7.8) See this in your custom code!

This code of attack event:

    public boolean attackEntityAsMob(Entity entityIn)
    {
        if (super.attackEntityAsMob(entityIn))
        {
            if (entityIn instanceof EntityLivingBase)
            {
            }

            return true;
        }
        else
        {
            return false;
        }
    }

For example mob can poisons entity(in easy Difficulty mob can not poisons entity) :

    public boolean attackEntityAsMob(Entity entityIn)
    {
        if (super.attackEntityAsMob(entityIn))
        {
            if (entityIn instanceof EntityLivingBase)
            {
                int i = 0;

                if (this.world.getDifficulty() == EnumDifficulty.NORMAL)
                {
                    i = 7;
                }
                else if (this.world.getDifficulty() == EnumDifficulty.HARD)
                {
                    i = 15;
                }

                if (i > 0)
                {
                    ((EntityLivingBase)entityIn).addPotionEffect(new PotionEffect(MobEffects.POISON, i * 20, 0));

            }

            return true;
        }
        else
        {
            return false;
        }
    }

Issue comments

Submitted by Klemen on Wed, 03/07/2018 - 19:32

I can confirm this bug. It will be fixed with next update. But just a note, events were not swapped but both events happened at entity death.