Search in sources :

Example 96 with NBTTagList

use of net.minecraft.nbt.NBTTagList in project ImmersiveEngineering by BluSunrize.

the class ItemNBTHelper method setLore.

public static void setLore(ItemStack stack, String... lore) {
    NBTTagCompound displayTag = getTagCompound(stack, "display");
    NBTTagList list = new NBTTagList();
    for (String s : lore) list.appendTag(new NBTTagString(s));
    displayTag.setTag("Lore", list);
    setTagCompound(stack, "display", displayTag);
}
Also used : NBTTagList(net.minecraft.nbt.NBTTagList) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) NBTTagString(net.minecraft.nbt.NBTTagString) NBTTagString(net.minecraft.nbt.NBTTagString)

Example 97 with NBTTagList

use of net.minecraft.nbt.NBTTagList in project ImmersiveEngineering by BluSunrize.

the class ItemInternalStorage method getContainedItems.

@Override
public ItemStack[] getContainedItems(ItemStack stack) {
    ItemStack[] stackList = new ItemStack[getInternalSlots(stack)];
    if (stack.hasTagCompound()) {
        NBTTagList inv = stack.getTagCompound().getTagList("Inv", 10);
        for (int i = 0; i < inv.tagCount(); i++) {
            NBTTagCompound tag = inv.getCompoundTagAt(i);
            int slot = tag.getByte("Slot") & 0xFF;
            if ((slot >= 0) && (slot < stackList.length))
                stackList[slot] = ItemStack.loadItemStackFromNBT(tag);
        }
    }
    return stackList;
}
Also used : NBTTagList(net.minecraft.nbt.NBTTagList) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) ItemStack(net.minecraft.item.ItemStack)

Example 98 with NBTTagList

use of net.minecraft.nbt.NBTTagList in project ImmersiveEngineering by BluSunrize.

the class TileEntityImmersiveConnectable method writeConnsToNBT.

private void writeConnsToNBT(NBTTagCompound nbt) {
    if (worldObj != null && !worldObj.isRemote && nbt != null) {
        NBTTagList connectionList = new NBTTagList();
        Set<Connection> conL = ImmersiveNetHandler.INSTANCE.getConnections(worldObj, Utils.toCC(this));
        if (conL != null)
            for (Connection con : conL) connectionList.appendTag(con.writeToNBT());
        nbt.setTag("connectionList", connectionList);
    }
}
Also used : NBTTagList(net.minecraft.nbt.NBTTagList) Connection(blusunrize.immersiveengineering.api.energy.wires.ImmersiveNetHandler.Connection)

Example 99 with NBTTagList

use of net.minecraft.nbt.NBTTagList in project ImmersiveEngineering by BluSunrize.

the class MixerRecipe method writeToNBT.

@Override
public NBTTagCompound writeToNBT(NBTTagCompound nbt) {
    nbt.setTag("fluidInput", fluidInput.writeToNBT(new NBTTagCompound()));
    if (this.itemInputs.length > 0) {
        NBTTagList list = new NBTTagList();
        for (IngredientStack add : this.itemInputs) list.appendTag(add.writeToNBT(new NBTTagCompound()));
        nbt.setTag("itemInputs", list);
    }
    return nbt;
}
Also used : NBTTagList(net.minecraft.nbt.NBTTagList) NBTTagCompound(net.minecraft.nbt.NBTTagCompound)

Example 100 with NBTTagList

use of net.minecraft.nbt.NBTTagList in project ImmersiveEngineering by BluSunrize.

the class TileEntityImmersiveConnectable method loadConnsFromNBT.

private void loadConnsFromNBT(NBTTagCompound nbt) {
    if (worldObj != null && worldObj.isRemote && !Minecraft.getMinecraft().isSingleplayer() && nbt != null) {
        NBTTagList connectionList = nbt.getTagList("connectionList", 10);
        ImmersiveNetHandler.INSTANCE.clearConnectionsOriginatingFrom(Utils.toCC(this), worldObj);
        for (int i = 0; i < connectionList.tagCount(); i++) {
            NBTTagCompound conTag = connectionList.getCompoundTagAt(i);
            Connection con = Connection.readFromNBT(conTag);
            if (con != null) {
                ImmersiveNetHandler.INSTANCE.addConnection(worldObj, Utils.toCC(this), con);
            } else
                IELogger.error("CLIENT read connection as null");
        }
    }
}
Also used : NBTTagList(net.minecraft.nbt.NBTTagList) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) Connection(blusunrize.immersiveengineering.api.energy.wires.ImmersiveNetHandler.Connection)

Aggregations

NBTTagList (net.minecraft.nbt.NBTTagList)451 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)385 ItemStack (net.minecraft.item.ItemStack)69 NBTTagString (net.minecraft.nbt.NBTTagString)42 BlockPos (net.minecraft.util.math.BlockPos)18 HashMap (java.util.HashMap)17 Map (java.util.Map)17 NotNull (org.jetbrains.annotations.NotNull)17 ArrayList (java.util.ArrayList)14 AMVector3 (am2.api.math.AMVector3)9 ChunkPosition (net.minecraft.world.ChunkPosition)9 NBTBase (net.minecraft.nbt.NBTBase)8 EntityPlayer (net.minecraft.entity.player.EntityPlayer)7 Vec3d (net.minecraft.util.math.Vec3d)7 WorldCoordinate (mods.railcraft.api.core.WorldCoordinate)6 Block (net.minecraft.block.Block)6 ItemIdentifierStack (logisticspipes.utils.item.ItemIdentifierStack)5 Entity (net.minecraft.entity.Entity)5 TileEntity (net.minecraft.tileentity.TileEntity)5 ChunkPos (net.minecraft.util.math.ChunkPos)5