Despawn Mob - Feature Request

Issue description

Hello everyone, it's me, TheGreatKingBoo_!

Today, i just wanted to do a quick suggestion for a thing that strangely hasn't been implemented yet (from what i know atleast): The "Despawn Mob" procedure element

Basically, it would just despawn the mob that has this element in his procedure, nothing too hard to understand!

Issue comments

Submitted by Klemen on Sat, 05/12/2018 - 17:11

So you would like a procedure block to remove the entity that is provided via dependency?

Submitted by Klemen on Sat, 05/12/2018 - 18:27

Thank you for the suggestion, we will implement this in next update.

Submitted by buddy3315 on Sun, 05/20/2018 - 00:56

I'm not sure if this is related but I did see something where you can banish the mob to another dimension. Could that be useful?

if you can't wait for the update here is the code for it :)

this one is for when you right click the mob with a specific item it will die V

if (entity.inventory.getCurrentItem() != null && entity.inventory.getCurrentItem().getItem() == mcreator_adogbiscuit.block) {
                if (entity instanceof EntityPlayer)
                    setDead();
            }

            return true;

 

(paste this under the ProcessInteract part)

 

And this one is for when a mob has existed for a certain amount of ticks it dies V

 

         @Override
public void onUpdate()
{
    super.onUpdate();

    if (this.ticksExisted >= 600)
    {
        this.setDead();
    }
}
 

(paste this under onStruckByLightning)

 

Submitted by Klemen on Mon, 06/18/2018 - 19:46

setDead() method is very problematic in the aspect of server-side mods. We have added set health procedure block instead. You will be able to use this block from 1.8.0 on. Use the set health block and set the value to 0.

For healing to max health it will be useful, but you would need a "get health" for adding specific amounts of health. Being able to do a negative amount of damage to an entity would give the se result though probably would need a totally different code.