mirror of
https://github.com/xSquishyLiam/mc-GeyserModelEngine-plugin.git
synced 2025-12-19 14:59:19 +00:00
Major Overhaul (needs testing)
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
package re.imc.geysermodelengine.runnables;
|
||||
|
||||
import com.ticxo.modelengine.api.model.ActiveModel;
|
||||
import io.papermc.paper.threadedregions.scheduler.ScheduledTask;
|
||||
import re.imc.geysermodelengine.GeyserModelEngine;
|
||||
import re.imc.geysermodelengine.managers.model.data.ModelEntityData;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public class UpdateTaskRunnable implements Consumer<ScheduledTask> {
|
||||
|
||||
private final GeyserModelEngine plugin;
|
||||
|
||||
public UpdateTaskRunnable(GeyserModelEngine plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void accept(ScheduledTask scheduledTask) {
|
||||
try {
|
||||
for (Map<ActiveModel, ModelEntityData> models : plugin.getModelManager().getEntitiesCache().values()) {
|
||||
models.values().forEach(model -> model.getEntityTask().updateEntityProperties(model, model.getViewers(), false));
|
||||
}
|
||||
} catch (Throwable err) {
|
||||
throw new RuntimeException(err);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user