use of net.minecraft.nbt.NBTTagList in project PneumaticCraft by MineMaarten.
the class TileEntityPressureChamberValve method readFromNBT.
// NBT methods-----------------------------------------------
@Override
public void readFromNBT(NBTTagCompound tag) {
super.readFromNBT(tag);
multiBlockX = tag.getInteger("multiBlockX");
multiBlockY = tag.getInteger("multiBlockY");
multiBlockZ = tag.getInteger("multiBlockZ");
multiBlockSize = tag.getInteger("multiBlockSize");
isSufficientPressureInChamber = tag.getBoolean("sufPressure");
isValidRecipeInChamber = tag.getBoolean("validRecipe");
recipePressure = tag.getFloat("recipePressure");
// Read in the ItemStacks in the inventory from NBT
NBTTagList tagList = tag.getTagList("Items", 10);
inventory = new ItemStack[getSizeInventory()];
for (int i = 0; i < tagList.tagCount(); ++i) {
NBTTagCompound tagCompound = tagList.getCompoundTagAt(i);
byte slot = tagCompound.getByte("Slot");
if (slot >= 0 && slot < inventory.length) {
inventory[slot] = ItemStack.loadItemStackFromNBT(tagCompound);
}
}
// Read in the accessory valves from NBT
NBTTagList tagList2 = tag.getTagList("Valves", 10);
nbtValveList.clear();
for (int i = 0; i < tagList2.tagCount(); ++i) {
NBTTagCompound tagCompound = tagList2.getCompoundTagAt(i);
if (tagCompound != null) {
nbtValveList.add(new int[] { tagCompound.getInteger("xCoord"), tagCompound.getInteger("yCoord"), tagCompound.getInteger("zCoord") });
}
}
readNBT = true;
}
use of net.minecraft.nbt.NBTTagList in project PneumaticCraft by MineMaarten.
the class TileEntityPressureTube method readFromPacket.
@Override
public void readFromPacket(NBTTagCompound tag) {
super.readFromPacket(tag);
modules = new TubeModule[6];
NBTTagList moduleList = tag.getTagList("modules", 10);
for (int i = 0; i < moduleList.tagCount(); i++) {
NBTTagCompound moduleTag = moduleList.getCompoundTagAt(i);
TubeModule module = ModuleRegistrator.getModule(moduleTag.getString("type"));
module.readFromNBT(moduleTag);
setModule(module, ForgeDirection.getOrientation(moduleTag.getInteger("side")));
}
if (worldObj != null && worldObj.isRemote) {
rerenderChunk();
}
}
use of net.minecraft.nbt.NBTTagList in project PneumaticCraft by MineMaarten.
the class TileEntitySecurityStation method writeToPacket.
@Override
public void writeToPacket(NBTTagCompound tag) {
super.writeToPacket(tag);
NBTTagList sharedList = new NBTTagList();
for (int i = 0; i < sharedUsers.size(); i++) {
NBTTagCompound tagCompound = new NBTTagCompound();
tagCompound.setString("name", sharedUsers.get(i).getName());
if (sharedUsers.get(i).getId() != null)
tagCompound.setString("uuid", sharedUsers.get(i).getId().toString());
sharedList.appendTag(tagCompound);
}
tag.setTag("SharedUsers", sharedList);
NBTTagList hackedList = new NBTTagList();
for (int i = 0; i < hackedUsers.size(); i++) {
NBTTagCompound tagCompound = new NBTTagCompound();
tagCompound.setString("name", hackedUsers.get(i).getName());
if (hackedUsers.get(i).getId() != null)
tagCompound.setString("uuid", hackedUsers.get(i).getId().toString());
hackedList.appendTag(tagCompound);
}
tag.setTag("HackedUsers", hackedList);
}
use of net.minecraft.nbt.NBTTagList in project PneumaticCraft by MineMaarten.
the class TileEntitySecurityStation method readFromNBT.
@Override
public void readFromNBT(NBTTagCompound tag) {
super.readFromNBT(tag);
redstoneMode = tag.getInteger("redstoneMode");
rebootTimer = tag.getInteger("startupTimer");
// Read in the ItemStacks in the inventory from NBT
NBTTagList tagList = tag.getTagList("Items", 10);
inventory = new ItemStack[getSizeInventory()];
for (int i = 0; i < tagList.tagCount(); ++i) {
NBTTagCompound tagCompound = tagList.getCompoundTagAt(i);
byte slot = tagCompound.getByte("Slot");
if (slot >= 0 && slot < inventory.length) {
inventory[slot] = ItemStack.loadItemStackFromNBT(tagCompound);
}
}
checkForNetworkValidity();
}
use of net.minecraft.nbt.NBTTagList in project PneumaticCraft by MineMaarten.
the class TileEntityUVLightBox method readFromNBT.
@Override
public void readFromNBT(NBTTagCompound nbt) {
super.readFromNBT(nbt);
redstoneMode = nbt.getInteger("redstoneMode");
// Read in the ItemStacks in the inventory from NBT
NBTTagList tagList = nbt.getTagList("Items", 10);
inventory = new ItemStack[getSizeInventory()];
for (int i = 0; i < tagList.tagCount(); ++i) {
NBTTagCompound tagCompound = tagList.getCompoundTagAt(i);
byte slot = tagCompound.getByte("Slot");
if (slot >= 0 && slot < inventory.length) {
inventory[slot] = ItemStack.loadItemStackFromNBT(tagCompound);
}
}
// if(worldObj.isRemote) System.out.println("reading from NBT, got a packet?");
}
Aggregations