Advertisement
Guest User

Untitled

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