Started by
RandomDrago
on
Topic category: Help with Minecraft modding (Java Edition)
So Basically- I want to make a custom mob despawn after a minute like a summoned creature expiring etc-
I thought of giving it wither but It wouldn't look good graphically and would probably have problems with it's ai
Alternatively I thought of using nbt tags etc to detect if it's timer is enough etc but I don't know how to do that.
If anyone could help I would appreciate it
how about using number data tag?
On initial entity spawn add NBT number tag for example: <timer> <1200> (one minute in ticks)
than on entity tick do something like:
if get NBT number tag > 0
set NBT number tag to [get NBT number tag - 1]
else
despawn entity
I hope this somehow helped
There should be an entity management block that despawns the target entity. Make a procedure that does the following, and call it on the entity's update tick, or when the entity is spawned.
If you want to make it a bit more dramatic, you could make particles spawn around the entity when it's about to despawn, (just make another wait block with a shorter duration), generate an explosion upon despawning, summon lightning, etc.
for dramatic particles you can execute command
particle minecraft:block redstone_block ~ ~1 ~ 0.3 0.3 0.3 0.3 50
(this command spawns particles imitating blood)
Actually, you can just do
"On Initial Entity Spawn"
Wait 1200 Ticks then do
Despawn event/target entity
Repeat 100 times
Wait pick random 0 to 100 ticks then do
Summon 5 particles on server side with range 3 blocks TYPE: PARTICLE NAME
Or something like that.
Folks! Thank you all so much-
I've honestly been looking around for such things but never saw anyone ever post about it so I decided to ask it myself and people actually have a solution for it now-
After asking the question I also thought of sth like
---
If source entity variable PlayerMana > 200
Summon FireElemental at SourceEntity
Check entity iterator square cube 4 subtype FireElemental
Get UUID EventTargetEntity
If data summontimer = 0
Despawn EventTargetEntity/UUID
Else
Set data summontimer - 1
---
It's honestly brilliant what an outrageous amount of talent this community has! I personally think RandomDudeGamer's reply might be the simplest and easiest one but what do they mean by the code below? Is it like- Within 100 ticks it summons 100 particles of the type and since it's within 100 ticks it's not all at once/cluttered etc?
--
Repeat 100 times
Wait pick random 0 to 100 ticks then do
--
Wait 1200 ticks do despawn event target entity
Yeah, the particles won't spawn all at once. Between 0 and 100 ticks (0~5 seconds), around 500 particles will spawn randomly when the mob is despawning. Doing too much more will kinda lag the game. Also, when doing like campfire smoke, or big particles, bring the "spawn 5 particles on server side" down to "spawn 1 particles on server side", because trust me, it lags A LOT.
hello, I know this post is from a very long time ago but I would like to have a photo of how to do this procedure, I am new to Mcreator