use of net.minecraft.nbt.NBTTagList in project PneumaticCraft by MineMaarten.
the class TileEntityAssemblyPlatform method writeToNBT.
@Override
public void writeToNBT(NBTTagCompound tag) {
super.writeToNBT(tag);
tag.setBoolean("clawClosing", shouldClawClose);
tag.setFloat("clawProgress", clawProgress);
tag.setFloat("speed", speed);
tag.setBoolean("drilled", hasDrilledStack);
tag.setBoolean("lasered", hasLaseredStack);
// Write the ItemStacks in the inventory to NBT
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);
}
use of net.minecraft.nbt.NBTTagList in project PneumaticCraft by MineMaarten.
the class TileEntityBase method writeInventoryToNBT.
public static void writeInventoryToNBT(NBTTagCompound tag, ItemStack[] stacks, String tagName) {
NBTTagList tagList = new NBTTagList();
for (int i = 0; i < stacks.length; i++) {
if (stacks[i] != null) {
NBTTagCompound itemTag = new NBTTagCompound();
stacks[i].writeToNBT(itemTag);
itemTag.setByte("Slot", (byte) i);
tagList.appendTag(itemTag);
}
}
tag.setTag(tagName, tagList);
}
use of net.minecraft.nbt.NBTTagList in project PneumaticCraft by MineMaarten.
the class TileEntityProgrammableController method writeToNBT.
@Override
public void writeToNBT(NBTTagCompound tag) {
super.writeToNBT(tag);
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);
NBTTagCompound tankTag = new NBTTagCompound();
tank.writeToNBT(tankTag);
tag.setTag("tank", tankTag);
NBTTagList droneItems = new NBTTagList();
for (int currentIndex = 0; currentIndex < getDroneSlots(); ++currentIndex) {
if (getFakePlayer().inventory.getStackInSlot(currentIndex) != null) {
NBTTagCompound tagCompound = new NBTTagCompound();
tagCompound.setByte("Slot", (byte) currentIndex);
getFakePlayer().inventory.getStackInSlot(currentIndex).writeToNBT(tagCompound);
droneItems.appendTag(tagCompound);
}
}
tag.setTag("droneItems", droneItems);
NBTTagList extendedList = new NBTTagList();
for (Map.Entry<String, IExtendedEntityProperties> entry : properties.entrySet()) {
NBTTagCompound propertyTag = new NBTTagCompound();
propertyTag.setString("key", entry.getKey());
entry.getValue().saveNBTData(propertyTag);
extendedList.appendTag(propertyTag);
}
tag.setTag("extendedProperties", extendedList);
}
use of net.minecraft.nbt.NBTTagList in project PneumaticCraft by MineMaarten.
the class TileEntityProgrammer method setWidgetsToNBT.
public static void setWidgetsToNBT(List<IProgWidget> widgets, NBTTagCompound tag) {
NBTTagList widgetTags = new NBTTagList();
for (IProgWidget widget : widgets) {
NBTTagCompound widgetTag = new NBTTagCompound();
widget.writeToNBT(widgetTag);
widgetTags.appendTag(widgetTag);
}
tag.setTag("widgets", widgetTags);
}
use of net.minecraft.nbt.NBTTagList in project PneumaticCraft by MineMaarten.
the class TileEntityPressureChamberValve method writeToNBT.
@Override
public void writeToNBT(NBTTagCompound tag) {
super.writeToNBT(tag);
tag.setInteger("multiBlockX", multiBlockX);
tag.setInteger("multiBlockY", multiBlockY);
tag.setInteger("multiBlockZ", multiBlockZ);
tag.setInteger("multiBlockSize", multiBlockSize);
tag.setBoolean("sufPressure", isSufficientPressureInChamber);
tag.setBoolean("validRecipe", isValidRecipeInChamber);
tag.setFloat("recipePressure", recipePressure);
// Write the ItemStacks in the inventory to NBT
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);
// Write the accessory valve to NBT
NBTTagList tagList2 = new NBTTagList();
for (TileEntityPressureChamberValve valve : accessoryValves) {
NBTTagCompound tagCompound = new NBTTagCompound();
tagCompound.setInteger("xCoord", valve.xCoord);
tagCompound.setInteger("yCoord", valve.yCoord);
tagCompound.setInteger("zCoord", valve.zCoord);
tagList2.appendTag(tagCompound);
}
tag.setTag("Valves", tagList2);
}
Aggregations