TransWikia.com

How can I make my summoned mobs despawn?

Arqade Asked by Elliott T on August 5, 2021

I am working on a project where I must make an ultimate skyblock map in Minecraft. I am using commands to generate mobs like cows and zombies. However, with the current despawn time in Minecraft, they fill up their islands and lag the game quite badly.

Here is an example of what I am doing now:
/summon creeper ~ ~ ~ {Age:5900}.

This creeper should despawn after only 5 seconds, but it persists. Any suggestions are appreciated. Thank you in advance, and my version is 1.17.

2 Answers

For a 5 second lifetime, you need to use the command:

summon creeper ~ ~ ~ {Age:100}

Answered by user228576 on August 5, 2021

You can always use scoreboards,

First type in chat: “/scoreboard objectives add Death air”

Add an always active repeating commandblock with “/scoreboard players add @e[tag=“Death”] Age 1”

Then add another always active repeating command block with “/kill @e[scores={Age=20}]”

(Note 20 ticks is one second, and since the repeating commandblock is basically reactivating every tick, each mob will be given their own 1 point every tick, and once they reach 20, that means they’ve been existing for one second.

You’re ofc free to change 20 to any amount of seconds such as if you want 6, you just multiply 6 • 20. Also note that you have to summon mobs with tags aswell as unlike despawning, the items drop.

Answered by SoupMoth _ on August 5, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP