This commit is contained in:
skippyall
2025-07-06 12:49:16 +02:00
parent 6640f95291
commit 66cbad38cb
2 changed files with 1 additions and 28 deletions
@@ -1,27 +0,0 @@
package io.github.skippyall.minions;
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class MinionsTickExecutor {
private static final List<Runnable> executeOnNextTick = Collections.synchronizedList(new ArrayList<>());
public static void register() {
ServerTickEvents.START_SERVER_TICK.register(server -> {
synchronized (executeOnNextTick) {
for (Runnable run:executeOnNextTick) {
run.run();
}
executeOnNextTick.clear();
}
});
}
public static void addExecuteOnNextTick(Runnable run) {
executeOnNextTick.add(run);
}
}
@@ -69,7 +69,7 @@ public class MinionFakePlayer extends ServerPlayerEntity {
PropertyMap skin = data.skin().orElse(null);
GameProfile profile = MinionProfileUtils.makeNewMinionProfile(data.uuid(), data.name(), skin);
doSpawn(data, profile, server, level, pos, rot);
server.send(server.createTask(() -> doSpawn(data, profile, server, level, pos, rot)));
}
}