Advertisement
Guest User

Untitled

a guest
Aug 17th, 2019
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.92 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.         System.out.println("debug line anchor");
  49.         return nbt;
  50.     }
  51.  
  52.     public static StructureSpawning get(World world) {
  53.         StructureSpawning save = (StructureSpawning) world.getMapStorage().getOrLoadData(StructureSpawning.class,
  54.                 IDENTIFIER);
  55.  
  56.         if (save == null) {
  57.  
  58.             save = new StructureSpawning();
  59.             world.getMapStorage().setData(IDENTIFIER, save);
  60.  
  61.         }
  62.         return save;
  63.     }
  64.  
  65.     public void setBlimpCount(int value) {
  66.         this.blimpCount = value;
  67.         this.markDirty();
  68.     }
  69.     public int getBlimpCount() {return this.blimpCount;}
  70.    
  71.  
  72.  
  73. public void setPos(int x, int y, int z) {
  74.     this.posX = x;
  75.     this.posY = y;
  76.     this.posZ = z;
  77.    
  78.    
  79.     this.markDirty();
  80.    
  81. }
  82.  
  83. public List<Integer> getPos() {
  84.     pos.add(posX);
  85.     pos.add(posY);
  86.     pos.add(posZ);
  87.         return pos;
  88. }
  89.  
  90.  
  91.  
  92.  
  93. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement