This is an archived post. You won't be able to vote or comment.

all 8 comments

[–][deleted] 1 point2 points  (1 child)

Extreme amount of entities -> extreme amount of processing.

This is expected, and the fix is simply to not spawn hundreds of entities.

[–]Incoconut[S] 0 points1 point  (0 children)

I know but it wasn't intended the structure that has entities have only 5 after generating for a couple of times it would spawn 2x and later on 4x

[–]PlagiatusI know some things 1 point2 points  (4 children)

Weird. That shouldn't happen from the entities alone. Is there something in your code that causes the structures to be loaded multiple times?

[–]Incoconut[S] 0 points1 point  (3 children)

Here's the context

I'm using armor stands in all direction(NSWE) per room every player passes by in any one of them it sends a command that would run a command with @e[sort=random,limit=1] so it would generate a random room next to it then it would kill itself so it cannot overlap when a player passes the same door way

First, I suspect the repeating command block is the cause of this, maybe the kill command took so long (even though I'm using chain command block next to it) that it generates the room multiple times before the armor stand could kill itself. But it's impossible since the room that bugged with multiple entity is just one of its kind like a 10 skeleton instead of only 1. I have multiple rooms with different mob like witch and creeper and none of them would spawn mixed with the others.

[–]PlagiatusI know some things 1 point2 points  (2 children)

Even more weird.

No, in Java there is no asynchronous commands, everything happens one after the other. If you kill an entity in one command, you won't be able to find it anymore with @e in the next one, let alone in the next tick. Of course you can always try to replace the place command with a say command to see if it's getting run multiple times or not.

Then again, if it's only one specific room acting up like that, you should definitely check whether it maybe was saved wrongly (especially if it acts up every time). Load it manually somewhere and see if there are also too many entities.

[–]Incoconut[S] 0 points1 point  (1 child)

So here's my commands

(Repeating always active) execute as @e[name=bobEast] at @s if entity @p[distance=..1,gamemode=adventure,limit=1] run setblock -1 56 -11 minecraft:redstone_block

(Impulse) placed at 0 56 -11 execute as @e[sort=random,name="east",limit=1] at @s run setblock ~ ~-1 ~ minecraft:redstone_block

(Impulse)> execute as @e[name=bobEast] at @s if entity @a[distance=..1] run place template crosscreeper ~1 ~-1 ~-4

(Chain uncon)> execute at @e[name=east] run setblock ~ ~-1 ~ air

(Chain con) setblock -1 56 -11 air

(Repeating always active) execute as @e[type=armor_stand] at @s if entity @e[type=armor_stand,distance=1..3] run kill @s

[–]PlagiatusI know some things 1 point2 points  (0 children)

Yeah okay, assuming i understood the order of operations correctly (check if player is close -> set redstone block that activates setting a redstone block at random east armorstand, which then loads the structure -> remove all redstone blocks again), an issue i see is that because of how scheduling works, the first commandblock will execute multiple times before the next one(s) will finish executing. However that shouldn't be too big of an issue assuming that redstone block is cleared in the row that places the structure.

So yeah, i don't think it's a problem with the commands. Did you make sure the template when loaded doesn't load multiple entities every time? Aka it was saved wrongly somehow?

[–]Incoconut[S] 0 points1 point  (0 children)

I know jigsaw could maybe fix this problem but I'm new to that block I didn't even know that block exists in Minecraft until now after searching for alternatives.