示例#1
0
 @Override
 public void unload(boolean save) {
   for (Component component : values()) {
     component.onDetached();
   }
   if (save) {
     save();
   }
   Collection<Region> regions = this.regions.getRegions();
   final int total = Math.max(1, regions.size());
   int progress = 0;
   for (Region r : regions) {
     r.unload(save);
     progress++;
     if (save && progress % 4 == 0) {
       getEngine()
           .getLogger()
           .info(
               "Saving world ["
                   + getName()
                   + "], "
                   + (int) (progress * 100F / total)
                   + "% Complete");
     }
   }
 }
示例#2
0
 @Override
 public void startTickRun(int stage, long delta) {
   switch (stage) {
     case 0:
       {
         age.set(age.get() + delta);
         parallelTaskManager.heartbeat(delta);
         taskManager.heartbeat(delta);
         for (Component component : values()) {
           component.tick(delta);
         }
         break;
       }
     default:
       {
         throw new IllegalStateException("Number of states exceeded limit for SpoutWorld");
       }
   }
 }