Advertisement
Guest User

Untitled

a guest
Aug 16th, 2019
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.89 KB | None | 0 0
  1. package com.izako.HunterX.worlddata;
  2.  
  3. import java.util.ArrayList;
  4. import java.util.List;
  5.  
  6. import com.izako.HunterX.util.Reference;
  7.  
  8. import net.minecraft.nbt.NBTTagCompound;
  9. import net.minecraft.world.World;
  10. import net.minecraft.world.storage.WorldSavedData;
  11.  
  12. public class StructureSpawning extends WorldSavedData {
  13.  
  14.     private static final String IDENTIFIER = Reference.MOD_ID + "WORLDDATA";
  15.  
  16.     private NBTTagCompound data = new NBTTagCompound();
  17.     private int blimpCount = 0;
  18.     private List<Integer> pos = new ArrayList<>();
  19.     private int posX = 0;
  20.     private int posY = 0;
  21.     private int posZ = 0;
  22.    
  23.     public StructureSpawning(String s) {
  24.         super(s);
  25.        
  26.     }
  27.  
  28.     public StructureSpawning() {
  29.         super(IDENTIFIER);
  30.        
  31.     }
  32.  
  33.     @Override
  34.     public void readFromNBT(NBTTagCompound nbt) {
  35.         blimpCount = nbt.getInteger("count");
  36.         posX = nbt.getInteger("posX");
  37.         posY = nbt.getInteger("posY");
  38.         posZ = nbt.getInteger("posZ");
  39.        
  40.     }
  41.  
  42.     @Override
  43.     public NBTTagCompound writeToNBT(NBTTagCompound nbt) {
  44.         nbt.setInteger("count", this.blimpCount);
  45.         nbt.setInteger("posX", posX);
  46.         nbt.setInteger("posY", posY);
  47.         nbt.setInteger("posZ", posZ);
  48.         return nbt;
  49.     }
  50.  
  51.     public static StructureSpawning get(World world) {
  52.         StructureSpawning save = (StructureSpawning) world.getMapStorage().getOrLoadData(StructureSpawning.class,
  53.                 IDENTIFIER);
  54.  
  55.         if (save == null) {
  56.  
  57.             save = new StructureSpawning();
  58.             world.getMapStorage().setData(IDENTIFIER, save);
  59.  
  60.         }
  61.         return save;
  62.     }
  63.  
  64.     public void setBlimpCount(int value) {
  65.         this.blimpCount = value;
  66.         this.markDirty();
  67.     }
  68.     public int getBlimpCount() {return this.blimpCount;}
  69.    
  70.  
  71.  
  72. public void setPos(int x, int y, int z) {
  73.     this.posX = x;
  74.     this.posY = y;
  75.     this.posZ = z;
  76.    
  77.     pos.clear();
  78.     pos.add(posX);
  79.     pos.add(posY);
  80.     pos.add(posZ);
  81.     this.markDirty();
  82.    
  83. }
  84.  
  85. public List<Integer> getPos() {
  86.         return pos;
  87. }
  88.  
  89.  
  90.  
  91.  
  92. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement