Advertisement
Guest User

Untitled

a guest
Feb 24th, 2017
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.23 KB | None | 0 0
  1. private boolean isReliquaryCrafted;
  2.     private static final String IDENTIFIER = Reference.MOD_ID;
  3.    
  4.     public ModWorldSavedData()
  5.     {
  6.         super(IDENTIFIER);
  7.     }
  8.    
  9.     public ReliquaryWorldData(String name)
  10.     {
  11.         super(name);
  12.     }
  13.  
  14.     @Override
  15.     public void readFromNBT(NBTTagCompound compound)
  16.     {
  17.         isReliquaryCrafted = compound.getBoolean("isReliquaryCrafted");
  18.     }
  19.  
  20.     @Override
  21.     public NBTTagCompound writeToNBT(NBTTagCompound compound)
  22.     {
  23.         compound.setBoolean("isreliquarycrafted", isReliquaryCrafted);
  24.         return compound;
  25.     }
  26.    
  27.     public void onReliquaryCrafted()
  28.     {
  29.         if(!isReliquaryCrafted)
  30.         {
  31.             this.isReliquaryCrafted = true;
  32.             this.markDirty();
  33.         }
  34.     }
  35.    
  36.     public void setReliquaryCrafted(boolean isReliquaryCrafted)
  37.     {
  38.         this.isReliquaryCrafted = isReliquaryCrafted;
  39.         this.markDirty();
  40.     }
  41.    
  42.     public boolean isReliquaryCrafted()
  43.     {
  44.         return isReliquaryCrafted;
  45.     }
  46.    
  47.     public static ReliquaryWorldData get(World world)
  48.     {
  49.         MapStorage storage = world.getMapStorage();
  50.         ReliquaryWorldData instance = (ReliquaryWorldData)storage.getOrLoadData(ReliquaryWorldData.class, IDENTIFIER);
  51.        
  52.         if(instance == null)
  53.         {
  54.             instance = new ReliquaryWorldData();
  55.             storage.setData(IDENTIFIER, instance);
  56.         }
  57.         return instance;
  58.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement