use of net.minecraft.nbt.NBTTagCompound in project BluePower by Qmunity.
the class TileDeployer method writeToNBT.
/**
* This function gets called whenever the world/chunk is saved
*/
@Override
public void writeToNBT(NBTTagCompound tCompound) {
super.writeToNBT(tCompound);
for (int i = 0; i < 9; i++) {
if (inventory[i] != null) {
NBTTagCompound tc = new NBTTagCompound();
inventory[i].writeToNBT(tc);
tCompound.setTag("inventory" + i, tc);
}
}
}
use of net.minecraft.nbt.NBTTagCompound in project BluePower by Qmunity.
the class TileEjector method writeToNBT.
/**
* This function gets called whenever the world/chunk is saved
*/
@Override
public void writeToNBT(NBTTagCompound tCompound) {
super.writeToNBT(tCompound);
for (int i = 0; i < 9; i++) {
if (inventory[i] != null) {
NBTTagCompound tc = new NBTTagCompound();
inventory[i].writeToNBT(tc);
tCompound.setTag("inventory" + i, tc);
}
}
}
use of net.minecraft.nbt.NBTTagCompound in project BluePower by Qmunity.
the class TileFilter method writeToNBT.
/**
* This function gets called whenever the world/chunk is saved
*/
@Override
public void writeToNBT(NBTTagCompound tCompound) {
super.writeToNBT(tCompound);
for (int i = 0; i < 9; i++) {
if (inventory[i] != null) {
NBTTagCompound tc = new NBTTagCompound();
inventory[i].writeToNBT(tc);
tCompound.setTag("inventory" + i, tc);
}
}
tCompound.setByte("filterColor", (byte) filterColor.ordinal());
tCompound.setByte("fuzzySetting", (byte) fuzzySetting);
}
use of net.minecraft.nbt.NBTTagCompound in project BluePower by Qmunity.
the class TileFilter method readFromNBT.
/**
* This function gets called whenever the world/chunk loads
*/
@Override
public void readFromNBT(NBTTagCompound tCompound) {
super.readFromNBT(tCompound);
for (int i = 0; i < 9; i++) {
NBTTagCompound tc = tCompound.getCompoundTag("inventory" + i);
inventory[i] = ItemStack.loadItemStackFromNBT(tc);
}
filterColor = TubeColor.values()[tCompound.getByte("filterColor")];
fuzzySetting = tCompound.getByte("fuzzySetting");
}
use of net.minecraft.nbt.NBTTagCompound in project BluePower by Qmunity.
the class TileSortingMachine method writeToNBT.
@Override
public void writeToNBT(NBTTagCompound tag) {
super.writeToNBT(tag);
tag.setByte("pullMode", (byte) pullMode.ordinal());
tag.setByte("sortMode", (byte) sortMode.ordinal());
tag.setInteger("savedPulses", savedPulses);
int[] colorArray = new int[colors.length];
for (int i = 0; i < colorArray.length; i++) {
colorArray[i] = colors[i].ordinal();
}
tag.setIntArray("colors", colorArray);
tag.setIntArray("fuzzySettings", fuzzySettings);
NBTTagList tagList = new NBTTagList();
for (int currentIndex = 0; currentIndex < inventory.length; ++currentIndex) {
if (inventory[currentIndex] != null) {
NBTTagCompound tagCompound = new NBTTagCompound();
tagCompound.setByte("Slot", (byte) currentIndex);
inventory[currentIndex].writeToNBT(tagCompound);
tagList.appendTag(tagCompound);
}
}
tag.setTag("Items", tagList);
}
Aggregations