This repository has been archived on 2022-11-23. You can view files and clone it, but cannot push or open issues or pull requests.
arcane-seals/src/main/java/net/anvilcraft/arcaneseals/SealData.java

50 lines
1.2 KiB
Java
Raw Normal View History

package net.anvilcraft.arcaneseals;
import net.anvilcraft.arcaneseals.tiles.TileSeal;
import net.minecraft.nbt.NBTTagCompound;
public class SealData {
public int dim;
public int x;
public int y;
public int z;
public short orientation;
public byte rune;
public SealData() {}
public SealData(TileSeal seal) {
this.dim = seal.getWorldObj().provider.dimensionId;
this.x = seal.xCoord;
this.y = seal.yCoord;
this.z = seal.zCoord;
this.orientation = seal.orientation;
this.rune = seal.runes[2];
}
public NBTTagCompound writeToNbt(NBTTagCompound nbt) {
nbt.setInteger("dim", this.dim);
nbt.setInteger("x", this.x);
nbt.setInteger("y", this.y);
nbt.setInteger("z", this.z);
nbt.setShort("orientation", this.orientation);
nbt.setByte("rune", this.rune);
return nbt;
}
public static SealData readFromNbt(NBTTagCompound nbt) {
SealData self = new SealData();
self.dim = nbt.getInteger("dim");
self.x = nbt.getInteger("x");
self.y = nbt.getInteger("y");
self.z = nbt.getInteger("z");
return self;
}
}