34 lines
683 B
Java
34 lines
683 B
Java
package projectzombie.entity;
|
|
|
|
import mainloop.task.IMainloopTask;
|
|
import projectzombie.Main;
|
|
|
|
public class EntityEventHandler implements IMainloopTask
|
|
{
|
|
public static final EntityEventHandler ENTITY_EVENT_HANDLER = new EntityEventHandler();
|
|
|
|
@Override
|
|
public boolean MainLoopDelay(long millis) {
|
|
return millis > Main.tickrate;
|
|
}
|
|
|
|
@Override
|
|
public boolean MainLoopRepeat() {
|
|
return true;
|
|
}
|
|
|
|
@Override
|
|
public void MainLoopUpdate()
|
|
{
|
|
Main.menu.update();
|
|
if(!Main.menu.doGameloop) {
|
|
return;
|
|
}
|
|
|
|
// Update the world and spawn random entities
|
|
Main.world.tickEntities();
|
|
Main.world.spawnRandomEntities();
|
|
Main.player.tick(null, Main.world.getLayer());
|
|
}
|
|
}
|