mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
66 lines
1.5 KiB
Java
66 lines
1.5 KiB
Java
package com.hbm.saveddata;
|
|
|
|
import java.util.Arrays;
|
|
|
|
import net.minecraft.nbt.NBTTagCompound;
|
|
|
|
public class SatelliteSaveStructure {
|
|
|
|
public int satelliteID;
|
|
public int satDim;
|
|
public SatelliteType satelliteType;
|
|
public long lastOp;
|
|
|
|
public SatelliteSaveStructure() { }
|
|
|
|
public SatelliteSaveStructure(int id, SatelliteType type, int dim) {
|
|
satelliteID = id;
|
|
satelliteType = type;
|
|
satDim = dim;
|
|
}
|
|
|
|
public enum SatelliteType {
|
|
|
|
//Prints map remotely
|
|
MAPPER,
|
|
//Displays entities
|
|
RADAR,
|
|
//Prints map, ores only
|
|
SCANNER,
|
|
//Does nothing
|
|
RELAY,
|
|
//Death ray
|
|
LASER,
|
|
//Allows use of AMS
|
|
RESONATOR,
|
|
//Farms ores for free
|
|
MINER;
|
|
|
|
public static SatelliteType getEnum(int i) {
|
|
if(i < SatelliteType.values().length)
|
|
return SatelliteType.values()[i];
|
|
else
|
|
return SatelliteType.RELAY;
|
|
}
|
|
|
|
public int getID() {
|
|
return Arrays.asList(SatelliteType.values()).indexOf(this);
|
|
}
|
|
}
|
|
|
|
public void readFromNBT(NBTTagCompound nbt, int index) {
|
|
satelliteID = nbt.getInteger("sat_" + index + "_id");
|
|
satelliteType = SatelliteType.getEnum(nbt.getInteger("sat_" + index + "_type"));
|
|
satDim = nbt.getInteger("sat_" + index + "_dim");
|
|
lastOp = nbt.getLong("sat_" + index + "_op");
|
|
}
|
|
|
|
public void writeToNBT(NBTTagCompound nbt, int index) {
|
|
nbt.setInteger("sat_" + index + "_id", satelliteID);
|
|
nbt.setInteger("sat_" + index + "_type", satelliteType.getID());
|
|
nbt.setInteger("sat_" + index + "_dim", satDim);
|
|
nbt.setLong("sat_" + index + "_op", lastOp);
|
|
}
|
|
|
|
}
|