Search in sources :

Example 71 with NBTTagString

use of net.minecraft.nbt.NBTTagString in project EnderIO by SleepyTrousers.

the class HandleThings method store.

@Override
public boolean store(@Nonnull Registry registry, @Nonnull Set<NBTAction> phase, @Nonnull NBTTagCompound nbt, @Nonnull String name, @Nonnull Things object) throws IllegalArgumentException, IllegalAccessException, InstantiationException, NoHandlerFoundException {
    NBTTagList list = new NBTTagList();
    for (NNIterator<String> itr = object.getNameList().fastIterator(); itr.hasNext(); ) {
        list.appendTag(new NBTTagString(itr.next()));
    }
    nbt.setTag(name, list);
    return true;
}
Also used : NBTTagList(net.minecraft.nbt.NBTTagList) NBTTagString(net.minecraft.nbt.NBTTagString) NBTTagString(net.minecraft.nbt.NBTTagString)

Example 72 with NBTTagString

use of net.minecraft.nbt.NBTTagString in project ForestryMC by ForestryMC.

the class MemorizedRecipe method writeToNBT.

@Override
public NBTTagCompound writeToNBT(NBTTagCompound nbttagcompound) {
    InventoryUtil.writeToNBT(craftMatrix, nbttagcompound);
    nbttagcompound.setLong("LastUsed", lastUsed);
    nbttagcompound.setBoolean("Locked", locked);
    nbttagcompound.setInteger("SelectedRecipe", selectedRecipe);
    NBTTagList recipesNbt = new NBTTagList();
    for (IRecipe recipe : recipes) {
        ResourceLocation recipeKey = ForgeRegistries.RECIPES.getKey(recipe);
        if (recipeKey != null) {
            recipesNbt.appendTag(new NBTTagString(recipeKey.toString()));
        }
    }
    nbttagcompound.setTag("Recipes", recipesNbt);
    return nbttagcompound;
}
Also used : NBTTagList(net.minecraft.nbt.NBTTagList) IRecipe(net.minecraft.item.crafting.IRecipe) ResourceLocation(net.minecraft.util.ResourceLocation) NBTTagString(net.minecraft.nbt.NBTTagString)

Example 73 with NBTTagString

use of net.minecraft.nbt.NBTTagString in project GregTech by GregTechCE.

the class TileEntitySurfaceRock method writeToNBT.

@Override
public NBTTagCompound writeToNBT(NBTTagCompound compound) {
    super.writeToNBT(compound);
    compound.setString("Material", Material.MATERIAL_REGISTRY.getNameForObject(material));
    NBTTagList tagList = new NBTTagList();
    this.undergroundMaterials.forEach(it -> tagList.appendTag(new NBTTagString(Material.MATERIAL_REGISTRY.getNameForObject(it))));
    compound.setTag("UndergroundMaterials", tagList);
    return compound;
}
Also used : NBTTagList(net.minecraft.nbt.NBTTagList) NBTTagString(net.minecraft.nbt.NBTTagString)

Example 74 with NBTTagString

use of net.minecraft.nbt.NBTTagString in project Kingdom-Keys-Re-Coded by Wehavecookies56.

the class TabKingdomKeys method getSkulls.

public void getSkulls(List list) throws IOException {
    ItemStack WHC56skull = new ItemStack(Items.SKULL, 1, 3);
    try {
        WHC56skull.setTagCompound(new NBTTagCompound());
        WHC56skull.getTagCompound().setTag("SkullOwner", new NBTTagString("Wehavecookies56"));
        list.add(WHC56skull);
        ItemStack AAskull = new ItemStack(Items.SKULL, 1, 3);
        AAskull.setTagCompound(new NBTTagCompound());
        AAskull.getTagCompound().setTag("SkullOwner", new NBTTagString("Abelatox"));
        list.add(AAskull);
    } catch (Exception e) {
    }
}
Also used : NBTTagCompound(net.minecraft.nbt.NBTTagCompound) NBTTagString(net.minecraft.nbt.NBTTagString) ItemStack(net.minecraft.item.ItemStack) IOException(java.io.IOException)

Example 75 with NBTTagString

use of net.minecraft.nbt.NBTTagString in project RFTools by McJty.

the class MatterTransmitterTileEntity method writeRestorableToNBT.

@Override
public void writeRestorableToNBT(NBTTagCompound tagCompound) {
    super.writeRestorableToNBT(tagCompound);
    if (name != null && !name.isEmpty()) {
        tagCompound.setString("tpName", name);
    }
    if (teleportDestination != null) {
        BlockPos c = teleportDestination.getCoordinate();
        if (c != null) {
            BlockPosTools.writeToNBT(tagCompound, "dest", c);
            tagCompound.setInteger("dim", teleportDestination.getDimension());
        }
    }
    if (teleportId != null) {
        tagCompound.setInteger("destId", teleportId);
    }
    tagCompound.setBoolean("private", privateAccess);
    tagCompound.setBoolean("hideBeam", beamHidden);
    tagCompound.setBoolean("once", once);
    NBTTagList playerTagList = new NBTTagList();
    for (String player : allowedPlayers) {
        playerTagList.appendTag(new NBTTagString(player));
    }
    tagCompound.setTag("players", playerTagList);
}
Also used : NBTTagList(net.minecraft.nbt.NBTTagList) NBTTagString(net.minecraft.nbt.NBTTagString) BlockPos(net.minecraft.util.math.BlockPos) NBTTagString(net.minecraft.nbt.NBTTagString)

Aggregations

NBTTagString (net.minecraft.nbt.NBTTagString)101 NBTTagList (net.minecraft.nbt.NBTTagList)82 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)57 ItemStack (net.minecraft.item.ItemStack)18 NBTTagIntArray (net.minecraft.nbt.NBTTagIntArray)11 NBTBase (net.minecraft.nbt.NBTBase)10 NBTTagByteArray (net.minecraft.nbt.NBTTagByteArray)10 NBTTagInt (net.minecraft.nbt.NBTTagInt)10 NBTTagDouble (net.minecraft.nbt.NBTTagDouble)9 NBTTagFloat (net.minecraft.nbt.NBTTagFloat)9 NBTTagByte (net.minecraft.nbt.NBTTagByte)8 NBTTagLong (net.minecraft.nbt.NBTTagLong)8 ResourceLocation (net.minecraft.util.ResourceLocation)8 List (java.util.List)7 NBTTagShort (net.minecraft.nbt.NBTTagShort)7 ArrayList (java.util.ArrayList)5 Map (java.util.Map)5 IOException (java.io.IOException)4 HashMap (java.util.HashMap)4 Item (net.minecraft.item.Item)4