Started by
Jenssons
on
Topic category: Help with Minecraft modding (Java Edition)
Hai i want a block when its placed to spawn a entity and then i want that block to keep that entity on top of it and if that entity dies spawn a new one to instantly replace it. is this possible to do? i imagine its something to do with the block keeping the entity's id in a local variable and then from there it can call from it to do checks if its still alive and on top of it, i do not know how to do that, would anyone be willing to help me. Maybe show me some code/layout thank you so much for reading
You can make the entity stay put by storing its location on top of the block as NBT tags and then setting its location to that place every tick. If this is done, absolutely nothing can move that mob.
You could also program the mob to instantly die if it detects it is no longer standing on the correct block.
Now as for making more of the entity... Maybe a procedure that detects how many of the mobs are nearby and spawns one on top if the number is zero?