package com.enderio.core.common.util;

import java.io.File;
import java.util.List;

import lombok.SneakyThrows;

import com.google.common.collect.Lists;

public class PermanentCache<I> extends WorldCache<I> {

  private static final List<PermanentCache<?>> allCaches = Lists.newArrayList();

  @SneakyThrows
  public PermanentCache(String ident) {
    super(ident);
    loadData(getSaveFile());
  }

  @Override
  @SneakyThrows
  protected File getSaveFile() {
    return new File("saves", ident + ".dat");
  }
  
  @Override
  protected void blockOldIDs() {
    if (!objToName.isEmpty()) {
      super.blockOldIDs();
    }
  }
  
  @Override
  protected void mergeNewIDs() {
    if (!objToName.isEmpty()) {
      super.mergeNewIDs();
    }
  }

  @Override
  public void addObject(I object, String name) {
    super.addObject(object, name);
    setID(name);
  }

  public static void saveCaches() {
    for (PermanentCache<?> c : allCaches) {
      c.saveData(c.getSaveFile());
    }
  }
}

@@ -147,16 +147,62 @@
 Lists;%0A%0A
+import cpw.mods.fml.common.FMLCommonHandler;%0A%0A
 public c
@@ -451,32 +451,16 @@
 verride%0A
-  @SneakyThrows%0A
   protec
@@ -480,24 +480,129 @@
 aveFile() %7B%0A
+    if (FMLCommonHandler.instance().getSide().isServer()) %7B%0A      return new File(ident + %22.dat%22);%0A    %7D%0A
     return n

Fix PermanentCache not saving on servers