Mob killed and attack events are swapped in MCreator 1.7.8

Published by Hakann on Wed, 03/07/2018 - 13:15
Status
Fixed
Type
Product/platform
Not applicable
Priority
Normal
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

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.



Donate to MCreator

By donating to developers you can speed up development, as with more resources, we can dedicate more time to MCreator. It is a free project made by developers working on it in their free time.