Search in sources :

Example 36 with NBTTagCompound

use of net.minecraft.nbt.NBTTagCompound in project BluePower by Qmunity.

the class TileCircuitTable 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);
    tag.setString("textboxString", textboxString);
}
Also used : NBTTagList(net.minecraft.nbt.NBTTagList) NBTTagCompound(net.minecraft.nbt.NBTTagCompound)

Example 37 with NBTTagCompound

use of net.minecraft.nbt.NBTTagCompound in project BluePower by Qmunity.

the class TileRegulator method writeToNBT.

@Override
public void writeToNBT(NBTTagCompound tag) {
    super.writeToNBT(tag);
    tag.setByte("filterColor", (byte) color.ordinal());
    tag.setByte("mode", (byte) mode);
    tag.setByte("fuzzySetting", (byte) fuzzySetting);
    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);
}
Also used : NBTTagList(net.minecraft.nbt.NBTTagList) NBTTagCompound(net.minecraft.nbt.NBTTagCompound)

Example 38 with NBTTagCompound

use of net.minecraft.nbt.NBTTagCompound in project BluePower by Qmunity.

the class TileProjectTable 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);
    tagList = new NBTTagList();
    for (int currentIndex = 0; currentIndex < craftingGrid.length; ++currentIndex) {
        if (craftingGrid[currentIndex] != null) {
            NBTTagCompound tagCompound = new NBTTagCompound();
            tagCompound.setByte("Slot", (byte) currentIndex);
            craftingGrid[currentIndex].writeToNBT(tagCompound);
            tagList.appendTag(tagCompound);
        }
    }
    tag.setTag("CraftingGrid", tagList);
}
Also used : NBTTagList(net.minecraft.nbt.NBTTagList) NBTTagCompound(net.minecraft.nbt.NBTTagCompound)

Example 39 with NBTTagCompound

use of net.minecraft.nbt.NBTTagCompound in project BluePower by Qmunity.

the class TileRelay 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);
    }
}
Also used : NBTTagCompound(net.minecraft.nbt.NBTTagCompound)

Example 40 with NBTTagCompound

use of net.minecraft.nbt.NBTTagCompound in project BluePower by Qmunity.

the class TileRelay 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);
        }
    }
}
Also used : NBTTagCompound(net.minecraft.nbt.NBTTagCompound)

Aggregations

NBTTagCompound (net.minecraft.nbt.NBTTagCompound)3985 NBTTagList (net.minecraft.nbt.NBTTagList)1052 ItemStack (net.minecraft.item.ItemStack)883 BlockPos (net.minecraft.util.math.BlockPos)229 TileEntity (net.minecraft.tileentity.TileEntity)173 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)148 ArrayList (java.util.ArrayList)99 Block (net.minecraft.block.Block)98 ResourceLocation (net.minecraft.util.ResourceLocation)96 IBlockState (net.minecraft.block.state.IBlockState)92 EntityPlayer (net.minecraft.entity.player.EntityPlayer)81 NBTTagString (net.minecraft.nbt.NBTTagString)79 Nonnull (javax.annotation.Nonnull)74 Map (java.util.Map)71 UUID (java.util.UUID)69 NBTBase (net.minecraft.nbt.NBTBase)66 HashMap (java.util.HashMap)64 EnumFacing (net.minecraft.util.EnumFacing)61 NotNull (org.jetbrains.annotations.NotNull)60 Item (net.minecraft.item.Item)55